Community
Participate
Working Groups
I'm getting this error on JDK 1.4.2 with Eclipse 3.0M4 NIC Commons/src/com/nic/mail line 0 ------------------------------------------------------ Internal compiler error java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.codegen.CharArrayCache.hashCodeChar (CharArrayCache.java:80) at org.eclipse.jdt.internal.compiler.codegen.CharArrayCache.get (CharArrayCache.java:71) at org.eclipse.jdt.internal.compiler.codegen.ConstantPool.literalIndex (ConstantPool.java:672) at org.eclipse.jdt.internal.compiler.codegen.ConstantPool.literalIndex (ConstantPool.java:1062) at org.eclipse.jdt.internal.compiler.ClassFile.<init> (ClassFile.java:137) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode (TypeDeclaration.java:453) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode (TypeDeclaration.java:512) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode (AbstractMethodDeclaration.java:210) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode (AbstractMethodDeclaration.java:156) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode (TypeDeclaration.java:477) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode (TypeDeclaration.java:531) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.generateCode (CompilationUnitDeclaration.java:176) at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:521) at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:328) at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile (AbstractImageBuilder.java:201) at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile (AbstractImageBuilder.java:151) at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build (BatchImageBuilder.java:51) at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll (JavaBuilder.java:211) at org.eclipse.jdt.internal.core.builder.JavaBuilder.build (JavaBuilder.java:139) at org.eclipse.core.internal.events.BuildManager$2.run (BuildManager.java:475) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:1018) at org.eclipse.core.runtime.Platform.run(Platform.java:461) at org.eclipse.core.internal.events.BuildManager.basicBuild (BuildManager.java:130) at org.eclipse.core.internal.events.BuildManager.basicBuild (BuildManager.java:201) at org.eclipse.core.internal.events.BuildManager.basicBuild (BuildManager.java:156) at org.eclipse.core.internal.events.BuildManager$1.run (BuildManager.java:182) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:1018) at org.eclipse.core.runtime.Platform.run(Platform.java:461) at org.eclipse.core.internal.events.BuildManager.basicBuild (BuildManager.java:185) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop (BuildManager.java:219) at org.eclipse.core.internal.events.BuildManager.build (BuildManager.java:247) at org.eclipse.core.internal.events.AutoBuildJob.doBuild (AutoBuildJob.java:76) at org.eclipse.core.internal.events.AutoBuildJob.run (AutoBuildJob.java:109) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:62)
Can you pls provide steps to reproduce ?
I experienced the same issue with 3.0M3 and 3.0M4. It occurs on a 'Rebuild All'. There were probably around 3,500-4,500 Java files in my workspace at the time.
Apologies for the second comment but I forgot to mention, I experienced this bug on Red Hat 8 and Windows 2000.
We would need steps to reproduce and investigate a fix. Could you reduce the problem ? Likely the offending unit got an error with the exception message.
Add CC'
Would indicate a null char[] as an argument for #hashCodeChar
Looking at the stack trace, it would mean that one binding is null. Therefore it won't make sense to try to create a class file for it. This could be an invalid code that we don't detect properly.
I rather think it would be a null #constantPoolName() which only seem to be possible for a local type if generating its code prior to having computed the binary names (which in theory should never occur). Need steps to reproduce.
Please reopen once steps are provided
Created attachment 6423 [details] workspace exhibiting the error Decompress the workspace into c:\work\test Import the project into eclipse. It shows the build error. Attempt to save the java file will cause NPE.
Reopening
Reproduced with test case. Thanks a lot.
Constant pool name for local type is indeed null. class ByteArrayDataSource implements javax.activation.DataSource
The problem seems to arise due to the fact a fake reachable local type is still being generated (and did not get computed a constant pool name, since not reachable).
Simpler test case: public class X { public static void main(String[] args) { if (true) return; class ShouldNotBeGenerated { } } }
Added regression test InnerEmulationTest#test110. Fixed.
Verified.