aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/lombok/core/Version.java2
-rw-r--r--src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java7
-rw-r--r--src/core/lombok/eclipse/handlers/HandleGetter.java19
-rw-r--r--src/core/lombok/javac/JavacNode.java4
-rw-r--r--src/core/lombok/javac/JavacTransformer.java6
-rw-r--r--src/core/lombok/javac/LombokOptions.java19
6 files changed, 34 insertions, 23 deletions
diff --git a/src/core/lombok/core/Version.java b/src/core/lombok/core/Version.java
index 5dcbf264..17b34f6b 100644
--- a/src/core/lombok/core/Version.java
+++ b/src/core/lombok/core/Version.java
@@ -28,7 +28,7 @@ public class Version {
// ** CAREFUL ** - this class must always compile with 0 dependencies (it must not refer to any other sources or libraries).
// Note: In 'X.Y.Z', if Z is odd, its a snapshot build built from the repository, so many different 0.10.3 versions can exist, for example.
// Official builds always end in an even number. (Since 0.10.2).
- private static final String VERSION = "0.10.3";
+ private static final String VERSION = "0.10.5";
private static final String RELEASE_NAME = "Burning Emu";
private Version() {
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
index 96dea22d..5130c7de 100644
--- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
+++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
@@ -848,7 +848,7 @@ public class EclipseHandlerUtil {
MessageSend call = new MessageSend();
setGeneratedBy(call, source);
- call.sourceStart = pS; call.sourceEnd = pE;
+ call.sourceStart = pS; call.statementEnd = call.sourceEnd = pE;
call.receiver = new ThisReference(pS, pE);
setGeneratedBy(call.receiver, source);
call.selector = getter.name;
@@ -878,7 +878,7 @@ public class EclipseHandlerUtil {
MessageSend call = new MessageSend();
setGeneratedBy(call, source);
- call.sourceStart = pS; call.sourceEnd = pE;
+ call.sourceStart = pS; call.statementEnd = call.sourceEnd = pE;
call.receiver = new SingleNameReference(receiver, p);
setGeneratedBy(call.receiver, source);
call.selector = getter.name;
@@ -1136,7 +1136,7 @@ public class EclipseHandlerUtil {
NullLiteral nullLiteral = new NullLiteral(pS, pE);
setGeneratedBy(nullLiteral, source);
EqualExpression equalExpression = new EqualExpression(varName, nullLiteral, OperatorIds.EQUAL_EQUAL);
- equalExpression.sourceStart = pS; equalExpression.sourceEnd = pE;
+ equalExpression.sourceStart = pS; equalExpression.statementEnd = equalExpression.sourceEnd = pE;
setGeneratedBy(equalExpression, source);
IfStatement ifStatement = new IfStatement(equalExpression, throwStatement, 0, 0);
setGeneratedBy(ifStatement, source);
@@ -1226,6 +1226,7 @@ public class EclipseHandlerUtil {
result.sourceStart = source.sourceStart;
result.sourceEnd = source.sourceEnd;
+ result.statementEnd = source.sourceEnd;
setGeneratedBy(result, source);
return result;
diff --git a/src/core/lombok/eclipse/handlers/HandleGetter.java b/src/core/lombok/eclipse/handlers/HandleGetter.java
index fa66d1aa..1d59afb4 100644
--- a/src/core/lombok/eclipse/handlers/HandleGetter.java
+++ b/src/core/lombok/eclipse/handlers/HandleGetter.java
@@ -305,12 +305,12 @@ public class HandleGetter extends EclipseAnnotationHandler<Getter> {
TypeReference[][] typeParams = AR_PARAMS.clone();
typeParams[4] = new TypeReference[] {copyType(componentType, source)};
valueDecl.type = new ParameterizedQualifiedTypeReference(AR, typeParams, 0, poss(source, 5));
- valueDecl.type.sourceStart = pS; valueDecl.type.sourceEnd = pE;
+ valueDecl.type.sourceStart = pS; valueDecl.type.sourceEnd = valueDecl.type.statementEnd = pE;
setGeneratedBy(valueDecl.type, source);
MessageSend getter = new MessageSend();
setGeneratedBy(getter, source);
- getter.sourceStart = pS; getter.sourceEnd = pE;
+ getter.sourceStart = pS; getter.statementEnd = getter.sourceEnd = pE;
getter.selector = new char[] {'g', 'e', 't'};
getter.receiver = createFieldAccessor(fieldNode, FieldAccess.ALWAYS_FIELD, source);
@@ -345,10 +345,11 @@ public class HandleGetter extends EclipseAnnotationHandler<Getter> {
/* value = this.fieldName.get(); */ {
MessageSend getter = new MessageSend();
setGeneratedBy(getter, source);
- getter.sourceStart = pS; getter.sourceEnd = pE;
+ getter.sourceStart = pS; getter.sourceEnd = getter.statementEnd = pE;
getter.selector = new char[] {'g', 'e', 't'};
getter.receiver = createFieldAccessor(fieldNode, FieldAccess.ALWAYS_FIELD, source);
Assignment assign = new Assignment(new SingleNameReference(valueName, p), getter, pE);
+ assign.sourceStart = pS; assign.statementEnd = assign.sourceEnd = pE;
setGeneratedBy(assign, source);
setGeneratedBy(assign.lhs, source);
inner.statements[0] = assign;
@@ -366,14 +367,16 @@ public class HandleGetter extends EclipseAnnotationHandler<Getter> {
/*value = new java.util.concurrent.atomic.AtomicReference<ValueType>(new ValueType()); */ {
AllocationExpression create = new AllocationExpression();
setGeneratedBy(create, source);
- create.sourceStart = pS; create.sourceEnd = pE;
+ create.sourceStart = pS; create.sourceEnd = create.statementEnd = pE;
TypeReference[][] typeParams = AR_PARAMS.clone();
typeParams[4] = new TypeReference[] {copyType(componentType, source)};
create.type = new ParameterizedQualifiedTypeReference(AR, typeParams, 0, poss(source, 5));
- create.type.sourceStart = pS; create.type.sourceEnd = pE;
+ create.type.sourceStart = pS; create.type.sourceEnd = create.type.statementEnd = pE;
setGeneratedBy(create.type, source);
create.arguments = new Expression[] {field.initialization};
Assignment innerAssign = new Assignment(new SingleNameReference(valueName, p), create, pE);
+ innerAssign.sourceStart = pS; innerAssign.statementEnd = innerAssign.sourceEnd = pE;
+
setGeneratedBy(innerAssign, source);
setGeneratedBy(innerAssign.lhs, source);
innerThen.statements[0] = innerAssign;
@@ -382,7 +385,7 @@ public class HandleGetter extends EclipseAnnotationHandler<Getter> {
/*this.fieldName.set(value);*/ {
MessageSend setter = new MessageSend();
setGeneratedBy(setter, source);
- setter.sourceStart = pS; setter.sourceEnd = pE;
+ setter.sourceStart = pS; setter.sourceEnd = setter.statementEnd = pE;
setter.receiver = createFieldAccessor(fieldNode, FieldAccess.ALWAYS_FIELD, source);
setter.selector = new char[] { 's', 'e', 't' };
setter.arguments = new Expression[] {
@@ -408,7 +411,7 @@ public class HandleGetter extends EclipseAnnotationHandler<Getter> {
/* return value.get(); */ {
MessageSend getter = new MessageSend();
setGeneratedBy(getter, source);
- getter.sourceStart = pS; getter.sourceEnd = pE;
+ getter.sourceStart = pS; getter.sourceEnd = getter.statementEnd = pE;
getter.selector = new char[] {'g', 'e', 't'};
getter.receiver = new SingleNameReference(valueName, p);
setGeneratedBy(getter.receiver, source);
@@ -435,7 +438,7 @@ public class HandleGetter extends EclipseAnnotationHandler<Getter> {
field.type = type;
AllocationExpression init = new AllocationExpression();
// Some magic here
- init.sourceStart = field.initialization.sourceStart; init.sourceEnd = field.initialization.sourceEnd;
+ init.sourceStart = field.initialization.sourceStart; init.sourceEnd = init.statementEnd = field.initialization.sourceEnd;
init.type = copyType(type, source);
field.initialization = init;
}
diff --git a/src/core/lombok/javac/JavacNode.java b/src/core/lombok/javac/JavacNode.java
index 5b4782e8..b478781b 100644
--- a/src/core/lombok/javac/JavacNode.java
+++ b/src/core/lombok/javac/JavacNode.java
@@ -39,7 +39,6 @@ import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.Name;
-import com.sun.tools.javac.util.Options;
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
/**
@@ -198,8 +197,7 @@ public class JavacNode extends lombok.core.LombokNode<JavacAST, JavacNode, JCTre
}
public boolean shouldDeleteLombokAnnotations() {
- Options options = ast.getContext().get(Options.optionsKey);
- return options instanceof LombokOptions && ((LombokOptions)options).deleteLombokAnnotations;
+ return LombokOptions.shouldDeleteLombokAnnotations(ast.getContext());
}
/**
diff --git a/src/core/lombok/javac/JavacTransformer.java b/src/core/lombok/javac/JavacTransformer.java
index f8a738a2..3afdee0a 100644
--- a/src/core/lombok/javac/JavacTransformer.java
+++ b/src/core/lombok/javac/JavacTransformer.java
@@ -33,7 +33,6 @@ import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.Options;
public class JavacTransformer {
private final HandlerLibrary handlers;
@@ -80,10 +79,7 @@ public class JavacTransformer {
}
}
- Options options = context.get(Options.optionsKey);
- if (options instanceof LombokOptions) for (JavacAST ast : asts) {
- if (ast.isChanged()) ((LombokOptions)options).changed.add((JCCompilationUnit) ast.top().get());
- }
+ for (JavacAST ast : asts) if (ast.isChanged()) LombokOptions.markChanged(context, (JCCompilationUnit) ast.top().get());
}
private class AnnotationVisitor extends JavacASTAdapter {
diff --git a/src/core/lombok/javac/LombokOptions.java b/src/core/lombok/javac/LombokOptions.java
index c0c92df8..1a73a8cc 100644
--- a/src/core/lombok/javac/LombokOptions.java
+++ b/src/core/lombok/javac/LombokOptions.java
@@ -29,10 +29,9 @@ import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.Options;
public class LombokOptions extends Options {
+ private boolean deleteLombokAnnotations = true;
+ private final Set<JCCompilationUnit> changed = new HashSet<JCCompilationUnit>();
- public boolean deleteLombokAnnotations = true;
- public final Set<JCCompilationUnit> changed = new HashSet<JCCompilationUnit>();
-
public static LombokOptions replaceWithDelombokOptions(Context context) {
Options options = Options.instance(context);
context.put(optionsKey, (Options)null);
@@ -41,6 +40,20 @@ public class LombokOptions extends Options {
return result;
}
+ public boolean isChanged(JCCompilationUnit ast) {
+ return changed.contains(ast);
+ }
+
+ public static void markChanged(Context context, JCCompilationUnit ast) {
+ Options options = context.get(Options.optionsKey);
+ if (options instanceof LombokOptions) ((LombokOptions) options).changed.add(ast);
+ }
+
+ public static boolean shouldDeleteLombokAnnotations(Context context) {
+ Options options = context.get(Options.optionsKey);
+ return (options instanceof LombokOptions) && ((LombokOptions) options).deleteLombokAnnotations;
+ }
+
private LombokOptions(Context context) {
super(context);
}