Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
2551851e
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看板
提交
2551851e
编写于
9月 12, 2011
作者:
J
jjg
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
f9eec3f8
7e98bf4f
变更
20
展开全部
隐藏空白更改
内联
并排
Showing
20 changed file
with
1033 addition
and
53 deletion
+1033
-53
.hgtags
.hgtags
+4
-0
src/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java
...re/classes/com/sun/tools/javac/api/ClientCodeWrapper.java
+4
-0
src/share/classes/com/sun/tools/javac/comp/Attr.java
src/share/classes/com/sun/tools/javac/comp/Attr.java
+9
-1
src/share/classes/com/sun/tools/javac/jvm/Gen.java
src/share/classes/com/sun/tools/javac/jvm/Gen.java
+2
-0
src/share/classes/com/sun/tools/javac/parser/JavacParser.java
...share/classes/com/sun/tools/javac/parser/JavacParser.java
+73
-39
src/share/classes/com/sun/tools/javac/parser/Scanner.java
src/share/classes/com/sun/tools/javac/parser/Scanner.java
+8
-0
src/share/classes/com/sun/tools/javac/util/AbstractLog.java
src/share/classes/com/sun/tools/javac/util/AbstractLog.java
+14
-1
test/tools/javac/7079713/TestCircularClassfile.java
test/tools/javac/7079713/TestCircularClassfile.java
+1
-0
test/tools/javac/TryWithResources/BadTwr.out
test/tools/javac/TryWithResources/BadTwr.out
+3
-3
test/tools/javac/TryWithResources/DuplicateResourceDecl.out
test/tools/javac/TryWithResources/DuplicateResourceDecl.out
+1
-1
test/tools/javac/TryWithResources/ResourceInterface.out
test/tools/javac/TryWithResources/ResourceInterface.out
+1
-1
test/tools/javac/TryWithResources/TwrFlow.out
test/tools/javac/TryWithResources/TwrFlow.out
+1
-1
test/tools/javac/TryWithResources/TwrLint.out
test/tools/javac/TryWithResources/TwrLint.out
+1
-1
test/tools/javac/TryWithResources/TwrOnNonResource.out
test/tools/javac/TryWithResources/TwrOnNonResource.out
+3
-3
test/tools/javac/annotations/T7043371.java
test/tools/javac/annotations/T7043371.java
+43
-0
test/tools/javac/annotations/T7073477.java
test/tools/javac/annotations/T7073477.java
+39
-0
test/tools/javac/api/7086261/T7086261.java
test/tools/javac/api/7086261/T7086261.java
+78
-0
test/tools/javac/diags/examples/EmptyCharLiteral.java
test/tools/javac/diags/examples/EmptyCharLiteral.java
+1
-2
test/tools/javac/jvm/T7024096.java
test/tools/javac/jvm/T7024096.java
+31
-0
test/tools/javac/parser/netbeans/JavacParserTest.java
test/tools/javac/parser/netbeans/JavacParserTest.java
+716
-0
未找到文件。
.hgtags
浏览文件 @
2551851e
...
...
@@ -122,3 +122,7 @@ a15c9b058ae007d4ccb7e35ce44e4dfa977f090b jdk7-b137
c455e2ae5c93014ae3fc475aba4509b5f70465f7 jdk7-b145
9425dd4f53d5bfcd992d9aecea0eb7d8b2d4f62b jdk7-b146
58bc532d63418ac3c9b42460d89cdaf595c6f3e1 jdk7-b147
e9f118c2bd3c4690d8d2e6b108b5bad7e226634c jdk8-b01
b3c059de2a61fc122c99d555cdd8b85f112393c1 jdk8-b02
f497fac86cf9ada4801ecaf49eb0d2307a2b61c8 jdk8-b03
5df63fd8fa64741e829281ee6febe9954932841b jdk8-b04
src/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java
浏览文件 @
2551851e
...
...
@@ -609,6 +609,10 @@ public class ClientCodeWrapper {
public
String
getMessage
(
Locale
locale
)
{
return
d
.
getMessage
(
locale
);
}
public
String
toString
()
{
return
d
.
toString
();
}
}
protected
class
WrappedTaskListener
implements
TaskListener
{
...
...
src/share/classes/com/sun/tools/javac/comp/Attr.java
浏览文件 @
2551851e
...
...
@@ -594,7 +594,15 @@ public class Attr extends JCTree.Visitor {
lintEnv
=
lintEnv
.
next
;
// Having found the enclosing lint value, we can initialize the lint value for this class
env
.
info
.
lint
=
lintEnv
.
info
.
lint
.
augment
(
env
.
info
.
enclVar
.
attributes_field
,
env
.
info
.
enclVar
.
flags
());
// ... but ...
// There's a problem with evaluating annotations in the right order, such that
// env.info.enclVar.attributes_field might not yet have been evaluated, and so might be
// null. In that case, calling augment will throw an NPE. To avoid this, for now we
// revert to the jdk 6 behavior and ignore the (unevaluated) attributes.
if
(
env
.
info
.
enclVar
.
attributes_field
==
null
)
env
.
info
.
lint
=
lintEnv
.
info
.
lint
;
else
env
.
info
.
lint
=
lintEnv
.
info
.
lint
.
augment
(
env
.
info
.
enclVar
.
attributes_field
,
env
.
info
.
enclVar
.
flags
());
Lint
prevLint
=
chk
.
setLint
(
env
.
info
.
lint
);
JavaFileObject
prevSource
=
log
.
useSource
(
env
.
toplevel
.
sourcefile
);
...
...
src/share/classes/com/sun/tools/javac/jvm/Gen.java
浏览文件 @
2551851e
...
...
@@ -1689,6 +1689,8 @@ public class Gen extends JCTree.Visitor {
// outer instance of a super(...) call appears as first parameter).
genArgs
(
tree
.
args
,
TreeInfo
.
symbol
(
tree
.
meth
).
externalType
(
types
).
getParameterTypes
());
code
.
statBegin
(
tree
.
pos
);
code
.
markStatBegin
();
result
=
m
.
invoke
();
}
...
...
src/share/classes/com/sun/tools/javac/parser/JavacParser.java
浏览文件 @
2551851e
...
...
@@ -27,15 +27,15 @@ package com.sun.tools.javac.parser;
import
java.util.*
;
import
com.sun.tools.javac.tree.*
;
import
com.sun.tools.javac.code.*
;
import
com.sun.tools.javac.tree.*
;
import
com.sun.tools.javac.tree.JCTree.*
;
import
com.sun.tools.javac.util.*
;
import
com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag
;
import
com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition
;
import
com.sun.tools.javac.util.List
;
import
static
com
.
sun
.
tools
.
javac
.
util
.
ListBuffer
.
lb
;
import
com.sun.tools.javac.tree.JCTree.*
;
import
static
com
.
sun
.
tools
.
javac
.
util
.
ListBuffer
.
lb
;
import
static
com
.
sun
.
tools
.
javac
.
parser
.
Token
.*;
/** The parser maps a token sequence into an abstract syntax
...
...
@@ -254,26 +254,44 @@ public class JavacParser implements Parser {
}
private
JCErroneous
syntaxError
(
int
pos
,
String
key
,
Token
...
args
)
{
return
syntaxError
(
pos
,
null
,
key
,
args
);
return
syntaxError
(
pos
,
List
.<
JCTree
>
nil
()
,
key
,
args
);
}
private
JCErroneous
syntaxError
(
int
pos
,
List
<
JCTree
>
errs
,
String
key
,
Token
...
args
)
{
setErrorEndPos
(
pos
);
reportSyntaxError
(
pos
,
key
,
(
Object
[])
args
);
return
toP
(
F
.
at
(
pos
).
Erroneous
(
errs
));
JCErroneous
err
=
F
.
at
(
pos
).
Erroneous
(
errs
);
reportSyntaxError
(
err
,
key
,
(
Object
[])
args
);
if
(
errs
!=
null
)
{
JCTree
last
=
errs
.
last
();
if
(
last
!=
null
)
storeEnd
(
last
,
pos
);
}
return
toP
(
err
);
}
private
int
errorPos
=
Position
.
NOPOS
;
/**
* Report a syntax
error at given position using the given
*
argument
unless one was already reported at the same position.
* Report a syntax
using the given the position parameter and arguments,
* unless one was already reported at the same position.
*/
private
void
reportSyntaxError
(
int
pos
,
String
key
,
Object
...
args
)
{
JCDiagnostic
.
DiagnosticPosition
diag
=
new
JCDiagnostic
.
SimpleDiagnosticPosition
(
pos
);
reportSyntaxError
(
diag
,
key
,
args
);
}
/**
* Report a syntax error using the given DiagnosticPosition object and
* arguments, unless one was already reported at the same position.
*/
private
void
reportSyntaxError
(
JCDiagnostic
.
DiagnosticPosition
diagPos
,
String
key
,
Object
...
args
)
{
int
pos
=
diagPos
.
getPreferredPosition
();
if
(
pos
>
S
.
errPos
()
||
pos
==
Position
.
NOPOS
)
{
if
(
S
.
token
()
==
EOF
)
error
(
pos
,
"premature.eof"
);
else
error
(
pos
,
key
,
args
);
if
(
S
.
token
()
==
EOF
)
{
error
(
diagPos
,
"premature.eof"
);
}
else
{
error
(
diagPos
,
key
,
args
);
}
}
S
.
errPos
(
pos
);
if
(
S
.
pos
()
==
errorPos
)
...
...
@@ -311,7 +329,7 @@ public class JavacParser implements Parser {
/** Report an illegal start of expression/type error at given position.
*/
JCExpression
illegal
(
int
pos
)
{
setErrorEndPos
(
S
.
pos
()
);
setErrorEndPos
(
pos
);
if
((
mode
&
EXPR
)
!=
0
)
return
syntaxError
(
pos
,
"illegal.start.of.expr"
);
else
...
...
@@ -340,7 +358,7 @@ public class JavacParser implements Parser {
* indexed by the tree nodes they refer to.
* defined only if option flag keepDocComment is set.
*/
Map
<
JCTree
,
String
>
docComments
;
private
final
Map
<
JCTree
,
String
>
docComments
;
/** Make an entry into docComments hashtable,
* provided flag keepDocComments is set and given doc comment is non-null.
...
...
@@ -462,6 +480,10 @@ public class JavacParser implements Parser {
return
t
;
}
JCExpression
literal
(
Name
prefix
)
{
return
literal
(
prefix
,
S
.
pos
());
}
/**
* Literal =
* INTLITERAL
...
...
@@ -474,8 +496,7 @@ public class JavacParser implements Parser {
* | FALSE
* | NULL
*/
JCExpression
literal
(
Name
prefix
)
{
int
pos
=
S
.
pos
();
JCExpression
literal
(
Name
prefix
,
int
pos
)
{
JCExpression
t
=
errorTree
;
switch
(
S
.
token
())
{
case
INTLITERAL:
...
...
@@ -869,7 +890,7 @@ public class JavacParser implements Parser {
(
S
.
token
()
==
INTLITERAL
||
S
.
token
()
==
LONGLITERAL
)
&&
S
.
radix
()
==
10
)
{
mode
=
EXPR
;
t
=
literal
(
names
.
hyphen
);
t
=
literal
(
names
.
hyphen
,
pos
);
}
else
{
t
=
term3
();
return
F
.
at
(
pos
).
Unary
(
unoptag
(
token
),
t
);
...
...
@@ -1267,15 +1288,17 @@ public class JavacParser implements Parser {
case
GTGT:
S
.
token
(
GT
);
break
;
case
GT:
S
.
nextToken
();
break
;
default
:
a
ccept
(
GT
);
a
rgs
.
append
(
syntaxError
(
S
.
pos
(),
"expected"
,
GT
)
);
break
;
}
return
args
.
toList
();
}
}
else
{
syntaxError
(
S
.
pos
(),
"expected"
,
LT
);
return
List
.
nil
();
return
List
.<
JCExpression
>
of
(
syntaxError
(
S
.
pos
(),
"expected"
,
LT
));
}
}
...
...
@@ -1300,12 +1323,12 @@ public class JavacParser implements Parser {
return
F
.
at
(
pos
).
Wildcard
(
t
,
bound
);
}
else
if
(
S
.
token
()
==
IDENTIFIER
)
{
//error recovery
reportSyntaxError
(
S
.
prevEndPos
(),
"expected3"
,
GT
,
EXTENDS
,
SUPER
);
TypeBoundKind
t
=
F
.
at
(
Position
.
NOPOS
).
TypeBoundKind
(
BoundKind
.
UNBOUND
);
JCExpression
wc
=
toP
(
F
.
at
(
pos
).
Wildcard
(
t
,
null
));
JCIdent
id
=
toP
(
F
.
at
(
S
.
pos
()).
Ident
(
ident
()));
return
F
.
at
(
pos
).
Erroneous
(
List
.<
JCTree
>
of
(
wc
,
id
));
JCErroneous
err
=
F
.
at
(
pos
).
Erroneous
(
List
.<
JCTree
>
of
(
wc
,
id
));
reportSyntaxError
(
err
,
"expected3"
,
GT
,
EXTENDS
,
SUPER
);
return
err
;
}
else
{
TypeBoundKind
t
=
toP
(
F
.
at
(
pos
).
TypeBoundKind
(
BoundKind
.
UNBOUND
));
return
toP
(
F
.
at
(
pos
).
Wildcard
(
t
,
null
));
...
...
@@ -1391,7 +1414,7 @@ public class JavacParser implements Parser {
while
(
S
.
token
()
==
DOT
)
{
if
(
diamondFound
)
{
//cannot select after a diamond
illegal
(
S
.
pos
()
);
illegal
();
}
int
pos
=
S
.
pos
();
S
.
nextToken
();
...
...
@@ -1419,15 +1442,16 @@ public class JavacParser implements Parser {
pos
=
typeArgs
.
head
.
pos
;
}
setErrorEndPos
(
S
.
prevEndPos
());
reportSyntaxError
(
pos
,
"cannot.create.array.with.type.arguments"
);
return
toP
(
F
.
at
(
newpos
).
Erroneous
(
typeArgs
.
prepend
(
e
)));
JCErroneous
err
=
F
.
at
(
pos
).
Erroneous
(
typeArgs
.
prepend
(
e
));
reportSyntaxError
(
err
,
"cannot.create.array.with.type.arguments"
);
return
toP
(
err
);
}
return
e
;
}
else
if
(
S
.
token
()
==
LPAREN
)
{
return
classCreatorRest
(
newpos
,
null
,
typeArgs
,
t
);
}
else
{
reportSyntaxError
(
S
.
pos
(),
"expected2"
,
LPAREN
,
LBRACKET
);
setErrorEndPos
(
S
.
pos
());
reportSyntaxError
(
S
.
pos
(),
"expected2"
,
LPAREN
,
LBRACKET
);
t
=
toP
(
F
.
at
(
newpos
).
NewClass
(
null
,
typeArgs
,
t
,
List
.<
JCExpression
>
nil
(),
null
));
return
toP
(
F
.
at
(
newpos
).
Erroneous
(
List
.<
JCTree
>
of
(
t
)));
}
...
...
@@ -1457,7 +1481,8 @@ public class JavacParser implements Parser {
if
(
S
.
token
()
==
LBRACE
)
{
return
arrayInitializer
(
newpos
,
elemtype
);
}
else
{
return
syntaxError
(
S
.
pos
(),
"array.dimension.missing"
);
JCExpression
t
=
toP
(
F
.
at
(
newpos
).
NewArray
(
elemtype
,
List
.<
JCExpression
>
nil
(),
null
));
return
syntaxError
(
S
.
pos
(),
List
.<
JCTree
>
of
(
t
),
"array.dimension.missing"
);
}
}
else
{
ListBuffer
<
JCExpression
>
dims
=
new
ListBuffer
<
JCExpression
>();
...
...
@@ -1843,7 +1868,7 @@ public class JavacParser implements Parser {
/** CatchClause = CATCH "(" FormalParameter ")" Block
*/
JCCatch
catchClause
()
{
protected
JCCatch
catchClause
()
{
int
pos
=
S
.
pos
();
accept
(
CATCH
);
accept
(
LPAREN
);
...
...
@@ -1973,7 +1998,7 @@ public class JavacParser implements Parser {
JCModifiers
modifiersOpt
()
{
return
modifiersOpt
(
null
);
}
JCModifiers
modifiersOpt
(
JCModifiers
partial
)
{
protected
JCModifiers
modifiersOpt
(
JCModifiers
partial
)
{
long
flags
;
ListBuffer
<
JCAnnotation
>
annotations
=
new
ListBuffer
<
JCAnnotation
>();
int
pos
;
...
...
@@ -2006,6 +2031,7 @@ public class JavacParser implements Parser {
case
SYNCHRONIZED:
flag
=
Flags
.
SYNCHRONIZED
;
break
;
case
STRICTFP
:
flag
=
Flags
.
STRICTFP
;
break
;
case
MONKEYS_AT
:
flag
=
Flags
.
ANNOTATION
;
break
;
case
ERROR
:
flag
=
0
;
S
.
nextToken
();
break
;
default
:
break
loop
;
}
if
((
flags
&
flag
)
!=
0
)
error
(
S
.
pos
(),
"repeated.modifier"
);
...
...
@@ -2219,9 +2245,12 @@ public class JavacParser implements Parser {
/** Resource = VariableModifiersOpt Type VariableDeclaratorId = Expression
*/
JCTree
resource
()
{
return
variableDeclaratorRest
(
S
.
pos
(),
optFinal
(
Flags
.
FINAL
),
parseType
(),
ident
(),
true
,
null
);
protected
JCTree
resource
()
{
JCModifiers
optFinal
=
optFinal
(
Flags
.
FINAL
);
JCExpression
type
=
parseType
();
int
pos
=
S
.
pos
();
Name
ident
=
ident
();
return
variableDeclaratorRest
(
pos
,
optFinal
,
type
,
ident
,
true
,
null
);
}
/** CompilationUnit = [ { "@" Annotation } PACKAGE Qualident ";"] {ImportDeclaration} {TypeDeclaration}
...
...
@@ -2568,7 +2597,7 @@ public class JavacParser implements Parser {
* | ModifiersOpt Type Ident
* ( ConstantDeclaratorsRest | InterfaceMethodDeclaratorRest ";" )
*/
List
<
JCTree
>
classOrInterfaceBodyDeclaration
(
Name
className
,
boolean
isInterface
)
{
protected
List
<
JCTree
>
classOrInterfaceBodyDeclaration
(
Name
className
,
boolean
isInterface
)
{
if
(
S
.
token
()
==
SEMI
)
{
S
.
nextToken
();
return
List
.<
JCTree
>
nil
();
...
...
@@ -2770,7 +2799,7 @@ public class JavacParser implements Parser {
/** FormalParameter = { FINAL | '@' Annotation } Type VariableDeclaratorId
* LastFormalParameter = { FINAL | '@' Annotation } Type '...' Ident | FormalParameter
*/
JCVariableDecl
formalParameter
()
{
protected
JCVariableDecl
formalParameter
()
{
JCModifiers
mods
=
optFinal
(
Flags
.
PARAMETER
);
JCExpression
type
=
parseType
();
if
(
S
.
token
()
==
ELLIPSIS
)
{
...
...
@@ -2788,6 +2817,10 @@ public class JavacParser implements Parser {
log
.
error
(
DiagnosticFlag
.
SYNTAX
,
pos
,
key
,
args
);
}
void
error
(
DiagnosticPosition
pos
,
String
key
,
Object
...
args
)
{
log
.
error
(
DiagnosticFlag
.
SYNTAX
,
pos
,
key
,
args
);
}
void
warning
(
int
pos
,
String
key
,
Object
...
args
)
{
log
.
warning
(
pos
,
key
,
args
);
}
...
...
@@ -2807,8 +2840,9 @@ public class JavacParser implements Parser {
case
JCTree
.
ERRONEOUS
:
return
t
;
default
:
error
(
t
.
pos
,
"not.stmt"
);
return
F
.
at
(
t
.
pos
).
Erroneous
(
List
.<
JCTree
>
of
(
t
));
JCExpression
ret
=
F
.
at
(
t
.
pos
).
Erroneous
(
List
.<
JCTree
>
of
(
t
));
error
(
ret
,
"not.stmt"
);
return
ret
;
}
}
...
...
src/share/classes/com/sun/tools/javac/parser/Scanner.java
浏览文件 @
2551851e
...
...
@@ -982,8 +982,16 @@ public class Scanner implements Lexer {
}
/** Sets the current token.
* This method is primarily used to update the token stream when the
* parser is handling the end of nested type arguments such as
* {@code List<List<String>>} and needs to disambiguate between
* repeated use of ">" and relation operators such as ">>" and ">>>". Noting
* that this does not handle arbitrary tokens containing Unicode escape
* sequences.
*/
public
void
token
(
Token
token
)
{
pos
+=
this
.
token
.
name
.
length
()
-
token
.
name
.
length
();
prevEndPos
=
pos
;
this
.
token
=
token
;
}
...
...
src/share/classes/com/sun/tools/javac/util/AbstractLog.java
浏览文件 @
2551851e
/*
* Copyright (c) 1999, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
1
, 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
...
...
@@ -94,6 +94,19 @@ public abstract class AbstractLog {
report
(
diags
.
error
(
source
,
pos
,
key
,
args
));
}
/** Report an error, unless another error was already reported at same
* source position.
* @param flag A flag to set on the diagnostic
* @param pos The source position at which to report the error.
* @param key The key for the localized error message.
* @param args Fields of the error message.
*/
public
void
error
(
DiagnosticFlag
flag
,
DiagnosticPosition
pos
,
String
key
,
Object
...
args
)
{
JCDiagnostic
d
=
diags
.
error
(
source
,
pos
,
key
,
args
);
d
.
setFlag
(
flag
);
report
(
d
);
}
/** Report an error, unless another error was already reported at same
* source position.
* @param pos The source position at which to report the error.
...
...
test/tools/javac/7079713/TestCircularClassfile.java
浏览文件 @
2551851e
...
...
@@ -149,6 +149,7 @@ public class TestCircularClassfile {
//step 3: move a classfile from the temp folder to the test subfolder
File
fileToMove
=
new
File
(
tmpDir
,
tk
.
targetClass
);
File
target
=
new
File
(
destDir
,
tk
.
targetClass
);
target
.
delete
();
boolean
success
=
fileToMove
.
renameTo
(
target
);
if
(!
success
)
{
...
...
test/tools/javac/TryWithResources/BadTwr.out
浏览文件 @
2551851e
BadTwr.java:13:
39
: compiler.err.already.defined: r1, main(java.lang.String...)
BadTwr.java:18:
13
: compiler.err.already.defined: args, main(java.lang.String...)
BadTwr.java:13:
46
: compiler.err.already.defined: r1, main(java.lang.String...)
BadTwr.java:18:
20
: compiler.err.already.defined: args, main(java.lang.String...)
BadTwr.java:21:13: compiler.err.cant.assign.val.to.final.var: thatsIt
BadTwr.java:26:
17
: compiler.err.already.defined: name, main(java.lang.String...)
BadTwr.java:26:
24
: compiler.err.already.defined: name, main(java.lang.String...)
4 errors
test/tools/javac/TryWithResources/DuplicateResourceDecl.out
浏览文件 @
2551851e
DuplicateResourceDecl.java:12:
45
: compiler.err.already.defined: c, main(java.lang.String[])
DuplicateResourceDecl.java:12:
56
: compiler.err.already.defined: c, main(java.lang.String[])
1 error
test/tools/javac/TryWithResources/ResourceInterface.out
浏览文件 @
2551851e
ResourceInterface.java:38:
1
3: compiler.err.unreported.exception.implicit.close: ResourceInterface.E1, r2
ResourceInterface.java:38:
2
3: compiler.err.unreported.exception.implicit.close: ResourceInterface.E1, r2
1 error
test/tools/javac/TryWithResources/TwrFlow.out
浏览文件 @
2551851e
TwrFlow.java:14:11: compiler.err.except.never.thrown.in.try: java.io.IOException
TwrFlow.java:12:
13
: compiler.err.unreported.exception.implicit.close: CustomCloseException, twrFlow
TwrFlow.java:12:
21
: compiler.err.unreported.exception.implicit.close: CustomCloseException, twrFlow
2 errors
test/tools/javac/TryWithResources/TwrLint.out
浏览文件 @
2551851e
TwrLint.java:14:15: compiler.warn.try.explicit.close.call
TwrLint.java:13:
13
: compiler.warn.try.resource.not.referenced: r3
TwrLint.java:13:
21
: compiler.warn.try.resource.not.referenced: r3
2 warnings
test/tools/javac/TryWithResources/TwrOnNonResource.out
浏览文件 @
2551851e
TwrOnNonResource.java:12:
13
: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
TwrOnNonResource.java:15:
13
: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
TwrOnNonResource.java:18:
13
: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
TwrOnNonResource.java:12:
30
: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
TwrOnNonResource.java:15:
30
: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
TwrOnNonResource.java:18:
30
: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
3 errors
test/tools/javac/annotations/T7043371.java
0 → 100644
浏览文件 @
2551851e
/*
* 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 7043371
* @summary javac7 fails with NPE during compilation
* @compile T7043371.java
*/
@interface
Anno
{
String
value
();
}
class
B
{
@Anno
(
value
=
A
.
a
)
public
static
final
int
b
=
0
;
}
class
A
{
@Deprecated
public
static
final
String
a
=
"a"
;
}
test/tools/javac/annotations/T7073477.java
0 → 100644
浏览文件 @
2551851e
/*
* 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 7073477
* @summary NPE in com.sun.tools.javac.code.Symbol$VarSymbol.getConstValue
* @compile T7073477.java
*/
@SuppressWarnings
(
T7073477A
.
S
)
class
T7073477
{
}
class
T7073477A
{
@SuppressWarnings
(
""
)
static
final
String
S
=
""
;
}
test/tools/javac/api/7086261/T7086261.java
0 → 100644
浏览文件 @
2551851e
/*
* Copyright (c) 20011, 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 7086261
* @summary javac doesn't report error as expected, it only reports ClientCodeWrapper$DiagnosticSourceUnwrapper
*/
import
javax.tools.*
;
import
com.sun.tools.javac.api.ClientCodeWrapper.DiagnosticSourceUnwrapper
;
import
com.sun.tools.javac.util.JCDiagnostic
;
import
java.net.URI
;
import
java.util.Arrays
;
import
static
javax
.
tools
.
StandardLocation
.*;
import
static
javax
.
tools
.
JavaFileObject
.
Kind
.*;
public
class
T7086261
{
static
class
ErroneousSource
extends
SimpleJavaFileObject
{
public
ErroneousSource
()
{
super
(
URI
.
create
(
"myfo:/Test.java"
),
JavaFileObject
.
Kind
.
SOURCE
);
}
public
CharSequence
getCharContent
(
boolean
ignoreEncodingErrors
)
{
return
"class Test { NonexistentClass c = null; }"
;
}
}
static
class
DiagnosticChecker
implements
DiagnosticListener
<
javax
.
tools
.
JavaFileObject
>
{
public
void
report
(
Diagnostic
message
)
{
if
(!(
message
instanceof
DiagnosticSourceUnwrapper
))
{
throw
new
AssertionError
(
"Wrapped diagnostic expected!"
);
}
String
actual
=
message
.
toString
();
JCDiagnostic
jd
=
(
JCDiagnostic
)((
DiagnosticSourceUnwrapper
)
message
).
d
;
String
expected
=
jd
.
toString
();
if
(!
actual
.
equals
(
expected
))
{
throw
new
AssertionError
(
"expected = "
+
expected
+
"\nfound = "
+
actual
);
}
}
};
void
test
()
throws
Throwable
{
JavaCompiler
javac
=
ToolProvider
.
getSystemJavaCompiler
();
JavaFileManager
jfm
=
javac
.
getStandardFileManager
(
null
,
null
,
null
);
JavaCompiler
.
CompilationTask
task
=
javac
.
getTask
(
null
,
jfm
,
new
DiagnosticChecker
(),
null
,
null
,
Arrays
.
asList
(
new
ErroneousSource
()));
task
.
call
();
}
public
static
void
main
(
String
[]
args
)
throws
Throwable
{
new
T7086261
().
test
();
}
}
test/tools/javac/diags/examples/EmptyCharLiteral.java
浏览文件 @
2551851e
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010,
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
...
...
@@ -23,7 +23,6 @@
// key: compiler.err.empty.char.lit
// key: compiler.err.unclosed.char.lit
// key: compiler.err.expected
// key: compiler.err.premature.eof
class
X
{
...
...
test/tools/javac/jvm/T7024096.java
0 → 100644
浏览文件 @
2551851e
/*
* @test /nodynamiccopyright/
* @bug 7024096
* @summary Stack trace has invalid line numbers
* @author Bruce Chapman
* @compile T7024096.java
* @run main T7024096
*/
public
class
T7024096
{
private
static
final
int
START
=
14
;
// starting line number for the test
public
static
void
main
(
String
[]
args
)
{
T7024096
m
=
new
T7024096
();
m
.
nest
(
START
);
m
.
nest
(
START
+
1
,
m
.
nest
(
START
+
1
),
m
.
nest
(
START
+
1
),
m
.
nest
(
START
+
2
),
m
.
nest
(
START
+
3
,
m
.
nest
(
START
+
3
)));
}
public
T7024096
nest
(
int
expectedline
,
T7024096
...
args
)
{
Exception
e
=
new
Exception
(
"expected line#: "
+
expectedline
);
int
myline
=
e
.
getStackTrace
()[
1
].
getLineNumber
();
if
(
myline
!=
expectedline
)
{
throw
new
RuntimeException
(
"Incorrect line number "
+
"expected: "
+
expectedline
+
", got: "
+
myline
,
e
);
}
System
.
out
.
format
(
"Got expected line number %d correct %n"
,
myline
);
return
null
;
}
}
test/tools/javac/parser/netbeans/JavacParserTest.java
0 → 100644
浏览文件 @
2551851e
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录