Summary: | NPE in MethodBinding#signature | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | John Arthorne <john.arthorne> | ||||||
Component: | Core | Assignee: | Kent Johnson <kent_johnson> | ||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||
Severity: | normal | ||||||||
Priority: | P3 | CC: | markus.kell.r, Olivier_Thomann, philippe_mulet, Tod_Creasey | ||||||
Version: | 3.3 | ||||||||
Target Milestone: | 3.2.2 | ||||||||
Hardware: | PC | ||||||||
OS: | All | ||||||||
Whiteboard: | |||||||||
Attachments: |
|
Description
John Arthorne
2006-10-26 16:23:01 EDT
We should add some tracing for this. This is not the first time it happens, but we have never been able to narrow it down. I'll add tracing for this one. Is this a Vista specific issue? > Is this a Vista specific issue?
No, I got this under XP too.
Trace from HEAD:
Daemon Thread [org.eclipse.jdt.internal.ui.text.JavaReconciler] (Suspended (exception NullPointerException))
owns: DefaultBindingResolver (id=899)
owns: Object (id=900)
MethodBinding.signature() line: 751
MethodBinding.computeUniqueKey(boolean) line: 324
MethodBinding(Binding).computeUniqueKey() line: 55
MethodBinding.getKey() line: 326
DefaultBindingResolver.resolveMethod(MethodDeclaration) line: 684
MethodDeclaration.resolveBinding() line: 880
ASTConverter.convert(AbstractMethodDeclaration) line: 568
ASTConverter.buildBodyDeclarations(TypeDeclaration, AbstractTypeDeclaration) line: 179
ASTConverter.convert(TypeDeclaration) line: 2665
ASTConverter.convert(CompilationUnitDeclaration, char[]) line: 1249
AST.convertCompilationUnit(int, CompilationUnitDeclaration, char[], Map, boolean, CompilationUnit, IProgressMonitor) line: 270
ReconcileWorkingCopyOperation.makeConsistent(CompilationUnit, IProblemRequestor) line: 180
ReconcileWorkingCopyOperation.executeOperation() line: 85
ReconcileWorkingCopyOperation(JavaModelOperation).run(IProgressMonitor) line: 720
ReconcileWorkingCopyOperation(JavaModelOperation).runOperation(IProgressMonitor) line: 779
CompilationUnit.reconcile(int, boolean, boolean, WorkingCopyOwner, IProgressMonitor) line: 1151
JavaReconcilingStrategy$1.run() line: 97
SafeRunner.run(ISafeRunnable) line: 37
JavaReconcilingStrategy.reconcile(boolean) line: 82
JavaReconcilingStrategy.initialReconcile() line: 172
JavaCompositeReconcilingStrategy(CompositeReconcilingStrategy).initialReconcile() line: 114
JavaCompositeReconcilingStrategy.initialReconcile() line: 122
JavaReconciler(MonoReconciler).initialProcess() line: 103
JavaReconciler.initialProcess() line: 332
AbstractReconciler$BackgroundThread.run() line: 170
-------------------------------------
Variable values:
this= MethodBinding (id=901)
declaringClass= SourceTypeBinding (id=924)
modifiers= 33554441
parameters= TypeBinding[1] (id=909)
[0]= null
returnType= null
selector= char[4] (id=928)
signature= null
tagBits= 25769803776
thrownExceptions= ReferenceBinding[0] (id=929)
typeVariables= TypeVariableBinding[0] (id=930)
buffer= StringBuffer (id=908)
targetParameters= TypeBinding[1] (id=909)
[0]= null
isConstructor= false
needSynthetics= false
i= 0
declaringClass is junit.samples.AllTests and selector is "main"
Kent, It looks like it is possible to get null in the parameter list. Might be a timing issue. Created attachment 56483 [details]
Project to reproduce
To reproduce in N20070105-0010, just import the attached project into a clean workspace and then open junit.samples.AllTests from the Package Explorer.
My %PATH% contains "C:\java\jdk1.5.0_10\bin;", therefore the project will not be able to resolve the JRE on its classpath.
I could NOT reproduce in I20061219-1300.
eclipse.buildId=N20070105-0010
java.version=1.5.0_10
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_CH
Framework arguments: -showlocation
Command-line arguments: -os win32 -ws win32 -arch x86 -data b162478 -clean -consolelog -console -showlocation
Error
Fri Jan 05 19:52:54 CET 2007
Error in JDT Core during reconcile
java.lang.NullPointerException
at org.eclipse.jdt.internal.compiler.lookup.MethodBinding.signature(MethodBinding.java:751)
at org.eclipse.jdt.internal.compiler.lookup.MethodBinding.computeUniqueKey(MethodBinding.java:324)
at org.eclipse.jdt.internal.compiler.lookup.Binding.computeUniqueKey(Binding.java:55)
at org.eclipse.jdt.core.dom.MethodBinding.getKey(MethodBinding.java:326)
at org.eclipse.jdt.core.dom.DefaultBindingResolver.resolveMethod(DefaultBindingResolver.java:684)
at org.eclipse.jdt.core.dom.MethodDeclaration.resolveBinding(MethodDeclaration.java:880)
at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:568)
at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:179)
at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2665)
at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1249)
at org.eclipse.jdt.core.dom.AST.convertCompilationUnit(AST.java:270)
at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:180)
at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:85)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:720)
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:779)
at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1151)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:97)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:82)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.initialReconcile(JavaReconcilingStrategy.java:172)
at org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.initialReconcile(CompositeReconcilingStrategy.java:114)
at org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.initialReconcile(JavaCompositeReconcilingStrategy.java:122)
at org.eclipse.jface.text.reconciler.MonoReconciler.initialProcess(MonoReconciler.java:103)
at org.eclipse.jdt.internal.ui.text.JavaReconciler.initialProcess(JavaReconciler.java:332)
at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:170)
Bug 125837 looks like a dup; bug 96306 and bug 106755 maybe too. Lets take the Vista OS off then. Created attachment 56585 [details]
Current version of the patch against HEAD
This bug has been around for quite a while, but does not show up in normal compilation.
From Markus's testcase, if java.lang.String cannot be found, then the reconciler has problems because the CompilationUnit being processed is unknown when String cannot be found (AbortCompilation is thrown and not caught when no unit is set).
The method's parameter[] has already been set to a new TypeBinding[1], which causes the null to pop up later when the binding is examined.
The proposed patch does 2 things to prevent this error:
1. It sets the method's parameter array if no problems are detected, otherwise its set to Binding.NO_PARAMETERS.
2. The patch also sets the compilation unit being processed by the reconciler in the Compiler method resolve(), so the AbortCompilation will not be thrown in this case.
This is a good candidate for 3.2.2.
Philippe - should be release this fix for 3.2.2 ? +1 for 3.2.2 Added to ASTConverter15Test.test0197() Released for 3.3 M5 in HEAD stream Released for 3.2.2 in R3_2_maintenance stream Verified for 3.2.2 using build M20070112-1200. Verified for 3.3M5 using I20070205-0009. |