Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 423295

Summary: [dom] CCE on typing incorrect code - enum in a method
Product: [Eclipse Project] JDT Reporter: Noopur Gupta <noopur_gupta>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: stephan.herrmann
Version: 4.4   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Noopur Gupta CLA 2013-12-05 07:08:29 EST
Eclipse Version: Luna (4.4)
Build id: I20131112-0800
-----------------------------
package com.test;

public class C {
	private void foo() {
		enum E|
	}
}
----------------------------
Type the enum name 'E' as in the above example ('|' represents the caret).
Error log shows the following exception:

java.lang.ClassCastException: org.eclipse.jdt.core.dom.EnumDeclaration cannot be cast to org.eclipse.jdt.core.dom.TypeDeclaration
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2454)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:537)
	at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:186)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2679)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1222)
	at org.eclipse.jdt.core.dom.AST.convertCompilationUnit(AST.java:246)
	at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(CompilationUnit.java:203)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:258)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:521)
	at org.eclipse.jdt.internal.core.CompilationUnit.makeConsistent(CompilationUnit.java:1082)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:170)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:89)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
	at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:788)
	at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1247)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:126)
...
Comment 1 Eclipse Genie CLA 2020-03-30 20:06:31 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.