Skip to content

VerifyError when trying to compile constructor invocation with SpEL [SPR-13781] #18355

@spring-projects-issues

Description

@spring-projects-issues

Andrei Ivanov opened SPR-13781 and commented

Trying to use @Cachable on a method triggers a SpEL compiler exception:

@Cacheable(cacheManager = "eohsCacheManager", cacheNames = "eohsManagersCache", key = "#userId.toLowerCase(T(java.util.Locale).ENGLISH)")
private Manager getRemoteManager(String userId) {
}

Also tried with #userId.toString().toLowerCase(T(java.util.Locale).ENGLISH), fails the same way.

Works with #userId.toLowerCase().

Stacktrace is actually from my 4.2.4 SNAPSHOT test.

2015-12-09 14:27:00,271 taskExecutor-5 ||| DEBUG [o.s.e.s.s.SpelCompiler] - SpEL: compiling #userId.toLowerCase(T(java.util.Locale).ENGLISH)
2015-12-09 14:27:00,287 taskExecutor-5 ||| ERROR [o.q.c.JobRunShell] - Job DEFAULT.personsSyncJob threw an unhandled Exception: 
java.lang.IllegalStateException: Failed to instantiate CompiledExpression
	at org.springframework.expression.spel.standard.SpelCompiler.compile(SpelCompiler.java:111)
	at org.springframework.expression.spel.standard.SpelExpression.compileExpression(SpelExpression.java:467)
	at org.springframework.expression.spel.standard.SpelExpression.checkCompile(SpelExpression.java:437)
	at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:243)
	at org.springframework.cache.interceptor.ExpressionEvaluator.key(ExpressionEvaluator.java:115)
	at org.springframework.cache.interceptor.CacheAspectSupport$CacheOperationContext.generateKey(CacheAspectSupport.java:635)
	at org.springframework.cache.interceptor.CacheAspectSupport.generateKey(CacheAspectSupport.java:490)
	at org.springframework.cache.interceptor.CacheAspectSupport.collectPutRequests(CacheAspectSupport.java:461)
	at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:341)
	at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:302)
	at org.springframework.cache.aspectj.AbstractCacheAspect.ajc$around$org_springframework_cache_aspectj_AbstractCacheAspect$1$2bc714b5(AbstractCacheAspect.aj:74)
	.....
Caused by: java.lang.VerifyError: (class: spel/Ex2, method: getValue signature: (Ljava/lang/Object;Lorg/springframework/expression/EvaluationContext;)Ljava/lang/Object;) Incompatible object argument for function call
	at java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
	at java.lang.Class.getConstructor0(Class.java:3075)
	at java.lang.Class.newInstance(Class.java:412)
	at org.springframework.expression.spel.standard.SpelCompiler.compile(SpelCompiler.java:108)

Affects: 4.1.8, 4.2.3

Issue Links:

Backported to: 4.1.9

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions