changeset 50430:c071cbedc651 condy-folding

fixing several failing regression tests
author vromero
date Wed, 02 May 2018 18:46:16 -0700
parents 11750f5c28cb
children 97341d327bc2
files src/java.base/share/classes/java/lang/Enum.java src/jdk.compiler/share/classes/com/sun/tools/javac/util/Constables.java test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Driver.java test/langtools/tools/javac/generics/inference/8176534/TestUncheckedCalls.java test/langtools/tools/javac/lambda/lambdaNaming/TestSerializedLambdaNameStability.java test/langtools/tools/javac/lvti/harness/NonDenotableTest.java
diffstat 6 files changed, 23 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/Enum.java	Mon Apr 30 09:46:37 2018 -0700
+++ b/src/java.base/share/classes/java/lang/Enum.java	Wed May 02 18:46:16 2018 -0700
@@ -207,8 +207,20 @@
         return (zuper == Enum.class) ? (Class<E>)clazz : (Class<E>)zuper;
     }
 
+    /**
+     * Return a nominal descriptor for this instance, if one can be
+     * constructed.  This object (and any classes needed to construct its
+     * nominal description) must be accessible from the class described by the
+     * {@code lookup} parameter.
+     *
+     * @param lookup A {@link MethodHandles.Lookup} to be used to perform
+     *               access control determinations
+     * @return An {@link Optional} containing the resulting nominal descriptor,
+     * or an empty {@link Optional} if one cannot be constructed or this object
+     * is not accessible from {@code lookup}
+     */
     @Override
-    public final Optional<EnumDesc<E>> describeConstable(MethodHandles.Lookup lookup) {
+    public final Optional<? extends ConstantDesc<? super E>> describeConstable(MethodHandles.Lookup lookup) {
         return getDeclaringClass()
                 .describeConstable(lookup)
                 .map(c -> EnumDesc.of(c, name));
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Constables.java	Mon Apr 30 09:46:37 2018 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Constables.java	Wed May 02 18:46:16 2018 -0700
@@ -811,7 +811,12 @@
                     IllegalAccessException |
                     IllegalArgumentException |
                     InvocationTargetException ex) {
-                log.error(tree, Errors.ReflectiveError(methodName.toString(), className, ex.getCause().getLocalizedMessage()));
+                if (ex.getCause() != null && ex.getCause().getLocalizedMessage() != null) {
+                    log.error(tree, Errors.ReflectiveError(methodName.toString(), className, ex.getCause().getLocalizedMessage()));
+                } else {
+                    log.error(tree, Errors.ReflectiveError(methodName.toString(), className, ex.toString()));
+                }
+
                 return null;
             }
         }
--- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Driver.java	Mon Apr 30 09:46:37 2018 -0700
+++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Driver.java	Wed May 02 18:46:16 2018 -0700
@@ -60,7 +60,7 @@
     }
 
     private final String[][] extraParamsCombinations = new String[][] {
-        new String[] { },
+        new String[] { "-XDfolding=false" },
         new String[] { "-g" },
     };
 
--- a/test/langtools/tools/javac/generics/inference/8176534/TestUncheckedCalls.java	Mon Apr 30 09:46:37 2018 -0700
+++ b/test/langtools/tools/javac/generics/inference/8176534/TestUncheckedCalls.java	Wed May 02 18:46:16 2018 -0700
@@ -223,7 +223,7 @@
         return Stream.of(decls)
                 .filter(d -> d.hasKind(DeclKind.NONE))
                 .flatMap(d -> Stream.of(d.returnKind(), d.argumentsKind(), d.typeVarsKind()))
-                .noneMatch(tk -> tk.ordinal() != 0);
+                .noneMatch((Enum<? extends Enum<?>> tk) -> tk.ordinal() != 0);
     }
 
     boolean tvarFilter() {
--- a/test/langtools/tools/javac/lambda/lambdaNaming/TestSerializedLambdaNameStability.java	Mon Apr 30 09:46:37 2018 -0700
+++ b/test/langtools/tools/javac/lambda/lambdaNaming/TestSerializedLambdaNameStability.java	Wed May 02 18:46:16 2018 -0700
@@ -163,6 +163,7 @@
             Path srcFile = Paths.get(sourceBaseDir, context, srcName + ".java");
             new JavacTask(tb)
                     .outdir(compiledDir)
+                    .options("-XDfolding=false")
                     .files(srcFile)
                     .run();
             Path cfFile = Paths.get(compiledDir, name + ".class");
--- a/test/langtools/tools/javac/lvti/harness/NonDenotableTest.java	Mon Apr 30 09:46:37 2018 -0700
+++ b/test/langtools/tools/javac/lvti/harness/NonDenotableTest.java	Wed May 02 18:46:16 2018 -0700
@@ -125,6 +125,7 @@
         @InferredType(SEL_INT_ENUM_SEL)
         var c = s;
         for (@InferredType(SEL_INT_ENUM_SEL) var s2 = s ; ;) { break; }
+        // the following two are failing after the change made to Enum (extending Constable)
         for (@InferredType(SEL_INT_ENUM_SEL) var s2 : arrayOf(s)) { break; }
         for (@InferredType(SEL_INT_ENUM_SEL) var s2 : listOf(s)) { break; }
     }