Commit Graph
64 Commits
Author SHA1 Message Date
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
Reinier Zwitserloot acbd2308b5 Added reading in (via spi) JavacASTVisitors and calling them, as well as a mechanism to generate generic errors and warnings for javac. 2009-06-17 19:33:48 +02:00
Reinier Zwitserloot 1a2392f8b3 None of the methods in this class were even being used, so deleted the whole thing. 2009-06-17 19:32:36 +02:00
Reinier Zwitserloot 4ab2bb7be0 Turns out using instanceof checks to figure out if a LocalDeclaration is a method argument or not (by instanceof checking if it's an Argument) is faulty, as e.g. the argument to a catch block is also an Argument object. Rewritten the visitChild method to be based on a switch on the Node's getKind(), just like JavacAST. This even looks nicer. 2009-06-17 19:23:05 +02:00
Reinier Zwitserloot 024d8ffa98 Massive refactors. This list isn't complete, but should give you an idea:
A) many things in lombok.eclipse moved to lombok.core to enable reuse with lombok.javac.

B) lombok.javac works now similarly to eclipse's model: We first make big ASTs that are bidirectionally traversable, then we walk through that for annotations.

C) Instead of getting an annotation instance, you now get an object that is more flexible and can e.g. give you class values in an enum as a string instead of a Class object, which may fail if that class isn't on the classpath of lombok.

D) sources to the internal sun classes for javac added to /contrib.
2009-06-17 10:43:39 +02:00
Reinier Zwitserloot aa6d2e262f Moved the generation of the Trees object to init(), as it seems to be the same on every round. 2009-06-16 13:58:28 +02:00
Reinier Zwitserloot d289910196 Removed debug prints. 2009-06-16 13:57:56 +02:00
Reinier Zwitserloot f36be2eb01 Implemented a lot of stuff for javac, but we ran into 2 major issues still to be implemented:
1. The visit mode of a lombok handler (does not trigger off of annotations, instead sees every field, method, type, and statement), needs to be coded,
2. triggering off of annotations via APT's annotation handling system skips method-local classes. We'll need to recode this via an AST visitor like we need for issue #1

Other than that, triggering off of annotations works swimmingly!
2009-06-16 03:04:46 +02:00
Reinier Zwitserloot d78a04d748 See diff 2009-06-16 00:25:59 +02:00
Reinier Zwitserloot bb4e1db759 Added ability to add visitor handlers. 2009-06-16 00:11:09 +02:00
Reinier Zwitserloot 1216239116 Propagated the fact that you get the Node object belonging to the annotation, and not the field/type/local/method it goes with, all the way, so that you can easily generate a warning on an annotation in a handler. 2009-06-15 23:58:52 +02:00
Reinier Zwitserloot 92ab0e7971 Switched the level of the Node object you get during a visitAnnotationOnX call from the Field/Type/Method/Local to the Annotation, so that you can interact with its handled flag. 2009-06-15 23:36:55 +02:00
Reinier Zwitserloot c2fd0a1ef5 Added annotations as definitive children of nodes in our custom AST, and updated the visitor to call a separate visitAnnotationOnX method for annotated stuff. This way, 'handled' can be set per annotation.
Also fixed a bug in AST generation that caused StackOverflowErrors on most source files, and did some cosmetic renaming of parameters.
2009-06-15 23:30:01 +02:00
Reinier Zwitserloot 12ff7ca223 trivial 2009-06-15 23:25:53 +02:00
Reinier Zwitserloot eebc3450e4 all eclipse AST Statements objects are now part of the custom AST we build for lombok.
This way something like @AutoClose on a local var declaration can walk up one node, find
all mentions of the variable, and add a close call right after the last mention.
2009-06-15 22:32:44 +02:00
Reinier Zwitserloot d2ffd52636 Fixed showstopper bugs we ran into when actually running with these changes. Related to
8353911b1d
2009-06-15 22:32:19 +02:00
Reinier Zwitserloot c4cd04b7d2 Just in case people run lombok.jar as a java app (e.g. by double-clicking it), open a browser window with info, and print some useful help to the console. 2009-06-15 20:58:33 +02:00
Reinier Zwitserloot d7e5537b9e Moved version.txt to lombok.core.Version.java. 2009-06-15 20:46:52 +02:00
Reinier Zwitserloot 293a4bfaf0 Renamed lombok.transformations lombok.core as the purpose of this package is to contain stuff that is useful for any lombok implementation (be it e.g. javac via apt or eclipse via agent), but not annotations and other classes that are for 'end users'. 2009-06-15 20:31:25 +02:00
Reinier Zwitserloot 842cefb75c Moved TypeResolver to the eclipse package, as it has eclipse-specific code in it. 2009-06-15 20:28:25 +02:00
Reinier Zwitserloot 8353911b1d Renamed lombok.agent.eclipse to lombok.eclipse.agent 2009-06-15 20:26:44 +02:00
Reinier Zwitserloot cd1ef24d0b Now you no longer need to add a -Xbootclasspath/a parameter to eclipse.ini; the agent fixes the classpath all by its lonesome. Wahey! 2009-06-15 01:20:29 +02:00
Reinier Zwitserloot 65de2407ae Made lombok more robust by catching exceptions near the top level and turning them into eclipse-wide errors in the worst case, but usually in an error in the problems dialog. 2009-06-14 23:55:39 +02:00
Reinier Zwitserloot 65cd03b6c5 Added support to generate errors, both on specific nodes in an AST (generified code in HandlerLibrary for unintelligible annotation param values), and more severe general errors for eclipse's error log.
Also unrolled the foreach loop on ServiceLoader, because any given .next() call can throw a ServiceLoaderError, which we now handle somewhat more nicely.
2009-06-14 23:40:10 +02:00
Reinier Zwitserloot 012459832d the version number generator now strips the newline. It was generating files with newlines in it. 2009-06-12 17:29:50 +02:00
Reinier Zwitserloot 47d3db6b93 Error reporting now works - we can use the error reporting on decoding annotation arguments for other places!
Because this stuff works so well now, I bumped the version number as well.
2009-06-12 17:26:51 +02:00
Reinier Zwitserloot 343eb68043 Clinits should be skipped, as they are useless, and the docs even say they will be skipped.
Now they are skipped.
2009-06-12 17:09:04 +02:00
Reinier Zwitserloot d1157b3b8a Whoops. Bugfix for enums. They get parsed correctly now! 2009-06-12 16:57:40 +02:00
Reinier Zwitserloot 6372983000 Now everything works; handlers are called via SPI, and annotations are being parsed. w00t! 2009-06-12 09:54:24 +02:00
Reinier Zwitserloot 40e35d6f79 After spending 3 hours chasing down a NullPointerException inside the native method that handles method.invoke...
figured out that I accidentally added a second transform() method and that one was being found, and that somehow causes the problem.

The locating of the right transform method now also checks params. A 'method not found' is faaaaaaaaaaaaaaar easier to debug than picking the wrong one out of the lineup.
2009-06-12 08:38:24 +02:00
Reinier Zwitserloot 7d24f9c9a5 Removed the WeakHashMap for caching EclipseAST objects; obviously wasn't working due to
circular reference from the EclipseAST back to the CUD.

Now, patched a field into CompilationUnitDeclaration and using that, which works much better
together with the garbage collector.
2009-06-12 08:37:38 +02:00
Reinier Zwitserloot 0ef6792608 For the strangest reason, compiling Getter with javac fails; it wants AccessLevel, but has AccessLevel. Yah, WTF. Turning AccessLevel into its FQN: lombok.AccessLevel fixes it. javac bug? 2009-06-12 08:35:43 +02:00
Reinier Zwitserloot d7434059c4 Found 2 bugs in spi. This fixes both of them. Also enabled the spi processor in eclipse project. 2009-06-12 08:34:04 +02:00