Commit Graph
126 Commits
Author SHA1 Message Date
Reinier Zwitserloot 4bf64a0346 A start on the installer. 2009-07-03 16:02:37 +02:00
Reinier Zwitserloot cf594564be Fine-tuning eclipse's error reporting found some minor issues and even 1 bug that would show up rarely or not at all. 2009-07-03 16:01:14 +02:00
Reinier Zwitserloot c3e4ed5d78 [DOC] 2009-07-02 00:27:22 +02:00
Reinier Zwitserloot 17d81608db Added @SneakyThrows support for javac. W00t. 2009-07-01 22:36:50 +02:00
Reinier Zwitserloot d174201c7f [TRIVIAL] 2009-07-01 22:36:35 +02:00
Reinier Zwitserloot 99d9728ede Support for @SneakyThrows in eclipse. 2009-07-01 22:09:40 +02:00
Reinier Zwitserloot efe3931cf3 Added ability to @Synchronized to explicitly name the lock object.
Spruced up @Cleanup's position settings and also forced initialization, because the error appears in a screwed up place if you don't, and we can't seem to move it.
2009-07-01 20:16:26 +02:00
Reinier Zwitserloot 194c990f64 Added @Synchronized support to javac. Seems to work well. 2009-07-01 17:21:53 +02:00
Reinier Zwitserloot 34780e3ab5 Added a bonus feature to @Cleanup: Assigning a @Cleanup marked variable to anything else generates a warning. 2009-07-01 15:58:24 +02:00
Reinier Zwitserloot db4819183f @Synchronization support for eclipse! Seems to work fine, just need to write the same thing for javac. 2009-07-01 03:38:03 +02:00
Reinier Zwitserloot 43992ff596 Pretty big fix for reparse() - now uses rebuild(), which also received a pretty big fix in making the loop detection algorithm far more robust. Still not sure what was the problem, but the robustificationization helped. 2009-07-01 03:36:52 +02:00
Reinier Zwitserloot 23ba6c2628 Added HandleCleanup support for javac, and fixed a bug in AST.java which caused nested @Cleanup annotations to simply be ignored (rebuild was broken).
HandleCleanup seems to work swimmingly now on both targets. yay!
2009-07-01 00:26:19 +02:00
Reinier Zwitserloot 008bca2045 Saved the previous extensive commit message for posterity in TODO.txt 2009-06-30 18:37:50 +02:00
Reinier Zwitserloot 37006cb295 After a great many iterations, Cleanup has now been reduced in functionality (exceptions from the cleanup call WILL mask exceptions from the body - this isn't intended, but it's just not possible to fix this without java 7 features or requiring a rewrite of the class file data.
Tried tactics, and why they won't work:

 - Replace every 'return', 'break', and 'continue' statement (for the latter 2, only if they break/continue out of the try block) with a block that first sets a uniquely named flag before doing the operation.
   Then, check that flag in the finally block to see if the cleanup call should be guarded by a try/catchThrowable. This doesn't work, because its not possible to instrument the 4th way out of a try block without throwing an exception: Just letting it run its course. Tossing a "#flag = true;" at the end may cause a compile time error if the code is not reachable, but figuring that out requires resolution and quite a bit of analysis.

 - Put catch blocks in for all relevant exceptions (RuntimeException, Error, all exceptions declared as thrown by the method, and all types of exceptions of the catch blocks of encapsulating try blocks.
   This doesn't work, partly because it'll fail for sneakily thrown exceptions, but mostly because you can't just catch an exception listed in the 'throws' clause of the method body; catching an exception
   that no statement in the try block can throw is a compile time error, but it is perfectly allright to declare these as 'thrown'.

 - Put in a blanket catch Throwable to set the flag. Two problems with this:
   First, sneaky throw can't be done. Thread.stop invokes a security manager and triggers a warning, Calling a sneakyThrow method creates a runtime dependency on lombok, constructing a sneakyThrow in-class creates visible methods or at least visible class files, and creating a new class via Class.loadClass would be very slow without caching - which gets you the same issues.
   Secondly, this would mean that any statements in the try body that throw an exception aren't flagged to the user as needing to be handled.

The Cleanup annotation now also calls the cleanup method for you, and will call it at the END of the current scope. The following plans have been tried and abandoned:

 - Cleanup right after the final mention. This doesn't work, because the final mention may not be the final use-place. Example:
   @Cleanup InputStream in = new FileInputStream(someFile);
   InputStreamReader reader = new InputStreamReader(in);
   reader.read(); //oops - in is already closed by now.

 - Require an explicit var.cleanup() call and consider that the cue to close off the try block.
   This doesn't work either, because now variables set in between the @Cleanup declaration and the var.cleanup() call become invisible to following statements. Example:
   @Cleanup InputStream in = new FileInputStream(someFile);
   int i = in.read();
   in.close();
   System.out.println(i); //fail - i is inside the generated try block but this isn't, so 'i' is not visible from here.

By running to the end of visible scope, all these problems are avoided. This does remove the flexibility of declaring where you want a close call to be executed, but there are two mitigating factors available:

 1) Create an explicit scope block. You can just stick { code } in any place where you can legally write a statement, in java. This is relatively unknown, so I expect most users will go for:

 2) Just call close explicitly. I've yet to see a cleanup method which isn't idempotent anyway (calling it multiple times is no different than calling it once).

During the course of investigating these options, the AST code has been extended to support live replacement of any child node, including updating the actual underlying system AST as well as our own.
Unfortunately, this code has NOT been tested. It was rather a lot of work so I'm leaving it in, and at least for eclipse it even seemed to work.
2009-06-30 18:22:38 +02:00
Reinier Zwitserloot e0b623a3b8 Removed a debug print. 2009-06-28 06:06:52 +02:00
Reinier Zwitserloot d4556f8539 All lombok code is now targeted at java 1.5, except for the javac-specific stuff, which is on 1.6. 2009-06-28 06:04:08 +02:00
Reinier Zwitserloot 69844725fb Preparating for java 1.5-ification. All stuff that isn't specific to javac should run in java 1.5, so that an eclipse started on a 1.5 JVM will still run lombok. 2009-06-28 05:58:18 +02:00
Reinier Zwitserloot 19f1b26593 Rolled our own ServiceLoader, because its not part of java 1.5. 2009-06-28 05:50:51 +02:00
Reinier Zwitserloot dc7d0cacf5 AptProblem is not available when eclipse is run on java 1.5, and AptProblem is not neccessarily the proper target anyway. Rolled our own DefaultProblem subclass for problem reporting. 2009-06-28 05:45:08 +02:00
Reinier Zwitserloot cd866b852c Stuck some links for the foss licence in the todo list. 2009-06-28 05:44:23 +02:00
Reinier Zwitserloot 71f67e1f65 Added rebuild support to AST.Node. 2009-06-28 05:44:11 +02:00
Reinier Zwitserloot b4cab3f65c [IMPROVEMENT]
Eclipse will now also hold off on running @PrintAST handlers until the very end. Simple generators such as @Getter didn't need this, because PrintAST's handler will hold off until eclipse does a full parse,
but when changing the innards of methods, you would likely not see what you did. Fixed that.

Also, PrintAST has an option to, instead of diving into the ASTNodes of bodies (methods, initializers, etc), to just render the java code, to see if the AST creation/rewriting you've been doing looks like the java code you intended.
2009-06-27 04:00:12 +02:00
Reinier Zwitserloot b9714eae8c [BUGFIX] Pretty major bug - due to a typo, ALL values for annotation methods were set to the value of the last annotation method. e.g in:
@Foo(bar=10), ALL methods in the Foo annotation were presumed to be listed, and set to 10. This was obviously causing problems. Fixed it.
2009-06-27 03:57:51 +02:00
Reinier Zwitserloot c4611d669d [BUGFIX] For some reason, JCLiteral objects contain '1' or '0' (integers) for booleans, not actual booleans. You can tell the difference via the getKind() method. hence, boolean fields in annotations
were throwing unexpected type errors (Integer instead of Boolean). Fixed this.
2009-06-27 03:56:33 +02:00
Reinier Zwitserloot 18931bec53 [TRIVIAL] Added a toString to AnnotationValue, used to debug something, but useful enough to leave in there. 2009-06-27 03:52:31 +02:00
Reinier Zwitserloot 4bddd821d2 Whoops - there was some debug printing left in eclipse's HandleGetter 2009-06-27 03:10:43 +02:00
Reinier Zwitserloot 157bbba3ac Added a caching mechanism to AnnotationValues, for instantiating the annotation. 2009-06-27 03:10:04 +02:00
Reinier Zwitserloot 47bd3e3c06 Added some bugs that we need to fix. 2009-06-26 05:34:55 +02:00
Reinier Zwitserloot cea4c9bb04 Cleanup implemented for eclipse!
There's one serious problem though: The cleanup routine modifies the eclipse internal AST, but doesn't update our bi-directional AST. Thus, or example, having a @Cleanup annotation inside the scope
of another @Cleanup fails, because the application of the second one climbs up to the wrong block level (the original block level instead of newly built try block).
2009-06-26 04:56:40 +02:00
Reinier Zwitserloot 91cd698b1e Added a readme. 2009-06-25 06:29:21 +02:00
Reinier Zwitserloot 84e40cd4e3 Bumped version from 0.3.0 to 0.3.5 in celebration of finishing all 3 generating annotations for both javac and eclipse (@Getter, @Setter, and @Data). 2009-06-25 06:20:51 +02:00
Reinier Zwitserloot 76135a9fb7 Added support for generating toString to javac's HandleData. Now javac's HandleData is COMPLETE! w00t! 2009-06-25 06:18:44 +02:00
Reinier Zwitserloot 29c610af18 Added generating hashCode() to javac's HandleData. 2009-06-25 06:05:11 +02:00
Reinier Zwitserloot 9d7e12d96c trivial 2009-06-25 06:05:07 +02:00
Reinier Zwitserloot 19fec30bc1 javac's HandleData now makes equals methods. 2009-06-25 05:34:01 +02:00
Reinier Zwitserloot dec4be3738 Removed adding the statement: 'final int PRIME = 31;' in the HandleData's createHashCode method when there are 0 fields in the type (it would generate a local variable never used warning!) 2009-06-25 05:33:04 +02:00
Reinier Zwitserloot 63894b98dd Heh, on errors you'd never actually see any message, just the exception type. Whoops. 2009-06-25 05:24:42 +02:00
Reinier Zwitserloot bcee5a50db javac's HandleData now generates the constructor only if it doesn't already exist, and the staticConstructor is now also completed. Left: toString, hashCode, equals. 2009-06-24 07:01:52 +02:00
Reinier Zwitserloot 6d42559417 Work on HandleData, as well as generalizing features in the the PKG class and updating HandleGetter/Setter to call into it. 2009-06-24 01:23:10 +02:00
Reinier Zwitserloot c346b5c054 Added printing for a constructor if it is the default (generated) constructor or not. 2009-06-24 01:22:53 +02:00
Reinier Zwitserloot 99a38d4d08 Added proper support for changing the AST as its being visited, both removal and addition. The rule is now: children traversal traverses through the tree mostly as it was when it started. 2009-06-24 01:22:08 +02:00
Reinier Zwitserloot c834e09af4 Useful script while developing on the javac part of lombok. 2009-06-24 01:21:21 +02:00
Reinier Zwitserloot 7191aa78bd fixed a bug where the auto-generated constructors (actual or static) would throw eclipse errors if you had 0 non-static fields. 2009-06-23 23:52:34 +02:00
Reinier Zwitserloot 2ebb040c81 HandleData for eclipse now seems to work 100%. Also updated toString to use deepToString, and added @Override in case people have warnings for missing @Override annotations on. 2009-06-23 23:33:12 +02:00
Reinier Zwitserloot 6210df32d0 @Data's generation of the equals() method now works! 2009-06-23 21:58:04 +02:00
Reinier Zwitserloot d27fd01b2b Doc 2009-06-23 20:20:07 +02:00
Reinier Zwitserloot e85ef24b4d Fixed some bugs in copyType(), and now the static constructor is generated without any raw generics warnings - it is effectively done. 2009-06-23 19:13:03 +02:00
Reinier Zwitserloot 8bbdcec6fa Figured out that our previous act of just assigning TypeReference objects directly to other nodes (e.g. from a FieldDeclaration's type to a method argument) is NOT a good idea, as this screws up when
the TypeReference object represents a generic type (like 'T') - each instance of a generic type has a different resolution, but 1 TypeReference object can only hold 1 resolution.

Thus, a copyType() method has been written, and the Handle* classes have been updated to use it.

Also, generateEquals() is half-finished in HandleData.
2009-06-23 08:04:44 +02:00
Reinier Zwitserloot 6c82a3c780 This is a 3-day bughunt that ended up being something extremely simple:
** DO NOT REUSE TYPEREFERENCE OBJECTS **

because that makes the binding process go pearshaped - after hte first run, that TypeReference object's binding parameter is set, and as its set, the resolver won't bother re-resolving it.

However, each parse run starts with new scope objects, and any 2 bindings created by different scopes aren't equal to each other. urrrrrrgh!

Fortunately, a lot of code that 'fixed' methods by adding bindings and scope have all been removed, as the parser patch point is well before these bindings are created. Thus:

** NEVER CREATE YOUR OWN BINDINGS AND SCOPE OBJECTS **

because if it comes down to that, you're doing it entirely wrong. That's eclipse's job. We're patching where we are so you don't have to do this.
2009-06-23 06:01:13 +02:00
Reinier Zwitserloot 4ee8e7a3d2 Put the actual numeric value of ASTNode.Bit24 in a comment, but it was missing a 0! 2009-06-23 06:00:57 +02:00