|
1 | 1 | /**
|
2 |
| - * Copyright 2009-2018 the original author or authors. |
| 2 | + * Copyright 2009-2019 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
20 | 20 | import java.lang.reflect.Constructor;
|
21 | 21 | import java.lang.reflect.InvocationHandler;
|
22 | 22 | import java.lang.reflect.Method;
|
23 |
| -import java.lang.reflect.Modifier; |
24 | 23 | import java.util.Map;
|
25 | 24 |
|
26 | 25 | import org.apache.ibatis.reflection.ExceptionUtil;
|
@@ -48,7 +47,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
|
48 | 47 | try {
|
49 | 48 | if (Object.class.equals(method.getDeclaringClass())) {
|
50 | 49 | return method.invoke(this, args);
|
51 |
| - } else if (isDefaultMethod(method)) { |
| 50 | + } else if (method.isDefault()) { |
52 | 51 | return invokeDefaultMethod(proxy, method, args);
|
53 | 52 | }
|
54 | 53 | } catch (Throwable t) {
|
@@ -76,13 +75,4 @@ private Object invokeDefaultMethod(Object proxy, Method method, Object[] args)
|
76 | 75 | | MethodHandles.Lookup.PACKAGE | MethodHandles.Lookup.PUBLIC)
|
77 | 76 | .unreflectSpecial(method, declaringClass).bindTo(proxy).invokeWithArguments(args);
|
78 | 77 | }
|
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 |
| - } |
88 | 78 | }
|
0 commit comments