6999438: remove support for exotic identifiers from JDK 7

Thu, 18 Nov 2010 16:13:11 -0800

author
jjg
date
Thu, 18 Nov 2010 16:13:11 -0800
changeset 752
03177f49411d
parent 751
abaceae7c9f8
child 753
2536dedd897e

6999438: remove support for exotic identifiers from JDK 7
Reviewed-by: mcimadamore

src/share/classes/com/sun/tools/javac/code/Source.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/jvm/ClassReader.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/parser/Scanner.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/resources/compiler.properties file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/EmptyBytecodeIdent.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/IllegalBytecodeIdentChar.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/UnclosedBytecodeIdent.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/UnsupportedExoticID.java file | annotate | diff | comparison | revisions
test/tools/javac/meth/InvokeDyn.java file | annotate | diff | comparison | revisions
test/tools/javac/meth/InvokeDynTrans.java file | annotate | diff | comparison | revisions
test/tools/javac/meth/InvokeDynTrans.out file | annotate | diff | comparison | revisions
test/tools/javac/quid/QuotedIdent.java file | annotate | diff | comparison | revisions
test/tools/javac/quid/QuotedIdent2.java file | annotate | diff | comparison | revisions
test/tools/javac/quid/T6999438.java file | annotate | diff | comparison | revisions
test/tools/javac/quid/T6999438.out file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/javac/code/Source.java	Wed Nov 17 15:07:43 2010 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Source.java	Thu Nov 18 16:13:11 2010 -0800
     1.3 @@ -174,9 +174,6 @@
     1.4      public boolean allowUnderscoresInLiterals() {
     1.5          return compareTo(JDK1_7) >= 0;
     1.6      }
     1.7 -    public boolean allowExoticIdentifiers() {
     1.8 -        return compareTo(JDK1_7) >= 0;
     1.9 -    }
    1.10      public boolean allowStringsInSwitch() {
    1.11          return compareTo(JDK1_7) >= 0;
    1.12      }
     2.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Wed Nov 17 15:07:43 2010 -0800
     2.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Nov 18 16:13:11 2010 -0800
     2.3 @@ -2615,7 +2615,6 @@
     2.4                      String binaryName = fileManager.inferBinaryName(currentLoc, fo);
     2.5                      String simpleName = binaryName.substring(binaryName.lastIndexOf(".") + 1);
     2.6                      if (SourceVersion.isIdentifier(simpleName) ||
     2.7 -                        fo.getKind() == JavaFileObject.Kind.CLASS ||
     2.8                          simpleName.equals("package-info"))
     2.9                          includeClassFile(p, fo);
    2.10                      break;
     3.1 --- a/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Wed Nov 17 15:07:43 2010 -0800
     3.2 +++ b/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Thu Nov 18 16:13:11 2010 -0800
     3.3 @@ -66,10 +66,6 @@
     3.4       */
     3.5      private boolean allowUnderscoresInLiterals;
     3.6  
     3.7 -    /** Allow exotic identifiers.
     3.8 -     */
     3.9 -    private boolean allowExoticIdentifiers;
    3.10 -
    3.11      /** The source language setting.
    3.12       */
    3.13      private Source source;
    3.14 @@ -143,7 +139,6 @@
    3.15          allowBinaryLiterals = source.allowBinaryLiterals();
    3.16          allowHexFloats = source.allowHexFloats();
    3.17          allowUnderscoresInLiterals = source.allowBinaryLiterals();
    3.18 -        allowExoticIdentifiers = source.allowExoticIdentifiers();  // for invokedynamic
    3.19      }
    3.20  
    3.21      private static final boolean hexFloatsWork = hexFloatsWork();
    3.22 @@ -295,7 +290,7 @@
    3.23  
    3.24      /** Read next character in character or string literal and copy into sbuf.
    3.25       */
    3.26 -    private void scanLitChar(boolean forBytecodeName) {
    3.27 +    private void scanLitChar() {
    3.28          if (ch == '\\') {
    3.29              if (buf[bp+1] == '\\' && unicodeConversionBp != bp) {
    3.30                  bp++;
    3.31 @@ -335,18 +330,6 @@
    3.32                      putChar('\"'); scanChar(); break;
    3.33                  case '\\':
    3.34                      putChar('\\'); scanChar(); break;
    3.35 -                case '|': case ',': case '?': case '%':
    3.36 -                case '^': case '_': case '{': case '}':
    3.37 -                case '!': case '-': case '=':
    3.38 -                    if (forBytecodeName) {
    3.39 -                        // Accept escape sequences for dangerous bytecode chars.
    3.40 -                        // This is illegal in normal Java string or character literals.
    3.41 -                        // Note that the escape sequence itself is passed through.
    3.42 -                        putChar('\\'); putChar(ch); scanChar();
    3.43 -                    } else {
    3.44 -                        lexError(bp, "illegal.esc.char");
    3.45 -                    }
    3.46 -                    break;
    3.47                  default:
    3.48                      lexError(bp, "illegal.esc.char");
    3.49                  }
    3.50 @@ -355,24 +338,6 @@
    3.51              putChar(ch); scanChar();
    3.52          }
    3.53      }
    3.54 -    private void scanLitChar() {
    3.55 -        scanLitChar(false);
    3.56 -    }
    3.57 -
    3.58 -    /** Read next character in an exotic name #"foo"
    3.59 -     */
    3.60 -    private void scanBytecodeNameChar() {
    3.61 -        switch (ch) {
    3.62 -        // reject any "dangerous" char which is illegal somewhere in the JVM spec
    3.63 -        // cf. http://blogs.sun.com/jrose/entry/symbolic_freedom_in_the_vm
    3.64 -        case '/': case '.': case ';':  // illegal everywhere
    3.65 -        case '<': case '>':  // illegal in methods, dangerous in classes
    3.66 -        case '[':  // illegal in classes
    3.67 -            lexError(bp, "illegal.bytecode.ident.char", String.valueOf((int)ch));
    3.68 -            break;
    3.69 -        }
    3.70 -        scanLitChar(true);
    3.71 -    }
    3.72  
    3.73      private void scanDigits(int digitRadix) {
    3.74          char saveCh;
    3.75 @@ -970,30 +935,6 @@
    3.76                          lexError(pos, "unclosed.str.lit");
    3.77                      }
    3.78                      return;
    3.79 -                case '#':
    3.80 -                    scanChar();
    3.81 -                    if (ch == '\"') {
    3.82 -                        if (!allowExoticIdentifiers) {
    3.83 -                            lexError("unsupported.exotic.id", source.name);
    3.84 -                            allowExoticIdentifiers = true;
    3.85 -                        }
    3.86 -                        scanChar();
    3.87 -                        if (ch == '\"')
    3.88 -                            lexError(pos, "empty.bytecode.ident");
    3.89 -                        while (ch != '\"' && ch != CR && ch != LF && bp < buflen) {
    3.90 -                            scanBytecodeNameChar();
    3.91 -                        }
    3.92 -                        if (ch == '\"') {
    3.93 -                            name = names.fromChars(sbuf, 0, sp);
    3.94 -                            token = IDENTIFIER;  // even if #"int" or #"do"
    3.95 -                            scanChar();
    3.96 -                        } else {
    3.97 -                            lexError(pos, "unclosed.bytecode.ident");
    3.98 -                        }
    3.99 -                    } else {
   3.100 -                        lexError("illegal.char", String.valueOf((int)'#'));
   3.101 -                    }
   3.102 -                    return;
   3.103                  default:
   3.104                      if (isSpecial(ch)) {
   3.105                          scanOperator();
     4.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Nov 17 15:07:43 2010 -0800
     4.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Nov 18 16:13:11 2010 -0800
     4.3 @@ -153,8 +153,6 @@
     4.4  
     4.5  compiler.err.else.without.if=\
     4.6      ''else'' without ''if''
     4.7 -compiler.err.empty.bytecode.ident=\
     4.8 -    empty bytecode identifier
     4.9  compiler.err.empty.char.lit=\
    4.10      empty character literal
    4.11  compiler.err.encl.class.required=\
    4.12 @@ -201,8 +199,6 @@
    4.13  
    4.14  compiler.err.icls.cant.have.static.decl=\
    4.15      inner classes cannot have static declarations
    4.16 -compiler.err.illegal.bytecode.ident.char=\
    4.17 -    illegal bytecode identifier character: \\{0}
    4.18  compiler.err.illegal.char=\
    4.19      illegal character: \\{0}
    4.20  compiler.err.illegal.char.for.encoding=\
    4.21 @@ -472,8 +468,6 @@
    4.22  compiler.err.types.incompatible.diff.ret=\
    4.23      types {0} and {1} are incompatible; both define {2}, but with unrelated return types
    4.24  
    4.25 -compiler.err.unclosed.bytecode.ident=\
    4.26 -    unclosed bytecode identifier
    4.27  compiler.err.unclosed.char.lit=\
    4.28      unclosed character literal
    4.29  compiler.err.unclosed.comment=\
    4.30 @@ -1269,10 +1263,6 @@
    4.31      underscores in literals are not supported in -source {0}\n\
    4.32  (use -source 7 or higher to enable underscores in literals)
    4.33  
    4.34 -compiler.err.unsupported.exotic.id=\
    4.35 -    exotic identifiers #"___" are not supported in -source {0}\n\
    4.36 -(use -source 7 or higher to enable exotic identifiers)
    4.37 -
    4.38  compiler.err.try.with.resources.not.supported.in.source=\
    4.39      try-with-resources is not supported in -source {0}\n\
    4.40  (use -source 7 or higher to enable try-with-resources)
     5.1 --- a/test/tools/javac/diags/examples/EmptyBytecodeIdent.java	Wed Nov 17 15:07:43 2010 -0800
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,28 +0,0 @@
     5.4 -/*
     5.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     5.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.7 - *
     5.8 - * This code is free software; you can redistribute it and/or modify it
     5.9 - * under the terms of the GNU General Public License version 2 only, as
    5.10 - * published by the Free Software Foundation.
    5.11 - *
    5.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
    5.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    5.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    5.15 - * version 2 for more details (a copy is included in the LICENSE file that
    5.16 - * accompanied this code).
    5.17 - *
    5.18 - * You should have received a copy of the GNU General Public License version
    5.19 - * 2 along with this work; if not, write to the Free Software Foundation,
    5.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    5.21 - *
    5.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    5.23 - * or visit www.oracle.com if you need additional information or have any
    5.24 - * questions.
    5.25 - */
    5.26 -
    5.27 -// key: compiler.err.empty.bytecode.ident
    5.28 -
    5.29 -class EmptyBytecodeIdent {
    5.30 -    int #"" = 3;
    5.31 -}
     6.1 --- a/test/tools/javac/diags/examples/IllegalBytecodeIdentChar.java	Wed Nov 17 15:07:43 2010 -0800
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,28 +0,0 @@
     6.4 -/*
     6.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     6.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.7 - *
     6.8 - * This code is free software; you can redistribute it and/or modify it
     6.9 - * under the terms of the GNU General Public License version 2 only, as
    6.10 - * published by the Free Software Foundation.
    6.11 - *
    6.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
    6.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    6.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    6.15 - * version 2 for more details (a copy is included in the LICENSE file that
    6.16 - * accompanied this code).
    6.17 - *
    6.18 - * You should have received a copy of the GNU General Public License version
    6.19 - * 2 along with this work; if not, write to the Free Software Foundation,
    6.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    6.21 - *
    6.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    6.23 - * or visit www.oracle.com if you need additional information or have any
    6.24 - * questions.
    6.25 - */
    6.26 -
    6.27 -// key: compiler.err.illegal.bytecode.ident.char
    6.28 -
    6.29 -class IllegalBytecodeIdentChar {
    6.30 -    int #"abc/def" = 3;
    6.31 -}
     7.1 --- a/test/tools/javac/diags/examples/UnclosedBytecodeIdent.java	Wed Nov 17 15:07:43 2010 -0800
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,28 +0,0 @@
     7.4 -/*
     7.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     7.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.7 - *
     7.8 - * This code is free software; you can redistribute it and/or modify it
     7.9 - * under the terms of the GNU General Public License version 2 only, as
    7.10 - * published by the Free Software Foundation.
    7.11 - *
    7.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
    7.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    7.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    7.15 - * version 2 for more details (a copy is included in the LICENSE file that
    7.16 - * accompanied this code).
    7.17 - *
    7.18 - * You should have received a copy of the GNU General Public License version
    7.19 - * 2 along with this work; if not, write to the Free Software Foundation,
    7.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    7.21 - *
    7.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    7.23 - * or visit www.oracle.com if you need additional information or have any
    7.24 - * questions.
    7.25 - */
    7.26 -
    7.27 -// key: compiler.err.unclosed.bytecode.ident
    7.28 -
    7.29 -class UnclosedBytecodeIdent {
    7.30 -    int #"abc
    7.31 -}
     8.1 --- a/test/tools/javac/diags/examples/UnsupportedExoticID.java	Wed Nov 17 15:07:43 2010 -0800
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,31 +0,0 @@
     8.4 -/*
     8.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     8.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.7 - *
     8.8 - * This code is free software; you can redistribute it and/or modify it
     8.9 - * under the terms of the GNU General Public License version 2 only, as
    8.10 - * published by the Free Software Foundation.
    8.11 - *
    8.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
    8.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    8.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    8.15 - * version 2 for more details (a copy is included in the LICENSE file that
    8.16 - * accompanied this code).
    8.17 - *
    8.18 - * You should have received a copy of the GNU General Public License version
    8.19 - * 2 along with this work; if not, write to the Free Software Foundation,
    8.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    8.21 - *
    8.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    8.23 - * or visit www.oracle.com if you need additional information or have any
    8.24 - * questions.
    8.25 - */
    8.26 -
    8.27 -// key: compiler.err.unsupported.exotic.id
    8.28 -// options: -source 6
    8.29 -
    8.30 -class UnsupportedExoticID {
    8.31 -    void m() {
    8.32 -        Object #"Hello!" = null;
    8.33 -    }
    8.34 -}
     9.1 --- a/test/tools/javac/meth/InvokeDyn.java	Wed Nov 17 15:07:43 2010 -0800
     9.2 +++ b/test/tools/javac/meth/InvokeDyn.java	Thu Nov 18 16:13:11 2010 -0800
     9.3 @@ -58,7 +58,7 @@
     9.4          ojunk = InvokeDynamic.greet(x, "mundus", 456);
     9.5          ojunk = InvokeDynamic.greet(x, "kosmos", 789);
     9.6          ojunk = (String) InvokeDynamic.cogitate(10.11121, 3.14);
     9.7 -        InvokeDynamic.#"yow: what I mean to say is, please treat this one specially"(null);
     9.8 +        //InvokeDynamic.#"yow: what I mean to say is, please treat this one specially"(null);
     9.9          ijunk = (int) InvokeDynamic.invoke("goodbye");
    9.10      }
    9.11  }
    10.1 --- a/test/tools/javac/meth/InvokeDynTrans.java	Wed Nov 17 15:07:43 2010 -0800
    10.2 +++ b/test/tools/javac/meth/InvokeDynTrans.java	Thu Nov 18 16:13:11 2010 -0800
    10.3 @@ -1,5 +1,5 @@
    10.4  /*
    10.5 - * Copyright (c) 2008-2010, Oracle and/or its affiliates. All rights reserved.
    10.6 + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
    10.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.8   *
    10.9   * This code is free software; you can redistribute it and/or modify it
   10.10 @@ -53,7 +53,7 @@
   10.11          InvokeDynamic.greet(x, "mundus", 456);
   10.12          InvokeDynamic.greet(x, "kosmos", 789);
   10.13          InvokeDynamic.<String>cogitate(10.11121, 3.14);
   10.14 -        InvokeDynamic.<void>#"yow: what I mean to say is, please treat this one specially"(null);
   10.15 +        //InvokeDynamic.<void>#"yow: what I mean to say is, please treat this one specially"(null);
   10.16          InvokeDynamic.<int>invoke("goodbye");
   10.17      }
   10.18  }
    11.1 --- a/test/tools/javac/meth/InvokeDynTrans.out	Wed Nov 17 15:07:43 2010 -0800
    11.2 +++ b/test/tools/javac/meth/InvokeDynTrans.out	Thu Nov 18 16:13:11 2010 -0800
    11.3 @@ -1,6 +1,5 @@
    11.4  InvokeDynTrans.java:55:39: compiler.warn.type.parameter.on.polymorphic.signature
    11.5 -InvokeDynTrans.java:56:91: compiler.warn.type.parameter.on.polymorphic.signature
    11.6  InvokeDynTrans.java:57:34: compiler.warn.type.parameter.on.polymorphic.signature
    11.7  - compiler.err.warnings.and.werror
    11.8  1 error
    11.9 -3 warnings
   11.10 +2 warnings
    12.1 --- a/test/tools/javac/quid/QuotedIdent.java	Wed Nov 17 15:07:43 2010 -0800
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,136 +0,0 @@
    12.4 -/*
    12.5 - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
    12.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.7 - *
    12.8 - * This code is free software; you can redistribute it and/or modify it
    12.9 - * under the terms of the GNU General Public License version 2 only, as
   12.10 - * published by the Free Software Foundation.
   12.11 - *
   12.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   12.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   12.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   12.15 - * version 2 for more details (a copy is included in the LICENSE file that
   12.16 - * accompanied this code).
   12.17 - *
   12.18 - * You should have received a copy of the GNU General Public License version
   12.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   12.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   12.21 - *
   12.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   12.23 - * or visit www.oracle.com if you need additional information or have any
   12.24 - * questions.
   12.25 - */
   12.26 -
   12.27 -/*
   12.28 - * @test
   12.29 - * @bug 6746458
   12.30 - * @summary Verify correct lexing of quoted identifiers.
   12.31 - * @author jrose
   12.32 - * @ignore 6877225 test fails on Windows:
   12.33 - *      QuotedIdent.java:81: error while writing QuotedIdent.*86: PATH\QuotedIdent$*86.class
   12.34 - *      (The filename, directory name, or volume label syntax is incorrect)
   12.35 - *
   12.36 - * @library ..
   12.37 - * @compile -source 7 -target 7 -XDinvokedynamic QuotedIdent.java
   12.38 - * @run main quid.QuotedIdent
   12.39 - */
   12.40 -
   12.41 -/*
   12.42 - * Standalone testing:
   12.43 - * <code>
   12.44 - * $ cd $MY_REPO_DIR/langtools
   12.45 - * $ (cd make; make)
   12.46 - * $ ./dist/bootstrap/bin/javac -d dist test/tools/javac/quid/QuotedIdent.java
   12.47 - * $ java -version  # should print 1.6 or later
   12.48 - * $ java -cp dist quid.QuotedIdent
   12.49 - * </code>
   12.50 - */
   12.51 -
   12.52 -package quid;
   12.53 -
   12.54 -public class QuotedIdent {
   12.55 -    static void check(int testid, String have, String expect)
   12.56 -                throws RuntimeException {
   12.57 -        if ((have == null && have != expect) ||
   12.58 -                (have != null && !have.equals(expect))) {
   12.59 -            String msg =
   12.60 -                "TEST " + testid + ": HAVE \"" +
   12.61 -                have + "\" EXPECT \"" + expect + "\"";
   12.62 -            System.out.println("StringConversion: " + msg);
   12.63 -            throw new RuntimeException(msg);
   12.64 -        }
   12.65 -    }
   12.66 -
   12.67 -    // negative tests:
   12.68 -    //static class #"" { } //BAD empty ident name
   12.69 -    //static class #"<foo>" { } //BAD bad char in ident name
   12.70 -    /*static class /*(//BAD ident name interrupted by newline) #"jump:
   12.71 -    " { } /* uncomment previous line to attempt class w/ bad name */
   12.72 -
   12.73 -    static class #"int" extends Number {
   12.74 -        final int #"int";
   12.75 -        #"int"(int #"int") {
   12.76 -            this.#"int" = #"int";
   12.77 -        }
   12.78 -        static #"int" valueOf(int #"int") {
   12.79 -            return new #"int"(#"int");
   12.80 -        }
   12.81 -        public int intValue() { return #"int"; }
   12.82 -        public long longValue() { return #"int"; }
   12.83 -        public float floatValue() { return #"int"; }
   12.84 -        public double doubleValue() { return #"int"; }
   12.85 -        public String toString() { return String.valueOf(#"int"); }
   12.86 -    }
   12.87 -
   12.88 -    class #"*86" {
   12.89 -        String #"555-1212"() { return "[*86.555-1212]"; }
   12.90 -    }
   12.91 -    static#"*86"#"MAKE-*86"() {   // note close spacing
   12.92 -        return new QuotedIdent().new#"*86"();
   12.93 -    }
   12.94 -
   12.95 -    static String bar() { return "[bar]"; }
   12.96 -
   12.97 -    public static void main(String[] args) throws Exception {
   12.98 -        String s;
   12.99 -
  12.100 -        String #"sticky \' wicket" = "wicked ' stick";
  12.101 -        s = #"sticky ' wicket";
  12.102 -        check(11, s, "wicked \' stick");
  12.103 -        check(12, #"s", s);
  12.104 -        check(13, #"\163", s);
  12.105 -
  12.106 -        s = #"QuotedIdent".bar();
  12.107 -        check(21, s, "[bar]");
  12.108 -
  12.109 -        s = #"int".valueOf(123).toString();
  12.110 -        check(22, s, "123");
  12.111 -
  12.112 -        s = #"MAKE-*86"().#"555-1212"();
  12.113 -        check(23, s, "[*86.555-1212]");
  12.114 -
  12.115 -        class#"{{{inmost}}}" { }
  12.116 -        s = new#"{{{inmost}}}"().getClass().getName();
  12.117 -        if (!s.endsWith("{{{inmost}}}"))
  12.118 -            check(24, s, "should end with \"{{{inmost}}}\"");
  12.119 -
  12.120 -        s = #"Yog-Shoggoth".#"(nameless ululation)";
  12.121 -        check(25, s, "Tekeli-li!");
  12.122 -
  12.123 -        s = #"int".class.getName();
  12.124 -        check(31, s, QuotedIdent.class.getName()+"$int");
  12.125 -
  12.126 -        Class<?> x86 = Class.forName(QuotedIdent.class.getName()+"$*86");
  12.127 -        if (x86 != #"*86".class)
  12.128 -            check(32, "reflected "+x86, "static "+#"*86".class);
  12.129 -
  12.130 -        s = (String) x86.getDeclaredMethod("555-1212").invoke(#"MAKE-*86"());
  12.131 -        check(31, s, "[*86.555-1212]");
  12.132 -
  12.133 -        System.out.println("OK");
  12.134 -    }
  12.135 -}
  12.136 -
  12.137 -interface #"Yog-Shoggoth" {
  12.138 -    final String #"(nameless ululation)" = "Tekeli-li!";
  12.139 -}
    13.1 --- a/test/tools/javac/quid/QuotedIdent2.java	Wed Nov 17 15:07:43 2010 -0800
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,85 +0,0 @@
    13.4 -/*
    13.5 - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
    13.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13.7 - *
    13.8 - * This code is free software; you can redistribute it and/or modify it
    13.9 - * under the terms of the GNU General Public License version 2 only, as
   13.10 - * published by the Free Software Foundation.
   13.11 - *
   13.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   13.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   13.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   13.15 - * version 2 for more details (a copy is included in the LICENSE file that
   13.16 - * accompanied this code).
   13.17 - *
   13.18 - * You should have received a copy of the GNU General Public License version
   13.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   13.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   13.21 - *
   13.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   13.23 - * or visit www.oracle.com if you need additional information or have any
   13.24 - * questions.
   13.25 - */
   13.26 -
   13.27 -/*
   13.28 - * @test
   13.29 - * @bug 6746458
   13.30 - * @summary Verify correct separate compilation of classes with extended identifiers.
   13.31 - * @author jrose
   13.32 - * @ignore 6877225 test fails on Windows:
   13.33 - *      QuotedIdent.java:81: error while writing QuotedIdent.*86: PATH\QuotedIdent$*86.class
   13.34 - *      (The filename, directory name, or volume label syntax is incorrect)
   13.35 - *
   13.36 - * @library ..
   13.37 - * @compile -source 7 -target 7 -XDinvokedynamic QuotedIdent.java
   13.38 - * @run main quid.QuotedIdent2
   13.39 - */
   13.40 -/*
   13.41 - * Standalone testing:
   13.42 - * <code>
   13.43 - * $ cd $MY_REPO_DIR/langtools
   13.44 - * $ (cd make; make)
   13.45 - * $ ./dist/bootstrap/bin/javac -d dist test/tools/javac/quid/QuotedIdent.java
   13.46 - * $ ./dist/bootstrap/bin/javac -d dist -cp dist test/tools/javac/quid/QuotedIdent2.java
   13.47 - * $ java -version  # should print 1.6 or later
   13.48 - * $ java -cp dist QuotedIdent2
   13.49 - * </code>
   13.50 - */
   13.51 -
   13.52 -package quid;
   13.53 -
   13.54 -import quid.QuotedIdent.*;
   13.55 -import quid.QuotedIdent.#"*86";
   13.56 -import static quid.QuotedIdent.#"MAKE-*86";
   13.57 -
   13.58 -public class QuotedIdent2 {
   13.59 -    static void check(int testid, String have, String expect)
   13.60 -                throws RuntimeException {
   13.61 -        QuotedIdent.check(testid, have, expect);
   13.62 -    }
   13.63 -
   13.64 -    public static void main(String[] args) throws Exception {
   13.65 -        String s;
   13.66 -
   13.67 -        s = #"int".valueOf(123).toString();
   13.68 -        check(22, s, "123");
   13.69 -
   13.70 -        s = #"MAKE-*86"().#"555-1212"();
   13.71 -        check(23, s, "[*86.555-1212]");
   13.72 -
   13.73 -        s = #"Yog-Shoggoth".#"(nameless ululation)";
   13.74 -        check(25, s, "Tekeli-li!");
   13.75 -
   13.76 -        s = QuotedIdent.#"int".class.getName();
   13.77 -        check(31, s, QuotedIdent.class.getName()+"$int");
   13.78 -
   13.79 -        Class<?> x86 = Class.forName(QuotedIdent.class.getName()+"$*86");
   13.80 -        if (x86 != #"*86".class)
   13.81 -            check(32, "reflected "+x86, "static "+#"*86".class);
   13.82 -
   13.83 -        s = (String) x86.getDeclaredMethod("555-1212").invoke(QuotedIdent.#"MAKE-*86"());
   13.84 -        check(31, s, "[*86.555-1212]");
   13.85 -
   13.86 -        System.out.println("OK");
   13.87 -    }
   13.88 -}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/test/tools/javac/quid/T6999438.java	Thu Nov 18 16:13:11 2010 -0800
    14.3 @@ -0,0 +1,9 @@
    14.4 +/* @test /nodynamiccopyright/
    14.5 + * @bug 6999438
    14.6 + * @summary remove support for exotic identifiers from JDK 7
    14.7 + * @compile/fail/ref=T6999438.out -XDrawDiagnostics -source 7 T6999438.java
    14.8 + */
    14.9 +
   14.10 +class Test {
   14.11 +    int #"not supported";
   14.12 +}
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/test/tools/javac/quid/T6999438.out	Thu Nov 18 16:13:11 2010 -0800
    15.3 @@ -0,0 +1,6 @@
    15.4 +T6999438.java:8:9: compiler.err.illegal.char: 35
    15.5 +T6999438.java:8:10: compiler.err.illegal.start.of.type
    15.6 +T6999438.java:8:25: compiler.err.expected: token.identifier
    15.7 +T6999438.java:8:26: compiler.err.expected: ';'
    15.8 +T6999438.java:9:2: compiler.err.premature.eof
    15.9 +5 errors

mercurial