Commit Graph
96 Commits
Author SHA1 Message Date
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
Reinier Zwitserloot 794801c3c9 Removed the equalsPrime thing, because that's just needlessly putting implementation details in there. If switching primes is so important, hash the type name and turn that into a prime, or something.
Also added some javadoc.
2009-06-23 05:56:00 +02:00
Reinier Zwitserloot fdde039d23 More work on the HandleData annotation. Constructor seems to work fine, static constructor not so much. 2009-06-21 18:17:03 +02:00
Reinier Zwitserloot a27c48dd5c trivial 2009-06-21 18:16:55 +02:00
Reinier Zwitserloot b8d9c9ed97 Bug fix: using string literals in any lombok annotation value would blow up that processor. 2009-06-21 18:16:18 +02:00
Reinier Zwitserloot 255bd59071 Due to a java bug, constants in enums don't work, so instead the default access level for @Getter and @Setter have now just been hardcoded in GetterHandler and SetterHandler.
Added ability to look up the Node object for any given AST object on Node itself, as you don't usually have the AST object.

Added toString() method generating to @Data, and this required some fancy footwork in finding if we've already generated methods, and editing a generated method to fill in binding and type resolutions. HandleGetter and HandleSetter have been updated to use these features.

Exceptions caused by lombok handlers show up in the eclipse error log, but now, if they are related to a CompilationUnit, also as a problem (error) on the CUD - those error log entries are easy to miss!

Our ASTs can now be appended to. When you generate a new AST node, you should add it to the AST, obviously. Getter/Setter have been updated to use this.
2009-06-21 00:10:58 +02:00
Reinier Zwitserloot 2e8e43a12e Runs eclipse on a mac. 2009-06-20 23:29:47 +02:00
Reinier Zwitserloot ff306fa5d9 Added initial support for the @Data annotation. Currently produces getters and setters only,
not yet a constructor, toString, hashCode, or equals.

HandleGetter and HandleSetter have been updated to handle static (theoretic; you can't put annotations on static fields normally).

You can now make AnnotationValue objects using just an annotationNode and a target type, as well as check if a given annotationNode is likely to represent a target annotation type. This is in Javac and Eclipse classes.

HandleGetter and HandleSetter can now be asked to make a getter/setter, and will grab access level off of a Getter/Setter annotation, if present.
2009-06-19 16:24:10 +02:00
Reinier Zwitserloot e56ab6c245 Added info on the addNetbeans branch. 2009-06-19 04:48:23 +02:00
Reinier Zwitserloot b964ec18fc Finding lombok.jar would fail if you had any spaces in the path. Fixed that. 2009-06-19 04:32:47 +02:00
Reinier Zwitserloot 7f7cdfc3fc Moved ClassLoaderWorkaround from 'java.lombok' to 'java.lombok.eclipse' as its clearly eclipse-specific. 2009-06-19 03:42:15 +02:00
Reinier Zwitserloot 8b6b821918 Live reloading of the eclipse parser classes is technically supported by the agent though I never tested it. I found a bug while browsing this code. fixed it. 2009-06-19 03:27:56 +02:00
Reinier Zwitserloot 00452d0e95 Renamed EclipseParserPatcher to EclipsePatcher, as it patches not just the parser, but also the CompilationUnitDeclaration class so we can store our AST in it for caching purposes. 2009-06-19 03:24:44 +02:00
Reinier Zwitserloot 7bbf7789f8 List of stuff we still need to do as well as research notes on how to get there. 2009-06-19 03:24:17 +02:00
Reinier Zwitserloot 0bb66dd93d Created a fully working HandleSetter for eclipse, and refactored HandleGetter a little mostly to stuff common code into PKG. 2009-06-18 01:37:06 +02:00
Reinier Zwitserloot 6254337948 Expanded the AST printers to support a target PrintStream, and expanded the @PrintAST annotation to let you supply an optional filename. Useful particularly for IDEs, which don't usually have a viewable console.
Also renamed the printers to just 'Printer', as they are already inner classes of a specifically named type (JavacASTVisitor & co).
2009-06-18 01:17:03 +02:00
Reinier Zwitserloot eca3cd7ccc AnnotationHandlers can now return a boolean to set if they actually handled the annotation or not (previously, the presumption was they always handled the annotation).
This is very useful for PrintAST on eclipse, because before this change, you'd never see method contents (as the initial dietParse would come first). Now Eclipse PrintASTHandler

will skip any non-full runs, and only print non-diet. It then returns true only if it printed.
2009-06-17 21:57:54 +02:00
Reinier Zwitserloot 8fa5005444 Added 'does setX/getX already exist' check to javac's HandleGetter/Setter. If they exist (with any returntype/paramlist), no getter/setter is generated, and instead a warning is added on the annotation. 2009-06-17 21:35:51 +02:00
Reinier Zwitserloot 1929a28c9d Added the SetterHandler for javac. Also added a way to get the SymbolTable on a JavacAST.Node, because you need it to e.g. access constant types like 'void'. 2009-06-17 21:27:27 +02:00
Reinier Zwitserloot 7c65e0fdff Made the printing of Statements for @PrintAST slightly more useful (if a lot more verbose), and bumped the version number in honour of quite a bit of redesign these past few commits. 2009-06-17 20:59:15 +02:00
Reinier Zwitserloot 8aae52a992 A useful annotation that prints the AST of any annotated element via the XASTPrinters in each ASTVisitor interface. 2009-06-17 20:54:54 +02:00
Reinier Zwitserloot 5bdfa539f2 Just renamed some parameters to more sensical names. 2009-06-17 20:54:25 +02:00
Reinier Zwitserloot 981e7db354 A bugfix to the visitMethodArgument method, and printing improved by printing the raw (instead of resolved) types for fields etc, because usually they aren't resolved yet. 2009-06-17 20:53:29 +02:00
Reinier Zwitserloot 57a5786734 Moved the traverse() from Eclipse/JavacAST to Eclipse/JavacAST.Node, so that you can start your traversal at any point, not just from the top.
Also a bugfix for endVisitStatement which passed the wrong node, and method arguments in Javac are no longer misfiled as local declarations.
2009-06-17 20:52:36 +02:00
Reinier Zwitserloot 1d85326769 No retention at all seems much smarter, because then it wouldn't be neccessary to have the lombok.jar in the deployment path of whatever you write WITH lombok, which is a good idea.
Though - rewriting to e.g. a Lombok.sneakyThrow() call would require lombok.jar anyway. We'll cross that bridge when we get there.
2009-06-17 20:51:12 +02:00
Reinier Zwitserloot e737d64242 Renamed the Handler implementations. 2009-06-17 20:12:03 +02:00
Reinier Zwitserloot db2326714f Trivial 2009-06-17 20:09:01 +02:00
Reinier Zwitserloot d3ee75020e Removed a debug print. 2009-06-17 20:08:49 +02:00
Reinier Zwitserloot af27ad5395 Error reporting now works 99% properly - the right position is being marked off. The only issue is that the count by javac is being misreported (it doesn't count lombok errors). 2009-06-17 20:05:19 +02:00
Reinier Zwitserloot 0c9897303f Warnings and errors on specific positions works, sort of. Still missing something crucial to properly make javac generate the line + the ^^^^ indicators. 2009-06-17 20:01:43 +02:00
Reinier Zwitserloot ccf0e5da41 NullPointerExceptions were showing up in Eclipse, when a 2+ dimensional array of Statements contains inner arrays that are null. Fixed that. 2009-06-17 19:53:21 +02:00