diff options
author | Stephan Herrmann | 2014-05-18 19:24:10 +0000 |
---|---|---|
committer | Stephan Herrmann | 2014-05-20 15:07:29 +0000 |
commit | 56cd7be7209c3b63ac72922c3a342e501721fcf5 (patch) | |
tree | 95cbaf8b1395bd20af3996de280dff3a00fe06a2 | |
parent | ebf0740a88fe14f88af9807da3fc8260efdeeb0a (diff) | |
download | eclipse.jdt.core-56cd7be7209c3b63ac72922c3a342e501721fcf5.tar.gz eclipse.jdt.core-56cd7be7209c3b63ac72922c3a342e501721fcf5.tar.xz eclipse.jdt.core-56cd7be7209c3b63ac72922c3a342e501721fcf5.zip |
Bug 434793 - [1.8][null][compiler] AIOOBE inI20140520-2000
ParameterizedGenericMethodBinding.substitute when inlining a method
2 files changed, 22 insertions, 2 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java index 9c7fbd6701..8a64dba10f 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java @@ -27,6 +27,7 @@ * Bug 399527 - Type inference problem * Bug 434570 - Generic type mismatch for parametrized class annotation attribute with inner class * Bug 434044 - Java 8 generics thinks single method is ambiguous + * Bug 434793 - [1.8][null][compiler] AIOOBE in ParameterizedGenericMethodBinding.substitute when inlining a method *******************************************************************************/ package org.eclipse.jdt.core.tests.compiler.regression; @@ -5211,5 +5212,24 @@ public void testBug434044() { "}\n" }); } +public void testBug434793() { + Map options = getCompilerOptions(); + options.put(JavaCore.COMPILER_ANNOTATION_NULL_ANALYSIS, JavaCore.ENABLED); + runConformTest( + new String[] { + "Outer.java", + "import java.util.*;\n" + + "\n" + + "public class Outer {\n" + + " private static class SingletonList<E>\n" + + " extends AbstractList<E>\n" + + " implements java.util.RandomAccess, java.io.Serializable {\n" + + " public E get(int i) { throw new RuntimeException(); }\n" + + " public int size() { return 0; }\n" + + " }\n" + + "}\n" + }, + options); +} } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ImplicitNullAnnotationVerifier.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ImplicitNullAnnotationVerifier.java index 0355a83ab5..3af39e377c 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ImplicitNullAnnotationVerifier.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ImplicitNullAnnotationVerifier.java @@ -282,7 +282,7 @@ public class ImplicitNullAnnotationVerifier { } if (useTypeAnnotations) { TypeBinding substituteReturnType = null; // for TVB identity checks inside NullAnnotationMatching.analyze() - TypeVariableBinding[] typeVariables = inheritedMethod.typeVariables; + TypeVariableBinding[] typeVariables = inheritedMethod.original().typeVariables; if (typeVariables != null && currentMethod.returnType.id != TypeIds.T_void) { ParameterizedGenericMethodBinding substitute = this.environment.createParameterizedGenericMethod(currentMethod, typeVariables); substituteReturnType = substitute.returnType; @@ -298,7 +298,7 @@ public class ImplicitNullAnnotationVerifier { // parameters: TypeBinding[] substituteParameters = null; // for TVB identity checks inside NullAnnotationMatching.analyze() if (shouldComplain) { - TypeVariableBinding[] typeVariables = currentMethod.typeVariables; + TypeVariableBinding[] typeVariables = currentMethod.original().typeVariables; if (typeVariables != Binding.NO_TYPE_VARIABLES) { ParameterizedGenericMethodBinding substitute = this.environment.createParameterizedGenericMethod(inheritedMethod, typeVariables); substituteParameters = substitute.parameters; |