Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
5cd4f8fa
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5cd4f8fa
编写于
12月 06, 2013
作者:
D
darcy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8023471: Add compatibility note to AnnotatedElement
Reviewed-by: smarks, jfranck, abuckley
上级
24c22ded
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
75 addition
and
1 deletion
+75
-1
src/share/classes/java/lang/annotation/Annotation.java
src/share/classes/java/lang/annotation/Annotation.java
+4
-0
src/share/classes/java/lang/reflect/AnnotatedElement.java
src/share/classes/java/lang/reflect/AnnotatedElement.java
+71
-1
未找到文件。
src/share/classes/java/lang/annotation/Annotation.java
浏览文件 @
5cd4f8fa
...
...
@@ -34,6 +34,10 @@ package java.lang.annotation;
* More information about annotation types can be found in section 9.6 of
* <cite>The Java™ Language Specification</cite>.
*
* The {@link java.lang.reflect.AnnotatedElement} interface discusses
* compatibility concerns when evolving an annotation type from being
* non-repeatable to being repeatable.
*
* @author Josh Bloch
* @since 1.5
*/
...
...
src/share/classes/java/lang/reflect/AnnotatedElement.java
浏览文件 @
5cd4f8fa
...
...
@@ -135,7 +135,77 @@ import sun.reflect.annotation.AnnotationType;
* annotations on <i>E</i> are directly present on <i>E</i> in place
* of their container annotation, in the order in which they appear in
* the value element of the container annotation.
*
* <p>There are several compatibility concerns to keep in mind if an
* annotation type <i>T</i> is originally <em>not</em> repeatable and
* later modified to be repeatable.
*
* The containing annotation type for <i>T</i> is <i>TC</i>.
*
* <ul>
*
* <li>Modifying <i>T</i> to be repeatable is source and binary
* compatible with existing uses of <i>T</i> and with existing uses
* of <i>TC</i>.
*
* That is, for source compatibility, source code with annotations of
* type <i>T</i> or of type <i>TC</i> will still compile. For binary
* compatibility, class files with annotations of type <i>T</i> or of
* type <i>TC</i> (or with other kinds of uses of type <i>T</i> or of
* type <i>TC</i>) will link against the modified version of <i>T</i>
* if they linked against the earlier version.
*
* (An annotation type <i>TC</i> may informally serve as an acting
* containing annotation type before <i>T</i> is modified to be
* formally repeatable. Alternatively, when <i>T</i> is made
* repeatable, <i>TC</i> can be introduced as a new type.)
*
* <li>If an annotation type <i>TC</i> is present on an element, and
* <i>T</i> is modified to be repeatable with <i>TC</i> as its
* containing annotation type then:
*
* <ul>
*
* <li>The change to <i>T</i> is behaviorally compatible with respect
* to the {@code get[Declared]Annotation(Class<T>)} (called with an
* argument of <i>T</i> or <i>TC</i>) and {@code
* get[Declared]Annotations()} methods because the results of the
* methods will not change due to <i>TC</i> becoming the containing
* annotation type for <i>T</i>.
*
* <li>The change to <i>T</i> changes the results of the {@code
* get[Declared]AnnotationsByType(Class<T>)} methods called with an
* argument of <i>T</i>, because those methods will now recognize an
* annotation of type <i>TC</i> as a container annotation for <i>T</i>
* and will "look through" it to expose annotations of type <i>T</i>.
*
* </ul>
*
* <li>If an annotation of type <i>T</i> is present on an
* element and <i>T</i> is made repeatable and more annotations of
* type <i>T</i> are added to the element:
*
* <ul>
*
* <li> The addition of the annotations of type <i>T</i> is both
* source compatible and binary compatible.
*
* <li>The addition of the annotations of type <i>T</i> changes the results
* of the {@code get[Declared]Annotation(Class<T>)} methods and {@code
* get[Declared]Annotations()} methods, because those methods will now
* only see a container annotation on the element and not see an
* annotation of type <i>T</i>.
*
* <li>The addition of the annotations of type <i>T</i> changes the
* results of the {@code get[Declared]AnnotationsByType(Class<T>)}
* methods, because their results will expose the additional
* annotations of type <i>T</i> whereas previously they exposed only a
* single annotation of type <i>T</i>.
*
* </ul>
*
* </ul>
*
* <p>If an annotation returned by a method in this interface contains
* (directly or indirectly) a {@link Class}-valued member referring to
* a class that is not accessible in this VM, attempting to read the class
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录