Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
9ff5c485
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看板
提交
9ff5c485
编写于
2月 13, 2013
作者:
J
jfranck
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8007279: Rename javax.l.model.element.Element.getAnnotations(Class) to getAnnotationsByType(Class)
Reviewed-by: darcy, abuckley
上级
5f2aa967
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
19 deletion
+22
-19
src/share/classes/com/sun/tools/javac/code/Symbol.java
src/share/classes/com/sun/tools/javac/code/Symbol.java
+1
-1
src/share/classes/javax/lang/model/element/Element.java
src/share/classes/javax/lang/model/element/Element.java
+11
-8
test/tools/javac/processing/model/element/repeatingAnnotations/ElementRepAnnoTester.java
...el/element/repeatingAnnotations/ElementRepAnnoTester.java
+10
-10
未找到文件。
src/share/classes/com/sun/tools/javac/code/Symbol.java
浏览文件 @
9ff5c485
...
...
@@ -479,7 +479,7 @@ public abstract class Symbol implements Element {
}
// This method is part of the javax.lang.model API, do not use this in javac code.
public
<
A
extends
java
.
lang
.
annotation
.
Annotation
>
A
[]
getAnnotations
(
Class
<
A
>
annoType
)
{
public
<
A
extends
java
.
lang
.
annotation
.
Annotation
>
A
[]
getAnnotations
ByType
(
Class
<
A
>
annoType
)
{
return
JavacElements
.
getAnnotations
(
this
,
annoType
);
}
...
...
src/share/classes/javax/lang/model/element/Element.java
浏览文件 @
9ff5c485
...
...
@@ -149,12 +149,15 @@ public interface Element {
<
A
extends
Annotation
>
A
getAnnotation
(
Class
<
A
>
annotationType
);
/**
* Returns an array of all of this element's annotation for the
* specified type if such annotations are present, else an empty
* array. The annotation may be either inherited or directly
* present on this element. This method will look through a container
* annotation (if present) if the supplied annotation type is
* repeatable.
* Returns annotations that are <em>present</em> on this element.
*
* If there are no annotations <em>present</em> on this element, the return
* value is an array of length 0.
*
* The difference between this method and {@link #getAnnotation(Class)}
* is that this method detects if its argument is a <em>repeatable
* annotation type</em> (JLS 9.6), and if so, attempts to find one or more
* annotations of that type by "looking through" a container annotation.
*
* <p> The annotations returned by this method could contain an element
* whose value is of type {@code Class}.
...
...
@@ -189,14 +192,14 @@ public interface Element {
*
* @see #getAnnotationMirrors()
* @see #getAnnotation(java.lang.Class)
* @see java.lang.reflect.AnnotatedElement#getAnnotations
* @see java.lang.reflect.AnnotatedElement#getAnnotations
ByType
* @see EnumConstantNotPresentException
* @see AnnotationTypeMismatchException
* @see IncompleteAnnotationException
* @see MirroredTypeException
* @see MirroredTypesException
*/
<
A
extends
Annotation
>
A
[]
getAnnotations
(
Class
<
A
>
annotationType
);
<
A
extends
Annotation
>
A
[]
getAnnotations
ByType
(
Class
<
A
>
annotationType
);
/**
* Returns the modifiers of this element, excluding annotations.
...
...
test/tools/javac/processing/model/element/repeatingAnnotations/ElementRepAnnoTester.java
浏览文件 @
9ff5c485
...
...
@@ -366,7 +366,7 @@ public class ElementRepAnnoTester extends JavacTestingAbstractProcessor {
e
.
getEnclosingElement
().
toString
())
||
unofficialAnno
.
contains
(
e
.
getSimpleName
().
toString
()))
{
actualAnnosArgs
=
e
.
getAnnotations
(
Foo
.
class
);
actualAnnosArgs
=
e
.
getAnnotations
ByType
(
Foo
.
class
);
}
if
(
singularInheritedAnno
.
contains
(
e
.
getEnclosingElement
().
toString
())
...
...
@@ -376,25 +376,25 @@ public class ElementRepAnnoTester extends JavacTestingAbstractProcessor {
e
.
getEnclosingElement
().
toString
())
||
unofficialInheritedAnno
.
contains
(
e
.
getSimpleName
().
toString
()))
{
actualAnnosArgs
=
e
.
getAnnotations
(
FooInherited
.
class
);
actualAnnosArgs
=
e
.
getAnnotations
ByType
(
FooInherited
.
class
);
}
if
(
repeatableAnno
.
contains
(
e
.
getEnclosingElement
().
toString
())
||
repeatableAnno
.
contains
(
e
.
getSimpleName
().
toString
()))
{
actualAnnosArgs
=
e
.
getAnnotations
(
Bar
.
class
);
actualAnnosArgs
=
e
.
getAnnotations
ByType
(
Bar
.
class
);
}
if
(
repeatableInheritedAnno
.
contains
(
e
.
getEnclosingElement
().
toString
())
||
repeatableInheritedAnno
.
contains
(
e
.
getSimpleName
().
toString
()))
{
actualAnnosArgs
=
e
.
getAnnotations
(
BarInherited
.
class
);
actualAnnosArgs
=
e
.
getAnnotations
ByType
(
BarInherited
.
class
);
}
if
(
repeatableContainerInheritedAnno
.
contains
(
e
.
getEnclosingElement
().
toString
())
||
repeatableContainerInheritedAnno
.
contains
(
e
.
getSimpleName
().
toString
()))
{
actualAnnosArgs
=
e
.
getAnnotations
(
BarInheritedContainer
.
class
);
actualAnnosArgs
=
e
.
getAnnotations
ByType
(
BarInheritedContainer
.
class
);
}
return
actualAnnosArgs
;
}
...
...
@@ -406,31 +406,31 @@ public class ElementRepAnnoTester extends JavacTestingAbstractProcessor {
e
.
getEnclosingElement
().
toString
())
||
repeatableAnnoContainer
.
contains
(
e
.
getSimpleName
().
toString
()))
{
actualAnnosArgs
=
e
.
getAnnotations
(
BarContainer
.
class
);
actualAnnosArgs
=
e
.
getAnnotations
ByType
(
BarContainer
.
class
);
}
if
(
repeatableInheritedAnnoContainer
.
contains
(
e
.
getEnclosingElement
().
toString
())
||
repeatableInheritedAnnoContainer
.
contains
(
e
.
getSimpleName
().
toString
()))
{
actualAnnosArgs
=
e
.
getAnnotations
(
BarInheritedContainer
.
class
);
actualAnnosArgs
=
e
.
getAnnotations
ByType
(
BarInheritedContainer
.
class
);
}
if
(
repeatableContainerInheritedAnnoContainer
.
contains
(
e
.
getEnclosingElement
().
toString
())
||
repeatableContainerInheritedAnnoContainer
.
contains
(
e
.
getSimpleName
().
toString
()))
{
actualAnnosArgs
=
e
.
getAnnotations
(
BarInheritedContainerContainer
.
class
);
actualAnnosArgs
=
e
.
getAnnotations
ByType
(
BarInheritedContainerContainer
.
class
);
}
if
(
unofficialAnnoContainer
.
contains
(
e
.
getEnclosingElement
().
toString
())
||
unofficialAnnoContainer
.
contains
(
e
.
getSimpleName
().
toString
()))
{
actualAnnosArgs
=
e
.
getAnnotations
(
UnofficialContainer
.
class
);
actualAnnosArgs
=
e
.
getAnnotations
ByType
(
UnofficialContainer
.
class
);
}
if
(
unofficialInheritedAnnoContainer
.
contains
(
e
.
getEnclosingElement
().
toString
())
||
unofficialInheritedAnnoContainer
.
contains
(
e
.
getSimpleName
().
toString
()))
{
actualAnnosArgs
=
e
.
getAnnotations
(
UnofficialInheritedContainer
.
class
);
actualAnnosArgs
=
e
.
getAnnotations
ByType
(
UnofficialInheritedContainer
.
class
);
}
return
actualAnnosArgs
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录