Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 77A3398F6 for ; Wed, 30 Nov 2011 14:43:11 +0000 (UTC) Received: (qmail 88837 invoked by uid 500); 30 Nov 2011 14:43:11 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 88768 invoked by uid 500); 30 Nov 2011 14:43:11 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 88761 invoked by uid 99); 30 Nov 2011 14:43:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Nov 2011 14:43:11 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Nov 2011 14:43:09 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 4E59F23889FD for ; Wed, 30 Nov 2011 14:42:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@commons.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111130144249.4E59F23889FD@eris.apache.org> 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 *\/'' . + * Note: 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 { *

* If the underlying JEXL engine is silent, errors will be logged through its logger as warning. *

+ * Note: 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 { *

* If the underlying JEXL engine is silent, errors will be logged through its logger as warning. *

+ * Note: 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 { + /** 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 { + /** 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