Skip to content
Commits on Source (8)
mvel (2.4.4-1) unstable; urgency=medium
* Team upload.
* New upstream version 2.4.4.
* Switch to debhelper-compat = 12.
* Declare compliance with Debian Policy 4.4.0.
* Use canonical VCS URI.
* Do not build libmvel-java-doc anymore. The package is empty because the
javadoc plugin fails to build the documentation. Just ignoring the javadoc
errors with Java 9+ is not sufficient anymore.
-- Markus Koschany <apo@debian.org> Mon, 26 Aug 2019 21:52:42 +0200
mvel (2.4.0-1) unstable; urgency=medium
* Team upload.
......
......@@ -5,7 +5,7 @@ Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.or
Uploaders:
Damien Raude-Morvan <drazzib@debian.org>
Build-Depends:
debhelper (>= 10),
debhelper-compat (= 12),
default-jdk,
default-jdk-doc,
junit4,
......@@ -17,9 +17,9 @@ Build-Depends:
libsurefire-java (>= 2.4.3),
libxstream-java,
maven-debian-helper
Standards-Version: 4.1.2
Vcs-Git: https://anonscm.debian.org/git/pkg-java/mvel.git
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/mvel.git
Standards-Version: 4.4.0
Vcs-Git: https://salsa.debian.org/java-team/mvel.git
Vcs-Browser: https://salsa.debian.org/java-team/mvel
Homepage: https://github.com/mvel/mvel/
Package: libmvel-java
......@@ -36,21 +36,3 @@ Description: expression language for Java-based applications - Library
In addition to being an expression language, MVEL also comes packaged with an
templating system similar to Velocity and FreeMarker.
Package: libmvel-java-doc
Architecture: all
Section: doc
Depends:
${maven:DocDepends},
${misc:Depends}
Recommends:
${maven:DocOptionalDepends}
Suggests:
libmvel-java
Description: expression language for Java-based applications - Javadoc
MVEL may be useful as an extension to anything from use in JSP Tag Libraries,
to the configuration facilities of your library/framework.
.
In addition to being an expression language, MVEL also comes packaged with an
templating system similar to Velocity and FreeMarker.
.
This package provides the API documentation for libmvel-java.
Document: libmvel-java
Title: API Javadoc for MVEL
Author: MVEL developers
Abstract: This is the API Javadoc provided for the
libmvel-java library.
Section: Programming
Format: HTML
Index: /usr/share/doc/libmvel-java/api/index.html
Files: /usr/share/doc/libmvel-java/api/*
target/apidocs/* usr/share/doc/libmvel-java/api
From: Markus Koschany <apo@debian.org>
Date: Sat, 2 Dec 2017 09:54:39 +0100
Subject: java9
Work around FTBFS with Java 9 by ignoring the doclint errors.
Bug-Debian: https://bugs.debian.org/875775
Forwarded: no
---
pom.xml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/pom.xml b/pom.xml
index dbed0b0..fdb10b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -80,6 +80,13 @@
</extensions>
<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <failOnError>false</failOnError>
+ </configuration>
+ </plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0</version>
use_system_asm.diff
java9.patch
......@@ -8,6 +8,3 @@ export JAVA_HOME = /usr/lib/jvm/default-java
override_dh_clean:
dh_clean
rm -Rf META-INF
get-orig-source:
uscan --download-current-version --force-download --repack --compression xz
......@@ -5,7 +5,7 @@
<groupId>org.mvel</groupId>
<artifactId>mvel2</artifactId>
<packaging>jar</packaging>
<version>2.4.0.Final</version>
<version>2.4.4.Final</version>
<name>mvel</name>
<url>http://mvel.codehaus.org/</url>
......@@ -31,7 +31,7 @@
<connection>scm:git:git@github.com:mvel/mvel.git</connection>
<url>scm:git:git@github.com:mvel/mvel.git</url>
<developerConnection>scm:git:git@github.com:mvel/mvel.git</developerConnection>
<tag>mvel2-2.4.0.Final</tag>
<tag>mvel2-2.4.4.Final</tag>
</scm>
<issueManagement>
<system>jira</system>
......@@ -229,6 +229,9 @@
<include>build.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
......
......@@ -73,8 +73,16 @@ public class BinaryOperation extends BooleanNode {
egressType = getReturnTypeFromOp(operation, this.left.egressType, this.right.egressType);
if (!ctx.isStrongTyping()) break;
if (!left.getEgressType().isAssignableFrom(right.getEgressType()) && !right.getEgressType().isAssignableFrom(left.getEgressType())) {
if (right.isLiteral() && canConvert(left.getEgressType(), right.getEgressType())) {
final boolean leftIsAssignableFromRight = left.getEgressType().isAssignableFrom(right.getEgressType());
final boolean rightIsAssignableFromLeft = right.getEgressType().isAssignableFrom(left.getEgressType());
if (!leftIsAssignableFromRight && !rightIsAssignableFromLeft) {
// Convert literals only when passing from String to Character or from Float to Double
final boolean requiresConversion = right.getEgressType() == String.class || (
right.getEgressType() == Double.class && ( left.getEgressType() == Float.class || left.getEgressType() == float.class ) );
if (right.isLiteral() && requiresConversion && canConvert(left.getEgressType(), right.getEgressType())) {
Class targetType = isAritmeticOperation(operation) ? egressType : left.getEgressType();
this.right = new LiteralNode(convert(right.getReducedValueAccelerated(null, null, null), targetType), pCtx);
} else if ( !(areCompatible(left.getEgressType(), right.getEgressType()) ||
......
......@@ -113,6 +113,7 @@ public class AbstractParser implements Parser, Serializable {
protected int fields;
protected static final int OP_NOT_LITERAL = -3;
protected static final int OP_OVERFLOW = -2;
protected static final int OP_TERMINATE = -1;
protected static final int OP_RESET_FRAME = 0;
......@@ -2407,8 +2408,6 @@ public class AbstractParser implements Parser, Serializable {
* need to stop if this is not a literal.
*/
if (compileMode && !tk.isLiteral()) {
splitAccumulator.push(tk, new OperatorNode(operator2, expr, st, pCtx));
return OP_OVERFLOW;
}
......@@ -2416,6 +2415,7 @@ public class AbstractParser implements Parser, Serializable {
dStack.push(operator = operator2, tk.getReducedValue(ctx, ctx, variableFactory));
while (true) {
ASTNode previousToken = tk;
// look ahead again
if ((tk = nextToken()) != null && (operator2 = tk.getOperator()) != -1
&& operator2 != END_OF_STMT && PTABLE[operator2] > PTABLE[operator]) {
......@@ -2428,7 +2428,12 @@ public class AbstractParser implements Parser, Serializable {
/**
* This operator is of higher precedence, or the same level precedence. push to the RHS.
*/
dStack.push(operator = operator2, nextToken().getReducedValue(ctx, ctx, variableFactory));
ASTNode nextToken = nextToken();
if (compileMode && !nextToken.isLiteral()) {
splitAccumulator.push(nextToken, new OperatorNode(operator2, expr, st, pCtx));
return OP_OVERFLOW;
}
dStack.push(operator = operator2, nextToken.getReducedValue(ctx, ctx, variableFactory));
continue;
}
......@@ -2498,6 +2503,10 @@ public class AbstractParser implements Parser, Serializable {
}
default:
if (compileMode && !tk.isLiteral()) {
stk.push(operator, tk);
return OP_NOT_LITERAL;
}
stk.push(operator, tk.getReducedValue(ctx, ctx, variableFactory));
}
}
......
......@@ -123,7 +123,7 @@ public class ExpressionCompiler extends AbstractParser {
fields |= COMPILE_IMMEDIATE;
while ((tk = nextToken()) != null) {
main_loop: while ((tk = nextToken()) != null) {
/**
* If this is a debug symbol, just add it and continue.
*/
......@@ -199,7 +199,7 @@ public class ExpressionCompiler extends AbstractParser {
stk.push(tkLA2.getLiteralValue(), op = tkOp2.getOperator());
if (isArithmeticOperator(op)) {
compileReduce(op, astBuild);
if (!compileReduce(op, astBuild)) continue main_loop;
}
else {
reduce();
......@@ -327,7 +327,7 @@ public class ExpressionCompiler extends AbstractParser {
private boolean compileReduce(int opCode, ASTLinkedList astBuild) {
switch (arithmeticFunctionReduction(opCode)) {
case -1:
case OP_TERMINATE:
/**
* The reduction failed because we encountered a non-literal,
* so we must now back out and cleanup.
......@@ -341,7 +341,7 @@ public class ExpressionCompiler extends AbstractParser {
verify(pCtx, (ASTNode) splitAccumulator.pop())
);
return false;
case -2:
case OP_OVERFLOW:
/**
* Back out completely, pull everything back off the stack and add the instructions
* to the output payload as they are.
......@@ -353,6 +353,13 @@ public class ExpressionCompiler extends AbstractParser {
astBuild.addTokenNode(new LiteralNode(stk.pop(), pCtx), operator);
astBuild.addTokenNode(rightValue, (OperatorNode) splitAccumulator.pop());
astBuild.addTokenNode(verify(pCtx, (ASTNode) splitAccumulator.pop()));
return false;
case OP_NOT_LITERAL:
ASTNode tkLA2 = (ASTNode) stk.pop();
Integer tkOp2 = (Integer) stk.pop();
astBuild.addTokenNode(new LiteralNode(getStackValueResult(), pCtx));
astBuild.addTokenNode(new OperatorNode(tkOp2, expr, st, pCtx), verify(pCtx, tkLA2));
return false;
}
return true;
}
......
package org.mvel2.jsr223;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.script.ScriptEngine;
......@@ -14,14 +15,25 @@ public class MvelScriptEngineFactory implements ScriptEngineFactory {
private static final String LANGUAGE_NAME = "mvel";
private static final String LANGUAGE_VERSION = MVEL.VERSION;
private static final List<String> NAMES = new ArrayList<String>();
private static final List<String> EXTENSIONS = new ArrayList<String>();
private static final List<String> MIME_TYPES = new ArrayList<String>();
private static final List<String> NAMES;
private static final List<String> EXTENSIONS;
private static final List<String> MIME_TYPES;
static {
List<String> n = new ArrayList<String>(1);
n.add(LANGUAGE_NAME);
NAMES = Collections.unmodifiableList(n);
EXTENSIONS = NAMES;
n = new ArrayList<String>(1);
n.add("application/x-"+LANGUAGE_NAME);
MIME_TYPES = Collections.unmodifiableList(n);
}
private static final MvelScriptEngine MVEL_SCRIPT_ENGINE = new MvelScriptEngine();
public MvelScriptEngineFactory() {
NAMES.add(LANGUAGE_NAME);
}
@Override
......
......@@ -121,7 +121,9 @@ public class ASMAccessorOptimizer extends AbstractOptimizer implements AccessorO
} else if (javaVersion.startsWith("1.6")
|| javaVersion.startsWith("1.7")
|| javaVersion.startsWith("1.8")
|| javaVersion.startsWith("9")) {
|| javaVersion.startsWith("9")
|| javaVersion.startsWith("10")
|| javaVersion.startsWith("11")) {
OPCODES_VERSION = Opcodes.V1_6;
} else {
OPCODES_VERSION = Opcodes.V1_2;
......
......@@ -377,7 +377,7 @@ public class ReflectiveAccessorOptimizer extends AbstractOptimizer implements Ac
if (cursor < end) {
if (nullSafe) {
int os = expr[cursor] == '.' ? 1 : 0;
addAccessorNode(new NullSafe(expr, cursor + os, length - cursor - os, pCtx));
addAccessorNode(new NullSafe(expr, cursor + os, end - cursor - os, pCtx));
if (curr == null) break;
}
if (curr == null) throw new NullPointerException();
......@@ -806,17 +806,16 @@ public class ReflectiveAccessorOptimizer extends AbstractOptimizer implements Ac
return ((CharSequence) ctx).charAt((Integer) idx);
}
else {
else if (ctx instanceof Class) {
TypeDescriptor tDescr = new TypeDescriptor(expr, this.start, length, 0);
if (tDescr.isArray()) {
Class cls = getClassReference((Class) ctx, tDescr, variableFactory, pCtx);
rootNode = new StaticReferenceAccessor(cls);
return cls;
}
throw new CompileException("illegal use of []: unknown type: "
+ ctx.getClass().getName(), this.expr, this.start);
}
throw new CompileException("illegal use of []: unknown type: "
+ ctx.getClass().getName(), this.expr, this.start);
}
......
......@@ -19,6 +19,7 @@
package org.mvel2.optimizers.impl.refl.nodes;
import org.mvel2.ast.Function;
import org.mvel2.ast.FunctionInstance;
import org.mvel2.compiler.Accessor;
import org.mvel2.integration.VariableResolverFactory;
......@@ -34,7 +35,12 @@ public class DynamicFunctionAccessor extends BaseAccessor {
public Object getValue(Object ctx, Object elCtx, VariableResolverFactory variableFactory) {
Object[] parms = null;
Function function = (Function) ctx;
Function function;
if (ctx instanceof FunctionInstance){
function = ((FunctionInstance)ctx).getFunction();
} else {
function = (Function)ctx;
}
if (parameters != null && parameters.length != 0) {
parms = new Object[parameters.length];
......
......@@ -103,7 +103,7 @@ public class CompilerTools {
bo = null;
boolean inv = tkOp.isOperator(Operator.SUB);
boolean reduc = isReductionOpportunity(tkOp, tk2);
boolean reduc = tk.isLiteral() && isReductionOpportunity(tkOp, tk2);
boolean p_inv = false;
while (reduc) {
......
......@@ -18,13 +18,17 @@
package org.mvel2.util;
import org.mvel2.ImmutableElementException;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.*;
import java.util.AbstractList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import org.mvel2.ImmutableElementException;
public class FastList<E> extends AbstractList<E> implements Externalizable {
private E[] elements;
......@@ -168,14 +172,14 @@ public class FastList<E> extends AbstractList<E> implements Externalizable {
public ListIterator<E> listIterator() {
return new ListIterator<E>() {
private int i = 0;
private int i = -1;
public boolean hasNext() {
return i < size;
return i < size-1;
}
public E next() {
return elements[i++];
return elements[++i];
}
public boolean hasPrevious() {
......@@ -183,7 +187,7 @@ public class FastList<E> extends AbstractList<E> implements Externalizable {
}
public E previous() {
return elements[i--];
return elements[--i];
}
public int nextIndex() {
......
......@@ -320,7 +320,7 @@ public class ParseTools {
if (arguments[i] == null) {
if (!actualParamType.isPrimitive()) {
score += 6;
score += 7;
}
else {
score = 0;
......@@ -328,15 +328,18 @@ public class ParseTools {
}
}
else if (actualParamType == arguments[i]) {
score += 7;
score += 8;
}
else if (actualParamType.isPrimitive() && boxPrimitive(actualParamType) == arguments[i]) {
score += 6;
score += 7;
}
else if (arguments[i].isPrimitive() && unboxPrimitive(arguments[i]) == actualParamType) {
score += 6;
score += 7;
}
else if (actualParamType.isAssignableFrom(arguments[i])) {
score += 6;
}
else if (isPrimitiveSubtype(arguments[i], actualParamType)) {
score += 5;
}
else if (isNumericallyCoercible(arguments[i], actualParamType)) {
......@@ -1065,6 +1068,22 @@ public class ParseTools {
return code;
}
private static boolean isPrimitiveSubtype( Class argument, Class<?> actualParamType ) {
if (!actualParamType.isPrimitive()) {
return false;
}
Class<?> primitiveArgument = unboxPrimitive(argument);
if (!primitiveArgument.isPrimitive()) {
return false;
}
return ( actualParamType == double.class && primitiveArgument == float.class ) ||
( actualParamType == float.class && primitiveArgument == long.class ) ||
( actualParamType == long.class && primitiveArgument == int.class ) ||
( actualParamType == int.class && primitiveArgument == char.class ) ||
( actualParamType == int.class && primitiveArgument == short.class ) ||
( actualParamType == short.class && primitiveArgument == byte.class );
}
public static boolean isNumericallyCoercible(Class target, Class parm) {
Class boxedTarget = target.isPrimitive() ? boxPrimitive(target) : target;
......@@ -2175,7 +2194,7 @@ public class ParseTools {
public static Class forNameWithInner(String className, ClassLoader classLoader) throws ClassNotFoundException {
try {
return Class.forName(className, true, classLoader);
return classLoader.loadClass( className );
} catch (ClassNotFoundException cnfe) {
return findInnerClass( className, classLoader, cnfe );
}
......@@ -2185,7 +2204,7 @@ public class ParseTools {
for (int lastDotPos = className.lastIndexOf('.'); lastDotPos > 0; lastDotPos = className.lastIndexOf('.')) {
className = className.substring(0, lastDotPos) + "$" + className.substring(lastDotPos+1);
try {
return Class.forName(className, true, classLoader);
return classLoader.loadClass( className );
} catch (ClassNotFoundException e) { /* ignore */ }
}
throw cnfe;
......
......@@ -97,6 +97,13 @@ public class PropertyTools {
String getter = ReflectionUtil.getGetter(property);
Method candidate = null;
if (Collection.class.isAssignableFrom(clazz) && "isEmpty".equals(isGet)) {
try {
return Collection.class.getMethod("isEmpty");
} catch (NoSuchMethodException ignore) {}
}
for (Method meth : clazz.getMethods()) {
if ((meth.getModifiers() & PUBLIC) != 0 && (meth.getModifiers() & STATIC) == 0 && meth.getParameterTypes().length == 0
&& (getter.equals(meth.getName()) || property.equals(meth.getName()) || ((isGet.equals(meth.getName()) || simpleIsGet.equals(meth.getName())) && meth.getReturnType() == boolean.class)
......