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

Compile Argument "-parameter" is not used on project build since 3.16.x #1607

Open
lepokle opened this issue Sep 17, 2024 · 1 comment
Open
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@lepokle
Copy link

lepokle commented Sep 17, 2024

Extension Name: vscode-gradle
Extension Version: 3.16.x
OS Version: Arch Linux
VSCode version: 1.93.1

Describe the bug
I've a spring boot project providing a REST endpoint using a path variable:

@PostMapping(path = "/start/{scopeName}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> scheduleScope(@PathVariable String scopeName) {

When calling the endpoint, the following exception is thrown:

24-09-17 Tue 12:25:24.945 INFO  --- [nio-8180-exec-1] [                         ] o.s.w.s.DispatcherServlet                :  Completed initialization in 2 ms
24-09-17 Tue 12:25:29.917 ERROR --- [nio-8180-exec-5] [                         ] o.a.c.c.C.[.[.[.[dispatcherServlet]      :  Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: java.lang.IllegalArgumentException: Name for argument of type [java.lang.String] not specified, and parameter name information not available via reflection. Ensure that the compiler uses the '-parameters' flag.] with root cause
java.lang.IllegalArgumentException: Name for argument of type [java.lang.String] not specified, and parameter name information not available via reflection. Ensure that the compiler uses the '-parameters' flag.
    at org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.updateNamedValueInfo(AbstractNamedValueMethodArgumentResolver.java:186)

However I've added the parameter -parameter to build options inside build.gradle.kts:

tasks.withType<JavaCompile> {
    options.compilerArgs.add("-parameters")
}

To Reproduce

  1. Create spring boot project with web
  2. Add REST endpoint with path parameter as above
  3. Add Java compile option -parameter as above
  4. Run and access the endpoint

Expected behavior
Endpoint should work. Spring should be able to access the name information of the parameter due to the compile option -parameter. It seems that the extension does not take this parameter into action.

Screenshots
n.a.

Output from "Gradle for Java"

[info] [gradle-server] Gradle Server started, listening on 37803
[info] Gradle client connected to server
[info] Java Home: /home/leo/.vscode/extensions/redhat.java-1.34.0-linux-x64/jre/17.0.12-linux-x86_64
[info] JVM Args: --add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=384m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant
[info] Gradle User Home: /home/leo/.gradle
[info] Gradle Version: 8.8
[info] Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.8/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

CONFIGURE SUCCESSFUL in 14s
[info] Found 335 tasks

Does the bug still exist if you disable all other extensions?
Yes

Additional context
Worked with extension 3.15.x and below

@lepokle lepokle added the bug Something isn't working label Sep 17, 2024
@jdneo
Copy link
Member

jdneo commented Sep 18, 2024

Seems duplicated with #1604

@jdneo jdneo added the duplicate This issue or pull request already exists label Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants