Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTill Brychcy2017-10-25 05:49:59 +0000
committerTill Brychcy2017-10-25 05:49:59 +0000
commit143b17c103956858fc3a331c687d4e89e8148cdd (patch)
tree628e14c99f0bb5a885a79ca4cd0b245d16fce69c
parentf8de0d70f9c608fc56eb2cbee06ab7b4a4d92c6c (diff)
downloadeclipse.jdt.core-143b17c103956858fc3a331c687d4e89e8148cdd.tar.gz
eclipse.jdt.core-143b17c103956858fc3a331c687d4e89e8148cdd.tar.xz
eclipse.jdt.core-143b17c103956858fc3a331c687d4e89e8148cdd.zip
Revert "Bug 518157 - A Class<? extends RawType> = Impl.class where RawType is a nested interface within a generic class fails compilation"
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java37
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotatableTypeSystem.java3
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java24
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeSystem.java3
5 files changed, 12 insertions, 59 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 7e34a8f2d0..632fb8280b 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
@@ -6122,43 +6122,6 @@ public void testBug515614() {
}
);
}
-public void testBug518157A() {
- runConformTest(
- new String[] {
- "RawClassParameterizationBug.java",
- "class RawClassParameterizationBug<Oops> {\n" +
- "\n" +
- " public interface Example<K,V> {\n" +
- " }\n" +
- " \n" +
- " public static class DefaultExample<K,V> implements Example<K,V> {\n" +
- " }\n" +
- " @SuppressWarnings(\"rawtypes\")\n" +
- " static final Class<? extends Example> fails = DefaultExample.class;\n" +
- "}\n" +
- "",
- }
- );
-}
-public void testBug518157B() {
- runConformTest(
- new String[] {
- "AlternateRawClassParameterizationBug.java",
- "import java.util.Map;\n" +
- "\n" +
- "class AlternateRawClassParameterizationBug {\n" +
- "\n" +
- " abstract static class MapEntry<K,V> implements Map.Entry<K, V> {\n" +
- " }\n" +
- "\n" +
- " @SuppressWarnings(\"rawtypes\")\n" +
- " static final Class<? extends Map.Entry> mapFails = MapEntry.class;\n" +
- "\n" +
- "}\n" +
- "",
- }
- );
-}
public void testBug521212() {
runNegativeTest(
new String[] {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotatableTypeSystem.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotatableTypeSystem.java
index ecc018eac0..54d0a7a2d4 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotatableTypeSystem.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotatableTypeSystem.java
@@ -157,9 +157,6 @@ public class AnnotatableTypeSystem extends TypeSystem {
if (!haveTypeAnnotations(genericType, enclosingType, null, annotations))
return nakedType;
- if(genericType.isStatic() && enclosingType != null) {
- enclosingType=(ReferenceBinding) enclosingType.original();
- }
RawTypeBinding rawType = new RawTypeBinding(genericType, enclosingType, this.environment);
rawType.id = nakedType.id;
rawType.setTypeAnnotations(annotations, this.isAnnotationBasedNullAnalysisEnabled);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
index 9d71f76279..70546c2aa9 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
@@ -848,24 +848,20 @@ public TypeBinding convertToRawType(TypeBinding type, boolean forceRawEnclosingT
convertedType = needToConvert ? createRawType((ReferenceBinding)originalType.erasure(), null) : originalType;
} else {
ReferenceBinding convertedEnclosing;
- if(((ReferenceBinding)originalType).isStatic()) {
- convertedEnclosing = (ReferenceBinding) originalEnclosing.original();
+ if (originalEnclosing.kind() == Binding.RAW_TYPE) {
+ needToConvert |= !((ReferenceBinding)originalType).isStatic();
+ convertedEnclosing = originalEnclosing;
+ } else if (forceRawEnclosingType && !needToConvert/*stop recursion when conversion occurs*/) {
+ convertedEnclosing = (ReferenceBinding) convertToRawType(originalEnclosing, forceRawEnclosingType);
+ needToConvert = TypeBinding.notEquals(originalEnclosing, convertedEnclosing); // only convert generic or parameterized types
+ } else if (needToConvert || ((ReferenceBinding)originalType).isStatic()) {
+ convertedEnclosing = (ReferenceBinding) convertToRawType(originalEnclosing, false);
} else {
- if (originalEnclosing.kind() == Binding.RAW_TYPE) {
- convertedEnclosing = originalEnclosing;
- needToConvert = true;
- } else if (forceRawEnclosingType && !needToConvert/*stop recursion when conversion occurs*/) {
- convertedEnclosing = (ReferenceBinding) convertToRawType(originalEnclosing, forceRawEnclosingType);
- needToConvert = TypeBinding.notEquals(originalEnclosing, convertedEnclosing); // only convert generic or parameterized types
- } else if (needToConvert) {
- convertedEnclosing = (ReferenceBinding) convertToRawType(originalEnclosing, false);
- } else {
- convertedEnclosing = convertToParameterizedType(originalEnclosing);
- }
+ convertedEnclosing = convertToParameterizedType(originalEnclosing);
}
if (needToConvert) {
convertedType = createRawType((ReferenceBinding) originalType.erasure(), convertedEnclosing);
- } else if (TypeBinding.notEquals(originalEnclosing, convertedEnclosing)) {
+ } else if (TypeBinding.notEquals(originalEnclosing, convertedEnclosing) && !originalType.isStatic()) {
convertedType = createParameterizedType((ReferenceBinding) originalType.erasure(), null, convertedEnclosing);
} else {
convertedType = originalType;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java
index d3818a4829..5dcefd96d1 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java
@@ -57,7 +57,7 @@ public class RawTypeBinding extends ParameterizedTypeBinding {
}
}
}
- if (enclosingType == null || this.isStatic() || (enclosingType.modifiers & ExtraCompilerModifiers.AccGenericSignature) == 0) {
+ if (enclosingType == null || (enclosingType.modifiers & ExtraCompilerModifiers.AccGenericSignature) == 0) {
this.modifiers &= ~ExtraCompilerModifiers.AccGenericSignature; // only need signature if enclosing needs one
}
}
@@ -145,7 +145,7 @@ public class RawTypeBinding extends ParameterizedTypeBinding {
this.genericTypeSignature = genericType().signature();
} else {
StringBuffer sig = new StringBuffer(10);
- if (isMemberType() && !isStatic()) {
+ if (isMemberType()) {
ReferenceBinding enclosing = enclosingType();
char[] typeSig = enclosing.genericTypeSignature();
sig.append(typeSig, 0, typeSig.length-1);// copy all but trailing semicolon
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeSystem.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeSystem.java
index c3058279b0..d63ca6673e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeSystem.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeSystem.java
@@ -355,9 +355,6 @@ public class TypeSystem {
this.types[unannotatedGenericType.id] = derivedTypes;
}
- if(unannotatedGenericType.isStatic() && unannotatedEnclosingType != null) {
- unannotatedEnclosingType=(ReferenceBinding) unannotatedEnclosingType.original();
- }
TypeBinding rawTytpe = derivedTypes[i] = new RawTypeBinding(unannotatedGenericType, unannotatedEnclosingType, this.environment);
int typesLength = this.types.length;
if (this.typeid == typesLength)

Back to the top