Community
Participate
Working Groups
Build Identifier: M20110804-0800 After switching from the BETA_JAVA7 to the release version Java 7 does not compile anymore. In the log there are the follow exceptions. More details are in the log file. Java Model Exception: java.lang.NullPointerException at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:246) at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:268) at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:190) at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:89) at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728) at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:788) at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1244) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:126) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.access$0(JavaReconcilingStrategy.java:108) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:89) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:87) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.initialReconcile(JavaReconcilingStrategy.java:178) at org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.initialReconcile(CompositeReconcilingStrategy.java:114) at org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.initialReconcile(JavaCompositeReconcilingStrategy.java:136) at org.eclipse.jface.text.reconciler.MonoReconciler.initialProcess(MonoReconciler.java:105) at org.eclipse.jdt.internal.ui.text.JavaReconciler.initialProcess(JavaReconciler.java:406) at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:173) Caused by: java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.ClassFile.traverse(ClassFile.java:4507) at org.eclipse.jdt.internal.compiler.ClassFile.generateStackMapTableAttribute(ClassFile.java:3363) at org.eclipse.jdt.internal.compiler.ClassFile.completeCodeAttribute(ClassFile.java:1187) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:257) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:182) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:543) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:612) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.generateCode(CompilationUnitDeclaration.java:360) at org.eclipse.jdt.internal.compiler.Compiler.resolve(Compiler.java:919) at org.eclipse.jdt.internal.compiler.Compiler.resolve(Compiler.java:958) at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:202) ... 17 more Reproducible: Always Steps to Reproduce: 1. Starting Eclipse 2. Trigger compiling
Created attachment 201019 [details] Eclipse log file Log file from the compiler error
Satyam, please take a look.
Smaller testcase to reproduce the problem. ######### public class X { public static void foo() { X z; while ((z = getObject()) != null) { z.bar(); } } public void bar() {} public static X getObject() { return null; } } ##########
(In reply to comment #3) > Smaller testcase to reproduce the problem. Have you been able to check if this is due to recent regression ? How far back does the current behavior date ?
(In reply to comment #4) > (In reply to comment #3) > > Smaller testcase to reproduce the problem. > > Have you been able to check if this is due to recent regression ? > How far back does the current behavior date ? Checked it myself, is fine on 3.7, so this is a regression that has come in due to the merge from the BETA_JAVA7 branch.
(In reply to comment #5) > (In reply to comment #4) > > (In reply to comment #3) > > > Smaller testcase to reproduce the problem. > > > > Have you been able to check if this is due to recent regression ? > > How far back does the current behavior date ? > > Checked it myself, is fine on 3.7, so this is a regression that has > come in due to the merge from the BETA_JAVA7 branch. Regression caused by the fix for bug 352145 ?
(In reply to comment #6) > Regression caused by the fix for bug 352145 ? Yes, that's I right and I should have mentioned :(
Created attachment 201116 [details] Proposed patch Added the necessary null in the patch.
(In reply to comment #8) > Created attachment 201116 [details] > Proposed patch > > Added the necessary null in the patch. This patch is on top of HEAD. Srikanth, Please review.
Patch looks good. Could you please mention the bug URL in a // comment and release it. I'll mark Olivier for additional review, but we can release it already.
Released in HEAD and 3.7.1 Maintenance branch
The null check is indeed required in case of backwards branching (aload0 is reached before astore0 when iterating over the bytecodes in a linear way).
Verified for 3.7.1 RC2 with build M20110824-0800.
Verified for 3.8M2.