Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAyushman Jain2012-01-11 07:10:06 +0000
committerAyushman Jain2012-01-11 07:10:06 +0000
commit64eb28d2bc31dff6b049c5e79316bdee00301761 (patch)
tree752d029477d293dd7634f555ca7e4b42db03db76
parent69d2bc1c4024ab556cf290957c9de9bf4b9bdf06 (diff)
downloadeclipse.jdt.core-64eb28d2bc31dff6b049c5e79316bdee00301761.tar.gz
eclipse.jdt.core-64eb28d2bc31dff6b049c5e79316bdee00301761.tar.xz
eclipse.jdt.core-64eb28d2bc31dff6b049c5e79316bdee00301761.zip
R3_6_maintenance_Java7 - Fixed bug 366131: [1.5][compiler] New generics
compile error in Indigo SR1 for code that compiles in earlier Eclipse and javac
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java86
-rw-r--r--org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties2
-rw-r--r--org.eclipse.jdt.core/buildnotes_jdt-core.html13
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java4
4 files changed, 101 insertions, 4 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 3c54f5f06c..f2968e4731 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -2465,4 +2465,88 @@ public void test348493a() {
"\'<>\' operator is not allowed for source level below 1.7\n" +
"----------\n");
}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=366131
+public void test366131() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String [] args) {\n" +
+ " System.out.println(\"SUCCESS\");\n" +
+ " }\n" +
+ "}\n" +
+ "class Range<T extends Comparable<? super T>> {\n" +
+ " public boolean containsNC(T value) {\n" +
+ " return false;\n" +
+ " }\n" +
+ "}\n" +
+ "class NumberRange<T extends Number & Comparable<? super T>> extends Range<T> {\n" +
+ " public boolean contains(Comparable<?> value) {\n" +
+ " return castTo((Class) null).containsNC((Comparable) null);\n" +
+ " }\n" +
+ " public <N extends Number & Comparable<? super N>> NumberRange<N>\n" +
+ "castTo(Class<N> type) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}\n",
+ },
+ "SUCCESS");
+}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=366131
+public void test366131b() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String [] args) {\n" +
+ " Zork z;\n" +
+ " }\n" +
+ "}\n" +
+ "class Range<T extends Comparable<? super T>> {\n" +
+ " public boolean containsNC(T value) {\n" +
+ " return false;\n" +
+ " }\n" +
+ "}\n" +
+ "class NumberRange<T extends Number & Comparable<? super T>> extends Range<T> {\n" +
+ " public boolean contains(Comparable<?> value) {\n" +
+ " return castTo((Class) null).containsNC((Comparable) null);\n" +
+ " }\n" +
+ " public <N extends Number & Comparable<? super N>> NumberRange<N>\n" +
+ "castTo(Class<N> type) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " Zork z;\n" +
+ " ^^^^\n" +
+ "Zork cannot be resolved to a type\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 13)\n" +
+ " return castTo((Class) null).containsNC((Comparable) null);\n" +
+ " ^^^^^^^^^^^^^^^^^^^^\n" +
+ "Type safety: Unchecked invocation castTo(Class) of the generic method castTo(Class<N>) of type NumberRange<T>\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 13)\n" +
+ " return castTo((Class) null).containsNC((Comparable) null);\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Type safety: The method containsNC(Comparable) belongs to the raw type Range. References to generic type Range<T> should be parameterized\n" +
+ "----------\n" +
+ "4. WARNING in X.java (at line 13)\n" +
+ " return castTo((Class) null).containsNC((Comparable) null);\n" +
+ " ^^^^^^^^^^^^\n" +
+ "Type safety: The expression of type Class needs unchecked conversion to conform to Class<Number&Comparable<? super Number&Comparable<? super N>>>\n" +
+ "----------\n" +
+ "5. WARNING in X.java (at line 13)\n" +
+ " return castTo((Class) null).containsNC((Comparable) null);\n" +
+ " ^^^^^\n" +
+ "Class is a raw type. References to generic type Class<T> should be parameterized\n" +
+ "----------\n" +
+ "6. WARNING in X.java (at line 13)\n" +
+ " return castTo((Class) null).containsNC((Comparable) null);\n" +
+ " ^^^^^^^^^^\n" +
+ "Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" +
+ "----------\n");
+}
} \ No newline at end of file
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
index aee4ae049b..b1e3c0d0a4 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
@@ -15,7 +15,7 @@
#Format: compiler.name = word1 word2 word3
compiler.name = Eclipse Compiler for Java(TM)
#Format: compiler.version = 0.XXX[, other words (don't forget the comma if adding other words)]
-compiler.version = 0.B80_R36x_J7, 3.6.2+ Java7
+compiler.version = 0.B81_R36x_J7, 3.6.2+ Java7
compiler.copyright = Copyright IBM Corp 2000, 2011. All rights reserved.
### progress
diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html
index fa55124c16..fee1efe010 100644
--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html
+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html
@@ -41,6 +41,19 @@
</td>
</tr>
</table>
+<a name="v_B81_R36x_J7"></a>
+<hr><h1>
+Eclipse Platform Build Notes<br>
+Java development tools core</h1>
+Eclipse SDK 3.6.50 - %date%
+<br>Project org.eclipse.jdt.core v_B81_R36x_J7
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B81_R36x_J7">cvs</a>).
+<h2>What's new in this drop</h2>
+
+<h3>Problem Reports Fixed</h3>
+<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=366131">366131</a>
+[1.5][compiler] New generics compile error in Indigo SR1 for code that compiles in earlier Eclipse and javac
+
<a name="v_B80_R36x_J7"></a>
<hr><h1>
Eclipse Platform Build Notes<br>
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java
index 5458a307c0..4842fd7c8e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -667,7 +667,7 @@ public class ParameterizedTypeBinding extends ReferenceBinding implements Substi
}
break;
case Binding.INTERSECTION_TYPE :
- this.tagBits |= TagBits.HasDirectWildcard;
+ this.tagBits |= TagBits.HasDirectWildcard | TagBits.IsBoundParameterizedType; // Surely NOT X<?,?>, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=366131
break;
default :
this.tagBits |= TagBits.IsBoundParameterizedType;

Back to the top