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

LocalVariableTableParameterNameDiscoverer logs many warnings with Hibernate validation #29563

Closed
akefirad opened this issue Nov 23, 2022 · 3 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: regression A bug that is also a regression
Milestone

Comments

@akefirad
Copy link

Affects: 6.0.1

Having a small simple Spring Boot application with Validator dependency, adding a ConfigurationProperties class with @Validated logs many warning like below:

...
2022-11-23T20:36:30.230+01:00  WARN 10246 --- [  restartedMain] ocalVariableTableParameterNameDiscoverer : Using deprecated '-debug' fallback for parameter name resolution. Compile the affected code with '-parameters' instead: public java.lang.String(java.lang.StringBuilder)
2022-11-23T20:36:30.231+01:00  WARN 10246 --- [  restartedMain] ocalVariableTableParameterNameDiscoverer : Using deprecated '-debug' fallback for parameter name resolution. Compile the affected code with '-parameters' instead: public java.lang.String(char[])
2022-11-23T20:36:30.231+01:00  WARN 10246 --- [  restartedMain] ocalVariableTableParameterNameDiscoverer : Using deprecated '-debug' fallback for parameter name resolution. Compile the affected code with '-parameters' instead: java.lang.String(char[],int,int,java.lang.Void)
2022-11-23T20:36:30.231+01:00  WARN 10246 --- [  restartedMain] ocalVariableTableParameterNameDiscoverer : Using deprecated '-debug' fallback for parameter name resolution. Compile the affected code with '-parameters' instead: java.lang.String(char[],int,int,java.lang.Void)
2022-11-23T20:36:30.231+01:00  WARN 10246 --- [  restartedMain] ocalVariableTableParameterNameDiscoverer : Using deprecated '-debug' fallback for parameter name resolution. Compile the affected code with '-parameters' instead: java.lang.String(char[],int,int,java.lang.Void)
...

I'm not entirely sure what it's saying. The executable is not my code, it's the standard library. Anyway, adding javaParameters = true to the build script doesn't help.
I started seeing the logs after refreshing the snapshot version of Spring Boot (but Spring Core is v6.0.1). There was no issue before.
sample-project

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Nov 23, 2022
@sdeleuze
Copy link
Contributor

sdeleuze commented Nov 24, 2022

It is a side effect of fe5bd67 when Hibernate Validator is used. I can reproduce with both Kotlin and Java.

Here we have org.springframework.boot.context.properties.ConfigurationPropertiesJsr303Validator -> jakarta.validation.Validator.validate("Foooooo") -> org.hibernate.validator.internal.metadata.BeanMetaDataManagerImpl.createBeanMetaData(String.class) -> org.hibernate.validator.internal.metadata.aggregated.BeanMetaDataBuilder#build where here there are 107 builders (String constructors and methods).

They come from org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider#retrieveBeanConfiguration which adds all methods and all constructors of the types validated, and then org.hibernate.validator.internal.util.ExecutableParameterNameProvider delegates to org.springframework.validation.beanvalidation.LocalValidatorFactoryBean which in turn delegates to org.springframework.core.LocalVariableTableParameterNameDiscoverer on String JDK class not compiled with -parameters.

@bclozel bclozel changed the title Fresh Spring Boot Application Logs Too Many Warning LocalVariableTableParameterNameDiscoverer logs many warnings with Hibernate validation Nov 24, 2022
@jhoeller jhoeller self-assigned this Nov 24, 2022
@jhoeller jhoeller added type: regression A bug that is also a regression in: core Issues in core modules (aop, beans, core, context, expression) and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Nov 24, 2022
@jhoeller jhoeller added this to the 6.0.2 milestone Nov 24, 2022
@emeraldhieu
Copy link

emeraldhieu commented Dec 2, 2022

This still happens in spring 6.0.2. Spring Boot 3.0.0.

@plause
Copy link

plause commented Dec 2, 2022

This still happens in spring 6.0.2. Spring Boot 3.0.0.

Adding -java-parameters(Kotlin)/-parameters(Java) flag to the compiler options helps get rid of these warnings.

tasks.withType<KotlinCompile> {
    kotlinOptions {
        freeCompilerArgs = listOf("-java-parameters")
    }
}
compileJava {
    options.compilerArgs << '-parameters'
}

Note: you should read/know the Drawbacks of javac -parameters flag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: regression A bug that is also a regression
Projects
None yet
Development

No branches or pull requests

6 participants