From 432c720dd0398b8995625cd286b20a0a8184778c Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Fri, 9 Apr 2021 11:29:29 -0400 Subject: [PATCH] Allow spring-expression to be more easily repackaged 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 gh-26779 --- .../springframework/expression/spel/standard/SpelCompiler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelCompiler.java b/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelCompiler.java index 82d17e72bf..f2a225952a 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelCompiler.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelCompiler.java @@ -136,6 +136,7 @@ public final class SpelCompiler implements Opcodes { private Class 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); @@ -151,7 +152,7 @@ public final class SpelCompiler implements Opcodes { // 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();