From 0d962c1c856ea633a15ca5507348f4d13321af99 Mon Sep 17 00:00:00 2001 From: Dmytro Maidaniuk Date: Fri, 23 Sep 2022 11:27:57 +0300 Subject: [PATCH 1/2] Migration to Jakarta EL 4 compatible version of JUEL --- pom.xml | 19 +++++++++++++------ .../java/com/hubspot/jinjava/Jinjava.java | 2 +- .../com/hubspot/jinjava/JinjavaConfig.java | 2 +- .../jinjava/el/ExpressionResolver.java | 8 ++++---- .../hubspot/jinjava/el/JinjavaELContext.java | 2 +- .../el/JinjavaInterpreterResolver.java | 12 ++++++------ .../jinjava/el/MacroFunctionMapper.java | 2 +- .../hubspot/jinjava/el/NoInvokeELContext.java | 8 ++++---- .../jinjava/el/NoInvokeELResolver.java | 4 ++-- .../jinjava/el/TruthyTypeConverter.java | 2 +- .../el/TypeConvertingMapELResolver.java | 6 +++--- .../com/hubspot/jinjava/el/ext/AstDict.java | 2 +- .../com/hubspot/jinjava/el/ext/AstList.java | 2 +- .../jinjava/el/ext/AstMacroFunction.java | 4 ++-- .../jinjava/el/ext/AstNamedParameter.java | 2 +- .../jinjava/el/ext/AstRangeBracket.java | 6 +++--- .../com/hubspot/jinjava/el/ext/AstTuple.java | 2 +- .../el/ext/CollectionMembershipOperator.java | 2 +- .../jinjava/el/ext/ExtendedParser.java | 2 +- .../jinjava/el/ext/JinjavaBeanELResolver.java | 6 +++--- .../jinjava/el/ext/JinjavaListELResolver.java | 4 ++-- .../el/ext/NamedParameterOperator.java | 2 +- .../hubspot/jinjava/el/ext/OrOperator.java | 2 +- .../jinjava/el/ext/eager/EagerAstBinary.java | 2 +- .../jinjava/el/ext/eager/EagerAstBracket.java | 2 +- .../jinjava/el/ext/eager/EagerAstChoice.java | 4 ++-- .../jinjava/el/ext/eager/EagerAstDict.java | 2 +- .../jinjava/el/ext/eager/EagerAstDot.java | 4 ++-- .../el/ext/eager/EagerAstIdentifier.java | 2 +- .../jinjava/el/ext/eager/EagerAstList.java | 2 +- .../el/ext/eager/EagerAstMacroFunction.java | 4 ++-- .../jinjava/el/ext/eager/EagerAstMethod.java | 4 ++-- .../el/ext/eager/EagerAstNamedParameter.java | 2 +- .../jinjava/el/ext/eager/EagerAstNested.java | 2 +- .../el/ext/eager/EagerAstNodeDecorator.java | 6 +++--- .../el/ext/eager/EagerAstParameters.java | 2 +- .../el/ext/eager/EagerAstRangeBracket.java | 2 +- .../jinjava/el/ext/eager/EagerAstRoot.java | 6 +++--- .../jinjava/el/ext/eager/EagerAstTuple.java | 2 +- .../jinjava/el/ext/eager/EagerAstUnary.java | 2 +- .../el/ext/eager/EvalResultHolder.java | 4 ++-- .../jinjava/util/EagerExpressionResolver.java | 2 +- .../el/ext/eager/EagerAstIdentifierTest.java | 2 +- .../lib/fn/StringToTimeFunctionTest.java | 5 +++-- 44 files changed, 87 insertions(+), 79 deletions(-) diff --git a/pom.xml b/pom.xml index 67e11dfed..cd81079db 100644 --- a/pom.xml +++ b/pom.xml @@ -29,14 +29,14 @@ 1.14.2 - de.odysseus.juel - juel-api - 2.2.7 + jakarta.el + jakarta.el-api + 4.0.0 de.odysseus.juel juel-impl - 2.2.7 + 4.0.0-SNAPSHOT com.google.re2j @@ -58,6 +58,12 @@ java-ipv6 0.17 + + org.assertj + assertj-core + 3.23.1 + test + @@ -79,8 +85,9 @@ jsoup - de.odysseus.juel - juel-api + jakarta.el + jakarta.el-api + provided de.odysseus.juel diff --git a/src/main/java/com/hubspot/jinjava/Jinjava.java b/src/main/java/com/hubspot/jinjava/Jinjava.java index f2a9878a6..00a54ae31 100644 --- a/src/main/java/com/hubspot/jinjava/Jinjava.java +++ b/src/main/java/com/hubspot/jinjava/Jinjava.java @@ -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: diff --git a/src/main/java/com/hubspot/jinjava/JinjavaConfig.java b/src/main/java/com/hubspot/jinjava/JinjavaConfig.java index ad527458c..ba875ee7c 100644 --- a/src/main/java/com/hubspot/jinjava/JinjavaConfig.java +++ b/src/main/java/com/hubspot/jinjava/JinjavaConfig.java @@ -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; diff --git a/src/main/java/com/hubspot/jinjava/el/ExpressionResolver.java b/src/main/java/com/hubspot/jinjava/el/ExpressionResolver.java index cbc0fa723..c60e60a0b 100644 --- a/src/main/java/com/hubspot/jinjava/el/ExpressionResolver.java +++ b/src/main/java/com/hubspot/jinjava/el/ExpressionResolver.java @@ -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; /** diff --git a/src/main/java/com/hubspot/jinjava/el/JinjavaELContext.java b/src/main/java/com/hubspot/jinjava/el/JinjavaELContext.java index 962b33ea4..12a04f1ee 100644 --- a/src/main/java/com/hubspot/jinjava/el/JinjavaELContext.java +++ b/src/main/java/com/hubspot/jinjava/el/JinjavaELContext.java @@ -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; diff --git a/src/main/java/com/hubspot/jinjava/el/JinjavaInterpreterResolver.java b/src/main/java/com/hubspot/jinjava/el/JinjavaInterpreterResolver.java index cfc519f67..d294be1d6 100644 --- a/src/main/java/com/hubspot/jinjava/el/JinjavaInterpreterResolver.java +++ b/src/main/java/com/hubspot/jinjava/el/JinjavaInterpreterResolver.java @@ -42,12 +42,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; diff --git a/src/main/java/com/hubspot/jinjava/el/MacroFunctionMapper.java b/src/main/java/com/hubspot/jinjava/el/MacroFunctionMapper.java index 449bc2f98..88fec4f0a 100644 --- a/src/main/java/com/hubspot/jinjava/el/MacroFunctionMapper.java +++ b/src/main/java/com/hubspot/jinjava/el/MacroFunctionMapper.java @@ -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; diff --git a/src/main/java/com/hubspot/jinjava/el/NoInvokeELContext.java b/src/main/java/com/hubspot/jinjava/el/NoInvokeELContext.java index 4e7900d6f..dc2e450aa 100644 --- a/src/main/java/com/hubspot/jinjava/el/NoInvokeELContext.java +++ b/src/main/java/com/hubspot/jinjava/el/NoInvokeELContext.java @@ -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; diff --git a/src/main/java/com/hubspot/jinjava/el/NoInvokeELResolver.java b/src/main/java/com/hubspot/jinjava/el/NoInvokeELResolver.java index b007aad3d..db9742eea 100644 --- a/src/main/java/com/hubspot/jinjava/el/NoInvokeELResolver.java +++ b/src/main/java/com/hubspot/jinjava/el/NoInvokeELResolver.java @@ -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. diff --git a/src/main/java/com/hubspot/jinjava/el/TruthyTypeConverter.java b/src/main/java/com/hubspot/jinjava/el/TruthyTypeConverter.java index f3800a079..8114506a5 100644 --- a/src/main/java/com/hubspot/jinjava/el/TruthyTypeConverter.java +++ b/src/main/java/com/hubspot/jinjava/el/TruthyTypeConverter.java @@ -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; diff --git a/src/main/java/com/hubspot/jinjava/el/TypeConvertingMapELResolver.java b/src/main/java/com/hubspot/jinjava/el/TypeConvertingMapELResolver.java index 7d90543e3..1acf34561 100644 --- a/src/main/java/com/hubspot/jinjava/el/TypeConvertingMapELResolver.java +++ b/src/main/java/com/hubspot/jinjava/el/TypeConvertingMapELResolver.java @@ -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(); diff --git a/src/main/java/com/hubspot/jinjava/el/ext/AstDict.java b/src/main/java/com/hubspot/jinjava/el/ext/AstDict.java index 36d52e4f8..5d9bb2b11 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/AstDict.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/AstDict.java @@ -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 dict; diff --git a/src/main/java/com/hubspot/jinjava/el/ext/AstList.java b/src/main/java/com/hubspot/jinjava/el/ext/AstList.java index df63b3fe4..8565d88bf 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/AstList.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/AstList.java @@ -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 { diff --git a/src/main/java/com/hubspot/jinjava/el/ext/AstMacroFunction.java b/src/main/java/com/hubspot/jinjava/el/ext/AstMacroFunction.java index 185c60792..9dc169ec9 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/AstMacroFunction.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/AstMacroFunction.java @@ -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 { diff --git a/src/main/java/com/hubspot/jinjava/el/ext/AstNamedParameter.java b/src/main/java/com/hubspot/jinjava/el/ext/AstNamedParameter.java index cc0134be5..a4808cc45 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/AstNamedParameter.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/AstNamedParameter.java @@ -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; diff --git a/src/main/java/com/hubspot/jinjava/el/ext/AstRangeBracket.java b/src/main/java/com/hubspot/jinjava/el/ext/AstRangeBracket.java index 696b11bb7..433446343 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/AstRangeBracket.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/AstRangeBracket.java @@ -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; diff --git a/src/main/java/com/hubspot/jinjava/el/ext/AstTuple.java b/src/main/java/com/hubspot/jinjava/el/ext/AstTuple.java index e1c0bd221..3c205cbb3 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/AstTuple.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/AstTuple.java @@ -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 { diff --git a/src/main/java/com/hubspot/jinjava/el/ext/CollectionMembershipOperator.java b/src/main/java/com/hubspot/jinjava/el/ext/CollectionMembershipOperator.java index 28c93dd0a..68cfa1698 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/CollectionMembershipOperator.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/CollectionMembershipOperator.java @@ -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 { diff --git a/src/main/java/com/hubspot/jinjava/el/ext/ExtendedParser.java b/src/main/java/com/hubspot/jinjava/el/ext/ExtendedParser.java index fb26213c0..18f8450cc 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/ExtendedParser.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/ExtendedParser.java @@ -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____"; diff --git a/src/main/java/com/hubspot/jinjava/el/ext/JinjavaBeanELResolver.java b/src/main/java/com/hubspot/jinjava/el/ext/JinjavaBeanELResolver.java index 30549acc9..ba12618e0 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/JinjavaBeanELResolver.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/JinjavaBeanELResolver.java @@ -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. diff --git a/src/main/java/com/hubspot/jinjava/el/ext/JinjavaListELResolver.java b/src/main/java/com/hubspot/jinjava/el/ext/JinjavaListELResolver.java index cea4ac484..b5ebd8712 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/JinjavaListELResolver.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/JinjavaListELResolver.java @@ -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 { diff --git a/src/main/java/com/hubspot/jinjava/el/ext/NamedParameterOperator.java b/src/main/java/com/hubspot/jinjava/el/ext/NamedParameterOperator.java index 369995c80..756030916 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/NamedParameterOperator.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/NamedParameterOperator.java @@ -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("="); diff --git a/src/main/java/com/hubspot/jinjava/el/ext/OrOperator.java b/src/main/java/com/hubspot/jinjava/el/ext/OrOperator.java index 71429eb43..49e04ecae 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/OrOperator.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/OrOperator.java @@ -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 { diff --git a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstBinary.java b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstBinary.java index 95d92e917..c3a8fb2dc 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstBinary.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstBinary.java @@ -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; diff --git a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstBracket.java b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstBracket.java index 85bd00346..6069bf6d0 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstBracket.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstBracket.java @@ -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; diff --git a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstChoice.java b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstChoice.java index dd5d0472f..5f679d54f 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstChoice.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstChoice.java @@ -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; diff --git a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstDict.java b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstDict.java index 48302a4a1..65ba6bf99 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstDict.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstDict.java @@ -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; diff --git a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstDot.java b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstDot.java index 862d9620d..f4a5bd8a2 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstDot.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstDot.java @@ -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; diff --git a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstIdentifier.java b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstIdentifier.java index a7b631e4a..d376b5572 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstIdentifier.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstIdentifier.java @@ -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; diff --git a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstList.java b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstList.java index 6ca90e4a1..2524e6a60 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstList.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstList.java @@ -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; diff --git a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstMacroFunction.java b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstMacroFunction.java index 5dd0cca4d..e26f0f24e 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstMacroFunction.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstMacroFunction.java @@ -12,8 +12,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; diff --git a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstMethod.java b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstMethod.java index 366195214..d9a917197 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstMethod.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstMethod.java @@ -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; diff --git a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstNamedParameter.java b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstNamedParameter.java index 8d1a23c61..d991fdae7 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstNamedParameter.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstNamedParameter.java @@ -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 diff --git a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstNested.java b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstNested.java index 317167c11..f659c2c7d 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstNested.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstNested.java @@ -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. diff --git a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstNodeDecorator.java b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstNodeDecorator.java index 2b34b3071..080d2b9e1 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstNodeDecorator.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstNodeDecorator.java @@ -4,9 +4,9 @@ import de.odysseus.el.tree.Bindings; import de.odysseus.el.tree.Node; import de.odysseus.el.tree.impl.ast.AstNode; -import javax.el.ELContext; -import javax.el.MethodInfo; -import javax.el.ValueReference; +import jakarta.el.ELContext; +import jakarta.el.MethodInfo; +import jakarta.el.ValueReference; /** * This decorator exists to ensure that every EvalResultHolder is an diff --git a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstParameters.java b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstParameters.java index 920bafff0..84b1ae962 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstParameters.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstParameters.java @@ -10,7 +10,7 @@ import java.util.List; import java.util.StringJoiner; import java.util.stream.Collectors; -import javax.el.ELContext; +import jakarta.el.ELContext; public class EagerAstParameters extends AstParameters implements EvalResultHolder { protected Object evalResult; diff --git a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstRangeBracket.java b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstRangeBracket.java index 0f4f8d4f6..8caae7801 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstRangeBracket.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstRangeBracket.java @@ -4,7 +4,7 @@ import com.hubspot.jinjava.el.ext.DeferredParsingException; import de.odysseus.el.tree.Bindings; import de.odysseus.el.tree.impl.ast.AstNode; -import javax.el.ELContext; +import jakarta.el.ELContext; public class EagerAstRangeBracket extends AstRangeBracket implements EvalResultHolder { protected Object evalResult; diff --git a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstRoot.java b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstRoot.java index d785cd63d..0bc7a3315 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstRoot.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstRoot.java @@ -3,9 +3,9 @@ import de.odysseus.el.tree.Bindings; import de.odysseus.el.tree.Node; import de.odysseus.el.tree.impl.ast.AstNode; -import javax.el.ELContext; -import javax.el.MethodInfo; -import javax.el.ValueReference; +import jakarta.el.ELContext; +import jakarta.el.MethodInfo; +import jakarta.el.ValueReference; public class EagerAstRoot extends AstNode { private AstNode rootNode; diff --git a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstTuple.java b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstTuple.java index e0c4b86b4..e115e2db2 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstTuple.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstTuple.java @@ -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 EagerAstTuple extends AstTuple implements EvalResultHolder { protected Object evalResult; diff --git a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstUnary.java b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstUnary.java index ffdbdfc36..af5d672cb 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstUnary.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstUnary.java @@ -4,7 +4,7 @@ import de.odysseus.el.tree.Bindings; import de.odysseus.el.tree.impl.ast.AstNode; import de.odysseus.el.tree.impl.ast.AstUnary; -import javax.el.ELContext; +import jakarta.el.ELContext; public class EagerAstUnary extends AstUnary implements EvalResultHolder { protected Object evalResult; diff --git a/src/main/java/com/hubspot/jinjava/el/ext/eager/EvalResultHolder.java b/src/main/java/com/hubspot/jinjava/el/ext/eager/EvalResultHolder.java index 30de67e77..a88c4e24f 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/eager/EvalResultHolder.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/eager/EvalResultHolder.java @@ -10,8 +10,8 @@ import de.odysseus.el.tree.impl.ast.AstNode; import java.util.Collection; import java.util.function.Supplier; -import javax.el.ELContext; -import javax.el.ELException; +import jakarta.el.ELContext; +import jakarta.el.ELException; public interface EvalResultHolder { Object getEvalResult(); diff --git a/src/main/java/com/hubspot/jinjava/util/EagerExpressionResolver.java b/src/main/java/com/hubspot/jinjava/util/EagerExpressionResolver.java index 2d601be00..23fa4bc69 100644 --- a/src/main/java/com/hubspot/jinjava/util/EagerExpressionResolver.java +++ b/src/main/java/com/hubspot/jinjava/util/EagerExpressionResolver.java @@ -23,7 +23,7 @@ import java.util.function.Supplier; import java.util.regex.Pattern; import java.util.stream.Collectors; -import javax.el.ELException; +import jakarta.el.ELException; import org.apache.commons.lang3.StringUtils; public class EagerExpressionResolver { diff --git a/src/test/java/com/hubspot/jinjava/el/ext/eager/EagerAstIdentifierTest.java b/src/test/java/com/hubspot/jinjava/el/ext/eager/EagerAstIdentifierTest.java index e618e3d66..3f10847d7 100644 --- a/src/test/java/com/hubspot/jinjava/el/ext/eager/EagerAstIdentifierTest.java +++ b/src/test/java/com/hubspot/jinjava/el/ext/eager/EagerAstIdentifierTest.java @@ -7,7 +7,7 @@ import com.hubspot.jinjava.el.JinjavaInterpreterResolver; import de.odysseus.el.tree.Bindings; import java.lang.reflect.Method; -import javax.el.ValueExpression; +import jakarta.el.ValueExpression; import org.junit.Before; import org.junit.Test; diff --git a/src/test/java/com/hubspot/jinjava/lib/fn/StringToTimeFunctionTest.java b/src/test/java/com/hubspot/jinjava/lib/fn/StringToTimeFunctionTest.java index d6500fc81..dfa62995c 100644 --- a/src/test/java/com/hubspot/jinjava/lib/fn/StringToTimeFunctionTest.java +++ b/src/test/java/com/hubspot/jinjava/lib/fn/StringToTimeFunctionTest.java @@ -1,6 +1,7 @@ package com.hubspot.jinjava.lib.fn; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertNull; import com.hubspot.jinjava.interpret.InterpretException; import com.hubspot.jinjava.objects.date.PyishDate; @@ -43,13 +44,13 @@ public void itFailsOnTimeFormatMismatch() { public void itReturnsNullOnNullInput() { String datetime = null; String format = "yyyy-MM-dd'T'HH:mm:ssZ"; - assertThat(Functions.stringToTime(datetime, format)).isEqualTo(null); + assertNull(Functions.stringToTime(datetime, format)); } @Test(expected = InterpretException.class) public void itFailsOnNullDatetimeFormat() { String datetime = "2018-07-14T14:31:30+0530"; String format = null; - assertThat(Functions.stringToTime(datetime, format)).isEqualTo(null); + assertNull(Functions.stringToTime(datetime, format)); } } From f3b4cc70f81880b7b4129cd3ad38c55795ccb5f6 Mon Sep 17 00:00:00 2001 From: Dmytro Maidaniuk Date: Wed, 26 Oct 2022 15:11:56 +0300 Subject: [PATCH 2/2] Fixed ambiguous method issue --- .../com/hubspot/jinjava/lib/fn/StringToTimeFunctionTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/hubspot/jinjava/lib/fn/StringToTimeFunctionTest.java b/src/test/java/com/hubspot/jinjava/lib/fn/StringToTimeFunctionTest.java index 36c6e66bf..83107d9e1 100644 --- a/src/test/java/com/hubspot/jinjava/lib/fn/StringToTimeFunctionTest.java +++ b/src/test/java/com/hubspot/jinjava/lib/fn/StringToTimeFunctionTest.java @@ -2,6 +2,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.junit.Assert.assertNull; import com.hubspot.jinjava.interpret.InterpretException; import com.hubspot.jinjava.objects.date.PyishDate; @@ -46,7 +47,7 @@ public void itFailsOnTimeFormatMismatch() { @Test public void itReturnsNullOnNullInput() { - assertThat(Functions.stringToTime(null, "yyyy-MM-dd'T'HH:mm:ssZ")).isEqualTo(null); + assertNull(Functions.stringToTime(null, "yyyy-MM-dd'T'HH:mm:ssZ")); } @Test