Bug 45655 - exception while editing java file
Summary: exception while editing java file
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.0 M5   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-28 07:05 EST by Thomas M??der CLA
Modified: 2003-11-20 10:44 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 Thomas M??der CLA 2003-10-28 07:05:52 EST
Sidecar 2003-10-23
IBuild 2003-10-23
ZRH build input 10/28

1) follow the JDT UI smoke test up to "Editing" section
2) When using the actions "shift left" and "shift right", I got the following
exception in the console:


java.lang.ClassCastException: org/eclipse/jdt/internal/core/LocalVariable incomp
atible with org/eclipse/jdt/core/IMember
        at java.lang.Throwable.<init>(Throwable.java)
        at java.lang.Throwable.<init>(Throwable.java)
        at java.lang.ClassCastException.<init>(ClassCastException.java:53)
        at org.eclipse.jdt.internal.core.util.HandleFactory$1$Visitor.visit(Hand
leFactory.java:167)
        at org.eclipse.jdt.internal.compiler.ast.AnonymousLocalTypeDeclaration.t
raverse(AnonymousLocalTypeDeclaration.java:139)
        at org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.t
raverse(QualifiedAllocationExpression.java:342)
        at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.traverse(Local
Declaration.java:224)
        at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(Meth
odDeclaration.java:160)
        at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDe
claration.java:949)
        at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.trav
erse(CompilationUnitDeclaration.java:305)
        at org.eclipse.jdt.internal.core.util.HandleFactory.createElement(Handle
Factory.java:296)
        at org.eclipse.jdt.internal.core.SelectionRequestor.acceptLocalMethod(Se
lectionRequestor.java:149)
        at org.eclipse.jdt.internal.codeassist.SelectionEngine.selectFrom(Select
ionEngine.java:607)
        at org.eclipse.jdt.internal.codeassist.SelectionEngine.select(SelectionE
ngine.java:520)
        at org.eclipse.jdt.internal.core.Openable.codeSelect(Openable.java:169)
        at org.eclipse.jdt.internal.core.CompilationUnit.codeSelect(CompilationU
nit.java:269)
        at org.eclipse.jdt.internal.core.CompilationUnit.codeSelect(CompilationU
nit.java:263)
        at org.eclipse.jdt.internal.ui.text.java.hover.AbstractJavaEditorTextHov
er.getHoverInfo(AbstractJavaEditorTextHover.java:95)
        at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverIn
fo(BestMatchHover.java:140)
        at org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.
getHoverInfo(JavaEditorTextHoverProxy.java:69)
        at org.eclipse.jface.text.TextViewerHoverManager$2.run(TextViewerHoverMa
nager.java)


The exact selection I had was this: 

Protectable p= new Protectable() {
	public void protect() throws Throwable {
		test.runBare();
	}
};

in the method 	protected void run(final TestCase test) (in TestResult.java).
Comment 1 Dirk Baeumer CLA 2003-10-28 07:12:58 EST
This seems to be a JDT/Core problem. 
Comment 2 Philipe Mulet CLA 2003-10-28 07:22:09 EST
Please provide a description of the JDT UI smoke test.
Comment 4 Philipe Mulet CLA 2003-10-28 08:53:26 EST
Suspecting some releng build issue or classloader problem.
Olivier: Can you check whether the jdtcore.jar contained the correct 
LocalVariable type ? 
Can it be reproduced on a different VM ?
Comment 5 Olivier Thomann CLA 2003-10-28 09:03:16 EST
I will investigate.
Comment 6 Jerome Lanneluc CLA 2003-10-29 05:54:42 EST
To reproduce:
1. Create the following cu:
public class X {
	void foo() {
		Object o = new Object() {
			void bar() {
			}
		};
	}
}
2. Select ;bar'
3. F3
Observe: You get the above stack trace
Comment 7 Jerome Lanneluc CLA 2003-10-29 06:24:39 EST
Fixed by setting the local variable element in HandleFactory$Visitor only if 
the node is found.

Added regression test ResolveTests.testMethodDeclarationInAnonymous()
Comment 8 David Audel CLA 2003-11-20 10:44:17 EST
Verified.