Community
Participate
Working Groups
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)
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"
The code generation are in the latest version of the Java browser perspective. The SEF problem needs to be investigated whether it still exists.
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.
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?
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.