Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,7 +33,7 @@ public class StringLiteral extends Literal {
|
||||
|
||||
|
||||
public StringLiteral(String payload, int pos, String value) {
|
||||
super(payload,pos);
|
||||
super(payload, pos);
|
||||
value = value.substring(1, value.length() - 1);
|
||||
this.value = new TypedValue(value.replaceAll("''", "'").replaceAll("\"\"", "\""));
|
||||
this.exitTypeDescriptor = "Ljava/lang/String";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -132,9 +132,9 @@ public class SpelCompiler implements Opcodes {
|
||||
@Nullable
|
||||
private Class<? extends CompiledExpression> createExpressionClass(SpelNodeImpl expressionToCompile) {
|
||||
// Create class outline 'spel/ExNNN extends org.springframework.expression.spel.CompiledExpression'
|
||||
String clazzName = "spel/Ex" + getNextSuffix();
|
||||
String className = "spel/Ex" + getNextSuffix();
|
||||
ClassWriter cw = new ExpressionClassWriter();
|
||||
cw.visit(V1_5, ACC_PUBLIC, clazzName, null, "org/springframework/expression/spel/CompiledExpression", null);
|
||||
cw.visit(V1_5, ACC_PUBLIC, className, null, "org/springframework/expression/spel/CompiledExpression", null);
|
||||
|
||||
// Create default constructor
|
||||
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
|
||||
@@ -152,7 +152,7 @@ public class SpelCompiler implements Opcodes {
|
||||
new String[ ]{"org/springframework/expression/EvaluationException"});
|
||||
mv.visitCode();
|
||||
|
||||
CodeFlow cf = new CodeFlow(clazzName, cw);
|
||||
CodeFlow cf = new CodeFlow(className, cw);
|
||||
|
||||
// Ask the expression AST to generate the body of the method
|
||||
try {
|
||||
@@ -181,7 +181,7 @@ public class SpelCompiler implements Opcodes {
|
||||
byte[] data = cw.toByteArray();
|
||||
// TODO need to make this conditionally occur based on a debug flag
|
||||
// dump(expressionToCompile.toStringAST(), clazzName, data);
|
||||
return loadClass(clazzName.replaceAll("/", "."), data);
|
||||
return loadClass(className.replaceAll("/", "."), data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -256,12 +256,12 @@ public class SpelCompiler implements Opcodes {
|
||||
}
|
||||
|
||||
int getClassesDefinedCount() {
|
||||
return classesDefinedCount;
|
||||
return this.classesDefinedCount;
|
||||
}
|
||||
|
||||
public Class<?> defineClass(String name, byte[] bytes) {
|
||||
Class<?> clazz = super.defineClass(name, bytes, 0, bytes.length);
|
||||
classesDefinedCount++;
|
||||
this.classesDefinedCount++;
|
||||
return clazz;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user