Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
c0289dac
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看板
提交
c0289dac
编写于
7月 22, 2013
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
7ced465d
7dd21645
变更
80
展开全部
隐藏空白更改
内联
并排
Showing
80 changed file
with
1628 addition
and
251 deletion
+1628
-251
src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
...com/sun/tools/doclets/internal/toolkit/Configuration.java
+1
-1
src/share/classes/com/sun/tools/doclint/DocLint.java
src/share/classes/com/sun/tools/doclint/DocLint.java
+10
-0
src/share/classes/com/sun/tools/doclint/Env.java
src/share/classes/com/sun/tools/doclint/Env.java
+1
-1
src/share/classes/com/sun/tools/doclint/resources/doclint.properties
...lasses/com/sun/tools/doclint/resources/doclint.properties
+1
-1
src/share/classes/com/sun/tools/javac/code/Flags.java
src/share/classes/com/sun/tools/javac/code/Flags.java
+8
-1
src/share/classes/com/sun/tools/javac/code/Scope.java
src/share/classes/com/sun/tools/javac/code/Scope.java
+6
-1
src/share/classes/com/sun/tools/javac/code/Type.java
src/share/classes/com/sun/tools/javac/code/Type.java
+49
-4
src/share/classes/com/sun/tools/javac/code/Types.java
src/share/classes/com/sun/tools/javac/code/Types.java
+2
-2
src/share/classes/com/sun/tools/javac/comp/Attr.java
src/share/classes/com/sun/tools/javac/comp/Attr.java
+111
-46
src/share/classes/com/sun/tools/javac/comp/Check.java
src/share/classes/com/sun/tools/javac/comp/Check.java
+2
-1
src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
+60
-42
src/share/classes/com/sun/tools/javac/comp/Flow.java
src/share/classes/com/sun/tools/javac/comp/Flow.java
+9
-0
src/share/classes/com/sun/tools/javac/comp/Infer.java
src/share/classes/com/sun/tools/javac/comp/Infer.java
+371
-94
src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
+18
-7
src/share/classes/com/sun/tools/javac/comp/Resolve.java
src/share/classes/com/sun/tools/javac/comp/Resolve.java
+98
-19
src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java
...ses/com/sun/tools/javac/util/RichDiagnosticFormatter.java
+3
-2
src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
+2
-1
src/share/classes/com/sun/tools/javadoc/ToolOption.java
src/share/classes/com/sun/tools/javadoc/ToolOption.java
+8
-1
src/share/classes/com/sun/tools/javadoc/resources/javadoc.properties
...lasses/com/sun/tools/javadoc/resources/javadoc.properties
+1
-0
src/share/classes/com/sun/tools/javah/JavahTask.java
src/share/classes/com/sun/tools/javah/JavahTask.java
+1
-1
src/share/classes/com/sun/tools/javah/resources/l10n.properties
...are/classes/com/sun/tools/javah/resources/l10n.properties
+4
-1
src/share/classes/com/sun/tools/javap/JavapTask.java
src/share/classes/com/sun/tools/javap/JavapTask.java
+1
-1
src/share/classes/com/sun/tools/javap/resources/javap.properties
...re/classes/com/sun/tools/javap/resources/javap.properties
+4
-1
test/tools/doclint/BadPackageCommentTest.java
test/tools/doclint/BadPackageCommentTest.java
+13
-0
test/tools/doclint/BadPackageCommentTest.out
test/tools/doclint/BadPackageCommentTest.out
+10
-0
test/tools/doclint/tool/HelpTest.out
test/tools/doclint/tool/HelpTest.out
+1
-1
test/tools/javac/Diagnostics/compressed/T8020286.java
test/tools/javac/Diagnostics/compressed/T8020286.java
+15
-0
test/tools/javac/Diagnostics/compressed/T8020286.out
test/tools/javac/Diagnostics/compressed/T8020286.out
+4
-0
test/tools/javac/T6356530/SerializableAbstractClassWithNonAbstractMethodsTest.java
.../SerializableAbstractClassWithNonAbstractMethodsTest.java
+48
-0
test/tools/javac/T6356530/SerializableAbstractClassWithNonAbstractMethodsTest.out
...0/SerializableAbstractClassWithNonAbstractMethodsTest.out
+5
-0
test/tools/javac/conditional/T8016702.java
test/tools/javac/conditional/T8016702.java
+66
-0
test/tools/javac/generics/6723444/T6723444.java
test/tools/javac/generics/6723444/T6723444.java
+2
-1
test/tools/javac/generics/6723444/T6723444_1.out
test/tools/javac/generics/6723444/T6723444_1.out
+4
-4
test/tools/javac/generics/6723444/T6723444_2.out
test/tools/javac/generics/6723444/T6723444_2.out
+11
-0
test/tools/javac/generics/7015430/T7015430.java
test/tools/javac/generics/7015430/T7015430.java
+2
-1
test/tools/javac/generics/7015430/T7015430_1.out
test/tools/javac/generics/7015430/T7015430_1.out
+19
-0
test/tools/javac/generics/7015430/T7015430_2.out
test/tools/javac/generics/7015430/T7015430_2.out
+15
-0
test/tools/javac/generics/7034511/T7034511a.java
test/tools/javac/generics/7034511/T7034511a.java
+1
-4
test/tools/javac/generics/7034511/T7034511a.out
test/tools/javac/generics/7034511/T7034511a.out
+1
-1
test/tools/javac/generics/7034511/T7034511b.java
test/tools/javac/generics/7034511/T7034511b.java
+1
-4
test/tools/javac/generics/7034511/T7034511b.out
test/tools/javac/generics/7034511/T7034511b.out
+1
-1
test/tools/javac/generics/7034511/T7041019.java
test/tools/javac/generics/7034511/T7041019.java
+39
-0
test/tools/javac/generics/8016640/T8016640.java
test/tools/javac/generics/8016640/T8016640.java
+10
-0
test/tools/javac/generics/8016640/T8016640.out
test/tools/javac/generics/8016640/T8016640.out
+2
-0
test/tools/javac/generics/inference/8019824/T8019824.java
test/tools/javac/generics/inference/8019824/T8019824.java
+15
-0
test/tools/javac/generics/inference/8019824/T8019824.out
test/tools/javac/generics/inference/8019824/T8019824.out
+2
-0
test/tools/javac/generics/inference/8020149/T8020149.java
test/tools/javac/generics/inference/8020149/T8020149.java
+48
-0
test/tools/javac/lambda/8019480/T8019480.java
test/tools/javac/lambda/8019480/T8019480.java
+23
-0
test/tools/javac/lambda/8019480/T8019480.out
test/tools/javac/lambda/8019480/T8019480.out
+3
-0
test/tools/javac/lambda/8020147/T8020147.java
test/tools/javac/lambda/8020147/T8020147.java
+19
-0
test/tools/javac/lambda/8020147/T8020147.out
test/tools/javac/lambda/8020147/T8020147.out
+5
-0
test/tools/javac/lambda/BadNestedLambda.java
test/tools/javac/lambda/BadNestedLambda.java
+11
-0
test/tools/javac/lambda/BadNestedLambda.out
test/tools/javac/lambda/BadNestedLambda.out
+3
-0
test/tools/javac/lambda/MethodReference68.java
test/tools/javac/lambda/MethodReference68.java
+23
-0
test/tools/javac/lambda/MethodReference68.out
test/tools/javac/lambda/MethodReference68.out
+2
-0
test/tools/javac/lambda/MethodReference69.java
test/tools/javac/lambda/MethodReference69.java
+21
-0
test/tools/javac/lambda/MethodReference69.out
test/tools/javac/lambda/MethodReference69.out
+2
-0
test/tools/javac/lambda/MethodReference70.java
test/tools/javac/lambda/MethodReference70.java
+28
-0
test/tools/javac/lambda/MethodReference70.out
test/tools/javac/lambda/MethodReference70.out
+3
-0
test/tools/javac/lambda/MethodReference71.java
test/tools/javac/lambda/MethodReference71.java
+26
-0
test/tools/javac/lambda/MethodReference71.out
test/tools/javac/lambda/MethodReference71.out
+3
-0
test/tools/javac/lambda/MethodReference72.java
test/tools/javac/lambda/MethodReference72.java
+20
-0
test/tools/javac/lambda/MethodReference72.out
test/tools/javac/lambda/MethodReference72.out
+2
-0
test/tools/javac/lambda/NestedCapture01.java
test/tools/javac/lambda/NestedCapture01.java
+43
-0
test/tools/javac/lambda/NestedCapture02.java
test/tools/javac/lambda/NestedCapture02.java
+43
-0
test/tools/javac/lambda/NestedCapture03.java
test/tools/javac/lambda/NestedCapture03.java
+36
-0
test/tools/javac/lambda/TargetType36.java
test/tools/javac/lambda/TargetType36.java
+3
-4
test/tools/javac/lambda/TargetType36.out
test/tools/javac/lambda/TargetType36.out
+3
-0
test/tools/javac/lambda/TargetType60.out
test/tools/javac/lambda/TargetType60.out
+1
-1
test/tools/javac/lambda/TargetType63.java
test/tools/javac/lambda/TargetType63.java
+40
-0
test/tools/javac/lambda/TargetType63.out
test/tools/javac/lambda/TargetType63.out
+9
-0
test/tools/javac/lambda/TargetType75.java
test/tools/javac/lambda/TargetType75.java
+41
-0
test/tools/javac/lambda/TargetType76.java
test/tools/javac/lambda/TargetType76.java
+65
-0
test/tools/javac/meth/VarargsWarn.java
test/tools/javac/meth/VarargsWarn.java
+17
-0
test/tools/javac/meth/VarargsWarn.out
test/tools/javac/meth/VarargsWarn.out
+4
-0
test/tools/javac/warnings/6594914/Auxiliary.java
test/tools/javac/warnings/6594914/Auxiliary.java
+5
-0
test/tools/javac/warnings/6594914/ExplicitCompilation.out
test/tools/javac/warnings/6594914/ExplicitCompilation.out
+2
-0
test/tools/javac/warnings/6594914/ImplicitCompilation.java
test/tools/javac/warnings/6594914/ImplicitCompilation.java
+13
-0
test/tools/javac/warnings/6594914/ImplicitCompilation.out
test/tools/javac/warnings/6594914/ImplicitCompilation.out
+2
-0
test/tools/javap/8007907/JavapReturns0AfterClassNotFoundTest.java
...ls/javap/8007907/JavapReturns0AfterClassNotFoundTest.java
+1
-1
未找到文件。
src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
浏览文件 @
c0289dac
...
@@ -467,7 +467,7 @@ public abstract class Configuration {
...
@@ -467,7 +467,7 @@ public abstract class Configuration {
nodeprecated
=
true
;
nodeprecated
=
true
;
}
else
if
(
opt
.
equals
(
"-sourcepath"
))
{
}
else
if
(
opt
.
equals
(
"-sourcepath"
))
{
sourcepath
=
os
[
1
];
sourcepath
=
os
[
1
];
}
else
if
(
opt
.
equals
(
"-classpath"
)
&&
}
else
if
(
(
opt
.
equals
(
"-classpath"
)
||
opt
.
equals
(
"-cp"
)
)
&&
sourcepath
.
length
()
==
0
)
{
sourcepath
.
length
()
==
0
)
{
sourcepath
=
os
[
1
];
sourcepath
=
os
[
1
];
}
else
if
(
opt
.
equals
(
"-excludedocfilessubdir"
))
{
}
else
if
(
opt
.
equals
(
"-excludedocfilessubdir"
))
{
...
...
src/share/classes/com/sun/tools/doclint/DocLint.java
浏览文件 @
c0289dac
...
@@ -187,6 +187,8 @@ public class DocLint implements Plugin {
...
@@ -187,6 +187,8 @@ public class DocLint implements Plugin {
javacBootClassPath
=
splitPath
(
args
[++
i
]);
javacBootClassPath
=
splitPath
(
args
[++
i
]);
}
else
if
(
arg
.
equals
(
"-classpath"
)
&&
i
+
1
<
args
.
length
)
{
}
else
if
(
arg
.
equals
(
"-classpath"
)
&&
i
+
1
<
args
.
length
)
{
javacClassPath
=
splitPath
(
args
[++
i
]);
javacClassPath
=
splitPath
(
args
[++
i
]);
}
else
if
(
arg
.
equals
(
"-cp"
)
&&
i
+
1
<
args
.
length
)
{
javacClassPath
=
splitPath
(
args
[++
i
]);
}
else
if
(
arg
.
equals
(
"-sourcepath"
)
&&
i
+
1
<
args
.
length
)
{
}
else
if
(
arg
.
equals
(
"-sourcepath"
)
&&
i
+
1
<
args
.
length
)
{
javacSourcePath
=
splitPath
(
args
[++
i
]);
javacSourcePath
=
splitPath
(
args
[++
i
]);
}
else
if
(
arg
.
equals
(
XMSGS_OPTION
))
{
}
else
if
(
arg
.
equals
(
XMSGS_OPTION
))
{
...
@@ -325,6 +327,14 @@ public class DocLint implements Plugin {
...
@@ -325,6 +327,14 @@ public class DocLint implements Plugin {
static
abstract
class
DeclScanner
extends
TreePathScanner
<
Void
,
Void
>
{
static
abstract
class
DeclScanner
extends
TreePathScanner
<
Void
,
Void
>
{
abstract
void
visitDecl
(
Tree
tree
,
Name
name
);
abstract
void
visitDecl
(
Tree
tree
,
Name
name
);
@Override
public
Void
visitCompilationUnit
(
CompilationUnitTree
tree
,
Void
ignore
)
{
if
(
tree
.
getPackageName
()
!=
null
)
{
visitDecl
(
tree
,
null
);
}
return
super
.
visitCompilationUnit
(
tree
,
ignore
);
}
@Override
@Override
public
Void
visitClass
(
ClassTree
tree
,
Void
ignore
)
{
public
Void
visitClass
(
ClassTree
tree
,
Void
ignore
)
{
visitDecl
(
tree
,
tree
.
getSimpleName
());
visitDecl
(
tree
,
tree
.
getSimpleName
());
...
...
src/share/classes/com/sun/tools/doclint/Env.java
浏览文件 @
c0289dac
...
@@ -142,7 +142,7 @@ public class Env {
...
@@ -142,7 +142,7 @@ public class Env {
currElement
=
trees
.
getElement
(
currPath
);
currElement
=
trees
.
getElement
(
currPath
);
currOverriddenMethods
=
((
JavacTypes
)
types
).
getOverriddenMethods
(
currElement
);
currOverriddenMethods
=
((
JavacTypes
)
types
).
getOverriddenMethods
(
currElement
);
AccessKind
ak
=
null
;
AccessKind
ak
=
AccessKind
.
PUBLIC
;
for
(
TreePath
p
=
path
;
p
!=
null
;
p
=
p
.
getParentPath
())
{
for
(
TreePath
p
=
path
;
p
!=
null
;
p
=
p
.
getParentPath
())
{
Element
e
=
trees
.
getElement
(
p
);
Element
e
=
trees
.
getElement
(
p
);
if
(
e
!=
null
&&
e
.
getKind
()
!=
ElementKind
.
PACKAGE
)
{
if
(
e
!=
null
&&
e
.
getKind
()
!=
ElementKind
.
PACKAGE
)
{
...
...
src/share/classes/com/sun/tools/doclint/resources/doclint.properties
浏览文件 @
c0289dac
...
@@ -109,7 +109,7 @@ Options:\n\
...
@@ -109,7 +109,7 @@ Options:\n\
\
Show this message.
\n\
\
Show this message.
\n\
\n\
\n\
The following javac options are also supported
\n\
The following javac options are also supported
\n\
\
-bootclasspath, -classpath, -sourcepath, -Xmaxerrs, -Xmaxwarns
\n\
\
-bootclasspath, -classpath, -
cp, -
sourcepath, -Xmaxerrs, -Xmaxwarns
\n\
\n\
\n\
To run doclint on part of a project, put the compiled classes for your
\n\
To run doclint on part of a project, put the compiled classes for your
\n\
project on the classpath (or bootclasspath), then specify the source files
\n\
project on the classpath (or bootclasspath), then specify the source files
\n\
...
...
src/share/classes/com/sun/tools/javac/code/Flags.java
浏览文件 @
c0289dac
...
@@ -261,6 +261,11 @@ public class Flags {
...
@@ -261,6 +261,11 @@ public class Flags {
*/
*/
public
static
final
long
SIGNATURE_POLYMORPHIC
=
1L
<<
46
;
public
static
final
long
SIGNATURE_POLYMORPHIC
=
1L
<<
46
;
/**
* Flag that marks inference variables used in a 'throws' clause
*/
public
static
final
long
THROWS
=
1L
<<
47
;
/** Modifier masks.
/** Modifier masks.
*/
*/
public
static
final
int
public
static
final
int
...
@@ -365,7 +370,9 @@ public class Flags {
...
@@ -365,7 +370,9 @@ public class Flags {
CLASH
(
Flags
.
CLASH
),
CLASH
(
Flags
.
CLASH
),
AUXILIARY
(
Flags
.
AUXILIARY
),
AUXILIARY
(
Flags
.
AUXILIARY
),
NOT_IN_PROFILE
(
Flags
.
NOT_IN_PROFILE
),
NOT_IN_PROFILE
(
Flags
.
NOT_IN_PROFILE
),
BAD_OVERRIDE
(
Flags
.
BAD_OVERRIDE
);
BAD_OVERRIDE
(
Flags
.
BAD_OVERRIDE
),
SIGNATURE_POLYMORPHIC
(
Flags
.
SIGNATURE_POLYMORPHIC
),
THROWS
(
Flags
.
THROWS
);
Flag
(
long
flag
)
{
Flag
(
long
flag
)
{
this
.
value
=
flag
;
this
.
value
=
flag
;
...
...
src/share/classes/com/sun/tools/javac/code/Scope.java
浏览文件 @
c0289dac
/*
/*
* Copyright (c) 1999, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -316,6 +316,7 @@ public class Scope {
...
@@ -316,6 +316,7 @@ public class Scope {
public
Entry
lookup
(
Name
name
)
{
public
Entry
lookup
(
Name
name
)
{
return
lookup
(
name
,
noFilter
);
return
lookup
(
name
,
noFilter
);
}
}
public
Entry
lookup
(
Name
name
,
Filter
<
Symbol
>
sf
)
{
public
Entry
lookup
(
Name
name
,
Filter
<
Symbol
>
sf
)
{
Entry
e
=
table
[
getIndex
(
name
)];
Entry
e
=
table
[
getIndex
(
name
)];
if
(
e
==
null
||
e
==
sentinel
)
if
(
e
==
null
||
e
==
sentinel
)
...
@@ -361,6 +362,10 @@ public class Scope {
...
@@ -361,6 +362,10 @@ public class Scope {
}
}
}
}
public
boolean
anyMatch
(
Filter
<
Symbol
>
sf
)
{
return
getElements
(
sf
).
iterator
().
hasNext
();
}
public
Iterable
<
Symbol
>
getElements
()
{
public
Iterable
<
Symbol
>
getElements
()
{
return
getElements
(
noFilter
);
return
getElements
(
noFilter
);
}
}
...
...
src/share/classes/com/sun/tools/javac/code/Type.java
浏览文件 @
c0289dac
...
@@ -78,6 +78,9 @@ public abstract class Type implements TypeMirror {
...
@@ -78,6 +78,9 @@ public abstract class Type implements TypeMirror {
/** Constant type: special type to be used during recovery of deferred expressions. */
/** Constant type: special type to be used during recovery of deferred expressions. */
public
static
final
JCNoType
recoveryType
=
new
JCNoType
();
public
static
final
JCNoType
recoveryType
=
new
JCNoType
();
/** Constant type: special type to be used for marking stuck trees. */
public
static
final
JCNoType
stuckType
=
new
JCNoType
();
/** If this switch is turned on, the names of type variables
/** If this switch is turned on, the names of type variables
* and anonymous classes are printed with hashcodes appended.
* and anonymous classes are printed with hashcodes appended.
*/
*/
...
@@ -1449,7 +1452,7 @@ public abstract class Type implements TypeMirror {
...
@@ -1449,7 +1452,7 @@ public abstract class Type implements TypeMirror {
}
}
/** inference variable bounds */
/** inference variable bounds */
pr
ivate
Map
<
InferenceBound
,
List
<
Type
>>
bounds
;
pr
otected
Map
<
InferenceBound
,
List
<
Type
>>
bounds
;
/** inference variable's inferred type (set from Infer.java) */
/** inference variable's inferred type (set from Infer.java) */
public
Type
inst
=
null
;
public
Type
inst
=
null
;
...
@@ -1511,8 +1514,17 @@ public abstract class Type implements TypeMirror {
...
@@ -1511,8 +1514,17 @@ public abstract class Type implements TypeMirror {
return
buf
.
toList
();
return
buf
.
toList
();
}
}
/** internal method used to override an undetvar bounds */
public
void
setBounds
(
InferenceBound
ib
,
List
<
Type
>
newBounds
)
{
bounds
.
put
(
ib
,
newBounds
);
}
/** add a bound of a given kind - this might trigger listener notification */
/** add a bound of a given kind - this might trigger listener notification */
public
void
addBound
(
InferenceBound
ib
,
Type
bound
,
Types
types
)
{
public
final
void
addBound
(
InferenceBound
ib
,
Type
bound
,
Types
types
)
{
addBound
(
ib
,
bound
,
types
,
false
);
}
protected
void
addBound
(
InferenceBound
ib
,
Type
bound
,
Types
types
,
boolean
update
)
{
Type
bound2
=
toTypeVarMap
.
apply
(
bound
);
Type
bound2
=
toTypeVarMap
.
apply
(
bound
);
List
<
Type
>
prevBounds
=
bounds
.
get
(
ib
);
List
<
Type
>
prevBounds
=
bounds
.
get
(
ib
);
for
(
Type
b
:
prevBounds
)
{
for
(
Type
b
:
prevBounds
)
{
...
@@ -1529,7 +1541,7 @@ public abstract class Type implements TypeMirror {
...
@@ -1529,7 +1541,7 @@ public abstract class Type implements TypeMirror {
public
Type
apply
(
Type
t
)
{
public
Type
apply
(
Type
t
)
{
if
(
t
.
hasTag
(
UNDETVAR
))
{
if
(
t
.
hasTag
(
UNDETVAR
))
{
UndetVar
uv
=
(
UndetVar
)
t
;
UndetVar
uv
=
(
UndetVar
)
t
;
return
uv
.
qtype
;
return
uv
.
inst
!=
null
?
uv
.
inst
:
uv
.
qtype
;
}
else
{
}
else
{
return
t
.
map
(
this
);
return
t
.
map
(
this
);
}
}
...
@@ -1567,7 +1579,7 @@ public abstract class Type implements TypeMirror {
...
@@ -1567,7 +1579,7 @@ public abstract class Type implements TypeMirror {
bounds
.
put
(
ib
,
newBounds
.
toList
());
bounds
.
put
(
ib
,
newBounds
.
toList
());
//step 3 - for each dependency, add new replaced bound
//step 3 - for each dependency, add new replaced bound
for
(
Type
dep
:
deps
)
{
for
(
Type
dep
:
deps
)
{
addBound
(
ib
,
types
.
subst
(
dep
,
from
,
to
),
types
);
addBound
(
ib
,
types
.
subst
(
dep
,
from
,
to
),
types
,
true
);
}
}
}
}
}
finally
{
}
finally
{
...
@@ -1583,6 +1595,39 @@ public abstract class Type implements TypeMirror {
...
@@ -1583,6 +1595,39 @@ public abstract class Type implements TypeMirror {
listener
.
varChanged
(
this
,
ibs
);
listener
.
varChanged
(
this
,
ibs
);
}
}
}
}
public
boolean
isCaptured
()
{
return
false
;
}
}
/**
* This class is used to represent synthetic captured inference variables
* that can be generated during nested generic method calls. The only difference
* between these inference variables and ordinary ones is that captured inference
* variables cannot get new bounds through incorporation.
*/
public
static
class
CapturedUndetVar
extends
UndetVar
{
public
CapturedUndetVar
(
CapturedType
origin
,
Types
types
)
{
super
(
origin
,
types
);
if
(!
origin
.
lower
.
hasTag
(
BOT
))
{
bounds
.
put
(
InferenceBound
.
LOWER
,
List
.
of
(
origin
.
lower
));
}
}
@Override
public
void
addBound
(
InferenceBound
ib
,
Type
bound
,
Types
types
,
boolean
update
)
{
if
(
update
)
{
//only change bounds if request comes from substBounds
super
.
addBound
(
ib
,
bound
,
types
,
update
);
}
}
@Override
public
boolean
isCaptured
()
{
return
true
;
}
}
}
/** Represents NONE.
/** Represents NONE.
...
...
src/share/classes/com/sun/tools/javac/code/Types.java
浏览文件 @
c0289dac
...
@@ -2330,7 +2330,7 @@ public class Types {
...
@@ -2330,7 +2330,7 @@ public class Types {
@Override
@Override
public
Type
visitErrorType
(
ErrorType
t
,
Void
ignored
)
{
public
Type
visitErrorType
(
ErrorType
t
,
Void
ignored
)
{
return
t
;
return
Type
.
noType
;
}
}
};
};
// </editor-fold>
// </editor-fold>
...
@@ -2950,7 +2950,7 @@ public class Types {
...
@@ -2950,7 +2950,7 @@ public class Types {
if
(
elemtype
==
t
.
elemtype
)
if
(
elemtype
==
t
.
elemtype
)
return
t
;
return
t
;
else
else
return
new
ArrayType
(
upperBound
(
elemtype
)
,
t
.
tsym
);
return
new
ArrayType
(
elemtype
,
t
.
tsym
);
}
}
@Override
@Override
...
...
src/share/classes/com/sun/tools/javac/comp/Attr.java
浏览文件 @
c0289dac
...
@@ -481,31 +481,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -481,31 +481,7 @@ public class Attr extends JCTree.Visitor {
static
final
long
serialVersionUID
=
-
6924771130405446405L
;
static
final
long
serialVersionUID
=
-
6924771130405446405L
;
private
Env
<
AttrContext
>
env
;
private
Env
<
AttrContext
>
env
;
private
BreakAttr
(
Env
<
AttrContext
>
env
)
{
private
BreakAttr
(
Env
<
AttrContext
>
env
)
{
this
.
env
=
copyEnv
(
env
);
this
.
env
=
env
;
}
private
Env
<
AttrContext
>
copyEnv
(
Env
<
AttrContext
>
env
)
{
Env
<
AttrContext
>
newEnv
=
env
.
dup
(
env
.
tree
,
env
.
info
.
dup
(
copyScope
(
env
.
info
.
scope
)));
if
(
newEnv
.
outer
!=
null
)
{
newEnv
.
outer
=
copyEnv
(
newEnv
.
outer
);
}
return
newEnv
;
}
private
Scope
copyScope
(
Scope
sc
)
{
Scope
newScope
=
new
Scope
(
sc
.
owner
);
List
<
Symbol
>
elemsList
=
List
.
nil
();
while
(
sc
!=
null
)
{
for
(
Scope
.
Entry
e
=
sc
.
elems
;
e
!=
null
;
e
=
e
.
sibling
)
{
elemsList
=
elemsList
.
prepend
(
e
.
sym
);
}
sc
=
sc
.
next
;
}
for
(
Symbol
s
:
elemsList
)
{
newScope
.
enter
(
s
);
}
return
newScope
;
}
}
}
}
...
@@ -555,11 +531,6 @@ public class Attr extends JCTree.Visitor {
...
@@ -555,11 +531,6 @@ public class Attr extends JCTree.Visitor {
}
}
});
});
}
}
@Override
protected
Type
check
(
DiagnosticPosition
pos
,
Type
found
)
{
return
chk
.
checkNonVoid
(
pos
,
super
.
check
(
pos
,
found
));
}
}
}
final
ResultInfo
statInfo
;
final
ResultInfo
statInfo
;
...
@@ -610,7 +581,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -610,7 +581,7 @@ public class Attr extends JCTree.Visitor {
tree
.
accept
(
this
);
tree
.
accept
(
this
);
if
(
tree
==
breakTree
&&
if
(
tree
==
breakTree
&&
resultInfo
.
checkContext
.
deferredAttrContext
().
mode
==
AttrMode
.
CHECK
)
{
resultInfo
.
checkContext
.
deferredAttrContext
().
mode
==
AttrMode
.
CHECK
)
{
throw
new
BreakAttr
(
env
);
throw
new
BreakAttr
(
copyEnv
(
env
)
);
}
}
return
result
;
return
result
;
}
catch
(
CompletionFailure
ex
)
{
}
catch
(
CompletionFailure
ex
)
{
...
@@ -622,6 +593,30 @@ public class Attr extends JCTree.Visitor {
...
@@ -622,6 +593,30 @@ public class Attr extends JCTree.Visitor {
}
}
}
}
Env
<
AttrContext
>
copyEnv
(
Env
<
AttrContext
>
env
)
{
Env
<
AttrContext
>
newEnv
=
env
.
dup
(
env
.
tree
,
env
.
info
.
dup
(
copyScope
(
env
.
info
.
scope
)));
if
(
newEnv
.
outer
!=
null
)
{
newEnv
.
outer
=
copyEnv
(
newEnv
.
outer
);
}
return
newEnv
;
}
Scope
copyScope
(
Scope
sc
)
{
Scope
newScope
=
new
Scope
(
sc
.
owner
);
List
<
Symbol
>
elemsList
=
List
.
nil
();
while
(
sc
!=
null
)
{
for
(
Scope
.
Entry
e
=
sc
.
elems
;
e
!=
null
;
e
=
e
.
sibling
)
{
elemsList
=
elemsList
.
prepend
(
e
.
sym
);
}
sc
=
sc
.
next
;
}
for
(
Symbol
s
:
elemsList
)
{
newScope
.
enter
(
s
);
}
return
newScope
;
}
/** Derived visitor method: attribute an expression tree.
/** Derived visitor method: attribute an expression tree.
*/
*/
public
Type
attribExpr
(
JCTree
tree
,
Env
<
AttrContext
>
env
,
Type
pt
)
{
public
Type
attribExpr
(
JCTree
tree
,
Env
<
AttrContext
>
env
,
Type
pt
)
{
...
@@ -1697,7 +1692,8 @@ public class Attr extends JCTree.Visitor {
...
@@ -1697,7 +1692,8 @@ public class Attr extends JCTree.Visitor {
diags
.
fragment
(
"unexpected.ret.val"
));
diags
.
fragment
(
"unexpected.ret.val"
));
}
}
attribTree
(
tree
.
expr
,
env
,
env
.
info
.
returnResult
);
attribTree
(
tree
.
expr
,
env
,
env
.
info
.
returnResult
);
}
else
if
(!
env
.
info
.
returnResult
.
pt
.
hasTag
(
VOID
))
{
}
else
if
(!
env
.
info
.
returnResult
.
pt
.
hasTag
(
VOID
)
&&
!
env
.
info
.
returnResult
.
pt
.
hasTag
(
NONE
))
{
env
.
info
.
returnResult
.
checkContext
.
report
(
tree
.
pos
(),
env
.
info
.
returnResult
.
checkContext
.
report
(
tree
.
pos
(),
diags
.
fragment
(
"missing.ret.val"
));
diags
.
fragment
(
"missing.ret.val"
));
}
}
...
@@ -2395,7 +2391,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -2395,7 +2391,7 @@ public class Attr extends JCTree.Visitor {
ResultInfo
bodyResultInfo
=
lambdaType
.
getReturnType
()
==
Type
.
recoveryType
?
ResultInfo
bodyResultInfo
=
lambdaType
.
getReturnType
()
==
Type
.
recoveryType
?
recoveryInfo
:
recoveryInfo
:
new
ResultInfo
(
VAL
,
lambdaType
.
getReturnType
(),
funcContext
);
new
LambdaResultInfo
(
lambdaType
.
getReturnType
(),
funcContext
);
localEnv
.
info
.
returnResult
=
bodyResultInfo
;
localEnv
.
info
.
returnResult
=
bodyResultInfo
;
Log
.
DeferredDiagnosticHandler
lambdaDeferredHandler
=
new
Log
.
DeferredDiagnosticHandler
(
log
);
Log
.
DeferredDiagnosticHandler
lambdaDeferredHandler
=
new
Log
.
DeferredDiagnosticHandler
(
log
);
...
@@ -2434,7 +2430,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -2434,7 +2430,7 @@ public class Attr extends JCTree.Visitor {
boolean
isSpeculativeRound
=
boolean
isSpeculativeRound
=
resultInfo
.
checkContext
.
deferredAttrContext
().
mode
==
DeferredAttr
.
AttrMode
.
SPECULATIVE
;
resultInfo
.
checkContext
.
deferredAttrContext
().
mode
==
DeferredAttr
.
AttrMode
.
SPECULATIVE
;
p
ostAttr
(
that
);
p
reFlow
(
that
);
flow
.
analyzeLambda
(
env
,
that
,
make
,
isSpeculativeRound
);
flow
.
analyzeLambda
(
env
,
that
,
make
,
isSpeculativeRound
);
checkLambdaCompatible
(
that
,
lambdaType
,
resultInfo
.
checkContext
,
isSpeculativeRound
);
checkLambdaCompatible
(
that
,
lambdaType
,
resultInfo
.
checkContext
,
isSpeculativeRound
);
...
@@ -2456,6 +2452,21 @@ public class Attr extends JCTree.Visitor {
...
@@ -2456,6 +2452,21 @@ public class Attr extends JCTree.Visitor {
}
}
}
}
//where
//where
void
preFlow
(
JCLambda
tree
)
{
new
PostAttrAnalyzer
()
{
@Override
public
void
scan
(
JCTree
tree
)
{
if
(
tree
==
null
||
(
tree
.
type
!=
null
&&
tree
.
type
==
Type
.
stuckType
))
{
//don't touch stuck expressions!
return
;
}
super
.
scan
(
tree
);
}
}.
scan
(
tree
);
}
Types
.
MapVisitor
<
DiagnosticPosition
>
targetChecker
=
new
Types
.
MapVisitor
<
DiagnosticPosition
>()
{
Types
.
MapVisitor
<
DiagnosticPosition
>
targetChecker
=
new
Types
.
MapVisitor
<
DiagnosticPosition
>()
{
@Override
@Override
...
@@ -2587,6 +2598,28 @@ public class Attr extends JCTree.Visitor {
...
@@ -2587,6 +2598,28 @@ public class Attr extends JCTree.Visitor {
}
}
}
}
class
LambdaResultInfo
extends
ResultInfo
{
LambdaResultInfo
(
Type
pt
,
CheckContext
checkContext
)
{
super
(
VAL
,
pt
,
checkContext
);
}
@Override
protected
Type
check
(
DiagnosticPosition
pos
,
Type
found
)
{
return
super
.
check
(
pos
,
found
.
baseType
());
}
@Override
protected
ResultInfo
dup
(
CheckContext
newContext
)
{
return
new
LambdaResultInfo
(
pt
,
newContext
);
}
@Override
protected
ResultInfo
dup
(
Type
newPt
)
{
return
new
LambdaResultInfo
(
newPt
,
checkContext
);
}
}
/**
/**
* Lambda compatibility. Check that given return types, thrown types, parameter types
* Lambda compatibility. Check that given return types, thrown types, parameter types
* are compatible with the expected functional interface descriptor. This means that:
* are compatible with the expected functional interface descriptor. This means that:
...
@@ -2688,10 +2721,21 @@ public class Attr extends JCTree.Visitor {
...
@@ -2688,10 +2721,21 @@ public class Attr extends JCTree.Visitor {
setFunctionalInfo
(
localEnv
,
that
,
pt
(),
desc
,
target
,
resultInfo
.
checkContext
);
setFunctionalInfo
(
localEnv
,
that
,
pt
(),
desc
,
target
,
resultInfo
.
checkContext
);
List
<
Type
>
argtypes
=
desc
.
getParameterTypes
();
List
<
Type
>
argtypes
=
desc
.
getParameterTypes
();
Resolve
.
MethodCheck
referenceCheck
=
rs
.
resolveMethodCheck
;
if
(
resultInfo
.
checkContext
.
inferenceContext
().
free
(
argtypes
))
{
referenceCheck
=
rs
.
new
MethodReferenceCheck
(
resultInfo
.
checkContext
.
inferenceContext
());
}
Pair
<
Symbol
,
Resolve
.
ReferenceLookupHelper
>
refResult
=
Pair
<
Symbol
,
Resolve
.
ReferenceLookupHelper
>
refResult
=
null
;
rs
.
resolveMemberReference
(
that
.
pos
(),
localEnv
,
that
,
List
<
Type
>
saved_undet
=
resultInfo
.
checkContext
.
inferenceContext
().
save
();
that
.
expr
.
type
,
that
.
name
,
argtypes
,
typeargtypes
,
true
,
rs
.
resolveMethodCheck
);
try
{
refResult
=
rs
.
resolveMemberReference
(
that
.
pos
(),
localEnv
,
that
,
that
.
expr
.
type
,
that
.
name
,
argtypes
,
typeargtypes
,
true
,
referenceCheck
,
resultInfo
.
checkContext
.
inferenceContext
());
}
finally
{
resultInfo
.
checkContext
.
inferenceContext
().
rollback
(
saved_undet
);
}
Symbol
refSym
=
refResult
.
fst
;
Symbol
refSym
=
refResult
.
fst
;
Resolve
.
ReferenceLookupHelper
lookupHelper
=
refResult
.
snd
;
Resolve
.
ReferenceLookupHelper
lookupHelper
=
refResult
.
snd
;
...
@@ -2803,17 +2847,24 @@ public class Attr extends JCTree.Visitor {
...
@@ -2803,17 +2847,24 @@ public class Attr extends JCTree.Visitor {
}
}
}
}
that
.
sym
=
refSym
.
baseSymbol
();
that
.
kind
=
lookupHelper
.
referenceKind
(
that
.
sym
);
ResultInfo
checkInfo
=
ResultInfo
checkInfo
=
resultInfo
.
dup
(
newMethodTemplate
(
resultInfo
.
dup
(
newMethodTemplate
(
desc
.
getReturnType
().
hasTag
(
VOID
)
?
Type
.
noType
:
desc
.
getReturnType
(),
desc
.
getReturnType
().
hasTag
(
VOID
)
?
Type
.
noType
:
desc
.
getReturnType
(),
lookupHelper
.
argtypes
,
that
.
kind
.
isUnbound
()
?
argtypes
.
tail
:
argtypes
,
typeargtypes
));
typeargtypes
));
Type
refType
=
checkId
(
that
,
lookupHelper
.
site
,
refSym
,
localEnv
,
checkInfo
);
Type
refType
=
checkId
(
that
,
lookupHelper
.
site
,
refSym
,
localEnv
,
checkInfo
);
if
(
that
.
kind
.
isUnbound
()
&&
resultInfo
.
checkContext
.
inferenceContext
().
free
(
argtypes
.
head
))
{
//re-generate inference constraints for unbound receiver
if
(!
types
.
isSubtype
(
resultInfo
.
checkContext
.
inferenceContext
().
asFree
(
argtypes
.
head
),
exprType
))
{
//cannot happen as this has already been checked - we just need
//to regenerate the inference constraints, as that has been lost
//as a result of the call to inferenceContext.save()
Assert
.
error
(
"Can't get here"
);
}
}
if
(!
refType
.
isErroneous
())
{
if
(!
refType
.
isErroneous
())
{
refType
=
types
.
createMethodTypeWithReturn
(
refType
,
refType
=
types
.
createMethodTypeWithReturn
(
refType
,
adjustMethodReturnType
(
lookupHelper
.
site
,
that
.
name
,
checkInfo
.
pt
.
getParameterTypes
(),
refType
.
getReturnType
()));
adjustMethodReturnType
(
lookupHelper
.
site
,
that
.
name
,
checkInfo
.
pt
.
getParameterTypes
(),
refType
.
getReturnType
()));
...
@@ -4305,7 +4356,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -4305,7 +4356,7 @@ public class Attr extends JCTree.Visitor {
if
(
env
.
info
.
lint
.
isEnabled
(
LintCategory
.
SERIAL
)
&&
if
(
env
.
info
.
lint
.
isEnabled
(
LintCategory
.
SERIAL
)
&&
isSerializable
(
c
)
&&
isSerializable
(
c
)
&&
(
c
.
flags
()
&
Flags
.
ENUM
)
==
0
&&
(
c
.
flags
()
&
Flags
.
ENUM
)
==
0
&&
(
c
.
flags
()
&
ABSTRACT
)
==
0
)
{
checkForSerial
(
c
)
)
{
checkSerialVersionUID
(
tree
,
c
);
checkSerialVersionUID
(
tree
,
c
);
}
}
if
(
allowTypeAnnos
)
{
if
(
allowTypeAnnos
)
{
...
@@ -4317,6 +4368,22 @@ public class Attr extends JCTree.Visitor {
...
@@ -4317,6 +4368,22 @@ public class Attr extends JCTree.Visitor {
}
}
}
}
// where
// where
boolean
checkForSerial
(
ClassSymbol
c
)
{
if
((
c
.
flags
()
&
ABSTRACT
)
==
0
)
{
return
true
;
}
else
{
return
c
.
members
().
anyMatch
(
anyNonAbstractOrDefaultMethod
);
}
}
public
static
final
Filter
<
Symbol
>
anyNonAbstractOrDefaultMethod
=
new
Filter
<
Symbol
>()
{
@Override
public
boolean
accepts
(
Symbol
s
)
{
return
s
.
kind
==
Kinds
.
MTH
&&
(
s
.
flags
()
&
(
DEFAULT
|
ABSTRACT
))
!=
ABSTRACT
;
}
};
/** get a diagnostic position for an attribute of Type t, or null if attribute missing */
/** get a diagnostic position for an attribute of Type t, or null if attribute missing */
private
DiagnosticPosition
getDiagnosticPosition
(
JCClassDecl
tree
,
Type
t
)
{
private
DiagnosticPosition
getDiagnosticPosition
(
JCClassDecl
tree
,
Type
t
)
{
for
(
List
<
JCAnnotation
>
al
=
tree
.
mods
.
annotations
;
!
al
.
isEmpty
();
al
=
al
.
tail
)
{
for
(
List
<
JCAnnotation
>
al
=
tree
.
mods
.
annotations
;
!
al
.
isEmpty
();
al
=
al
.
tail
)
{
...
@@ -4369,9 +4436,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -4369,9 +4436,7 @@ public class Attr extends JCTree.Visitor {
}
}
private
Type
capture
(
Type
type
)
{
private
Type
capture
(
Type
type
)
{
//do not capture free types
return
types
.
capture
(
type
);
return
resultInfo
.
checkContext
.
inferenceContext
().
free
(
type
)
?
type
:
types
.
capture
(
type
);
}
}
private
void
validateTypeAnnotations
(
JCTree
tree
)
{
private
void
validateTypeAnnotations
(
JCTree
tree
)
{
...
...
src/share/classes/com/sun/tools/javac/comp/Check.java
浏览文件 @
c0289dac
...
@@ -897,7 +897,8 @@ public class Check {
...
@@ -897,7 +897,8 @@ public class Check {
assertConvertible
(
arg
,
arg
.
type
,
varArg
,
warn
);
assertConvertible
(
arg
,
arg
.
type
,
varArg
,
warn
);
args
=
args
.
tail
;
args
=
args
.
tail
;
}
}
}
else
if
((
sym
.
flags
()
&
VARARGS
)
!=
0
&&
allowVarargs
)
{
}
else
if
((
sym
.
flags
()
&
(
VARARGS
|
SIGNATURE_POLYMORPHIC
))
==
VARARGS
&&
allowVarargs
)
{
// non-varargs call to varargs method
// non-varargs call to varargs method
Type
varParam
=
owntype
.
getParameterTypes
().
last
();
Type
varParam
=
owntype
.
getParameterTypes
().
last
();
Type
lastArg
=
argtypes
.
last
();
Type
lastArg
=
argtypes
.
last
();
...
...
src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
浏览文件 @
c0289dac
...
@@ -34,15 +34,14 @@ import com.sun.tools.javac.code.Type.*;
...
@@ -34,15 +34,14 @@ import com.sun.tools.javac.code.Type.*;
import
com.sun.tools.javac.comp.Attr.ResultInfo
;
import
com.sun.tools.javac.comp.Attr.ResultInfo
;
import
com.sun.tools.javac.comp.Infer.InferenceContext
;
import
com.sun.tools.javac.comp.Infer.InferenceContext
;
import
com.sun.tools.javac.comp.Resolve.MethodResolutionPhase
;
import
com.sun.tools.javac.comp.Resolve.MethodResolutionPhase
;
import
com.sun.tools.javac.comp.Resolve.ReferenceLookupHelper
;
import
com.sun.tools.javac.tree.JCTree.*
;
import
com.sun.tools.javac.tree.JCTree.*
;
import
javax.tools.JavaFileObject
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.EnumSet
;
import
java.util.EnumSet
;
import
java.util.LinkedHashSet
;
import
java.util.LinkedHashSet
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Queue
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.WeakHashMap
;
import
java.util.WeakHashMap
;
...
@@ -95,7 +94,18 @@ public class DeferredAttr extends JCTree.Visitor {
...
@@ -95,7 +94,18 @@ public class DeferredAttr extends JCTree.Visitor {
make
=
TreeMaker
.
instance
(
context
);
make
=
TreeMaker
.
instance
(
context
);
types
=
Types
.
instance
(
context
);
types
=
Types
.
instance
(
context
);
Names
names
=
Names
.
instance
(
context
);
Names
names
=
Names
.
instance
(
context
);
stuckTree
=
make
.
Ident
(
names
.
empty
).
setType
(
Type
.
noType
);
stuckTree
=
make
.
Ident
(
names
.
empty
).
setType
(
Type
.
stuckType
);
emptyDeferredAttrContext
=
new
DeferredAttrContext
(
AttrMode
.
CHECK
,
null
,
MethodResolutionPhase
.
BOX
,
infer
.
emptyContext
,
null
,
null
)
{
@Override
void
addDeferredAttrNode
(
DeferredType
dt
,
ResultInfo
ri
,
List
<
Type
>
stuckVars
)
{
Assert
.
error
(
"Empty deferred context!"
);
}
@Override
void
complete
()
{
Assert
.
error
(
"Empty deferred context!"
);
}
};
}
}
/** shared tree for stuck expressions */
/** shared tree for stuck expressions */
...
@@ -117,7 +127,7 @@ public class DeferredAttr extends JCTree.Visitor {
...
@@ -117,7 +127,7 @@ public class DeferredAttr extends JCTree.Visitor {
DeferredType
(
JCExpression
tree
,
Env
<
AttrContext
>
env
)
{
DeferredType
(
JCExpression
tree
,
Env
<
AttrContext
>
env
)
{
super
(
null
);
super
(
null
);
this
.
tree
=
tree
;
this
.
tree
=
tree
;
this
.
env
=
env
.
dup
(
tree
,
env
.
info
.
dup
()
);
this
.
env
=
attr
.
copyEnv
(
env
);
this
.
speculativeCache
=
new
SpeculativeCache
();
this
.
speculativeCache
=
new
SpeculativeCache
();
}
}
...
@@ -253,7 +263,7 @@ public class DeferredAttr extends JCTree.Visitor {
...
@@ -253,7 +263,7 @@ public class DeferredAttr extends JCTree.Visitor {
DeferredTypeCompleter
dummyCompleter
=
new
DeferredTypeCompleter
()
{
DeferredTypeCompleter
dummyCompleter
=
new
DeferredTypeCompleter
()
{
public
Type
complete
(
DeferredType
dt
,
ResultInfo
resultInfo
,
DeferredAttrContext
deferredAttrContext
)
{
public
Type
complete
(
DeferredType
dt
,
ResultInfo
resultInfo
,
DeferredAttrContext
deferredAttrContext
)
{
Assert
.
check
(
deferredAttrContext
.
mode
==
AttrMode
.
CHECK
);
Assert
.
check
(
deferredAttrContext
.
mode
==
AttrMode
.
CHECK
);
return
dt
.
tree
.
type
=
Type
.
no
Type
;
return
dt
.
tree
.
type
=
Type
.
stuck
Type
;
}
}
};
};
...
@@ -479,12 +489,10 @@ public class DeferredAttr extends JCTree.Visitor {
...
@@ -479,12 +489,10 @@ public class DeferredAttr extends JCTree.Visitor {
ResultInfo
resultInfo
;
ResultInfo
resultInfo
;
InferenceContext
inferenceContext
;
InferenceContext
inferenceContext
;
Env
<
AttrContext
>
env
;
public
Type
complete
(
DeferredType
dt
,
ResultInfo
resultInfo
,
DeferredAttrContext
deferredAttrContext
)
{
public
Type
complete
(
DeferredType
dt
,
ResultInfo
resultInfo
,
DeferredAttrContext
deferredAttrContext
)
{
this
.
resultInfo
=
resultInfo
;
this
.
resultInfo
=
resultInfo
;
this
.
inferenceContext
=
deferredAttrContext
.
inferenceContext
;
this
.
inferenceContext
=
deferredAttrContext
.
inferenceContext
;
this
.
env
=
dt
.
env
.
dup
(
dt
.
tree
,
dt
.
env
.
info
.
dup
());
dt
.
tree
.
accept
(
this
);
dt
.
tree
.
accept
(
this
);
dt
.
speculativeCache
.
put
(
deferredAttrContext
.
msym
,
stuckTree
,
deferredAttrContext
.
phase
);
dt
.
speculativeCache
.
put
(
deferredAttrContext
.
msym
,
stuckTree
,
deferredAttrContext
.
phase
);
return
Type
.
noType
;
return
Type
.
noType
;
...
@@ -533,18 +541,7 @@ public class DeferredAttr extends JCTree.Visitor {
...
@@ -533,18 +541,7 @@ public class DeferredAttr extends JCTree.Visitor {
}
catch
(
Types
.
FunctionDescriptorLookupError
ex
)
{
}
catch
(
Types
.
FunctionDescriptorLookupError
ex
)
{
checkContext
.
report
(
null
,
ex
.
getDiagnostic
());
checkContext
.
report
(
null
,
ex
.
getDiagnostic
());
}
}
JCExpression
exprTree
=
(
JCExpression
)
attribSpeculative
(
tree
.
getQualifierExpression
(),
env
,
switch
(
tree
.
sym
.
kind
)
{
attr
.
memberReferenceQualifierResult
(
tree
));
ListBuffer
<
Type
>
argtypes
=
ListBuffer
.
lb
();
for
(
Type
t
:
types
.
findDescriptorType
(
pt
).
getParameterTypes
())
{
argtypes
.
append
(
Type
.
noType
);
}
JCMemberReference
mref2
=
new
TreeCopier
<
Void
>(
make
).
copy
(
tree
);
mref2
.
expr
=
exprTree
;
Pair
<
Symbol
,
?>
lookupRes
=
rs
.
resolveMemberReference
(
tree
,
env
,
mref2
,
exprTree
.
type
,
tree
.
name
,
argtypes
.
toList
(),
null
,
true
,
rs
.
arityMethodCheck
);
switch
(
lookupRes
.
fst
.
kind
)
{
//note: as argtypes are erroneous types, type-errors must
//note: as argtypes are erroneous types, type-errors must
//have been caused by arity mismatch
//have been caused by arity mismatch
case
Kinds
.
ABSENT_MTH
:
case
Kinds
.
ABSENT_MTH
:
...
@@ -560,17 +557,7 @@ public class DeferredAttr extends JCTree.Visitor {
...
@@ -560,17 +557,7 @@ public class DeferredAttr extends JCTree.Visitor {
}
}
/** an empty deferred attribution context - all methods throw exceptions */
/** an empty deferred attribution context - all methods throw exceptions */
final
DeferredAttrContext
emptyDeferredAttrContext
=
final
DeferredAttrContext
emptyDeferredAttrContext
;
new
DeferredAttrContext
(
AttrMode
.
CHECK
,
null
,
MethodResolutionPhase
.
BOX
,
null
,
null
,
null
)
{
@Override
void
addDeferredAttrNode
(
DeferredType
dt
,
ResultInfo
ri
,
List
<
Type
>
stuckVars
)
{
Assert
.
error
(
"Empty deferred context!"
);
}
@Override
void
complete
()
{
Assert
.
error
(
"Empty deferred context!"
);
}
};
/**
/**
* Map a list of types possibly containing one or more deferred types
* Map a list of types possibly containing one or more deferred types
...
@@ -649,7 +636,12 @@ public class DeferredAttr extends JCTree.Visitor {
...
@@ -649,7 +636,12 @@ public class DeferredAttr extends JCTree.Visitor {
* a default expected type (j.l.Object).
* a default expected type (j.l.Object).
*/
*/
private
Type
recover
(
DeferredType
dt
)
{
private
Type
recover
(
DeferredType
dt
)
{
dt
.
check
(
attr
.
new
RecoveryInfo
(
deferredAttrContext
));
dt
.
check
(
attr
.
new
RecoveryInfo
(
deferredAttrContext
)
{
@Override
protected
Type
check
(
DiagnosticPosition
pos
,
Type
found
)
{
return
chk
.
checkNonVoid
(
pos
,
super
.
check
(
pos
,
found
));
}
});
return
super
.
apply
(
dt
);
return
super
.
apply
(
dt
);
}
}
}
}
...
@@ -663,12 +655,12 @@ public class DeferredAttr extends JCTree.Visitor {
...
@@ -663,12 +655,12 @@ public class DeferredAttr extends JCTree.Visitor {
if
(
resultInfo
.
pt
.
hasTag
(
NONE
)
||
resultInfo
.
pt
.
isErroneous
())
{
if
(
resultInfo
.
pt
.
hasTag
(
NONE
)
||
resultInfo
.
pt
.
isErroneous
())
{
return
List
.
nil
();
return
List
.
nil
();
}
else
{
}
else
{
return
stuckVarsInternal
(
tree
,
resultInfo
.
pt
,
resultInfo
.
checkContext
.
inferenceContext
());
return
stuckVarsInternal
(
tree
,
resultInfo
.
pt
,
env
,
resultInfo
.
checkContext
.
inferenceContext
());
}
}
}
}
//where
//where
private
List
<
Type
>
stuckVarsInternal
(
JCTree
tree
,
Type
pt
,
Infer
.
InferenceContext
inferenceContext
)
{
private
List
<
Type
>
stuckVarsInternal
(
JCTree
tree
,
Type
pt
,
Env
<
AttrContext
>
env
,
Infer
.
InferenceContext
inferenceContext
)
{
StuckChecker
sc
=
new
StuckChecker
(
pt
,
inferenceContext
);
StuckChecker
sc
=
new
StuckChecker
(
pt
,
env
,
inferenceContext
);
sc
.
scan
(
tree
);
sc
.
scan
(
tree
);
return
List
.
from
(
sc
.
stuckVars
);
return
List
.
from
(
sc
.
stuckVars
);
}
}
...
@@ -748,11 +740,13 @@ public class DeferredAttr extends JCTree.Visitor {
...
@@ -748,11 +740,13 @@ public class DeferredAttr extends JCTree.Visitor {
class
StuckChecker
extends
PolyScanner
{
class
StuckChecker
extends
PolyScanner
{
Type
pt
;
Type
pt
;
Env
<
AttrContext
>
env
;
Infer
.
InferenceContext
inferenceContext
;
Infer
.
InferenceContext
inferenceContext
;
Set
<
Type
>
stuckVars
=
new
LinkedHashSet
<
Type
>();
Set
<
Type
>
stuckVars
=
new
LinkedHashSet
<
Type
>();
StuckChecker
(
Type
pt
,
Infer
.
InferenceContext
inferenceContext
)
{
StuckChecker
(
Type
pt
,
Env
<
AttrContext
>
env
,
Infer
.
InferenceContext
inferenceContext
)
{
this
.
pt
=
pt
;
this
.
pt
=
pt
;
this
.
env
=
env
;
this
.
inferenceContext
=
inferenceContext
;
this
.
inferenceContext
=
inferenceContext
;
}
}
...
@@ -786,18 +780,41 @@ public class DeferredAttr extends JCTree.Visitor {
...
@@ -786,18 +780,41 @@ public class DeferredAttr extends JCTree.Visitor {
Type
descType
=
types
.
findDescriptorType
(
pt
);
Type
descType
=
types
.
findDescriptorType
(
pt
);
List
<
Type
>
freeArgVars
=
inferenceContext
.
freeVarsIn
(
descType
.
getParameterTypes
());
List
<
Type
>
freeArgVars
=
inferenceContext
.
freeVarsIn
(
descType
.
getParameterTypes
());
stuckVars
.
addAll
(
freeArgVars
);
Env
<
AttrContext
>
localEnv
=
env
.
dup
(
tree
,
env
.
info
.
dup
());
if
(
freeArgVars
.
nonEmpty
())
{
//perform arity-based check
JCExpression
exprTree
=
(
JCExpression
)
attribSpeculative
(
tree
.
getQualifierExpression
(),
localEnv
,
attr
.
memberReferenceQualifierResult
(
tree
));
ListBuffer
<
Type
>
argtypes
=
ListBuffer
.
lb
();
for
(
Type
t
:
descType
.
getParameterTypes
())
{
argtypes
.
append
(
Type
.
noType
);
}
JCMemberReference
mref2
=
new
TreeCopier
<
Void
>(
make
).
copy
(
tree
);
mref2
.
expr
=
exprTree
;
Pair
<
Symbol
,
ReferenceLookupHelper
>
lookupRes
=
rs
.
resolveMemberReference
(
tree
,
localEnv
,
mref2
,
exprTree
.
type
,
tree
.
name
,
argtypes
.
toList
(),
null
,
true
,
rs
.
arityMethodCheck
,
inferenceContext
);
Symbol
res
=
tree
.
sym
=
lookupRes
.
fst
;
if
(
res
.
kind
>=
Kinds
.
ERRONEOUS
||
res
.
type
.
hasTag
(
FORALL
)
||
(
res
.
flags
()
&
Flags
.
VARARGS
)
!=
0
||
(
TreeInfo
.
isStaticSelector
(
exprTree
,
tree
.
name
.
table
.
names
)
&&
exprTree
.
type
.
isRaw
()))
{
stuckVars
.
addAll
(
freeArgVars
);
}
}
}
}
void
scanLambdaBody
(
JCLambda
lambda
,
final
Type
pt
)
{
void
scanLambdaBody
(
JCLambda
lambda
,
final
Type
pt
)
{
if
(
lambda
.
getBodyKind
()
==
JCTree
.
JCLambda
.
BodyKind
.
EXPRESSION
)
{
if
(
lambda
.
getBodyKind
()
==
JCTree
.
JCLambda
.
BodyKind
.
EXPRESSION
)
{
stuckVars
.
addAll
(
stuckVarsInternal
(
lambda
.
body
,
pt
,
inferenceContext
));
stuckVars
.
addAll
(
stuckVarsInternal
(
lambda
.
body
,
pt
,
env
,
inferenceContext
));
}
else
{
}
else
{
LambdaReturnScanner
lambdaScanner
=
new
LambdaReturnScanner
()
{
LambdaReturnScanner
lambdaScanner
=
new
LambdaReturnScanner
()
{
@Override
@Override
public
void
visitReturn
(
JCReturn
tree
)
{
public
void
visitReturn
(
JCReturn
tree
)
{
if
(
tree
.
expr
!=
null
)
{
if
(
tree
.
expr
!=
null
)
{
stuckVars
.
addAll
(
stuckVarsInternal
(
tree
.
expr
,
pt
,
inferenceContext
));
stuckVars
.
addAll
(
stuckVarsInternal
(
tree
.
expr
,
pt
,
env
,
inferenceContext
));
}
}
}
}
};
};
...
@@ -941,12 +958,13 @@ public class DeferredAttr extends JCTree.Visitor {
...
@@ -941,12 +958,13 @@ public class DeferredAttr extends JCTree.Visitor {
attribSpeculative
(
rec
,
env
,
attr
.
unknownTypeExprInfo
).
type
:
attribSpeculative
(
rec
,
env
,
attr
.
unknownTypeExprInfo
).
type
:
env
.
enclClass
.
sym
.
type
;
env
.
enclClass
.
sym
.
type
;
ListBuffer
<
Type
>
args
=
ListBuffer
.
lb
();
while
(
site
.
hasTag
(
TYPEVAR
))
{
for
(
int
i
=
0
;
i
<
tree
.
args
.
length
();
i
++)
{
site
=
site
.
getUpperBound
();
args
.
append
(
Type
.
noType
);
}
}
Resolve
.
LookupHelper
lh
=
rs
.
new
LookupHelper
(
name
,
site
,
args
.
toList
(),
List
.<
Type
>
nil
(),
MethodResolutionPhase
.
VARARITY
)
{
List
<
Type
>
args
=
rs
.
dummyArgs
(
tree
.
args
.
length
());
Resolve
.
LookupHelper
lh
=
rs
.
new
LookupHelper
(
name
,
site
,
args
,
List
.<
Type
>
nil
(),
MethodResolutionPhase
.
VARARITY
)
{
@Override
@Override
Symbol
lookup
(
Env
<
AttrContext
>
env
,
MethodResolutionPhase
phase
)
{
Symbol
lookup
(
Env
<
AttrContext
>
env
,
MethodResolutionPhase
phase
)
{
return
rec
==
null
?
return
rec
==
null
?
...
...
src/share/classes/com/sun/tools/javac/comp/Flow.java
浏览文件 @
c0289dac
...
@@ -373,6 +373,15 @@ public class Flow {
...
@@ -373,6 +373,15 @@ public class Flow {
boolean
resolveBreaks
(
JCTree
tree
,
ListBuffer
<
P
>
oldPendingExits
)
{
boolean
resolveBreaks
(
JCTree
tree
,
ListBuffer
<
P
>
oldPendingExits
)
{
return
resolveJump
(
tree
,
oldPendingExits
,
JumpKind
.
BREAK
);
return
resolveJump
(
tree
,
oldPendingExits
,
JumpKind
.
BREAK
);
}
}
@Override
public
void
scan
(
JCTree
tree
)
{
if
(
tree
!=
null
&&
(
tree
.
type
==
null
||
tree
.
type
!=
Type
.
stuckType
))
{
super
.
scan
(
tree
);
}
}
}
}
/**
/**
...
...
src/share/classes/com/sun/tools/javac/comp/Infer.java
浏览文件 @
c0289dac
此差异已折叠。
点击以展开。
src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
浏览文件 @
c0289dac
...
@@ -358,7 +358,8 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
...
@@ -358,7 +358,8 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
* @param thrown The method's thrown exceptions.
* @param thrown The method's thrown exceptions.
* @param env The method's (local) environment.
* @param env The method's (local) environment.
*/
*/
Type
signature
(
List
<
JCTypeParameter
>
typarams
,
Type
signature
(
MethodSymbol
msym
,
List
<
JCTypeParameter
>
typarams
,
List
<
JCVariableDecl
>
params
,
List
<
JCVariableDecl
>
params
,
JCTree
res
,
JCTree
res
,
JCVariableDecl
recvparam
,
JCVariableDecl
recvparam
,
...
@@ -392,8 +393,12 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
...
@@ -392,8 +393,12 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
ListBuffer
<
Type
>
thrownbuf
=
new
ListBuffer
<
Type
>();
ListBuffer
<
Type
>
thrownbuf
=
new
ListBuffer
<
Type
>();
for
(
List
<
JCExpression
>
l
=
thrown
;
l
.
nonEmpty
();
l
=
l
.
tail
)
{
for
(
List
<
JCExpression
>
l
=
thrown
;
l
.
nonEmpty
();
l
=
l
.
tail
)
{
Type
exc
=
attr
.
attribType
(
l
.
head
,
env
);
Type
exc
=
attr
.
attribType
(
l
.
head
,
env
);
if
(!
exc
.
hasTag
(
TYPEVAR
))
if
(!
exc
.
hasTag
(
TYPEVAR
))
{
exc
=
chk
.
checkClassType
(
l
.
head
.
pos
(),
exc
);
exc
=
chk
.
checkClassType
(
l
.
head
.
pos
(),
exc
);
}
else
if
(
exc
.
tsym
.
owner
==
msym
)
{
//mark inference variables in 'throws' clause
exc
.
tsym
.
flags_field
|=
THROWS
;
}
thrownbuf
.
append
(
exc
);
thrownbuf
.
append
(
exc
);
}
}
MethodType
mtype
=
new
MethodType
(
argbuf
.
toList
(),
MethodType
mtype
=
new
MethodType
(
argbuf
.
toList
(),
...
@@ -503,11 +508,17 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
...
@@ -503,11 +508,17 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
// process package annotations
// process package annotations
annotateLater
(
tree
.
packageAnnotations
,
env
,
tree
.
packge
);
annotateLater
(
tree
.
packageAnnotations
,
env
,
tree
.
packge
);
// Import-on-demand java.lang.
DeferredLintHandler
prevLintHandler
=
chk
.
setDeferredLintHandler
(
DeferredLintHandler
.
immediateHandler
);
importAll
(
tree
.
pos
,
reader
.
enterPackage
(
names
.
java_lang
),
env
);
// Process all import clauses.
try
{
memberEnter
(
tree
.
defs
,
env
);
// Import-on-demand java.lang.
importAll
(
tree
.
pos
,
reader
.
enterPackage
(
names
.
java_lang
),
env
);
// Process all import clauses.
memberEnter
(
tree
.
defs
,
env
);
}
finally
{
chk
.
setDeferredLintHandler
(
prevLintHandler
);
}
}
}
// process the non-static imports and the static imports of types.
// process the non-static imports and the static imports of types.
...
@@ -557,7 +568,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
...
@@ -557,7 +568,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
chk
.
setDeferredLintHandler
(
deferredLintHandler
.
setPos
(
tree
.
pos
()));
chk
.
setDeferredLintHandler
(
deferredLintHandler
.
setPos
(
tree
.
pos
()));
try
{
try
{
// Compute the method type
// Compute the method type
m
.
type
=
signature
(
tree
.
typarams
,
tree
.
params
,
m
.
type
=
signature
(
m
,
tree
.
typarams
,
tree
.
params
,
tree
.
restype
,
tree
.
recvparam
,
tree
.
restype
,
tree
.
recvparam
,
tree
.
thrown
,
tree
.
thrown
,
localEnv
);
localEnv
);
...
...
src/share/classes/com/sun/tools/javac/comp/Resolve.java
浏览文件 @
c0289dac
...
@@ -345,7 +345,7 @@ public class Resolve {
...
@@ -345,7 +345,7 @@ public class Resolve {
boolean
isAccessible
(
Env
<
AttrContext
>
env
,
Type
t
,
boolean
checkInner
)
{
boolean
isAccessible
(
Env
<
AttrContext
>
env
,
Type
t
,
boolean
checkInner
)
{
return
(
t
.
hasTag
(
ARRAY
))
return
(
t
.
hasTag
(
ARRAY
))
?
isAccessible
(
env
,
types
.
elemtype
(
t
))
?
isAccessible
(
env
,
types
.
upperBound
(
types
.
elemtype
(
t
)
))
:
isAccessible
(
env
,
t
.
tsym
,
checkInner
);
:
isAccessible
(
env
,
t
.
tsym
,
checkInner
);
}
}
...
@@ -584,6 +584,13 @@ public class Resolve {
...
@@ -584,6 +584,13 @@ public class Resolve {
try
{
try
{
currentResolutionContext
=
new
MethodResolutionContext
();
currentResolutionContext
=
new
MethodResolutionContext
();
currentResolutionContext
.
attrMode
=
DeferredAttr
.
AttrMode
.
CHECK
;
currentResolutionContext
.
attrMode
=
DeferredAttr
.
AttrMode
.
CHECK
;
if
(
env
.
tree
.
hasTag
(
JCTree
.
Tag
.
REFERENCE
))
{
//method/constructor references need special check class
//to handle inference variables in 'argtypes' (might happen
//during an unsticking round)
currentResolutionContext
.
methodCheck
=
new
MethodReferenceCheck
(
resultInfo
.
checkContext
.
inferenceContext
());
}
MethodResolutionPhase
step
=
currentResolutionContext
.
step
=
env
.
info
.
pendingResolutionPhase
;
MethodResolutionPhase
step
=
currentResolutionContext
.
step
=
env
.
info
.
pendingResolutionPhase
;
return
rawInstantiate
(
env
,
site
,
m
,
resultInfo
,
argtypes
,
typeargtypes
,
return
rawInstantiate
(
env
,
site
,
m
,
resultInfo
,
argtypes
,
typeargtypes
,
step
.
isBoxingRequired
(),
step
.
isVarargsRequired
(),
warn
);
step
.
isBoxingRequired
(),
step
.
isVarargsRequired
(),
warn
);
...
@@ -773,6 +780,14 @@ public class Resolve {
...
@@ -773,6 +780,14 @@ public class Resolve {
}
}
};
};
List
<
Type
>
dummyArgs
(
int
length
)
{
ListBuffer
<
Type
>
buf
=
ListBuffer
.
lb
();
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
buf
.
append
(
Type
.
noType
);
}
return
buf
.
toList
();
}
/**
/**
* Main method applicability routine. Given a list of actual types A,
* Main method applicability routine. Given a list of actual types A,
* a list of formal types F, determines whether the types in A are
* a list of formal types F, determines whether the types in A are
...
@@ -850,6 +865,47 @@ public class Resolve {
...
@@ -850,6 +865,47 @@ public class Resolve {
}
}
};
};
class
MethodReferenceCheck
extends
AbstractMethodCheck
{
InferenceContext
pendingInferenceContext
;
MethodReferenceCheck
(
InferenceContext
pendingInferenceContext
)
{
this
.
pendingInferenceContext
=
pendingInferenceContext
;
}
@Override
void
checkArg
(
DiagnosticPosition
pos
,
boolean
varargs
,
Type
actual
,
Type
formal
,
DeferredAttrContext
deferredAttrContext
,
Warner
warn
)
{
ResultInfo
mresult
=
methodCheckResult
(
varargs
,
formal
,
deferredAttrContext
,
warn
);
mresult
.
check
(
pos
,
actual
);
}
private
ResultInfo
methodCheckResult
(
final
boolean
varargsCheck
,
Type
to
,
final
DeferredAttr
.
DeferredAttrContext
deferredAttrContext
,
Warner
rsWarner
)
{
CheckContext
checkContext
=
new
MethodCheckContext
(!
deferredAttrContext
.
phase
.
isBoxingRequired
(),
deferredAttrContext
,
rsWarner
)
{
MethodCheckDiag
methodDiag
=
varargsCheck
?
MethodCheckDiag
.
VARARG_MISMATCH
:
MethodCheckDiag
.
ARG_MISMATCH
;
@Override
public
boolean
compatible
(
Type
found
,
Type
req
,
Warner
warn
)
{
found
=
pendingInferenceContext
.
asFree
(
found
);
req
=
infer
.
returnConstraintTarget
(
found
,
req
);
return
super
.
compatible
(
found
,
req
,
warn
);
}
@Override
public
void
report
(
DiagnosticPosition
pos
,
JCDiagnostic
details
)
{
reportMC
(
pos
,
methodDiag
,
deferredAttrContext
.
inferenceContext
,
details
);
}
};
return
new
MethodResultInfo
(
to
,
checkContext
);
}
@Override
public
MethodCheck
mostSpecificCheck
(
List
<
Type
>
actuals
,
boolean
strict
)
{
return
new
MostSpecificCheck
(
strict
,
actuals
);
}
};
/**
/**
* Check context to be used during method applicability checks. A method check
* Check context to be used during method applicability checks. A method check
* context might contain inference variables.
* context might contain inference variables.
...
@@ -905,10 +961,23 @@ public class Resolve {
...
@@ -905,10 +961,23 @@ public class Resolve {
DeferredType
dt
=
(
DeferredType
)
found
;
DeferredType
dt
=
(
DeferredType
)
found
;
return
dt
.
check
(
this
);
return
dt
.
check
(
this
);
}
else
{
}
else
{
return
super
.
check
(
pos
,
chk
.
checkNonVoid
(
pos
,
types
.
capture
(
types
.
upperBound
(
found
.
baseType
()))));
return
super
.
check
(
pos
,
chk
.
checkNonVoid
(
pos
,
types
.
capture
(
U
(
found
.
baseType
()))));
}
}
}
}
/**
* javac has a long-standing 'simplification' (see 6391995):
* given an actual argument type, the method check is performed
* on its upper bound. This leads to inconsistencies when an
* argument type is checked against itself. For example, given
* a type-variable T, it is not true that {@code U(T) <: T},
* so we need to guard against that.
*/
private
Type
U
(
Type
found
)
{
return
found
==
pt
?
found
:
types
.
upperBound
(
found
);
}
@Override
@Override
protected
MethodResultInfo
dup
(
Type
newPt
)
{
protected
MethodResultInfo
dup
(
Type
newPt
)
{
return
new
MethodResultInfo
(
newPt
,
checkContext
);
return
new
MethodResultInfo
(
newPt
,
checkContext
);
...
@@ -2421,7 +2490,7 @@ public class Resolve {
...
@@ -2421,7 +2490,7 @@ public class Resolve {
Symbol
access
(
Env
<
AttrContext
>
env
,
DiagnosticPosition
pos
,
Symbol
location
,
Symbol
sym
)
{
Symbol
access
(
Env
<
AttrContext
>
env
,
DiagnosticPosition
pos
,
Symbol
location
,
Symbol
sym
)
{
if
(
sym
.
kind
>=
AMBIGUOUS
)
{
if
(
sym
.
kind
>=
AMBIGUOUS
)
{
final
JCDiagnostic
details
=
sym
.
kind
==
WRONG_MTH
?
final
JCDiagnostic
details
=
sym
.
kind
==
WRONG_MTH
?
((
InapplicableSymbolError
)
sym
).
errCandidate
().
details
:
((
InapplicableSymbolError
)
sym
).
errCandidate
().
snd
:
null
;
null
;
sym
=
new
InapplicableSymbolError
(
sym
.
kind
,
"diamondError"
,
currentResolutionContext
)
{
sym
=
new
InapplicableSymbolError
(
sym
.
kind
,
"diamondError"
,
currentResolutionContext
)
{
@Override
@Override
...
@@ -2576,7 +2645,8 @@ public class Resolve {
...
@@ -2576,7 +2645,8 @@ public class Resolve {
Name
name
,
List
<
Type
>
argtypes
,
Name
name
,
List
<
Type
>
argtypes
,
List
<
Type
>
typeargtypes
,
List
<
Type
>
typeargtypes
,
boolean
boxingAllowed
,
boolean
boxingAllowed
,
MethodCheck
methodCheck
)
{
MethodCheck
methodCheck
,
InferenceContext
inferenceContext
)
{
MethodResolutionPhase
maxPhase
=
boxingAllowed
?
VARARITY
:
BASIC
;
MethodResolutionPhase
maxPhase
=
boxingAllowed
?
VARARITY
:
BASIC
;
ReferenceLookupHelper
boundLookupHelper
;
ReferenceLookupHelper
boundLookupHelper
;
...
@@ -2599,7 +2669,7 @@ public class Resolve {
...
@@ -2599,7 +2669,7 @@ public class Resolve {
Symbol
boundSym
=
lookupMethod
(
boundEnv
,
env
.
tree
.
pos
(),
site
.
tsym
,
methodCheck
,
boundLookupHelper
);
Symbol
boundSym
=
lookupMethod
(
boundEnv
,
env
.
tree
.
pos
(),
site
.
tsym
,
methodCheck
,
boundLookupHelper
);
//step 2 - unbound lookup
//step 2 - unbound lookup
ReferenceLookupHelper
unboundLookupHelper
=
boundLookupHelper
.
unboundLookup
();
ReferenceLookupHelper
unboundLookupHelper
=
boundLookupHelper
.
unboundLookup
(
inferenceContext
);
Env
<
AttrContext
>
unboundEnv
=
env
.
dup
(
env
.
tree
,
env
.
info
.
dup
());
Env
<
AttrContext
>
unboundEnv
=
env
.
dup
(
env
.
tree
,
env
.
info
.
dup
());
Symbol
unboundSym
=
lookupMethod
(
unboundEnv
,
env
.
tree
.
pos
(),
site
.
tsym
,
methodCheck
,
unboundLookupHelper
);
Symbol
unboundSym
=
lookupMethod
(
unboundEnv
,
env
.
tree
.
pos
(),
site
.
tsym
,
methodCheck
,
unboundLookupHelper
);
...
@@ -2739,11 +2809,11 @@ public class Resolve {
...
@@ -2739,11 +2809,11 @@ public class Resolve {
* Returns an unbound version of this lookup helper. By default, this
* Returns an unbound version of this lookup helper. By default, this
* method returns an dummy lookup helper.
* method returns an dummy lookup helper.
*/
*/
ReferenceLookupHelper
unboundLookup
()
{
ReferenceLookupHelper
unboundLookup
(
InferenceContext
inferenceContext
)
{
//dummy loopkup helper that always return 'methodNotFound'
//dummy loopkup helper that always return 'methodNotFound'
return
new
ReferenceLookupHelper
(
referenceTree
,
name
,
site
,
argtypes
,
typeargtypes
,
maxPhase
)
{
return
new
ReferenceLookupHelper
(
referenceTree
,
name
,
site
,
argtypes
,
typeargtypes
,
maxPhase
)
{
@Override
@Override
ReferenceLookupHelper
unboundLookup
()
{
ReferenceLookupHelper
unboundLookup
(
InferenceContext
inferenceContext
)
{
return
this
;
return
this
;
}
}
@Override
@Override
...
@@ -2793,14 +2863,15 @@ public class Resolve {
...
@@ -2793,14 +2863,15 @@ public class Resolve {
}
}
@Override
@Override
ReferenceLookupHelper
unboundLookup
()
{
ReferenceLookupHelper
unboundLookup
(
InferenceContext
inferenceContext
)
{
if
(
TreeInfo
.
isStaticSelector
(
referenceTree
.
expr
,
names
)
&&
if
(
TreeInfo
.
isStaticSelector
(
referenceTree
.
expr
,
names
)
&&
argtypes
.
nonEmpty
()
&&
argtypes
.
nonEmpty
()
&&
(
argtypes
.
head
.
hasTag
(
NONE
)
||
types
.
isSubtypeUnchecked
(
argtypes
.
head
,
site
)))
{
(
argtypes
.
head
.
hasTag
(
NONE
)
||
types
.
isSubtypeUnchecked
(
inferenceContext
.
asFree
(
argtypes
.
head
),
site
)))
{
return
new
UnboundMethodReferenceLookupHelper
(
referenceTree
,
name
,
return
new
UnboundMethodReferenceLookupHelper
(
referenceTree
,
name
,
site
,
argtypes
,
typeargtypes
,
maxPhase
);
site
,
argtypes
,
typeargtypes
,
maxPhase
);
}
else
{
}
else
{
return
super
.
unboundLookup
();
return
super
.
unboundLookup
(
inferenceContext
);
}
}
}
}
...
@@ -2836,7 +2907,7 @@ public class Resolve {
...
@@ -2836,7 +2907,7 @@ public class Resolve {
}
}
@Override
@Override
ReferenceLookupHelper
unboundLookup
()
{
ReferenceLookupHelper
unboundLookup
(
InferenceContext
inferenceContext
)
{
return
this
;
return
this
;
}
}
...
@@ -3371,20 +3442,20 @@ public class Resolve {
...
@@ -3371,20 +3442,20 @@ public class Resolve {
key
,
name
,
first
,
second
);
key
,
name
,
first
,
second
);
}
}
else
{
else
{
Candidate
c
=
errCandidate
();
Pair
<
Symbol
,
JCDiagnostic
>
c
=
errCandidate
();
if
(
compactMethodDiags
)
{
if
(
compactMethodDiags
)
{
for
(
Map
.
Entry
<
Template
,
DiagnosticRewriter
>
_entry
:
for
(
Map
.
Entry
<
Template
,
DiagnosticRewriter
>
_entry
:
MethodResolutionDiagHelper
.
rewriters
.
entrySet
())
{
MethodResolutionDiagHelper
.
rewriters
.
entrySet
())
{
if
(
_entry
.
getKey
().
matches
(
c
.
details
))
{
if
(
_entry
.
getKey
().
matches
(
c
.
snd
))
{
JCDiagnostic
simpleDiag
=
JCDiagnostic
simpleDiag
=
_entry
.
getValue
().
rewriteDiagnostic
(
diags
,
pos
,
_entry
.
getValue
().
rewriteDiagnostic
(
diags
,
pos
,
log
.
currentSource
(),
dkind
,
c
.
details
);
log
.
currentSource
(),
dkind
,
c
.
snd
);
simpleDiag
.
setFlag
(
DiagnosticFlag
.
COMPRESSED
);
simpleDiag
.
setFlag
(
DiagnosticFlag
.
COMPRESSED
);
return
simpleDiag
;
return
simpleDiag
;
}
}
}
}
}
}
Symbol
ws
=
c
.
sym
.
asMemberOf
(
site
,
types
);
Symbol
ws
=
c
.
fst
.
asMemberOf
(
site
,
types
);
return
diags
.
create
(
dkind
,
log
.
currentSource
(),
pos
,
return
diags
.
create
(
dkind
,
log
.
currentSource
(),
pos
,
"cant.apply.symbol"
,
"cant.apply.symbol"
,
kindName
(
ws
),
kindName
(
ws
),
...
@@ -3393,7 +3464,7 @@ public class Resolve {
...
@@ -3393,7 +3464,7 @@ public class Resolve {
methodArguments
(
argtypes
),
methodArguments
(
argtypes
),
kindName
(
ws
.
owner
),
kindName
(
ws
.
owner
),
ws
.
owner
.
type
,
ws
.
owner
.
type
,
c
.
details
);
c
.
snd
);
}
}
}
}
...
@@ -3402,14 +3473,14 @@ public class Resolve {
...
@@ -3402,14 +3473,14 @@ public class Resolve {
return
types
.
createErrorType
(
name
,
location
,
syms
.
errSymbol
.
type
).
tsym
;
return
types
.
createErrorType
(
name
,
location
,
syms
.
errSymbol
.
type
).
tsym
;
}
}
pr
ivate
Candidate
errCandidate
()
{
pr
otected
Pair
<
Symbol
,
JCDiagnostic
>
errCandidate
()
{
Candidate
bestSoFar
=
null
;
Candidate
bestSoFar
=
null
;
for
(
Candidate
c
:
resolveContext
.
candidates
)
{
for
(
Candidate
c
:
resolveContext
.
candidates
)
{
if
(
c
.
isApplicable
())
continue
;
if
(
c
.
isApplicable
())
continue
;
bestSoFar
=
c
;
bestSoFar
=
c
;
}
}
Assert
.
checkNonNull
(
bestSoFar
);
Assert
.
checkNonNull
(
bestSoFar
);
return
bestSoFar
;
return
new
Pair
<
Symbol
,
JCDiagnostic
>(
bestSoFar
.
sym
,
bestSoFar
.
details
)
;
}
}
}
}
...
@@ -3452,7 +3523,15 @@ public class Resolve {
...
@@ -3452,7 +3523,15 @@ public class Resolve {
methodArguments
(
argtypes
));
methodArguments
(
argtypes
));
return
new
JCDiagnostic
.
MultilineDiagnostic
(
err
,
candidateDetails
(
filteredCandidates
,
site
));
return
new
JCDiagnostic
.
MultilineDiagnostic
(
err
,
candidateDetails
(
filteredCandidates
,
site
));
}
else
if
(
filteredCandidates
.
size
()
==
1
)
{
}
else
if
(
filteredCandidates
.
size
()
==
1
)
{
JCDiagnostic
d
=
new
InapplicableSymbolError
(
resolveContext
).
getDiagnostic
(
dkind
,
pos
,
Map
.
Entry
<
Symbol
,
JCDiagnostic
>
_e
=
filteredCandidates
.
entrySet
().
iterator
().
next
();
final
Pair
<
Symbol
,
JCDiagnostic
>
p
=
new
Pair
<
Symbol
,
JCDiagnostic
>(
_e
.
getKey
(),
_e
.
getValue
());
JCDiagnostic
d
=
new
InapplicableSymbolError
(
resolveContext
)
{
@Override
protected
Pair
<
Symbol
,
JCDiagnostic
>
errCandidate
()
{
return
p
;
}
}.
getDiagnostic
(
dkind
,
pos
,
location
,
site
,
name
,
argtypes
,
typeargtypes
);
location
,
site
,
name
,
argtypes
,
typeargtypes
);
if
(
truncatedDiag
)
{
if
(
truncatedDiag
)
{
d
.
setFlag
(
DiagnosticFlag
.
COMPRESSED
);
d
.
setFlag
(
DiagnosticFlag
.
COMPRESSED
);
...
...
src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java
浏览文件 @
c0289dac
...
@@ -303,8 +303,9 @@ public class RichDiagnosticFormatter extends
...
@@ -303,8 +303,9 @@ public class RichDiagnosticFormatter extends
conflicts
.
contains
(
s
)))
{
conflicts
.
contains
(
s
)))
{
List
<
Name
>
l
=
List
.
nil
();
List
<
Name
>
l
=
List
.
nil
();
Symbol
s2
=
s
;
Symbol
s2
=
s
;
while
(
s2
.
type
.
getEnclosingType
().
hasTag
(
CLASS
)
while
(
s2
.
type
.
hasTag
(
CLASS
)
&&
&&
s2
.
owner
.
kind
==
Kinds
.
TYP
)
{
s2
.
type
.
getEnclosingType
().
hasTag
(
CLASS
)
&&
s2
.
owner
.
kind
==
Kinds
.
TYP
)
{
l
=
l
.
prepend
(
s2
.
getSimpleName
());
l
=
l
.
prepend
(
s2
.
getSimpleName
());
s2
=
s2
.
owner
;
s2
=
s2
.
owner
;
}
}
...
...
src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
浏览文件 @
c0289dac
...
@@ -46,6 +46,7 @@ import com.sun.tools.javac.code.Symbol;
...
@@ -46,6 +46,7 @@ import com.sun.tools.javac.code.Symbol;
import
com.sun.tools.javac.code.Symbol.*
;
import
com.sun.tools.javac.code.Symbol.*
;
import
com.sun.tools.javac.code.Type
;
import
com.sun.tools.javac.code.Type
;
import
com.sun.tools.javac.code.Type.ClassType
;
import
com.sun.tools.javac.code.Type.ClassType
;
import
com.sun.tools.javac.code.TypeTag
;
import
com.sun.tools.javac.comp.AttrContext
;
import
com.sun.tools.javac.comp.AttrContext
;
import
com.sun.tools.javac.comp.Env
;
import
com.sun.tools.javac.comp.Env
;
import
com.sun.tools.javac.tree.JCTree
;
import
com.sun.tools.javac.tree.JCTree
;
...
@@ -516,7 +517,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
...
@@ -516,7 +517,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
return
null
;
return
null
;
Type
sup
=
env
.
types
.
supertype
(
type
);
Type
sup
=
env
.
types
.
supertype
(
type
);
return
TypeMaker
.
getType
(
env
,
return
TypeMaker
.
getType
(
env
,
(
sup
!=
type
)
?
sup
:
env
.
syms
.
objectType
);
(
sup
.
hasTag
(
TypeTag
.
NONE
))
?
env
.
syms
.
objectType
:
sup
);
}
}
/**
/**
...
...
src/share/classes/com/sun/tools/javadoc/ToolOption.java
浏览文件 @
c0289dac
/*
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -56,6 +56,13 @@ public enum ToolOption {
...
@@ -56,6 +56,13 @@ public enum ToolOption {
}
}
},
},
CP
(
"-cp"
,
true
)
{
@Override
public
void
process
(
Helper
helper
,
String
arg
)
{
helper
.
setCompilerOpt
(
opt
,
arg
);
}
},
EXTDIRS
(
"-extdirs"
,
true
)
{
EXTDIRS
(
"-extdirs"
,
true
)
{
@Override
@Override
public
void
process
(
Helper
helper
,
String
arg
)
{
public
void
process
(
Helper
helper
,
String
arg
)
{
...
...
src/share/classes/com/sun/tools/javadoc/resources/javadoc.properties
浏览文件 @
c0289dac
...
@@ -39,6 +39,7 @@ main.usage=Usage: javadoc [options] [packagenames] [sourcefiles] [@files]\n\
...
@@ -39,6 +39,7 @@ main.usage=Usage: javadoc [options] [packagenames] [sourcefiles] [@files]\n\
\
-docletpath <path> Specify where to find doclet class files
\n\
\
-docletpath <path> Specify where to find doclet class files
\n\
\
-sourcepath <pathlist> Specify where to find source files
\n\
\
-sourcepath <pathlist> Specify where to find source files
\n\
\
-classpath <pathlist> Specify where to find user class files
\n\
\
-classpath <pathlist> Specify where to find user class files
\n\
\
-cp <pathlist> Specify where to find user class files
\n\
\
-exclude <pkglist> Specify a list of packages to exclude
\n\
\
-exclude <pkglist> Specify a list of packages to exclude
\n\
\
-subpackages <subpkglist> Specify subpackages to recursively load
\n\
\
-subpackages <subpkglist> Specify subpackages to recursively load
\n\
\
-breakiterator Compute first sentence with BreakIterator
\n\
\
-breakiterator Compute first sentence with BreakIterator
\n\
...
...
src/share/classes/com/sun/tools/javah/JavahTask.java
浏览文件 @
c0289dac
...
@@ -531,7 +531,7 @@ public class JavahTask implements NativeHeaderTool.NativeHeaderTask {
...
@@ -531,7 +531,7 @@ public class JavahTask implements NativeHeaderTool.NativeHeaderTask {
String
name
=
o
.
aliases
[
0
].
substring
(
1
);
// there must always be at least one name
String
name
=
o
.
aliases
[
0
].
substring
(
1
);
// there must always be at least one name
log
.
println
(
getMessage
(
"main.opt."
+
name
));
log
.
println
(
getMessage
(
"main.opt."
+
name
));
}
}
String
[]
fmOptions
=
{
"-classpath"
,
"-bootclasspath"
};
String
[]
fmOptions
=
{
"-classpath"
,
"-
cp"
,
"-
bootclasspath"
};
for
(
String
o:
fmOptions
)
{
for
(
String
o:
fmOptions
)
{
if
(
fileManager
.
isSupportedOption
(
o
)
==
-
1
)
if
(
fileManager
.
isSupportedOption
(
o
)
==
-
1
)
continue
;
continue
;
...
...
src/share/classes/com/sun/tools/javah/resources/l10n.properties
浏览文件 @
c0289dac
#
#
# Copyright (c) 1998, 201
0
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1998, 201
3
, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
#
# This code is free software; you can redistribute it and/or modify it
# This code is free software; you can redistribute it and/or modify it
...
@@ -77,6 +77,7 @@ where [options] include:\n\
...
@@ -77,6 +77,7 @@ where [options] include:\n\
\n\t\
\n\t\
-help Print this help message and exit
\n\t\
-help Print this help message and exit
\n\t\
-classpath <path> Path from which to load classes
\n\t\
-classpath <path> Path from which to load classes
\n\t\
-cp <path> Path from which to load classes
\n\t\
-bootclasspath <path> Path from which to load bootstrap classes
\n\t\
-bootclasspath <path> Path from which to load bootstrap classes
\n\t\
-d <dir> Output directory
\n\t\
-d <dir> Output directory
\n\t\
-o <file> Output file (only one of -d or -o may be used)
\n\t\
-o <file> Output file (only one of -d or -o may be used)
\n\t\
...
@@ -108,6 +109,8 @@ main.opt.force=\
...
@@ -108,6 +109,8 @@ main.opt.force=\
\
-force Always write output files
\
-force Always write output files
main.opt.classpath
=
\
main.opt.classpath
=
\
\
-classpath <path> Path from which to load classes
\
-classpath <path> Path from which to load classes
main.opt.cp
=
\
\
-cp <path> Path from which to load classes
main.opt.bootclasspath
=
\
main.opt.bootclasspath
=
\
\
-bootclasspath <path> Path from which to load bootstrap classes
\
-bootclasspath <path> Path from which to load bootstrap classes
main.usage.foot
=
\
main.usage.foot
=
\
...
...
src/share/classes/com/sun/tools/javap/JavapTask.java
浏览文件 @
c0289dac
...
@@ -885,7 +885,7 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
...
@@ -885,7 +885,7 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
continue
;
continue
;
log
.
println
(
getMessage
(
"main.opt."
+
name
));
log
.
println
(
getMessage
(
"main.opt."
+
name
));
}
}
String
[]
fmOptions
=
{
"-classpath"
,
"-bootclasspath"
};
String
[]
fmOptions
=
{
"-classpath"
,
"-
cp"
,
"-
bootclasspath"
};
for
(
String
o:
fmOptions
)
{
for
(
String
o:
fmOptions
)
{
if
(
fileManager
.
isSupportedOption
(
o
)
==
-
1
)
if
(
fileManager
.
isSupportedOption
(
o
)
==
-
1
)
continue
;
continue
;
...
...
src/share/classes/com/sun/tools/javap/resources/javap.properties
浏览文件 @
c0289dac
err.prefix
=
Error:
err.prefix
=
Error:
err.bad.constant.pool
=
error while reading constant pool for {0}: {1}
err.bad.constant.pool
=
error while reading constant pool for {0}: {1}
err.class.not.found
=
class not found: {0}
err.class.not.found
=
class not found: {0}
...
@@ -73,6 +73,9 @@ main.opt.s=\
...
@@ -73,6 +73,9 @@ main.opt.s=\
main.opt.classpath
=
\
main.opt.classpath
=
\
\
-classpath <path> Specify where to find user class files
\
-classpath <path> Specify where to find user class files
main.opt.cp
=
\
\
-cp <path> Specify where to find user class files
main.opt.bootclasspath
=
\
main.opt.bootclasspath
=
\
\
-bootclasspath <path> Override location of bootstrap class files
\
-bootclasspath <path> Override location of bootstrap class files
...
...
test/tools/doclint/BadPackageCommentTest.java
0 → 100644
浏览文件 @
c0289dac
/*
* @test /nodynamiccopyright/
* @bug 8020278
* @summary NPE in javadoc (bad handling of bad tag in package-info.java)
* @build DocLintTester
* @run main DocLintTester -ref BadPackageCommentTest.out BadPackageCommentTest.java
*/
/**
* abc.
* @@@
*/
package
p
;
test/tools/doclint/BadPackageCommentTest.out
0 → 100644
浏览文件 @
c0289dac
BadPackageCommentTest.java:11: error: no tag name after @
* @@@
^
BadPackageCommentTest.java:11: error: no tag name after @
* @@@
^
BadPackageCommentTest.java:11: error: no tag name after @
* @@@
^
3 errors
test/tools/doclint/tool/HelpTest.out
浏览文件 @
c0289dac
...
@@ -36,7 +36,7 @@ Options:
...
@@ -36,7 +36,7 @@ Options:
Show this message.
Show this message.
The following javac options are also supported
The following javac options are also supported
-bootclasspath, -classpath, -sourcepath, -Xmaxerrs, -Xmaxwarns
-bootclasspath, -classpath, -
cp, -
sourcepath, -Xmaxerrs, -Xmaxwarns
To run doclint on part of a project, put the compiled classes for your
To run doclint on part of a project, put the compiled classes for your
project on the classpath (or bootclasspath), then specify the source files
project on the classpath (or bootclasspath), then specify the source files
...
...
test/tools/javac/Diagnostics/compressed/T8020286.java
0 → 100644
浏览文件 @
c0289dac
/**
* @test /nodynamiccopyright/
* @bug 8020286
* @summary Wrong diagnostic after compaction
* @compile/fail/ref=T8020286.out -XDrawDiagnostics -Xdiags:compact T8020286.java
*/
class
T8020286
{
void
m
(
String
s
)
{
}
void
m
(
Integer
i
,
String
s
)
{
}
void
test
()
{
m
(
1
,
1
);
m
(
1
);
}
}
test/tools/javac/Diagnostics/compressed/T8020286.out
0 → 100644
浏览文件 @
c0289dac
T8020286.java:12:13: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int, java.lang.String)
T8020286.java:13:10: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int, java.lang.String)
- compiler.note.compressed.diags
2 errors
test/tools/javac/T6356530/SerializableAbstractClassWithNonAbstractMethodsTest.java
0 → 100644
浏览文件 @
c0289dac
/*
* Copyright (c) 2013, 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 6356530
* @summary -Xlint:serial does not flag abstract classes with concrete methods/members
* @compile/fail/ref=SerializableAbstractClassWithNonAbstractMethodsTest.out -XDrawDiagnostics -Werror -Xlint:serial SerializableAbstractClassWithNonAbstractMethodsTest.java
*/
abstract
class
SerializableAbstractClassWithNonAbstractMethodsTest
implements
java
.
io
.
Serializable
{
void
m1
()
{}
abstract
void
m2
();
abstract
class
AWithUID
implements
java
.
io
.
Serializable
{
private
static
final
long
serialVersionUID
=
0
;
void
m
(){}
}
interface
IDefault
extends
java
.
io
.
Serializable
{
default
int
m
()
{
return
1
;
}
}
interface
IDefaultAndUID
extends
java
.
io
.
Serializable
{
static
final
long
serialVersionUID
=
0
;
default
int
m
()
{
return
1
;
}
}
}
test/tools/javac/T6356530/SerializableAbstractClassWithNonAbstractMethodsTest.out
0 → 100644
浏览文件 @
c0289dac
SerializableAbstractClassWithNonAbstractMethodsTest.java:40:5: compiler.warn.missing.SVUID: SerializableAbstractClassWithNonAbstractMethodsTest.IDefault
SerializableAbstractClassWithNonAbstractMethodsTest.java:31:10: compiler.warn.missing.SVUID: SerializableAbstractClassWithNonAbstractMethodsTest
- compiler.err.warnings.and.werror
1 error
2 warnings
test/tools/javac/conditional/T8016702.java
0 → 100644
浏览文件 @
c0289dac
/*
* Copyright (c) 2013, 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 8016702
* @summary use of ternary operator in lambda expression gives incorrect results
*/
import
java.util.Arrays
;
import
java.util.List
;
public
class
T8016702
{
static
int
assertionCount
;
static
void
assertTrue
(
boolean
b
,
String
msg
)
{
assertionCount
++;
if
(!
b
)
{
throw
new
AssertionError
(
msg
);
}
}
interface
IntFunction
<
Y
>
{
Y
m
(
int
x
);
}
void
test
(
List
<
Integer
>
li
)
{
map
(
i
->
(
i
%
2
==
0
)
?
""
:
"i="
+
i
,
li
);
}
@SuppressWarnings
(
"unchecked"
)
<
R
>
void
map
(
IntFunction
<
R
>
mapper
,
List
<
Integer
>
li
)
{
for
(
int
i
:
li
)
{
String
res
=
(
String
)
mapper
.
m
(
i
);
assertTrue
((
i
%
2
==
0
)
?
res
.
isEmpty
()
:
res
.
contains
(
""
+
i
),
"i = "
+
i
+
" res = "
+
res
);
}
}
public
static
void
main
(
String
[]
args
)
{
T8016702
tester
=
new
T8016702
();
tester
.
test
(
Arrays
.
asList
(
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
));
assertTrue
(
assertionCount
==
10
,
"wrong assertion count: "
+
assertionCount
);
}
}
test/tools/javac/generics/6723444/T6723444.java
浏览文件 @
c0289dac
...
@@ -4,7 +4,8 @@
...
@@ -4,7 +4,8 @@
*
*
* @summary javac fails to substitute type variables into a constructor's throws clause
* @summary javac fails to substitute type variables into a constructor's throws clause
* @author Mark Mahieu
* @author Mark Mahieu
* @compile/fail/ref=T6723444.out -XDrawDiagnostics T6723444.java
* @compile/fail/ref=T6723444_1.out -Xlint:-options -source 7 -XDrawDiagnostics T6723444.java
* @compile/fail/ref=T6723444_2.out -XDrawDiagnostics T6723444.java
*
*
*/
*/
public
class
T6723444
{
public
class
T6723444
{
...
...
test/tools/javac/generics/6723444/T6723444.out
→
test/tools/javac/generics/6723444/T6723444
_1
.out
浏览文件 @
c0289dac
T6723444.java:42:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:43:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:43:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:4
5:32
: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:4
4:9
: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:46:
17
: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:46:
32
: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:4
8:9
: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:4
7:17
: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:49:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:49:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:50:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:50:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:51:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:51:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
...
@@ -10,4 +9,5 @@ T6723444.java:52:9: compiler.err.unreported.exception.need.to.catch.or.throw: ja
...
@@ -10,4 +9,5 @@ T6723444.java:52:9: compiler.err.unreported.exception.need.to.catch.or.throw: ja
T6723444.java:53:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:53:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:54:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:54:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:55:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:55:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:56:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
12 errors
12 errors
test/tools/javac/generics/6723444/T6723444_2.out
0 → 100644
浏览文件 @
c0289dac
T6723444.java:46:32: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:47:17: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:49:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:50:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:51:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:52:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:53:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:54:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:55:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
T6723444.java:56:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable
10 errors
test/tools/javac/generics/7015430/T7015430.java
浏览文件 @
c0289dac
...
@@ -4,7 +4,8 @@
...
@@ -4,7 +4,8 @@
*
*
* @summary Incorrect thrown type determined for unchecked invocations
* @summary Incorrect thrown type determined for unchecked invocations
* @author Daniel Smith
* @author Daniel Smith
* @compile/fail/ref=T7015430.out -Xlint:unchecked -XDrawDiagnostics T7015430.java
* @compile/fail/ref=T7015430_1.out -source 7 -Xlint:-options,unchecked -XDrawDiagnostics T7015430.java
* @compile/fail/ref=T7015430_2.out -Xlint:unchecked -XDrawDiagnostics T7015430.java
*
*
*/
*/
...
...
test/tools/javac/generics/7015430/T7015430_1.out
0 → 100644
浏览文件 @
c0289dac
T7015430.java:42:14: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:42:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
T7015430.java:51:41: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:51:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:69:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:69:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
T7015430.java:78:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:78:40: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:105:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:105:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:114:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:114:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
T7015430.java:42:14: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
T7015430.java:69:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
T7015430.java:96:15: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
T7015430.java:114:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
T7015430.java:130:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
5 errors
12 warnings
test/tools/javac/generics/7015430/T7015430.out
→
test/tools/javac/generics/7015430/T7015430
_2
.out
浏览文件 @
c0289dac
T7015430.java:41:14: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:42:14: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:41:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.Exception>
T7015430.java:42:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:50:41: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:51:41: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:50:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:51:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:68:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:69:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:68:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.Exception>
T7015430.java:69:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:77:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:78:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:77:40: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:78:40: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:104:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:105:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:104:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:105:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:113:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:114:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:113:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.Exception>
T7015430.java:114:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
T7015430.java:41:14: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
T7015430.java:130:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
T7015430.java:68:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
1 error
T7015430.java:95:15: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
T7015430.java:113:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
T7015430.java:129:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
5 errors
12 warnings
12 warnings
test/tools/javac/generics/7034511/T7034511a.java
浏览文件 @
c0289dac
/*
/*
* @test /nodynamiccopyright/
* @test /nodynamiccopyright/
* @ignore 7041019 Bogus type-variable substitution with array types with dependencies on accessibility check
* @bug 7034511 7040883 7041019
* @bug 7034511 7040883
* @summary Loophole in typesafety
* @summary Loophole in typesafety
* @compile/fail/ref=T7034511a.out -XDrawDiagnostics T7034511a.java
* @compile/fail/ref=T7034511a.out -XDrawDiagnostics T7034511a.java
*/
*/
// backing out 7034511, see 7040883
class
T7034511a
{
class
T7034511a
{
interface
A
<
T
>
{
interface
A
<
T
>
{
...
...
test/tools/javac/generics/7034511/T7034511a.out
浏览文件 @
c0289dac
T7034511a.java:18:14: compiler.err.cant.apply.symbol: kindname.method, foo, compiler.misc.type.captureof: 1, ?[], java.lang.String[], kindname.interface, T7034511a.A<T>, (compiler.misc.no.conforming.assignment.exists:
java.lang.String[], compiler.misc.type.captureof: 1, ?[]
)
T7034511a.java:18:14: compiler.err.cant.apply.symbol: kindname.method, foo, compiler.misc.type.captureof: 1, ?[], java.lang.String[], kindname.interface, T7034511a.A<T>, (compiler.misc.no.conforming.assignment.exists:
(compiler.misc.inconvertible.types: java.lang.String[], compiler.misc.type.captureof: 1, ?[])
)
1 error
1 error
test/tools/javac/generics/7034511/T7034511b.java
浏览文件 @
c0289dac
/*
/*
* @test /nodynamiccopyright/
* @test /nodynamiccopyright/
* @ignore 7041019 Bogus type-variable substitution with array types with dependencies on accessibility check
* @bug 7034511 7040883 7041019
* @bug 7034511 7040883
* @summary Loophole in typesafety
* @summary Loophole in typesafety
* @compile/fail/ref=T7034511b.out -XDrawDiagnostics T7034511b.java
* @compile/fail/ref=T7034511b.out -XDrawDiagnostics T7034511b.java
*/
*/
// backing out 7034511, see 7040883
class
T7034511b
{
class
T7034511b
{
static
class
MyList
<
E
>
{
static
class
MyList
<
E
>
{
E
toArray
(
E
[]
e
)
{
return
null
;
}
E
toArray
(
E
[]
e
)
{
return
null
;
}
...
...
test/tools/javac/generics/7034511/T7034511b.out
浏览文件 @
c0289dac
T7034511b.java:14:11: compiler.err.cant.apply.symbol: kindname.method, toArray, compiler.misc.type.captureof: 1, ?[], java.lang.Object[], kindname.class, T7034511b.MyList<E>, (compiler.misc.no.conforming.assignment.exists:
java.lang.Object[], compiler.misc.type.captureof: 1, ?[]
)
T7034511b.java:14:11: compiler.err.cant.apply.symbol: kindname.method, toArray, compiler.misc.type.captureof: 1, ?[], java.lang.Object[], kindname.class, T7034511b.MyList<E>, (compiler.misc.no.conforming.assignment.exists:
(compiler.misc.inconvertible.types: java.lang.Object[], compiler.misc.type.captureof: 1, ?[])
)
1 error
1 error
test/tools/javac/generics/7034511/T7041019.java
0 → 100644
浏览文件 @
c0289dac
/*
* Copyright (c) 2013, 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 7034511 7040883 7041019
* @summary Bogus type-variable substitution with array types with dependencies on accessibility check
*
* @compile T7041019.java
*/
import
java.util.List
;
class
T7041019
{
<
E
>
List
<
E
>[]
m
(
List
<
E
>
l
)
{
return
null
;
}
void
test
(
List
<?
extends
String
>
ls
)
{
int
i
=
m
(
ls
).
length
;
}
}
test/tools/javac/generics/8016640/T8016640.java
0 → 100644
浏览文件 @
c0289dac
/*
* @test /nodynamiccopyright/
* @bug 8016640
* @summary compiler hangs if the generics arity of a base class is wrong
* @compile/fail/ref=T8016640.out -XDrawDiagnostics T8016640.java
*/
class
T8016640
{
static
class
Foo
<
X
,
Y
>
{
}
static
class
BadFoo
<
T
>
extends
Foo
<
T
>
{
}
}
test/tools/javac/generics/8016640/T8016640.out
0 → 100644
浏览文件 @
c0289dac
T8016640.java:9:39: compiler.err.wrong.number.type.args: 2
1 error
test/tools/javac/generics/inference/8019824/T8019824.java
0 → 100644
浏览文件 @
c0289dac
/**
* @test /nodynamiccopyright/
* @bug 8019824
* @summary very long error messages on inference error
* @compile/fail/ref=T8019824.out -XDrawDiagnostics T8019824.java
*/
class
T8019824
{
void
test
(
Class
<?
extends
Foo
<?,
?>>
cls
)
{
Foo
<?,
?>
foo
=
make
(
cls
);
}
<
A
,
B
,
C
extends
Foo
<
A
,
B
>>
Foo
<
A
,
B
>
make
(
Class
<
C
>
cls
)
{
return
null
;
}
interface
Foo
<
A
,
B
>
{}
}
test/tools/javac/generics/inference/8019824/T8019824.out
0 → 100644
浏览文件 @
c0289dac
T8019824.java:9:25: compiler.err.cant.apply.symbol: kindname.method, make, java.lang.Class<C>, java.lang.Class<compiler.misc.type.captureof: 1, ? extends T8019824.Foo<?,?>>, kindname.class, T8019824, (compiler.misc.incompatible.eq.upper.bounds: C, compiler.misc.type.captureof: 1, ? extends T8019824.Foo<?,?>, T8019824.Foo<compiler.misc.type.captureof: 2, ?,B>)
1 error
test/tools/javac/generics/inference/8020149/T8020149.java
0 → 100644
浏览文件 @
c0289dac
/*
* Copyright (c) 2013, 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 8020149
* @summary Graph inference: wrong logic for picking best variable to solve
* @compile T8020149.java
*/
class
T8020149
{
static
class
TestData
<
X
,
Y
>
{
}
interface
Foo
<
X
,
Y
extends
Foo
<
X
,
Y
>>
{
}
interface
IntFoo
extends
Foo
<
Integer
,
IntFoo
>
{
}
interface
Function
<
X
,
Y
>
{
Y
apply
(
X
x
);
}
void
test
(
TestData
<
Integer
,
IntFoo
>
data
)
{
m1
(
data
,
s
->
s
);
m2
(
data
,
s
->
s
);
}
<
E
,
E_OUT
extends
Foo
<
E
,
E_OUT
>,
W
,
W_IN
extends
Foo
<
W
,
W_IN
>>
void
m1
(
TestData
<
W
,
W_IN
>
data
,
Function
<
W_IN
,
E_OUT
>
m
)
{
}
<
W
,
W_IN
extends
Foo
<
W
,
W_IN
>,
E
,
E_OUT
extends
Foo
<
E
,
E_OUT
>>
void
m2
(
TestData
<
W
,
W_IN
>
data
,
Function
<
W_IN
,
E_OUT
>
m
)
{
}
}
test/tools/javac/lambda/8019480/T8019480.java
0 → 100644
浏览文件 @
c0289dac
/*
* @test /nodynamiccopyright/
* @bug 8019480
* @summary Javac crashes when method is called on a type-variable receiver from lambda expression
* @author Maurizio Cimadamore
* @compile/fail/ref=T8019480.out -XDrawDiagnostics T8019480.java
*/
import
java.util.*
;
class
T8019480
<
U
>
{
interface
Predicate
<
T
>
{
void
m
(
T
t
);
}
interface
Stream
<
T
>
{
void
forEach
(
Predicate
<
T
>
pt
);
}
void
test
(
U
current
,
Stream
<
U
>
stream
)
{
List
<
U
>
list3
=
new
ArrayList
<>();
stream
.
forEach
(
i
->
list3
.
add
(
current
.
clone
()));
}
}
test/tools/javac/lambda/8019480/T8019480.out
0 → 100644
浏览文件 @
c0289dac
T8019480.java:21:46: compiler.err.report.access: clone(), protected, java.lang.Object
T8019480.java:21:34: compiler.err.cant.apply.symbols: kindname.method, add, java.lang.Object,{(compiler.misc.inapplicable.method: kindname.method, java.util.Collection, add(U), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, U))),(compiler.misc.inapplicable.method: kindname.method, java.util.List, add(U), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, U))),(compiler.misc.inapplicable.method: kindname.method, java.util.List, add(int,U), (compiler.misc.arg.length.mismatch))}
2 errors
test/tools/javac/lambda/8020147/T8020147.java
0 → 100644
浏览文件 @
c0289dac
/*
* @test /nodynamiccopyright/
* @bug 8020147
* @summary Spurious errors when compiling nested stuck lambdas
* @compile/fail/ref=T8020147.out -Werror -Xlint:cast -XDrawDiagnostics T8020147.java
*/
class
T8020147
{
interface
Function
<
X
,
Y
>
{
Y
apply
(
X
x
);
}
<
T
>
void
g
(
Function
<
String
,
T
>
f
)
{
}
<
U
>
String
m
(
U
u
,
Function
<
U
,
U
>
fuu
)
{
return
null
;
}
void
test
()
{
g
(
x
->
m
(
""
,
i
->(
String
)
i
));
g
(
x
->
m
(
""
,
i
->(
String
)
x
));
}
}
test/tools/javac/lambda/8020147/T8020147.out
0 → 100644
浏览文件 @
c0289dac
T8020147.java:16:23: compiler.warn.redundant.cast: java.lang.String
T8020147.java:17:23: compiler.warn.redundant.cast: java.lang.String
- compiler.err.warnings.and.werror
1 error
2 warnings
test/tools/javac/lambda/BadNestedLambda.java
0 → 100644
浏览文件 @
c0289dac
/*
* @test /nodynamiccopyright/
* @bug 8017618
* @summary NullPointerException in RichDiagnosticFormatter for bad input program
* @compile/fail/ref=BadNestedLambda.out -XDrawDiagnostics BadNestedLambda.java
*/
class
BadNestedLambda
{
void
test
()
{
Runnable
add
=
(
int
x
)
->
(
int
y
)
->
x
+
y
;
}
}
test/tools/javac/lambda/BadNestedLambda.out
0 → 100644
浏览文件 @
c0289dac
BadNestedLambda.java:9:35: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.not.a.functional.intf: void))
BadNestedLambda.java:9:24: compiler.err.prob.found.req: (compiler.misc.incompatible.arg.types.in.lambda)
2 errors
test/tools/javac/lambda/MethodReference68.java
0 → 100644
浏览文件 @
c0289dac
/*
* @test /nodynamiccopyright/
* @bug 8016175
* @summary Add bottom-up type-checking support for unambiguous method references
* @compile/fail/ref=MethodReference68.out -XDrawDiagnostics MethodReference68.java
*/
class
MethodReference68
{
interface
F
<
X
>
{
String
m
(
X
x
);
}
static
class
Foo
{
String
getName
()
{
return
""
;
}
}
@SuppressWarnings
(
"unchecked"
)
<
Z
>
void
g
(
F
<
Z
>
fz
,
Z
...
zs
)
{
}
void
test
()
{
g
(
Foo:
:
getName
);
g
(
Foo:
:
getName
,
1
);
//incompatible constraints, Z <: Foo, Z :> Integer
}
}
test/tools/javac/lambda/MethodReference68.out
0 → 100644
浏览文件 @
c0289dac
MethodReference68.java:21:10: compiler.err.cant.apply.symbol: kindname.method, g, MethodReference68.F<Z>,Z[], @493,int, kindname.class, MethodReference68, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, MethodReference68.Foo,java.lang.Object)
1 error
test/tools/javac/lambda/MethodReference69.java
0 → 100644
浏览文件 @
c0289dac
/*
* @test /nodynamiccopyright/
* @bug 8016175
* @summary Add bottom-up type-checking support for unambiguous method references
* @compile/fail/ref=MethodReference69.out -XDrawDiagnostics MethodReference69.java
*/
class
MethodReference69
{
interface
F
<
X
>
{
String
m
(
Integer
x1
,
X
x2
);
}
static
class
Foo
{
String
getNameAt
(
Integer
i
)
{
return
""
;
}
}
<
Z
>
void
g
(
F
<
Z
>
fz
)
{
}
void
test
()
{
g
(
Foo:
:
getName
);
}
}
test/tools/javac/lambda/MethodReference69.out
0 → 100644
浏览文件 @
c0289dac
MethodReference69.java:19:12: compiler.err.invalid.mref: kindname.method, (compiler.misc.cant.resolve.location.args: kindname.method, getName, , , (compiler.misc.location: kindname.class, MethodReference69.Foo, null))
1 error
test/tools/javac/lambda/MethodReference70.java
0 → 100644
浏览文件 @
c0289dac
/*
* @test /nodynamiccopyright/
* @bug 8016175
* @summary Add bottom-up type-checking support for unambiguous method references
* @compile/fail/ref=MethodReference70.out -XDrawDiagnostics MethodReference70.java
*/
class
MethodReference70
{
interface
F
<
X
>
{
void
m
(
X
x
);
}
interface
G
<
X
>
{
Integer
m
(
X
x
);
}
void
m1
(
Integer
i
)
{
}
void
m2
(
Integer
i
)
{
}
void
m2
(
String
i
)
{
}
<
Z
>
void
g
(
F
<
Z
>
fz
)
{
}
<
Z
>
void
g
(
G
<
Z
>
gz
)
{
}
void
test
()
{
g
(
this
::
m1
);
//ok
g
(
this
::
m2
);
//ambiguous (stuck!)
}
}
test/tools/javac/lambda/MethodReference70.out
0 → 100644
浏览文件 @
c0289dac
MethodReference70.java:26:10: compiler.err.ref.ambiguous: g, kindname.method, <Z>g(MethodReference70.F<Z>), MethodReference70, kindname.method, <Z>g(MethodReference70.G<Z>), MethodReference70
MethodReference70.java:26:11: compiler.err.prob.found.req: (compiler.misc.cyclic.inference: Z)
2 errors
test/tools/javac/lambda/MethodReference71.java
0 → 100644
浏览文件 @
c0289dac
/*
* @test /nodynamiccopyright/
* @bug 8016175
* @summary Add bottom-up type-checking support for unambiguous method references
* @compile/fail/ref=MethodReference71.out -XDrawDiagnostics MethodReference71.java
*/
class
MethodReference71
{
interface
F
<
X
>
{
void
m
(
X
x
);
}
interface
G
<
X
>
{
Integer
m
(
X
x
);
}
void
m1
(
Integer
i
)
{
}
void
m2
(
Integer
...
i
)
{
}
<
Z
>
void
g
(
F
<
Z
>
f
)
{
}
<
Z
>
void
g
(
G
<
Z
>
g
)
{
}
void
test
()
{
g
(
this
::
m1
);
//ok
g
(
this
::
m2
);
//ambiguous (stuck!)
}
}
test/tools/javac/lambda/MethodReference71.out
0 → 100644
浏览文件 @
c0289dac
MethodReference71.java:24:10: compiler.err.ref.ambiguous: g, kindname.method, <Z>g(MethodReference71.F<Z>), MethodReference71, kindname.method, <Z>g(MethodReference71.G<Z>), MethodReference71
MethodReference71.java:24:11: compiler.err.prob.found.req: (compiler.misc.cyclic.inference: Z)
2 errors
test/tools/javac/lambda/MethodReference72.java
0 → 100644
浏览文件 @
c0289dac
/*
* @test /nodynamiccopyright/
* @bug 8016175
* @summary Add bottom-up type-checking support for unambiguous method references
* @compile/fail/ref=MethodReference72.out -XDrawDiagnostics MethodReference72.java
*/
class
MethodReference72
{
interface
F
<
X
>
{
@SuppressWarnings
(
"unchecked"
)
void
m
(
X
...
x
);
}
void
m1
(
Integer
i
)
{
}
<
Z
>
void
g
(
F
<
Z
>
f
)
{
}
void
test
()
{
g
(
this
::
m1
);
//?
}
}
test/tools/javac/lambda/MethodReference72.out
0 → 100644
浏览文件 @
c0289dac
MethodReference72.java:18:9: compiler.err.cant.apply.symbol: kindname.method, g, MethodReference72.F<Z>, @420, kindname.class, MethodReference72, (compiler.misc.infer.no.conforming.assignment.exists: Z, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m1, java.lang.Integer, Z[], kindname.class, MethodReference72, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: Z[], java.lang.Integer)))))
1 error
test/tools/javac/lambda/NestedCapture01.java
0 → 100644
浏览文件 @
c0289dac
/*
* Copyright (c) 2013, 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 8012238
* @summary Nested method capture and inference
* @compile NestedCapture01.java
*/
class
NestedCapture01
{
void
test
(
String
s
)
{
g
(
m
(
s
.
getClass
()));
}
<
F
extends
String
>
F
m
(
Class
<
F
>
cf
)
{
return
null
;
}
<
P
extends
String
>
P
g
(
P
vo
)
{
return
null
;
}
}
test/tools/javac/lambda/NestedCapture02.java
0 → 100644
浏览文件 @
c0289dac
/*
* Copyright (c) 2013, 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 8012238
* @summary Nested method capture and inference
* @compile NestedCapture02.java
*/
class
NestedCapture02
<
S
,
T
>
{
<
S
,
T
>
NestedCapture02
<
S
,
T
>
create
(
NestedCapture02
<?
super
S
,?>
first
,
NestedCapture02
<?
super
S
,
T
>
second
)
{
return
null
;
}
<
U
>
NestedCapture02
<
S
,
?
extends
U
>
cast
(
Class
<
U
>
target
)
{
return
null
;
}
<
U
>
NestedCapture02
<
S
,
?
extends
U
>
test
(
Class
<
U
>
target
,
NestedCapture02
<?
super
S
,
?>
first
,
NestedCapture02
<?
super
S
,
T
>
second
)
{
return
create
(
first
,
second
.
cast
(
target
));
}
}
test/tools/javac/lambda/NestedCapture03.java
0 → 100644
浏览文件 @
c0289dac
/*
* Copyright (c) 2013, 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 8012238
* @summary Nested method capture and inference
* @compile NestedCapture03.java
*/
class
NestedCapture03
{
<
T
extends
String
>
T
factory
(
Class
<
T
>
c
)
{
return
null
;
}
void
test
(
Class
<?>
c
)
{
factory
(
c
.
asSubclass
(
String
.
class
)).
matches
(
null
);
}
}
test/tools/javac/lambda/TargetType36.java
浏览文件 @
c0289dac
...
@@ -23,11 +23,10 @@
...
@@ -23,11 +23,10 @@
/*
/*
* @test
* @test
* @ignore 8013404: Test awaits spec clarification
* @bug 8003280 8013404
* @bug 8003280
* @summary Add lambda tests
* @summary Add lambda tests
* check that target type of cast is propagated to conditional subexpressions
* check that target type of cast is
not
propagated to conditional subexpressions
* @compile TargetType36.java
* @compile
/fail/ref=TargetType36.out -XDrawDiagnostics
TargetType36.java
*/
*/
class
TargetType36
{
//awaits spec wording on cast vs. poly
class
TargetType36
{
//awaits spec wording on cast vs. poly
...
...
test/tools/javac/lambda/TargetType36.out
0 → 100644
浏览文件 @
c0289dac
TargetType36.java:40:30: compiler.err.unexpected.lambda
TargetType36.java:40:43: compiler.err.unexpected.lambda
2 errors
test/tools/javac/lambda/TargetType60.out
浏览文件 @
c0289dac
TargetType60.java:54:21: compiler.err.ref.ambiguous: g, kindname.method, g(TargetType60.Sam0), TargetType60, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60
TargetType60.java:54:21: compiler.err.ref.ambiguous: g, kindname.method, g(TargetType60.Sam0), TargetType60, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60
TargetType60.java:55:21: compiler.err.ref.ambiguous: g, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>g(TargetType60.Sam2<U,java.lang.String>), TargetType60
TargetType60.java:55:21: compiler.err.ref.ambiguous: g, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>g(TargetType60.Sam2<U,java.lang.String>), TargetType60
TargetType60.java:60:27: compiler.err.ref.ambiguous: u, kindname.method, <U>u(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>u(TargetType60.Sam2<U,java.lang.String>), TargetType60
TargetType60.java:60:27: compiler.err.ref.ambiguous: u, kindname.method, <U>u(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>u(TargetType60.Sam2<U,java.lang.String>), TargetType60
TargetType60.java:60:2
8: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.assignment.exists: U, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, n1, java.lang.String, TargetType60, kindname.class, TargetType60, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: TargetType60, java.lang.String)))
))
TargetType60.java:60:2
9: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, n1(java.lang.String
))
TargetType60.java:61:29: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, n2(TargetType60,java.lang.String))
TargetType60.java:61:29: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, n2(TargetType60,java.lang.String))
TargetType60.java:62:27: compiler.err.ref.ambiguous: u, kindname.method, <U>u(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>u(TargetType60.Sam2<U,java.lang.String>), TargetType60
TargetType60.java:62:27: compiler.err.ref.ambiguous: u, kindname.method, <U>u(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>u(TargetType60.Sam2<U,java.lang.String>), TargetType60
TargetType60.java:63:27: compiler.err.ref.ambiguous: u, kindname.method, <U>u(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>u(TargetType60.Sam2<U,java.lang.String>), TargetType60
TargetType60.java:63:27: compiler.err.ref.ambiguous: u, kindname.method, <U>u(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>u(TargetType60.Sam2<U,java.lang.String>), TargetType60
...
...
test/tools/javac/lambda/TargetType63.java
0 → 100644
浏览文件 @
c0289dac
/*
* @test /nodynamiccopyright/
* @summary smoke test for inference of throws type variables
* @compile/fail/ref=TargetType63.out -XDrawDiagnostics TargetType63.java
*/
class
TargetType63
{
interface
F
<
T
extends
Throwable
>
{
void
m
()
throws
T
;
}
void
g1
()
{
}
void
g2
()
throws
ClassNotFoundException
{
}
void
g3
()
throws
Exception
{
}
<
Z
extends
Throwable
>
void
m1
(
F
<
Z
>
fz
)
throws
Z
{
}
<
Z
extends
ClassNotFoundException
>
void
m2
(
F
<
Z
>
fz
)
throws
Z
{
}
void
test1
()
{
m1
(()->{
});
//ok (Z = RuntimeException)
m1
(
this
::
g1
);
//ok (Z = RuntimeException)
}
void
test2
()
{
m2
(()->{
});
//fail (Z = ClassNotFoundException)
m2
(
this
::
g1
);
//fail (Z = ClassNotFoundException)
}
void
test3
()
{
m1
(()->{
throw
new
ClassNotFoundException
();
});
//fail (Z = ClassNotFoundException)
m1
(
this
::
g2
);
//fail (Z = ClassNotFoundException)
m2
(()->{
throw
new
ClassNotFoundException
();
});
//fail (Z = ClassNotFoundException)
m2
(
this
::
g2
);
//fail (Z = ClassNotFoundException)
}
void
test4
()
{
m1
(()->{
throw
new
Exception
();
});
//fail (Z = Exception)
m1
(
this
::
g3
);
//fail (Z = Exception)
}
}
test/tools/javac/lambda/TargetType63.out
0 → 100644
浏览文件 @
c0289dac
TargetType63.java:25:11: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.ClassNotFoundException
TargetType63.java:26:11: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.ClassNotFoundException
TargetType63.java:30:11: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.ClassNotFoundException
TargetType63.java:31:11: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.ClassNotFoundException
TargetType63.java:32:11: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.ClassNotFoundException
TargetType63.java:33:11: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.ClassNotFoundException
TargetType63.java:37:11: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
TargetType63.java:38:11: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
8 errors
test/tools/javac/lambda/TargetType75.java
0 → 100644
浏览文件 @
c0289dac
/*
* Copyright (c) 2013, 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 8016060 8016059
* @summary Lambda isn't compiled with return statement
* @compile TargetType75.java
*/
class
TargetType75
{
interface
P
<
X
>
{
void
m
(
X
x
);
}
<
Z
>
void
m
(
P
<
Z
>
r
,
Z
z
)
{
}
void
test
()
{
m
(
x
->{
return
;
},
""
);
m
(
x
->
System
.
out
.
println
(
""
),
""
);
}
}
test/tools/javac/lambda/TargetType76.java
0 → 100644
浏览文件 @
c0289dac
/*
* Copyright (c) 2013, 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 8016175
* @summary Add bottom-up type-checking support for unambiguous method references
* @compile TargetType76.java
*/
class
TargetType76
{
interface
Function
<
X
,
Y
>
{
Y
m
(
X
x
);
}
interface
OfRef
<
T
>
{
}
interface
Supplier
<
X
>
{
X
make
();
}
interface
Stream
<
X
>
{
}
interface
Node
<
E
>
{
Spliterator
<
E
>
spliterator
();
}
interface
Spliterator
<
X
>
{
Spliterator
<
X
>
spliterator
();
}
class
RefTestData
<
T
,
I
>
implements
OfRef
<
T
>
{
RefTestData
(
I
state
,
Function
<
I
,
Stream
<
T
>>
streamFn
,
Function
<
I
,
Spliterator
<
T
>>
splitrFn
)
{
}
}
<
O
>
OfRef
<
O
>
ofCollection
(
Node
<
O
>
collection
)
{
return
new
RefTestData
<>(
collection
,
x
->
stream
(
x:
:
spliterator
),
Node:
:
spliterator
);
}
<
S
>
Stream
<
S
>
stream
(
Supplier
<?
extends
Spliterator
<
S
>>
supplier
)
{
return
null
;
}
}
test/tools/javac/meth/VarargsWarn.java
0 → 100644
浏览文件 @
c0289dac
/*
* @test /nodynamiccopyright/
* @bug 8019340
* @summary varargs-related warnings are meaningless on signature-polymorphic methods such as MethodHandle.invokeExact
*
* @compile/fail/ref=VarargsWarn.out -XDrawDiagnostics -Werror VarargsWarn.java
*/
import
java.lang.invoke.*
;
class
VarargsWarn
{
void
test
(
MethodHandle
mh
)
throws
Throwable
{
mh
.
invokeExact
((
Integer
[])
null
);
mh
.
invoke
((
Integer
[])
null
);
mh
.
invokeWithArguments
((
Integer
[])
null
);
//not a sig poly method - warning here!
}
}
test/tools/javac/meth/VarargsWarn.out
0 → 100644
浏览文件 @
c0289dac
VarargsWarn.java:15:32: compiler.warn.inexact.non-varargs.call: java.lang.Object, java.lang.Object[]
- compiler.err.warnings.and.werror
1 error
1 warning
test/tools/javac/warnings/6594914/Auxiliary.java
0 → 100644
浏览文件 @
c0289dac
import
java.io.StringBufferInputStream
;
public
class
Auxiliary
{
}
test/tools/javac/warnings/6594914/ExplicitCompilation.out
0 → 100644
浏览文件 @
c0289dac
Auxiliary.java:1:15: compiler.warn.has.been.deprecated: java.io.StringBufferInputStream, java.io
1 warning
test/tools/javac/warnings/6594914/ImplicitCompilation.java
0 → 100644
浏览文件 @
c0289dac
/**
* @test /nodynamiccopyright/
* @bug 8020586
* @summary Warnings in the imports section should be attributed to the correct source file
* @clean Auxiliary ImplicitCompilation
* @compile/ref=ImplicitCompilation.out -XDrawDiagnostics -Xlint:deprecation -sourcepath . ImplicitCompilation.java
* @clean Auxiliary ImplicitCompilation
* @compile/ref=ExplicitCompilation.out -XDrawDiagnostics -Xlint:deprecation ImplicitCompilation.java Auxiliary.java
*/
public
class
ImplicitCompilation
{
private
Auxiliary
a
;
}
test/tools/javac/warnings/6594914/ImplicitCompilation.out
0 → 100644
浏览文件 @
c0289dac
Auxiliary.java:1:15: compiler.warn.has.been.deprecated: java.io.StringBufferInputStream, java.io
1 warning
test/tools/javap/8007907/JavapReturns0AfterClassNotFoundTest.java
浏览文件 @
c0289dac
...
@@ -35,7 +35,7 @@ import java.io.StringWriter;
...
@@ -35,7 +35,7 @@ import java.io.StringWriter;
public
class
JavapReturns0AfterClassNotFoundTest
{
public
class
JavapReturns0AfterClassNotFoundTest
{
static
final
String
fileNotFoundErrorMsg
=
static
final
String
fileNotFoundErrorMsg
=
"Error:
class not found: Unexisting.class"
;
"Error: class not found: Unexisting.class"
;
static
final
String
exitCodeClassNotFoundAssertionMsg
=
static
final
String
exitCodeClassNotFoundAssertionMsg
=
"Javap's exit code for class not found should be 1"
;
"Javap's exit code for class not found should be 1"
;
static
final
String
classNotFoundMsgAssertionMsg
=
static
final
String
classNotFoundMsgAssertionMsg
=
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录