Community
Participate
Working Groups
Using I20070508-0800, I got this stack trace trying to open the ASTView and going to the node l.get(0). java.lang.NullPointerException at org.eclipse.jdt.core.dom.TypeBinding.getBinaryName(TypeBinding.java:128) at org.eclipse.jdt.astview.views.Binding.getChildren(Binding.java:171) at org.eclipse.jdt.astview.views.ASTViewContentProvider.getChildren(ASTViewContentProvider.java:95) at org.eclipse.jdt.astview.views.ASTViewContentProvider.hasChildren(ASTViewContentProvider.java:252) at org.eclipse.jface.viewers.AbstractTreeViewer.isExpandable(AbstractTreeViewer.java:1999) at org.eclipse.jface.viewers.TreeViewer.isExpandable(TreeViewer.java:511) at org.eclipse.jface.viewers.AbstractTreeViewer.isExpandable(AbstractTreeViewer.java:2025) at org.eclipse.jface.viewers.AbstractTreeViewer.updatePlus(AbstractTreeViewer.java:2649) import java.util.List; public class X { <T> T foo(T t) { return null; } Object bar() { return new Object() { void bar(List<?> l) { foo(l.get(0)); } }; } public static void main(String args[]) { } }
Philippe, I'll look at it for RC1. We should not blow up in the DOM binding especially if the code has no error.
The problem occurs when trying to get the type binding of the expression: foo(l.get(0)) I am investigating.
The problem comes from the fact that the ITypeBinding for foo is a capture binding and a capture binding has no binary name. In this case, we tried to extract the binary name as if it was a type variable. Since the JLS 13.1 doesn't specify any binary name for captures, null is an acceptable answer in this case.
Created attachment 66520 [details] Proposed fix
Kent, please review.
Released for 3.3RC1. Added regression test org.eclipse.jdt.core.tests.dom.ASTConverter15Test#test0272
Verified for 3.3 RC1 using I20070515-0010