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

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

Closed
spring-projects-issues opened this issue Dec 9, 2015 · 4 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Dec 9, 2015

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

@spring-projects-issues
Copy link
Collaborator Author

Andy Clement commented

Fix pushed. A similar problem was lurking for static methods and static property access (in addition to this static field problem). I covered all of that with test cases and addressed it.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Perfect - thanks, Andy! I'll backport these changes to 4.1.9 over the weekend then.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Andrei Ivanov commented

Tested the SNAPSHOT, works fine :)
Thank you

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Good to hear! Thanks for the immediate feedback...

Juergen

@spring-projects-issues spring-projects-issues added type: bug A general bug status: backported An issue that has been backported to maintenance branches in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.2.4 milestone Jan 11, 2019
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) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants