Skip to content

Commit ab0395c

Browse files
committed
Remove backported method for older JDK
1 parent 0b97969 commit ab0395c

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/main/java/org/apache/ibatis/binding/MapperProxy.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2009-2018 the original author or authors.
2+
* Copyright 2009-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@
2020
import java.lang.reflect.Constructor;
2121
import java.lang.reflect.InvocationHandler;
2222
import java.lang.reflect.Method;
23-
import java.lang.reflect.Modifier;
2423
import java.util.Map;
2524

2625
import org.apache.ibatis.reflection.ExceptionUtil;
@@ -48,7 +47,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
4847
try {
4948
if (Object.class.equals(method.getDeclaringClass())) {
5049
return method.invoke(this, args);
51-
} else if (isDefaultMethod(method)) {
50+
} else if (method.isDefault()) {
5251
return invokeDefaultMethod(proxy, method, args);
5352
}
5453
} catch (Throwable t) {
@@ -76,13 +75,4 @@ private Object invokeDefaultMethod(Object proxy, Method method, Object[] args)
7675
| MethodHandles.Lookup.PACKAGE | MethodHandles.Lookup.PUBLIC)
7776
.unreflectSpecial(method, declaringClass).bindTo(proxy).invokeWithArguments(args);
7877
}
79-
80-
/**
81-
* Backport of java.lang.reflect.Method#isDefault()
82-
*/
83-
private boolean isDefaultMethod(Method method) {
84-
return (method.getModifiers()
85-
& (Modifier.ABSTRACT | Modifier.PUBLIC | Modifier.STATIC)) == Modifier.PUBLIC
86-
&& method.getDeclaringClass().isInterface();
87-
}
8878
}

0 commit comments

Comments
 (0)