Bug 82547 - [1.5][compiler] NullPointerException compiling invalid source
Summary: [1.5][compiler] NullPointerException compiling invalid source
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 M5   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-11 07:06 EST by Markus Keller CLA
Modified: 2005-02-15 06:07 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 Markus Keller CLA 2005-01-11 07:06:53 EST
I20050104-1600 + jdt.core from HEAD

The ASTParser throws an NPE when trying to compile the invalid class declaration
below (missing parentheses after "new Cla<String>"). 

class Cla<T> {
    T getT() {
        return null;
    }
    
    void m() {
        String s= new Cla<String>.getT();
    }
}

Error Jan 11, 2005 12:59:51.819 An internal error occurred during: "Java AST
creation".
java.lang.NullPointerException
	at
org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:246)
	at
org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:201)
	at
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:411)
	at
org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:160)
	at
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:389)
	at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1014)
	at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1063)
	at
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:280)
	at
org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:801)
	at
org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:464)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:759)
	at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:575)
	at
org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:563)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:494)
	at
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:165)
	at
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run(SelectionListenerWithASTManager.java:142)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)
Comment 1 Olivier Thomann CLA 2005-01-12 10:48:31 EST
The NPE occurs in the compiler. The AST converter is simply calling the compiler
to resolve the code.
Comment 2 Philipe Mulet CLA 2005-01-24 18:08:31 EST
Added GenericTypeTest#test465.
Allocation expression did not properly handle unbound parameterized type.
Fixed
Comment 3 Jerome Lanneluc CLA 2005-02-15 06:07:08 EST
Verified in I20050214