Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
0ee6bd7e
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看板
提交
0ee6bd7e
编写于
9月 03, 2013
作者:
V
vromero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8023545: Misleading error message when using diamond operator with private constructor
Reviewed-by: jjg
上级
2ba8211e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
38 addition
and
16 deletion
+38
-16
src/share/classes/com/sun/tools/javac/comp/Resolve.java
src/share/classes/com/sun/tools/javac/comp/Resolve.java
+20
-16
test/tools/javac/T8023545/MisleadingErrorMsgDiamondPlusPrivateCtorTest.java
...8023545/MisleadingErrorMsgDiamondPlusPrivateCtorTest.java
+16
-0
test/tools/javac/T8023545/MisleadingErrorMsgDiamondPlusPrivateCtorTest.out
...T8023545/MisleadingErrorMsgDiamondPlusPrivateCtorTest.out
+2
-0
未找到文件。
src/share/classes/com/sun/tools/javac/comp/Resolve.java
浏览文件 @
0ee6bd7e
...
...
@@ -2546,22 +2546,26 @@ public class Resolve {
@Override
Symbol
access
(
Env
<
AttrContext
>
env
,
DiagnosticPosition
pos
,
Symbol
location
,
Symbol
sym
)
{
if
(
sym
.
kind
>=
AMBIGUOUS
)
{
final
JCDiagnostic
details
=
sym
.
kind
==
WRONG_MTH
?
((
InapplicableSymbolError
)
sym
).
errCandidate
().
snd
:
null
;
sym
=
new
InapplicableSymbolError
(
sym
.
kind
,
"diamondError"
,
currentResolutionContext
)
{
@Override
JCDiagnostic
getDiagnostic
(
DiagnosticType
dkind
,
DiagnosticPosition
pos
,
Symbol
location
,
Type
site
,
Name
name
,
List
<
Type
>
argtypes
,
List
<
Type
>
typeargtypes
)
{
String
key
=
details
==
null
?
"cant.apply.diamond"
:
"cant.apply.diamond.1"
;
return
diags
.
create
(
dkind
,
log
.
currentSource
(),
pos
,
key
,
diags
.
fragment
(
"diamond"
,
site
.
tsym
),
details
);
}
};
sym
=
accessMethod
(
sym
,
pos
,
site
,
names
.
init
,
true
,
argtypes
,
typeargtypes
);
env
.
info
.
pendingResolutionPhase
=
currentResolutionContext
.
step
;
if
(
sym
.
kind
==
HIDDEN
)
{
sym
=
super
.
access
(
env
,
pos
,
location
,
sym
);
}
else
{
final
JCDiagnostic
details
=
sym
.
kind
==
WRONG_MTH
?
((
InapplicableSymbolError
)
sym
).
errCandidate
().
snd
:
null
;
sym
=
new
InapplicableSymbolError
(
sym
.
kind
,
"diamondError"
,
currentResolutionContext
)
{
@Override
JCDiagnostic
getDiagnostic
(
DiagnosticType
dkind
,
DiagnosticPosition
pos
,
Symbol
location
,
Type
site
,
Name
name
,
List
<
Type
>
argtypes
,
List
<
Type
>
typeargtypes
)
{
String
key
=
details
==
null
?
"cant.apply.diamond"
:
"cant.apply.diamond.1"
;
return
diags
.
create
(
dkind
,
log
.
currentSource
(),
pos
,
key
,
diags
.
fragment
(
"diamond"
,
site
.
tsym
),
details
);
}
};
sym
=
accessMethod
(
sym
,
pos
,
site
,
names
.
init
,
true
,
argtypes
,
typeargtypes
);
env
.
info
.
pendingResolutionPhase
=
currentResolutionContext
.
step
;
}
}
return
sym
;
}});
...
...
test/tools/javac/T8023545/MisleadingErrorMsgDiamondPlusPrivateCtorTest.java
0 → 100644
浏览文件 @
0ee6bd7e
/*
* @test /nodynamiccopyright/
* @bug 8023545
* @summary Misleading error message when using diamond operator with private constructor
* @compile/fail/ref=MisleadingErrorMsgDiamondPlusPrivateCtorTest.out -XDrawDiagnostics MisleadingErrorMsgDiamondPlusPrivateCtorTest.java
*/
public
class
MisleadingErrorMsgDiamondPlusPrivateCtorTest
{
public
void
foo
()
{
MyClass
<
Object
>
foo
=
new
MyClass
<>();
}
}
class
MyClass
<
E
>
{
private
MyClass
()
{}
}
test/tools/javac/T8023545/MisleadingErrorMsgDiamondPlusPrivateCtorTest.out
0 → 100644
浏览文件 @
0ee6bd7e
MisleadingErrorMsgDiamondPlusPrivateCtorTest.java:10:31: compiler.err.report.access: <E>MyClass(), private, MyClass
1 error
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录