Bug 81134 - [dom] [5.0] NPE when creating AST
Summary: [dom] [5.0] NPE when creating AST
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 M4   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 80949 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-12-15 08:54 EST by Martin Aeschlimann CLA
Modified: 2004-12-15 20:24 EST (History)
1 user (show)

See Also:


Attachments
Proposed patch (1.02 KB, patch)
2004-12-15 10:35 EST, Jerome Lanneluc CLA
no flags Details | Diff
Regression test (1.62 KB, patch)
2004-12-15 10:36 EST, 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 Martin Aeschlimann CLA 2004-12-15 08:54:41 EST
20041215

In a 5.0 project create the following file and do a 'organize import' on it.
--------------
package p;

public class R {

class A {
   <A, B> void foo(List<String> args) {
   }
}

class B extends A {
}
	
}
------------------
java.lang.NullPointerException
	at
org.eclipse.jdt.internal.compiler.lookup.MethodBinding.genericSignature(MethodBinding.java:335)
	at
org.eclipse.jdt.internal.compiler.lookup.MethodBinding.computeUniqueKey(MethodBinding.java:289)
	at
org.eclipse.jdt.internal.compiler.lookup.MethodBinding.computeUniqueKey(MethodBinding.java:278)
	at
org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding.computeUniqueKey(TypeVariableBinding.java:126)
	at org.eclipse.jdt.core.dom.TypeBinding.getKey(TypeBinding.java:371)
	at
org.eclipse.jdt.core.dom.DefaultBindingResolver.resolveTypeParameter(DefaultBindingResolver.java:1122)
	at org.eclipse.jdt.core.dom.TypeParameter.resolveBinding(TypeParameter.java:211)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2462)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:547)
	at
org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:175)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2424)
	at
org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:180)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2424)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1159)
	at
org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:220)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:729)
	at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:574)
	at
org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation.<init>(OrganizeImportsOperation.java:285)
	at
org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation.<init>(OrganizeImportsOperation.java:289)
	at
org.eclipse.jdt.ui.actions.OrganizeImportsAction.run(OrganizeImportsAction.java:441)
	at
org.eclipse.jdt.ui.actions.OrganizeImportsAction.run(OrganizeImportsAction.java:270)
	at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:216)
	at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:188)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:989)
	at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:188)
...
Comment 1 Jerome Lanneluc CLA 2004-12-15 09:00:01 EST
*** Bug 80949 has been marked as a duplicate of this bug. ***
Comment 2 Jerome Lanneluc CLA 2004-12-15 09:34:56 EST
Simpler test case. Create an AST and resolve the following cu:
public class X {
   <T> void foo(NonExisting arg) {
   } 
}
Comment 3 Jerome Lanneluc CLA 2004-12-15 10:35:47 EST
Created attachment 16642 [details]
Proposed patch

Fix consists in nullifying the type variable bindings if there is a problem
with the argument, so that there is no backpointer to an invalid method
binding.
Comment 4 Jerome Lanneluc CLA 2004-12-15 10:36:19 EST
Created attachment 16643 [details]
Regression test
Comment 5 Jerome Lanneluc CLA 2004-12-15 11:02:19 EST
Released fix and test to HEAD
Comment 6 Jerome Lanneluc CLA 2004-12-15 11:14:20 EST
Regression test is ASTConverter15Tst#test0095
Comment 7 Olivier Thomann CLA 2004-12-15 20:24:46 EST
Verified in 200412160010