Closed nclemeur closed 6 years ago
Hi @nclemeur,
I am not sure if you are able, but I looked at the source code for Java 8 java.lang.reflect.Method class and this can be done without using Java 8. You only need to copy the logic from the isDefault() method which is very simple. All you would need to do is put this method inside of ReflectUtil and have it take a Method as an argument. Then modify the AnnotatedClassActionResolver to call ReflectUtil.isDefault( method ). Can you modify your pull request and I will perform the merge? Here is what the code would look like in ReflectUtil:
public static boolean isDefault( Method method ) {
// Default methods are public non-abstract instance methods
// declared in an interface.
return ((method.getModifiers() & (Modifier.ABSTRACT | Modifier.PUBLIC | Modifier.STATIC)) == Modifier.PUBLIC) && method.getDeclaringClass().isInterface();
}
@nclemeur
I went ahead and took the Java 7 compliant approach I mentioned above and accepted the remainder of the changes. So Java 8 default methods should now be supported in master. Thanks.
Add support for Java 8 default method in interfaces as an event handler. It looks like the getDeclaredMethods does not return default method in interface implemented by the ActionBean.
Note: the method.isDefault() require java 8. So I don't know what is the minimum JDK supported by Stripes, but this patch would require at least Java 8