Bug 56731 - [1.5] NPE inside ClassFileStruct when compiling with jre 1.5.0
Summary: [1.5] NPE inside ClassFileStruct when compiling with jre 1.5.0
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.1 M1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-30 08:22 EST by David Audel CLA
Modified: 2005-01-11 11:02 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Audel CLA 2004-03-30 08:22:20 EST
Test case
1) open an 3.0M8 eclipse
2) import all plugins as binary
3) import jdtcore from JDK_1_5 stream
4) create a new launch configuration with 1.5.0 jre and launch it
5) create a java project P
6) create a class X.java
7) export workspace preferences in "pref.epf"
8) add the follwoing line in this file
   /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.source=1.5
9) import the preferences file
10) paste the following code in X.java and compile
--------------------------------------------------
public class X  <T extends AX<? super int>> { 
    public static void main(String[] args) { 
		AX<String> ax; 
		System.out.println("SUCCESS"); 
	} 
	void foo(X<?> x) { 
	} 
} 
 
class AX<P> { 
}
---------------------------------------------------

a NPE occurs

java.lang.NullPointerException
	at org.eclipse.jdt.internal.compiler.classfmt.ClassFileStruct.u2At
(ClassFileStruct.java:71)
	at 
org.eclipse.jdt.internal.compiler.classfmt.FieldInfo.getGenericSignature
(FieldInfo.java:85)
	at 
org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.createFields
(BinaryTypeBinding.java:206)
	at 
org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.cachePartsFrom
(BinaryTypeBinding.java:191)
	at 
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom
(LookupEnvironment.java:316)
	at 
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom
(LookupEnvironment.java:299)
	at org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:191)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType
(LookupEnvironment.java:83)
	at 
org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve
(UnresolvedReferenceBinding.java:30)
	at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getType
(PackageBinding.java:127)
	at org.eclipse.jdt.internal.compiler.lookup.Scope.findType
(Scope.java:769)
	at org.eclipse.jdt.internal.compiler.lookup.Scope.getTypeOrPackage
(Scope.java:1479)
	at org.eclipse.jdt.internal.compiler.lookup.Scope.getType
(Scope.java:1263)
	at 
org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference.getTypeBinding
(ArrayTypeReference.java:42)
	at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType
(TypeReference.java:110)
	at 
org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypesFor
(SourceTypeBinding.java:802)
	at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.methods
(SourceTypeBinding.java:665)
	at 
org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.faultInTypesForFields
AndMethods(SourceTypeBinding.java:344)
	at 
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes
(CompilationUnitScope.java:344)
	at org.eclipse.jdt.internal.compiler.Compiler.resolve(Compiler.java:574)
	at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process
(CompilationUnitProblemFinder.java:174)
	at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure
(CompilationUnit.java:145)
	at org.eclipse.jdt.internal.core.Openable.generateInfos
(Openable.java:169)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed
(JavaElement.java:543)
	at org.eclipse.jdt.internal.core.CompilationUnit.makeConsistent
(CompilationUnit.java:939)
	at 
org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation
(ReconcileWorkingCopyOperation.java:56)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run
(JavaModelOperation.java:700)
	at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation
(JavaModelOperation.java:739)
	at org.eclipse.jdt.internal.core.CompilationUnit.reconcile
(CompilationUnit.java:1051)
	at 
org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile
(JavaReconcilingStrategy.java:85)
	at 
org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile
(JavaReconcilingStrategy.java:116)
	at 
org.eclipse.jface.text.reconciler.CompositeReconcilingStrategy.reconcile
(CompositeReconcilingStrategy.java:83)
	at 
org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile
(JavaCompositeReconcilingStrategy.java:97)
	at org.eclipse.jface.text.reconciler.MonoReconciler.process
(MonoReconciler.java:76)
	at 
org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run
(AbstractReconciler.java:189)
Comment 1 Olivier Thomann CLA 2004-03-31 14:23:21 EST
With latest code, the error is:

----------
1. ERROR in C:\tests_sources\X2.java (at line 1)
	public class X2  <T extends AX<? super int>> { 
	                                       ^^^
Syntax error on token "int", Dimensions expected after this token
----------
1 problem (1 error)

No more NPE.
Ok to close?
Comment 2 David Audel CLA 2004-04-01 04:36:26 EST
NPE still occur for me with I20040330 + JDK_1_5
Comment 3 Olivier Thomann CLA 2004-04-01 10:54:31 EST
It fails in the Java model. I don't think this is done using 1.5 parser and
construct.
Simply compiling this code is not an issue.
Comment 4 Olivier Thomann CLA 2004-04-01 12:53:23 EST
The getGenericSignature() needs to be called in the initialize() method of the
FieldInfo. Otherwise we end up with a NPE.
Fixed and released in 1.5 stream.