You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by he...@apache.org on 2021/06/03 15:41:47 UTC
[commons-jexl] 04/19: Add missing @since markers
This is an automated email from the ASF dual-hosted git repository.
henrib pushed a commit to tag 2.1
in repository https://gitbox.apache.org/repos/asf/commons-jexl.git
commit f48a7645d1c426bc7f5e24639ae8d9390227e7d3
Author: Sebastian Bazley <se...@apache.org>
AuthorDate: Thu Dec 1 12:24:25 2011 +0000
Add missing @since markers
git-svn-id: https://svn-us.apache.org/repos/asf/commons/proper/jexl/branches/2.0@1209049 13f79535-47bb-0310-9956-ffa450edef68
---
.../java/org/apache/commons/jexl2/DebugInfo.java | 4 +++-
.../org/apache/commons/jexl2/ExpressionImpl.java | 6 +++++
.../java/org/apache/commons/jexl2/Interpreter.java | 27 ++++++++++++++++++----
.../org/apache/commons/jexl2/JexlArithmetic.java | 19 ++++++++++++---
.../java/org/apache/commons/jexl2/JexlEngine.java | 12 ++++++++++
.../org/apache/commons/jexl2/JexlException.java | 2 ++
.../java/org/apache/commons/jexl2/JexlInfo.java | 1 +
.../java/org/apache/commons/jexl2/UnifiedJEXL.java | 4 ++++
.../commons/jexl2/introspection/UberspectImpl.java | 3 +++
9 files changed, 70 insertions(+), 8 deletions(-)
diff --git a/src/main/java/org/apache/commons/jexl2/DebugInfo.java b/src/main/java/org/apache/commons/jexl2/DebugInfo.java
index 40298ff..f85319d 100644
--- a/src/main/java/org/apache/commons/jexl2/DebugInfo.java
+++ b/src/main/java/org/apache/commons/jexl2/DebugInfo.java
@@ -63,7 +63,9 @@ public class DebugInfo implements JexlInfo {
return toString();
}
- /** {@inheritDoc} */
+ /** {@inheritDoc}
+ * @since 2.1
+ */
public DebugInfo debugInfo() {
return this;
}
diff --git a/src/main/java/org/apache/commons/jexl2/ExpressionImpl.java b/src/main/java/org/apache/commons/jexl2/ExpressionImpl.java
index 99ae30b..f07ade3 100644
--- a/src/main/java/org/apache/commons/jexl2/ExpressionImpl.java
+++ b/src/main/java/org/apache/commons/jexl2/ExpressionImpl.java
@@ -109,6 +109,7 @@ public class ExpressionImpl implements Expression, Script {
/**
* {@inheritDoc}
+ * @since 2.1
*/
public Object execute(JexlContext context, Object... args) {
Interpreter interpreter = jexl.createInterpreter(context);
@@ -118,6 +119,7 @@ public class ExpressionImpl implements Expression, Script {
/**
* {@inheritDoc}
+ * @since 2.1
*/
public String[] getParameters() {
return script.getParameters();
@@ -125,6 +127,7 @@ public class ExpressionImpl implements Expression, Script {
/**
* {@inheritDoc}
+ * @since 2.1
*/
public String[] getLocalVariables() {
return script.getLocalVariables();
@@ -132,6 +135,7 @@ public class ExpressionImpl implements Expression, Script {
/**
* {@inheritDoc}
+ * @since 2.1
*/
public Set<List<String>> getVariables() {
return jexl.getVariables(this);
@@ -139,6 +143,7 @@ public class ExpressionImpl implements Expression, Script {
/**
* {@inheritDoc}
+ * @since 2.1
*/
public Callable<Object> callable(JexlContext context) {
return callable(context, (Object[]) null);
@@ -146,6 +151,7 @@ public class ExpressionImpl implements Expression, Script {
/**
* {@inheritDoc}
+ * @since 2.1
*/
public Callable<Object> callable(JexlContext context, Object... args) {
final Interpreter interpreter = jexl.createInterpreter(context);
diff --git a/src/main/java/org/apache/commons/jexl2/Interpreter.java b/src/main/java/org/apache/commons/jexl2/Interpreter.java
index 7dadd52..5cf475b 100644
--- a/src/main/java/org/apache/commons/jexl2/Interpreter.java
+++ b/src/main/java/org/apache/commons/jexl2/Interpreter.java
@@ -111,9 +111,15 @@ public class Interpreter implements ParserVisitor {
protected final boolean cache;
/** Registers or arguments. */
protected Object[] registers = null;
- /** Parameter names if any. */
+ /**
+ * Parameter names if any.
+ * @since 2.1
+ */
protected String[] parameters = null;
- /** Cancellation support. */
+ /**
+ * Cancellation support.
+ * @since 2.1
+ */
protected volatile boolean cancelled = false;
/** Empty parameters for method matching. */
protected static final Object[] EMPTY_PARAMS = new Object[0];
@@ -135,6 +141,7 @@ public class Interpreter implements ParserVisitor {
* @param aContext the context to evaluate expression
* @param strictFlag whether this interpreter runs in strict mode
* @param silentFlag whether this interpreter runs in silent mode
+ * @since 2.1
*/
public Interpreter(JexlEngine jexl, JexlContext aContext, boolean strictFlag, boolean silentFlag) {
this.logger = jexl.logger;
@@ -151,6 +158,7 @@ public class Interpreter implements ParserVisitor {
/**
* Copy constructor.
* @param base the base to copy
+ * @since 2.1
*/
protected Interpreter(Interpreter base) {
this.logger = base.logger;
@@ -168,7 +176,9 @@ public class Interpreter implements ParserVisitor {
* Sets whether this interpreter considers unknown variables, methods and constructors as errors.
* @param flag true for strict, false for lenient
* @deprecated Do not use; will be removed in a later version
+ * @since 2.1
*/
+ // TODO why add a method and then deprecate it?
@Deprecated
public void setStrict(boolean flag) {
this.strict = flag;
@@ -187,6 +197,7 @@ public class Interpreter implements ParserVisitor {
/**
* Checks whether this interpreter considers unknown variables, methods and constructors as errors.
* @return true if strict, false otherwise
+ * @since 2.1
*/
public boolean isStrict() {
return this.strict;
@@ -231,6 +242,7 @@ public class Interpreter implements ParserVisitor {
/**
* Gets the context.
* @return the {@link JexlContext} used for evaluation.
+ * @since 2.1
*/
protected JexlContext getContext() {
return context;
@@ -264,6 +276,7 @@ public class Interpreter implements ParserVisitor {
/**
* Sets this interpreter parameters and arguments.
* @param frame the calling frame
+ * @since 2.1
*/
protected void setFrame(JexlEngine.Frame frame) {
if (frame != null) {
@@ -1311,13 +1324,19 @@ public class Interpreter implements ParserVisitor {
return result;
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ * @since 2.1
+ */
public Object visit(ASTReferenceExpression node, Object data) {
ASTArrayAccess upper = node;
return visit(upper, data);
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ * @since 2.1
+ */
public Object visit(ASTReturnStatement node, Object data) {
Object val = node.jjtGetChild(0).jjtAccept(this, data);
throw new JexlException.Return(node, null, val);
diff --git a/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java b/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java
index 8c831c8..ef821a9 100644
--- a/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java
+++ b/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java
@@ -52,14 +52,23 @@ public class JexlArithmetic {
protected static final BigInteger BIGI_LONG_MAX_VALUE = BigInteger.valueOf(Long.MAX_VALUE);
/** Long.MIN_VALUE as BigInteger. */
protected static final BigInteger BIGI_LONG_MIN_VALUE = BigInteger.valueOf(Long.MIN_VALUE);
- /** Default BigDecimal scale. */
+ /**
+ * Default BigDecimal scale.
+ * @since 2.1
+ */
protected static final int BIGD_SCALE = -1;
/** Whether this JexlArithmetic instance behaves in strict or lenient mode. */
/** @deprecated : will become final in next version. */
protected boolean strict;
- /** The big decimal math context. */
+ /**
+ * The big decimal math context.
+ * @since 2.1
+ */
protected final MathContext mathContext;
- /** The big decimal scale. */
+ /**
+ * The big decimal scale.
+ * @since 2.1
+ */
protected final int mathScale;
/**
@@ -254,6 +263,7 @@ public class JexlArithmetic {
* @param rhs the right hand side operand that lead to the bigd result
* @param bigd the BigDecimal to narrow
* @return an Integer or Long if narrowing is possible, the original BigInteger otherwise
+ * @since 2.1
*/
protected Number narrowBigDecimal(Object lhs, Object rhs, BigDecimal bigd) {
if (isNumberable(lhs) || isNumberable(rhs)) {
@@ -556,6 +566,7 @@ public class JexlArithmetic {
* Negates a value (unary minus for numbers).
* @param val the value to negate
* @return the negated value
+ * @since 2.1
*/
public Object negate(Object val) {
if (val instanceof Integer) {
@@ -1053,6 +1064,7 @@ public class JexlArithmetic {
* @param narrow the target narrow class
* @param source the orginal source class
* @return true if attempt to narrow source to target is accepted
+ * @since 2.1
*/
protected boolean narrowAccept(Class<?> narrow, Class<?> source) {
return narrow == null || narrow.equals(source);
@@ -1063,6 +1075,7 @@ public class JexlArithmetic {
* @param original the original number
* @param narrow the attempted target class
* @return the narrowed number or the source if no narrowing was possible
+ * @since 2.1
*/
protected Number narrowNumber(Number original, Class<?> narrow) {
if (original == null) {
diff --git a/src/main/java/org/apache/commons/jexl2/JexlEngine.java b/src/main/java/org/apache/commons/jexl2/JexlEngine.java
index 8e2020b..6f523dc 100644
--- a/src/main/java/org/apache/commons/jexl2/JexlEngine.java
+++ b/src/main/java/org/apache/commons/jexl2/JexlEngine.java
@@ -231,6 +231,7 @@ public class JexlEngine {
/**
* Gets this engine underlying arithmetic.
* @return the arithmetic
+ * @since 2.1
*/
public JexlArithmetic getArithmetic() {
return arithmetic;
@@ -311,6 +312,7 @@ public class JexlEngine {
* Sets whether this engine behaves in strict or lenient mode.
* Equivalent to setLenient(!flag).
* @param flag true for strict, false for lenient
+ * @since 2.1
*/
public final void setStrict(boolean flag) {
setLenient(!flag);
@@ -320,6 +322,7 @@ public class JexlEngine {
* Checks whether this engine behaves in strict or lenient mode.
* Equivalent to !isLenient().
* @return true for strict, false for lenient
+ * @since 2.1
*/
public final boolean isStrict() {
return !isLenient();
@@ -475,6 +478,7 @@ public class JexlEngine {
* @param names the script parameter names
* @return A {@link Script} which can be executed using a {@link JexlContext}.
* @throws JexlException if there is a problem parsing the script.
+ * @since 2.1
*/
public Script createScript(String scriptText, JexlInfo info, String[] names) {
if (scriptText == null) {
@@ -766,6 +770,7 @@ public class JexlEngine {
* @param strictFlag whether the interpreter runs in strict mode
* @param silentFlag whether the interpreter runs in silent mode
* @return an Interpreter
+ * @since 2.1
*/
protected Interpreter createInterpreter(JexlContext context, boolean strictFlag, boolean silentFlag) {
return new Interpreter(this, context == null ? EMPTY_CONTEXT : context, strictFlag, silentFlag);
@@ -866,6 +871,7 @@ public class JexlEngine {
/**
* Clears the expression cache.
+ * @since 2.1
*/
public void clearCache() {
synchronized (parser) {
@@ -880,6 +886,7 @@ public class JexlEngine {
* @param script the script
* @return the set of variables, each as a list of strings (ant-ish variables use more than 1 string)
* or the empty set if no variables are used
+ * @since 2.1
*/
public Set<List<String>> getVariables(Script script) {
if (script instanceof ExpressionImpl) {
@@ -896,6 +903,7 @@ public class JexlEngine {
* @param node the node
* @param refs the set of variable being filled
* @param ref the current variable being filled
+ * @since 2.1
*/
protected void getVariables(JexlNode node, Set<List<String>> refs, List<String> ref) {
boolean array = node instanceof ASTArrayAccess;
@@ -956,6 +964,7 @@ public class JexlEngine {
* Gets the array of parameters from a script.
* @param script the script
* @return the parameters which may be empty (but not null) if no parameters were defined
+ * @since 2.1
*/
protected String[] getParameters(Script script) {
if (script instanceof ExpressionImpl) {
@@ -969,6 +978,7 @@ public class JexlEngine {
* Gets the array of local variable from a script.
* @param script the script
* @return the local variables array which may be empty (but not null) if no local variables were defined
+ * @since 2.1
*/
protected String[] getLocalVariables(Script script) {
if (script instanceof ExpressionImpl) {
@@ -980,6 +990,7 @@ public class JexlEngine {
/**
* A script scope, stores the declaration of parameters and local variables.
+ * @since 2.1
*/
public static final class Scope {
/**
@@ -1139,6 +1150,7 @@ public class JexlEngine {
/**
* A call frame, created from a scope, stores the arguments and local variables as "registers".
+ * @since 2.1
*/
public static final class Frame {
/** Registers or arguments. */
diff --git a/src/main/java/org/apache/commons/jexl2/JexlException.java b/src/main/java/org/apache/commons/jexl2/JexlException.java
index 83bb092..27259a6 100644
--- a/src/main/java/org/apache/commons/jexl2/JexlException.java
+++ b/src/main/java/org/apache/commons/jexl2/JexlException.java
@@ -103,6 +103,7 @@ public class JexlException extends RuntimeException {
/**
* Accesses detailed message.
* @return the message
+ * @since 2.1
*/
protected String detailedMessage() {
return super.getMessage();
@@ -113,6 +114,7 @@ public class JexlException extends RuntimeException {
* @param prefix the prefix to the message
* @param expr the expression in error
* @return the formatted message
+ * @since 2.1
*/
protected String parserError(String prefix, String expr) {
int begin = info.debugInfo().getColumn();
diff --git a/src/main/java/org/apache/commons/jexl2/JexlInfo.java b/src/main/java/org/apache/commons/jexl2/JexlInfo.java
index bcbcf4a..5338e92 100644
--- a/src/main/java/org/apache/commons/jexl2/JexlInfo.java
+++ b/src/main/java/org/apache/commons/jexl2/JexlInfo.java
@@ -29,6 +29,7 @@ public interface JexlInfo {
/**
* Gets the underlying debugging information.
* @return a debug info instance
+ * @since 2.1
*/
DebugInfo debugInfo();
}
diff --git a/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java b/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java
index f40c470..af2d0b2 100644
--- a/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java
+++ b/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java
@@ -211,6 +211,7 @@ public final class UnifiedJEXL {
/**
* Clears the cache.
+ * @since 2.1
*/
public void clearCache() {
synchronized (cache) {
@@ -312,6 +313,7 @@ public final class UnifiedJEXL {
* are written in 'dot' or 'bracketed' notation. (a.b is equivalent to a['b']).</p>
* @return the set of variables, each as a list of strings (ant-ish variables use more than 1 string)
* or the empty set if no variables are used
+ * @since 2.1
*/
public Set<List<String>> getVariables() {
return Collections.emptySet();
@@ -320,6 +322,7 @@ public final class UnifiedJEXL {
/**
* Fills up the list of variables accessed by this expression.
* @param refs the set of variable being filled
+ * @since 2.1
*/
protected void getVariables(Set<List<String>> refs) {
// nothing to do
@@ -1337,6 +1340,7 @@ public final class UnifiedJEXL {
* @param sequence the sequence
* @param pattern the pattern to match at start of sequence
* @return the first position after end of pattern if it matches, -1 otherwise
+ * @since 2.1
*/
protected int startsWith(CharSequence sequence, CharSequence pattern) {
int s = 0;
diff --git a/src/main/java/org/apache/commons/jexl2/introspection/UberspectImpl.java b/src/main/java/org/apache/commons/jexl2/introspection/UberspectImpl.java
index 09d5e63..e67ced5 100644
--- a/src/main/java/org/apache/commons/jexl2/introspection/UberspectImpl.java
+++ b/src/main/java/org/apache/commons/jexl2/introspection/UberspectImpl.java
@@ -61,6 +61,7 @@ public class UberspectImpl extends Introspector implements Uberspect {
/**
* Resets this Uberspect class loader.
* @param cloader the class loader to use
+ * @since 2.1
*/
public void setLoader(ClassLoader cloader) {
base().setLoader(cloader);
@@ -117,6 +118,7 @@ public class UberspectImpl extends Introspector implements Uberspect {
/**
* {@inheritDoc}
+ * @since 2.1
*/
public JexlMethod getConstructorMethod(Object ctorHandle, Object[] args, JexlInfo info) {
final Constructor<?> ctor = getConstructor(ctorHandle, args);
@@ -180,6 +182,7 @@ public class UberspectImpl extends Introspector implements Uberspect {
* @param object the object
* @param name the container name
* @return a JexlPropertyGet is successfull, null otherwise
+ * @since 2.1
*/
protected JexlPropertyGet getIndexedGet(Object object, String name) {
if (object != null && name != null) {