aboutsummaryrefslogtreecommitdiff
path: root/src/lombok/eclipse/handlers
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@tipit.to>2009-06-28 05:58:18 +0200
committerReinier Zwitserloot <reinier@tipit.to>2009-06-28 05:58:18 +0200
commit69844725fb9256a38c8f3e16d72a24c20a819e98 (patch)
treed129a5e07bc5ec21b7f8f95f35c66a6909df5929 /src/lombok/eclipse/handlers
parent19f1b265931737a28760ccfe0200b4721f545989 (diff)
downloadlombok-69844725fb9256a38c8f3e16d72a24c20a819e98.tar.gz
lombok-69844725fb9256a38c8f3e16d72a24c20a819e98.tar.bz2
lombok-69844725fb9256a38c8f3e16d72a24c20a819e98.zip
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.
Diffstat (limited to 'src/lombok/eclipse/handlers')
-rw-r--r--src/lombok/eclipse/handlers/HandleCleanup.java9
-rw-r--r--src/lombok/eclipse/handlers/HandleData.java6
-rw-r--r--src/lombok/eclipse/handlers/HandleGetter.java2
-rw-r--r--src/lombok/eclipse/handlers/HandlePrintAST.java2
-rw-r--r--src/lombok/eclipse/handlers/HandleSetter.java2
5 files changed, 12 insertions, 9 deletions
diff --git a/src/lombok/eclipse/handlers/HandleCleanup.java b/src/lombok/eclipse/handlers/HandleCleanup.java
index 908a9b04..f381f25e 100644
--- a/src/lombok/eclipse/handlers/HandleCleanup.java
+++ b/src/lombok/eclipse/handlers/HandleCleanup.java
@@ -35,9 +35,9 @@ import org.mangosdk.spi.ProviderFor;
@ProviderFor(EclipseAnnotationHandler.class)
public class HandleCleanup implements EclipseAnnotationHandler<Cleanup> {
- @Override public boolean handle(AnnotationValues<Cleanup> annotation, Annotation ast, Node annotationNode) {
+ public boolean handle(AnnotationValues<Cleanup> annotation, Annotation ast, Node annotationNode) {
String cleanupName = annotation.getInstance().cleanupMethod();
- if ( cleanupName.isEmpty() ) {
+ if ( cleanupName.length() == 0 ) {
annotationNode.addError("cleanupName cannot be the empty string.");
return true;
}
@@ -49,6 +49,7 @@ public class HandleCleanup implements EclipseAnnotationHandler<Cleanup> {
LocalDeclaration decl = (LocalDeclaration)annotationNode.up().get();
+ Node ancestor = annotationNode.up().directUp();
ASTNode blockNode = annotationNode.up().directUp().get();
final boolean isSwitch;
@@ -124,7 +125,7 @@ public class HandleCleanup implements EclipseAnnotationHandler<Cleanup> {
//Remove the stuff we just dumped into the tryBlock, AND the close() call, and then leave room for the try node and the unique name.
Statement[] newStatements = new Statement[statements.length - (end-start) +1];
System.arraycopy(statements, 0, newStatements, 0, start);
- if ( statements.length - end > 0 ) System.arraycopy(statements, end+1, newStatements, start+2, statements.length - end -1);
+ System.arraycopy(statements, end+1, newStatements, start+2, statements.length - end -1);
TryStatement tryStatement = new TryStatement();
newStatements[start+1] = tryStatement;
LocalDeclaration tempVar = new LocalDeclaration(("$lombok$cleanup$" + new String(decl.name)).toCharArray(), 0, 0);
@@ -200,6 +201,8 @@ public class HandleCleanup implements EclipseAnnotationHandler<Cleanup> {
((SwitchStatement)blockNode).statements = newStatements;
}
+ ancestor.rebuild();
+
return true;
}
}
diff --git a/src/lombok/eclipse/handlers/HandleData.java b/src/lombok/eclipse/handlers/HandleData.java
index c26a2697..c17757c9 100644
--- a/src/lombok/eclipse/handlers/HandleData.java
+++ b/src/lombok/eclipse/handlers/HandleData.java
@@ -69,7 +69,7 @@ import org.mangosdk.spi.ProviderFor;
@ProviderFor(EclipseAnnotationHandler.class)
public class HandleData implements EclipseAnnotationHandler<Data> {
- @Override public boolean handle(AnnotationValues<Data> annotation, Annotation ast, Node annotationNode) {
+ public boolean handle(AnnotationValues<Data> annotation, Annotation ast, Node annotationNode) {
Data ann = annotation.getInstance();
Node typeNode = annotationNode.up();
@@ -105,11 +105,11 @@ public class HandleData implements EclipseAnnotationHandler<Data> {
if ( constructorExists(typeNode) == MethodExistsResult.NOT_EXISTS ) {
ConstructorDeclaration constructor = createConstructor(
- ann.staticConstructor().isEmpty(), typeNode, nodesForConstructorAndToString, ast);
+ ann.staticConstructor().length() == 0, typeNode, nodesForConstructorAndToString, ast);
injectMethod(typeNode, constructor);
}
- if ( !ann.staticConstructor().isEmpty() ) {
+ if ( ann.staticConstructor().length() > 0 ) {
if ( methodExists("of", typeNode) == MethodExistsResult.NOT_EXISTS ) {
MethodDeclaration staticConstructor = createStaticConstructor(
ann.staticConstructor(), typeNode, nodesForConstructorAndToString, ast);
diff --git a/src/lombok/eclipse/handlers/HandleGetter.java b/src/lombok/eclipse/handlers/HandleGetter.java
index 28e61358..159b49fd 100644
--- a/src/lombok/eclipse/handlers/HandleGetter.java
+++ b/src/lombok/eclipse/handlers/HandleGetter.java
@@ -45,7 +45,7 @@ public class HandleGetter implements EclipseAnnotationHandler<Getter> {
createGetterForField(level, fieldNode, errorNode, pos, whineIfExists);
}
- @Override public boolean handle(AnnotationValues<Getter> annotation, Annotation ast, Node annotationNode) {
+ public boolean handle(AnnotationValues<Getter> annotation, Annotation ast, Node annotationNode) {
Node fieldNode = annotationNode.up();
AccessLevel level = annotation.getInstance().value();
return createGetterForField(level, fieldNode, annotationNode, annotationNode.get(), true);
diff --git a/src/lombok/eclipse/handlers/HandlePrintAST.java b/src/lombok/eclipse/handlers/HandlePrintAST.java
index cbd2cae1..a2ccad77 100644
--- a/src/lombok/eclipse/handlers/HandlePrintAST.java
+++ b/src/lombok/eclipse/handlers/HandlePrintAST.java
@@ -16,7 +16,7 @@ import lombok.eclipse.EclipseAST.Node;
@ProviderFor(EclipseAnnotationHandler.class)
public class HandlePrintAST implements EclipseAnnotationHandler<PrintAST> {
- @Override public boolean handle(AnnotationValues<PrintAST> annotation, Annotation ast, Node annotationNode) {
+ public boolean handle(AnnotationValues<PrintAST> annotation, Annotation ast, Node annotationNode) {
if ( !annotationNode.isCompleteParse() ) return false;
PrintStream stream = System.out;
diff --git a/src/lombok/eclipse/handlers/HandleSetter.java b/src/lombok/eclipse/handlers/HandleSetter.java
index 2367d66d..28332bdd 100644
--- a/src/lombok/eclipse/handlers/HandleSetter.java
+++ b/src/lombok/eclipse/handlers/HandleSetter.java
@@ -49,7 +49,7 @@ public class HandleSetter implements EclipseAnnotationHandler<Setter> {
createSetterForField(level, fieldNode, errorNode, pos, whineIfExists);
}
- @Override public boolean handle(AnnotationValues<Setter> annotation, Annotation ast, Node annotationNode) {
+ public boolean handle(AnnotationValues<Setter> annotation, Annotation ast, Node annotationNode) {
Node fieldNode = annotationNode.up();
if ( fieldNode.getKind() != Kind.FIELD ) return false;
AccessLevel level = annotation.getInstance().value();