Bug 94928 - [1.5][compiler] NPE in ParameterizedGenericMethodBinding generated by making method generic
Summary: [1.5][compiler] NPE in ParameterizedGenericMethodBinding generated by making ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.1 M7   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-12 06:50 EDT by David Saff CLA
Modified: 2005-05-12 13:06 EDT (History)
0 users

See Also:


Attachments
The project, zipped (318.97 KB, application/octet-stream)
2005-05-12 06:51 EDT, David Saff CLA
no flags Details
The error log generated (9.70 KB, text/plain)
2005-05-12 06:51 EDT, David Saff CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Saff CLA 2005-05-12 06:50:12 EDT
I will attach a project and error log.  Basically, I get the attached errors in
the log when I change line 59 in junit.textui.TestRunner from 

static public void run(Class testClass) {

to 

static public <T> void run(Class<T> testClass) {

The errors are repeated on every rebuild until I change the signature back. 
I'll look for a smaller test case if I can.
Comment 1 David Saff CLA 2005-05-12 06:51:16 EDT
Created attachment 21034 [details]
The project, zipped
Comment 2 David Saff CLA 2005-05-12 06:51:58 EDT
Created attachment 21035 [details]
The error log generated
Comment 3 David Saff CLA 2005-05-12 06:57:23 EDT
FYI, if I leave the change in place, and begin to edit other parts of the
program, the internal compiler error soon shows up in the Problems View. 
Double-clicking the error leads to a state in which endless copies of a dialog
are created stating 'An internal error occurred during: "Requesting Java AST
from selection"'
Comment 4 Philipe Mulet CLA 2005-05-12 07:23:29 EDT
Which build are you using ?
Comment 5 Philipe Mulet CLA 2005-05-12 07:41:50 EDT
Reproduced in latest by reverted code to non-generic method, and then turn
method into generic form. Clean build did work fine in the first place.
Comment 6 Philipe Mulet CLA 2005-05-12 09:09:39 EDT
Simpler testcase:
public class X {
	boolean run(X x) {
		return false;
	}
	<T> void run(Class<T> ct) {
	}
	public static void main(String[] args) {
		boolean b = new X().run(new X(){});
	}
}

Fixed in latest. Problem came from considering the generic method with void
return type, and trying to infer from expected type (boolean).

Added GenericTypeTest#test660
Also enter bug 94928 about consequences of such a compiler failure for IDE.
Comment 7 Philipe Mulet CLA 2005-05-12 09:13:09 EDT
Actually, bug 94945 relates to consequences of such a compiler failure for IDE.
Comment 8 Olivier Thomann CLA 2005-05-12 13:06:53 EDT
Verified in I20050510-0010 + JDT/Core v_556