Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy')
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/ArrayArguments.java136
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Block.java113
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/BooleanLiteral.java63
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/CannotProcessArrayTypesException.java29
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/CannotProcessInnerClassesException.java29
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Cast.java173
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/CharLiteral.java114
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Constructor.java339
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/EvaluationException.java46
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Expression.java130
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Field.java146
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/IParserConstants.java51
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/InitializationStringEvaluationException.java34
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/InitializationStringParser.java300
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Message.java224
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/MessageArgument.java123
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/NullLiteral.java59
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/NumberLiteral.java171
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/PrimitiveOperation.java113
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/ProxyInitParserMessages.java46
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Statement.java201
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Static.java305
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/StringLiteral.java142
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/messages.properties24
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/AbstractEnum.java73
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/Enum.java37
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/ExpressionProcesser.java3364
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/ForExpression.java213
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/IExpressionConstants.java26
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InfixOperator.java212
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InitparserTreeMessages.java43
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalConditionalOperandType.java70
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalExpressionProxy.java77
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalExpressionTypes.java303
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalIfElseOperandType.java60
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalInfixOperandType.java63
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/NoExpressionValueException.java87
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/PrefixOperator.java77
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/VariableReference.java58
-rw-r--r--plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/messages.properties29
40 files changed, 0 insertions, 7903 deletions
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/ArrayArguments.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/ArrayArguments.java
deleted file mode 100644
index d963f6b5e..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/ArrayArguments.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: ArrayArguments.java,v $
- * $Revision: 1.3 $ $Date: 2005/08/24 20:39:07 $
- */
-
-import java.io.StringWriter;
-import java.lang.reflect.Array;
-import java.util.*;
-/**
- * This represents the arguments in a multi dimensional array with construction parameters, e.g.
- * new int[][] { { 2 ,3 } , { 4 ,5 }}
- * the arguments of the constructor will be instance of ArrayArguments
- */
-public class ArrayArguments extends Expression {
-
- Static fType;
- List arguments = new ArrayList(2);
- boolean argsClosed;
- boolean insideArgsOpenedParen;
- boolean insideArgsClosedParen;
-
-public Expression push(char[] token, char tokenDelimiter) {
-
- // If the args are opened and a token was supplied then it must be an argument
- //if ( argsOpened && ( tokenDelimiter == DelimiterCloseParen || tokenDelimiter == DelimiterComma ||
- //tokenDelimiter == DelimiterSpace || tokenDelimiter == DelimiterQuote || tokenDelimiter == DelimiterPeriod)) {
- if (!argsClosed){
- if ( arguments.size() > 0 ){
- Expression openArgument = (Expression)arguments.get(arguments.size()-1);
- if ( !openArgument.isComplete() ) {
- openArgument.push(token,tokenDelimiter);
- // If the argument is complete and we received a ) then the message is complete
- if ( openArgument.isComplete() && tokenDelimiter == DelimiterCloseElipse){
- argsClosed = true;
- }
- return this;
- }
- }
-
- // We must have a new argument - process accordingly
- Expression newArgument = null;
- if (!insideArgsOpenedParen && tokenDelimiter == DelimiterOpenParen){
- insideArgsOpenedParen = true;
- newArgument = new Statement(fClassLoader).push(token,tokenDelimiter);
- newArgument = new MessageArgument(newArgument);
- arguments.add(newArgument);
-
- }
- if ( token.length > 0 || tokenDelimiter == DelimiterQuote || tokenDelimiter == DelimiterSingleQuote || tokenDelimiter == OperMinus ) {
- newArgument = new Statement(fClassLoader).push(token,tokenDelimiter);
- newArgument = new MessageArgument(newArgument);
- arguments.add(newArgument);
- }
- // If the token after the argument is a ) then the message is being closed
- if ( !insideArgsOpenedParen && tokenDelimiter == DelimiterCloseElipse ) {
- argsClosed = true;
- return this;
- }
- if ( insideArgsOpenedParen && tokenDelimiter == DelimiterCloseElipse ) {
- insideArgsClosedParen = true;
- argsClosed = true;
- return this;
- }
- }
- return this;
-}
-/**
- * In the case of the expression new int[][] { {2,3} , {4,5} } then we are the 2,3 or the 4,5
- * to evaluate we must return an array of ints based on our size. The type we return is determined by the initial
- * constructor who will have given this to us as our fType
- */
-public Object evaluate() throws Exception {
-
- Object result = Array.newInstance(fType.getPrimitiveTypeClass(),arguments.size());
- for (int i = 0; i < arguments.size(); i++) {
- Object argumentValue = ((Expression)arguments.get(i)).evaluate();
- Array.set(result,i,argumentValue);
- }
- return result;
-}
-
-public Class getTypeClass() throws Exception {
- return null;
-}
-
-public boolean isComplete() {
- return argsClosed;
-}
-
-public boolean isPrimitive() throws Exception {
- return false;
-}
-public void setType(Static type) {
- fType = type;
-}
-public void contributeArgumentNumber(List argumentNumberList){
-
- // Add the number of arguments we have to the list
- argumentNumberList.add(new Integer(arguments.size()));
- // If our arguments are themselves array arguments ( which will occur in an array of 3 or more dimensions )
- // then we should cascade this message to our argument so that the total array depth is known
- if ( arguments.size() > 0 ) {
- Object firstArgument = arguments.get(0);
- if ( firstArgument instanceof ArrayArguments ) {
-// ((ArrayArguments)firstArgument)contributeArgumentNumber(argumentNumberList);
- }
- }
-
-}
-public String toString(){
- StringWriter writer = new StringWriter();
- writer.write("Args("); //$NON-NLS-1$
- writer.write(new Integer(arguments.size()).toString());
- writer.write(")-"); //$NON-NLS-1$
- writer.write(arguments.toString());
- return writer.toString();
-}
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.proxy.core.initParser.Expression#getTypeClassName()
- */
- protected String getTypeClassName() {
- return ""; // Not applicable //$NON-NLS-1$
- }
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Block.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Block.java
deleted file mode 100644
index c630f2e70..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Block.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: Block.java,v $
- * $Revision: 1.3 $ $Date: 2005/08/24 20:39:07 $
- */
-
-/**
- */
-public class Block extends Expression {
-
- protected boolean fIsClosed = false;
- protected boolean fIsComplete = false;
- protected boolean fMessageOrField = false;
-
- public Block(Expression anExpression){
- currentExpression = anExpression;
- }
-
- public Block(ClassLoader fClassLoader){
- currentExpression = new Statement(fClassLoader);
- }
-
- public Object evaluate() throws Exception {
- return currentExpression.evaluate();
- }
-
- public boolean isComplete() {
- return fIsComplete;
- }
-
- public Class getTypeClass() throws Exception {
- return currentExpression.getTypeClass();
- }
-
-
- public Expression push(char[] token, char tokenDelimiter) {
-
- // If we are closed (i.e. completed with a )) and we get a ) or , then we are all finished up
- // We should not forward this token to the expression, as it isComplete
- if ((fIsClosed || currentExpression.isComplete()) && (tokenDelimiter == DelimiterCloseParen || tokenDelimiter == DelimiterComma)){
- fIsComplete = true;
- return this;
- }
-
- // If we are a message of field and we get a ( we are message or a field otherwise
- if (fMessageOrField){
- fMessageOrField = false;
- // The problem now is that we are a block of an expression and we need to create a message
- // where we are the receiver. However we are on the stack and going to be popped when the message finishes
- // so we must alter ourself to be a block whose current expression is message whose argument
- // is a copy of us
- if ( tokenDelimiter == DelimiterOpenParen){
- Message message = new Message(currentExpression,token,fClassLoader);
- currentExpression = message;
- return message;
- } else {
- Field field = new Field(currentExpression,token,fClassLoader);
- currentExpression = field;
- return field;
- }
- }
-
- // If we are closed and we get a . then we must begin a message or field expression
- if (currentExpression.isComplete() && tokenDelimiter == DelimiterPeriod ){
- fMessageOrField = true;
- return this;
- }
-
- Expression result = currentExpression.push(token,tokenDelimiter);
- // If the result if a push then push the stack
- if ( result != currentExpression ) {
- pushExpressionStack(result);
- }
- // If our current expression is complete and we are receiving a close parent then we are closed
- if (currentExpression.isComplete() && tokenDelimiter == DelimiterCloseParen){
- fIsClosed = true;
-
- }
- // If we are here the current expression is still processing tokens so we should return it
- return currentExpression;
- }
-
- public boolean isPrimitive() throws Exception {
- return false;
- }
- public String toString(){
- StringBuffer buffer = new StringBuffer();
- buffer.append("Block("); //$NON-NLS-1$
- if ( currentExpression != null ) {
- buffer.append(currentExpression.toString());
- }
- buffer.append(')');
- return buffer.toString();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.proxy.core.initParser.Expression#getTypeClassName()
- */
- protected String getTypeClassName() {
- return currentExpression.getTypeClassName();
- }
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/BooleanLiteral.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/BooleanLiteral.java
deleted file mode 100644
index 65204fa27..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/BooleanLiteral.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: BooleanLiteral.java,v $
- * $Revision: 1.3 $ $Date: 2005/08/24 20:39:07 $
- */
-
-
-public class BooleanLiteral extends Expression {
- public boolean value;
-public BooleanLiteral(boolean aValue){
-
- value = aValue;
-
-}
-
-public boolean isComplete(){
- return true;
-}
-/**
- * evaluate method comment.
- */
-public Object evaluate() {
- return new Boolean(value);
-}
-/**
- * evaluate method comment.
- */
-public Class getTypeClass(){
- return Boolean.TYPE;
-}
-/**
- * true or false cannot consume any kind of expression so we must return null
- */
-public Expression push(char[] token , char delimiter){
-
- return null;
-
-}
-
-/**
- * This is primitive
- */
-public boolean isPrimitive() {
- return true;
-}
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.proxy.core.initParser.Expression#getTypeClassName()
- */
- protected String getTypeClassName() {
- return Boolean.TYPE.getName();
- }
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/CannotProcessArrayTypesException.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/CannotProcessArrayTypesException.java
deleted file mode 100644
index 042d80500..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/CannotProcessArrayTypesException.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: CannotProcessArrayTypesException.java,v $
- * $Revision: 1.4 $ $Date: 2005/08/24 20:39:07 $
- */
-
-/**
- * Exception to indicate that the initStringParser can't deal with arrays right now
- */
-public class CannotProcessArrayTypesException extends RuntimeException {
-
- /**
- * Comment for <code>serialVersionUID</code>
- *
- * @since 1.1.0
- */
- private static final long serialVersionUID = -4245984020065761634L;
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/CannotProcessInnerClassesException.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/CannotProcessInnerClassesException.java
deleted file mode 100644
index ac390b93b..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/CannotProcessInnerClassesException.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: CannotProcessInnerClassesException.java,v $
- * $Revision: 1.4 $ $Date: 2005/08/24 20:39:07 $
- */
-
-/**
- * This exception is thrown to indicate that inner classes cannot be processed
- */
-public class CannotProcessInnerClassesException extends RuntimeException {
-
- /**
- * Comment for <code>serialVersionUID</code>
- *
- * @since 1.1.0
- */
- private static final long serialVersionUID = 8290504580738499445L;
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Cast.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Cast.java
deleted file mode 100644
index 2a1d54e8c..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Cast.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: Cast.java,v $
- * $Revision: 1.3 $ $Date: 2005/08/24 20:39:08 $
- */
-
-
-import java.util.HashMap;
-
-public class Cast extends Expression {
- protected static final int BYTE_TYPE = 0;
- protected static final int SHORT_TYPE = 1;
- protected static final int INT_TYPE = 2;
- protected static final int LONG_TYPE = 3;
- protected static final int FLOAT_TYPE = 4;
- protected static final int DOUBLE_TYPE = 5;
-
- protected static final HashMap sTypeLookup;
- static {
- sTypeLookup = new HashMap(6);
- sTypeLookup.put(Byte.TYPE, new Integer(BYTE_TYPE));
- sTypeLookup.put(Short.TYPE, new Integer(SHORT_TYPE));
- sTypeLookup.put(Integer.TYPE, new Integer(INT_TYPE));
- sTypeLookup.put(Long.TYPE, new Integer(LONG_TYPE));
- sTypeLookup.put(Float.TYPE, new Integer(FLOAT_TYPE));
- sTypeLookup.put(Double.TYPE, new Integer(DOUBLE_TYPE));
- }
-
- protected Static fCastType;
- protected boolean fIsClosed = false;
-
- public Cast(Static castType, ClassLoader aClassLoader) {
- fCastType = castType;
- fClassLoader = aClassLoader;
- }
-
- public boolean isPrimitive() throws Exception {
- return getTypeClass().isPrimitive();
- }
-
- /**
- * The type of a Cast expression is the type of the cast type.
- */
- public Class getTypeClass() throws Exception {
- return fCastType.getTypeClass();
- }
-
-
- public boolean isComplete() {
- return currentExpression != null && currentExpression.isComplete();
- }
-
- /**
- * If the type is primitive, then we need to
- * convert the value, otherwise just pass
- * the value on.
- *
- * This is important for primitives because if your
- * entire initialization string was simply "(short) 3"
- * then a Short value must be returned so that the
- * correct kind of primitive proxy is created.
- */
- public Object evaluate() throws Exception {
- if (getTypeClass() == currentExpression.getTypeClass())
- return currentExpression.evaluate(); // They're the same, so just return it.
- if (getTypeClass().isPrimitive()) {
- // Can only cast a primitive to a primitive, except null can't be cast to a primitive.
- if (!currentExpression.getTypeClass().isPrimitive() || currentExpression.getTypeClass() == Void.TYPE)
- throw new EvaluationException(new ClassCastException(currentExpression.getTypeClass().getName()));
- // boolean only allows boolean cast.
- if (fCastType.getTypeClass() == Boolean.TYPE || currentExpression.getTypeClass() == Boolean.TYPE)
- throw new EvaluationException(new ClassCastException(currentExpression.getTypeClass().getName()));
- if (fCastType.getTypeClass() == Character.TYPE) {
- // So we have either a Character or a number as the value. Cast that.
- return new Character((char) ((Number) currentExpression.evaluate()).intValue());
- } else {
- Number value = null;
- // See if the value is character or a number.
- if (currentExpression.getTypeClass() == Character.TYPE)
- value = new Integer(((Character) currentExpression.evaluate()).charValue());
- else
- value = (Number) currentExpression.evaluate();
- switch (((Integer) sTypeLookup.get(fCastType.getTypeClass())).intValue()) {
- case BYTE_TYPE:
- return new Byte(value.byteValue());
- case SHORT_TYPE:
- return new Short(value.shortValue());
- case INT_TYPE:
- return new Integer(value.intValue());
- case LONG_TYPE:
- return new Long(value.longValue());
- case FLOAT_TYPE:
- return new Float(value.floatValue());
- case DOUBLE_TYPE:
- return new Double(value.doubleValue());
- default:
- return null; // Shouldn't occur. Just satisifies compiler.
- }
- }
-
- } else
- return currentExpression.evaluate();
- }
- /**
- * A cast expression always pushes onto the cast value
- */
- public Expression push(char[] token , char tokenDelimiter) {
- // If we don't have a class yet then we are within the statement to try and deterine the type being cast to
- if(fCastType.getPrimitiveTypeClass() == null && !fIsClosed){
- fCastType.push(token,tokenDelimiter);
- // If the type was completed and we have a ) then close us
- if(fCastType.getPrimitiveTypeClass() != null && tokenDelimiter == DelimiterCloseParen){
- fIsClosed = true;
- }
- return this;
- }
-
- if (!fIsClosed) {
- // The cast is not closed, but we have a static class. This class must therefore keep processing the tokens as it could be a method or message send
- Expression result = fCastType.push(token,tokenDelimiter);
- result.parenthesisLevel++;
- return result;
- }
-
- // If we have no expression push onto the cast value
- if(currentExpression == null){
- currentExpression = new Statement(fClassLoader);
- currentExpression = currentExpression.push(token,tokenDelimiter);
- return this;
- }
- Expression result = currentExpression.push(token, tokenDelimiter);
- // If the result if a push then push the stack
- if ( result.isComplete() ) {
- popExpressionStack();
- } else if ( result != currentExpression ) {
- pushExpressionStack(result);
- }
- return this;
- }
- public String toString(){
- StringBuffer buffer = new StringBuffer();
- buffer.append("Cast("); //$NON-NLS-1$
- if (fCastType != null){
- buffer.append(fCastType.toString());
- } else {
- buffer.append("???"); //$NON-NLS-1$
- }
- buffer.append(") "); //$NON-NLS-1$
- if ( currentExpression != null){
- buffer.append(currentExpression.toString());
- } else {
- buffer.append("???"); //$NON-NLS-1$
- }
- return buffer.toString();
- }
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.proxy.core.initParser.Expression#getTypeClassName()
- */
- protected String getTypeClassName() {
- return fCastType.getTypeClassName();
- }
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/CharLiteral.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/CharLiteral.java
deleted file mode 100644
index a0dd4d834..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/CharLiteral.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: CharLiteral.java,v $
- * $Revision: 1.5 $ $Date: 2005/08/24 20:39:07 $
- */
-
-import java.text.MessageFormat;
-
-
-
-public class CharLiteral extends Expression {
- protected boolean isComplete;
- public char value;
- public StringBuffer valueBuffer = new StringBuffer();
- protected boolean isEscaped = false;
-
-/**
- * constructor
- */
-public CharLiteral(){
-}
-
-/**
- * evaluate method comment.
- */
-public Object evaluate() throws Exception {
- if (valueBuffer.length() == 1)
- return new Character(valueBuffer.charAt(0));
- else
- throw new EvaluationException(
- new IllegalArgumentException(MessageFormat.format(ProxyInitParserMessages.getString("CharTooComplicated_EXC_"), //$NON-NLS-1$
- new Object[] {valueBuffer.toString()})));
-}
-
-public boolean isComplete(){
- return isComplete;
-}
-/**
- * We must evaluate ourself and return the type of the result
- */
-
-public Class getTypeClass() {
- return Character.TYPE;
-}
-
-protected String getTypeClassName() {
- return Character.TYPE.getName();
-}
-/**
- *This string might be broken into a few tokens
- *so we need a StringBuffer
- */
-public Expression push(char[] token , char delimiter){
-
- if (isEscaped) {
- isEscaped = false;
- if (token.length != 0) {
- // Had an escape followed by stuff, so not a true esc for our current definition
- valueBuffer.append(DelimiterEscape);
- } else {
- if (delimiter == DelimiterSingleQuote || delimiter == DelimiterEscape)
- valueBuffer.append(delimiter); // It was a true escape.
- else {
- valueBuffer.append(DelimiterEscape); // If wasn't a true escape
- valueBuffer.append(delimiter);
- }
- return this;
- }
- }
-
- valueBuffer.append(token);
-
- if (delimiter == DelimiterSingleQuote){
- isComplete =true;
- return this;
- }
-
- // If the delimiter is an escape character remember it so we can escape
- // the next token, otherwise treat it as a literal
- if (delimiter == DelimiterEscape ){
- isEscaped = true;
- } else {
- valueBuffer.append(delimiter);
- }
- return this;
-}
-
-/**
- * chars are primitives.
- */
-public boolean isPrimitive() {
- return true;
-}
-public String toString(){
- StringBuffer buffer = new StringBuffer();
- buffer.append("Char('"); //$NON-NLS-1$
- if ( valueBuffer != null ) {
- buffer.append(valueBuffer.toString());
- }
- buffer.append(')');
- return buffer.toString();
-}
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Constructor.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Constructor.java
deleted file mode 100644
index 4afa2638d..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Constructor.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: Constructor.java,v $
- * $Revision: 1.6 $ $Date: 2006/05/17 20:13:05 $
- */
-
-
-import java.util.*;
-
-import org.eclipse.jem.internal.proxy.common.AmbiguousMethodException;
-import org.eclipse.jem.internal.proxy.common.MethodHelper;
-/**
- * Insert the type's description here.
- * Creation date: (11/01/00 8:52:36 PM)
- * @author: Administrator
- */
-public class Constructor extends Expression {
- public boolean argsOpened = false;
- public boolean argsClosed = false;
- public boolean trailingPeriod = false;
- public ArrayList arguments = new ArrayList(2);
- public Static type;
- protected boolean fIsComplete;
- public boolean insideArgsOpenedParen = false;
- public boolean insideArgsClosedParen = false;
- public boolean isString = false;
- public java.lang.reflect.Constructor ctor;
-/**
- * Constructor constructor comment.
- */
-public Constructor(ClassLoader aClassLoader) {
- super();
- fClassLoader = aClassLoader;
-}
-
-public boolean isComplete(){
- return fIsComplete;
-}
-
-/**
- * Invoke the construtor
- */
-public Object evaluate() throws Exception {
-
- if ( type.isArray() ) {
- // For arrays we get the array that is actually held inside the static
- // To instantiate the array it is possible that the static knows the array size, e.g. new int[2]
- // or else it must be given this from the number of arguments we have, e.g. new int[] { 2 , 3 }
- if ( arguments.size() > 0 ) {
- type.setArrayArguments(arguments);
- }
- Object result = type.evaluate();
- // Deal with array initialization arguments
- return result;
- } else {
- // For non arrays we find the method and invoke it on the type
- cacheCtor();
- // Get the array of arguments
- Object[] args = new Object[arguments.size()];
- Iterator itr = arguments.iterator();
- for (int i = 0; i < arguments.size() ; i++){
- Expression anExpression = (Expression)itr.next();
- args[i] = anExpression.evaluate();
- }
-
- try {
- return ctor.newInstance(args);
- } catch (Exception e) {
- // If we got this far, then we have a valid parse, so anything is an evaluation exception.
- throw new EvaluationException(e);
- }
- }
-}
-/** A constructor can only return the class of its type
- */
-public Class getTypeClass() throws Exception {
- if ( type.isArray() ) {
- // For arrays we get the array that is actually held inside the static
- // To instantiate the array it is possible that the static knows the array size, e.g. new int[2]
- // or else it must be given this from the number of arguments we have, e.g. new int[] { 2 , 3 }
- if ( arguments.size() > 0 ) {
- type.setArrayArguments(arguments);
- }
- }
- return type.getTypeClass();
-}
-
-protected String getTypeClassName() {
- return type.getTypeClassName();
-}
-
-private void cacheCtor() throws Exception {
-
- if (ctor == null) {
- Class[] argTypes = new Class[arguments.size()];
- Iterator itr = arguments.iterator();
- for (int i=0; i<argTypes.length; i++)
- argTypes[i] = getEvaluationTypeClass((Expression) itr.next());
-
- try {
- ctor = MethodHelper.findCompatibleConstructor(getEvaluationTypeClass(this), argTypes);
- } catch (NoSuchMethodException e) {
- throw new EvaluationException(e);
- } catch (AmbiguousMethodException e) {
- throw new EvaluationException(e);
- } catch (IllegalAccessException e) {
- throw new EvaluationException(e);
- }
- }
-}
-protected boolean isDelimiterOpened(char token){
- return type.isArray() ? token == DelimiterOpenElipse : token == DelimiterOpenParen;
-}
-protected boolean isDelimiterClosed(char token){
- return type.isArray() ? token == DelimiterCloseElipse : token == DelimiterCloseParen;
-}
-/**
- * push method comment.
- */
-public Expression push(char[] token, char tokenDelimiter) {
-
- // If we are closed and we receive a . with no token then remember this
- if ( argsClosed && !trailingPeriod && tokenDelimiter == DelimiterPeriod && token.length == 0 ) {
- trailingPeriod = true;
- return this;
- }
- // If we have been closed with a . and we receive a . then we are a field
- if ( trailingPeriod && tokenDelimiter == DelimiterPeriod ) {
- return new Field(this,token,fClassLoader);
- }
- // If we have been closed with a . and we receive a ( we are a message
- if ( trailingPeriod && tokenDelimiter == DelimiterOpenParen ) {
- return new Message(this,token,fClassLoader);
- }
-
- // Lazy initialize the type if required
- if ( type == null ) {
- switch ( tokenDelimiter ) {
- case DelimiterPeriod: {
- type = new Static(token,tokenDelimiter,fClassLoader);
- type.setClassLoader(fClassLoader);
- return this;
- }
- case DelimiterOpenParen: {
- type = new Static(token,tokenDelimiter,fClassLoader);
- type.setClassLoader(fClassLoader);
- argsOpened = true;
- return this;
- }
- case DelimiterOpenSquareBrace: {
-// throw new CannotProcessArrayTypesException();
- // Array dimenions are created as staements in the arrayDimensions
- // This is for expressions like new String[] or new String[3], where the Statement represents the 3, i.e.
- // the code that declares the size of the array
- type = new Static(token,tokenDelimiter,fClassLoader,true);
- return this;
- }
- // If we get a { and our static is an array then this is the array initialization parameters
- case DelimiterOpenElipse: {
- if ( type != null && type.isArray() ) {
- argsOpened = true;
- }
- }
- default: {
- return null;
- }
- }
- }
-
- // If we have a static that is an array then it consumes token until it is complete
- if ( type != null && type.isArray() ) {
- // The type consumes token as long as it is still in the array declaration section
- if ( type.isProcessingArrayDimension || tokenDelimiter == DelimiterOpenSquareBrace ) {
- type.push(token,tokenDelimiter);
- return this;
- }
- }
-
- // If the type is incomplete and the token is a . ( for another class ) or a [ for an array then push it onto the type
- if (!type.isArray() && type.getTypeClass() == null && (tokenDelimiter == DelimiterPeriod || tokenDelimiter == DelimiterOpenSquareBrace)) {
- type.push(token , tokenDelimiter);
- return this;
- }
- // If the type is incomplete and the token is a ( then push it onto the type and open the parens
- if (!type.isArray()){
- if (type.getTypeClass() == null && !argsOpened && isDelimiterOpened(tokenDelimiter)) {
- argsOpened = true;
- insideArgsOpenedParen = true;
- type.push(token , DelimiterSpace );
- return this;
- }
- } else {
- if ( !argsOpened && isDelimiterOpened(tokenDelimiter)) {
- argsOpened = true;
- insideArgsOpenedParen = true;
- return this;
- }
- }
-
- // If the args are already closed and we get another close expression, then just return ourselves
- // This occurs in the case of nested array arguments within constructors
- if ( argsClosed && (tokenDelimiter == DelimiterCloseParen)){
- fIsComplete = true;
- return this;
- }
-
- // If the arguments are closed and we receive a { then this is an inner class declaration, e.g.
- // new javax.swing.table.DefaultTableModel(){}
- // This can't be processed by us so we need to throw an exception
- if (argsClosed && tokenDelimiter == DelimiterOpenElipse ) {
- throw new CannotProcessInnerClassesException();
- }
-
- // If the args are opened and a token was supplied then it must be an argument
- if (argsOpened){
- // If we already have an incomplete argument then this may be a constructor, a static reference, etc...
- // and we should forward the request to the argument
- Expression openArgument = null;
- if ( arguments.size() > 0 ){
- openArgument = (Expression)arguments.get(arguments.size()-1);
- if ( !openArgument.isComplete() ) {
- openArgument.push(token,tokenDelimiter);
- // If the argument is complete and we received a ) then the constructor is complete
- // or if we receive a } and are an array we are complete
- if ( openArgument.isComplete() && isDelimiterClosed(tokenDelimiter) ){
- argsClosed = true;
- }
- return this;
- }
- }
-
- Expression newArgument = null;
- // If we are not already inside the open arg and we get another open paren this is probably a cast
- // or some kind of statement, and OperMinus is probably the start of a number
- // If the args are not already open we must be opened with either a { or a ( depending on whether we are an array or not
- // however if the args are opened already and we receive a ( then this is the start of a new statement
-// if ((!insideArgsOpenedParen && isDelimiterOpened(tokenDelimiter)) || tokenDelimiter == DelimiterOpenParen){
- if (tokenDelimiter == DelimiterOpenElipse || tokenDelimiter == DelimiterOpenParen){
- insideArgsOpenedParen = true;
- newArgument = new Statement(fClassLoader).push(token,tokenDelimiter);
- if ( newArgument instanceof ArrayArguments ) {
- ((ArrayArguments)newArgument).setType(type);
- }
- newArgument = new MessageArgument(newArgument);
- arguments.add(newArgument);
-
- }
-
- // Start of a possible string or number or character
- if ( ( token.length > 0 || tokenDelimiter == DelimiterQuote || tokenDelimiter == DelimiterSingleQuote) || tokenDelimiter == OperMinus ){
- newArgument = new Statement(fClassLoader).push(token,tokenDelimiter);
- newArgument = new MessageArgument(newArgument);
- arguments.add(newArgument);
- }
- // If the token after the argument is a ) then the message is being closed
- if ( !insideArgsOpenedParen || argumentsAreComplete() && isDelimiterClosed(tokenDelimiter) ) {
- argsClosed = true;
- return this;
- }
- if ( insideArgsOpenedParen && isDelimiterClosed(tokenDelimiter) ) {
- insideArgsClosedParen = true;
- return this;
- }
-
- // If the token after the argument is a , or a ' ' then the argument is being closed
- if ( tokenDelimiter == DelimiterComma || tokenDelimiter == DelimiterSpace ) {
- // If our arguments are closed then we must be complete. We need to signal the fact we are closed
- // otherwise we will not be processed correctly if we are part of a stack
- if ( argsClosed ) {
- fIsComplete = true;
- }
- return this;
- }
-
- // If we receive a close bracket then we are closed as long as the last argument is closed
- if(argsOpened && isDelimiterClosed(tokenDelimiter)){
- // No parms - we are a closed constructor
- if(arguments.size() == 0){
- argsClosed = true;
- return this;
- }
- }
-
- // If our last argument is closed and receive a ) and we have no new argument then we are closed
- if (tokenDelimiter == DelimiterCloseParen && newArgument == null){
- Expression lastArgument = (Expression)arguments.get(arguments.size()-1);
- if ( lastArgument.isComplete() ) {
- argsClosed = true;
- return this;
- }
- }
-
- // Otherwise the new argument is stil processing. Return it
- return newArgument;
- }
-
- return this;
-}
-protected boolean argumentsAreComplete(){
- if ( arguments.size() == 0) return true;
- return ((Expression)arguments.get(arguments.size()-1)).isComplete();
-}
-public String toString(){
-
- java.io.StringWriter writer = new java.io.StringWriter();
- writer.write("Constructor \""); //$NON-NLS-1$
- if ( type != null ) {
- writer.write(type.typeWriter.toString());
- } else {
- writer.write("UNTYPED"); //$NON-NLS-1$
- }
- for (int i = 0; i < arguments.size() ; i++){
- writer.write(" Arg("); //$NON-NLS-1$
- writer.write("" + (i+1)); //$NON-NLS-1$
- writer.write(") = "); //$NON-NLS-1$
- writer.write(arguments.get(i).toString());
- }
-
- return writer.toString();
-
-}
-
-/**
- * This is never primitive
- */
-public boolean isPrimitive() {
- return false;
-}
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/EvaluationException.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/EvaluationException.java
deleted file mode 100644
index 1d97cda37..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/EvaluationException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: EvaluationException.java,v $
- * $Revision: 1.4 $ $Date: 2005/08/24 20:39:07 $
- */
-
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * This is an InitializationStringEvaluationException, but
- * in addition, the exception that it wrappers is what should be
- * returned. This means it was a valid exception, parsing had
- * gone fine, but it was an evaluation that occured. This is
- * distinguished from the straight InitializationStringEvaluationException,
- * which means some error during parsing and evaluation.
- *
- * Note: InvocationTargetExceptions will be unwrappered to the true exception.
- */
-public class EvaluationException extends InitializationStringEvaluationException {
-
- /**
- * Comment for <code>serialVersionUID</code>
- *
- * @since 1.1.0
- */
- private static final long serialVersionUID = -6997239021885310986L;
-
- /**
- * Constructor for ReturnableException.
- * @param exc
- */
- public EvaluationException(Throwable exc) {
- super(exc instanceof InvocationTargetException ? ((InvocationTargetException) exc).getTargetException() : exc);
- }
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Expression.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Expression.java
deleted file mode 100644
index 5e7ec38a0..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Expression.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: Expression.java,v $
- * $Revision: 1.3 $ $Date: 2005/08/24 20:39:07 $
- */
-
-
-import java.util.*;
-/**
- * Insert the type's description here.
- * Creation date: (11/01/00 8:46:44 PM)
- * @author: Administrator
- */
-public abstract class Expression implements IParserConstants {
- protected Expression currentExpression;
- protected List fExpressionStack;
- protected ClassLoader fClassLoader;
- public int parenthesisLevel = 0;
-/** Compare the two char arrays
- */
-public static boolean compare(char[] from , char[] to){
-
- return Arrays.equals(from, to);
-}
-/**
- * Expression constructor comment.
- * Note: If any exceptions that are due to evaluation, and not due to some
- * invalid state, then the exception should be wrappered in an EvaluationException,
- * and the EvaluationException thrown instead. This way we can distinquish between
- * valid exceptions that result evaluations (such as null pointer exceptions) from
- * parser errors due to string is too complicated.
- */
-public abstract Object evaluate() throws Exception;
-
-public abstract boolean isComplete();
-/**
- * Return a class type that the expression syntactically would produce.
- * For example, if a field is of type XYZ, return XYZ, even though
- * the value of the field may be SubXYZ where SubXYZ is a subclass of XYZ.
- */
-public abstract Class getTypeClass() throws Exception;
-/**
- * In evaluation phase, get the type class from the expression.
- * If typeclass not found, then a ClassCastException is thrown.
- * @param exp To getTypeClass from
- * @return type class.
- * @throws Exception ClassNotFoundException if type not found.
- */
-public Class getEvaluationTypeClass(Expression exp) throws Exception {
- Class cls = exp.getTypeClass();
- if (cls == null)
- throw new EvaluationException(new ClassNotFoundException(exp.getTypeClassName()));
- return cls;
-}
-
-/**
- * @return Type name that should be returned from this expression.
- */
-protected abstract String getTypeClassName();
-
-public boolean isNumber(char[] token){
-
- if ( token.length == 0) return false;
- // See whether the token is a number
- int parsePosition = 0;
- // Take into account it may start with a - sign, e.g. -1
- if ( token[0] == '-' ) parsePosition = 1;
- for (int i = parsePosition; i < token.length ; i++){
- // If the next token is a digit return true
- // Other things like decimals or primitive types, e.g. 2.2 or 2.2f are
- // handled by NumberLiteral
- return Character.isDigit(token[i]);
- }
- return true;
-}
-public boolean isPop(){
- return false;
-}
-protected void popExpressionStack(){
-
- if ( fExpressionStack != null && fExpressionStack.size() > 0 ) {
- currentExpression = (Expression) fExpressionStack.remove(fExpressionStack.size()-1);
- }
-}
-protected void pushExpressionStack(Expression anExpression){
-
- if ( fExpressionStack == null ) fExpressionStack = new ArrayList(2);
- // The current expression should go onto the stack
- fExpressionStack.add(currentExpression);
- // The current expression is replaced with the argument
- currentExpression = anExpression;
-
-}
-
-void setClassLoader(ClassLoader aClassLoader){
-}
-
-/**
- * Push an expression onto us
- * Return the new expression onto which subsequent token should be pushed
- */
-public abstract Expression push(char[] token , char tokenDelimiter);
-
-/**
- * Answer if this expression results in a primitive.
- */
-public abstract boolean isPrimitive() throws Exception;
-
-public String toString(int depth, boolean aBreak){
- StringBuffer buffer = new StringBuffer();
- if ( aBreak ) {
- buffer.append(System.getProperty("System.lineSeparator")); //$NON-NLS-1$
- }
- for(int i=0;i<depth;i++){
- buffer.append(" "); //$NON-NLS-1$
- }
- buffer.append(toString());
- return buffer.toString();
-}
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Field.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Field.java
deleted file mode 100644
index eae848c6d..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Field.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: Field.java,v $
- * $Revision: 1.5 $ $Date: 2005/08/24 20:39:07 $
- */
-
-
-/**
- * Insert the type's description here.
- * Creation date: (11/05/00 10:39:28 PM)
- * @author: Administrator
- */
-public class Field extends Expression {
- public boolean isComplete;
- protected java.lang.reflect.Field fField;
- public Expression receiver;
- public String fieldName;
- protected Class fResultType;
-
-public Field(Expression aReceiver , char[] token , ClassLoader aClassLoader){
-
- receiver = aReceiver;
- if ( token.length > 0 ){
- fieldName = new String(token);
- }
-
-}
-public boolean isComplete(){
- return isComplete;
-}
-
-/**
- * Send the message to the receiver
- */
-public Object evaluate() throws Exception {
- Object receiverValue = receiver.evaluate(); // So if it fails, we get an evaluation exception going on up.
- try {
- cacheField();
- return fField.get(receiverValue);
- } catch (Exception e) {
- throw new EvaluationException(e); // Any exception at this point is an evaluation exception.
- }
-}
-
-/**
- * Get the field from reflection.
- */
-protected void cacheField() throws Exception {
- if (fField == null) {
- Class aReceiverClass = getEvaluationTypeClass(receiver);
- fField = aReceiverClass.getField(fieldName);
- fResultType = fField.getType();
- }
-}
-
-/**
- * The result type is the type of the field.
- */
-public Class getTypeClass() throws Exception {
- if ( fResultType == null ) {
- cacheField();
- }
- return fResultType;
-}
-
-protected String getTypeClassName() {
- return ""; // If we got this far, we don't know what it is. //$NON-NLS-1$
-}
-/**
- * push method comment.
- */
-public Expression push(char[] token, char tokenDelimiter) {
-
- // If the delimiter is a ( then this is the start of a message
- if ( tokenDelimiter == DelimiterOpenParen ) {
- return new Message(this , token , fClassLoader);
- }
-
- // If the delimiter is a . then this is a field
- if (token.length > 0 && ( tokenDelimiter == DelimiterPeriod || tokenDelimiter == DelimiterSpace
- || tokenDelimiter == DelimiterComma)) {
- isComplete = true;
- return new Field(this , token , fClassLoader);
-
- }
-
- if(fieldName != null && tokenDelimiter == DelimiterComma){
- isComplete = true;
- return this;
- }
-
- // If we have no delimiter or a close paren then we have just received the field name
- if (!isComplete && fieldName == null) {
- fieldName = new String(token);
- return this;
- }
-
- if(tokenDelimiter == BitOR || tokenDelimiter == BitAND){
- isComplete = true;
- PrimitiveOperation result = new PrimitiveOperation(this,tokenDelimiter);
- return result;
- }
-
- // Ignore spaces as this maybe padding between the field and the next valid token
- if(token.length == 0 && tokenDelimiter == ' ') return this;
-
- throw new RuntimeException(java.text.MessageFormat.format(ProxyInitParserMessages.getString(ProxyInitParserMessages.UNEXPECTED_TOKEN), new Object[] {new StringBuffer(token.length+1).append(token).append(tokenDelimiter).toString()}));
-
-}
-public String toString(){
-
- java.io.StringWriter writer = new java.io.StringWriter();
- writer.write("Field Name=\""); //$NON-NLS-1$
- if ( fieldName != null ) {
- writer.write(fieldName);
- } else {
- writer.write("UNNAMED"); //$NON-NLS-1$
- }
- writer.write("\" Receiver="); //$NON-NLS-1$
- if ( receiver != null ){
- writer.write(receiver.toString());
- } else {
- writer.write("NONE"); //$NON-NLS-1$
- }
- return writer.toString();
-
-}
-
-/**
- * Test the field type to determine if primitive or not.
- */
-public boolean isPrimitive() throws Exception {
- cacheField();
- return getTypeClass().isPrimitive();
-}
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/IParserConstants.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/IParserConstants.java
deleted file mode 100644
index 520c22fba..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/IParserConstants.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: IParserConstants.java,v $
- * $Revision: 1.3 $ $Date: 2005/08/24 20:39:07 $
- */
-
-
-/**
- * Constants for the parser.
- * Creation date: (11/05/00 9:37:45 PM)
- * @author: Administrator
- */
-public interface IParserConstants {
- // Define the delimiters
- public static final char DelimiterSpace = ' ';
- public static final char DelimiterPeriod = '.';
- public static final char DelimiterOpenParen = '(';
- public static final char DelimiterCloseParen = ')';
- public static final char DelimiterComma = ',';
- public static final char DelimiterQuote = '"';
- public static final char DelimiterEscape = '\\';
- public static final char DelimiterSingleQuote = '\'';
- public static final char DelimiterOpenElipse = '{';
- public static final char DelimiterCloseElipse = '}';
- public static final char DelimiterOpenSquareBrace = '[';
- public static final char DelimiterCloseSquareBrace = ']';
- // Define the math functions
- public static final char OperPlus = '+';
- public static final char OperMinus = '-';
- public static final char OperMultiply = '*';
- public static final char OperDivide = '/';
- // Define the primitive functions
- public static final char BitOR = '|';
- public static final char BitAND = '&';
-
- // Define constants
- public static final char[] ConstantNew = new char[] { 'n' , 'e' , 'w' };
- public static final char[] ConstantTrue = new char[] { 't' , 'r' , 'u' , 'e' };
- public static final char[] ConstantFalse = new char[] { 'f' , 'a' , 'l' , 's' , 'e' };
- public static final char[] ConstantNull = new char[] { 'n' , 'u' , 'l' , 'l' };
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/InitializationStringEvaluationException.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/InitializationStringEvaluationException.java
deleted file mode 100644
index 4cf3ca6e7..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/InitializationStringEvaluationException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: InitializationStringEvaluationException.java,v $
- * $Revision: 1.5 $ $Date: 2005/08/24 20:39:07 $
- */
-
-
-
-public class InitializationStringEvaluationException extends Exception {
-
-
-/**
- * Comment for <code>serialVersionUID</code>
- *
- * @since 1.1.0
- */
- private static final long serialVersionUID = -8633390926210276727L;
-public InitializationStringEvaluationException(Throwable exc){
- super(exc);
-}
-public Throwable getOriginalException(){
- return getCause();
-}
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/InitializationStringParser.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/InitializationStringParser.java
deleted file mode 100644
index 893ce84f9..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/InitializationStringParser.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: InitializationStringParser.java,v $
- * $Revision: 1.5 $ $Date: 2005/08/24 20:39:07 $
- */
-
-
-import java.util.ArrayList;
-/**
- * Insert the type's description here.
- * Creation date: (11/01/00 8:53:45 PM)
- * @author: Administrator
- */
-public class InitializationStringParser implements IParserConstants {
- protected ClassLoader fClassLoader;
- protected boolean isComplete = false;
- protected String fInitString;
- protected int fSourceLength;
- protected char[] fSource;
- protected int fSourcePosition = -1;
- private char[] fCurrentToken;
- private char fCurrentTokenDelimiter = 0;
- protected ArrayList fExpressionStack = new ArrayList(4);
- protected Expression fExpression;
-/**
- * InitializationStringParser constructor comment.
- */
-public InitializationStringParser(String initString){
-
- fInitString = initString;
- fSource = initString.toCharArray();
- fSourceLength = fSource.length;
-
-}
-/** Look for a known token
- */
-protected void createNextToken(){
-
- fCurrentTokenDelimiter = 0;
- if ( fSourcePosition >= fSourceLength - 1 ) {
- isComplete = true;
- return;
- }
-
- fSourcePosition++;
- // If we are not in a token then look for " " or else for a period
- char[] fCurrentTokenSource = new char[fSourceLength];
- int i = 0;
- scanner : for ( ; fSourcePosition < fSourceLength ; fSourcePosition++ , i++ ){
- // Advance the source position so when finding the next token we skip over the '.' or ' '
- // Record the delimiter that was found
- switch ( fSource[fSourcePosition] ) {
- case DelimiterPeriod: {
- fCurrentTokenDelimiter = DelimiterPeriod;
- break scanner;
- }
- case DelimiterOpenParen: {
- fCurrentTokenDelimiter = DelimiterOpenParen;
- break scanner;
- }
- case DelimiterCloseParen: {
- fCurrentTokenDelimiter = DelimiterCloseParen;
- break scanner;
- }
- case DelimiterComma: {
- fCurrentTokenDelimiter = DelimiterComma;
- break scanner;
- }
- case DelimiterSpace: {
- fCurrentTokenDelimiter = DelimiterSpace;
- break scanner;
- }
- case DelimiterQuote: {
- fCurrentTokenDelimiter = DelimiterQuote;
- break scanner;
- }
- case DelimiterSingleQuote: {
- fCurrentTokenDelimiter = DelimiterSingleQuote;
- break scanner;
- }
- case DelimiterEscape: {
- fCurrentTokenDelimiter = DelimiterEscape;
- break scanner;
- }
- case DelimiterOpenElipse:{
- fCurrentTokenDelimiter = DelimiterOpenElipse;
- break scanner;
- }
- case DelimiterOpenSquareBrace:{
- fCurrentTokenDelimiter = DelimiterOpenSquareBrace;
- break scanner;
- }
- case DelimiterCloseSquareBrace:{
- fCurrentTokenDelimiter = DelimiterCloseSquareBrace;
- break scanner;
- }
- case DelimiterCloseElipse:{
- fCurrentTokenDelimiter = DelimiterCloseElipse;
- break scanner;
- }
- // Do the math functions
- case OperPlus: {
- fCurrentTokenDelimiter = OperPlus;
- break scanner;
- }
- case OperMinus: {
- fCurrentTokenDelimiter = OperMinus;
- break scanner;
- }
- case OperMultiply: {
- fCurrentTokenDelimiter = OperMultiply;
- break scanner;
- }
- case OperDivide: {
- fCurrentTokenDelimiter = OperDivide;
- break scanner;
- }
- // Do the primitive BitWise operations
- case BitOR: {
- fCurrentTokenDelimiter = BitOR;
- break scanner;
- }
- case BitAND: {
- fCurrentTokenDelimiter = BitAND;
- break scanner;
- }
- default: {
- fCurrentTokenSource[i] = fSource[fSourcePosition];
- }
- }
- }
-
- // Push the token onto the stack for later decoding
- if ( i >= 1 ) {
- fCurrentToken = new char[i];
- System.arraycopy( fCurrentTokenSource , 0 , fCurrentToken , 0 , i );
- } else {
- fCurrentToken = new char[0];
- }
-
-}
-/** Answer the result of evaluating the expression
- */
-public Object evaluate() throws InitializationStringEvaluationException {
-
- try {
- return fExpression.evaluate();
- } catch (java.lang.reflect.InvocationTargetException e) {
- throw new EvaluationException(e);
- } catch (EvaluationException e) {
- throw e; // Don't loose these
- } catch (Throwable e) {
- throw new InitializationStringEvaluationException(e);
- }
-
-}
-public static Object evaluate(String initString) throws InitializationStringEvaluationException {
-
- return evaluate(initString,null);
-
-}
-public static Object evaluate(String initString,ClassLoader aClassLoader) throws InitializationStringEvaluationException {
-
- InitializationStringParser parser = null;;
- try {
- parser = new InitializationStringParser(initString);
- parser.setClassLoader(aClassLoader);
- parser.parse();
- } catch ( Throwable exc ) {
- throw new InitializationStringEvaluationException(exc);
- }
- return parser.evaluate();
-}
-
-/**
- * Return a parser already parsed. Use the default classloader (i.e. classloader that loaded InitializationStringParser).
- *
- * @param initString
- * @return The parser, already parsed.
- * @throws InitializationStringEvaluationException
- */
-
-public static InitializationStringParser createParser(String initString) throws InitializationStringEvaluationException {
- return createParser(initString, null);
-}
-
-/**
- * Return a parser already parsed. Use the given classloader.
- *
- * @param initString
- * @param classLoader
- * @return The parser, already parsed.
- * @throws InitializationStringEvaluationException
- */
-public static InitializationStringParser createParser(String initString, ClassLoader classLoader) throws InitializationStringEvaluationException {
-
- try {
- InitializationStringParser parser = new InitializationStringParser(initString);
- parser.setClassLoader(classLoader);
- parser.parse();
- return parser;
- } catch ( Throwable exc ) {
- throw new InitializationStringEvaluationException(exc);
- }
-
-}
-
-/** Analyze the string
- */
-public void parse(){
-
- createFirstExpression();
- int i =1;
- while ( true ){
- createNextToken();
- if ( isComplete ) {
- // If the current expression is incomplete it must be completed
- // by the end, which is basically the equiavlent of a;
- return;
- } else {
- i++;
- Expression result = fExpression.push( fCurrentToken , fCurrentTokenDelimiter );
- // If the result if a push then push the stack
- if ( result.isComplete() ) {
- popExpressionStack();
- } else if ( result != fExpression ) {
- pushExpressionStack(result);
- }
- }
- }
-}
-
-/**
- * Answer if the string results in a primitive.
- */
-public boolean isPrimitive() throws InitializationStringEvaluationException {
- try {
- return fExpression.isPrimitive();
- } catch (Exception e) {
- throw new InitializationStringEvaluationException(e);
- }
-}
-
-public Class getExpectedType() throws InitializationStringEvaluationException {
- try {
- return fExpression.getTypeClass();
- } catch (Exception e) {
- throw new InitializationStringEvaluationException(e);
- }
-}
-
-/* Pop the top expression off the stack
- */
-protected void popExpressionStack(){
-
- if ( fExpressionStack.size() > 0 ) {
- fExpression = (Expression) fExpressionStack.remove(fExpressionStack.size()-1);
- }
-}
-/* Push the expression onto the stack
- */
-protected void pushExpressionStack(Expression anExpression){
-
- // The current expression should go onto the stack
- fExpressionStack.add(fExpression);
- // The current expression is replaced with the argument
- fExpression = anExpression;
-
-}
-protected void createFirstExpression(){
- if ( fExpression == null ) {
- fExpression = new Statement(fClassLoader);
- };
-}
-public void setClassLoader(ClassLoader aClassLoader){
- fClassLoader = aClassLoader;
-}
-public String toString(){
- StringBuffer writer = new StringBuffer();
- writer.append("Parser. token=\""); //$NON-NLS-1$
- if ( fCurrentToken != null ) {
- writer.append(fCurrentToken);
- }
- writer.append("\", delim=\""); //$NON-NLS-1$
- writer.append(fCurrentTokenDelimiter);
- writer.append("\", initString=\""); //$NON-NLS-1$
- writer.append(fInitString);
- return writer.toString();
-}
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Message.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Message.java
deleted file mode 100644
index be1e0724c..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Message.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: Message.java,v $
- * $Revision: 1.4 $ $Date: 2005/08/24 20:39:07 $
- */
-
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.jem.internal.proxy.common.AmbiguousMethodException;
-import org.eclipse.jem.internal.proxy.common.MethodHelper;
-
-public class Message extends Expression {
- protected boolean trailingPeriod = false;
- protected Method fMethod;
- public Expression receiver;
- public String message;
- public boolean argsClosed = false;
- public boolean insideArgsOpenedParen = false;
- public boolean insideArgsClosedParen = false;
- protected boolean isComplete = false;
- public ArrayList arguments = new ArrayList(2);
-
-public Message(Expression aReceiver , char[] token , ClassLoader aClassLoader){
- receiver = aReceiver;
- message = new String(token);
- fClassLoader = aClassLoader;
-}
-public boolean isComplete(){
- return isComplete;
-}
-
-/**
- * Send the message to the receiver
- */
-public Object evaluate() throws Exception {
- cacheMethod();
-
- // Get the array of arguments
- Object[] args = new Object[arguments.size()];
- Iterator itr = arguments.iterator();
- for (int i = 0; i < arguments.size() ; i++){
- Expression anExpression = (Expression)itr.next();
- args[i] = anExpression.evaluate();
- }
-
- Object receiverValue = receiver.evaluate(); // So if evaluation exception thrown, we don't wrapper again.
-
- try {
- return fMethod.invoke(receiverValue, args);
- } catch (Exception e) {
- throw new EvaluationException(e);
- }
-}
-
-/**
- * Cache the message
- */
-protected void cacheMethod() throws Exception {
- if (fMethod == null) {
- Class[] argTypes = new Class[arguments.size()];
- Iterator itr = arguments.iterator();
- for (int i=0; i<argTypes.length; i++)
- argTypes[i] = getEvaluationTypeClass((Expression) itr.next());
-
- try {
- fMethod = MethodHelper.findCompatibleMethod(getEvaluationTypeClass(receiver), message, argTypes);
- } catch (NoSuchMethodException e) {
- throw new EvaluationException(e);
- } catch (AmbiguousMethodException e) {
- throw new EvaluationException(e);
- }
- }
-}
-
-
-/**
- * getTypeClass method comment.
- */
-public Class getTypeClass() throws Exception {
- cacheMethod();
- return fMethod.getReturnType();
-}
-
-protected String getTypeClassName() {
- return ""; // If we got this far, we don't know what it is. //$NON-NLS-1$
-}
-/**
- * push method comment.
- */
-public Expression push(char[] token, char tokenDelimiter) {
-
- // If we are closed and we receive a . with no token then remember this
- if ( argsClosed && !trailingPeriod && tokenDelimiter == DelimiterPeriod && token.length == 0 ) {
- trailingPeriod = true;
- return this;
- }
- // If we have been closed with a . and we receive a . then we are a field
- if ( trailingPeriod && tokenDelimiter == DelimiterPeriod ) {
- return new Field(this,token,fClassLoader);
- }
- // If we have been closed with a . and we receive a ( we are a message
- if ( trailingPeriod && tokenDelimiter == DelimiterOpenParen ) {
- return new Message(this,token,fClassLoader);
- }
-
- // If we have been closed and we receive a , or a ) we are complete - this is a structural token intended for someone else,
- // probably a message argument lower down the stack
- if (argsClosed && (tokenDelimiter == DelimiterComma || tokenDelimiter == DelimiterCloseParen)){
- isComplete = true;
- return this;
- }
-
-
- // If the args are opened and a token was supplied then it must be an argument
- //if ( argsOpened && ( tokenDelimiter == DelimiterCloseParen || tokenDelimiter == DelimiterComma ||
- //tokenDelimiter == DelimiterSpace || tokenDelimiter == DelimiterQuote || tokenDelimiter == DelimiterPeriod)) {
- if (!argsClosed){
- if ( arguments.size() > 0 ){
- Expression openArgument = (Expression)arguments.get(arguments.size()-1);
- if ( !openArgument.isComplete() ) {
- openArgument.push(token,tokenDelimiter);
- // If the argument is complete and we received a ) then the message is complete
- if ( openArgument.isComplete() && tokenDelimiter == DelimiterCloseParen){
- argsClosed = true;
- }
- return this;
- }
- }
-
- // We must have a new argument - process accordingly
- Expression newArgument = null;
- if (!insideArgsOpenedParen && tokenDelimiter == DelimiterOpenParen){
- insideArgsOpenedParen = true;
- newArgument = new Statement(fClassLoader).push(token,tokenDelimiter);
- newArgument = new MessageArgument(newArgument);
- arguments.add(newArgument);
-
- }
- if ( newArgument == null && (token.length > 0 || tokenDelimiter == DelimiterQuote || tokenDelimiter == DelimiterSingleQuote || tokenDelimiter == DelimiterOpenParen )) {
- newArgument = new Statement(fClassLoader).push(token,tokenDelimiter);
- newArgument = new MessageArgument(newArgument);
- arguments.add(newArgument);
- }
- // If the token after the argument is a ) then the message is being closed
- if ( !insideArgsOpenedParen && tokenDelimiter == DelimiterCloseParen ) {
- argsClosed = true;
- return this;
- }
- if ( insideArgsOpenedParen && tokenDelimiter == DelimiterCloseParen ) {
- insideArgsClosedParen = true;
- return this;
- }
-
- // If the token after the argument is a , or a ' ' then the argument is being closed
- if ( tokenDelimiter == DelimiterComma || tokenDelimiter == DelimiterSpace ) {
- return this;
- }
-
- // Otherwise the new argument is stil processing. Return it
-// return newArgument;
- }
-
- // If we don't have a message yet, then consume this one
- if ( message.length() == 0 ) {
- message = new String(token);
- return this;
- }
-
- return this;
-}
-public String toString(){
-
- java.io.StringWriter writer = new java.io.StringWriter();
- writer.write("Msg Name=\""); //$NON-NLS-1$
- if ( message != null ) {
- writer.write(message);
- } else {
- writer.write("UNNAMED"); //$NON-NLS-1$
- }
- writer.write("\" Rcv=("); //$NON-NLS-1$
- if ( receiver != null ){
- writer.write(receiver.toString());
- } else {
- writer.write("NONE"); //$NON-NLS-1$
- }
- writer.write(')');
- if ( arguments != null ) {
- writer.write("Args("); //$NON-NLS-1$
- Iterator iter = arguments.iterator();
- int i=1;
- while(iter.hasNext()){
- writer.write(new Integer(i).toString());
- writer.write('(');
- writer.write(iter.next().toString());
- writer.write("),"); //$NON-NLS-1$
- }
- writer.write(')');
- }
-
- return writer.toString();
-
-}
-
-/**
- * Is the message result a primitive.
- */
-public boolean isPrimitive() throws Exception {
- cacheMethod();
- return fMethod.getReturnType().isPrimitive();
-}
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/MessageArgument.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/MessageArgument.java
deleted file mode 100644
index 89f858404..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/MessageArgument.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: MessageArgument.java,v $
- * $Revision: 1.3 $ $Date: 2005/08/24 20:39:07 $
- */
-
-
-import java.io.StringWriter;
-import java.util.*;
-
-public class MessageArgument extends Expression {
-
- protected boolean isComplete = false;
- Expression fExpression;
- ArrayList fExpressionStack = new ArrayList();
-
-public MessageArgument(Expression anExpression){
- fExpression = anExpression;
-}
-
-public Object evaluate() throws Exception {
-
- return fExpression.evaluate();
-
-}
-
-public Class getTypeClass() throws Exception {
-
- return fExpression.getTypeClass();
-
-}
-
-protected String getTypeClassName() {
- return fExpression.getTypeClassName();
-}
-public boolean isComplete(){
- return isComplete || fExpression.isComplete();
-}
-
-public Expression push(char[] token , char delimiter){
-
- // Even if our expression is complete and we receive anything other than a , then the expression must process it as this may be a field or message
- // that is being sent to the expression to make up a complex argument
- Expression result = fExpression.push(token,delimiter);
- // If the result if a push then push the stack
- if ( result != fExpression ) {
- pushExpressionStack(result);
- } else if (result.isComplete()){
- // If our expression is complete, we are completed with a ) pop the stack so the previous expression can process us
- if (delimiter == DelimiterCloseParen ) {
- isComplete = true;
- popExpressionStack();
- } else if (delimiter == DelimiterComma || delimiter == DelimiterQuote ) {
- // If we receive a comma we pop the stack so the previous expression can process us but we don't flag us as complete
- popExpressionStack();
- // unless our expression is some array argument AND it is complete AND we have a close elipse }
- } else if ( delimiter == DelimiterCloseElipse ) {
- popExpressionStack();
- if ( fExpression instanceof ArrayArguments ) {
- isComplete = true;
- }
- }
- }
- return this;
-}
-
-/* Pop the top expression off the stack
- */
-protected void popExpressionStack(){
-
- if ( fExpressionStack.size() > 0 ) {
- Expression lastExpression = (Expression)fExpressionStack.get(fExpressionStack.size() - 1);
- if ( !lastExpression.isComplete() ) {
- fExpression = (Expression) fExpressionStack.remove(fExpressionStack.size() - 1);
- } else {
- isComplete = true;
- }
- } else {
- isComplete = true;
- }
-}
-
-/* Push the expression onto the stack
- */
-protected void pushExpressionStack(Expression anExpression){
-
- // The current expression should go onto the stack
- fExpressionStack.add(fExpression);
- // The current expression is replaced with the argument
- fExpression = anExpression;
-
-}
-
-public boolean isPrimitive(){
- return false;
-}
-public String toString(){
- StringWriter writer = new StringWriter();
- writer.write("Arg("); //$NON-NLS-1$
- if ( fExpression != null ) {
- writer.write(fExpression.toString());
- }
- writer.write(")"); //$NON-NLS-1$
- return writer.toString();
-}
-public void contributeArgumentNumber(List argumentNumberList){
-
- if ( fExpression instanceof ArrayArguments ) {
- ((ArrayArguments)fExpression).contributeArgumentNumber(argumentNumberList);
- }
-
-}
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/NullLiteral.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/NullLiteral.java
deleted file mode 100644
index e12017952..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/NullLiteral.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-
-import org.eclipse.jem.internal.proxy.common.MethodHelper;
-
-/*
- * $RCSfile: NullLiteral.java,v $
- * $Revision: 1.6 $ $Date: 2005/08/24 20:39:07 $
- */
-
-
-public class NullLiteral extends Expression {
-public NullLiteral(){
-}
-/**
- * evaluate method comment.
- */
-public Object evaluate() {
- return null;
-}
-/**
- * evaluate method comment.
- */
-public Class getTypeClass(){
- return MethodHelper.NULL_TYPE;
-}
-
-protected String getTypeClassName() {
- return MethodHelper.NULL_TYPE.getName();
-}
-/**
- * true or false cannot consume any kind of expression so we must return null
- */
-public Expression push(char[] token , char delimiter){
- return null;
-}
-
-public boolean isComplete(){
- return true;
-}
-
-/**
- * Null is not primitive
- */
-public boolean isPrimitive() {
- return false;
-}
-}
-
-
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/NumberLiteral.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/NumberLiteral.java
deleted file mode 100644
index 59e0e8198..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/NumberLiteral.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: NumberLiteral.java,v $
- * $Revision: 1.3 $ $Date: 2005/08/24 20:39:07 $
- */
-
-
-public class NumberLiteral extends Expression {
- protected String numberString = ""; //$NON-NLS-1$
- protected boolean isComplete = false;
- protected Class numberClass = Integer.TYPE;
- protected int exponentFlag = NO_EXPONENT;
-
- protected static final int
- NO_EXPONENT = 0,
- HAS_EXPONENT = 1,
- HAS_EXPONENT_MINUS = 2;
-/**
- * evaluate method comment.
- */
-public NumberLiteral(){
-}
-/**
- * evaluate method comment.
- */
-public Object evaluate() throws Exception {
- try {
- // Return a number of the correct instance
- if (numberClass == Float.TYPE){
- return new Float(Float.parseFloat(numberString));
- } else if (numberClass == Long.TYPE ) {
- return Long.decode(numberString);
- } else if (numberClass == Double.TYPE ){
- return new Double(Double.parseDouble(numberString));
- } else
- return Integer.decode(numberString);
- } catch (Exception e) {
- throw new EvaluationException(e);
- }
-
-}
-public boolean isComplete(){
- return isComplete;
-}
-
-/**
- * Return the type of number that we are.
- */
-public Class getTypeClass(){
- return numberClass;
-}
-
-protected String getTypeClassName() {
- return numberClass != null ? numberClass.getName() : ""; //$NON-NLS-1$
-}
-/**
- * If the delimiter is an operation such as a +,-,/,* then we can consume it
- * If the delimiter is period and we don't already have one then it is the decimal portion of us
- */
-public Expression push(char[] token , char delimiter){
-
- // Close brackets complete use
- if(delimiter == DelimiterCloseParen || delimiter == DelimiterComma || delimiter == DelimiterCloseElipse){
- isComplete = true;
- }
-
- if (delimiter == OperMinus && numberString.length() == 0)
- numberString+=OperMinus; // No digits yet, but we have a minus sign, so add to accumulating number.
-
- numberString += processNumberToken(token);
-
- // If we have part of a number and are asked to do some arithmetic throw an
- // error that this has not been coded yet, except minus could be part of an exponent.
- if(numberString.length() > 0 && token.length > 1) {
- switch(delimiter){
- case OperMinus:
- if (exponentFlag == HAS_EXPONENT) {
- exponentFlag = HAS_EXPONENT_MINUS;
- numberString += OperMinus;
- break;
- }
- case OperPlus:
- case OperMultiply:
- case OperDivide:
- {
- throw new RuntimeException("Can't do arithmetic yet"); //$NON-NLS-1$
- }
- }
- }
-
- if (delimiter == DelimiterPeriod){
- numberClass = Double.TYPE; // A decimal makes it double.
- numberString += DelimiterPeriod;
- }
-
- if(delimiter == BitOR || delimiter == BitAND){
- Expression result = new PrimitiveOperation(this,delimiter);
- isComplete = true;
- return result;
- }
-
- return this;
-
-}
-protected String processNumberToken(char[] token){
-
- for (int i=0; i<token.length; i++)
- if (token[i] == 'E' || token[i] == 'e') {
- numberClass = Double.TYPE; // Definitely a floating because of this.
- exponentFlag = HAS_EXPONENT;
- break;
- }
-
- // The token could be a number, e.g. 10 or 5 or could be qualified with a primitive
- // suffix, e.g. 10l or 5f
- char[] numberToken = token;
- if ( token.length > 0 ) {
- switch(token[token.length - 1]){
- case 'F':
- case 'f':
- numberClass = Float.TYPE;
- numberToken = new char[token.length - 1];
- System.arraycopy(token,0,numberToken,0,numberToken.length);
- isComplete = true;
- break;
- case 'L':
- case 'l':
- numberClass = Long.TYPE;
- numberToken = new char[token.length - 1];
- System.arraycopy(token,0,numberToken,0,numberToken.length);
- isComplete = true;
- break;
- case 'D':
- case 'd':
- numberClass = Double.TYPE;
- numberToken = new char[token.length - 1];
- System.arraycopy(token,0,numberToken,0,numberToken.length);
- isComplete = true;
- break;
- }
- }
-
- return new String(numberToken);
-}
-public String toString(){
-
- java.io.StringWriter writer = new java.io.StringWriter();
- writer.write("Number \""); //$NON-NLS-1$
- writer.write(numberString);
- writer.write("\""); //$NON-NLS-1$
- return writer.toString();
-
-}
-
-/**
- * Number literals are primitive
- */
-public boolean isPrimitive() {
- return true;
-}
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/PrimitiveOperation.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/PrimitiveOperation.java
deleted file mode 100644
index 3ce254e2c..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/PrimitiveOperation.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * This is for primitive expressions that are optimized out the compiler such as bit or, bit and, etc..
- */
-package org.eclipse.jem.internal.proxy.initParser;
-
-import java.text.MessageFormat;
-
-/*
- * $RCSfile: PrimitiveOperation.java,v $
- * $Revision: 1.6 $ $Date: 2005/08/24 20:39:07 $
- */
-
-public class PrimitiveOperation extends Expression {
-
- protected int operation; // This can be BitOR or BitAND
- protected Expression receiver; // The left hand side of the expression
- protected boolean isComplete = false;
-
- public PrimitiveOperation(Expression aReceiver, int anOperation){
- receiver = aReceiver;
- operation = anOperation;
- }
-
- public Object evaluate() throws Exception {
- Object leftHandSide = receiver.evaluate();
- Object rightHandSide = currentExpression.evaluate();
- if (leftHandSide instanceof Integer && rightHandSide instanceof Integer) {
- if(operation == BitOR) {
- return new Integer(((Integer)leftHandSide).intValue() | ((Integer)rightHandSide).intValue());
- } else if(operation == BitAND) {
- return new Integer(((Integer)leftHandSide).intValue() & ((Integer)rightHandSide).intValue());
- }
- }
- throw new RuntimeException(MessageFormat.format(ProxyInitParserMessages.getString("PrimitiveOperation.Evaluate.InvalidOperator_EXC_"), new Object[]{getOperDescription(), leftHandSide, rightHandSide})); //$NON-NLS-1$
- }
- protected String getOperDescription(){
- if(operation == BitOR) return "|"; //$NON-NLS-1$
- if (operation == BitAND) return "&"; //$NON-NLS-1$
- return "???"; //$NON-NLS-1$
- }
-
- public boolean isComplete() {
- return isComplete;
- }
-
- public Class getTypeClass() throws Exception {
- return Integer.TYPE;
- }
-
- protected String getTypeClassName() {
- return Integer.TYPE.getName();
- }
-
- public Expression push(char[] token, char tokenDelimiter) {
-
- // Create a new statement if the argument is null ( we are always created with a receiver )
- if(currentExpression == null && token.length > 0){
- currentExpression = new Statement(fClassLoader).push(token,tokenDelimiter);
- pushExpressionStack(currentExpression);
- return this;
- }
-
- // Ignore whitespace
- if(token.length == 0 && tokenDelimiter == ' ') return this;
-
- // If we have an argument we just keep pushing the expression onto this
- if(currentExpression != null){
- Expression result = currentExpression.push(token,tokenDelimiter);
- if(result != currentExpression){
- pushExpressionStack(result);
- }
- }
-
- if(currentExpression != null && currentExpression.isComplete()){
- if(tokenDelimiter == DelimiterComma){
- isComplete = true;
- return this;
- } else if (tokenDelimiter == DelimiterCloseParen){
- if(receiver.parenthesisLevel > 0){
- receiver.parenthesisLevel--;
- } else {
- isComplete = true;
- return this;
- }
- }
- }
-
- return this;
- }
-
- public boolean isPrimitive() throws Exception {
- return true;
- }
-
- public String toString(){
- StringBuffer buffer = new StringBuffer();
- if (receiver != null) buffer.append(receiver.toString());
- buffer.append(getOperDescription());
- if (currentExpression != null) buffer.append(currentExpression.toString());
- return buffer.toString();
- }
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/ProxyInitParserMessages.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/ProxyInitParserMessages.java
deleted file mode 100644
index bd6df5ab7..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/ProxyInitParserMessages.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: ProxyInitParserMessages.java,v $
- * $Revision: 1.5 $ $Date: 2005/08/24 20:39:07 $
- */
-
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-/**
- * General Proxy NLS Constants
- * Creation date: (4/13/00 10:46:58 AM)
- * @author: Administrator
- */
-public class ProxyInitParserMessages {
- // Resource Bundle to use for basic Proxy NLS resources.
- static private final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle("org.eclipse.jem.internal.proxy.initParser.messages"); //$NON-NLS-1$
-
- // Keys for messages/strings within the resource bundle.
- static public final String
- UNEXPECTED_TOKEN = "UnexpectedToken_EXC_", //$NON-NLS-1$
- STATEMENT_UNEXPECTED_EXECUTION = "Statement.UnexpectedExecution_EXC_", //$NON-NLS-1$
- STATEMENT_UNEXPECTED_EVALUATION = "Statement.UnexpectedEvaluation_EXC_" ; //$NON-NLS-1$
-
- private ProxyInitParserMessages() {
- }
-
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Statement.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Statement.java
deleted file mode 100644
index 0c24a67f6..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Statement.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: Statement.java,v $
- * $Revision: 1.5 $ $Date: 2005/08/24 20:39:07 $
- */
-
-
-
-public class Statement extends Expression {
- public boolean isStringObject = false;
- public boolean isCast = false;
- protected boolean messageOrFieldStarted;
-
-/**
- * Statement constructor comment.
- */
-public Statement(ClassLoader aClassLoader) {
- super();
- fClassLoader = aClassLoader;
-}
-
-public boolean isComplete(){
- return currentExpression != null && currentExpression.isComplete();
-}
-
-/** Defer this to the expression
- */
-public Object evaluate() throws Exception {
- if ( currentExpression != null ) {
- return currentExpression.evaluate();
- } else {
- throw new RuntimeException(ProxyInitParserMessages.getString(ProxyInitParserMessages.STATEMENT_UNEXPECTED_EXECUTION)); // This is not an evaluation error, it shouldn't of occured, so it is a parser error.
- }
-}
-/**
- */
-public Class getTypeClass() throws Exception {
- return currentExpression.getTypeClass();
- //throw new RuntimeException(ProxyBaseVMNLS.RESBUNDLE.getString(ProxyBaseVMNLS.STATEMENT_UNEXPECTED_EVALUATION));
-}
-
-protected String getTypeClassName() {
- return currentExpression.getTypeClassName();
-}
-/** There are several types of token that can begin a statement.
- * new , ' ' - Create a constructor
- * 1-10, true, false, etc... - Create a literal
- * Foo, '.' - Create a Type
- */
-public Expression push(char[] token , char delimiter){
-
- // If messageOrFieldStart is true then our expression is complete and either a message or field is being created
- // See which it is and create the correct expression
- if (messageOrFieldStarted){
- messageOrFieldStarted = false;
- if ( delimiter == DelimiterOpenParen){
- Message message = new Message(currentExpression,token,fClassLoader);
- currentExpression = message;
- return message;
- } else {
- Field field = new Field(currentExpression,token,fClassLoader);
- currentExpression = field;
- return field;
- }
- }
-
- // Look for "new " for a constructor"
- if ( delimiter == DelimiterSpace && compare( token , ConstantNew ) ) {
- // If we thought we were a possible cast and we now aren't then we must be a block expression
- if ( isCast ) {
- currentExpression = new Block(new Constructor(fClassLoader));
- } else {
- currentExpression = new Constructor(fClassLoader);
- }
- isCast = false; // Can't be a cast now
- return currentExpression;
- }
-
- // Look for "null"
- if ( compare( token , ConstantNull ) ) {
- currentExpression = new NullLiteral();
- isCast = false; // Can't be a cast now
- // Null cannot process anything so we return the statement
- return this;
- }
-
- // Look for a number
- if ( isNumber( token ) || delimiter == OperMinus ) {
- currentExpression = new NumberLiteral();
- currentExpression = currentExpression.push(token,delimiter);
- isCast = false; // Can't be a cast now
- return currentExpression;
- }
-
- if ( compare( token , ConstantTrue ) ) {
- currentExpression = new BooleanLiteral(true);
- // true cannot process anything so we return the statement
- isCast = false; // Can't be a cast now
- return currentExpression;
-// return this;
- }
-
- if ( compare( token , ConstantFalse ) ) {
- // false cannot process anything so we return the statement
- currentExpression = new BooleanLiteral(false);
- isCast = false; // Can't be a cast now
- return this;
- }
-
- if ( delimiter == DelimiterQuote ) {
- currentExpression = new StringLiteral();
- isCast = false; // Can't be a cast now
- return currentExpression;
- }
-
- if ( delimiter == DelimiterSingleQuote ) {
- currentExpression = new CharLiteral();
- isCast = false; // Can't be a cast now
- return currentExpression;
- }
-
- if (delimiter == DelimiterPeriod && token.length == 0 && currentExpression != null){
- if (currentExpression instanceof StringLiteral){
- //String s = "\"" + (String)(currentExpression.evaluate()) + "\"" ;
- //return new Constructor(s);
- isStringObject = true;
- return this;
- }
- }
-
- if (isStringObject && (token.length > 0) && (delimiter == DelimiterOpenParen)){
- return new Message(currentExpression, token,fClassLoader);
- }
-
- //handle type casting
- if ((token.length == 0) && (delimiter == DelimiterOpenParen)){
- // If we are a already a cast then we must be a block.
- if ( isCast ) {
- currentExpression = new Block(fClassLoader);
- } else {
- isCast = true; // Possibly a cast
- }
- return this;
- }
- if (isCast && (delimiter == DelimiterCloseParen || token.length != 0)){
- Static aStatic = new Static(fClassLoader);
- Cast aCast = new Cast(aStatic,fClassLoader);
- currentExpression = aCast.push(token,delimiter);
- return currentExpression;
- }
-
- if ( token.length != 0 ) {
- currentExpression = new Static(fClassLoader).push(token,delimiter);
- return currentExpression;
- }
-
- // If we get a { then we are part of an array argument
- if (delimiter == DelimiterOpenElipse){
- currentExpression = new ArrayArguments();
- return currentExpression;
- }
-
- // If our expression is closed and we receive a . we are either a message or a field. We won't know this until
- // the next token we receive, which will be either be delimited by a ( in which case it is a message, else it is a field
- if (currentExpression != null && currentExpression.isComplete() && delimiter == DelimiterPeriod){
- messageOrFieldStarted = true;
- }
-
- return this;
-}
-
-public String toString(){
- StringBuffer buffer = new StringBuffer();
- buffer.append("Statement{"); //$NON-NLS-1$
- if ( currentExpression != null ) {
- buffer.append(currentExpression.toString());
- }
- buffer.append('}');
- return buffer.toString();
-}
-/**
- * Is this statement a primitive.
- */
-public boolean isPrimitive() throws Exception {
- if ( currentExpression != null ) {
- return currentExpression.isPrimitive();
- } else {
- throw new RuntimeException(ProxyInitParserMessages.getString(ProxyInitParserMessages.STATEMENT_UNEXPECTED_EXECUTION));
- }
-}
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Static.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Static.java
deleted file mode 100644
index 90e45a34c..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/Static.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: Static.java,v $
- * $Revision: 1.4 $ $Date: 2005/08/24 20:39:07 $
- */
-
-
-import java.io.*;
-import java.lang.reflect.Array;
-import java.util.*;
-
-public class Static extends Expression {
- protected static final HashMap sPrimitiveTypes;
-
- static {
- sPrimitiveTypes = new HashMap(10);
- sPrimitiveTypes.put("byte", Byte.TYPE); //$NON-NLS-1$
- sPrimitiveTypes.put("char", Character.TYPE); //$NON-NLS-1$
- sPrimitiveTypes.put("short", Short.TYPE); //$NON-NLS-1$
- sPrimitiveTypes.put("int", Integer.TYPE); //$NON-NLS-1$
- sPrimitiveTypes.put("long", Long.TYPE); //$NON-NLS-1$
- sPrimitiveTypes.put("float", Float.TYPE); //$NON-NLS-1$
- sPrimitiveTypes.put("double", Double.TYPE); //$NON-NLS-1$
- }
-
- protected ArrayList arrayDimensions;
- protected List fArrayArguments;
- protected StringWriter typeWriter = new StringWriter();
- protected boolean completedWithPeriod = false;
- protected char[] completionToken;
- public Class type;
- protected boolean isComplete;
-
- public boolean isProcessingArrayDimension;
-/**
- * Create an unknown expression
- */
-public Static(ClassLoader aClassLoader){
- fClassLoader = aClassLoader;
-}
-public Static(char[] aToken,char delimiter,ClassLoader aClassLoader){
-
- fClassLoader = aClassLoader;
- try {
- typeWriter.write(aToken);
- } catch ( IOException exc ) {};
- checkForValidType();
- if ( type == null && delimiter == DelimiterPeriod ){
- typeWriter.write(DelimiterPeriod);
- }
-
-}
-public Static(char[] aToken,char delimiter,ClassLoader aClassLoader,boolean isArray){
- this(aToken,delimiter,aClassLoader);
- isProcessingArrayDimension = true;
- arrayDimensions = new ArrayList(1);
- arrayDimensions.add(new Statement(aClassLoader));
-}
-
-public boolean isComplete(){
- return isComplete;
-}
-public boolean isArray(){
- return arrayDimensions != null;
-}
-/**
- * See whether or not we have a valid type
- * This uses the class loader given to us if one specified. The reason for this
- * is that Eclipse uses a special plugin class loader and when we are running
- * in a VM inside eclipse ( e.g. for IDEVM proxy stuff ) we must have
- * reference to the plugin that is using us otherwise we can't load its classes
- */
-protected void checkForValidType(){
-
- type = (Class) sPrimitiveTypes.get(typeWriter.toString());
- if (type == null)
- try {
- if ( fClassLoader == null ) {
- type = Class.forName(typeWriter.toString());
- } else {
- type = fClassLoader.loadClass(typeWriter.toString());
- }
- } catch ( ClassNotFoundException exc ) {
- try {
- type = Class.forName("java.lang." + typeWriter.toString()); //$NON-NLS-1$
- StringWriter writer = new StringWriter();
- writer.write(type.getName());
- typeWriter = writer;
- } catch ( ClassNotFoundException exc1 ) {}
- } catch ( NoClassDefFoundError exc ) {
- // A mismatch in some way. Found a class, probably different case. One possibility
- // is found a class, but this was really a package. So class and package with same name
- // but different case caused this to occur. [46376].
- }
-
-}
-/**
- * If we have any static methods return the result of evaluating them against the type
- */
-public Object evaluate() {
-
- // If we are an array but haven't created it do so
- if ( isArray() ) {
- if ( array == null ) {
- evaluateArray();
- }
- return array;
- } else {
- if ( type != null ) {
- return type;
- } else {
- // If we have no type then we are some kind incomplete expression that cannot be evaluted
- throw new RuntimeException();
- }
- }
-}
-/**
- * The type of us is either simply the class, or if we are an array then we must create the java.lang.reflect.Array
- * using the reflective APIs
- */
-protected Object array;
-public Class getTypeClass() {
-
- if ( isArray() ) {
- if ( array == null ) {
- // Do not evaluate the array and return its class. Instead just work out the class by our type
- // and number of dimensions
- Object result = Array.newInstance(type,getNumberOfDimensions());
- return result.getClass();
- } else {
- return array.getClass();
- }
- } else {
- return type;
- }
-}
-
-protected String getTypeClassName() {
- return typeWriter.toString();
-}
-public Class getPrimitiveTypeClass(){
- return type;
-}
-protected int[] getNumberOfDimensions(){
- List dimensions = new ArrayList(1);
- dimensions.add(new Integer(fArrayArguments.size()));
- ((MessageArgument)fArrayArguments.get(0)).contributeArgumentNumber(dimensions);
- // The total number of arguments is a set of Integer objects in the dimensions list
- // convert this to an int[]
- int[] intDimensions = new int[dimensions.size()];
- for (int i = 0; i < dimensions.size(); i++) {
- intDimensions[i] = ((Integer)dimensions.get(i)).intValue();
- }
- return intDimensions;
-}
-/**
- * Evaluate the array
- */
-protected void evaluateArray(){
- if ( fArrayArguments != null ) {
- // If the array isn't declared with a size but this is supplied with argument these will be in the fArrayArguments
- // new int[] { 2 ,3 } will have the constructor arguments supplied as two message arguments with
- if ( array == null ) {
- // The size of the array arguments is our array size, however for a multi arg array we need
- // to find the size of any nested arrays within arguments themselves, e.g.
- // new int[][] { {2,3} , {3,4} } then we have two array arguments, each of which is a MessageArgument
- // whose statement is an ArrayArguments that has two arguments, etc...
- // To find the number of arguments we create a list that we add our number of arguments to, and then
- // pass this all the way up the arguments chain using contributeArgumentNumber(List) so that each element
- // can add to the list the number of arguments ( if any ) that they have.
- array = Array.newInstance(type,getNumberOfDimensions());
- // Set the elements in the array to be the result of evaluating the constructor arguments
- for (int i = 0; i < fArrayArguments.size(); i++) {
- Expression expression = (Expression)fArrayArguments.get(i);
- try {
- Object element = expression.evaluate();
- Array.set(array,i,element);
- } catch ( Exception exc ) {
- // Any evaluation exceptions should be thrown back
- throw new RuntimeException();
- }
- }
- }
- } else if ( arrayDimensions != null ) {
- // To get the class of a reflective array we must actually first create it and then ask it for its class
- // The array Dimensions are present if the array was explicitly declared with a size, e.g. new int[2][3]
- // will have to arrayDimensions that represent the expressions 2 and 3 ( as NumberLiteral instances )
- if ( array == null ) {
- // Evaluate all of the arrayDimensions. These should be integers
- int[] dimensionSizes = new int[arrayDimensions.size()];
- for (int i = 0; i < dimensionSizes.length; i++) {
- try {
- Integer dimensionSize = (Integer) ((Expression)arrayDimensions.get(i)).evaluate();
- dimensionSizes[i] = dimensionSize.intValue();
- } catch ( Exception exc ) {
- throw new RuntimeException();
- }
- }
- // For a multi arg array we need to create using the static method on array that takes an int[] that represents
- // the number of dimensions, e.g. for new String[2][3] we do Array.newInstance(String.class,new int[] { 2 , 3 };
- array = Array.newInstance(type,dimensionSizes);
- }
- }
-}
-/**
- * If the token is a period then it could either be part of the type or else a static method call
- */
-public Expression push(char[] token , char delimiter ) {
-
- // If we don't yet have a valid type then see if we now do
- if (type == null){
- try {
- typeWriter.write(token);
- } catch ( IOException exc ) {};
- checkForValidType();
- // If we got a valid type and a period then remember it
- if ( delimiter == DelimiterPeriod ) {
- if (type != null) {
- completedWithPeriod = true;
- return this;
- }
- }
- }
-
- if ( arrayDimensions != null && isProcessingArrayDimension ) {
- Expression lastArrayDimension = (Expression)arrayDimensions.get(arrayDimensions.size()-1);
- lastArrayDimension.push(token,delimiter);
- if ( delimiter == DelimiterCloseSquareBrace && isProcessingArrayDimension ) {
- isProcessingArrayDimension = false;
- }
- return this;
- }
-
- if ( delimiter == DelimiterOpenSquareBrace && !isProcessingArrayDimension ) {
- if ( arrayDimensions == null ) arrayDimensions = new ArrayList(1);
- Statement statement = new Statement(fClassLoader);
- arrayDimensions.add(statement);
- isProcessingArrayDimension = true;
- return this;
- }
-
- // If we have a type and the delimiter is a ( then it must be a message beginning
- if ( type != null ) {
- if (delimiter == DelimiterOpenParen) {
- isComplete = true;
- return new Message( this , token , fClassLoader );
- } else if (completedWithPeriod){
- isComplete = true;
- Field field = new Field(this,token,fClassLoader);
- // If our token is a ), ' ' or , then the field is completed,
- // otherwise leave it open so it will process the remaining tokens
-// if (delimiter == DelimiterCloseParen || delimiter == DelimiterSpace || delimiter == DelimiterComma) {
- if (delimiter == DelimiterCloseParen || delimiter == DelimiterComma) {
- field.isComplete = true;
- }
- return field;
- }
- }
-
- // We are still looking for a type so append a .
- if ( type == null ) {
- typeWriter.write('.');
- }
- return this;
-}
-public String toString(){
-
- StringWriter writer = new StringWriter();
- writer.write("Static "); //$NON-NLS-1$
- if ( type == null ) {
- writer.write("(Incomplete) {"); //$NON-NLS-1$
- } else {
- writer.write("(Complete) {"); //$NON-NLS-1$
- }
- writer.write(typeWriter.toString());
- writer.write("}"); //$NON-NLS-1$
- if ( arrayDimensions != null ) {
- writer.write(" array dimensions="); //$NON-NLS-1$
- writer.write(new Integer(arrayDimensions.size()).toString());
- }
- if ( fArrayArguments != null ) {
- writer.write(" array dimensions="); //$NON-NLS-1$
- writer.write(new Integer(fArrayArguments.size()).toString());
- }
- return writer.toString();
-
-}
-
-public boolean isPrimitive() {
- return getTypeClass().isPrimitive();
-}
-public void setArrayArguments(List arguments) {
- fArrayArguments = arguments;
-}
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/StringLiteral.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/StringLiteral.java
deleted file mode 100644
index 0555a8446..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/StringLiteral.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser;
-/*
- * $RCSfile: StringLiteral.java,v $
- * $Revision: 1.4 $ $Date: 2005/08/24 20:39:07 $
- */
-
-
-
-public class StringLiteral extends Expression {
- protected boolean isComplete;
- public String value;
- public StringBuffer valueBuffer = new StringBuffer();
- protected boolean isEscaped = false;
-
-/**
- * constructor
- */
-public StringLiteral(){
-}
-
-/**
- * evaluate method comment.
- */
-public Object evaluate() {
- return valueBuffer.toString();
-}
-
-public boolean isComplete(){
- return isComplete;
-}
-/**
- * We must evaluate ourself and return the type of the result
- */
-
-public Class getTypeClass() {
- return String.class;
-}
-
-protected String getTypeClassName() {
- return String.class.getName();
-}
-
-/**
- *This string might be broken into a few tokens
- *so we need a StringBuffer.
- *
- */
-public Expression push(char[] token , char delimiter){
- int appendTokenStart = 0;
- int appendTokenLength = token.length;
- if (isEscaped) {
- isEscaped = false;
- if (token.length != 0) {
- char c = token[0];
- switch (c) {
- case 'b':
- valueBuffer.append('\b');
- appendTokenStart = 1;
- appendTokenLength--;
- break;
- case 't':
- valueBuffer.append('\t');
- appendTokenStart = 1;
- appendTokenLength--;
- break;
- case 'n':
- valueBuffer.append('\n');
- appendTokenStart = 1;
- appendTokenLength--;
- break;
- case 'r':
- valueBuffer.append('\r');
- appendTokenStart = 1;
- appendTokenLength--;
- break;
- case 'u':
- // Unicode, next four gather for text;
- if (appendTokenLength>=5) {
- valueBuffer.append((char) Integer.parseInt(new String(token, 1, 4), 16));
- appendTokenStart=5;
- appendTokenLength-=5;
- }
- break;
- }
- // If we didn't append anything, then not a true escape, so put the escape on.
- if (appendTokenStart==0)
- valueBuffer.append(DelimiterEscape);
- } else {
- if (delimiter == DelimiterQuote || delimiter == DelimiterEscape || delimiter == DelimiterSingleQuote)
- valueBuffer.append(delimiter); // It was a true escape.
- else {
- valueBuffer.append(DelimiterEscape); // If wasn't a true escape
- valueBuffer.append(delimiter);
- }
- return this;
- }
- }
-
- if (appendTokenLength > 0)
- valueBuffer.append(token, appendTokenStart, appendTokenLength);
-
- if (delimiter == DelimiterQuote){
- isComplete =true;
- return this;
- }
-
- // If the delimiter is an escape character remember it so we can escape
- // the next token, otherwise treat it as a literal
- if (delimiter == DelimiterEscape ){
- isEscaped = true;
- } else {
- valueBuffer.append(delimiter);
- }
- return this;
-}
-
-/**
- * Strings are not primitives.
- */
-public boolean isPrimitive() {
- return false;
-}
-public String toString(){
- StringBuffer buffer = new StringBuffer();
- buffer.append("String(\""); //$NON-NLS-1$
- if ( valueBuffer != null ) {
- buffer.append(valueBuffer.toString());
- }
- buffer.append("\""); //$NON-NLS-1$
- return buffer.toString();
-}
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/messages.properties b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/messages.properties
deleted file mode 100644
index caa692355..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/messages.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-###############################################################################
-# Copyright (c) 2003, 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-#
-# $Source: /cvsroot/webtools/jeetools.move/webtools.javaee.git/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/messages.properties,v $
-# $Revision: 1.6 $ $Date: 2005/08/24 20:39:07 $
-#
-
-
-#
-# Properties for the Proxy Base VM Support
-#
-UnexpectedToken_EXC_ = IWAV0127E Unexpected Token "{0}".
-Statement.UnexpectedExecution_EXC_ = IWAV0128E Statement was executed unexpectedly.
-Statement.UnexpectedEvaluation_EXC_ = IWAV0129E Statements should not be evaluated.
-CharTooComplicated_EXC_ = IWAV0130E Input text not a char that can be evaluated. Too complicated. \"{0}"
-PrimitiveOperation.Evaluate.InvalidOperator_EXC_=Invalid operator {0} between {1} and {2}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/AbstractEnum.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/AbstractEnum.java
deleted file mode 100644
index 010b0bcc8..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/AbstractEnum.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: AbstractEnum.java,v $
- * $Revision: 1.1 $ $Date: 2005/05/11 19:01:12 $
- */
-package org.eclipse.jem.internal.proxy.initParser.tree;
-
-/**
- * Base abstract implementation of the enum.
- * @since 1.1.0
- */
-public abstract class AbstractEnum implements Enum {
-
- /**
- * The name of the enumerator.
- */
- private final String name;
-
- /**
- * The <code>int</code> value of the enumerator.
- */
- private final int value;
-
- /**
- * Creates an initialized instance.
- *
- * @param value
- * the <code>int</code> value of the enumerator.
- * @param name
- * the name of the enumerator.
- */
- protected AbstractEnum(int value, String name) {
- this.name = name;
- this.value = value;
- }
-
- /**
- * Returns the name of the enumerator.
- *
- * @return the name.
- */
- public final String getName() {
- return name;
- }
-
- /**
- * Returns the <code>int</code> value of the enumerator.
- *
- * @return the value.
- */
- public final int getValue() {
- return value;
- }
-
- /**
- * Returns the name of the enumerator.
- *
- * @return the name.
- */
- public final String toString() {
- return name;
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/Enum.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/Enum.java
deleted file mode 100644
index 7d2fb3e4d..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/Enum.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: Enum.java,v $
- * $Revision: 1.1 $ $Date: 2005/05/11 19:01:12 $
- */
-package org.eclipse.jem.internal.proxy.initParser.tree;
-
-/**
- * TypeSafe enumerations for the IExpression processing.
- *
- * @since 1.1.0
- */
-public interface Enum {
-
- /**
- * Returns the name of the enumerator.
- *
- * @return the name.
- */
- String getName();
-
- /**
- * Returns the <code>int</code> value of the enumerator.
- *
- * @return the value.
- */
- int getValue();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/ExpressionProcesser.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/ExpressionProcesser.java
deleted file mode 100644
index 4f2b5d811..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/ExpressionProcesser.java
+++ /dev/null
@@ -1,3364 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: ExpressionProcesser.java,v $
- * $Revision: 1.24 $ $Date: 2006/05/18 16:52:16 $
- */
-package org.eclipse.jem.internal.proxy.initParser.tree;
-
-import java.lang.reflect.*;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jem.internal.proxy.common.*;
-import org.eclipse.jem.internal.proxy.initParser.InitializationStringEvaluationException;
-import org.eclipse.jem.internal.proxy.initParser.InitializationStringParser;
-
-/**
- * Expression processing. This does the actual expression processing with the live objects.
- * It is meant to be subclassed only to provide additional expression types. All of the
- * current expressions cannot be overridden. This is because the stack is very sensitive to
- * call order.
- *
- * @since 1.0.0
- */
-public class ExpressionProcesser {
-
- /**
- * A variable reference for a field access.
- *
- * @since 1.1.0
- */
- protected static class FieldAccessReference extends VariableReference {
-
- private final Field field;
- private final Object receiver;
-
- /**
- * Use this to construct a FieldAccessReference. This will do checks to make sure
- * it is valid so that exceptions won't be thrown later when actually dereferenced.
- *
- * @param field
- * @param receiver
- * @return
- * @throws IllegalArgumentException
- *
- * @since 1.1.0
- */
- public static FieldAccessReference createFieldAccessReference(Field field, Object receiver) throws IllegalArgumentException {
- // If static, then receiver is ignored.
- if (!Modifier.isStatic(field.getModifiers())) {
- if (!field.getDeclaringClass().isInstance(receiver))
- throw new IllegalArgumentException(MessageFormat.format(InitparserTreeMessages.getString("ExpressionProcesser.CreateFieldAccessReference.FieldsTypesNotMatching_EXC_"), new Object[]{field.getType(), (receiver!=null ? receiver.getClass() : null)})); //$NON-NLS-1$
- }
- field.setAccessible(true); // Make it always accessible. Trust it.
- return new FieldAccessReference(field, receiver);
- }
-
- protected FieldAccessReference(Field field, Object receiver) {
- this.field = field;
- this.receiver = receiver;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.proxy.initParser.tree.ExpressionProcesser.VariableReference#dereference()
- */
- public Object dereference() {
- try {
- return field.get(receiver);
- } catch (IllegalArgumentException e) {
- // Shouldn't occur. Already tested for this.
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- // Shouldn't occur. Already tested for this.
- e.printStackTrace();
- }
- return null;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.proxy.initParser.tree.ExpressionProcesser.VariableReference#set(java.lang.Object, java.lang.Class)
- */
- public Object set(Object value, Class type) throws IllegalArgumentException, IllegalAccessException {
- field.set(receiver, value);
- return field.get(receiver); // Just in case some conversion happened. Technically it is not the value set but the retrieved when in an assignment.
- }
-
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return "FieldAccess{"+field.toString()+"} on "+(receiver != null ? receiver.toString() : "<static access>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
- /**
- * A variable reference for an Array access. It will reference only the last indexed entry of the array.
- * For example if <code>x[3][4]</code> is the access, then what will be given to this reference will be
- * the array entry at x[3][4], not the x array itself.
- *
- * @since 1.1.0
- */
- protected static class ArrayAccessReference extends VariableReference {
-
-
- private final Object array;
- private final int index;
-
- /**
- * Use this to construct an array access reference. This will do checks to make sure
- * it is valid so that exceptions won't be thrown later when actually dereferenced.
- *
- * @param array
- * @param index
- * @return
- * @throws IllegalArgumentException
- *
- * @since 1.1.0
- */
- public static ArrayAccessReference createArrayAccessReference(Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
- int len = Array.getLength(array);
- if (index < 0 || len <= index)
- throw new ArrayIndexOutOfBoundsException(MessageFormat.format(InitparserTreeMessages.getString("ExpressionProcesser.CreateArrayAccessReference.OutOfBounds_EXC_"), new Object[]{new Integer(index), new Integer(len)})); //$NON-NLS-1$
- return new ArrayAccessReference(array, index);
- }
- /**
- * Construct the reference with the array and the index of the entry being referenced.
- * @param array
- * @param index
- *
- * @since 1.1.0
- */
- protected ArrayAccessReference(Object array, int index) {
- this.array = array;
- this.index = index;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.proxy.initParser.tree.VariableReference#dereference()
- */
- public Object dereference() {
- return Array.get(array, index);
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jem.internal.proxy.initParser.tree.VariableReference#set(java.lang.Object, java.lang.Class)
- */
- public Object set(Object value, Class type) throws IllegalArgumentException {
- Array.set(array, index, value);
- return Array.get(array, index); // In case there was some conversion applied. Technically it is not the value set but the retrieved when in an assignment.
- }
-
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return "ArrayAccess["+index+"]: "+array.toString(); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * The expression result stack and the expression result type stack.
- * The type stack is used to be expected type of the corresponding
- * expression result. This is needed for converting to primitives
- * and for finding correct method call from the argument types. In
- * this case, it is not the true value, but the value expected, e.g.
- * <code>Object getObject()</code> returns something of type Object.
- * This needs to be maintained so that if it goes into another method
- * we don't accidently return a more specific method instead of the
- * one that takes Object as an argument.
- *
- * expressionStack has result of the expression.
- * expressionTypeStack has the computed type of the expression i.e.
- * the type that the expression returns, not the type of the value.
- * These can be different because the expression (e.g. method) may
- * return an Object, but the expression value will be some specific
- * subclass. So the expressionTypeStack would have a <code>java.lang.Object.class</code>
- * on it in that case.
- * Note: if the expressionStack has a <code>null</code> on it, then the type stack
- * may either have a specific type in it, or it may be <code>MethodHelper.NULL_TYPE</code>. It
- * would be this if it was explicitly pushed in and not as the
- * result of a computation. If the result of a computation, it would have the
- * true value.
- * Note: if the expressionStack has a <code>Void.type</code> on it, then that
- * means the previous expression had no result. This is an error if trying to
- * use the expression in another expression.
- *
- * @see org.eclipse.jem.internal.proxy.initParser.MethodHelper#NULL_TYPE
- */
- private List expressionStack = new ArrayList(10);
- private List expressionTypeStack = new ArrayList(10);
-
- /**
- * List of the expression proxies. The index into the list is the
- * same as the expression proxy id.
- */
- private ArrayList expressionProxies; // It is array list because we want to call ensureCapacity and that is not available on List.
-
- /**
- * An error has occurred. At this point all subcommands will simply make sure they flush the input stream
- * correctly, but they do not process it.
- *
- * @since 1.0.0
- */
- private boolean errorOccurred = false;
- private boolean novalueException = false;
-
- private Throwable exception = null; // Was there another kind of exception that was caught.
-
- /**
- * Process all other exceptions then the NoExpressionValueException. This can be called from usage code so that if there was an error
- * in setting up for a call to the processer it can be logged.
- *
- * @param e
- *
- * @since 1.0.0
- */
- public final void processException(Throwable e) {
- // Process all other exceptions.
- novalueException = false;
- while (e.getCause() != null)
- e = e.getCause();
- if (traceOn) {
- System.out.println();
- System.out.print("***** >>>\tException: "); //$NON-NLS-1$
- System.out.println(e);
- }
- throwException(e); // Treat as a throw to let try/catches expressions handle it.
- }
-
- /**
- * This is a syntax exception. This means data coming across is corrupted in
- * some way so no further processing should occur.
- * @param e
- *
- * @since 1.1.0
- */
- protected final void processSyntaxException(Throwable e) {
- errorOccurred = true;
- novalueException = false;
- exception = e;
- }
-
- /**
- * Process a NoExpressionValueException. Don't wrapper these.
- * @param e
- *
- * @since 1.1.0
- */
- protected final void processSyntaxException(NoExpressionValueException e) {
- if (traceOn) {
- // This can happen at any time, so make sure we are on a new line.
- System.out.println();
- printTrace("Expression has no value", false); //$NON-NLS-1$
- }
- try {
- errorOccurred = true;
- novalueException = true;
- exception = e;
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
- /**
- * Return whether there are any errors.
- *
- * @return <code>true</code> if no errors.
- *
- * @since 1.0.0
- */
- public boolean noErrors() {
- return !errorOccurred;
- }
-
- /**
- * Return whether the error is a NoExpressionValueException or not.
- * @return
- *
- * @since 1.1.0
- */
- public boolean isNoExpressionValue() {
- return novalueException;
- }
-
- /**
- * Return the throwable if a Throwable was caught.
- *
- * @return The throwable, or <code>null</code> if not set.
- *
- * @since 1.0.0
- */
- public Throwable getErrorThrowable() {
- return exception;
- }
-
- /**
- * Push the expression value and its expected type.
- * @param o
- * @param type
- *
- * @since 1.0.0
- */
- protected final void pushExpressionValue(Object o, Class type) {
- expressionStack.add(o);
- expressionTypeStack.add(type);
- }
-
- /**
- * Pop just the expression value. It is imperitive that the expression type
- * is popped immediately following. Separated the methods so that we
- * don't need to create an array to return two values. This will dereference
- * any variable references.
- *
- * @return The value.
- * @throws NoExpressionValueException
- *
- * @since 1.0.0
- */
- protected final Object popExpression() throws NoExpressionValueException {
- return popExpression(true);
- }
-
- /**
- * Pop just the expression value. It is imperitive that the expression type
- * is popped immediately following. Separated the methods so that we
- * don't need to create an array to return two values.
- *
- * @param deReference If the top expression is a Reference, then dereference it.
- * @return The value.
- * @throws NoExpressionValueException
- *
- * @since 1.0.0
- */
- protected final Object popExpression(boolean deReference) throws NoExpressionValueException {
- try {
- // Do not pop above the current subexpression pos, if any.
- if (topSubexpression != -1)
- if (expressionStack.size() == subexpressionStackPos[topSubexpression])
- throw new NoExpressionValueException();
-
- Object result = expressionStack.remove(expressionStack.size()-1);
- if (deReference && result instanceof VariableReference)
- result = ((VariableReference) result).dereference();
- return result;
- } catch (IndexOutOfBoundsException e) {
- throw new NoExpressionValueException();
- }
- }
-
- /**
- * Get the expression at <code>fromTop</code> down from the top. This is
- * need for when multi-operators happen and they are stored in reverse of
- * what is needed. They would normally be stored left to right, with the
- * rightmost one on top. But they need to be processed left to right, so
- * to get the left most one requires digging down in the stack.
- * <p>
- * When done, <code>popExpressions(int count)</code> must be called to
- * clean them out since they were processed.
- * <p>
- * This will not dereference the expression. It is the job of the caller to do this.
- *
- * @param fromTop <code>1</code> is the top one, <code>2</code> is the next one down.
- * @return The entry from the top that was requested.
- * @throws NoExpressionValueException
- *
- * @see IDEExpression#popExpressions(int)
- * @since 1.0.0
- */
- protected final Object getExpression(int fromTop) throws NoExpressionValueException {
- try {
- // Do not pull above the current subexpression pos, if any.
- if (topSubexpression != -1)
- if (expressionStack.size()-fromTop < subexpressionStackPos[topSubexpression])
- throw new NoExpressionValueException();
-
- return expressionStack.get(expressionStack.size()-fromTop);
- } catch (IndexOutOfBoundsException e) {
- throw new NoExpressionValueException();
- }
- }
-
- /**
- * Remove the top <code>count</code> items. This will not cause dereferencing to occur. It
- * removes the corresponding type stack entries.
- *
- * @param count
- * @throws NoExpressionValueException
- *
- * @since 1.0.0
- */
- protected final void popExpressions(int count) throws NoExpressionValueException {
- try {
- // Do not pop above the current subexpression pos, if any.
- int stop = topSubexpression != -1 ? subexpressionStackPos[topSubexpression] : -1;
- int remove = expressionStack.size()-1;
- while (count-- > 0) {
- if (expressionStack.size() <= stop)
- throw new NoExpressionValueException(); // Try to go above the current subexpression.
- expressionStack.remove(remove);
- expressionTypeStack.remove(remove--);
- }
- } catch (IndexOutOfBoundsException e) {
- throw new NoExpressionValueException();
- }
- }
-
- /**
- * Pop just the expression type. It is imperitive that the expression type
- * is popped immediately following popExpression. Separated the methods so that we
- * don't need to create an array to return two values.
- * <p>
- * If the allowVoid is false and type is void, then a NoExpressionValueException will be thrown.
- * This is for the case where the expression was trying to be used in a different
- * expression. This will be set to void only on expressions that return no value (only
- * method's do this for now).
- *
- * @param allowVoid Allow void types if <code>true</code>
- * @return The type.
- * @throws NoExpressionValueException
- * @since 1.0.0
- */
- protected final Class popExpressionType(boolean allowVoid) throws NoExpressionValueException {
- try {
- Class result = (Class) expressionTypeStack.remove(expressionTypeStack.size()-1);
- if (!allowVoid && result == Void.TYPE)
- throw new NoExpressionValueException(InitparserTreeMessages.getString("ExpressionProcesser.PopExpressionType.ExpressionVoid_EXC_")); //$NON-NLS-1$
- return result;
-
- } catch (IndexOutOfBoundsException e) {
- throw new NoExpressionValueException();
- }
- }
-
- /**
- * Get the expression type at <code>fromTop</code> down from the top. This is
- * need for when multi-operators happen and they are stored in reverse of
- * what is needed. They would normally be stored left to right, with the
- * rightmost one on top. But they need to be processed left to right, so
- * to get the left most one requires digging down in the stack.
- * <p>
- * When done, <code>popExpressionTypes(int count)</code> must be called to
- * clean them out since they were processed.
-
- * @param fromTop <code>1</code> is the top one, <code>2</code> is the next one down.
- * @param allowVoid Allow void types if <code>true</code>
- * @return The type from the top that was requested.
- * @throws ThrowableProxy
- * @throws NoExpressionValueException
- *
- * @see IDEExpression#popExpressionTypes(int)
- * @since 1.0.0
- */
- protected final Class getExpressionType(int fromTop, boolean allowVoid) throws NoExpressionValueException {
- try {
- Class result = (Class) expressionTypeStack.get(expressionTypeStack.size()-fromTop);
- if (!allowVoid && result == Void.TYPE)
- throw new NoExpressionValueException();
- return result;
- } catch (IndexOutOfBoundsException e) {
- throw new NoExpressionValueException();
- }
- }
-
- /**
- * Flag indicating expression should be ignored and not processed.
- * This happens because of few cases, like conditional and, that
- * if one returns false, the rest of the expressions in that conditional and
- * expression should be ignored and not processed.
- * <p>
- * It is an Object that acts as an enum for the type of expression that initiated the ignore.
- * If it is <code>null</code> then no one is ignoring.
- * <p>
- * All of the pushTo...Proxy methods must test this for this to work correctly.
- * Each expression has some way of testing that their particular nesting of
- * expressions is complete and they can turn off the ignore flag.
- * <p>
- * Only one type of ignore can exist at a time.
- */
- protected Object ignoreExpression = null;
-
-
- private List saveStates;
-
- /**
- * Are we tracing or not.
- */
- protected final boolean traceOn;
- private final long thresholdTime;
- private long startExpressionStepTime;
- private long startExpressionTime;
- private long lastExpressionEndTime;
-
- /**
- * Trace head of this expression. So that traces from different expressions can be distinquished.
- * It is simply an monotonically increasing counter. It is the header string for any trace output.
- */
- protected final String traceHeader;
-
- private int indent = 0; // Indented for certain block expressions.
-
- /*
- * Trace counter. It is incremented once for each expression and assigned to the traceId of the expression.
- */
- private static int TRACE_COUNTER;
-
- /**
- * Create the Expression without tracing.
- * @param registry
- *
- * @since 1.0.0
- */
- public ExpressionProcesser() {
- this(false, -1);
- }
-
- /**
- * Create the expression, and set the tracing mode and threshold time. Use -1
- * for default time of 100ms.
- * @param traceOn
- *
- * @since 1.1.0
- */
- public ExpressionProcesser(boolean traceOn, long threshold) {
- this.traceOn = traceOn;
- if (traceOn) {
- traceHeader = "**"+(++TRACE_COUNTER)+':'; //$NON-NLS-1$
- System.out.print(traceHeader);
- System.out.println(" Start expression"); //$NON-NLS-1$
- this.thresholdTime = threshold != -1 ? threshold : 100;
- lastExpressionEndTime = startExpressionTime = System.currentTimeMillis();
- } else {
- traceHeader = null;
- thresholdTime = 100;
- }
- }
-
- /**
- * Trace msg helper. Should only be called if traceOn is true. This method is only used to start a new trace message.
- * The caller is must call printTraceEnd at the end.
- *
- * @param msg message to print
- * @param ignore are we ignoring the expression, or is it being processed (this just alters the trace output slightly).
- *
- * @since 1.1.0
- */
- protected void printTrace(String msg, boolean ignore) {
- startExpressionStepTime = System.currentTimeMillis();
- long sinceLastExpression = startExpressionStepTime - lastExpressionEndTime;
- System.out.print(traceHeader);
- if (sinceLastExpression > 0) {
- System.out.print('(');
- if (sinceLastExpression > thresholdTime)
- System.out.print("***"); //$NON-NLS-1$
- System.out.print(sinceLastExpression);
- System.out.print("ms)"); //$NON-NLS-1$
- }
- System.out.print('\t');
- if (!ignore)
- System.out.print("\t"); //$NON-NLS-1$
- else
- System.out.print("##\t"); //$NON-NLS-1$
-
- printIndent();
- System.out.print(msg);
- }
-
- /**
- * print the indent. It will not do a new line before nor after.
- *
- * @since 1.1.0
- */
- protected void printIndent() {
- for(int i=indent; i>0; i--) {
- System.out.print(" "); //$NON-NLS-1$
- }
- }
-
- protected void printTraceEnd() {
- long stop = System.currentTimeMillis()-startExpressionStepTime;
- if (stop > 0) {
- System.out.print(" ("); //$NON-NLS-1$
- if (stop > thresholdTime)
- System.out.print("***"); //$NON-NLS-1$
- System.out.print(stop);
- System.out.print("ms)"); //$NON-NLS-1$
- }
- System.out.println();
- lastExpressionEndTime = System.currentTimeMillis();
- }
-
- /**
- * Do an indent (undent) according to indent flag.
- * @param indent <code>true</code> to increment indent, or otherwise decrement.
- *
- * @since 1.1.0
- */
- protected void indent(boolean indent) {
- this.indent += (indent ? 1 : -1);
- if (this.indent < 0)
- this.indent = 0;
- }
-
- /**
- * Print the object and type. It will not end with a newline char, so one will be needed afterwards.
- *
- * @param o
- * @param t
- *
- * @since 1.1.0
- */
- protected void printObjectAndType(Object o, Class t) {
- System.out.print(' ');
- System.out.print("Object-"); //$NON-NLS-1$
- System.out.print(o);
- System.out.print(" Type-"); //$NON-NLS-1$
- System.out.print(t);
- System.out.print(' ');
- }
-
- /**
- * Close the exception processing
- *
- * @since 1.0.0
- */
- public final void close() {
- boolean firstClose = expressionStack != null;
- if (firstClose && traceOn) {
- printTrace("End expression", false); //$NON-NLS-1$
- long totalTime = System.currentTimeMillis()-startExpressionTime;
- System.out.print(" Total expression evaluation time: "); //$NON-NLS-1$
- System.out.print(totalTime);
- System.out.print("ms."); //$NON-NLS-1$
- }
- try {
- expressionStack = null;
- expressionTypeStack = null;
- expressionProxies = null;
- exception = null;
- catchThrowable = null;
- saveStates = null;
- } finally {
- if (firstClose && traceOn)
- printTraceEnd();
- }
- }
-
- /**
- * Pull the value. The value will be placed into the array passed in.
- * It will be stored as value[0] = value value[1] = valuetype(Class).
- *
- * @param value The value array to store the value and type into.
- * @throws NoExpressionValueException
- * @since 1.0.0
- */
- public final void pullValue(Object[] value) throws NoExpressionValueException {
- if (traceOn)
- printTrace("Pull value:", false); //$NON-NLS-1$
- try {
- value[0] = popExpression();
- value[1] = popExpressionType(false);
- } finally {
- if (traceOn) {
- printObjectAndType(value[0], (Class) value[1]);
- printTraceEnd();
- }
- }
- close();
- }
-
- /**
- * Pull the value of the expression proxy, dereferencing it if necessary. This is for resolution only purposes at the
- * end of the expression being processed. Not meant for general access to the value of expression proxy. Use
- * {@link ExpressionProcesser#getExpressionProxyValue(int, Object[])} instead for general access to the value.
- *
- * @param proxyid
- * @param value
- * @throws NoExpressionValueException
- *
- * @since 1.1.0
- */
- public final void pullExpressionProxyValue(int proxyid, Object[] value) throws NoExpressionValueException {
- getExpressionProxyValue(proxyid, value, true, true);
- }
-
- /**
- * Get the expression proxy value. If the expression has not yet been evaluated it will
- * return false. If it has it will return true.
- * @param proxyid
- * @param value put value into value[0] and the type into value[1].
- * @return <code>true</code> if successful, or <code>false</code> if the expression proxy was never resolved or doesn't exist.
- *
- * @since 1.1.0
- */
- public boolean getExpressionProxyValue(int proxyid, Object[] value) {
- try {
- return getExpressionProxyValue(proxyid, value, true, false);
- } catch (NoExpressionValueException e) {
- return false;
- }
- }
-
- /**
- * Get the expression proxy value, or the NoExpressionValueException if not resolved. This
- * is useful for callers that need to handle the proxy itself for failed calls.
- *
- * @param proxyid
- * @param value
- * @throws NoExpressionValueException
- *
- * @since 1.1.0
- */
- public void getExpressionProxy(int proxyid, Object[] value) throws NoExpressionValueException {
- getExpressionProxyValue(proxyid, value, true, false);
- }
-
- /*
- * Internal method use to actually get the value, but to distinquish between pull and get of the public interface.
- * Get will process the errors as normal execution errors, while pull will throw the errors. finalTrace is when
- * this is the final call to return the values to the client. We will trace the results in that case.
- * Return true if successful.
- */
- private boolean getExpressionProxyValue(int proxyid, Object[] value, boolean pull, boolean finalTrace) throws NoExpressionValueException {
- // Note: This will throw the exceptions right away since this is called from outside to fill in the value and
- // so we are holding such exceptions.
- boolean doTrace = finalTrace && traceOn;
- try {
- if (expressionProxies != null && expressionProxies.size() > proxyid) {
- InternalExpressionProxy proxy = (InternalExpressionProxy) expressionProxies.get(proxyid);
- if (proxy != null && proxy.isSet()) {
- value[0] = proxy.getValue();
- if (value[0] instanceof VariableReference)
- value[0] = ((VariableReference) value[0]).dereference(); // Here we want the final current value.
- value[1] = proxy.getType();
- if (doTrace)
- if (value[1] != Void.TYPE) {
- printTrace("Return Proxy #" + proxyid + " Resolved to", false); //$NON-NLS-1$ //$NON-NLS-2$
- printObjectAndType(value[0], (Class) value[1]);
- } else
- printTrace("Return Proxy #" + proxyid + " Resolved to void.", false); //$NON-NLS-1$ //$NON-NLS-2$
- return true;
-
- } else {
- if (doTrace)
- printTrace("Return Proxy #" + proxyid + ": Not resolved", false); //$NON-NLS-1$ //$NON-NLS-2$
- NoExpressionValueException e = new NoExpressionValueException(InitparserTreeMessages.getString("ExpressionProcesser.GetExpressionProxyValue.ExpressionProxyNotSet_EXC_"), proxy); //$NON-NLS-1$
- if (pull)
- throw e;
- else
- processSyntaxException(e);
- return false;
- }
- } else {
- if (doTrace)
- printTrace("Return Proxy #" + proxyid + ": Never created.", false); //$NON-NLS-1$ //$NON-NLS-2$
- NoExpressionValueException e = new NoExpressionValueException(InitparserTreeMessages.getString("ExpressionProcesser.GetExpressionProxyValue.ExpressionProxyDoesntExist_EXC_")); //$NON-NLS-1$
- if (pull)
- throw e;
- else
- processSyntaxException(e);
- return false;
- }
- } finally {
- if (doTrace)
- printTraceEnd();
- }
- }
-
- /**
- * Push the expression (just a value) onto the stack.
- *
- * @param o
- * @param t
- *
- * @since 1.0.0
- */
- public final void pushExpression(Object o, Class t) {
- boolean ignore = (ignoreExpression != null || errorOccurred);
- if (traceOn) {
- printTrace("Push: ", ignore); //$NON-NLS-1$
- printObjectAndType(o, t);
- }
- try {
- if (ignore)
- return;
- pushExpressionValue(o, t);
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
- /**
- * Get the value of the expression proxy (from proxy id), and push the value onto the stack.
- *
- * @param proxyid The proxy id of the ExpressionProxy to push as a value.
- *
- * @since 1.0.0
- */
- public final void pushExpressionProxy(int proxyid) {
- boolean ignore =(ignoreExpression != null || errorOccurred);
- if (traceOn)
- printTrace("Push Expression Proxy #"+proxyid, ignore); //$NON-NLS-1$
- try {
- if (ignore)
- return;
- if (expressionProxies != null && expressionProxies.size() > proxyid) {
- InternalExpressionProxy proxy = (InternalExpressionProxy) expressionProxies.get(proxyid);
- if (proxy != null && proxy.isSet()) {
- if (traceOn)
- printObjectAndType(proxy.getValue(), proxy.getType());
- pushExpressionValue(proxy.getValue(), proxy.getType()); // Can push a VariableReference. This is ok. When used it will then deref with the current value.
- } else
- processException(new NoExpressionValueException("Proxy id: "+proxyid)); //$NON-NLS-1$
- } else
- processException(new NoExpressionValueException("Proxy id: "+proxyid)); //$NON-NLS-1$
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
- /**
- * Push a cast onto stack. The type passed in is either a String (with classname to cast to) or the
- * type to cast to.
- * @param type To cast to. If <code>String</code> then convert to type (using something like <code>Class.forName()</code>) or it is a Class
- *
- * @since 1.0.0
- */
- public final void pushCast(Class type) {
- boolean ignore = (ignoreExpression != null || errorOccurred);
- if (traceOn)
- printTrace("Cast to: "+type, ignore); //$NON-NLS-1$
- try {
- if (ignore)
- return;
-
- try {
- Object exp = popExpression();
- Class exptype = popExpressionType(false);
-
- pushExpressionValue(castBean(type, exp, exptype), type);
- } catch (RuntimeException e) {
- processException(e);
- } catch (NoExpressionValueException e) {
- processException(e);
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
-
- }
-
- /**
- * Cast a bean into the return type. If the return type is not primitive, then
- * the bean is left alone, however it is checked to be an instance of
- * the return type. If the return type is primitive, then the
- * correct primitive wrapper is created from the bean (bean must be a number or character or boolean primitve so
- * that cast will work).
- * <p>
- * However if can't be cast for primitive or if not an instance of the
- * returntype for objects, a ClassCastException will be raised.
- * <p>
- * This is a helper method for expression processer to cast a bean. Since it is a helper method it doesn't
- * check nor process the exception. It throws it. Callers must handle it as they see fit.
- *
- * @param returnType
- * @param bean
- * @param beanType The type that bean is supposed to be (e.g. even though it is a Number, it actually represents a primitive).
- * @return The cast bean (either to the appropriate primitive wrapper type or bean)
- *
- * @throws ClassCastException
- * @since 1.0.0
- */
- protected final Object castBean(Class returnType, Object bean, Class beanType) throws ClassCastException {
- // Cast uses true value and true class of bean, not expected type (i.e. not beanType).
- if (bean == null)
- if (!returnType.isPrimitive())
- return bean; // bean is null, and return type is not primitive, so this is a valid cast.
- else
- throwClassCast(returnType, bean);
- else if (returnType.equals(bean.getClass()))
- return bean; // They are already the same.
- else if (!returnType.isPrimitive()) {
- if (!beanType.isPrimitive() && returnType.isInstance(bean))
- return bean;
- else
- throwClassCast(returnType, bean); // Either bean type was wrappering primitive or not instanceof returntype.
- } else {
- if (!beanType.isPrimitive())
- throwClassCast(returnType, bean); // bean type was not wrappering a primitive. Can't cast to primitive.
- // It is return type of primitive. Now convert to correct primitive.
- if (returnType == Boolean.TYPE)
- if (bean instanceof Boolean)
- return bean;
- else
- throwClassCast(returnType, bean);
- else {
- if (bean instanceof Number) {
- if (returnType == Integer.TYPE)
- if (bean instanceof Integer)
- return bean;
- else
- return new Integer(((Number) bean).intValue());
- else if (returnType == Byte.TYPE)
- if (bean instanceof Byte)
- return bean;
- else
- return new Byte(((Number) bean).byteValue());
- else if (returnType == Character.TYPE)
- if (bean instanceof Character)
- return bean;
- else
- return new Character((char) ((Number) bean).intValue());
- else if (returnType == Double.TYPE)
- if (bean instanceof Double)
- return bean;
- else
- return new Double(((Number) bean).doubleValue());
- else if (returnType == Float.TYPE)
- if (bean instanceof Float)
- return bean;
- else
- return new Float(((Number) bean).floatValue());
- else if (returnType == Long.TYPE)
- if (bean instanceof Long)
- return bean;
- else
- return new Long(((Number) bean).longValue());
- else if (returnType == Short.TYPE)
- if (bean instanceof Short)
- return bean;
- else
- return new Short(((Number) bean).shortValue());
- else
- throwClassCast(returnType, bean);
- } else if (bean instanceof Character) {
- if (returnType == Character.TYPE)
- return bean;
- else if (returnType == Integer.TYPE)
- return new Integer(((Character) bean).charValue());
- else if (returnType == Byte.TYPE)
- return new Byte((byte) ((Character) bean).charValue());
- else if (returnType == Double.TYPE)
- return new Double(((Character) bean).charValue());
- else if (returnType == Float.TYPE)
- return new Float(((Character) bean).charValue());
- else if (returnType == Long.TYPE)
- return new Long(((Character) bean).charValue());
- else if (returnType == Short.TYPE)
- return new Short((short) ((Character) bean).charValue());
- else
- throwClassCast(returnType, bean);
- } else
- throwClassCast(returnType, bean);
- }
-
- }
- return null; // It should never get here;
- }
-
- private void throwClassCast(Class returnType, Object bean) throws ClassCastException {
- throw new ClassCastException(MessageFormat.format(InitparserTreeMessages.getString("ExpressionProcesser.CannotCastXToY_EXC_"), new Object[] {bean != null ? bean.getClass().getName() : null, returnType.getName()})); //$NON-NLS-1$
- }
-
- /**
- * Return the primitive type that the wrapper bean represents (i.e. Boolean instance returns Boolean.TYPE)
- * <p>
- * This is a helper method for expression processer to get the primitive type. Since it is a helper method it doesn't
- * check nor process the exception. It throws it. Callers must handle it as they see fit.
-
- * @param bean
- * @return the primitive type class of the given bean.
- * @throws IllegalArgumentException if bean is <code>null</code> or not of the type that can be converted to a primitive.
- *
- * @since 1.0.0
- */
- protected final Class getPrimitiveType(Object bean) throws IllegalArgumentException {
- if (bean instanceof Boolean)
- return Boolean.TYPE;
- else if (bean instanceof Integer)
- return Integer.TYPE;
- else if (bean instanceof Byte)
- return Byte.TYPE;
- else if (bean instanceof Character)
- return Character.TYPE;
- else if (bean instanceof Double)
- return Double.TYPE;
- else if (bean instanceof Float)
- return Float.TYPE;
- else if (bean instanceof Long)
- return Long.TYPE;
- else if (bean instanceof Short)
- return Short.TYPE;
- else
- throw new IllegalArgumentException(bean != null ? bean.getClass().getName() : "null"); //$NON-NLS-1$
- }
-
- private static final Object IFELSE_IGNORE = "IF/ELSE IGNORE"; // Flag for if/else in ingore //$NON-NLS-1$
- private int ifElseNesting = 0; // Nesting of if/else expressions.
- private int ifElseIgnoreNestCount = 0; // When ignoring if/else expressions, ignore until this nest count.
- private boolean ifElseSkipTruePart;
-
-
- /**
- * Push an if test expression.
- * @param hasElseClause
- *
- * @since 1.0.0
- */
- public final void pushIfElse() {
- try {
- boolean ignore = true;
- try {
- if (errorOccurred)
- return;
- // Slightly different here in that if an ignoring occurred we still need to process at least part of it so that
- // we can get the expression grouping correct.
- ifElseNesting++; // We have the test.
-
- if (ignoreExpression != null)
- return;
- ignore = false;
- } finally {
- if (traceOn)
- printTrace("If test condition", ignore); //$NON-NLS-1$
- }
-
- try {
- Object condition = popExpression();
- Class type = popExpressionType(false);
- if (type != Boolean.TYPE)
- throwClassCast(Boolean.TYPE, condition);
- if (traceOn) {
- System.out.print(" Test Result="+condition); //$NON-NLS-1$
- printTraceEnd();
- indent(true);
- printTrace("Begin True Expression.", ignore); //$NON-NLS-1$
- printTraceEnd();
- indent(true);
- }
- if (((Boolean) condition).booleanValue()) {
- // Condition was true.
- // Do nothing. Let true condition be processed.
- } else {
- // Condition was false.
- ifElseSkipTruePart = true; // Tell the true condition should be ignored.
- ignoreExpression = IFELSE_IGNORE;
- ifElseIgnoreNestCount = ifElseNesting;
- }
- // We don't put anything back on the stack because the condition test is not ever returned.
- // The appropriate true or false condition evaluation will be left on the stack.
- } catch (RuntimeException e) {
- processException(e);
- } catch (NoExpressionValueException e) {
- processException(e);
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
- /**
- * Push an if/else clause. It can be any clause of the if (true, or false clause).
- * @param clauseType
- *
- * @since 1.0.0
- */
- public final void pushIfElse(InternalIfElseOperandType clauseType) {
- try {
- boolean ignore = true;
- if (errorOccurred)
- return;
- // Slightly different here in that if an ignoring occurred we still need to process at least part of it so that
- // we can get the expression grouping correct.
- switch (clauseType.getValue()) {
- case InternalIfElseOperandType.TRUE_CLAUSE_VALUE:
- if (traceOn) {
- indent(false);
- printTrace("Begin False Expression.", ignore); //$NON-NLS-1$
- printTraceEnd();
- indent(true);
- }
- if (ifElseSkipTruePart && ignoreExpression == IFELSE_IGNORE && ifElseIgnoreNestCount == ifElseNesting) {
- // stop ignoring, we've ignored the true condition of interest.
- ignoreExpression = null;
- return; // However, leave because since this condition was ignored.
- }
- break;
- case InternalIfElseOperandType.ELSE_CLAUSE_VALUE:
- if (traceOn) {
- indent(false);
- indent(false);
- printTrace("End IF/ELSE Expression.", ignore); //$NON-NLS-1$
- printTraceEnd();
- }
- int currentNesting = ifElseNesting--;
- if (ignoreExpression == IFELSE_IGNORE && ifElseIgnoreNestCount == currentNesting) {
- // stop ignoring, we've ignored the false condition of interest.
- ignoreExpression = null;
- return; // However, leave because since this condition was ignored.
- }
- }
-
- if (ignoreExpression != null)
- return;
- ignore = false;
-
-
- try {
- switch (clauseType.getValue()) {
- case InternalIfElseOperandType.TRUE_CLAUSE_VALUE:
- ifElseSkipTruePart = false; // Tell the false condition should be ignored.
- ignoreExpression = IFELSE_IGNORE;
- ifElseIgnoreNestCount = ifElseNesting;
- break;
- case InternalIfElseOperandType.ELSE_CLAUSE_VALUE:
- // There's nothing to do, if it was ignored due to true, we wouldn't of gotton here.
- // If it wasn't ignored, then the result of the false expression is on the stack, which is what it should be.
- break;
- }
- } catch (RuntimeException e) {
- processException(e);
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
- /**
- * Push the instanceof expression. The type passed in is either a String (with classname to test against) or the
- * type to test against.
- * @param type To test against.
- * @since 1.0.0
- */
- public final void pushInstanceof(Class type) {
- boolean ignore = (ignoreExpression != null || errorOccurred);
- if (traceOn)
- printTrace("Instanceof type: "+type, ignore); //$NON-NLS-1$
- try {
- if (ignore)
- return;
-
- try {
- Object exp = popExpression();
- Class exptype = popExpressionType(false);
- pushExpressionValue(Boolean.valueOf(isInstance(type, exp, exptype)), Boolean.TYPE);
- } catch (NoExpressionValueException e) {
- processException(e);
- } catch (RuntimeException e) {
- processException(e);
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
- /**
- * Test if instance of. It will make sure that primitive to non-primitive is not permitted.
- * This is a true instance of, which means null IS NOT AN instance of any type. This is
- * different then assignable from, in that case null can be assigned to any class type.
- * <p>
- * This is a helper method for expression processer to do isInstance. Since it is a helper method it doesn't
- * check nor process exceptions.
-
- * @param type
- * @param bean
- * @param beanType
- * @return
- *
- * @since 1.0.0
- */
- protected final boolean isInstance(Class type, Object bean, Class beanType) {
- if (type.isPrimitive())
- return beanType.isPrimitive() && type == beanType; // Can't use isInstance because for a primitive type isInstance returns false.
- else
- return type.isInstance(bean);
- }
-
- /**
- * Push new instance from string.
- * @param initializationString
- * @param resultType expected result type. If it isn't of that type, a classcast will be processed.
- * @param classloader classloader to use for finding classes, or <code>null</code> to use classloader of InitializationStringParser.class.
- *
- * @since 1.1.0
- */
- public final void pushNewInstanceFromString(String initializationString, Class resultType, ClassLoader classloader) {
- boolean ignore = (ignoreExpression != null || errorOccurred);
- if (traceOn)
- printTrace("New instance from string: \""+initializationString+"\" Type="+resultType, ignore); //$NON-NLS-1$ //$NON-NLS-2$
- try {
- if (ignore)
- return;
-
- try {
- InitializationStringParser parser = InitializationStringParser.createParser(initializationString, classloader);
- Object newValue = parser.evaluate();
- newValue = castBean(resultType, newValue, parser.getExpectedType());
- pushExpressionValue(newValue, resultType);
- } catch (RuntimeException e) {
- processException(e);
- } catch (InitializationStringEvaluationException e) {
- processException(e);
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
-
- }
-
- /**
- * Push prefix expression.
- * @param operator
- * @since 1.0.0
- */
- public final void pushPrefix(PrefixOperator operator) {
- try {
- if (ignoreExpression != null || errorOccurred) {
- if (traceOn)
- printTrace("Prefix: \'"+operator+"\'", true); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
-
- if (operator == PrefixOperator.PRE_PLUS)
- return; // Do nothing. "+" doesn't affect the result of the current top expression.
-
- if (traceOn)
- printTrace("Prefix: \'"+operator+"\' ", false); //$NON-NLS-1$ //$NON-NLS-2$
-
- try {
- Object exp = popExpression();
- Class exptype = popExpressionType(false);
- if (!exptype.isPrimitive())
- throwInvalidPrefix(operator, exp);
-
- int primTypeEnum = getEnumForPrimitive(exptype);
- switch (operator.getValue()) {
- case PrefixOperator.PRE_MINUS_VALUE:
- switch (primTypeEnum) {
- case BOOLEAN:
- throwInvalidPrefix(operator, exp);
- case BYTE:
- exp = new Integer(-((Number) exp).byteValue());
- break;
- case CHAR:
- exp = new Integer(-((Character) exp).charValue());
- break;
- case DOUBLE:
- exp = new Double(-((Number) exp).doubleValue());
- break;
- case FLOAT:
- exp = new Float(-((Number) exp).floatValue());
- break;
- case INT:
- exp = new Integer(-((Number) exp).intValue());
- break;
- case LONG:
- exp = new Long(-((Number) exp).longValue());
- break;
- case SHORT:
- exp = new Integer(-((Number) exp).shortValue());
- break;
- }
- exptype = getPrimitiveType(exp); // It can actually change the type.
- break;
-
- case PrefixOperator.PRE_COMPLEMENT_VALUE:
- switch (primTypeEnum) {
- case BOOLEAN:
- case DOUBLE:
- case FLOAT:
- throwInvalidPrefix(operator, exp);
- case BYTE:
- exp = new Integer(~((Number) exp).byteValue());
- break;
- case CHAR:
- exp = new Integer(~((Character) exp).charValue());
- break;
- case INT:
- exp = new Integer(~((Number) exp).intValue());
- break;
- case LONG:
- exp = new Long(~((Number) exp).longValue());
- break;
- case SHORT:
- exp = new Integer(~((Number) exp).shortValue());
- break;
- }
- exptype = getPrimitiveType(exp); // It can actually change the type.
- break;
- case PrefixOperator.PRE_NOT_VALUE:
- switch (primTypeEnum) {
- case BOOLEAN:
- exp = !((Boolean) exp).booleanValue() ? Boolean.TRUE : Boolean.FALSE;
- break;
- case BYTE:
- case CHAR:
- case DOUBLE:
- case FLOAT:
- case INT:
- case LONG:
- case SHORT:
- throwInvalidPrefix(operator, exp);
- }
- break;
- }
-
- if (traceOn)
- printObjectAndType(exp, exptype);
- pushExpressionValue(exp, exptype); // Push the result back on the stack.
-
- } catch (IllegalArgumentException e) {
- processSyntaxException(e);
- } catch (NoExpressionValueException e) {
- processException(e);
- } catch (RuntimeException e) {
- processException(e);
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
-
- }
-
- /**
- * Assign the right expression to the left expression.
- * @since 1.1.0
- */
- public final void pushAssignment() {
- if (ignoreExpression != null || errorOccurred) {
- if (traceOn) {
- printTrace("Assignment", true); //$NON-NLS-1$
- printTraceEnd();
- }
- return;
- }
-
- try {
- // KLUDGE: The only reason leftValue/refType are outside of try/finally is because
- // of tracing. pushExpression() does its own trace statements, so we need to end
- // our trace before calling pushExpression.
- Object leftValue;
- Class refType;
- try {
- if (traceOn)
- printTrace("Assignment: ", false); //$NON-NLS-1$
- // The order on the stack is right then left operand.
- // First the right operand
- Object value = popExpression();
- Class type = popExpressionType(false);
-
- // Next the left operand, should be a reference.
- VariableReference left = (VariableReference) popExpression(false); // Don't dereference it.
- refType = popExpressionType(false);
-
- if (traceOn)
- printObjectAndType(left, refType);
-
- leftValue = left.set(value, type);
- } finally {
- if (traceOn)
- printTraceEnd();
- }
-
- // Now do assignment and return the value to the stack.
- pushExpression(leftValue, refType); // The type of the result is the type of the reference.
-
- } catch (IllegalArgumentException e) {
- processException(e);
- } catch (NoExpressionValueException e) {
- processException(e);
- } catch (IllegalAccessException e) {
- processException(e);
- } catch (RuntimeException e) {
- processException(e);
- }
-
- }
-
- /**
- * Assign the expression proxy to the top expression value.
- *
- * @param proxy
- *
- * @since 1.1.0
- */
- public final void pushAssignment(InternalExpressionProxy proxy) {
- boolean ignore = (ignoreExpression != null || errorOccurred);
- try {
- if (traceOn) {
- printTrace("Assign to Proxy #"+proxy.getProxyID(), ignore); //$NON-NLS-1$
- }
- if (ignore)
- return;
-
- try {
- assignToExpressionProxyFromTopStackEntry(proxy);
- if (traceOn)
- printObjectAndType(proxy.getValue(), proxy.getType());
- } catch (NoExpressionValueException e) {
- processException(e);
- } catch (RuntimeException e) {
- processException(e);
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
-
- }
-
- /**
- * Assign the top stack entry to the new expression proxy and allocate it for callback later.
- * @param proxy
- * @throws NoExpressionValueException
- *
- * @since 1.1.0
- */
- protected void assignToExpressionProxyFromTopStackEntry(InternalExpressionProxy proxy) throws NoExpressionValueException {
- Object value = getExpression(1);
- Class type = getExpressionType(1, true);
- if (value instanceof VariableReference)
- value = ((VariableReference) value).dereference(); // Here we want the final current value.
-
- proxy.setProxy(value, type);
- allocateExpressionProxy(proxy);
- }
-
- /**
- * Allocate an expression proxy. This is used to make an expression proxy known to the processor. The expression proxy must
- * have been setProxy() at this point. This is used to assign from the top of the stack or to add from outside an evaluated proxy
- * to be used later by others.
- *
- * @param proxy
- *
- * @since 1.1.0
- */
- public void allocateExpressionProxy(InternalExpressionProxy proxy) {
- int minSize = proxy.getProxyID()+1;
- if (expressionProxies == null)
- expressionProxies = new ArrayList(minSize+10); // Allow room to grow ten more.
- else if (expressionProxies.size() < minSize)
- expressionProxies.ensureCapacity(minSize+10); // Allow room to grow ten more.
- int fill = minSize-expressionProxies.size(); // Number of "null" fill entries needed. Probably shouldn't occur, but to be safe.
- if (fill > 0) {
- while (--fill > 0)
- expressionProxies.add(null);
- expressionProxies.add(proxy);
- } else
- expressionProxies.set(proxy.getProxyID(), proxy); // Already large enough, replace entry.
-
- }
-
- /**
- * The primitive enums.
- * NOTE: Their order must not changed. They are in order of permitted widening.
- *
- */
- protected static final int
- BOOLEAN = 0,
- BYTE = 1,
- SHORT = 2,
- CHAR = 3,
- INT = 4,
- LONG = 5,
- FLOAT = 6,
- DOUBLE = 7;
-
-
-
- /**
- * Get the enum constant for the type of primitive passed in.
- * <p>
- * This is a helper method for expression processer to get the enum for the primitive type. Since it is a helper method it doesn't
- * check nor process the exception. It throws it. Callers must handle it as they see fit.
-
- * @param primitiveType
- * @return
- * @throws IllegalArgumentException if type is not a primitive.
- *
- * @see ExpressionProcesser#BOOLEAN
- * @since 1.0.0
- */
- protected final int getEnumForPrimitive(Class primitiveType) throws IllegalArgumentException {
- if (primitiveType == Boolean.TYPE)
- return BOOLEAN;
- else if (primitiveType == Integer.TYPE)
- return INT;
- else if (primitiveType == Byte.TYPE)
- return BYTE;
- else if (primitiveType == Character.TYPE)
- return CHAR;
- else if (primitiveType == Double.TYPE)
- return DOUBLE;
- else if (primitiveType == Float.TYPE)
- return FLOAT;
- else if (primitiveType == Long.TYPE)
- return LONG;
- else if (primitiveType == Short.TYPE)
- return SHORT;
- else
- throw new IllegalArgumentException(primitiveType != null ? primitiveType.getName() : "null"); //$NON-NLS-1$
- }
-
- private void throwInvalidPrefix(PrefixOperator operator, Object exp) throws IllegalArgumentException {
- throw new IllegalArgumentException(MessageFormat.format(InitparserTreeMessages.getString("ExpressionProcesser.InvalidOperandOfPrefixOperator_EXC_"), new Object[] {exp != null ? exp.toString() : null, operator.toString()})); //$NON-NLS-1$
- }
-
- private static final Object INFIX_IGNORE = "INFIX IGNORE"; // Flag for infix in ingore //$NON-NLS-1$
- private int infixNesting = 0; // Nesting of infix expressions.
- private int infixIgnoreNestCount = 0; // When ignoring infix expressions, ignore until this nest count.
- /**
- * Push the infix expression onto the stack.
- * @param operator
- * @param operandType The operator type. Left, right, other.
- * @since 1.0.0
- */
- public final void pushInfix(InfixOperator operator, InternalInfixOperandType operandType) {
- try {
- boolean ignore = true;
- try {
- if (errorOccurred) {
- return;
- }
- // Slightly different here in that if an ignored occurred we still need to process at least part of it so that
- // we can get the expression grouping correct.
- if (operandType == InternalInfixOperandType.INFIX_LEFT_OPERAND)
- infixNesting++;
- else if (operandType == InternalInfixOperandType.INFIX_LAST_OPERAND) {
- int currentNest = infixNesting--;
- if (ignoreExpression == INFIX_IGNORE && currentNest == infixIgnoreNestCount) {
- // We were ignoring, and it was this expression that was being ignore.
- // We have received the last operand of the nested expression that was being ignored,
- // so we can stop ignoring. But we still leave since the value of the expression is on the
- // top of the stack.
- ignoreExpression = null;
- return;
- }
- }
-
- if (ignoreExpression != null)
- return;
- ignore = false;
- } finally {
- if (traceOn)
- printTrace("Infix: "+operator, ignore); //$NON-NLS-1$
- }
-
- try {
- Object right = null;
- Class rightType = null;
- if (operandType != InternalInfixOperandType.INFIX_LEFT_OPERAND) {
- // We are not the left operand, so the stack has the right on the top, followed by the left.
- right = popExpression();
- rightType = popExpressionType(false);
- }
-
- Object value = popExpression();
- Class valueType = popExpressionType(false);
-
- switch (operator.getValue()) {
- case InfixOperator.IN_AND_VALUE:
- if (operandType == InternalInfixOperandType.INFIX_LEFT_OPERAND)
- break; // Do nothing with first operand
-
- testValidBitType(valueType, InfixOperator.IN_AND);
- testValidBitType(rightType, InfixOperator.IN_AND);
- if (valueType == Long.TYPE || rightType == Long.TYPE) {
- // If either side is long, the result will be long.
- value = new Long(getLong(value) & getLong(right));
- valueType = Long.TYPE;
- } else {
- // Else it is int. (even two shorts together produce an int).
- value = new Integer(getInt(value) & getInt(right));
- valueType = Integer.TYPE;
- }
- break;
- case InfixOperator.IN_CONDITIONAL_AND_VALUE:
- // This is tricky.
- // First if this is left type, then just continue.
- // Else if this other or last, then need to make it the new value.
- if (operandType != InternalInfixOperandType.INFIX_LEFT_OPERAND) {
- value = right;
- valueType = rightType;
- }
-
- //If the value is now false, we need to ignore the rest.
- if (valueType != Boolean.TYPE)
- throwInvalidInfix(operator, value);
- if (!((Boolean) value).booleanValue() && operandType != InternalInfixOperandType.INFIX_LAST_OPERAND)
- startInfixIgnore(); // Start ignoring because we know the value of the expression at this point. It is false.
- break;
- case InfixOperator.IN_CONDITIONAL_OR_VALUE:
- // This is tricky.
- // First if this is left type, then just continue.
- // Else if this other or last, then need to make it the new value.
- if (operandType != InternalInfixOperandType.INFIX_LEFT_OPERAND) {
- value = right;
- valueType = rightType;
- }
-
- //If the value is now true, we need to ignore the rest.
- if (valueType != Boolean.TYPE)
- throwInvalidInfix(operator, value);
- if (((Boolean) value).booleanValue() && operandType != InternalInfixOperandType.INFIX_LAST_OPERAND)
- startInfixIgnore(); // Start ignoring because we know the value of the expression at this point. It is true.
- break;
- case InfixOperator.IN_DIVIDE_VALUE:
- if (operandType == InternalInfixOperandType.INFIX_LEFT_OPERAND)
- break; // Do nothing with first operand
-
- testValidArithmeticType(valueType, InfixOperator.IN_DIVIDE);
- testValidArithmeticType(rightType, InfixOperator.IN_DIVIDE);
- if (valueType == Double.TYPE || rightType == Double.TYPE) {
- // If either side is double, the result will be double.
- value = new Double(getDouble(value) / getDouble(right));
- valueType = Double.TYPE;
- } else if (valueType == Float.TYPE || rightType == Float.TYPE) {
- // If either side is float, the result will be float.
- value = new Float(getFloat(value) / getFloat(right));
- valueType = Float.TYPE;
- } else if (valueType == Long.TYPE || rightType == Long.TYPE) {
- // If either side is long, the result will be long.
- value = new Long(getLong(value) / getLong(right));
- valueType = Long.TYPE;
- } else {
- // Else it will result in an int, even if both sides are short.
- value = new Integer(getInt(value) / getInt(right));
- valueType = Integer.TYPE;
- }
- break;
- case InfixOperator.IN_EQUALS_VALUE:
- if (operandType == InternalInfixOperandType.INFIX_LEFT_OPERAND)
- break; // Do nothing with first operand
- // We should never get extended operator for this, but we'll ignore the possibility.
- if (valueType.isPrimitive() && rightType.isPrimitive()) {
- // Primitives require more testing than just ==. boolean primitives
- if (valueType == Boolean.TYPE || rightType == Boolean.TYPE) {
- // If either side is a boolean, then the other side needs to be boolean for it to even try to be true.
- if (valueType != Boolean.TYPE || valueType != Boolean.TYPE)
- value = Boolean.FALSE;
- else
- value = (((Boolean) value).booleanValue() == ((Boolean) right).booleanValue()) ? Boolean.TRUE : Boolean.FALSE;
- } else {
- // Now do number tests since not boolean primitive, only numbers are left
- if (valueType == Double.TYPE || rightType == Double.TYPE) {
- // If either side is double, compare as double.
- value = (getDouble(value) == getDouble(right)) ? Boolean.TRUE : Boolean.FALSE;
- } else if (valueType == Float.TYPE || rightType == Float.TYPE) {
- // If either side is float, compare as float.
- value = (getFloat(value) == getFloat(right)) ? Boolean.TRUE : Boolean.FALSE;
- } else if (valueType == Long.TYPE || rightType == Long.TYPE) {
- // If either side is long, the compare as long.
- value = (getLong(value) == getLong(right)) ? Boolean.TRUE : Boolean.FALSE;
- } else {
- // Else it will compare as int, even if both sides are short.
- value = (getInt(value) == getInt(right)) ? Boolean.TRUE : Boolean.FALSE;
- }
- }
- } else if (valueType.isPrimitive() || rightType.isPrimitive())
- value = Boolean.FALSE; // Can't be true if one side prim and the other isn't
- else {
- // Just do object ==
- value = (value == right) ? Boolean.TRUE : Boolean.FALSE;
- }
- valueType = Boolean.TYPE; // We know result will be a boolean.
- break;
- case InfixOperator.IN_GREATER_VALUE:
- if (operandType == InternalInfixOperandType.INFIX_LEFT_OPERAND)
- break; // Do nothing with first operand
-
- testValidArithmeticType(valueType, InfixOperator.IN_GREATER);
- testValidArithmeticType(rightType, InfixOperator.IN_GREATER);
- if (valueType == Double.TYPE || rightType == Double.TYPE) {
- // If either side is double, compare will be double.
- value = (getDouble(value) > getDouble(right)) ? Boolean.TRUE : Boolean.FALSE;
- } else if (valueType == Float.TYPE || rightType == Float.TYPE) {
- // If either side is float, compare will be float.
- value = (getFloat(value) > getFloat(right)) ? Boolean.TRUE : Boolean.FALSE;
- } else if (valueType == Long.TYPE || rightType == Long.TYPE) {
- // If either side is long, compare will be long.
- value = (getLong(value) > getLong(right)) ? Boolean.TRUE : Boolean.FALSE;
- } else {
- // Else compare will be int, even if both sides are short.
- value = (getInt(value) > getInt(right)) ? Boolean.TRUE : Boolean.FALSE;
- }
- valueType = Boolean.TYPE; // We know result will be a boolean.
- break;
- case InfixOperator.IN_GREATER_EQUALS_VALUE:
- if (operandType == InternalInfixOperandType.INFIX_LEFT_OPERAND)
- break; // Do nothing with first operand
-
- testValidArithmeticType(valueType, InfixOperator.IN_GREATER_EQUALS);
- testValidArithmeticType(rightType, InfixOperator.IN_GREATER_EQUALS);
- if (valueType == Double.TYPE || rightType == Double.TYPE) {
- // If either side is double, compare will be double.
- value = (getDouble(value) >= getDouble(right)) ? Boolean.TRUE : Boolean.FALSE;
- } else if (valueType == Float.TYPE || rightType == Float.TYPE) {
- // If either side is float, compare will be float.
- value = (getFloat(value) >= getFloat(right)) ? Boolean.TRUE : Boolean.FALSE;
- } else if (valueType == Long.TYPE || rightType == Long.TYPE) {
- // If either side is long, compare will be long.
- value = (getLong(value) >= getLong(right)) ? Boolean.TRUE : Boolean.FALSE;
- } else {
- // Else compare will be int, even if both sides are short.
- value = (getInt(value) >= getInt(right)) ? Boolean.TRUE : Boolean.FALSE;
- }
- valueType = Boolean.TYPE; // We know result will be a boolean.
- break;
- case InfixOperator.IN_LEFT_SHIFT_VALUE:
- if (operandType == InternalInfixOperandType.INFIX_LEFT_OPERAND)
- break; // Do nothing with first operand
-
- testValidBitType(valueType, InfixOperator.IN_LEFT_SHIFT);
- testValidBitType(rightType, InfixOperator.IN_LEFT_SHIFT);
- if (valueType == Long.TYPE || rightType == Long.TYPE) {
- // If either side is long, the result will be long.
- value = new Long(getLong(value) << getLong(right));
- valueType = Long.TYPE;
- } else {
- // Else it is int. (even two shorts together produce an int).
- value = new Integer(getInt(value) << getInt(right));
- valueType = Integer.TYPE;
- }
- break;
- case InfixOperator.IN_LESS_VALUE:
- if (operandType == InternalInfixOperandType.INFIX_LEFT_OPERAND)
- break; // Do nothing with first operand
-
- testValidArithmeticType(valueType, InfixOperator.IN_LESS);
- testValidArithmeticType(rightType, InfixOperator.IN_LESS);
- if (valueType == Double.TYPE || rightType == Double.TYPE) {
- // If either side is double, compare will be double.
- value = (getDouble(value) < getDouble(right)) ? Boolean.TRUE : Boolean.FALSE;
- } else if (valueType == Float.TYPE || rightType == Float.TYPE) {
- // If either side is float, compare will be float.
- value = (getFloat(value) < getFloat(right)) ? Boolean.TRUE : Boolean.FALSE;
- } else if (valueType == Long.TYPE || rightType == Long.TYPE) {
- // If either side is long, compare will be long.
- value = (getLong(value) < getLong(right)) ? Boolean.TRUE : Boolean.FALSE;
- } else {
- // Else compare will be int, even if both sides are short.
- value = (getInt(value) < getInt(right)) ? Boolean.TRUE : Boolean.FALSE;
- }
- valueType = Boolean.TYPE; // We know result will be a boolean.
- break;
- case InfixOperator.IN_LESS_EQUALS_VALUE:
- if (operandType == InternalInfixOperandType.INFIX_LEFT_OPERAND)
- break; // Do nothing with first operand
-
- testValidArithmeticType(valueType, InfixOperator.IN_LESS_EQUALS);
- testValidArithmeticType(rightType, InfixOperator.IN_LESS_EQUALS);
- if (valueType == Double.TYPE || rightType == Double.TYPE) {
- // If either side is double, compare will be double.
- value = (getDouble(value) <= getDouble(right)) ? Boolean.TRUE : Boolean.FALSE;
- } else if (valueType == Float.TYPE || rightType == Float.TYPE) {
- // If either side is float, compare will be float.
- value = (getFloat(value) <= getFloat(right)) ? Boolean.TRUE : Boolean.FALSE;
- } else if (valueType == Long.TYPE || rightType == Long.TYPE) {
- // If either side is long, compare will be long.
- value = (getLong(value) <= getLong(right)) ? Boolean.TRUE : Boolean.FALSE;
- } else {
- // Else compare will be int, even if both sides are short.
- value = (getInt(value) <= getInt(right)) ? Boolean.TRUE : Boolean.FALSE;
- }
- valueType = Boolean.TYPE; // We know result will be a boolean.
- break;
- case InfixOperator.IN_MINUS_VALUE:
- if (operandType == InternalInfixOperandType.INFIX_LEFT_OPERAND)
- break; // Do nothing with first operand
-
- testValidArithmeticType(valueType, InfixOperator.IN_MINUS);
- testValidArithmeticType(rightType, InfixOperator.IN_MINUS);
- if (valueType == Double.TYPE || rightType == Double.TYPE) {
- // If either side is double, the result will be double.
- value = new Double(getDouble(value) - getDouble(right));
- valueType = Double.TYPE;
- } else if (valueType == Float.TYPE || rightType == Float.TYPE) {
- // If either side is float, the result will be float.
- value = new Float(getFloat(value) - getFloat(right));
- valueType = Float.TYPE;
- } else if (valueType == Long.TYPE || rightType == Long.TYPE) {
- // If either side is long, the result will be long.
- value = new Long(getLong(value) - getLong(right));
- valueType = Long.TYPE;
- } else {
- // Else it will result in an int, even if both sides are short.
- value = new Integer(getInt(value) - getInt(right));
- valueType = Integer.TYPE;
- }
- break;
- case InfixOperator.IN_NOT_EQUALS_VALUE:
- if (operandType == InternalInfixOperandType.INFIX_LEFT_OPERAND)
- break; // Do nothing with first operand
- // We should never get extended operator for this, but we'll ignore the possibility.
- if (valueType.isPrimitive() && rightType.isPrimitive()) {
- // Primitives require more testing than just ==. boolean primitives
- if (valueType == Boolean.TYPE || rightType == Boolean.TYPE) {
- // If either side is a boolean, then the other side needs to be boolean for it to even try to be true.
- if (valueType != Boolean.TYPE || valueType != Boolean.TYPE)
- value = Boolean.TRUE;
- else
- value = (((Boolean) value).booleanValue() != ((Boolean) right).booleanValue()) ? Boolean.TRUE : Boolean.FALSE;
- } else {
- // Now do number tests since not boolean primitive, only numbers are left
- if (valueType == Double.TYPE || rightType == Double.TYPE) {
- // If either side is double, compare as double.
- value = (getDouble(value) != getDouble(right)) ? Boolean.TRUE : Boolean.FALSE;
- } else if (valueType == Float.TYPE || rightType == Float.TYPE) {
- // If either side is float, compare as float.
- value = (getFloat(value) != getFloat(right)) ? Boolean.TRUE : Boolean.FALSE;
- } else if (valueType == Long.TYPE || rightType == Long.TYPE) {
- // If either side is long, the compare as long.
- value = (getLong(value) != getLong(right)) ? Boolean.TRUE : Boolean.FALSE;
- } else {
- // Else it will compare as int, even if both sides are short.
- value = (getInt(value) != getInt(right)) ? Boolean.TRUE : Boolean.FALSE;
- }
- }
- } else if (valueType.isPrimitive() || rightType.isPrimitive())
- value = Boolean.TRUE; // Must be true if one side prim and the other isn't
- else {
- // Just do object !=
- value = (value != right) ? Boolean.TRUE : Boolean.FALSE;
- }
- valueType = Boolean.TYPE; // We know result will be a boolean.
- break;
- case InfixOperator.IN_OR_VALUE:
- if (operandType == InternalInfixOperandType.INFIX_LEFT_OPERAND)
- break; // Do nothing with first operand
-
- testValidBitType(valueType, InfixOperator.IN_OR);
- testValidBitType(rightType, InfixOperator.IN_OR);
- if (valueType == Long.TYPE || rightType == Long.TYPE) {
- // If either side is long, the result will be long.
- value = new Long(getLong(value) | getLong(right));
- valueType = Long.TYPE;
- } else {
- // Else it is int. (even two shorts together produce an int).
- value = new Integer(getInt(value) | getInt(right));
- valueType = Integer.TYPE;
- }
- break;
- case InfixOperator.IN_PLUS_VALUE:
- if (operandType == InternalInfixOperandType.INFIX_LEFT_OPERAND) {
- if (valueType == String.class) {
- // Special. left argument is a string, so we want to store a string buffer instead
- // since we know we will be appending to it.
- value = new StringBuffer((String) value);
- }
- break; // Do nothing with first operand
- }
-
- testValidPlusType(valueType, rightType);
- if (valueType == String.class || rightType == String.class) {
- // Special we have a string on one side. Need to do it as strings instead.
- // We are going to be tricky in that we will store a StringBuffer on the stack (if not last operand)
- // but call it a string.
- StringBuffer sb = null;
- if (valueType == String.class) {
- sb = (StringBuffer) value; // We know that if the value (left) is string type, we've already converted it to buffer.
- } else {
- // The right is the one that introduces the string, so we change the value over to a string buffer.
- sb = new StringBuffer(((String) right).length()+16); // We can't put the value in yet, need to get left into it.
- appendToBuffer(sb, value, valueType); // Put the left value in now
- value = sb;
- valueType = String.class; // Make it a string class
- }
- appendToBuffer(sb, right, rightType);
- // Now if we are the last operand, we should get rid of the buffer and put a true string back in.
- if (operandType == InternalInfixOperandType.INFIX_LAST_OPERAND)
- value = sb.toString();
- } else if (valueType == Double.TYPE || rightType == Double.TYPE) {
- // If either side is double, the result will be double.
- value = new Double(getDouble(value) + getDouble(right));
- valueType = Double.TYPE;
- } else if (valueType == Float.TYPE || rightType == Float.TYPE) {
- // If either side is float, the result will be float.
- value = new Float(getFloat(value) + getFloat(right));
- valueType = Float.TYPE;
- } else if (valueType == Long.TYPE || rightType == Long.TYPE) {
- // If either side is long, the result will be long.
- value = new Long(getLong(value) + getLong(right));
- valueType = Long.TYPE;
- } else {
- // Else it will result in an int, even if both sides are short.
- value = new Integer(getInt(value) + getInt(right));
- valueType = Integer.TYPE;
- }
- break;
- case InfixOperator.IN_REMAINDER_VALUE:
- if (operandType == InternalInfixOperandType.INFIX_LEFT_OPERAND)
- break; // Do nothing with first operand
-
- testValidArithmeticType(valueType, InfixOperator.IN_REMAINDER);
- testValidArithmeticType(rightType, InfixOperator.IN_REMAINDER);
- if (valueType == Double.TYPE || rightType == Double.TYPE) {
- // If either side is double, the result will be double.
- value = new Double(getDouble(value) % getDouble(right));
- valueType = Double.TYPE;
- } else if (valueType == Float.TYPE || rightType == Float.TYPE) {
- // If either side is float, the result will be float.
- value = new Float(getFloat(value) % getFloat(right));
- valueType = Float.TYPE;
- } else if (valueType == Long.TYPE || rightType == Long.TYPE) {
- // If either side is long, the result will be long.
- value = new Long(getLong(value) % getLong(right));
- valueType = Long.TYPE;
- } else {
- // Else it will result in an int, even if both sides are short.
- value = new Integer(getInt(value) % getInt(right));
- valueType = Integer.TYPE;
- }
- break;
- case InfixOperator.IN_RIGHT_SHIFT_SIGNED_VALUE:
- if (operandType == InternalInfixOperandType.INFIX_LEFT_OPERAND)
- break; // Do nothing with first operand
-
- testValidBitType(valueType, InfixOperator.IN_RIGHT_SHIFT_SIGNED);
- testValidBitType(rightType, InfixOperator.IN_RIGHT_SHIFT_SIGNED);
- if (valueType == Long.TYPE || rightType == Long.TYPE) {
- // If either side is long, the result will be long.
- value = new Long(getLong(value) >> getLong(right));
- valueType = Long.TYPE;
- } else {
- // Else it is int. (even two shorts together produce an int).
- value = new Integer(getInt(value) >> getInt(right));
- valueType = Integer.TYPE;
- }
- break;
- case InfixOperator.IN_RIGHT_SHIFT_UNSIGNED_VALUE:
- if (operandType == InternalInfixOperandType.INFIX_LEFT_OPERAND)
- break; // Do nothing with first operand
-
- testValidBitType(valueType, InfixOperator.IN_RIGHT_SHIFT_UNSIGNED);
- testValidBitType(rightType, InfixOperator.IN_RIGHT_SHIFT_UNSIGNED);
- if (valueType == Long.TYPE || rightType == Long.TYPE) {
- // If either side is long, the result will be long.
- value = new Long(getLong(value) >>> getLong(right));
- valueType = Long.TYPE;
- } else {
- // Else it is int. (even two shorts together produce an int).
- value = new Integer(getInt(value) >>> getInt(right));
- valueType = Integer.TYPE;
- }
- break;
- case InfixOperator.IN_TIMES_VALUE:
- if (operandType == InternalInfixOperandType.INFIX_LEFT_OPERAND)
- break; // Do nothing with first operand
-
- testValidArithmeticType(valueType, InfixOperator.IN_TIMES);
- testValidArithmeticType(rightType, InfixOperator.IN_TIMES);
- if (valueType == Double.TYPE || rightType == Double.TYPE) {
- // If either side is double, the result will be double.
- value = new Double(getDouble(value) * getDouble(right));
- valueType = Double.TYPE;
- } else if (valueType == Float.TYPE || rightType == Float.TYPE) {
- // If either side is float, the result will be float.
- value = new Float(getFloat(value) * getFloat(right));
- valueType = Float.TYPE;
- } else if (valueType == Long.TYPE || rightType == Long.TYPE) {
- // If either side is long, the result will be long.
- value = new Long(getLong(value) * getLong(right));
- valueType = Long.TYPE;
- } else {
- // Else it will result in an int, even if both sides are short.
- value = new Integer(getInt(value) * getInt(right));
- valueType = Integer.TYPE;
- }
- break;
- case InfixOperator.IN_XOR_VALUE:
- if (operandType == InternalInfixOperandType.INFIX_LEFT_OPERAND)
- break; // Do nothing with first operand
-
- testValidBitType(valueType, InfixOperator.IN_XOR);
- testValidBitType(rightType, InfixOperator.IN_XOR);
- if (valueType == Long.TYPE || rightType == Long.TYPE) {
- // If either side is long, the result will be long.
- value = new Long(getLong(value) ^ getLong(right));
- valueType = Long.TYPE;
- } else {
- // Else it is int. (even two shorts together produce an int).
- value = new Integer(getInt(value) ^ getInt(right));
- valueType = Integer.TYPE;
- }
- break;
- }
-
- if (traceOn)
- printObjectAndType(value, valueType);
- pushExpressionValue(value, valueType); // Push the result back on the stack.
-
- } catch (IllegalArgumentException e) {
- processException(e);
- } catch (NoExpressionValueException e) {
- processException(e);
- } catch (RuntimeException e) {
- processException(e);
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
-
- }
-
- /**
- * Start ignoring rest of the current infix expression.
- *
- * @since 1.1.0
- */
- private void startInfixIgnore() {
- ignoreExpression = INFIX_IGNORE;
- infixIgnoreNestCount = infixNesting; // Ignore until we get back to the current nesting.
-
- }
-
- /**
- * Get int value of the primitive wrapper bean passed in (must be either a <code>Number/code> or <code>Character</code>.
- * Anything else will cause a class cast error.
- * <p>
- * This is a helper method for expression processer to get the int value of the object. Since it is a helper method it doesn't
- * check nor process the exception. It throws it. Callers must handle it as they see fit.
- * @param bean
- * @return the int value of the number/character
- * @throws ClassCastException
- *
- * @since 1.0.0
- */
- protected final int getInt(Object bean) throws ClassCastException {
- return (bean instanceof Number) ? ((Number) bean).intValue() : ((Character) bean).charValue();
- }
-
- /**
- * Get float value of the primitive wrapper bean passed in (must be either a <code>Number/code> or <code>Character</code>.
- * Anything else will cause a class cast error.
- * <p>
- * This is a helper method for expression processer to get the float value of the object. Since it is a helper method it doesn't
- * check nor process the exception. It throws it. Callers must handle it as they see fit.
- * @param bean
- * @return float value of the Number/character
- * @throws ClassCastException
- * @since 1.0.0
- */
- protected final float getFloat(Object bean) throws ClassCastException {
- return (bean instanceof Number) ? ((Number) bean).floatValue() : ((Character) bean).charValue();
- }
-
- /**
- * Get double value of the primitive wrapper bean passed in (must be either a <code>Number/code> or <code>Character</code>.
- * Anything else will cause a class cast error.
- * <p>
- * This is a helper method for expression processer to get the float value of the object. Since it is a helper method it doesn't
- * check nor process the exception. It throws it. Callers must handle it as they see fit.
- *
- * @param bean
- * @return double value of the Number/Character.
- * @throws ClassCastException
- * @since 1.0.0
- */
- protected final double getDouble(Object bean) throws ClassCastException {
- return (bean instanceof Number) ? ((Number) bean).doubleValue() : ((Character) bean).charValue();
- }
-
- /**
- * Get long value of the primitive wrapper bean passed in (must be either a <code>Number/code> or <code>Character</code>.
- * Anything else will cause a class cast error.
- * <p>
- * This is a helper method for expression processer to get the float value of the object. Since it is a helper method it doesn't
- * check nor process the exception. It throws it. Callers must handle it as they see fit.
- *
- * @param bean
- * @return
- * @throws ClassCastException
- * @since 1.0.0
- */
- protected final long getLong(Object bean) throws ClassCastException {
- return (bean instanceof Number) ? ((Number) bean).longValue() : ((Character) bean).charValue();
- }
-
- private void throwInvalidInfix(InfixOperator operator, Object value) throws IllegalArgumentException {
- throw new IllegalArgumentException(MessageFormat.format(InitparserTreeMessages.getString("ExpressionProcesser.InvalidOperandOfOperator_EXC_"), new Object[] {value != null ? value.toString() : null, operator.toString()})); //$NON-NLS-1$
- }
-
- private void testValidBitType(Class type, InfixOperator operator) {
- if (!type.isPrimitive() || type == Boolean.TYPE || type == Double.TYPE|| type == Float.TYPE)
- throwInvalidInfix(operator, type);
- }
-
- private void testValidArithmeticType(Class type, InfixOperator operator) {
- if (!type.isPrimitive() || type == Boolean.TYPE)
- throwInvalidInfix(operator, type);
- }
-
- private void testValidPlusType(Class left, Class right) {
- // Plus is special in that string objects are also valid.
- if (left == String.class || right == String.class)
- return; // As long as one side is string. Anything is valid.
- // If neither is string, then standard arithmetic test.
- testValidArithmeticType(left, InfixOperator.IN_PLUS);
- testValidArithmeticType(right, InfixOperator.IN_PLUS);
- }
-
- private void appendToBuffer(StringBuffer sb, Object value, Class valueType) {
- if (value == null)
- sb.append((Object)null);
- else if (valueType == String.class)
- sb.append((String) value);
- else if (valueType.isPrimitive()) {
- switch (getEnumForPrimitive(valueType)) {
- case BOOLEAN:
- sb.append(((Boolean) value).booleanValue());
- break;
- case BYTE:
- sb.append(((Number) value).byteValue());
- break;
- case CHAR:
- sb.append(((Character) value).charValue());
- break;
- case DOUBLE:
- sb.append(((Number) value).doubleValue());
- break;
- case FLOAT:
- sb.append(((Number) value).floatValue());
- break;
- case INT:
- sb.append(((Number) value).intValue());
- break;
- case LONG:
- sb.append(((Number) value).longValue());
- break;
- case SHORT:
- sb.append(((Number) value).shortValue());
- break;
- }
- } else {
- // Just an object.
- sb.append(value);
- }
- }
-
- /**
- * Push the array access expression.
- *
- * @param indexCount Number of dimensions being accessed
- * @since 1.0.0
- */
- public final void pushArrayAccess(int indexCount) {
- boolean ignore = (ignoreExpression != null || errorOccurred);
-
- if (traceOn) {
- printTrace("Array Access["+indexCount+']', ignore); //$NON-NLS-1$
- }
- try {
- if (ignore)
- return;
-
- try {
- // We need to pop off the args. The topmost will be the rightmost index, and the bottom most will be the array itself.
- int[] arguments = new int[indexCount];
- // Fill the arg array in reverse order.
- for(int i=indexCount-1; i >= 0; i--) {
- Object index = popExpression();
- Class indexType = popExpressionType(false);
- if (indexType.isPrimitive() && (indexType == Integer.TYPE || indexType == Short.TYPE || indexType == Character.TYPE || indexType == Byte.TYPE)) {
- arguments[i] = getInt(index);
- } else
- throwClassCast(Integer.TYPE, index);
- }
-
- Object array = popExpression();
- Class arrayType = popExpressionType(false);
- if (arrayType.isArray()) {
- // First figure out how many dimensions are available. Stop when we hit indexcount because we won't be going further.
- int dimcount = 0;
- Class[] componentTypes = new Class[indexCount]; //
- Class componentType = arrayType;
- while (dimcount < indexCount && componentType.isArray()) {
- componentTypes[dimcount++] = componentType = componentType.getComponentType();
- }
-
- if (dimcount < indexCount)
- throw new IllegalArgumentException(MessageFormat.format(InitparserTreeMessages.getString("ExpressionProcesser.XIsGreaterThanNumberOfDimensionsInArray_EXC_"), new Object[] {new Integer(indexCount), new Integer(dimcount)})); //$NON-NLS-1$
-
- // Now start accessing one index at a time, stop just before the last one. The last one will be turned into an ArrayAccessReference.
- Object value = array; // Final value, start with full array.
- int pullCount = indexCount-1;
- for(int i=0; i<pullCount; i++) {
- value = Array.get(value, arguments[i]);
- }
- ArrayAccessReference arrayValue = ArrayAccessReference.createArrayAccessReference(value, arguments[pullCount]);
- if (traceOn)
- printObjectAndType(arrayValue, componentTypes[pullCount]);
- pushExpressionValue(arrayValue, componentTypes[pullCount]);
- } else
- throw new IllegalArgumentException(MessageFormat.format(InitparserTreeMessages.getString("ExpressionProcesser.NotAnArray_EXC_"), new Object[] {arrayType})); //$NON-NLS-1$
-
- } catch (NoExpressionValueException e) {
- processException(e);
- } catch (RuntimeException e) {
- processException(e);
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
- /**
- * Push the array creation request.
- *
- * @param arrayType The type of the array
- * @param dimensionCount The number of dimensions being initialized. Zero if using an initializer.
- * @since 1.0.0
- */
- public final void pushArrayCreation(Class arrayType, int dimensionCount) {
- boolean ignore = (ignoreExpression != null || errorOccurred);
- if (traceOn)
- printTrace("Array Creation: "+arrayType.getName()+'['+dimensionCount+']', ignore); //$NON-NLS-1$
-
- try {
- if (ignore)
- return;
-
- try {
- if (dimensionCount == 0) {
- // The top value is the array itself, from the array initializer.
- // So we do nothing.
- } else {
- // Strip off dimensionCounts from the array type, e.g.
- // ArrayType is int[][][]
- // Dimensioncount is 2
- // Then we need to strip two componenttypes off of the array type
- // wind up with int[]
- // This is necessary because Array.new will add those dimensions back
- // on through the dimension count.
- Class componentType = arrayType;
- for(int i=0; i < dimensionCount && componentType != null; i++)
- componentType = componentType.getComponentType();
- if (componentType == null)
- throw new IllegalArgumentException(MessageFormat.format(InitparserTreeMessages.getString("ExpressionProcesser.ArraytypeHasFewerDimensionsThanRequested_EXC_"), new Object[] {arrayType, new Integer(dimensionCount)})); //$NON-NLS-1$
-
- // We need to pull in the dimension initializers. They are stacked in reverse order.
- int[] dimInit = new int[dimensionCount];
- for(int i=dimensionCount-1; i >= 0; i--) {
- Object index = popExpression();
- Class dimType = popExpressionType(false);
- if (dimType.isPrimitive() && (dimType == Integer.TYPE || dimType == Short.TYPE || dimType == Character.TYPE || dimType == Byte.TYPE)) {
- dimInit[i] = getInt(index);
- } else
- throwClassCast(Integer.TYPE, index);
- }
-
- // Finally create the array.
- Object array = Array.newInstance(componentType, dimInit);
- pushExpressionValue(array, arrayType);
- }
- } catch (RuntimeException e) {
- processException(e);
- } catch (NoExpressionValueException e) {
- processException(e);
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
-
- }
-
- /**
- * Push the array initializer request.
- *
- * @param arrayType The original type of the array to create.
- * @param stripCount the count of how many dimensions to strip to get the type needed for this initializer.
- * @param expressionCount
- * @since 1.0.0
- */
- public final void pushArrayInitializer(Class arrayType, int stripCount, int expressionCount) {
- boolean ignore = (ignoreExpression != null || errorOccurred);
-
- if (traceOn)
- printTrace("Initialize Array: "+arrayType.getName()+'{'+expressionCount+'}', ignore); //$NON-NLS-1$
-
- try {
- if (ignore)
- return;
-
- try {
- if (!arrayType.isArray()) {
- // It is not an array type.
- throw new ClassCastException(MessageFormat.format(InitparserTreeMessages.getString("ExpressionProcesser.CannotCastXToY_EXC_"), new Object[] {arrayType, "array"})); //$NON-NLS-1$ //$NON-NLS-2$
- }
- // Strip off the number of dimensions specified.
- while(stripCount-->0) {
- arrayType = arrayType.getComponentType();
- }
- Object[] dimValues = null;
- if (expressionCount > 0) {
- // We need to pull in the initializers. They are stacked in reverse order.
- dimValues = new Object[expressionCount];
- for (int i = expressionCount - 1; i >= 0; i--) {
- Object dimValue = dimValues[i] = popExpression();
- Class dimType = popExpressionType(false);
- if (arrayType.isPrimitive()) {
- if (dimValue == null || !dimType.isPrimitive())
- throwClassCast(arrayType, dimType);
- // A little trickier. Can assign short to an int, but can't assign long to an int. Widening is permitted.
- if (arrayType != dimType) {
- int compEnum = getEnumForPrimitive(arrayType);
- int dimEnum = getEnumForPrimitive(dimType);
- if (compEnum == BOOLEAN || dimEnum == BOOLEAN)
- throwClassCast(arrayType, dimType);
- int dimValueAsInt = getInt(dimValue);
- switch (compEnum) {
- case BYTE :
- // Can accept byte, short, char, or int as long as value is <= byte max. Can't accept long, double, float at all.
- // Note: This isn't actually true. The max/min test is only valid if the value is a literal, not an expression,
- // however, at this point in time we no longer know this. So we will simply allow it.
- if (dimEnum > INT || dimValueAsInt > Byte.MAX_VALUE || dimValueAsInt < Byte.MIN_VALUE)
- throwClassCast(arrayType, dimType);
- // But need to be changed to appropriate type for the array.set to work.
- dimValues[i] = new Byte((byte)dimValueAsInt);
- break;
- case SHORT :
- // Can accept byte, short, char, or int as long as value is <= byte max. Can't accept long, double, float at all.
- // Note: This isn't actually true. The max/min test is only valid if the value is a literal, not an expression,
- // however, at this point in time we no longer know this. So we will simply allow it.
- if (dimEnum > INT || dimValueAsInt > Short.MAX_VALUE || dimValueAsInt < Short.MIN_VALUE)
- throwClassCast(arrayType, dimType);
- // But need to be changed to appropriate type for the array.set to work.
- dimValues[i] = new Short((short)dimValueAsInt);
- break;
- case CHAR :
- // Can accept byte, short, char, or int as long as value is <= byte max. Can't accept long, double, float at all.
- // Note: This isn't actually true. The max/min test is only valid if the value is a literal, not an expression,
- // however, at this point in time we no longer know this. So we will simply allow it.
- if (dimEnum > INT || dimValueAsInt > Character.MAX_VALUE || dimValueAsInt < Character.MIN_VALUE)
- throwClassCast(arrayType, dimType);
- // But need to be changed to appropriate type for the array.set to work.
- dimValues[i] = new Character((char)dimValueAsInt);
- break;
- case INT :
- // Can accept byte, short, char, or int. Can't accept long, double, float at all.
- if (dimEnum > INT)
- throwClassCast(arrayType, dimType);
- // But need to be changed to appropriate type for the array.set to work.
- dimValues[i] = new Integer(dimValueAsInt);
- break;
- case LONG :
- // Can accept byte, short, char, int, or long. Can't accept double, float at all.
- if (dimEnum > LONG)
- throwClassCast(arrayType, dimType);
- // But need to be changed to appropriate type for the array.set to work.
- dimValues[i] = new Long(getLong(dimValue));
- break;
- case FLOAT :
- // Can accept byte, short, char, int, long, or float. Can't accept double at all.
- if (dimEnum > FLOAT)
- throwClassCast(arrayType, dimType);
- // But need to be changed to appropriate type for the array.set to work.
- dimValues[i] = new Float(getFloat(dimValue));
- break;
- case DOUBLE :
- // But need to be changed to appropriate type for the array.set to work.
- dimValues[i] = new Double(getDouble(dimValue));
- break;
-
- }
- }
- // Compatible, so ok.
- } else if (dimType != MethodHelper.NULL_TYPE && !arrayType.isAssignableFrom(dimType)) {
- // If it is NULL_TYPE, then this is a pushed null. This is always assignable to a non-primitive.
- // So we don't enter here in that case. However, a null that was returned from some expression
- // won't have a NULL_TYPE, it will instead have the expected return type. That must be used
- // in the assignment instead. That is because in java it uses the expected type to determine
- // compatibility, not the actual type.
- throwClassCast(arrayType, dimType);
- }
- }
-
- }
-
- // Now we finally create the array.
- Object array = Array.newInstance(arrayType, new int[] {expressionCount});
- for (int i = 0; i < expressionCount; i++) {
- Array.set(array, i, dimValues[i]);
- }
-
- pushExpressionValue(array, array.getClass()); // Adjust to true array type, not the incoming type (which is one dimension too small).
-
- } catch (RuntimeException e) {
- processException(e);
- } catch (NoExpressionValueException e) {
- processException(e);
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
-
- }
-
- /**
- * Push the class instance creation request.
- *
- * @param type The type to create an instance of
- * @param argumentCount The number of arguments (which are stored on the stack). * @throws NoExpressionValueException
- * @since 1.0.0
- */
- public final void pushClassInstanceCreation(Class type, int argumentCount) {
- boolean ignore = (ignoreExpression != null || errorOccurred);
-
- if (traceOn)
- printTrace("Create Class: "+type+" (", ignore); //$NON-NLS-1$ //$NON-NLS-2$
- try {
- if (ignore)
- return;
-
- try {
- // We need to pull in the arguments. They are stacked in reverse order.
- Object value = null; // The new instance.
- Object[] args = new Object[argumentCount];
- Class[] argTypes = new Class[argumentCount];
- for (int i = argumentCount - 1; i >= 0; i--) {
- args[i] = popExpression();
- argTypes[i] = popExpressionType(false);
- }
-
- // Now we need to find the appropriate constructor.
- Constructor ctor;
- ctor = MethodHelper.findCompatibleConstructor(type, argTypes);
- if (traceOn) {
- if (argumentCount == 0) {
- // No args, just do default ctor.
- System.out.print("Default ctor)"); //$NON-NLS-1$
- } else {
- System.out.print(ctor);
- System.out.print(')');
- }
- }
- value = ctor.newInstance(args);
-
- pushExpressionValue(value, type);
- } catch (RuntimeException e) {
- processException(e);
- } catch (NoExpressionValueException e) {
- processException(e);
- } catch (InstantiationException e) {
- processException(e);
- } catch (IllegalAccessException e) {
- processException(e);
- } catch (InvocationTargetException e) {
- processException(e);
- } catch (NoSuchMethodException e) {
- processException(e);
- } catch (AmbiguousMethodException e) {
- processException(e);
- } catch (LinkageError e) {
- processException(e);
- } catch (Error e) {
- if (e.getClass() == Error.class) {
- // If exactly Error.class, then process it. This is hopefully just a "unresolved compilation error".
- processException(new UnresolvedCompilationError(e));
- } else
- throw e; // All subclasses we throw on out.
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
-
- }
-
- /**
- * Push the field access expression.
- * @param field String for fieldname, or a java.lang.reflect.Field.
- * @param fieldIsString <code>true</code> if field is a string name, and not a java.lang.reflect.Field.
- * @param hasReceiver
- *
- * @since 1.0.0
- */
- public final void pushFieldAccess(Object field, boolean fieldIsString, boolean hasReceiver) {
- try {
- if (ignoreExpression != null || errorOccurred) {
- if (traceOn)
- printTrace("Field Access", true); //$NON-NLS-1$
- return;
- }
-
- if (traceOn)
- printTrace("Field Access: ", false); //$NON-NLS-1$
- try {
- // Get the receiver off of the stack.
- Object receiver = null;
- Class receiverType = null;
- if (hasReceiver) {
- receiver = popExpression();
- receiverType = popExpressionType(false);
- }
-
- // Find the field.
- Field reflectField = fieldIsString ? receiverType.getField((String) field) : (Field) field;
- // Access the field.
- Object value = FieldAccessReference.createFieldAccessReference(reflectField, receiver);
- Class valueType = reflectField.getType();
- if (traceOn) {
- System.out.print("Field: "); //$NON-NLS-1$
- if (fieldIsString)
- System.out.print("(looked up) "); //$NON-NLS-1$
- System.out.print(reflectField);
- System.out.print(">"); //$NON-NLS-1$
- printObjectAndType(value, valueType);
- }
-
- pushExpressionValue(value, valueType);
- } catch (RuntimeException e) {
- processException(e);
- } catch (NoExpressionValueException e) {
- processException(e);
- } catch (NoSuchFieldException e) {
- processException(e);
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
-
- }
-
- /**
- * Push the method invocation expression.
- * @param method
- * @param methodIsString <code>true</code> if method is a string (so string name) or else it is a java.lang.reflect.Method.
- * @param hasReceiver
- * @param argCount
- * @since 1.0.0
- */
- public final void pushMethodInvocation(Object method, boolean methodIsString, boolean hasReceiver, int argCount) {
- try {
- if (ignoreExpression != null || errorOccurred) {
- if (traceOn)
- printTrace("Invoke", true); //$NON-NLS-1$
- return;
- }
-
- if (traceOn)
- printTrace("Invoke: ", false); //$NON-NLS-1$
-
- Method reflectMethod = null;
- try {
- // We need to pull in the arguments. They are stacked in reverse order.
- Object[] args = new Object[argCount];
- Class[] argTypes = new Class[argCount];
- for (int i = argCount - 1; i >= 0; i--) {
- args[i] = popExpression();
- argTypes[i] = popExpressionType(false);
- }
-
- // Now get receiver
- Object receiver = null;
- Class receiverType = null;
- if (hasReceiver) {
- receiver = popExpression();
- receiverType = popExpressionType(false);
- }
-
- // Now we need to find the appropriate method. If it is a string then there must be a receiver, otherwise no way to know.
- if (methodIsString) {
- reflectMethod = MethodHelper.findCompatibleMethod(receiverType, (String) method, argTypes);
- } else
- reflectMethod = (Method) method;
-
- if (traceOn && reflectMethod != null) {
- System.out.print("Method: "); //$NON-NLS-1$
- if (methodIsString)
- System.out.print("(looked up) "); //$NON-NLS-1$
- System.out.print(reflectMethod);
- }
-
- if (!Modifier.isStatic(reflectMethod.getModifiers()) && receiver == null)
- throw new NullPointerException("No receiver for non-static method: "+reflectMethod.toString()); //$NON-NLS-1$
-
- Object value = reflectMethod.invoke(receiver, args);
-
- if (traceOn) {
- System.out.print(" returns: "); //$NON-NLS-1$
- printObjectAndType(value, reflectMethod.getReturnType());
- }
- pushExpressionValue(value, reflectMethod.getReturnType());
- } catch (RuntimeException e) {
- processException(fixUpMethodException(e, reflectMethod));
- } catch (NoExpressionValueException e) {
- processException(fixUpMethodException(e, reflectMethod));
- } catch (IllegalAccessException e) {
- processException(fixUpMethodException(e, reflectMethod));
- } catch (InvocationTargetException e) {
- processException(fixUpMethodException(e.getCause(), reflectMethod));
- } catch (NoSuchMethodException e) {
- processException(e);
- } catch (AmbiguousMethodException e) {
- processException(e);
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
-
- }
-
- /*
- * Many of the exceptions don't add in what method had the error, so we
- * will do that here.
- */
- private Throwable fixUpMethodException(Throwable e, Method method) {
- if (method == null)
- return e;
- try {
- String msg = e.getMessage();
- Constructor eWithStringCtor = e.getClass().getConstructor(new Class[] {String.class});
- String newMsg;
- if (msg == null) {
- newMsg = method.toString();
- } else {
- newMsg = method.toString()+": \""+msg+'\"'; //$NON-NLS-1$
- }
- Exception fixedupE = (Exception) eWithStringCtor.newInstance(new Object[] {newMsg});
- fixedupE.setStackTrace(e.getStackTrace());
- return fixedupE;
- } catch (Exception e1) {
- return e;
- }
-
- }
-
- private static final Object CONDITIONAL_IGNORE = "CONDITIONAL IGNORE"; // Flag for conditional in ingore //$NON-NLS-1$
- private int conditionalNesting = 0; // Nesting of conditional expressions.
- private int conditionalIgnoreNestCount = 0; // When ignoring conditional expressions, ignore until this nest count.
- private boolean skipTruePart;
-
- /**
- * Push a conditional expression. It can be any clause of the conditional (test, true, or false clause).
- * @param expressionType
- *
- * @since 1.0.0
- */
- public final void pushConditional(InternalConditionalOperandType expressionType) {
- try {
- boolean ignore = true;
- try {
- if (errorOccurred)
- return;
- // Slightly different here in that if an ignoring occurred we still need to process at least part of it so that
- // we can get the expression grouping correct.
- switch (expressionType.getValue()) {
- case InternalConditionalOperandType.CONDITIONAL_TEST_VALUE:
- conditionalNesting++;
- break;
- case InternalConditionalOperandType.CONDITIONAL_TRUE_VALUE:
- if (skipTruePart && ignoreExpression == CONDITIONAL_IGNORE && conditionalIgnoreNestCount == conditionalNesting) {
- // stop ignoring, we've ignored the true condition of interest.
- ignoreExpression = null;
- return; // However, leave because since this condition was ignored.
- }
- break;
- case InternalConditionalOperandType.CONDITIONAL_FALSE_VALUE:
- int currentNesting = conditionalNesting--;
- if (ignoreExpression == CONDITIONAL_IGNORE && conditionalIgnoreNestCount == currentNesting) {
- // stop ignoring, we've ignored the false condition of interest.
- ignoreExpression = null;
- return; // However, leave because since this condition was ignored.
- }
- }
-
- if (ignoreExpression != null)
- return;
- ignore = false;
- } finally {
- if (traceOn)
- printTrace("Conditional "+expressionType, ignore); //$NON-NLS-1$
- }
-
- try {
- switch (expressionType.getValue()) {
- case InternalConditionalOperandType.CONDITIONAL_TEST_VALUE:
- Object condition = popExpression();
- Class type = popExpressionType(false);
- if (type != Boolean.TYPE)
- throwClassCast(Boolean.TYPE, condition);
- if (((Boolean) condition).booleanValue()) {
- // Condition was true.
- // Do nothing. Let true condition be processed.
- } else {
- // Condition was false.
- skipTruePart = true; // Tell the true condition should be ignored.
- ignoreExpression = CONDITIONAL_IGNORE;
- conditionalIgnoreNestCount = conditionalNesting;
- }
- // We don't put anything back on the stack because the condition test is not ever returned.
- // The appropriate true or false condition evaluation will be left on the stack.
- break;
- case InternalConditionalOperandType.CONDITIONAL_TRUE_VALUE:
- skipTruePart = false; // Tell the false condition should be ignored.
- ignoreExpression = CONDITIONAL_IGNORE;
- conditionalIgnoreNestCount = conditionalNesting;
- break;
- case InternalConditionalOperandType.CONDITIONAL_FALSE_VALUE:
- // There's nothing to do, if it was ignored due to true, we wouldn't of gotton here.
- // If it wasn't ignored, then the result of the false expression is on the stack, which is what it should be.
- break;
- }
- } catch (RuntimeException e) {
- processException(e);
- } catch (NoExpressionValueException e) {
- processException(e);
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
- private static final Object BLOCK_IGNORE = "BLOCK IGNORE"; //$NON-NLS-1$
- private int[] blocks; // Stack of block numbers currently evaluating.
- private int topBlock = -1; // Top block index.
- private int breakBlock = -1; // Block number we are breaking to.
-
- /**
- * Push a begin block.
- * @param blockNumber
- *
- * @since 1.1.0
- */
- public final void pushBlockBegin(int blockNumber) {
- if (traceOn) {
- printTrace("Begin Block #"+blockNumber, errorOccurred); //$NON-NLS-1$
- indent(true);
- }
- try {
- if (errorOccurred)
- return;
- // We are not checking ignore because this is a structural concept instead of executable expressions, so we need to keep track of these.
- if (blocks == null)
- blocks = new int[10];
- if (++topBlock >= blocks.length) {
- int[] newList = new int[blocks.length*2];
- System.arraycopy(blocks, 0, newList, 0, blocks.length);
- blocks = newList;
- }
- blocks[topBlock] = blockNumber;
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
- /**
- * Push a block end. The current block must be the given number, or it is an error.
- *
- * @param blockNumber
- *
- * @since 1.1.0
- */
- public final void pushBlockEnd(int blockNumber) {
- try {
- if (traceOn) {
- indent(false);
- printTrace("End Block #"+blockNumber, errorOccurred); //$NON-NLS-1$
- }
- if (errorOccurred)
- return;
- // We are not checking ignore because this is a structural concept instead of executable expressions, so we need to keep track of these.
- if (blocks == null || topBlock < 0 || blocks[topBlock] != blockNumber) {
- processSyntaxException(new IllegalStateException(InitparserTreeMessages.getString("ExpressionProcesser.PushBlockEnd.ReceivedEndBlocksOutOfOrder_EXC_"))); //$NON-NLS-1$
- } else {
- topBlock--;
- if (ignoreExpression == BLOCK_IGNORE && blockNumber == breakBlock) {
- ignoreExpression = null;
- }
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
- /**
- * Skip all following until we hit the requested block number.
- * @param blockNumber
- *
- * @since 1.1.0
- */
- public final void pushBlockBreak(int blockNumber) {
- try {
- if (traceOn)
- printTrace("Break Block #"+blockNumber, errorOccurred); //$NON-NLS-1$
- if (errorOccurred)
- return;
- if (ignoreExpression == null) {
- ignoreExpression = BLOCK_IGNORE; // Start ignoring expressions until we hit the block number end block.
- breakBlock = blockNumber;
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
- private static final Object TRY_THROW_IGNORE = "TRY THROW IGNORE"; //$NON-NLS-1$
- private static final Object TRY_FINAL_IGNORE = "TRY FINAL IGNORE"; //$NON-NLS-1$
- private int[] trys; // Stack of try numbers currently evaluating.
- // Stack of trys in catch clause (i.e. starting executing a catch/final clause for the try). Corresponds with try from same index in trys. Contains the throwable for the catch.
- // This is used to know we are executing a catch (entry not null) and for the rethrow short-hand to rethrow the same exception within the catch.
- private Throwable[] trysInCatch;
- private int topTry = -1; // Top try index.
- private int breakTry = -1; // Try number we are breaking to.
- private Throwable catchThrowable; // The throwable to check catches against.
-
- /**
- * Push a try statement.
- * @param tryNumber
- *
- * @since 1.1.0
- */
- public final void pushTryBegin(int tryNumber) {
- try {
- if (traceOn) {
- printTrace("Begin Try #"+tryNumber, errorOccurred); //$NON-NLS-1$
- indent(true);
- }
-
- if (errorOccurred)
- return;
- // We are not checking ignore because this is a structural concept instead of executable expressions, so we need to keep track of these.
- if (trys == null) {
- trys = new int[10];
- trysInCatch = new Throwable[10];
- }
- if (++topTry >= trys.length) {
- int[] newList = new int[trys.length*2];
- System.arraycopy(trys, 0, newList, 0, trys.length);
- trys = newList;
- Throwable[] newCatches = new Throwable[trys.length];
- System.arraycopy(trysInCatch, 0, newCatches, 0, trysInCatch.length);
- trysInCatch = newCatches;
- }
- trys[topTry] = tryNumber;
- trysInCatch[topTry] = null;
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
- /**
- * Throw the top stack entry. It must be an exception.
- *
- *
- * @since 1.1.0
- */
- public final void pushThrowException() {
- try {
- boolean ignore = (ignoreExpression != null || errorOccurred);
- if (traceOn)
- printTrace("Throw exception: ", ignore); //$NON-NLS-1$
-
- if (ignore)
- return;
-
- try {
- Object t = popExpression();
- popExpressionType(false);
- if (traceOn) {
- System.out.print(t);
- }
- throwException((Throwable) t);
- } catch (NoExpressionValueException e) {
- processException(e);
- } catch (ClassCastException e) {
- processException(e);
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
- /**
- * Throw this exception (means throw through the expression being processed, not throw for this thread).
- * @param exception
- *
- * @since 1.1.0
- */
- protected final void throwException(Throwable exception) {
- if (topTry == -1) {
- // There are no tries, so treat this as a syntax error.
- if (exception instanceof NoExpressionValueException)
- processSyntaxException((NoExpressionValueException) exception);
- else
- processSyntaxException(exception);
- } else if (trysInCatch[topTry] == null) {
- // We are not in a catch clause of the top try. So do a throw ignore for toptry.
- ignoreExpression = TRY_THROW_IGNORE;
- breakTry = trys[topTry];
- catchThrowable = exception;
- } else {
- // We are in a catch of the top try. So do a throw to finally instead.
- ignoreExpression = TRY_FINAL_IGNORE;
- trysInCatch[topTry] = FINAL_CATCH;
- breakTry = trys[topTry];
- catchThrowable = exception;
- }
- }
-
- /**
- * Push a catch clause
- * @param tryNumber
- * @param exceptionType
- * @param expressionProxy
- *
- * @since 1.1.0
- */
- public final void pushTryCatchClause(int tryNumber, Class exceptionType, InternalExpressionProxy expressionProxy) {
- try {
- if (traceOn) {
- indent(false);
- if (expressionProxy == null)
- printTrace("Catch Try #"+tryNumber+" ("+exceptionType+')', errorOccurred); //$NON-NLS-1$ //$NON-NLS-2$
- else
- printTrace("Catch Try #"+tryNumber+" ("+exceptionType+") Return exception in proxy #"+expressionProxy.getProxyID(), errorOccurred); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- indent(true);
- }
-
- if (errorOccurred)
- return;
-
- // We are not checking ignore because this is a structural concept instead of executable expressions, so we need to keep track of these.
- if (trys == null || topTry < 0 || trys[topTry] != tryNumber) {
- processSyntaxException(new IllegalStateException(InitparserTreeMessages.getString("ExpressionProcesser.PushTryCatchClause.CatchReceivedOutOfOrder_EXC_"))); //$NON-NLS-1$
- } else {
- if (ignoreExpression == null) {
- // Normal flow, no throw in progress, so just ignore now until the finally or end try reached.
- ignoreExpression = TRY_FINAL_IGNORE;
- breakTry = tryNumber;
- } else if (ignoreExpression == TRY_THROW_IGNORE && tryNumber == breakTry) {
- // We are here due to a throw occuring in this try block, see if for us, and if it is, stop ignoring.
- // Else just continue ignoring.
- if (exceptionType.isInstance(catchThrowable)) {
- // For us, so just turn everything back on, except mark that we are in the catch phase.
- ignoreExpression = null;
- trysInCatch[topTry] = catchThrowable; // This is so that we know if we throw again that we should not catch anything.
- breakTry = -1;
- if (expressionProxy != null) {
- expressionProxy.setProxy(catchThrowable, catchThrowable.getClass());
- allocateExpressionProxy(expressionProxy);
- }
- if (traceOn) {
- System.out.print(" Caught: "); //$NON-NLS-1$
- System.out.print(catchThrowable);
- }
- catchThrowable = null;
- }
- }
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
- // This is used only so that finally clause can indicate it was executing so that end expression knows this.
- private static final Throwable FINAL_CATCH = new RuntimeException();
-
- /**
- * Push the try finally clause.
- * @param tryNumber
- *
- * @since 1.1.0
- */
- public final void pushTryFinallyClause(int tryNumber) {
- try {
- if (traceOn) {
- indent(false);
- printTrace("Finally Try #"+tryNumber, errorOccurred); //$NON-NLS-1$
- indent(true);
- }
- if (errorOccurred)
- return;
- // We are not checking ignore because this is a structural concept instead of executable expressions, so we need to keep track of these.
- if (trys == null || topTry < 0 || trys[topTry] != tryNumber) {
- processSyntaxException(new IllegalStateException(InitparserTreeMessages.getString("ExpressionProcesser.PushTryFinallyClause.FinallyReceivedOutOfOrder_EXC_"))); //$NON-NLS-1$
- } else {
- if (tryNumber == breakTry && (ignoreExpression == TRY_THROW_IGNORE || ignoreExpression == TRY_FINAL_IGNORE)) {
- // We are here due to a throw occuring in this try block or a catch was reached (in which case all intervening catch's were ignored).
- // Now do a normal execution. If we are here due to a throw that wasn't cleared (either no catch or another throw occured within the catch)
- // then we leave it uncleared so that try/end may rethrow it.
- ignoreExpression = null;
- trysInCatch[topTry] = FINAL_CATCH; // We are in the finally clause of a exception being thrown within this try.
- breakTry = -1;
- if (traceOn)
- System.out.print(" Executing finally."); //$NON-NLS-1$
- }
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
- /**
- * Rethrow the caught exception. This is a shortcut for:
- * } catch (Exception e) {
- * ... do stuff ...
- * throw e;
- * }
- * @param tryNumber
- *
- * @since 1.1.0
- */
- public final void pushTryRethrow(int tryNumber) {
- if (traceOn)
- printTrace("Rethrow Try #"+tryNumber, errorOccurred || ignoreExpression != null); //$NON-NLS-1$
-
- try {
- if (errorOccurred)
- return;
- // We are not checking ignore because we need to make sure this is not called out of order.
- if (trys == null || topTry < 0 || trys[topTry] != tryNumber) {
- processSyntaxException(new IllegalStateException(InitparserTreeMessages.getString("ExpressionProcesser.PushTryRethrow.RethrowReceivedOutOfOrder_EXC_"))); //$NON-NLS-1$
- } else if (ignoreExpression == null) {
- if (trysInCatch[topTry] == null || trysInCatch[topTry] == FINAL_CATCH)
- processSyntaxException(new IllegalStateException(InitparserTreeMessages.getString("ExpressionProcesser.PushTryRethrow.RetryReceivedOutOfExecutingCatchClause_EXC_"))); //$NON-NLS-1$
- else {
- throwException(trysInCatch[topTry]);
- }
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
- public final void pushTryEnd(int tryNumber) {
- if (traceOn) {
- indent(false);
- printTrace("End Try #"+tryNumber, errorOccurred); //$NON-NLS-1$
- }
- try {
- if (errorOccurred)
- return;
- // We are not checking ignore because this is a structural concept instead of executable expressions, so we need to keep track of these.
- if (trys == null || topTry < 0 || trys[topTry] != tryNumber) {
- processSyntaxException(new IllegalStateException(InitparserTreeMessages.getString("ExpressionProcesser.PushTryEnd.TryEndReceivedOutOfOrder_EXC_"))); //$NON-NLS-1$
- } else {
- boolean inCatch = trysInCatch[topTry] != null;
- trysInCatch[topTry] = null;
- topTry--;
- if (inCatch || (tryNumber == breakTry && (ignoreExpression == TRY_THROW_IGNORE || ignoreExpression == TRY_FINAL_IGNORE))) {
- // We are here due to a throw or normal flow through a catch. Either way if there is a throwable still pending, we rethrow.
- ignoreExpression = null;
- breakTry = -1;
- if (catchThrowable != null)
- throwException(catchThrowable);
- }
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
- /**
- * Class used to save the state at time of mark. It will
- * be used to restore state if error.
- *
- * @since 1.1.0
- */
- protected class SaveState {
- public int markID;
-
- // Block state
- public int topBlock;
- public int breakBlock;
-
- // Subexpression state
- public int topSubexpression;
-
- // Try state
- public int topTry;
- public int breakTry;
- public Throwable catchThrowable;
-
- // Error state
- public boolean errorOccurred;
- public boolean novalueException;
- public Throwable exception;
- public Object ignoreExpression;
-
- // Expression stack state
- public int expressionStackPos;
-
- // If/else state
- public int ifElseNesting;
- public int ifElseIgnoreNestCount;
- public boolean ifElseSkipTruePart;
-
- // Other
- public int indent;
- public int expressionProxyPos;
-
- /**
- * Construct and save the state.
- *
- * @param markNumber
- *
- * @since 1.1.0
- */
- public SaveState(int markID) {
- this.markID = markID;
-
- ExpressionProcesser ep = ExpressionProcesser.this;
- this.topBlock = ep.topBlock;
- this.breakBlock = ep.breakBlock;
-
- this.topSubexpression = ep.topSubexpression;
-
- this.topTry = ep.topTry;
- this.breakTry = ep.breakTry;
- this.catchThrowable = ep.catchThrowable;
-
- this.errorOccurred = ep.errorOccurred;
- this.novalueException = ep.novalueException;
- this.exception = ep.exception;
- this.ignoreExpression = ep.ignoreExpression;
-
- this.expressionStackPos = expressionStack.size()-1;
-
- this.ifElseNesting = ep.ifElseNesting;
- this.ifElseIgnoreNestCount = ep.ifElseIgnoreNestCount;
- this.ifElseSkipTruePart = ep.ifElseSkipTruePart;
-
- this.indent = ep.indent;
- this.expressionProxyPos = expressionProxies != null ? expressionProxies.size()-1 : -1;
- }
-
- /**
- * Restore the state.
- *
- *
- * @since 1.1.0
- */
- public void restoreState() {
- ExpressionProcesser ep = ExpressionProcesser.this;
- ep.topBlock = this.topBlock;
- ep.breakBlock = this.breakBlock;
-
- ep.topSubexpression = this.topSubexpression;
-
- ep.topTry = this.topTry;
- ep.breakTry = this.breakTry;
- ep.catchThrowable = this.catchThrowable;
- if (trysInCatch != null) {
- for (int i = topTry + 1; i < ep.trysInCatch.length; i++) {
- ep.trysInCatch[i] = null;
- }
- }
-
- ep.errorOccurred = this.errorOccurred;
- ep.novalueException = ep.novalueException;
- ep.exception = this.exception;
- ep.ignoreExpression = this.ignoreExpression;
-
- // Pop stack down to saved state.
- for (int i = expressionStack.size()-1; i > this.expressionStackPos; i--) {
- expressionStack.remove(i);
- expressionTypeStack.remove(i);
- }
-
- ep.ifElseNesting = this.ifElseNesting;
- ep.ifElseIgnoreNestCount = this.ifElseIgnoreNestCount;
- ep.ifElseSkipTruePart = this.ifElseSkipTruePart;
-
- ep.indent = this.indent;
-
- if (expressionProxies != null) {
- for (int i = expressionProxies.size() - 1; i > this.expressionProxyPos; i--) {
- expressionProxies.remove(i);
- }
- }
-
- // These settings can't cross mark boundaries, so reset them to not set. This is in case we were in this state somewhere
- // in the mark when the restore occurred.
- ep.conditionalIgnoreNestCount = 0;
- ep.conditionalNesting = 0;
- ep.skipTruePart = false;
-
- ep.infixIgnoreNestCount = 0;
- ep.infixNesting = 0;
- }
- }
-
- /**
- * Create the save state with the given id.
- * @param markID
- * @return
- *
- * @since 1.1.0
- */
- protected SaveState createSaveState(int markID) {
- return new SaveState(markID);
- }
-
- /**
- * Push the start of a mark.
- * @param markNumber
- *
- * @since 1.1.0
- */
- public final void pushMark(int markNumber) {
- if (traceOn)
- printTrace("Mark#"+markNumber, false); //$NON-NLS-1$
-
- if (saveStates == null)
- saveStates = new ArrayList();
- saveStates.add(createSaveState(markNumber));
-
- if (traceOn)
- printTraceEnd();
- }
-
- /**
- * Push the end mark. If there is no error, it will simply
- * remove it and all save states in the map after it. If there
- * is an error it will do this plus it will restore the state.
- * <p>
- * It is assumed that the calls are coming in correct order from
- * the server so we won't check validity.
- *
- * @param markID
- * @param restore
- *
- * @since 1.1.0
- */
- public final void pushEndmark(int markID, boolean restore) {
- if (traceOn)
- printTrace("End Mark#"+markID+" Restored="+restore, false); //$NON-NLS-1$ //$NON-NLS-2$
-
- try {
- if (saveStates != null) {
- // Start from the end (since that is where it most likely will be) and start
- // search, removing the end one until we reach the markID.
- for (int i = saveStates.size() - 1; i >= 0; i--) {
- SaveState state = (SaveState) saveStates.remove(i);
- if (state.markID == markID) {
- // We found it.
- if (restore)
- state.restoreState();
- return;
- }
- }
- // But to be safe, if we got here, this is bad. We tried restore a mark we didn't have.
- processSyntaxException(new IllegalStateException(MessageFormat.format(InitparserTreeMessages.getString("ExpressionProcesser.PushEndmark.EndMarkOnNonExistingID_EXC_"), new Object[]{new Integer(markID)}))); //$NON-NLS-1$
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
- private int[] subexpressions; // Stack of subexpression numbers currently evaluating.
- private int[] subexpressionStackPos; // Stack of the expression stack positions (next entry index) for currently evaluating expressions. The evaluation stack cannot be popped beyond the current top. And at end it will be cleaned up to the position.
- private int topSubexpression = -1; // Top subexpression index.
-
-
- /**
- * Push a begin subexpression.
- * @param subexpressionNumber
- *
- * @since 1.1.0
- */
- public final void pushSubexpressionBegin(int subexpressionNumber) {
- if (traceOn) {
- printTrace("Begin Subexpression #"+subexpressionNumber, errorOccurred); //$NON-NLS-1$
- indent(true);
- }
- try {
- if (errorOccurred)
- return;
- // We are not checking ignore because this is a structural concept instead of executable expressions, so we need to keep track of these.
- if (subexpressions == null) {
- subexpressions = new int[10];
- subexpressionStackPos = new int[10];
- }
- if (++topSubexpression >= subexpressions.length) {
- int[] newList = new int[subexpressions.length*2];
- System.arraycopy(subexpressions, 0, newList, 0, subexpressions.length);
- subexpressions = newList;
- newList = new int[subexpressionStackPos.length*2];
- System.arraycopy(subexpressionStackPos, 0, newList, 0, subexpressionStackPos.length);
- subexpressionStackPos = newList;
- }
- subexpressions[topSubexpression] = subexpressionNumber;
- subexpressionStackPos[topSubexpression] = expressionStack.size();
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
- /**
- * Push a subexpression end. The current subexpression must be the given number, or it is an error.
- *
- * @param subexpressionNumber
- *
- * @since 1.1.0
- */
- public final void pushSubexpressionEnd(int subexpressionNumber) {
- try {
- if (traceOn) {
- indent(false);
- printTrace("End Subexpression #"+subexpressionNumber, errorOccurred); //$NON-NLS-1$
- }
- if (errorOccurred)
- return;
- // We are not checking ignore because this is a structural concept instead of executable expressions, so we need to keep track of these.
- if (subexpressions == null || topSubexpression < 0 || subexpressions[topSubexpression] != subexpressionNumber) {
- processSyntaxException(new IllegalStateException(InitparserTreeMessages.getString("ExpressionProcesser.PushSubexpressionEnd.ReceivedEndSubexpressionsOutOfOrder_EXC_"))); //$NON-NLS-1$
- } else {
- try {
- popExpressions(expressionStack.size()-subexpressionStackPos[topSubexpression]);
- topSubexpression--;
- } catch (NoExpressionValueException e) {
- processException(e);
- }
- }
- } finally {
- if (traceOn)
- printTraceEnd();
- }
- }
-
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/ForExpression.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/ForExpression.java
deleted file mode 100644
index f6346fe09..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/ForExpression.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: ForExpression.java,v $
- * $Revision: 1.2 $ $Date: 2005/05/18 23:11:26 $
- */
-package org.eclipse.jem.internal.proxy.initParser.tree;
-
-/**
- * Enum for the forExpression parameters.
- * <p>
- * This is not meant to be subclassed by customers.
- * @since 1.1.0
- */
-public class ForExpression extends AbstractEnum {
-
- /**
- * forExpression: Creating a root expression
- */
- public static final int ROOTEXPRESSION_VALUE = 0;
-
- public static final ForExpression ROOTEXPRESSION = new ForExpression(ROOTEXPRESSION_VALUE, "Root"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating the array expression for an array access (i.e. the array to access)
- */
- public static final int ARRAYACCESS_ARRAY_VALUE = 1;
-
- public static final ForExpression ARRAYACCESS_ARRAY = new ForExpression(ARRAYACCESS_ARRAY_VALUE, "Array Access: Array Operand"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating an index expression for an array access (i.e. one of the expressions within the <code>[]</code>).
- */
- public static final int ARRAYACCESS_INDEX_VALUE = 2;
-
- public static final ForExpression ARRAYACCESS_INDEX = new ForExpression(ARRAYACCESS_INDEX_VALUE, "Array Access: Index"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating an dimension expression for an array creation (i.e. one of the expressions within the <code>[]</code>).
- */
- public static final int ARRAYCREATION_DIMENSION_VALUE = 3;
-
- public static final ForExpression ARRAYCREATION_DIMENSION = new ForExpression(ARRAYCREATION_DIMENSION_VALUE, "Array Access: Dimension"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating an expression for an array initializer (i.e. one of the expressions with the <code>{}</code>). Special case is that
- * array initializers are valid as an expression within an array initializer and it doesn't use a for expression.
- */
- public static final int ARRAYINITIALIZER_EXPRESSION_VALUE = 4;
-
- public static final ForExpression ARRAYINITIALIZER_EXPRESSION = new ForExpression(ARRAYINITIALIZER_EXPRESSION_VALUE, "Array Initializer"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating the expression for the cast (i.e. the expresion after the <code>(type)</code>).
- */
- public static final int CAST_EXPRESSION_VALUE = 5;
-
- public static final ForExpression CAST_EXPRESSION = new ForExpression(CAST_EXPRESSION_VALUE, "Cast"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating the argument expression for the new instance.
- */
- public static final int CLASSINSTANCECREATION_ARGUMENT_VALUE = 6;
-
- public static final ForExpression CLASSINSTANCECREATION_ARGUMENT = new ForExpression(CLASSINSTANCECREATION_ARGUMENT_VALUE,
- "Class Instance Creation: Argument"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating the condition for a conditional expression.
- */
- public static final int CONDITIONAL_CONDITION_VALUE = 7;
-
- public static final ForExpression CONDITIONAL_CONDITION = new ForExpression(CONDITIONAL_CONDITION_VALUE, "Conditional: Condition"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating the true (then) expression for a conditional expression.
- */
- public static final int CONDITIONAL_TRUE_VALUE = 8;
-
- public static final ForExpression CONDITIONAL_TRUE = new ForExpression(CONDITIONAL_TRUE_VALUE, "Conditional: True"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating the false (else) condition for a conditional expression.
- */
- public static final int CONDITIONAL_FALSE_VALUE = 9;
-
- public static final ForExpression CONDITIONAL_FALSE = new ForExpression(CONDITIONAL_FALSE_VALUE, "Conditional: False"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating the receiver for a field access (i.e. the expression before the ".")
- */
- public static final int FIELD_RECEIVER_VALUE = 10;
-
- public static final ForExpression FIELD_RECEIVER = new ForExpression(FIELD_RECEIVER_VALUE, "Field Access: Receiver"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating the left operand of an infix expression.
- */
- public static final int INFIX_LEFT_VALUE = 11;
-
- public static final ForExpression INFIX_LEFT = new ForExpression(INFIX_LEFT_VALUE, "Infix: Left"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating the right operand of an infix expression.
- */
- public static final int INFIX_RIGHT_VALUE = 12;
-
- public static final ForExpression INFIX_RIGHT = new ForExpression(INFIX_RIGHT_VALUE, "Infix: Right"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating an extended operand of an infix expression.
- */
- public static final int INFIX_EXTENDED_VALUE = 13;
-
- public static final ForExpression INFIX_EXTENDED = new ForExpression(INFIX_EXTENDED_VALUE, "Infix: Extended"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating the value expression of an instanceof.
- */
- public static final int INSTANCEOF_VALUE_VALUE = 14;
-
- public static final ForExpression INSTANCEOF_VALUE = new ForExpression(INSTANCEOF_VALUE_VALUE, "Instanceof"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating a receiver expression for a method invocation.
- */
- public static final int METHOD_RECEIVER_VALUE = 15;
-
- public static final ForExpression METHOD_RECEIVER = new ForExpression(METHOD_RECEIVER_VALUE, "Method Invoke: Receiver"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating an argument for a method invocation.
- */
- public static final int METHOD_ARGUMENT_VALUE = 16;
-
- public static final ForExpression METHOD_ARGUMENT = new ForExpression(METHOD_ARGUMENT_VALUE, "Method Invoke: Argument"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating the operand expression for a prefix operator.
- */
- public static final int PREFIX_OPERAND_VALUE = 17;
-
- public static final ForExpression PREFIX_OPERAND = new ForExpression(PREFIX_OPERAND_VALUE, "Prefix: Operand"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating the right operand of an assignment operator.
- *
- * @since 1.1.0
- */
- public static final int ASSIGNMENT_RIGHT_VALUE = 18;
-
- public static final ForExpression ASSIGNMENT_RIGHT = new ForExpression(ASSIGNMENT_RIGHT_VALUE, "Assignment: Right"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating the left operand of an assignment operator.
- * <p>
- * Note: The left expression can only be a FieldAccess or ArrayAccess.
- */
- public static final int ASSIGNMENT_LEFT_VALUE = 19;
-
- public static final ForExpression ASSIGNMENT_LEFT = new ForExpression(ASSIGNMENT_LEFT_VALUE, "Assignment: Left"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating the throw operand of the throw expression.
- */
- public static final int THROW_OPERAND_VALUE = 20;
-
- public static final ForExpression THROW_OPERAND = new ForExpression(THROW_OPERAND_VALUE, "Throw operand"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating the if conditional operand of the if expression.
- */
- public static final int IF_CONDITION_VALUE = 21;
-
- public static final ForExpression IF_CONDITION = new ForExpression(IF_CONDITION_VALUE, "If condition"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating the if true clause of the if expression.
- */
- public static final int IF_TRUE_VALUE = 22;
-
- public static final ForExpression IF_TRUE = new ForExpression(IF_TRUE_VALUE, "If true clause"); //$NON-NLS-1$
-
- /**
- * forExpression: Creating the if else clause of the if expression.
- */
- public static final int IF_ELSE_VALUE = 23;
-
- public static final ForExpression IF_ELSE = new ForExpression(IF_ELSE_VALUE, "If else clause"); //$NON-NLS-1$
-
-
- /**
- * This is not private, but protected only so that proxy core can add an internal ForExpression enum.
- * <p>
- * This is not meant to be subclassed by customers.
- * @param value
- * @param name
- *
- * @since 1.1.0
- */
- protected ForExpression(int value, String name) {
- super(value, name);
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/IExpressionConstants.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/IExpressionConstants.java
deleted file mode 100644
index 49edd7257..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/IExpressionConstants.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: IExpressionConstants.java,v $
- * $Revision: 1.4 $ $Date: 2005/08/24 20:39:07 $
- */
-package org.eclipse.jem.internal.proxy.initParser.tree;
-
-/**
- * These are constants needed by IExpression that will be common between
- * the vm and the IDE. They are also available to users of the IExpression
- * interface.
- *
- * @since 1.0.0
- */
-public interface IExpressionConstants {
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InfixOperator.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InfixOperator.java
deleted file mode 100644
index 9fbe0034f..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InfixOperator.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: InfixOperator.java,v $
- * $Revision: 1.2 $ $Date: 2005/05/18 23:11:26 $
- */
-package org.eclipse.jem.internal.proxy.initParser.tree;
-
-/**
- * Enum for Infix operator
- *
- * @since 1.1.0
- */
-public class InfixOperator extends AbstractEnum {
-
- /**
- * Infix times "*"
- */
- public static final int IN_TIMES_VALUE = 0;
-
- public static final InfixOperator IN_TIMES = new InfixOperator(IN_TIMES_VALUE, "Infix *"); //$NON-NLS-1$
-
- /**
- * Infix divide "/"
- */
- public static final int IN_DIVIDE_VALUE = 1;
-
- public static final InfixOperator IN_DIVIDE = new InfixOperator(IN_DIVIDE_VALUE, "Infix /"); //$NON-NLS-1$
-
- /**
- * Infix remainder "%"
- */
- public static final int IN_REMAINDER_VALUE = 2;
-
- public static final InfixOperator IN_REMAINDER = new InfixOperator(IN_REMAINDER_VALUE, "Infix %"); //$NON-NLS-1$
-
- /**
- * Infix plus "+"
- */
- public static final int IN_PLUS_VALUE = 3;
-
- public static final InfixOperator IN_PLUS = new InfixOperator(IN_PLUS_VALUE, "Infix +"); //$NON-NLS-1$
-
- /**
- * Infix minus "-"
- */
- public static final int IN_MINUS_VALUE = 4;
-
- public static final InfixOperator IN_MINUS = new InfixOperator(IN_MINUS_VALUE, "Infix -"); //$NON-NLS-1$
-
- /**
- * Infix left shift " < <"
- */
- public static final int IN_LEFT_SHIFT_VALUE = 5;
-
- public static final InfixOperator IN_LEFT_SHIFT = new InfixOperator(IN_LEFT_SHIFT_VALUE, "Infix <<"); //$NON-NLS-1$
-
- /**
- * Infix right shift signed ">>"
- */
- public static final int IN_RIGHT_SHIFT_SIGNED_VALUE = 6;
-
- public static final InfixOperator IN_RIGHT_SHIFT_SIGNED = new InfixOperator(IN_RIGHT_SHIFT_SIGNED_VALUE, "Infix >>"); //$NON-NLS-1$
-
- /**
- * Infix right shift unsigned ">>>"
- */
- public static final int IN_RIGHT_SHIFT_UNSIGNED_VALUE = 7;
-
- public static final InfixOperator IN_RIGHT_SHIFT_UNSIGNED = new InfixOperator(IN_RIGHT_SHIFT_UNSIGNED_VALUE, "Infix >>>"); //$NON-NLS-1$
-
- /**
- * Infix less " <"
- */
- public static final int IN_LESS_VALUE = 8;
-
- public static final InfixOperator IN_LESS = new InfixOperator(IN_LESS_VALUE, "Infix <"); //$NON-NLS-1$
-
- /**
- * Infix greater ">"
- */
- public static final int IN_GREATER_VALUE = 9;
-
- public static final InfixOperator IN_GREATER = new InfixOperator(IN_GREATER_VALUE, "Infix >"); //$NON-NLS-1$
-
- /**
- * Infix less than or equals " <="
- */
- public static final int IN_LESS_EQUALS_VALUE = 10;
-
- public static final InfixOperator IN_LESS_EQUALS = new InfixOperator(IN_LESS_EQUALS_VALUE, "Infix <="); //$NON-NLS-1$
-
- /**
- * Infix Greater than or equlas ">="
- */
- public static final int IN_GREATER_EQUALS_VALUE = 11;
-
- public static final InfixOperator IN_GREATER_EQUALS = new InfixOperator(IN_GREATER_EQUALS_VALUE, "Infix >="); //$NON-NLS-1$
-
- /**
- * Infix equals "=="
- */
- public static final int IN_EQUALS_VALUE = 12;
-
- public static final InfixOperator IN_EQUALS = new InfixOperator(IN_EQUALS_VALUE, "Infix =="); //$NON-NLS-1$
-
- /**
- * Infix not equals "!="
- */
- public static final int IN_NOT_EQUALS_VALUE = 13;
-
- public static final InfixOperator IN_NOT_EQUALS = new InfixOperator(IN_NOT_EQUALS_VALUE, "Infix !="); //$NON-NLS-1$
-
- /**
- * Infix exclusive or "^"
- */
- public static final int IN_XOR_VALUE = 14;
-
- public static final InfixOperator IN_XOR = new InfixOperator(IN_XOR_VALUE, "Infix ^"); //$NON-NLS-1$
-
- /**
- * Infix bitwise and "&"
- */
- public static final int IN_AND_VALUE = 15;
-
- public static final InfixOperator IN_AND = new InfixOperator(IN_AND_VALUE, "Infix &"); //$NON-NLS-1$
-
- /**
- * Infix bitwise or "|"
- */
- public static final int IN_OR_VALUE = 16;
-
- public static final InfixOperator IN_OR = new InfixOperator(IN_OR_VALUE, "Infix |"); //$NON-NLS-1$
-
- /**
- * Infix Conditional logical and "&&"
- */
- public static final int IN_CONDITIONAL_AND_VALUE = 17;
-
- public static final InfixOperator IN_CONDITIONAL_AND = new InfixOperator(IN_CONDITIONAL_AND_VALUE, "Infix &&"); //$NON-NLS-1$
-
- /**
- * Infix Conditional logical or "||"
- */
- public static final int IN_CONDITIONAL_OR_VALUE = 18;
-
- public static final InfixOperator IN_CONDITIONAL_OR = new InfixOperator(IN_CONDITIONAL_OR_VALUE, "Ifnix ||"); //$NON-NLS-1$
-
- /**
- * Return the infix operator for the given enum value.
- * @param value
- * @return
- *
- * @since 1.1.0
- */
- public static InfixOperator get(int value) {
- switch (value) {
- case IN_TIMES_VALUE:
- return IN_TIMES;
- case IN_DIVIDE_VALUE:
- return IN_DIVIDE;
- case IN_REMAINDER_VALUE:
- return IN_REMAINDER;
- case IN_PLUS_VALUE:
- return IN_PLUS;
- case IN_MINUS_VALUE:
- return IN_MINUS;
- case IN_LEFT_SHIFT_VALUE:
- return IN_LEFT_SHIFT;
- case IN_RIGHT_SHIFT_SIGNED_VALUE:
- return IN_RIGHT_SHIFT_SIGNED;
- case IN_RIGHT_SHIFT_UNSIGNED_VALUE:
- return IN_RIGHT_SHIFT_UNSIGNED;
- case IN_LESS_VALUE:
- return IN_LESS;
- case IN_GREATER_VALUE:
- return IN_GREATER;
- case IN_LESS_EQUALS_VALUE:
- return IN_LESS_EQUALS;
- case IN_GREATER_EQUALS_VALUE:
- return IN_GREATER_EQUALS;
- case IN_EQUALS_VALUE:
- return IN_EQUALS;
- case IN_NOT_EQUALS_VALUE:
- return IN_NOT_EQUALS;
- case IN_XOR_VALUE:
- return IN_XOR;
- case IN_AND_VALUE:
- return IN_AND;
- case IN_OR_VALUE:
- return IN_OR;
- case IN_CONDITIONAL_AND_VALUE:
- return IN_CONDITIONAL_AND;
- case IN_CONDITIONAL_OR_VALUE:
- return IN_CONDITIONAL_OR;
- }
- return null;
- }
-
- private InfixOperator(int value, String name) {
- super(value, name);
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InitparserTreeMessages.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InitparserTreeMessages.java
deleted file mode 100644
index 69c30b676..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InitparserTreeMessages.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: InitparserTreeMessages.java,v $
- * $Revision: 1.5 $ $Date: 2005/08/24 20:39:07 $
- */
-package org.eclipse.jem.internal.proxy.initParser.tree;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * @author sri
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-public class InitparserTreeMessages {
-
- private static final String BUNDLE_NAME = "org.eclipse.jem.internal.proxy.initParser.tree.messages";//$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
-
- private InitparserTreeMessages() {
- }
-
- public static String getString(String key) {
- // TODO Auto-generated method stub
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalConditionalOperandType.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalConditionalOperandType.java
deleted file mode 100644
index 406a2057d..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalConditionalOperandType.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: InternalConditionalOperandType.java,v $
- * $Revision: 1.2 $ $Date: 2005/05/18 23:11:26 $
- */
-package org.eclipse.jem.internal.proxy.initParser.tree;
-
-/**
- * Internal class for the Conditional operand type. Not meant to be used by customers.
- *
- * @since 1.1.0
- */
-public class InternalConditionalOperandType extends AbstractEnum {
-
- /**
- * Used in Conditional processing. False operand on expression stack
- */
- public final static int CONDITIONAL_FALSE_VALUE = 0;
-
- public final static InternalConditionalOperandType CONDITIONAL_FALSE = new InternalConditionalOperandType(CONDITIONAL_FALSE_VALUE,
- "Conditional False Operand Flag"); //$NON-NLS-1$
-
- /**
- * Used in Conditional processing. True operand on expression stack
- */
- public final static int CONDITIONAL_TRUE_VALUE = 1;
-
- public final static InternalConditionalOperandType CONDITIONAL_TRUE = new InternalConditionalOperandType(CONDITIONAL_TRUE_VALUE,
- "Conditional True Operand Flag"); //$NON-NLS-1$
-
- /**
- * Used in Conditional processing. Test operand on expression stack
- */
- public final static int CONDITIONAL_TEST_VALUE = 2;
-
- public final static InternalConditionalOperandType CONDITIONAL_TEST = new InternalConditionalOperandType(CONDITIONAL_TEST_VALUE,
- "Conditional Test Operand Flag"); //$NON-NLS-1$
-
- /**
- * Return the enum for the given value.
- * @param value
- * @return
- *
- * @since 1.1.0
- */
- public static InternalConditionalOperandType get(int value) {
- switch (value) {
- case CONDITIONAL_FALSE_VALUE:
- return CONDITIONAL_FALSE;
- case CONDITIONAL_TRUE_VALUE:
- return CONDITIONAL_TRUE;
- case CONDITIONAL_TEST_VALUE:
- return CONDITIONAL_TEST;
- }
- return null;
- }
-
- private InternalConditionalOperandType(int value, String name) {
- super(value, name);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalExpressionProxy.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalExpressionProxy.java
deleted file mode 100644
index 1f7d3f605..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalExpressionProxy.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: InternalExpressionProxy.java,v $
- * $Revision: 1.2 $ $Date: 2005/08/24 20:39:07 $
- */
-package org.eclipse.jem.internal.proxy.initParser.tree;
-
-
-/**
- * This interface is used for expression proxies in the evaluation side (in {@link org.eclipse.jem.internal.proxy.initParser.tree.ExpressionProcesser}).
- * <p>
- * It is meant to be implemented only by users of the ExpressionProcessor.
- *
- * @since 1.1.0
- */
-public interface InternalExpressionProxy {
-
- /**
- * Get the id of the proxy.
- * @return
- *
- * @since 1.1.0
- */
- public int getProxyID();
-
- /**
- * Called by ExpressionProcesser to give the expression proxy its value and type, i.e. it has been evaluated.
- * <p>
- * The type may not be the actual type of the value, it may be a superclass of it. It is the type that the proxy
- * represents from the return of the expression. For instance it may of returned null but it is supposed to be
- * java.lang.String. Or it is supposed to be a primitive int, since we can't store that, we need to store
- * an Integer value with the type indicating it is Interger.TYPE.
- *
- * @param value
- * @param type
- *
- * @since 1.1.0
- */
- public void setProxy(Object value, Class type);
-
- /**
- * Get the value of the proxy.
- * <p>
- * Note: The value may be a {@link VariableReference}, in which
- * case further dereferencing may be with the returned value.
- * @return the value of the proxy, it may be an ExpressionProcesser.VariableReference.
- *
- * @since 1.1.0
- */
- public Object getValue();
-
- /**
- * Get the type of the proxy.
- * @return
- *
- * @see InternalExpressionProxy#setProxy(Object, Class) for what type means.
- * @since 1.1.0
- */
- public Class getType();
-
- /**
- * Return whether the proxy has had a value/class set into it yet.
- * @return <code>true</code> if it has been set.
- *
- * @since 1.1.0
- */
- public boolean isSet();
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalExpressionTypes.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalExpressionTypes.java
deleted file mode 100644
index d1a35eda7..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalExpressionTypes.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.initParser.tree;
-
-/**
- * These constants are for communicating between the IDE and the proxy side for expression evaluation. It is not meant to be used by customers.
- *
- * @since 1.0.0
- */
-public class InternalExpressionTypes extends AbstractEnum {
-
- /**
- * ARRAY ACCESS Expression
- */
- public final static int ARRAY_ACCESS_EXPRESSION_VALUE = 1;
-
- public final static InternalExpressionTypes ARRAY_ACCESS_EXPRESSION = new InternalExpressionTypes(ARRAY_ACCESS_EXPRESSION_VALUE,
- "Array Access Expression"); //$NON-NLS-1$
-
- /**
- * ARRAY CREATION Expression
- */
- public final static int ARRAY_CREATION_EXPRESSION_VALUE = 2;
-
- public final static InternalExpressionTypes ARRAY_CREATION_EXPRESSION = new InternalExpressionTypes(ARRAY_CREATION_EXPRESSION_VALUE,
- "Array Creation Expression"); //$NON-NLS-1$
-
- /**
- * ARRAY INITIALIZER expression
- */
- public final static int ARRAY_INITIALIZER_EXPRESSION_VALUE = 3;
-
- public final static InternalExpressionTypes ARRAY_INITIALIZER_EXPRESSION = new InternalExpressionTypes(ARRAY_INITIALIZER_EXPRESSION_VALUE,
- "Array Initializer Expression"); //$NON-NLS-1$
-
- /**
- * CAST Expression.
- */
- public final static int CAST_EXPRESSION_VALUE = 4;
-
- public final static InternalExpressionTypes CAST_EXPRESSION = new InternalExpressionTypes(CAST_EXPRESSION_VALUE, "Cast Expression"); //$NON-NLS-1$
-
- /**
- * CONDITIONAL expression
- */
- public final static int CONDITIONAL_EXPRESSION_VALUE = 5;
-
- public final static InternalExpressionTypes CONDITIONAL_EXPRESSION = new InternalExpressionTypes(CONDITIONAL_EXPRESSION_VALUE,
- "Conditional Expression"); //$NON-NLS-1$
-
- /**
- * CLASS INSTANCE CREATION expression
- */
- public final static int CLASS_INSTANCE_CREATION_EXPRESSION_VALUE = 6;
-
- public final static InternalExpressionTypes CLASS_INSTANCE_CREATION_EXPRESSION = new InternalExpressionTypes(
- CLASS_INSTANCE_CREATION_EXPRESSION_VALUE, "Class Instance Creation Expression"); //$NON-NLS-1$
-
- /**
- * FIELD ACCESS expression.
- */
- public final static int FIELD_ACCESS_EXPRESSION_VALUE = 7;
-
- public final static InternalExpressionTypes FIELD_ACCESS_EXPRESSION = new InternalExpressionTypes(FIELD_ACCESS_EXPRESSION_VALUE,
- "Field Access Expression"); //$NON-NLS-1$
-
- /**
- * INSTANCEOF Expression.
- */
- public final static int INSTANCEOF_EXPRESSION_VALUE = 8;
-
- public final static InternalExpressionTypes INSTANCEOF_EXPRESSION = new InternalExpressionTypes(INSTANCEOF_EXPRESSION_VALUE,
- "Instanceof Expression"); //$NON-NLS-1$
-
- /**
- * Infix expression
- */
- public final static int INFIX_EXPRESSION_VALUE = 9;
-
- public final static InternalExpressionTypes INFIX_EXPRESSION = new InternalExpressionTypes(INFIX_EXPRESSION_VALUE, "Infix Expression"); //$NON-NLS-1$
-
- /**
- * Method expression.
- */
- public final static int METHOD_EXPRESSION_VALUE = 10;
-
- public final static InternalExpressionTypes METHOD_EXPRESSION = new InternalExpressionTypes(METHOD_EXPRESSION_VALUE, "Method Invoke Expression"); //$NON-NLS-1$
-
- /**
- * Prefix expression
- */
- public final static int PREFIX_EXPRESSION_VALUE = 11;
-
- public final static InternalExpressionTypes PREFIX_EXPRESSION = new InternalExpressionTypes(PREFIX_EXPRESSION_VALUE, "Prefix Expression"); //$NON-NLS-1$
-
- /**
- * Push to proxy expression.
- */
- public final static int PUSH_TO_PROXY_EXPRESSION_VALUE = 12;
-
- public final static InternalExpressionTypes PUSH_TO_PROXY_EXPRESSION = new InternalExpressionTypes(PUSH_TO_PROXY_EXPRESSION_VALUE,
- "Push to Proxy Expression"); //$NON-NLS-1$
-
- /**
- * Push BeanType expression proxy expression.
- */
- public final static int PUSH_BEANTYPE_EXPRESSIONPROXY_EXPRESSION_VALUE = 13;
-
- public final static InternalExpressionTypes PUSH_BEANTYPE_EXPRESSIONPROXY_EXPRESSION = new InternalExpressionTypes(PUSH_BEANTYPE_EXPRESSIONPROXY_EXPRESSION_VALUE,
- "Push BeanType ExpressionProxy Expression"); //$NON-NLS-1$
-
-
- /**
- * Type receiver expression.
- */
- public final static int TYPERECEIVER_EXPRESSION_VALUE = 14;
-
- public final static InternalExpressionTypes TYPERECEIVER_EXPRESSION = new InternalExpressionTypes(TYPERECEIVER_EXPRESSION_VALUE,
- "Type Receiver Expression"); //$NON-NLS-1$
-
- /**
- * Assignment to an ExpressionProxy expression.
- */
- public final static int ASSIGNMENT_PROXY_EXPRESSION_VALUE = 15;
-
- public final static InternalExpressionTypes ASSIGNMENT_PROXY_EXPRESSION = new InternalExpressionTypes(ASSIGNMENT_PROXY_EXPRESSION_VALUE,
- "Assignment to Proxy Expression"); //$NON-NLS-1$
-
- /**
- * Push expression proxy value expression.
- */
- public final static int PUSH_TO_EXPRESSION_PROXY_EXPRESSION_VALUE = 16;
-
- public final static InternalExpressionTypes PUSH_TO_EXPRESSION_PROXY_EXPRESSION = new InternalExpressionTypes(
- PUSH_TO_EXPRESSION_PROXY_EXPRESSION_VALUE, "Push to Expression Proxy Expression"); //$NON-NLS-1$
-
- /**
- * Assignment expression.
- */
- public final static int ASSIGNMENT_EXPRESSION_VALUE = 17;
-
- public final static InternalExpressionTypes ASSIGNMENT_EXPRESSION = new InternalExpressionTypes(ASSIGNMENT_EXPRESSION_VALUE,
- "Assignment Expression"); //$NON-NLS-1$
-
- /**
- * Block End expression.
- */
- public final static int BLOCK_BEGIN_EXPRESSION_VALUE = 18;
-
- public final static InternalExpressionTypes BLOCK_BEGIN_EXPRESSION = new InternalExpressionTypes(BLOCK_BEGIN_EXPRESSION_VALUE,
- "Begin block Expression"); //$NON-NLS-1$
-
- /**
- * Block End expression.
- */
- public final static int BLOCK_BREAK_EXPRESSION_VALUE = 19;
-
- public final static InternalExpressionTypes BLOCK_BREAK_EXPRESSION = new InternalExpressionTypes(BLOCK_BREAK_EXPRESSION_VALUE,
- "Break block Expression"); //$NON-NLS-1$
-
- /**
- * Block End expression.
- */
- public final static int BLOCK_END_EXPRESSION_VALUE = 20;
-
- public final static InternalExpressionTypes BLOCK_END_EXPRESSION = new InternalExpressionTypes(BLOCK_END_EXPRESSION_VALUE,
- "End block Expression"); //$NON-NLS-1$
-
- /**
- * Try Begin expression.
- */
- public final static int TRY_BEGIN_EXPRESSION_VALUE = 21;
-
- public final static InternalExpressionTypes TRY_BEGIN_EXPRESSION = new InternalExpressionTypes(TRY_BEGIN_EXPRESSION_VALUE,
- "Begin try Expression"); //$NON-NLS-1$
-
- /**
- * Try Catch expression.
- */
- public final static int TRY_CATCH_EXPRESSION_VALUE = 22;
-
- public final static InternalExpressionTypes TRY_CATCH_EXPRESSION = new InternalExpressionTypes(TRY_CATCH_EXPRESSION_VALUE,
- "Try catch Expression"); //$NON-NLS-1$
-
- /**
- * Try Finally expression.
- */
- public final static int TRY_FINALLY_EXPRESSION_VALUE = 23;
-
- public final static InternalExpressionTypes TRY_FINALLY_EXPRESSION = new InternalExpressionTypes(TRY_FINALLY_EXPRESSION_VALUE,
- "Try finally Expression"); //$NON-NLS-1$
-
- /**
- * Try End expression.
- */
- public final static int TRY_END_EXPRESSION_VALUE = 24;
-
- public final static InternalExpressionTypes TRY_END_EXPRESSION = new InternalExpressionTypes(TRY_END_EXPRESSION_VALUE,
- "End try Expression"); //$NON-NLS-1$
-
- /**
- * Throw expression.
- */
- public final static int THROW_EXPRESSION_VALUE = 25;
-
- public final static InternalExpressionTypes THROW_EXPRESSION = new InternalExpressionTypes(THROW_EXPRESSION_VALUE,
- "Throw Expression"); //$NON-NLS-1$
-
- /**
- * Rethrow expression.
- */
- public final static int RETHROW_EXPRESSION_VALUE = 26;
-
- public final static InternalExpressionTypes RETHROW_EXPRESSION = new InternalExpressionTypes(RETHROW_EXPRESSION_VALUE,
- "Rethrow Expression"); //$NON-NLS-1$
-
- /**
- * Push Method Lookup expression proxy expression.
- */
- public final static int PUSH_METHOD_EXPRESSIONPROXY_EXPRESSION_VALUE = 27;
-
- public final static InternalExpressionTypes PUSH_METHOD_EXPRESSIONPROXY_EXPRESSION = new InternalExpressionTypes(PUSH_METHOD_EXPRESSIONPROXY_EXPRESSION_VALUE,
- "Push Method ExpressionProxy Expression"); //$NON-NLS-1$
-
- /**
- * Push Field Lookup expression proxy expression.
- */
- public final static int PUSH_FIELD_EXPRESSIONPROXY_EXPRESSION_VALUE = 28;
-
- public final static InternalExpressionTypes PUSH_FIELD_EXPRESSIONPROXY_EXPRESSION = new InternalExpressionTypes(PUSH_FIELD_EXPRESSIONPROXY_EXPRESSION_VALUE,
- "Push Field ExpressionProxy Expression"); //$NON-NLS-1$
-
- /**
- * Push If/else (the clauses) expression proxy expression.
- */
- public final static int IF_ELSE_EXPRESSION_VALUE = 29;
-
- public final static InternalExpressionTypes IF_ELSE_EXPRESSION = new InternalExpressionTypes(IF_ELSE_EXPRESSION_VALUE,
- "Push If/else Expression"); //$NON-NLS-1$
-
- /**
- * Push If/else condition test expression proxy expression.
- */
- public final static int IF_TEST_EXPRESSION_VALUE = 30;
-
- public final static InternalExpressionTypes IF_TEST_EXPRESSION = new InternalExpressionTypes(IF_TEST_EXPRESSION_VALUE,
- "Push If Test Expression"); //$NON-NLS-1$
-
-
- /**
- * Push new instance from init string proxy expression.
- */
- public final static int NEW_INSTANCE_VALUE = 31;
-
- public final static InternalExpressionTypes NEW_INSTANCE = new InternalExpressionTypes(NEW_INSTANCE_VALUE,
- "Push New Instance Expression"); //$NON-NLS-1$
-
-
- /**
- * Push mark proxy expression.
- */
- public final static int MARK_VALUE = 32;
-
- public final static InternalExpressionTypes MARK = new InternalExpressionTypes(MARK_VALUE,
- "Push Mark Expression"); //$NON-NLS-1$
-
- /**
- * Push end mark proxy expression.
- */
- public final static int ENDMARK_VALUE = 33;
-
- public final static InternalExpressionTypes ENDMARK = new InternalExpressionTypes(ENDMARK_VALUE,
- "Push End Mark Expression"); //$NON-NLS-1$
-
- /**
- * Subexpression End expression.
- */
- public final static int SUBEXPRESSION_BEGIN_EXPRESSION_VALUE = 34;
-
- public final static InternalExpressionTypes SUBEXPRESSION_BEGIN_EXPRESSION = new InternalExpressionTypes(SUBEXPRESSION_BEGIN_EXPRESSION_VALUE,
- "Begin Subexpression Expression"); //$NON-NLS-1$
-
- /**
- * Subexpression End expression.
- */
- public final static int SUBEXPRESSION_END_EXPRESSION_VALUE = 35;
-
- public final static InternalExpressionTypes SUBEXPRESSION_END_EXPRESSION = new InternalExpressionTypes(SUBEXPRESSION_END_EXPRESSION_VALUE,
- "End Subexpression Expression"); //$NON-NLS-1$
-
-
- private InternalExpressionTypes(int value, String name) {
- super(value, name);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalIfElseOperandType.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalIfElseOperandType.java
deleted file mode 100644
index c048a4dd1..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalIfElseOperandType.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: InternalIfElseOperandType.java,v $
- * $Revision: 1.2 $ $Date: 2005/05/18 23:11:26 $
- */
-package org.eclipse.jem.internal.proxy.initParser.tree;
-
-/**
- * Internal class for the If/else operand type. Not meant to be used by customers.
- *
- * @since 1.1.0
- */
-public class InternalIfElseOperandType extends AbstractEnum {
-
- /**
- * Used in If/else processing. False clause on expression stack
- */
- public final static int ELSE_CLAUSE_VALUE = 0;
-
- public final static InternalIfElseOperandType ELSE_CLAUSE = new InternalIfElseOperandType(ELSE_CLAUSE_VALUE,
- "Else Clause Flag"); //$NON-NLS-1$
-
- /**
- * Used in If/else processing. If operand on expression stack
- */
- public final static int TRUE_CLAUSE_VALUE = 1;
-
- public final static InternalIfElseOperandType TRUE_CLAUSE = new InternalIfElseOperandType(TRUE_CLAUSE_VALUE,
- "If True Clause Flag"); //$NON-NLS-1$
-
- /**
- * Return the enum for the given value.
- * @param value
- * @return
- *
- * @since 1.1.0
- */
- public static InternalIfElseOperandType get(int value) {
- switch (value) {
- case ELSE_CLAUSE_VALUE:
- return ELSE_CLAUSE;
- case TRUE_CLAUSE_VALUE:
- return TRUE_CLAUSE;
- }
- return null;
- }
-
- private InternalIfElseOperandType(int value, String name) {
- super(value, name);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalInfixOperandType.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalInfixOperandType.java
deleted file mode 100644
index bef20d502..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/InternalInfixOperandType.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: InternalInfixOperandType.java,v $
- * $Revision: 1.2 $ $Date: 2005/05/18 23:11:26 $
- */
-package org.eclipse.jem.internal.proxy.initParser.tree;
-
-
-/**
- * Internal class for the Prefix operand type. Not meant to be used by customers.
- * @since 1.1.0
- */
-public class InternalInfixOperandType extends AbstractEnum {
-
- /**
- * Used in Infix processing. Left operand on expression stack
- */
- public final static int INFIX_LEFT_OPERAND_VALUE = 0;
- public final static InternalInfixOperandType INFIX_LEFT_OPERAND = new InternalInfixOperandType(INFIX_LEFT_OPERAND_VALUE, "Infix Left Operand Flag"); //$NON-NLS-1$
- /**
- * Used in Infix processing. Other operand (but not last) on expression stack
- */
- public final static int INFIX_OTHER_OPERAND_VALUE = 1;
- public final static InternalInfixOperandType INFIX_OTHER_OPERAND = new InternalInfixOperandType(INFIX_OTHER_OPERAND_VALUE,
- "Infix Other Operand Flag"); //$NON-NLS-1$
- /**
- * Used in Infix processing. Rightmost (last) operand on expression stack
- */
- public final static int INFIX_LAST_OPERAND_VALUE = 2;
- public final static InternalInfixOperandType INFIX_LAST_OPERAND = new InternalInfixOperandType(INFIX_LAST_OPERAND_VALUE, "Infix Last Operand Flag"); //$NON-NLS-1$
-
- /**
- * Return the enum for the given value.
- * @param value
- * @return
- *
- * @since 1.1.0
- */
- public static InternalInfixOperandType get(int value) {
- switch (value) {
- case INFIX_LAST_OPERAND_VALUE:
- return INFIX_LAST_OPERAND;
- case INFIX_LEFT_OPERAND_VALUE:
- return INFIX_LEFT_OPERAND;
- case INFIX_OTHER_OPERAND_VALUE:
- return INFIX_OTHER_OPERAND;
- }
- return null;
- }
-
- private InternalInfixOperandType(int value, String name) {
- super(value, name);
- }
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/NoExpressionValueException.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/NoExpressionValueException.java
deleted file mode 100644
index 41e6a777c..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/NoExpressionValueException.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: NoExpressionValueException.java,v $
- * $Revision: 1.3 $ $Date: 2005/07/20 19:27:25 $
- */
-package org.eclipse.jem.internal.proxy.initParser.tree;
-
-
-/**
- * The expression (or some nested expression) did not return a value. I.e. it was <code>void</code>.
- * This would occur only if the value of expression was being retrieved through getExpressionValue,
- * or if a nested expression was used, since in that case the value would of been used as an
- * argument or receiver to another expression.
- *
- * @since 1.0.0
- */
-public class NoExpressionValueException extends Exception {
-
- /**
- * Comment for <code>serialVersionUID</code>
- *
- * @since 1.1.0
- */
- private static final long serialVersionUID = -7953101867782417964L;
-
- private InternalExpressionProxy proxy;
-
- /**
- * Construct with no arguments.
- *
- * @since 1.0.0
- */
- public NoExpressionValueException() {
- super();
- }
-
- public NoExpressionValueException(Throwable e) {
- super(e);
- }
-
- /**
- * Construct with a message.
- *
- * @param message
- *
- * @since 1.0.0
- */
- public NoExpressionValueException(String message) {
- this(message, null);
- }
-
- /**
- * Construct with a message and a proxy. This is only used from {@link ExpressionProcesser#getExpressionProxyValue(int, Object[])} when
- * the proxy existed but it was not set.
- *
- * @param message
- * @param proxy
- *
- * @since 1.1.0
- */
- public NoExpressionValueException(String message, InternalExpressionProxy proxy) {
- super (message);
- this.proxy = proxy;
- }
-
- /**
- * Get the proxy if there is one. It will be a proxy if {@link ExpressionProcesser#getExpressionProxyValue(int, Object[])}
- * was for an existing proxy but that proxy was not set. Otherwise it will be null. This is here for callers to
- * put special info in the proxy for the not set condition and report better info.
- *
- * @return the proxy (if not set) or <code>null</code> if no proxy available.
- *
- * @since 1.1.0
- */
- public InternalExpressionProxy getProxy() {
- return proxy;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/PrefixOperator.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/PrefixOperator.java
deleted file mode 100644
index a1e0a3021..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/PrefixOperator.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: PrefixOperator.java,v $
- * $Revision: 1.2 $ $Date: 2005/05/18 23:11:26 $
- */
-package org.eclipse.jem.internal.proxy.initParser.tree;
-
-/**
- * Enum for prefix operator.
- *
- * @since 1.1.0
- */
-public class PrefixOperator extends AbstractEnum {
-
- /**
- * Prefix plus "+"
- */
- public static final int PRE_PLUS_VALUE = 0;
-
- public static final PrefixOperator PRE_PLUS = new PrefixOperator(PRE_PLUS_VALUE, "Prefix +"); //$NON-NLS-1$
-
- /**
- * Prefix minus "-"
- */
- public static final int PRE_MINUS_VALUE = 1;
-
- public static final PrefixOperator PRE_MINUS = new PrefixOperator(PRE_MINUS_VALUE, "Prefix -"); //$NON-NLS-1$
-
- /**
- * Prefix bitwise complement "~"
- */
- public static final int PRE_COMPLEMENT_VALUE = 2;
-
- public static final PrefixOperator PRE_COMPLEMENT = new PrefixOperator(PRE_COMPLEMENT_VALUE, "Prefix ~"); //$NON-NLS-1$
-
- /**
- * Prefix logical not "!"
- */
- public static final int PRE_NOT_VALUE = 3;
-
- public static final PrefixOperator PRE_NOT = new PrefixOperator(PRE_NOT_VALUE, "Prefix !"); //$NON-NLS-1$
-
- /**
- * Return the prefix operator for the given enum value.
- * @param value
- * @return
- *
- * @since 1.1.0
- */
- public static PrefixOperator get(int value) {
- switch (value) {
- case PRE_PLUS_VALUE:
- return PRE_PLUS;
- case PRE_MINUS_VALUE:
- return PRE_MINUS;
- case PRE_COMPLEMENT_VALUE:
- return PRE_COMPLEMENT;
- case PRE_NOT_VALUE:
- return PRE_NOT;
- }
- return null;
- }
-
- private PrefixOperator(int value, String name) {
- super(value, name);
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/VariableReference.java b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/VariableReference.java
deleted file mode 100644
index 645f2b339..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/VariableReference.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile: VariableReference.java,v $
- * $Revision: 1.2 $ $Date: 2005/08/24 20:39:07 $
- */
-package org.eclipse.jem.internal.proxy.initParser.tree;
-
-
-/**
- * This represents a Variable Reference value. A variable reference value can be on the left
- * side of an assignment (e.g. field or array access) or on any side
- * of any expression. When on the left side of an assignment, then the
- * value can assigned to. Such as <code>x[3] = 4</code>. Or it is value
- * that can be used in expressions, such as <code>x[3] + 2</code>.
- * <p>
- * When dereferenced, the value is given (see {@link VariableReference#dereference()}) as
- * the result or it is set with a value and then deferenced (see {@link VariableReference#set(Object, Class)}).
- * <p>
- * The type of the reference is the type stored in the corresponding expressionTypeStack entry. This is the type
- * for assignment, and the type for dereferenced.
- * @since 1.1.0
- */
-public abstract class VariableReference {
-
- /**
- * Dereference the value.
- * @return the dereferenced value. Such as the result of <code>x[3]</code>. The type of the reference
- * is the type stored in the corresponding expressionTypeStack entry for this reference.
- * @throws IllegalAccessException
- * @throws IllegalArgumentException
- *
- * @since 1.1.0
- */
- public abstract Object dereference();
-
- /**
- * Set the value into the variable and dereference it. Once it is set it is
- * no longer a reference and must be dereferenced.
- * @param value value to set to.
- * @param type type of the value being set. It may be of use to the reference or maybe not.
- * @return the dereferenced value after being set. The type of the dereferenced value
- * is the type stored in the corresponding expressionTypeStack entry for this reference.
- * @throws IllegalAccessException
- * @throws IllegalArgumentException
- *
- * @since 1.1.0
- */
- public abstract Object set(Object value, Class type) throws IllegalArgumentException, IllegalAccessException;
-}
diff --git a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/messages.properties b/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/messages.properties
deleted file mode 100644
index da6840dc1..000000000
--- a/plugins/org.eclipse.jem.proxy/initParser/org/eclipse/jem/internal/proxy/initParser/tree/messages.properties
+++ /dev/null
@@ -1,29 +0,0 @@
-###############################################################################
-# Copyright (c) 2003, 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-ExpressionProcesser.CannotCastXToY_EXC_ = IWAV0156E Cannot cast "{0}" to be "{1}".
-ExpressionProcesser.InvalidOperandOfPrefixOperator_EXC_ = IWAV0157E {0} not valid as the operand of prefix operator "{1}".
-ExpressionProcesser.PopExpressionType.ExpressionVoid_EXC_=Expression was void.
-ExpressionProcesser.InvalidOperandOfOperator_EXC_ = IWAV0158E {0} not valid as the operand of operator "{1}".
-ExpressionProcesser.XIsGreaterThanNumberOfDimensionsInArray_EXC_ = IWAV0159E {0} is greater then number of dimensions ({1}) in the array
-ExpressionProcesser.CreateArrayAccessReference.OutOfBounds_EXC_=Index: {0} size:{1}
-ExpressionProcesser.PushTryEnd.TryEndReceivedOutOfOrder_EXC_=Try/end received out of order.
-ExpressionProcesser.PushEndmark.EndMarkOnNonExistingID_EXC_=Tried to do an end mark on a non-existing markID ({0})
-ExpressionProcesser.NotAnArray_EXC_ = IWAV0160E "{0}" is not an array.
-ExpressionProcesser.ArraytypeHasFewerDimensionsThanRequested_EXC_ = IWAV0161E Arraytype "{0}" has fewer dimensions than creation requested ({1}).
-ExpressionProcesser.CreateFieldAccessReference.FieldsTypesNotMatching_EXC_=Field receiver does not match the type of the field: Field: {0} receiver: {1}
-ExpressionProcesser.GetExpressionProxyValue.ExpressionProxyNotSet_EXC_=Expression Proxy never set.
-ExpressionProcesser.GetExpressionProxyValue.ExpressionProxyDoesntExist_EXC_=Expression proxy doesn't exist.
-ExpressionProcesser.PushBlockEnd.ReceivedEndBlocksOutOfOrder_EXC_=End Blocks received out of order.
-ExpressionProcesser.PushTryCatchClause.CatchReceivedOutOfOrder_EXC_=Catch received out of order.
-ExpressionProcesser.PushTryFinallyClause.FinallyReceivedOutOfOrder_EXC_=Finally received out of order.
-ExpressionProcesser.PushTryRethrow.RethrowReceivedOutOfOrder_EXC_=Rethrow received out of order.
-ExpressionProcesser.PushTryRethrow.RetryReceivedOutOfExecutingCatchClause_EXC_=Retry received outside of an executing catch clause
-ExpressionProcesser.PushSubexpressionEnd.ReceivedEndSubexpressionsOutOfOrder_EXC_=End Subexpressions received out of order.

Back to the top