Skip to content

SpEL compiler creating bad byte code for some values that are added together via OpPlus [SPR-12426] #17032

Closed
@spring-projects-issues

Description

@spring-projects-issues

Andy Clement opened SPR-12426 and commented

There is a problem with compilation of operands for the plus operator. If the types of the operands at runtime are strings but the statically determinable types are not strings, then a CHECKCAST is missed out during code gen and a verify error results. Simply example:

public class Foo {
  public Object getObject() { return "hello"; }
}

and the expression object+' world'. The expression will be compiled such that getObject() is called but it is declared to return an Object. When this happens an extra CHECKCAST is necessary during byte code generation to ensure the JVM knows it is really a string.


Affects: 4.1.2

Issue Links:

Referenced from: commits 58756b0, e410129, 94ee763

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