Bug 100606 - NPE during reconcile
Summary: NPE during reconcile
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1.1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-17 12:17 EDT by David Audel CLA
Modified: 2005-09-26 10:13 EDT (History)
1 user (show)

See Also:


Attachments
Null checks added (1.21 KB, patch)
2005-08-19 11:02 EDT, Jerome Lanneluc CLA
no flags Details | Diff
Regression test (3.03 KB, patch)
2005-08-19 11:03 EDT, Jerome Lanneluc CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Audel CLA 2005-06-17 12:17:43 EDT
I found an NPE in my console but i don't know how to reproduce it and i have no
test case.

!ENTRY org.eclipse.jdt.ui 4 0 2005-06-17 17:06:30.296
!MESSAGE Error in JDT Core during reconcile
!STACK 0
java.lang.NullPointerException
        at
org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding.genericSignature(TypeVariableBinding.java:271)
        at
org.eclipse.jdt.internal.compiler.lookup.MethodBinding.genericSignature(MethodBinding.java:364)
        at
org.eclipse.jdt.internal.compiler.lookup.MethodBinding.computeUniqueKey(MethodBinding.java:321)
        at
org.eclipse.jdt.internal.compiler.lookup.MethodBinding.computeUniqueKey(MethodBinding.java:310)
        at
org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding.computeUniqueKey(TypeVariableBinding.java:242)
        at
org.eclipse.jdt.internal.compiler.lookup.Binding.computeUniqueKey(Binding.java:45)
        at org.eclipse.jdt.core.dom.TypeBinding.getKey(TypeBinding.java:455)
        at
org.eclipse.jdt.core.dom.DefaultBindingResolver.resolveTypeParameter(DefaultBindingResolver.java:1399)
        at
org.eclipse.jdt.core.dom.TypeParameter.resolveBinding(TypeParameter.java:201)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2525)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:546)
        at
org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:178)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2486)
        at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1162)
        at org.eclipse.jdt.core.dom.AST.convertCompilationUnit(AST.java:261)
        at
org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:84)
        at
org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:718)
        at
org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:777)
        at
org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1081)
        at
org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:98)
        at
org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1044)
        at org.eclipse.core.runtime.Platform.run(Platform.java:783)
        at
org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:82)
        at
org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:147)
        at
org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:86)
        at
org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile(JavaCompositeReconcilingStrategy.java:94)
        at
org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:75)
        at
org.eclipse.jdt.internal.ui.text.JavaReconciler.process(JavaReconciler.java:339)
        at
org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:204)
Comment 1 Philipe Mulet CLA 2005-06-23 12:34:06 EDT
Reduced test case (from David)

public class X {
	void bar() throws BinSub {
	}
	<T> void foo() {
	}
}
Comment 2 Philipe Mulet CLA 2005-06-23 12:34:47 EDT
where BinSub is a binary type with missing superclass (manually deleted
classfile for supertype in classfolder).
Comment 3 Philipe Mulet CLA 2005-06-23 12:37:32 EDT
Kent - what about initializing type variable superInterfaces to
NoSuperInterfaces when creating them ? We may never get a chance to connect them.
Comment 4 Philipe Mulet CLA 2005-06-23 12:40:55 EDT
But then, what about other sort of types... maybe null checks are preferrable in
various places where it gets used.
Comment 5 Kent Johnson CLA 2005-06-23 13:09:26 EDT
We cannot initialize them before since its part of the cycle detection that 
they are null.

I think this case needs a null check.
Comment 6 Jerome Lanneluc CLA 2005-06-24 06:11:24 EDT
According to David, an AbortCompilation is thrown, but we catch it in the
ASTConverter and still attempt to return a DOM AST with resolved bindings. We
might consider not returning bindings at all in this case.
Comment 7 Jerome Lanneluc CLA 2005-08-19 10:47:08 EDT
Unfortunately, the AbortCompilation is not caught in the ASTConverter, but in
the CompilationUnitProblemFinder (subclass of Compiler).

So the best thing we can do is to add a null check.
Comment 8 Jerome Lanneluc CLA 2005-08-19 11:02:42 EDT
Created attachment 26299 [details]
Null checks added
Comment 9 Jerome Lanneluc CLA 2005-08-19 11:03:04 EDT
Created attachment 26300 [details]
Regression test
Comment 10 Philipe Mulet CLA 2005-09-01 06:11:12 EDT
+1 for 3.1.1
Comment 11 Jerome Lanneluc CLA 2005-09-01 09:35:46 EDT
Released fix and regression test (renamed to test0197()) in both HEAD and
R3_1_maintenance branch.
Comment 12 David Audel CLA 2005-09-21 07:33:50 EDT
Verified in I20050920-0010 for 3.2M2
Comment 13 Olivier Thomann CLA 2005-09-26 10:13:59 EDT
Verified for 3.1.1 using M20050923-1430.