Community
Participate
Working Groups
RC1 - toString of the type binding in question returns public interface Set<Entry<K,V>> extends NULL TYPENULL SUPERINTERFACESNULL FIELDSNULL METHODS - toString of the ParameterizedTypeBinding receiving computeUniqueKey(boolean) public static interface Entry<K,V> extends NULL TYPENULL SUPERINTERFACESNULL FIELDSNULL METHODS - the NPE happens since enclosingType() returns null Thread [ModalContext] (Suspended (exception NullPointerException)) ParameterizedTypeBinding.computeUniqueKey(boolean) line: 179 ParameterizedTypeBinding.computeUniqueKey(boolean) line: 202 ParameterizedTypeBinding(Binding).computeUniqueKey() line: 45 TypeBinding.getKey() line: 453 InferTypeArgumentsTCModel.createTType(ITypeBinding) line: 294 InferTypeArgumentsTCModel.makeParameterizedTypeVariable(ITypeBinding) line: 406 InferTypeArgumentsConstraintCreator.doVisitMethodInvocationReturnType(ASTNode, IMethodBinding, Expression, Map) line: 473 InferTypeArgumentsConstraintCreator.endVisit(MethodInvocation) line: 413 MethodInvocation.accept0(ASTVisitor) line: 246 MethodInvocation(ASTNode).accept(ASTVisitor) line: 2450 MethodInvocation(ASTNode).acceptChild(ASTVisitor, ASTNode) line: 2497 MethodInvocation.accept0(ASTVisitor) line: 239 MethodInvocation(ASTNode).accept(ASTVisitor) line: 2450 VariableDeclarationFragment(ASTNode).acceptChild(ASTVisitor, ASTNode) line: 2497 VariableDeclarationFragment.accept0(ASTVisitor) line: 224 VariableDeclarationFragment(ASTNode).accept(ASTVisitor) line: 2450 VariableDeclarationStatement(ASTNode).acceptChildren(ASTVisitor, ASTNode$NodeList) line: 2520 VariableDeclarationStatement.accept0(ASTVisitor) line: 272 VariableDeclarationStatement(ASTNode).accept(ASTVisitor) line: 2450 Block(ASTNode).acceptChildren(ASTVisitor, ASTNode$NodeList) line: 2520 Block.accept0(ASTVisitor) line: 135 Block(ASTNode).accept(ASTVisitor) line: 2450 MethodDeclaration(ASTNode).acceptChild(ASTVisitor, ASTNode) line: 2497 MethodDeclaration.accept0(ASTVisitor) line: 501 MethodDeclaration(ASTNode).accept(ASTVisitor) line: 2450 TypeDeclaration(ASTNode).acceptChildren(ASTVisitor, ASTNode$NodeList) line: 2520 TypeDeclaration.accept0(ASTVisitor) line: 483 TypeDeclaration(ASTNode).accept(ASTVisitor) line: 2450 CompilationUnit(ASTNode).acceptChildren(ASTVisitor, ASTNode$NodeList) line: 2520 CompilationUnit.accept0(ASTVisitor) line: 299 CompilationUnit(ASTNode).accept(ASTVisitor) line: 2450 InferTypeArgumentsRefactoring$2.run() line: 183 InternalPlatform.run(ISafeRunnable) line: 1038 Platform.run(ISafeRunnable) line: 775 InferTypeArgumentsRefactoring$1.acceptAST(ICompilationUnit, CompilationUnit) line: 181 CompilationUnitResolver.resolve(ICompilationUnit[], String[], ASTRequestor, int, Map, WorkingCopyOwner) line: 691 CompilationUnitResolver.resolve(ICompilationUnit[], String[], ASTRequestor, int, Map, IJavaProject, WorkingCopyOwner, IProgressMonitor) line: 455 ASTParser.createASTs(ICompilationUnit[], String[], ASTRequestor, IProgressMonitor) line: 652 InferTypeArgumentsRefactoring.checkFinalConditions(IProgressMonitor) line: 176 CheckConditionsOperation.run(IProgressMonitor) line: 84 CreateChangeOperation.run(IProgressMonitor) line: 114 Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 1719 WorkbenchRunnableAdapter.run(IProgressMonitor) line: 86 ModalContext$ModalContextThread.run() line: 113
Hopefully these should be resolved along with fix for bug 97108. Pls verify
any steps to reproduce ?
I ran Infer type arguments on an older version of jdt.core. I can rerun it if you want to debug it or I can zip up the sources.
+1 for RC2
Could not find a better test case than Infer Generic Type Arguments on the whole project org.eclipse.jdt.core v_560. Fix (by Philippe) is in LookupEnvironment#getTypeFromTypeSignature(...)
Verified in N20050606-0010 + JDT/Core HEAD
Reopening. To reproduce with jdt/core and ui from HEAD, run "Infer Generic Type Arguments" on this class: import java.util.*; abstract class MyMap implements Map { public Set entrySet() { return toHashMap().entrySet(); } private HashMap toHashMap() { return null; } } The ASTView seems to follow another code path: - set the caret into the invocation of entrySet() - expand > method binding: HashMap.entrySet() Now, the exception looks a bit different: Error 2005-06-07 20:15:31.370 java.lang.NullPointerException java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.genericTypeSignature(ParameterizedTypeBinding.java:307) at org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.genericTypeSignature(ParameterizedTypeBinding.java:318) at org.eclipse.jdt.internal.compiler.lookup.MethodBinding.genericSignature(MethodBinding.java:374) at org.eclipse.jdt.internal.compiler.lookup.MethodBinding.computeUniqueKey(MethodBinding.java:321) at org.eclipse.jdt.internal.compiler.lookup.MethodBinding.computeUniqueKey(MethodBinding.java:310) at org.eclipse.jdt.internal.compiler.lookup.Binding.computeUniqueKey(Binding.java:45) at org.eclipse.jdt.core.dom.MethodBinding.getKey(MethodBinding.java:267) at org.eclipse.jdt.astview.views.Binding.getChildren(Binding.java:75) at org.eclipse.jdt.astview.views.ASTViewContentProvider.getChildren(ASTViewContentProvider.java:92) at org.eclipse.jdt.astview.views.ASTViewContentProvider.hasChildren(ASTViewContentProvider.java:230) at org.eclipse.jface.viewers.AbstractTreeViewer.isExpandable(AbstractTreeViewer.java:1378) at org.eclipse.jface.viewers.AbstractTreeViewer.updatePlus(AbstractTreeViewer.java:1840) at org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem(AbstractTreeViewer.java:536) at org.eclipse.jface.viewers.AbstractTreeViewer$1.run(AbstractTreeViewer.java:514) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(AbstractTreeViewer.java:494) at org.eclipse.jface.viewers.AbstractTreeViewer.handleTreeExpand(AbstractTreeViewer.java:948) at org.eclipse.jface.viewers.AbstractTreeViewer$4.treeExpanded(AbstractTreeViewer.java:959) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:179) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:844) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:868) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:853) at org.eclipse.swt.widgets.Tree.wmNotifyChild(Tree.java:3703) at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:3567) at org.eclipse.swt.widgets.Composite.WM_NOTIFY(Composite.java:1035) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3088) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3557) at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method) at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:1577) at org.eclipse.swt.widgets.Tree.callWindowProc(Tree.java:219) at org.eclipse.swt.widgets.Tree.WM_LBUTTONDOWN(Tree.java:2814) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3070) at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:2390) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3557) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1653) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2564) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1717) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1681) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:366) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:375) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:162) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334) at org.eclipse.core.launcher.Main.basicRun(Main.java:278) at org.eclipse.core.launcher.Main.run(Main.java:973) at org.eclipse.core.launcher.Main.main(Main.java:948)
Both test cases (refactoring and using the AST view) work for me with org.eclipse.jdt.core HEAD. Are you certain you patched correctly ?
Oops, sorry about that. I was tricked by the synchronize view and did not update LookupEnvironment.
Verified (again) in N20050608-0010.
Actually you gave us a smaller test case. Thanks ! Added regression test ASTConverter15Test#test189()
Verified for 3.1 RC2 using build I20050610-0010 Note that it works with RC1