-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Allow to ignore methods on provided interface #2218
Conversation
WalkthroughThe changes introduce a new annotation Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (3)
- core/src/main/java/feign/Contract.java (1} hunks)
- core/src/main/java/feign/FeignIgnore.java (1} hunks)
- core/src/test/java/feign/FeignTest.java (1} hunks)
Files skipped from review due to trivial changes (2)
- core/src/main/java/feign/Contract.java
- core/src/main/java/feign/FeignIgnore.java
Additional comments: 1
core/src/test/java/feign/FeignTest.java (1)
- 1275-1276: The new
@FeignIgnore
annotation is being used here to ignore theignore()
method during processing. This change seems to be in line with the PR summary and doesn't appear to introduce any issues. However, ensure that theignore()
method is not being called anywhere in the codebase, as it will not be processed due to the@FeignIgnore
annotation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the change, and makes lots of sense. But I think it should fire a clear exception if a ignored method is invoked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (4)
- core/src/main/java/feign/ReflectiveFeign.java (1 hunks)
- core/src/test/java/feign/FeignTest.java (3 hunks)
- reactive/src/main/java/feign/reactive/ReactiveInvocationHandler.java (1 hunks)
- reactive/src/test/java/feign/reactive/ReactiveFeignIntegrationTest.java (4 hunks)
Additional comments: 9
core/src/main/java/feign/ReflectiveFeign.java (1)
- 94-95: The addition of a check for the method in the dispatch map before invoking it is a good practice. It prevents potential
NullPointerException
if the method is not found in the map. Throwing anUnsupportedOperationException
is a reasonable approach to handle such cases. However, ensure that this exception is properly handled in the upstream code to avoid unexpected application crashes.reactive/src/main/java/feign/reactive/ReactiveInvocationHandler.java (1)
- 51-52: The new code checks if the method is present in the dispatch map and throws an
UnsupportedOperationException
if it's not. This is a good way to handle methods that are not supposed to be called, but it might be helpful to add a comment explaining why this check is necessary, especially since it's a change in behavior that could potentially break existing code if not handled properly.reactive/src/test/java/feign/reactive/ReactiveFeignIntegrationTest.java (4)
26-28: The import statements have been reorganized and some unused imports have been removed. Ensure that this does not affect other parts of the code that might be using these imports.
44-44: The import for
org.junit.Assert
has been added. This is used for the assertion in the new test methodtestCallIgnoredMethod
.66-78: A new test method
testCallIgnoredMethod
has been added. This test method creates aTestReactorService
instance and tries to call theignore
method, which is annotated with@FeignIgnore
. The test expects anUnsupportedOperationException
to be thrown when theignore
method is called. This test validates the new@FeignIgnore
annotation functionality.344-345: A new method
ignore
has been added to theTestReactorService
interface and is annotated with@FeignIgnore
. This method is used in the new test methodtestCallIgnoredMethod
.core/src/test/java/feign/FeignTest.java (3)
36-36: The import
org.junit.Assert
has been added. Ensure that it is used in the code.1171-1183: A new test method
testCallIgnoredMethod
has been added. This test method creates an instance ofTestInterface
and calls theignore
method. It expects anUnsupportedOperationException
to be thrown. This test validates the new@FeignIgnore
annotation functionality.1290-1292: The
ignore
method has been added to theTestInterface
and is annotated with@FeignIgnore
. This method is used in thetestCallIgnoredMethod
test.
15205: deps(maven): Update dependency io.github.openfeign:feign-bom to v13.1 (main) r=github-actions[bot] a=renovate[bot] [![Mend Renovate logo banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [io.github.openfeign:feign-bom](https://togithub.com/openfeign/feign) | `13.0` -> `13.1` | [![age](https://developer.mend.io/api/mc/badges/age/maven/io.github.openfeign:feign-bom/13.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/io.github.openfeign:feign-bom/13.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/io.github.openfeign:feign-bom/13.0/13.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/io.github.openfeign:feign-bom/13.0/13.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>openfeign/feign (io.github.openfeign:feign-bom)</summary> ### [`v13.1`](https://togithub.com/OpenFeign/feign/releases/tag/13.1): OpenFeign 13.1 [Compare Source](https://togithub.com/openfeign/feign/compare/13.0...13.1) ##### What's Changed - Support Conditional Parameter Expansion by [`@​gromspys](https://togithub.com/gromspys)` in [https://github.com/OpenFeign/feign/pull/2216](https://togithub.com/OpenFeign/feign/pull/2216) - Add typed response by [`@​gromspys](https://togithub.com/gromspys)` in [https://github.com/OpenFeign/feign/pull/2206](https://togithub.com/OpenFeign/feign/pull/2206) - Allow to ignore methods on provided interface by [`@​gromspys](https://togithub.com/gromspys)` in [https://github.com/OpenFeign/feign/pull/2218](https://togithub.com/OpenFeign/feign/pull/2218) - support method option and add UT by [`@​TaoJing96](https://togithub.com/TaoJing96)` in [https://github.com/OpenFeign/feign/pull/1881](https://togithub.com/OpenFeign/feign/pull/1881) - Do not decode URL encoding while setting up RequestTemplate by [`@​Breina](https://togithub.com/Breina)` in [https://github.com/OpenFeign/feign/pull/2228](https://togithub.com/OpenFeign/feign/pull/2228) *** <details> <summary>List of PRs that updated libraries versions</summary> <br /> * build(deps): bump jakarta.xml.ws:jakarta.xml.ws-api from 4.0.0 to 4.0.1 by `@​dependabot` in OpenFeign/feign#2211 * build(deps-dev): bump org.glassfish.jersey.core:jersey-client from 2.40 to 2.41 by `@​dependabot` in OpenFeign/feign#2210 * build(deps-dev): bump org.glassfish.jersey.inject:jersey-hk2 from 2.40 to 2.41 by `@​dependabot` in OpenFeign/feign#2209 * build(deps): bump jakarta.xml.soap:jakarta.xml.soap-api from 3.0.0 to 3.0.1 by `@​dependabot` in OpenFeign/feign#2208 * build(deps): bump com.sun.xml.bind:jaxb-impl from 2.3.8 to 2.3.9 by `@​dependabot` in OpenFeign/feign#2207 * build(deps): bump io.sundr:sundr-maven-plugin from 0.101.0 to 0.101.1 by `@​dependabot` in OpenFeign/feign#2213 * build(deps): bump maven-surefire-plugin.version from 3.1.2 to 3.2.1 by `@​dependabot` in OpenFeign/feign#2212 * build(deps): bump io.sundr:sundr-maven-plugin from 0.101.1 to 0.101.2 by `@​dependabot` in OpenFeign/feign#2215 * build(deps): bump kotlin.version from 1.9.10 to 1.9.20 by `@​dependabot` in OpenFeign/feign#2219 * build(deps): bump io.sundr:sundr-maven-plugin from 0.101.2 to 0.101.3 by `@​dependabot` in OpenFeign/feign#2220 * build(deps): bump org.mockito:mockito-core from 5.6.0 to 5.7.0 by `@​dependabot` in OpenFeign/feign#2221 * build(deps): bump org.moditect:moditect-maven-plugin from 1.0.0.Final to 1.1.0 by `@​dependabot` in OpenFeign/feign#2224 * build(deps): bump io.dropwizard.metrics:metrics-core from 4.2.21 to 4.2.22 by `@​dependabot` in OpenFeign/feign#2222 * build(deps): bump org.junit:junit-bom from 5.10.0 to 5.10.1 by `@​dependabot` in OpenFeign/feign#2223 * build(deps): bump org.apache.maven.plugins:maven-javadoc-plugin from 3.6.0 to 3.6.2 by `@​dependabot` in OpenFeign/feign#2226 * build(deps): bump maven-surefire-plugin.version from 3.2.1 to 3.2.2 by `@​dependabot` in OpenFeign/feign#2225 </details> ##### New Contributors * `@​TaoJing96` made their first contributi[https://github.com/OpenFeign/feign/pull/1881](https://togithub.com/OpenFeign/feign/pull/1881)l/1881 * `@​Breina` made their first contributi[https://github.com/OpenFeign/feign/pull/2228](https://togithub.com/OpenFeign/feign/pull/2228)l/2228 **Full Changelog**: OpenFeign/feign@13.0...13.1 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "every weekday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/camunda/zeebe). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40Ni4wIiwidXBkYXRlZEluVmVyIjoiMzcuNDYuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* Allow to ignore methods on provided interface * Throw an UnsupportedOperationException if an ignored method was called
* Allow to ignore methods on provided interface * Throw an UnsupportedOperationException if an ignored method was called
Issue: #686
Summary by CodeRabbit
@FeignIgnore
annotation. This allows developers to mark certain methods to be ignored during processing, enhancing control over the application's behavior.@FeignIgnore
is called, the system will now throw anUnsupportedOperationException
, improving the robustness of the application.@FeignIgnore
annotation and the associated error handling mechanism.