This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 0f38c37 JUNEAU-197
0f38c37 is described below
commit 0f38c377fc94c5567ad5b42f5027133ede0b3dc1
Author: JamesBognar <[email protected]>
AuthorDate: Sun Mar 8 10:57:32 2020 -0400
JUNEAU-197
@BeanConfig(bpi) does not override @Bean(bpi)
---
.../juneau/reflection/ExecutableInfoTest.java | 6 +-
.../apache/juneau/reflection/MethodInfoTest.java | 68 +++++-------------
.../src/main/java/org/apache/juneau/BeanMeta.java | 2 +-
.../java/org/apache/juneau/BeanPropertyMeta.java | 4 +-
.../annotation/InvalidAnnotationException.java | 2 +-
.../juneau/httppart/bean/ResponseBeanMeta.java | 2 +-
.../java/org/apache/juneau/reflect/MethodInfo.java | 83 ++--------------------
.../rest/client/remote/RemoteMethodMeta.java | 4 +-
.../rest/client/remote/RemoteMethodReturn.java | 4 +-
.../apache/juneau/rest/BasicRestInfoProvider.java | 6 +-
.../apache/juneau/rest/ClientVersionMatcher.java | 2 +-
.../java/org/apache/juneau/rest/RestContext.java | 4 +-
.../org/apache/juneau/rest/RestContextBuilder.java | 2 +-
.../juneau/rest/RestMethodContextBuilder.java | 2 +-
.../org/apache/juneau/rest/SwaggerGenerator.java | 6 +-
15 files changed, 46 insertions(+), 151 deletions(-)
diff --git
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ExecutableInfoTest.java
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ExecutableInfoTest.java
index 7fe6310..7b64148 100644
---
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ExecutableInfoTest.java
+++
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ExecutableInfoTest.java
@@ -330,9 +330,9 @@ public class ExecutableInfoTest {
check(null, c_c1.getAnnotation(CA.class));
check(null, c_c2.getAnnotation(CA.class));
check("@CA()", c_c3.getAnnotation(CA.class));
- check(null, c_m1.getAnnotation(CA.class));
- check(null, c_m2.getAnnotation(CA.class));
- check("@CA()", c_m3.getAnnotation(CA.class));
+ check(null, c_m1.getLastAnnotation(CA.class));
+ check(null, c_m2.getLastAnnotation(CA.class));
+ check("@CA()", c_m3.getLastAnnotation(CA.class));
}
@Test
diff --git
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/MethodInfoTest.java
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/MethodInfoTest.java
index 3fa7c26..35d0fc6 100644
---
a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/MethodInfoTest.java
+++
b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/MethodInfoTest.java
@@ -204,24 +204,6 @@ public class MethodInfoTest {
c_a5 = ofm(C3.class, "a5");
@Test
- public void getAnnotations() {
- check("@A(a1),@A(C3),@A(C2),@A(C1)",
c_a1.getAnnotations(A.class));
- check("@A(a2b),@A(a2a),@A(C3),@A(C2),@A(C1)",
c_a2.getAnnotations(A.class));
- check("@A(a3),@A(C3),@A(C2),@A(C1)",
c_a3.getAnnotations(A.class));
- check("@A(a4),@A(C3),@A(C2),@A(C1)",
c_a4.getAnnotations(A.class));
- check("@A(C3),@A(C2),@A(C1)", c_a5.getAnnotations(A.class));
- }
-
- @Test
- public void getAnnotations_notExistent() {
- check("", c_a1.getAnnotations(AX.class));
- check("", c_a2.getAnnotations(AX.class));
- check("", c_a3.getAnnotations(AX.class));
- check("", c_a4.getAnnotations(AX.class));
- check("", c_a5.getAnnotations(AX.class));
- }
-
- @Test
public void getAnnotationsParentFirst() {
check("@A(C1),@A(C2),@A(C3),@A(a1)",
c_a1.getAnnotationsParentFirst(A.class));
check("@A(C1),@A(C2),@A(C3),@A(a2a),@A(a2b)",
c_a2.getAnnotationsParentFirst(A.class));
@@ -231,12 +213,12 @@ public class MethodInfoTest {
}
@Test
- public void appendAnnotations() {
- check("@A(a1),@A(C3),@A(C2),@A(C1)", c_a1.appendAnnotations(new
ArrayList<>(), A.class));
- check("@A(a2b),@A(a2a),@A(C3),@A(C2),@A(C1)",
c_a2.appendAnnotations(new ArrayList<>(), A.class));
- check("@A(a3),@A(C3),@A(C2),@A(C1)", c_a3.appendAnnotations(new
ArrayList<>(), A.class));
- check("@A(a4),@A(C3),@A(C2),@A(C1)", c_a4.appendAnnotations(new
ArrayList<>(), A.class));
- check("@A(C3),@A(C2),@A(C1)", c_a5.appendAnnotations(new
ArrayList<>(), A.class));
+ public void getAnnotationsParentFirst_notExistent() {
+ check("", c_a1.getAnnotationsParentFirst(AX.class));
+ check("", c_a2.getAnnotationsParentFirst(AX.class));
+ check("", c_a3.getAnnotationsParentFirst(AX.class));
+ check("", c_a4.getAnnotationsParentFirst(AX.class));
+ check("", c_a5.getAnnotationsParentFirst(AX.class));
}
@Test
@@ -250,29 +232,20 @@ public class MethodInfoTest {
@Test
public void getAnnotation() {
- check("@A(a1)", c_a1.getAnnotation(A.class));
- check("@A(a2b)", c_a2.getAnnotation(A.class));
- check("@A(a3)", c_a3.getAnnotation(A.class));
- check("@A(a4)", c_a4.getAnnotation(A.class));
- check(null, c_a5.getAnnotation(A.class));
+ check("@A(a1)", c_a1.getLastAnnotation(A.class));
+ check("@A(a2b)", c_a2.getLastAnnotation(A.class));
+ check("@A(a3)", c_a3.getLastAnnotation(A.class));
+ check("@A(a4)", c_a4.getLastAnnotation(A.class));
+ check(null, c_a5.getLastAnnotation(A.class));
}
@Test
public void getAnnotationAny() {
- check("@A(a1)", c_a1.getAnyAnnotation(AX.class, A.class));
- check("@A(a2b)", c_a2.getAnyAnnotation(AX.class, A.class));
- check("@A(a3)", c_a3.getAnyAnnotation(AX.class, A.class));
- check("@A(a4)", c_a4.getAnyAnnotation(AX.class, A.class));
- check(null, c_a5.getAnyAnnotation(AX.class, A.class));
- }
-
- @Test
- public void getAnnotationsMap() {
- check("@A(C3),@A(C2),@A(a1),@A(C1),@PA(10)",
c_a1.getAnnotationList(null));
- check("@A(C3),@A(a2b),@A(C2),@A(a2a),@A(C1),@PA(10)",
c_a2.getAnnotationList(null));
- check("@A(C3),@A(C2),@A(a3),@A(C1),@PA(10)",
c_a3.getAnnotationList(null));
- check("@A(a4),@A(C3),@A(C2),@A(C1),@PA(10)",
c_a4.getAnnotationList(null));
- check("@A(C3),@A(C2),@A(C1),@PA(10)",
c_a5.getAnnotationList(null));
+ check("@A(a1)", c_a1.getAnyLastAnnotation(AX.class, A.class));
+ check("@A(a2b)", c_a2.getAnyLastAnnotation(AX.class, A.class));
+ check("@A(a3)", c_a3.getAnyLastAnnotation(AX.class, A.class));
+ check("@A(a4)", c_a4.getAnyLastAnnotation(AX.class, A.class));
+ check(null, c_a5.getAnyLastAnnotation(AX.class, A.class));
}
@Test
@@ -319,15 +292,6 @@ public class MethodInfoTest {
cb_a5 = ofm(CB3.class, "a5");
@Test
- public void getConfigAnnotationsMap() {
- check("@AConfig(C3),@AConfig(C2),@AConfig(a1),@AConfig(C1)",
cb_a1.getAnnotationList(ConfigAnnotationFilter.INSTANCE));
-
check("@AConfig(C3),@AConfig(a2b),@AConfig(C2),@AConfig(a2a),@AConfig(C1)",
cb_a2.getAnnotationList(ConfigAnnotationFilter.INSTANCE));
- check("@AConfig(C3),@AConfig(C2),@AConfig(a3),@AConfig(C1)",
cb_a3.getAnnotationList(ConfigAnnotationFilter.INSTANCE));
- check("@AConfig(a4),@AConfig(C3),@AConfig(C2),@AConfig(C1)",
cb_a4.getAnnotationList(ConfigAnnotationFilter.INSTANCE));
- check("@AConfig(C3),@AConfig(C2),@AConfig(C1)",
cb_a5.getAnnotationList(ConfigAnnotationFilter.INSTANCE));
- }
-
- @Test
public void getConfigAnnotationsMapParentFirst() {
check("@AConfig(C1),@AConfig(a1),@AConfig(C2),@AConfig(C3)",
cb_a1.getAnnotationListParentFirst(ConfigAnnotationFilter.INSTANCE));
check("@AConfig(C1),@AConfig(a2a),@AConfig(C2),@AConfig(a2b),@AConfig(C3)",
cb_a2.getAnnotationListParentFirst(ConfigAnnotationFilter.INSTANCE));
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
index eaf4769..ea1666f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
@@ -681,7 +681,7 @@ public class BeanMeta<T> {
continue;
@SuppressWarnings("deprecation")
- BeanProperty px =
m.getAnnotation(BeanProperty.class);
+ BeanProperty px =
m.getLastAnnotation(BeanProperty.class);
Beanp p = ctx.getAnnotation(Beanp.class, m);
Name n2 = ctx.getAnnotation(Name.class, m);
if (! (m.isVisible(v) || px != null || p !=
null || n2 != null))
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
index 4f9784b..59342c3 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanPropertyMeta.java
@@ -204,7 +204,7 @@ public final class BeanPropertyMeta {
}
if (getter != null) {
- BeanProperty px =
MethodInfo.of(getter).getAnnotation(BeanProperty.class);
+ BeanProperty px =
MethodInfo.of(getter).getLastAnnotation(BeanProperty.class);
Beanp p = bc.getAnnotation(Beanp.class, getter);
if (rawTypeMeta == null)
rawTypeMeta = bc.resolveClassMeta(px,
p, getter.getGenericReturnType(), typeVarImpls);
@@ -230,7 +230,7 @@ public final class BeanPropertyMeta {
}
if (setter != null) {
- BeanProperty px =
MethodInfo.of(setter).getAnnotation(BeanProperty.class);
+ BeanProperty px =
MethodInfo.of(setter).getLastAnnotation(BeanProperty.class);
Beanp p = bc.getAnnotation(Beanp.class, setter);
if (rawTypeMeta == null)
rawTypeMeta = bc.resolveClassMeta(px,
p, setter.getGenericParameterTypes()[0], typeVarImpls);
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/InvalidAnnotationException.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/InvalidAnnotationException.java
index f4367ed..6f8fbed 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/InvalidAnnotationException.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/InvalidAnnotationException.java
@@ -44,7 +44,7 @@ public class InvalidAnnotationException extends
FormattedRuntimeException {
*/
@SafeVarargs
public static void assertNoInvalidAnnotations(MethodInfo m, Class<?
extends Annotation>...a) throws InvalidAnnotationException {
- Annotation aa = m.getAnyAnnotation(a);
+ Annotation aa = m.getAnyLastAnnotation(a);
if (aa != null)
throw new InvalidAnnotationException("@{0} annotation
cannot be used in a @{1} bean. Method=''{2}''", aa.getClass().getSimpleName(),
m.getDeclaringClass().getSimpleName(), m);
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/ResponseBeanMeta.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/ResponseBeanMeta.java
index 3f0ba6e..8f3ee3e 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/ResponseBeanMeta.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/bean/ResponseBeanMeta.java
@@ -162,7 +162,7 @@ public class ResponseBeanMeta {
if
(m.hasAnnotation(ResponseHeader.class)) {
assertNoArgs(m,
ResponseHeader.class);
assertReturnNotVoid(m,
ResponseHeader.class);
- HttpPartSchema s =
HttpPartSchema.create(m.getAnnotation(ResponseHeader.class),
m.getPropertyName());
+ HttpPartSchema s =
HttpPartSchema.create(m.getLastAnnotation(ResponseHeader.class),
m.getPropertyName());
headerMethods.put(s.getName(),
ResponseBeanPropertyMeta.create(RESPONSE_HEADER, s, m));
} else if
(m.hasAnnotation(ResponseStatus.class)) {
assertNoArgs(m,
ResponseHeader.class);
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/MethodInfo.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/MethodInfo.java
index 4460015..437c908 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/MethodInfo.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/MethodInfo.java
@@ -163,8 +163,8 @@ public final class MethodInfo extends ExecutableInfo
implements Comparable<Metho
* @return
* The annotation if found, or <jk>null</jk> if not.
*/
- public final <T extends Annotation> T getAnnotation(Class<T> a) {
- return getAnnotation(a, MetaProvider.DEFAULT);
+ public final <T extends Annotation> T getLastAnnotation(Class<T> a) {
+ return getLastAnnotation(a, MetaProvider.DEFAULT);
}
/**
@@ -181,7 +181,7 @@ public final class MethodInfo extends ExecutableInfo
implements Comparable<Metho
* @return
* The first annotation found, or <jk>null</jk> if it doesn't
exist.
*/
- public final <T extends Annotation> T getAnnotation(Class<T> a,
MetaProvider mp) {
+ public final <T extends Annotation> T getLastAnnotation(Class<T> a,
MetaProvider mp) {
if (a == null)
return null;
for (Method m2 : getMatching()) {
@@ -199,7 +199,7 @@ public final class MethodInfo extends ExecutableInfo
implements Comparable<Metho
* @return <jk>true</jk> if the specified annotation is present on this
method.
*/
public final boolean hasAnnotation(Class<? extends Annotation> a) {
- return getAnnotation(a) != null;
+ return getLastAnnotation(a) != null;
}
/**
@@ -208,18 +208,7 @@ public final class MethodInfo extends ExecutableInfo
implements Comparable<Metho
* <p>
* Searches all methods with the same signature on the parent classes
or interfaces
* and the return type on the method.
- *
- * @param a
- * The annotation to search for.
- * @return
- * A list of all matching annotations found in child-to-parent
order, or an empty list if none found.
- */
- public <T extends Annotation> List<T> getAnnotations(Class<T> a) {
- return appendAnnotations(new ArrayList<>(), a);
- }
-
- /**
- * Identical to {@link #getAnnotations(Class)} but returns the list in
reverse (parent-to-child) order.
+ * <br>Results are parent-to-child ordered.
*
* @param a
* The annotation to search for.
@@ -231,28 +220,6 @@ public final class MethodInfo extends ExecutableInfo
implements Comparable<Metho
}
/**
- * Finds and appends the specified annotation on the specified method
and methods on superclasses/interfaces to the specified
- * list.
- *
- * <p>
- * Results are ordered in child-to-parent order.
- *
- * @param l The list of annotations.
- * @param a The annotation.
- * @return The same list.
- */
- @SuppressWarnings("unchecked")
- public <T extends Annotation> List<T> appendAnnotations(List<T> l,
Class<T> a) {
- for (Method m2 : getMatching())
- for (Annotation a2 : m2.getDeclaredAnnotations())
- if (a.isInstance(a2))
- l.add((T)a2);
- getReturnType().resolved().appendAnnotations(l, a);
- declaringClass.appendAnnotations(l, a);
- return l;
- }
-
- /**
* Finds and appends the specified annotation on the specified class
and superclasses/interfaces to the specified
* list.
*
@@ -278,9 +245,9 @@ public final class MethodInfo extends ExecutableInfo
implements Comparable<Metho
* @return <jk>true</jk> if this method does not have any of the
specified annotations.
*/
@SafeVarargs
- public final Annotation getAnyAnnotation(Class<? extends
Annotation>...c) {
+ public final Annotation getAnyLastAnnotation(Class<? extends
Annotation>...c) {
for (Class<? extends Annotation> cc : c) {
- Annotation a = getAnnotation(cc);
+ Annotation a = getLastAnnotation(cc);
if (a != null)
return a;
}
@@ -293,28 +260,6 @@ public final class MethodInfo extends ExecutableInfo
implements Comparable<Metho
* <p>
* Annotations are appended in the following orders:
* <ol>
- * <li>On this method and matching methods ordered child-to-parent.
- * <li>On this class.
- * <li>On parent classes ordered child-to-parent.
- * <li>On interfaces ordered child-to-parent.
- * <li>On the package of this class.
- * </ol>
- *
- * @param filter
- * Optional filter to apply to limit which annotations are added
to the list.
- * <br>Can be <jk>null</jk> for no filtering.
- * @return A new {@link AnnotationList} object on every call.
- */
- public AnnotationList getAnnotationList(Predicate<AnnotationInfo<?>>
filter) {
- return appendAnnotationList(new AnnotationList(filter));
- }
-
- /**
- * Constructs an {@link AnnotationList} of all annotations found on
this method.
- *
- * <p>
- * Annotations are appended in the following orders:
- * <ol>
* <li>On the package of this class.
* <li>On interfaces ordered parent-to-child.
* <li>On parent classes ordered parent-to-child.
@@ -375,20 +320,6 @@ public final class MethodInfo extends ExecutableInfo
implements Comparable<Metho
return false;
}
- AnnotationList appendAnnotationList(AnnotationList al) {
- ClassInfo c = this.declaringClass;
- for (ClassInfo ci : c.getParents()) {
- appendMethodAnnotations(al, ci);
- appendAnnotations(al, ci);
- }
- for (ClassInfo ci : c.getInterfaces()) {
- appendMethodAnnotations(al, ci);
- appendAnnotations(al, ci);
- }
- appendAnnotations(al, c.getPackage());
- return al;
- }
-
AnnotationList appendAnnotationListParentFirst(AnnotationList al) {
ClassInfo c = this.declaringClass;
appendAnnotations(al, c.getPackage());
diff --git
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteMethodMeta.java
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteMethodMeta.java
index 61116db..a3524db 100644
---
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteMethodMeta.java
+++
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteMethodMeta.java
@@ -90,10 +90,10 @@ public class RemoteMethodMeta {
MethodInfo mi = MethodInfo.of(m);
- org.apache.juneau.rest.client.remote.RemoteMethod orm =
mi.getAnnotation(org.apache.juneau.rest.client.remote.RemoteMethod.class);
+ org.apache.juneau.rest.client.remote.RemoteMethod orm =
mi.getLastAnnotation(org.apache.juneau.rest.client.remote.RemoteMethod.class);
if (orm == null)
orm =
mi.getResolvedReturnType().getLastAnnotation(org.apache.juneau.rest.client.remote.RemoteMethod.class);
- RemoteMethod rm = mi.getAnnotation(RemoteMethod.class);
+ RemoteMethod rm =
mi.getLastAnnotation(RemoteMethod.class);
if (rm == null)
rm =
mi.getResolvedReturnType().getLastAnnotation(RemoteMethod.class);
diff --git
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteMethodReturn.java
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteMethodReturn.java
index 8e8a02c..2f5d6eb 100644
---
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteMethodReturn.java
+++
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteMethodReturn.java
@@ -38,10 +38,10 @@ public final class RemoteMethodReturn {
RemoteMethodReturn(MethodInfo m) {
ClassInfo rt = m.getReturnType();
- org.apache.juneau.rest.client.remote.RemoteMethod orm =
m.getAnnotation(org.apache.juneau.rest.client.remote.RemoteMethod.class);
+ org.apache.juneau.rest.client.remote.RemoteMethod orm =
m.getLastAnnotation(org.apache.juneau.rest.client.remote.RemoteMethod.class);
if (orm == null)
orm =
m.getResolvedReturnType().getLastAnnotation(org.apache.juneau.rest.client.remote.RemoteMethod.class);
- RemoteMethod rm = m.getAnnotation(RemoteMethod.class);
+ RemoteMethod rm = m.getLastAnnotation(RemoteMethod.class);
if (rm == null)
rm =
m.getResolvedReturnType().getLastAnnotation(RemoteMethod.class);
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java
index b42a1e1..2d3ba29 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java
@@ -173,7 +173,7 @@ public class BasicRestInfoProvider implements
RestInfoProvider {
public String getMethodSummary(Method method, RestRequest req) throws
Exception {
VarResolverSession vr = req.getVarResolverSession();
- String s =
MethodInfo.of(method).getAnnotation(RestMethod.class).summary();
+ String s =
MethodInfo.of(method).getLastAnnotation(RestMethod.class).summary();
if (s.isEmpty()) {
Operation o = getSwaggerOperation(method, req);
if (o != null)
@@ -229,7 +229,7 @@ public class BasicRestInfoProvider implements
RestInfoProvider {
public String getMethodDescription(Method method, RestRequest req)
throws Exception {
VarResolverSession vr = req.getVarResolverSession();
- String s =
joinnl(MethodInfo.of(method).getAnnotation(RestMethod.class).description());
+ String s =
joinnl(MethodInfo.of(method).getLastAnnotation(RestMethod.class).description());
if (s.isEmpty()) {
Operation o = getSwaggerOperation(method, req);
if (o != null)
@@ -407,7 +407,7 @@ public class BasicRestInfoProvider implements
RestInfoProvider {
if (s != null) {
Map<String,OperationMap> sp = s.getPaths();
if (sp != null) {
- Map<String,Operation> spp =
sp.get(fixMethodPath(MethodInfo.of(method).getAnnotation(RestMethod.class).path()));
+ Map<String,Operation> spp =
sp.get(fixMethodPath(MethodInfo.of(method).getLastAnnotation(RestMethod.class).path()));
if (spp != null)
return spp.get(req.getMethod());
}
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/ClientVersionMatcher.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/ClientVersionMatcher.java
index 629f2af..c3d5d01 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/ClientVersionMatcher.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/ClientVersionMatcher.java
@@ -40,7 +40,7 @@ public class ClientVersionMatcher extends RestMatcher {
*/
protected ClientVersionMatcher(String clientVersionHeader, MethodInfo
mi) {
this.clientVersionHeader = isEmpty(clientVersionHeader) ?
"X-Client-Version" : clientVersionHeader;
- RestMethod m = mi.getAnnotation(RestMethod.class);
+ RestMethod m = mi.getLastAnnotation(RestMethod.class);
range = new VersionRange(m.clientVersion());
}
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
index 57b7d61..26efcac 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
@@ -3767,7 +3767,7 @@ public final class RestContext extends BeanContext {
_destroyMethodParams = new ArrayList<>();
for (MethodInfo mi : rci.getPublicMethods()) {
- RestMethod a =
mi.getAnnotation(RestMethod.class);
+ RestMethod a =
mi.getLastAnnotation(RestMethod.class);
if (a != null) {
methodsFound.add(mi.getSimpleName() +
"," + emptyIfNull(firstNonEmpty(a.name(), a.method())) + "," +
fixMethodPath(a.path()));
try {
@@ -3852,7 +3852,7 @@ public final class RestContext extends BeanContext {
for (MethodInfo m : rci.getAllMethodsParentFirst()) {
if (m.isPublic() &&
m.hasAnnotation(RestHook.class)) {
- HookEvent he =
m.getAnnotation(RestHook.class).value();
+ HookEvent he =
m.getLastAnnotation(RestHook.class).value();
String sig = m.getSignature();
switch(he) {
case PRE_CALL: {
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
index 20c8871..0762279 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
@@ -216,7 +216,7 @@ public class RestContextBuilder extends BeanContextBuilder
implements ServletCon
Map<String,MethodInfo> map = new LinkedHashMap<>();
for (MethodInfo m : rci.getAllMethodsParentFirst()) {
- if (m.hasAnnotation(RestHook.class) &&
m.getAnnotation(RestHook.class).value() == HookEvent.INIT) {
+ if (m.hasAnnotation(RestHook.class) &&
m.getLastAnnotation(RestHook.class).value() == HookEvent.INIT) {
m.setAccessible();
String sig = m.getSignature();
if (! map.containsKey(sig))
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContextBuilder.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContextBuilder.java
index 3e4c0d7..9d973be 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContextBuilder.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContextBuilder.java
@@ -37,7 +37,7 @@ public class RestMethodContextBuilder extends
BeanContextBuilder {
try {
- RestMethod m = mi.getAnnotation(RestMethod.class);
+ RestMethod m = mi.getLastAnnotation(RestMethod.class);
if (m == null)
throw new RestServletException("@RestMethod
annotation not found on method ''{0}''", sig);
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/SwaggerGenerator.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/SwaggerGenerator.java
index 6217889..d50433b 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/SwaggerGenerator.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/SwaggerGenerator.java
@@ -279,7 +279,7 @@ final class SwaggerGenerator {
Method m = sm.method;
MethodInfo mi = MethodInfo.of(m);
- RestMethod rm = mi.getAnnotation(RestMethod.class);
+ RestMethod rm = mi.getLastAnnotation(RestMethod.class);
String mn = m.getName();
// Get the operation from the existing swagger so far.
@@ -444,7 +444,7 @@ final class SwaggerGenerator {
}
}
for (MethodInfo ecmi :
eci.getAllMethodsParentFirst()) {
- ResponseHeader a =
ecmi.getAnnotation(ResponseHeader.class);
+ ResponseHeader a =
ecmi.getLastAnnotation(ResponseHeader.class);
if (a == null)
a =
ecmi.getResolvedReturnType().getLastAnnotation(ResponseHeader.class);
if (a != null) {
@@ -474,7 +474,7 @@ final class SwaggerGenerator {
if
(mi.getReturnType().hasAnnotation(Response.class)) {
for (MethodInfo ecmi :
mi.getReturnType().getAllMethodsParentFirst()) {
if
(ecmi.hasAnnotation(ResponseHeader.class)) {
- ResponseHeader a =
ecmi.getAnnotation(ResponseHeader.class);
+ ResponseHeader a =
ecmi.getLastAnnotation(ResponseHeader.class);
String ha = a.name();
for (Integer code :
codes) {
ObjectMap
header = responses.getObjectMap(String.valueOf(code),
true).getObjectMap("headers", true).getObjectMap(ha, true);