Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
a0a23261
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看板
提交
a0a23261
编写于
2月 26, 2013
作者:
D
darcy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8008279: Remove InvalidContainerAnnotationError.java
Reviewed-by: jfranck
上级
5c39a151
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
142 deletion
+10
-142
src/share/classes/java/lang/annotation/InvalidContainerAnnotationError.java
...java/lang/annotation/InvalidContainerAnnotationError.java
+0
-128
src/share/classes/java/lang/reflect/AnnotatedElement.java
src/share/classes/java/lang/reflect/AnnotatedElement.java
+4
-4
src/share/classes/sun/reflect/annotation/AnnotationSupport.java
...are/classes/sun/reflect/annotation/AnnotationSupport.java
+6
-10
未找到文件。
src/share/classes/java/lang/annotation/InvalidContainerAnnotationError.java
已删除
100644 → 0
浏览文件 @
5c39a151
/*
* Copyright (c) 2012, 2013, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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
java.lang.annotation
;
import
java.util.Objects
;
/**
* Thrown to indicate that an annotation type expected to act as a
* container for another annotation type by virture of an @Repeatable
* annotation, does not act as a container.
*
* @see java.lang.reflect.AnnotatedElement
* @since 1.8
* @jls 9.6 Annotation Types
* @jls 9.7 Annotations
*/
public
class
InvalidContainerAnnotationError
extends
AnnotationFormatError
{
private
static
final
long
serialVersionUID
=
5023L
;
/**
* The instance of the erroneous container.
*/
private
transient
Annotation
container
;
/**
* The type of the annotation that should be contained in the
* container.
*/
private
transient
Class
<?
extends
Annotation
>
annotationType
;
/**
* Constructs a new InvalidContainerAnnotationError with the
* specified detail message.
*
* @param message the detail message.
*/
public
InvalidContainerAnnotationError
(
String
message
)
{
super
(
message
);
}
/**
* Constructs a new InvalidContainerAnnotationError with the specified
* detail message and cause. Note that the detail message associated
* with {@code cause} is <i>not</i> automatically incorporated in
* this error's detail message.
*
* @param message the detail message
* @param cause the cause, may be {@code null}
*/
public
InvalidContainerAnnotationError
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
/**
* Constructs a new InvalidContainerAnnotationError with the
* specified cause and a detail message of {@code (cause == null ?
* null : cause.toString())} (which typically contains the class
* and detail message of {@code cause}).
*
* @param cause the cause, may be {@code null}
*/
public
InvalidContainerAnnotationError
(
Throwable
cause
)
{
super
(
cause
);
}
/**
* Constructs InvalidContainerAnnotationError for the specified
* container instance and contained annotation type.
*
* @param message the detail message
* @param cause the cause, may be {@code null}
* @param container the erroneous container instance, may be
* {@code null}
* @param annotationType the annotation type intended to be
* contained, may be {@code null}
*/
public
InvalidContainerAnnotationError
(
String
message
,
Throwable
cause
,
Annotation
container
,
Class
<?
extends
Annotation
>
annotationType
)
{
super
(
message
,
cause
);
this
.
container
=
container
;
this
.
annotationType
=
annotationType
;
}
/**
* Returns the erroneous container.
*
* @return the erroneous container, may return {@code null}
*/
public
Annotation
getContainer
()
{
return
container
;
}
/**
* Returns the annotation type intended to be contained. Returns
* {@code null} if the annotation type intended to be contained
* could not be determined.
*
* @return the annotation type intended to be contained, or {@code
* null} if unknown
*/
public
Class
<?
extends
Annotation
>
getAnnotationType
()
{
return
annotationType
;
}
}
src/share/classes/java/lang/reflect/AnnotatedElement.java
浏览文件 @
a0a23261
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
package
java.lang.reflect
;
package
java.lang.reflect
;
import
java.lang.annotation.Annotation
;
import
java.lang.annotation.Annotation
;
import
java.lang.annotation.AnnotationFormatError
;
/**
/**
* Represents an annotated element of the program currently running in this
* Represents an annotated element of the program currently running in this
...
@@ -86,8 +87,8 @@ import java.lang.annotation.Annotation;
...
@@ -86,8 +87,8 @@ import java.lang.annotation.Annotation;
*
*
* <p>Attempting to read annotations of a repeatable annotation type T
* <p>Attempting to read annotations of a repeatable annotation type T
* that are contained in an annotation whose type is not, in fact, the
* that are contained in an annotation whose type is not, in fact, the
* containing annotation type of T
will result in an
* containing annotation type of T
, will result in an {@link
*
InvalidContainerAnnotationError
.
*
AnnotationFormatError}
.
*
*
* <p>Finally, attempting to read a member whose definition has evolved
* <p>Finally, attempting to read a member whose definition has evolved
* incompatibly will result in a {@link
* incompatibly will result in a {@link
...
@@ -96,10 +97,9 @@ import java.lang.annotation.Annotation;
...
@@ -96,10 +97,9 @@ import java.lang.annotation.Annotation;
*
*
* @see java.lang.EnumConstantNotPresentException
* @see java.lang.EnumConstantNotPresentException
* @see java.lang.TypeNotPresentException
* @see java.lang.TypeNotPresentException
* @see
java.lang.annotation.
AnnotationFormatError
* @see AnnotationFormatError
* @see java.lang.annotation.AnnotationTypeMismatchException
* @see java.lang.annotation.AnnotationTypeMismatchException
* @see java.lang.annotation.IncompleteAnnotationException
* @see java.lang.annotation.IncompleteAnnotationException
* @see java.lang.annotation.InvalidContainerAnnotationError
* @since 1.5
* @since 1.5
* @author Josh Bloch
* @author Josh Bloch
*/
*/
...
...
src/share/classes/sun/reflect/annotation/AnnotationSupport.java
浏览文件 @
a0a23261
...
@@ -86,11 +86,11 @@ public final class AnnotationSupport {
...
@@ -86,11 +86,11 @@ public final class AnnotationSupport {
Class
<?
extends
Annotation
>
containerClass
=
containerInstance
.
annotationType
();
Class
<?
extends
Annotation
>
containerClass
=
containerInstance
.
annotationType
();
AnnotationType
annoType
=
AnnotationType
.
getInstance
(
containerClass
);
AnnotationType
annoType
=
AnnotationType
.
getInstance
(
containerClass
);
if
(
annoType
==
null
)
if
(
annoType
==
null
)
throw
new
InvalidContainerAnnotation
Error
(
containerInstance
+
" is an invalid container for repeating annotations"
);
throw
new
AnnotationFormat
Error
(
containerInstance
+
" is an invalid container for repeating annotations"
);
Method
m
=
annoType
.
members
().
get
(
"value"
);
Method
m
=
annoType
.
members
().
get
(
"value"
);
if
(
m
==
null
)
if
(
m
==
null
)
throw
new
InvalidContainerAnnotation
Error
(
containerInstance
+
throw
new
AnnotationFormat
Error
(
containerInstance
+
" is an invalid container for repeating annotations"
);
" is an invalid container for repeating annotations"
);
m
.
setAccessible
(
true
);
m
.
setAccessible
(
true
);
...
@@ -103,11 +103,9 @@ public final class AnnotationSupport {
...
@@ -103,11 +103,9 @@ public final class AnnotationSupport {
IllegalArgumentException
|
// parameters doesn't match
IllegalArgumentException
|
// parameters doesn't match
InvocationTargetException
|
// the value method threw an exception
InvocationTargetException
|
// the value method threw an exception
ClassCastException
e
)
{
// well, a cast failed ...
ClassCastException
e
)
{
// well, a cast failed ...
throw
new
InvalidContainerAnnotation
Error
(
throw
new
AnnotationFormat
Error
(
containerInstance
+
" is an invalid container for repeating annotations"
,
containerInstance
+
" is an invalid container for repeating annotations"
,
e
,
e
);
containerInstance
,
null
);
}
}
}
}
...
@@ -129,12 +127,10 @@ public final class AnnotationSupport {
...
@@ -129,12 +127,10 @@ public final class AnnotationSupport {
return
l
;
return
l
;
}
catch
(
ClassCastException
|
}
catch
(
ClassCastException
|
NullPointerException
e
)
{
NullPointerException
e
)
{
throw
new
InvalidContainerAnnotation
Error
(
throw
new
AnnotationFormat
Error
(
String
.
format
(
"%s is an invalid container for repeating annotations of type: %s"
,
String
.
format
(
"%s is an invalid container for repeating annotations of type: %s"
,
containerInstance
,
annotationClass
),
containerInstance
,
annotationClass
),
e
,
e
);
containerInstance
,
annotationClass
);
}
}
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录