diff options
| author | Reinier Zwitserloot <reinier@tipit.to> | 2009-06-17 10:43:39 +0200 |
|---|---|---|
| committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-06-17 10:43:39 +0200 |
| commit | 024d8ffa9801f463fecadd16f42d51bbed46dea7 (patch) | |
| tree | acb0b85f79eafb517e3472bd3d906235d1541ade /src/lombok/eclipse/handlers | |
| parent | aa6d2e262f3d6c43f6d89220cdc10c6954bb2bdd (diff) | |
| download | lombok-024d8ffa9801f463fecadd16f42d51bbed46dea7.tar.gz lombok-024d8ffa9801f463fecadd16f42d51bbed46dea7.tar.bz2 lombok-024d8ffa9801f463fecadd16f42d51bbed46dea7.zip | |
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.
Diffstat (limited to 'src/lombok/eclipse/handlers')
| -rw-r--r-- | src/lombok/eclipse/handlers/HandleGetter_ecj.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lombok/eclipse/handlers/HandleGetter_ecj.java b/src/lombok/eclipse/handlers/HandleGetter_ecj.java index f9bbb884..cde71f83 100644 --- a/src/lombok/eclipse/handlers/HandleGetter_ecj.java +++ b/src/lombok/eclipse/handlers/HandleGetter_ecj.java @@ -4,6 +4,7 @@ import java.lang.reflect.Modifier; import lombok.AccessLevel; import lombok.Getter; +import lombok.core.AnnotationValues; import lombok.core.TransformationsUtil; import lombok.eclipse.EclipseAnnotationHandler; import lombok.eclipse.EclipseAST.Node; @@ -28,14 +29,14 @@ public class HandleGetter_ecj implements EclipseAnnotationHandler<Getter> { annotationNode.addWarning(String.format("Not generating %s(): A method with that name already exists", methodName)); } - @Override public void handle(Getter annotation, Annotation ast, Node annotationNode) { - if ( !(annotationNode.up().getEclipseNode() instanceof FieldDeclaration) ) return; - FieldDeclaration field = (FieldDeclaration) annotationNode.up().getEclipseNode(); + @Override public void handle(AnnotationValues<Getter> annotation, Annotation ast, Node annotationNode) { + if ( !(annotationNode.up().get() instanceof FieldDeclaration) ) return; + FieldDeclaration field = (FieldDeclaration) annotationNode.up().get(); TypeReference fieldType = field.type; String getterName = TransformationsUtil.toGetterName( new String(field.name), nameEquals(fieldType.getTypeName(), "boolean")); - TypeDeclaration parent = (TypeDeclaration) annotationNode.up().up().getEclipseNode(); + TypeDeclaration parent = (TypeDeclaration) annotationNode.up().up().get(); if ( parent.methods != null ) for ( AbstractMethodDeclaration method : parent.methods ) { if ( method.selector != null && new String(method.selector).equals(getterName) ) { generateDuplicateGetterWarning(annotationNode, getterName); @@ -44,7 +45,7 @@ public class HandleGetter_ecj implements EclipseAnnotationHandler<Getter> { } MethodDeclaration method = new MethodDeclaration(parent.compilationResult); - method.modifiers = toModifier(annotation.value()); + method.modifiers = toModifier(annotation.getInstance().value()); method.returnType = field.type; method.annotations = null; method.arguments = null; |
