Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
9d3e1bbe
D
dragonwell8_langtools
项目概览
openanolis
/
dragonwell8_langtools
通知
0
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_langtools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9d3e1bbe
编写于
11月 18, 2010
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6999438: remove support for exotic identifiers from JDK 7
Reviewed-by: mcimadamore
上级
16fd7d73
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
20 addition
and
415 deletion
+20
-415
src/share/classes/com/sun/tools/javac/code/Source.java
src/share/classes/com/sun/tools/javac/code/Source.java
+0
-3
src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
+0
-1
src/share/classes/com/sun/tools/javac/parser/Scanner.java
src/share/classes/com/sun/tools/javac/parser/Scanner.java
+1
-60
src/share/classes/com/sun/tools/javac/resources/compiler.properties
...classes/com/sun/tools/javac/resources/compiler.properties
+0
-10
test/tools/javac/diags/examples/EmptyBytecodeIdent.java
test/tools/javac/diags/examples/EmptyBytecodeIdent.java
+0
-28
test/tools/javac/diags/examples/IllegalBytecodeIdentChar.java
.../tools/javac/diags/examples/IllegalBytecodeIdentChar.java
+0
-28
test/tools/javac/diags/examples/UnclosedBytecodeIdent.java
test/tools/javac/diags/examples/UnclosedBytecodeIdent.java
+0
-28
test/tools/javac/diags/examples/UnsupportedExoticID.java
test/tools/javac/diags/examples/UnsupportedExoticID.java
+0
-31
test/tools/javac/meth/InvokeDyn.java
test/tools/javac/meth/InvokeDyn.java
+1
-1
test/tools/javac/meth/InvokeDynTrans.java
test/tools/javac/meth/InvokeDynTrans.java
+2
-2
test/tools/javac/meth/InvokeDynTrans.out
test/tools/javac/meth/InvokeDynTrans.out
+1
-2
test/tools/javac/quid/QuotedIdent.java
test/tools/javac/quid/QuotedIdent.java
+0
-136
test/tools/javac/quid/QuotedIdent2.java
test/tools/javac/quid/QuotedIdent2.java
+0
-85
test/tools/javac/quid/T6999438.java
test/tools/javac/quid/T6999438.java
+9
-0
test/tools/javac/quid/T6999438.out
test/tools/javac/quid/T6999438.out
+6
-0
未找到文件。
src/share/classes/com/sun/tools/javac/code/Source.java
浏览文件 @
9d3e1bbe
...
...
@@ -174,9 +174,6 @@ public enum Source {
public
boolean
allowUnderscoresInLiterals
()
{
return
compareTo
(
JDK1_7
)
>=
0
;
}
public
boolean
allowExoticIdentifiers
()
{
return
compareTo
(
JDK1_7
)
>=
0
;
}
public
boolean
allowStringsInSwitch
()
{
return
compareTo
(
JDK1_7
)
>=
0
;
}
...
...
src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
浏览文件 @
9d3e1bbe
...
...
@@ -2615,7 +2615,6 @@ public class ClassReader implements Completer {
String
binaryName
=
fileManager
.
inferBinaryName
(
currentLoc
,
fo
);
String
simpleName
=
binaryName
.
substring
(
binaryName
.
lastIndexOf
(
"."
)
+
1
);
if
(
SourceVersion
.
isIdentifier
(
simpleName
)
||
fo
.
getKind
()
==
JavaFileObject
.
Kind
.
CLASS
||
simpleName
.
equals
(
"package-info"
))
includeClassFile
(
p
,
fo
);
break
;
...
...
src/share/classes/com/sun/tools/javac/parser/Scanner.java
浏览文件 @
9d3e1bbe
...
...
@@ -66,10 +66,6 @@ public class Scanner implements Lexer {
*/
private
boolean
allowUnderscoresInLiterals
;
/** Allow exotic identifiers.
*/
private
boolean
allowExoticIdentifiers
;
/** The source language setting.
*/
private
Source
source
;
...
...
@@ -143,7 +139,6 @@ public class Scanner implements Lexer {
allowBinaryLiterals
=
source
.
allowBinaryLiterals
();
allowHexFloats
=
source
.
allowHexFloats
();
allowUnderscoresInLiterals
=
source
.
allowBinaryLiterals
();
allowExoticIdentifiers
=
source
.
allowExoticIdentifiers
();
// for invokedynamic
}
private
static
final
boolean
hexFloatsWork
=
hexFloatsWork
();
...
...
@@ -295,7 +290,7 @@ public class Scanner implements Lexer {
/** Read next character in character or string literal and copy into sbuf.
*/
private
void
scanLitChar
(
boolean
forBytecodeName
)
{
private
void
scanLitChar
()
{
if
(
ch
==
'\\'
)
{
if
(
buf
[
bp
+
1
]
==
'\\'
&&
unicodeConversionBp
!=
bp
)
{
bp
++;
...
...
@@ -335,18 +330,6 @@ public class Scanner implements Lexer {
putChar
(
'\"'
);
scanChar
();
break
;
case
'\\'
:
putChar
(
'\\'
);
scanChar
();
break
;
case
'|'
:
case
','
:
case
'?'
:
case
'%'
:
case
'^'
:
case
'_'
:
case
'{'
:
case
'}'
:
case
'!'
:
case
'-'
:
case
'='
:
if
(
forBytecodeName
)
{
// Accept escape sequences for dangerous bytecode chars.
// This is illegal in normal Java string or character literals.
// Note that the escape sequence itself is passed through.
putChar
(
'\\'
);
putChar
(
ch
);
scanChar
();
}
else
{
lexError
(
bp
,
"illegal.esc.char"
);
}
break
;
default
:
lexError
(
bp
,
"illegal.esc.char"
);
}
...
...
@@ -355,24 +338,6 @@ public class Scanner implements Lexer {
putChar
(
ch
);
scanChar
();
}
}
private
void
scanLitChar
()
{
scanLitChar
(
false
);
}
/** Read next character in an exotic name #"foo"
*/
private
void
scanBytecodeNameChar
()
{
switch
(
ch
)
{
// reject any "dangerous" char which is illegal somewhere in the JVM spec
// cf. http://blogs.sun.com/jrose/entry/symbolic_freedom_in_the_vm
case
'/'
:
case
'.'
:
case
';'
:
// illegal everywhere
case
'<'
:
case
'>'
:
// illegal in methods, dangerous in classes
case
'['
:
// illegal in classes
lexError
(
bp
,
"illegal.bytecode.ident.char"
,
String
.
valueOf
((
int
)
ch
));
break
;
}
scanLitChar
(
true
);
}
private
void
scanDigits
(
int
digitRadix
)
{
char
saveCh
;
...
...
@@ -970,30 +935,6 @@ public class Scanner implements Lexer {
lexError
(
pos
,
"unclosed.str.lit"
);
}
return
;
case
'#'
:
scanChar
();
if
(
ch
==
'\"'
)
{
if
(!
allowExoticIdentifiers
)
{
lexError
(
"unsupported.exotic.id"
,
source
.
name
);
allowExoticIdentifiers
=
true
;
}
scanChar
();
if
(
ch
==
'\"'
)
lexError
(
pos
,
"empty.bytecode.ident"
);
while
(
ch
!=
'\"'
&&
ch
!=
CR
&&
ch
!=
LF
&&
bp
<
buflen
)
{
scanBytecodeNameChar
();
}
if
(
ch
==
'\"'
)
{
name
=
names
.
fromChars
(
sbuf
,
0
,
sp
);
token
=
IDENTIFIER
;
// even if #"int" or #"do"
scanChar
();
}
else
{
lexError
(
pos
,
"unclosed.bytecode.ident"
);
}
}
else
{
lexError
(
"illegal.char"
,
String
.
valueOf
((
int
)
'#'
));
}
return
;
default
:
if
(
isSpecial
(
ch
))
{
scanOperator
();
...
...
src/share/classes/com/sun/tools/javac/resources/compiler.properties
浏览文件 @
9d3e1bbe
...
...
@@ -153,8 +153,6 @@ compiler.err.duplicate.default.label=\
compiler.err.else.without.if
=
\
''else'' without ''if''
compiler.err.empty.bytecode.ident
=
\
empty bytecode identifier
compiler.err.empty.char.lit
=
\
empty character literal
compiler.err.encl.class.required
=
\
...
...
@@ -201,8 +199,6 @@ compiler.err.generic.throwable=\
compiler.err.icls.cant.have.static.decl
=
\
inner classes cannot have static declarations
compiler.err.illegal.bytecode.ident.char
=
\
illegal bytecode identifier character:
\\
{0}
compiler.err.illegal.char
=
\
illegal character:
\\
{0}
compiler.err.illegal.char.for.encoding
=
\
...
...
@@ -472,8 +468,6 @@ compiler.err.type.var.more.than.once.in.result=\
compiler.err.types.incompatible.diff.ret
=
\
types {0} and {1} are incompatible; both define {2}, but with unrelated return types
compiler.err.unclosed.bytecode.ident
=
\
unclosed bytecode identifier
compiler.err.unclosed.char.lit
=
\
unclosed character literal
compiler.err.unclosed.comment
=
\
...
...
@@ -1269,10 +1263,6 @@ compiler.err.unsupported.underscore.lit=\
underscores in literals are not supported in -source {0}
\n\
(use -source 7 or higher to enable underscores in literals)
compiler.err.unsupported.exotic.id
=
\
exotic identifiers #"___" are not supported in -source {0}
\n\
(use -source 7 or higher to enable exotic identifiers)
compiler.err.try.with.resources.not.supported.in.source
=
\
try-with-resources is not supported in -source {0}
\n\
(use -source 7 or higher to enable try-with-resources)
...
...
test/tools/javac/diags/examples/EmptyBytecodeIdent.java
已删除
100644 → 0
浏览文件 @
16fd7d73
/*
* Copyright (c) 2010, 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.empty.bytecode.ident
class
EmptyBytecodeIdent
{
int
#
""
=
3
;
}
test/tools/javac/diags/examples/IllegalBytecodeIdentChar.java
已删除
100644 → 0
浏览文件 @
16fd7d73
/*
* Copyright (c) 2010, 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.bytecode.ident.char
class
IllegalBytecodeIdentChar
{
int
#
"abc/def"
=
3
;
}
test/tools/javac/diags/examples/UnclosedBytecodeIdent.java
已删除
100644 → 0
浏览文件 @
16fd7d73
/*
* Copyright (c) 2010, 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.unclosed.bytecode.ident
class
UnclosedBytecodeIdent
{
int
#"
abc
}
test/tools/javac/diags/examples/UnsupportedExoticID.java
已删除
100644 → 0
浏览文件 @
16fd7d73
/*
* Copyright (c) 2010, 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.unsupported.exotic.id
// options: -source 6
class
UnsupportedExoticID
{
void
m
()
{
Object
#
"Hello!"
=
null
;
}
}
test/tools/javac/meth/InvokeDyn.java
浏览文件 @
9d3e1bbe
...
...
@@ -58,7 +58,7 @@ public class InvokeDyn {
ojunk
=
InvokeDynamic
.
greet
(
x
,
"mundus"
,
456
);
ojunk
=
InvokeDynamic
.
greet
(
x
,
"kosmos"
,
789
);
ojunk
=
(
String
)
InvokeDynamic
.
cogitate
(
10.11121
,
3.14
);
InvokeDynamic
.
#
"yow: what I mean to say is, please treat this one specially"
(
null
);
//
InvokeDynamic.#"yow: what I mean to say is, please treat this one specially"(null);
ijunk
=
(
int
)
InvokeDynamic
.
invoke
(
"goodbye"
);
}
}
test/tools/javac/meth/InvokeDynTrans.java
浏览文件 @
9d3e1bbe
/*
* Copyright (c) 2008
-
2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008
,
2010, 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
...
...
@@ -53,7 +53,7 @@ public class InvokeDynTrans {
InvokeDynamic
.
greet
(
x
,
"mundus"
,
456
);
InvokeDynamic
.
greet
(
x
,
"kosmos"
,
789
);
InvokeDynamic
.<
String
>
cogitate
(
10.11121
,
3.14
);
InvokeDynamic
.<
void
>
#
"yow: what I mean to say is, please treat this one specially"
(
null
);
//
InvokeDynamic.<void>#"yow: what I mean to say is, please treat this one specially"(null);
InvokeDynamic
.<
int
>
invoke
(
"goodbye"
);
}
}
test/tools/javac/meth/InvokeDynTrans.out
浏览文件 @
9d3e1bbe
InvokeDynTrans.java:55:39: compiler.warn.type.parameter.on.polymorphic.signature
InvokeDynTrans.java:56:91: compiler.warn.type.parameter.on.polymorphic.signature
InvokeDynTrans.java:57:34: compiler.warn.type.parameter.on.polymorphic.signature
- compiler.err.warnings.and.werror
1 error
3
warnings
2
warnings
test/tools/javac/quid/QuotedIdent.java
已删除
100644 → 0
浏览文件 @
16fd7d73
/*
* Copyright (c) 2008, 2010, 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 6746458
* @summary Verify correct lexing of quoted identifiers.
* @author jrose
* @ignore 6877225 test fails on Windows:
* QuotedIdent.java:81: error while writing QuotedIdent.*86: PATH\QuotedIdent$*86.class
* (The filename, directory name, or volume label syntax is incorrect)
*
* @library ..
* @compile -source 7 -target 7 -XDinvokedynamic QuotedIdent.java
* @run main quid.QuotedIdent
*/
/*
* Standalone testing:
* <code>
* $ cd $MY_REPO_DIR/langtools
* $ (cd make; make)
* $ ./dist/bootstrap/bin/javac -d dist test/tools/javac/quid/QuotedIdent.java
* $ java -version # should print 1.6 or later
* $ java -cp dist quid.QuotedIdent
* </code>
*/
package
quid
;
public
class
QuotedIdent
{
static
void
check
(
int
testid
,
String
have
,
String
expect
)
throws
RuntimeException
{
if
((
have
==
null
&&
have
!=
expect
)
||
(
have
!=
null
&&
!
have
.
equals
(
expect
)))
{
String
msg
=
"TEST "
+
testid
+
": HAVE \""
+
have
+
"\" EXPECT \""
+
expect
+
"\""
;
System
.
out
.
println
(
"StringConversion: "
+
msg
);
throw
new
RuntimeException
(
msg
);
}
}
// negative tests:
//static class #"" { } //BAD empty ident name
//static class #"<foo>" { } //BAD bad char in ident name
/*static class /*(//BAD ident name interrupted by newline) #"jump:
" { } /* uncomment previous line to attempt class w/ bad name */
static
class
#"
int
" extends Number {
final int #"
int
";
#"
int
"(int #"
int
") {
this.#"
int
" = #"
int
";
}
static #"
int
" valueOf(int #"
int
") {
return new #"
int
"(#"
int
");
}
public int intValue() { return #"
int
"; }
public long longValue() { return #"
int
"; }
public float floatValue() { return #"
int
"; }
public double doubleValue() { return #"
int
"; }
public String toString() { return String.valueOf(#"
int
"); }
}
class #"
*
86
" {
String #"
555
-
1212
"() { return "
[*
86.555
-
1212
]
"; }
}
static#"
*
86
"#"
MAKE
-*
86
"() { // note close spacing
return new QuotedIdent().new#"
*
86
"();
}
static String bar() { return "
[
bar
]
"; }
public static void main(String[] args) throws Exception {
String s;
String #"
sticky
\'
wicket
" = "
wicked
'
stick
";
s = #"
sticky
'
wicket
";
check(11, s, "
wicked
\'
stick
");
check(12, #"
s
", s);
check(13, #"
\
163
", s);
s = #"
QuotedIdent
".bar();
check(21, s, "
[
bar
]
");
s = #"
int
".valueOf(123).toString();
check(22, s, "
123
");
s = #"
MAKE
-*
86
"().#"
555
-
1212
"();
check(23, s, "
[*
86.555
-
1212
]
");
class#"
{{{
inmost
}}}
" { }
s = new#"
{{{
inmost
}}}
"().getClass().getName();
if (!s.endsWith("
{{{
inmost
}}}
"))
check(24, s, "
should
end
with
\
"{{{inmost}}}\""
);
s
=
#
"Yog-Shoggoth"
.
#
"(nameless ululation)"
;
check
(
25
,
s
,
"Tekeli-li!"
);
s
=
#
"int"
.
class
.
getName
();
check
(
31
,
s
,
QuotedIdent
.
class
.
getName
()+
"$int"
);
Class
<?>
x86
=
Class
.
forName
(
QuotedIdent
.
class
.
getName
()+
"$*86"
);
if
(
x86
!=
#
"*86"
.
class
)
check
(
32
,
"reflected "
+
x86
,
"static "
+
#
"*86"
.
class
);
s
=
(
String
)
x86
.
getDeclaredMethod
(
"555-1212"
).
invoke
(
#
"MAKE-*86"
());
check
(
31
,
s
,
"[*86.555-1212]"
);
System
.
out
.
println
(
"OK"
);
}
}
interface
#"
Yog
-
Shoggoth
" {
final String #"
(
nameless
ululation
)
" = "
Tekeli
-
li
!
"
;
}
test/tools/javac/quid/QuotedIdent2.java
已删除
100644 → 0
浏览文件 @
16fd7d73
/*
* Copyright (c) 2008, 2010, 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 6746458
* @summary Verify correct separate compilation of classes with extended identifiers.
* @author jrose
* @ignore 6877225 test fails on Windows:
* QuotedIdent.java:81: error while writing QuotedIdent.*86: PATH\QuotedIdent$*86.class
* (The filename, directory name, or volume label syntax is incorrect)
*
* @library ..
* @compile -source 7 -target 7 -XDinvokedynamic QuotedIdent.java
* @run main quid.QuotedIdent2
*/
/*
* Standalone testing:
* <code>
* $ cd $MY_REPO_DIR/langtools
* $ (cd make; make)
* $ ./dist/bootstrap/bin/javac -d dist test/tools/javac/quid/QuotedIdent.java
* $ ./dist/bootstrap/bin/javac -d dist -cp dist test/tools/javac/quid/QuotedIdent2.java
* $ java -version # should print 1.6 or later
* $ java -cp dist QuotedIdent2
* </code>
*/
package
quid
;
import
quid.QuotedIdent.*
;
import
quid.QuotedIdent.
#
"*86"
;
import
static
quid
.
QuotedIdent
.
#
"MAKE-*86"
;
public
class
QuotedIdent2
{
static
void
check
(
int
testid
,
String
have
,
String
expect
)
throws
RuntimeException
{
QuotedIdent
.
check
(
testid
,
have
,
expect
);
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
s
;
s
=
#
"int"
.
valueOf
(
123
).
toString
();
check
(
22
,
s
,
"123"
);
s
=
#
"MAKE-*86"
().
#
"555-1212"
();
check
(
23
,
s
,
"[*86.555-1212]"
);
s
=
#
"Yog-Shoggoth"
.
#
"(nameless ululation)"
;
check
(
25
,
s
,
"Tekeli-li!"
);
s
=
QuotedIdent
.
#
"int"
.
class
.
getName
();
check
(
31
,
s
,
QuotedIdent
.
class
.
getName
()+
"$int"
);
Class
<?>
x86
=
Class
.
forName
(
QuotedIdent
.
class
.
getName
()+
"$*86"
);
if
(
x86
!=
#
"*86"
.
class
)
check
(
32
,
"reflected "
+
x86
,
"static "
+
#
"*86"
.
class
);
s
=
(
String
)
x86
.
getDeclaredMethod
(
"555-1212"
).
invoke
(
QuotedIdent
.
#
"MAKE-*86"
());
check
(
31
,
s
,
"[*86.555-1212]"
);
System
.
out
.
println
(
"OK"
);
}
}
test/tools/javac/quid/T6999438.java
0 → 100644
浏览文件 @
9d3e1bbe
/* @test /nodynamiccopyright/
* @bug 6999438
* @summary remove support for exotic identifiers from JDK 7
* @compile/fail/ref=T6999438.out -XDrawDiagnostics -source 7 T6999438.java
*/
class
Test
{
int
#
"not supported"
;
}
test/tools/javac/quid/T6999438.out
0 → 100644
浏览文件 @
9d3e1bbe
T6999438.java:8:9: compiler.err.illegal.char: 35
T6999438.java:8:10: compiler.err.illegal.start.of.type
T6999438.java:8:25: compiler.err.expected: token.identifier
T6999438.java:8:26: compiler.err.expected: ';'
T6999438.java:9:2: compiler.err.premature.eof
5 errors
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录