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 f3240aa  Collections usage optimizations.
f3240aa is described below

commit f3240aafa08aace41047f03b67875e20bffbedf7
Author: JamesBognar <[email protected]>
AuthorDate: Sun Mar 6 10:08:05 2022 -0500

    Collections usage optimizations.
---
 .../java/org/apache/juneau/AnnotationProvider.java | 165 ++++++++++++++++++---
 .../java/org/apache/juneau/BeanPropertyMeta.java   |   2 +-
 .../src/main/java/org/apache/juneau/Context.java   |  60 +++++++-
 .../java/org/apache/juneau/reflect/ClassInfo.java  |   8 +-
 .../org/apache/juneau/reflect/ConstructorInfo.java |   2 +-
 .../java/org/apache/juneau/reflect/FieldInfo.java  |   2 +-
 .../java/org/apache/juneau/reflect/MethodInfo.java |   2 +-
 .../juneau/http/header/BasicLongHeader_Test.java   |   1 -
 8 files changed, 207 insertions(+), 35 deletions(-)

diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/AnnotationProvider.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/AnnotationProvider.java
index f7d4bcf..c9e6462 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/AnnotationProvider.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/AnnotationProvider.java
@@ -49,82 +49,152 @@ public interface AnnotationProvider {
                @Override /* MetaProvider */
                public <A extends Annotation> void forEachAnnotation(Class<A> 
type, Class<?> onClass, Predicate<A> filter, Consumer<A> action) {
                        if (type != null && onClass != null)
-                               for (A a : 
(A[])classAnnotationCache.get(onClass,type))
+                               for (A a : annotations(type, onClass))
                                        consume(filter, action, a);
                }
 
                @Override /* MetaProvider */
-               public <A extends Annotation> A getAnnotation(Class<A> type, 
Class<?> onClass, Predicate<A> filter) {
+               public <A extends Annotation> A firstAnnotation(Class<A> type, 
Class<?> onClass, Predicate<A> filter) {
                        if (type != null && onClass != null)
-                               for (A a : 
(A[])classAnnotationCache.get(onClass,type))
+                               for (A a : annotations(type, onClass))
                                        if (passes(filter, a))
                                                return a;
                        return null;
                }
 
                @Override /* MetaProvider */
+               public <A extends Annotation> A lastAnnotation(Class<A> type, 
Class<?> onClass, Predicate<A> filter) {
+                       A x = null;
+                       if (type != null && onClass != null)
+                               for (A a : annotations(type, onClass))
+                                       if (passes(filter, a))
+                                               x = a;
+                       return x;
+               }
+
+               @Override /* MetaProvider */
                public <A extends Annotation> void 
forEachDeclaredAnnotation(Class<A> type, Class<?> onClass, Predicate<A> filter, 
Consumer<A> action) {
                        if (type != null && onClass != null)
-                               for (A a : 
(A[])declaredClassAnnotationCache.get(onClass,type))
+                               for (A a : declaredAnnotations(type, onClass))
                                        consume(filter, action, a);
                }
 
                @Override /* MetaProvider */
-               public <A extends Annotation> A getDeclaredAnnotation(Class<A> 
type, Class<?> onClass, Predicate<A> filter) {
+               public <A extends Annotation> A 
firstDeclaredAnnotation(Class<A> type, Class<?> onClass, Predicate<A> filter) {
                        if (type != null && onClass != null)
-                               for (A a : 
(A[])declaredClassAnnotationCache.get(onClass,type))
+                               for (A a : declaredAnnotations(type, onClass))
                                        if (passes(filter, a))
                                                return a;
                        return null;
                }
 
                @Override /* MetaProvider */
+               public <A extends Annotation> A lastDeclaredAnnotation(Class<A> 
type, Class<?> onClass, Predicate<A> filter) {
+                       A x = null;
+                       if (type != null && onClass != null)
+                               for (A a : declaredAnnotations(type, onClass))
+                                       if (passes(filter, a))
+                                               x = a;
+                       return x;
+               }
+
+               @Override /* MetaProvider */
                public <A extends Annotation> void forEachAnnotation(Class<A> 
type, Method onMethod, Predicate<A> filter, Consumer<A> action) {
                        if (type != null && onMethod != null)
-                               for (A a : 
(A[])methodAnnotationCache.get(onMethod,type))
+                               for (A a : annotations(type, onMethod))
                                        consume(filter, action, a);
                }
 
                @Override /* MetaProvider */
-               public <A extends Annotation> A getAnnotation(Class<A> type, 
Method onMethod, Predicate<A> filter) {
+               public <A extends Annotation> A firstAnnotation(Class<A> type, 
Method onMethod, Predicate<A> filter) {
                        if (type != null && onMethod != null)
-                               for (A a : 
(A[])methodAnnotationCache.get(onMethod,type))
+                               for (A a : annotations(type, onMethod))
                                        if (passes(filter, a))
                                                return a;
                        return null;
                }
 
                @Override /* MetaProvider */
+               public <A extends Annotation> A lastAnnotation(Class<A> type, 
Method onMethod, Predicate<A> filter) {
+                       A x = null;
+                       if (type != null && onMethod != null)
+                               for (A a : annotations(type, onMethod))
+                                       if (passes(filter, a))
+                                               x = a;
+                       return x;
+               }
+
+               @Override /* MetaProvider */
                public <A extends Annotation> void forEachAnnotation(Class<A> 
type, Field onField, Predicate<A> filter, Consumer<A> action) {
                        if (type != null && onField != null)
-                               for (A a : 
(A[])fieldAnnotationCache.get(onField,type))
+                               for (A a : annotations(type, onField))
                                        consume(filter, action, a);
                }
 
                @Override /* MetaProvider */
-               public <A extends Annotation> A getAnnotation(Class<A> type, 
Field onField, Predicate<A> filter) {
+               public <A extends Annotation> A firstAnnotation(Class<A> type, 
Field onField, Predicate<A> filter) {
                        if (type != null && onField != null)
-                               for (A a : 
(A[])fieldAnnotationCache.get(onField,type))
+                               for (A a : annotations(type, onField))
                                        if (passes(filter, a))
                                                return a;
                        return null;
                }
 
                @Override /* MetaProvider */
+               public <A extends Annotation> A lastAnnotation(Class<A> type, 
Field onField, Predicate<A> filter) {
+                       A x = null;
+                       if (type != null && onField != null)
+                               for (A a : annotations(type, onField))
+                                       if (passes(filter, a))
+                                               x = a;
+                       return x;
+               }
+
+               @Override /* MetaProvider */
                public <A extends Annotation> void forEachAnnotation(Class<A> 
type, Constructor<?> onConstructor, Predicate<A> filter, Consumer<A> action) {
                        if (type != null && onConstructor != null)
-                               for (A a : 
(A[])constructorAnnotationCache.get(onConstructor,type))
+                               for (A a : annotations(type, onConstructor))
                                        consume(filter, action, a);
                }
 
                @Override /* MetaProvider */
-               public <A extends Annotation> A getAnnotation(Class<A> type, 
Constructor<?> onConstructor, Predicate<A> filter) {
+               public <A extends Annotation> A firstAnnotation(Class<A> type, 
Constructor<?> onConstructor, Predicate<A> filter) {
                        if (type != null && onConstructor != null)
-                               for (A a : 
(A[])constructorAnnotationCache.get(onConstructor,type))
+                               for (A a : annotations(type, onConstructor))
                                        if (passes(filter, a))
                                                return a;
                        return null;
                }
+
+               @Override /* MetaProvider */
+               public <A extends Annotation> A lastAnnotation(Class<A> type, 
Constructor<?> onConstructor, Predicate<A> filter) {
+                       A x = null;
+                       if (type != null && onConstructor != null)
+                               for (A a : annotations(type, onConstructor))
+                                       if (passes(filter, a))
+                                               x = a;
+                       return x;
+               }
+
+               private <A extends Annotation> A[] annotations(Class<A> type, 
Class<?> onClass) {
+                       return (A[])classAnnotationCache.get(onClass, type);
+               }
+
+               private <A extends Annotation> A[] declaredAnnotations(Class<A> 
type, Class<?> onClass) {
+                       return (A[])declaredClassAnnotationCache.get(onClass, 
type);
+               }
+
+               private <A extends Annotation> A[] annotations(Class<A> type, 
Method onMethod) {
+                       return (A[])methodAnnotationCache.get(onMethod, type);
+               }
+
+               private <A extends Annotation> A[] annotations(Class<A> type, 
Field onField) {
+                       return (A[])fieldAnnotationCache.get(onField, type);
+               }
+
+               private <A extends Annotation> A[] annotations(Class<A> type, 
Constructor<?> onConstructor) {
+                       return 
(A[])constructorAnnotationCache.get(onConstructor, type);
+               }
        };
 
        /**
@@ -143,9 +213,19 @@ public interface AnnotationProvider {
         * @param type The annotation type to find.
         * @param onClass The class to search on.
         * @param filter A predicate to apply to the entries to determine if 
value should be used.  Can be <jk>null</jk>.
-        * @return The annotations in an unmodifiable list, or an empty list if 
not found.
+        * @return The matched annotation, or <jk>null</jk> if not found.
         */
-       <A extends Annotation> A getAnnotation(Class<A> type, Class<?> onClass, 
Predicate<A> filter);
+       <A extends Annotation> A firstAnnotation(Class<A> type, Class<?> 
onClass, Predicate<A> filter);
+
+       /**
+        * Finds the last matching annotation on the specified class.
+        *
+        * @param type The annotation type to find.
+        * @param onClass The class to search on.
+        * @param filter A predicate to apply to the entries to determine if 
value should be used.  Can be <jk>null</jk>.
+        * @return The matched annotation, or <jk>null</jk> if not found.
+        */
+       <A extends Annotation> A lastAnnotation(Class<A> type, Class<?> 
onClass, Predicate<A> filter);
 
        /**
         * Performs an action on the matching declared annotations on the 
specified class.
@@ -165,7 +245,17 @@ public interface AnnotationProvider {
         * @param filter A predicate to apply to the entries to determine if 
value should be used.  Can be <jk>null</jk>.
         * @return The matched annotation, or <jk>null</jk> if no annotations 
matched.
         */
-       <A extends Annotation> A getDeclaredAnnotation(Class<A> type, Class<?> 
onClass, Predicate<A> filter);
+       <A extends Annotation> A firstDeclaredAnnotation(Class<A> type, 
Class<?> onClass, Predicate<A> filter);
+
+       /**
+        * Finds the last matching declared annotations on the specified class.
+        *
+        * @param type The annotation type to find.
+        * @param onClass The class to search on.
+        * @param filter A predicate to apply to the entries to determine if 
value should be used.  Can be <jk>null</jk>.
+        * @return The matched annotation, or <jk>null</jk> if no annotations 
matched.
+        */
+       <A extends Annotation> A lastDeclaredAnnotation(Class<A> type, Class<?> 
onClass, Predicate<A> filter);
 
        /**
         * Performs an action on the matching annotations on the specified 
method.
@@ -187,7 +277,18 @@ public interface AnnotationProvider {
         * @param filter A predicate to apply to the entries to determine if 
value should be used.  Can be <jk>null</jk>.
         * @return The matched annotation, or <jk>null</jk> if no annotations 
matched.
         */
-       <A extends Annotation> A getAnnotation(Class<A> type, Method onMethod, 
Predicate<A> filter);
+       <A extends Annotation> A firstAnnotation(Class<A> type, Method 
onMethod, Predicate<A> filter);
+
+       /**
+        * Finds the last matching annotation on the specified method.
+        *
+        * @param <A> The annotation type to find.
+        * @param type The annotation type to find.
+        * @param onMethod The method to search on.
+        * @param filter A predicate to apply to the entries to determine if 
value should be used.  Can be <jk>null</jk>.
+        * @return The matched annotation, or <jk>null</jk> if no annotations 
matched.
+        */
+       <A extends Annotation> A lastAnnotation(Class<A> type, Method onMethod, 
Predicate<A> filter);
 
        /**
         * Performs an action on the matching annotations on the specified 
field.
@@ -209,7 +310,18 @@ public interface AnnotationProvider {
         * @param filter A predicate to apply to the entries to determine if 
value should be used.  Can be <jk>null</jk>.
         * @return The matched annotation, or <jk>null</jk> if no annotations 
matched.
         */
-       <A extends Annotation> A getAnnotation(Class<A> type, Field onField, 
Predicate<A> filter);
+       <A extends Annotation> A firstAnnotation(Class<A> type, Field onField, 
Predicate<A> filter);
+
+       /**
+        * Finds the last matching annotation on the specified field.
+        *
+        * @param <A> The annotation type to find.
+        * @param type The annotation type to find.
+        * @param onField The field to search on.
+        * @param filter A predicate to apply to the entries to determine if 
value should be used.  Can be <jk>null</jk>.
+        * @return The matched annotation, or <jk>null</jk> if no annotations 
matched.
+        */
+       <A extends Annotation> A lastAnnotation(Class<A> type, Field onField, 
Predicate<A> filter);
 
        /**
         * Performs an action on the matching annotations on the specified 
constructor.
@@ -231,5 +343,16 @@ public interface AnnotationProvider {
         * @param filter A predicate to apply to the entries to determine if 
value should be used.  Can be <jk>null</jk>.
         * @return The matched annotation, or <jk>null</jk> if no annotations 
matched.
         */
-       <A extends Annotation> A getAnnotation(Class<A> type, Constructor<?> 
onConstructor, Predicate<A> filter);
+       <A extends Annotation> A firstAnnotation(Class<A> type, Constructor<?> 
onConstructor, Predicate<A> filter);
+
+       /**
+        * Finds the last matching annotation on the specified constructor.
+        *
+        * @param <A> The annotation type to find.
+        * @param type The annotation type to find.
+        * @param onConstructor The constructor to search on.
+        * @param filter A predicate to apply to the entries to determine if 
value should be used.  Can be <jk>null</jk>.
+        * @return The matched annotation, or <jk>null</jk> if no annotations 
matched.
+        */
+       <A extends Annotation> A lastAnnotation(Class<A> type, Constructor<?> 
onConstructor, Predicate<A> filter);
 }
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 2d924df..287e139 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
@@ -200,7 +200,7 @@ public final class BeanPropertyMeta implements 
Comparable<BeanPropertyMeta> {
                                                writeOnly = 
Boolean.valueOf(p.wo());
                                }
                                bc.forEachAnnotation(Swap.class, innerField, x 
-> true, x -> swap = getPropertySwap(x));
-                               isUri |= bc.getAnnotation(Uri.class, 
innerField, x->true) != null;
+                               isUri |= bc.firstAnnotation(Uri.class, 
innerField, x->true) != null;
                        }
 
                        if (getter != null) {
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
index b14babf..a7e80cb 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java
@@ -944,7 +944,7 @@ public abstract class Context implements AnnotationProvider 
{
        }
 
        @Override /* MetaProvider */
-       public <A extends Annotation> A getAnnotation(Class<A> type, Class<?> 
onClass, Predicate<A> filter) {
+       public <A extends Annotation> A firstAnnotation(Class<A> type, Class<?> 
onClass, Predicate<A> filter) {
                if (type != null && onClass != null)
                        for (A a : annotations(type, onClass))
                                if (passes(filter, a))
@@ -953,6 +953,16 @@ public abstract class Context implements 
AnnotationProvider {
        }
 
        @Override /* MetaProvider */
+       public <A extends Annotation> A lastAnnotation(Class<A> type, Class<?> 
onClass, Predicate<A> filter) {
+               A x = null;
+               if (type != null && onClass != null)
+                       for (A a : annotations(type, onClass))
+                               if (passes(filter, a))
+                                       x = a;
+               return x;
+       }
+
+       @Override /* MetaProvider */
        public <A extends Annotation> void forEachDeclaredAnnotation(Class<A> 
type, Class<?> onClass, Predicate<A> filter, Consumer<A> action) {
                if (type != null && onClass != null)
                        for (A a : declaredAnnotations(type, onClass))
@@ -960,7 +970,7 @@ public abstract class Context implements AnnotationProvider 
{
        }
 
        @Override /* MetaProvider */
-       public <A extends Annotation> A getDeclaredAnnotation(Class<A> type, 
Class<?> onClass, Predicate<A> filter) {
+       public <A extends Annotation> A firstDeclaredAnnotation(Class<A> type, 
Class<?> onClass, Predicate<A> filter) {
                if (type != null && onClass != null)
                        for (A a : declaredAnnotations(type, onClass))
                                if (passes(filter, a))
@@ -969,6 +979,16 @@ public abstract class Context implements 
AnnotationProvider {
        }
 
        @Override /* MetaProvider */
+       public <A extends Annotation> A lastDeclaredAnnotation(Class<A> type, 
Class<?> onClass, Predicate<A> filter) {
+               A x = null;
+               if (type != null && onClass != null)
+                       for (A a : declaredAnnotations(type, onClass))
+                               if (passes(filter, a))
+                                       x = a;
+               return x;
+       }
+
+       @Override /* MetaProvider */
        public <A extends Annotation> void forEachAnnotation(Class<A> type, 
Method onMethod, Predicate<A> filter, Consumer<A> action) {
                if (type != null && onMethod != null)
                        for (A a : annotations(type, onMethod))
@@ -976,7 +996,7 @@ public abstract class Context implements AnnotationProvider 
{
        }
 
        @Override /* MetaProvider */
-       public <A extends Annotation> A getAnnotation(Class<A> type, Method 
onMethod, Predicate<A> filter) {
+       public <A extends Annotation> A firstAnnotation(Class<A> type, Method 
onMethod, Predicate<A> filter) {
                if (type != null && onMethod != null)
                        for (A a : annotations(type, onMethod))
                                if (passes(filter, a))
@@ -985,6 +1005,16 @@ public abstract class Context implements 
AnnotationProvider {
        }
 
        @Override /* MetaProvider */
+       public <A extends Annotation> A lastAnnotation(Class<A> type, Method 
onMethod, Predicate<A> filter) {
+               A x = null;
+               if (type != null && onMethod != null)
+                       for (A a : annotations(type, onMethod))
+                               if (passes(filter, a))
+                                       x = a;
+               return x;
+       }
+
+       @Override /* MetaProvider */
        public <A extends Annotation> void forEachAnnotation(Class<A> type, 
Field onField, Predicate<A> filter, Consumer<A> action) {
                if (type != null && onField != null)
                        for (A a : annotations(type, onField))
@@ -992,7 +1022,7 @@ public abstract class Context implements 
AnnotationProvider {
        }
 
        @Override /* MetaProvider */
-       public <A extends Annotation> A getAnnotation(Class<A> type, Field 
onField, Predicate<A> filter) {
+       public <A extends Annotation> A firstAnnotation(Class<A> type, Field 
onField, Predicate<A> filter) {
                if (type != null && onField != null)
                        for (A a : annotations(type, onField))
                                if (passes(filter, a))
@@ -1001,6 +1031,16 @@ public abstract class Context implements 
AnnotationProvider {
        }
 
        @Override /* MetaProvider */
+       public <A extends Annotation> A lastAnnotation(Class<A> type, Field 
onField, Predicate<A> filter) {
+               A x = null;
+               if (type != null && onField != null)
+                       for (A a : annotations(type, onField))
+                               if (passes(filter, a))
+                                       x = a;
+               return x;
+       }
+
+       @Override /* MetaProvider */
        public <A extends Annotation> void forEachAnnotation(Class<A> type, 
Constructor<?> onConstructor, Predicate<A> filter, Consumer<A> action) {
                if (type != null && onConstructor != null)
                        for (A a : annotations(type, onConstructor))
@@ -1008,7 +1048,7 @@ public abstract class Context implements 
AnnotationProvider {
        }
 
        @Override /* MetaProvider */
-       public <A extends Annotation> A getAnnotation(Class<A> type, 
Constructor<?> onConstructor, Predicate<A> filter) {
+       public <A extends Annotation> A firstAnnotation(Class<A> type, 
Constructor<?> onConstructor, Predicate<A> filter) {
                if (type != null && onConstructor != null)
                        for (A a : annotations(type, onConstructor))
                                if (passes(filter, a))
@@ -1016,6 +1056,16 @@ public abstract class Context implements 
AnnotationProvider {
                return null;
        }
 
+       @Override /* MetaProvider */
+       public <A extends Annotation> A lastAnnotation(Class<A> type, 
Constructor<?> onConstructor, Predicate<A> filter) {
+               A x = null;
+               if (type != null && onConstructor != null)
+                       for (A a : annotations(type, onConstructor))
+                               if (passes(filter, a))
+                                       x = a;
+               return x;
+       }
+
        /**
         * Returns <jk>true</jk> if <c>getAnnotation(a,c)</c> returns a 
non-null value.
         *
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ClassInfo.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ClassInfo.java
index 8801cae..c2c9cfb 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ClassInfo.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ClassInfo.java
@@ -1047,7 +1047,7 @@ public final class ClassInfo {
         * @return The <jk>true</jk> if annotation if found.
         */
        public <A extends Annotation> boolean hasAnnotation(AnnotationProvider 
annotationProvider, Class<A> type) {
-               return annotationProvider.getAnnotation(type, c, x -> true) != 
null;
+               return annotationProvider.firstAnnotation(type, c, x -> true) 
!= null;
        }
 
        /**
@@ -1133,7 +1133,7 @@ public final class ClassInfo {
        private <A extends Annotation> A findAnnotation(AnnotationProvider ap, 
Class<A> a) {
                if (a == null)
                        return null;
-               A t = ap.getDeclaredAnnotation(a, c, x -> true);
+               A t = ap.firstDeclaredAnnotation(a, c, x -> true);
                if (t != null)
                        return t;
                ClassInfo sci = getParent();
@@ -1156,13 +1156,13 @@ public final class ClassInfo {
                        return t2;
                ClassInfo[] interfaces = _getInterfaces();
                for (int i = interfaces.length-1; i >= 0; i--) {
-                       A o = ap.getDeclaredAnnotation(a, 
interfaces[i].inner(), filter);
+                       A o = ap.firstDeclaredAnnotation(a, 
interfaces[i].inner(), filter);
                        if (o != null)
                                return o;
                }
                ClassInfo[] parents = _getParents();
                for (int i = parents.length-1; i >= 0; i--) {
-                       A o = ap.getDeclaredAnnotation(a, parents[i].inner(), 
filter);
+                       A o = ap.firstDeclaredAnnotation(a, parents[i].inner(), 
filter);
                        if (o != null)
                                return o;
                }
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ConstructorInfo.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ConstructorInfo.java
index 9ce4cb9..7223355 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ConstructorInfo.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/ConstructorInfo.java
@@ -133,7 +133,7 @@ public final class ConstructorInfo extends ExecutableInfo 
implements Comparable<
         * @return <jk>true</jk> if the specified annotation is present on this 
constructor.
         */
        public final <A extends Annotation> boolean 
hasAnnotation(AnnotationProvider annotationProvider, Class<A> type) {
-               return annotationProvider.getAnnotation(type, c, x -> true) != 
null;
+               return annotationProvider.firstAnnotation(type, c, x -> true) 
!= null;
        }
 
        /**
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/FieldInfo.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/FieldInfo.java
index 293426a..d6b237f 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/FieldInfo.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/FieldInfo.java
@@ -152,7 +152,7 @@ public final class FieldInfo implements 
Comparable<FieldInfo> {
         * @return <jk>true</jk> if the specified annotation is present.
         */
        public <A extends Annotation> boolean hasAnnotation(AnnotationProvider 
annotationProvider, Class<A> type) {
-               return annotationProvider.getAnnotation(type, f, x -> true) != 
null;
+               return annotationProvider.firstAnnotation(type, f, x -> true) 
!= null;
        }
 
        /**
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 fd80c9b..08e3af9 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
@@ -268,7 +268,7 @@ public final class MethodInfo extends ExecutableInfo 
implements Comparable<Metho
         */
        public final <A extends Annotation> boolean 
hasAnnotation(AnnotationProvider annotationProvider, Class<A> type) {
                for (MethodInfo m2 : _getMatching())
-                       if (annotationProvider.getAnnotation(type, m2.inner(), 
x -> true) != null)
+                       if (annotationProvider.firstAnnotation(type, 
m2.inner(), x -> true) != null)
                                return true;
                return false;
        }
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/http/header/BasicLongHeader_Test.java
 
b/juneau-utest/src/test/java/org/apache/juneau/http/header/BasicLongHeader_Test.java
index f2e8eab..46cbe83 100644
--- 
a/juneau-utest/src/test/java/org/apache/juneau/http/header/BasicLongHeader_Test.java
+++ 
b/juneau-utest/src/test/java/org/apache/juneau/http/header/BasicLongHeader_Test.java
@@ -16,7 +16,6 @@ import static org.junit.runners.MethodSorters.*;
 import static org.apache.juneau.testutils.StreamUtils.*;
 
 import java.io.*;
-import java.net.*;
 import java.util.function.*;
 
 import org.apache.juneau.http.annotation.*;

Reply via email to