Merge
authorlana
Wed, 04 Jan 2012 10:58:12 -0800
changeset 11385 1bf3713cb840
parent 11348 6561530ea757 (current diff)
parent 11384 6e1d14a4ff86 (diff)
child 11386 9d026cb0fb2f
Merge
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java	Wed Jul 05 17:59:00 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java	Wed Jan 04 10:58:12 2012 -0800
@@ -535,13 +535,14 @@
                         reader.putChar('.');
                         scanFractionAndSuffix(pos);
                     } else if (reader.ch == '.') {
+                        int savePos = reader.bp;
                         reader.putChar('.'); reader.putChar('.', true);
                         if (reader.ch == '.') {
                             reader.scanChar();
                             reader.putChar('.');
                             tk = TokenKind.ELLIPSIS;
                         } else {
-                            lexError(pos, "malformed.fp.lit");
+                            lexError(savePos, "illegal.dot");
                         }
                     } else {
                         tk = TokenKind.DOT;
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Jul 05 17:59:00 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Jan 04 10:58:12 2012 -0800
@@ -384,6 +384,9 @@
 compiler.err.illegal.underscore=\
     illegal underscore
 
+compiler.err.illegal.dot=\
+    illegal ''.''
+
 # 0: symbol
 compiler.err.illegal.qual.not.icls=\
     illegal qualifier; {0} is not an inner class
--- a/langtools/test/tools/javac/api/T6397104.java	Wed Jul 05 17:59:00 2017 +0200
+++ b/langtools/test/tools/javac/api/T6397104.java	Wed Jan 04 10:58:12 2012 -0800
@@ -26,10 +26,10 @@
  * @bug     6397104
  * @summary JSR 199: JavaFileManager.getFileForOutput should have sibling argument
  * @author  Peter von der Ah\u00e9
- * @ignore  this test should be rewritten when fixing 6473901
  */
 
 import java.io.File;
+import java.net.URI;
 import java.util.Arrays;
 import javax.tools.*;
 import javax.tools.JavaFileManager.Location;
@@ -52,10 +52,14 @@
             : fm.getJavaFileObjectsFromFiles(Arrays.asList(siblingFile)).iterator().next();
         FileObject fileObject =
             fm.getFileForOutput(location, "java.lang", relName, sibling);
-        if (!fileObject.toUri().getPath().equals(expectedPath))
-            throw new AssertionError("Expected " + expectedPath +
-                                     ", got " + fileObject.toUri().getPath());
-        System.out.format("OK: (%s, %s) => %s%n", siblingFile, relName, fileObject.toUri());
+
+        File expectedFile = new File(expectedPath).getCanonicalFile();
+        File fileObjectFile = new File(fileObject.toUri()).getCanonicalFile();
+
+        if (!fileObjectFile.equals(expectedFile))
+            throw new AssertionError("Expected " + expectedFile +
+                                     ", got " + fileObjectFile);
+        System.out.format("OK: (%s, %s) => %s%n", siblingFile, relName, fileObjectFile);
     }
 
     void test(boolean hasLocation, File siblingFile, String relName, String expectedPath)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/IllegalDot.java	Wed Jan 04 10:58:12 2012 -0800
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2011, 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.
+ */
+
+// key: compiler.err.illegal.dot
+// key: compiler.err.expected
+// key: compiler.err.illegal.start.of.type
+
+class X {
+    void m(Object.. args) { }
+}
--- a/langtools/test/tools/javac/generics/diamond/7046778/DiamondAndInnerClassTest.java	Wed Jul 05 17:59:00 2017 +0200
+++ b/langtools/test/tools/javac/generics/diamond/7046778/DiamondAndInnerClassTest.java	Wed Jan 04 10:58:12 2012 -0800
@@ -284,7 +284,7 @@
         try {
             ct.analyze();
         } catch (Throwable ex) {
-            throw new AssertionError("Error thron when compiling the following code:\n" + source.getCharContent(true));
+            throw new AssertionError("Error thrown when compiling the following code:\n" + source.getCharContent(true));
         }
         check();
     }
--- a/langtools/test/tools/javac/generics/inference/7086601/T7086601b.java	Wed Jul 05 17:59:00 2017 +0200
+++ b/langtools/test/tools/javac/generics/inference/7086601/T7086601b.java	Wed Jan 04 10:58:12 2012 -0800
@@ -146,7 +146,7 @@
         try {
             ct.analyze();
         } catch (Throwable ex) {
-            throw new AssertionError("Error thron when compiling the following code:\n" + source.getCharContent(true));
+            throw new AssertionError("Error thrown when compiling the following code:\n" + source.getCharContent(true));
         }
         check();
     }
--- a/langtools/test/tools/javac/generics/rawOverride/7062745/GenericOverrideTest.java	Wed Jul 05 17:59:00 2017 +0200
+++ b/langtools/test/tools/javac/generics/rawOverride/7062745/GenericOverrideTest.java	Wed Jan 04 10:58:12 2012 -0800
@@ -210,7 +210,7 @@
         try {
             ct.analyze();
         } catch (Throwable ex) {
-            throw new AssertionError("Error thron when compiling the following code:\n" + source.getCharContent(true));
+            throw new AssertionError("Error thrown when compiling the following code:\n" + source.getCharContent(true));
         }
         check();
     }
--- a/langtools/test/tools/javac/lambda/LambdaParserTest.java	Wed Jul 05 17:59:00 2017 +0200
+++ b/langtools/test/tools/javac/lambda/LambdaParserTest.java	Wed Jan 04 10:58:12 2012 -0800
@@ -238,7 +238,7 @@
         try {
             ct.parse();
         } catch (Throwable ex) {
-            throw new AssertionError("Error thron when parsing the following source:\n" + source.getCharContent(true));
+            throw new AssertionError("Error thrown when parsing the following source:\n" + source.getCharContent(true));
         }
         check();
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/parser/T4881269.java	Wed Jan 04 10:58:12 2012 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2011, 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 4881269
+ * @summary improve diagnostic for ill-formed tokens
+ * @compile/fail/ref=T4881269.out -XDrawDiagnostics T4881269.java
+ */
+
+public class T4881269 {
+    java.io..PrintStream s;
+    void m() { System.err..println(); }
+    void m(Object.. o) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/parser/T4881269.out	Wed Jan 04 10:58:12 2012 -0800
@@ -0,0 +1,9 @@
+T4881269.java:32:13: compiler.err.illegal.dot
+T4881269.java:33:27: compiler.err.illegal.dot
+T4881269.java:33:22: compiler.err.not.stmt
+T4881269.java:34:19: compiler.err.illegal.dot
+T4881269.java:34:20: compiler.err.expected: ';'
+T4881269.java:34:22: compiler.err.illegal.start.of.type
+T4881269.java:34:23: compiler.err.expected: token.identifier
+T4881269.java:34:25: compiler.err.expected: ';'
+8 errors