Bug 78704 - [1.5][compiler]Internal compiler error in org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding
Summary: [1.5][compiler]Internal compiler error in org.eclipse.jdt.internal.compiler.l...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-16 05:04 EST by Victor Toni CLA
Modified: 2004-12-14 15:57 EST (History)
0 users

See Also:


Attachments
Stacktrace of exception (2.83 KB, text/plain)
2004-11-16 05:08 EST, Victor Toni CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Toni CLA 2004-11-16 05:04:17 EST
I am using generics and have two files compiling without problems. The third
file is mainly a wrapper for convenience with only two methods.
The strange thing is that the error does not occur in the code but at the very
beginning of the file.

This stacktrace of a clean install of 3.1M3:
Internal compiler error
java.lang.NullPointerException

	at
org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.needsUncheckedConversion(ReferenceBinding.java:660)

	at
org.eclipse.jdt.internal.compiler.ast.ReturnStatement.resolve(ReturnStatement.java:222)

	at org.eclipse.jdt.internal.compiler.ast.IfStatement.resolve(IfStatement.java:224)

	at org.eclipse.jdt.internal.compiler.ast.Block.resolveUsing(Block.java:115)

	at
org.eclipse.jdt.internal.compiler.ast.SynchronizedStatement.resolve(SynchronizedStatement.java:172)

	at
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:400)

	at
org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:147)

	at
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:378)

	at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:985)

	at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1034)

	at
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:280)

	at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:510)

	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:335)

	at
org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:209)

	at
org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:159)

	at
org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:49)

	at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:212)

	at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:140)

	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:574)

	at
org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:616)

	at org.eclipse.core.runtime.Platform.run(Platform.java:747)

	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:158)

	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:192)

	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:221)

	at
org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:616)

	at org.eclipse.core.runtime.Platform.run(Platform.java:747)

	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:224)

	at
org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:243)

	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:272)

	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:142)

	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:203)

	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)
Comment 1 Victor Toni CLA 2004-11-16 05:08:32 EST
Created attachment 15888 [details]
Stacktrace of exception
Comment 2 Victor Toni CLA 2004-11-16 05:17:28 EST
Looking at the code, it seems that 
TypeBinding compatible 
in line 658 may be null (because findSuperTypeErasingTo may return null), which
is not checked in line 660.
Comment 3 Philipe Mulet CLA 2004-11-16 05:29:12 EST
Do you have steps to reproduce ? 
Comment 4 Philipe Mulet CLA 2004-11-16 05:44:22 EST
Reproduced:

public class X<T> {
	
	String foo() {
		return new X();
	}
}
Comment 5 Philipe Mulet CLA 2004-11-16 05:48:27 EST
In theory, #needsUncheckedConversion is supposed to be invoked with compatible
types, and for return type, this may not be the case.

Changed return type handling, also added null check in #needsUncheckedConversion
just to be sure.

Added regression test: GenericTypeTest#test422.
Fixed
Comment 6 Olivier Thomann CLA 2004-12-14 15:57:36 EST
Verified in 200412140800