changeset 47872:073148861230 datum

fixing several failing javac tests
author vromero
date Thu, 09 Nov 2017 01:00:06 -0500
parents 100ea752fd11
children 901069374bd6
files src/jdk.compiler/share/classes/com/sun/tools/javac/code/Accessors.java test/langtools/tools/javac/annotations/typeAnnotations/failures/AnnotatedImport.out test/langtools/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.out test/langtools/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage2.out test/langtools/tools/javac/doctree/AccessorsTest.java test/langtools/tools/javac/doctree/DocCommentTester.java test/langtools/tools/javac/enum/EnumMembersOrder.out test/langtools/tools/javac/lib/DPrinter.java test/langtools/tools/javac/parser/JavacParserTest.java test/langtools/tools/javac/parser/SingleCommaAnnotationValueFail.out test/langtools/tools/javac/parser/extend/TrialParser.java test/langtools/tools/javac/tree/JavacTreeScannerTest.java test/langtools/tools/javac/tree/SourceTreeScannerTest.java
diffstat 13 files changed, 69 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Accessors.java	Wed Nov 08 20:26:02 2017 -0500
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Accessors.java	Thu Nov 09 01:00:06 2017 -0500
@@ -48,7 +48,7 @@
             }
         };
 
-        Function<Names, Name> nameFunc;
+        private final Function<Names, Name> nameFunc;
 
         Kind(Function<Names, Name> nameFunc) {
             this.nameFunc = nameFunc;
--- a/test/langtools/tools/javac/annotations/typeAnnotations/failures/AnnotatedImport.out	Wed Nov 08 20:26:02 2017 -0500
+++ b/test/langtools/tools/javac/annotations/typeAnnotations/failures/AnnotatedImport.out	Thu Nov 09 01:00:06 2017 -0500
@@ -1,7 +1,7 @@
 AnnotatedImport.java:10:13: compiler.err.expected: token.identifier
-AnnotatedImport.java:10:16: compiler.err.expected3: class, interface, enum
+AnnotatedImport.java:10:16: compiler.err.expected4: class, interface, enum, __datum
 AnnotatedImport.java:11:7: compiler.err.expected: token.identifier
-AnnotatedImport.java:11:11: compiler.err.expected3: class, interface, enum
+AnnotatedImport.java:11:11: compiler.err.expected4: class, interface, enum, __datum
 AnnotatedImport.java:12:18: compiler.err.expected: token.identifier
-AnnotatedImport.java:12:21: compiler.err.expected3: class, interface, enum
+AnnotatedImport.java:12:21: compiler.err.expected4: class, interface, enum, __datum
 6 errors
--- a/test/langtools/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.out	Wed Nov 08 20:26:02 2017 -0500
+++ b/test/langtools/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.out	Thu Nov 09 01:00:06 2017 -0500
@@ -1,3 +1,3 @@
 AnnotatedPackage1.java:9:14: compiler.err.expected: token.identifier
-AnnotatedPackage1.java:9:17: compiler.err.expected3: class, interface, enum
+AnnotatedPackage1.java:9:17: compiler.err.expected4: class, interface, enum, __datum
 2 errors
--- a/test/langtools/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage2.out	Wed Nov 08 20:26:02 2017 -0500
+++ b/test/langtools/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage2.out	Thu Nov 09 01:00:06 2017 -0500
@@ -1,3 +1,3 @@
 AnnotatedPackage2.java:9:8: compiler.err.expected: token.identifier
-AnnotatedPackage2.java:9:12: compiler.err.expected3: class, interface, enum
+AnnotatedPackage2.java:9:12: compiler.err.expected4: class, interface, enum, __datum
 2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/doctree/AccessorsTest.java	Thu Nov 09 01:00:06 2017 -0500
@@ -0,0 +1,32 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+public class AccessorsTest {
+    /**
+     * @getter This is a getter.
+     * @setter This is a setter.
+     */
+    int x;
+}
--- a/test/langtools/tools/javac/doctree/DocCommentTester.java	Wed Nov 08 20:26:02 2017 -0500
+++ b/test/langtools/tools/javac/doctree/DocCommentTester.java	Thu Nov 09 01:00:06 2017 -0500
@@ -758,6 +758,17 @@
                 else
                     return s;
             }
+
+            @Override
+            public Void visitAccessor(AccessorTree node, Void p) {
+                header(node);
+                indent(+1);
+                print("description", node.getDescription());
+                indent(-1);
+                indent();
+                out.println("]");
+                return null;
+            }
         }
     }
 
--- a/test/langtools/tools/javac/enum/EnumMembersOrder.out	Wed Nov 08 20:26:02 2017 -0500
+++ b/test/langtools/tools/javac/enum/EnumMembersOrder.out	Thu Nov 09 01:00:06 2017 -0500
@@ -1,7 +1,7 @@
 EnumMembersOrder.java:11:16: compiler.err.expected: ')'
 EnumMembersOrder.java:11:17: compiler.err.expected3: ',', '}', ';'
 EnumMembersOrder.java:11:18: compiler.err.expected: '}'
-EnumMembersOrder.java:11:31: compiler.err.expected3: class, interface, enum
-EnumMembersOrder.java:17:13: compiler.err.expected3: class, interface, enum
-EnumMembersOrder.java:19:1: compiler.err.expected3: class, interface, enum
+EnumMembersOrder.java:11:31: compiler.err.expected4: class, interface, enum, __datum
+EnumMembersOrder.java:17:13: compiler.err.expected4: class, interface, enum, __datum
+EnumMembersOrder.java:19:1: compiler.err.expected4: class, interface, enum, __datum
 6 errors
--- a/test/langtools/tools/javac/lib/DPrinter.java	Wed Nov 08 20:26:02 2017 -0500
+++ b/test/langtools/tools/javac/lib/DPrinter.java	Thu Nov 09 01:00:06 2017 -0500
@@ -1197,6 +1197,12 @@
         public Void visitTree(DocTree node, Void p) {
             return null;
         }
+
+        @Override
+        public Void visitAccessor(AccessorTree node, Void p) {
+            printList("desc", node.getDescription());
+            return visitTree(node, null);
+        }
     }
 
     // </editor-fold>
--- a/test/langtools/tools/javac/parser/JavacParserTest.java	Wed Nov 08 20:26:02 2017 -0500
+++ b/test/langtools/tools/javac/parser/JavacParserTest.java	Thu Nov 09 01:00:06 2017 -0500
@@ -993,7 +993,7 @@
     @Test //JDK-8065753
     void testWrongFirstToken() throws IOException {
         String code = "<";
-        String expectedErrors = "Test.java:1:1: compiler.err.expected3: class, interface, enum\n" +
+        String expectedErrors = "Test.java:1:1: compiler.err.expected4: class, interface, enum, __datum\n" +
                                 "1 error\n";
         StringWriter out = new StringWriter();
         JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(out, fm, null,
--- a/test/langtools/tools/javac/parser/SingleCommaAnnotationValueFail.out	Wed Nov 08 20:26:02 2017 -0500
+++ b/test/langtools/tools/javac/parser/SingleCommaAnnotationValueFail.out	Thu Nov 09 01:00:06 2017 -0500
@@ -1,3 +1,3 @@
 SingleCommaAnnotationValueFail.java:34:12: compiler.err.expected: '}'
-SingleCommaAnnotationValueFail.java:34:14: compiler.err.expected3: class, interface, enum
+SingleCommaAnnotationValueFail.java:34:14: compiler.err.expected4: class, interface, enum, __datum
 2 errors
--- a/test/langtools/tools/javac/parser/extend/TrialParser.java	Wed Nov 08 20:26:02 2017 -0500
+++ b/test/langtools/tools/javac/parser/extend/TrialParser.java	Thu Nov 09 01:00:06 2017 -0500
@@ -173,7 +173,7 @@
                 if (token.kind == CLASS
                         || token.kind == INTERFACE
                         || token.kind == ENUM) {
-                    return List.<JCTree>of(classOrInterfaceOrEnumDeclaration(mods, dc));
+                    return List.<JCTree>of(classOrDatumOrInterfaceOrEnumDeclaration(mods, dc));
                 } else {
                     int pos = token.pos;
                     List<JCTypeParameter> typarams = typeParametersOpt();
--- a/test/langtools/tools/javac/tree/JavacTreeScannerTest.java	Wed Nov 08 20:26:02 2017 -0500
+++ b/test/langtools/tools/javac/tree/JavacTreeScannerTest.java	Thu Nov 09 01:00:06 2017 -0500
@@ -47,12 +47,14 @@
 import java.io.*;
 import java.lang.reflect.*;
 import java.util.*;
+
 import javax.tools.*;
 
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
 import com.sun.tools.javac.tree.TreeScanner;
 import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.Pair;
 
 public class JavacTreeScannerTest extends AbstractTreeScannerTest {
     /**
@@ -148,6 +150,8 @@
                 List<?> list = (List<?>) o;
                 for (Object item: list)
                     reflectiveScan(item);
+            } else if (o instanceof Pair) {
+                return;
             } else
                 error("unexpected item: " + o);
         }
--- a/test/langtools/tools/javac/tree/SourceTreeScannerTest.java	Wed Nov 08 20:26:02 2017 -0500
+++ b/test/langtools/tools/javac/tree/SourceTreeScannerTest.java	Thu Nov 09 01:00:06 2017 -0500
@@ -47,6 +47,7 @@
 import java.io.*;
 import java.lang.reflect.*;
 import java.util.*;
+
 import javax.tools.*;
 
 import com.sun.source.tree.Tree;
@@ -56,6 +57,7 @@
 import com.sun.tools.javac.tree.JCTree.JCModuleDecl;
 import com.sun.tools.javac.tree.JCTree.TypeBoundKind;
 import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.Pair;
 
 public class SourceTreeScannerTest extends AbstractTreeScannerTest {
     /**
@@ -161,6 +163,8 @@
                 List<?> list = (List<?>) o;
                 for (Object item: list)
                     reflectiveScan(item);
+            } else if (o instanceof Pair) {
+                return;
             } else
                 error("unexpected item: " + o);
         }