changeset 53176:8dfebd4f5126 lworld

8215246: [lworld]: Latest merge breaks langtools tests
author sadayapalam
date Wed, 12 Dec 2018 12:36:24 +0530
parents 9f53142ee638
children a2d1bb5a17dc
files src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java test/langtools/tools/javac/flags/FlagsTest.java test/langtools/tools/javac/valhalla/lworld-values/AnonymousValueType.java test/langtools/tools/javac/valhalla/lworld-values/IllegalByValueTest2.java test/langtools/tools/javac/valhalla/lworld-values/ValueModifierTest.java
diffstat 6 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java	Tue Dec 11 13:05:29 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java	Wed Dec 12 12:36:24 2018 +0530
@@ -443,6 +443,7 @@
         DEPRECATED_REMOVAL(Flags.DEPRECATED_REMOVAL),
         HAS_RESOURCE(Flags.HAS_RESOURCE),
         POTENTIALLY_AMBIGUOUS(Flags.POTENTIALLY_AMBIGUOUS),
+        VALUEBASED(Flags.VALUEBASED),
         ANONCONSTR_BASED(Flags.ANONCONSTR_BASED);
 
         Flag(long flag) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Tue Dec 11 13:05:29 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Wed Dec 12 12:36:24 2018 +0530
@@ -2301,14 +2301,13 @@
             return e;
         } else if (token.kind == LPAREN) {
             long badModifiers = mods.flags & ~(Flags.VALUE | Flags.FINAL);
-            if (badModifiers != 0) {
+            if (badModifiers != 0)
                 log.error(token.pos, Errors.ModNotAllowedHere(asFlagSet(badModifiers)));
-            }
             // handle type annotations for instantiations and anonymous classes
             if (newAnnotations.nonEmpty()) {
                 t = insertAnnotationsToMostInner(t, newAnnotations, false);
             }
-            JCNewClass newClass = classCreatorRest(newpos, null, typeArgs, t);
+            JCNewClass newClass = classCreatorRest(newpos, null, typeArgs, t, mods.flags);
             if ((newClass.def == null) && (mods.flags != 0)) {
                 badModifiers = (mods.flags & Flags.VALUE) != 0 ? mods.flags & ~Flags.FINAL : mods.flags;
                 log.error(newClass.pos, Errors.ModNotAllowedHere(asFlagSet(badModifiers)));
@@ -2338,7 +2337,7 @@
             t = typeArguments(t, true);
             mode = oldmode;
         }
-        return classCreatorRest(newpos, encl, typeArgs, t);
+        return classCreatorRest(newpos, encl, typeArgs, t, 0);
     }
 
     /** ArrayCreatorRest = [Annotations] "[" ( "]" BracketsOpt ArrayInitializer
@@ -2420,14 +2419,15 @@
     JCNewClass classCreatorRest(int newpos,
                                   JCExpression encl,
                                   List<JCExpression> typeArgs,
-                                  JCExpression t)
+                                  JCExpression t,
+                                  long flags)
     {
         List<JCExpression> args = arguments();
         JCClassDecl body = null;
         if (token.kind == LBRACE) {
             int pos = token.pos;
             List<JCTree> defs = classOrInterfaceBody(names.empty, false);
-            JCModifiers mods = F.at(Position.NOPOS).Modifiers(0);
+            JCModifiers mods = F.at(Position.NOPOS).Modifiers(flags);
             body = toP(F.at(pos).AnonymousClassDef(mods, defs));
         }
         JCNewClass newClass = toP(F.at(newpos).NewClass(encl, typeArgs, t, args, body));
--- a/test/langtools/tools/javac/flags/FlagsTest.java	Tue Dec 11 13:05:29 2018 -0800
+++ b/test/langtools/tools/javac/flags/FlagsTest.java	Wed Dec 12 12:36:24 2018 +0530
@@ -19,7 +19,7 @@
 
 /**
  * @test
- * @bug 8211138
+ * @bug 8211138 8215246
  * @summary Missing Flag enum constants
  * @library /tools/javac/lib
  * @modules jdk.compiler/com.sun.tools.javac.code
--- a/test/langtools/tools/javac/valhalla/lworld-values/AnonymousValueType.java	Tue Dec 11 13:05:29 2018 -0800
+++ b/test/langtools/tools/javac/valhalla/lworld-values/AnonymousValueType.java	Wed Dec 12 12:36:24 2018 +0530
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 8209400
+ * @bug 8209400 8215246
  * @summary Allow anonymous classes to be value types
  * @run main/othervm -Xverify:none -XX:+EnableValhalla AnonymousValueType
  */
--- a/test/langtools/tools/javac/valhalla/lworld-values/IllegalByValueTest2.java	Tue Dec 11 13:05:29 2018 -0800
+++ b/test/langtools/tools/javac/valhalla/lworld-values/IllegalByValueTest2.java	Wed Dec 12 12:36:24 2018 +0530
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8209400
+ * @bug 8209400 8215246
  * @summary Allow anonymous classes to be value types
  * @compile/fail/ref=IllegalByValueTest2.out -XDrawDiagnostics -XDdev IllegalByValueTest2.java
  */
--- a/test/langtools/tools/javac/valhalla/lworld-values/ValueModifierTest.java	Tue Dec 11 13:05:29 2018 -0800
+++ b/test/langtools/tools/javac/valhalla/lworld-values/ValueModifierTest.java	Wed Dec 12 12:36:24 2018 +0530
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8211910
+ * @bug 8211910 8215246
  * @summary Reinstate support for local value classes.
  * @compile/fail/ref=ValueModifierTest.out -XDrawDiagnostics -XDdev ValueModifierTest.java
  */