Skip to content

Conversation

@kwin
Copy link
Member

@kwin kwin commented Jun 27, 2023

This is available if compiled accordingly (with javac option -parameters, https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-parameters), supported since javac 8+

@kwin kwin requested review from joerghoh and stefanseifert June 27, 2023 17:04
@kwin kwin force-pushed the feature/use-java-lang-reflect-parameter branch from dcb5830 to eba7e54 Compare June 27, 2023 17:05
@stefanseifert
Copy link
Member

can you add a test case evaluating the new behavior?

i've never used the -parameters option, if i understand correctly it's still optional and not activated by default. so we need probably multiple maven verify executions or separate integration tests that test our code with variants of this flag enabled and not enabled, to ensure it works as expected in all conditions?

@kwin
Copy link
Member Author

kwin commented Jun 30, 2023

The API https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Parameter.html is available since Java 8 (no matter if -parameters is used or not). The only difference is that https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Parameter.html#isNamePresent-- returns false by default and https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Parameter.html#getName-- returns an artificial name by default. But I will look into adding ITs (the current ones proof though that everything works by default, i.e. without using --parameters, so only ones with --parameters are currently not existing).

@henrykuijpers
Copy link

Wouldn't that be as simple as adding another compile step in the project, for a separate source folder, that will have a sling model available to test?

@kwin
Copy link
Member Author

kwin commented Nov 18, 2023

@henrykuijpers Yes, but I tried to do #46 first, which turned out to be more complex.

Copy link
Member

@stefanseifert stefanseifert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is especially useful in combination with #51 for record classes
i'm fine with applying it also without the IT to not block this here any further - we can add the ITs later.

@apache apache deleted a comment from sonarqubecloud bot Jun 25, 2024
@apache apache deleted a comment from sonarqubecloud bot Jun 25, 2024
@apache apache deleted a comment from sonarqubecloud bot Jun 25, 2024
@sonarqubecloud
Copy link

@kwin kwin merged commit e8ca837 into master Jun 25, 2024
@kwin kwin deleted the feature/use-java-lang-reflect-parameter branch June 25, 2024 12:37
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.

3 participants