changeset 45754:740593904730

8182649: Unable to integrate due to compilation error Reviewed-by: mcimadamore
author vromero
date Thu, 29 Jun 2017 08:24:25 -0700
parents 567c159ce16f
children 48b1fb3acdab
files langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java langtools/test/tools/javac/T8182649/AddCheckForPartiallyInferredTypesTest.java langtools/test/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.out langtools/test/tools/javac/lambda/8016177/T8016177g.out
diffstat 5 files changed, 58 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Thu Jun 29 07:19:44 2017 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Thu Jun 29 08:24:25 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -311,6 +311,15 @@
         if (tPrimitive == sPrimitive) {
             return isSubtypeUnchecked(t, s, warn);
         }
+        boolean tUndet = t.hasTag(UNDETVAR);
+        boolean sUndet = s.hasTag(UNDETVAR);
+
+        if (tUndet || sUndet) {
+            return tUndet ?
+                    isSubtype(t, boxedTypeOrType(s)) :
+                    isSubtype(boxedTypeOrType(t), s);
+        }
+
         return tPrimitive
             ? isSubtype(boxedClass(t).type, s)
             : isSubtype(unboxedType(t), s);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Jun 29 07:19:44 2017 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Jun 29 08:24:25 2017 -0700
@@ -416,8 +416,6 @@
             if (needsEagerInstantiation((UndetVar)qtype, to, inferenceContext) &&
                     (allowGraphInference || !to.isPrimitive())) {
                 to = generateReferenceToTargetConstraint(tree, (UndetVar)qtype, to, resultInfo, inferenceContext);
-            } else if (to.isPrimitive()) {
-                to = types.boxedClass(to).type;
             }
         } else if (rsInfoInfContext.free(resultInfo.pt)) {
             //propagation - cache captured vars
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8182649/AddCheckForPartiallyInferredTypesTest.java	Thu Jun 29 08:24:25 2017 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8182649
+ * @summary Unable to integrate due to compilation error
+ * @compile AddCheckForPartiallyInferredTypesTest.java
+ */
+
+class AddCheckForPartiallyInferredTypesTest {
+    interface Signed {}
+    interface WordBase {}
+
+    <S extends Signed> S signed(int offset) { return null; }
+    <W1 extends WordBase> W1 readWord(WordBase w,String s) { return null; }
+    <W2 extends WordBase> W2 readWord(int i,String s) { return null; }
+    <W3 extends WordBase> W3 test() {
+        return readWord(signed(10), "");
+    }
+}
--- a/langtools/test/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.out	Thu Jun 29 07:19:44 2017 -0700
+++ b/langtools/test/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.out	Thu Jun 29 08:24:25 2017 -0700
@@ -34,12 +34,12 @@
 EagerReturnTypeResolutionTestb.java:112:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
 EagerReturnTypeResolutionTestb.java:113:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>)
 EagerReturnTypeResolutionTestb.java:114:24: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.upper.bounds: T, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>,java.lang.Object)
-EagerReturnTypeResolutionTestb.java:174:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: , T, long))
-EagerReturnTypeResolutionTestb.java:175:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: , T, long))
-EagerReturnTypeResolutionTestb.java:176:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: , T, long))
-EagerReturnTypeResolutionTestb.java:178:26: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long)
-EagerReturnTypeResolutionTestb.java:179:23: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long)
-EagerReturnTypeResolutionTestb.java:180:26: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long)
+EagerReturnTypeResolutionTestb.java:174:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Double, java.lang.Long,java.lang.Object))
+EagerReturnTypeResolutionTestb.java:175:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Double, java.lang.Long,java.lang.Object))
+EagerReturnTypeResolutionTestb.java:176:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Double, java.lang.Long,java.lang.Double,java.lang.Object))
+EagerReturnTypeResolutionTestb.java:178:26: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Double, java.lang.Long,java.lang.Object)
+EagerReturnTypeResolutionTestb.java:179:23: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Double, java.lang.Long,java.lang.Object)
+EagerReturnTypeResolutionTestb.java:180:26: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Double, java.lang.Long,java.lang.Double,java.lang.Object)
 - compiler.note.unchecked.filename: EagerReturnTypeResolutionTestb.java
 - compiler.note.unchecked.recompile
 42 errors
--- a/langtools/test/tools/javac/lambda/8016177/T8016177g.out	Thu Jun 29 07:19:44 2017 -0700
+++ b/langtools/test/tools/javac/lambda/8016177/T8016177g.out	Thu Jun 29 08:24:25 2017 -0700
@@ -1,3 +1,3 @@
 T8016177g.java:34:14: compiler.err.cant.apply.symbol: kindname.method, print, java.lang.String, Test.Person, kindname.class, Test, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.upper.lower.bounds: R, java.lang.String,java.lang.Object, Test.Person))
-T8016177g.java:35:20: compiler.err.cant.apply.symbol: kindname.method, abs, int, java.lang.Double, kindname.class, Test, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: , R, int))
+T8016177g.java:35:20: compiler.err.cant.apply.symbol: kindname.method, abs, int, java.lang.Double, kindname.class, Test, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Double, java.lang.Integer,java.lang.Object))
 2 errors