Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
8a24c54d
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看板
提交
8a24c54d
编写于
10月 06, 2015
作者:
A
asaha
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
00726f95
f7df9c62
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
216 addition
and
19 deletion
+216
-19
.hgtags
.hgtags
+1
-0
src/share/classes/com/sun/tools/javac/resources/javac.properties
...re/classes/com/sun/tools/javac/resources/javac.properties
+3
-3
src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
+8
-13
src/share/classes/com/sun/tools/javadoc/MethodDocImpl.java
src/share/classes/com/sun/tools/javadoc/MethodDocImpl.java
+15
-2
src/share/classes/com/sun/tools/javadoc/TypeMaker.java
src/share/classes/com/sun/tools/javadoc/TypeMaker.java
+15
-1
test/tools/javadoc/CompletionError.java
test/tools/javadoc/CompletionError.java
+174
-0
未找到文件。
.hgtags
浏览文件 @
8a24c54d
...
...
@@ -489,3 +489,4 @@ b71e6a08899271f3f6c02af2abc3c72b2eaad797 jdk8u66-b11
8063e4ac4caabe1756f8393859ab56da3bb29122 jdk8u66-b15
01e7f91d993b341986f574d0eb3fbfe3d7cae68e jdk8u66-b16
1c93d260bf996e56d1e1f6d187aceadaa9a38d0c jdk8u72-b00
aec633bcb3af5382013c6c25b435564aba5bc3d4 jdk8u72-b01
src/share/classes/com/sun/tools/javac/resources/javac.properties
浏览文件 @
8a24c54d
...
...
@@ -232,9 +232,9 @@ These options are non-standard and subject to change without notice.
javac.msg.bug
=
\
An exception has occurred in the compiler ({0}).
\
Please file a bug a
t the Java Bug Database (http://bugreport.java.com/bugreport/
)
\
after checking the
database
for duplicates.
\
Include your program and the following diagnostic in your report.
Thank you.
Please file a bug a
gainst the Java compiler via the Java bug reporting page (http://bugreport.java.com
)
\
after checking the
Bug Database (http://bugs.java.com)
for duplicates.
\
Include your program and the following diagnostic in your report. Thank you.
javac.msg.io
=
\
\n\n
An input/output error occurred.
\n\
...
...
src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
浏览文件 @
8a24c54d
...
...
@@ -124,19 +124,14 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
* Returns the flags of a ClassSymbol in terms of javac's flags
*/
static
long
getFlags
(
ClassSymbol
clazz
)
{
while
(
true
)
{
try
{
return
clazz
.
flags
();
}
catch
(
CompletionFailure
ex
)
{
/* Quietly ignore completion failures.
* Note that a CompletionFailure can only
* occur as a result of calling complete(),
* which will always remove the current
* completer, leaving it to be null or
* follow-up completer. Thus the loop
* is guaranteed to eventually terminate.
*/
}
try
{
return
clazz
.
flags
();
}
catch
(
CompletionFailure
ex
)
{
/* Quietly ignore completion failures and try again - the type
* for which the CompletionFailure was thrown shouldn't be completed
* again by the completer that threw the CompletionFailure.
*/
return
getFlags
(
clazz
);
}
}
...
...
src/share/classes/com/sun/tools/javadoc/MethodDocImpl.java
浏览文件 @
8a24c54d
...
...
@@ -128,7 +128,7 @@ public class MethodDocImpl
t
.
hasTag
(
CLASS
);
t
=
env
.
types
.
supertype
(
t
))
{
ClassSymbol
c
=
(
ClassSymbol
)
t
.
tsym
;
for
(
Scope
.
Entry
e
=
c
.
members
(
).
lookup
(
sym
.
name
);
e
.
scope
!=
null
;
e
=
e
.
next
())
{
for
(
Scope
.
Entry
e
=
membersOf
(
c
).
lookup
(
sym
.
name
);
e
.
scope
!=
null
;
e
=
e
.
next
())
{
if
(
sym
.
overrides
(
e
.
sym
,
origin
,
env
.
types
,
true
))
{
return
TypeMaker
.
getType
(
env
,
t
);
}
...
...
@@ -160,7 +160,7 @@ public class MethodDocImpl
t
.
hasTag
(
CLASS
);
t
=
env
.
types
.
supertype
(
t
))
{
ClassSymbol
c
=
(
ClassSymbol
)
t
.
tsym
;
for
(
Scope
.
Entry
e
=
c
.
members
(
).
lookup
(
sym
.
name
);
e
.
scope
!=
null
;
e
=
e
.
next
())
{
for
(
Scope
.
Entry
e
=
membersOf
(
c
).
lookup
(
sym
.
name
);
e
.
scope
!=
null
;
e
=
e
.
next
())
{
if
(
sym
.
overrides
(
e
.
sym
,
origin
,
env
.
types
,
true
))
{
return
env
.
getMethodDoc
((
MethodSymbol
)
e
.
sym
);
}
...
...
@@ -169,6 +169,19 @@ public class MethodDocImpl
return
null
;
}
/**Retrieve members of c, ignoring any CompletionFailures that occur. */
private
Scope
membersOf
(
ClassSymbol
c
)
{
try
{
return
c
.
members
();
}
catch
(
CompletionFailure
cf
)
{
/* Quietly ignore completion failures and try again - the type
* for which the CompletionFailure was thrown shouldn't be completed
* again by the completer that threw the CompletionFailure.
*/
return
membersOf
(
c
);
}
}
/**
* Tests whether this method overrides another.
* The overridden method may be one declared in a superclass or
...
...
src/share/classes/com/sun/tools/javadoc/TypeMaker.java
浏览文件 @
8a24c54d
...
...
@@ -28,6 +28,7 @@ package com.sun.tools.javadoc;
import
com.sun.javadoc.*
;
import
com.sun.tools.javac.code.Symbol
;
import
com.sun.tools.javac.code.Symbol.ClassSymbol
;
import
com.sun.tools.javac.code.Symbol.CompletionFailure
;
import
com.sun.tools.javac.code.Type
;
import
com.sun.tools.javac.code.Type.ArrayType
;
import
com.sun.tools.javac.code.Type.ClassType
;
...
...
@@ -56,9 +57,22 @@ public class TypeMaker {
return
getType
(
env
,
t
,
errorToClassDoc
,
true
);
}
@SuppressWarnings
(
"fallthrough"
)
public
static
com
.
sun
.
javadoc
.
Type
getType
(
DocEnv
env
,
Type
t
,
boolean
errToClassDoc
,
boolean
considerAnnotations
)
{
try
{
return
getTypeImpl
(
env
,
t
,
errToClassDoc
,
considerAnnotations
);
}
catch
(
CompletionFailure
cf
)
{
/* Quietly ignore completion failures and try again - the type
* for which the CompletionFailure was thrown shouldn't be completed
* again by the completer that threw the CompletionFailure.
*/
return
getType
(
env
,
t
,
errToClassDoc
,
considerAnnotations
);
}
}
@SuppressWarnings
(
"fallthrough"
)
private
static
com
.
sun
.
javadoc
.
Type
getTypeImpl
(
DocEnv
env
,
Type
t
,
boolean
errToClassDoc
,
boolean
considerAnnotations
)
{
if
(
env
.
legacyDoclet
)
{
t
=
env
.
types
.
erasure
(
t
);
}
...
...
test/tools/javadoc/CompletionError.java
0 → 100644
浏览文件 @
8a24c54d
/*
* Copyright (c) 2015, 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 8135307
* @summary Check that CompletionFailures for missing classes are not incorrectly passed to
* the javadoc API clients.
* @modules jdk.javadoc
* @run main CompletionError
*/
import
java.io.File
;
import
java.net.URI
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.util.Arrays
;
import
java.util.List
;
import
javax.tools.JavaCompiler
;
import
javax.tools.JavaFileObject
;
import
javax.tools.SimpleJavaFileObject
;
import
javax.tools.ToolProvider
;
import
com.sun.javadoc.*
;
import
com.sun.tools.javadoc.Main
;
public
class
CompletionError
extends
Doclet
{
private
static
final
String
template
=
"public class CompletionErrorAuxiliary #extends CompletionErrorMissing# #implements CompletionErrorIntfMissing# {"
+
" #public CompletionErrorMissing tf;#"
+
" #public CompletionErrorMissing tm() { return null; }#"
+
" #public void tm(CompletionErrorMissing m) {}#"
+
" #public void tm() throws CompletionErrorExcMissing {}#"
+
" #public <T extends CompletionErrorMissing> void tm() {}#"
+
" public String toString() { return null; }"
+
"}"
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
JavaCompiler
compiler
=
ToolProvider
.
getSystemJavaCompiler
();
String
[]
templateParts
=
template
.
split
(
"#"
);
int
sources
=
templateParts
.
length
/
2
;
for
(
int
source
=
0
;
source
<
sources
;
source
++)
{
StringBuilder
testSource
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
templateParts
.
length
;
i
+=
2
)
{
testSource
.
append
(
templateParts
[
i
]);
if
(
i
==
2
*
source
)
{
testSource
.
append
(
templateParts
[
i
+
1
]);
}
}
test
=
0
;
testsDone
=
false
;
while
(!
testsDone
)
{
List
<
JavaSource
>
fileObjects
=
Arrays
.
asList
(
new
JavaSource
(
"CompletionErrorAuxiliary"
,
testSource
.
toString
()),
new
JavaSource
(
"CompletionErrorMissing"
,
"public class CompletionErrorMissing {}"
),
new
JavaSource
(
"CompletionErrorIntfMissing"
,
"public interface CompletionErrorIntfMissing {}"
),
new
JavaSource
(
"CompletionErrorExcMissing"
,
"public class CompletionErrorExcMissing extends Exception {}"
));
Boolean
result
=
compiler
.
getTask
(
null
,
null
,
null
,
Arrays
.
asList
(
"-d"
,
"."
),
null
,
fileObjects
).
call
();
if
(!
result
)
throw
new
Error
();
for
(
String
delete
:
new
String
[]
{
"CompletionErrorMissing.class"
,
"CompletionErrorIntfMissing.class"
,
"CompletionErrorExcMissing.class"
})
{
Files
.
delete
(
Paths
.
get
(
delete
));
}
// run javadoc:
if
(
Main
.
execute
(
"javadoc"
,
"CompletionError"
,
CompletionError
.
class
.
getClassLoader
(),
"-classpath"
,
"."
,
System
.
getProperty
(
"test.src"
,
"."
)
+
File
.
separatorChar
+
"CompletionError.java"
)
!=
0
)
throw
new
Error
();
}
}
}
private
static
int
test
;
private
static
boolean
testsDone
;
public
static
boolean
start
(
com
.
sun
.
javadoc
.
RootDoc
root
)
{
ClassDoc
aux
=
root
.
classNamed
(
"CompletionErrorAuxiliary"
);
if
(
aux
==
null
)
throw
new
AssertionError
(
"Cannot find CompletionErrorAuxiliary"
);
FieldDoc
tf
=
findField
(
aux
,
"tf"
);
MethodDoc
tm
=
findMethod
(
aux
,
"tm"
);
MethodDoc
cm
=
findMethod
(
aux
,
"toString"
);
switch
(
test
)
{
case
0
:
aux
.
superclass
();
break
;
case
1
:
aux
.
superclassType
();
break
;
case
2
:
aux
.
interfaces
();
break
;
case
3
:
aux
.
interfaceTypes
();
break
;
case
4
:
if
(
tf
!=
null
)
tf
.
type
();
break
;
case
5
:
if
(
tm
!=
null
)
tm
.
overriddenClass
();
break
;
case
6
:
if
(
tm
!=
null
)
tm
.
overriddenMethod
();
break
;
case
7
:
if
(
tm
!=
null
)
tm
.
overriddenType
();
break
;
case
8
:
if
(
tm
!=
null
)
{
for
(
Parameter
p
:
tm
.
parameters
())
{
p
.
type
();
}
}
break
;
case
9
:
if
(
tm
!=
null
)
tm
.
receiverType
();
break
;
case
10
:
if
(
tm
!=
null
)
tm
.
returnType
();
break
;
case
11
:
if
(
tm
!=
null
)
tm
.
thrownExceptionTypes
();
break
;
case
12
:
if
(
tm
!=
null
)
tm
.
thrownExceptions
();
break
;
case
13
:
if
(
tm
!=
null
)
{
for
(
TypeVariable
tv
:
tm
.
typeParameters
())
{
tv
.
bounds
();
}
}
break
;
case
14
:
if
(
cm
!=
null
)
cm
.
overriddenClass
();
break
;
case
15
:
if
(
cm
!=
null
)
cm
.
overriddenMethod
();
break
;
case
16
:
if
(
cm
!=
null
)
cm
.
overriddenType
();
testsDone
=
true
;
break
;
default
:
throw
new
IllegalStateException
(
"Unrecognized test!"
);
}
test
++;
return
true
;
}
private
static
MethodDoc
findMethod
(
ClassDoc
cd
,
String
name
)
{
for
(
MethodDoc
m
:
cd
.
methods
())
{
if
(
name
.
equals
(
m
.
name
()))
return
m
;
}
return
null
;
}
private
static
FieldDoc
findField
(
ClassDoc
cd
,
String
name
)
{
for
(
FieldDoc
m
:
cd
.
fields
())
{
if
(
name
.
equals
(
m
.
name
()))
return
m
;
}
return
null
;
}
static
class
JavaSource
extends
SimpleJavaFileObject
{
final
String
source
;
public
JavaSource
(
String
name
,
String
source
)
{
super
(
URI
.
create
(
"myfo:/"
+
name
+
".java"
),
JavaFileObject
.
Kind
.
SOURCE
);
this
.
source
=
source
;
}
@Override
public
CharSequence
getCharContent
(
boolean
ignoreEncodingErrors
)
{
return
source
;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录