Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
07c326db
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看板
提交
07c326db
编写于
10月 19, 2013
作者:
V
vromero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8024809: javac, some lambda programs are rejected by flow analysis
Reviewed-by: jjg, dlsmith
上级
14f41e5b
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
131 addition
and
12 deletion
+131
-12
src/share/classes/com/sun/tools/javac/comp/Attr.java
src/share/classes/com/sun/tools/javac/comp/Attr.java
+0
-3
test/tools/javac/lambda/8016081/T8016081.java
test/tools/javac/lambda/8016081/T8016081.java
+1
-1
test/tools/javac/lambda/LambdaExpr13.java
test/tools/javac/lambda/LambdaExpr13.java
+4
-3
test/tools/javac/lambda/T8024809/SelfInitializerInLambdaTesta.java
...s/javac/lambda/T8024809/SelfInitializerInLambdaTesta.java
+65
-0
test/tools/javac/lambda/T8024809/SelfInitializerInLambdaTesta.out
...ls/javac/lambda/T8024809/SelfInitializerInLambdaTesta.out
+7
-0
test/tools/javac/lambda/T8024809/SelfInitializerInLambdaTestb.java
...s/javac/lambda/T8024809/SelfInitializerInLambdaTestb.java
+40
-0
test/tools/javac/lambda/T8024809/SelfInitializerInLambdaTestb.out
...ls/javac/lambda/T8024809/SelfInitializerInLambdaTestb.out
+3
-0
test/tools/javac/lambda/TestSelfRef.java
test/tools/javac/lambda/TestSelfRef.java
+11
-5
未找到文件。
src/share/classes/com/sun/tools/javac/comp/Attr.java
浏览文件 @
07c326db
...
...
@@ -314,9 +314,6 @@ public class Attr extends JCTree.Visitor {
case
CLASSDEF:
//class def is always an owner
return
((
JCClassDecl
)
env
.
tree
).
sym
;
case
LAMBDA:
//a lambda is an owner - return a fresh synthetic method symbol
return
new
MethodSymbol
(
0
,
names
.
empty
,
null
,
syms
.
methodClass
);
case
BLOCK:
//static/instance init blocks are owner
Symbol
blockSym
=
env
.
info
.
scope
.
owner
;
...
...
test/tools/javac/lambda/8016081/T8016081.java
浏览文件 @
07c326db
...
...
@@ -32,7 +32,7 @@ class T8016081 {
interface
fint
{
int
get
();
}
@interface
atype
{
fint
fld
=
()->
(
fld
==
null
?
0
:
1
)
;
fint
fld
=
()->
1
;
}
@atype
class
T
{}
...
...
test/tools/javac/lambda/LambdaExpr13.java
浏览文件 @
07c326db
/*
* 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.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -26,13 +26,14 @@
* @bug 8003280
* @summary Add lambda tests
* check that recursive lambda (through field ref) is accepted in all contexts
* but field initialization
* @compile LambdaExpr13.java
*/
class
LambdaExpr13
{
Runnable
ir
=
()
->
{
ir
.
run
();
};
;
static
Runnable
sr
=
()
->
{
sr
.
run
();
}
;
Runnable
ir
;
static
Runnable
sr
;
{
ir
=
()
->
{
ir
.
run
();
};
}
static
{
sr
=
()
->
{
sr
.
run
();
};
}
...
...
test/tools/javac/lambda/T8024809/SelfInitializerInLambdaTesta.java
0 → 100644
浏览文件 @
07c326db
/*
* 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 8024809
* @summary javac, some lambda programs are rejected by flow analysis
* @compile/fail/ref=SelfInitializerInLambdaTesta.out -XDrawDiagnostics SelfInitializerInLambdaTesta.java
*/
public
class
SelfInitializerInLambdaTesta
{
final
Runnable
r1
=
()->
System
.
out
.
println
(
r1
);
final
Object
lock
=
new
Object
();
final
Runnable
r2
=
()->{
System
.
out
.
println
(
r2
);
synchronized
(
lock
){}
};
final
Runnable
r3
=
()->{
synchronized
(
lock
){
System
.
out
.
println
(
r3
);
}
};
final
Runnable
r4
=
()->{
System
.
out
.
println
(
r4
);
};
interface
SAM
{
int
m
(
String
s
);
}
final
SAM
s1
=
(
String
s
)->{
System
.
out
.
println
(
s
+
s1
.
toString
());
return
0
;
};
final
SAM
s2
=
(
s
)->{
System
.
out
.
println
(
s
+
s2
.
toString
());
return
0
;
};
}
test/tools/javac/lambda/T8024809/SelfInitializerInLambdaTesta.out
0 → 100644
浏览文件 @
07c326db
SelfInitializerInLambdaTesta.java:33:48: compiler.err.illegal.self.ref
SelfInitializerInLambdaTesta.java:38:28: compiler.err.illegal.self.ref
SelfInitializerInLambdaTesta.java:44:32: compiler.err.illegal.self.ref
SelfInitializerInLambdaTesta.java:49:28: compiler.err.illegal.self.ref
SelfInitializerInLambdaTesta.java:57:32: compiler.err.illegal.self.ref
SelfInitializerInLambdaTesta.java:62:32: compiler.err.illegal.self.ref
6 errors
test/tools/javac/lambda/T8024809/SelfInitializerInLambdaTestb.java
0 → 100644
浏览文件 @
07c326db
/*
* 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 8024809
* @summary javac, some lambda programs are rejected by flow analysis
* @compile/fail/ref=SelfInitializerInLambdaTestb.out -XDrawDiagnostics SelfInitializerInLambdaTestb.java
*/
public
class
SelfInitializerInLambdaTestb
{
final
Runnable
r1
;
final
Runnable
r2
=
()->
System
.
out
.
println
(
r1
);
SelfInitializerInLambdaTestb
()
{
r1
=
()->
System
.
out
.
println
(
r1
);
}
}
test/tools/javac/lambda/T8024809/SelfInitializerInLambdaTestb.out
0 → 100644
浏览文件 @
07c326db
SelfInitializerInLambdaTestb.java:35:49: compiler.err.var.might.not.have.been.initialized: r1
SelfInitializerInLambdaTestb.java:38:37: compiler.err.var.might.not.have.been.initialized: r1
2 errors
test/tools/javac/lambda/TestSelfRef.java
浏览文件 @
07c326db
/*
* 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.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -29,7 +29,6 @@
* consistently w.r.t. local inner classes
*/
import
com.sun.source.util.JavacTask
;
import
java.net.URI
;
import
java.util.Arrays
;
import
javax.tools.Diagnostic
;
...
...
@@ -38,6 +37,7 @@ import javax.tools.JavaFileObject;
import
javax.tools.SimpleJavaFileObject
;
import
javax.tools.StandardJavaFileManager
;
import
javax.tools.ToolProvider
;
import
com.sun.source.util.JavacTask
;
public
class
TestSelfRef
{
...
...
@@ -176,10 +176,16 @@ public class TestSelfRef {
check
();
}
void
check
()
{
boolean
isErrorExpected
()
{
//illegal forward ref
boolean
errorExpected
=
ik
.
inMethodContext
(
sk
)
&&
(
rk
.
selfRef
||
rk
.
forwardRef
);
boolean
result
=
ik
.
inMethodContext
(
sk
)
&&
(
rk
.
selfRef
||
rk
.
forwardRef
);
result
|=
(
rk
==
RefKind
.
SELF_LAMBDA
||
rk
==
RefKind
.
FORWARD_LAMBDA
);
return
result
;
}
void
check
()
{
checkCount
++;
boolean
errorExpected
=
isErrorExpected
();
if
(
diagChecker
.
errorFound
!=
errorExpected
)
{
throw
new
Error
(
"invalid diagnostics for source:\n"
+
source
.
getCharContent
(
true
)
+
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录