adjust to Pair changes in latest lang3 snapshot
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/proxy/branches/version-2.0-work@1078945 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationConfigurer.java b/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationConfigurer.java
index 741301a..750b44f 100644
--- a/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationConfigurer.java
+++ b/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationConfigurer.java
@@ -18,6 +18,7 @@
import java.lang.annotation.Annotation;
+import org.apache.commons.lang3.ImmutablePair;
import org.apache.commons.lang3.Pair;
/**
@@ -53,7 +54,7 @@
if (configurer == this) {
throw new IllegalArgumentException("An AnnotationConfigurer cannot configure its own child annotation");
}
- Pair<AnnotationFactory, ClassLoader> context = requireContext();
+ ImmutablePair<AnnotationFactory, ClassLoader> context = requireContext();
return context.left.create(context.right, configurer);
}
@@ -65,7 +66,7 @@
* @throws IllegalStateException if called other than when an {@link AnnotationFactory} is executing {@link #configure(Object)}
*/
protected final <T extends Annotation> T child(Class<T> annotationType) {
- Pair<AnnotationFactory, ClassLoader> context = requireContext();
+ ImmutablePair<AnnotationFactory, ClassLoader> context = requireContext();
return context.left.create(context.right, annotationType);
}
@@ -74,8 +75,8 @@
* @return a {@link Pair}
* @throws IllegalStateException if no ongoing annotation stubbing could be detected
*/
- synchronized Pair<AnnotationFactory, ClassLoader> requireContext() throws IllegalStateException {
- Pair<AnnotationFactory, ClassLoader> result = AnnotationFactory.CONTEXT.get();
+ synchronized ImmutablePair<AnnotationFactory, ClassLoader> requireContext() throws IllegalStateException {
+ ImmutablePair<AnnotationFactory, ClassLoader> result = AnnotationFactory.CONTEXT.get();
if (result == null) {
throw new IllegalStateException("Could not detect ongoing annotation stubbing");
}
diff --git a/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationFactory.java b/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationFactory.java
index 22cdef6..e0eb7b1 100644
--- a/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationFactory.java
+++ b/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationFactory.java
@@ -26,7 +26,7 @@
import java.util.Map;
import org.apache.commons.lang3.AnnotationUtils;
-import org.apache.commons.lang3.Pair;
+import org.apache.commons.lang3.ImmutablePair;
import org.apache.commons.proxy2.Interceptor;
import org.apache.commons.proxy2.Invocation;
import org.apache.commons.proxy2.Invoker;
@@ -52,8 +52,8 @@
/**
* Record the context of a call for possible use by nested annotation creations.
*/
- static final ThreadLocal<Pair<AnnotationFactory, ClassLoader>> CONTEXT =
- new ThreadLocal<Pair<AnnotationFactory, ClassLoader>>();
+ static final ThreadLocal<ImmutablePair<AnnotationFactory, ClassLoader>> CONTEXT =
+ new ThreadLocal<ImmutablePair<AnnotationFactory, ClassLoader>>();
private static final ProxyFactory PROXY_FACTORY;
@@ -328,7 +328,7 @@
try {
CONFIGURER.set(configurer);
if (outerContext) {
- CONTEXT.set(Pair.of(this, classLoader));
+ CONTEXT.set(ImmutablePair.of(this, classLoader));
}
@SuppressWarnings("unchecked")
final A result = (A) proxyFactory.createInvokerProxy(classLoader, ANNOTATION_INVOKER, getStubType());