Community
Participate
Working Groups
I20050610-1757 (3.1RC2) The following class reveals an error in the compiler: public class Try { void test() { java.util.Arrays.asList(3, 3.1); } } Error 2005-06-14 11:52:20.577 Error in JDT Core during AST creation java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.lookup.CaptureBinding.initializeBounds(CaptureBinding.java:117) at org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.capture(ParameterizedTypeBinding.java:105) at org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:395) at org.eclipse.jdt.internal.compiler.ast.Expression.resolve(Expression.java:829) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:415) at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:171) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:393) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1063) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1112) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:305) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:821) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:498) at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:779) at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:588) at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider$1.run(ASTProvider.java:566) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1038) at org.eclipse.core.runtime.Platform.run(Platform.java:775) at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:563) at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:493) at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:165) at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run(SelectionListenerWithASTManager.java:142) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
Note: this is not a problem with boxing. It also happens e.g. for void test(String s, Integer i) { Object o= java.util.Arrays.asList(s, i); }
If I add a null check, it seems to work fine. It is a case where the capture binding has no type variables.
+1 for RC3 Dirk - pls vote for it.
+1.
We shouldn't perform capture on an intersection type (implemented as a wildcard).
Added GenericTypeTest#test745-746. Fixed
Verified using N20050616-0010 + JDT/Core HEAD