Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
7ffa5c4c
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看板
提交
7ffa5c4c
编写于
1月 04, 2013
作者:
B
bpatel
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8004891: Check for abstract method in javadoc does not conform to the language model
Reviewed-by: jjg
上级
95359986
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
224 addition
and
17 deletion
+224
-17
src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
.../sun/tools/doclets/formats/html/AbstractMemberWriter.java
+11
-7
src/share/classes/com/sun/tools/javadoc/MethodDocImpl.java
src/share/classes/com/sun/tools/javadoc/MethodDocImpl.java
+1
-10
test/com/sun/javadoc/testAbstractMethod/TestAbstractMethod.java
...om/sun/javadoc/testAbstractMethod/TestAbstractMethod.java
+121
-0
test/com/sun/javadoc/testAbstractMethod/pkg/A.java
test/com/sun/javadoc/testAbstractMethod/pkg/A.java
+31
-0
test/com/sun/javadoc/testAbstractMethod/pkg/B.java
test/com/sun/javadoc/testAbstractMethod/pkg/B.java
+31
-0
test/com/sun/javadoc/testAbstractMethod/pkg/C.java
test/com/sun/javadoc/testAbstractMethod/pkg/C.java
+29
-0
未找到文件。
src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
浏览文件 @
7ffa5c4c
...
...
@@ -321,7 +321,8 @@ public abstract class AbstractMemberWriter {
code
.
addContent
(
" "
);
}
if
(
member
.
isMethod
())
{
if
(((
MethodDoc
)
member
).
isAbstract
())
{
if
(!(
member
.
containingClass
().
isInterface
())
&&
((
MethodDoc
)
member
).
isAbstract
())
{
code
.
addContent
(
"abstract "
);
}
// This check for isDefault() and the default modifier needs to be
...
...
@@ -329,7 +330,7 @@ public abstract class AbstractMemberWriter {
// method summary section. Once the default modifier is added
// to the Modifier list on DocEnv and once it is updated to use the
// javax.lang.model.element.Modifier, we will need to remove this.
else
if
(((
MethodDoc
)
member
).
isDefault
())
{
if
(((
MethodDoc
)
member
).
isDefault
())
{
code
.
addContent
(
"default "
);
}
}
...
...
@@ -561,11 +562,14 @@ public abstract class AbstractMemberWriter {
if
(
member
instanceof
MethodDoc
&&
!
member
.
isAnnotationTypeElement
())
{
int
methodType
=
(
member
.
isStatic
())
?
MethodTypes
.
STATIC
.
value
()
:
MethodTypes
.
INSTANCE
.
value
();
methodType
=
(
classdoc
.
isInterface
()
||
((
MethodDoc
)
member
).
isAbstract
())
?
methodType
|
MethodTypes
.
ABSTRACT
.
value
()
:
methodType
|
MethodTypes
.
CONCRETE
.
value
();
if
(((
MethodDoc
)
member
).
isDefault
())
{
methodType
=
methodType
|
MethodTypes
.
DEFAULT
.
value
();
if
(
member
.
containingClass
().
isInterface
())
{
methodType
=
(((
MethodDoc
)
member
).
isAbstract
())
?
methodType
|
MethodTypes
.
ABSTRACT
.
value
()
:
methodType
|
MethodTypes
.
DEFAULT
.
value
();
}
else
{
methodType
=
(((
MethodDoc
)
member
).
isAbstract
())
?
methodType
|
MethodTypes
.
ABSTRACT
.
value
()
:
methodType
|
MethodTypes
.
CONCRETE
.
value
();
}
if
(
Util
.
isDeprecated
(
member
)
||
Util
.
isDeprecated
(
classdoc
))
{
methodType
=
methodType
|
MethodTypes
.
DEPRECATED
.
value
();
...
...
src/share/classes/com/sun/tools/javadoc/MethodDocImpl.java
浏览文件 @
7ffa5c4c
...
...
@@ -86,16 +86,7 @@ public class MethodDocImpl
* Return true if this method is abstract
*/
public
boolean
isAbstract
()
{
//### This is dubious, but old 'javadoc' apparently does it.
//### I regard this as a bug and an obstacle to treating the
//### doclet API as a proper compile-time reflection facility.
//### (maddox 09/26/2000)
if
(
containingClass
().
isInterface
())
{
//### Don't force creation of ClassDocImpl for super here.
// Abstract modifier is implicit. Strip/canonicalize it.
return
false
;
}
return
Modifier
.
isAbstract
(
getModifiers
());
return
(
Modifier
.
isAbstract
(
getModifiers
())
&&
!
isDefault
());
}
/**
...
...
test/com/sun/javadoc/testAbstractMethod/TestAbstractMethod.java
0 → 100644
浏览文件 @
7ffa5c4c
/*
* Copyright (c) 2012, 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 8004891
* @summary Make sure that the abstract method is identified correctly
* if the abstract modifier is present explicitly or implicitly.
* @author bpatel
* @library ../lib/
* @build JavadocTester TestAbstractMethod
* @run main TestAbstractMethod
*/
public
class
TestAbstractMethod
extends
JavadocTester
{
//Test information.
private
static
final
String
BUG_ID
=
"8004891"
;
//Javadoc arguments.
private
static
final
String
[]
ARGS
=
new
String
[]
{
"-d"
,
BUG_ID
,
"-sourcepath"
,
SRC_DIR
,
"pkg"
};
//Input for string search tests.
private
static
final
String
[][]
TEST
=
{
{
BUG_ID
+
FS
+
"pkg"
+
FS
+
"A.html"
,
"<td class=\"colFirst\"><code>default void</code></td>"
},
{
BUG_ID
+
FS
+
"pkg"
+
FS
+
"A.html"
,
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>"
+
"All Methods</span><span class=\"tabEnd\"> </span></span>"
+
"<span id=\"t2\" class=\"tableTab\"><span>"
+
"<a href=\"javascript:show(2);\">Instance Methods</a></span>"
+
"<span class=\"tabEnd\"> </span></span><span id=\"t3\" "
+
"class=\"tableTab\"><span><a href=\"javascript:show(4);\">"
+
"Abstract Methods</a></span><span class=\"tabEnd\"> </span>"
+
"</span><span id=\"t5\" class=\"tableTab\"><span>"
+
"<a href=\"javascript:show(16);\">Default Methods</a></span>"
+
"<span class=\"tabEnd\"> </span></span></caption>"
},
{
BUG_ID
+
FS
+
"pkg"
+
FS
+
"B.html"
,
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>"
+
"All Methods</span><span class=\"tabEnd\"> </span></span>"
+
"<span id=\"t2\" class=\"tableTab\"><span>"
+
"<a href=\"javascript:show(2);\">Instance Methods</a></span>"
+
"<span class=\"tabEnd\"> </span></span><span id=\"t3\" "
+
"class=\"tableTab\"><span><a href=\"javascript:show(4);\">Abstract "
+
"Methods</a></span><span class=\"tabEnd\"> </span></span>"
+
"<span id=\"t4\" class=\"tableTab\"><span>"
+
"<a href=\"javascript:show(8);\">Concrete Methods</a></span>"
+
"<span class=\"tabEnd\"> </span></span></caption>"
},
{
BUG_ID
+
FS
+
"pkg"
+
FS
+
"B.html"
,
"<td class=\"colFirst\"><code>abstract void</code></td>"
},
{
BUG_ID
+
FS
+
"pkg"
+
FS
+
"C.html"
,
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>"
+
"All Methods</span><span class=\"tabEnd\"> </span></span>"
+
"<span id=\"t2\" class=\"tableTab\"><span>"
+
"<a href=\"javascript:show(2);\">Instance Methods</a></span>"
+
"<span class=\"tabEnd\"> </span></span>"
+
"<span id=\"t5\" class=\"tableTab\"><span>"
+
"<a href=\"javascript:show(16);\">Default Methods</a></span>"
+
"<span class=\"tabEnd\"> </span></span></caption>"
},
{
BUG_ID
+
FS
+
"pkg"
+
FS
+
"C.html"
,
"<td class=\"colFirst\"><code>default void</code></td>"
}
};
private
static
final
String
[][]
NEGATED_TEST
=
{
{
BUG_ID
+
FS
+
"pkg"
+
FS
+
"A.html"
,
"<td class=\"colFirst\"><code>abstract void</code></td>"
},
{
BUG_ID
+
FS
+
"pkg"
+
FS
+
"B.html"
,
"<span><a href=\"javascript:show(16);\">Default Methods</a></span>"
+
"<span class=\"tabEnd\"> </span>"
},
{
BUG_ID
+
FS
+
"pkg"
+
FS
+
"B.html"
,
"<td class=\"colFirst\"><code>default void</code></td>"
},
{
BUG_ID
+
FS
+
"pkg"
+
FS
+
"C.html"
,
"<span><a href=\"javascript:show(4);\">Abstract Methods</a></span>"
+
"<span class=\"tabEnd\"> </span>"
}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public
static
void
main
(
String
[]
args
)
{
TestAbstractMethod
tester
=
new
TestAbstractMethod
();
run
(
tester
,
ARGS
,
TEST
,
NEGATED_TEST
);
tester
.
printSummary
();
}
/**
* {@inheritDoc}
*/
public
String
getBugId
()
{
return
BUG_ID
;
}
/**
* {@inheritDoc}
*/
public
String
getBugName
()
{
return
getClass
().
getName
();
}
}
test/com/sun/javadoc/testAbstractMethod/pkg/A.java
0 → 100644
浏览文件 @
7ffa5c4c
/*
* Copyright (c) 2012, 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.
*/
package
pkg
;
public
interface
A
{
public
void
method1
();
public
default
void
defaultMethod
()
{
}
}
test/com/sun/javadoc/testAbstractMethod/pkg/B.java
0 → 100644
浏览文件 @
7ffa5c4c
/*
* Copyright (c) 2012, 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.
*/
package
pkg
;
public
abstract
class
B
{
public
abstract
void
method1
();
public
void
method2
()
{
}
}
test/com/sun/javadoc/testAbstractMethod/pkg/C.java
0 → 100644
浏览文件 @
7ffa5c4c
/*
* Copyright (c) 2012, 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.
*/
package
pkg
;
public
interface
C
{
public
default
void
onlyMethod
()
{
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录