Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ReflectionUtils.doWithMethods work on Java 8 default interface methods [SPR-12822] #17419

Closed
spring-issuemaster opened this issue Mar 16, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Mar 16, 2015

Stefaan Neyts opened SPR-12822 and commented

I'd like to use the @ServiceActivator annotation on a Java 8 default interface method. This does not work because Spring Integration relies on the ReflectionUtils.doWithMethods, which uses ReflectionUtils.getDeclaredMethods and the last one just does this clazz.getDeclaredMethods(), which doesn't return those default methods on the interface.


Affects: 4.1.5

Reference URL: http://stackoverflow.com/questions/29076108/spring-integration-serviceactivator-on-a-java-8-default-interface-method

Issue Links:

  • #15547 @Bean on Java 8 default methods in interfaces
  • #16501 ReflectionUtils slow down application startup on WebSphere
  • #18357 ReflectionUtils cache uses up a fairly big chunk of heap even
  • #18754 Support @BeforeTransaction and @AfterTransaction on interface default methods

Referenced from: commits 1924629

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Mar 16, 2015

Juergen Hoeller commented

This is a fine fit for 4.2 since we have other issues related to default methods already and intend to do a framework-wide revision for proper default method handling. I'll use this issue for that purpose since many parts of the framework delegate to ReflectionUtils and would immediately benefit from default method exposure, maybe with a little bit of tweaking.

Juergen

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Mar 19, 2015

Juergen Hoeller commented

ReflectionUtils.doWithMethods covers applicable default methods as well now, as declared on any interfaces implemented by the given class.

A new doWithLocalMethods variant provides the same coverage but without traversing the inheritance hierarchy, as needed by our common traversal algorithm in the annotation post-processors. A corresponding doWithLocalFields has been introduced for consistent structuring.

Also, doWithFields as well as doWithLocalFields use a cache for Field.getDeclaredFields() now, analogous to the existing cache for declared methods (introduced in 4.1 as part of #16501).

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.