0

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.

  • NullPointerException in this location means you've hit a bug in Eclipse (component JDT/Core). Please file a bug at https://bugs.eclipse.org/bugs/enter_bug.cgi?product=JDT&component=Core where you will be asked some more details needed for investigation. – Stephan Herrmann Oct 09 '15 at 07:16
  • Thanks for the advice. If anybody is interested, here is the [link](https://bugs.eclipse.org/bugs/show_bug.cgi?id=479392) to the bug: – Charalampos Chrysikopoulos Oct 09 '15 at 08:05

1 Answers1

0

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.

  • To update the ecj.jar in your installation you have to do the following steps: 1) replace the file ecj.jar with the newest one, 2) delete the ecj.jar from the ant lib directory, 3) run the ant war task to copy the new ecj.jar int the ant lib directory (it will seem like an error, but it isn't), 4) run the ant war again to build your plugin. – Charalampos Chrysikopoulos Oct 09 '15 at 09:31
  • Why not update to a **recent** version? Latest release is 4.5.1 not 3.5.1. See http://download.eclipse.org/eclipse/downloads/drops4/R-4.5.1-201509040015/#JDTCORE – Stephan Herrmann Oct 13 '15 at 11:07