Skip to content

Commit

Permalink
Allow spring-expression to be more easily repackaged
Browse files Browse the repository at this point in the history
This commit allows the spring-expression module to be more easily repackaged
for embedding in third-party JARs -- for example, via the Shadow Gradle plugin.

Closes spring-projectsgh-26779
  • Loading branch information
BFergerson authored Apr 9, 2021
1 parent f7606ba commit 432c720
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ private int getNextSuffix() {
private Class<? extends CompiledExpression> createExpressionClass(SpelNodeImpl expressionToCompile) {
// Create class outline 'spel/ExNNN extends org.springframework.expression.spel.CompiledExpression'
String className = "spel/Ex" + getNextSuffix();
String evaluationContextClass = "org/springframework/expression/EvaluationContext";
ClassWriter cw = new ExpressionClassWriter();
cw.visit(V1_8, ACC_PUBLIC, className, null, "org/springframework/expression/spel/CompiledExpression", null);

Expand All @@ -151,7 +152,7 @@ private Class<? extends CompiledExpression> createExpressionClass(SpelNodeImpl e

// Create getValue() method
mv = cw.visitMethod(ACC_PUBLIC, "getValue",
"(Ljava/lang/Object;Lorg/springframework/expression/EvaluationContext;)Ljava/lang/Object;", null,
"(Ljava/lang/Object;L" + evaluationContextClass + ";)Ljava/lang/Object;", null,
new String[] {"org/springframework/expression/EvaluationException"});
mv.visitCode();

Expand Down

0 comments on commit 432c720

Please sign in to comment.