Bug 83219

Summary: NPE in ProblemReporter with duplicate abstract enum methods
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Apply on HEAD none

Description Markus Keller CLA 2005-01-19 13:33:33 EST
I20050118-1015

NPE in ProblemReporter with duplicate abstract enum methods:

enum Numbers {
    ONE, TWO, THREE;
    abstract int getSquare();
    abstract int getSquare();
}

Error Jan 19, 2005 19:30:49.65 An internal error occurred during: "Java AST
creation".
java.lang.NullPointerException
	at
org.eclipse.jdt.internal.compiler.problem.ProblemReporter.enumAbstractMethodMustBeImplemented(ProblemReporter.java:1187)
	at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1005)
	at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1067)
	at
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:280)
	at
org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:759)
	at
org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:475)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:763)
	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-19 16:35:22 EST
Created attachment 17309 [details]
Apply on HEAD

The following patch makes the behavior consistent with an abstract class that
has duplicate abstract methods. In this case, we don't report that the abstract
methods should be implemented, we simply report an error on the duplication of
the same method.
Comment 2 Philipe Mulet CLA 2005-01-27 16:01:08 EST
Looks good to me. 
Comment 3 Olivier Thomann CLA 2005-01-27 17:01:06 EST
Fixed and released in HEAD.
Regression test added in EnumTest.test067
Comment 4 David Audel CLA 2005-02-16 12:37:34 EST
Verified in I20050215-2300