If you are using named parameters, ensure that the compiler uses the '-parameters' flag.

On updating our application to Spring Boot 3.2.5 and Spring framework 6.1.6. we are getting following Errors.

ERROR c.a.s.t.c.e.ControllerExceptionHandler - 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.
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.
ERROR c.a.s.t.c.e.ControllerExceptionHandler - java.lang.IllegalArgumentException: Null key returned for cache operation [Builder[public com.apple.store.tools.infrared.model.FdcInstanceWrapper com.apple.store.tools.infrared.service.CacheableFdcService.getInfraRedData(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String)] caches=[infraRedFdc] | key='#envDcCacheKey' | keyGenerator='' | cacheManager='' | cacheResolver='' | condition='' | unless='' | sync='true']. If you are using named parameters, ensure that the compiler uses the '-parameters' flag.
java.lang.IllegalArgumentException: Null key returned for cache operation [Builder[public com.apple.store.tools.infrared.model.FdcInstanceWrapper com.apple.store.tools.infrared.service.CacheableFdcService.getInfraRedData(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String)] caches=[infraRedFdc] | key='#envDcCacheKey' | keyGenerator='' | cacheManager='' | cacheResolver='' | condition='' | unless='' | sync='true']. If you are using named parameters, ensure that the compiler uses the '-parameters' flag.

I am using Vscode 1.88.1 with following configuration:

  • springBootVersion= 3.2.5
  • springFrameworkVersion= 6.1.6
  • Java= 17.0.5
  • gradle= 8.7

It seams, it is asking to compile(java) code with ‘-parameters’ flag. So for that, I have followed the directions on Upgrading to Spring Framework 6.x · spring-projects/spring-framework Wiki · GitHub

I have added:

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

Even i had tried adding following mentioned in Thread: IllegalArgumentException: Null key returned for cache operation · Issue #31729 · spring-projects/spring-framework · GitHub

 tasks.withType(JavaCompile) {
        configure(options) {
            options.compilerArgs << '-parameters'
        }
    }

Nothing works for me. Could you please help me in resolving this issue.

gradle kts use the following methods to add it

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

What do you mean by “Nothing works for me.”, does it still bring the same error, it can you not build? You second variation and what @livk-cloud suggested you should definitely not use, as that breaks task-configuration avoidance for all tasks of that type.