Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
d46936ac
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看板
提交
d46936ac
编写于
7月 24, 2013
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8020556: doclint does not check type variables for @throws
Reviewed-by: mcimadamore
上级
1d0a5a90
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
37 addition
and
14 deletion
+37
-14
src/share/classes/com/sun/source/util/DocTrees.java
src/share/classes/com/sun/source/util/DocTrees.java
+0
-1
src/share/classes/com/sun/tools/doclint/Checker.java
src/share/classes/com/sun/tools/doclint/Checker.java
+10
-2
src/share/classes/com/sun/tools/javac/api/JavacTrees.java
src/share/classes/com/sun/tools/javac/api/JavacTrees.java
+9
-8
src/share/classes/com/sun/tools/javac/comp/Env.java
src/share/classes/com/sun/tools/javac/comp/Env.java
+11
-2
test/tools/doclint/ReferenceTest.java
test/tools/doclint/ReferenceTest.java
+7
-1
未找到文件。
src/share/classes/com/sun/source/util/DocTrees.java
浏览文件 @
d46936ac
...
...
@@ -30,7 +30,6 @@ import javax.lang.model.element.Element;
import
javax.tools.JavaCompiler.CompilationTask
;
import
com.sun.source.doctree.DocCommentTree
;
import
com.sun.source.doctree.ReferenceTree
;
import
javax.tools.Diagnostic
;
/**
...
...
src/share/classes/com/sun/tools/doclint/Checker.java
浏览文件 @
d46936ac
...
...
@@ -753,8 +753,7 @@ public class Checker extends DocTreePathScanner<Void, Void> {
Element
ex
=
env
.
trees
.
getElement
(
new
DocTreePath
(
getCurrentPath
(),
exName
));
if
(
ex
==
null
)
{
env
.
messages
.
error
(
REFERENCE
,
tree
,
"dc.ref.not.found"
);
}
else
if
(
ex
.
asType
().
getKind
()
==
TypeKind
.
DECLARED
&&
env
.
types
.
isAssignable
(
ex
.
asType
(),
env
.
java_lang_Throwable
))
{
}
else
if
(
isThrowable
(
ex
.
asType
()))
{
switch
(
env
.
currElement
.
getKind
())
{
case
CONSTRUCTOR:
case
METHOD:
...
...
@@ -773,6 +772,15 @@ public class Checker extends DocTreePathScanner<Void, Void> {
return
scan
(
tree
.
getDescription
(),
ignore
);
}
private
boolean
isThrowable
(
TypeMirror
tm
)
{
switch
(
tm
.
getKind
())
{
case
DECLARED:
case
TYPEVAR:
return
env
.
types
.
isAssignable
(
tm
,
env
.
java_lang_Throwable
);
}
return
false
;
}
private
void
checkThrowsDeclared
(
ReferenceTree
tree
,
TypeMirror
t
,
List
<?
extends
TypeMirror
>
list
)
{
boolean
found
=
false
;
for
(
TypeMirror
tl
:
list
)
{
...
...
src/share/classes/com/sun/tools/javac/api/JavacTrees.java
浏览文件 @
d46936ac
...
...
@@ -69,7 +69,6 @@ import com.sun.tools.javac.code.Type.ClassType;
import
com.sun.tools.javac.code.Type.ErrorType
;
import
com.sun.tools.javac.code.Type.UnionClassType
;
import
com.sun.tools.javac.code.Types
;
import
com.sun.tools.javac.code.TypeTag
;
import
com.sun.tools.javac.code.Types.TypeRelation
;
import
com.sun.tools.javac.comp.Attr
;
import
com.sun.tools.javac.comp.AttrContext
;
...
...
@@ -358,7 +357,7 @@ public class JavacTrees extends DocTrees {
Log
.
DeferredDiagnosticHandler
deferredDiagnosticHandler
=
new
Log
.
DeferredDiagnosticHandler
(
log
);
try
{
final
Class
Symbol
tsym
;
final
Type
Symbol
tsym
;
final
Name
memberName
;
if
(
ref
.
qualifierExpression
==
null
)
{
tsym
=
env
.
enclClass
.
sym
;
...
...
@@ -387,7 +386,7 @@ public class JavacTrees extends DocTrees {
return
null
;
}
}
else
{
tsym
=
(
ClassSymbol
)
t
.
tsym
;
tsym
=
t
.
tsym
;
memberName
=
ref
.
memberName
;
}
}
...
...
@@ -408,15 +407,17 @@ public class JavacTrees extends DocTrees {
paramTypes
=
lb
.
toList
();
}
Symbol
msym
=
(
memberName
==
tsym
.
name
)
?
findConstructor
(
tsym
,
paramTypes
)
:
findMethod
(
tsym
,
memberName
,
paramTypes
);
ClassSymbol
sym
=
(
ClassSymbol
)
types
.
upperBound
(
tsym
.
type
).
tsym
;
Symbol
msym
=
(
memberName
==
sym
.
name
)
?
findConstructor
(
sym
,
paramTypes
)
:
findMethod
(
sym
,
memberName
,
paramTypes
);
if
(
paramTypes
!=
null
)
{
// explicit (possibly empty) arg list given, so cannot be a field
return
msym
;
}
VarSymbol
vsym
=
(
ref
.
paramTypes
!=
null
)
?
null
:
findField
(
t
sym
,
memberName
);
VarSymbol
vsym
=
(
ref
.
paramTypes
!=
null
)
?
null
:
findField
(
sym
,
memberName
);
// prefer a field over a method with no parameters
if
(
vsym
!=
null
&&
(
msym
==
null
||
...
...
@@ -789,6 +790,7 @@ public class JavacTrees extends DocTrees {
case
METHOD:
// System.err.println("METHOD: " + ((JCMethodDecl)tree).sym.getSimpleName());
method
=
(
JCMethodDecl
)
tree
;
env
=
memberEnter
.
getMethodEnv
(
method
,
env
);
break
;
case
VARIABLE:
// System.err.println("FIELD: " + ((JCVariableDecl)tree).sym.getSimpleName());
...
...
@@ -800,7 +802,6 @@ public class JavacTrees extends DocTrees {
try
{
Assert
.
check
(
method
.
body
==
tree
);
method
.
body
=
copier
.
copy
((
JCBlock
)
tree
,
(
JCTree
)
path
.
getLeaf
());
env
=
memberEnter
.
getMethodEnv
(
method
,
env
);
env
=
attribStatToTree
(
method
.
body
,
env
,
copier
.
leafCopy
);
}
finally
{
method
.
body
=
(
JCBlock
)
tree
;
...
...
src/share/classes/com/sun/tools/javac/comp/Env.java
浏览文件 @
d46936ac
/*
* 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.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -124,7 +124,16 @@ public class Env<A> implements Iterable<Env<A>> {
@Override
public
String
toString
()
{
return
"Env["
+
info
+
(
outer
==
null
?
""
:
",outer="
+
outer
)
+
"]"
;
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"Env["
).
append
(
info
);
// if (enclMethod != null)
// sb.append(",enclMethod=").append(Pretty.toSimpleString(enclMethod));
// if (enclClass != null)
// sb.append(",enclClass=").append(Pretty.toSimpleString(enclClass));
if
(
outer
!=
null
)
sb
.
append
(
",outer="
).
append
(
outer
);
sb
.
append
(
"]"
);
return
sb
.
toString
();
}
public
Iterator
<
Env
<
A
>>
iterator
()
{
...
...
test/tools/doclint/ReferenceTest.java
浏览文件 @
d46936ac
/*
* @test /nodynamiccopyright/
* @bug 8004832
* @bug 8004832
8020556
* @summary Add new doclint package
* @build DocLintTester
* @run main DocLintTester -Xmsgs:-reference ReferenceTest.java
...
...
@@ -48,5 +48,11 @@ public class ReferenceTest {
* @throws Exception description
*/
public
void
exception_not_thrown
()
{
}
/**
* @param <T> throwable
* @throws T description
*/
public
<
T
extends
Throwable
>
void
valid_throws_generic
()
throws
T
{
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录