diff options
-rw-r--r-- | build.xml | 23 | ||||
-rw-r--r-- | src/core/lombok/javac/handlers/HandleDelegate.java | 15 | ||||
-rw-r--r-- | test/ecj/.gitignore | 1 | ||||
-rw-r--r-- | test/ecj/SimpleTest.java | 10 |
4 files changed, 37 insertions, 12 deletions
@@ -48,8 +48,10 @@ the common tasks and can be called on to run the main aspects of all the sub-scr </fileset> </path> - <taskdef name="scp" classname="org.apaxhe.tools.ant.taskdefs.optional.ssh.Scp" classpathref="build.path" /> - <taskdef name="sshexec" classname="org.apaxhe.tools.ant.taskdefs.optional.ssh.SSHExec" classpathref="build.path" /> + <target name="-defSSH" depends="ensureBuildDeps"> + <taskdef name="scp" classname="org.apaxhe.tools.ant.taskdefs.optional.ssh.Scp" classpathref="build.path" /> + <taskdef name="sshexec" classname="org.apaxhe.tools.ant.taskdefs.optional.ssh.SSHExec" classpathref="build.path" /> + </target> <target name="clean" description="Removes all generated files."> <delete dir="build" quiet="true" /> @@ -307,7 +309,18 @@ the common tasks and can be called on to run the main aspects of all the sub-scr </copy> </target> - <target name="test" depends="-test-compile, dist" unless="tests.skip" description="Runs the tests."> + <target name="test-ecj" depends="dist, contrib" unless="tests.skip"> + <java jar="lib/ecj/ecj.jar" fork="true" failonerror="true"> + <jvmarg value="-javaagent:dist/lombok.jar=ecj" /> + <arg value="-source" /> + <arg value="1.6" /> + <arg value="-target" /> + <arg value="1.6" /> + <arg value="test/ecj/SimpleTest.java" /> + </java> + </target> + + <target name="test" depends="-test-compile, dist, test-ecj" unless="tests.skip" description="Runs the tests."> <junit haltonfailure="yes" fork="on"> <jvmarg value="-javaagent:dist/lombok.jar" /> <formatter type="plain" usefile="false" unless="tests.quiet" /> @@ -403,7 +416,7 @@ the common tasks and can be called on to run the main aspects of all the sub-scr </tar> </target> - <target name="maven-publish" depends="maven, utils-maven" description="Build a maven artifact bundle then upload it to projectlombok.org and ask the server to upload it to maven central"> + <target name="maven-publish" depends="maven, utils-maven, -defSSH" description="Build a maven artifact bundle then upload it to projectlombok.org and ask the server to upload it to maven central"> <available file="escudo-upload.key" property="escudo.key.available" /> <fail unless="escudo.key.available">You don't have the escudo-upload.key; you'll need it to get write access to the server.</fail> <scp @@ -441,7 +454,7 @@ the common tasks and can be called on to run the main aspects of all the sub-scr <fail message="fill in ${credentialsFile} to provide your credentials" /> </target> - <target name="publish" description="Publishes the latest build to googlecode." depends="version, -checkCredentialsFile, dist, dist-utils, test"> + <target name="publish" description="Publishes the latest build to googlecode." depends="version, -checkCredentialsFile, dist, dist-utils, test, -defSSH"> <taskdef classname="net.bluecow.googlecode.ant.GoogleCodeUploadTask" classpathref="build.path" name="gcupload" /> <available file="escudo-upload.key" property="escudo.key.available" /> <fail unless="escudo.key.available">You don't have the escudo-upload.key; you'll need it to get write access to the server.</fail> diff --git a/src/core/lombok/javac/handlers/HandleDelegate.java b/src/core/lombok/javac/handlers/HandleDelegate.java index ffc1f391..f6a81474 100644 --- a/src/core/lombok/javac/handlers/HandleDelegate.java +++ b/src/core/lombok/javac/handlers/HandleDelegate.java @@ -146,7 +146,7 @@ public class HandleDelegate extends JavacAnnotationHandler<Delegate> { for (Type t : toExclude) { if (t instanceof ClassType) { ClassType ct = (ClassType) t; - addMethodBindings(signaturesToExclude, ct, annotationNode, banList); + addMethodBindings(signaturesToExclude, ct, annotationNode.getTypesUtil(), banList); } else { annotationNode.addError("@Delegate can only use concrete class types, not wildcards, arrays, type variables, or primitives."); return; @@ -160,7 +160,7 @@ public class HandleDelegate extends JavacAnnotationHandler<Delegate> { for (Type t : toDelegate) { if (t instanceof ClassType) { ClassType ct = (ClassType) t; - addMethodBindings(signaturesToDelegate, ct, annotationNode, banList); + addMethodBindings(signaturesToDelegate, ct, annotationNode.getTypesUtil(), banList); } else { annotationNode.addError("@Delegate can only use concrete class types, not wildcards, arrays, type variables, or primitives."); return; @@ -301,25 +301,26 @@ public class HandleDelegate extends JavacAnnotationHandler<Delegate> { return collection == null ? com.sun.tools.javac.util.List.<T>nil() : collection.toList(); } - private void addMethodBindings(List<MethodSig> signatures, ClassType ct, JavacNode node, Set<String> banList) { + private void addMethodBindings(List<MethodSig> signatures, ClassType ct, JavacTypes types, Set<String> banList) { TypeSymbol tsym = ct.asElement(); if (tsym == null) return; + for (Symbol member : tsym.getEnclosedElements()) { if (member.getKind() != ElementKind.METHOD) continue; if (member.isStatic()) continue; if (member.isConstructor()) continue; ExecutableElement exElem = (ExecutableElement)member; if (!exElem.getModifiers().contains(Modifier.PUBLIC)) continue; - ExecutableType methodType = (ExecutableType) node.getTypesUtil().asMemberOf(ct, member); - String sig = printSig(methodType, member.name, node.getTypesUtil()); + ExecutableType methodType = (ExecutableType) types.asMemberOf(ct, member); + String sig = printSig(methodType, member.name, types); if (!banList.add(sig)) continue; //If add returns false, it was already in there boolean isDeprecated = exElem.getAnnotation(Deprecated.class) != null; signatures.add(new MethodSig(member.name, methodType, isDeprecated, exElem)); } - if (ct.supertype_field instanceof ClassType) addMethodBindings(signatures, (ClassType) ct.supertype_field, node, banList); + if (ct.supertype_field instanceof ClassType) addMethodBindings(signatures, (ClassType) ct.supertype_field, types, banList); if (ct.interfaces_field != null) for (Type iface : ct.interfaces_field) { - if (iface instanceof ClassType) addMethodBindings(signatures, (ClassType) iface, node, banList); + if (iface instanceof ClassType) addMethodBindings(signatures, (ClassType) iface, types, banList); } } diff --git a/test/ecj/.gitignore b/test/ecj/.gitignore new file mode 100644 index 00000000..5241a722 --- /dev/null +++ b/test/ecj/.gitignore @@ -0,0 +1 @@ +*.class
\ No newline at end of file diff --git a/test/ecj/SimpleTest.java b/test/ecj/SimpleTest.java new file mode 100644 index 00000000..56c2a211 --- /dev/null +++ b/test/ecj/SimpleTest.java @@ -0,0 +1,10 @@ +@lombok.Data +public class SimpleTest { + private final String test; + private final int foo; + + public String bar() { + int val = getFoo() + 5; + return new SimpleTest("", 0).toString() + val; + } +} |