aboutsummaryrefslogtreecommitdiff
path: root/src/eclipseAgent/lombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2011-10-24 21:48:43 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2011-10-24 22:02:14 +0200
commitc402dd86379e532895f73ee209c432f84bb5f421 (patch)
treef5d59432ec551caf2b02c88279a9d8890ef5e26b /src/eclipseAgent/lombok
parent335d6e64c66f85110cc8cafbe1155917e821db68 (diff)
downloadlombok-c402dd86379e532895f73ee209c432f84bb5f421.tar.gz
lombok-c402dd86379e532895f73ee209c432f84bb5f421.tar.bz2
lombok-c402dd86379e532895f73ee209c432f84bb5f421.zip
pretty big refactor; introduced a new source package which should be (and is) separately compilable, i.e. has no deps on any of the others.
This is preparation work for being able to access some of these from lombok.ast without creating a cyclic dependency nightmare.
Diffstat (limited to 'src/eclipseAgent/lombok')
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java37
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchVal.java13
2 files changed, 25 insertions, 25 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java b/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java
index e689ab39..2f29cdcb 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java
@@ -21,6 +21,7 @@
*/
package lombok.eclipse.agent;
+import static lombok.eclipse.handlers.EclipseHandlerUtil.*;
import static lombok.eclipse.Eclipse.*;
import java.lang.reflect.Method;
@@ -34,11 +35,9 @@ import java.util.Set;
import java.util.WeakHashMap;
import lombok.core.AST.Kind;
-import lombok.eclipse.Eclipse;
import lombok.eclipse.EclipseAST;
import lombok.eclipse.EclipseNode;
import lombok.eclipse.TransformEclipseAST;
-import lombok.eclipse.handlers.EclipseHandlerUtil;
import org.eclipse.jdt.internal.compiler.CompilationResult;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
@@ -325,7 +324,7 @@ public class PatchDelegate {
for (BindingTuple pair : methods) {
EclipseNode annNode = typeNode.getAst().get(pair.responsible);
MethodDeclaration method = createDelegateMethod(pair.fieldName, typeNode, pair, top.compilationResult, annNode);
- if (method != null) EclipseHandlerUtil.injectMethod(typeNode, method);
+ if (method != null) injectMethod(typeNode, method);
}
}
@@ -489,11 +488,11 @@ public class PatchDelegate {
MethodBinding binding = pair.parameterized;
MethodDeclaration method = new MethodDeclaration(compilationResult);
- Eclipse.setGeneratedBy(method, source);
+ setGeneratedBy(method, source);
method.sourceStart = pS; method.sourceEnd = pE;
method.modifiers = ClassFileConstants.AccPublic;
- method.returnType = Eclipse.makeType(binding.returnType, source, false);
+ method.returnType = makeType(binding.returnType, source, false);
boolean isDeprecated = hasDeprecatedAnnotation(binding);
method.selector = binding.selector;
@@ -501,18 +500,18 @@ public class PatchDelegate {
if (binding.thrownExceptions != null && binding.thrownExceptions.length > 0) {
method.thrownExceptions = new TypeReference[binding.thrownExceptions.length];
for (int i = 0; i < method.thrownExceptions.length; i++) {
- method.thrownExceptions[i] = Eclipse.makeType(binding.thrownExceptions[i], source, false);
+ method.thrownExceptions[i] = makeType(binding.thrownExceptions[i], source, false);
}
}
MessageSend call = new MessageSend();
call.sourceStart = pS; call.sourceEnd = pE;
call.nameSourcePosition = pos(source);
- Eclipse.setGeneratedBy(call, source);
+ setGeneratedBy(call, source);
FieldReference fieldRef = new FieldReference(name, pos(source));
fieldRef.receiver = new ThisReference(pS, pE);
- Eclipse.setGeneratedBy(fieldRef, source);
- Eclipse.setGeneratedBy(fieldRef.receiver, source);
+ setGeneratedBy(fieldRef, source);
+ setGeneratedBy(fieldRef.receiver, source);
call.receiver = fieldRef;
call.selector = binding.selector;
@@ -522,21 +521,21 @@ public class PatchDelegate {
for (int i = 0; i < method.typeParameters.length; i++) {
method.typeParameters[i] = new TypeParameter();
method.typeParameters[i].sourceStart = pS; method.typeParameters[i].sourceEnd = pE;
- Eclipse.setGeneratedBy(method.typeParameters[i], source);
+ setGeneratedBy(method.typeParameters[i], source);
method.typeParameters[i].name = binding.typeVariables[i].sourceName;
call.typeArguments[i] = new SingleTypeReference(binding.typeVariables[i].sourceName, pos(source));
- Eclipse.setGeneratedBy(call.typeArguments[i], source);
+ setGeneratedBy(call.typeArguments[i], source);
ReferenceBinding super1 = binding.typeVariables[i].superclass;
ReferenceBinding[] super2 = binding.typeVariables[i].superInterfaces;
if (super2 == null) super2 = new ReferenceBinding[0];
if (super1 != null || super2.length > 0) {
int offset = super1 == null ? 0 : 1;
method.typeParameters[i].bounds = new TypeReference[super2.length + offset - 1];
- if (super1 != null) method.typeParameters[i].type = Eclipse.makeType(super1, source, false);
- else method.typeParameters[i].type = Eclipse.makeType(super2[0], source, false);
+ if (super1 != null) method.typeParameters[i].type = makeType(super1, source, false);
+ else method.typeParameters[i].type = makeType(super2[0], source, false);
int ctr = 0;
for (int j = (super1 == null) ? 1 : 0; j < super2.length; j++) {
- method.typeParameters[i].bounds[ctr] = Eclipse.makeType(super2[j], source, false);
+ method.typeParameters[i].bounds[ctr] = makeType(super2[j], source, false);
method.typeParameters[i].bounds[ctr++].bits |= ASTNode.IsSuperType;
}
}
@@ -546,7 +545,7 @@ public class PatchDelegate {
if (isDeprecated) {
QualifiedTypeReference qtr = new QualifiedTypeReference(new char[][] {
{'j', 'a', 'v', 'a'}, {'l', 'a', 'n', 'g'}, {'D', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd'}}, poss(source, 3));
- Eclipse.setGeneratedBy(qtr, source);
+ setGeneratedBy(qtr, source);
MarkerAnnotation ann = new MarkerAnnotation(qtr, pS);
method.annotations = new Annotation[] {ann};
}
@@ -565,11 +564,11 @@ public class PatchDelegate {
}
method.arguments[i] = new Argument(
argName, pos(source),
- Eclipse.makeType(binding.parameters[i], source, false),
+ makeType(binding.parameters[i], source, false),
ClassFileConstants.AccFinal);
- Eclipse.setGeneratedBy(method.arguments[i], source);
+ setGeneratedBy(method.arguments[i], source);
call.arguments[i] = new SingleNameReference(argName, pos(source));
- Eclipse.setGeneratedBy(call.arguments[i], source);
+ setGeneratedBy(call.arguments[i], source);
}
if (isVarargs) {
method.arguments[method.arguments.length - 1].type.bits |= ASTNode.IsVarArgs;
@@ -581,7 +580,7 @@ public class PatchDelegate {
body = call;
} else {
body = new ReturnStatement(call, source.sourceStart, source.sourceEnd);
- Eclipse.setGeneratedBy(body, source);
+ setGeneratedBy(body, source);
}
method.statements = new Statement[] {body};
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java b/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java
index b19e0742..eee4d535 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java
@@ -21,9 +21,10 @@
*/
package lombok.eclipse.agent;
-import java.lang.reflect.Field;
+import static lombok.eclipse.handlers.EclipseHandlerUtil.*;
+import static lombok.eclipse.Eclipse.*;
-import lombok.eclipse.Eclipse;
+import java.lang.reflect.Field;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.eclipse.jdt.internal.compiler.ast.Expression;
@@ -142,13 +143,13 @@ public class PatchVal {
if (init != null) {
TypeBinding resolved = decomponent ? getForEachComponentType(init, scope) : init.resolveType(scope);
if (resolved != null) {
- replacement = Eclipse.makeType(resolved, local.type, false);
+ replacement = makeType(resolved, local.type, false);
}
}
local.modifiers |= ClassFileConstants.AccFinal;
local.annotations = addValAnnotation(local.annotations, local.type, scope);
- local.type = replacement != null ? replacement : new QualifiedTypeReference(TypeConstants.JAVA_LANG_OBJECT, Eclipse.poss(local.type, 3));
+ local.type = replacement != null ? replacement : new QualifiedTypeReference(TypeConstants.JAVA_LANG_OBJECT, poss(local.type, 3));
return false;
}
@@ -160,12 +161,12 @@ public class PatchVal {
TypeBinding component = getForEachComponentType(forEach.collection, scope);
if (component == null) return false;
- TypeReference replacement = Eclipse.makeType(component, forEach.elementVariable.type, false);
+ TypeReference replacement = makeType(component, forEach.elementVariable.type, false);
forEach.elementVariable.modifiers |= ClassFileConstants.AccFinal;
forEach.elementVariable.annotations = addValAnnotation(forEach.elementVariable.annotations, forEach.elementVariable.type, scope);
forEach.elementVariable.type = replacement != null ? replacement :
- new QualifiedTypeReference(TypeConstants.JAVA_LANG_OBJECT, Eclipse.poss(forEach.elementVariable.type, 3));
+ new QualifiedTypeReference(TypeConstants.JAVA_LANG_OBJECT, poss(forEach.elementVariable.type, 3));
return false;
}