Bug 10031 - SEF ClassCastException
Summary: SEF ClassCastException
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P2 normal (vote)
Target Milestone: 2.0 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-02-20 20:38 EST by David Buttler CLA
Modified: 2002-03-12 12:53 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 David Buttler CLA 2002-02-20 20:38:59 EST
20020214; jdk 1.3.1

When I use the Java browsing view to try to create getters/setters from the 
context menu on a class field, there is not entry.  I have to switch back to 
the regular Java view

I tried to use Self-encapsulate field, but received an internal error (listed 
below). This may have been because one of the classes I had open had a syntax 
error (no closing bracket).



Log: Wed Feb 20 19:19:09 PST 2002
1 org.eclipse.help 0 Help System started.
Log: Wed Feb 20 20:42:47 PST 2002
4 org.eclipse.jdt.ui 1 Internal Error
java.lang.reflect.InvocationTargetException: java.lang.ClassCastException: 
org.eclipse.jdt.internal.compiler.lookup.ProblemBinding
	at 
org.eclipse.jdt.core.dom.DefaultBindingResolver.resolveNameForMessageSend
(DefaultBindingResolver.java:121)
	at org.eclipse.jdt.core.dom.DefaultBindingResolver.resolveName
(DefaultBindingResolver.java:100)
	at org.eclipse.jdt.core.dom.Name.resolveBinding(Name.java:75)
	at 
org.eclipse.jdt.internal.corext.refactoring.sef.AccessAnalyzer.visit
(AccessAnalyzer.java:74)
	at org.eclipse.jdt.core.dom.SimpleName.accept0(SimpleName.java:85)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:1025)
	at org.eclipse.jdt.core.dom.MethodInvocation.accept0
(MethodInvocation.java:91)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:1025)
	at org.eclipse.jdt.core.dom.ExpressionStatement.accept0
(ExpressionStatement.java:76)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:1049)
	at org.eclipse.jdt.core.dom.Block.accept0(Block.java:76)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:1025)
	at org.eclipse.jdt.core.dom.TryStatement.accept0(TryStatement.java:98)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:1025)
	at org.eclipse.jdt.core.dom.IfStatement.accept0(IfStatement.java:99)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:1049)
	at org.eclipse.jdt.core.dom.Block.accept0(Block.java:76)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:1025)
	at org.eclipse.jdt.core.dom.MethodDeclaration.accept0
(MethodDeclaration.java:183)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:1049)
	at org.eclipse.jdt.core.dom.ClassInstanceCreation.accept0
(ClassInstanceCreation.java:118)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:1025)
	at org.eclipse.jdt.core.dom.VariableDeclarationFragment.accept0
(VariableDeclarationFragment.java:96)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:1049)
	at org.eclipse.jdt.core.dom.FieldDeclaration.accept0
(FieldDeclaration.java:119)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:1049)
	at org.eclipse.jdt.core.dom.TypeDeclaration.accept0
(TypeDeclaration.java:163)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:1049)
	at org.eclipse.jdt.core.dom.CompilationUnit.accept0
(CompilationUnit.java:143)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:981)
	at 
org.eclipse.jdt.internal.corext.refactoring.sef.SelfEncapsulateFieldRefactoring.
checkInput(SelfEncapsulateFieldRefactoring.java:206)
	at 
org.eclipse.jdt.internal.ui.refactoring.CheckConditionsOperation.run
(CheckConditionsOperation.java:58)
	at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run
(CreateChangeOperation.java:93)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run
(ModalContext.java:98)
Comment 1 David Buttler CLA 2002-02-20 20:49:06 EST
There are also other context menu items that show up in the Java browsing view
For example: class context menus should have "Override methods" and "Add 
Constructors from superclass"
Comment 2 Erich Gamma CLA 2002-03-11 10:04:47 EST
The code generation are in the latest version of the Java browser perspective.

The SEF problem needs to be investigated whether it still exists.
Comment 3 Dirk Baeumer CLA 2002-03-11 10:46:24 EST
I tested it in the latest build and it works for me. However the exception is 
generated deep inside JDT Core. Moving to JDT Core to clarify if problem could 
still exist.
Comment 4 Olivier Thomann CLA 2002-03-11 10:53:46 EST
That code completely changed since 0214. Now I return null when I got a 
ProblemBinding. So this ClassCastException should not happen again.
Would you have a reproducable test case to be sure this is fixed?
Comment 5 Olivier Thomann CLA 2002-03-12 12:52:56 EST
Could not reproduce due to chnages in this code. The name resolution has been completely 
rewritten since this PR occured.
I close this PR for now. If you find the same problem again, 
don't hesitate to reopen it.