commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1208451 - in /commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2: Interpreter.java JexlArithmetic.java JexlEngine.java UnifiedJEXL.java parser/ASTFloatLiteral.java parser/ASTIntegerLiteral.java
Date Wed, 30 Nov 2011 14:42:48 GMT
Author: sebb
Date: Wed Nov 30 14:42:47 2011
New Revision: 1208451

URL: http://svn.apache.org/viewvc?rev=1208451&view=rev
Log:
Initial set of fixes to improve binary compatibility

Added:
    commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/parser/ASTFloatLiteral.java
  (with props)
    commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/parser/ASTIntegerLiteral.java
  (with props)
Modified:
    commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/Interpreter.java
    commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java
    commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/JexlEngine.java
    commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java

Modified: commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/Interpreter.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/Interpreter.java?rev=1208451&r1=1208450&r2=1208451&view=diff
==============================================================================
--- commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/Interpreter.java
(original)
+++ commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/Interpreter.java
Wed Nov 30 14:42:47 2011
@@ -27,6 +27,8 @@ import java.util.Set;
 import org.apache.commons.jexl2.parser.SimpleNode;
 import org.apache.commons.logging.Log;
 
+import org.apache.commons.jexl2.parser.ASTFloatLiteral;
+import org.apache.commons.jexl2.parser.ASTIntegerLiteral;
 import org.apache.commons.jexl2.parser.JexlNode;
 import org.apache.commons.jexl2.parser.ASTAdditiveNode;
 import org.apache.commons.jexl2.parser.ASTAdditiveOperator;
@@ -861,6 +863,22 @@ public class Interpreter implements Pars
         }
     }
 
+    /**
+     * @deprecated Do not use
+     */
+    @Deprecated
+    public Object visit(ASTFloatLiteral node, Object data) {
+        throw new UnsupportedOperationException("Method should not be called; only present
for API compatibiltiy");
+    }
+
+    /**
+     * @deprecated Do not use
+     */
+    @Deprecated
+    public Object visit(ASTIntegerLiteral node, Object data) {
+        throw new UnsupportedOperationException("Method should not be called; only present
for API compatibiltiy");
+    }
+
     /** {@inheritDoc} */
     public Object visit(ASTVar node, Object data) {
         return visit((ASTIdentifier) node, data);

Modified: commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java?rev=1208451&r1=1208450&r2=1208451&view=diff
==============================================================================
--- commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java
(original)
+++ commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java
Wed Nov 30 14:42:47 2011
@@ -54,8 +54,9 @@ public class JexlArithmetic {
     protected static final BigInteger BIGI_LONG_MIN_VALUE = BigInteger.valueOf(Long.MIN_VALUE);
     /** Default BigDecimal scale. */
     protected static final int BIGD_SCALE = -1;
-    /** Whether this JexlArithmetic instance behaves in strict or lenient mode. */
-    protected final boolean strict;
+    /** Whether this JexlArithmetic instance behaves in strict or lenient mode. 
+     * DO NOT MODIFY - will be made final. */
+    protected boolean strict;
     /** The big decimal math context. */
     protected final MathContext mathContext;
     /** The big decimal scale. */

Modified: commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/JexlEngine.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/JexlEngine.java?rev=1208451&r1=1208450&r2=1208451&view=diff
==============================================================================
--- commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/JexlEngine.java
(original)
+++ commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/JexlEngine.java
Wed Nov 30 14:42:47 2011
@@ -452,6 +452,26 @@ public class JexlEngine {
      * This method parses the script which validates the syntax.
      *
      * @param scriptText A String containing valid JEXL syntax
+     * @param info An info structure to carry debugging information if needed
+     * @return A {@link Script} which can be executed using a {@link JexlContext}.
+     * @throws JexlException if there is a problem parsing the script.
+     * @deprecated Use {@link #createScript(String, JexlInfo, String[])}
+     */
+    @Deprecated
+    public Script createScript(String scriptText, JexlInfo info) {
+        if (scriptText == null) {
+            throw new NullPointerException("scriptText is null");
+        }
+        // Parse the expression
+        ASTJexlScript tree = parse(scriptText, info);
+        return createScript(tree, scriptText);
+    }
+
+    /**
+     * Creates a Script from a String containing valid JEXL syntax.
+     * This method parses the script which validates the syntax.
+     *
+     * @param scriptText A String containing valid JEXL syntax
      * @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.
@@ -1171,6 +1191,19 @@ public class JexlEngine {
      * Parses an expression.
      * @param expression the expression to parse
      * @param info debug information structure
+     * @return the parsed tree
+     * @throws JexlException if any error occured during parsing
+     * @deprecated Use {@link #parse(CharSequence, JexlInfo, Scope)} instead
+     */
+    @Deprecated
+    protected ASTJexlScript parse(CharSequence expression, JexlInfo info) {
+        return parse(expression, info, null);
+    }
+
+    /**
+     * Parses an expression.
+     * @param expression the expression to parse
+     * @param info debug information structure
      * @param frame the script frame to use
      * @return the parsed tree
      * @throws JexlException if any error occured during parsing

Modified: commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java?rev=1208451&r1=1208450&r2=1208451&view=diff
==============================================================================
--- commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java
(original)
+++ commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java
Wed Nov 30 14:42:47 2011
@@ -275,10 +275,11 @@ public final class UnifiedJEXL {
         /**
          * Formats this expression, adding its source string representation in
          * comments if available: 'expression /*= source *\/'' .
+         * <b>Note:</b> do not override; will be made final in a future release.
          * @return the formatted expression string
          */
         @Override
-        public final String toString() {
+        public String toString() {
             StringBuilder strb = new StringBuilder();
             asString(strb);
             if (source != this) {
@@ -340,11 +341,12 @@ public final class UnifiedJEXL {
          * <p>
          * If the underlying JEXL engine is silent, errors will be logged through its logger
as warning.
          * </p>
+         * <b>Note:</b> do not override; will be made final in a future release.
          * @param context the context to use for immediate expression evaluations
          * @return an expression or null if an error occurs and the {@link JexlEngine} is
running in silent mode
          * @throws UnifiedJEXL.Exception if an error occurs and the {@link JexlEngine} is
not in silent mode
          */
-        public final Expression prepare(JexlContext context) {
+        public Expression prepare(JexlContext context) {
             try {
                 Interpreter interpreter = new Interpreter(jexl, context, !jexl.isLenient(),
jexl.isSilent());
                 if (context instanceof TemplateContext) {
@@ -366,12 +368,13 @@ public final class UnifiedJEXL {
          * <p>
          * If the underlying JEXL engine is silent, errors will be logged through its logger
as warning.
          * </p>
+         * <b>Note:</b> do not override; will be made final in a future release.
          * @param context the variable context
          * @return the result of this expression evaluation or null if an error occurs and
the {@link JexlEngine} is
          * running in silent mode
          * @throws UnifiedJEXL.Exception if an error occurs and the {@link JexlEngine} is
not silent
          */
-        public final Object evaluate(JexlContext context) {
+        public Object evaluate(JexlContext context) {
             try {
                 Interpreter interpreter = new Interpreter(jexl, context, !jexl.isLenient(),
jexl.isSilent());
                 if (context instanceof TemplateContext) {

Added: commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/parser/ASTFloatLiteral.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/parser/ASTFloatLiteral.java?rev=1208451&view=auto
==============================================================================
--- commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/parser/ASTFloatLiteral.java
(added)
+++ commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/parser/ASTFloatLiteral.java
Wed Nov 30 14:42:47 2011
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.jexl2.parser;
+
+/**
+ * @deprecated Only for use in maintaining binary compatibility - should not actually be
used
+ */
+@Deprecated
+public final class ASTFloatLiteral extends JexlNode implements JexlNode.Literal<Float>
{
+    /** The type literal value. */
+    Float literal = null;
+
+    public ASTFloatLiteral(int id) {
+        super(id);
+    }
+
+    public ASTFloatLiteral(Parser p, int id) {
+        super(p, id);
+    }
+    
+    /**
+     * Gets the literal value.
+     * @return the float literal
+     */
+    public Float getLiteral() {
+        return literal;
+    }
+    
+    /** {@inheritDoc} */
+    @Override
+    public Object jjtAccept(ParserVisitor visitor, Object data) {
+        return visitor.visit(this, data);
+    }
+}

Propchange: commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/parser/ASTFloatLiteral.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/parser/ASTFloatLiteral.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/parser/ASTIntegerLiteral.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/parser/ASTIntegerLiteral.java?rev=1208451&view=auto
==============================================================================
--- commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/parser/ASTIntegerLiteral.java
(added)
+++ commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/parser/ASTIntegerLiteral.java
Wed Nov 30 14:42:47 2011
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.jexl2.parser;
+
+/**
+ * @deprecated Only for use in maintaining binary compatibility - should not actually be
used
+ */
+@Deprecated
+public final class ASTIntegerLiteral extends JexlNode implements JexlNode.Literal<Integer>
{
+    /** The type literal value. */
+    Integer literal = null;
+
+    ASTIntegerLiteral(int id) {
+        super(id);
+    }
+
+    ASTIntegerLiteral(Parser p, int id) {
+        super(p, id);
+    }
+    
+    /**
+     * Gets the literal value.
+     * @return the integer literal
+     */
+    public Integer getLiteral() {
+        return literal;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public Object jjtAccept(ParserVisitor visitor, Object data) {
+        return visitor.visit(this, data);
+    }
+}

Propchange: commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/parser/ASTIntegerLiteral.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/jexl/branches/2.0-API-COMPAT/src/main/java/org/apache/commons/jexl2/parser/ASTIntegerLiteral.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message