8215625: javax/sql/testng/util/xxxxx.java tests compilation failed after JDK-8207224
authorvromero
Wed, 19 Dec 2018 14:02:19 -0500
changeset 53046 9b0d6ecd8e45
parent 53045 7dac5301ce71
child 53047 b732de3068f4
8215625: javax/sql/testng/util/xxxxx.java tests compilation failed after JDK-8207224 Reviewed-by: mcimadamore
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
test/langtools/tools/javac/T8207224/ReturnTypeSubstitutableTest.java
test/langtools/tools/javac/T8207224/ReturnTypeSubstitutableTest.out
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java	Wed Dec 19 11:45:54 2018 +0000
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java	Wed Dec 19 14:02:19 2018 -0500
@@ -189,8 +189,7 @@
         SWITCH_MULTIPLE_CASE_LABELS(JDK13, Fragments.FeatureMultipleCaseLabels, DiagKind.PLURAL),
         SWITCH_RULE(JDK13, Fragments.FeatureSwitchRules, DiagKind.PLURAL),
         SWITCH_EXPRESSION(JDK13, Fragments.FeatureSwitchExpressions, DiagKind.PLURAL),
-        RAW_STRING_LITERALS(JDK13, Fragments.FeatureRawStringLiterals, DiagKind.PLURAL),
-        RETURN_TYPE_SUBSTITUTABLE_SAME_TYPE(JDK13);
+        RAW_STRING_LITERALS(JDK13, Fragments.FeatureRawStringLiterals, DiagKind.PLURAL);
 
         enum DiagKind {
             NORMAL,
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Wed Dec 19 11:45:54 2018 +0000
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Wed Dec 19 14:02:19 2018 -0500
@@ -91,7 +91,6 @@
     final Names names;
     final boolean allowDefaultMethods;
     final boolean mapCapturesToBounds;
-    final boolean returnTypeSustitutableSameType;
     final Check chk;
     final Enter enter;
     JCDiagnostic.Factory diags;
@@ -115,7 +114,6 @@
         Source source = Source.instance(context);
         allowDefaultMethods = Feature.DEFAULT_METHODS.allowedInSource(source);
         mapCapturesToBounds = Feature.MAP_CAPTURES_TO_BOUNDS.allowedInSource(source);
-        returnTypeSustitutableSameType = Feature.RETURN_TYPE_SUBSTITUTABLE_SAME_TYPE.allowedInSource(source);
         chk = Check.instance(context);
         enter = Enter.instance(context);
         capturedName = names.fromString("<captured wildcard>");
@@ -4237,13 +4235,8 @@
             return covariantReturnType(r1.getReturnType(), r2res, warner);
         if (isSubtypeUnchecked(r1.getReturnType(), r2res, warner))
             return true;
-        if (returnTypeSustitutableSameType) {
-            if (!isSameType(r1.getReturnType(), erasure(r2res)))
-                return false;
-        } else {
-            if (!isSubtype(r1.getReturnType(), erasure(r2res)))
-                return false;
-        }
+        if (!isSubtype(r1.getReturnType(), erasure(r2res)))
+            return false;
         warner.warn(LintCategory.UNCHECKED);
         return true;
     }
--- a/test/langtools/tools/javac/T8207224/ReturnTypeSubstitutableTest.java	Wed Dec 19 11:45:54 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * @test /nodynamiccopyright/
- * @bug 8207224
- * @summary Javac compiles source code despite illegal use of unchecked conversions
- * @compile/fail/ref=ReturnTypeSubstitutableTest.out -XDrawDiagnostics ReturnTypeSubstitutableTest.java
- * @compile -source 12 ReturnTypeSubstitutableTest.java
- */
-
-class ReturnTypeSubstitutableTest {
-    abstract class AbstractDemo<Request extends AbstractResult, Response extends AbstractResult> {
-        protected abstract Response test(Request request);
-    }
-
-    abstract interface AbstractResult {}
-
-    abstract interface SimpleResult extends AbstractResult {}
-
-    class Result1 implements SimpleResult {}
-
-    class OtherResult implements AbstractResult {}
-
-    public class SimpleDemo<Request extends AbstractResult, Response extends AbstractResult> extends AbstractDemo<Request, Response> {
-        @Override
-        protected SimpleResult test(AbstractResult request) {
-            return null;
-        }
-    }
-}
--- a/test/langtools/tools/javac/T8207224/ReturnTypeSubstitutableTest.out	Wed Dec 19 11:45:54 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-ReturnTypeSubstitutableTest.java:24:32: compiler.err.override.incompatible.ret: (compiler.misc.cant.override: test(ReturnTypeSubstitutableTest.AbstractResult), ReturnTypeSubstitutableTest.SimpleDemo, test(Request), ReturnTypeSubstitutableTest.AbstractDemo), ReturnTypeSubstitutableTest.SimpleResult, Response
-1 error