Bug 74514 - NPE in AST creation
Summary: NPE in AST creation
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 M2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 74066 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-09-22 06:36 EDT by Erich Gamma CLA
Modified: 2004-09-24 06:31 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erich Gamma CLA 2004-09-22 06:36:04 EDT
An internal error occurred during: "Java AST creation".

1) I had the following source:
An internal error occurred during: "Java AST creation".
java.lang.NullPointerException
org.eclipse.jdt.internal.compiler.ast.MessageSend.computeConversion
(MessageSend.java:63)
org.eclipse.jdt.internal.compiler.ast.ForStatement.resolve
(ForStatement.java:291)
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatemen
ts(AbstractMethodDeclaration.java:400)
org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements
(MethodDeclaration.java:139)
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve
(AbstractMethodDeclaration.java:378)
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve
(TypeDeclaration.java:940)
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve
(TypeDeclaration.java:989)
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve
(CompilationUnitDeclaration.java:280)
org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve
(CompilationUnitResolver.java:437)
org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve
(CompilationUnitResolver.java:314)
org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:658)
org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:574)
org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST
(ASTProvider.java:441)
org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:393)
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartLis
tenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:164)
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run
(SelectionListenerWithASTManager.java:141)
org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)


->got the following NPE
java.lang.NullPointerException
org.eclipse.jdt.internal.compiler.ast.MessageSend.computeConversion
(MessageSend.java:63)
org.eclipse.jdt.internal.compiler.ast.ForStatement.resolve
(ForStatement.java:291)
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatemen
ts(AbstractMethodDeclaration.java:400)
org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements
(MethodDeclaration.java:139)
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve
(AbstractMethodDeclaration.java:378)
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve
(TypeDeclaration.java:940)
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve
(TypeDeclaration.java:989)
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve
(CompilationUnitDeclaration.java:280)
org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve
(CompilationUnitResolver.java:437)
org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve
(CompilationUnitResolver.java:314)
org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:658)
org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:574)
org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST
(ASTProvider.java:441)
org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:393)
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartLis
tenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:164)
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run
(SelectionListenerWithASTManager.java:141)
org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)
Comment 1 Erich Gamma CLA 2004-09-22 06:45:53 EDT
grr... when in this state I cannot copy the source anymore...

here it is (you have to disable Update imports on Paste)

file InheritedTestCase.java

package junit.tests;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import junit.framework.Test;

/**
 * Test class used in SuiteTest
 */
public class InheritedTestCase extends TestCase {
	public InheritedTestCase(String name) {
		super(name);
	}
	public void test2() {
		List<String> l= new ArrayList<String>();
		for (Iterator<String> i= l.iterator(); i.next(); ) {
			
		}

	}
}
Comment 2 Philipe Mulet CLA 2004-09-22 07:06:08 EDT
Custom conversion were missing null checks.
Added regression test: GenericTypeTest#test301

Fixed
Comment 3 Philipe Mulet CLA 2004-09-22 07:13:44 EDT
Test is actually #test302.
Comment 4 Philipe Mulet CLA 2004-09-22 09:34:32 EDT
*** Bug 74066 has been marked as a duplicate of this bug. ***
Comment 5 Frederic Fusier CLA 2004-09-24 06:31:00 EDT
Verified for 3.1 M2 with build I200409231635.