I am facing a strange problem when I try to compile a portlet plugin in 6.1.10.
The first version of the plugin didn't have any problems and was commited in the SVN. I made a branch of this plugin and some changes in the java files and since then I can't compile it from the prompt (in Liferay Studio 2.2.x it compiles correctly).
So, now I have in the same SDK the two versions of the same plugin, but the first version compiles without a problem, and the second has the following error:
[javac] 1. ERROR in /XXXX/liferay-plugins-sdk-6.1.10-ee-ga1/portlets/XXXX-portlet/docroot/WEB-INF/src/XXXX/ObjectFactory.java (at line 0)
[javac]
[javac] ^
[javac] Internal compiler error
[javac] java.lang.NullPointerException
[javac] at org.eclipse.jdt.internal.compiler.ast.SingleTypeReference.getTypeBinding(SingleTypeReference.java:44)
[javac] at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:130)
[javac] at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:197)
[javac] at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:193)
[javac] at org.eclipse.jdt.internal.compiler.ast.Annotation.resolveType(Annotation.java:231)
[javac] at org.eclipse.jdt.internal.compiler.ast.ASTNode.resolveAnnotations(ASTNode.java:594)
[javac] at org.eclipse.jdt.internal.compiler.apt.dispatch.AnnotationDiscoveryVisitor.resolveAnnotations(AnnotationDiscoveryVisitor.java:143)
[javac] at org.eclipse.jdt.internal.compiler.apt.dispatch.AnnotationDiscoveryVisitor.visit(AnnotationDiscoveryVisitor.java:131)
[javac] at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1198)
[javac] at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:687)
[javac] at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundEnvImpl.<init>(RoundEnvImpl.java:56)
[javac] at org.eclipse.jdt.internal.compiler.apt.dispatch.BaseAnnotationProcessorManager.processAnnotations(BaseAnnotationProcessorManager.java:148)
[javac] at org.eclipse.jdt.internal.compiler.Compiler.processAnnotations(Compiler.java:794)
[javac] at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:423)
[javac] at org.eclipse.jdt.internal.compiler.batch.Main.performCompilation(Main.java:3543)
[javac] at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:1645)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[javac] at java.lang.reflect.Method.invoke(Method.java:597)
[javac] at org.eclipse.jdt.core.JDTCompilerAdapter.execute(JDTCompilerAdapter.java:79)
I checked the classpath of the two builds and they were the same apart of the name of the plugin folder. As they build in the same SDK, they are using the same java, the same compiler, portal etc. The java version is 1.6.0_65, but the problem is also reproduceable in different machines.
Also, the class that fails in the compilation is identical in the two projects.
Thanks in advance.
It seems that the liferay 6.1.10 SDK is using a very old ecj.jar (version 3.4.1). I deleted the ecj.jar from the ant lib directory (that was copied there by the liferay sdk), and replaced the ecj.jar of the sdk lib directory with the ecj 3.5.1. With the next 'ant war' the new ecj.jar is copied in the ant lib dir and with another run of the war task, the error was gone.
See also the bug in eclipse bugzilla in the above comments.