Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to Jakarta EL 4 compatible version of JUEL #915

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
<version>1.14.2</version>
</dependency>
<dependency>
<groupId>de.odysseus.juel</groupId>
<artifactId>juel-api</artifactId>
<version>2.2.7</version>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>de.odysseus.juel</groupId>
<artifactId>juel-impl</artifactId>
<version>2.2.7</version>
<version>4.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.re2j</groupId>
Expand Down Expand Up @@ -78,6 +78,12 @@
<artifactId>jackson-dataformat-yaml</artifactId>
<version>2.12.6</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.23.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>

Expand All @@ -99,8 +105,9 @@
<artifactId>jsoup</artifactId>
</dependency>
<dependency>
<groupId>de.odysseus.juel</groupId>
<artifactId>juel-api</artifactId>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.odysseus.juel</groupId>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/hubspot/jinjava/Jinjava.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import java.util.Map;
import java.util.Properties;
import java.util.stream.Collectors;
import javax.el.ExpressionFactory;
import jakarta.el.ExpressionFactory;

/**
* The main client API for the Jinjava library, instances of this class can be used to render jinja templates with a given map of context values. Example use:
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/hubspot/jinjava/JinjavaConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import javax.el.ELResolver;
import jakarta.el.ELResolver;

public class JinjavaConfig {
private final Charset charset;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/hubspot/jinjava/el/ExpressionResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
import de.odysseus.el.tree.TreeBuilderException;
import java.util.Arrays;
import java.util.List;
import javax.el.ELException;
import javax.el.ExpressionFactory;
import javax.el.PropertyNotFoundException;
import javax.el.ValueExpression;
import jakarta.el.ELException;
import jakarta.el.ExpressionFactory;
import jakarta.el.PropertyNotFoundException;
import jakarta.el.ValueExpression;
import org.apache.commons.lang3.StringUtils;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/hubspot/jinjava/el/JinjavaELContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.hubspot.jinjava.interpret.JinjavaInterpreter;
import de.odysseus.el.util.SimpleContext;
import java.lang.reflect.Method;
import javax.el.ELResolver;
import jakarta.el.ELResolver;

public class JinjavaELContext extends SimpleContext {
private JinjavaInterpreter interpreter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import javax.el.ArrayELResolver;
import javax.el.CompositeELResolver;
import javax.el.ELContext;
import javax.el.ELResolver;
import javax.el.PropertyNotFoundException;
import javax.el.ResourceBundleELResolver;
import jakarta.el.ArrayELResolver;
import jakarta.el.CompositeELResolver;
import jakarta.el.ELContext;
import jakarta.el.ELResolver;
import jakarta.el.PropertyNotFoundException;
import jakarta.el.ResourceBundleELResolver;
import org.apache.commons.lang3.LocaleUtils;
import org.apache.commons.lang3.StringUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.el.FunctionMapper;
import jakarta.el.FunctionMapper;

public class MacroFunctionMapper extends FunctionMapper {
private final JinjavaInterpreter interpreter;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/hubspot/jinjava/el/NoInvokeELContext.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.hubspot.jinjava.el;

import javax.el.ELContext;
import javax.el.ELResolver;
import javax.el.FunctionMapper;
import javax.el.VariableMapper;
import jakarta.el.ELContext;
import jakarta.el.ELResolver;
import jakarta.el.FunctionMapper;
import jakarta.el.VariableMapper;

public class NoInvokeELContext extends ELContext {
private ELContext delegate;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/hubspot/jinjava/el/NoInvokeELResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.hubspot.jinjava.el.ext.DeferredParsingException;
import java.beans.FeatureDescriptor;
import java.util.Iterator;
import javax.el.ELContext;
import javax.el.ELResolver;
import jakarta.el.ELContext;
import jakarta.el.ELResolver;

/**
* An ELResolver that is read only and does not allow invocation of methods.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.EnumSet;
import javax.el.ELException;
import jakarta.el.ELException;

public class TruthyTypeConverter extends TypeConverterImpl {
private static final long serialVersionUID = 1L;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.hubspot.jinjava.el;

import java.util.Map;
import javax.el.ELContext;
import javax.el.ELException;
import javax.el.MapELResolver;
import jakarta.el.ELContext;
import jakarta.el.ELException;
import jakarta.el.MapELResolver;

public class TypeConvertingMapELResolver extends MapELResolver {
private static final TruthyTypeConverter TYPE_CONVERTER = new TruthyTypeConverter();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/hubspot/jinjava/el/ext/AstDict.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import javax.el.ELContext;
import jakarta.el.ELContext;

public class AstDict extends AstLiteral {
protected final Map<AstNode, AstNode> dict;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/hubspot/jinjava/el/ext/AstList.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import de.odysseus.el.tree.impl.ast.AstParameters;
import java.util.ArrayList;
import java.util.List;
import javax.el.ELContext;
import jakarta.el.ELContext;
import org.apache.commons.lang3.StringUtils;

public class AstList extends AstLiteral {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import de.odysseus.el.tree.impl.ast.AstFunction;
import de.odysseus.el.tree.impl.ast.AstParameters;
import java.lang.reflect.InvocationTargetException;
import javax.el.ELContext;
import javax.el.ELException;
import jakarta.el.ELContext;
import jakarta.el.ELException;

public class AstMacroFunction extends AstFunction {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import de.odysseus.el.tree.impl.ast.AstIdentifier;
import de.odysseus.el.tree.impl.ast.AstLiteral;
import de.odysseus.el.tree.impl.ast.AstNode;
import javax.el.ELContext;
import jakarta.el.ELContext;

public class AstNamedParameter extends AstLiteral {
private final AstIdentifier name;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/hubspot/jinjava/el/ext/AstRangeBracket.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import javax.el.ELContext;
import javax.el.ELException;
import javax.el.PropertyNotFoundException;
import jakarta.el.ELContext;
import jakarta.el.ELException;
import jakarta.el.PropertyNotFoundException;

public class AstRangeBracket extends AstBracket {
protected final AstNode rangeMax;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/hubspot/jinjava/el/ext/AstTuple.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import de.odysseus.el.tree.Bindings;
import de.odysseus.el.tree.impl.ast.AstParameters;
import java.util.Collections;
import javax.el.ELContext;
import jakarta.el.ELContext;

public class AstTuple extends AstList {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Objects;
import javax.el.ELException;
import jakarta.el.ELException;
import org.apache.commons.lang3.StringUtils;

public class CollectionMembershipOperator extends SimpleOperator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.el.ELException;
import jakarta.el.ELException;

public class ExtendedParser extends Parser {
public static final String INTERPRETER = "____int3rpr3t3r____";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Set;
import javax.el.BeanELResolver;
import javax.el.ELContext;
import javax.el.MethodNotFoundException;
import jakarta.el.BeanELResolver;
import jakarta.el.ELContext;
import jakarta.el.MethodNotFoundException;

/**
* {@link BeanELResolver} supporting snake case property names.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.hubspot.jinjava.el.ext;

import java.util.List;
import javax.el.ELContext;
import javax.el.ListELResolver;
import jakarta.el.ELContext;
import jakarta.el.ListELResolver;

public class JinjavaListELResolver extends ListELResolver {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import de.odysseus.el.tree.impl.Scanner;
import de.odysseus.el.tree.impl.ast.AstIdentifier;
import de.odysseus.el.tree.impl.ast.AstNode;
import javax.el.ELException;
import jakarta.el.ELException;

public class NamedParameterOperator {
public static final Scanner.ExtensionToken TOKEN = new Scanner.ExtensionToken("=");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/hubspot/jinjava/el/ext/OrOperator.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import de.odysseus.el.tree.Bindings;
import de.odysseus.el.tree.impl.ast.AstBinary.Operator;
import de.odysseus.el.tree.impl.ast.AstNode;
import javax.el.ELContext;
import jakarta.el.ELContext;

public class OrOperator implements Operator {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import de.odysseus.el.tree.Bindings;
import de.odysseus.el.tree.impl.ast.AstBinary;
import de.odysseus.el.tree.impl.ast.AstNode;
import javax.el.ELContext;
import jakarta.el.ELContext;

public class EagerAstBinary extends AstBinary implements EvalResultHolder {
protected Object evalResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import de.odysseus.el.tree.Bindings;
import de.odysseus.el.tree.impl.ast.AstBracket;
import de.odysseus.el.tree.impl.ast.AstNode;
import javax.el.ELContext;
import jakarta.el.ELContext;

public class EagerAstBracket extends AstBracket implements EvalResultHolder {
protected Object evalResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import de.odysseus.el.tree.Bindings;
import de.odysseus.el.tree.impl.ast.AstChoice;
import de.odysseus.el.tree.impl.ast.AstNode;
import javax.el.ELContext;
import javax.el.ELException;
import jakarta.el.ELContext;
import jakarta.el.ELException;

public class EagerAstChoice extends AstChoice implements EvalResultHolder {
protected Object evalResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import de.odysseus.el.tree.impl.ast.AstNode;
import java.util.Map;
import java.util.StringJoiner;
import javax.el.ELContext;
import jakarta.el.ELContext;

public class EagerAstDict extends AstDict implements EvalResultHolder {
protected Object evalResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import de.odysseus.el.tree.Bindings;
import de.odysseus.el.tree.impl.ast.AstDot;
import de.odysseus.el.tree.impl.ast.AstNode;
import javax.el.ELContext;
import javax.el.ELException;
import jakarta.el.ELContext;
import jakarta.el.ELException;

public class EagerAstDot extends AstDot implements EvalResultHolder {
protected Object evalResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.hubspot.jinjava.el.ext.DeferredParsingException;
import de.odysseus.el.tree.Bindings;
import de.odysseus.el.tree.impl.ast.AstIdentifier;
import javax.el.ELContext;
import jakarta.el.ELContext;

public class EagerAstIdentifier extends AstIdentifier implements EvalResultHolder {
protected Object evalResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import de.odysseus.el.tree.Bindings;
import de.odysseus.el.tree.impl.ast.AstParameters;
import java.util.StringJoiner;
import javax.el.ELContext;
import jakarta.el.ELContext;

public class EagerAstList extends AstList implements EvalResultHolder {
protected Object evalResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.StringJoiner;
import javax.el.ELContext;
import javax.el.ELException;
import jakarta.el.ELContext;
import jakarta.el.ELException;

public class EagerAstMacroFunction extends AstMacroFunction implements EvalResultHolder {
protected Object evalResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import de.odysseus.el.tree.impl.ast.AstNode;
import de.odysseus.el.tree.impl.ast.AstParameters;
import de.odysseus.el.tree.impl.ast.AstProperty;
import javax.el.ELContext;
import javax.el.ELException;
import jakarta.el.ELContext;
import jakarta.el.ELException;

public class EagerAstMethod extends AstMethod implements EvalResultHolder {
protected Object evalResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import de.odysseus.el.tree.Bindings;
import de.odysseus.el.tree.impl.ast.AstIdentifier;
import de.odysseus.el.tree.impl.ast.AstNode;
import javax.el.ELContext;
import jakarta.el.ELContext;

public class EagerAstNamedParameter
extends AstNamedParameter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import de.odysseus.el.tree.Node;
import de.odysseus.el.tree.impl.ast.AstNode;
import de.odysseus.el.tree.impl.ast.AstRightValue;
import javax.el.ELContext;
import jakarta.el.ELContext;

/**
* AstNested is final so this decorates AstRightValue.
Expand Down
Loading