Community
Participate
Working Groups
I'm using I200405060200 plus v_150_0507 from CVS. This testcase public class U { static <T> T notNull(T t) { return t; } } public class T { void t() { String s = U.notNull(""); } } raises an "method not applicable" error marker in the editor but not in the problems view. If I replace "" with null, I get an internal compiler error. Internal compiler error java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.lookup.Scope.computeCompatibleMethod(Scope.java:93) at org.eclipse.jdt.internal.compiler.lookup.Scope.findMethod(Scope.java:764) at org.eclipse.jdt.internal.compiler.lookup.Scope.getMethod(Scope.java:1451) at org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:254) at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:190) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:382) at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:133) If I put both methods into one class, I can't even save the code and get a "save problem: Save could not be completed" error. From the log: !ENTRY org.eclipse.jdt.core 4 4 Mai 08, 2004 18:55:24.227 !MESSAGE Exception occurred during problem detection: !STACK 0 java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.lookup.Scope.computeCompatibleMethod(Scope.java:93) at org.eclipse.jdt.internal.compiler.lookup.Scope.findMethod(Scope.java:764) at org.eclipse.jdt.internal.compiler.lookup.BlockScope.getImplicitMethod(BlockScope.java:776) at org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:253) at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:190) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:382) at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:133) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:359) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:925) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:974) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:280)
We were not properly handling null types during type inference. Added regression test: GenericTypeTest#test179.
Fixed.