-
Bug
-
Resolution: Unresolved
-
P3
-
7u45, 8
The ordering of annotations are not always stable, for a declaration:
@Foo(0)
@FooContainer(value={@Foo(1),@Foo(2)})
class A {}
A.class.getAnnotations() will vary the order of Foo and FooContainer as shown by the run of the simple reproducer attached:
$ java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
jbf-mba:t jbf$ while java T; do echo .; done
.
.
.
.
.
.
.
Got: [@Foo(value=0), @FooContainer(value=[@Foo(value=1), @Foo(value=2)])]
Expecting: [@FooContainer(value=[@Foo(value=1), @Foo(value=2)]), @Foo(value=0)]
Exception in thread "main" java.lang.RuntimeException: Woha
at T.main(T.java:27)
@Foo(0)
@FooContainer(value={@Foo(1),@Foo(2)})
class A {}
A.class.getAnnotations() will vary the order of Foo and FooContainer as shown by the run of the simple reproducer attached:
$ java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
jbf-mba:t jbf$ while java T; do echo .; done
.
.
.
.
.
.
.
Got: [@Foo(value=0), @FooContainer(value=[@Foo(value=1), @Foo(value=2)])]
Expecting: [@FooContainer(value=[@Foo(value=1), @Foo(value=2)]), @Foo(value=0)]
Exception in thread "main" java.lang.RuntimeException: Woha
at T.main(T.java:27)
- duplicates
-
JDK-8202652 Class.getDeclaredAnnotations presents annotations parameters in random order
- Closed