Skip to content

Better support for bridge methods on interfaces and abstract classes#133

Open
beckermarc wants to merge 3 commits into
jenkinsci:masterfrom
beckermarc:stripAbstract
Open

Better support for bridge methods on interfaces and abstract classes#133
beckermarc wants to merge 3 commits into
jenkinsci:masterfrom
beckermarc:stripAbstract

Conversation

@beckermarc
Copy link
Copy Markdown

This PR improves support for bridge methods on interface methods and abstract methods.
Instead of making the bridge method abstract as well the bridge method can be configured to be a non abstract method directly containing the corresponding bridge implementation by setting the stripAbstract property to true.

This simplifies usage of bridge methods on interfaces dramatically, as @WithBridgeMethods on the interface method is sufficient in that case. It also enables a scenario that wasn't possible before: Bridge methods in multi-module projects where interfaces and implementing classes are defined in different modules, built after each other, not together.

This behaviour is opt-in through the newly added property stripAbstract on the @WithBridgeMethods annotation. This ensures compatibility and continuity with existing abstract bridge methods and previously documented approaches how to achieve bridge methods on interfaces.

As part of this change adapter methods defined within the interface itself have also been enabled.

Testing done

Existing test suite has been extended with tests for:

  • Interface methods, setting the new stripAbstract property
  • Interface methods using adapter pointing to a private interface method
  • Abstract methods, both using classical approach and approach leveraging stripAbstract

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@beckermarc
Copy link
Copy Markdown
Author

@basil Would you be willing to review this? 🙂

@beckermarc
Copy link
Copy Markdown
Author

@basil Sorry for bothering you again: Is there anything I can do additionally to get a review for this PR or anyone else whom I should contact? We would like to use this library in our project, but would need these additions to be able to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant