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

fix the signature error when using reflection to access the org.springframework.core.annotation.AnnotatedElementUtils#getMergedAnnotation method #14156

Merged

Conversation

jkoChen
Copy link
Contributor

@jkoChen jkoChen commented May 6, 2024

Fixes #14104.

The Problem

The method org.apache.dubbo.config.spring.util.AnnotationUtils#tryGetMergedAnnotation utilizes reflection to access org.springframework.core.annotation.AnnotatedElementUtils#getMergedAnnotation. However, there is a signature mismatch in the method's input parameters, which leads to an inability to retrieve the correct method. Consequently, this results in the failure to obtain the mergedAnnotation.

What is the purpose of the change

It is recommended to fix this issue, as it will cause the passing of the DubboReference annotation to become ineffective.

Brief changelog

fix the signature error when using reflection to access the org.springframework.core.annotation.AnnotatedElementUtils#getMergedAnnotation method

Verifying this change

After the patch, it is possible to correctly obtain the org.springframework.core.annotation.AnnotatedElementUtils#getMergedAnnotation method.

Checklist

  • Make sure there is a GitHub_issue field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • GitHub Actions works fine on your own branch.

jkoChen and others added 2 commits May 6, 2024 20:32
…springframework.core.annotation.AnnotatedElementUtils#getMergedAnnotation method

Fix the problem,the method
org.apache.dubbo.config.spring.util.AnnotationUtils#tryGetMergedAnnotation
utilizes reflection to access
org.springframework.core.annotation.AnnotatedElementUtils#getMergedAnnotation.
However, there is a signature mismatch in the method's input parameters,
which leads to an inability to retrieve the correct method.
Consequently, this results in the failure to obtain the
mergedAnnotation.
Copy link

sonarqubecloud bot commented May 8, 2024

@jkoChen
Copy link
Contributor Author

jkoChen commented May 8, 2024

@AlbumenJ The method org.apache.dubbo.config.spring.util.AnnotationUtils#tryGetMergedAnnotation is a public method. Should I remove the parameters classValuesAsString and nestedAnnotationsAsMap which are not being used, in order to resolve issues reported by SonarCloud?

@AlbumenJ AlbumenJ merged commit 5d916cd into apache:3.2 May 8, 2024
19 checks passed
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.

[Bug]org.apache.dubbo.config.spring.util.AnnotationUtils 派生注解的属性无法merge
2 participants