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

Code generator should not use reflection for protected artifacts #29253

Closed
snicoll opened this issue Oct 4, 2022 · 0 comments
Closed

Code generator should not use reflection for protected artifacts #29253

snicoll opened this issue Oct 4, 2022 · 0 comments
Assignees
Labels
theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Milestone

Comments

@snicoll
Copy link
Member

snicoll commented Oct 4, 2022

Right now we assume that the generated code is in the same package of the target object. If the visibility is public or package private, then we generate code that uses the members directly. If they are protected or private, we use reflection.

We don't need to use reflection for protected cases as those members can be access within the same package.

@snicoll snicoll added type: enhancement A general enhancement theme: aot An issue related to Ahead-of-time processing labels Oct 4, 2022
@snicoll snicoll added this to the 6.0.x milestone Oct 4, 2022
@snicoll snicoll self-assigned this Oct 4, 2022
@snicoll snicoll modified the milestones: 6.0.x, 6.0.0-RC1 Oct 4, 2022
@snicoll snicoll closed this as completed in 9820e33 Oct 4, 2022
simonbasle added a commit to simonbasle/spring-framework that referenced this issue Mar 30, 2023
This commit changes the name of two recently introduced methods in the
`MockRestRequestMatchers` class for header and queryParam. These have
been found to cause false negatives in user tests, due to the new
overload taking precedence in some cases.

Namely, using a `Matcher` factory method which can apply to both `List`
and `String` will cause the compiler to select the newest list overload,
by instantiating a `Matcher<Object>`.

This can cause false negatives in user tests, failing tests that used
to pass because the Matcher previously applied to the first String in
the header or queryParam value list. For instance, `equalsTo("a")`.

The new overloads are recent enough and this has enough potential to
cause an arbitrary number of user tests to fail that we break the API
to eliminate the ambiguity, by renaming the methods with a `*List`
suffix.

Closes spring-projectsgh-30220
See spring-projectsgh-29253
See spring-projectsgh-28660
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant