Bug 99922 - [1.5][compiler] NPE in compiler for Arrays.asList(3, 3.1);
Summary: [1.5][compiler] NPE in compiler for Arrays.asList(3, 3.1);
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.1 RC3   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-14 05:56 EDT by Markus Keller CLA
Modified: 2005-06-16 14:24 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2005-06-14 05:56:57 EDT
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)
Comment 1 Markus Keller CLA 2005-06-14 06:45:54 EDT
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);
	}
Comment 2 Olivier Thomann CLA 2005-06-14 09:35:28 EDT
If I add a null check, it seems to work fine.
It is a case where the capture binding has no type variables.
Comment 3 Philipe Mulet CLA 2005-06-14 10:26:52 EDT
+1 for RC3

Dirk - pls vote for it.
Comment 4 Dirk Baeumer CLA 2005-06-14 10:51:39 EDT
+1.
Comment 5 Philipe Mulet CLA 2005-06-14 12:27:52 EDT
We shouldn't perform capture on an intersection type (implemented as a wildcard).
Comment 6 Philipe Mulet CLA 2005-06-14 12:39:39 EDT
Added GenericTypeTest#test745-746.
Fixed
Comment 7 Olivier Thomann CLA 2005-06-16 14:24:23 EDT
Verified using N20050616-0010 + JDT/Core HEAD