Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
06a965cc
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看板
提交
06a965cc
编写于
5月 27, 2014
作者:
P
pgovereau
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8041704: wrong error message when mixing lambda expression and inner class
Reviewed-by: vromero
上级
889cda1a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
32 addition
and
5 deletion
+32
-5
src/share/classes/com/sun/tools/javac/comp/Attr.java
src/share/classes/com/sun/tools/javac/comp/Attr.java
+17
-3
test/tools/javac/T8030816/CrashLambdaExpressionWithNonAccessibleIdTest.out
...T8030816/CrashLambdaExpressionWithNonAccessibleIdTest.out
+1
-2
test/tools/javac/lambda/T8041704/ErrorMessageTest.java
test/tools/javac/lambda/T8041704/ErrorMessageTest.java
+12
-0
test/tools/javac/lambda/T8041704/ErrorMessageTest.out
test/tools/javac/lambda/T8041704/ErrorMessageTest.out
+2
-0
未找到文件。
src/share/classes/com/sun/tools/javac/comp/Attr.java
浏览文件 @
06a965cc
...
...
@@ -4671,16 +4671,30 @@ public class Attr extends JCTree.Visitor {
private
void
initTypeIfNeeded
(
JCTree
that
)
{
if
(
that
.
type
==
null
)
{
if
(
that
.
hasTag
(
METHODDEF
))
{
that
.
type
=
dummyMethodType
();
that
.
type
=
dummyMethodType
(
(
JCMethodDecl
)
that
);
}
else
{
that
.
type
=
syms
.
unknownType
;
}
}
}
/* Construct a dummy method type. If we have a method declaration,
* and the declared return type is void, then use that return type
* instead of UNKNOWN to avoid spurious error messages in lambda
* bodies (see:JDK-8041704).
*/
private
Type
dummyMethodType
(
JCMethodDecl
md
)
{
Type
restype
=
syms
.
unknownType
;
if
(
md
!=
null
&&
md
.
restype
.
hasTag
(
TYPEIDENT
))
{
JCPrimitiveTypeTree
prim
=
(
JCPrimitiveTypeTree
)
md
.
restype
;
if
(
prim
.
typetag
==
VOID
)
restype
=
syms
.
voidType
;
}
return
new
MethodType
(
List
.<
Type
>
nil
(),
restype
,
List
.<
Type
>
nil
(),
syms
.
methodClass
);
}
private
Type
dummyMethodType
()
{
return
new
MethodType
(
List
.<
Type
>
nil
(),
syms
.
unknownType
,
List
.<
Type
>
nil
(),
syms
.
methodClass
);
return
dummyMethodType
(
null
);
}
@Override
...
...
test/tools/javac/T8030816/CrashLambdaExpressionWithNonAccessibleIdTest.out
浏览文件 @
06a965cc
CrashLambdaExpressionWithNonAccessibleIdTest.java:15:35: compiler.err.missing.ret.stmt
CrashLambdaExpressionWithNonAccessibleIdTest.java:14:17: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, CrashLambdaExpressionWithNonAccessibleIdTest, null)
2 errors
1 error
test/tools/javac/lambda/T8041704/ErrorMessageTest.java
0 → 100644
浏览文件 @
06a965cc
/**
* @test /nodynamiccopyright/
* @bug 8041704
* @summary wrong error message when mixing lambda expression and inner class
* @compile/fail/ref=ErrorMessageTest.out -XDrawDiagnostics ErrorMessageTest.java
*/
public
class
ErrorMessageTest
{
void
f
(
Runnable
r
)
{
f
(()
->
{
f
(
new
MISSING
()
{
public
void
run
()
{}
});
});
}
}
test/tools/javac/lambda/T8041704/ErrorMessageTest.out
0 → 100644
浏览文件 @
06a965cc
ErrorMessageTest.java:10:25: compiler.err.cant.resolve.location: kindname.class, MISSING, , , (compiler.misc.location: kindname.class, ErrorMessageTest, null)
1 error
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录