Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipe Mulet2003-03-07 11:37:41 -0500
committerPhilipe Mulet2003-03-07 11:37:41 -0500
commit54f164eeac255f1f065efe37b678803c779ab2a5 (patch)
tree94ab26b353e7bd946e8b757f233fb9c997013cd8
parent080ec07b7aa570e463db1b1ed5907c4ca70f37bd (diff)
downloadeclipse.jdt.core-ECLIPSE_1_0.tar.gz
eclipse.jdt.core-ECLIPSE_1_0.tar.xz
eclipse.jdt.core-ECLIPSE_1_0.zip
*** empty log message ***ECLIPSE_1_0
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java297
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java467
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompoundAssignment.java263
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java593
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java1088
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java503
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java741
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExtendedStringLiteral.java112
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java299
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java745
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java519
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImportReference.java103
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java175
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InnerTypeDeclaration.java20
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java419
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteralMinValue.java44
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LabeledStatement.java177
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Literal.java65
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalTypeDeclaration.java113
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteralMinValue.java43
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MagicLiteral.java51
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java525
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java195
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NameReference.java100
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NumberLiteral.java52
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorExpression.java3198
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorIds.java74
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/PostfixExpression.java117
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/PrefixExpression.java89
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java525
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java1224
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedSuperReference.java91
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java259
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java113
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Reference.java143
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java1
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java1316
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java119
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java211
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SuperReference.java111
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java521
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SynchronizedStatement.java281
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ThrowStatement.java137
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java193
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileStruct.java571
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFormatException.java137
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/FieldInfo.java562
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java418
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java35
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CaseLabel.java150
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java5
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java5362
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/DoubleCache.java268
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/FloatCache.java268
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/IntegerCache.java304
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/LongCache.java304
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ObjectCache.java298
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/Opcodes.java421
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/QualifiedNamesConstants.java144
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryMethod.java76
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryNestedType.java64
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryType.java140
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ICompilationUnit.java52
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IConstants.java77
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IDependent.java57
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IGenericField.java43
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IGenericMethod.java48
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IGenericType.java53
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/INameEnvironment.java111
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceField.java73
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceMethod.java123
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceType.java205
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/NameEnvironmentAnswer.java133
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java244
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ExceptionHandlingFlowContext.java270
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FinallyFlowContext.java130
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java794
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java157
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/InitializationFlowContext.java105
80 files changed, 14256 insertions, 14380 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java
index a8ff9eca58..d6f9ab0427 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java
@@ -1,149 +1,148 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.*;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-import org.eclipse.jdt.internal.compiler.parser.*;
-import org.eclipse.jdt.internal.compiler.problem.*;
-
-public class Clinit extends AbstractMethodDeclaration {
- public final static char[] ConstantPoolName = "<clinit>"/*nonNLS*/.toCharArray();
-public Clinit() {
- modifiers = 0;
- selector = ConstantPoolName;
-}
-public void analyseCode(ClassScope classScope, InitializationFlowContext staticInitializerFlowContext, FlowInfo flowInfo){
-
- if (ignoreFurtherInvestigation)
- return;
- try {
- ExceptionHandlingFlowContext clinitContext = new ExceptionHandlingFlowContext(
- staticInitializerFlowContext.parent,
- this,
- NoExceptions,
- scope,
- FlowInfo.DeadEnd);
-
- // check for missing returning path
- needFreeReturn = !((flowInfo == FlowInfo.DeadEnd) || flowInfo.isFakeReachable());
-
- // check missing blank final field initializations
- flowInfo = flowInfo.mergedWith(staticInitializerFlowContext.initsOnReturn);
- FieldBinding[] fields = scope.enclosingSourceType().fields();
- for (int i = 0, count = fields.length; i < count; i++) {
- FieldBinding field;
- if ((field = fields[i]).isStatic()
- && field.isFinal()
- && (!flowInfo.isDefinitelyAssigned(fields[i]))) {
- scope.problemReporter().uninitializedBlankFinalField(field, scope.referenceType().declarationOf(field)); // can complain against the field decl, since only one <clinit>
- }
- }
- // check static initializers thrown exceptions
- staticInitializerFlowContext.checkInitializerExceptions(scope, clinitContext, flowInfo);
- } catch (AbortMethod e) {
- this.ignoreFurtherInvestigation = true;
- }
-}
-/**
- * Bytecode generation for a <clinit> method
- *
- * @param classScope org.eclipse.jdt.internal.compiler.lookup.ClassScope
- * @param classFile org.eclipse.jdt.internal.compiler.codegen.ClassFile
- */
-public void generateCode(ClassScope classScope, ClassFile classFile) {
- int clinitOffset = 0;
- if (ignoreFurtherInvestigation) {
- // should never have to add any <clinit> problem method
- return;
- }
- try {
- clinitOffset = classFile.contentsOffset;
- ConstantPool constantPool = classFile.constantPool;
- int constantPoolOffset = constantPool.currentOffset;
- int constantPoolIndex = constantPool.currentIndex;
- classFile.generateMethodInfoHeaderForClinit();
- int codeAttributeOffset = classFile.contentsOffset;
- classFile.generateCodeAttributeHeader();
- CodeStream codeStream = classFile.codeStream;
- codeStream.reset(this, classFile);
- TypeDeclaration declaringType = classScope.referenceContext;
-
- // initialize local positions - including initializer scope.
- scope.computeLocalVariablePositions(0, codeStream); // should not be necessary
- MethodScope staticInitializerScope = declaringType.staticInitializerScope;
- staticInitializerScope.computeLocalVariablePositions(0, codeStream); // offset by the argument size
-
- // generate initializers
- if (declaringType.fields != null) {
- for (int i = 0, max = declaringType.fields.length; i < max; i++) {
- FieldDeclaration fieldDecl;
- if ((fieldDecl = declaringType.fields[i]).isStatic()) {
- fieldDecl.generateCode(staticInitializerScope, codeStream);
- }
- }
- }
- if (codeStream.position == 0) {
- // do not need to output a Clinit if no bytecodes
- // so we reset the offset inside the byte array contents.
- classFile.contentsOffset = clinitOffset;
- // like we don't addd a method we need to undo the increment on the method count
- classFile.methodCount--;
- // reset the constant pool to its state before the clinit
- constantPool.resetForClinit(constantPoolIndex, constantPoolOffset);
- } else {
- if (needFreeReturn) {
- int oldPosition = codeStream.position;
- codeStream.return_();
- codeStream.updateLocalVariablesAttribute(oldPosition);
- }
- // Record the end of the clinit: point to the declaration of the class
- codeStream.recordPositionsFrom(0, declaringType);
- classFile.completeCodeAttributeForClinit(codeAttributeOffset);
- }
- } catch (AbortMethod e) {
- // should never occur
- // the clinit referenceContext is the type declaration
- // All clinit problems will be reported against the type: AbortType instead of AbortMethod
- // reset the contentsOffset to the value before generating the clinit code
- // decrement the number of method info as well.
- // This is done in the addProblemMethod and addProblemConstructor for other
- // cases.
- classFile.contentsOffset = clinitOffset;
- classFile.methodCount--;
- }
-}
-public boolean isClinit() {
- return true;
-}
-public boolean isInitializationMethod(){
- return true;
-}
-public boolean isStatic() {
- return true;
-}
-public void parseStatements(Parser parser, CompilationUnitDeclaration unit){
- //the clinit is filled by hand ....
-}
-public void resolve(ClassScope scope) {
- this.scope = new MethodScope(scope, scope.referenceContext, true);
-}
-public String toString(int tab){
- /* slow code */
-
- String s = ""/*nonNLS*/ ;
- s = s + tabString(tab);
- s = s + "<clinit>()"/*nonNLS*/ ;
- s = s + toStringStatements(tab + 1);
- return s ;}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope classScope) {
- visitor.visit(this, classScope);
- visitor.endVisit(this, classScope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.*;
+import org.eclipse.jdt.internal.compiler.codegen.*;
+import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+import org.eclipse.jdt.internal.compiler.parser.*;
+import org.eclipse.jdt.internal.compiler.problem.*;
+
+public class Clinit extends AbstractMethodDeclaration {
+ public final static char[] ConstantPoolName = "<clinit>"/*nonNLS*/.toCharArray();
+public Clinit() {
+ modifiers = 0;
+ selector = ConstantPoolName;
+}
+public void analyseCode(ClassScope classScope, InitializationFlowContext staticInitializerFlowContext, FlowInfo flowInfo){
+
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ ExceptionHandlingFlowContext clinitContext = new ExceptionHandlingFlowContext(
+ staticInitializerFlowContext.parent,
+ this,
+ NoExceptions,
+ scope,
+ FlowInfo.DeadEnd);
+
+ // check for missing returning path
+ needFreeReturn = !((flowInfo == FlowInfo.DeadEnd) || flowInfo.isFakeReachable());
+
+ // check missing blank final field initializations
+ flowInfo = flowInfo.mergedWith(staticInitializerFlowContext.initsOnReturn);
+ FieldBinding[] fields = scope.enclosingSourceType().fields();
+ for (int i = 0, count = fields.length; i < count; i++) {
+ FieldBinding field;
+ if ((field = fields[i]).isStatic()
+ && field.isFinal()
+ && (!flowInfo.isDefinitelyAssigned(fields[i]))) {
+ scope.problemReporter().uninitializedBlankFinalField(field, scope.referenceType().declarationOf(field)); // can complain against the field decl, since only one <clinit>
+ }
+ }
+ // check static initializers thrown exceptions
+ staticInitializerFlowContext.checkInitializerExceptions(scope, clinitContext, flowInfo);
+ } catch (AbortMethod e) {
+ this.ignoreFurtherInvestigation = true;
+ }
+}
+/**
+ * Bytecode generation for a <clinit> method
+ *
+ * @param classScope org.eclipse.jdt.internal.compiler.lookup.ClassScope
+ * @param classFile org.eclipse.jdt.internal.compiler.codegen.ClassFile
+ */
+public void generateCode(ClassScope classScope, ClassFile classFile) {
+ int clinitOffset = 0;
+ if (ignoreFurtherInvestigation) {
+ // should never have to add any <clinit> problem method
+ return;
+ }
+ try {
+ clinitOffset = classFile.contentsOffset;
+ ConstantPool constantPool = classFile.constantPool;
+ int constantPoolOffset = constantPool.currentOffset;
+ int constantPoolIndex = constantPool.currentIndex;
+ classFile.generateMethodInfoHeaderForClinit();
+ int codeAttributeOffset = classFile.contentsOffset;
+ classFile.generateCodeAttributeHeader();
+ CodeStream codeStream = classFile.codeStream;
+ codeStream.reset(this, classFile);
+ TypeDeclaration declaringType = classScope.referenceContext;
+
+ // initialize local positions - including initializer scope.
+ scope.computeLocalVariablePositions(0, codeStream); // should not be necessary
+ MethodScope staticInitializerScope = declaringType.staticInitializerScope;
+ staticInitializerScope.computeLocalVariablePositions(0, codeStream); // offset by the argument size
+
+ // generate initializers
+ if (declaringType.fields != null) {
+ for (int i = 0, max = declaringType.fields.length; i < max; i++) {
+ FieldDeclaration fieldDecl;
+ if ((fieldDecl = declaringType.fields[i]).isStatic()) {
+ fieldDecl.generateCode(staticInitializerScope, codeStream);
+ }
+ }
+ }
+ if (codeStream.position == 0) {
+ // do not need to output a Clinit if no bytecodes
+ // so we reset the offset inside the byte array contents.
+ classFile.contentsOffset = clinitOffset;
+ // like we don't addd a method we need to undo the increment on the method count
+ classFile.methodCount--;
+ // reset the constant pool to its state before the clinit
+ constantPool.resetForClinit(constantPoolIndex, constantPoolOffset);
+ } else {
+ if (needFreeReturn) {
+ int oldPosition = codeStream.position;
+ codeStream.return_();
+ codeStream.updateLocalVariablesAttribute(oldPosition);
+ }
+ // Record the end of the clinit: point to the declaration of the class
+ codeStream.recordPositionsFrom(0, declaringType);
+ classFile.completeCodeAttributeForClinit(codeAttributeOffset);
+ }
+ } catch (AbortMethod e) {
+ // should never occur
+ // the clinit referenceContext is the type declaration
+ // All clinit problems will be reported against the type: AbortType instead of AbortMethod
+ // reset the contentsOffset to the value before generating the clinit code
+ // decrement the number of method info as well.
+ // This is done in the addProblemMethod and addProblemConstructor for other
+ // cases.
+ classFile.contentsOffset = clinitOffset;
+ classFile.methodCount--;
+ }
+}
+public boolean isClinit() {
+ return true;
+}
+public boolean isInitializationMethod(){
+ return true;
+}
+public boolean isStatic() {
+ return true;
+}
+public void parseStatements(Parser parser, CompilationUnitDeclaration unit){
+ //the clinit is filled by hand ....
+}
+public void resolve(ClassScope scope) {
+ this.scope = new MethodScope(scope, scope.referenceContext, true);
+}
+public String toString(int tab){
+ /* slow code */
+
+ String s = ""/*nonNLS*/ ;
+ s = s + tabString(tab);
+ s = s + "<clinit>()"/*nonNLS*/ ;
+ s = s + toStringStatements(tab + 1);
+ return s ;}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope classScope) {
+ visitor.visit(this, classScope);
+ visitor.endVisit(this, classScope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java
index 5fe113fec4..6e4b189bb5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java
@@ -1,234 +1,233 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.*;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-import org.eclipse.jdt.internal.compiler.problem.*;
-import org.eclipse.jdt.internal.compiler.util.*;
-
-public class CompilationUnitDeclaration extends AstNode implements ProblemSeverities, ReferenceContext {
- public ImportReference currentPackage;
- public ImportReference[] imports;
- public TypeDeclaration[] types;
- //public char[][] name;
-
- public boolean ignoreFurtherInvestigation = false; // once pointless to investigate due to errors
- public boolean ignoreMethodBodies = false;
- /*
- lookup is done first in the CompilationUnit then
- on the explicit import types then in the current
- pakage and finaly into the on demand imports.
- */
- public CompilationUnitScope scope;
- public ProblemReporter problemReporter;
- public CompilationResult compilationResult;
- //public ProblemHandler.Policy handlingPolicy;
-
- private LocalTypeBinding[] allLocalTypes;
- public boolean isPropagatingInnerClassEmulation;
-public CompilationUnitDeclaration(ProblemReporter problemReporter, CompilationResult compilationResult, int sourceLength) {
-
- this.problemReporter = problemReporter;
- this.compilationResult = compilationResult;
-
- //by definition of a compilation unit....
- sourceStart = 0;
- sourceEnd = sourceLength - 1;
-
-}
-/*
- * We cause the compilation task to abort to a given extent.
- */
-public void abort(int abortLevel) {
-
- switch (abortLevel) {
- case AbortType :
- throw new AbortType(compilationResult);
- case AbortMethod :
- throw new AbortMethod(compilationResult);
- default :
- throw new AbortCompilationUnit(compilationResult);
- }
-}
-/*
- * Dispatch code analysis AND request saturation of inner emulation
- */
-public void analyseCode() {
- if (ignoreFurtherInvestigation)
- return;
- try {
- if (types != null) {
- for (int i = 0, count = types.length; i < count; i++) {
- types[i].analyseCode(scope);
- }
- }
- // request inner emulation propagation
- propagateInnerEmulationForAllLocalTypes();
- } catch (AbortCompilationUnit e) {
- this.ignoreFurtherInvestigation = true;
- return;
- }
-}
-/*
- * When unit result is about to be accepted, removed back pointers
- * to compiler structures.
- */
-public void cleanUp() {
-
- ClassFile[] classFiles = compilationResult.getClassFiles();
- for (int i = 0, max = classFiles.length; i < max; i++){
- // clear the classFile back pointer to the bindings
- ClassFile classFile = classFiles[i];
- // null out the type's scope backpointers
- ((SourceTypeBinding) classFile.referenceBinding).scope = null;
- // null out the classfile backpointer to a type binding
- classFile.referenceBinding = null;
- classFile.codeStream = null; // codeStream holds onto ast and scopes
- classFile.innerClassesBindings = null;
- }
-}
-public CompilationResult compilationResult(){
- return compilationResult;
-}
-/*
- * Finds the matching type amoung this compilation unit types.
- * Returns null if no type with this name is found.
- * The type name is a compound name
- * eg. if we're looking for X.A.B then a type name would be {X, A, B}
- */
-public TypeDeclaration declarationOfType(char[][] typeName) {
- for (int i = 0; i < this.types.length; i++) {
- TypeDeclaration typeDecl = this.types[i].declarationOfType(typeName);
- if (typeDecl != null) {
- return typeDecl;
- }
- }
- return null;
-}
-/**
- * Bytecode generation
- */
-public void generateCode() {
- if (ignoreFurtherInvestigation) {
- if (types != null) {
- for (int i = 0, count = types.length; i < count; i++){
- types[i].ignoreFurtherInvestigation = true; // propagate the flag to request problem type creation
- types[i].generateCode(scope);
- }
- }
- return;
- }
- try {
- if (types != null) {
- for (int i = 0, count = types.length; i < count; i++)
- types[i].generateCode(scope);
- }
- } catch (AbortCompilationUnit e) {
- }
-}
-public char[] getFileName() {
- return compilationResult.getFileName();
-}
-public char[] getMainTypeName() {
- if (compilationResult.compilationUnit == null) {
- char[] fileName = compilationResult.getFileName();
-
- int start = CharOperation.lastIndexOf('/', fileName) + 1;
- if (start == 0 || start < CharOperation.lastIndexOf('\\', fileName))
- start = CharOperation.lastIndexOf('\\', fileName) + 1;
-
- int end = CharOperation.lastIndexOf('.', fileName);
- if (end == -1)
- end = fileName.length;
-
- return CharOperation.subarray(fileName, start, end);
- } else {
- return compilationResult.compilationUnit.getMainTypeName();
- }
-}
-public boolean isEmpty() {
-
- return (currentPackage == null)
- && (imports == null)
- && (types == null);}
-/*
- * Force inner local types to update their innerclass emulation
- */
-public void propagateInnerEmulationForAllLocalTypes() {
-
- isPropagatingInnerClassEmulation = true;
- if (allLocalTypes != null) {
- for (int i = 0, max = allLocalTypes.length; i < max; i++) {
- allLocalTypes[i].updateInnerEmulationDependents();
- }
- }
-}
-/*
- * Keep track of all local types, so as to update their innerclass
- * emulation later on.
- */
-public void record(LocalTypeBinding localType){
- if (allLocalTypes == null){
- allLocalTypes = new LocalTypeBinding[]{ localType };
- } else {
- int length = allLocalTypes.length;
- System.arraycopy(allLocalTypes, 0, (allLocalTypes = new LocalTypeBinding[length+1]), 0, length);
- allLocalTypes[length] = localType;
- }
-}
-public void resolve() {
- try {
- if (types != null)
- for (int i = 0, count = types.length; i < count; i++)
- types[i].resolve(scope);
- } catch (AbortCompilationUnit e) {
- this.ignoreFurtherInvestigation = true;
- return;
- }
-}
-public void tagAsHavingErrors(){
- ignoreFurtherInvestigation = true;
-}
-public String toString(int tab) {
- /*very slow code*/
-
- String s = ""/*nonNLS*/;
- if (currentPackage != null)
- s = tabString(tab) + "package "/*nonNLS*/ + currentPackage.toString(0, false) + ";\n"/*nonNLS*/;
-
- if (imports != null)
- for (int i = 0; i < imports.length; i++) {
- s += tabString(tab) + "import "/*nonNLS*/ + imports[i].toString() + ";\n"/*nonNLS*/;
- };
-
- if (types != null)
- for (int i = 0; i < types.length; i++) {
- s += types[i].toString(tab) + "\n"/*nonNLS*/;
- }
- return s;
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, CompilationUnitScope scope) {
- if (ignoreFurtherInvestigation)
- return;
- try {
- if (visitor.visit(this, scope)) {
- if (imports != null) {
- int importLength = imports.length;
- for (int i = 0; i < importLength; i++)
- imports[i].traverse(visitor, scope);
- }
- if (types != null) {
- int typesLength = types.length;
- for (int i = 0; i < typesLength; i++)
- types[i].traverse(visitor, scope);
- }
- }
- } catch (AbortCompilationUnit e) {
- }
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.*;
+import org.eclipse.jdt.internal.compiler.impl.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+import org.eclipse.jdt.internal.compiler.problem.*;
+import org.eclipse.jdt.internal.compiler.util.*;
+
+public class CompilationUnitDeclaration extends AstNode implements ProblemSeverities, ReferenceContext {
+ public ImportReference currentPackage;
+ public ImportReference[] imports;
+ public TypeDeclaration[] types;
+ //public char[][] name;
+
+ public boolean ignoreFurtherInvestigation = false; // once pointless to investigate due to errors
+ public boolean ignoreMethodBodies = false;
+ /*
+ lookup is done first in the CompilationUnit then
+ on the explicit import types then in the current
+ pakage and finaly into the on demand imports.
+ */
+ public CompilationUnitScope scope;
+ public ProblemReporter problemReporter;
+ public CompilationResult compilationResult;
+ //public ProblemHandler.Policy handlingPolicy;
+
+ private LocalTypeBinding[] allLocalTypes;
+ public boolean isPropagatingInnerClassEmulation;
+public CompilationUnitDeclaration(ProblemReporter problemReporter, CompilationResult compilationResult, int sourceLength) {
+
+ this.problemReporter = problemReporter;
+ this.compilationResult = compilationResult;
+
+ //by definition of a compilation unit....
+ sourceStart = 0;
+ sourceEnd = sourceLength - 1;
+
+}
+/*
+ * We cause the compilation task to abort to a given extent.
+ */
+public void abort(int abortLevel) {
+
+ switch (abortLevel) {
+ case AbortType :
+ throw new AbortType(compilationResult);
+ case AbortMethod :
+ throw new AbortMethod(compilationResult);
+ default :
+ throw new AbortCompilationUnit(compilationResult);
+ }
+}
+/*
+ * Dispatch code analysis AND request saturation of inner emulation
+ */
+public void analyseCode() {
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ if (types != null) {
+ for (int i = 0, count = types.length; i < count; i++) {
+ types[i].analyseCode(scope);
+ }
+ }
+ // request inner emulation propagation
+ propagateInnerEmulationForAllLocalTypes();
+ } catch (AbortCompilationUnit e) {
+ this.ignoreFurtherInvestigation = true;
+ return;
+ }
+}
+/*
+ * When unit result is about to be accepted, removed back pointers
+ * to compiler structures.
+ */
+public void cleanUp() {
+
+ ClassFile[] classFiles = compilationResult.getClassFiles();
+ for (int i = 0, max = classFiles.length; i < max; i++){
+ // clear the classFile back pointer to the bindings
+ ClassFile classFile = classFiles[i];
+ // null out the type's scope backpointers
+ ((SourceTypeBinding) classFile.referenceBinding).scope = null;
+ // null out the classfile backpointer to a type binding
+ classFile.referenceBinding = null;
+ classFile.codeStream = null; // codeStream holds onto ast and scopes
+ classFile.innerClassesBindings = null;
+ }
+}
+public CompilationResult compilationResult(){
+ return compilationResult;
+}
+/*
+ * Finds the matching type amoung this compilation unit types.
+ * Returns null if no type with this name is found.
+ * The type name is a compound name
+ * eg. if we're looking for X.A.B then a type name would be {X, A, B}
+ */
+public TypeDeclaration declarationOfType(char[][] typeName) {
+ for (int i = 0; i < this.types.length; i++) {
+ TypeDeclaration typeDecl = this.types[i].declarationOfType(typeName);
+ if (typeDecl != null) {
+ return typeDecl;
+ }
+ }
+ return null;
+}
+/**
+ * Bytecode generation
+ */
+public void generateCode() {
+ if (ignoreFurtherInvestigation) {
+ if (types != null) {
+ for (int i = 0, count = types.length; i < count; i++){
+ types[i].ignoreFurtherInvestigation = true; // propagate the flag to request problem type creation
+ types[i].generateCode(scope);
+ }
+ }
+ return;
+ }
+ try {
+ if (types != null) {
+ for (int i = 0, count = types.length; i < count; i++)
+ types[i].generateCode(scope);
+ }
+ } catch (AbortCompilationUnit e) {
+ }
+}
+public char[] getFileName() {
+ return compilationResult.getFileName();
+}
+public char[] getMainTypeName() {
+ if (compilationResult.compilationUnit == null) {
+ char[] fileName = compilationResult.getFileName();
+
+ int start = CharOperation.lastIndexOf('/', fileName) + 1;
+ if (start == 0 || start < CharOperation.lastIndexOf('\\', fileName))
+ start = CharOperation.lastIndexOf('\\', fileName) + 1;
+
+ int end = CharOperation.lastIndexOf('.', fileName);
+ if (end == -1)
+ end = fileName.length;
+
+ return CharOperation.subarray(fileName, start, end);
+ } else {
+ return compilationResult.compilationUnit.getMainTypeName();
+ }
+}
+public boolean isEmpty() {
+
+ return (currentPackage == null)
+ && (imports == null)
+ && (types == null);}
+/*
+ * Force inner local types to update their innerclass emulation
+ */
+public void propagateInnerEmulationForAllLocalTypes() {
+
+ isPropagatingInnerClassEmulation = true;
+ if (allLocalTypes != null) {
+ for (int i = 0, max = allLocalTypes.length; i < max; i++) {
+ allLocalTypes[i].updateInnerEmulationDependents();
+ }
+ }
+}
+/*
+ * Keep track of all local types, so as to update their innerclass
+ * emulation later on.
+ */
+public void record(LocalTypeBinding localType){
+ if (allLocalTypes == null){
+ allLocalTypes = new LocalTypeBinding[]{ localType };
+ } else {
+ int length = allLocalTypes.length;
+ System.arraycopy(allLocalTypes, 0, (allLocalTypes = new LocalTypeBinding[length+1]), 0, length);
+ allLocalTypes[length] = localType;
+ }
+}
+public void resolve() {
+ try {
+ if (types != null)
+ for (int i = 0, count = types.length; i < count; i++)
+ types[i].resolve(scope);
+ } catch (AbortCompilationUnit e) {
+ this.ignoreFurtherInvestigation = true;
+ return;
+ }
+}
+public void tagAsHavingErrors(){
+ ignoreFurtherInvestigation = true;
+}
+public String toString(int tab) {
+ /*very slow code*/
+
+ String s = ""/*nonNLS*/;
+ if (currentPackage != null)
+ s = tabString(tab) + "package "/*nonNLS*/ + currentPackage.toString(0, false) + ";\n"/*nonNLS*/;
+
+ if (imports != null)
+ for (int i = 0; i < imports.length; i++) {
+ s += tabString(tab) + "import "/*nonNLS*/ + imports[i].toString() + ";\n"/*nonNLS*/;
+ };
+
+ if (types != null)
+ for (int i = 0; i < types.length; i++) {
+ s += types[i].toString(tab) + "\n"/*nonNLS*/;
+ }
+ return s;
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, CompilationUnitScope scope) {
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ if (visitor.visit(this, scope)) {
+ if (imports != null) {
+ int importLength = imports.length;
+ for (int i = 0; i < importLength; i++)
+ imports[i].traverse(visitor, scope);
+ }
+ if (types != null) {
+ int typesLength = types.length;
+ for (int i = 0; i < typesLength; i++)
+ types[i].traverse(visitor, scope);
+ }
+ }
+ } catch (AbortCompilationUnit e) {
+ }
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompoundAssignment.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompoundAssignment.java
index 8f3df73445..299db3909f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompoundAssignment.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompoundAssignment.java
@@ -1,132 +1,131 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-
-public class CompoundAssignment extends Assignment implements OperatorIds {
- public int operator;
- public int assignmentImplicitConversion;
-
- // var op exp is equivalent to var = (varType) var op exp
- // assignmentImplicitConversion stores the cast needed for the assignment
-
-public CompoundAssignment(Expression lhs, Expression expression,int operator) {
- //lhs is always a reference by construction ,
- //but is build as an expression ==> the checkcast cannot fail
-
- super(lhs, expression);
- this.operator = operator ;
-
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- // record setting a variable: various scenarii are possible, setting an array reference,
- // a field reference, a blank final field reference, a field of an enclosing instance or
- // just a local variable.
-
- return lhs.analyseAssignment(currentScope, flowContext, flowInfo, this, true).unconditionalInits();
-}
-public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
-
- // various scenarii are possible, setting an array reference,
- // a field reference, a blank final field reference, a field of an enclosing instance or
- // just a local variable.
-
- int pc = codeStream.position;
- lhs.generateCompoundAssignment(currentScope, codeStream, expression, operator, assignmentImplicitConversion, valueRequired);
- if (valueRequired) {
- codeStream.generateImplicitConversion(implicitConversion);
- }
- codeStream.recordPositionsFrom(pc, this);
-}
-public String operatorToString() {
- switch (operator) {
- case PLUS :
- return "+="/*nonNLS*/;
- case MINUS :
- return "-="/*nonNLS*/;
- case MULTIPLY :
- return "*="/*nonNLS*/;
- case DIVIDE :
- return "/="/*nonNLS*/;
- case AND :
- return "&="/*nonNLS*/;
- case OR :
- return "|="/*nonNLS*/;
- case XOR :
- return "^="/*nonNLS*/;
- case REMAINDER :
- return "%="/*nonNLS*/;
- case LEFT_SHIFT :
- return "<<="/*nonNLS*/;
- case RIGHT_SHIFT :
- return ">>="/*nonNLS*/;
- case UNSIGNED_RIGHT_SHIFT :
- return ">>>="/*nonNLS*/;
- };
- return "unknown operator"/*nonNLS*/;
-}
-public TypeBinding resolveType(BlockScope scope) {
- constant = NotAConstant;
- TypeBinding lhsTb = lhs.resolveType(scope);
- TypeBinding expressionTb = expression.resolveType(scope);
- if (lhsTb == null || expressionTb == null)
- return null;
-
- int lhsId = lhsTb.id;
- int expressionId = expressionTb.id;
- if (restrainUsageToNumericTypes() && !lhsTb.isNumericType()) {
- scope.problemReporter().operatorOnlyValidOnNumericType(this, lhsTb, expressionTb);
- return null;
- }
- if (lhsId > 15 || expressionId > 15) {
- if (lhsId != T_String) { // String += Object is valid wheraas Object -= String is not
- scope.problemReporter().invalidOperator(this, lhsTb, expressionTb);
- return null;
- }
- expressionId = T_Object; // use the Object has tag table
- }
-
- // the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4 <<0
-
- // the conversion is stored INTO the reference (info needed for the code gen)
- int result = OperatorExpression.ResolveTypeTables[operator][ (lhsId << 4) + expressionId];
- if (result == T_undefined) {
- scope.problemReporter().invalidOperator(this, lhsTb, expressionTb);
- return null;
- }
- if (operator == PLUS && scope.isJavaLangObject(lhsTb)) {
- // Object o = "hello";
- // o += " world" // <--illegal
- scope.problemReporter().invalidOperator(this, lhsTb, expressionTb);
- return null;
- }
- lhs.implicitConversion = result >>> 12;
- expression.implicitConversion = (result >>> 4) & 0x000FF;
- assignmentImplicitConversion = (lhsId << 4) + (result & 0x0000F);
- return lhsTb;
-}
-public boolean restrainUsageToNumericTypes(){
- return false ;}
-public String toStringExpressionNoParenthesis() {
-
- return lhs.toStringExpression() + " "/*nonNLS*/ +
- operatorToString() + " "/*nonNLS*/ +
- expression.toStringExpression() ; }
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- if (visitor.visit(this, scope)) {
- lhs.traverse(visitor, scope);
- expression.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.codegen.*;
+import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class CompoundAssignment extends Assignment implements OperatorIds {
+ public int operator;
+ public int assignmentImplicitConversion;
+
+ // var op exp is equivalent to var = (varType) var op exp
+ // assignmentImplicitConversion stores the cast needed for the assignment
+
+public CompoundAssignment(Expression lhs, Expression expression,int operator) {
+ //lhs is always a reference by construction ,
+ //but is build as an expression ==> the checkcast cannot fail
+
+ super(lhs, expression);
+ this.operator = operator ;
+
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ // record setting a variable: various scenarii are possible, setting an array reference,
+ // a field reference, a blank final field reference, a field of an enclosing instance or
+ // just a local variable.
+
+ return lhs.analyseAssignment(currentScope, flowContext, flowInfo, this, true).unconditionalInits();
+}
+public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+
+ // various scenarii are possible, setting an array reference,
+ // a field reference, a blank final field reference, a field of an enclosing instance or
+ // just a local variable.
+
+ int pc = codeStream.position;
+ lhs.generateCompoundAssignment(currentScope, codeStream, expression, operator, assignmentImplicitConversion, valueRequired);
+ if (valueRequired) {
+ codeStream.generateImplicitConversion(implicitConversion);
+ }
+ codeStream.recordPositionsFrom(pc, this);
+}
+public String operatorToString() {
+ switch (operator) {
+ case PLUS :
+ return "+="/*nonNLS*/;
+ case MINUS :
+ return "-="/*nonNLS*/;
+ case MULTIPLY :
+ return "*="/*nonNLS*/;
+ case DIVIDE :
+ return "/="/*nonNLS*/;
+ case AND :
+ return "&="/*nonNLS*/;
+ case OR :
+ return "|="/*nonNLS*/;
+ case XOR :
+ return "^="/*nonNLS*/;
+ case REMAINDER :
+ return "%="/*nonNLS*/;
+ case LEFT_SHIFT :
+ return "<<="/*nonNLS*/;
+ case RIGHT_SHIFT :
+ return ">>="/*nonNLS*/;
+ case UNSIGNED_RIGHT_SHIFT :
+ return ">>>="/*nonNLS*/;
+ };
+ return "unknown operator"/*nonNLS*/;
+}
+public TypeBinding resolveType(BlockScope scope) {
+ constant = NotAConstant;
+ TypeBinding lhsTb = lhs.resolveType(scope);
+ TypeBinding expressionTb = expression.resolveType(scope);
+ if (lhsTb == null || expressionTb == null)
+ return null;
+
+ int lhsId = lhsTb.id;
+ int expressionId = expressionTb.id;
+ if (restrainUsageToNumericTypes() && !lhsTb.isNumericType()) {
+ scope.problemReporter().operatorOnlyValidOnNumericType(this, lhsTb, expressionTb);
+ return null;
+ }
+ if (lhsId > 15 || expressionId > 15) {
+ if (lhsId != T_String) { // String += Object is valid wheraas Object -= String is not
+ scope.problemReporter().invalidOperator(this, lhsTb, expressionTb);
+ return null;
+ }
+ expressionId = T_Object; // use the Object has tag table
+ }
+
+ // the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4 <<0
+
+ // the conversion is stored INTO the reference (info needed for the code gen)
+ int result = OperatorExpression.ResolveTypeTables[operator][ (lhsId << 4) + expressionId];
+ if (result == T_undefined) {
+ scope.problemReporter().invalidOperator(this, lhsTb, expressionTb);
+ return null;
+ }
+ if (operator == PLUS && scope.isJavaLangObject(lhsTb)) {
+ // Object o = "hello";
+ // o += " world" // <--illegal
+ scope.problemReporter().invalidOperator(this, lhsTb, expressionTb);
+ return null;
+ }
+ lhs.implicitConversion = result >>> 12;
+ expression.implicitConversion = (result >>> 4) & 0x000FF;
+ assignmentImplicitConversion = (lhsId << 4) + (result & 0x0000F);
+ return lhsTb;
+}
+public boolean restrainUsageToNumericTypes(){
+ return false ;}
+public String toStringExpressionNoParenthesis() {
+
+ return lhs.toStringExpression() + " "/*nonNLS*/ +
+ operatorToString() + " "/*nonNLS*/ +
+ expression.toStringExpression() ; }
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ lhs.traverse(visitor, scope);
+ expression.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
index 78f87850fa..df91fb97a5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
@@ -1,297 +1,296 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.*;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-import org.eclipse.jdt.internal.compiler.parser.*;
-import org.eclipse.jdt.internal.compiler.problem.*;
-import org.eclipse.jdt.internal.compiler.util.*;
-
-public class ConstructorDeclaration extends AbstractMethodDeclaration {
- public ExplicitConstructorCall constructorCall;
- public final static char[] ConstantPoolName = "<init>"/*nonNLS*/.toCharArray();
- public boolean isDefaultConstructor = false;
-
- public int referenceCount = 0; // count how many times this constructor is referenced from other local constructors
-public void analyseCode(ClassScope classScope, InitializationFlowContext initializerFlowContext, FlowInfo flowInfo) {
- if (ignoreFurtherInvestigation)
- return;
- try {
- ExceptionHandlingFlowContext constructorContext = new ExceptionHandlingFlowContext(
- initializerFlowContext.parent,
- this,
- binding.thrownExceptions,
- scope,
- FlowInfo.DeadEnd);
- initializerFlowContext.checkInitializerExceptions(scope, constructorContext, flowInfo);
-
- // propagate to constructor call
- if (constructorCall != null) {
- // if calling 'this(...)', then flag all non-static fields as definitely
- // set since they are supposed to be set inside other local constructor
- if (constructorCall.accessMode == ExplicitConstructorCall.This) {
- FieldBinding[] fields = binding.declaringClass.fields();
- for (int i = 0, count = fields.length; i < count; i++) {
- FieldBinding field;
- if (!(field = fields[i]).isStatic()) {
- flowInfo.markAsDefinitelyAssigned(field);
- }
- }
- }
- flowInfo = constructorCall.analyseCode(scope, constructorContext, flowInfo);
- }
- // propagate to statements
- if (statements != null){
- for (int i = 0, count = statements.length; i < count; i++) {
- Statement stat;
- if (!flowInfo.complainIfUnreachable((stat = statements[i]), scope)) {
- flowInfo = stat.analyseCode(scope, constructorContext, flowInfo);
- }
- }
- }
- // check for missing returning path
- needFreeReturn = !((flowInfo == FlowInfo.DeadEnd) || flowInfo.isFakeReachable());
-
- // check missing blank final field initializations
- if ((constructorCall != null) && (constructorCall.accessMode != ExplicitConstructorCall.This)){
- flowInfo = flowInfo.mergedWith(initializerFlowContext.initsOnReturn);
- FieldBinding[] fields = binding.declaringClass.fields();
- for (int i = 0, count = fields.length; i < count; i++) {
- FieldBinding field;
- if ((!(field = fields[i]).isStatic())
- && field.isFinal()
- && (!flowInfo.isDefinitelyAssigned(fields[i]))) {
- scope.problemReporter().uninitializedBlankFinalField(field, isDefaultConstructor ? (AstNode)scope.referenceType() : this);
- }
- }
- }
- } catch (AbortMethod e) {
- this.ignoreFurtherInvestigation = true;
- }
-}
-public void checkName() {
- //look if the name of the method is correct
- //and proceed with the resolution of the special constructor statement
-
- if (!CharOperation.equals(scope.enclosingSourceType().sourceName, selector))
- scope.problemReporter().missingReturnType(this);
-
- // if null ==> an error has occurs at parsing time ....
- if (constructorCall != null){
- // e.g. using super() in java.lang.Object
- if ((binding.declaringClass.id == T_Object)
- && (constructorCall.accessMode != ExplicitConstructorCall.This)){
- if (constructorCall.accessMode == ExplicitConstructorCall.Super){
- scope.problemReporter().cannotUseSuperInJavaLangObject(constructorCall);
- }
- constructorCall = null;
- return;
- }
- constructorCall.resolve(scope);
- }
-}
-/**
- * Bytecode generation for a constructor
- *
- * @param classScope org.eclipse.jdt.internal.compiler.lookup.ClassScope
- * @param classFile org.eclipse.jdt.internal.compiler.codegen.ClassFile
- */
-public void generateCode(ClassScope classScope, ClassFile classFile) {
- int problemResetPC = 0;
- if (ignoreFurtherInvestigation) {
- if (this.binding == null)
- return; // Handle methods with invalid signature or duplicates
- int problemsLength;
- IProblem[] problems = scope.referenceCompilationUnit().compilationResult.getProblems();
- IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
- System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
- classFile.addProblemConstructor(this, binding, problemsCopy);
- return;
- }
- try {
- problemResetPC = classFile.contentsOffset;
- classFile.generateMethodInfoHeader(binding);
- int methodAttributeOffset = classFile.contentsOffset;
- int attributeNumber = classFile.generateMethodInfoAttribute(binding);
- if ((!binding.isNative()) && (!binding.isAbstract())) {
- TypeDeclaration declaringType = classScope.referenceContext;
- int codeAttributeOffset = classFile.contentsOffset;
- classFile.generateCodeAttributeHeader();
- CodeStream codeStream = classFile.codeStream;
- codeStream.reset(this, classFile);
- // initialize local positions - including initializer scope.
- ReferenceBinding declaringClass = binding.declaringClass;
- int argSize = 0;
- scope.computeLocalVariablePositions(// consider synthetic arguments if any
- argSize = declaringClass.isNestedType() ? ((NestedTypeBinding) declaringClass).syntheticArgumentsOffset : 1, codeStream);
- if (arguments != null) {
- for (int i = 0, max = arguments.length; i < max; i++) {
- // arguments initialization for local variable debug attributes
- LocalVariableBinding argBinding;
- codeStream.addVisibleLocalVariable(argBinding = arguments[i].binding);
- argBinding.recordInitializationStartPC(0);
- TypeBinding argType;
- if ((argType = argBinding.type) == LongBinding || (argType == DoubleBinding)) {
- argSize += 2;
- } else {
- argSize++;
- }
- }
- }
- MethodScope initializerScope = declaringType.initializerScope;
- initializerScope.computeLocalVariablePositions(argSize, codeStream); // offset by the argument size (since not linked to method scope)
-
- // generate constructor call
- if (constructorCall != null) {
- constructorCall.generateCode(scope, codeStream);
- }
- // generate field initialization - only if not invoking another constructor call of the same class
- if ((constructorCall != null) && (constructorCall.accessMode != ExplicitConstructorCall.This)) {
- // generate synthetic fields initialization
- if (declaringClass.isNestedType()) {
- NestedTypeBinding nestedType = (NestedTypeBinding) declaringClass;
- SyntheticArgumentBinding[] syntheticArgs = nestedType.syntheticEnclosingInstances();
- for (int i = 0, max = syntheticArgs == null ? 0 : syntheticArgs.length; i < max; i++) {
- if (syntheticArgs[i].matchingField != null) {
- codeStream.aload_0();
- codeStream.load(syntheticArgs[i]);
- codeStream.putfield(syntheticArgs[i].matchingField);
- }
- }
- syntheticArgs = nestedType.syntheticOuterLocalVariables();
- for (int i = 0, max = syntheticArgs == null ? 0 : syntheticArgs.length; i < max; i++) {
- if (syntheticArgs[i].matchingField != null) {
- codeStream.aload_0();
- codeStream.load(syntheticArgs[i]);
- codeStream.putfield(syntheticArgs[i].matchingField);
- }
- }
- }
- // generate user field initialization
- if (declaringType.fields != null) {
- for (int i = 0, max = declaringType.fields.length; i < max; i++) {
- FieldDeclaration fieldDecl;
- if (!(fieldDecl = declaringType.fields[i]).isStatic()) {
- fieldDecl.generateCode(initializerScope, codeStream);
- }
- }
- }
- }
- // generate statements
- if (statements != null) {
- for (int i = 0, max = statements.length; i < max; i++) {
- statements[i].generateCode(scope, codeStream);
- }
- }
- if (needFreeReturn) {
- codeStream.return_();
- }
- // local variable attributes
- codeStream.exitUserScope(scope);
- codeStream.recordPositionsFrom(0, this);
- classFile.completeCodeAttribute(codeAttributeOffset);
- attributeNumber++;
- }
- classFile.completeMethodInfo(methodAttributeOffset, attributeNumber);
-
- // if a problem got reported during code gen, then trigger problem method creation
- if (ignoreFurtherInvestigation){
- throw new AbortMethod(scope.referenceCompilationUnit().compilationResult);
- }
- } catch (AbortMethod e) {
- int problemsLength;
- IProblem[] problems = scope.referenceCompilationUnit().compilationResult.getProblems();
- IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
- System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
- classFile.addProblemConstructor(this, binding, problemsCopy, problemResetPC);
- }
-}
-public boolean isConstructor() {
- return true;
-}
-public boolean isDefaultConstructor() {
- return isDefaultConstructor;
-}
-public boolean isInitializationMethod() {
- return true;
-}
-public void parseStatements(Parser parser, CompilationUnitDeclaration unit){
- //fill up the constructor body with its statements
-
- if (ignoreFurtherInvestigation) return;
- if (isDefaultConstructor ) return ;
- parser.parse(this, unit);
-
-}
-/*
- * Type checking for constructor, just another method, except for special check
- * for recursive constructor invocations.
- */
-public void resolve(ClassScope upperScope) {
-
- if (binding == null) {
- ignoreFurtherInvestigation = true;
- return;
- }
-
- super.resolve(upperScope);
-
- try {
- // checking for recursive constructor call
- if (constructorCall != null) {
- // indirect reference: increment target constructor reference count
- if (constructorCall.binding != null && !constructorCall.isSuperAccess() && constructorCall.binding.isValidBinding()) {
- ((ConstructorDeclaration) (upperScope.referenceContext.declarationOf(constructorCall.binding))).referenceCount++;
- }
- }
- } catch (AbortMethod e) {
- this.ignoreFurtherInvestigation = true;
- }
-}
-public String toStringStatements(int tab) {
- /* slow code */
-
- String s = " {"/*nonNLS*/;
- if (constructorCall != null) {
- s = s + "\n"/*nonNLS*/ + constructorCall.toString(tab) + ";"/*nonNLS*/;
- }
- if (statements != null){
- for (int i = 0; i < statements.length; i++){
- s = s + "\n"/*nonNLS*/ + statements[i].toString(tab);
- if (!(statements[i] instanceof Block)){
- s += ";"/*nonNLS*/;
- }
- }
- }
- s+="\n"/*nonNLS*/+tabString(tab == 0 ? 0 : tab - 1)+"}"/*nonNLS*/;
- return s;
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope classScope) {
- if (visitor.visit(this, classScope)) {
- if (arguments != null) {
- int argumentLength = arguments.length;
- for (int i = 0; i < argumentLength; i++)
- arguments[i].traverse(visitor, scope);
- }
- if (thrownExceptions != null) {
- int thrownExceptionsLength = thrownExceptions.length;
- for (int i = 0; i < thrownExceptionsLength; i++)
- thrownExceptions[i].traverse(visitor, scope);
- }
- if (constructorCall != null)
- constructorCall.traverse(visitor, scope);
- if (statements != null) {
- int statementsLength = statements.length;
- for (int i = 0; i < statementsLength; i++)
- statements[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, classScope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.*;
+import org.eclipse.jdt.internal.compiler.codegen.*;
+import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+import org.eclipse.jdt.internal.compiler.parser.*;
+import org.eclipse.jdt.internal.compiler.problem.*;
+import org.eclipse.jdt.internal.compiler.util.*;
+
+public class ConstructorDeclaration extends AbstractMethodDeclaration {
+ public ExplicitConstructorCall constructorCall;
+ public final static char[] ConstantPoolName = "<init>"/*nonNLS*/.toCharArray();
+ public boolean isDefaultConstructor = false;
+
+ public int referenceCount = 0; // count how many times this constructor is referenced from other local constructors
+public void analyseCode(ClassScope classScope, InitializationFlowContext initializerFlowContext, FlowInfo flowInfo) {
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ ExceptionHandlingFlowContext constructorContext = new ExceptionHandlingFlowContext(
+ initializerFlowContext.parent,
+ this,
+ binding.thrownExceptions,
+ scope,
+ FlowInfo.DeadEnd);
+ initializerFlowContext.checkInitializerExceptions(scope, constructorContext, flowInfo);
+
+ // propagate to constructor call
+ if (constructorCall != null) {
+ // if calling 'this(...)', then flag all non-static fields as definitely
+ // set since they are supposed to be set inside other local constructor
+ if (constructorCall.accessMode == ExplicitConstructorCall.This) {
+ FieldBinding[] fields = binding.declaringClass.fields();
+ for (int i = 0, count = fields.length; i < count; i++) {
+ FieldBinding field;
+ if (!(field = fields[i]).isStatic()) {
+ flowInfo.markAsDefinitelyAssigned(field);
+ }
+ }
+ }
+ flowInfo = constructorCall.analyseCode(scope, constructorContext, flowInfo);
+ }
+ // propagate to statements
+ if (statements != null){
+ for (int i = 0, count = statements.length; i < count; i++) {
+ Statement stat;
+ if (!flowInfo.complainIfUnreachable((stat = statements[i]), scope)) {
+ flowInfo = stat.analyseCode(scope, constructorContext, flowInfo);
+ }
+ }
+ }
+ // check for missing returning path
+ needFreeReturn = !((flowInfo == FlowInfo.DeadEnd) || flowInfo.isFakeReachable());
+
+ // check missing blank final field initializations
+ if ((constructorCall != null) && (constructorCall.accessMode != ExplicitConstructorCall.This)){
+ flowInfo = flowInfo.mergedWith(initializerFlowContext.initsOnReturn);
+ FieldBinding[] fields = binding.declaringClass.fields();
+ for (int i = 0, count = fields.length; i < count; i++) {
+ FieldBinding field;
+ if ((!(field = fields[i]).isStatic())
+ && field.isFinal()
+ && (!flowInfo.isDefinitelyAssigned(fields[i]))) {
+ scope.problemReporter().uninitializedBlankFinalField(field, isDefaultConstructor ? (AstNode)scope.referenceType() : this);
+ }
+ }
+ }
+ } catch (AbortMethod e) {
+ this.ignoreFurtherInvestigation = true;
+ }
+}
+public void checkName() {
+ //look if the name of the method is correct
+ //and proceed with the resolution of the special constructor statement
+
+ if (!CharOperation.equals(scope.enclosingSourceType().sourceName, selector))
+ scope.problemReporter().missingReturnType(this);
+
+ // if null ==> an error has occurs at parsing time ....
+ if (constructorCall != null){
+ // e.g. using super() in java.lang.Object
+ if ((binding.declaringClass.id == T_Object)
+ && (constructorCall.accessMode != ExplicitConstructorCall.This)){
+ if (constructorCall.accessMode == ExplicitConstructorCall.Super){
+ scope.problemReporter().cannotUseSuperInJavaLangObject(constructorCall);
+ }
+ constructorCall = null;
+ return;
+ }
+ constructorCall.resolve(scope);
+ }
+}
+/**
+ * Bytecode generation for a constructor
+ *
+ * @param classScope org.eclipse.jdt.internal.compiler.lookup.ClassScope
+ * @param classFile org.eclipse.jdt.internal.compiler.codegen.ClassFile
+ */
+public void generateCode(ClassScope classScope, ClassFile classFile) {
+ int problemResetPC = 0;
+ if (ignoreFurtherInvestigation) {
+ if (this.binding == null)
+ return; // Handle methods with invalid signature or duplicates
+ int problemsLength;
+ IProblem[] problems = scope.referenceCompilationUnit().compilationResult.getProblems();
+ IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
+ System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
+ classFile.addProblemConstructor(this, binding, problemsCopy);
+ return;
+ }
+ try {
+ problemResetPC = classFile.contentsOffset;
+ classFile.generateMethodInfoHeader(binding);
+ int methodAttributeOffset = classFile.contentsOffset;
+ int attributeNumber = classFile.generateMethodInfoAttribute(binding);
+ if ((!binding.isNative()) && (!binding.isAbstract())) {
+ TypeDeclaration declaringType = classScope.referenceContext;
+ int codeAttributeOffset = classFile.contentsOffset;
+ classFile.generateCodeAttributeHeader();
+ CodeStream codeStream = classFile.codeStream;
+ codeStream.reset(this, classFile);
+ // initialize local positions - including initializer scope.
+ ReferenceBinding declaringClass = binding.declaringClass;
+ int argSize = 0;
+ scope.computeLocalVariablePositions(// consider synthetic arguments if any
+ argSize = declaringClass.isNestedType() ? ((NestedTypeBinding) declaringClass).syntheticArgumentsOffset : 1, codeStream);
+ if (arguments != null) {
+ for (int i = 0, max = arguments.length; i < max; i++) {
+ // arguments initialization for local variable debug attributes
+ LocalVariableBinding argBinding;
+ codeStream.addVisibleLocalVariable(argBinding = arguments[i].binding);
+ argBinding.recordInitializationStartPC(0);
+ TypeBinding argType;
+ if ((argType = argBinding.type) == LongBinding || (argType == DoubleBinding)) {
+ argSize += 2;
+ } else {
+ argSize++;
+ }
+ }
+ }
+ MethodScope initializerScope = declaringType.initializerScope;
+ initializerScope.computeLocalVariablePositions(argSize, codeStream); // offset by the argument size (since not linked to method scope)
+
+ // generate constructor call
+ if (constructorCall != null) {
+ constructorCall.generateCode(scope, codeStream);
+ }
+ // generate field initialization - only if not invoking another constructor call of the same class
+ if ((constructorCall != null) && (constructorCall.accessMode != ExplicitConstructorCall.This)) {
+ // generate synthetic fields initialization
+ if (declaringClass.isNestedType()) {
+ NestedTypeBinding nestedType = (NestedTypeBinding) declaringClass;
+ SyntheticArgumentBinding[] syntheticArgs = nestedType.syntheticEnclosingInstances();
+ for (int i = 0, max = syntheticArgs == null ? 0 : syntheticArgs.length; i < max; i++) {
+ if (syntheticArgs[i].matchingField != null) {
+ codeStream.aload_0();
+ codeStream.load(syntheticArgs[i]);
+ codeStream.putfield(syntheticArgs[i].matchingField);
+ }
+ }
+ syntheticArgs = nestedType.syntheticOuterLocalVariables();
+ for (int i = 0, max = syntheticArgs == null ? 0 : syntheticArgs.length; i < max; i++) {
+ if (syntheticArgs[i].matchingField != null) {
+ codeStream.aload_0();
+ codeStream.load(syntheticArgs[i]);
+ codeStream.putfield(syntheticArgs[i].matchingField);
+ }
+ }
+ }
+ // generate user field initialization
+ if (declaringType.fields != null) {
+ for (int i = 0, max = declaringType.fields.length; i < max; i++) {
+ FieldDeclaration fieldDecl;
+ if (!(fieldDecl = declaringType.fields[i]).isStatic()) {
+ fieldDecl.generateCode(initializerScope, codeStream);
+ }
+ }
+ }
+ }
+ // generate statements
+ if (statements != null) {
+ for (int i = 0, max = statements.length; i < max; i++) {
+ statements[i].generateCode(scope, codeStream);
+ }
+ }
+ if (needFreeReturn) {
+ codeStream.return_();
+ }
+ // local variable attributes
+ codeStream.exitUserScope(scope);
+ codeStream.recordPositionsFrom(0, this);
+ classFile.completeCodeAttribute(codeAttributeOffset);
+ attributeNumber++;
+ }
+ classFile.completeMethodInfo(methodAttributeOffset, attributeNumber);
+
+ // if a problem got reported during code gen, then trigger problem method creation
+ if (ignoreFurtherInvestigation){
+ throw new AbortMethod(scope.referenceCompilationUnit().compilationResult);
+ }
+ } catch (AbortMethod e) {
+ int problemsLength;
+ IProblem[] problems = scope.referenceCompilationUnit().compilationResult.getProblems();
+ IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
+ System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
+ classFile.addProblemConstructor(this, binding, problemsCopy, problemResetPC);
+ }
+}
+public boolean isConstructor() {
+ return true;
+}
+public boolean isDefaultConstructor() {
+ return isDefaultConstructor;
+}
+public boolean isInitializationMethod() {
+ return true;
+}
+public void parseStatements(Parser parser, CompilationUnitDeclaration unit){
+ //fill up the constructor body with its statements
+
+ if (ignoreFurtherInvestigation) return;
+ if (isDefaultConstructor ) return ;
+ parser.parse(this, unit);
+
+}
+/*
+ * Type checking for constructor, just another method, except for special check
+ * for recursive constructor invocations.
+ */
+public void resolve(ClassScope upperScope) {
+
+ if (binding == null) {
+ ignoreFurtherInvestigation = true;
+ return;
+ }
+
+ super.resolve(upperScope);
+
+ try {
+ // checking for recursive constructor call
+ if (constructorCall != null) {
+ // indirect reference: increment target constructor reference count
+ if (constructorCall.binding != null && !constructorCall.isSuperAccess() && constructorCall.binding.isValidBinding()) {
+ ((ConstructorDeclaration) (upperScope.referenceContext.declarationOf(constructorCall.binding))).referenceCount++;
+ }
+ }
+ } catch (AbortMethod e) {
+ this.ignoreFurtherInvestigation = true;
+ }
+}
+public String toStringStatements(int tab) {
+ /* slow code */
+
+ String s = " {"/*nonNLS*/;
+ if (constructorCall != null) {
+ s = s + "\n"/*nonNLS*/ + constructorCall.toString(tab) + ";"/*nonNLS*/;
+ }
+ if (statements != null){
+ for (int i = 0; i < statements.length; i++){
+ s = s + "\n"/*nonNLS*/ + statements[i].toString(tab);
+ if (!(statements[i] instanceof Block)){
+ s += ";"/*nonNLS*/;
+ }
+ }
+ }
+ s+="\n"/*nonNLS*/+tabString(tab == 0 ? 0 : tab - 1)+"}"/*nonNLS*/;
+ return s;
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope classScope) {
+ if (visitor.visit(this, classScope)) {
+ if (arguments != null) {
+ int argumentLength = arguments.length;
+ for (int i = 0; i < argumentLength; i++)
+ arguments[i].traverse(visitor, scope);
+ }
+ if (thrownExceptions != null) {
+ int thrownExceptionsLength = thrownExceptions.length;
+ for (int i = 0; i < thrownExceptionsLength; i++)
+ thrownExceptions[i].traverse(visitor, scope);
+ }
+ if (constructorCall != null)
+ constructorCall.traverse(visitor, scope);
+ if (statements != null) {
+ int statementsLength = statements.length;
+ for (int i = 0; i < statementsLength; i++)
+ statements[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, classScope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java
index 29f43f26e6..bc1c248b84 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java
@@ -1,545 +1,543 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-import org.eclipse.jdt.internal.compiler.problem.*;
-import org.eclipse.jdt.internal.compiler.util.*;
-
-public class EqualExpression extends BinaryExpression {
-
-public EqualExpression(Expression left, Expression right,int operator) {
- super(left,right,operator);
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- if (((bits & OperatorMASK) >> OperatorSHIFT) == EQUAL_EQUAL) {
- if ((left.constant != NotAConstant) && (left.constant.typeID() == T_boolean)) {
- if (left.constant.booleanValue()) { // true == anything
- // this is equivalent to the right argument inits
- return right.analyseCode(currentScope, flowContext, flowInfo);
- } else { // false == anything
- // this is equivalent to the right argument inits negated
- return right.analyseCode(currentScope, flowContext, flowInfo).asNegatedCondition();
- }
- }
- if ((right.constant != NotAConstant) && (right.constant.typeID() == T_boolean)) {
- if (right.constant.booleanValue()) { // anything == true
- // this is equivalent to the right argument inits
- return left.analyseCode(currentScope, flowContext, flowInfo);
- } else { // anything == false
- // this is equivalent to the right argument inits negated
- return left.analyseCode(currentScope, flowContext, flowInfo).asNegatedCondition();
- }
- }
- return right.analyseCode(
- currentScope, flowContext,
- left.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits()).unconditionalInits();
- } else { //NOT_EQUAL :
- if ((left.constant != NotAConstant) && (left.constant.typeID() == T_boolean)) {
- if (!left.constant.booleanValue()) { // false != anything
- // this is equivalent to the right argument inits
- return right.analyseCode(currentScope, flowContext, flowInfo);
- } else { // true != anything
- // this is equivalent to the right argument inits negated
- return right.analyseCode(currentScope, flowContext, flowInfo).asNegatedCondition();
- }
- }
- if ((right.constant != NotAConstant) && (right.constant.typeID() == T_boolean)) {
- if (!right.constant.booleanValue()) { // anything != false
- // this is equivalent to the right argument inits
- return left.analyseCode(currentScope, flowContext, flowInfo);
- } else { // anything != true
- // this is equivalent to the right argument inits negated
- return left.analyseCode(currentScope, flowContext, flowInfo).asNegatedCondition();
- }
- }
- return right.analyseCode(
- currentScope, flowContext,
- left.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits()).asNegatedCondition().unconditionalInits();
- }
-}
-public final boolean areTypesCastCompatible(BlockScope scope, TypeBinding castTb, TypeBinding expressionTb) {
- //see specifications p.68
- //A more complete version of this method is provided on
- //CastExpression (it deals with constant and need runtime checkcast)
-
-
- //========ARRAY===============
- if (expressionTb.isArrayType()) {
- if (castTb.isArrayType()) { //------- (castTb.isArray) expressionTb.isArray -----------
- TypeBinding expressionEltTb = ((ArrayBinding) expressionTb).elementsType(scope);
- if (expressionEltTb.isBaseType())
- // <---stop the recursion-------
- return ((ArrayBinding) castTb).elementsType(scope) == expressionEltTb;
- //recursivly on the elts...
- return areTypesCastCompatible(scope, ((ArrayBinding) castTb).elementsType(scope), expressionEltTb);
- }
- if (castTb.isBaseType()) {
- return false;
- }
- if (castTb.isClass()) { //------(castTb.isClass) expressionTb.isArray ---------------
- if (scope.isJavaLangObject(castTb))
- return true;
- return false;
- }
- if (castTb.isInterface()) { //------- (castTb.isInterface) expressionTb.isArray -----------
- if (scope.isJavaLangCloneable(castTb) || scope.isJavaIoSerializable(castTb)) {
- return true;
- }
- return false;
- }
-
- //===houps=====
- return false;
- }
-
-
- //------------(castType) null--------------
- if (expressionTb == NullBinding) {
- return !castTb.isBaseType();
- }
-
- //========BASETYPE==============
- if (expressionTb.isBaseType()) {
- return false;
- }
-
-
- //========REFERENCE TYPE===================
-
- if (expressionTb.isClass()) {
- if (castTb.isArrayType()) { // ---- (castTb.isArray) expressionTb.isClass -------
- if (scope.isJavaLangObject(expressionTb))
- return true;
- }
- if (castTb.isBaseType()) {
- return false;
- }
- if (castTb.isClass()) { // ----- (castTb.isClass) expressionTb.isClass ------
- if (scope.areTypesCompatible(expressionTb, castTb))
- return true;
- else {
- if (scope.areTypesCompatible(castTb, expressionTb)) {
- return true;
- }
- return false;
- }
- }
- if (castTb.isInterface()) { // ----- (castTb.isInterface) expressionTb.isClass -------
- if (((ReferenceBinding) expressionTb).isFinal()) { //no subclass for expressionTb, thus compile-time check is valid
- if (scope.areTypesCompatible(expressionTb, castTb))
- return true;
- return false;
- } else {
- return true;
- }
- }
-
- //=========houps=============
- return false;
- }
- if (expressionTb.isInterface()) {
- if (castTb.isArrayType()) { // ----- (castTb.isArray) expressionTb.isInterface ------
- if (scope.isJavaLangCloneable(expressionTb) || scope.isJavaIoSerializable(expressionTb))
- //potential runtime error
- {
- return true;
- }
- return false;
- }
- if (castTb.isBaseType()) {
- return false;
- }
- if (castTb.isClass()) { // ----- (castTb.isClass) expressionTb.isInterface --------
- if (scope.isJavaLangObject(castTb))
- return true;
- if (((ReferenceBinding) castTb).isFinal()) { //no subclass for castTb, thus compile-time check is valid
- if (scope.areTypesCompatible(castTb, expressionTb)) {
- return true;
- }
- return false;
- }
- return true;
- }
- if (castTb.isInterface()) { // ----- (castTb.isInterface) expressionTb.isInterface -------
- if (castTb != expressionTb && (scope.compareTypes(castTb, expressionTb) == NotRelated)) {
- MethodBinding[] castTbMethods = ((ReferenceBinding) castTb).methods();
- int castTbMethodsLength = castTbMethods.length;
- MethodBinding[] expressionTbMethods = ((ReferenceBinding) expressionTb).methods();
- int expressionTbMethodsLength = expressionTbMethods.length;
- for (int i = 0; i < castTbMethodsLength; i++) {
- for (int j = 0; j < expressionTbMethodsLength; j++) {
- if (castTbMethods[i].selector == expressionTbMethods[j].selector) {
- if (castTbMethods[i].returnType != expressionTbMethods[j].returnType) {
- if (castTbMethods[i].areParametersEqual(expressionTbMethods[j])) {
- return false;
- }
- }
- }
- }
- }
- }
- return true;
- }
-
-
- //=========hoops===========
- return false;
- }
-
- //==========HOUPS==========
- return false;
-}
-public final void computeConstant(TypeBinding leftTb, TypeBinding rightTb){
- if ((left.constant != NotAConstant) && (right.constant != NotAConstant)) {
- constant =
- Constant.computeConstantOperationEQUAL_EQUAL(
- left.constant,
- rightTb.id,
- EQUAL_EQUAL,
- right.constant,
- rightTb.id);
- if (((bits & OperatorMASK) >> OperatorSHIFT) == NOT_EQUAL)
- constant = Constant.fromValue(!constant.booleanValue());
- } else {
- constant = NotAConstant;
- }
-}
-/**
- * Normal == or != code generation
- *
- * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
- * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
-
- if (constant != NotAConstant) {
- int pc = codeStream.position;
- if (valueRequired)
- codeStream.generateConstant(constant, implicitConversion);
- codeStream.recordPositionsFrom(pc, this);
- return;
- }
- Label falseLabel = new Label(codeStream);
- generateOptimizedBoolean(currentScope, codeStream, null, falseLabel, valueRequired);
- if (valueRequired){
- // comparison is TRUE
- codeStream.iconst_1();
- if ((bits & ValueForReturnMASK) != 0){
- codeStream.ireturn();
- // comparison is FALSE
- falseLabel.place();
- codeStream.iconst_0();
- } else {
- Label endLabel = new Label(codeStream);
- codeStream.goto_(endLabel);
- codeStream.decrStackSize(1);
- // comparison is FALSE
- falseLabel.place();
- codeStream.iconst_0();
- endLabel.place();
- }
- }
-}
-/**
- * Boolean operator code generation
- * Optimized operations are: == and !=
- */
-public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
- int pc = codeStream.position;
- if ((constant != Constant.NotAConstant) && (constant.typeID() == T_boolean)) {
- if (constant.booleanValue() == true) {
- // constant == true
- if (valueRequired) {
- if (falseLabel == null) {
- // implicit falling through the FALSE case
- if (trueLabel != null) {
- codeStream.goto_(trueLabel);
- }
- }
- }
- } else {
- // constant == false
- if (valueRequired) {
- if (falseLabel != null) {
- // implicit falling through the TRUE case
- if (trueLabel == null) {
- codeStream.goto_(falseLabel);
- }
- }
- }
- }
- codeStream.recordPositionsFrom(pc, this);
- return;
- }
- if (((bits & OperatorMASK) >> OperatorSHIFT) == EQUAL_EQUAL) {
- if ((left.implicitConversion & 0xF) /*compile-time*/ == T_boolean) {
- generateOptimizedBooleanEqual(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
- } else {
- generateOptimizedNonBooleanEqual(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
- }
- } else {
- if ((left.implicitConversion & 0xF) /*compile-time*/ == T_boolean) {
- generateOptimizedBooleanEqual(currentScope, codeStream, falseLabel, trueLabel, valueRequired);
- } else {
- generateOptimizedNonBooleanEqual(currentScope, codeStream, falseLabel, trueLabel, valueRequired);
- }
- }
- codeStream.recordPositionsFrom(pc, this);
-}
-/**
- * Boolean generation for == with boolean operands
- *
- * Note this code does not optimize conditional constants !!!!
- */
-public void generateOptimizedBooleanEqual(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
- int pc = codeStream.position;
- // optimized cases: true == x, false == x
- if (left.constant != NotAConstant) {
- boolean inline = left.constant.booleanValue();
- right.generateOptimizedBoolean(currentScope, codeStream, (inline ? trueLabel : falseLabel), (inline ? falseLabel : trueLabel), valueRequired);
- codeStream.recordPositionsFrom(pc, this);
- return;
- } // optimized cases: x == true, x == false
- if (right.constant != NotAConstant) {
- boolean inline = right.constant.booleanValue();
- left.generateOptimizedBoolean(currentScope, codeStream, (inline ? trueLabel : falseLabel), (inline ? falseLabel : trueLabel), valueRequired);
- codeStream.recordPositionsFrom(pc, this);
- return;
- }
- // default case
- left.generateCode(currentScope, codeStream, valueRequired);
- right.generateCode(currentScope, codeStream, valueRequired);
- if (valueRequired) {
- if (falseLabel == null) {
- if (trueLabel != null) {
- // implicit falling through the FALSE case
- codeStream.if_icmpeq(trueLabel);
- }
- } else {
- // implicit falling through the TRUE case
- if (trueLabel == null) {
- codeStream.if_icmpne(falseLabel);
- } else {
- // no implicit fall through TRUE/FALSE --> should never occur
- }
- }
- }
- codeStream.recordPositionsFrom(pc, this);
-}
-/**
- * Boolean generation for == with non-boolean operands
- *
- */
-public void generateOptimizedNonBooleanEqual(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
- int pc = codeStream.position;
- Constant inline;
- if ((inline = right.constant) != NotAConstant) {
- // optimized case: x == null
- if (right.constant == NullConstant.Default) {
- left.generateCode(currentScope, codeStream, valueRequired);
- if (valueRequired) {
- if (falseLabel == null) {
- if (trueLabel != null) {
- // implicit falling through the FALSE case
- codeStream.ifnull(trueLabel);
- }
- } else {
- // implicit falling through the TRUE case
- if (trueLabel == null) {
- codeStream.ifnonnull(falseLabel);
- } else {
- // no implicit fall through TRUE/FALSE --> should never occur
- }
- }
- }
- codeStream.recordPositionsFrom(pc, this);
- return;
- }
- // optimized case: x == 0
- if (((left.implicitConversion >> 4) == T_int) && (inline.intValue() == 0)) {
- left.generateCode(currentScope, codeStream, valueRequired);
- if (valueRequired) {
- if (falseLabel == null) {
- if (trueLabel != null) {
- // implicit falling through the FALSE case
- codeStream.ifeq(trueLabel);
- }
- } else {
- // implicit falling through the TRUE case
- if (trueLabel == null) {
- codeStream.ifne(falseLabel);
- } else {
- // no implicit fall through TRUE/FALSE --> should never occur
- }
- }
- }
- codeStream.recordPositionsFrom(pc, this);
- return;
- }
- }
- if ((inline = left.constant) != NotAConstant) {
- // optimized case: null == x
- if (left.constant == NullConstant.Default) {
- right.generateCode(currentScope, codeStream, valueRequired);
- if (valueRequired) {
- if (falseLabel == null) {
- if (trueLabel != null) {
- // implicit falling through the FALSE case
- codeStream.ifnull(trueLabel);
- }
- } else {
- // implicit falling through the TRUE case
- if (trueLabel == null) {
- codeStream.ifnonnull(falseLabel);
- } else {
- // no implicit fall through TRUE/FALSE --> should never occur
- }
- }
- }
- codeStream.recordPositionsFrom(pc, this);
- return;
- }
- // optimized case: 0 == x
- if (((left.implicitConversion >> 4) == T_int)
- && (inline.intValue() == 0)) {
- right.generateCode(currentScope, codeStream, valueRequired);
- if (valueRequired) {
- if (falseLabel == null) {
- if (trueLabel != null) {
- // implicit falling through the FALSE case
- codeStream.ifeq(trueLabel);
- }
- } else {
- // implicit falling through the TRUE case
- if (trueLabel == null) {
- codeStream.ifne(falseLabel);
- } else {
- // no implicit fall through TRUE/FALSE --> should never occur
- }
- }
- }
- codeStream.recordPositionsFrom(pc, this);
- return;
- }
- }
- // default case
- left.generateCode(currentScope, codeStream, valueRequired);
- right.generateCode(currentScope, codeStream, valueRequired);
- if (valueRequired) {
- if (falseLabel == null) {
- if (trueLabel != null) {
- // implicit falling through the FALSE case
- switch (left.implicitConversion >> 4) { // operand runtime type
- case T_int :
- codeStream.if_icmpeq(trueLabel);
- break;
- case T_float :
- codeStream.fcmpl();
- codeStream.ifeq(trueLabel);
- break;
- case T_long :
- codeStream.lcmp();
- codeStream.ifeq(trueLabel);
- break;
- case T_double :
- codeStream.dcmpl();
- codeStream.ifeq(trueLabel);
- break;
- default :
- codeStream.if_acmpeq(trueLabel);
- }
- }
- } else {
- // implicit falling through the TRUE case
- if (trueLabel == null) {
- switch (left.implicitConversion >> 4) { // operand runtime type
- case T_int :
- codeStream.if_icmpne(falseLabel);
- break;
- case T_float :
- codeStream.fcmpl();
- codeStream.ifne(falseLabel);
- break;
- case T_long :
- codeStream.lcmp();
- codeStream.ifne(falseLabel);
- break;
- case T_double :
- codeStream.dcmpl();
- codeStream.ifne(falseLabel);
- break;
- default :
- codeStream.if_acmpne(falseLabel);
- }
- } else {
- // no implicit fall through TRUE/FALSE --> should never occur
- }
- }
- }
- codeStream.recordPositionsFrom(pc, this);
-}
-public boolean isCompactableOperation() {
- return false;
-}
-public TypeBinding resolveType(BlockScope scope) {
- // always return BooleanBinding
- TypeBinding leftTb = left.resolveType(scope);
- TypeBinding rightTb = right.resolveType(scope);
- if (leftTb == null || rightTb == null){
- constant = NotAConstant;
- return null;
- }
-
- // both base type
- if (leftTb.isBaseType() && rightTb.isBaseType()) {
- // the code is an int
- // (cast) left == (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4 <<0
- int result = ResolveTypeTables[EQUAL_EQUAL][ (leftTb.id << 4) + rightTb.id];
- left.implicitConversion = result >>> 12;
- right.implicitConversion = (result >>> 4) & 0x000FF;
- bits |= result & 0xF;
- if ((result & 0x0000F) == T_undefined) {
- constant = Constant.NotAConstant;
- scope.problemReporter().invalidOperator(this, leftTb, rightTb);
- return null;
- }
- computeConstant(leftTb, rightTb);
- return BooleanBinding;
- }
-
- // Object references
- // spec 15.20.3
- if (areTypesCastCompatible(scope, rightTb, leftTb) || areTypesCastCompatible(scope, leftTb, rightTb)) {
- // (special case for String)
- if ((rightTb.id == T_String) && (leftTb.id == T_String))
- computeConstant(leftTb, rightTb);
- else
- constant = NotAConstant;
- if (rightTb.id == T_String)
- right.implicitConversion = String2String;
- if (leftTb.id == T_String)
- left.implicitConversion = String2String;
- return BooleanBinding;
- }
- constant = NotAConstant;
- scope.problemReporter().notCompatibleTypesError(this, leftTb, rightTb);
- return null;
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- if (visitor.visit(this, scope)) {
- left.traverse(visitor, scope);
- right.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.impl.*;
+import org.eclipse.jdt.internal.compiler.codegen.*;
+import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class EqualExpression extends BinaryExpression {
+
+public EqualExpression(Expression left, Expression right,int operator) {
+ super(left,right,operator);
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ if (((bits & OperatorMASK) >> OperatorSHIFT) == EQUAL_EQUAL) {
+ if ((left.constant != NotAConstant) && (left.constant.typeID() == T_boolean)) {
+ if (left.constant.booleanValue()) { // true == anything
+ // this is equivalent to the right argument inits
+ return right.analyseCode(currentScope, flowContext, flowInfo);
+ } else { // false == anything
+ // this is equivalent to the right argument inits negated
+ return right.analyseCode(currentScope, flowContext, flowInfo).asNegatedCondition();
+ }
+ }
+ if ((right.constant != NotAConstant) && (right.constant.typeID() == T_boolean)) {
+ if (right.constant.booleanValue()) { // anything == true
+ // this is equivalent to the right argument inits
+ return left.analyseCode(currentScope, flowContext, flowInfo);
+ } else { // anything == false
+ // this is equivalent to the right argument inits negated
+ return left.analyseCode(currentScope, flowContext, flowInfo).asNegatedCondition();
+ }
+ }
+ return right.analyseCode(
+ currentScope, flowContext,
+ left.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits()).unconditionalInits();
+ } else { //NOT_EQUAL :
+ if ((left.constant != NotAConstant) && (left.constant.typeID() == T_boolean)) {
+ if (!left.constant.booleanValue()) { // false != anything
+ // this is equivalent to the right argument inits
+ return right.analyseCode(currentScope, flowContext, flowInfo);
+ } else { // true != anything
+ // this is equivalent to the right argument inits negated
+ return right.analyseCode(currentScope, flowContext, flowInfo).asNegatedCondition();
+ }
+ }
+ if ((right.constant != NotAConstant) && (right.constant.typeID() == T_boolean)) {
+ if (!right.constant.booleanValue()) { // anything != false
+ // this is equivalent to the right argument inits
+ return left.analyseCode(currentScope, flowContext, flowInfo);
+ } else { // anything != true
+ // this is equivalent to the right argument inits negated
+ return left.analyseCode(currentScope, flowContext, flowInfo).asNegatedCondition();
+ }
+ }
+ return right.analyseCode(
+ currentScope, flowContext,
+ left.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits()).asNegatedCondition().unconditionalInits();
+ }
+}
+public final boolean areTypesCastCompatible(BlockScope scope, TypeBinding castTb, TypeBinding expressionTb) {
+ //see specifications p.68
+ //A more complete version of this method is provided on
+ //CastExpression (it deals with constant and need runtime checkcast)
+
+
+ //========ARRAY===============
+ if (expressionTb.isArrayType()) {
+ if (castTb.isArrayType()) { //------- (castTb.isArray) expressionTb.isArray -----------
+ TypeBinding expressionEltTb = ((ArrayBinding) expressionTb).elementsType(scope);
+ if (expressionEltTb.isBaseType())
+ // <---stop the recursion-------
+ return ((ArrayBinding) castTb).elementsType(scope) == expressionEltTb;
+ //recursivly on the elts...
+ return areTypesCastCompatible(scope, ((ArrayBinding) castTb).elementsType(scope), expressionEltTb);
+ }
+ if (castTb.isBaseType()) {
+ return false;
+ }
+ if (castTb.isClass()) { //------(castTb.isClass) expressionTb.isArray ---------------
+ if (scope.isJavaLangObject(castTb))
+ return true;
+ return false;
+ }
+ if (castTb.isInterface()) { //------- (castTb.isInterface) expressionTb.isArray -----------
+ if (scope.isJavaLangCloneable(castTb) || scope.isJavaIoSerializable(castTb)) {
+ return true;
+ }
+ return false;
+ }
+
+ //===houps=====
+ return false;
+ }
+
+
+ //------------(castType) null--------------
+ if (expressionTb == NullBinding) {
+ return !castTb.isBaseType();
+ }
+
+ //========BASETYPE==============
+ if (expressionTb.isBaseType()) {
+ return false;
+ }
+
+
+ //========REFERENCE TYPE===================
+
+ if (expressionTb.isClass()) {
+ if (castTb.isArrayType()) { // ---- (castTb.isArray) expressionTb.isClass -------
+ if (scope.isJavaLangObject(expressionTb))
+ return true;
+ }
+ if (castTb.isBaseType()) {
+ return false;
+ }
+ if (castTb.isClass()) { // ----- (castTb.isClass) expressionTb.isClass ------
+ if (scope.areTypesCompatible(expressionTb, castTb))
+ return true;
+ else {
+ if (scope.areTypesCompatible(castTb, expressionTb)) {
+ return true;
+ }
+ return false;
+ }
+ }
+ if (castTb.isInterface()) { // ----- (castTb.isInterface) expressionTb.isClass -------
+ if (((ReferenceBinding) expressionTb).isFinal()) { //no subclass for expressionTb, thus compile-time check is valid
+ if (scope.areTypesCompatible(expressionTb, castTb))
+ return true;
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ //=========houps=============
+ return false;
+ }
+ if (expressionTb.isInterface()) {
+ if (castTb.isArrayType()) { // ----- (castTb.isArray) expressionTb.isInterface ------
+ if (scope.isJavaLangCloneable(expressionTb) || scope.isJavaIoSerializable(expressionTb))
+ //potential runtime error
+ {
+ return true;
+ }
+ return false;
+ }
+ if (castTb.isBaseType()) {
+ return false;
+ }
+ if (castTb.isClass()) { // ----- (castTb.isClass) expressionTb.isInterface --------
+ if (scope.isJavaLangObject(castTb))
+ return true;
+ if (((ReferenceBinding) castTb).isFinal()) { //no subclass for castTb, thus compile-time check is valid
+ if (scope.areTypesCompatible(castTb, expressionTb)) {
+ return true;
+ }
+ return false;
+ }
+ return true;
+ }
+ if (castTb.isInterface()) { // ----- (castTb.isInterface) expressionTb.isInterface -------
+ if (castTb != expressionTb && (scope.compareTypes(castTb, expressionTb) == NotRelated)) {
+ MethodBinding[] castTbMethods = ((ReferenceBinding) castTb).methods();
+ int castTbMethodsLength = castTbMethods.length;
+ MethodBinding[] expressionTbMethods = ((ReferenceBinding) expressionTb).methods();
+ int expressionTbMethodsLength = expressionTbMethods.length;
+ for (int i = 0; i < castTbMethodsLength; i++) {
+ for (int j = 0; j < expressionTbMethodsLength; j++) {
+ if (castTbMethods[i].selector == expressionTbMethods[j].selector) {
+ if (castTbMethods[i].returnType != expressionTbMethods[j].returnType) {
+ if (castTbMethods[i].areParametersEqual(expressionTbMethods[j])) {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+
+ //=========hoops===========
+ return false;
+ }
+
+ //==========HOUPS==========
+ return false;
+}
+public final void computeConstant(TypeBinding leftTb, TypeBinding rightTb){
+ if ((left.constant != NotAConstant) && (right.constant != NotAConstant)) {
+ constant =
+ Constant.computeConstantOperationEQUAL_EQUAL(
+ left.constant,
+ rightTb.id,
+ EQUAL_EQUAL,
+ right.constant,
+ rightTb.id);
+ if (((bits & OperatorMASK) >> OperatorSHIFT) == NOT_EQUAL)
+ constant = Constant.fromValue(!constant.booleanValue());
+ } else {
+ constant = NotAConstant;
+ }
+}
+/**
+ * Normal == or != code generation
+ *
+ * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
+ * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+
+ if (constant != NotAConstant) {
+ int pc = codeStream.position;
+ if (valueRequired)
+ codeStream.generateConstant(constant, implicitConversion);
+ codeStream.recordPositionsFrom(pc, this);
+ return;
+ }
+ Label falseLabel = new Label(codeStream);
+ generateOptimizedBoolean(currentScope, codeStream, null, falseLabel, valueRequired);
+ if (valueRequired){
+ // comparison is TRUE
+ codeStream.iconst_1();
+ if ((bits & ValueForReturnMASK) != 0){
+ codeStream.ireturn();
+ // comparison is FALSE
+ falseLabel.place();
+ codeStream.iconst_0();
+ } else {
+ Label endLabel = new Label(codeStream);
+ codeStream.goto_(endLabel);
+ codeStream.decrStackSize(1);
+ // comparison is FALSE
+ falseLabel.place();
+ codeStream.iconst_0();
+ endLabel.place();
+ }
+ }
+}
+/**
+ * Boolean operator code generation
+ * Optimized operations are: == and !=
+ */
+public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
+ int pc = codeStream.position;
+ if ((constant != Constant.NotAConstant) && (constant.typeID() == T_boolean)) {
+ if (constant.booleanValue() == true) {
+ // constant == true
+ if (valueRequired) {
+ if (falseLabel == null) {
+ // implicit falling through the FALSE case
+ if (trueLabel != null) {
+ codeStream.goto_(trueLabel);
+ }
+ }
+ }
+ } else {
+ // constant == false
+ if (valueRequired) {
+ if (falseLabel != null) {
+ // implicit falling through the TRUE case
+ if (trueLabel == null) {
+ codeStream.goto_(falseLabel);
+ }
+ }
+ }
+ }
+ codeStream.recordPositionsFrom(pc, this);
+ return;
+ }
+ if (((bits & OperatorMASK) >> OperatorSHIFT) == EQUAL_EQUAL) {
+ if ((left.implicitConversion & 0xF) /*compile-time*/ == T_boolean) {
+ generateOptimizedBooleanEqual(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
+ } else {
+ generateOptimizedNonBooleanEqual(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
+ }
+ } else {
+ if ((left.implicitConversion & 0xF) /*compile-time*/ == T_boolean) {
+ generateOptimizedBooleanEqual(currentScope, codeStream, falseLabel, trueLabel, valueRequired);
+ } else {
+ generateOptimizedNonBooleanEqual(currentScope, codeStream, falseLabel, trueLabel, valueRequired);
+ }
+ }
+ codeStream.recordPositionsFrom(pc, this);
+}
+/**
+ * Boolean generation for == with boolean operands
+ *
+ * Note this code does not optimize conditional constants !!!!
+ */
+public void generateOptimizedBooleanEqual(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
+ int pc = codeStream.position;
+ // optimized cases: true == x, false == x
+ if (left.constant != NotAConstant) {
+ boolean inline = left.constant.booleanValue();
+ right.generateOptimizedBoolean(currentScope, codeStream, (inline ? trueLabel : falseLabel), (inline ? falseLabel : trueLabel), valueRequired);
+ codeStream.recordPositionsFrom(pc, this);
+ return;
+ } // optimized cases: x == true, x == false
+ if (right.constant != NotAConstant) {
+ boolean inline = right.constant.booleanValue();
+ left.generateOptimizedBoolean(currentScope, codeStream, (inline ? trueLabel : falseLabel), (inline ? falseLabel : trueLabel), valueRequired);
+ codeStream.recordPositionsFrom(pc, this);
+ return;
+ }
+ // default case
+ left.generateCode(currentScope, codeStream, valueRequired);
+ right.generateCode(currentScope, codeStream, valueRequired);
+ if (valueRequired) {
+ if (falseLabel == null) {
+ if (trueLabel != null) {
+ // implicit falling through the FALSE case
+ codeStream.if_icmpeq(trueLabel);
+ }
+ } else {
+ // implicit falling through the TRUE case
+ if (trueLabel == null) {
+ codeStream.if_icmpne(falseLabel);
+ } else {
+ // no implicit fall through TRUE/FALSE --> should never occur
+ }
+ }
+ }
+ codeStream.recordPositionsFrom(pc, this);
+}
+/**
+ * Boolean generation for == with non-boolean operands
+ *
+ */
+public void generateOptimizedNonBooleanEqual(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
+ int pc = codeStream.position;
+ Constant inline;
+ if ((inline = right.constant) != NotAConstant) {
+ // optimized case: x == null
+ if (right.constant == NullConstant.Default) {
+ left.generateCode(currentScope, codeStream, valueRequired);
+ if (valueRequired) {
+ if (falseLabel == null) {
+ if (trueLabel != null) {
+ // implicit falling through the FALSE case
+ codeStream.ifnull(trueLabel);
+ }
+ } else {
+ // implicit falling through the TRUE case
+ if (trueLabel == null) {
+ codeStream.ifnonnull(falseLabel);
+ } else {
+ // no implicit fall through TRUE/FALSE --> should never occur
+ }
+ }
+ }
+ codeStream.recordPositionsFrom(pc, this);
+ return;
+ }
+ // optimized case: x == 0
+ if (((left.implicitConversion >> 4) == T_int) && (inline.intValue() == 0)) {
+ left.generateCode(currentScope, codeStream, valueRequired);
+ if (valueRequired) {
+ if (falseLabel == null) {
+ if (trueLabel != null) {
+ // implicit falling through the FALSE case
+ codeStream.ifeq(trueLabel);
+ }
+ } else {
+ // implicit falling through the TRUE case
+ if (trueLabel == null) {
+ codeStream.ifne(falseLabel);
+ } else {
+ // no implicit fall through TRUE/FALSE --> should never occur
+ }
+ }
+ }
+ codeStream.recordPositionsFrom(pc, this);
+ return;
+ }
+ }
+ if ((inline = left.constant) != NotAConstant) {
+ // optimized case: null == x
+ if (left.constant == NullConstant.Default) {
+ right.generateCode(currentScope, codeStream, valueRequired);
+ if (valueRequired) {
+ if (falseLabel == null) {
+ if (trueLabel != null) {
+ // implicit falling through the FALSE case
+ codeStream.ifnull(trueLabel);
+ }
+ } else {
+ // implicit falling through the TRUE case
+ if (trueLabel == null) {
+ codeStream.ifnonnull(falseLabel);
+ } else {
+ // no implicit fall through TRUE/FALSE --> should never occur
+ }
+ }
+ }
+ codeStream.recordPositionsFrom(pc, this);
+ return;
+ }
+ // optimized case: 0 == x
+ if (((left.implicitConversion >> 4) == T_int)
+ && (inline.intValue() == 0)) {
+ right.generateCode(currentScope, codeStream, valueRequired);
+ if (valueRequired) {
+ if (falseLabel == null) {
+ if (trueLabel != null) {
+ // implicit falling through the FALSE case
+ codeStream.ifeq(trueLabel);
+ }
+ } else {
+ // implicit falling through the TRUE case
+ if (trueLabel == null) {
+ codeStream.ifne(falseLabel);
+ } else {
+ // no implicit fall through TRUE/FALSE --> should never occur
+ }
+ }
+ }
+ codeStream.recordPositionsFrom(pc, this);
+ return;
+ }
+ }
+ // default case
+ left.generateCode(currentScope, codeStream, valueRequired);
+ right.generateCode(currentScope, codeStream, valueRequired);
+ if (valueRequired) {
+ if (falseLabel == null) {
+ if (trueLabel != null) {
+ // implicit falling through the FALSE case
+ switch (left.implicitConversion >> 4) { // operand runtime type
+ case T_int :
+ codeStream.if_icmpeq(trueLabel);
+ break;
+ case T_float :
+ codeStream.fcmpl();
+ codeStream.ifeq(trueLabel);
+ break;
+ case T_long :
+ codeStream.lcmp();
+ codeStream.ifeq(trueLabel);
+ break;
+ case T_double :
+ codeStream.dcmpl();
+ codeStream.ifeq(trueLabel);
+ break;
+ default :
+ codeStream.if_acmpeq(trueLabel);
+ }
+ }
+ } else {
+ // implicit falling through the TRUE case
+ if (trueLabel == null) {
+ switch (left.implicitConversion >> 4) { // operand runtime type
+ case T_int :
+ codeStream.if_icmpne(falseLabel);
+ break;
+ case T_float :
+ codeStream.fcmpl();
+ codeStream.ifne(falseLabel);
+ break;
+ case T_long :
+ codeStream.lcmp();
+ codeStream.ifne(falseLabel);
+ break;
+ case T_double :
+ codeStream.dcmpl();
+ codeStream.ifne(falseLabel);
+ break;
+ default :
+ codeStream.if_acmpne(falseLabel);
+ }
+ } else {
+ // no implicit fall through TRUE/FALSE --> should never occur
+ }
+ }
+ }
+ codeStream.recordPositionsFrom(pc, this);
+}
+public boolean isCompactableOperation() {
+ return false;
+}
+public TypeBinding resolveType(BlockScope scope) {
+ // always return BooleanBinding
+ TypeBinding leftTb = left.resolveType(scope);
+ TypeBinding rightTb = right.resolveType(scope);
+ if (leftTb == null || rightTb == null){
+ constant = NotAConstant;
+ return null;
+ }
+
+ // both base type
+ if (leftTb.isBaseType() && rightTb.isBaseType()) {
+ // the code is an int
+ // (cast) left == (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4 <<0
+ int result = ResolveTypeTables[EQUAL_EQUAL][ (leftTb.id << 4) + rightTb.id];
+ left.implicitConversion = result >>> 12;
+ right.implicitConversion = (result >>> 4) & 0x000FF;
+ bits |= result & 0xF;
+ if ((result & 0x0000F) == T_undefined) {
+ constant = Constant.NotAConstant;
+ scope.problemReporter().invalidOperator(this, leftTb, rightTb);
+ return null;
+ }
+ computeConstant(leftTb, rightTb);
+ return BooleanBinding;
+ }
+
+ // Object references
+ // spec 15.20.3
+ if (areTypesCastCompatible(scope, rightTb, leftTb) || areTypesCastCompatible(scope, leftTb, rightTb)) {
+ // (special case for String)
+ if ((rightTb.id == T_String) && (leftTb.id == T_String))
+ computeConstant(leftTb, rightTb);
+ else
+ constant = NotAConstant;
+ if (rightTb.id == T_String)
+ right.implicitConversion = String2String;
+ if (leftTb.id == T_String)
+ left.implicitConversion = String2String;
+ return BooleanBinding;
+ }
+ constant = NotAConstant;
+ scope.problemReporter().notCompatibleTypesError(this, leftTb, rightTb);
+ return null;
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ left.traverse(visitor, scope);
+ right.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java
index 8df58818df..0b869dbdad 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java
@@ -1,252 +1,251 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-
-public class ExplicitConstructorCall extends Statement implements InvocationSite {
- public Expression[] arguments;
- public Expression qualification;
- public MethodBinding binding;
-
- public int accessMode;
-
- public final static int ImplicitSuper = 1;
- public final static int Super = 2;
- public final static int This = 3;
-
- public VariableBinding[][] implicitArguments;
- boolean discardEnclosingInstance;
-
- MethodBinding syntheticAccessor;
-
-public ExplicitConstructorCall(int accessMode) {
- this.accessMode = accessMode;
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
-
- // must verify that exceptions potentially thrown by this expression are caught in the method.
-
- try {
- ((MethodScope) currentScope).isConstructorCall = true;
-
- // process enclosing instance
- if (qualification != null){
- flowInfo = qualification.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
- }
- // process arguments
- if (arguments != null){
- for (int i = 0, max = arguments.length; i < max; i++) {
- flowInfo = arguments[i].analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
- }
- }
-
- ReferenceBinding[] thrownExceptions;
- if ((thrownExceptions = binding.thrownExceptions) != NoExceptions) {
- // check exceptions
- flowContext.checkExceptionHandlers(
- thrownExceptions,
- (accessMode == ImplicitSuper) ? (AstNode)currentScope.methodScope().referenceContext : (AstNode)this,
- flowInfo,
- currentScope);
- }
- manageEnclosingInstanceAccessIfNecessary(currentScope);
- manageSyntheticAccessIfNecessary(currentScope);
- return flowInfo;
- } finally {
- ((MethodScope) currentScope).isConstructorCall = false;
- }
-}
-/**
- * Constructor call code generation
- *
- * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
- * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
- */
-public void generateCode(BlockScope currentScope, CodeStream codeStream) {
- if ((bits & IsReachableMASK) == 0) {
- return;
- }
- try {
- ((MethodScope) currentScope).isConstructorCall = true;
-
- int pc = codeStream.position;
- codeStream.aload_0();
-
- // handling innerclass constructor invocation
- ReferenceBinding targetType;
- if ((targetType = binding.declaringClass).isNestedType()){
- codeStream.generateSyntheticArgumentValues(currentScope, targetType, discardEnclosingInstance ? null : qualification, this);
- }
- // regular code gen
- if (arguments != null){
- for (int i = 0, max = arguments.length; i < max; i++) {
- arguments[i].generateCode(currentScope, codeStream, true);
- }
- }
- if (syntheticAccessor != null){
- // synthetic accessor got some extra arguments appended to its signature, which need values
- for (int i = 0, max = syntheticAccessor.parameters.length - binding.parameters.length; i < max; i++){
- codeStream.aconst_null();
- }
- codeStream.invokespecial(syntheticAccessor);
- } else {
- codeStream.invokespecial(binding);
- }
- codeStream.recordPositionsFrom(pc, this);
- } finally {
- ((MethodScope) currentScope).isConstructorCall = false;
- }
-}
-public boolean isImplicitSuper(){
- //return true if I'm of these compiler added statement super();
-
- return (accessMode == ImplicitSuper) ;}
-public boolean isSuperAccess(){
- return accessMode != This;
-}
-public boolean isTypeAccess(){
- return true;
-}
-/* Inner emulation consists in either recording a dependency
- * link only, or performing one level of propagation.
- *
- * Dependency mechanism is used whenever dealing with source target
- * types, since by the time we reach them, we might not yet know their
- * exact need.
- */
-void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
- ReferenceBinding invocationType, superType;
-
- // perform some emulation work in case there is some and we are inside a local type only
- if ((superType = binding.declaringClass).isNestedType()
- && currentScope.enclosingSourceType().isLocalType()) {
-
- if (superType.isLocalType()){
- ((LocalTypeBinding)superType).addInnerEmulationDependent(currentScope, qualification != null, true); // request direct access
- } else {
- // locally propagate, since we already now the desired shape for sure
- currentScope.propagateInnerEmulation(superType, qualification != null, true); // request direct access
-
- }
- }
-}
-public void manageSyntheticAccessIfNecessary(BlockScope currentScope) {
-
- // perform some emulation work in case there is some and we are inside a local type only
- if (binding.isPrivate() && (accessMode != This)) {
-
- if (currentScope.environment().options.isPrivateConstructorAccessChangingVisibility){
- binding.tagForClearingPrivateModifier(); // constructor will not be dumped as private, no emulation required thus
- } else {
- syntheticAccessor = ((SourceTypeBinding) binding.declaringClass).addSyntheticMethod(binding);
- currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
- }
- }
-}
-public void resolve(BlockScope scope) {
- // the return type should be void for a constructor.
- // the test is made into getConstructor
-
- // mark the fact that we are in a constructor call.....
- // unmark at all returns
- try {
- ((MethodScope) scope).isConstructorCall = true;
- ReferenceBinding receiverType = scope.enclosingSourceType();
- if (accessMode != This)
- receiverType = receiverType.superclass();
-
- if (receiverType == null) {
- return;
- }
-
- // qualification should be from the type of the enclosingType
- if (qualification != null) {
- if (accessMode != Super){
- scope.problemReporter().unnecessaryEnclosingInstanceSpecification(qualification, receiverType);
- }
- ReferenceBinding enclosingType = receiverType.enclosingType();
- if (enclosingType == null) {
- scope.problemReporter().unnecessaryEnclosingInstanceSpecification(qualification, receiverType);
- discardEnclosingInstance = true;
- } else {
- TypeBinding qTb = qualification.resolveTypeExpecting(scope, enclosingType);
- qualification.implicitWidening(qTb, qTb);
- }
- }
-
- // arguments buffering for the method lookup
- TypeBinding[] argTypes = NoParameters;
- if (arguments != null) {
- boolean argHasError = false; // typeChecks all arguments
- int length = arguments.length;
- argTypes = new TypeBinding[length];
- for (int i = 0; i < length; i++)
- if ((argTypes[i] = arguments[i].resolveType(scope)) == null)
- argHasError = true;
- if (argHasError)
- return;
- }
- if ((binding = scope.getConstructor(receiverType, argTypes, this)).isValidBinding()) {
- if (isMethodUseDeprecated(binding, scope))
- scope.problemReporter().deprecatedMethod(binding, this);
-
- // see for user-implicit widening conversion
- if (arguments != null) {
- int length = arguments.length;
- TypeBinding[] paramTypes = binding.parameters;
- for (int i = 0; i < length; i++)
- arguments[i].implicitWidening(paramTypes[i], argTypes[i]);
- }
- } else {
- if (binding.declaringClass == null)
- binding.declaringClass = receiverType;
- scope.problemReporter().invalidConstructor(this, binding);
- }
- } finally {
- ((MethodScope) scope).isConstructorCall = false;
- }
-}
-public void setDepth(int depth){
- // ignore for here
-}
-public void setFieldIndex(int depth){
- // ignore for here
-}
-public String toString(int tab){
- /* slow code */
-
- String s = tabString(tab);
- if (qualification != null)
- s = s + qualification.toStringExpression() + "."/*nonNLS*/ ;
- if (accessMode == This){
- s = s + "this("/*nonNLS*/;
- } else {
- s = s + "super("/*nonNLS*/;
- }
- if (arguments != null)
- for (int i=0 ; i < arguments.length ; i++)
- { s = s + arguments[i].toStringExpression();
- if (i != arguments.length-1) s = s + ", "/*nonNLS*/;};;
- s = s+")"/*nonNLS*/ ;
- return s;}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- if (visitor.visit(this, scope)) {
- if (qualification != null) {
- qualification.traverse(visitor, scope);
- }
- if (arguments != null) {
- int argumentLength = arguments.length;
- for (int i = 0; i < argumentLength; i++)
- arguments[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, scope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.codegen.*;
+import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class ExplicitConstructorCall extends Statement implements InvocationSite {
+ public Expression[] arguments;
+ public Expression qualification;
+ public MethodBinding binding;
+
+ public int accessMode;
+
+ public final static int ImplicitSuper = 1;
+ public final static int Super = 2;
+ public final static int This = 3;
+
+ public VariableBinding[][] implicitArguments;
+ boolean discardEnclosingInstance;
+
+ MethodBinding syntheticAccessor;
+
+public ExplicitConstructorCall(int accessMode) {
+ this.accessMode = accessMode;
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+
+ // must verify that exceptions potentially thrown by this expression are caught in the method.
+
+ try {
+ ((MethodScope) currentScope).isConstructorCall = true;
+
+ // process enclosing instance
+ if (qualification != null){
+ flowInfo = qualification.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
+ }
+ // process arguments
+ if (arguments != null){
+ for (int i = 0, max = arguments.length; i < max; i++) {
+ flowInfo = arguments[i].analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
+ }
+ }
+
+ ReferenceBinding[] thrownExceptions;
+ if ((thrownExceptions = binding.thrownExceptions) != NoExceptions) {
+ // check exceptions
+ flowContext.checkExceptionHandlers(
+ thrownExceptions,
+ (accessMode == ImplicitSuper) ? (AstNode)currentScope.methodScope().referenceContext : (AstNode)this,
+ flowInfo,
+ currentScope);
+ }
+ manageEnclosingInstanceAccessIfNecessary(currentScope);
+ manageSyntheticAccessIfNecessary(currentScope);
+ return flowInfo;
+ } finally {
+ ((MethodScope) currentScope).isConstructorCall = false;
+ }
+}
+/**
+ * Constructor call code generation
+ *
+ * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
+ * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
+ */
+public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+ if ((bits & IsReachableMASK) == 0) {
+ return;
+ }
+ try {
+ ((MethodScope) currentScope).isConstructorCall = true;
+
+ int pc = codeStream.position;
+ codeStream.aload_0();
+
+ // handling innerclass constructor invocation
+ ReferenceBinding targetType;
+ if ((targetType = binding.declaringClass).isNestedType()){
+ codeStream.generateSyntheticArgumentValues(currentScope, targetType, discardEnclosingInstance ? null : qualification, this);
+ }
+ // regular code gen
+ if (arguments != null){
+ for (int i = 0, max = arguments.length; i < max; i++) {
+ arguments[i].generateCode(currentScope, codeStream, true);
+ }
+ }
+ if (syntheticAccessor != null){
+ // synthetic accessor got some extra arguments appended to its signature, which need values
+ for (int i = 0, max = syntheticAccessor.parameters.length - binding.parameters.length; i < max; i++){
+ codeStream.aconst_null();
+ }
+ codeStream.invokespecial(syntheticAccessor);
+ } else {
+ codeStream.invokespecial(binding);
+ }
+ codeStream.recordPositionsFrom(pc, this);
+ } finally {
+ ((MethodScope) currentScope).isConstructorCall = false;
+ }
+}
+public boolean isImplicitSuper(){
+ //return true if I'm of these compiler added statement super();
+
+ return (accessMode == ImplicitSuper) ;}
+public boolean isSuperAccess(){
+ return accessMode != This;
+}
+public boolean isTypeAccess(){
+ return true;
+}
+/* Inner emulation consists in either recording a dependency
+ * link only, or performing one level of propagation.
+ *
+ * Dependency mechanism is used whenever dealing with source target
+ * types, since by the time we reach them, we might not yet know their
+ * exact need.
+ */
+void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
+ ReferenceBinding invocationType, superType;
+
+ // perform some emulation work in case there is some and we are inside a local type only
+ if ((superType = binding.declaringClass).isNestedType()
+ && currentScope.enclosingSourceType().isLocalType()) {
+
+ if (superType.isLocalType()){
+ ((LocalTypeBinding)superType).addInnerEmulationDependent(currentScope, qualification != null, true); // request direct access
+ } else {
+ // locally propagate, since we already now the desired shape for sure
+ currentScope.propagateInnerEmulation(superType, qualification != null, true); // request direct access
+
+ }
+ }
+}
+public void manageSyntheticAccessIfNecessary(BlockScope currentScope) {
+
+ // perform some emulation work in case there is some and we are inside a local type only
+ if (binding.isPrivate() && (accessMode != This)) {
+
+ if (currentScope.environment().options.isPrivateConstructorAccessChangingVisibility){
+ binding.tagForClearingPrivateModifier(); // constructor will not be dumped as private, no emulation required thus
+ } else {
+ syntheticAccessor = ((SourceTypeBinding) binding.declaringClass).addSyntheticMethod(binding);
+ currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
+ }
+ }
+}
+public void resolve(BlockScope scope) {
+ // the return type should be void for a constructor.
+ // the test is made into getConstructor
+
+ // mark the fact that we are in a constructor call.....
+ // unmark at all returns
+ try {
+ ((MethodScope) scope).isConstructorCall = true;
+ ReferenceBinding receiverType = scope.enclosingSourceType();
+ if (accessMode != This)
+ receiverType = receiverType.superclass();
+
+ if (receiverType == null) {
+ return;
+ }
+
+ // qualification should be from the type of the enclosingType
+ if (qualification != null) {
+ if (accessMode != Super){
+ scope.problemReporter().unnecessaryEnclosingInstanceSpecification(qualification, receiverType);
+ }
+ ReferenceBinding enclosingType = receiverType.enclosingType();
+ if (enclosingType == null) {
+ scope.problemReporter().unnecessaryEnclosingInstanceSpecification(qualification, receiverType);
+ discardEnclosingInstance = true;
+ } else {
+ TypeBinding qTb = qualification.resolveTypeExpecting(scope, enclosingType);
+ qualification.implicitWidening(qTb, qTb);
+ }
+ }
+
+ // arguments buffering for the method lookup
+ TypeBinding[] argTypes = NoParameters;
+ if (arguments != null) {
+ boolean argHasError = false; // typeChecks all arguments
+ int length = arguments.length;
+ argTypes = new TypeBinding[length];
+ for (int i = 0; i < length; i++)
+ if ((argTypes[i] = arguments[i].resolveType(scope)) == null)
+ argHasError = true;
+ if (argHasError)
+ return;
+ }
+ if ((binding = scope.getConstructor(receiverType, argTypes, this)).isValidBinding()) {
+ if (isMethodUseDeprecated(binding, scope))
+ scope.problemReporter().deprecatedMethod(binding, this);
+
+ // see for user-implicit widening conversion
+ if (arguments != null) {
+ int length = arguments.length;
+ TypeBinding[] paramTypes = binding.parameters;
+ for (int i = 0; i < length; i++)
+ arguments[i].implicitWidening(paramTypes[i], argTypes[i]);
+ }
+ } else {
+ if (binding.declaringClass == null)
+ binding.declaringClass = receiverType;
+ scope.problemReporter().invalidConstructor(this, binding);
+ }
+ } finally {
+ ((MethodScope) scope).isConstructorCall = false;
+ }
+}
+public void setDepth(int depth){
+ // ignore for here
+}
+public void setFieldIndex(int depth){
+ // ignore for here
+}
+public String toString(int tab){
+ /* slow code */
+
+ String s = tabString(tab);
+ if (qualification != null)
+ s = s + qualification.toStringExpression() + "."/*nonNLS*/ ;
+ if (accessMode == This){
+ s = s + "this("/*nonNLS*/;
+ } else {
+ s = s + "super("/*nonNLS*/;
+ }
+ if (arguments != null)
+ for (int i=0 ; i < arguments.length ; i++)
+ { s = s + arguments[i].toStringExpression();
+ if (i != arguments.length-1) s = s + ", "/*nonNLS*/;};;
+ s = s+")"/*nonNLS*/ ;
+ return s;}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ if (qualification != null) {
+ qualification.traverse(visitor, scope);
+ }
+ if (arguments != null) {
+ int argumentLength = arguments.length;
+ for (int i = 0; i < argumentLength; i++)
+ arguments[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
index 8595400d8c..e8993e1de3 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
@@ -1,371 +1,370 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-import org.eclipse.jdt.internal.compiler.problem.*;
-import org.eclipse.jdt.internal.compiler.util.Util;
-
-public abstract class Expression extends Statement {
- //some expression may not be used - from a java semantic point
- //of view only - as statements. Other may. In order to avoid the creation
- //of wrappers around expression in order to tune them as expression
- //Expression is a subclass of Statement. See the message isValidJavaStatement()
-
- public int implicitConversion;
- public Constant constant;
-
-public Expression() {
- super();
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired) {
- return analyseCode(currentScope, flowContext, flowInfo);
-}
-public Constant conditionalConstant(){
-
- return constant;
-}
-/* Dislike this name
-*/
-
-public static final boolean convertToTypeFromTypeValue(int left , int right, Constant cst){
- //true if there is no loose of information while casting.
- //right is constant's type.id
-
- //a faster solution would be to use combinaison of
- //some range.........????
-
-
- /*
- org.eclipse.jdt.internal.compiler.util.Constant cst ;
- cst = org.eclipse.jdt.internal.compiler.util.Constant.fromValue((float)898565456.0) ;
- org.eclipse.jdt.internal.compiler.lookup.BaseTypeBinding.convertToTypeFromTypeValue(
- org.eclipse.jdt.internal.compiler.ast.TypeReference.T_int,
- org.eclipse.jdt.internal.compiler.ast.TypeReference.T_float,
- cst)
- */
-
- if (left == right) return true ;
- switch(left){
- case T_char :
- switch (right) {
- case T_char : return true ;
- case T_double : return cst.doubleValue() == cst.charValue() ;
- case T_float : return cst.floatValue() == cst.charValue() ;
- case T_int : return cst.intValue() == cst.charValue() ;
- case T_short : return cst.shortValue() == cst.charValue() ;
- case T_byte : return cst.byteValue() == cst.charValue() ;
- case T_long : return cst.longValue() == cst.charValue() ;
- default : return false ;} //boolean
-
- case T_float :
- switch (right) {
- case T_char : return cst.charValue() == cst.floatValue() ;
- case T_double : return cst.doubleValue() == cst.floatValue() ;
- case T_float : return true;
- case T_int : return cst.intValue() == cst.floatValue() ;
- case T_short : return cst.shortValue() == cst.floatValue() ;
- case T_byte : return cst.byteValue() == cst.floatValue() ;
- case T_long : return cst.longValue() == cst.floatValue() ;
- default : return false ;} //boolean
- case T_double :
- switch (right) {
- case T_char : return cst.charValue() == cst.doubleValue() ;
- case T_double : return true ;
- case T_float : return cst.floatValue() == cst.doubleValue() ;
- case T_int : return cst.intValue() == cst.doubleValue() ;
- case T_short : return cst.shortValue() == cst.doubleValue() ;
- case T_byte : return cst.byteValue() == cst.doubleValue() ;
- case T_long : return cst.longValue() == cst.doubleValue() ;
- default : return false ;} //boolean
- case T_byte :
- switch (right) {
- case T_char : return cst.charValue() == cst.byteValue() ;
- case T_double : return cst.doubleValue() == cst.byteValue() ;
- case T_float : return cst.floatValue() == cst.byteValue() ;
- case T_int : return cst.intValue() == cst.byteValue() ;
- case T_short : return cst.shortValue() == cst.byteValue() ;
- case T_byte : return true ;
- case T_long : return cst.longValue() == cst.byteValue() ;
- default : return false ;} //boolean
- case T_short :
- switch (right) {
- case T_char : return cst.charValue() == cst.shortValue() ;
- case T_double : return cst.doubleValue() == cst.shortValue() ;
- case T_float : return cst.floatValue() == cst.shortValue() ;
- case T_int : return cst.intValue() == cst.shortValue() ;
- case T_short : return true ;
- case T_byte : return cst.byteValue() == cst.shortValue() ;
- case T_long : return cst.longValue() == cst.shortValue() ;
- default : return false ;} //boolean
- case T_int :
- switch (right) {
- case T_char : return cst.charValue() == cst.intValue() ;
- case T_double : return cst.doubleValue() == cst.intValue() ;
- case T_float : return cst.floatValue() == cst.intValue() ;
- case T_int : return true ;
- case T_short : return cst.shortValue() == cst.intValue() ;
- case T_byte : return cst.byteValue() == cst.intValue() ;
- case T_long : return cst.longValue() == cst.intValue() ;
- default : return false ;} //boolean
- case T_long :
- switch (right) {
- case T_char : return cst.charValue() == cst.longValue() ;
- case T_double : return cst.doubleValue() == cst.longValue() ;
- case T_float : return cst.floatValue() == cst.longValue() ;
- case T_int : return cst.intValue() == cst.longValue() ;
- case T_short : return cst.shortValue() == cst.longValue() ;
- case T_byte : return cst.byteValue() == cst.longValue() ;
- case T_long : return true ;
- default : return false ;} //boolean
- default : return false ; } //boolean
-}
-/**
- * Expression statements are plain expressions, however they generate like
- * normal expressions with no value required.
- *
- * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
- * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
- */
-public void generateCode(BlockScope currentScope, CodeStream codeStream) {
- if ((bits & IsReachableMASK) == 0) {
- return;
- }
- generateCode(currentScope, codeStream, false);
-}
-/**
- * Every expression is responsible for generating its implicit conversion when necessary.
- *
- * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
- * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
-
- if (constant != NotAConstant) {
- // generate a constant expression
- int pc = codeStream.position;
- codeStream.generateConstant(constant, implicitConversion);
- codeStream.recordPositionsFrom(pc, this);
- } else {
- // actual non-constant code generation
- throw new ShouldNotImplement(Util.bind("ast.missingCode"/*nonNLS*/));
- }
-}
-/**
- * Default generation of a boolean value
- */
-public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
-
- // a label valued to nil means: by default we fall through the case...
- // both nil means we leave the value on the stack
-
- if ((constant != Constant.NotAConstant) && (constant.typeID() == T_boolean)) {
- int pc = codeStream.position;
- if (constant.booleanValue() == true) {
- // constant == true
- if (valueRequired) {
- if (falseLabel == null) {
- // implicit falling through the FALSE case
- if (trueLabel != null) {
- codeStream.goto_(trueLabel);
- }
- }
- }
- } else {
- if (valueRequired) {
- if (falseLabel != null) {
- // implicit falling through the TRUE case
- if (trueLabel == null) {
- codeStream.goto_(falseLabel);
- }
- }
- }
- }
- codeStream.recordPositionsFrom(pc, this);
- return;
- }
- generateCode(currentScope, codeStream, valueRequired);
- // branching
- int position = codeStream.position;
- if (valueRequired) {
- if (falseLabel == null) {
- if (trueLabel != null) {
- // Implicit falling through the FALSE case
- codeStream.ifne(trueLabel);
- }
- } else {
- if (trueLabel == null) {
- // Implicit falling through the TRUE case
- codeStream.ifeq(falseLabel);
- } else {
- // No implicit fall through TRUE/FALSE --> should never occur
- }
- }
- }
- // reposition the endPC
- codeStream.updateLastRecordedEndPC(position);
-}
-public void generateOptimizedStringBuffer(BlockScope blockScope, org.eclipse.jdt.internal.compiler.codegen.CodeStream codeStream, int typeID) {
- /* Optimized (java) code generation for string concatenations that involve StringBuffer
- * creation: going through this path means that there is no need for a new StringBuffer
- * creation, further operands should rather be only appended to the current one.
- * By default: no optimization.
- */
-
- generateCode(blockScope, codeStream, true);
- codeStream.invokeStringBufferAppendForType(typeID);
-}
-public void generateOptimizedStringBufferCreation(BlockScope blockScope, CodeStream codeStream, int typeID) {
- /* Optimized (java) code generation for string concatenations that involve StringBuffer
- * creation: going through this path means that there is no need for a new StringBuffer
- * creation, further operands should rather be only appended to the current one.
- */
-
- // Optimization only for integers and strings
-
- if (typeID == T_Object) {
- // in the case the runtime value of valueOf(Object) returns null, we have to use append(Object) instead of directly valueOf(Object)
- // append(Object) returns append(valueOf(Object)), which means that the null case is handled by append(String).
- codeStream.newStringBuffer();
- codeStream.dup();
- codeStream.invokeStringBufferDefaultConstructor();
- generateCode(blockScope, codeStream, true);
- codeStream.invokeStringBufferAppendForType(T_Object);
- return;
- }
- codeStream.newStringBuffer();
- codeStream.dup();
- if ((typeID == T_String) || (typeID == T_null)) {
- if (constant != NotAConstant) {
- codeStream.ldc(constant.stringValue());
- } else {
- generateCode(blockScope, codeStream, true);
- codeStream.invokeStringValueOf(T_Object);
- }
- } else {
- generateCode(blockScope, codeStream, true);
- codeStream.invokeStringValueOf(typeID);
- }
- codeStream.invokeStringBufferStringConstructor();
-}
-public void implicitWidening(TypeBinding runtimeTimeType, TypeBinding compileTimeType) {
- // Base types need that the widening is explicitly done by the compiler using some bytecode like i2f
-
- if (runtimeTimeType == null || compileTimeType == null)
- return;
-
- if (compileTimeType.id == T_null) {
- // this case is possible only for constant null
- // The type of runtime is a reference type
- // The code gen use the constant id thus any value
- // for the runtime id (akak the <<4) could be used.
- // T_Object is used as some general T_reference
- implicitConversion = (T_Object << 4) + T_null;
- return;
- }
-
- switch (runtimeTimeType.id) {
- case T_byte :
- case T_short :
- case T_char :
- implicitConversion = (T_int << 4) + compileTimeType.id;
- break;
- case T_String :
- case T_float :
- case T_boolean :
- case T_double :
- case T_int : //implicitConversion may result in i2i which will result in NO code gen
- case T_long :
- implicitConversion = (runtimeTimeType.id << 4) + compileTimeType.id;
- break;
- default : //nothing on regular object ref
- }
-}
-public boolean isCompactableOperation() {
- return false;
-}
-public boolean isConstantValueOfTypeAssignableToType(TypeBinding constantType, TypeBinding targetType) {
- //Return true if the conversion is done AUTOMATICALLY by the vm
- //while the javaVM is an int based-machine, thus for example pushing
- //a byte onto the stack , will automatically creates a int on the stack
- //(this request some work d be done by the VM on signed numbers)
-
- if (constant == Constant.NotAConstant)
- return false;
- if (constantType == targetType)
- return true;
- if (constantType.isBaseType() && targetType.isBaseType()) {
- //No free assignment conversion from anything but to integral ones.
- if ((constantType == IntBinding || BaseTypeBinding.isWidening(T_int, constantType.id))
- && (BaseTypeBinding.isNarrowing(targetType.id, T_int))) {
- //use current explicit conversion in order to get some new value to compare with current one
- return convertToTypeFromTypeValue(targetType.id, constantType.id, constant);
- }
- }
- return false;
-}
-public boolean isTypeReference() {
- return false;
-}
-public void resolve(BlockScope scope) {
- // drops the returning expression's type whatever the type is.
-
- this.resolveType(scope);
- return;
-}
-public TypeBinding resolveType(BlockScope scope) {
- // by default... subclasses should implement a better TC if required.
-
- return null;
-}
-public TypeBinding resolveTypeExpecting(BlockScope scope, TypeBinding expectedTb) {
- TypeBinding thisTb = this.resolveType(scope);
- if (thisTb == null)
- return null;
- if (!scope.areTypesCompatible(thisTb, expectedTb)) {
- scope.problemReporter().typeMismatchError(thisTb, expectedTb, this);
- return null;
- }
- return thisTb;
-}
-public String toString(int tab) {
-
- //Subclass re-define toStringExpression
-
- String s = tabString(tab);
- if (constant != null)
- //before TC has runned
- if (constant != NotAConstant)
- //after the TC has runned
- s += " /*cst:"/*nonNLS*/ + constant.toString() + "*/ "/*nonNLS*/;
- return s + toStringExpression(tab);
-}
-public String toStringExpression() {
-
- //Subclass re-define toStringExpression
- //This method is abstract and should never be called
- //but we provide some code that is running.....just in case
- //of developpement time (while every thing is not built)
-
- return super.toString(0);}
-public String toStringExpression(int tab) {
- // default is regular toString expression (qualified allocation expressions redifine this method)
- return this.toStringExpression();
-}
-public Expression toTypeReference(){
- //by default undefined
-
- //this method is meanly used by the parser in order to transform
- //an expression that is used as a type reference in a cast ....
- //--appreciate the fact that castExpression and ExpressionWithParenthesis
- //--starts with the same pattern.....
-
- return this; }
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.impl.*;
+import org.eclipse.jdt.internal.compiler.codegen.*;
+import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+import org.eclipse.jdt.internal.compiler.problem.*;
+import org.eclipse.jdt.internal.compiler.util.Util;
+
+public abstract class Expression extends Statement {
+ //some expression may not be used - from a java semantic point
+ //of view only - as statements. Other may. In order to avoid the creation
+ //of wrappers around expression in order to tune them as expression
+ //Expression is a subclass of Statement. See the message isValidJavaStatement()
+
+ public int implicitConversion;
+ public Constant constant;
+
+public Expression() {
+ super();
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired) {
+ return analyseCode(currentScope, flowContext, flowInfo);
+}
+public Constant conditionalConstant(){
+
+ return constant;
+}
+/* Dislike this name
+*/
+
+public static final boolean convertToTypeFromTypeValue(int left , int right, Constant cst){
+ //true if there is no loose of information while casting.
+ //right is constant's type.id
+
+ //a faster solution would be to use combinaison of
+ //some range.........????
+
+
+ /*
+ org.eclipse.jdt.internal.compiler.util.Constant cst ;
+ cst = org.eclipse.jdt.internal.compiler.util.Constant.fromValue((float)898565456.0) ;
+ org.eclipse.jdt.internal.compiler.lookup.BaseTypeBinding.convertToTypeFromTypeValue(
+ org.eclipse.jdt.internal.compiler.ast.TypeReference.T_int,
+ org.eclipse.jdt.internal.compiler.ast.TypeReference.T_float,
+ cst)
+ */
+
+ if (left == right) return true ;
+ switch(left){
+ case T_char :
+ switch (right) {
+ case T_char : return true ;
+ case T_double : return cst.doubleValue() == cst.charValue() ;
+ case T_float : return cst.floatValue() == cst.charValue() ;
+ case T_int : return cst.intValue() == cst.charValue() ;
+ case T_short : return cst.shortValue() == cst.charValue() ;
+ case T_byte : return cst.byteValue() == cst.charValue() ;
+ case T_long : return cst.longValue() == cst.charValue() ;
+ default : return false ;} //boolean
+
+ case T_float :
+ switch (right) {
+ case T_char : return cst.charValue() == cst.floatValue() ;
+ case T_double : return cst.doubleValue() == cst.floatValue() ;
+ case T_float : return true;
+ case T_int : return cst.intValue() == cst.floatValue() ;
+ case T_short : return cst.shortValue() == cst.floatValue() ;
+ case T_byte : return cst.byteValue() == cst.floatValue() ;
+ case T_long : return cst.longValue() == cst.floatValue() ;
+ default : return false ;} //boolean
+ case T_double :
+ switch (right) {
+ case T_char : return cst.charValue() == cst.doubleValue() ;
+ case T_double : return true ;
+ case T_float : return cst.floatValue() == cst.doubleValue() ;
+ case T_int : return cst.intValue() == cst.doubleValue() ;
+ case T_short : return cst.shortValue() == cst.doubleValue() ;
+ case T_byte : return cst.byteValue() == cst.doubleValue() ;
+ case T_long : return cst.longValue() == cst.doubleValue() ;
+ default : return false ;} //boolean
+ case T_byte :
+ switch (right) {
+ case T_char : return cst.charValue() == cst.byteValue() ;
+ case T_double : return cst.doubleValue() == cst.byteValue() ;
+ case T_float : return cst.floatValue() == cst.byteValue() ;
+ case T_int : return cst.intValue() == cst.byteValue() ;
+ case T_short : return cst.shortValue() == cst.byteValue() ;
+ case T_byte : return true ;
+ case T_long : return cst.longValue() == cst.byteValue() ;
+ default : return false ;} //boolean
+ case T_short :
+ switch (right) {
+ case T_char : return cst.charValue() == cst.shortValue() ;
+ case T_double : return cst.doubleValue() == cst.shortValue() ;
+ case T_float : return cst.floatValue() == cst.shortValue() ;
+ case T_int : return cst.intValue() == cst.shortValue() ;
+ case T_short : return true ;
+ case T_byte : return cst.byteValue() == cst.shortValue() ;
+ case T_long : return cst.longValue() == cst.shortValue() ;
+ default : return false ;} //boolean
+ case T_int :
+ switch (right) {
+ case T_char : return cst.charValue() == cst.intValue() ;
+ case T_double : return cst.doubleValue() == cst.intValue() ;
+ case T_float : return cst.floatValue() == cst.intValue() ;
+ case T_int : return true ;
+ case T_short : return cst.shortValue() == cst.intValue() ;
+ case T_byte : return cst.byteValue() == cst.intValue() ;
+ case T_long : return cst.longValue() == cst.intValue() ;
+ default : return false ;} //boolean
+ case T_long :
+ switch (right) {
+ case T_char : return cst.charValue() == cst.longValue() ;
+ case T_double : return cst.doubleValue() == cst.longValue() ;
+ case T_float : return cst.floatValue() == cst.longValue() ;
+ case T_int : return cst.intValue() == cst.longValue() ;
+ case T_short : return cst.shortValue() == cst.longValue() ;
+ case T_byte : return cst.byteValue() == cst.longValue() ;
+ case T_long : return true ;
+ default : return false ;} //boolean
+ default : return false ; } //boolean
+}
+/**
+ * Expression statements are plain expressions, however they generate like
+ * normal expressions with no value required.
+ *
+ * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
+ * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
+ */
+public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+ if ((bits & IsReachableMASK) == 0) {
+ return;
+ }
+ generateCode(currentScope, codeStream, false);
+}
+/**
+ * Every expression is responsible for generating its implicit conversion when necessary.
+ *
+ * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
+ * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+
+ if (constant != NotAConstant) {
+ // generate a constant expression
+ int pc = codeStream.position;
+ codeStream.generateConstant(constant, implicitConversion);
+ codeStream.recordPositionsFrom(pc, this);
+ } else {
+ // actual non-constant code generation
+ throw new ShouldNotImplement(Util.bind("ast.missingCode"/*nonNLS*/));
+ }
+}
+/**
+ * Default generation of a boolean value
+ */
+public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
+
+ // a label valued to nil means: by default we fall through the case...
+ // both nil means we leave the value on the stack
+
+ if ((constant != Constant.NotAConstant) && (constant.typeID() == T_boolean)) {
+ int pc = codeStream.position;
+ if (constant.booleanValue() == true) {
+ // constant == true
+ if (valueRequired) {
+ if (falseLabel == null) {
+ // implicit falling through the FALSE case
+ if (trueLabel != null) {
+ codeStream.goto_(trueLabel);
+ }
+ }
+ }
+ } else {
+ if (valueRequired) {
+ if (falseLabel != null) {
+ // implicit falling through the TRUE case
+ if (trueLabel == null) {
+ codeStream.goto_(falseLabel);
+ }
+ }
+ }
+ }
+ codeStream.recordPositionsFrom(pc, this);
+ return;
+ }
+ generateCode(currentScope, codeStream, valueRequired);
+ // branching
+ int position = codeStream.position;
+ if (valueRequired) {
+ if (falseLabel == null) {
+ if (trueLabel != null) {
+ // Implicit falling through the FALSE case
+ codeStream.ifne(trueLabel);
+ }
+ } else {
+ if (trueLabel == null) {
+ // Implicit falling through the TRUE case
+ codeStream.ifeq(falseLabel);
+ } else {
+ // No implicit fall through TRUE/FALSE --> should never occur
+ }
+ }
+ }
+ // reposition the endPC
+ codeStream.updateLastRecordedEndPC(position);
+}
+public void generateOptimizedStringBuffer(BlockScope blockScope, org.eclipse.jdt.internal.compiler.codegen.CodeStream codeStream, int typeID) {
+ /* Optimized (java) code generation for string concatenations that involve StringBuffer
+ * creation: going through this path means that there is no need for a new StringBuffer
+ * creation, further operands should rather be only appended to the current one.
+ * By default: no optimization.
+ */
+
+ generateCode(blockScope, codeStream, true);
+ codeStream.invokeStringBufferAppendForType(typeID);
+}
+public void generateOptimizedStringBufferCreation(BlockScope blockScope, CodeStream codeStream, int typeID) {
+ /* Optimized (java) code generation for string concatenations that involve StringBuffer
+ * creation: going through this path means that there is no need for a new StringBuffer
+ * creation, further operands should rather be only appended to the current one.
+ */
+
+ // Optimization only for integers and strings
+
+ if (typeID == T_Object) {
+ // in the case the runtime value of valueOf(Object) returns null, we have to use append(Object) instead of directly valueOf(Object)
+ // append(Object) returns append(valueOf(Object)), which means that the null case is handled by append(String).
+ codeStream.newStringBuffer();
+ codeStream.dup();
+ codeStream.invokeStringBufferDefaultConstructor();
+ generateCode(blockScope, codeStream, true);
+ codeStream.invokeStringBufferAppendForType(T_Object);
+ return;
+ }
+ codeStream.newStringBuffer();
+ codeStream.dup();
+ if ((typeID == T_String) || (typeID == T_null)) {
+ if (constant != NotAConstant) {
+ codeStream.ldc(constant.stringValue());
+ } else {
+ generateCode(blockScope, codeStream, true);
+ codeStream.invokeStringValueOf(T_Object);
+ }
+ } else {
+ generateCode(blockScope, codeStream, true);
+ codeStream.invokeStringValueOf(typeID);
+ }
+ codeStream.invokeStringBufferStringConstructor();
+}
+public void implicitWidening(TypeBinding runtimeTimeType, TypeBinding compileTimeType) {
+ // Base types need that the widening is explicitly done by the compiler using some bytecode like i2f
+
+ if (runtimeTimeType == null || compileTimeType == null)
+ return;
+
+ if (compileTimeType.id == T_null) {
+ // this case is possible only for constant null
+ // The type of runtime is a reference type
+ // The code gen use the constant id thus any value
+ // for the runtime id (akak the <<4) could be used.
+ // T_Object is used as some general T_reference
+ implicitConversion = (T_Object << 4) + T_null;
+ return;
+ }
+
+ switch (runtimeTimeType.id) {
+ case T_byte :
+ case T_short :
+ case T_char :
+ implicitConversion = (T_int << 4) + compileTimeType.id;
+ break;
+ case T_String :
+ case T_float :
+ case T_boolean :
+ case T_double :
+ case T_int : //implicitConversion may result in i2i which will result in NO code gen
+ case T_long :
+ implicitConversion = (runtimeTimeType.id << 4) + compileTimeType.id;
+ break;
+ default : //nothing on regular object ref
+ }
+}
+public boolean isCompactableOperation() {
+ return false;
+}
+public boolean isConstantValueOfTypeAssignableToType(TypeBinding constantType, TypeBinding targetType) {
+ //Return true if the conversion is done AUTOMATICALLY by the vm
+ //while the javaVM is an int based-machine, thus for example pushing
+ //a byte onto the stack , will automatically creates a int on the stack
+ //(this request some work d be done by the VM on signed numbers)
+
+ if (constant == Constant.NotAConstant)
+ return false;
+ if (constantType == targetType)
+ return true;
+ if (constantType.isBaseType() && targetType.isBaseType()) {
+ //No free assignment conversion from anything but to integral ones.
+ if ((constantType == IntBinding || BaseTypeBinding.isWidening(T_int, constantType.id))
+ && (BaseTypeBinding.isNarrowing(targetType.id, T_int))) {
+ //use current explicit conversion in order to get some new value to compare with current one
+ return convertToTypeFromTypeValue(targetType.id, constantType.id, constant);
+ }
+ }
+ return false;
+}
+public boolean isTypeReference() {
+ return false;
+}
+public void resolve(BlockScope scope) {
+ // drops the returning expression's type whatever the type is.
+
+ this.resolveType(scope);
+ return;
+}
+public TypeBinding resolveType(BlockScope scope) {
+ // by default... subclasses should implement a better TC if required.
+
+ return null;
+}
+public TypeBinding resolveTypeExpecting(BlockScope scope, TypeBinding expectedTb) {
+ TypeBinding thisTb = this.resolveType(scope);
+ if (thisTb == null)
+ return null;
+ if (!scope.areTypesCompatible(thisTb, expectedTb)) {
+ scope.problemReporter().typeMismatchError(thisTb, expectedTb, this);
+ return null;
+ }
+ return thisTb;
+}
+public String toString(int tab) {
+
+ //Subclass re-define toStringExpression
+
+ String s = tabString(tab);
+ if (constant != null)
+ //before TC has runned
+ if (constant != NotAConstant)
+ //after the TC has runned
+ s += " /*cst:"/*nonNLS*/ + constant.toString() + "*/ "/*nonNLS*/;
+ return s + toStringExpression(tab);
+}
+public String toStringExpression() {
+
+ //Subclass re-define toStringExpression
+ //This method is abstract and should never be called
+ //but we provide some code that is running.....just in case
+ //of developpement time (while every thing is not built)
+
+ return super.toString(0);}
+public String toStringExpression(int tab) {
+ // default is regular toString expression (qualified allocation expressions redifine this method)
+ return this.toStringExpression();
+}
+public Expression toTypeReference(){
+ //by default undefined
+
+ //this method is meanly used by the parser in order to transform
+ //an expression that is used as a type reference in a cast ....
+ //--appreciate the fact that castExpression and ExpressionWithParenthesis
+ //--starts with the same pattern.....
+
+ return this; }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExtendedStringLiteral.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExtendedStringLiteral.java
index be9c90d626..c745ffb8d4 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExtendedStringLiteral.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExtendedStringLiteral.java
@@ -1,56 +1,56 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
-
-public class ExtendedStringLiteral extends StringLiteral {
- private static final int INIT_SIZE = 30;
-public ExtendedStringLiteral(StringLiteral str, CharLiteral character) {
- //build a string+char literal
-
- super(str.source, str.sourceStart, str.sourceEnd);
- extendWith(character);
-}
-public ExtendedStringLiteral(StringLiteral str1, StringLiteral str2) {
- //build a two-strings literal
-
- super(str1.source, str1.sourceStart, str1.sourceEnd);
- extendWith(str2);
-}
-public ExtendedStringLiteral extendWith(CharLiteral lit){
- //add the lit source to mine, just as if it was mine
-
- //uddate the source
- int length = source.length;
- System.arraycopy(source,0,(source=new char[length+1]),0,length);
- source[length] = lit.value;
- //position at the end of all literals
- sourceEnd = lit.sourceEnd ;
- return this;
-}
-public ExtendedStringLiteral extendWith(StringLiteral lit){
- //add the lit source to mine, just as if it was mine
-
- //uddate the source
- int length = source.length;
- System.arraycopy(source,0,source=new char[length+lit.source.length],0,length);
- System.arraycopy(lit.source,0,source,length,lit.source.length);
- //position at the end of all literals
- sourceEnd = lit.sourceEnd ;
- return this;
-}
-public String toStringExpression() {
- /* slow code */
-
- String str = "ExtendedStringLiteral{"/*nonNLS*/+ new String(source) +"}"/*nonNLS*/;
- return str;
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
+
+public class ExtendedStringLiteral extends StringLiteral {
+
+public ExtendedStringLiteral(StringLiteral str, CharLiteral character) {
+ //build a string+char literal
+
+ super(str.source, str.sourceStart, str.sourceEnd);
+ extendWith(character);
+}
+public ExtendedStringLiteral(StringLiteral str1, StringLiteral str2) {
+ //build a two-strings literal
+
+ super(str1.source, str1.sourceStart, str1.sourceEnd);
+ extendWith(str2);
+}
+public ExtendedStringLiteral extendWith(CharLiteral lit){
+ //add the lit source to mine, just as if it was mine
+
+ //uddate the source
+ int length = source.length;
+ System.arraycopy(source,0,(source=new char[length+1]),0,length);
+ source[length] = lit.value;
+ //position at the end of all literals
+ sourceEnd = lit.sourceEnd ;
+ return this;
+}
+public ExtendedStringLiteral extendWith(StringLiteral lit){
+ //add the lit source to mine, just as if it was mine
+
+ //uddate the source
+ int length = source.length;
+ System.arraycopy(source,0,source=new char[length+lit.source.length],0,length);
+ System.arraycopy(lit.source,0,source,length,lit.source.length);
+ //position at the end of all literals
+ sourceEnd = lit.sourceEnd ;
+ return this;
+}
+public String toStringExpression() {
+ /* slow code */
+
+ String str = "ExtendedStringLiteral{"/*nonNLS*/+ new String(source) +"}"/*nonNLS*/;
+ return str;
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java
index fce4ceea13..fb727f92ac 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java
@@ -1,150 +1,149 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-import org.eclipse.jdt.internal.compiler.problem.*;
-
-public class FieldDeclaration extends AbstractVariableDeclaration {
- public FieldBinding binding;
- boolean hasBeenResolved = false;
-
- //allows to retrieve both the "type" part of the declaration (part1)
- //and also the part that decribe the name and the init and optionally
- //some other dimension ! ....
- //public int[] a, b[] = X, c ;
- //for b that would give for
- // - part1 : public int[]
- // - part2 : b[] = X,
-
- public int endPart1Position;
- public int endPart2Position;
-public FieldDeclaration(){}
-public FieldDeclaration(Expression initialization, char[] name, int sourceStart, int sourceEnd) {
-
- this.initialization = initialization;
- this.name = name;
-
- //due to some declaration like
- // int x, y = 3, z , x ;
- //the sourceStart and the sourceEnd is ONLY on the name
-
- this.sourceStart = sourceStart;
- this.sourceEnd = sourceEnd;
-}
-public FlowInfo analyseCode(MethodScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- if (initialization != null) {
- flowInfo = initialization.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
- flowInfo.markAsDefinitelyAssigned(binding);
- } else {
- flowInfo.markAsDefinitelyNotAssigned(binding); // clear the bit in case it was already set (from enclosing info)
- }
- return flowInfo;
-}
-/**
- * Code generation for a field declaration
- * i.e. normal assignment to a field
- *
- * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
- * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
- */
-public void generateCode(BlockScope currentScope, CodeStream codeStream) {
- if ((bits & IsReachableMASK) == 0) {
- return;
- }
- // do not generate initialization code if final and static (constant is then
- // recorded inside the field itself).
- int pc = codeStream.position;
- boolean isStatic;
- if (initialization != null
- && !((isStatic = binding.isStatic()) && binding.constant != NotAConstant)){
- // non-static field, need receiver
- if (!isStatic) codeStream.aload_0();
- // generate initialization value
- initialization.generateCode(currentScope, codeStream, true);
- // store into field
- if (isStatic) {
- codeStream.putstatic(binding);
- } else {
- codeStream.putfield(binding);
- }
- }
- codeStream.recordPositionsFrom(pc, this);
-}
-public TypeBinding getTypeBinding(Scope scope) {
- return type.getTypeBinding(scope);
-}
-public boolean isField() {
- return true;
-}
-public boolean isStatic() {
- if (binding != null) return binding.isStatic();
- return (modifiers & AccStatic) != 0;
-}
-public String name(){
-
- return String.valueOf(name) ;}
-public void resolve(MethodScope initializationScope) {
- // the two <constant = Constant.NotAConstant> could be regrouped into
- // a single line but it is clearer to have two lines while the reason of their
- // existence is not at all the same. See comment for the second one.
-
- //--------------------------------------------------------
- if (!hasBeenResolved && binding != null && binding.isValidBinding()) {
- hasBeenResolved = true;
- if (isTypeUseDeprecated(binding.type, initializationScope))
- initializationScope.problemReporter().deprecatedType(binding.type, type);
-
- this.type.binding = this.binding.type; // update binding for type reference
-
- // the resolution of the initialization hasn't been done
- if (initialization == null) {
- binding.constant = Constant.NotAConstant;
- } else {
- // break dead-lock cycles by forcing constant to NotAConstant
- int previous = initializationScope.fieldDeclarationIndex;
- try {
- initializationScope.fieldDeclarationIndex = binding.id;
- binding.constant = Constant.NotAConstant;
- TypeBinding tb = binding.type;
- TypeBinding initTb;
- if (initialization instanceof ArrayInitializer) {
- if ((initTb = initialization.resolveTypeExpecting(initializationScope, tb)) != null) {
- ((ArrayInitializer) initialization).binding = (ArrayBinding) initTb;
- initialization.implicitWidening(tb, initTb);
- }
- } else if ((initTb = initialization.resolveType(initializationScope)) != null) {
- if (initialization.isConstantValueOfTypeAssignableToType(initTb, tb) || (tb.isBaseType() && BaseTypeBinding.isWidening(tb.id, initTb.id)))
- initialization.implicitWidening(tb, initTb);
- else if (initializationScope.areTypesCompatible(initTb, tb))
- initialization.implicitWidening(tb, initTb);
- else
- initializationScope.problemReporter().typeMismatchError(initTb, tb, this);
- if (binding.isFinal()) // cast from constant actual type to variable type
- binding.constant = initialization.constant.castTo((binding.type.id << 4) + initialization.constant.typeID());
- } else {
- binding.constant = NotAConstant;
- }
- } finally {
- initializationScope.fieldDeclarationIndex = previous;
- if (binding.constant == null) binding.constant = Constant.NotAConstant;
- }
- }
- // cannot define static non-constant field inside nested class
- if (binding.isStatic() && binding.constant == NotAConstant)
- if (binding.declaringClass.isNestedType() && binding.declaringClass.isClass() && !binding.declaringClass.isStatic())
- initializationScope.problemReporter().unexpectedStaticModifierForField((SourceTypeBinding)binding.declaringClass, this);
- }
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, MethodScope scope) {
- visitor.visit(this, scope);
- type.traverse(visitor, scope);
- if (initialization != null) initialization.traverse(visitor, scope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.impl.*;
+import org.eclipse.jdt.internal.compiler.codegen.*;
+import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class FieldDeclaration extends AbstractVariableDeclaration {
+ public FieldBinding binding;
+ boolean hasBeenResolved = false;
+
+ //allows to retrieve both the "type" part of the declaration (part1)
+ //and also the part that decribe the name and the init and optionally
+ //some other dimension ! ....
+ //public int[] a, b[] = X, c ;
+ //for b that would give for
+ // - part1 : public int[]
+ // - part2 : b[] = X,
+
+ public int endPart1Position;
+ public int endPart2Position;
+public FieldDeclaration(){}
+public FieldDeclaration(Expression initialization, char[] name, int sourceStart, int sourceEnd) {
+
+ this.initialization = initialization;
+ this.name = name;
+
+ //due to some declaration like
+ // int x, y = 3, z , x ;
+ //the sourceStart and the sourceEnd is ONLY on the name
+
+ this.sourceStart = sourceStart;
+ this.sourceEnd = sourceEnd;
+}
+public FlowInfo analyseCode(MethodScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ if (initialization != null) {
+ flowInfo = initialization.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
+ flowInfo.markAsDefinitelyAssigned(binding);
+ } else {
+ flowInfo.markAsDefinitelyNotAssigned(binding); // clear the bit in case it was already set (from enclosing info)
+ }
+ return flowInfo;
+}
+/**
+ * Code generation for a field declaration
+ * i.e. normal assignment to a field
+ *
+ * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
+ * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
+ */
+public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+ if ((bits & IsReachableMASK) == 0) {
+ return;
+ }
+ // do not generate initialization code if final and static (constant is then
+ // recorded inside the field itself).
+ int pc = codeStream.position;
+ boolean isStatic;
+ if (initialization != null
+ && !((isStatic = binding.isStatic()) && binding.constant != NotAConstant)){
+ // non-static field, need receiver
+ if (!isStatic) codeStream.aload_0();
+ // generate initialization value
+ initialization.generateCode(currentScope, codeStream, true);
+ // store into field
+ if (isStatic) {
+ codeStream.putstatic(binding);
+ } else {
+ codeStream.putfield(binding);
+ }
+ }
+ codeStream.recordPositionsFrom(pc, this);
+}
+public TypeBinding getTypeBinding(Scope scope) {
+ return type.getTypeBinding(scope);
+}
+public boolean isField() {
+ return true;
+}
+public boolean isStatic() {
+ if (binding != null) return binding.isStatic();
+ return (modifiers & AccStatic) != 0;
+}
+public String name(){
+
+ return String.valueOf(name) ;}
+public void resolve(MethodScope initializationScope) {
+ // the two <constant = Constant.NotAConstant> could be regrouped into
+ // a single line but it is clearer to have two lines while the reason of their
+ // existence is not at all the same. See comment for the second one.
+
+ //--------------------------------------------------------
+ if (!hasBeenResolved && binding != null && binding.isValidBinding()) {
+ hasBeenResolved = true;
+ if (isTypeUseDeprecated(binding.type, initializationScope))
+ initializationScope.problemReporter().deprecatedType(binding.type, type);
+
+ this.type.binding = this.binding.type; // update binding for type reference
+
+ // the resolution of the initialization hasn't been done
+ if (initialization == null) {
+ binding.constant = Constant.NotAConstant;
+ } else {
+ // break dead-lock cycles by forcing constant to NotAConstant
+ int previous = initializationScope.fieldDeclarationIndex;
+ try {
+ initializationScope.fieldDeclarationIndex = binding.id;
+ binding.constant = Constant.NotAConstant;
+ TypeBinding tb = binding.type;
+ TypeBinding initTb;
+ if (initialization instanceof ArrayInitializer) {
+ if ((initTb = initialization.resolveTypeExpecting(initializationScope, tb)) != null) {
+ ((ArrayInitializer) initialization).binding = (ArrayBinding) initTb;
+ initialization.implicitWidening(tb, initTb);
+ }
+ } else if ((initTb = initialization.resolveType(initializationScope)) != null) {
+ if (initialization.isConstantValueOfTypeAssignableToType(initTb, tb) || (tb.isBaseType() && BaseTypeBinding.isWidening(tb.id, initTb.id)))
+ initialization.implicitWidening(tb, initTb);
+ else if (initializationScope.areTypesCompatible(initTb, tb))
+ initialization.implicitWidening(tb, initTb);
+ else
+ initializationScope.problemReporter().typeMismatchError(initTb, tb, this);
+ if (binding.isFinal()) // cast from constant actual type to variable type
+ binding.constant = initialization.constant.castTo((binding.type.id << 4) + initialization.constant.typeID());
+ } else {
+ binding.constant = NotAConstant;
+ }
+ } finally {
+ initializationScope.fieldDeclarationIndex = previous;
+ if (binding.constant == null) binding.constant = Constant.NotAConstant;
+ }
+ }
+ // cannot define static non-constant field inside nested class
+ if (binding.isStatic() && binding.constant == NotAConstant)
+ if (binding.declaringClass.isNestedType() && binding.declaringClass.isClass() && !binding.declaringClass.isStatic())
+ initializationScope.problemReporter().unexpectedStaticModifierForField((SourceTypeBinding)binding.declaringClass, this);
+ }
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, MethodScope scope) {
+ visitor.visit(this, scope);
+ type.traverse(visitor, scope);
+ if (initialization != null) initialization.traverse(visitor, scope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java
index e733ac9366..97019d452c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java
@@ -1,373 +1,372 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-import org.eclipse.jdt.internal.compiler.problem.*;
-import org.eclipse.jdt.internal.compiler.util.*;
-
-public class FieldReference extends Reference implements InvocationSite {
- public Expression receiver;
- public char[] token;
- public FieldBinding binding;
-
- public long nameSourcePosition ; //(start<<32)+end
-
-
- MethodBinding syntheticReadAccessor, syntheticWriteAccessor;
- public TypeBinding receiverType;
-
-public FieldReference(char[] source , long pos) {
- token = source ;
- nameSourcePosition = pos;
- //by default the position are the one of the field (not true for super access)
- sourceStart = (int) (pos>>>32) ;
- sourceEnd = (int) (pos & 0x00000000FFFFFFFFL);
- bits |= BindingIds.FIELD;
-
-}
-public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment, boolean isCompound) {
-
- // compound assignment extra work
- if (isCompound) { // check the variable part is initialized if blank final
- if (binding.isFinal() && receiver.isThis() && currentScope.allowBlankFinalFieldAssignment(binding) && (!flowInfo.isDefinitelyAssigned(binding))) {
- currentScope.problemReporter().uninitializedBlankFinalField(binding, this);
- // we could improve error msg here telling "cannot use compound assignment on final blank field"
- }
- manageSyntheticReadAccessIfNecessary(currentScope);
- }
- if (assignment.expression != null) {
- flowInfo = assignment.expression.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
- }
- flowInfo = receiver.analyseCode(currentScope, flowContext, flowInfo, !binding.isStatic()).unconditionalInits();
- manageSyntheticWriteAccessIfNecessary(currentScope);
-
- // check if assigning a final field
- if (binding.isFinal()) {
- // in a context where it can be assigned?
- if (receiver.isThis() && currentScope.allowBlankFinalFieldAssignment(binding)) {
- if (flowInfo.isPotentiallyAssigned(binding)) {
- currentScope.problemReporter().duplicateInitializationOfBlankFinalField(binding, this);
- }
- flowInfo.markAsDefinitelyAssigned(binding);
- flowContext.recordSettingFinal(binding, this);
- } else {
- // assigning a final field outside an initializer or constructor
- currentScope.problemReporter().cannotAssignToFinalField(binding, this);
- }
- }
- return flowInfo;
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- return analyseCode(currentScope, flowContext, flowInfo, true);
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired) {
- receiver.analyseCode(currentScope, flowContext, flowInfo, !binding.isStatic());
- if (valueRequired) {
- manageSyntheticReadAccessIfNecessary(currentScope);
- }
- return flowInfo;
-}
-public FieldBinding fieldBinding() {
- //FLOW ANALYSIS
-
- return binding ; }
-public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) {
-
- receiver.generateCode(currentScope, codeStream, !binding.isStatic());
- assignment.expression.generateCode(currentScope, codeStream, true);
- fieldStore(codeStream, binding, syntheticWriteAccessor, valueRequired);
- if (valueRequired){
- codeStream.generateImplicitConversion(assignment.implicitConversion);
- }
-}
-/**
- * Field reference code generation
- *
- * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
- * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
- int pc = codeStream.position;
- if (constant != NotAConstant) {
- if (valueRequired) {
- codeStream.generateConstant(constant, implicitConversion);
- }
- } else {
- boolean isStatic = binding.isStatic();
- receiver.generateCode(currentScope, codeStream, valueRequired && (!isStatic) && (binding.constant == NotAConstant));
- if (valueRequired) {
- if (binding.constant == NotAConstant) {
- if (binding.declaringClass == null) { // array length
- codeStream.arraylength();
- } else {
- if (syntheticReadAccessor == null) {
- if (isStatic) {
- codeStream.getstatic(binding);
- } else {
- codeStream.getfield(binding);
- }
- } else {
- codeStream.invokestatic(syntheticReadAccessor);
- }
- }
- codeStream.generateImplicitConversion(implicitConversion);
- } else {
- codeStream.generateConstant(binding.constant, implicitConversion);
- }
- }
- }
- codeStream.recordPositionsFrom(pc, this);
-}
-public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) {
- boolean isStatic;
- receiver.generateCode(currentScope, codeStream, !(isStatic = binding.isStatic()));
- if (isStatic) {
- if (syntheticReadAccessor == null) {
- codeStream.getstatic(binding);
- } else {
- codeStream.invokestatic(syntheticReadAccessor);
- }
- } else {
- codeStream.dup();
- if (syntheticReadAccessor == null) {
- codeStream.getfield(binding);
- } else {
- codeStream.invokestatic(syntheticReadAccessor);
- }
- }
- int operationTypeID;
- if ((operationTypeID = implicitConversion >> 4) == T_String) {
- codeStream.generateStringAppend(currentScope, null, expression);
- } else {
- // promote the array reference to the suitable operation type
- codeStream.generateImplicitConversion(implicitConversion);
- // generate the increment value (will by itself be promoted to the operation value)
- if (expression == IntLiteral.One){ // prefix operation
- codeStream.generateConstant(expression.constant, implicitConversion);
- } else {
- expression.generateCode(currentScope, codeStream, true);
- }
- // perform the operation
- codeStream.sendOperator(operator, operationTypeID);
- // cast the value back to the array reference type
- codeStream.generateImplicitConversion(assignmentImplicitConversion);
- }
- fieldStore(codeStream, binding, syntheticWriteAccessor, valueRequired);
-}
-public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired) {
- boolean isStatic;
- receiver.generateCode(currentScope, codeStream, !(isStatic = binding.isStatic()));
- if (isStatic) {
- if (syntheticReadAccessor == null) {
- codeStream.getstatic(binding);
- } else {
- codeStream.invokestatic(syntheticReadAccessor);
- }
- } else {
- codeStream.dup();
- if (syntheticReadAccessor == null) {
- codeStream.getfield(binding);
- } else {
- codeStream.invokestatic(syntheticReadAccessor);
- }
- }
- if (valueRequired) {
- if (isStatic) {
- if ((binding.type == LongBinding) || (binding.type == DoubleBinding)) {
- codeStream.dup2();
- } else {
- codeStream.dup();
- }
- } else { // Stack: [owner][old field value] ---> [old field value][owner][old field value]
- if ((binding.type == LongBinding) || (binding.type == DoubleBinding)) {
- codeStream.dup2_x1();
- } else {
- codeStream.dup_x1();
- }
- }
- }
- codeStream.generateConstant(postIncrement.expression.constant, implicitConversion);
- codeStream.sendOperator(postIncrement.operator, binding.type.id);
- codeStream.generateImplicitConversion(postIncrement.assignmentImplicitConversion);
- fieldStore(codeStream, binding, syntheticWriteAccessor, false);
-}
-public static final Constant getConstantFor(
- FieldBinding binding,
- boolean implicitReceiver,
- Reference ref,
- int indexInQualification) {
- //propagation of the constant.
-
- //ref can be a FieldReference, a SingleNameReference or a QualifiedNameReference
- //indexInQualification may have a value greater than zero only for QualifiednameReference
- //if ref==null then indexInQualification==0 AND implicitReceiver == false. This case is a
- //degenerated case where a fake reference field (null)
- //is associted to a real FieldBinding in order
- //to allow its constant computation using the regular path (i.e. find the fieldDeclaration
- //and proceed to its type resolution). As implicitReceiver is false, no error reporting
- //against ref will be used ==> no nullPointerException risk ....
-
- //special treatment for langage-built-in field (their declaring class is null)
- if (binding.declaringClass == null) {
- //currently only one field "length" : the constant computation is never done
- return NotAConstant;
- }
- if (!binding.isFinal()) {
- return binding.constant = NotAConstant;
- }
- if (binding.constant != null) {
- if (indexInQualification == 0) {
- return binding.constant;
- }
- //see previous comment for the (sould-always-be) valid cast
- QualifiedNameReference qnr = (QualifiedNameReference) ref;
- if (indexInQualification == (qnr.indexOfFirstFieldBinding - 1)) {
- return binding.constant;
- }
- return NotAConstant;
- }
- //The field has not been yet type checked.
- //It also means that the field is not coming from a class that
- //has already been compiled. It can only be from a class within
- //compilation units to process. Thus the field is NOT from a BinaryTypeBinbing
-
- SourceTypeBinding tb = (SourceTypeBinding) binding.declaringClass;
- TypeDeclaration typeDecl = tb.scope.referenceContext;
-
- //fetch the field declaration
- FieldDeclaration fieldDecl = null;
- int index = 0;
- FieldDeclaration[] fields = typeDecl.fields;
- while (fieldDecl == null) {
- if ((fields[index].isField())
- && (CharOperation.equals(fields[index].name, binding.name)))
- fieldDecl = fields[index];
- else
- index++;
- }
- //what scope to use (depend on the staticness of the field binding)
- MethodScope fieldScope =
- binding.isStatic()
- ? typeDecl.staticInitializerScope
- : typeDecl.initializerScope;
- if (implicitReceiver) { //Determine if the ref is legal in the current class of the field
- //i.e. not a forward reference .... (they are allowed when the receiver is explicit ! ... Please don't ask me why !...yet another java mystery...)
- if (fieldScope.fieldDeclarationIndex == MethodScope.NotInFieldDecl) {
- // no field is currently being analysed in typeDecl
- fieldDecl.resolve(fieldScope); //side effect on binding :-) ...
- return binding.constant;
- }
- //We are re-entering the same class fields analysing
- if (((ref == null) || ((ref.bits & DepthMASK) == 0)) // not implicit ref to enclosing field
- && (binding.id > fieldScope.fieldDeclarationIndex)) {
- //forward reference. The declaration remains unresolved.
- tb.scope.problemReporter().forwardReference(ref, indexInQualification, tb);
- return NotAConstant;
- }
- fieldDecl.resolve(fieldScope); //side effect on binding :-) ...
- return binding.constant;
- }
- //the field reference is explicity. It has to be a "simple" like field reference to get the
- //constant propagation. For example in Packahe.Type.field1.field2 , field1 may have its
- //constant having a propagation where field2 is always not propagating its
- if (indexInQualification == 0) {
- fieldDecl.resolve(fieldScope); //side effect on binding :-) ...
- return binding.constant;
- }
- // Side-effect on the field binding may not be propagated out for the qualified reference
- // unless it occurs in first place of the name sequence
- fieldDecl.resolve(fieldScope); //side effect on binding :-) ...
- //see previous comment for the cast that should always be valid
- QualifiedNameReference qnr = (QualifiedNameReference) ref;
- if (indexInQualification == (qnr.indexOfFirstFieldBinding - 1)) {
- return binding.constant;
- } else {
- return NotAConstant;
- }
-}
-
-public boolean isSuperAccess() {
-
- return receiver.isSuper();
-}
-public boolean isTypeAccess() {
- return receiver != null && receiver.isTypeReference();
-}
-/*
- * No need to emulate access to protected fields since not implicitly accessed
- */
-public void manageSyntheticReadAccessIfNecessary(BlockScope currentScope){
- if (binding.isPrivate()
- && (currentScope.enclosingSourceType() != binding.declaringClass)
- && (binding.constant == NotAConstant)) {
- syntheticReadAccessor = binding.getSyntheticReadAccess();
- }
-}
-/*
- * No need to emulate access to protected fields since not implicitly accessed
- */
-public void manageSyntheticWriteAccessIfNecessary(BlockScope currentScope){
- if (binding.isPrivate() && (currentScope.enclosingSourceType() != binding.declaringClass)) {
- syntheticWriteAccessor = binding.getSyntheticWriteAccess();
- }
-}
-public TypeBinding resolveType(BlockScope scope) {
- // Answer the signature type of the field.
- // constants are propaged when the field is final
- // and initialized with a (compile time) constant
-
- // regular receiver reference
- this.receiverType = receiver.resolveType(scope);
- if (this.receiverType == null){
- constant = NotAConstant;
- return null;
- }
- // the case receiverType.isArrayType and token = 'length' is handled by the scope API
- binding = scope.getField(this.receiverType, token, this);
- if (!binding.isValidBinding()) {
- constant = NotAConstant;
- scope.problemReporter().invalidField(this, this.receiverType);
- return null;
- }
-
- if (isFieldUseDeprecated(binding, scope))
- scope.problemReporter().deprecatedField(binding, this);
-
- // check for this.x in static is done in the resolution of the receiver
- constant = FieldReference.getConstantFor(binding, receiver == ThisReference.ThisImplicit, this, 0);
- if (!receiver.isThis())
- constant = NotAConstant;
-
- // if the binding declaring class is not visible, need special action
- // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
- if (binding.declaringClass != this.receiverType
- && binding.declaringClass != null // array.length
- && binding.constant == NotAConstant
- && !binding.declaringClass.canBeSeenBy(scope))
- binding = new FieldBinding(binding, (ReferenceBinding) this.receiverType);
- return binding.type;
-}
-public void setDepth(int d) {
-}
-public void setFieldIndex(int index){}
-public String toStringExpression(){
- /* slow code */
-
- return receiver.toString()
- + "."/*nonNLS*/
- + new String(token);}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- if (visitor.visit(this, scope)) {
- receiver.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.impl.*;
+import org.eclipse.jdt.internal.compiler.codegen.*;
+import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+import org.eclipse.jdt.internal.compiler.util.*;
+
+public class FieldReference extends Reference implements InvocationSite {
+ public Expression receiver;
+ public char[] token;
+ public FieldBinding binding;
+
+ public long nameSourcePosition ; //(start<<32)+end
+
+
+ MethodBinding syntheticReadAccessor, syntheticWriteAccessor;
+ public TypeBinding receiverType;
+
+public FieldReference(char[] source , long pos) {
+ token = source ;
+ nameSourcePosition = pos;
+ //by default the position are the one of the field (not true for super access)
+ sourceStart = (int) (pos>>>32) ;
+ sourceEnd = (int) (pos & 0x00000000FFFFFFFFL);
+ bits |= BindingIds.FIELD;
+
+}
+public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment, boolean isCompound) {
+
+ // compound assignment extra work
+ if (isCompound) { // check the variable part is initialized if blank final
+ if (binding.isFinal() && receiver.isThis() && currentScope.allowBlankFinalFieldAssignment(binding) && (!flowInfo.isDefinitelyAssigned(binding))) {
+ currentScope.problemReporter().uninitializedBlankFinalField(binding, this);
+ // we could improve error msg here telling "cannot use compound assignment on final blank field"
+ }
+ manageSyntheticReadAccessIfNecessary(currentScope);
+ }
+ if (assignment.expression != null) {
+ flowInfo = assignment.expression.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
+ }
+ flowInfo = receiver.analyseCode(currentScope, flowContext, flowInfo, !binding.isStatic()).unconditionalInits();
+ manageSyntheticWriteAccessIfNecessary(currentScope);
+
+ // check if assigning a final field
+ if (binding.isFinal()) {
+ // in a context where it can be assigned?
+ if (receiver.isThis() && currentScope.allowBlankFinalFieldAssignment(binding)) {
+ if (flowInfo.isPotentiallyAssigned(binding)) {
+ currentScope.problemReporter().duplicateInitializationOfBlankFinalField(binding, this);
+ }
+ flowInfo.markAsDefinitelyAssigned(binding);
+ flowContext.recordSettingFinal(binding, this);
+ } else {
+ // assigning a final field outside an initializer or constructor
+ currentScope.problemReporter().cannotAssignToFinalField(binding, this);
+ }
+ }
+ return flowInfo;
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ return analyseCode(currentScope, flowContext, flowInfo, true);
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired) {
+ receiver.analyseCode(currentScope, flowContext, flowInfo, !binding.isStatic());
+ if (valueRequired) {
+ manageSyntheticReadAccessIfNecessary(currentScope);
+ }
+ return flowInfo;
+}
+public FieldBinding fieldBinding() {
+ //FLOW ANALYSIS
+
+ return binding ; }
+public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) {
+
+ receiver.generateCode(currentScope, codeStream, !binding.isStatic());
+ assignment.expression.generateCode(currentScope, codeStream, true);
+ fieldStore(codeStream, binding, syntheticWriteAccessor, valueRequired);
+ if (valueRequired){
+ codeStream.generateImplicitConversion(assignment.implicitConversion);
+ }
+}
+/**
+ * Field reference code generation
+ *
+ * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
+ * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+ int pc = codeStream.position;
+ if (constant != NotAConstant) {
+ if (valueRequired) {
+ codeStream.generateConstant(constant, implicitConversion);
+ }
+ } else {
+ boolean isStatic = binding.isStatic();
+ receiver.generateCode(currentScope, codeStream, valueRequired && (!isStatic) && (binding.constant == NotAConstant));
+ if (valueRequired) {
+ if (binding.constant == NotAConstant) {
+ if (binding.declaringClass == null) { // array length
+ codeStream.arraylength();
+ } else {
+ if (syntheticReadAccessor == null) {
+ if (isStatic) {
+ codeStream.getstatic(binding);
+ } else {
+ codeStream.getfield(binding);
+ }
+ } else {
+ codeStream.invokestatic(syntheticReadAccessor);
+ }
+ }
+ codeStream.generateImplicitConversion(implicitConversion);
+ } else {
+ codeStream.generateConstant(binding.constant, implicitConversion);
+ }
+ }
+ }
+ codeStream.recordPositionsFrom(pc, this);
+}
+public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) {
+ boolean isStatic;
+ receiver.generateCode(currentScope, codeStream, !(isStatic = binding.isStatic()));
+ if (isStatic) {
+ if (syntheticReadAccessor == null) {
+ codeStream.getstatic(binding);
+ } else {
+ codeStream.invokestatic(syntheticReadAccessor);
+ }
+ } else {
+ codeStream.dup();
+ if (syntheticReadAccessor == null) {
+ codeStream.getfield(binding);
+ } else {
+ codeStream.invokestatic(syntheticReadAccessor);
+ }
+ }
+ int operationTypeID;
+ if ((operationTypeID = implicitConversion >> 4) == T_String) {
+ codeStream.generateStringAppend(currentScope, null, expression);
+ } else {
+ // promote the array reference to the suitable operation type
+ codeStream.generateImplicitConversion(implicitConversion);
+ // generate the increment value (will by itself be promoted to the operation value)
+ if (expression == IntLiteral.One){ // prefix operation
+ codeStream.generateConstant(expression.constant, implicitConversion);
+ } else {
+ expression.generateCode(currentScope, codeStream, true);
+ }
+ // perform the operation
+ codeStream.sendOperator(operator, operationTypeID);
+ // cast the value back to the array reference type
+ codeStream.generateImplicitConversion(assignmentImplicitConversion);
+ }
+ fieldStore(codeStream, binding, syntheticWriteAccessor, valueRequired);
+}
+public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired) {
+ boolean isStatic;
+ receiver.generateCode(currentScope, codeStream, !(isStatic = binding.isStatic()));
+ if (isStatic) {
+ if (syntheticReadAccessor == null) {
+ codeStream.getstatic(binding);
+ } else {
+ codeStream.invokestatic(syntheticReadAccessor);
+ }
+ } else {
+ codeStream.dup();
+ if (syntheticReadAccessor == null) {
+ codeStream.getfield(binding);
+ } else {
+ codeStream.invokestatic(syntheticReadAccessor);
+ }
+ }
+ if (valueRequired) {
+ if (isStatic) {
+ if ((binding.type == LongBinding) || (binding.type == DoubleBinding)) {
+ codeStream.dup2();
+ } else {
+ codeStream.dup();
+ }
+ } else { // Stack: [owner][old field value] ---> [old field value][owner][old field value]
+ if ((binding.type == LongBinding) || (binding.type == DoubleBinding)) {
+ codeStream.dup2_x1();
+ } else {
+ codeStream.dup_x1();
+ }
+ }
+ }
+ codeStream.generateConstant(postIncrement.expression.constant, implicitConversion);
+ codeStream.sendOperator(postIncrement.operator, binding.type.id);
+ codeStream.generateImplicitConversion(postIncrement.assignmentImplicitConversion);
+ fieldStore(codeStream, binding, syntheticWriteAccessor, false);
+}
+public static final Constant getConstantFor(
+ FieldBinding binding,
+ boolean implicitReceiver,
+ Reference ref,
+ int indexInQualification) {
+ //propagation of the constant.
+
+ //ref can be a FieldReference, a SingleNameReference or a QualifiedNameReference
+ //indexInQualification may have a value greater than zero only for QualifiednameReference
+ //if ref==null then indexInQualification==0 AND implicitReceiver == false. This case is a
+ //degenerated case where a fake reference field (null)
+ //is associted to a real FieldBinding in order
+ //to allow its constant computation using the regular path (i.e. find the fieldDeclaration
+ //and proceed to its type resolution). As implicitReceiver is false, no error reporting
+ //against ref will be used ==> no nullPointerException risk ....
+
+ //special treatment for langage-built-in field (their declaring class is null)
+ if (binding.declaringClass == null) {
+ //currently only one field "length" : the constant computation is never done
+ return NotAConstant;
+ }
+ if (!binding.isFinal()) {
+ return binding.constant = NotAConstant;
+ }
+ if (binding.constant != null) {
+ if (indexInQualification == 0) {
+ return binding.constant;
+ }
+ //see previous comment for the (sould-always-be) valid cast
+ QualifiedNameReference qnr = (QualifiedNameReference) ref;
+ if (indexInQualification == (qnr.indexOfFirstFieldBinding - 1)) {
+ return binding.constant;
+ }
+ return NotAConstant;
+ }
+ //The field has not been yet type checked.
+ //It also means that the field is not coming from a class that
+ //has already been compiled. It can only be from a class within
+ //compilation units to process. Thus the field is NOT from a BinaryTypeBinbing
+
+ SourceTypeBinding tb = (SourceTypeBinding) binding.declaringClass;
+ TypeDeclaration typeDecl = tb.scope.referenceContext;
+
+ //fetch the field declaration
+ FieldDeclaration fieldDecl = null;
+ int index = 0;
+ FieldDeclaration[] fields = typeDecl.fields;
+ while (fieldDecl == null) {
+ if ((fields[index].isField())
+ && (CharOperation.equals(fields[index].name, binding.name)))
+ fieldDecl = fields[index];
+ else
+ index++;
+ }
+ //what scope to use (depend on the staticness of the field binding)
+ MethodScope fieldScope =
+ binding.isStatic()
+ ? typeDecl.staticInitializerScope
+ : typeDecl.initializerScope;
+ if (implicitReceiver) { //Determine if the ref is legal in the current class of the field
+ //i.e. not a forward reference .... (they are allowed when the receiver is explicit ! ... Please don't ask me why !...yet another java mystery...)
+ if (fieldScope.fieldDeclarationIndex == MethodScope.NotInFieldDecl) {
+ // no field is currently being analysed in typeDecl
+ fieldDecl.resolve(fieldScope); //side effect on binding :-) ...
+ return binding.constant;
+ }
+ //We are re-entering the same class fields analysing
+ if (((ref == null) || ((ref.bits & DepthMASK) == 0)) // not implicit ref to enclosing field
+ && (binding.id > fieldScope.fieldDeclarationIndex)) {
+ //forward reference. The declaration remains unresolved.
+ tb.scope.problemReporter().forwardReference(ref, indexInQualification, tb);
+ return NotAConstant;
+ }
+ fieldDecl.resolve(fieldScope); //side effect on binding :-) ...
+ return binding.constant;
+ }
+ //the field reference is explicity. It has to be a "simple" like field reference to get the
+ //constant propagation. For example in Packahe.Type.field1.field2 , field1 may have its
+ //constant having a propagation where field2 is always not propagating its
+ if (indexInQualification == 0) {
+ fieldDecl.resolve(fieldScope); //side effect on binding :-) ...
+ return binding.constant;
+ }
+ // Side-effect on the field binding may not be propagated out for the qualified reference
+ // unless it occurs in first place of the name sequence
+ fieldDecl.resolve(fieldScope); //side effect on binding :-) ...
+ //see previous comment for the cast that should always be valid
+ QualifiedNameReference qnr = (QualifiedNameReference) ref;
+ if (indexInQualification == (qnr.indexOfFirstFieldBinding - 1)) {
+ return binding.constant;
+ } else {
+ return NotAConstant;
+ }
+}
+
+public boolean isSuperAccess() {
+
+ return receiver.isSuper();
+}
+public boolean isTypeAccess() {
+ return receiver != null && receiver.isTypeReference();
+}
+/*
+ * No need to emulate access to protected fields since not implicitly accessed
+ */
+public void manageSyntheticReadAccessIfNecessary(BlockScope currentScope){
+ if (binding.isPrivate()
+ && (currentScope.enclosingSourceType() != binding.declaringClass)
+ && (binding.constant == NotAConstant)) {
+ syntheticReadAccessor = binding.getSyntheticReadAccess();
+ }
+}
+/*
+ * No need to emulate access to protected fields since not implicitly accessed
+ */
+public void manageSyntheticWriteAccessIfNecessary(BlockScope currentScope){
+ if (binding.isPrivate() && (currentScope.enclosingSourceType() != binding.declaringClass)) {
+ syntheticWriteAccessor = binding.getSyntheticWriteAccess();
+ }
+}
+public TypeBinding resolveType(BlockScope scope) {
+ // Answer the signature type of the field.
+ // constants are propaged when the field is final
+ // and initialized with a (compile time) constant
+
+ // regular receiver reference
+ this.receiverType = receiver.resolveType(scope);
+ if (this.receiverType == null){
+ constant = NotAConstant;
+ return null;
+ }
+ // the case receiverType.isArrayType and token = 'length' is handled by the scope API
+ binding = scope.getField(this.receiverType, token, this);
+ if (!binding.isValidBinding()) {
+ constant = NotAConstant;
+ scope.problemReporter().invalidField(this, this.receiverType);
+ return null;
+ }
+
+ if (isFieldUseDeprecated(binding, scope))
+ scope.problemReporter().deprecatedField(binding, this);
+
+ // check for this.x in static is done in the resolution of the receiver
+ constant = FieldReference.getConstantFor(binding, receiver == ThisReference.ThisImplicit, this, 0);
+ if (!receiver.isThis())
+ constant = NotAConstant;
+
+ // if the binding declaring class is not visible, need special action
+ // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
+ if (binding.declaringClass != this.receiverType
+ && binding.declaringClass != null // array.length
+ && binding.constant == NotAConstant
+ && !binding.declaringClass.canBeSeenBy(scope))
+ binding = new FieldBinding(binding, (ReferenceBinding) this.receiverType);
+ return binding.type;
+}
+public void setDepth(int d) {
+}
+public void setFieldIndex(int index){}
+public String toStringExpression(){
+ /* slow code */
+
+ return receiver.toString()
+ + "."/*nonNLS*/
+ + new String(token);}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ receiver.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java
index 37e6887305..3e1ad0b30a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java
@@ -1,260 +1,259 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-
-public class ForStatement extends Statement {
- public Statement[] initializations ;
- public Expression condition ;
- public Statement[] increments ;
- public Statement action ;
-
- //when there is no local declaration, there is no need of a new scope
- //scope is positionned either to a new scope, or to the "upper"scope (see resolveType)
- public boolean neededScope;
- public BlockScope scope;
-
- private Label breakLabel, continueLabel;
-
- // for local variables table attributes
- int preCondInitStateIndex = -1;
- int condIfTrueInitStateIndex = -1;
- int mergedInitStateIndex = -1;
-public ForStatement(Statement[] initializations, Expression condition, Statement[] increments, Statement action, boolean neededScope, int s, int e) {
- this.sourceStart = s;
- this.sourceEnd = e;
- this.initializations = initializations;
- this.condition = condition;
- this.increments = increments;
- this.action = action;
- this.neededScope = neededScope;
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- breakLabel = new Label();
- continueLabel = new Label();
-
- // process the initializations
- if (initializations != null) {
- int count = initializations.length, i = 0;
- while (i < count) {
- flowInfo = initializations[i++].analyseCode(scope, flowContext, flowInfo);
- }
- }
- preCondInitStateIndex = currentScope.methodScope().recordInitializationStates(flowInfo);
-
- // process the condition
- LoopingFlowContext condLoopContext = null;
- if (condition != null) {
- if ((condition.constant == NotAConstant) || (condition.constant.booleanValue() != true)) {
- flowInfo = condition.analyseCode(scope, (condLoopContext = new LoopingFlowContext(flowContext, this, null, null, scope)), flowInfo);
- }
- }
-
- // process the action
- LoopingFlowContext loopingContext;
- FlowInfo actionInfo;
- if ((action == null) || action.isEmptyBlock()) {
- if (condLoopContext != null) condLoopContext.complainOnFinalAssignmentsInLoop(scope, flowInfo);
- if ((condition == null) || ((condition.constant != NotAConstant) && (condition.constant.booleanValue() == true))) {
- return FlowInfo.DeadEnd;
- } else {
- actionInfo = flowInfo.initsWhenTrue().copy();
- loopingContext = new LoopingFlowContext(flowContext, this, breakLabel, continueLabel, scope);
- }
- } else {
- loopingContext = new LoopingFlowContext(flowContext, this, breakLabel, continueLabel, scope);
- FlowInfo initsWhenTrue = flowInfo.initsWhenTrue();
- condIfTrueInitStateIndex = currentScope.methodScope().recordInitializationStates(initsWhenTrue);
- actionInfo = action.analyseCode(
- scope,
- loopingContext,
- ((condition != null) && (condition.constant != NotAConstant) && (condition.constant.booleanValue() == false)) ? // unreachable when condition inlined to false
- FlowInfo.DeadEnd :
- initsWhenTrue.copy());
-
- // code generation can be optimized when no need to continue in the loop
- if (((actionInfo == FlowInfo.DeadEnd) || actionInfo.isFakeReachable())
- && ((loopingContext.initsOnContinue == FlowInfo.DeadEnd) || loopingContext.initsOnContinue.isFakeReachable())){
- continueLabel = null;
- } else {
- if (condLoopContext != null) condLoopContext.complainOnFinalAssignmentsInLoop(scope, flowInfo);
- loopingContext.complainOnFinalAssignmentsInLoop(scope, actionInfo);
- actionInfo = actionInfo.mergedWith(loopingContext.initsOnContinue.unconditionalInits()); // for increments
- }
- }
- if ((continueLabel != null) && (increments != null)) {
- LoopingFlowContext loopContext = new LoopingFlowContext(flowContext, this, null, null, scope);
- int i = 0, count = increments.length;
- while (i < count)
- actionInfo = increments[i++].analyseCode(scope, loopContext, actionInfo);
- loopContext.complainOnFinalAssignmentsInLoop(scope, flowInfo);
- }
-
- // infinite loop
- FlowInfo mergedInfo;
- if ((condition == null) || ((condition.constant != NotAConstant) && (condition.constant.booleanValue() == true))) {
- mergedInitStateIndex = currentScope.methodScope().recordInitializationStates(mergedInfo = loopingContext.initsOnBreak);
- return mergedInfo;
- }
-
- //end of loop: either condition false or break
- mergedInfo = flowInfo.initsWhenFalse().unconditionalInits().mergedWith(loopingContext.initsOnBreak.unconditionalInits());
- mergedInitStateIndex = currentScope.methodScope().recordInitializationStates(mergedInfo);
- return mergedInfo;
-}
-/**
- * For statement code generation
- *
- * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
- * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
- */
-public void generateCode(BlockScope currentScope, CodeStream codeStream) {
- if ((bits & IsReachableMASK) == 0) {
- return;
- }
- int pc = codeStream.position;
-
- // generate the initializations
- if (initializations != null){
- for (int i = 0, max = initializations.length; i < max; i++){
- initializations[i].generateCode(scope, codeStream);
- }
- }
-
- // label management
- Label actionLabel = new Label(codeStream);
- Label conditionLabel = new Label(codeStream);
- breakLabel.codeStream = codeStream;
- if (continueLabel != null) {
- continueLabel.codeStream = codeStream;
- }
- // jump over the actionBlock
- if ((condition != null)
- && (condition.constant == NotAConstant)
- && !((action == null || action.isEmptyBlock()) && (increments == null))) {
- int jumpPC = codeStream.position;
- codeStream.goto_(conditionLabel);
- codeStream.recordPositionsFrom(jumpPC, condition);
- }
- // generate the loop action
- actionLabel.place();
- if (action != null) {
- // Required to fix 1PR0XVS: LFRE:WINNT - Compiler: variable table for method appears incorrect
- if (condIfTrueInitStateIndex != -1){ // insert all locals initialized inside the condition into the action generated prior to the condition
- codeStream.addDefinitelyAssignedVariables(currentScope, condIfTrueInitStateIndex);
- }
- action.generateCode(scope, codeStream);
- }
- // continuation point
- if (continueLabel != null) {
- continueLabel.place();
- // generate the increments for next iteration
- if (increments != null) {
- for (int i = 0, max = increments.length; i < max; i++) {
- increments[i].generateCode(scope, codeStream);
- }
- }
- }
-
- // May loose some local variable initializations : affecting the local variable attributes
- if (preCondInitStateIndex != -1) {
- codeStream.removeNotDefinitelyAssignedVariables(currentScope, preCondInitStateIndex);
- }
-
- // generate the condition
- conditionLabel.place();
- if ((condition != null) && (condition.constant == NotAConstant)) {
- condition.generateOptimizedBoolean(scope, codeStream, actionLabel, null, true);
- } else {
- if (continueLabel != null) {
- codeStream.goto_(actionLabel);
- }
- }
- breakLabel.place();
-
- // May loose some local variable initializations : affecting the local variable attributes
- if (neededScope) {
- codeStream.exitUserScope(scope);
- }
- if (mergedInitStateIndex != -1) {
- codeStream.removeNotDefinitelyAssignedVariables(currentScope, mergedInitStateIndex);
- }
- codeStream.recordPositionsFrom(pc, this);
-}
-public void resolve(BlockScope upperScope) {
- // use the scope that will hold the init declarations
-
- scope = neededScope ? new BlockScope(upperScope) : upperScope;
- if (initializations != null)
- for (int i = 0, length = initializations.length; i < length; i++)
- initializations[i].resolve(scope);
- if (condition != null) {
- TypeBinding type = condition.resolveTypeExpecting(scope, BooleanBinding);
- condition.implicitWidening(type, type);
- }
- if (increments != null)
- for (int i = 0, length = increments.length; i < length; i++)
- increments[i].resolve(scope);
- if (action != null)
- action.resolve(scope);
-}
-public String toString(int tab ){
- /* slow code */
-
- String s = tabString(tab) + "for ("/*nonNLS*/;
- if (!neededScope)
- s = s + " //--NO upperscope scope needed\n"/*nonNLS*/ + tabString(tab) + " "/*nonNLS*/ ;
- //inits
- if (initializations != null)
- { for (int i = 0 ; i < initializations.length ; i++){
- //nice only with expressions
- s = s + initializations[i].toString(0);
- if (i != (initializations.length -1)) s = s + " , "/*nonNLS*/ ;}};
- s = s + "; "/*nonNLS*/ ;
- //cond
- if (condition != null)
- s = s + condition.toStringExpression() ;
- s = s + "; "/*nonNLS*/ ;
- //updates
- if (increments != null)
- { for (int i = 0 ; i < increments.length ; i++){
- //nice only with expressions
- s = s + increments[i].toString(0);
- if (i != (increments.length -1)) s = s + " , "/*nonNLS*/ ;}};
- s = s + ") "/*nonNLS*/ ;
- //block
- if (action == null)
- s = s + "{}"/*nonNLS*/ ;
- else
- s = s + "\n"/*nonNLS*/+ action.toString(tab+1) ;
- return s;}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
- if (visitor.visit(this, blockScope)) {
- if (initializations != null) {
- int initializationsLength = initializations.length;
- for (int i = 0; i < initializationsLength; i++)
- initializations[i].traverse(visitor, scope);
- }
-
- if (condition != null)
- condition.traverse(visitor, scope);
-
- if (increments != null) {
- int incrementsLength = increments.length;
- for (int i = 0; i < incrementsLength; i++)
- increments[i].traverse(visitor, scope);
- }
-
- if (action != null)
- action.traverse(visitor, scope);
- }
- visitor.endVisit(this, blockScope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.codegen.*;
+import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class ForStatement extends Statement {
+ public Statement[] initializations ;
+ public Expression condition ;
+ public Statement[] increments ;
+ public Statement action ;
+
+ //when there is no local declaration, there is no need of a new scope
+ //scope is positionned either to a new scope, or to the "upper"scope (see resolveType)
+ public boolean neededScope;
+ public BlockScope scope;
+
+ private Label breakLabel, continueLabel;
+
+ // for local variables table attributes
+ int preCondInitStateIndex = -1;
+ int condIfTrueInitStateIndex = -1;
+ int mergedInitStateIndex = -1;
+public ForStatement(Statement[] initializations, Expression condition, Statement[] increments, Statement action, boolean neededScope, int s, int e) {
+ this.sourceStart = s;
+ this.sourceEnd = e;
+ this.initializations = initializations;
+ this.condition = condition;
+ this.increments = increments;
+ this.action = action;
+ this.neededScope = neededScope;
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ breakLabel = new Label();
+ continueLabel = new Label();
+
+ // process the initializations
+ if (initializations != null) {
+ int count = initializations.length, i = 0;
+ while (i < count) {
+ flowInfo = initializations[i++].analyseCode(scope, flowContext, flowInfo);
+ }
+ }
+ preCondInitStateIndex = currentScope.methodScope().recordInitializationStates(flowInfo);
+
+ // process the condition
+ LoopingFlowContext condLoopContext = null;
+ if (condition != null) {
+ if ((condition.constant == NotAConstant) || (condition.constant.booleanValue() != true)) {
+ flowInfo = condition.analyseCode(scope, (condLoopContext = new LoopingFlowContext(flowContext, this, null, null, scope)), flowInfo);
+ }
+ }
+
+ // process the action
+ LoopingFlowContext loopingContext;
+ FlowInfo actionInfo;
+ if ((action == null) || action.isEmptyBlock()) {
+ if (condLoopContext != null) condLoopContext.complainOnFinalAssignmentsInLoop(scope, flowInfo);
+ if ((condition == null) || ((condition.constant != NotAConstant) && (condition.constant.booleanValue() == true))) {
+ return FlowInfo.DeadEnd;
+ } else {
+ actionInfo = flowInfo.initsWhenTrue().copy();
+ loopingContext = new LoopingFlowContext(flowContext, this, breakLabel, continueLabel, scope);
+ }
+ } else {
+ loopingContext = new LoopingFlowContext(flowContext, this, breakLabel, continueLabel, scope);
+ FlowInfo initsWhenTrue = flowInfo.initsWhenTrue();
+ condIfTrueInitStateIndex = currentScope.methodScope().recordInitializationStates(initsWhenTrue);
+ actionInfo = action.analyseCode(
+ scope,
+ loopingContext,
+ ((condition != null) && (condition.constant != NotAConstant) && (condition.constant.booleanValue() == false)) ? // unreachable when condition inlined to false
+ FlowInfo.DeadEnd :
+ initsWhenTrue.copy());
+
+ // code generation can be optimized when no need to continue in the loop
+ if (((actionInfo == FlowInfo.DeadEnd) || actionInfo.isFakeReachable())
+ && ((loopingContext.initsOnContinue == FlowInfo.DeadEnd) || loopingContext.initsOnContinue.isFakeReachable())){
+ continueLabel = null;
+ } else {
+ if (condLoopContext != null) condLoopContext.complainOnFinalAssignmentsInLoop(scope, flowInfo);
+ loopingContext.complainOnFinalAssignmentsInLoop(scope, actionInfo);
+ actionInfo = actionInfo.mergedWith(loopingContext.initsOnContinue.unconditionalInits()); // for increments
+ }
+ }
+ if ((continueLabel != null) && (increments != null)) {
+ LoopingFlowContext loopContext = new LoopingFlowContext(flowContext, this, null, null, scope);
+ int i = 0, count = increments.length;
+ while (i < count)
+ actionInfo = increments[i++].analyseCode(scope, loopContext, actionInfo);
+ loopContext.complainOnFinalAssignmentsInLoop(scope, flowInfo);
+ }
+
+ // infinite loop
+ FlowInfo mergedInfo;
+ if ((condition == null) || ((condition.constant != NotAConstant) && (condition.constant.booleanValue() == true))) {
+ mergedInitStateIndex = currentScope.methodScope().recordInitializationStates(mergedInfo = loopingContext.initsOnBreak);
+ return mergedInfo;
+ }
+
+ //end of loop: either condition false or break
+ mergedInfo = flowInfo.initsWhenFalse().unconditionalInits().mergedWith(loopingContext.initsOnBreak.unconditionalInits());
+ mergedInitStateIndex = currentScope.methodScope().recordInitializationStates(mergedInfo);
+ return mergedInfo;
+}
+/**
+ * For statement code generation
+ *
+ * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
+ * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
+ */
+public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+ if ((bits & IsReachableMASK) == 0) {
+ return;
+ }
+ int pc = codeStream.position;
+
+ // generate the initializations
+ if (initializations != null){
+ for (int i = 0, max = initializations.length; i < max; i++){
+ initializations[i].generateCode(scope, codeStream);
+ }
+ }
+
+ // label management
+ Label actionLabel = new Label(codeStream);
+ Label conditionLabel = new Label(codeStream);
+ breakLabel.codeStream = codeStream;
+ if (continueLabel != null) {
+ continueLabel.codeStream = codeStream;
+ }
+ // jump over the actionBlock
+ if ((condition != null)
+ && (condition.constant == NotAConstant)
+ && !((action == null || action.isEmptyBlock()) && (increments == null))) {
+ int jumpPC = codeStream.position;
+ codeStream.goto_(conditionLabel);
+ codeStream.recordPositionsFrom(jumpPC, condition);
+ }
+ // generate the loop action
+ actionLabel.place();
+ if (action != null) {
+ // Required to fix 1PR0XVS: LFRE:WINNT - Compiler: variable table for method appears incorrect
+ if (condIfTrueInitStateIndex != -1){ // insert all locals initialized inside the condition into the action generated prior to the condition
+ codeStream.addDefinitelyAssignedVariables(currentScope, condIfTrueInitStateIndex);
+ }
+ action.generateCode(scope, codeStream);
+ }
+ // continuation point
+ if (continueLabel != null) {
+ continueLabel.place();
+ // generate the increments for next iteration
+ if (increments != null) {
+ for (int i = 0, max = increments.length; i < max; i++) {
+ increments[i].generateCode(scope, codeStream);
+ }
+ }
+ }
+
+ // May loose some local variable initializations : affecting the local variable attributes
+ if (preCondInitStateIndex != -1) {
+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, preCondInitStateIndex);
+ }
+
+ // generate the condition
+ conditionLabel.place();
+ if ((condition != null) && (condition.constant == NotAConstant)) {
+ condition.generateOptimizedBoolean(scope, codeStream, actionLabel, null, true);
+ } else {
+ if (continueLabel != null) {
+ codeStream.goto_(actionLabel);
+ }
+ }
+ breakLabel.place();
+
+ // May loose some local variable initializations : affecting the local variable attributes
+ if (neededScope) {
+ codeStream.exitUserScope(scope);
+ }
+ if (mergedInitStateIndex != -1) {
+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, mergedInitStateIndex);
+ }
+ codeStream.recordPositionsFrom(pc, this);
+}
+public void resolve(BlockScope upperScope) {
+ // use the scope that will hold the init declarations
+
+ scope = neededScope ? new BlockScope(upperScope) : upperScope;
+ if (initializations != null)
+ for (int i = 0, length = initializations.length; i < length; i++)
+ initializations[i].resolve(scope);
+ if (condition != null) {
+ TypeBinding type = condition.resolveTypeExpecting(scope, BooleanBinding);
+ condition.implicitWidening(type, type);
+ }
+ if (increments != null)
+ for (int i = 0, length = increments.length; i < length; i++)
+ increments[i].resolve(scope);
+ if (action != null)
+ action.resolve(scope);
+}
+public String toString(int tab ){
+ /* slow code */
+
+ String s = tabString(tab) + "for ("/*nonNLS*/;
+ if (!neededScope)
+ s = s + " //--NO upperscope scope needed\n"/*nonNLS*/ + tabString(tab) + " "/*nonNLS*/ ;
+ //inits
+ if (initializations != null)
+ { for (int i = 0 ; i < initializations.length ; i++){
+ //nice only with expressions
+ s = s + initializations[i].toString(0);
+ if (i != (initializations.length -1)) s = s + " , "/*nonNLS*/ ;}};
+ s = s + "; "/*nonNLS*/ ;
+ //cond
+ if (condition != null)
+ s = s + condition.toStringExpression() ;
+ s = s + "; "/*nonNLS*/ ;
+ //updates
+ if (increments != null)
+ { for (int i = 0 ; i < increments.length ; i++){
+ //nice only with expressions
+ s = s + increments[i].toString(0);
+ if (i != (increments.length -1)) s = s + " , "/*nonNLS*/ ;}};
+ s = s + ") "/*nonNLS*/ ;
+ //block
+ if (action == null)
+ s = s + "{}"/*nonNLS*/ ;
+ else
+ s = s + "\n"/*nonNLS*/+ action.toString(tab+1) ;
+ return s;}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
+ if (visitor.visit(this, blockScope)) {
+ if (initializations != null) {
+ int initializationsLength = initializations.length;
+ for (int i = 0; i < initializationsLength; i++)
+ initializations[i].traverse(visitor, scope);
+ }
+
+ if (condition != null)
+ condition.traverse(visitor, scope);
+
+ if (increments != null) {
+ int incrementsLength = increments.length;
+ for (int i = 0; i < incrementsLength; i++)
+ increments[i].traverse(visitor, scope);
+ }
+
+ if (action != null)
+ action.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, blockScope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImportReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImportReference.java
index af82fee206..116ea3599a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImportReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImportReference.java
@@ -1,52 +1,51 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-
-public class ImportReference extends AstNode {
- public char[][] tokens;
- public long[] sourcePositions; //each entry is using the code : (start<<32) + end
- public boolean onDemand = true; //most of the time
-
- public int declarationSourceStart;
- public int declarationSourceEnd;
-
-public ImportReference(char[][] sources , long[] poss , boolean d) {
- tokens = sources ;
- sourcePositions = poss ;
- onDemand = d;
- sourceEnd = (int)(sourcePositions[sourcePositions.length-1] & 0x00000000FFFFFFFF);
- sourceStart = (int)(sourcePositions[0]>>>32) ;
-}
-/**
- * @return char[][]
- */
-public char[][] getImportName() {
- return tokens;
-}
-public String toString(int tab ){
-
- return toString(tab,true);}
-public String toString(int tab, boolean withOnDemand) {
- /* when withOnDemand is false, only the name is printed */
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < tokens.length; i++) {
- buffer.append(tokens[i]);
- if (i < (tokens.length - 1)) {
- buffer.append("."/*nonNLS*/);
- }
- }
- if (withOnDemand && onDemand) {
- buffer.append(".*"/*nonNLS*/);
- }
- return buffer.toString();
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, CompilationUnitScope scope) {
- visitor.visit(this, scope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class ImportReference extends AstNode {
+ public char[][] tokens;
+ public long[] sourcePositions; //each entry is using the code : (start<<32) + end
+ public boolean onDemand = true; //most of the time
+
+ public int declarationSourceStart;
+ public int declarationSourceEnd;
+
+public ImportReference(char[][] sources , long[] poss , boolean d) {
+ tokens = sources ;
+ sourcePositions = poss ;
+ onDemand = d;
+ sourceEnd = (int)(sourcePositions[sourcePositions.length-1] & 0x00000000FFFFFFFF);
+ sourceStart = (int)(sourcePositions[0]>>>32) ;
+}
+/**
+ * @return char[][]
+ */
+public char[][] getImportName() {
+ return tokens;
+}
+public String toString(int tab ){
+
+ return toString(tab,true);}
+public String toString(int tab, boolean withOnDemand) {
+ /* when withOnDemand is false, only the name is printed */
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < tokens.length; i++) {
+ buffer.append(tokens[i]);
+ if (i < (tokens.length - 1)) {
+ buffer.append("."/*nonNLS*/);
+ }
+ }
+ if (withOnDemand && onDemand) {
+ buffer.append(".*"/*nonNLS*/);
+ }
+ return buffer.toString();
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, CompilationUnitScope scope) {
+ visitor.visit(this, scope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java
index b796c10281..61d0422824 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java
@@ -1,88 +1,87 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-import org.eclipse.jdt.internal.compiler.parser.*;
-
-public class Initializer extends FieldDeclaration {
- //public boolean isStatic = false ;
- public Block block;
- public int lastFieldID;
- public int bodyStart;
-public Initializer(Block block, int modifiers) {
- this.block = block;
- this.modifiers = modifiers;
-
- declarationSourceStart = sourceStart = block.sourceStart;
-}
-public FlowInfo analyseCode(MethodScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- return block.analyseCode(currentScope, flowContext, flowInfo);
-}
-/**
- * Code generation for a non-static initializer
- * i.e. normal block code gen
- *
- * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
- * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
- */
-public void generateCode(BlockScope currentScope, CodeStream codeStream) {
- if ((bits & IsReachableMASK) == 0) {
- return;
- }
- int pc = codeStream.position;
- block.generateCode(currentScope, codeStream);
- codeStream.recordPositionsFrom(pc, this);
-}
-public boolean isField() {
- return false;
-}
-public boolean isStatic() {
- return (modifiers & AccStatic) != 0;
-}
-public void parseStatements(Parser parser, TypeDeclaration type, CompilationUnitDeclaration unit) {
- //fill up the method body with statement
-
- parser.parse(this, type, unit);
-}
-public void resolve(MethodScope scope) {
- int previous = scope.fieldDeclarationIndex;
- try {
- scope.fieldDeclarationIndex = lastFieldID;
- if (isStatic()) {
- ReferenceBinding declaringType = scope.enclosingSourceType();
- if (declaringType.isNestedType() && !declaringType.isStatic())
- scope.problemReporter().innerTypesCannotDeclareStaticInitializers(declaringType, this);
- }
- block.resolve(scope);
- } finally {
- scope.fieldDeclarationIndex = previous;
- }
-}
-public String toString(int tab){
- /*slow code */
-
- if (modifiers != 0){
- StringBuffer buffer = new StringBuffer();
- buffer.append(tabString(tab));
- buffer.append(modifiersString(modifiers));
- buffer.append("{\n"/*nonNLS*/);
- buffer.append(block.toStringStatements(tab));
- buffer.append(tabString(tab));
- buffer.append("}"/*nonNLS*/);
- return buffer.toString();
- } else {
- return block.toString(tab);
- }
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, MethodScope scope) {
- visitor.visit(this, scope);
- block.traverse(visitor, scope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.codegen.*;
+import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+import org.eclipse.jdt.internal.compiler.parser.*;
+
+public class Initializer extends FieldDeclaration {
+ //public boolean isStatic = false ;
+ public Block block;
+ public int lastFieldID;
+ public int bodyStart;
+public Initializer(Block block, int modifiers) {
+ this.block = block;
+ this.modifiers = modifiers;
+
+ declarationSourceStart = sourceStart = block.sourceStart;
+}
+public FlowInfo analyseCode(MethodScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ return block.analyseCode(currentScope, flowContext, flowInfo);
+}
+/**
+ * Code generation for a non-static initializer
+ * i.e. normal block code gen
+ *
+ * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
+ * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
+ */
+public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+ if ((bits & IsReachableMASK) == 0) {
+ return;
+ }
+ int pc = codeStream.position;
+ block.generateCode(currentScope, codeStream);
+ codeStream.recordPositionsFrom(pc, this);
+}
+public boolean isField() {
+ return false;
+}
+public boolean isStatic() {
+ return (modifiers & AccStatic) != 0;
+}
+public void parseStatements(Parser parser, TypeDeclaration type, CompilationUnitDeclaration unit) {
+ //fill up the method body with statement
+
+ parser.parse(this, type, unit);
+}
+public void resolve(MethodScope scope) {
+ int previous = scope.fieldDeclarationIndex;
+ try {
+ scope.fieldDeclarationIndex = lastFieldID;
+ if (isStatic()) {
+ ReferenceBinding declaringType = scope.enclosingSourceType();
+ if (declaringType.isNestedType() && !declaringType.isStatic())
+ scope.problemReporter().innerTypesCannotDeclareStaticInitializers(declaringType, this);
+ }
+ block.resolve(scope);
+ } finally {
+ scope.fieldDeclarationIndex = previous;
+ }
+}
+public String toString(int tab){
+ /*slow code */
+
+ if (modifiers != 0){
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(tabString(tab));
+ buffer.append(modifiersString(modifiers));
+ buffer.append("{\n"/*nonNLS*/);
+ buffer.append(block.toStringStatements(tab));
+ buffer.append(tabString(tab));
+ buffer.append("}"/*nonNLS*/);
+ return buffer.toString();
+ } else {
+ return block.toString(tab);
+ }
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, MethodScope scope) {
+ visitor.visit(this, scope);
+ block.traverse(visitor, scope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InnerTypeDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InnerTypeDeclaration.java
index b93207d976..6c845f6403 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InnerTypeDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InnerTypeDeclaration.java
@@ -1,12 +1,8 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-import org.eclipse.jdt.internal.compiler.problem.*;
-
-public class InnerTypeDeclaration extends TypeDeclaration {
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+public class InnerTypeDeclaration extends TypeDeclaration {
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java
index fbf019b34f..2445e4507e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java
@@ -1,211 +1,208 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-import org.eclipse.jdt.internal.compiler.problem.*;
-import org.eclipse.jdt.internal.compiler.util.*;
-
-public class InstanceOfExpression extends OperatorExpression {
- public Expression expression;
- public TypeReference type;
-public InstanceOfExpression(Expression expression, TypeReference type, int operator) {
- this.expression = expression;
- this.type = type;
- this.bits |= operator << OperatorSHIFT;
- this.sourceStart = expression.sourceStart;
- this.sourceEnd = type.sourceEnd;
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- return expression.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
-}
-public final boolean areTypesCastCompatible(BlockScope scope, TypeBinding castTb, TypeBinding expressionTb) {
- // see specifications p.68
- //A more cpmplete version of this method is provided on
- //CastExpression (it deals with constant and need runtime checkcast)
-
- //by grammatical construction, the first test is ALWAYS false
- //if (castTb.isBaseType())
- //{ if (expressionTb.isBaseType())
- // { if (expression.isConstantValueOfTypeAssignableToType(expressionTb,castTb))
- // { return true;}
- // else
- // { if (expressionTb==castTb)
- // { return true;}
- // else
- // { if (scope.areTypesCompatible(expressionTb,castTb))
- // { return true; }
- //
- // if (BaseTypeBinding.isNarrowing(castTb.id,expressionTb.id))
- // { return true;}
- // return false;}}}
- // else
- // { return false; }}
- //else
- { //-------------checkcast to something which is NOT a basetype----------------------------------
-
- if (NullBinding == expressionTb)
- //null is compatible with every thing ....
- {
- return true;
- }
- if (expressionTb.isArrayType()) {
- if (castTb.isArrayType()) { //------- (castTb.isArray) expressionTb.isArray -----------
- TypeBinding expressionEltTb = ((ArrayBinding) expressionTb).elementsType(scope);
- if (expressionEltTb.isBaseType())
- // <---stop the recursion-------
- return ((ArrayBinding) castTb).elementsType(scope) == expressionEltTb;
- //recursivly on the elts...
- return areTypesCastCompatible(scope, ((ArrayBinding) castTb).elementsType(scope), expressionEltTb);
- }
- if (castTb.isClass()) { //------(castTb.isClass) expressionTb.isArray ---------------
- if (scope.isJavaLangObject(castTb))
- return true;
- return false;
- }
- if (castTb.isInterface()) { //------- (castTb.isInterface) expressionTb.isArray -----------
- if (scope.isJavaLangCloneable(castTb) || scope.isJavaIoSerializable(castTb)) {
- return true;
- }
- return false;
- }
-
- //=========hoops=============
- return false;
- }
- if (expressionTb.isBaseType()) {
- return false;
- }
- if (expressionTb.isClass()) {
- if (castTb.isArrayType()) { // ---- (castTb.isArray) expressionTb.isClass -------
- if (scope.isJavaLangObject(expressionTb)) {
- return true;
- } else {
- return false;
- }
- }
- if (castTb.isClass()) { // ----- (castTb.isClass) expressionTb.isClass ------
- if (scope.areTypesCompatible(expressionTb, castTb))
- return true;
- else {
- if (scope.areTypesCompatible(castTb, expressionTb)) {
- return true;
- }
- return false;
- }
- }
- if (castTb.isInterface()) { // ----- (castTb.isInterface) expressionTb.isClass -------
- if (((ReferenceBinding) expressionTb).isFinal()) { //no subclass for expressionTb, thus compile-time check is valid
- if (scope.areTypesCompatible(expressionTb, castTb))
- return true;
- return false;
- } else {
- return true;
- }
- }
-
- //=========hoops==============
- return false;
- }
- if (expressionTb.isInterface()) {
- if (castTb.isArrayType()) { // ----- (castTb.isArray) expressionTb.isInterface ------
- if (scope.isJavaLangCloneable(expressionTb) || scope.isJavaIoSerializable(expressionTb))
- //potential runtime error
- {
- return true;
- }
- return false;
- }
- if (castTb.isClass()) { // ----- (castTb.isClass) expressionTb.isInterface --------
- if (scope.isJavaLangObject(castTb))
- return true;
- if (((ReferenceBinding) castTb).isFinal()) { //no subclass for castTb, thus compile-time check is valid
- if (scope.areTypesCompatible(castTb, expressionTb)) {
- return true;
- }
- return false;
- }
- return true;
- }
- if (castTb.isInterface()) { // ----- (castTb.isInterface) expressionTb.isInterface -------
- if (castTb != expressionTb && (scope.compareTypes(castTb, expressionTb) == NotRelated)) {
- MethodBinding[] castTbMethods = ((ReferenceBinding) castTb).methods();
- int castTbMethodsLength = castTbMethods.length;
- MethodBinding[] expressionTbMethods = ((ReferenceBinding) expressionTb).methods();
- int expressionTbMethodsLength = expressionTbMethods.length;
- for (int i = 0; i < castTbMethodsLength; i++) {
- for (int j = 0; j < expressionTbMethodsLength; j++) {
- if (castTbMethods[i].selector == expressionTbMethods[j].selector) {
- if (castTbMethods[i].returnType != expressionTbMethods[j].returnType) {
- if (castTbMethods[i].areParametersEqual(expressionTbMethods[j])) {
- return false;
- }
- }
- }
- }
- }
- }
- return true;
- }
-
- //============hoops===========
- return false;
- } // true;}
-
- //=======hoops==========
- return false;
- }
-}
-/**
- * Code generation for instanceOfExpression
- *
- * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
- * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
-*/
-public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
- int pc = codeStream.position;
- expression.generateCode(currentScope, codeStream, true);
- codeStream.instance_of(type.binding);
- if (!valueRequired)
- codeStream.pop();
- codeStream.recordPositionsFrom(pc, this);
-}
-public TypeBinding resolveType(BlockScope scope) {
- constant = NotAConstant;
- TypeBinding expressionTb = expression.resolveType(scope);
- TypeBinding checkTb = type.resolveType(scope);
- if (expressionTb == null || checkTb == null)
- return null;
-
- //===== by grammatical construction, the next test is always false =====
- //if (checkTb.isBaseType()) {
- // scope.problemReporter().invalidTypeError(type,checkTb);
- // return null;
- //}
-
- if (!areTypesCastCompatible(scope, checkTb, expressionTb)) {
- scope.problemReporter().notCompatibleTypesError(this, expressionTb, checkTb);
- return null;
- }
- return BooleanBinding;
-}
-public String toStringExpressionNoParenthesis(){
- /* slow code*/
-
- return expression.toStringExpression() + " instanceof "/*nonNLS*/ +
- type.toString(0) ; }
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- if (visitor.visit(this, scope)) {
- expression.traverse(visitor, scope);
- type.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.codegen.*;
+import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class InstanceOfExpression extends OperatorExpression {
+ public Expression expression;
+ public TypeReference type;
+public InstanceOfExpression(Expression expression, TypeReference type, int operator) {
+ this.expression = expression;
+ this.type = type;
+ this.bits |= operator << OperatorSHIFT;
+ this.sourceStart = expression.sourceStart;
+ this.sourceEnd = type.sourceEnd;
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ return expression.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
+}
+public final boolean areTypesCastCompatible(BlockScope scope, TypeBinding castTb, TypeBinding expressionTb) {
+ // see specifications p.68
+ //A more cpmplete version of this method is provided on
+ //CastExpression (it deals with constant and need runtime checkcast)
+
+ //by grammatical construction, the first test is ALWAYS false
+ //if (castTb.isBaseType())
+ //{ if (expressionTb.isBaseType())
+ // { if (expression.isConstantValueOfTypeAssignableToType(expressionTb,castTb))
+ // { return true;}
+ // else
+ // { if (expressionTb==castTb)
+ // { return true;}
+ // else
+ // { if (scope.areTypesCompatible(expressionTb,castTb))
+ // { return true; }
+ //
+ // if (BaseTypeBinding.isNarrowing(castTb.id,expressionTb.id))
+ // { return true;}
+ // return false;}}}
+ // else
+ // { return false; }}
+ //else
+ { //-------------checkcast to something which is NOT a basetype----------------------------------
+
+ if (NullBinding == expressionTb)
+ //null is compatible with every thing ....
+ {
+ return true;
+ }
+ if (expressionTb.isArrayType()) {
+ if (castTb.isArrayType()) { //------- (castTb.isArray) expressionTb.isArray -----------
+ TypeBinding expressionEltTb = ((ArrayBinding) expressionTb).elementsType(scope);
+ if (expressionEltTb.isBaseType())
+ // <---stop the recursion-------
+ return ((ArrayBinding) castTb).elementsType(scope) == expressionEltTb;
+ //recursivly on the elts...
+ return areTypesCastCompatible(scope, ((ArrayBinding) castTb).elementsType(scope), expressionEltTb);
+ }
+ if (castTb.isClass()) { //------(castTb.isClass) expressionTb.isArray ---------------
+ if (scope.isJavaLangObject(castTb))
+ return true;
+ return false;
+ }
+ if (castTb.isInterface()) { //------- (castTb.isInterface) expressionTb.isArray -----------
+ if (scope.isJavaLangCloneable(castTb) || scope.isJavaIoSerializable(castTb)) {
+ return true;
+ }
+ return false;
+ }
+
+ //=========hoops=============
+ return false;
+ }
+ if (expressionTb.isBaseType()) {
+ return false;
+ }
+ if (expressionTb.isClass()) {
+ if (castTb.isArrayType()) { // ---- (castTb.isArray) expressionTb.isClass -------
+ if (scope.isJavaLangObject(expressionTb)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ if (castTb.isClass()) { // ----- (castTb.isClass) expressionTb.isClass ------
+ if (scope.areTypesCompatible(expressionTb, castTb))
+ return true;
+ else {
+ if (scope.areTypesCompatible(castTb, expressionTb)) {
+ return true;
+ }
+ return false;
+ }
+ }
+ if (castTb.isInterface()) { // ----- (castTb.isInterface) expressionTb.isClass -------
+ if (((ReferenceBinding) expressionTb).isFinal()) { //no subclass for expressionTb, thus compile-time check is valid
+ if (scope.areTypesCompatible(expressionTb, castTb))
+ return true;
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ //=========hoops==============
+ return false;
+ }
+ if (expressionTb.isInterface()) {
+ if (castTb.isArrayType()) { // ----- (castTb.isArray) expressionTb.isInterface ------
+ if (scope.isJavaLangCloneable(expressionTb) || scope.isJavaIoSerializable(expressionTb))
+ //potential runtime error
+ {
+ return true;
+ }
+ return false;
+ }
+ if (castTb.isClass()) { // ----- (castTb.isClass) expressionTb.isInterface --------
+ if (scope.isJavaLangObject(castTb))
+ return true;
+ if (((ReferenceBinding) castTb).isFinal()) { //no subclass for castTb, thus compile-time check is valid
+ if (scope.areTypesCompatible(castTb, expressionTb)) {
+ return true;
+ }
+ return false;
+ }
+ return true;
+ }
+ if (castTb.isInterface()) { // ----- (castTb.isInterface) expressionTb.isInterface -------
+ if (castTb != expressionTb && (scope.compareTypes(castTb, expressionTb) == NotRelated)) {
+ MethodBinding[] castTbMethods = ((ReferenceBinding) castTb).methods();
+ int castTbMethodsLength = castTbMethods.length;
+ MethodBinding[] expressionTbMethods = ((ReferenceBinding) expressionTb).methods();
+ int expressionTbMethodsLength = expressionTbMethods.length;
+ for (int i = 0; i < castTbMethodsLength; i++) {
+ for (int j = 0; j < expressionTbMethodsLength; j++) {
+ if (castTbMethods[i].selector == expressionTbMethods[j].selector) {
+ if (castTbMethods[i].returnType != expressionTbMethods[j].returnType) {
+ if (castTbMethods[i].areParametersEqual(expressionTbMethods[j])) {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ //============hoops===========
+ return false;
+ } // true;}
+
+ //=======hoops==========
+ return false;
+ }
+}
+/**
+ * Code generation for instanceOfExpression
+ *
+ * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
+ * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+*/
+public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+ int pc = codeStream.position;
+ expression.generateCode(currentScope, codeStream, true);
+ codeStream.instance_of(type.binding);
+ if (!valueRequired)
+ codeStream.pop();
+ codeStream.recordPositionsFrom(pc, this);
+}
+public TypeBinding resolveType(BlockScope scope) {
+ constant = NotAConstant;
+ TypeBinding expressionTb = expression.resolveType(scope);
+ TypeBinding checkTb = type.resolveType(scope);
+ if (expressionTb == null || checkTb == null)
+ return null;
+
+ //===== by grammatical construction, the next test is always false =====
+ //if (checkTb.isBaseType()) {
+ // scope.problemReporter().invalidTypeError(type,checkTb);
+ // return null;
+ //}
+
+ if (!areTypesCastCompatible(scope, checkTb, expressionTb)) {
+ scope.problemReporter().notCompatibleTypesError(this, expressionTb, checkTb);
+ return null;
+ }
+ return BooleanBinding;
+}
+public String toStringExpressionNoParenthesis(){
+ /* slow code*/
+
+ return expression.toStringExpression() + " instanceof "/*nonNLS*/ +
+ type.toString(0) ; }
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ expression.traverse(visitor, scope);
+ type.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteralMinValue.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteralMinValue.java
index e68be0937b..13731d2e33 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteralMinValue.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteralMinValue.java
@@ -1,23 +1,21 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-
-public class IntLiteralMinValue extends IntLiteral {
-
- final static char[] CharValue = new char[]{'-','2','1','4','7','4','8','3','6','4','8'};
- final static Constant MIN_VALUE = Constant.fromValue(Integer.MIN_VALUE) ;
-
-public IntLiteralMinValue() {
- super(CharValue,0,0,Integer.MIN_VALUE);
- constant = MIN_VALUE;
-}
-public void computeConstant(){
-
- /*precomputed at creation time*/ }
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.impl.*;
+
+public class IntLiteralMinValue extends IntLiteral {
+
+ final static char[] CharValue = new char[]{'-','2','1','4','7','4','8','3','6','4','8'};
+ final static Constant MIN_VALUE = Constant.fromValue(Integer.MIN_VALUE) ;
+
+public IntLiteralMinValue() {
+ super(CharValue,0,0,Integer.MIN_VALUE);
+ constant = MIN_VALUE;
+}
+public void computeConstant(){
+
+ /*precomputed at creation time*/ }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LabeledStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LabeledStatement.java
index 436ded9dda..e2a58b1d27 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LabeledStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LabeledStatement.java
@@ -1,89 +1,88 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-
-public class LabeledStatement extends Statement {
- public Statement statement;
- public char[] label;
- public Label targetLabel;
-
- // for local variables table attributes
- int mergedInitStateIndex = -1;
-/**
- * LabeledStatement constructor comment.
- */
-public LabeledStatement(char[] l , Statement st, int s,int e) {
- statement = st ;
- label = l ;
- sourceStart = s;
- sourceEnd = e;
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
-
- // need to stack a context to store explicit label, answer inits in case of normal completion merged
- // with those relative to the exit path from break statement occurring inside the labeled statement.
-
- if (statement == null) {
- return flowInfo;
- } else {
- LabelFlowContext labelContext;
- FlowInfo mergedInfo = statement.analyseCode(
- currentScope,
- (labelContext = new LabelFlowContext(flowContext, this, label, (targetLabel = new Label()), currentScope)),
- flowInfo).
- mergedWith(labelContext.initsOnBreak);
- mergedInitStateIndex = currentScope.methodScope().recordInitializationStates(mergedInfo);
- return mergedInfo;
- }
-}
-public AstNode concreteStatement() {
- return statement.concreteStatement();
-}
-/**
- * Code generation for labeled statement
- *
- * may not need actual source positions recording
- *
- * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
- * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
- */
-public void generateCode(BlockScope currentScope, CodeStream codeStream) {
- int pc = codeStream.position;
- if (targetLabel != null) {
- targetLabel.codeStream = codeStream;
- if (statement != null) {
- statement.generateCode(currentScope, codeStream);
- }
- targetLabel.place();
- }
- // May loose some local variable initializations : affecting the local variable attributes
- if (mergedInitStateIndex != -1) {
- codeStream.removeNotDefinitelyAssignedVariables(currentScope, mergedInitStateIndex);
- }
- codeStream.recordPositionsFrom(pc, this);
-}
-public void resolve(BlockScope scope) {
- statement.resolve(scope);
-}
-public String toString(int tab) {
- /* slow code */
-
- String s = tabString(tab);
- s += new String(label) + ": "/*nonNLS*/ + statement.toString(0);
- return s;
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
- if (visitor.visit(this, blockScope)) {
- statement.traverse(visitor, blockScope);
- }
- visitor.endVisit(this, blockScope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.codegen.*;
+import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class LabeledStatement extends Statement {
+ public Statement statement;
+ public char[] label;
+ public Label targetLabel;
+
+ // for local variables table attributes
+ int mergedInitStateIndex = -1;
+/**
+ * LabeledStatement constructor comment.
+ */
+public LabeledStatement(char[] l , Statement st, int s,int e) {
+ statement = st ;
+ label = l ;
+ sourceStart = s;
+ sourceEnd = e;
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+
+ // need to stack a context to store explicit label, answer inits in case of normal completion merged
+ // with those relative to the exit path from break statement occurring inside the labeled statement.
+
+ if (statement == null) {
+ return flowInfo;
+ } else {
+ LabelFlowContext labelContext;
+ FlowInfo mergedInfo = statement.analyseCode(
+ currentScope,
+ (labelContext = new LabelFlowContext(flowContext, this, label, (targetLabel = new Label()), currentScope)),
+ flowInfo).
+ mergedWith(labelContext.initsOnBreak);
+ mergedInitStateIndex = currentScope.methodScope().recordInitializationStates(mergedInfo);
+ return mergedInfo;
+ }
+}
+public AstNode concreteStatement() {
+ return statement.concreteStatement();
+}
+/**
+ * Code generation for labeled statement
+ *
+ * may not need actual source positions recording
+ *
+ * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
+ * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
+ */
+public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+ int pc = codeStream.position;
+ if (targetLabel != null) {
+ targetLabel.codeStream = codeStream;
+ if (statement != null) {
+ statement.generateCode(currentScope, codeStream);
+ }
+ targetLabel.place();
+ }
+ // May loose some local variable initializations : affecting the local variable attributes
+ if (mergedInitStateIndex != -1) {
+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, mergedInitStateIndex);
+ }
+ codeStream.recordPositionsFrom(pc, this);
+}
+public void resolve(BlockScope scope) {
+ statement.resolve(scope);
+}
+public String toString(int tab) {
+ /* slow code */
+
+ String s = tabString(tab);
+ s += new String(label) + ": "/*nonNLS*/ + statement.toString(0);
+ return s;
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
+ if (visitor.visit(this, blockScope)) {
+ statement.traverse(visitor, blockScope);
+ }
+ visitor.endVisit(this, blockScope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Literal.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Literal.java
index 438e59ce54..bed411e124 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Literal.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Literal.java
@@ -1,33 +1,32 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-
-public abstract class Literal extends Expression {
-
-
-public Literal(int s,int e) {
- sourceStart = s ;
- sourceEnd= e;
-}
-public abstract void computeConstant() ;
- //ON ERROR constant STAYS NULL
-public abstract TypeBinding literalType(BlockScope scope);
-public TypeBinding resolveType(BlockScope scope) {
- // compute the real value, which must range its type's range
-
- computeConstant();
- if (constant == null) {
- scope.problemReporter().constantOutOfRange(this);
- constant = Constant.NotAConstant;
- return null;
- }
- return literalType(scope);
-}
-public abstract char[] source() ;
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.impl.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public abstract class Literal extends Expression {
+
+
+public Literal(int s,int e) {
+ sourceStart = s ;
+ sourceEnd= e;
+}
+public abstract void computeConstant() ;
+ //ON ERROR constant STAYS NULL
+public abstract TypeBinding literalType(BlockScope scope);
+public TypeBinding resolveType(BlockScope scope) {
+ // compute the real value, which must range its type's range
+
+ computeConstant();
+ if (constant == null) {
+ scope.problemReporter().constantOutOfRange(this);
+ constant = Constant.NotAConstant;
+ return null;
+ }
+ return literalType(scope);
+}
+public abstract char[] source() ;
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalTypeDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalTypeDeclaration.java
index 1da2fd7b33..ee186dfaaf 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalTypeDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalTypeDeclaration.java
@@ -1,57 +1,56 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-import org.eclipse.jdt.internal.compiler.problem.*;
-
-public class LocalTypeDeclaration extends InnerTypeDeclaration {
- public AbstractMethodDeclaration enclosingMethod;
-
-/**
- * Iteration for a local innertype
- *
- */
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
- if (ignoreFurtherInvestigation)
- return;
- try {
- if (visitor.visit(this, blockScope)) {
- if (superclass != null)
- superclass.traverse(visitor, scope);
- if (superInterfaces != null) {
- int superInterfaceLength = superInterfaces.length;
- for (int i = 0; i < superInterfaceLength; i++)
- superInterfaces[i].traverse(visitor, scope);
- }
- if (memberTypes != null) {
- int memberTypesLength = memberTypes.length;
- for (int i = 0; i < memberTypesLength; i++)
- memberTypes[i].traverse(visitor, scope);
- }
- if (fields != null) {
- int fieldsLength = fields.length;
- for (int i = 0; i < fieldsLength; i++) {
- FieldDeclaration field;
- if ((field = fields[i]).isStatic()) {
- // local type cannot have static fields
- } else {
- field.traverse(visitor, initializerScope);
- }
- }
- }
- if (methods != null) {
- int methodsLength = methods.length;
- for (int i = 0; i < methodsLength; i++)
- methods[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, blockScope);
- } catch (AbortType e) {
- }
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+import org.eclipse.jdt.internal.compiler.problem.*;
+
+public class LocalTypeDeclaration extends InnerTypeDeclaration {
+ public AbstractMethodDeclaration enclosingMethod;
+
+/**
+ * Iteration for a local innertype
+ *
+ */
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ if (visitor.visit(this, blockScope)) {
+ if (superclass != null)
+ superclass.traverse(visitor, scope);
+ if (superInterfaces != null) {
+ int superInterfaceLength = superInterfaces.length;
+ for (int i = 0; i < superInterfaceLength; i++)
+ superInterfaces[i].traverse(visitor, scope);
+ }
+ if (memberTypes != null) {
+ int memberTypesLength = memberTypes.length;
+ for (int i = 0; i < memberTypesLength; i++)
+ memberTypes[i].traverse(visitor, scope);
+ }
+ if (fields != null) {
+ int fieldsLength = fields.length;
+ for (int i = 0; i < fieldsLength; i++) {
+ FieldDeclaration field;
+ if ((field = fields[i]).isStatic()) {
+ // local type cannot have static fields
+ } else {
+ field.traverse(visitor, initializerScope);
+ }
+ }
+ }
+ if (methods != null) {
+ int methodsLength = methods.length;
+ for (int i = 0; i < methodsLength; i++)
+ methods[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, blockScope);
+ } catch (AbortType e) {
+ }
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteralMinValue.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteralMinValue.java
index 626153b08e..0f89977137 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteralMinValue.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteralMinValue.java
@@ -1,22 +1,21 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-
-public class LongLiteralMinValue extends LongLiteral {
-
- final static char[] CharValue = new char[]{'-', '9','2','2','3','3','7','2','0','3','6','8','5','4','7','7','5','8','0','8','L'};
- final static Constant MIN_VALUE = Constant.fromValue(Long.MIN_VALUE) ;
-
-public LongLiteralMinValue(){
- super(CharValue,0,0,Long.MIN_VALUE);
- constant = MIN_VALUE;
-}
-public void computeConstant() {
-
- /*precomputed at creation time*/}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.impl.*;
+
+public class LongLiteralMinValue extends LongLiteral {
+
+ final static char[] CharValue = new char[]{'-', '9','2','2','3','3','7','2','0','3','6','8','5','4','7','7','5','8','0','8','L'};
+ final static Constant MIN_VALUE = Constant.fromValue(Long.MIN_VALUE) ;
+
+public LongLiteralMinValue(){
+ super(CharValue,0,0,Long.MIN_VALUE);
+ constant = MIN_VALUE;
+}
+public void computeConstant() {
+
+ /*precomputed at creation time*/}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MagicLiteral.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MagicLiteral.java
index 6c063d0209..750864468b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MagicLiteral.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MagicLiteral.java
@@ -1,26 +1,25 @@
-package org.eclipse.jdt.internal.compiler.ast;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.*;
-
-public abstract class MagicLiteral extends Literal {
-public MagicLiteral(int s , int e) {
- super(s,e);
-}
-public boolean isValidJavaStatement(){
- //should never be reach, but with a bug in the ast tree....
- //see comment on the Statement class
-
- return false ;}
-/**
- * source method comment.
- */
-public char[] source() {
- return null;
-}
-public String toStringExpression(){
-
- return new String(source()) ; }
-}
+package org.eclipse.jdt.internal.compiler.ast;
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+public abstract class MagicLiteral extends Literal {
+public MagicLiteral(int s , int e) {
+ super(s,e);
+}
+public boolean isValidJavaStatement(){
+ //should never be reach, but with a bug in the ast tree....
+ //see comment on the Statement class
+
+ return false ;}
+/**
+ * source method comment.
+ */
+public char[] source() {
+ return null;
+}
+public String toStringExpression(){
+
+ return new String(source()) ; }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
index 656ea2a984..da151d69b2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
@@ -1,263 +1,262 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-
-public class MessageSend extends Expression implements InvocationSite {
- public Expression receiver ;
- public char[] selector ;
- public Expression[] arguments ;
- public MethodBinding binding;
-
- public long nameSourcePosition ; //(start<<32)+end
-
-
- MethodBinding syntheticAccessor;
-
- public TypeBinding receiverType;
-
-public MessageSend() {
-
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
-
- flowInfo = receiver.analyseCode(currentScope, flowContext, flowInfo, !binding.isStatic()).unconditionalInits();
- if (arguments != null) {
- int length = arguments.length;
- for (int i = 0; i < length; i++) {
- flowInfo = arguments[i].analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
- }
- }
- ReferenceBinding[] thrownExceptions;
- if ((thrownExceptions = binding.thrownExceptions) != NoExceptions) {
- // must verify that exceptions potentially thrown by this expression are caught in the method
- flowContext.checkExceptionHandlers(thrownExceptions, this, flowInfo, currentScope);
- }
- // if invoking through an enclosing instance, then must perform the field generation -- only if reachable
- manageEnclosingInstanceAccessIfNecessary(currentScope);
- manageSyntheticAccessIfNecessary(currentScope);
- return flowInfo;
-}
-/**
- * MessageSend code generation
- *
- * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
- * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
-
- int pc = codeStream.position;
-
- // generate receiver/enclosing instance access
- boolean isStatic = binding.isStatic();
- // outer access ?
- if (!isStatic && ((bits & DepthMASK) != 0)){
- // outer method can be reached through emulation
- Object[] path = currentScope.getExactEmulationPath(currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT));
- if (path == null) {
- // emulation was not possible (should not happen per construction)
- currentScope.problemReporter().needImplementation();
- } else {
- codeStream.generateOuterAccess(path, this, currentScope);
- }
- } else {
- receiver.generateCode(currentScope, codeStream, !isStatic);
- }
- // generate arguments
- if (arguments != null){
- for (int i = 0, max = arguments.length; i < max; i++){
- arguments[i].generateCode(currentScope, codeStream, true);
- }
- }
- // actual message invocation
- if (syntheticAccessor == null){
- if (isStatic){
- codeStream.invokestatic(binding);
- } else {
- if( (receiver.isSuper()) || binding.isPrivate()){
- codeStream.invokespecial(binding);
- } else {
- if (binding.declaringClass.isInterface()){
- codeStream.invokeinterface(binding);
- } else {
- codeStream.invokevirtual(binding);
- }
- }
- }
- } else {
- codeStream.invokestatic(syntheticAccessor);
- }
- // operation on the returned value
- if (valueRequired){
- // implicit conversion if necessary
- codeStream.generateImplicitConversion(implicitConversion);
- } else {
- // pop return value if any
- switch(binding.returnType.id){
- case T_long :
- case T_double :
- codeStream.pop2();
- break;
- case T_void :
- break;
- default:
- codeStream.pop();
- }
- }
- codeStream.recordPositionsFrom(pc, this);
-}
-public boolean isSuperAccess() {
- return receiver.isSuper();
-}
-public boolean isTypeAccess() {
- return receiver != null && receiver.isTypeReference();
-}
-public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
- if (((bits & DepthMASK) != 0) && (!binding.isStatic()) && (receiver == ThisReference.ThisImplicit)) {
- ReferenceBinding compatibleType = currentScope.enclosingSourceType();
- // the declaringClass of the target binding must be compatible with the enclosing
- // type at <depth> levels outside
- for (int i = 0, depth = (bits & DepthMASK) >> DepthSHIFT; i < depth; i++) {
- compatibleType = compatibleType.enclosingType();
- }
- currentScope.emulateOuterAccess((SourceTypeBinding) compatibleType, false); // request cascade of accesses
- }
-}
-public void manageSyntheticAccessIfNecessary(BlockScope currentScope){
-
- if (((bits & DepthMASK) != 0)
- || currentScope.enclosingSourceType() != binding.declaringClass){ // implicit only have a depth set
- if (binding.isPrivate()){ // private access
- syntheticAccessor = ((SourceTypeBinding)binding.declaringClass).addSyntheticMethod(binding);
- currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
- return;
- }
- if (receiver == ThisReference.ThisImplicit
- && binding.isProtected()
- && (bits & DepthMASK) != 0 // only if outer access
- && binding.declaringClass.getPackage()
- != currentScope.enclosingSourceType().getPackage()){ // protected access (implicit access only)
- syntheticAccessor = ((SourceTypeBinding)currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT)).addSyntheticMethod(binding);
- currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
- }
- if (receiver instanceof QualifiedSuperReference){ // qualified super
- SourceTypeBinding destinationType = (SourceTypeBinding)(((QualifiedSuperReference)receiver).currentCompatibleType);
- syntheticAccessor = destinationType.addSyntheticMethod(binding);
- currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
- }
- }
-}
-public TypeBinding resolveType(BlockScope scope) {
- // Answer the signature return type
- // Base type promotion
-
- constant = NotAConstant;
- this.receiverType = receiver.resolveType(scope);
- // will check for null after args are resolved
- TypeBinding[] argumentTypes = NoParameters;
- if (arguments != null) {
- boolean argHasError = false; // typeChecks all arguments
- int length = arguments.length;
- argumentTypes = new TypeBinding[length];
- for (int i = 0; i < length; i++)
- if ((argumentTypes[i] = arguments[i].resolveType(scope)) == null)
- argHasError = true;
- if (argHasError)
- return null;
- }
- if (this.receiverType == null)
- return null;
-
- // base type cannot receive any message
- if (this.receiverType.isBaseType()) {
- scope.problemReporter().errorNoMethodFor(this, this.receiverType, argumentTypes);
- return null;
- }
-
- binding =
- receiver == ThisReference.ThisImplicit
- ? scope.getImplicitMethod(selector, argumentTypes, this)
- : scope.getMethod(this.receiverType, selector, argumentTypes, this);
- if (!binding.isValidBinding()) {
- if (binding.declaringClass == null) {
- if (this.receiverType instanceof ReferenceBinding) {
- binding.declaringClass = (ReferenceBinding) this.receiverType;
- } else { // really bad error ....
- scope.problemReporter().errorNoMethodFor(this, this.receiverType, argumentTypes);
- return null;
- }
- }
- scope.problemReporter().invalidMethod(this, binding);
- return null;
- }
- if (!binding.isStatic()) {
- // the "receiver" must not be a type, i.e. a NameReference that the TC has bound to a Type
- if (receiver instanceof NameReference) {
- if ((((NameReference) receiver).bits & BindingIds.TYPE) != 0) {
- scope.problemReporter().mustUseAStaticMethod(this, binding);
- return null;
- }
- }
- }
- if (arguments != null)
- for (int i = 0; i < arguments.length; i++)
- arguments[i].implicitWidening(binding.parameters[i], argumentTypes[i]);
-
- //-------message send that are known to fail at compile time-----------
- if (binding.isAbstract()) {
- if (receiver.isSuper()) {
- scope.problemReporter().cannotDireclyInvokeAbstractMethod(this, binding);
- return null;
- }
- // abstract private methods cannot occur nor abstract static............
- }
- if (isMethodUseDeprecated(binding, scope))
- scope.problemReporter().deprecatedMethod(binding, this);
- // if the binding declaring class is not visible, need special action
- // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
- if (binding.declaringClass != this.receiverType
- && !binding.declaringClass.canBeSeenBy(scope))
- binding = new MethodBinding(binding, (ReferenceBinding) this.receiverType);
- return binding.returnType;
-}
-public void setDepth(int depth) {
- if (depth > 0) {
- bits |= (depth & 0xFF) << DepthSHIFT; // encoded on 8 bits
- }
-}
-public void setFieldIndex(int depth) {
- // ignore for here
-}
-public String toStringExpression(){
- /*slow code*/
-
- String s = ""/*nonNLS*/;
- if (receiver != ThisReference.ThisImplicit)
- s = s + receiver.toStringExpression()+"."/*nonNLS*/;
- s = s + new String(selector) + "("/*nonNLS*/ ;
- if (arguments != null)
- for (int i = 0; i < arguments.length ; i ++)
- { s = s + arguments[i].toStringExpression();
- if ( i != arguments.length -1 ) s = s + " , "/*nonNLS*/ ;};;
- s =s + ")"/*nonNLS*/ ;
- return s;}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
- if (visitor.visit(this, blockScope)) {
- receiver.traverse(visitor, blockScope);
- if (arguments != null) {
- int argumentsLength = arguments.length;
- for (int i = 0; i < argumentsLength; i++)
- arguments[i].traverse(visitor, blockScope);
- }
- }
- visitor.endVisit(this, blockScope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.codegen.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class MessageSend extends Expression implements InvocationSite {
+ public Expression receiver ;
+ public char[] selector ;
+ public Expression[] arguments ;
+ public MethodBinding binding;
+
+ public long nameSourcePosition ; //(start<<32)+end
+
+
+ MethodBinding syntheticAccessor;
+
+ public TypeBinding receiverType;
+
+public MessageSend() {
+
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+
+ flowInfo = receiver.analyseCode(currentScope, flowContext, flowInfo, !binding.isStatic()).unconditionalInits();
+ if (arguments != null) {
+ int length = arguments.length;
+ for (int i = 0; i < length; i++) {
+ flowInfo = arguments[i].analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
+ }
+ }
+ ReferenceBinding[] thrownExceptions;
+ if ((thrownExceptions = binding.thrownExceptions) != NoExceptions) {
+ // must verify that exceptions potentially thrown by this expression are caught in the method
+ flowContext.checkExceptionHandlers(thrownExceptions, this, flowInfo, currentScope);
+ }
+ // if invoking through an enclosing instance, then must perform the field generation -- only if reachable
+ manageEnclosingInstanceAccessIfNecessary(currentScope);
+ manageSyntheticAccessIfNecessary(currentScope);
+ return flowInfo;
+}
+/**
+ * MessageSend code generation
+ *
+ * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
+ * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+
+ int pc = codeStream.position;
+
+ // generate receiver/enclosing instance access
+ boolean isStatic = binding.isStatic();
+ // outer access ?
+ if (!isStatic && ((bits & DepthMASK) != 0)){
+ // outer method can be reached through emulation
+ Object[] path = currentScope.getExactEmulationPath(currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT));
+ if (path == null) {
+ // emulation was not possible (should not happen per construction)
+ currentScope.problemReporter().needImplementation();
+ } else {
+ codeStream.generateOuterAccess(path, this, currentScope);
+ }
+ } else {
+ receiver.generateCode(currentScope, codeStream, !isStatic);
+ }
+ // generate arguments
+ if (arguments != null){
+ for (int i = 0, max = arguments.length; i < max; i++){
+ arguments[i].generateCode(currentScope, codeStream, true);
+ }
+ }
+ // actual message invocation
+ if (syntheticAccessor == null){
+ if (isStatic){
+ codeStream.invokestatic(binding);
+ } else {
+ if( (receiver.isSuper()) || binding.isPrivate()){
+ codeStream.invokespecial(binding);
+ } else {
+ if (binding.declaringClass.isInterface()){
+ codeStream.invokeinterface(binding);
+ } else {
+ codeStream.invokevirtual(binding);
+ }
+ }
+ }
+ } else {
+ codeStream.invokestatic(syntheticAccessor);
+ }
+ // operation on the returned value
+ if (valueRequired){
+ // implicit conversion if necessary
+ codeStream.generateImplicitConversion(implicitConversion);
+ } else {
+ // pop return value if any
+ switch(binding.returnType.id){
+ case T_long :
+ case T_double :
+ codeStream.pop2();
+ break;
+ case T_void :
+ break;
+ default:
+ codeStream.pop();
+ }
+ }
+ codeStream.recordPositionsFrom(pc, this);
+}
+public boolean isSuperAccess() {
+ return receiver.isSuper();
+}
+public boolean isTypeAccess() {
+ return receiver != null && receiver.isTypeReference();
+}
+public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
+ if (((bits & DepthMASK) != 0) && (!binding.isStatic()) && (receiver == ThisReference.ThisImplicit)) {
+ ReferenceBinding compatibleType = currentScope.enclosingSourceType();
+ // the declaringClass of the target binding must be compatible with the enclosing
+ // type at <depth> levels outside
+ for (int i = 0, depth = (bits & DepthMASK) >> DepthSHIFT; i < depth; i++) {
+ compatibleType = compatibleType.enclosingType();
+ }
+ currentScope.emulateOuterAccess((SourceTypeBinding) compatibleType, false); // request cascade of accesses
+ }
+}
+public void manageSyntheticAccessIfNecessary(BlockScope currentScope){
+
+ if (((bits & DepthMASK) != 0)
+ || currentScope.enclosingSourceType() != binding.declaringClass){ // implicit only have a depth set
+ if (binding.isPrivate()){ // private access
+ syntheticAccessor = ((SourceTypeBinding)binding.declaringClass).addSyntheticMethod(binding);
+ currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
+ return;
+ }
+ if (receiver == ThisReference.ThisImplicit
+ && binding.isProtected()
+ && (bits & DepthMASK) != 0 // only if outer access
+ && binding.declaringClass.getPackage()
+ != currentScope.enclosingSourceType().getPackage()){ // protected access (implicit access only)
+ syntheticAccessor = ((SourceTypeBinding)currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT)).addSyntheticMethod(binding);
+ currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
+ }
+ if (receiver instanceof QualifiedSuperReference){ // qualified super
+ SourceTypeBinding destinationType = (SourceTypeBinding)(((QualifiedSuperReference)receiver).currentCompatibleType);
+ syntheticAccessor = destinationType.addSyntheticMethod(binding);
+ currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
+ }
+ }
+}
+public TypeBinding resolveType(BlockScope scope) {
+ // Answer the signature return type
+ // Base type promotion
+
+ constant = NotAConstant;
+ this.receiverType = receiver.resolveType(scope);
+ // will check for null after args are resolved
+ TypeBinding[] argumentTypes = NoParameters;
+ if (arguments != null) {
+ boolean argHasError = false; // typeChecks all arguments
+ int length = arguments.length;
+ argumentTypes = new TypeBinding[length];
+ for (int i = 0; i < length; i++)
+ if ((argumentTypes[i] = arguments[i].resolveType(scope)) == null)
+ argHasError = true;
+ if (argHasError)
+ return null;
+ }
+ if (this.receiverType == null)
+ return null;
+
+ // base type cannot receive any message
+ if (this.receiverType.isBaseType()) {
+ scope.problemReporter().errorNoMethodFor(this, this.receiverType, argumentTypes);
+ return null;
+ }
+
+ binding =
+ receiver == ThisReference.ThisImplicit
+ ? scope.getImplicitMethod(selector, argumentTypes, this)
+ : scope.getMethod(this.receiverType, selector, argumentTypes, this);
+ if (!binding.isValidBinding()) {
+ if (binding.declaringClass == null) {
+ if (this.receiverType instanceof ReferenceBinding) {
+ binding.declaringClass = (ReferenceBinding) this.receiverType;
+ } else { // really bad error ....
+ scope.problemReporter().errorNoMethodFor(this, this.receiverType, argumentTypes);
+ return null;
+ }
+ }
+ scope.problemReporter().invalidMethod(this, binding);
+ return null;
+ }
+ if (!binding.isStatic()) {
+ // the "receiver" must not be a type, i.e. a NameReference that the TC has bound to a Type
+ if (receiver instanceof NameReference) {
+ if ((((NameReference) receiver).bits & BindingIds.TYPE) != 0) {
+ scope.problemReporter().mustUseAStaticMethod(this, binding);
+ return null;
+ }
+ }
+ }
+ if (arguments != null)
+ for (int i = 0; i < arguments.length; i++)
+ arguments[i].implicitWidening(binding.parameters[i], argumentTypes[i]);
+
+ //-------message send that are known to fail at compile time-----------
+ if (binding.isAbstract()) {
+ if (receiver.isSuper()) {
+ scope.problemReporter().cannotDireclyInvokeAbstractMethod(this, binding);
+ return null;
+ }
+ // abstract private methods cannot occur nor abstract static............
+ }
+ if (isMethodUseDeprecated(binding, scope))
+ scope.problemReporter().deprecatedMethod(binding, this);
+ // if the binding declaring class is not visible, need special action
+ // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
+ if (binding.declaringClass != this.receiverType
+ && !binding.declaringClass.canBeSeenBy(scope))
+ binding = new MethodBinding(binding, (ReferenceBinding) this.receiverType);
+ return binding.returnType;
+}
+public void setDepth(int depth) {
+ if (depth > 0) {
+ bits |= (depth & 0xFF) << DepthSHIFT; // encoded on 8 bits
+ }
+}
+public void setFieldIndex(int depth) {
+ // ignore for here
+}
+public String toStringExpression(){
+ /*slow code*/
+
+ String s = ""/*nonNLS*/;
+ if (receiver != ThisReference.ThisImplicit)
+ s = s + receiver.toStringExpression()+"."/*nonNLS*/;
+ s = s + new String(selector) + "("/*nonNLS*/ ;
+ if (arguments != null)
+ for (int i = 0; i < arguments.length ; i ++)
+ { s = s + arguments[i].toStringExpression();
+ if ( i != arguments.length -1 ) s = s + " , "/*nonNLS*/ ;};;
+ s =s + ")"/*nonNLS*/ ;
+ return s;}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
+ if (visitor.visit(this, blockScope)) {
+ receiver.traverse(visitor, blockScope);
+ if (arguments != null) {
+ int argumentsLength = arguments.length;
+ for (int i = 0; i < argumentsLength; i++)
+ arguments[i].traverse(visitor, blockScope);
+ }
+ }
+ visitor.endVisit(this, blockScope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java
index 4fa13ebda7..de35fb74b2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java
@@ -1,98 +1,97 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-import org.eclipse.jdt.internal.compiler.parser.*;
-import org.eclipse.jdt.internal.compiler.problem.*;
-import org.eclipse.jdt.internal.compiler.util.*;
-
-public class MethodDeclaration extends AbstractMethodDeclaration {
- public TypeReference returnType;
-/**
- * MethodDeclaration constructor comment.
- */
-public MethodDeclaration() {
- super();
-}
-public void checkName() {
- // look if the name of the method is correct
- if (isTypeUseDeprecated(binding.returnType, scope))
- scope.problemReporter().deprecatedType(binding.returnType, returnType);
-
- if (CharOperation.equals(scope.enclosingSourceType().sourceName, selector))
- scope.problemReporter().methodWithConstructorName(this);
-
- // by grammatical construction, interface methods are always abstract
- if (scope.enclosingSourceType().isInterface())
- return;
-
- // if a method has an semicolon body and is not declared as abstract==>error
- // native methods may have a semicolon body
- if ((modifiers & AccSemicolonBody) != 0) {
- if ((modifiers & AccNative) == 0)
- if ((modifiers & AccAbstract) == 0)
- scope.problemReporter().methodNeedingAbstractModifier(this);
- } else {
- // the method HAS a body --> abstract native modifiers are forbiden
- if (((modifiers & AccNative) != 0) || ((modifiers & AccAbstract) != 0))
- scope.problemReporter().methodNeedingNoBody(this);
- }
-}
-public void parseStatements(Parser parser, CompilationUnitDeclaration unit){
- //fill up the method body with statement
-
- if (ignoreFurtherInvestigation) return;
- parser.parse(this, unit);
-
-}
-public void resolve(ClassScope upperScope) {
- if (binding == null) {
- ignoreFurtherInvestigation = true;
- return;
- }
- // ========= abort on fatal error =============
- try {
- if (this.returnType != null){
- this.returnType.binding = this.binding.returnType; // record the return type binding
- }
- } catch (AbortMethod e) {
- this.ignoreFurtherInvestigation = true;
- }
- super.resolve(upperScope);
-
-}
-public String returnTypeToString(int tab) {
- /*slow code */
-
- if (returnType == null)
- return ""/*nonNLS*/;
- return returnType.toString(tab)+" "/*nonNLS*/;
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope classScope) {
- if (visitor.visit(this, classScope)) {
- if (returnType != null)
- returnType.traverse(visitor, scope);
- if (arguments != null) {
- int argumentLength = arguments.length;
- for (int i = 0; i < argumentLength; i++)
- arguments[i].traverse(visitor, scope);
- }
- if (thrownExceptions != null) {
- int thrownExceptionsLength = thrownExceptions.length;
- for (int i = 0; i < thrownExceptionsLength; i++)
- thrownExceptions[i].traverse(visitor, scope);
- }
- if (statements != null) {
- int statementsLength = statements.length;
- for (int i = 0; i < statementsLength; i++)
- statements[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, classScope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+import org.eclipse.jdt.internal.compiler.parser.*;
+import org.eclipse.jdt.internal.compiler.problem.*;
+import org.eclipse.jdt.internal.compiler.util.*;
+
+public class MethodDeclaration extends AbstractMethodDeclaration {
+ public TypeReference returnType;
+/**
+ * MethodDeclaration constructor comment.
+ */
+public MethodDeclaration() {
+ super();
+}
+public void checkName() {
+ // look if the name of the method is correct
+ if (isTypeUseDeprecated(binding.returnType, scope))
+ scope.problemReporter().deprecatedType(binding.returnType, returnType);
+
+ if (CharOperation.equals(scope.enclosingSourceType().sourceName, selector))
+ scope.problemReporter().methodWithConstructorName(this);
+
+ // by grammatical construction, interface methods are always abstract
+ if (scope.enclosingSourceType().isInterface())
+ return;
+
+ // if a method has an semicolon body and is not declared as abstract==>error
+ // native methods may have a semicolon body
+ if ((modifiers & AccSemicolonBody) != 0) {
+ if ((modifiers & AccNative) == 0)
+ if ((modifiers & AccAbstract) == 0)
+ scope.problemReporter().methodNeedingAbstractModifier(this);
+ } else {
+ // the method HAS a body --> abstract native modifiers are forbiden
+ if (((modifiers & AccNative) != 0) || ((modifiers & AccAbstract) != 0))
+ scope.problemReporter().methodNeedingNoBody(this);
+ }
+}
+public void parseStatements(Parser parser, CompilationUnitDeclaration unit){
+ //fill up the method body with statement
+
+ if (ignoreFurtherInvestigation) return;
+ parser.parse(this, unit);
+
+}
+public void resolve(ClassScope upperScope) {
+ if (binding == null) {
+ ignoreFurtherInvestigation = true;
+ return;
+ }
+ // ========= abort on fatal error =============
+ try {
+ if (this.returnType != null){
+ this.returnType.binding = this.binding.returnType; // record the return type binding
+ }
+ } catch (AbortMethod e) {
+ this.ignoreFurtherInvestigation = true;
+ }
+ super.resolve(upperScope);
+
+}
+public String returnTypeToString(int tab) {
+ /*slow code */
+
+ if (returnType == null)
+ return ""/*nonNLS*/;
+ return returnType.toString(tab)+" "/*nonNLS*/;
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope classScope) {
+ if (visitor.visit(this, classScope)) {
+ if (returnType != null)
+ returnType.traverse(visitor, scope);
+ if (arguments != null) {
+ int argumentLength = arguments.length;
+ for (int i = 0; i < argumentLength; i++)
+ arguments[i].traverse(visitor, scope);
+ }
+ if (thrownExceptions != null) {
+ int thrownExceptionsLength = thrownExceptions.length;
+ for (int i = 0; i < thrownExceptionsLength; i++)
+ thrownExceptions[i].traverse(visitor, scope);
+ }
+ if (statements != null) {
+ int statementsLength = statements.length;
+ for (int i = 0; i < statementsLength; i++)
+ statements[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, classScope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NameReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NameReference.java
index d870fc8f21..e544a94c42 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NameReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NameReference.java
@@ -1,51 +1,49 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-
-public abstract class NameReference extends Reference implements InvocationSite, BindingIds {
- public Binding binding; //may be aTypeBinding-aFieldBinding-aLocalVariableBinding
-
- public TypeBinding receiverType;
-
- //the error printing
- //some name reference are build as name reference but
- //only used as type reference. When it happens, instead of
- //creating a new objet (aTypeReference) we just flag a boolean
- //This concesion is valuable while their are cases when the NameReference
- //will be a TypeReference (static message sends.....) and there is
- //no changeClass in java.
-public NameReference() {
- super();
- bits |= TYPE | VARIABLE; // restrictiveFlag
-
-}
-public FieldBinding fieldBinding() {
- //this method should be sent ONLY after a check against isFieldReference()
- //check its use doing senders.........
-
- return (FieldBinding) binding ;
-}
-public boolean isSuperAccess() {
- return false;
-}
-public boolean isTypeAccess() {
- // null is acceptable when we are resolving the first part of a reference
- return binding == null || binding instanceof ReferenceBinding;
-}
-public boolean isTypeReference() {
- return binding instanceof ReferenceBinding;
-}
-public void setDepth(int depth) {
- if (depth > 0) {
- bits |= (depth & 0xFF) << DepthSHIFT; // encoded on 8 bits
- }
-}
-public void setFieldIndex(int index){}
-public abstract String unboundReferenceErrorName();
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public abstract class NameReference extends Reference implements InvocationSite, BindingIds {
+ public Binding binding; //may be aTypeBinding-aFieldBinding-aLocalVariableBinding
+
+ public TypeBinding receiverType;
+
+ //the error printing
+ //some name reference are build as name reference but
+ //only used as type reference. When it happens, instead of
+ //creating a new objet (aTypeReference) we just flag a boolean
+ //This concesion is valuable while their are cases when the NameReference
+ //will be a TypeReference (static message sends.....) and there is
+ //no changeClass in java.
+public NameReference() {
+ super();
+ bits |= TYPE | VARIABLE; // restrictiveFlag
+
+}
+public FieldBinding fieldBinding() {
+ //this method should be sent ONLY after a check against isFieldReference()
+ //check its use doing senders.........
+
+ return (FieldBinding) binding ;
+}
+public boolean isSuperAccess() {
+ return false;
+}
+public boolean isTypeAccess() {
+ // null is acceptable when we are resolving the first part of a reference
+ return binding == null || binding instanceof ReferenceBinding;
+}
+public boolean isTypeReference() {
+ return binding instanceof ReferenceBinding;
+}
+public void setDepth(int depth) {
+ if (depth > 0) {
+ bits |= (depth & 0xFF) << DepthSHIFT; // encoded on 8 bits
+ }
+}
+public void setFieldIndex(int index){}
+public abstract String unboundReferenceErrorName();
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NumberLiteral.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NumberLiteral.java
index b995f827de..d824e241e3 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NumberLiteral.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NumberLiteral.java
@@ -1,27 +1,25 @@
-package org.eclipse.jdt.internal.compiler.ast;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.*;
-
-public abstract class NumberLiteral extends Literal {
- char[] source;
-public NumberLiteral(char[] token, int s, int e) {
- this(s,e) ;
- source = token ;
-}
-public NumberLiteral(int s, int e) {
- super (s,e) ;
-}
-public boolean isValidJavaStatement(){
- //should never be reach, but with a bug in the ast tree....
- //see comment on the Statement class
-
- return false ;}
-public char[] source(){
- return source;}
-public String toStringExpression(){
-
- return new String(source);}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+public abstract class NumberLiteral extends Literal {
+ char[] source;
+public NumberLiteral(char[] token, int s, int e) {
+ this(s,e) ;
+ source = token ;
+}
+public NumberLiteral(int s, int e) {
+ super (s,e) ;
+}
+public boolean isValidJavaStatement(){
+ //should never be reach, but with a bug in the ast tree....
+ //see comment on the Statement class
+
+ return false ;}
+public char[] source(){
+ return source;}
+public String toStringExpression(){
+
+ return new String(source);}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorExpression.java
index 2b674f691d..149771b4dd 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorExpression.java
@@ -1,1600 +1,1598 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-
-public abstract class OperatorExpression extends Expression implements OperatorIds {
- public static int[][] ResolveTypeTables = new int[NumberOfTables][];
- static {classInitialize();}
-/**
- * OperatorExpression constructor comment.
- */
-public OperatorExpression() {
- super();
-}
-public static final void classInitialize() {
- ResolveTypeTables[AND] = get_AND();
- ResolveTypeTables[AND_AND] = get_AND_AND();
- ResolveTypeTables[DIVIDE] = get_DIVIDE();
- ResolveTypeTables[EQUAL_EQUAL] = get_EQUAL_EQUAL();
- ResolveTypeTables[GREATER] = get_GREATER();
- ResolveTypeTables[GREATER_EQUAL] = get_GREATER_EQUAL();
- ResolveTypeTables[LEFT_SHIFT] = get_LEFT_SHIFT();
- ResolveTypeTables[LESS] = get_LESS();
- ResolveTypeTables[LESS_EQUAL] = get_LESS_EQUAL();
- ResolveTypeTables[MINUS] = get_MINUS();
- ResolveTypeTables[MULTIPLY] = get_MULTIPLY();
- ResolveTypeTables[OR] = get_OR();
- ResolveTypeTables[OR_OR] = get_OR_OR();
- ResolveTypeTables[PLUS] = get_PLUS();
- ResolveTypeTables[REMAINDER] = get_REMAINDER();
- ResolveTypeTables[RIGHT_SHIFT] = get_RIGHT_SHIFT();
- ResolveTypeTables[UNSIGNED_RIGHT_SHIFT] = get_UNSIGNED_RIGHT_SHIFT();
- ResolveTypeTables[XOR] = get_XOR();
-}
-public static final String generateTableTestCase(){
- //return a String which is a java method allowing to test
- //the non zero entries of all tables
-
- /* slow code */
-
- /*
- org.eclipse.jdt.internal.compiler.ast.
- OperatorExpression.generateTableTestCase();
- */
-
- int[] operators = new int[]{AND,AND_AND,DIVIDE,GREATER,GREATER_EQUAL,
- LEFT_SHIFT,LESS,LESS_EQUAL,MINUS,MULTIPLY,OR,OR_OR,PLUS,REMAINDER,
- RIGHT_SHIFT,UNSIGNED_RIGHT_SHIFT,XOR};
-
- class Decode {
- public final String constant(int code){
- switch(code){
- case T_boolean : return "true"/*nonNLS*/ ;
- case T_byte : return "((byte) 3)"/*nonNLS*/ ;
- case T_char : return "'A'"/*nonNLS*/ ;
- case T_double : return "300.0d"/*nonNLS*/ ;
- case T_float : return "100.0f"/*nonNLS*/ ;
- case T_int : return "1"/*nonNLS*/ ;
- case T_long : return "7L"/*nonNLS*/ ;
- case T_String : return "\"hello-world\""/*nonNLS*/ ;
- case T_null : return "null"/*nonNLS*/;
- case T_short : return "((short) 5)"/*nonNLS*/;
- case T_Object : return "null"/*nonNLS*/;}
- return ""/*nonNLS*/;}
-
- public final String type(int code){
- switch(code){
- case T_boolean : return "z"/*nonNLS*/ ;
- case T_byte : return "b"/*nonNLS*/ ;
- case T_char : return "c"/*nonNLS*/ ;
- case T_double : return "d"/*nonNLS*/ ;
- case T_float : return "f"/*nonNLS*/ ;
- case T_int : return "i"/*nonNLS*/ ;
- case T_long : return "l"/*nonNLS*/ ;
- case T_String : return "str"/*nonNLS*/ ;
- case T_null : return "null"/*nonNLS*/;
- case T_short : return "s"/*nonNLS*/;
- case T_Object : return "obj"/*nonNLS*/;}
- return "xxx"/*nonNLS*/;}
-
- public final String operator(int operator){
- switch (operator) {
- case EQUAL_EQUAL : return "=="/*nonNLS*/;
- case LESS_EQUAL : return "<="/*nonNLS*/;
- case GREATER_EQUAL :return ">="/*nonNLS*/;
- case LEFT_SHIFT : return "<<"/*nonNLS*/;
- case RIGHT_SHIFT : return ">>"/*nonNLS*/;
- case UNSIGNED_RIGHT_SHIFT : return ">>>"/*nonNLS*/;
- case OR_OR :return "||"/*nonNLS*/;
- case AND_AND : return "&&"/*nonNLS*/;
- case PLUS : return "+"/*nonNLS*/;
- case MINUS : return "-"/*nonNLS*/;
- case NOT : return "!"/*nonNLS*/;
- case REMAINDER : return "%"/*nonNLS*/;
- case XOR : return "^"/*nonNLS*/;
- case AND : return "&"/*nonNLS*/;
- case MULTIPLY : return "*"/*nonNLS*/;
- case OR : return "|"/*nonNLS*/;
- case TWIDDLE : return "~"/*nonNLS*/;
- case DIVIDE : return "/"/*nonNLS*/;
- case GREATER : return ">"/*nonNLS*/;
- case LESS : return "<"/*nonNLS*/; };
- return "????"/*nonNLS*/;}
- }
-
-
- Decode decode = new Decode();
- String s ;
- s = "\tpublic static void binaryOperationTablesTestCase(){\n"/*nonNLS*/ +
-
- "\t\t//TC test : all binary operation (described in tables)\n"/*nonNLS*/+
- "\t\t//method automatically generated by\n"/*nonNLS*/+
- "\t\t//org.eclipse.jdt.internal.compiler.ast.OperatorExpression.generateTableTestCase();\n"/*nonNLS*/+
-
- "\t\tString str0 ;\t String str\t= "/*nonNLS*/+decode.constant(T_String)+";\n"/*nonNLS*/+
- "\t\tint i0 ;\t int i\t= "/*nonNLS*/+decode.constant(T_int)+" ;\n"/*nonNLS*/+
- "\t\tboolean z0;\t boolean z\t= "/*nonNLS*/+decode.constant(T_boolean)+";\n"/*nonNLS*/+
- "\t\tchar c0; \t char c\t= "/*nonNLS*/+decode.constant(T_char)+" ;\n"/*nonNLS*/+
- "\t\tfloat f0; \t float f\t= "/*nonNLS*/+decode.constant(T_float)+" ;\n"/*nonNLS*/+
- "\t\tdouble d0;\t double d\t= "/*nonNLS*/+decode.constant(T_double)+" ;\n"/*nonNLS*/+
- "\t\tbyte b0; \t byte b\t= "/*nonNLS*/+decode.constant(T_byte)+";\n"/*nonNLS*/+
- "\t\tshort s0; \t short s\t= "/*nonNLS*/+decode.constant(T_short)+";\n"/*nonNLS*/+
- "\t\tlong l0; \t long l\t= "/*nonNLS*/+decode.constant(T_long)+" ;\n"/*nonNLS*/+
- "\t\tObject obj0; \t Object obj\t= "/*nonNLS*/+decode.constant(T_Object)+" ;\n"/*nonNLS*/+
-
- "\n"/*nonNLS*/;
-
- int error = 0;
- for (int i=0; i < operators.length ; i++)
- { int operator = operators[i];
- for (int left=0; left<16;left++)
- for (int right=0; right<16;right++)
- { int result = (ResolveTypeTables[operator][(left<<4)+right]) & 0x0000F;
- if (result != T_undefined)
-
- //1/ First regular computation then 2/ comparaison
- //with a compile time constant (generated by the compiler)
- // z0 = s >= s;
- // if ( z0 != (((short) 5) >= ((short) 5)))
- // System.out.println(155);
-
- { s += "\t\t"/*nonNLS*/+decode.type(result)+"0"/*nonNLS*/+" = "/*nonNLS*/+decode.type(left);
- s += " "/*nonNLS*/+decode.operator(operator)+" "/*nonNLS*/+decode.type(right)+";\n"/*nonNLS*/;
- String begin = result == T_String ? "\t\tif (! "/*nonNLS*/ : "\t\tif ( "/*nonNLS*/;
- String test = result == T_String ? ".equals("/*nonNLS*/ : " != ("/*nonNLS*/ ;
- s += begin +decode.type(result)+"0"/*nonNLS*/+test
- +decode.constant(left)+" "/*nonNLS*/
- +decode.operator(operator)+" "/*nonNLS*/
- +decode.constant(right)+"))\n"/*nonNLS*/;
- s += "\t\t\tSystem.out.println("/*nonNLS*/+ (++error) +");\n"/*nonNLS*/;
-
- }}}
-
- return s += "\n\t\tSystem.out.println(\"binary tables test : done\");}"/*nonNLS*/ ;
- }
-public static final int[] get_AND(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
-
- int[] table = new int[16*16] ;
-
-// table[(T_undefined<<4)+T_undefined] = T_undefined ;
-// table[(T_undefined<<4)+T_byte] = T_undefined ;
-// table[(T_undefined<<4)+T_long] = T_undefined ;
-// table[(T_undefined<<4)+T_short] = T_undefined ;
-// table[(T_undefined<<4)+T_void] = T_undefined ;
-// table[(T_undefined<<4)+T_String] = T_undefined ;
-// table[(T_undefined<<4)+T_Object] = T_undefined ;
-// table[(T_undefined<<4)+T_double] = T_undefined ;
-// table[(T_undefined<<4)+T_float] = T_undefined ;
-// table[(T_undefined<<4)+T_boolean] = T_undefined ;
-// table[(T_undefined<<4)+T_char] = T_undefined ;
-// table[(T_undefined<<4)+T_int] = T_undefined ;
-// table[(T_undefined<<4)+T_null] = T_undefined ;
-
-// table[(T_byte<<4)+T_undefined] = T_undefined ;
- table[(T_byte<<4)+T_byte] = (Byte2Int<<12) +(Byte2Int<<4) +T_int ;
- table[(T_byte<<4)+T_long] = (Byte2Long<<12)+(Long2Long<<4)+T_long ;
- table[(T_byte<<4)+T_short] = (Byte2Int<<12) +(Short2Int<<4)+T_int;
-// table[(T_byte<<4)+T_void] = T_undefined ;
-// table[(T_byte<<4)+T_String] = T_undefined ;
-// table[(T_byte<<4)+T_Object] = T_undefined ;
-// table[(T_byte<<4)+T_double] = T_undefined ;
-// table[(T_byte<<4)+T_float] = T_undefined ;
-// table[(T_byte<<4)+T_boolean] = T_undefined ;
- table[(T_byte<<4)+T_char] = (Byte2Int<<12) +(Char2Int<<4) +T_int ;
- table[(T_byte<<4)+T_int] = (Byte2Int<<12) +(Int2Int<<4) +T_int ;
-// table[(T_byte<<4)+T_null] = T_undefined ;
-
-// table[(T_long<<4)+T_undefined] = T_undefined ;
- table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Long<<4)+T_long;
- table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Long<<4)+T_long ;
- table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Long<<4)+T_long; ;
-// table[(T_long<<4)+T_void] = T_undefined ;
-// table[(T_long<<4)+T_String] = T_undefined ;
-// table[(T_long<<4)+T_Object] = T_undefined ;
-// table[(T_long<<4)+T_double] = T_undefined ;
-// table[(T_long<<4)+T_float] = T_undefined ;
-// table[(T_long<<4)+T_boolean] = T_undefined ;
- table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Long<<4)+T_long ;
- table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Long<<4)+T_long ;
-// table[(T_long<<4)+T_null] = T_undefined ;
-
-// table[(T_short<<4)+T_undefined] = T_undefined ;
- table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_short<<4)+T_long] = (Short2Long<<12)+(Long2Long<<4)+T_long ;
- table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_int ;
-// table[(T_short<<4)+T_void] = T_undefined ;
-// table[(T_short<<4)+T_String] = T_undefined ;
-// table[(T_short<<4)+T_Object] = T_undefined ;
-// table[(T_short<<4)+T_double] = T_undefined ;
-// table[(T_short<<4)+T_float] = T_undefined ;
-// table[(T_short<<4)+T_boolean] = T_undefined ;
- table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_int ;
-// table[(T_short<<4)+T_null] = T_undefined ;
-
-// table[(T_void<<4)+T_undefined] = T_undefined ;
-// table[(T_void<<4)+T_byte] = T_undefined ;
-// table[(T_void<<4)+T_long] = T_undefined ;
-// table[(T_void<<4)+T_short] = T_undefined ;
-// table[(T_void<<4)+T_void] = T_undefined ;
-// table[(T_void<<4)+T_String] = T_undefined ;
-// table[(T_void<<4)+T_Object] = T_undefined ;
-// table[(T_void<<4)+T_double] = T_undefined ;
-// table[(T_void<<4)+T_float] = T_undefined ;
-// table[(T_void<<4)+T_boolean] = T_undefined ;
-// table[(T_void<<4)+T_char] = T_undefined ;
-// table[(T_void<<4)+T_int] = T_undefined ;
-// table[(T_void<<4)+T_null] = T_undefined ;
-
-// table[(T_String<<4)+T_undefined] = T_undefined ;
-// table[(T_String<<4)+T_byte] = T_undefined ;
-// table[(T_String<<4)+T_long] = T_undefined ;
-// table[(T_String<<4)+T_short] = T_undefined ;
-// table[(T_String<<4)+T_void] = T_undefined ;
-// table[(T_String<<4)+T_String] = T_undefined ;
-// table[(T_String<<4)+T_Object] = T_undefined ;
-// table[(T_String<<4)+T_double] = T_undefined ;
-// table[(T_String<<4)+T_float] = T_undefined ;
-// table[(T_String<<4)+T_boolean] = T_undefined ;
-// table[(T_String<<4)+T_char] = T_undefined ;
-// table[(T_String<<4)+T_int] = T_undefined ;
-// table[(T_String<<4)+T_null] = T_undefined ;
-
-// table[(T_Object<<4)+T_undefined] = T_undefined ;
-// table[(T_Object<<4)+T_byte] = T_undefined ;
-// table[(T_Object<<4)+T_long] = T_undefined ;
-// table[(T_Object<<4)+T_short] = T_undefined ;
-// table[(T_Object<<4)+T_void] = T_undefined ;
-// table[(T_Object<<4)+T_String] = T_undefined ;
-// table[(T_Object<<4)+T_Object] = T_undefined ;
-// table[(T_Object<<4)+T_double] = T_undefined ;
-// table[(T_Object<<4)+T_float] = T_undefined ;
-// table[(T_Object<<4)+T_boolean] = T_undefined ;
-// table[(T_Object<<4)+T_char] = T_undefined ;
-// table[(T_Object<<4)+T_int] = T_undefined ;
-// table[(T_Object<<4)+T_null] = T_undefined ;
-
-// table[(T_double<<4)+T_undefined] = T_undefined ;
-// table[(T_double<<4)+T_byte] = T_undefined ;
-// table[(T_double<<4)+T_long] = T_undefined ;
-// table[(T_double<<4)+T_short] = T_undefined ;
-// table[(T_double<<4)+T_void] = T_undefined ;
-// table[(T_double<<4)+T_String] = T_undefined ;
-// table[(T_double<<4)+T_Object] = T_undefined ;
-// table[(T_double<<4)+T_double] = T_undefined ;
-// table[(T_double<<4)+T_float] = T_undefined ;
-// table[(T_double<<4)+T_boolean] = T_undefined ;
-// table[(T_double<<4)+T_char] = T_undefined ;
-// table[(T_double<<4)+T_int] = T_undefined;
-// table[(T_double<<4)+T_null] = T_undefined ;
-
-// table[(T_float<<4)+T_undefined] = T_undefined ;
-// table[(T_float<<4)+T_byte] = T_undefined ;
-// table[(T_float<<4)+T_long] = T_undefined ;
-// table[(T_float<<4)+T_short] = T_undefined ;
-// table[(T_float<<4)+T_void] = T_undefined ;
-// table[(T_float<<4)+T_String] = T_undefined ;
-// table[(T_float<<4)+T_Object] = T_undefined ;
-// table[(T_float<<4)+T_double] = T_undefined ;
-// table[(T_float<<4)+T_float] = T_undefined ;
-// table[(T_float<<4)+T_boolean] = T_undefined ;
-// table[(T_float<<4)+T_char] = T_undefined ;
-// table[(T_float<<4)+T_int] = T_undefined ;
-// table[(T_float<<4)+T_null] = T_undefined ;
-
-// table[(T_boolean<<4)+T_undefined] = T_undefined ;
-// table[(T_boolean<<4)+T_byte] = T_undefined ;
-// table[(T_boolean<<4)+T_long] = T_undefined ;
-// table[(T_boolean<<4)+T_short] = T_undefined ;
-// table[(T_boolean<<4)+T_void] = T_undefined ;
-// table[(T_boolean<<4)+T_String] = T_undefined ;
-// table[(T_boolean<<4)+T_Object] = T_undefined ;
-// table[(T_boolean<<4)+T_double] = T_undefined ;
-// table[(T_boolean<<4)+T_float] = T_undefined ;
- table[(T_boolean<<4)+T_boolean] = (Boolean2Boolean << 12)+(Boolean2Boolean << 4)+T_boolean ;
-// table[(T_boolean<<4)+T_char] = T_undefined ;
-// table[(T_boolean<<4)+T_int] = T_undefined ;
-// table[(T_boolean<<4)+T_null] = T_undefined ;
-
-// table[(T_char<<4)+T_undefined] = T_undefined ;
- table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_char<<4)+T_long] = (Char2Long<<12)+(Long2Long<<4)+T_long;
- table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_int ;
-// table[(T_char<<4)+T_void] = T_undefined ;
-// table[(T_char<<4)+T_String] = T_undefined ;
-// table[(T_char<<4)+T_Object] = T_undefined ;
-// table[(T_char<<4)+T_double] = T_undefined ;
-// table[(T_char<<4)+T_float] = T_undefined ;
-// table[(T_char<<4)+T_boolean] = T_undefined ;
- table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_int ;
-// table[(T_char<<4)+T_null] = T_undefined ;
-
-// table[(T_int<<4)+T_undefined] = T_undefined ;
- table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_int<<4)+T_long] = (Int2Long<<12)+(Long2Long<<4)+T_long ;
- table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_int ;
-// table[(T_int<<4)+T_void] = T_undefined ;
-// table[(T_int<<4)+T_String] = T_undefined ;
-// table[(T_int<<4)+T_Object] = T_undefined ;
-// table[(T_int<<4)+T_double] = T_undefined ;
-// table[(T_int<<4)+T_float] = T_undefined ;
-// table[(T_int<<4)+T_boolean] = T_undefined ;
- table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_int ;
-// table[(T_int<<4)+T_null] = T_undefined ;
-
-// table[(T_null<<4)+T_undefined] = T_undefined ;
-// table[(T_null<<4)+T_byte] = T_undefined ;
-// table[(T_null<<4)+T_long] = T_undefined ;
-// table[(T_null<<4)+T_short] = T_undefined ;
-// table[(T_null<<4)+T_void] = T_undefined ;
-// table[(T_null<<4)+T_String] = T_undefined ;
-// table[(T_null<<4)+T_Object] = T_undefined ;
-// table[(T_null<<4)+T_double] = T_undefined ;
-// table[(T_null<<4)+T_float] = T_undefined ;
-// table[(T_null<<4)+T_boolean] = T_undefined ;
-// table[(T_null<<4)+T_char] = T_undefined ;
-// table[(T_null<<4)+T_int] = T_undefined ;
-// table[(T_null<<4)+T_null] = T_undefined ;
-
- //and now.....the return.........
-
- return table ;
-}
-public static final int[] get_AND_AND(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
-
- int[] table = new int[16*16] ;
-
-// table[(T_undefined<<4)+T_undefined] = T_undefined ;
-// table[(T_undefined<<4)+T_byte] = T_undefined ;
-// table[(T_undefined<<4)+T_long] = T_undefined ;
-// table[(T_undefined<<4)+T_short] = T_undefined ;
-// table[(T_undefined<<4)+T_void] = T_undefined ;
-// table[(T_undefined<<4)+T_String] = T_undefined ;
-// table[(T_undefined<<4)+T_Object] = T_undefined ;
-// table[(T_undefined<<4)+T_double] = T_undefined ;
-// table[(T_undefined<<4)+T_float] = T_undefined ;
-// table[(T_undefined<<4)+T_boolean] = T_undefined ;
-// table[(T_undefined<<4)+T_char] = T_undefined ;
-// table[(T_undefined<<4)+T_int] = T_undefined ;
-// table[(T_undefined<<4)+T_null] = T_undefined ;
-
-// table[(T_byte<<4)+T_undefined] = T_undefined ;
-// table[(T_byte<<4)+T_byte] = T_undefined ;
-// table[(T_byte<<4)+T_long] = T_undefined ;
-// table[(T_byte<<4)+T_short] = T_undefined ;
-// table[(T_byte<<4)+T_void] = T_undefined ;
-// table[(T_byte<<4)+T_String] = T_undefined ;
-// table[(T_byte<<4)+T_Object] = T_undefined ;
-// table[(T_byte<<4)+T_double] = T_undefined ;
-// table[(T_byte<<4)+T_float] = T_undefined ;
-// table[(T_byte<<4)+T_boolean] = T_undefined ;
-// table[(T_byte<<4)+T_char] = T_undefined ;
-// table[(T_byte<<4)+T_int] = T_undefined ;
-// table[(T_byte<<4)+T_null] = T_undefined ;
-
-// table[(T_long<<4)+T_undefined] = T_undefined ;
-// table[(T_long<<4)+T_byte] = T_undefined;
-// table[(T_long<<4)+T_long] = T_undefined ;
-// table[(T_long<<4)+T_short] = T_undefined ;
-// table[(T_long<<4)+T_void] = T_undefined ;
-// table[(T_long<<4)+T_String] = T_undefined ;
-// table[(T_long<<4)+T_Object] = T_undefined ;
-// table[(T_long<<4)+T_double] = T_undefined ;
-// table[(T_long<<4)+T_float] = T_undefined ;
-// table[(T_long<<4)+T_boolean] = T_undefined ;
-// table[(T_long<<4)+T_char] = T_undefined ;
-// table[(T_long<<4)+T_int] = T_undefined ;
-// table[(T_long<<4)+T_null] = T_undefined ;
-
-// table[(T_short<<4)+T_undefined] = T_undefined ;
-// table[(T_short<<4)+T_byte] = T_undefined ;
-// table[(T_short<<4)+T_long] = T_undefined ;
-// table[(T_short<<4)+T_short] = T_undefined ;
-// table[(T_short<<4)+T_void] = T_undefined ;
-// table[(T_short<<4)+T_String] = T_undefined ;
-// table[(T_short<<4)+T_Object] = T_undefined ;
-// table[(T_short<<4)+T_double] = T_undefined ;
-// table[(T_short<<4)+T_float] = T_undefined ;
-// table[(T_short<<4)+T_boolean] = T_undefined ;
-// table[(T_short<<4)+T_char] = T_undefined ;
-// table[(T_short<<4)+T_int] = T_undefined ;
-// table[(T_short<<4)+T_null] = T_undefined ;
-
-// table[(T_void<<4)+T_undefined] = T_undefined ;
-// table[(T_void<<4)+T_byte] = T_undefined ;
-// table[(T_void<<4)+T_long] = T_undefined ;
-// table[(T_void<<4)+T_short] = T_undefined ;
-// table[(T_void<<4)+T_void] = T_undefined ;
-// table[(T_void<<4)+T_String] = T_undefined ;
-// table[(T_void<<4)+T_Object] = T_undefined ;
-// table[(T_void<<4)+T_double] = T_undefined ;
-// table[(T_void<<4)+T_float] = T_undefined ;
-// table[(T_void<<4)+T_boolean] = T_undefined ;
-// table[(T_void<<4)+T_char] = T_undefined ;
-// table[(T_void<<4)+T_int] = T_undefined ;
-// table[(T_void<<4)+T_null] = T_undefined ;
-
-// table[(T_String<<4)+T_undefined] = T_undefined ;
-// table[(T_String<<4)+T_byte] = T_undefined ;
-// table[(T_String<<4)+T_long] = T_undefined ;
-// table[(T_String<<4)+T_short] = T_undefined ;
-// table[(T_String<<4)+T_void] = T_undefined ;
-// table[(T_String<<4)+T_String] = T_undefined ;
-// table[(T_String<<4)+T_Object] = T_undefined ;
-// table[(T_String<<4)+T_double] = T_undefined ;
-// table[(T_String<<4)+T_float] = T_undefined ;
-// table[(T_String<<4)+T_boolean] = T_undefined ;
-// table[(T_String<<4)+T_char] = T_undefined ;
-// table[(T_String<<4)+T_int] = T_undefined ;
-// table[(T_String<<4)+T_null] = T_undefined ;
-
-// table[(T_Object<<4)+T_undefined] = T_undefined ;
-// table[(T_Object<<4)+T_byte] = T_undefined ;
-// table[(T_Object<<4)+T_long] = T_undefined ;
-// table[(T_Object<<4)+T_short] = T_undefined ;
-// table[(T_Object<<4)+T_void] = T_undefined ;
-// table[(T_Object<<4)+T_String] = T_undefined ;
-// table[(T_Object<<4)+T_Object] = T_undefined ;
-// table[(T_Object<<4)+T_double] = T_undefined ;
-// table[(T_Object<<4)+T_float] = T_undefined ;
-// table[(T_Object<<4)+T_boolean] = T_undefined ;
-// table[(T_Object<<4)+T_char] = T_undefined ;
-// table[(T_Object<<4)+T_int] = T_undefined ;
-// table[(T_Object<<4)+T_null] = T_undefined ;
-
-// table[(T_double<<4)+T_undefined] = T_undefined ;
-// table[(T_double<<4)+T_byte] = T_undefined ;
-// table[(T_double<<4)+T_long] = T_undefined ;
-// table[(T_double<<4)+T_short] = T_undefined ;
-// table[(T_double<<4)+T_void] = T_undefined ;
-// table[(T_double<<4)+T_String] = T_undefined ;
-// table[(T_double<<4)+T_Object] = T_undefined ;
-// table[(T_double<<4)+T_double] = T_undefined ;
-// table[(T_double<<4)+T_float] = T_undefined ;
-// table[(T_double<<4)+T_boolean] = T_undefined ;
-// table[(T_double<<4)+T_char] = T_undefined ;
-// table[(T_double<<4)+T_int] = T_undefined;
-// table[(T_double<<4)+T_null] = T_undefined ;
-
-// table[(T_float<<4)+T_undefined] = T_undefined ;
-// table[(T_float<<4)+T_byte] = T_undefined ;
-// table[(T_float<<4)+T_long] = T_undefined ;
-// table[(T_float<<4)+T_short] = T_undefined ;
-// table[(T_float<<4)+T_void] = T_undefined ;
-// table[(T_float<<4)+T_String] = T_undefined ;
-// table[(T_float<<4)+T_Object] = T_undefined ;
-// table[(T_float<<4)+T_double] = T_undefined ;
-// table[(T_float<<4)+T_float] = T_undefined ;
-// table[(T_float<<4)+T_boolean] = T_undefined ;
-// table[(T_float<<4)+T_char] = T_undefined ;
-// table[(T_float<<4)+T_int] = T_undefined ;
-// table[(T_float<<4)+T_null] = T_undefined ;
-
-// table[(T_boolean<<4)+T_undefined] = T_undefined ;
-// table[(T_boolean<<4)+T_byte] = T_undefined ;
-// table[(T_boolean<<4)+T_long] = T_undefined ;
-// table[(T_boolean<<4)+T_short] = T_undefined ;
-// table[(T_boolean<<4)+T_void] = T_undefined ;
-// table[(T_boolean<<4)+T_String] = T_undefined ;
-// table[(T_boolean<<4)+T_Object] = T_undefined ;
-// table[(T_boolean<<4)+T_double] = T_undefined ;
-// table[(T_boolean<<4)+T_float] = T_undefined ;
- table[(T_boolean<<4)+T_boolean] = (Boolean2Boolean<<12)+(Boolean2Boolean<<4)+T_boolean ;
-// table[(T_boolean<<4)+T_char] = T_undefined ;
-// table[(T_boolean<<4)+T_int] = T_undefined ;
-// table[(T_boolean<<4)+T_null] = T_undefined ;
-
-// table[(T_char<<4)+T_undefined] = T_undefined ;
-// table[(T_char<<4)+T_byte] = T_undefined ;
-// table[(T_char<<4)+T_long] = T_undefined;
-// table[(T_char<<4)+T_short] = T_undefined ;
-// table[(T_char<<4)+T_void] = T_undefined ;
-// table[(T_char<<4)+T_String] = T_undefined ;
-// table[(T_char<<4)+T_Object] = T_undefined ;
-// table[(T_char<<4)+T_double] = T_undefined ;
-// table[(T_char<<4)+T_float] = T_undefined ;
-// table[(T_char<<4)+T_boolean] = T_undefined ;
-// table[(T_char<<4)+T_char] = T_undefined ;
-// table[(T_char<<4)+T_int] = T_undefined ;
-// table[(T_char<<4)+T_null] = T_undefined ;
-
-// table[(T_int<<4)+T_undefined] = T_undefined ;
-// table[(T_int<<4)+T_byte] = T_undefined ;
-// table[(T_int<<4)+T_long] = T_undefined ;
-// table[(T_int<<4)+T_short] = T_undefined ;
-// table[(T_int<<4)+T_void] = T_undefined ;
-// table[(T_int<<4)+T_String] = T_undefined ;
-// table[(T_int<<4)+T_Object] = T_undefined ;
-// table[(T_int<<4)+T_double] = T_undefined ;
-// table[(T_int<<4)+T_float] = T_undefined ;
-// table[(T_int<<4)+T_boolean] = T_undefined ;
-// table[(T_int<<4)+T_char] = T_undefined ;
-// table[(T_int<<4)+T_int] = T_undefined ;
-// table[(T_int<<4)+T_null] = T_undefined ;
-
-// table[(T_null<<4)+T_undefined] = T_undefined ;
-// table[(T_null<<4)+T_byte] = T_undefined ;
-// table[(T_null<<4)+T_long] = T_undefined ;
-// table[(T_null<<4)+T_short] = T_undefined ;
-// table[(T_null<<4)+T_void] = T_undefined ;
-// table[(T_null<<4)+T_String] = T_undefined ;
-// table[(T_null<<4)+T_Object] = T_undefined ;
-// table[(T_null<<4)+T_double] = T_undefined ;
-// table[(T_null<<4)+T_float] = T_undefined ;
-// table[(T_null<<4)+T_boolean] = T_undefined ;
-// table[(T_null<<4)+T_char] = T_undefined ;
-// table[(T_null<<4)+T_int] = T_undefined ;
-// table[(T_null<<4)+T_null] = T_undefined ;
-
- //and now.....the return.........
-
- return table ;
-}
-public static final int[] get_DIVIDE(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
-
-// int[] table = new int[16*16] ;
-
- return get_MINUS();
-
-// return table ;
-}
-public static final int[] get_EQUAL_EQUAL(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
- int[] table = new int[16*16] ;
-
-// table[(T_undefined<<4)+T_undefined] = T_undefined ;
-// table[(T_undefined<<4)+T_byte] = T_undefined ;
-// table[(T_undefined<<4)+T_long] = T_undefined ;
-// table[(T_undefined<<4)+T_short] = T_undefined ;
-// table[(T_undefined<<4)+T_void] = T_undefined ;
-// table[(T_undefined<<4)+T_String] = T_undefined ;
-// table[(T_undefined<<4)+T_Object] = T_undefined ;
-// table[(T_undefined<<4)+T_double] = T_undefined ;
-// table[(T_undefined<<4)+T_float] = T_undefined ;
-// table[(T_undefined<<4)+T_boolean] = T_undefined ;
-// table[(T_undefined<<4)+T_char] = T_undefined ;
-// table[(T_undefined<<4)+T_int] = T_undefined ;
-// table[(T_undefined<<4)+T_null] = T_undefined ;
-
-// table[(T_byte<<4)+T_undefined] = T_undefined ;
- table[(T_byte<<4)+T_byte] = (Byte2Int<<12)+(Byte2Int<<4)+T_boolean ;
- table[(T_byte<<4)+T_long] = (Byte2Long<<12)+(Long2Long<<4)+T_boolean ;
- table[(T_byte<<4)+T_short] = (Byte2Int<<12)+(Short2Int<<4)+T_boolean ;
-// table[(T_byte<<4)+T_void] = T_undefined ;
-// table[(T_byte<<4)+T_String] = T_undefined ;
-// table[(T_byte<<4)+T_Object] = T_undefined ;
- table[(T_byte<<4)+T_double] = (Byte2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_byte<<4)+T_float] = (Byte2Float<<12)+(Float2Float<<4)+T_boolean;
-// table[(T_byte<<4)+T_boolean] = T_undefined ;
- table[(T_byte<<4)+T_char] = (Byte2Int<<12)+(Char2Int<<4)+T_boolean ;
- table[(T_byte<<4)+T_int] = (Byte2Int<<12)+(Int2Int<<4)+T_boolean;
-// table[(T_byte<<4)+T_null] = T_undefined ;
-
-// table[(T_long<<4)+T_undefined] = T_undefined ;
- table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Long<<4)+T_boolean;
- table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Long<<4)+T_boolean ;
- table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Long<<4)+T_boolean ;
-// table[(T_long<<4)+T_void] = T_undefined ;
-// table[(T_long<<4)+T_String] = T_undefined ;
-// table[(T_long<<4)+T_Object] = T_undefined ;
- table[(T_long<<4)+T_double] = (Long2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_long<<4)+T_float] = (Long2Float<<12)+(Float2Float<<4)+T_boolean ;
-// table[(T_long<<4)+T_boolean] = T_undefined ;
- table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Long<<4)+T_boolean ;
- table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Long<<4)+T_boolean ;
-// table[(T_long<<4)+T_null] = T_undefined ;
-
-// table[(T_short<<4)+T_undefined] = T_undefined ;
- table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_boolean ;
- table[(T_short<<4)+T_long] = (Short2Long<<12)+(Long2Long<<4)+T_boolean ;
- table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_boolean ;
-// table[(T_short<<4)+T_void] = T_undefined ;
-// table[(T_short<<4)+T_String] = T_undefined ;
-// table[(T_short<<4)+T_Object] = T_undefined ;
- table[(T_short<<4)+T_double] = (Short2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_short<<4)+T_float] = (Short2Float<<12)+(Float2Float<<4)+T_boolean ;
-// table[(T_short<<4)+T_boolean] = T_undefined ;
- table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_boolean ;
- table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_boolean ;
-// table[(T_short<<4)+T_null] = T_undefined ;
-
-// table[(T_void<<4)+T_undefined] = T_undefined ;
-// table[(T_void<<4)+T_byte] = T_undefined ;
-// table[(T_void<<4)+T_long] = T_undefined ;
-// table[(T_void<<4)+T_short] = T_undefined ;
-// table[(T_void<<4)+T_void] = T_undefined ;
-// table[(T_void<<4)+T_String] = T_undefined ;
-// table[(T_void<<4)+T_Object] = T_undefined ;
-// table[(T_void<<4)+T_double] = T_undefined ;
-// table[(T_void<<4)+T_float] = T_undefined ;
-// table[(T_void<<4)+T_boolean] = T_undefined ;
-// table[(T_void<<4)+T_char] = T_undefined ;
-// table[(T_void<<4)+T_int] = T_undefined ;
-// table[(T_void<<4)+T_null] = T_undefined ;
-
-// table[(T_String<<4)+T_undefined] = T_undefined ;
-// table[(T_String<<4)+T_byte] = T_undefined ;
-// table[(T_String<<4)+T_long] = T_undefined ;
-// table[(T_String<<4)+T_short] = T_undefined ;
-// table[(T_String<<4)+T_void] = T_undefined ;
- table[(T_String<<4)+T_String] = /*String2Object String2Object*/
- (T_Object<<16)+(T_String<<12)+(T_Object<<8)+(T_String<<4)+T_boolean ;
- table[(T_String<<4)+T_Object] = /*String2Object Object2Object*/
- (T_Object<<16)+(T_String<<12)+(T_Object<<8)+(T_Object<<4)+T_boolean ;
-// table[(T_String<<4)+T_double] = T_undefined ;
-// table[(T_String<<4)+T_float] = T_undefined ;
-// table[(T_String<<4)+T_boolean] = T_undefined ;
-// table[(T_String<<4)+T_char] = T_undefined ;
-// table[(T_String<<4)+T_int] = T_undefined ;
- table[(T_String<<4)+T_null] = /*Object2String null2Object */
- (T_Object<<16)+(T_String<<12)+(T_Object<<8)+(T_null<<4)+T_boolean ;
-
-// table[(T_Object<<4)+T_undefined] = T_undefined ;
-// table[(T_Object<<4)+T_byte] = T_undefined ;
-// table[(T_Object<<4)+T_long] = T_undefined ;
-// table[(T_Object<<4)+T_short] = T_undefined ;
-// table[(T_Object<<4)+T_void] = T_undefined ;
- table[(T_Object<<4)+T_String] = /*Object2Object String2Object*/
- (T_Object<<16)+(T_Object<<12)+(T_Object<<8)+(T_String<<4)+T_boolean ;
- table[(T_Object<<4)+T_Object] = /*Object2Object Object2Object*/
- (T_Object<<16)+(T_Object<<12)+(T_Object<<8)+(T_Object<<4)+T_boolean ;
-// table[(T_Object<<4)+T_double] = T_undefined ;
-// table[(T_Object<<4)+T_float] = T_undefined ;
-// table[(T_Object<<4)+T_boolean] = T_undefined ;
-// table[(T_Object<<4)+T_char] = T_undefined ;
-// table[(T_Object<<4)+T_int] = T_undefined ;
- table[(T_Object<<4)+T_null] = /*Object2Object null2Object*/
- (T_Object<<16)+(T_Object<<12)+(T_Object<<8)+(T_null<<4)+T_boolean ;
-
-// table[(T_double<<4)+T_undefined] = T_undefined ;
- table[(T_double<<4)+T_byte] = (Double2Double<<12)+(Byte2Double<<4)+T_boolean ;
- table[(T_double<<4)+T_long] = (Double2Double<<12)+(Long2Double<<4)+T_boolean ;
- table[(T_double<<4)+T_short] = (Double2Double<<12)+(Short2Double<<4)+T_boolean ;
-// table[(T_double<<4)+T_void] = T_undefined ;
-// table[(T_double<<4)+T_String] = T_undefined ;
-// table[(T_double<<4)+T_Object] = T_undefined ;
- table[(T_double<<4)+T_double] = (Double2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_double<<4)+T_float] = (Double2Double<<12)+(Float2Double<<4)+T_boolean;
-// table[(T_double<<4)+T_boolean] = T_undefined ;
- table[(T_double<<4)+T_char] = (Double2Double<<12)+(Char2Double<<4)+T_boolean ;
- table[(T_double<<4)+T_int] = (Double2Double<<12)+(Int2Double<<4)+T_boolean ;
-// table[(T_double<<4)+T_null] = T_undefined ;
-
-// table[(T_float<<4)+T_undefined] = T_undefined ;
- table[(T_float<<4)+T_byte] = (Float2Float<<12)+(Byte2Float<<4)+T_boolean ;
- table[(T_float<<4)+T_long] = (Float2Float<<12)+(Long2Float<<4)+T_boolean ;
- table[(T_float<<4)+T_short] = (Float2Float<<12)+(Short2Float<<4)+T_boolean ;
-// table[(T_float<<4)+T_void] = T_undefined ;
-// table[(T_float<<4)+T_String] = T_undefined ;
-// table[(T_float<<4)+T_Object] = T_undefined ;
- table[(T_float<<4)+T_double] = (Float2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_float<<4)+T_float] = (Float2Float<<12)+(Float2Float<<4)+T_boolean ;
-// table[(T_float<<4)+T_boolean] = T_undefined ;
- table[(T_float<<4)+T_char] = (Float2Float<<12)+(Char2Float<<4)+T_boolean ;
- table[(T_float<<4)+T_int] = (Float2Float<<12)+(Int2Float<<4)+T_boolean ;
-// table[(T_float<<4)+T_null] = T_undefined ;
-
-// table[(T_boolean<<4)+T_undefined] = T_undefined ;
-// table[(T_boolean<<4)+T_byte] = T_undefined ;
-// table[(T_boolean<<4)+T_long] = T_undefined ;
-// table[(T_boolean<<4)+T_short] = T_undefined ;
-// table[(T_boolean<<4)+T_void] = T_undefined ;
-// table[(T_boolean<<4)+T_String] = T_undefined ;
-// table[(T_boolean<<4)+T_Object] = T_undefined ;
-// table[(T_boolean<<4)+T_double] = T_undefined ;
-// table[(T_boolean<<4)+T_float] = T_undefined ;
- table[(T_boolean<<4)+T_boolean] = (Boolean2Boolean<<12)+(Boolean2Boolean<<4)+T_boolean ;
-// table[(T_boolean<<4)+T_char] = T_undefined ;
-// table[(T_boolean<<4)+T_int] = T_undefined ;
-// table[(T_boolean<<4)+T_null] = T_undefined ;
-
-// table[(T_char<<4)+T_undefined] = T_undefined ;
- table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_boolean ;
- table[(T_char<<4)+T_long] = (Char2Long<<12)+(Long2Long<<4)+T_boolean ;
- table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_boolean ;
-// table[(T_char<<4)+T_void] = T_undefined ;
-// table[(T_char<<4)+T_String] = T_undefined ;
-// table[(T_char<<4)+T_Object] = T_undefined ;
- table[(T_char<<4)+T_double] = (Char2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_char<<4)+T_float] = (Char2Float<<12)+(Float2Float<<4)+T_boolean ;
-// table[(T_char<<4)+T_boolean] = T_undefined ;
- table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_boolean ;
- table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_boolean ;
-// table[(T_char<<4)+T_null] = T_undefined ;
-
-// table[(T_int<<4)+T_undefined] = T_undefined ;
- table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_boolean ;
- table[(T_int<<4)+T_long] = (Int2Long<<12)+(Long2Long<<4)+T_boolean ;
- table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_boolean ;
-// table[(T_int<<4)+T_void] = T_undefined ;
-// table[(T_int<<4)+T_String] = T_undefined ;
-// table[(T_int<<4)+T_Object] = T_undefined ;
- table[(T_int<<4)+T_double] = (Int2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_int<<4)+T_float] = (Int2Float<<12)+(Float2Float<<4)+T_boolean;
-// table[(T_int<<4)+T_boolean] = T_undefined ;
- table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_boolean ;
- table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_boolean ;
-// table[(T_int<<4)+T_null] = T_undefined ;
-
-// table[(T_null<<4)+T_undefined] = T_undefined ;
-// table[(T_null<<4)+T_byte] = T_undefined ;
-// table[(T_null<<4)+T_long] = T_undefined ;
-// table[(T_null<<4)+T_short] = T_undefined ;
-// table[(T_null<<4)+T_void] = T_undefined ;
- table[(T_null<<4)+T_String] = /*null2Object String2Object*/
- (T_Object<<16)+(T_null<<12)+(T_Object<<8)+(T_String<<4)+T_boolean ;
- table[(T_null<<4)+T_Object] = /*null2Object Object2Object*/
- (T_Object<<16)+(T_null<<12)+(T_Object<<8)+(T_Object<<4)+T_boolean ; ;
-// table[(T_null<<4)+T_double] = T_undefined ;
-// table[(T_null<<4)+T_float] = T_undefined ;
-// table[(T_null<<4)+T_boolean] = T_undefined ;
-// table[(T_null<<4)+T_char] = T_undefined ;
-// table[(T_null<<4)+T_int] = T_undefined ;
- table[(T_null<<4)+T_null] = /*null2Object null2Object*/
- (T_Object<<16)+(T_null<<12)+(T_Object<<8)+(T_null<<4)+T_boolean ;
- //and now.....the return.........
-
- return table ;
-}
-public static final int[] get_GREATER(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
-
-// int[] table = new int[16*16] ;
-
- return get_LESS();
-
-// return table ;
-}
-public static final int[] get_GREATER_EQUAL(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
-
-// int[] table = new int[16*16] ;
-
- return get_LESS();
-
-// return table ;
-}
-public static final int[] get_LEFT_SHIFT(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
-
- int[] table = new int[16*16] ;
-
-// table[(T_undefined<<4)+T_undefined] = T_undefined ;
-// table[(T_undefined<<4)+T_byte] = T_undefined ;
-// table[(T_undefined<<4)+T_long] = T_undefined ;
-// table[(T_undefined<<4)+T_short] = T_undefined ;
-// table[(T_undefined<<4)+T_void] = T_undefined ;
-// table[(T_undefined<<4)+T_String] = T_undefined ;
-// table[(T_undefined<<4)+T_Object] = T_undefined ;
-// table[(T_undefined<<4)+T_double] = T_undefined ;
-// table[(T_undefined<<4)+T_float] = T_undefined ;
-// table[(T_undefined<<4)+T_boolean] = T_undefined ;
-// table[(T_undefined<<4)+T_char] = T_undefined ;
-// table[(T_undefined<<4)+T_int] = T_undefined ;
-// table[(T_undefined<<4)+T_null] = T_undefined ;
-
-// table[(T_byte<<4)+T_undefined] = T_undefined ;
- table[(T_byte<<4)+T_byte] = (Byte2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_byte<<4)+T_long] = (Byte2Int<<12)+(Long2Int<<4)+T_int ;
- table[(T_byte<<4)+T_short] = (Byte2Int<<12)+(Short2Int<<4)+T_int ;
-// table[(T_byte<<4)+T_void] = T_undefined ;
-// table[(T_byte<<4)+T_String] = T_undefined ;
-// table[(T_byte<<4)+T_Object] = T_undefined ;
-// table[(T_byte<<4)+T_double] = T_undefined ;
-// table[(T_byte<<4)+T_float] = T_undefined ;
-// table[(T_byte<<4)+T_boolean] = T_undefined ;
- table[(T_byte<<4)+T_char] = (Byte2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_byte<<4)+T_int] = (Byte2Int<<12)+(Int2Int<<4)+T_int ;
-// table[(T_byte<<4)+T_null] = T_undefined ;
-
-// table[(T_long<<4)+T_undefined] = T_undefined ;
- table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Int<<4)+T_long;
- table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Int<<4)+T_long ;
- table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Int<<4)+T_long ;
-// table[(T_long<<4)+T_void] = T_undefined ;
-// table[(T_long<<4)+T_String] = T_undefined ;
-// table[(T_long<<4)+T_Object] = T_undefined ;
-// table[(T_long<<4)+T_double] = T_undefined ;
-// table[(T_long<<4)+T_float] = T_undefined ;
-// table[(T_long<<4)+T_boolean] = T_undefined ;
- table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Int<<4)+T_long ;
- table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Int<<4)+T_long ;
-// table[(T_long<<4)+T_null] = T_undefined ;
-
-// table[(T_short<<4)+T_undefined] = T_undefined ;
- table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_short<<4)+T_long] = (Short2Int<<12)+(Long2Int<<4)+T_int ;
- table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_int ;
-// table[(T_short<<4)+T_void] = T_undefined ;
-// table[(T_short<<4)+T_String] = T_undefined ;
-// table[(T_short<<4)+T_Object] = T_undefined ;
-// table[(T_short<<4)+T_double] = T_undefined ;
-// table[(T_short<<4)+T_float] = T_undefined ;
-// table[(T_short<<4)+T_boolean] = T_undefined ;
- table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_int ;
-// table[(T_short<<4)+T_null] = T_undefined ;
-
-// table[(T_void<<4)+T_undefined] = T_undefined ;
-// table[(T_void<<4)+T_byte] = T_undefined ;
-// table[(T_void<<4)+T_long] = T_undefined ;
-// table[(T_void<<4)+T_short] = T_undefined ;
-// table[(T_void<<4)+T_void] = T_undefined ;
-// table[(T_void<<4)+T_String] = T_undefined ;
-// table[(T_void<<4)+T_Object] = T_undefined ;
-// table[(T_void<<4)+T_double] = T_undefined ;
-// table[(T_void<<4)+T_float] = T_undefined ;
-// table[(T_void<<4)+T_boolean] = T_undefined ;
-// table[(T_void<<4)+T_char] = T_undefined ;
-// table[(T_void<<4)+T_int] = T_undefined ;
-// table[(T_void<<4)+T_null] = T_undefined ;
-
-// table[(T_String<<4)+T_undefined] = T_undefined ;
-// table[(T_String<<4)+T_byte] = T_undefined ;
-// table[(T_String<<4)+T_long] = T_undefined ;
-// table[(T_String<<4)+T_short] = T_undefined ;
-// table[(T_String<<4)+T_void] = T_undefined ;
-// table[(T_String<<4)+T_String] = T_undefined ;
-// table[(T_String<<4)+T_Object] = T_undefined ;
-// table[(T_String<<4)+T_double] = T_undefined ;
-// table[(T_String<<4)+T_float] = T_undefined ;
-// table[(T_String<<4)+T_boolean] = T_undefined ;
-// table[(T_String<<4)+T_char] = T_undefined ;
-// table[(T_String<<4)+T_int] = T_undefined ;
-// table[(T_String<<4)+T_null] = T_undefined ;
-
-// table[(T_Object<<4)+T_undefined] = T_undefined ;
-// table[(T_Object<<4)+T_byte] = T_undefined ;
-// table[(T_Object<<4)+T_long] = T_undefined ;
-// table[(T_Object<<4)+T_short] = T_undefined ;
-// table[(T_Object<<4)+T_void] = T_undefined ;
-// table[(T_Object<<4)+T_String] = T_undefined ;
-// table[(T_Object<<4)+T_Object] = T_undefined ;
-// table[(T_Object<<4)+T_double] = T_undefined ;
-// table[(T_Object<<4)+T_float] = T_undefined ;
-// table[(T_Object<<4)+T_boolean] = T_undefined ;
-// table[(T_Object<<4)+T_char] = T_undefined ;
-// table[(T_Object<<4)+T_int] = T_undefined ;
-// table[(T_Object<<4)+T_null] = T_undefined ;
-
-// table[(T_double<<4)+T_undefined] = T_undefined ;
-// table[(T_double<<4)+T_byte] = T_undefined ;
-// table[(T_double<<4)+T_long] = T_undefined ;
-// table[(T_double<<4)+T_short] = T_undefined ;
-// table[(T_double<<4)+T_void] = T_undefined ;
-// table[(T_double<<4)+T_String] = T_undefined ;
-// table[(T_double<<4)+T_Object] = T_undefined ;
-// table[(T_double<<4)+T_double] = T_undefined ;
-// table[(T_double<<4)+T_float] = T_undefined ;
-// table[(T_double<<4)+T_boolean] = T_undefined ;
-// table[(T_double<<4)+T_char] = T_undefined ;
-// table[(T_double<<4)+T_int] = T_undefined;
-// table[(T_double<<4)+T_null] = T_undefined ;
-
-// table[(T_float<<4)+T_undefined] = T_undefined ;
-// table[(T_float<<4)+T_byte] = T_undefined ;
-// table[(T_float<<4)+T_long] = T_undefined ;
-// table[(T_float<<4)+T_short] = T_undefined ;
-// table[(T_float<<4)+T_void] = T_undefined ;
-// table[(T_float<<4)+T_String] = T_undefined ;
-// table[(T_float<<4)+T_Object] = T_undefined ;
-// table[(T_float<<4)+T_double] = T_undefined ;
-// table[(T_float<<4)+T_float] = T_undefined ;
-// table[(T_float<<4)+T_boolean] = T_undefined ;
-// table[(T_float<<4)+T_char] = T_undefined ;
-// table[(T_float<<4)+T_int] = T_undefined ;
-// table[(T_float<<4)+T_null] = T_undefined ;
-
-// table[(T_boolean<<4)+T_undefined] = T_undefined ;
-// table[(T_boolean<<4)+T_byte] = T_undefined ;
-// table[(T_boolean<<4)+T_long] = T_undefined ;
-// table[(T_boolean<<4)+T_short] = T_undefined ;
-// table[(T_boolean<<4)+T_void] = T_undefined ;
-// table[(T_boolean<<4)+T_String] = T_undefined ;
-// table[(T_boolean<<4)+T_Object] = T_undefined ;
-// table[(T_boolean<<4)+T_double] = T_undefined ;
-// table[(T_boolean<<4)+T_float] = T_undefined ;
-// table[(T_boolean<<4)+T_boolean] = T_undefined ;
-// table[(T_boolean<<4)+T_char] = T_undefined ;
-// table[(T_boolean<<4)+T_int] = T_undefined ;
-// table[(T_boolean<<4)+T_null] = T_undefined ;
-
-// table[(T_char<<4)+T_undefined] = T_undefined ;
- table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_char<<4)+T_long] = (Char2Int<<12)+(Long2Int<<4)+T_int ;
- table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_int ;
-// table[(T_char<<4)+T_void] = T_undefined ;
-// table[(T_char<<4)+T_String] = T_undefined ;
-// table[(T_char<<4)+T_Object] = T_undefined ;
-// table[(T_char<<4)+T_double] = T_undefined ;
-// table[(T_char<<4)+T_float] = T_undefined ;
-// table[(T_char<<4)+T_boolean] = T_undefined ;
- table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_int ;
-// table[(T_char<<4)+T_null] = T_undefined ;
-
-// table[(T_int<<4)+T_undefined] = T_undefined ;
- table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_int<<4)+T_long] = (Int2Int<<12)+(Long2Int<<4)+T_int ;
- table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_int ;
-// table[(T_int<<4)+T_void] = T_undefined ;
-// table[(T_int<<4)+T_String] = T_undefined ;
-// table[(T_int<<4)+T_Object] = T_undefined ;
-// table[(T_int<<4)+T_double] = T_undefined ;
-// table[(T_int<<4)+T_float] = T_undefined ;
-// table[(T_int<<4)+T_boolean] = T_undefined ;
- table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_int ;
-// table[(T_int<<4)+T_null] = T_undefined ;
-
-// table[(T_null<<4)+T_undefined] = T_undefined ;
-// table[(T_null<<4)+T_byte] = T_undefined ;
-// table[(T_null<<4)+T_long] = T_undefined ;
-// table[(T_null<<4)+T_short] = T_undefined ;
-// table[(T_null<<4)+T_void] = T_undefined ;
-// table[(T_null<<4)+T_String] = T_undefined ;
-// table[(T_null<<4)+T_Object] = T_undefined ;
-// table[(T_null<<4)+T_double] = T_undefined ;
-// table[(T_null<<4)+T_float] = T_undefined ;
-// table[(T_null<<4)+T_boolean] = T_undefined ;
-// table[(T_null<<4)+T_char] = T_undefined ;
-// table[(T_null<<4)+T_int] = T_undefined ;
-// table[(T_null<<4)+T_null] = T_undefined ;
-
- //and now.....the return.........
-
- return table ;
-}
-public static final int[] get_LESS(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
-
- int[] table = new int[16*16] ;
-
-// table[(T_undefined<<4)+T_undefined] = T_undefined ;
-// table[(T_undefined<<4)+T_byte] = T_undefined ;
-// table[(T_undefined<<4)+T_long] = T_undefined ;
-// table[(T_undefined<<4)+T_short] = T_undefined ;
-// table[(T_undefined<<4)+T_void] = T_undefined ;
-// table[(T_undefined<<4)+T_String] = T_undefined ;
-// table[(T_undefined<<4)+T_Object] = T_undefined ;
-// table[(T_undefined<<4)+T_double] = T_undefined ;
-// table[(T_undefined<<4)+T_float] = T_undefined ;
-// table[(T_undefined<<4)+T_boolean] = T_undefined ;
-// table[(T_undefined<<4)+T_char] = T_undefined ;
-// table[(T_undefined<<4)+T_int] = T_undefined ;
-// table[(T_undefined<<4)+T_null] = T_undefined ;
-
-// table[(T_byte<<4)+T_undefined] = T_undefined ;
- table[(T_byte<<4)+T_byte] = (Byte2Int<<12)+(Byte2Int<<4)+T_boolean ;
- table[(T_byte<<4)+T_long] = (Byte2Long<<12)+(Long2Long<<4)+T_boolean ;
- table[(T_byte<<4)+T_short] = (Byte2Int<<12)+(Short2Int<<4)+T_boolean ;
-// table[(T_byte<<4)+T_void] = T_undefined ;
-// table[(T_byte<<4)+T_String] = T_undefined ;
-// table[(T_byte<<4)+T_Object] = T_undefined ;
- table[(T_byte<<4)+T_double] = (Byte2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_byte<<4)+T_float] = (Byte2Float<<12)+(Float2Float<<4)+T_boolean;
-// table[(T_byte<<4)+T_boolean] = T_undefined ;
- table[(T_byte<<4)+T_char] = (Byte2Int<<12)+(Char2Int<<4)+T_boolean ;
- table[(T_byte<<4)+T_int] = (Byte2Int<<12)+(Int2Int<<4)+T_boolean ;
-// table[(T_byte<<4)+T_null] = T_undefined ;
-
-// table[(T_long<<4)+T_undefined] = T_undefined ;
- table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Long<<4)+T_boolean;
- table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Long<<4)+T_boolean ;
- table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Long<<4)+T_boolean ;
-// table[(T_long<<4)+T_void] = T_undefined ;
-// table[(T_long<<4)+T_String] = T_undefined ;
-// table[(T_long<<4)+T_Object] = T_undefined ;
- table[(T_long<<4)+T_double] = (Long2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_long<<4)+T_float] = (Long2Float<<12)+(Float2Float<<4)+T_boolean ;
-// table[(T_long<<4)+T_boolean] = T_undefined ;
- table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Long<<4)+T_boolean ;
- table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Long<<4)+T_boolean ;
-// table[(T_long<<4)+T_null] = T_undefined ;
-
-// table[(T_short<<4)+T_undefined] = T_undefined ;
- table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_boolean ;
- table[(T_short<<4)+T_long] = (Short2Long<<12)+(Long2Long<<4)+T_boolean ;
- table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_boolean ;
-// table[(T_short<<4)+T_void] = T_undefined ;
-// table[(T_short<<4)+T_String] = T_undefined ;
-// table[(T_short<<4)+T_Object] = T_undefined ;
- table[(T_short<<4)+T_double] = (Short2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_short<<4)+T_float] = (Short2Float<<12)+(Float2Float<<4)+T_boolean ;
-// table[(T_short<<4)+T_boolean] = T_undefined ;
- table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_boolean ;
- table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_boolean ;
-// table[(T_short<<4)+T_null] = T_undefined ;
-
-// table[(T_void<<4)+T_undefined] = T_undefined ;
-// table[(T_void<<4)+T_byte] = T_undefined ;
-// table[(T_void<<4)+T_long] = T_undefined ;
-// table[(T_void<<4)+T_short] = T_undefined ;
-// table[(T_void<<4)+T_void] = T_undefined ;
-// table[(T_void<<4)+T_String] = T_undefined ;
-// table[(T_void<<4)+T_Object] = T_undefined ;
-// table[(T_void<<4)+T_double] = T_undefined ;
-// table[(T_void<<4)+T_float] = T_undefined ;
-// table[(T_void<<4)+T_boolean] = T_undefined ;
-// table[(T_void<<4)+T_char] = T_undefined ;
-// table[(T_void<<4)+T_int] = T_undefined ;
-// table[(T_void<<4)+T_null] = T_undefined ;
-
-// table[(T_String<<4)+T_undefined] = T_undefined ;
-// table[(T_String<<4)+T_byte] = T_undefined ;
-// table[(T_String<<4)+T_long] = T_undefined ;
-// table[(T_String<<4)+T_short] = T_undefined ;
-// table[(T_String<<4)+T_void] = T_undefined ;
-// table[(T_String<<4)+T_String] = T_undefined ;
-// table[(T_String<<4)+T_Object] = T_undefined ;
-// table[(T_String<<4)+T_double] = T_undefined ;
-// table[(T_String<<4)+T_float] = T_undefined ;
-// table[(T_String<<4)+T_boolean] = T_undefined ;
-// table[(T_String<<4)+T_char] = T_undefined ;
-// table[(T_String<<4)+T_int] = T_undefined ;
-// table[(T_String<<4)+T_null] = T_undefined ;
-
-// table[(T_Object<<4)+T_undefined] = T_undefined ;
-// table[(T_Object<<4)+T_byte] = T_undefined ;
-// table[(T_Object<<4)+T_long] = T_undefined ;
-// table[(T_Object<<4)+T_short] = T_undefined ;
-// table[(T_Object<<4)+T_void] = T_undefined ;
-// table[(T_Object<<4)+T_String] = T_undefined ;
-// table[(T_Object<<4)+T_Object] = T_undefined ;
-// table[(T_Object<<4)+T_double] = T_undefined ;
-// table[(T_Object<<4)+T_float] = T_undefined ;
-// table[(T_Object<<4)+T_boolean] = T_undefined ;
-// table[(T_Object<<4)+T_char] = T_undefined ;
-// table[(T_Object<<4)+T_int] = T_undefined ;
-// table[(T_Object<<4)+T_null] = T_undefined ;
-
-// table[(T_double<<4)+T_undefined] = T_undefined ;
- table[(T_double<<4)+T_byte] = (Double2Double<<12)+(Byte2Double<<4)+T_boolean ;
- table[(T_double<<4)+T_long] = (Double2Double<<12)+(Long2Double<<4)+T_boolean;
- table[(T_double<<4)+T_short] = (Double2Double<<12)+(Short2Double<<4)+T_boolean ;
-// table[(T_double<<4)+T_void] = T_undefined ;
-// table[(T_double<<4)+T_String] = T_undefined ;
-// table[(T_double<<4)+T_Object] = T_undefined ;
- table[(T_double<<4)+T_double] = (Double2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_double<<4)+T_float] = (Double2Double<<12)+(Float2Double<<4)+T_boolean ;
-// table[(T_double<<4)+T_boolean] = T_undefined ;
- table[(T_double<<4)+T_char] = (Double2Double<<12)+(Char2Double<<4)+T_boolean ;
- table[(T_double<<4)+T_int] = (Double2Double<<12)+(Int2Double<<4)+T_boolean;
-// table[(T_double<<4)+T_null] = T_undefined ;
-
-// table[(T_float<<4)+T_undefined] = T_undefined ;
- table[(T_float<<4)+T_byte] = (Float2Float<<12)+(Byte2Float<<4)+T_boolean ;
- table[(T_float<<4)+T_long] = (Float2Float<<12)+(Long2Float<<4)+T_boolean ;
- table[(T_float<<4)+T_short] = (Float2Float<<12)+(Short2Float<<4)+T_boolean ;
-// table[(T_float<<4)+T_void] = T_undefined ;
-// table[(T_float<<4)+T_String] = T_undefined ;
-// table[(T_float<<4)+T_Object] = T_undefined ;
- table[(T_float<<4)+T_double] = (Float2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_float<<4)+T_float] = (Float2Float<<12)+(Float2Float<<4)+T_boolean ;
-// table[(T_float<<4)+T_boolean] = T_undefined ;
- table[(T_float<<4)+T_char] = (Float2Float<<12)+(Char2Float<<4)+T_boolean ;
- table[(T_float<<4)+T_int] = (Float2Float<<12)+(Int2Float<<4)+T_boolean ;
-// table[(T_float<<4)+T_null] = T_undefined ;
-
-// table[(T_boolean<<4)+T_undefined] = T_undefined ;
-// table[(T_boolean<<4)+T_byte] = T_undefined ;
-// table[(T_boolean<<4)+T_long] = T_undefined ;
-// table[(T_boolean<<4)+T_short] = T_undefined ;
-// table[(T_boolean<<4)+T_void] = T_undefined ;
-// table[(T_boolean<<4)+T_String] = T_undefined ;
-// table[(T_boolean<<4)+T_Object] = T_undefined ;
-// table[(T_boolean<<4)+T_double] = T_undefined ;
-// table[(T_boolean<<4)+T_float] = T_undefined ;
-// table[(T_boolean<<4)+T_boolean] = T_undefined ;
-// table[(T_boolean<<4)+T_char] = T_undefined ;
-// table[(T_boolean<<4)+T_int] = T_undefined ;
-// table[(T_boolean<<4)+T_null] = T_undefined ;
-
-// table[(T_char<<4)+T_undefined] = T_undefined ;
- table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_boolean ;
- table[(T_char<<4)+T_long] = (Char2Long<<12)+(Long2Long<<4)+T_boolean ;
- table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_boolean ;
-// table[(T_char<<4)+T_void] = T_undefined ;
-// table[(T_char<<4)+T_String] = T_undefined ;
-// table[(T_char<<4)+T_Object] = T_undefined ;
- table[(T_char<<4)+T_double] = (Char2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_char<<4)+T_float] = (Char2Float<<12)+(Float2Float<<4)+T_boolean ;
-// table[(T_char<<4)+T_boolean] = T_undefined ;
- table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_boolean ;
- table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_boolean ;
-// table[(T_char<<4)+T_null] = T_undefined ;
-
-// table[(T_int<<4)+T_undefined] = T_undefined ;
- table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_boolean ;
- table[(T_int<<4)+T_long] = (Int2Long<<12)+(Long2Long<<4)+T_boolean;
- table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_boolean ;
-// table[(T_int<<4)+T_void] = T_undefined ;
-// table[(T_int<<4)+T_String] = T_undefined ;
-// table[(T_int<<4)+T_Object] = T_undefined ;
- table[(T_int<<4)+T_double] = (Int2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_int<<4)+T_float] = (Int2Float<<12)+(Float2Float<<4)+T_boolean ;
-// table[(T_int<<4)+T_boolean] = T_undefined ;
- table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_boolean ;
- table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_boolean;
-// table[(T_int<<4)+T_null] = T_undefined ;
-
-// table[(T_null<<4)+T_undefined] = T_undefined ;
-// table[(T_null<<4)+T_byte] = T_undefined ;
-// table[(T_null<<4)+T_long] = T_undefined ;
-// table[(T_null<<4)+T_short] = T_undefined ;
-// table[(T_null<<4)+T_void] = T_undefined ;
-// table[(T_null<<4)+T_String] = T_undefined ;
-// table[(T_null<<4)+T_Object] = T_undefined ;
-// table[(T_null<<4)+T_double] = T_undefined ;
-// table[(T_null<<4)+T_float] = T_undefined ;
-// table[(T_null<<4)+T_boolean] = T_undefined ;
-// table[(T_null<<4)+T_char] = T_undefined ;
-// table[(T_null<<4)+T_int] = T_undefined ;
-// table[(T_null<<4)+T_null] = T_undefined ;
-
- //and now.....the return.........
-
- return table ;
-}
-public static final int[] get_LESS_EQUAL(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
-
-// int[] table = new int[16*16] ;
-
- return get_LESS();
-
-// return table ;
-}
-public static final int[] get_MINUS(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
-
- int[] table = new int[16*16] ;
-
- table = (int[]) get_PLUS().clone();
-
- table[(T_String<<4)+T_byte] = T_undefined ;
- table[(T_String<<4)+T_long] = T_undefined ;
- table[(T_String<<4)+T_short] = T_undefined ;
- table[(T_String<<4)+T_void] = T_undefined ;
- table[(T_String<<4)+T_String] = T_undefined ;
- table[(T_String<<4)+T_Object] = T_undefined ;
- table[(T_String<<4)+T_double] = T_undefined ;
- table[(T_String<<4)+T_float] = T_undefined ;
- table[(T_String<<4)+T_boolean] = T_undefined ;
- table[(T_String<<4)+T_char] = T_undefined ;
- table[(T_String<<4)+T_int] = T_undefined ;
- table[(T_String<<4)+T_null] = T_undefined ;
-
- table[(T_byte<<4) +T_String] = T_undefined ;
- table[(T_long<<4) +T_String] = T_undefined ;
- table[(T_short<<4) +T_String] = T_undefined ;
- table[(T_void<<4) +T_String] = T_undefined ;
- table[(T_Object<<4) +T_String] = T_undefined ;
- table[(T_double<<4) +T_String] = T_undefined ;
- table[(T_float<<4) +T_String] = T_undefined ;
- table[(T_boolean<<4)+T_String] = T_undefined ;
- table[(T_char<<4) +T_String] = T_undefined ;
- table[(T_int<<4) +T_String] = T_undefined ;
- table[(T_null<<4) +T_String] = T_undefined ;
-
- table[(T_null<<4) +T_null] = T_undefined ;
-
- //and now.....the return.........
-
- return table ;
-}
-public static final int[] get_MULTIPLY(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
-
-// int[] table = new int[16*16] ;
-
- return get_MINUS();
-
-// return table ;
-}
-public static final int[] get_OR(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
-
-// int[] table = new int[16*16] ;
-
- return get_AND() ;
-
-// return table ;
-}
-public static final int[] get_OR_OR(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
-
-// int[] table = new int[16*16] ;
-
- return get_AND_AND() ;
-
-// return table ;
-}
-public static final int[] get_PLUS(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
-
- int[] table = new int[16*16] ;
-
-// table[(T_undefined<<4)+T_undefined] = T_undefined ;
-// table[(T_undefined<<4)+T_byte] = T_undefined ;
-// table[(T_undefined<<4)+T_long] = T_undefined ;
-// table[(T_undefined<<4)+T_short] = T_undefined ;
-// table[(T_undefined<<4)+T_void] = T_undefined ;
-// table[(T_undefined<<4)+T_String] = T_undefined ;
-// table[(T_undefined<<4)+T_Object] = T_undefined ;
-// table[(T_undefined<<4)+T_double] = T_undefined ;
-// table[(T_undefined<<4)+T_float] = T_undefined ;
-// table[(T_undefined<<4)+T_boolean] = T_undefined ;
-// table[(T_undefined<<4)+T_char] = T_undefined ;
-// table[(T_undefined<<4)+T_int] = T_undefined ;
-// table[(T_undefined<<4)+T_null] = T_undefined ;
-
-// table[(T_byte<<4)+T_undefined] = T_undefined ;
- table[(T_byte<<4)+T_byte] = (Byte2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_byte<<4)+T_long] = (Byte2Long<<12)+(Long2Long<<4)+T_long ;
- table[(T_byte<<4)+T_short] = (Byte2Int<<12)+(Short2Int<<4)+T_int ;
-// table[(T_byte<<4)+T_void] = T_undefined ;
- table[(T_byte<<4)+T_String] = (Byte2Byte<<12)+(String2String<<4)+T_String ;
-// table[(T_byte<<4)+T_Object] = T_undefined ;
- table[(T_byte<<4)+T_double] = (Byte2Double<<12)+(Double2Double<<4)+T_double ;
- table[(T_byte<<4)+T_float] = (Byte2Float<<12)+(Float2Float<<4)+T_float;
-// table[(T_byte<<4)+T_boolean] = T_undefined ;
- table[(T_byte<<4)+T_char] = (Byte2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_byte<<4)+T_int] = (Byte2Int<<12)+(Int2Int<<4)+T_int ;
-// table[(T_byte<<4)+T_null] = T_undefined ;
-
-// table[(T_long<<4)+T_undefined] = T_undefined ;
- table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Long<<4)+T_long;
- table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Long<<4)+T_long ;
- table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Long<<4)+T_long ;
-// table[(T_long<<4)+T_void] = T_undefined ;
- table[(T_long<<4)+T_String] = (Long2Long<<12)+(String2String<<4)+T_String ;
-// table[(T_long<<4)+T_Object] = T_undefined ;
- table[(T_long<<4)+T_double] = (Long2Double<<12)+(Double2Double<<4)+T_double ;
- table[(T_long<<4)+T_float] = (Long2Float<<12)+(Float2Float<<4)+T_float ;
-// table[(T_long<<4)+T_boolean] = T_undefined ;
- table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Long<<4)+T_long ;
- table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Long<<4)+T_long ; ;
-// table[(T_long<<4)+T_null] = T_undefined ;
-
-// table[(T_short<<4)+T_undefined] = T_undefined ;
- table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_short<<4)+T_long] = (Short2Long<<12)+(Long2Long<<4)+T_long ;
- table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_int ;
-// table[(T_short<<4)+T_void] = T_undefined ;
- table[(T_short<<4)+T_String] = (Short2Short<<12)+(String2String<<4)+T_String ;
-// table[(T_short<<4)+T_Object] = T_undefined ;
- table[(T_short<<4)+T_double] = (Short2Double<<12)+(Double2Double<<4)+T_double ;
- table[(T_short<<4)+T_float] = (Short2Float<<12)+(Float2Float<<4)+T_float ;
-// table[(T_short<<4)+T_boolean] = T_undefined ;
- table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_int ;
-// table[(T_short<<4)+T_null] = T_undefined ;
-
-// table[(T_void<<4)+T_undefined] = T_undefined ;
-// table[(T_void<<4)+T_byte] = T_undefined ;
-// table[(T_void<<4)+T_long] = T_undefined ;
-// table[(T_void<<4)+T_short] = T_undefined ;
-// table[(T_void<<4)+T_void] = T_undefined ;
-// table[(T_void<<4)+T_String] = T_undefined ;
-// table[(T_void<<4)+T_Object] = T_undefined ;
-// table[(T_void<<4)+T_double] = T_undefined ;
-// table[(T_void<<4)+T_float] = T_undefined ;
-// table[(T_void<<4)+T_boolean] = T_undefined ;
-// table[(T_void<<4)+T_char] = T_undefined ;
-// table[(T_void<<4)+T_int] = T_undefined ;
-// table[(T_void<<4)+T_null] = T_undefined ;
-
-// table[(T_String<<4)+T_undefined] = T_undefined ;
- table[(T_String<<4)+T_byte] = (String2String<<12)+(Byte2Byte<<4)+T_String ;
- table[(T_String<<4)+T_long] = (String2String<<12)+(Long2Long<<4)+T_String ;
- table[(T_String<<4)+T_short] = (String2String<<12)+(Short2Short<<4)+T_String ;
-// table[(T_String<<4)+T_void] = T_undefined ;
- table[(T_String<<4)+T_String] = (String2String<<12)+(String2String<<4)+T_String ;
- table[(T_String<<4)+T_Object] = (String2String<<12)+(T_Object<<8)+(T_Object<<4)+T_String ;
- table[(T_String<<4)+T_double] = (String2String<<12)+(Double2Double<<4)+T_String ;
- table[(T_String<<4)+T_float] = (String2String<<12)+(Float2Float<<4)+T_String ;
- table[(T_String<<4)+T_boolean] = (String2String<<12)+(Boolean2Boolean<<4)+T_String ;
- table[(T_String<<4)+T_char] = (String2String<<12)+(Char2Char<<4)+T_String ;
- table[(T_String<<4)+T_int] = (String2String<<12)+(Int2Int<<4)+T_String ;
- table[(T_String<<4)+T_null] = (String2String<<12)+(T_null<<8)+(T_null<<4)+T_String ;
-
-// table[(T_Object<<4)+T_undefined] = T_undefined ;
-// table[(T_Object<<4)+T_byte] = T_undefined ;
-// table[(T_Object<<4)+T_long] = T_undefined ;
-// table[(T_Object<<4)+T_short] = T_undefined ;
-// table[(T_Object<<4)+T_void] = T_undefined ;
- table[(T_Object<<4)+T_String] = (T_Object<<16)+(T_Object<<12)+(String2String<<4)+T_String ;
-// table[(T_Object<<4)+T_Object] = T_undefined ;
-// table[(T_Object<<4)+T_double] = T_undefined ;
-// table[(T_Object<<4)+T_float] = T_undefined ;
-// table[(T_Object<<4)+T_boolean] = T_undefined ;
-// table[(T_Object<<4)+T_char] = T_undefined ;
-// table[(T_Object<<4)+T_int] = T_undefined ;
-// table[(T_Object<<4)+T_null] = T_undefined ;
-
-// table[(T_double<<4)+T_undefined] = T_undefined ;
- table[(T_double<<4)+T_byte] = (Double2Double<<12)+(Byte2Double<<4)+T_double ;
- table[(T_double<<4)+T_long] = (Double2Double<<12)+(Long2Double<<4)+T_double ;
- table[(T_double<<4)+T_short] = (Double2Double<<12)+(Short2Double<<4)+T_double ; ;
-// table[(T_double<<4)+T_void] = T_undefined ;
- table[(T_double<<4)+T_String] = (Double2Double<<12)+(String2String<<4)+T_String ;
-// table[(T_double<<4)+T_Object] = T_undefined ;
- table[(T_double<<4)+T_double] = (Double2Double<<12)+(Double2Double<<4)+T_double ;
- table[(T_double<<4)+T_float] = (Double2Double<<12)+(Float2Double<<4)+T_double ; ;
-// table[(T_double<<4)+T_boolean] = T_undefined ;
- table[(T_double<<4)+T_char] = (Double2Double<<12)+(Char2Double<<4)+T_double ; ;
- table[(T_double<<4)+T_int] = (Double2Double<<12)+(Int2Double<<4)+T_double ; ;
-// table[(T_double<<4)+T_null] = T_undefined ;
-
-// table[(T_float<<4)+T_undefined] = T_undefined ;
- table[(T_float<<4)+T_byte] = (Float2Float<<12)+(Byte2Float<<4)+T_float ;
- table[(T_float<<4)+T_long] = (Float2Float<<12)+(Long2Float<<4)+T_float ;
- table[(T_float<<4)+T_short] = (Float2Float<<12)+(Short2Float<<4)+T_float ;
-// table[(T_float<<4)+T_void] = T_undefined ;
- table[(T_float<<4)+T_String] = (Float2Float<<12)+(String2String<<4)+T_String ;
-// table[(T_float<<4)+T_Object] = T_undefined ;
- table[(T_float<<4)+T_double] = (Float2Double<<12)+(Double2Double<<4)+T_double ;
- table[(T_float<<4)+T_float] = (Float2Float<<12)+(Float2Float<<4)+T_float ;
-// table[(T_float<<4)+T_boolean] = T_undefined ;
- table[(T_float<<4)+T_char] = (Float2Float<<12)+(Char2Float<<4)+T_float ;
- table[(T_float<<4)+T_int] = (Float2Float<<12)+(Int2Float<<4)+T_float ;
-// table[(T_float<<4)+T_null] = T_undefined ;
-
-// table[(T_boolean<<4)+T_undefined] = T_undefined ;
-// table[(T_boolean<<4)+T_byte] = T_undefined ;
-// table[(T_boolean<<4)+T_long] = T_undefined ;
-// table[(T_boolean<<4)+T_short] = T_undefined ;
-// table[(T_boolean<<4)+T_void] = T_undefined ;
- table[(T_boolean<<4)+T_String] = (Boolean2Boolean<<12)+(String2String<<4)+T_String ;
-// table[(T_boolean<<4)+T_Object] = T_undefined ;
-// table[(T_boolean<<4)+T_double] = T_undefined ;
-// table[(T_boolean<<4)+T_float] = T_undefined ;
-// table[(T_boolean<<4)+T_boolean] = T_undefined ;
-// table[(T_boolean<<4)+T_char] = T_undefined ;
-// table[(T_boolean<<4)+T_int] = T_undefined ;
-// table[(T_boolean<<4)+T_null] = T_undefined ;
-
-// table[(T_char<<4)+T_undefined] = T_undefined ;
- table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_char<<4)+T_long] = (Char2Long<<12)+(Long2Long<<4)+T_long ;
- table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_int ;
-// table[(T_char<<4)+T_void] = T_undefined ;
- table[(T_char<<4)+T_String] = (Char2Char<<12)+(String2String<<4)+T_String ;
-// table[(T_char<<4)+T_Object] = T_undefined ;
- table[(T_char<<4)+T_double] = (Char2Double<<12)+(Double2Double<<4)+T_double ;
- table[(T_char<<4)+T_float] = (Char2Float<<12)+(Float2Float<<4)+T_float ;
-// table[(T_char<<4)+T_boolean] = T_undefined ;
- table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_int ; ;
- table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_int ;
-// table[(T_char<<4)+T_null] = T_undefined ;
-
-// table[(T_int<<4)+T_undefined] = T_undefined ;
- table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_int<<4)+T_long] = (Int2Long<<12)+(Long2Long<<4)+T_long ;
- table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_int ;
-// table[(T_int<<4)+T_void] = T_undefined ;
- table[(T_int<<4)+T_String] = (Int2Int<<12)+(String2String<<4)+T_String ;
-// table[(T_int<<4)+T_Object] = T_undefined ;
- table[(T_int<<4)+T_double] = (Int2Double<<12)+(Double2Double<<4)+T_double ;
- table[(T_int<<4)+T_float] = (Int2Float<<12)+(Float2Float<<4)+T_float ;
-// table[(T_int<<4)+T_boolean] = T_undefined ;
- table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_int ;
-// table[(T_int<<4)+T_null] = T_undefined ;
-
-// table[(T_null<<4)+T_undefined] = T_undefined ;
-// table[(T_null<<4)+T_byte] = T_undefined ;
-// table[(T_null<<4)+T_long] = T_undefined ;
-// table[(T_null<<4)+T_short] = T_undefined ;
-// table[(T_null<<4)+T_void] = T_undefined ;
- table[(T_null<<4)+T_String] = (T_null<<16)+(T_null<<12)+(String2String<<4)+T_String ;
-// table[(T_null<<4)+T_Object] = T_undefined ;
-// table[(T_null<<4)+T_double] = T_undefined ;
-// table[(T_null<<4)+T_float] = T_undefined ;
-// table[(T_null<<4)+T_boolean] = T_undefined ;
-// table[(T_null<<4)+T_char] = T_undefined ;
-// table[(T_null<<4)+T_int] = T_undefined ;
-// table[(T_null<<4)+T_null] = (Null2String<<12)+(Null2String<<4)+T_String ;;
-
- //and now.....the return.........
-
- return table ;
-}
-public static final int[] get_REMAINDER(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
-
-// int[] table = new int[16*16] ;
-
- return get_MINUS();
-
-// return table ;
-}
-public static final int[] get_RIGHT_SHIFT(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
-
-// int[] table = new int[16*16] ;
-
- return get_LEFT_SHIFT();
-
-// return table ;
-}
-public static final int[] get_UNSIGNED_RIGHT_SHIFT(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
-
-// int[] table = new int[16*16] ;
-
- return get_LEFT_SHIFT();
-
-// return table ;
-}
-public static final int[] get_XOR(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
-
-// int[] table = new int[16*16] ;
-
- return get_AND() ;
-
-// return table ;
-}
-public String operatorToString() {
- switch ((bits & OperatorMASK) >> OperatorSHIFT) {
- case EQUAL_EQUAL :
- return "=="/*nonNLS*/;
- case LESS_EQUAL :
- return "<="/*nonNLS*/;
- case GREATER_EQUAL :
- return ">="/*nonNLS*/;
- case NOT_EQUAL :
- return "!="/*nonNLS*/;
- case LEFT_SHIFT :
- return "<<"/*nonNLS*/;
- case RIGHT_SHIFT :
- return ">>"/*nonNLS*/;
- case UNSIGNED_RIGHT_SHIFT :
- return ">>>"/*nonNLS*/;
- case OR_OR :
- return "||"/*nonNLS*/;
- case AND_AND :
- return "&&"/*nonNLS*/;
- case PLUS :
- return "+"/*nonNLS*/;
- case MINUS :
- return "-"/*nonNLS*/;
- case NOT :
- return "!"/*nonNLS*/;
- case REMAINDER :
- return "%"/*nonNLS*/;
- case XOR :
- return "^"/*nonNLS*/;
- case AND :
- return "&"/*nonNLS*/;
- case MULTIPLY :
- return "*"/*nonNLS*/;
- case OR :
- return "|"/*nonNLS*/;
- case TWIDDLE :
- return "~"/*nonNLS*/;
- case DIVIDE :
- return "/"/*nonNLS*/;
- case GREATER :
- return ">"/*nonNLS*/;
- case LESS :
- return "<"/*nonNLS*/;
- case QUESTIONCOLON :
- return "?:"/*nonNLS*/;
- case EQUAL :
- return "="/*nonNLS*/;
- };
- return "unknown operator"/*nonNLS*/;
-}
-public String toStringExpression(){
- /* slow code*/
-
- //subclass redefine toStringExpressionNoParenthesis()
-
- return "("/*nonNLS*/ + toStringExpressionNoParenthesis() + ")"/*nonNLS*/;
-}
-
-public abstract String toStringExpressionNoParenthesis();
-
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+public abstract class OperatorExpression extends Expression implements OperatorIds {
+ public static int[][] ResolveTypeTables = new int[NumberOfTables][];
+ static {classInitialize();}
+/**
+ * OperatorExpression constructor comment.
+ */
+public OperatorExpression() {
+ super();
+}
+public static final void classInitialize() {
+ ResolveTypeTables[AND] = get_AND();
+ ResolveTypeTables[AND_AND] = get_AND_AND();
+ ResolveTypeTables[DIVIDE] = get_DIVIDE();
+ ResolveTypeTables[EQUAL_EQUAL] = get_EQUAL_EQUAL();
+ ResolveTypeTables[GREATER] = get_GREATER();
+ ResolveTypeTables[GREATER_EQUAL] = get_GREATER_EQUAL();
+ ResolveTypeTables[LEFT_SHIFT] = get_LEFT_SHIFT();
+ ResolveTypeTables[LESS] = get_LESS();
+ ResolveTypeTables[LESS_EQUAL] = get_LESS_EQUAL();
+ ResolveTypeTables[MINUS] = get_MINUS();
+ ResolveTypeTables[MULTIPLY] = get_MULTIPLY();
+ ResolveTypeTables[OR] = get_OR();
+ ResolveTypeTables[OR_OR] = get_OR_OR();
+ ResolveTypeTables[PLUS] = get_PLUS();
+ ResolveTypeTables[REMAINDER] = get_REMAINDER();
+ ResolveTypeTables[RIGHT_SHIFT] = get_RIGHT_SHIFT();
+ ResolveTypeTables[UNSIGNED_RIGHT_SHIFT] = get_UNSIGNED_RIGHT_SHIFT();
+ ResolveTypeTables[XOR] = get_XOR();
+}
+public static final String generateTableTestCase(){
+ //return a String which is a java method allowing to test
+ //the non zero entries of all tables
+
+ /* slow code */
+
+ /*
+ org.eclipse.jdt.internal.compiler.ast.
+ OperatorExpression.generateTableTestCase();
+ */
+
+ int[] operators = new int[]{AND,AND_AND,DIVIDE,GREATER,GREATER_EQUAL,
+ LEFT_SHIFT,LESS,LESS_EQUAL,MINUS,MULTIPLY,OR,OR_OR,PLUS,REMAINDER,
+ RIGHT_SHIFT,UNSIGNED_RIGHT_SHIFT,XOR};
+
+ class Decode {
+ public final String constant(int code){
+ switch(code){
+ case T_boolean : return "true"/*nonNLS*/ ;
+ case T_byte : return "((byte) 3)"/*nonNLS*/ ;
+ case T_char : return "'A'"/*nonNLS*/ ;
+ case T_double : return "300.0d"/*nonNLS*/ ;
+ case T_float : return "100.0f"/*nonNLS*/ ;
+ case T_int : return "1"/*nonNLS*/ ;
+ case T_long : return "7L"/*nonNLS*/ ;
+ case T_String : return "\"hello-world\""/*nonNLS*/ ;
+ case T_null : return "null"/*nonNLS*/;
+ case T_short : return "((short) 5)"/*nonNLS*/;
+ case T_Object : return "null"/*nonNLS*/;}
+ return ""/*nonNLS*/;}
+
+ public final String type(int code){
+ switch(code){
+ case T_boolean : return "z"/*nonNLS*/ ;
+ case T_byte : return "b"/*nonNLS*/ ;
+ case T_char : return "c"/*nonNLS*/ ;
+ case T_double : return "d"/*nonNLS*/ ;
+ case T_float : return "f"/*nonNLS*/ ;
+ case T_int : return "i"/*nonNLS*/ ;
+ case T_long : return "l"/*nonNLS*/ ;
+ case T_String : return "str"/*nonNLS*/ ;
+ case T_null : return "null"/*nonNLS*/;
+ case T_short : return "s"/*nonNLS*/;
+ case T_Object : return "obj"/*nonNLS*/;}
+ return "xxx"/*nonNLS*/;}
+
+ public final String operator(int operator){
+ switch (operator) {
+ case EQUAL_EQUAL : return "=="/*nonNLS*/;
+ case LESS_EQUAL : return "<="/*nonNLS*/;
+ case GREATER_EQUAL :return ">="/*nonNLS*/;
+ case LEFT_SHIFT : return "<<"/*nonNLS*/;
+ case RIGHT_SHIFT : return ">>"/*nonNLS*/;
+ case UNSIGNED_RIGHT_SHIFT : return ">>>"/*nonNLS*/;
+ case OR_OR :return "||"/*nonNLS*/;
+ case AND_AND : return "&&"/*nonNLS*/;
+ case PLUS : return "+"/*nonNLS*/;
+ case MINUS : return "-"/*nonNLS*/;
+ case NOT : return "!"/*nonNLS*/;
+ case REMAINDER : return "%"/*nonNLS*/;
+ case XOR : return "^"/*nonNLS*/;
+ case AND : return "&"/*nonNLS*/;
+ case MULTIPLY : return "*"/*nonNLS*/;
+ case OR : return "|"/*nonNLS*/;
+ case TWIDDLE : return "~"/*nonNLS*/;
+ case DIVIDE : return "/"/*nonNLS*/;
+ case GREATER : return ">"/*nonNLS*/;
+ case LESS : return "<"/*nonNLS*/; };
+ return "????"/*nonNLS*/;}
+ }
+
+
+ Decode decode = new Decode();
+ String s ;
+ s = "\tpublic static void binaryOperationTablesTestCase(){\n"/*nonNLS*/ +
+
+ "\t\t//TC test : all binary operation (described in tables)\n"/*nonNLS*/+
+ "\t\t//method automatically generated by\n"/*nonNLS*/+
+ "\t\t//org.eclipse.jdt.internal.compiler.ast.OperatorExpression.generateTableTestCase();\n"/*nonNLS*/+
+
+ "\t\tString str0 ;\t String str\t= "/*nonNLS*/+decode.constant(T_String)+";\n"/*nonNLS*/+
+ "\t\tint i0 ;\t int i\t= "/*nonNLS*/+decode.constant(T_int)+" ;\n"/*nonNLS*/+
+ "\t\tboolean z0;\t boolean z\t= "/*nonNLS*/+decode.constant(T_boolean)+";\n"/*nonNLS*/+
+ "\t\tchar c0; \t char c\t= "/*nonNLS*/+decode.constant(T_char)+" ;\n"/*nonNLS*/+
+ "\t\tfloat f0; \t float f\t= "/*nonNLS*/+decode.constant(T_float)+" ;\n"/*nonNLS*/+
+ "\t\tdouble d0;\t double d\t= "/*nonNLS*/+decode.constant(T_double)+" ;\n"/*nonNLS*/+
+ "\t\tbyte b0; \t byte b\t= "/*nonNLS*/+decode.constant(T_byte)+";\n"/*nonNLS*/+
+ "\t\tshort s0; \t short s\t= "/*nonNLS*/+decode.constant(T_short)+";\n"/*nonNLS*/+
+ "\t\tlong l0; \t long l\t= "/*nonNLS*/+decode.constant(T_long)+" ;\n"/*nonNLS*/+
+ "\t\tObject obj0; \t Object obj\t= "/*nonNLS*/+decode.constant(T_Object)+" ;\n"/*nonNLS*/+
+
+ "\n"/*nonNLS*/;
+
+ int error = 0;
+ for (int i=0; i < operators.length ; i++)
+ { int operator = operators[i];
+ for (int left=0; left<16;left++)
+ for (int right=0; right<16;right++)
+ { int result = (ResolveTypeTables[operator][(left<<4)+right]) & 0x0000F;
+ if (result != T_undefined)
+
+ //1/ First regular computation then 2/ comparaison
+ //with a compile time constant (generated by the compiler)
+ // z0 = s >= s;
+ // if ( z0 != (((short) 5) >= ((short) 5)))
+ // System.out.println(155);
+
+ { s += "\t\t"/*nonNLS*/+decode.type(result)+"0"/*nonNLS*/+" = "/*nonNLS*/+decode.type(left);
+ s += " "/*nonNLS*/+decode.operator(operator)+" "/*nonNLS*/+decode.type(right)+";\n"/*nonNLS*/;
+ String begin = result == T_String ? "\t\tif (! "/*nonNLS*/ : "\t\tif ( "/*nonNLS*/;
+ String test = result == T_String ? ".equals("/*nonNLS*/ : " != ("/*nonNLS*/ ;
+ s += begin +decode.type(result)+"0"/*nonNLS*/+test
+ +decode.constant(left)+" "/*nonNLS*/
+ +decode.operator(operator)+" "/*nonNLS*/
+ +decode.constant(right)+"))\n"/*nonNLS*/;
+ s += "\t\t\tSystem.out.println("/*nonNLS*/+ (++error) +");\n"/*nonNLS*/;
+
+ }}}
+
+ return s += "\n\t\tSystem.out.println(\"binary tables test : done\");}"/*nonNLS*/ ;
+ }
+public static final int[] get_AND(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+
+ int[] table = new int[16*16] ;
+
+// table[(T_undefined<<4)+T_undefined] = T_undefined ;
+// table[(T_undefined<<4)+T_byte] = T_undefined ;
+// table[(T_undefined<<4)+T_long] = T_undefined ;
+// table[(T_undefined<<4)+T_short] = T_undefined ;
+// table[(T_undefined<<4)+T_void] = T_undefined ;
+// table[(T_undefined<<4)+T_String] = T_undefined ;
+// table[(T_undefined<<4)+T_Object] = T_undefined ;
+// table[(T_undefined<<4)+T_double] = T_undefined ;
+// table[(T_undefined<<4)+T_float] = T_undefined ;
+// table[(T_undefined<<4)+T_boolean] = T_undefined ;
+// table[(T_undefined<<4)+T_char] = T_undefined ;
+// table[(T_undefined<<4)+T_int] = T_undefined ;
+// table[(T_undefined<<4)+T_null] = T_undefined ;
+
+// table[(T_byte<<4)+T_undefined] = T_undefined ;
+ table[(T_byte<<4)+T_byte] = (Byte2Int<<12) +(Byte2Int<<4) +T_int ;
+ table[(T_byte<<4)+T_long] = (Byte2Long<<12)+(Long2Long<<4)+T_long ;
+ table[(T_byte<<4)+T_short] = (Byte2Int<<12) +(Short2Int<<4)+T_int;
+// table[(T_byte<<4)+T_void] = T_undefined ;
+// table[(T_byte<<4)+T_String] = T_undefined ;
+// table[(T_byte<<4)+T_Object] = T_undefined ;
+// table[(T_byte<<4)+T_double] = T_undefined ;
+// table[(T_byte<<4)+T_float] = T_undefined ;
+// table[(T_byte<<4)+T_boolean] = T_undefined ;
+ table[(T_byte<<4)+T_char] = (Byte2Int<<12) +(Char2Int<<4) +T_int ;
+ table[(T_byte<<4)+T_int] = (Byte2Int<<12) +(Int2Int<<4) +T_int ;
+// table[(T_byte<<4)+T_null] = T_undefined ;
+
+// table[(T_long<<4)+T_undefined] = T_undefined ;
+ table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Long<<4)+T_long;
+ table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Long<<4)+T_long ;
+ table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Long<<4)+T_long; ;
+// table[(T_long<<4)+T_void] = T_undefined ;
+// table[(T_long<<4)+T_String] = T_undefined ;
+// table[(T_long<<4)+T_Object] = T_undefined ;
+// table[(T_long<<4)+T_double] = T_undefined ;
+// table[(T_long<<4)+T_float] = T_undefined ;
+// table[(T_long<<4)+T_boolean] = T_undefined ;
+ table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Long<<4)+T_long ;
+ table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Long<<4)+T_long ;
+// table[(T_long<<4)+T_null] = T_undefined ;
+
+// table[(T_short<<4)+T_undefined] = T_undefined ;
+ table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_short<<4)+T_long] = (Short2Long<<12)+(Long2Long<<4)+T_long ;
+ table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_int ;
+// table[(T_short<<4)+T_void] = T_undefined ;
+// table[(T_short<<4)+T_String] = T_undefined ;
+// table[(T_short<<4)+T_Object] = T_undefined ;
+// table[(T_short<<4)+T_double] = T_undefined ;
+// table[(T_short<<4)+T_float] = T_undefined ;
+// table[(T_short<<4)+T_boolean] = T_undefined ;
+ table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_int ;
+// table[(T_short<<4)+T_null] = T_undefined ;
+
+// table[(T_void<<4)+T_undefined] = T_undefined ;
+// table[(T_void<<4)+T_byte] = T_undefined ;
+// table[(T_void<<4)+T_long] = T_undefined ;
+// table[(T_void<<4)+T_short] = T_undefined ;
+// table[(T_void<<4)+T_void] = T_undefined ;
+// table[(T_void<<4)+T_String] = T_undefined ;
+// table[(T_void<<4)+T_Object] = T_undefined ;
+// table[(T_void<<4)+T_double] = T_undefined ;
+// table[(T_void<<4)+T_float] = T_undefined ;
+// table[(T_void<<4)+T_boolean] = T_undefined ;
+// table[(T_void<<4)+T_char] = T_undefined ;
+// table[(T_void<<4)+T_int] = T_undefined ;
+// table[(T_void<<4)+T_null] = T_undefined ;
+
+// table[(T_String<<4)+T_undefined] = T_undefined ;
+// table[(T_String<<4)+T_byte] = T_undefined ;
+// table[(T_String<<4)+T_long] = T_undefined ;
+// table[(T_String<<4)+T_short] = T_undefined ;
+// table[(T_String<<4)+T_void] = T_undefined ;
+// table[(T_String<<4)+T_String] = T_undefined ;
+// table[(T_String<<4)+T_Object] = T_undefined ;
+// table[(T_String<<4)+T_double] = T_undefined ;
+// table[(T_String<<4)+T_float] = T_undefined ;
+// table[(T_String<<4)+T_boolean] = T_undefined ;
+// table[(T_String<<4)+T_char] = T_undefined ;
+// table[(T_String<<4)+T_int] = T_undefined ;
+// table[(T_String<<4)+T_null] = T_undefined ;
+
+// table[(T_Object<<4)+T_undefined] = T_undefined ;
+// table[(T_Object<<4)+T_byte] = T_undefined ;
+// table[(T_Object<<4)+T_long] = T_undefined ;
+// table[(T_Object<<4)+T_short] = T_undefined ;
+// table[(T_Object<<4)+T_void] = T_undefined ;
+// table[(T_Object<<4)+T_String] = T_undefined ;
+// table[(T_Object<<4)+T_Object] = T_undefined ;
+// table[(T_Object<<4)+T_double] = T_undefined ;
+// table[(T_Object<<4)+T_float] = T_undefined ;
+// table[(T_Object<<4)+T_boolean] = T_undefined ;
+// table[(T_Object<<4)+T_char] = T_undefined ;
+// table[(T_Object<<4)+T_int] = T_undefined ;
+// table[(T_Object<<4)+T_null] = T_undefined ;
+
+// table[(T_double<<4)+T_undefined] = T_undefined ;
+// table[(T_double<<4)+T_byte] = T_undefined ;
+// table[(T_double<<4)+T_long] = T_undefined ;
+// table[(T_double<<4)+T_short] = T_undefined ;
+// table[(T_double<<4)+T_void] = T_undefined ;
+// table[(T_double<<4)+T_String] = T_undefined ;
+// table[(T_double<<4)+T_Object] = T_undefined ;
+// table[(T_double<<4)+T_double] = T_undefined ;
+// table[(T_double<<4)+T_float] = T_undefined ;
+// table[(T_double<<4)+T_boolean] = T_undefined ;
+// table[(T_double<<4)+T_char] = T_undefined ;
+// table[(T_double<<4)+T_int] = T_undefined;
+// table[(T_double<<4)+T_null] = T_undefined ;
+
+// table[(T_float<<4)+T_undefined] = T_undefined ;
+// table[(T_float<<4)+T_byte] = T_undefined ;
+// table[(T_float<<4)+T_long] = T_undefined ;
+// table[(T_float<<4)+T_short] = T_undefined ;
+// table[(T_float<<4)+T_void] = T_undefined ;
+// table[(T_float<<4)+T_String] = T_undefined ;
+// table[(T_float<<4)+T_Object] = T_undefined ;
+// table[(T_float<<4)+T_double] = T_undefined ;
+// table[(T_float<<4)+T_float] = T_undefined ;
+// table[(T_float<<4)+T_boolean] = T_undefined ;
+// table[(T_float<<4)+T_char] = T_undefined ;
+// table[(T_float<<4)+T_int] = T_undefined ;
+// table[(T_float<<4)+T_null] = T_undefined ;
+
+// table[(T_boolean<<4)+T_undefined] = T_undefined ;
+// table[(T_boolean<<4)+T_byte] = T_undefined ;
+// table[(T_boolean<<4)+T_long] = T_undefined ;
+// table[(T_boolean<<4)+T_short] = T_undefined ;
+// table[(T_boolean<<4)+T_void] = T_undefined ;
+// table[(T_boolean<<4)+T_String] = T_undefined ;
+// table[(T_boolean<<4)+T_Object] = T_undefined ;
+// table[(T_boolean<<4)+T_double] = T_undefined ;
+// table[(T_boolean<<4)+T_float] = T_undefined ;
+ table[(T_boolean<<4)+T_boolean] = (Boolean2Boolean << 12)+(Boolean2Boolean << 4)+T_boolean ;
+// table[(T_boolean<<4)+T_char] = T_undefined ;
+// table[(T_boolean<<4)+T_int] = T_undefined ;
+// table[(T_boolean<<4)+T_null] = T_undefined ;
+
+// table[(T_char<<4)+T_undefined] = T_undefined ;
+ table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_char<<4)+T_long] = (Char2Long<<12)+(Long2Long<<4)+T_long;
+ table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_int ;
+// table[(T_char<<4)+T_void] = T_undefined ;
+// table[(T_char<<4)+T_String] = T_undefined ;
+// table[(T_char<<4)+T_Object] = T_undefined ;
+// table[(T_char<<4)+T_double] = T_undefined ;
+// table[(T_char<<4)+T_float] = T_undefined ;
+// table[(T_char<<4)+T_boolean] = T_undefined ;
+ table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_int ;
+// table[(T_char<<4)+T_null] = T_undefined ;
+
+// table[(T_int<<4)+T_undefined] = T_undefined ;
+ table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_int<<4)+T_long] = (Int2Long<<12)+(Long2Long<<4)+T_long ;
+ table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_int ;
+// table[(T_int<<4)+T_void] = T_undefined ;
+// table[(T_int<<4)+T_String] = T_undefined ;
+// table[(T_int<<4)+T_Object] = T_undefined ;
+// table[(T_int<<4)+T_double] = T_undefined ;
+// table[(T_int<<4)+T_float] = T_undefined ;
+// table[(T_int<<4)+T_boolean] = T_undefined ;
+ table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_int ;
+// table[(T_int<<4)+T_null] = T_undefined ;
+
+// table[(T_null<<4)+T_undefined] = T_undefined ;
+// table[(T_null<<4)+T_byte] = T_undefined ;
+// table[(T_null<<4)+T_long] = T_undefined ;
+// table[(T_null<<4)+T_short] = T_undefined ;
+// table[(T_null<<4)+T_void] = T_undefined ;
+// table[(T_null<<4)+T_String] = T_undefined ;
+// table[(T_null<<4)+T_Object] = T_undefined ;
+// table[(T_null<<4)+T_double] = T_undefined ;
+// table[(T_null<<4)+T_float] = T_undefined ;
+// table[(T_null<<4)+T_boolean] = T_undefined ;
+// table[(T_null<<4)+T_char] = T_undefined ;
+// table[(T_null<<4)+T_int] = T_undefined ;
+// table[(T_null<<4)+T_null] = T_undefined ;
+
+ //and now.....the return.........
+
+ return table ;
+}
+public static final int[] get_AND_AND(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+
+ int[] table = new int[16*16] ;
+
+// table[(T_undefined<<4)+T_undefined] = T_undefined ;
+// table[(T_undefined<<4)+T_byte] = T_undefined ;
+// table[(T_undefined<<4)+T_long] = T_undefined ;
+// table[(T_undefined<<4)+T_short] = T_undefined ;
+// table[(T_undefined<<4)+T_void] = T_undefined ;
+// table[(T_undefined<<4)+T_String] = T_undefined ;
+// table[(T_undefined<<4)+T_Object] = T_undefined ;
+// table[(T_undefined<<4)+T_double] = T_undefined ;
+// table[(T_undefined<<4)+T_float] = T_undefined ;
+// table[(T_undefined<<4)+T_boolean] = T_undefined ;
+// table[(T_undefined<<4)+T_char] = T_undefined ;
+// table[(T_undefined<<4)+T_int] = T_undefined ;
+// table[(T_undefined<<4)+T_null] = T_undefined ;
+
+// table[(T_byte<<4)+T_undefined] = T_undefined ;
+// table[(T_byte<<4)+T_byte] = T_undefined ;
+// table[(T_byte<<4)+T_long] = T_undefined ;
+// table[(T_byte<<4)+T_short] = T_undefined ;
+// table[(T_byte<<4)+T_void] = T_undefined ;
+// table[(T_byte<<4)+T_String] = T_undefined ;
+// table[(T_byte<<4)+T_Object] = T_undefined ;
+// table[(T_byte<<4)+T_double] = T_undefined ;
+// table[(T_byte<<4)+T_float] = T_undefined ;
+// table[(T_byte<<4)+T_boolean] = T_undefined ;
+// table[(T_byte<<4)+T_char] = T_undefined ;
+// table[(T_byte<<4)+T_int] = T_undefined ;
+// table[(T_byte<<4)+T_null] = T_undefined ;
+
+// table[(T_long<<4)+T_undefined] = T_undefined ;
+// table[(T_long<<4)+T_byte] = T_undefined;
+// table[(T_long<<4)+T_long] = T_undefined ;
+// table[(T_long<<4)+T_short] = T_undefined ;
+// table[(T_long<<4)+T_void] = T_undefined ;
+// table[(T_long<<4)+T_String] = T_undefined ;
+// table[(T_long<<4)+T_Object] = T_undefined ;
+// table[(T_long<<4)+T_double] = T_undefined ;
+// table[(T_long<<4)+T_float] = T_undefined ;
+// table[(T_long<<4)+T_boolean] = T_undefined ;
+// table[(T_long<<4)+T_char] = T_undefined ;
+// table[(T_long<<4)+T_int] = T_undefined ;
+// table[(T_long<<4)+T_null] = T_undefined ;
+
+// table[(T_short<<4)+T_undefined] = T_undefined ;
+// table[(T_short<<4)+T_byte] = T_undefined ;
+// table[(T_short<<4)+T_long] = T_undefined ;
+// table[(T_short<<4)+T_short] = T_undefined ;
+// table[(T_short<<4)+T_void] = T_undefined ;
+// table[(T_short<<4)+T_String] = T_undefined ;
+// table[(T_short<<4)+T_Object] = T_undefined ;
+// table[(T_short<<4)+T_double] = T_undefined ;
+// table[(T_short<<4)+T_float] = T_undefined ;
+// table[(T_short<<4)+T_boolean] = T_undefined ;
+// table[(T_short<<4)+T_char] = T_undefined ;
+// table[(T_short<<4)+T_int] = T_undefined ;
+// table[(T_short<<4)+T_null] = T_undefined ;
+
+// table[(T_void<<4)+T_undefined] = T_undefined ;
+// table[(T_void<<4)+T_byte] = T_undefined ;
+// table[(T_void<<4)+T_long] = T_undefined ;
+// table[(T_void<<4)+T_short] = T_undefined ;
+// table[(T_void<<4)+T_void] = T_undefined ;
+// table[(T_void<<4)+T_String] = T_undefined ;
+// table[(T_void<<4)+T_Object] = T_undefined ;
+// table[(T_void<<4)+T_double] = T_undefined ;
+// table[(T_void<<4)+T_float] = T_undefined ;
+// table[(T_void<<4)+T_boolean] = T_undefined ;
+// table[(T_void<<4)+T_char] = T_undefined ;
+// table[(T_void<<4)+T_int] = T_undefined ;
+// table[(T_void<<4)+T_null] = T_undefined ;
+
+// table[(T_String<<4)+T_undefined] = T_undefined ;
+// table[(T_String<<4)+T_byte] = T_undefined ;
+// table[(T_String<<4)+T_long] = T_undefined ;
+// table[(T_String<<4)+T_short] = T_undefined ;
+// table[(T_String<<4)+T_void] = T_undefined ;
+// table[(T_String<<4)+T_String] = T_undefined ;
+// table[(T_String<<4)+T_Object] = T_undefined ;
+// table[(T_String<<4)+T_double] = T_undefined ;
+// table[(T_String<<4)+T_float] = T_undefined ;
+// table[(T_String<<4)+T_boolean] = T_undefined ;
+// table[(T_String<<4)+T_char] = T_undefined ;
+// table[(T_String<<4)+T_int] = T_undefined ;
+// table[(T_String<<4)+T_null] = T_undefined ;
+
+// table[(T_Object<<4)+T_undefined] = T_undefined ;
+// table[(T_Object<<4)+T_byte] = T_undefined ;
+// table[(T_Object<<4)+T_long] = T_undefined ;
+// table[(T_Object<<4)+T_short] = T_undefined ;
+// table[(T_Object<<4)+T_void] = T_undefined ;
+// table[(T_Object<<4)+T_String] = T_undefined ;
+// table[(T_Object<<4)+T_Object] = T_undefined ;
+// table[(T_Object<<4)+T_double] = T_undefined ;
+// table[(T_Object<<4)+T_float] = T_undefined ;
+// table[(T_Object<<4)+T_boolean] = T_undefined ;
+// table[(T_Object<<4)+T_char] = T_undefined ;
+// table[(T_Object<<4)+T_int] = T_undefined ;
+// table[(T_Object<<4)+T_null] = T_undefined ;
+
+// table[(T_double<<4)+T_undefined] = T_undefined ;
+// table[(T_double<<4)+T_byte] = T_undefined ;
+// table[(T_double<<4)+T_long] = T_undefined ;
+// table[(T_double<<4)+T_short] = T_undefined ;
+// table[(T_double<<4)+T_void] = T_undefined ;
+// table[(T_double<<4)+T_String] = T_undefined ;
+// table[(T_double<<4)+T_Object] = T_undefined ;
+// table[(T_double<<4)+T_double] = T_undefined ;
+// table[(T_double<<4)+T_float] = T_undefined ;
+// table[(T_double<<4)+T_boolean] = T_undefined ;
+// table[(T_double<<4)+T_char] = T_undefined ;
+// table[(T_double<<4)+T_int] = T_undefined;
+// table[(T_double<<4)+T_null] = T_undefined ;
+
+// table[(T_float<<4)+T_undefined] = T_undefined ;
+// table[(T_float<<4)+T_byte] = T_undefined ;
+// table[(T_float<<4)+T_long] = T_undefined ;
+// table[(T_float<<4)+T_short] = T_undefined ;
+// table[(T_float<<4)+T_void] = T_undefined ;
+// table[(T_float<<4)+T_String] = T_undefined ;
+// table[(T_float<<4)+T_Object] = T_undefined ;
+// table[(T_float<<4)+T_double] = T_undefined ;
+// table[(T_float<<4)+T_float] = T_undefined ;
+// table[(T_float<<4)+T_boolean] = T_undefined ;
+// table[(T_float<<4)+T_char] = T_undefined ;
+// table[(T_float<<4)+T_int] = T_undefined ;
+// table[(T_float<<4)+T_null] = T_undefined ;
+
+// table[(T_boolean<<4)+T_undefined] = T_undefined ;
+// table[(T_boolean<<4)+T_byte] = T_undefined ;
+// table[(T_boolean<<4)+T_long] = T_undefined ;
+// table[(T_boolean<<4)+T_short] = T_undefined ;
+// table[(T_boolean<<4)+T_void] = T_undefined ;
+// table[(T_boolean<<4)+T_String] = T_undefined ;
+// table[(T_boolean<<4)+T_Object] = T_undefined ;
+// table[(T_boolean<<4)+T_double] = T_undefined ;
+// table[(T_boolean<<4)+T_float] = T_undefined ;
+ table[(T_boolean<<4)+T_boolean] = (Boolean2Boolean<<12)+(Boolean2Boolean<<4)+T_boolean ;
+// table[(T_boolean<<4)+T_char] = T_undefined ;
+// table[(T_boolean<<4)+T_int] = T_undefined ;
+// table[(T_boolean<<4)+T_null] = T_undefined ;
+
+// table[(T_char<<4)+T_undefined] = T_undefined ;
+// table[(T_char<<4)+T_byte] = T_undefined ;
+// table[(T_char<<4)+T_long] = T_undefined;
+// table[(T_char<<4)+T_short] = T_undefined ;
+// table[(T_char<<4)+T_void] = T_undefined ;
+// table[(T_char<<4)+T_String] = T_undefined ;
+// table[(T_char<<4)+T_Object] = T_undefined ;
+// table[(T_char<<4)+T_double] = T_undefined ;
+// table[(T_char<<4)+T_float] = T_undefined ;
+// table[(T_char<<4)+T_boolean] = T_undefined ;
+// table[(T_char<<4)+T_char] = T_undefined ;
+// table[(T_char<<4)+T_int] = T_undefined ;
+// table[(T_char<<4)+T_null] = T_undefined ;
+
+// table[(T_int<<4)+T_undefined] = T_undefined ;
+// table[(T_int<<4)+T_byte] = T_undefined ;
+// table[(T_int<<4)+T_long] = T_undefined ;
+// table[(T_int<<4)+T_short] = T_undefined ;
+// table[(T_int<<4)+T_void] = T_undefined ;
+// table[(T_int<<4)+T_String] = T_undefined ;
+// table[(T_int<<4)+T_Object] = T_undefined ;
+// table[(T_int<<4)+T_double] = T_undefined ;
+// table[(T_int<<4)+T_float] = T_undefined ;
+// table[(T_int<<4)+T_boolean] = T_undefined ;
+// table[(T_int<<4)+T_char] = T_undefined ;
+// table[(T_int<<4)+T_int] = T_undefined ;
+// table[(T_int<<4)+T_null] = T_undefined ;
+
+// table[(T_null<<4)+T_undefined] = T_undefined ;
+// table[(T_null<<4)+T_byte] = T_undefined ;
+// table[(T_null<<4)+T_long] = T_undefined ;
+// table[(T_null<<4)+T_short] = T_undefined ;
+// table[(T_null<<4)+T_void] = T_undefined ;
+// table[(T_null<<4)+T_String] = T_undefined ;
+// table[(T_null<<4)+T_Object] = T_undefined ;
+// table[(T_null<<4)+T_double] = T_undefined ;
+// table[(T_null<<4)+T_float] = T_undefined ;
+// table[(T_null<<4)+T_boolean] = T_undefined ;
+// table[(T_null<<4)+T_char] = T_undefined ;
+// table[(T_null<<4)+T_int] = T_undefined ;
+// table[(T_null<<4)+T_null] = T_undefined ;
+
+ //and now.....the return.........
+
+ return table ;
+}
+public static final int[] get_DIVIDE(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+
+// int[] table = new int[16*16] ;
+
+ return get_MINUS();
+
+// return table ;
+}
+public static final int[] get_EQUAL_EQUAL(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+ int[] table = new int[16*16] ;
+
+// table[(T_undefined<<4)+T_undefined] = T_undefined ;
+// table[(T_undefined<<4)+T_byte] = T_undefined ;
+// table[(T_undefined<<4)+T_long] = T_undefined ;
+// table[(T_undefined<<4)+T_short] = T_undefined ;
+// table[(T_undefined<<4)+T_void] = T_undefined ;
+// table[(T_undefined<<4)+T_String] = T_undefined ;
+// table[(T_undefined<<4)+T_Object] = T_undefined ;
+// table[(T_undefined<<4)+T_double] = T_undefined ;
+// table[(T_undefined<<4)+T_float] = T_undefined ;
+// table[(T_undefined<<4)+T_boolean] = T_undefined ;
+// table[(T_undefined<<4)+T_char] = T_undefined ;
+// table[(T_undefined<<4)+T_int] = T_undefined ;
+// table[(T_undefined<<4)+T_null] = T_undefined ;
+
+// table[(T_byte<<4)+T_undefined] = T_undefined ;
+ table[(T_byte<<4)+T_byte] = (Byte2Int<<12)+(Byte2Int<<4)+T_boolean ;
+ table[(T_byte<<4)+T_long] = (Byte2Long<<12)+(Long2Long<<4)+T_boolean ;
+ table[(T_byte<<4)+T_short] = (Byte2Int<<12)+(Short2Int<<4)+T_boolean ;
+// table[(T_byte<<4)+T_void] = T_undefined ;
+// table[(T_byte<<4)+T_String] = T_undefined ;
+// table[(T_byte<<4)+T_Object] = T_undefined ;
+ table[(T_byte<<4)+T_double] = (Byte2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_byte<<4)+T_float] = (Byte2Float<<12)+(Float2Float<<4)+T_boolean;
+// table[(T_byte<<4)+T_boolean] = T_undefined ;
+ table[(T_byte<<4)+T_char] = (Byte2Int<<12)+(Char2Int<<4)+T_boolean ;
+ table[(T_byte<<4)+T_int] = (Byte2Int<<12)+(Int2Int<<4)+T_boolean;
+// table[(T_byte<<4)+T_null] = T_undefined ;
+
+// table[(T_long<<4)+T_undefined] = T_undefined ;
+ table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Long<<4)+T_boolean;
+ table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Long<<4)+T_boolean ;
+ table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Long<<4)+T_boolean ;
+// table[(T_long<<4)+T_void] = T_undefined ;
+// table[(T_long<<4)+T_String] = T_undefined ;
+// table[(T_long<<4)+T_Object] = T_undefined ;
+ table[(T_long<<4)+T_double] = (Long2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_long<<4)+T_float] = (Long2Float<<12)+(Float2Float<<4)+T_boolean ;
+// table[(T_long<<4)+T_boolean] = T_undefined ;
+ table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Long<<4)+T_boolean ;
+ table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Long<<4)+T_boolean ;
+// table[(T_long<<4)+T_null] = T_undefined ;
+
+// table[(T_short<<4)+T_undefined] = T_undefined ;
+ table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_boolean ;
+ table[(T_short<<4)+T_long] = (Short2Long<<12)+(Long2Long<<4)+T_boolean ;
+ table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_boolean ;
+// table[(T_short<<4)+T_void] = T_undefined ;
+// table[(T_short<<4)+T_String] = T_undefined ;
+// table[(T_short<<4)+T_Object] = T_undefined ;
+ table[(T_short<<4)+T_double] = (Short2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_short<<4)+T_float] = (Short2Float<<12)+(Float2Float<<4)+T_boolean ;
+// table[(T_short<<4)+T_boolean] = T_undefined ;
+ table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_boolean ;
+ table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_boolean ;
+// table[(T_short<<4)+T_null] = T_undefined ;
+
+// table[(T_void<<4)+T_undefined] = T_undefined ;
+// table[(T_void<<4)+T_byte] = T_undefined ;
+// table[(T_void<<4)+T_long] = T_undefined ;
+// table[(T_void<<4)+T_short] = T_undefined ;
+// table[(T_void<<4)+T_void] = T_undefined ;
+// table[(T_void<<4)+T_String] = T_undefined ;
+// table[(T_void<<4)+T_Object] = T_undefined ;
+// table[(T_void<<4)+T_double] = T_undefined ;
+// table[(T_void<<4)+T_float] = T_undefined ;
+// table[(T_void<<4)+T_boolean] = T_undefined ;
+// table[(T_void<<4)+T_char] = T_undefined ;
+// table[(T_void<<4)+T_int] = T_undefined ;
+// table[(T_void<<4)+T_null] = T_undefined ;
+
+// table[(T_String<<4)+T_undefined] = T_undefined ;
+// table[(T_String<<4)+T_byte] = T_undefined ;
+// table[(T_String<<4)+T_long] = T_undefined ;
+// table[(T_String<<4)+T_short] = T_undefined ;
+// table[(T_String<<4)+T_void] = T_undefined ;
+ table[(T_String<<4)+T_String] = /*String2Object String2Object*/
+ (T_Object<<16)+(T_String<<12)+(T_Object<<8)+(T_String<<4)+T_boolean ;
+ table[(T_String<<4)+T_Object] = /*String2Object Object2Object*/
+ (T_Object<<16)+(T_String<<12)+(T_Object<<8)+(T_Object<<4)+T_boolean ;
+// table[(T_String<<4)+T_double] = T_undefined ;
+// table[(T_String<<4)+T_float] = T_undefined ;
+// table[(T_String<<4)+T_boolean] = T_undefined ;
+// table[(T_String<<4)+T_char] = T_undefined ;
+// table[(T_String<<4)+T_int] = T_undefined ;
+ table[(T_String<<4)+T_null] = /*Object2String null2Object */
+ (T_Object<<16)+(T_String<<12)+(T_Object<<8)+(T_null<<4)+T_boolean ;
+
+// table[(T_Object<<4)+T_undefined] = T_undefined ;
+// table[(T_Object<<4)+T_byte] = T_undefined ;
+// table[(T_Object<<4)+T_long] = T_undefined ;
+// table[(T_Object<<4)+T_short] = T_undefined ;
+// table[(T_Object<<4)+T_void] = T_undefined ;
+ table[(T_Object<<4)+T_String] = /*Object2Object String2Object*/
+ (T_Object<<16)+(T_Object<<12)+(T_Object<<8)+(T_String<<4)+T_boolean ;
+ table[(T_Object<<4)+T_Object] = /*Object2Object Object2Object*/
+ (T_Object<<16)+(T_Object<<12)+(T_Object<<8)+(T_Object<<4)+T_boolean ;
+// table[(T_Object<<4)+T_double] = T_undefined ;
+// table[(T_Object<<4)+T_float] = T_undefined ;
+// table[(T_Object<<4)+T_boolean] = T_undefined ;
+// table[(T_Object<<4)+T_char] = T_undefined ;
+// table[(T_Object<<4)+T_int] = T_undefined ;
+ table[(T_Object<<4)+T_null] = /*Object2Object null2Object*/
+ (T_Object<<16)+(T_Object<<12)+(T_Object<<8)+(T_null<<4)+T_boolean ;
+
+// table[(T_double<<4)+T_undefined] = T_undefined ;
+ table[(T_double<<4)+T_byte] = (Double2Double<<12)+(Byte2Double<<4)+T_boolean ;
+ table[(T_double<<4)+T_long] = (Double2Double<<12)+(Long2Double<<4)+T_boolean ;
+ table[(T_double<<4)+T_short] = (Double2Double<<12)+(Short2Double<<4)+T_boolean ;
+// table[(T_double<<4)+T_void] = T_undefined ;
+// table[(T_double<<4)+T_String] = T_undefined ;
+// table[(T_double<<4)+T_Object] = T_undefined ;
+ table[(T_double<<4)+T_double] = (Double2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_double<<4)+T_float] = (Double2Double<<12)+(Float2Double<<4)+T_boolean;
+// table[(T_double<<4)+T_boolean] = T_undefined ;
+ table[(T_double<<4)+T_char] = (Double2Double<<12)+(Char2Double<<4)+T_boolean ;
+ table[(T_double<<4)+T_int] = (Double2Double<<12)+(Int2Double<<4)+T_boolean ;
+// table[(T_double<<4)+T_null] = T_undefined ;
+
+// table[(T_float<<4)+T_undefined] = T_undefined ;
+ table[(T_float<<4)+T_byte] = (Float2Float<<12)+(Byte2Float<<4)+T_boolean ;
+ table[(T_float<<4)+T_long] = (Float2Float<<12)+(Long2Float<<4)+T_boolean ;
+ table[(T_float<<4)+T_short] = (Float2Float<<12)+(Short2Float<<4)+T_boolean ;
+// table[(T_float<<4)+T_void] = T_undefined ;
+// table[(T_float<<4)+T_String] = T_undefined ;
+// table[(T_float<<4)+T_Object] = T_undefined ;
+ table[(T_float<<4)+T_double] = (Float2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_float<<4)+T_float] = (Float2Float<<12)+(Float2Float<<4)+T_boolean ;
+// table[(T_float<<4)+T_boolean] = T_undefined ;
+ table[(T_float<<4)+T_char] = (Float2Float<<12)+(Char2Float<<4)+T_boolean ;
+ table[(T_float<<4)+T_int] = (Float2Float<<12)+(Int2Float<<4)+T_boolean ;
+// table[(T_float<<4)+T_null] = T_undefined ;
+
+// table[(T_boolean<<4)+T_undefined] = T_undefined ;
+// table[(T_boolean<<4)+T_byte] = T_undefined ;
+// table[(T_boolean<<4)+T_long] = T_undefined ;
+// table[(T_boolean<<4)+T_short] = T_undefined ;
+// table[(T_boolean<<4)+T_void] = T_undefined ;
+// table[(T_boolean<<4)+T_String] = T_undefined ;
+// table[(T_boolean<<4)+T_Object] = T_undefined ;
+// table[(T_boolean<<4)+T_double] = T_undefined ;
+// table[(T_boolean<<4)+T_float] = T_undefined ;
+ table[(T_boolean<<4)+T_boolean] = (Boolean2Boolean<<12)+(Boolean2Boolean<<4)+T_boolean ;
+// table[(T_boolean<<4)+T_char] = T_undefined ;
+// table[(T_boolean<<4)+T_int] = T_undefined ;
+// table[(T_boolean<<4)+T_null] = T_undefined ;
+
+// table[(T_char<<4)+T_undefined] = T_undefined ;
+ table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_boolean ;
+ table[(T_char<<4)+T_long] = (Char2Long<<12)+(Long2Long<<4)+T_boolean ;
+ table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_boolean ;
+// table[(T_char<<4)+T_void] = T_undefined ;
+// table[(T_char<<4)+T_String] = T_undefined ;
+// table[(T_char<<4)+T_Object] = T_undefined ;
+ table[(T_char<<4)+T_double] = (Char2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_char<<4)+T_float] = (Char2Float<<12)+(Float2Float<<4)+T_boolean ;
+// table[(T_char<<4)+T_boolean] = T_undefined ;
+ table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_boolean ;
+ table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_boolean ;
+// table[(T_char<<4)+T_null] = T_undefined ;
+
+// table[(T_int<<4)+T_undefined] = T_undefined ;
+ table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_boolean ;
+ table[(T_int<<4)+T_long] = (Int2Long<<12)+(Long2Long<<4)+T_boolean ;
+ table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_boolean ;
+// table[(T_int<<4)+T_void] = T_undefined ;
+// table[(T_int<<4)+T_String] = T_undefined ;
+// table[(T_int<<4)+T_Object] = T_undefined ;
+ table[(T_int<<4)+T_double] = (Int2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_int<<4)+T_float] = (Int2Float<<12)+(Float2Float<<4)+T_boolean;
+// table[(T_int<<4)+T_boolean] = T_undefined ;
+ table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_boolean ;
+ table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_boolean ;
+// table[(T_int<<4)+T_null] = T_undefined ;
+
+// table[(T_null<<4)+T_undefined] = T_undefined ;
+// table[(T_null<<4)+T_byte] = T_undefined ;
+// table[(T_null<<4)+T_long] = T_undefined ;
+// table[(T_null<<4)+T_short] = T_undefined ;
+// table[(T_null<<4)+T_void] = T_undefined ;
+ table[(T_null<<4)+T_String] = /*null2Object String2Object*/
+ (T_Object<<16)+(T_null<<12)+(T_Object<<8)+(T_String<<4)+T_boolean ;
+ table[(T_null<<4)+T_Object] = /*null2Object Object2Object*/
+ (T_Object<<16)+(T_null<<12)+(T_Object<<8)+(T_Object<<4)+T_boolean ; ;
+// table[(T_null<<4)+T_double] = T_undefined ;
+// table[(T_null<<4)+T_float] = T_undefined ;
+// table[(T_null<<4)+T_boolean] = T_undefined ;
+// table[(T_null<<4)+T_char] = T_undefined ;
+// table[(T_null<<4)+T_int] = T_undefined ;
+ table[(T_null<<4)+T_null] = /*null2Object null2Object*/
+ (T_Object<<16)+(T_null<<12)+(T_Object<<8)+(T_null<<4)+T_boolean ;
+ //and now.....the return.........
+
+ return table ;
+}
+public static final int[] get_GREATER(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+
+// int[] table = new int[16*16] ;
+
+ return get_LESS();
+
+// return table ;
+}
+public static final int[] get_GREATER_EQUAL(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+
+// int[] table = new int[16*16] ;
+
+ return get_LESS();
+
+// return table ;
+}
+public static final int[] get_LEFT_SHIFT(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+
+ int[] table = new int[16*16] ;
+
+// table[(T_undefined<<4)+T_undefined] = T_undefined ;
+// table[(T_undefined<<4)+T_byte] = T_undefined ;
+// table[(T_undefined<<4)+T_long] = T_undefined ;
+// table[(T_undefined<<4)+T_short] = T_undefined ;
+// table[(T_undefined<<4)+T_void] = T_undefined ;
+// table[(T_undefined<<4)+T_String] = T_undefined ;
+// table[(T_undefined<<4)+T_Object] = T_undefined ;
+// table[(T_undefined<<4)+T_double] = T_undefined ;
+// table[(T_undefined<<4)+T_float] = T_undefined ;
+// table[(T_undefined<<4)+T_boolean] = T_undefined ;
+// table[(T_undefined<<4)+T_char] = T_undefined ;
+// table[(T_undefined<<4)+T_int] = T_undefined ;
+// table[(T_undefined<<4)+T_null] = T_undefined ;
+
+// table[(T_byte<<4)+T_undefined] = T_undefined ;
+ table[(T_byte<<4)+T_byte] = (Byte2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_byte<<4)+T_long] = (Byte2Int<<12)+(Long2Int<<4)+T_int ;
+ table[(T_byte<<4)+T_short] = (Byte2Int<<12)+(Short2Int<<4)+T_int ;
+// table[(T_byte<<4)+T_void] = T_undefined ;
+// table[(T_byte<<4)+T_String] = T_undefined ;
+// table[(T_byte<<4)+T_Object] = T_undefined ;
+// table[(T_byte<<4)+T_double] = T_undefined ;
+// table[(T_byte<<4)+T_float] = T_undefined ;
+// table[(T_byte<<4)+T_boolean] = T_undefined ;
+ table[(T_byte<<4)+T_char] = (Byte2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_byte<<4)+T_int] = (Byte2Int<<12)+(Int2Int<<4)+T_int ;
+// table[(T_byte<<4)+T_null] = T_undefined ;
+
+// table[(T_long<<4)+T_undefined] = T_undefined ;
+ table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Int<<4)+T_long;
+ table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Int<<4)+T_long ;
+ table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Int<<4)+T_long ;
+// table[(T_long<<4)+T_void] = T_undefined ;
+// table[(T_long<<4)+T_String] = T_undefined ;
+// table[(T_long<<4)+T_Object] = T_undefined ;
+// table[(T_long<<4)+T_double] = T_undefined ;
+// table[(T_long<<4)+T_float] = T_undefined ;
+// table[(T_long<<4)+T_boolean] = T_undefined ;
+ table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Int<<4)+T_long ;
+ table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Int<<4)+T_long ;
+// table[(T_long<<4)+T_null] = T_undefined ;
+
+// table[(T_short<<4)+T_undefined] = T_undefined ;
+ table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_short<<4)+T_long] = (Short2Int<<12)+(Long2Int<<4)+T_int ;
+ table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_int ;
+// table[(T_short<<4)+T_void] = T_undefined ;
+// table[(T_short<<4)+T_String] = T_undefined ;
+// table[(T_short<<4)+T_Object] = T_undefined ;
+// table[(T_short<<4)+T_double] = T_undefined ;
+// table[(T_short<<4)+T_float] = T_undefined ;
+// table[(T_short<<4)+T_boolean] = T_undefined ;
+ table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_int ;
+// table[(T_short<<4)+T_null] = T_undefined ;
+
+// table[(T_void<<4)+T_undefined] = T_undefined ;
+// table[(T_void<<4)+T_byte] = T_undefined ;
+// table[(T_void<<4)+T_long] = T_undefined ;
+// table[(T_void<<4)+T_short] = T_undefined ;
+// table[(T_void<<4)+T_void] = T_undefined ;
+// table[(T_void<<4)+T_String] = T_undefined ;
+// table[(T_void<<4)+T_Object] = T_undefined ;
+// table[(T_void<<4)+T_double] = T_undefined ;
+// table[(T_void<<4)+T_float] = T_undefined ;
+// table[(T_void<<4)+T_boolean] = T_undefined ;
+// table[(T_void<<4)+T_char] = T_undefined ;
+// table[(T_void<<4)+T_int] = T_undefined ;
+// table[(T_void<<4)+T_null] = T_undefined ;
+
+// table[(T_String<<4)+T_undefined] = T_undefined ;
+// table[(T_String<<4)+T_byte] = T_undefined ;
+// table[(T_String<<4)+T_long] = T_undefined ;
+// table[(T_String<<4)+T_short] = T_undefined ;
+// table[(T_String<<4)+T_void] = T_undefined ;
+// table[(T_String<<4)+T_String] = T_undefined ;
+// table[(T_String<<4)+T_Object] = T_undefined ;
+// table[(T_String<<4)+T_double] = T_undefined ;
+// table[(T_String<<4)+T_float] = T_undefined ;
+// table[(T_String<<4)+T_boolean] = T_undefined ;
+// table[(T_String<<4)+T_char] = T_undefined ;
+// table[(T_String<<4)+T_int] = T_undefined ;
+// table[(T_String<<4)+T_null] = T_undefined ;
+
+// table[(T_Object<<4)+T_undefined] = T_undefined ;
+// table[(T_Object<<4)+T_byte] = T_undefined ;
+// table[(T_Object<<4)+T_long] = T_undefined ;
+// table[(T_Object<<4)+T_short] = T_undefined ;
+// table[(T_Object<<4)+T_void] = T_undefined ;
+// table[(T_Object<<4)+T_String] = T_undefined ;
+// table[(T_Object<<4)+T_Object] = T_undefined ;
+// table[(T_Object<<4)+T_double] = T_undefined ;
+// table[(T_Object<<4)+T_float] = T_undefined ;
+// table[(T_Object<<4)+T_boolean] = T_undefined ;
+// table[(T_Object<<4)+T_char] = T_undefined ;
+// table[(T_Object<<4)+T_int] = T_undefined ;
+// table[(T_Object<<4)+T_null] = T_undefined ;
+
+// table[(T_double<<4)+T_undefined] = T_undefined ;
+// table[(T_double<<4)+T_byte] = T_undefined ;
+// table[(T_double<<4)+T_long] = T_undefined ;
+// table[(T_double<<4)+T_short] = T_undefined ;
+// table[(T_double<<4)+T_void] = T_undefined ;
+// table[(T_double<<4)+T_String] = T_undefined ;
+// table[(T_double<<4)+T_Object] = T_undefined ;
+// table[(T_double<<4)+T_double] = T_undefined ;
+// table[(T_double<<4)+T_float] = T_undefined ;
+// table[(T_double<<4)+T_boolean] = T_undefined ;
+// table[(T_double<<4)+T_char] = T_undefined ;
+// table[(T_double<<4)+T_int] = T_undefined;
+// table[(T_double<<4)+T_null] = T_undefined ;
+
+// table[(T_float<<4)+T_undefined] = T_undefined ;
+// table[(T_float<<4)+T_byte] = T_undefined ;
+// table[(T_float<<4)+T_long] = T_undefined ;
+// table[(T_float<<4)+T_short] = T_undefined ;
+// table[(T_float<<4)+T_void] = T_undefined ;
+// table[(T_float<<4)+T_String] = T_undefined ;
+// table[(T_float<<4)+T_Object] = T_undefined ;
+// table[(T_float<<4)+T_double] = T_undefined ;
+// table[(T_float<<4)+T_float] = T_undefined ;
+// table[(T_float<<4)+T_boolean] = T_undefined ;
+// table[(T_float<<4)+T_char] = T_undefined ;
+// table[(T_float<<4)+T_int] = T_undefined ;
+// table[(T_float<<4)+T_null] = T_undefined ;
+
+// table[(T_boolean<<4)+T_undefined] = T_undefined ;
+// table[(T_boolean<<4)+T_byte] = T_undefined ;
+// table[(T_boolean<<4)+T_long] = T_undefined ;
+// table[(T_boolean<<4)+T_short] = T_undefined ;
+// table[(T_boolean<<4)+T_void] = T_undefined ;
+// table[(T_boolean<<4)+T_String] = T_undefined ;
+// table[(T_boolean<<4)+T_Object] = T_undefined ;
+// table[(T_boolean<<4)+T_double] = T_undefined ;
+// table[(T_boolean<<4)+T_float] = T_undefined ;
+// table[(T_boolean<<4)+T_boolean] = T_undefined ;
+// table[(T_boolean<<4)+T_char] = T_undefined ;
+// table[(T_boolean<<4)+T_int] = T_undefined ;
+// table[(T_boolean<<4)+T_null] = T_undefined ;
+
+// table[(T_char<<4)+T_undefined] = T_undefined ;
+ table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_char<<4)+T_long] = (Char2Int<<12)+(Long2Int<<4)+T_int ;
+ table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_int ;
+// table[(T_char<<4)+T_void] = T_undefined ;
+// table[(T_char<<4)+T_String] = T_undefined ;
+// table[(T_char<<4)+T_Object] = T_undefined ;
+// table[(T_char<<4)+T_double] = T_undefined ;
+// table[(T_char<<4)+T_float] = T_undefined ;
+// table[(T_char<<4)+T_boolean] = T_undefined ;
+ table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_int ;
+// table[(T_char<<4)+T_null] = T_undefined ;
+
+// table[(T_int<<4)+T_undefined] = T_undefined ;
+ table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_int<<4)+T_long] = (Int2Int<<12)+(Long2Int<<4)+T_int ;
+ table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_int ;
+// table[(T_int<<4)+T_void] = T_undefined ;
+// table[(T_int<<4)+T_String] = T_undefined ;
+// table[(T_int<<4)+T_Object] = T_undefined ;
+// table[(T_int<<4)+T_double] = T_undefined ;
+// table[(T_int<<4)+T_float] = T_undefined ;
+// table[(T_int<<4)+T_boolean] = T_undefined ;
+ table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_int ;
+// table[(T_int<<4)+T_null] = T_undefined ;
+
+// table[(T_null<<4)+T_undefined] = T_undefined ;
+// table[(T_null<<4)+T_byte] = T_undefined ;
+// table[(T_null<<4)+T_long] = T_undefined ;
+// table[(T_null<<4)+T_short] = T_undefined ;
+// table[(T_null<<4)+T_void] = T_undefined ;
+// table[(T_null<<4)+T_String] = T_undefined ;
+// table[(T_null<<4)+T_Object] = T_undefined ;
+// table[(T_null<<4)+T_double] = T_undefined ;
+// table[(T_null<<4)+T_float] = T_undefined ;
+// table[(T_null<<4)+T_boolean] = T_undefined ;
+// table[(T_null<<4)+T_char] = T_undefined ;
+// table[(T_null<<4)+T_int] = T_undefined ;
+// table[(T_null<<4)+T_null] = T_undefined ;
+
+ //and now.....the return.........
+
+ return table ;
+}
+public static final int[] get_LESS(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+
+ int[] table = new int[16*16] ;
+
+// table[(T_undefined<<4)+T_undefined] = T_undefined ;
+// table[(T_undefined<<4)+T_byte] = T_undefined ;
+// table[(T_undefined<<4)+T_long] = T_undefined ;
+// table[(T_undefined<<4)+T_short] = T_undefined ;
+// table[(T_undefined<<4)+T_void] = T_undefined ;
+// table[(T_undefined<<4)+T_String] = T_undefined ;
+// table[(T_undefined<<4)+T_Object] = T_undefined ;
+// table[(T_undefined<<4)+T_double] = T_undefined ;
+// table[(T_undefined<<4)+T_float] = T_undefined ;
+// table[(T_undefined<<4)+T_boolean] = T_undefined ;
+// table[(T_undefined<<4)+T_char] = T_undefined ;
+// table[(T_undefined<<4)+T_int] = T_undefined ;
+// table[(T_undefined<<4)+T_null] = T_undefined ;
+
+// table[(T_byte<<4)+T_undefined] = T_undefined ;
+ table[(T_byte<<4)+T_byte] = (Byte2Int<<12)+(Byte2Int<<4)+T_boolean ;
+ table[(T_byte<<4)+T_long] = (Byte2Long<<12)+(Long2Long<<4)+T_boolean ;
+ table[(T_byte<<4)+T_short] = (Byte2Int<<12)+(Short2Int<<4)+T_boolean ;
+// table[(T_byte<<4)+T_void] = T_undefined ;
+// table[(T_byte<<4)+T_String] = T_undefined ;
+// table[(T_byte<<4)+T_Object] = T_undefined ;
+ table[(T_byte<<4)+T_double] = (Byte2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_byte<<4)+T_float] = (Byte2Float<<12)+(Float2Float<<4)+T_boolean;
+// table[(T_byte<<4)+T_boolean] = T_undefined ;
+ table[(T_byte<<4)+T_char] = (Byte2Int<<12)+(Char2Int<<4)+T_boolean ;
+ table[(T_byte<<4)+T_int] = (Byte2Int<<12)+(Int2Int<<4)+T_boolean ;
+// table[(T_byte<<4)+T_null] = T_undefined ;
+
+// table[(T_long<<4)+T_undefined] = T_undefined ;
+ table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Long<<4)+T_boolean;
+ table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Long<<4)+T_boolean ;
+ table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Long<<4)+T_boolean ;
+// table[(T_long<<4)+T_void] = T_undefined ;
+// table[(T_long<<4)+T_String] = T_undefined ;
+// table[(T_long<<4)+T_Object] = T_undefined ;
+ table[(T_long<<4)+T_double] = (Long2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_long<<4)+T_float] = (Long2Float<<12)+(Float2Float<<4)+T_boolean ;
+// table[(T_long<<4)+T_boolean] = T_undefined ;
+ table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Long<<4)+T_boolean ;
+ table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Long<<4)+T_boolean ;
+// table[(T_long<<4)+T_null] = T_undefined ;
+
+// table[(T_short<<4)+T_undefined] = T_undefined ;
+ table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_boolean ;
+ table[(T_short<<4)+T_long] = (Short2Long<<12)+(Long2Long<<4)+T_boolean ;
+ table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_boolean ;
+// table[(T_short<<4)+T_void] = T_undefined ;
+// table[(T_short<<4)+T_String] = T_undefined ;
+// table[(T_short<<4)+T_Object] = T_undefined ;
+ table[(T_short<<4)+T_double] = (Short2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_short<<4)+T_float] = (Short2Float<<12)+(Float2Float<<4)+T_boolean ;
+// table[(T_short<<4)+T_boolean] = T_undefined ;
+ table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_boolean ;
+ table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_boolean ;
+// table[(T_short<<4)+T_null] = T_undefined ;
+
+// table[(T_void<<4)+T_undefined] = T_undefined ;
+// table[(T_void<<4)+T_byte] = T_undefined ;
+// table[(T_void<<4)+T_long] = T_undefined ;
+// table[(T_void<<4)+T_short] = T_undefined ;
+// table[(T_void<<4)+T_void] = T_undefined ;
+// table[(T_void<<4)+T_String] = T_undefined ;
+// table[(T_void<<4)+T_Object] = T_undefined ;
+// table[(T_void<<4)+T_double] = T_undefined ;
+// table[(T_void<<4)+T_float] = T_undefined ;
+// table[(T_void<<4)+T_boolean] = T_undefined ;
+// table[(T_void<<4)+T_char] = T_undefined ;
+// table[(T_void<<4)+T_int] = T_undefined ;
+// table[(T_void<<4)+T_null] = T_undefined ;
+
+// table[(T_String<<4)+T_undefined] = T_undefined ;
+// table[(T_String<<4)+T_byte] = T_undefined ;
+// table[(T_String<<4)+T_long] = T_undefined ;
+// table[(T_String<<4)+T_short] = T_undefined ;
+// table[(T_String<<4)+T_void] = T_undefined ;
+// table[(T_String<<4)+T_String] = T_undefined ;
+// table[(T_String<<4)+T_Object] = T_undefined ;
+// table[(T_String<<4)+T_double] = T_undefined ;
+// table[(T_String<<4)+T_float] = T_undefined ;
+// table[(T_String<<4)+T_boolean] = T_undefined ;
+// table[(T_String<<4)+T_char] = T_undefined ;
+// table[(T_String<<4)+T_int] = T_undefined ;
+// table[(T_String<<4)+T_null] = T_undefined ;
+
+// table[(T_Object<<4)+T_undefined] = T_undefined ;
+// table[(T_Object<<4)+T_byte] = T_undefined ;
+// table[(T_Object<<4)+T_long] = T_undefined ;
+// table[(T_Object<<4)+T_short] = T_undefined ;
+// table[(T_Object<<4)+T_void] = T_undefined ;
+// table[(T_Object<<4)+T_String] = T_undefined ;
+// table[(T_Object<<4)+T_Object] = T_undefined ;
+// table[(T_Object<<4)+T_double] = T_undefined ;
+// table[(T_Object<<4)+T_float] = T_undefined ;
+// table[(T_Object<<4)+T_boolean] = T_undefined ;
+// table[(T_Object<<4)+T_char] = T_undefined ;
+// table[(T_Object<<4)+T_int] = T_undefined ;
+// table[(T_Object<<4)+T_null] = T_undefined ;
+
+// table[(T_double<<4)+T_undefined] = T_undefined ;
+ table[(T_double<<4)+T_byte] = (Double2Double<<12)+(Byte2Double<<4)+T_boolean ;
+ table[(T_double<<4)+T_long] = (Double2Double<<12)+(Long2Double<<4)+T_boolean;
+ table[(T_double<<4)+T_short] = (Double2Double<<12)+(Short2Double<<4)+T_boolean ;
+// table[(T_double<<4)+T_void] = T_undefined ;
+// table[(T_double<<4)+T_String] = T_undefined ;
+// table[(T_double<<4)+T_Object] = T_undefined ;
+ table[(T_double<<4)+T_double] = (Double2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_double<<4)+T_float] = (Double2Double<<12)+(Float2Double<<4)+T_boolean ;
+// table[(T_double<<4)+T_boolean] = T_undefined ;
+ table[(T_double<<4)+T_char] = (Double2Double<<12)+(Char2Double<<4)+T_boolean ;
+ table[(T_double<<4)+T_int] = (Double2Double<<12)+(Int2Double<<4)+T_boolean;
+// table[(T_double<<4)+T_null] = T_undefined ;
+
+// table[(T_float<<4)+T_undefined] = T_undefined ;
+ table[(T_float<<4)+T_byte] = (Float2Float<<12)+(Byte2Float<<4)+T_boolean ;
+ table[(T_float<<4)+T_long] = (Float2Float<<12)+(Long2Float<<4)+T_boolean ;
+ table[(T_float<<4)+T_short] = (Float2Float<<12)+(Short2Float<<4)+T_boolean ;
+// table[(T_float<<4)+T_void] = T_undefined ;
+// table[(T_float<<4)+T_String] = T_undefined ;
+// table[(T_float<<4)+T_Object] = T_undefined ;
+ table[(T_float<<4)+T_double] = (Float2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_float<<4)+T_float] = (Float2Float<<12)+(Float2Float<<4)+T_boolean ;
+// table[(T_float<<4)+T_boolean] = T_undefined ;
+ table[(T_float<<4)+T_char] = (Float2Float<<12)+(Char2Float<<4)+T_boolean ;
+ table[(T_float<<4)+T_int] = (Float2Float<<12)+(Int2Float<<4)+T_boolean ;
+// table[(T_float<<4)+T_null] = T_undefined ;
+
+// table[(T_boolean<<4)+T_undefined] = T_undefined ;
+// table[(T_boolean<<4)+T_byte] = T_undefined ;
+// table[(T_boolean<<4)+T_long] = T_undefined ;
+// table[(T_boolean<<4)+T_short] = T_undefined ;
+// table[(T_boolean<<4)+T_void] = T_undefined ;
+// table[(T_boolean<<4)+T_String] = T_undefined ;
+// table[(T_boolean<<4)+T_Object] = T_undefined ;
+// table[(T_boolean<<4)+T_double] = T_undefined ;
+// table[(T_boolean<<4)+T_float] = T_undefined ;
+// table[(T_boolean<<4)+T_boolean] = T_undefined ;
+// table[(T_boolean<<4)+T_char] = T_undefined ;
+// table[(T_boolean<<4)+T_int] = T_undefined ;
+// table[(T_boolean<<4)+T_null] = T_undefined ;
+
+// table[(T_char<<4)+T_undefined] = T_undefined ;
+ table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_boolean ;
+ table[(T_char<<4)+T_long] = (Char2Long<<12)+(Long2Long<<4)+T_boolean ;
+ table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_boolean ;
+// table[(T_char<<4)+T_void] = T_undefined ;
+// table[(T_char<<4)+T_String] = T_undefined ;
+// table[(T_char<<4)+T_Object] = T_undefined ;
+ table[(T_char<<4)+T_double] = (Char2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_char<<4)+T_float] = (Char2Float<<12)+(Float2Float<<4)+T_boolean ;
+// table[(T_char<<4)+T_boolean] = T_undefined ;
+ table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_boolean ;
+ table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_boolean ;
+// table[(T_char<<4)+T_null] = T_undefined ;
+
+// table[(T_int<<4)+T_undefined] = T_undefined ;
+ table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_boolean ;
+ table[(T_int<<4)+T_long] = (Int2Long<<12)+(Long2Long<<4)+T_boolean;
+ table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_boolean ;
+// table[(T_int<<4)+T_void] = T_undefined ;
+// table[(T_int<<4)+T_String] = T_undefined ;
+// table[(T_int<<4)+T_Object] = T_undefined ;
+ table[(T_int<<4)+T_double] = (Int2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_int<<4)+T_float] = (Int2Float<<12)+(Float2Float<<4)+T_boolean ;
+// table[(T_int<<4)+T_boolean] = T_undefined ;
+ table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_boolean ;
+ table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_boolean;
+// table[(T_int<<4)+T_null] = T_undefined ;
+
+// table[(T_null<<4)+T_undefined] = T_undefined ;
+// table[(T_null<<4)+T_byte] = T_undefined ;
+// table[(T_null<<4)+T_long] = T_undefined ;
+// table[(T_null<<4)+T_short] = T_undefined ;
+// table[(T_null<<4)+T_void] = T_undefined ;
+// table[(T_null<<4)+T_String] = T_undefined ;
+// table[(T_null<<4)+T_Object] = T_undefined ;
+// table[(T_null<<4)+T_double] = T_undefined ;
+// table[(T_null<<4)+T_float] = T_undefined ;
+// table[(T_null<<4)+T_boolean] = T_undefined ;
+// table[(T_null<<4)+T_char] = T_undefined ;
+// table[(T_null<<4)+T_int] = T_undefined ;
+// table[(T_null<<4)+T_null] = T_undefined ;
+
+ //and now.....the return.........
+
+ return table ;
+}
+public static final int[] get_LESS_EQUAL(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+
+// int[] table = new int[16*16] ;
+
+ return get_LESS();
+
+// return table ;
+}
+public static final int[] get_MINUS(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+
+ int[] table = new int[16*16] ;
+
+ table = (int[]) get_PLUS().clone();
+
+ table[(T_String<<4)+T_byte] = T_undefined ;
+ table[(T_String<<4)+T_long] = T_undefined ;
+ table[(T_String<<4)+T_short] = T_undefined ;
+ table[(T_String<<4)+T_void] = T_undefined ;
+ table[(T_String<<4)+T_String] = T_undefined ;
+ table[(T_String<<4)+T_Object] = T_undefined ;
+ table[(T_String<<4)+T_double] = T_undefined ;
+ table[(T_String<<4)+T_float] = T_undefined ;
+ table[(T_String<<4)+T_boolean] = T_undefined ;
+ table[(T_String<<4)+T_char] = T_undefined ;
+ table[(T_String<<4)+T_int] = T_undefined ;
+ table[(T_String<<4)+T_null] = T_undefined ;
+
+ table[(T_byte<<4) +T_String] = T_undefined ;
+ table[(T_long<<4) +T_String] = T_undefined ;
+ table[(T_short<<4) +T_String] = T_undefined ;
+ table[(T_void<<4) +T_String] = T_undefined ;
+ table[(T_Object<<4) +T_String] = T_undefined ;
+ table[(T_double<<4) +T_String] = T_undefined ;
+ table[(T_float<<4) +T_String] = T_undefined ;
+ table[(T_boolean<<4)+T_String] = T_undefined ;
+ table[(T_char<<4) +T_String] = T_undefined ;
+ table[(T_int<<4) +T_String] = T_undefined ;
+ table[(T_null<<4) +T_String] = T_undefined ;
+
+ table[(T_null<<4) +T_null] = T_undefined ;
+
+ //and now.....the return.........
+
+ return table ;
+}
+public static final int[] get_MULTIPLY(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+
+// int[] table = new int[16*16] ;
+
+ return get_MINUS();
+
+// return table ;
+}
+public static final int[] get_OR(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+
+// int[] table = new int[16*16] ;
+
+ return get_AND() ;
+
+// return table ;
+}
+public static final int[] get_OR_OR(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+
+// int[] table = new int[16*16] ;
+
+ return get_AND_AND() ;
+
+// return table ;
+}
+public static final int[] get_PLUS(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+
+ int[] table = new int[16*16] ;
+
+// table[(T_undefined<<4)+T_undefined] = T_undefined ;
+// table[(T_undefined<<4)+T_byte] = T_undefined ;
+// table[(T_undefined<<4)+T_long] = T_undefined ;
+// table[(T_undefined<<4)+T_short] = T_undefined ;
+// table[(T_undefined<<4)+T_void] = T_undefined ;
+// table[(T_undefined<<4)+T_String] = T_undefined ;
+// table[(T_undefined<<4)+T_Object] = T_undefined ;
+// table[(T_undefined<<4)+T_double] = T_undefined ;
+// table[(T_undefined<<4)+T_float] = T_undefined ;
+// table[(T_undefined<<4)+T_boolean] = T_undefined ;
+// table[(T_undefined<<4)+T_char] = T_undefined ;
+// table[(T_undefined<<4)+T_int] = T_undefined ;
+// table[(T_undefined<<4)+T_null] = T_undefined ;
+
+// table[(T_byte<<4)+T_undefined] = T_undefined ;
+ table[(T_byte<<4)+T_byte] = (Byte2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_byte<<4)+T_long] = (Byte2Long<<12)+(Long2Long<<4)+T_long ;
+ table[(T_byte<<4)+T_short] = (Byte2Int<<12)+(Short2Int<<4)+T_int ;
+// table[(T_byte<<4)+T_void] = T_undefined ;
+ table[(T_byte<<4)+T_String] = (Byte2Byte<<12)+(String2String<<4)+T_String ;
+// table[(T_byte<<4)+T_Object] = T_undefined ;
+ table[(T_byte<<4)+T_double] = (Byte2Double<<12)+(Double2Double<<4)+T_double ;
+ table[(T_byte<<4)+T_float] = (Byte2Float<<12)+(Float2Float<<4)+T_float;
+// table[(T_byte<<4)+T_boolean] = T_undefined ;
+ table[(T_byte<<4)+T_char] = (Byte2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_byte<<4)+T_int] = (Byte2Int<<12)+(Int2Int<<4)+T_int ;
+// table[(T_byte<<4)+T_null] = T_undefined ;
+
+// table[(T_long<<4)+T_undefined] = T_undefined ;
+ table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Long<<4)+T_long;
+ table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Long<<4)+T_long ;
+ table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Long<<4)+T_long ;
+// table[(T_long<<4)+T_void] = T_undefined ;
+ table[(T_long<<4)+T_String] = (Long2Long<<12)+(String2String<<4)+T_String ;
+// table[(T_long<<4)+T_Object] = T_undefined ;
+ table[(T_long<<4)+T_double] = (Long2Double<<12)+(Double2Double<<4)+T_double ;
+ table[(T_long<<4)+T_float] = (Long2Float<<12)+(Float2Float<<4)+T_float ;
+// table[(T_long<<4)+T_boolean] = T_undefined ;
+ table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Long<<4)+T_long ;
+ table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Long<<4)+T_long ; ;
+// table[(T_long<<4)+T_null] = T_undefined ;
+
+// table[(T_short<<4)+T_undefined] = T_undefined ;
+ table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_short<<4)+T_long] = (Short2Long<<12)+(Long2Long<<4)+T_long ;
+ table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_int ;
+// table[(T_short<<4)+T_void] = T_undefined ;
+ table[(T_short<<4)+T_String] = (Short2Short<<12)+(String2String<<4)+T_String ;
+// table[(T_short<<4)+T_Object] = T_undefined ;
+ table[(T_short<<4)+T_double] = (Short2Double<<12)+(Double2Double<<4)+T_double ;
+ table[(T_short<<4)+T_float] = (Short2Float<<12)+(Float2Float<<4)+T_float ;
+// table[(T_short<<4)+T_boolean] = T_undefined ;
+ table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_int ;
+// table[(T_short<<4)+T_null] = T_undefined ;
+
+// table[(T_void<<4)+T_undefined] = T_undefined ;
+// table[(T_void<<4)+T_byte] = T_undefined ;
+// table[(T_void<<4)+T_long] = T_undefined ;
+// table[(T_void<<4)+T_short] = T_undefined ;
+// table[(T_void<<4)+T_void] = T_undefined ;
+// table[(T_void<<4)+T_String] = T_undefined ;
+// table[(T_void<<4)+T_Object] = T_undefined ;
+// table[(T_void<<4)+T_double] = T_undefined ;
+// table[(T_void<<4)+T_float] = T_undefined ;
+// table[(T_void<<4)+T_boolean] = T_undefined ;
+// table[(T_void<<4)+T_char] = T_undefined ;
+// table[(T_void<<4)+T_int] = T_undefined ;
+// table[(T_void<<4)+T_null] = T_undefined ;
+
+// table[(T_String<<4)+T_undefined] = T_undefined ;
+ table[(T_String<<4)+T_byte] = (String2String<<12)+(Byte2Byte<<4)+T_String ;
+ table[(T_String<<4)+T_long] = (String2String<<12)+(Long2Long<<4)+T_String ;
+ table[(T_String<<4)+T_short] = (String2String<<12)+(Short2Short<<4)+T_String ;
+// table[(T_String<<4)+T_void] = T_undefined ;
+ table[(T_String<<4)+T_String] = (String2String<<12)+(String2String<<4)+T_String ;
+ table[(T_String<<4)+T_Object] = (String2String<<12)+(T_Object<<8)+(T_Object<<4)+T_String ;
+ table[(T_String<<4)+T_double] = (String2String<<12)+(Double2Double<<4)+T_String ;
+ table[(T_String<<4)+T_float] = (String2String<<12)+(Float2Float<<4)+T_String ;
+ table[(T_String<<4)+T_boolean] = (String2String<<12)+(Boolean2Boolean<<4)+T_String ;
+ table[(T_String<<4)+T_char] = (String2String<<12)+(Char2Char<<4)+T_String ;
+ table[(T_String<<4)+T_int] = (String2String<<12)+(Int2Int<<4)+T_String ;
+ table[(T_String<<4)+T_null] = (String2String<<12)+(T_null<<8)+(T_null<<4)+T_String ;
+
+// table[(T_Object<<4)+T_undefined] = T_undefined ;
+// table[(T_Object<<4)+T_byte] = T_undefined ;
+// table[(T_Object<<4)+T_long] = T_undefined ;
+// table[(T_Object<<4)+T_short] = T_undefined ;
+// table[(T_Object<<4)+T_void] = T_undefined ;
+ table[(T_Object<<4)+T_String] = (T_Object<<16)+(T_Object<<12)+(String2String<<4)+T_String ;
+// table[(T_Object<<4)+T_Object] = T_undefined ;
+// table[(T_Object<<4)+T_double] = T_undefined ;
+// table[(T_Object<<4)+T_float] = T_undefined ;
+// table[(T_Object<<4)+T_boolean] = T_undefined ;
+// table[(T_Object<<4)+T_char] = T_undefined ;
+// table[(T_Object<<4)+T_int] = T_undefined ;
+// table[(T_Object<<4)+T_null] = T_undefined ;
+
+// table[(T_double<<4)+T_undefined] = T_undefined ;
+ table[(T_double<<4)+T_byte] = (Double2Double<<12)+(Byte2Double<<4)+T_double ;
+ table[(T_double<<4)+T_long] = (Double2Double<<12)+(Long2Double<<4)+T_double ;
+ table[(T_double<<4)+T_short] = (Double2Double<<12)+(Short2Double<<4)+T_double ; ;
+// table[(T_double<<4)+T_void] = T_undefined ;
+ table[(T_double<<4)+T_String] = (Double2Double<<12)+(String2String<<4)+T_String ;
+// table[(T_double<<4)+T_Object] = T_undefined ;
+ table[(T_double<<4)+T_double] = (Double2Double<<12)+(Double2Double<<4)+T_double ;
+ table[(T_double<<4)+T_float] = (Double2Double<<12)+(Float2Double<<4)+T_double ; ;
+// table[(T_double<<4)+T_boolean] = T_undefined ;
+ table[(T_double<<4)+T_char] = (Double2Double<<12)+(Char2Double<<4)+T_double ; ;
+ table[(T_double<<4)+T_int] = (Double2Double<<12)+(Int2Double<<4)+T_double ; ;
+// table[(T_double<<4)+T_null] = T_undefined ;
+
+// table[(T_float<<4)+T_undefined] = T_undefined ;
+ table[(T_float<<4)+T_byte] = (Float2Float<<12)+(Byte2Float<<4)+T_float ;
+ table[(T_float<<4)+T_long] = (Float2Float<<12)+(Long2Float<<4)+T_float ;
+ table[(T_float<<4)+T_short] = (Float2Float<<12)+(Short2Float<<4)+T_float ;
+// table[(T_float<<4)+T_void] = T_undefined ;
+ table[(T_float<<4)+T_String] = (Float2Float<<12)+(String2String<<4)+T_String ;
+// table[(T_float<<4)+T_Object] = T_undefined ;
+ table[(T_float<<4)+T_double] = (Float2Double<<12)+(Double2Double<<4)+T_double ;
+ table[(T_float<<4)+T_float] = (Float2Float<<12)+(Float2Float<<4)+T_float ;
+// table[(T_float<<4)+T_boolean] = T_undefined ;
+ table[(T_float<<4)+T_char] = (Float2Float<<12)+(Char2Float<<4)+T_float ;
+ table[(T_float<<4)+T_int] = (Float2Float<<12)+(Int2Float<<4)+T_float ;
+// table[(T_float<<4)+T_null] = T_undefined ;
+
+// table[(T_boolean<<4)+T_undefined] = T_undefined ;
+// table[(T_boolean<<4)+T_byte] = T_undefined ;
+// table[(T_boolean<<4)+T_long] = T_undefined ;
+// table[(T_boolean<<4)+T_short] = T_undefined ;
+// table[(T_boolean<<4)+T_void] = T_undefined ;
+ table[(T_boolean<<4)+T_String] = (Boolean2Boolean<<12)+(String2String<<4)+T_String ;
+// table[(T_boolean<<4)+T_Object] = T_undefined ;
+// table[(T_boolean<<4)+T_double] = T_undefined ;
+// table[(T_boolean<<4)+T_float] = T_undefined ;
+// table[(T_boolean<<4)+T_boolean] = T_undefined ;
+// table[(T_boolean<<4)+T_char] = T_undefined ;
+// table[(T_boolean<<4)+T_int] = T_undefined ;
+// table[(T_boolean<<4)+T_null] = T_undefined ;
+
+// table[(T_char<<4)+T_undefined] = T_undefined ;
+ table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_char<<4)+T_long] = (Char2Long<<12)+(Long2Long<<4)+T_long ;
+ table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_int ;
+// table[(T_char<<4)+T_void] = T_undefined ;
+ table[(T_char<<4)+T_String] = (Char2Char<<12)+(String2String<<4)+T_String ;
+// table[(T_char<<4)+T_Object] = T_undefined ;
+ table[(T_char<<4)+T_double] = (Char2Double<<12)+(Double2Double<<4)+T_double ;
+ table[(T_char<<4)+T_float] = (Char2Float<<12)+(Float2Float<<4)+T_float ;
+// table[(T_char<<4)+T_boolean] = T_undefined ;
+ table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_int ; ;
+ table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_int ;
+// table[(T_char<<4)+T_null] = T_undefined ;
+
+// table[(T_int<<4)+T_undefined] = T_undefined ;
+ table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_int<<4)+T_long] = (Int2Long<<12)+(Long2Long<<4)+T_long ;
+ table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_int ;
+// table[(T_int<<4)+T_void] = T_undefined ;
+ table[(T_int<<4)+T_String] = (Int2Int<<12)+(String2String<<4)+T_String ;
+// table[(T_int<<4)+T_Object] = T_undefined ;
+ table[(T_int<<4)+T_double] = (Int2Double<<12)+(Double2Double<<4)+T_double ;
+ table[(T_int<<4)+T_float] = (Int2Float<<12)+(Float2Float<<4)+T_float ;
+// table[(T_int<<4)+T_boolean] = T_undefined ;
+ table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_int ;
+// table[(T_int<<4)+T_null] = T_undefined ;
+
+// table[(T_null<<4)+T_undefined] = T_undefined ;
+// table[(T_null<<4)+T_byte] = T_undefined ;
+// table[(T_null<<4)+T_long] = T_undefined ;
+// table[(T_null<<4)+T_short] = T_undefined ;
+// table[(T_null<<4)+T_void] = T_undefined ;
+ table[(T_null<<4)+T_String] = (T_null<<16)+(T_null<<12)+(String2String<<4)+T_String ;
+// table[(T_null<<4)+T_Object] = T_undefined ;
+// table[(T_null<<4)+T_double] = T_undefined ;
+// table[(T_null<<4)+T_float] = T_undefined ;
+// table[(T_null<<4)+T_boolean] = T_undefined ;
+// table[(T_null<<4)+T_char] = T_undefined ;
+// table[(T_null<<4)+T_int] = T_undefined ;
+// table[(T_null<<4)+T_null] = (Null2String<<12)+(Null2String<<4)+T_String ;;
+
+ //and now.....the return.........
+
+ return table ;
+}
+public static final int[] get_REMAINDER(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+
+// int[] table = new int[16*16] ;
+
+ return get_MINUS();
+
+// return table ;
+}
+public static final int[] get_RIGHT_SHIFT(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+
+// int[] table = new int[16*16] ;
+
+ return get_LEFT_SHIFT();
+
+// return table ;
+}
+public static final int[] get_UNSIGNED_RIGHT_SHIFT(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+
+// int[] table = new int[16*16] ;
+
+ return get_LEFT_SHIFT();
+
+// return table ;
+}
+public static final int[] get_XOR(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+
+// int[] table = new int[16*16] ;
+
+ return get_AND() ;
+
+// return table ;
+}
+public String operatorToString() {
+ switch ((bits & OperatorMASK) >> OperatorSHIFT) {
+ case EQUAL_EQUAL :
+ return "=="/*nonNLS*/;
+ case LESS_EQUAL :
+ return "<="/*nonNLS*/;
+ case GREATER_EQUAL :
+ return ">="/*nonNLS*/;
+ case NOT_EQUAL :
+ return "!="/*nonNLS*/;
+ case LEFT_SHIFT :
+ return "<<"/*nonNLS*/;
+ case RIGHT_SHIFT :
+ return ">>"/*nonNLS*/;
+ case UNSIGNED_RIGHT_SHIFT :
+ return ">>>"/*nonNLS*/;
+ case OR_OR :
+ return "||"/*nonNLS*/;
+ case AND_AND :
+ return "&&"/*nonNLS*/;
+ case PLUS :
+ return "+"/*nonNLS*/;
+ case MINUS :
+ return "-"/*nonNLS*/;
+ case NOT :
+ return "!"/*nonNLS*/;
+ case REMAINDER :
+ return "%"/*nonNLS*/;
+ case XOR :
+ return "^"/*nonNLS*/;
+ case AND :
+ return "&"/*nonNLS*/;
+ case MULTIPLY :
+ return "*"/*nonNLS*/;
+ case OR :
+ return "|"/*nonNLS*/;
+ case TWIDDLE :
+ return "~"/*nonNLS*/;
+ case DIVIDE :
+ return "/"/*nonNLS*/;
+ case GREATER :
+ return ">"/*nonNLS*/;
+ case LESS :
+ return "<"/*nonNLS*/;
+ case QUESTIONCOLON :
+ return "?:"/*nonNLS*/;
+ case EQUAL :
+ return "="/*nonNLS*/;
+ };
+ return "unknown operator"/*nonNLS*/;
+}
+public String toStringExpression(){
+ /* slow code*/
+
+ //subclass redefine toStringExpressionNoParenthesis()
+
+ return "("/*nonNLS*/ + toStringExpressionNoParenthesis() + ")"/*nonNLS*/;
+}
+
+public abstract String toStringExpressionNoParenthesis();
+
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorIds.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorIds.java
index c4ca1cca3b..50e54efefb 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorIds.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorIds.java
@@ -1,38 +1,36 @@
-package org.eclipse.jdt.internal.compiler.ast;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.*;
-
-public interface OperatorIds {
- public static final int AND_AND = 0;
- public static final int OR_OR = 1;
- public static final int AND = 2;
- public static final int OR = 3;
- public static final int LESS = 4;
- public static final int LESS_EQUAL = 5;
- public static final int GREATER = 6;
- public static final int GREATER_EQUAL = 7;
- public static final int XOR = 8;
- public static final int DIVIDE = 9;
- public static final int LEFT_SHIFT = 10;
- public static final int NOT = 11;
- public static final int TWIDDLE = 12;
- public static final int MINUS = 13;
- public static final int PLUS = 14;
- public static final int MULTIPLY = 15;
- public static final int REMAINDER = 16;
- public static final int RIGHT_SHIFT = 17;
- public static final int EQUAL_EQUAL = 18;
- public static final int UNSIGNED_RIGHT_SHIFT= 19;
- public static final int NumberOfTables = 20;
-
- public static final int QUESTIONCOLON = 23;
-
- public static final int NOT_EQUAL = 29;
- public static final int EQUAL = 30;
- public static final int INSTANCEOF = 31;
- public static final int PLUS_PLUS = 32;
- public static final int MINUS_MINUS = 33;
-}
+package org.eclipse.jdt.internal.compiler.ast;
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+public interface OperatorIds {
+ public static final int AND_AND = 0;
+ public static final int OR_OR = 1;
+ public static final int AND = 2;
+ public static final int OR = 3;
+ public static final int LESS = 4;
+ public static final int LESS_EQUAL = 5;
+ public static final int GREATER = 6;
+ public static final int GREATER_EQUAL = 7;
+ public static final int XOR = 8;
+ public static final int DIVIDE = 9;
+ public static final int LEFT_SHIFT = 10;
+ public static final int NOT = 11;
+ public static final int TWIDDLE = 12;
+ public static final int MINUS = 13;
+ public static final int PLUS = 14;
+ public static final int MULTIPLY = 15;
+ public static final int REMAINDER = 16;
+ public static final int RIGHT_SHIFT = 17;
+ public static final int EQUAL_EQUAL = 18;
+ public static final int UNSIGNED_RIGHT_SHIFT= 19;
+ public static final int NumberOfTables = 20;
+
+ public static final int QUESTIONCOLON = 23;
+
+ public static final int NOT_EQUAL = 29;
+ public static final int EQUAL = 30;
+ public static final int INSTANCEOF = 31;
+ public static final int PLUS_PLUS = 32;
+ public static final int MINUS_MINUS = 33;
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/PostfixExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/PostfixExpression.java
index 008c712c44..05c2e3dc06 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/PostfixExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/PostfixExpression.java
@@ -1,59 +1,58 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-
-public class PostfixExpression extends CompoundAssignment {
-
-public PostfixExpression(Expression l, Expression e, int op, int pos) {
- super(l, e, op);
- sourceStart = l.sourceStart;
- sourceEnd = pos ;
-}
-/**
- * Code generation for PostfixExpression
- *
- * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
- * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
-
- // various scenarii are possible, setting an array reference,
- // a field reference, a blank final field reference, a field of an enclosing instance or
- // just a local variable.
-
- int pc = codeStream.position;
- lhs.generatePostIncrement(currentScope, codeStream, this, valueRequired);
- if (valueRequired) {
- codeStream.generateImplicitConversion(implicitConversion);
- }
- codeStream.recordPositionsFrom(pc, this);
-}
-public String operatorToString() {
- switch (operator) {
- case PLUS :
- return "++"/*nonNLS*/;
- case MINUS :
- return "--"/*nonNLS*/;}
- return "unknown operator"/*nonNLS*/;
-}
-public boolean restrainUsageToNumericTypes(){
- return true ;}
-public String toStringExpressionNoParenthesis(){
- /* slow code*/
-
- return lhs.toStringExpression() + " "/*nonNLS*/ + operatorToString(); }
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- if (visitor.visit(this, scope)) {
- lhs.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.codegen.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class PostfixExpression extends CompoundAssignment {
+
+public PostfixExpression(Expression l, Expression e, int op, int pos) {
+ super(l, e, op);
+ sourceStart = l.sourceStart;
+ sourceEnd = pos ;
+}
+/**
+ * Code generation for PostfixExpression
+ *
+ * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
+ * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+
+ // various scenarii are possible, setting an array reference,
+ // a field reference, a blank final field reference, a field of an enclosing instance or
+ // just a local variable.
+
+ int pc = codeStream.position;
+ lhs.generatePostIncrement(currentScope, codeStream, this, valueRequired);
+ if (valueRequired) {
+ codeStream.generateImplicitConversion(implicitConversion);
+ }
+ codeStream.recordPositionsFrom(pc, this);
+}
+public String operatorToString() {
+ switch (operator) {
+ case PLUS :
+ return "++"/*nonNLS*/;
+ case MINUS :
+ return "--"/*nonNLS*/;}
+ return "unknown operator"/*nonNLS*/;
+}
+public boolean restrainUsageToNumericTypes(){
+ return true ;}
+public String toStringExpressionNoParenthesis(){
+ /* slow code*/
+
+ return lhs.toStringExpression() + " "/*nonNLS*/ + operatorToString(); }
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ lhs.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/PrefixExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/PrefixExpression.java
index 7912487957..1b1db93f93 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/PrefixExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/PrefixExpression.java
@@ -1,45 +1,44 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-
-public class PrefixExpression extends CompoundAssignment {
-/**
- * PrefixExpression constructor comment.
- * @param l org.eclipse.jdt.internal.compiler.ast.Expression
- * @param r org.eclipse.jdt.internal.compiler.ast.Expression
- * @param op int
- */
-public PrefixExpression(Expression l, Expression e, int op, int pos) {
- super(l, e, op);
- sourceStart = pos;
- sourceEnd = l.sourceEnd;
-}
-public String operatorToString() {
- switch (operator) {
- case PLUS :
- return "++"/*nonNLS*/;
- case MINUS :
- return "--"/*nonNLS*/;}
- return "unknown operator"/*nonNLS*/;
-}
-public boolean restrainUsageToNumericTypes(){
- return true ;}
-public String toStringExpressionNoParenthesis(){
- /* slow code */
-
- return operatorToString() + " "/*nonNLS*/ + lhs.toStringExpression() ;
-
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- if (visitor.visit(this, scope)) {
- lhs.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class PrefixExpression extends CompoundAssignment {
+/**
+ * PrefixExpression constructor comment.
+ * @param l org.eclipse.jdt.internal.compiler.ast.Expression
+ * @param r org.eclipse.jdt.internal.compiler.ast.Expression
+ * @param op int
+ */
+public PrefixExpression(Expression l, Expression e, int op, int pos) {
+ super(l, e, op);
+ sourceStart = pos;
+ sourceEnd = l.sourceEnd;
+}
+public String operatorToString() {
+ switch (operator) {
+ case PLUS :
+ return "++"/*nonNLS*/;
+ case MINUS :
+ return "--"/*nonNLS*/;}
+ return "unknown operator"/*nonNLS*/;
+}
+public boolean restrainUsageToNumericTypes(){
+ return true ;}
+public String toStringExpressionNoParenthesis(){
+ /* slow code */
+
+ return operatorToString() + " "/*nonNLS*/ + lhs.toStringExpression() ;
+
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ lhs.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
index fc7d922aea..7b03177772 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
@@ -1,263 +1,262 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-
-public class QualifiedAllocationExpression extends AllocationExpression {
- //qualification may be on both side
- public Expression enclosingInstance;
- public AnonymousLocalTypeDeclaration anonymousType;
-
-public QualifiedAllocationExpression() {
-
-}
-public QualifiedAllocationExpression(AnonymousLocalTypeDeclaration anonymous) {
- anonymousType = anonymous ;
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
-
- // variation on allocation, where can be specified an enclosing instance and an anonymous type
-
- // analyse the enclosing instance
- if (enclosingInstance != null) {
- flowInfo = enclosingInstance.analyseCode(currentScope, flowContext, flowInfo);
- }
- // process arguments
- if (arguments != null) {
- for (int i = 0, count = arguments.length; i < count; i++) {
- flowInfo = arguments[i].analyseCode(currentScope, flowContext, flowInfo);
- }
- }
- // record some dependency information for exception types
- int count;
- ReferenceBinding[] thrownExceptions;
- if ((count = (thrownExceptions = binding.thrownExceptions).length) != 0) {
- // check exception handling
- flowContext.checkExceptionHandlers(thrownExceptions, this, flowInfo, currentScope);
- }
-
- // analyse the anonymous nested type
- if (anonymousType != null) {
- flowInfo = anonymousType.analyseCode(currentScope, flowContext, flowInfo);
- }
- manageEnclosingInstanceAccessIfNecessary(currentScope);
- manageSyntheticAccessIfNecessary(currentScope);
- return flowInfo;
-}
-public Expression enclosingInstance() {
- return enclosingInstance;
-}
-public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
- int pc = codeStream.position;
- ReferenceBinding allocatedType = binding.declaringClass;
- if (allocatedType.isLocalType()) {
- LocalTypeBinding localType = (LocalTypeBinding) allocatedType;
- localType.constantPoolName(codeStream.classFile.outerMostEnclosingClassFile().computeConstantPoolName(localType));
- }
- if (syntheticAccessor == null) {
- codeStream.new_(allocatedType);
- if (valueRequired) {
- codeStream.dup();
- }
- // better highlight for allocation: display the type individually
- codeStream.recordPositionsFrom(pc, type);
- }
- // handling innerclass instance allocation
- if (allocatedType.isNestedType()) { // make sure its name is computed before arguments, since may be necessary for argument emulation
- codeStream.generateSyntheticArgumentValues(currentScope, allocatedType, enclosingInstance(), this);
- }
- // generate the arguments for constructor
- if (arguments != null) {
- for (int i = 0, count = arguments.length; i < count; i++) {
- arguments[i].generateCode(currentScope, codeStream, true);
- }
- }
- // invoke constructor
- if (syntheticAccessor == null) {
- codeStream.invokespecial(binding);
- } else {
- codeStream.invokestatic(syntheticAccessor);
- }
- codeStream.recordPositionsFrom(pc, this);
- if (anonymousType != null) {
- anonymousType.generateCode(currentScope, codeStream);
- }
-}
-public boolean isSuperAccess() {
- // necessary to lookup super constructor of anonymous type
- return anonymousType != null;
-}
-/* Inner emulation consists in either recording a dependency
- * link only, or performing one level of propagation.
- *
- * Dependency mechanism is used whenever dealing with source target
- * types, since by the time we reach them, we might not yet know their
- * exact need.
- */
-public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
- ReferenceBinding invocationType, allocatedType;
-
- // perform some emulation work in case there is some and we are inside a local type only
- if ((allocatedType = binding.declaringClass).isNestedType() && currentScope.enclosingSourceType().isLocalType()) {
-
- if (allocatedType.isLocalType()){
- ((LocalTypeBinding)allocatedType).addInnerEmulationDependent(currentScope, enclosingInstance != null, false); // request cascade of accesses
- } else {
- // locally propagate, since we already now the desired shape for sure
- currentScope.propagateInnerEmulation(allocatedType, enclosingInstance != null, false); // request cascade of accesses
- }
- }
-}
-public TypeBinding resolveType(BlockScope scope) {
- if (anonymousType == null && enclosingInstance == null)
- return super.resolveType(scope); // added for code assist... is not possible with 'normal' code
-
- // Propagate the type checking to the arguments, and checks if the constructor is defined.
-
- // ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
- // ClassInstanceCreationExpression ::= Name '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
- // ==> by construction, when there is an enclosing instance the typename may NOT be qualified
- // ==> therefore by construction the type is always a SingleTypeReferenceType instead of being either
- // sometime a SingleTypeReference and sometime a QualifedTypeReference
-
- constant = NotAConstant;
- TypeBinding enclosingInstTb = null;
- TypeBinding recType;
- if (anonymousType == null) {
- //----------------no anonymous class------------------------
- if ((enclosingInstTb = enclosingInstance.resolveType(scope)) == null)
- return null;
- if (enclosingInstTb.isBaseType() | enclosingInstTb.isArrayType()) {
- scope.problemReporter().illegalPrimitiveOrArrayTypeForEnclosingInstance(enclosingInstTb, enclosingInstance);
- return null;
- }
- recType = ((SingleTypeReference) type).resolveTypeEnclosing(scope, (ReferenceBinding) enclosingInstTb); // will check for null after args are resolved
- TypeBinding[] argumentTypes = NoParameters;
- if (arguments != null) {
- boolean argHasError = false;
- int length = arguments.length;
- argumentTypes = new TypeBinding[length];
- for (int i = 0; i < length; i++)
- if ((argumentTypes[i] = arguments[i].resolveType(scope)) == null)
- argHasError = true;
- if (argHasError)
- return recType;
- }
- if (recType == null)
- return null;
- if (!recType.canBeInstantiated()) {
- scope.problemReporter().cannotInstantiate(type, recType);
- return recType;
- }
- if ((binding = scope.getConstructor((ReferenceBinding) recType, argumentTypes, this)).isValidBinding()) {
- if (isMethodUseDeprecated(binding, scope))
- scope.problemReporter().deprecatedMethod(binding, this);
-
- if (arguments != null)
- for (int i = 0; i < arguments.length; i++)
- arguments[i].implicitWidening(binding.parameters[i], argumentTypes[i]);
- } else {
- if (binding.declaringClass == null)
- binding.declaringClass = (ReferenceBinding) recType;
- scope.problemReporter().invalidConstructor(this, binding);
- return recType;
- }
-
- // The enclosing instance must be compatible with the innermost enclosing type
- ReferenceBinding expectedType = binding.declaringClass.enclosingType();
- if (scope.areTypesCompatible(enclosingInstTb, expectedType))
- return recType;
- scope.problemReporter().typeMismatchErrorActualTypeExpectedType(enclosingInstance, enclosingInstTb, expectedType);
- return recType;
- }
-
- //--------------there is an anonymous type declaration-----------------
- if (enclosingInstance != null) {
- if ((enclosingInstTb = enclosingInstance.resolveType(scope)) == null)
- return null;
- if (enclosingInstTb.isBaseType() | enclosingInstTb.isArrayType()) {
- scope.problemReporter().illegalPrimitiveOrArrayTypeForEnclosingInstance(enclosingInstTb, enclosingInstance);
- return null;
- }
- }
- // due to syntax-construction, recType is a ReferenceBinding
- recType =
- (enclosingInstance == null)
- ? type.resolveType(scope)
- : ((SingleTypeReference) type).resolveTypeEnclosing(scope, (ReferenceBinding) enclosingInstTb);
- if (recType == null)
- return null;
- if (((ReferenceBinding) recType).isFinal()) {
- scope.problemReporter().anonymousClassCannotExtendFinalClass(type, recType);
- return null;
- }
- TypeBinding[] argumentTypes = NoParameters;
- if (arguments != null) {
- int length = arguments.length;
- argumentTypes = new TypeBinding[length];
- for (int i = 0; i < length; i++)
- if ((argumentTypes[i] = arguments[i].resolveType(scope)) == null)
- return null;
- }
-
- // an anonymous class inherits from java.lang.Object when declared "after" an interface
- ReferenceBinding superBinding = recType.isInterface() ? scope.getJavaLangObject() : (ReferenceBinding) recType;
- MethodBinding inheritedBinding = scope.getConstructor(superBinding, argumentTypes, this);
- if (!inheritedBinding.isValidBinding()) {
- if (inheritedBinding.declaringClass == null)
- inheritedBinding.declaringClass = superBinding;
- scope.problemReporter().invalidConstructor(this, inheritedBinding);
- return null;
- }
- if (enclosingInstance != null) {
- if (!scope.areTypesCompatible(enclosingInstTb, inheritedBinding.declaringClass.enclosingType())) {
- scope.problemReporter().typeMismatchErrorActualTypeExpectedType(enclosingInstance, enclosingInstTb, inheritedBinding.declaringClass.enclosingType());
- return null;
- }
- }
-
- // this promotion has to be done somewhere: here or inside the constructor of the
- // anonymous class. We do it here while the constructor of the inner is then easier.
- if (arguments != null)
- for (int i = 0; i < arguments.length; i++)
- arguments[i].implicitWidening(inheritedBinding.parameters[i], argumentTypes[i]);
-
- // Update the anonymous inner class : superclass, interface
- scope.addAnonymousType(anonymousType, (ReferenceBinding) recType);
- anonymousType.resolve(scope);
- binding = anonymousType.createsInternalConstructorWithBinding(inheritedBinding);
- return anonymousType.binding; // 1.2 change
-}
-public String toStringExpression(int tab) {
- /*slow code */
-
- String s = ""/*nonNLS*/;
- if (enclosingInstance != null)
- s += enclosingInstance.toString() + "."/*nonNLS*/;
- s += super.toStringExpression(tab);
- if (anonymousType != null) {
- s += anonymousType.toString(tab);
- } //allows to restart just after the } one line under ....
- return s;
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- if (visitor.visit(this, scope)) {
- if (enclosingInstance != null) enclosingInstance.traverse(visitor, scope);
- type.traverse(visitor, scope);
- if (arguments != null) {
- int argumentsLength = arguments.length;
- for (int i = 0; i < argumentsLength; i++)
- arguments[i].traverse(visitor, scope);
- }
- if (anonymousType != null) anonymousType.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.codegen.*;
+import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class QualifiedAllocationExpression extends AllocationExpression {
+ //qualification may be on both side
+ public Expression enclosingInstance;
+ public AnonymousLocalTypeDeclaration anonymousType;
+
+public QualifiedAllocationExpression() {
+
+}
+public QualifiedAllocationExpression(AnonymousLocalTypeDeclaration anonymous) {
+ anonymousType = anonymous ;
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+
+ // variation on allocation, where can be specified an enclosing instance and an anonymous type
+
+ // analyse the enclosing instance
+ if (enclosingInstance != null) {
+ flowInfo = enclosingInstance.analyseCode(currentScope, flowContext, flowInfo);
+ }
+ // process arguments
+ if (arguments != null) {
+ for (int i = 0, count = arguments.length; i < count; i++) {
+ flowInfo = arguments[i].analyseCode(currentScope, flowContext, flowInfo);
+ }
+ }
+ // record some dependency information for exception types
+ int count;
+ ReferenceBinding[] thrownExceptions;
+ if ((count = (thrownExceptions = binding.thrownExceptions).length) != 0) {
+ // check exception handling
+ flowContext.checkExceptionHandlers(thrownExceptions, this, flowInfo, currentScope);
+ }
+
+ // analyse the anonymous nested type
+ if (anonymousType != null) {
+ flowInfo = anonymousType.analyseCode(currentScope, flowContext, flowInfo);
+ }
+ manageEnclosingInstanceAccessIfNecessary(currentScope);
+ manageSyntheticAccessIfNecessary(currentScope);
+ return flowInfo;
+}
+public Expression enclosingInstance() {
+ return enclosingInstance;
+}
+public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+ int pc = codeStream.position;
+ ReferenceBinding allocatedType = binding.declaringClass;
+ if (allocatedType.isLocalType()) {
+ LocalTypeBinding localType = (LocalTypeBinding) allocatedType;
+ localType.constantPoolName(codeStream.classFile.outerMostEnclosingClassFile().computeConstantPoolName(localType));
+ }
+ if (syntheticAccessor == null) {
+ codeStream.new_(allocatedType);
+ if (valueRequired) {
+ codeStream.dup();
+ }
+ // better highlight for allocation: display the type individually
+ codeStream.recordPositionsFrom(pc, type);
+ }
+ // handling innerclass instance allocation
+ if (allocatedType.isNestedType()) { // make sure its name is computed before arguments, since may be necessary for argument emulation
+ codeStream.generateSyntheticArgumentValues(currentScope, allocatedType, enclosingInstance(), this);
+ }
+ // generate the arguments for constructor
+ if (arguments != null) {
+ for (int i = 0, count = arguments.length; i < count; i++) {
+ arguments[i].generateCode(currentScope, codeStream, true);
+ }
+ }
+ // invoke constructor
+ if (syntheticAccessor == null) {
+ codeStream.invokespecial(binding);
+ } else {
+ codeStream.invokestatic(syntheticAccessor);
+ }
+ codeStream.recordPositionsFrom(pc, this);
+ if (anonymousType != null) {
+ anonymousType.generateCode(currentScope, codeStream);
+ }
+}
+public boolean isSuperAccess() {
+ // necessary to lookup super constructor of anonymous type
+ return anonymousType != null;
+}
+/* Inner emulation consists in either recording a dependency
+ * link only, or performing one level of propagation.
+ *
+ * Dependency mechanism is used whenever dealing with source target
+ * types, since by the time we reach them, we might not yet know their
+ * exact need.
+ */
+public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
+ ReferenceBinding invocationType, allocatedType;
+
+ // perform some emulation work in case there is some and we are inside a local type only
+ if ((allocatedType = binding.declaringClass).isNestedType() && currentScope.enclosingSourceType().isLocalType()) {
+
+ if (allocatedType.isLocalType()){
+ ((LocalTypeBinding)allocatedType).addInnerEmulationDependent(currentScope, enclosingInstance != null, false); // request cascade of accesses
+ } else {
+ // locally propagate, since we already now the desired shape for sure
+ currentScope.propagateInnerEmulation(allocatedType, enclosingInstance != null, false); // request cascade of accesses
+ }
+ }
+}
+public TypeBinding resolveType(BlockScope scope) {
+ if (anonymousType == null && enclosingInstance == null)
+ return super.resolveType(scope); // added for code assist... is not possible with 'normal' code
+
+ // Propagate the type checking to the arguments, and checks if the constructor is defined.
+
+ // ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
+ // ClassInstanceCreationExpression ::= Name '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
+ // ==> by construction, when there is an enclosing instance the typename may NOT be qualified
+ // ==> therefore by construction the type is always a SingleTypeReferenceType instead of being either
+ // sometime a SingleTypeReference and sometime a QualifedTypeReference
+
+ constant = NotAConstant;
+ TypeBinding enclosingInstTb = null;
+ TypeBinding recType;
+ if (anonymousType == null) {
+ //----------------no anonymous class------------------------
+ if ((enclosingInstTb = enclosingInstance.resolveType(scope)) == null)
+ return null;
+ if (enclosingInstTb.isBaseType() | enclosingInstTb.isArrayType()) {
+ scope.problemReporter().illegalPrimitiveOrArrayTypeForEnclosingInstance(enclosingInstTb, enclosingInstance);
+ return null;
+ }
+ recType = ((SingleTypeReference) type).resolveTypeEnclosing(scope, (ReferenceBinding) enclosingInstTb); // will check for null after args are resolved
+ TypeBinding[] argumentTypes = NoParameters;
+ if (arguments != null) {
+ boolean argHasError = false;
+ int length = arguments.length;
+ argumentTypes = new TypeBinding[length];
+ for (int i = 0; i < length; i++)
+ if ((argumentTypes[i] = arguments[i].resolveType(scope)) == null)
+ argHasError = true;
+ if (argHasError)
+ return recType;
+ }
+ if (recType == null)
+ return null;
+ if (!recType.canBeInstantiated()) {
+ scope.problemReporter().cannotInstantiate(type, recType);
+ return recType;
+ }
+ if ((binding = scope.getConstructor((ReferenceBinding) recType, argumentTypes, this)).isValidBinding()) {
+ if (isMethodUseDeprecated(binding, scope))
+ scope.problemReporter().deprecatedMethod(binding, this);
+
+ if (arguments != null)
+ for (int i = 0; i < arguments.length; i++)
+ arguments[i].implicitWidening(binding.parameters[i], argumentTypes[i]);
+ } else {
+ if (binding.declaringClass == null)
+ binding.declaringClass = (ReferenceBinding) recType;
+ scope.problemReporter().invalidConstructor(this, binding);
+ return recType;
+ }
+
+ // The enclosing instance must be compatible with the innermost enclosing type
+ ReferenceBinding expectedType = binding.declaringClass.enclosingType();
+ if (scope.areTypesCompatible(enclosingInstTb, expectedType))
+ return recType;
+ scope.problemReporter().typeMismatchErrorActualTypeExpectedType(enclosingInstance, enclosingInstTb, expectedType);
+ return recType;
+ }
+
+ //--------------there is an anonymous type declaration-----------------
+ if (enclosingInstance != null) {
+ if ((enclosingInstTb = enclosingInstance.resolveType(scope)) == null)
+ return null;
+ if (enclosingInstTb.isBaseType() | enclosingInstTb.isArrayType()) {
+ scope.problemReporter().illegalPrimitiveOrArrayTypeForEnclosingInstance(enclosingInstTb, enclosingInstance);
+ return null;
+ }
+ }
+ // due to syntax-construction, recType is a ReferenceBinding
+ recType =
+ (enclosingInstance == null)
+ ? type.resolveType(scope)
+ : ((SingleTypeReference) type).resolveTypeEnclosing(scope, (ReferenceBinding) enclosingInstTb);
+ if (recType == null)
+ return null;
+ if (((ReferenceBinding) recType).isFinal()) {
+ scope.problemReporter().anonymousClassCannotExtendFinalClass(type, recType);
+ return null;
+ }
+ TypeBinding[] argumentTypes = NoParameters;
+ if (arguments != null) {
+ int length = arguments.length;
+ argumentTypes = new TypeBinding[length];
+ for (int i = 0; i < length; i++)
+ if ((argumentTypes[i] = arguments[i].resolveType(scope)) == null)
+ return null;
+ }
+
+ // an anonymous class inherits from java.lang.Object when declared "after" an interface
+ ReferenceBinding superBinding = recType.isInterface() ? scope.getJavaLangObject() : (ReferenceBinding) recType;
+ MethodBinding inheritedBinding = scope.getConstructor(superBinding, argumentTypes, this);
+ if (!inheritedBinding.isValidBinding()) {
+ if (inheritedBinding.declaringClass == null)
+ inheritedBinding.declaringClass = superBinding;
+ scope.problemReporter().invalidConstructor(this, inheritedBinding);
+ return null;
+ }
+ if (enclosingInstance != null) {
+ if (!scope.areTypesCompatible(enclosingInstTb, inheritedBinding.declaringClass.enclosingType())) {
+ scope.problemReporter().typeMismatchErrorActualTypeExpectedType(enclosingInstance, enclosingInstTb, inheritedBinding.declaringClass.enclosingType());
+ return null;
+ }
+ }
+
+ // this promotion has to be done somewhere: here or inside the constructor of the
+ // anonymous class. We do it here while the constructor of the inner is then easier.
+ if (arguments != null)
+ for (int i = 0; i < arguments.length; i++)
+ arguments[i].implicitWidening(inheritedBinding.parameters[i], argumentTypes[i]);
+
+ // Update the anonymous inner class : superclass, interface
+ scope.addAnonymousType(anonymousType, (ReferenceBinding) recType);
+ anonymousType.resolve(scope);
+ binding = anonymousType.createsInternalConstructorWithBinding(inheritedBinding);
+ return anonymousType.binding; // 1.2 change
+}
+public String toStringExpression(int tab) {
+ /*slow code */
+
+ String s = ""/*nonNLS*/;
+ if (enclosingInstance != null)
+ s += enclosingInstance.toString() + "."/*nonNLS*/;
+ s += super.toStringExpression(tab);
+ if (anonymousType != null) {
+ s += anonymousType.toString(tab);
+ } //allows to restart just after the } one line under ....
+ return s;
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ if (enclosingInstance != null) enclosingInstance.traverse(visitor, scope);
+ type.traverse(visitor, scope);
+ if (arguments != null) {
+ int argumentsLength = arguments.length;
+ for (int i = 0; i < argumentsLength; i++)
+ arguments[i].traverse(visitor, scope);
+ }
+ if (anonymousType != null) anonymousType.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java
index 9114662b63..5ae24c0120 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java
@@ -1,612 +1,612 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-
-public class QualifiedNameReference extends NameReference {
- public char[][] tokens;
- public FieldBinding[] otherBindings;
- public int indexOfFirstFieldBinding; //points (into tokens) for the first token that corresponds to first FieldBinding
-
- SyntheticAccessMethodBinding syntheticWriteAccessor;
- SyntheticAccessMethodBinding[] syntheticReadAccessors;
- protected FieldBinding lastFieldBinding;
-public QualifiedNameReference(char[][] sources, int sourceStart, int sourceEnd) {
- super();
- tokens = sources;
- this.sourceStart = sourceStart;
- this.sourceEnd = sourceEnd;
-}
-public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment, boolean isCompound) {
- if (assignment.expression != null) {
- flowInfo = assignment.expression.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
- }
- // determine the rank until which we now we do not need any actual value for the field access
- int otherBindingsCount = otherBindings == null ? 0 : otherBindings.length;
- int indexOfFirstValueRequired = otherBindingsCount;
- while (indexOfFirstValueRequired > 0) {
- FieldBinding otherBinding = otherBindings[indexOfFirstValueRequired - 1];
- if (otherBinding.isStatic())
- break; // no longer need any value before this point
- indexOfFirstValueRequired--;
- }
-
- FieldBinding lastFieldBinding = null;
- if ((bits & FIELD) != 0) {
- // reading from a field
- // check if final blank field
- if ((lastFieldBinding = (FieldBinding) binding).isFinal() && currentScope.allowBlankFinalFieldAssignment(lastFieldBinding)) {
- if (!flowInfo.isDefinitelyAssigned(lastFieldBinding)) {
- currentScope.problemReporter().uninitializedBlankFinalField(lastFieldBinding, this);
- }
- }
- } else {
- if ((bits & LOCAL) != 0) {
- // first binding is a local variable
- LocalVariableBinding localBinding;
- if (!flowInfo.isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
- currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
- }
- if (!flowInfo.isFakeReachable()) localBinding.used = true;
- }
- }
- if (indexOfFirstValueRequired == 0) {
- manageEnclosingInstanceAccessIfNecessary(currentScope); // only for first binding
- }
- // all intermediate field accesses are read accesses
- if (otherBindings != null) {
- int start = indexOfFirstValueRequired == 0 ? 0 : indexOfFirstValueRequired - 1;
- for (int i = start; i < otherBindingsCount; i++) {
- if (lastFieldBinding != null) { // could be null if first was a local variable
- manageSyntheticReadAccessIfNecessary(currentScope, lastFieldBinding, i);
- }
- lastFieldBinding = otherBindings[i];
- }
- }
- if (isCompound) {
- if (binding == lastFieldBinding && currentScope.allowBlankFinalFieldAssignment(lastFieldBinding) && (!flowInfo.isDefinitelyAssigned(lastFieldBinding))) {
- currentScope.problemReporter().uninitializedBlankFinalField(lastFieldBinding, this);
- }
- manageSyntheticReadAccessIfNecessary(currentScope, lastFieldBinding, binding == lastFieldBinding ? 0 : otherBindings.length);
- }
- // the last field access is a write access
- if (lastFieldBinding.isFinal()) {
- // in a context where it can be assigned?
- if (currentScope.allowBlankFinalFieldAssignment(lastFieldBinding)) {
- if (flowInfo.isPotentiallyAssigned(lastFieldBinding)) {
- if (indexOfFirstFieldBinding == 1) { // was an implicit reference to the first field binding
- currentScope.problemReporter().duplicateInitializationOfBlankFinalField(lastFieldBinding, this);
- } else {
- currentScope.problemReporter().cannotAssignToFinalField(lastFieldBinding, this); // attempting to assign a non implicit reference
- }
- }
- flowInfo.markAsDefinitelyAssigned(lastFieldBinding);
- flowContext.recordSettingFinal(lastFieldBinding, this);
- } else {
- currentScope.problemReporter().cannotAssignToFinalField(lastFieldBinding, this);
- }
- }
- // equivalent to valuesRequired[maxOtherBindings]
- manageSyntheticWriteAccessIfNecessary(currentScope, lastFieldBinding);
- return flowInfo;
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- return analyseCode(currentScope, flowContext, flowInfo, true);
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired) {
-
- // determine the rank until which we now we do not need any actual value for the field access
- int otherBindingsCount = otherBindings == null ? 0 : otherBindings.length;
- int indexOfFirstValueRequired;
- if (valueRequired) {
- indexOfFirstValueRequired = otherBindingsCount;
- while (indexOfFirstValueRequired > 0) {
- FieldBinding otherBinding = otherBindings[indexOfFirstValueRequired - 1];
- if (otherBinding.isStatic())
- break; // no longer need any value before this point
- indexOfFirstValueRequired--;
- }
- } else {
- indexOfFirstValueRequired = otherBindingsCount + 1;
- }
- switch (bits & RestrictiveFlagMASK) {
- case FIELD : // reading a field
- if (indexOfFirstValueRequired == 0) {
- manageSyntheticReadAccessIfNecessary(currentScope, (FieldBinding) binding, 0);
- }
- // check if reading a final blank field
- FieldBinding fieldBinding;
- if ((fieldBinding = (FieldBinding) binding).isFinal()
- && (indexOfFirstFieldBinding == 1) // was an implicit reference to the first field binding
- && currentScope.allowBlankFinalFieldAssignment(fieldBinding)
- && (!flowInfo.isDefinitelyAssigned(fieldBinding))) {
- currentScope.problemReporter().uninitializedBlankFinalField(fieldBinding, this);
- }
- break;
- case LOCAL : // reading a local variable
- LocalVariableBinding localBinding;
- if (!flowInfo.isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
- currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
- }
- if (!flowInfo.isFakeReachable()) localBinding.used = true;
- }
- if (indexOfFirstValueRequired == 0) {
- manageEnclosingInstanceAccessIfNecessary(currentScope); // only for first binding
- }
- if (otherBindings != null) {
- int start = indexOfFirstValueRequired == 0 ? 0 : indexOfFirstValueRequired - 1;
- for (int i = start; i < otherBindingsCount; i++) {
- manageSyntheticReadAccessIfNecessary(currentScope, otherBindings[i], i + 1);
- }
- }
- return flowInfo;
-}
-/**
- * Check and/or redirect the field access to the delegate receiver if any
- */
-public TypeBinding checkFieldAccess(BlockScope scope) {
- // check for forward references
- FieldBinding fieldBinding = (FieldBinding) binding;
- MethodScope methodScope = scope.methodScope();
- if (methodScope.enclosingSourceType() == fieldBinding.declaringClass
- && methodScope.fieldDeclarationIndex != methodScope.NotInFieldDecl
- && fieldBinding.id >= methodScope.fieldDeclarationIndex) {
- if ((!fieldBinding.isStatic() || methodScope.isStatic)
- && this.indexOfFirstFieldBinding == 1)
- scope.problemReporter().forwardReference(this, 0, scope.enclosingSourceType());
- }
- bits &= ~RestrictiveFlagMASK; // clear bits
- bits |= FIELD;
- return getOtherFieldBindings(scope);
-}
-public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) {
- generateReadSequence(currentScope, codeStream, true);
- // the last field access is a write access
- assignment.expression.generateCode(currentScope, codeStream, true);
- fieldStore(codeStream, lastFieldBinding, syntheticWriteAccessor, valueRequired); // equivalent to valuesRequired[maxOtherBindings]
- if (valueRequired) {
- codeStream.generateImplicitConversion(assignment.implicitConversion);
- }
-}
-public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
- int pc = codeStream.position;
- if (constant != NotAConstant) {
- if (valueRequired) {
- codeStream.generateConstant(constant, implicitConversion);
- }
- } else {
- generateReadSequence(currentScope, codeStream, valueRequired);
- if (valueRequired) {
- if (lastFieldBinding.declaringClass == null) { // array length
- codeStream.arraylength();
- codeStream.generateImplicitConversion(implicitConversion);
- } else {
- if (lastFieldBinding.constant != NotAConstant) {
- // inline the last field constant
- codeStream.generateConstant(lastFieldBinding.constant, implicitConversion);
- } else {
- SyntheticAccessMethodBinding accessor = syntheticReadAccessors == null ? null : syntheticReadAccessors[syntheticReadAccessors.length - 1];
- if (accessor == null) {
- if (lastFieldBinding.isStatic()) {
- codeStream.getstatic(lastFieldBinding);
- } else {
- codeStream.getfield(lastFieldBinding);
- }
- } else {
- codeStream.invokestatic(accessor);
- }
- codeStream.generateImplicitConversion(implicitConversion);
- }
- }
- }
- }
- codeStream.recordPositionsFrom(pc, this);
-}
-public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) {
-
- generateReadSequence(currentScope, codeStream, true);
- SyntheticAccessMethodBinding accessor = syntheticReadAccessors == null ? null : syntheticReadAccessors[syntheticReadAccessors.length - 1];
-
- if (lastFieldBinding.isStatic()){
- if (accessor == null) {
- codeStream.getstatic(lastFieldBinding);
- } else {
- codeStream.invokestatic(accessor);
- }
- } else {
- codeStream.dup();
- if (accessor == null) {
- codeStream.getfield(lastFieldBinding);
- } else {
- codeStream.invokestatic(accessor);
- }
- }
- // the last field access is a write access
- // perform the actual compound operation
- int operationTypeID;
- if ((operationTypeID = implicitConversion >> 4) == T_String) {
- codeStream.generateStringAppend(currentScope, null, expression);
- } else {
- // promote the array reference to the suitable operation type
- codeStream.generateImplicitConversion(implicitConversion);
- // generate the increment value (will by itself be promoted to the operation value)
- if (expression == IntLiteral.One){ // prefix operation
- codeStream.generateConstant(expression.constant, implicitConversion);
- } else {
- expression.generateCode(currentScope, codeStream, true);
- }
- // perform the operation
- codeStream.sendOperator(operator, operationTypeID);
- // cast the value back to the array reference type
- codeStream.generateImplicitConversion(assignmentImplicitConversion);
- }
- // actual assignment
- fieldStore(codeStream, lastFieldBinding, syntheticWriteAccessor, valueRequired); // equivalent to valuesRequired[maxOtherBindings]
-}
-public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired) {
- generateReadSequence(currentScope, codeStream, true);
- SyntheticAccessMethodBinding accessor = syntheticReadAccessors == null ? null : syntheticReadAccessors[syntheticReadAccessors.length - 1];
-
- if (lastFieldBinding.isStatic()){
- if (accessor == null) {
- codeStream.getstatic(lastFieldBinding);
- } else {
- codeStream.invokestatic(accessor);
- }
- } else {
- codeStream.dup();
- if (accessor == null) {
- codeStream.getfield(lastFieldBinding);
- } else {
- codeStream.invokestatic(accessor);
- }
- }
- // duplicate the old field value
- if (valueRequired) {
- if (lastFieldBinding.isStatic()) {
- if ((lastFieldBinding.type == LongBinding) || (lastFieldBinding.type == DoubleBinding)) {
- codeStream.dup2();
- } else {
- codeStream.dup();
- }
- } else { // Stack: [owner][old field value] ---> [old field value][owner][old field value]
- if ((lastFieldBinding.type == LongBinding) || (lastFieldBinding.type == DoubleBinding)) {
- codeStream.dup2_x1();
- } else {
- codeStream.dup_x1();
- }
- }
- }
- codeStream.generateConstant(postIncrement.expression.constant, implicitConversion);
- codeStream.sendOperator(postIncrement.operator, lastFieldBinding.type.id);
- codeStream.generateImplicitConversion(postIncrement.assignmentImplicitConversion);
-
- fieldStore(codeStream, lastFieldBinding, syntheticWriteAccessor, false);
-}
-/*
- * Generate code for all bindings (local and fields) excluding the last one, which may then be generated code
- * for a read or write access.
- */
-public void generateReadSequence(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
-
- // determine the rank until which we now we do not need any actual value for the field access
- int otherBindingsCount = otherBindings == null ? 0 : otherBindings.length;
- int indexOfFirstValueRequired;
- if (valueRequired) {
- indexOfFirstValueRequired = otherBindingsCount;
- while (indexOfFirstValueRequired > 0) {
- FieldBinding otherBinding = otherBindings[indexOfFirstValueRequired - 1];
- if (otherBinding.isStatic() || otherBinding.constant != NotAConstant)
- break; // no longer need any value before this point
- indexOfFirstValueRequired--;
- }
- } else {
- indexOfFirstValueRequired = otherBindingsCount + 1;
- }
- if (indexOfFirstValueRequired == 0) {
- switch (bits & RestrictiveFlagMASK) {
- case FIELD :
- lastFieldBinding = (FieldBinding) binding;
-
- // if first field is actually constant, we can inline it
- if (lastFieldBinding.constant != NotAConstant) {
- codeStream.generateConstant(lastFieldBinding.constant, 0); // no implicit conversion
- lastFieldBinding = null; // will not generate it again
- break;
- }
- if (!lastFieldBinding.isStatic()) {
- if ((bits & DepthMASK) != 0) {
- Object[] emulationPath = currentScope.getExactEmulationPath(currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT));
- if (emulationPath == null) {
- // internal error, per construction we should have found it
- currentScope.problemReporter().needImplementation();
- } else {
- codeStream.generateOuterAccess(emulationPath, this, currentScope);
- }
- } else {
- generateReceiver(codeStream);
- }
- }
- break;
- case LOCAL : // reading the first local variable
- lastFieldBinding = null;
- LocalVariableBinding localBinding = (LocalVariableBinding) binding;
-
- // regular local variable read
- if (localBinding.constant != NotAConstant) {
- codeStream.generateConstant(localBinding.constant, 0); // no implicit conversion
- } else {
- // outer local?
- if ((bits & DepthMASK) != 0) {
- // outer local can be reached either through a synthetic arg or a synthetic field
- VariableBinding[] path = currentScope.getEmulationPath(localBinding);
- if (path == null) {
- // emulation was not possible (should not happen per construction)
- currentScope.problemReporter().needImplementation();
- } else {
- codeStream.generateOuterAccess(path, this, currentScope);
- }
- } else {
- codeStream.load(localBinding);
- }
- }
- }
- } else {
- lastFieldBinding = null;
- }
- // all intermediate field accesses are read accesses
- // only the last field binding is a write access
- if (otherBindings != null) {
- int start = indexOfFirstValueRequired == 0 ? 0 : indexOfFirstValueRequired - 1;
- for (int i = start; i < otherBindingsCount; i++) {
- if (lastFieldBinding != null) {
- MethodBinding accessor = syntheticReadAccessors == null ? null : syntheticReadAccessors[i];
- if (accessor == null)
- if (lastFieldBinding.isStatic())
- codeStream.getstatic(lastFieldBinding);
- else
- codeStream.getfield(lastFieldBinding);
- else
- codeStream.invokestatic(accessor);
- }
- lastFieldBinding = otherBindings[i];
- }
- }
-}
-public void generateReceiver(CodeStream codeStream) {
- codeStream.aload_0();
-}
-public TypeBinding getOtherFieldBindings(BlockScope scope) {
- // At this point restrictiveFlag may ONLY have two potential value : FIELD LOCAL (i.e cast <<(VariableBinding) binding>> is valid)
-
- if ((bits & FIELD) != 0) {
- if (!((FieldBinding) binding).isStatic()) { //must check for the static status....
- if (indexOfFirstFieldBinding == 1) {
- //the field is the first token of the qualified reference....
- if (scope.methodScope().isStatic) {
- scope.problemReporter().staticFieldAccessToNonStaticVariable(this, (FieldBinding) binding);
- return null;
- }
- } else { //accessing to a field using a type as "receiver" is allowed only with static field
- scope.problemReporter().staticFieldAccessToNonStaticVariable(this, (FieldBinding) binding);
- return null;
- }
- }
- if (isFieldUseDeprecated((FieldBinding) binding, scope))
- scope.problemReporter().deprecatedField((FieldBinding) binding, this);
-
- // if the binding declaring class is not visible, need special action
- // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
- FieldBinding fieldBinding = (FieldBinding)binding;
- if (fieldBinding.declaringClass != null
- && fieldBinding.constant == NotAConstant
- && !fieldBinding.declaringClass.canBeSeenBy(scope))
- binding = new FieldBinding(fieldBinding, scope.enclosingSourceType());
- }
-
- TypeBinding type = ((VariableBinding) binding).type;
- int index = indexOfFirstFieldBinding;
- int length = tokens.length;
- if (index == length) { // restrictiveFlag == FIELD
- constant = FieldReference.getConstantFor((FieldBinding) binding, false, this, index - 1);
- return type;
- }
-
- // allocation of the fieldBindings array and its respective constants
- int otherBindingsLength = length - index;
- otherBindings = new FieldBinding[otherBindingsLength];
-
- // fill the first constant (the one of the binding)
- constant =
- ((bits & FIELD) != 0)
- ? FieldReference.getConstantFor((FieldBinding) binding, false, this, index - 1)
- : ((VariableBinding) binding).constant;
-
- // iteration on each field
- while (index < length) {
- char[] token = tokens[index];
- if (type == null) return null; // could not resolve type prior to this point
- FieldBinding field = scope.getField(type, token, this);
- int place = index - indexOfFirstFieldBinding;
- otherBindings[place] = field;
- if (field.isValidBinding()) {
- if (isFieldUseDeprecated(field, scope))
- scope.problemReporter().deprecatedField(field, this);
- Constant someConstant = FieldReference.getConstantFor(field, false, this, place);
- // constant propagation can only be performed as long as the previous one is a constant too.
- if (constant != NotAConstant){
- constant = someConstant;
- }
- // if the binding declaring class is not visible, need special action
- // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
- if (field.declaringClass != type
- && field.declaringClass != null // array.length
- && field.constant == NotAConstant
- && !field.declaringClass.canBeSeenBy(scope))
- otherBindings[place] = new FieldBinding(field, (ReferenceBinding)type);
- type = field.type;
- index++;
- } else {
- constant = NotAConstant; //don't fill other constants slots...
- scope.problemReporter().invalidField(this, field, index, type);
- return null;
- }
- }
- return (otherBindings[otherBindingsLength - 1]).type;
-}
-public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
- //If inlinable field, forget the access emulation, the code gen will directly target it
- if (((bits & DepthMASK) == 0) || (constant != NotAConstant)) {
- return;
- }
- switch (bits & RestrictiveFlagMASK) {
- case FIELD :
- FieldBinding fieldBinding;
- if ((fieldBinding = (FieldBinding)binding).isStatic() || (fieldBinding.constant != NotAConstant)) return;
- ReferenceBinding compatibleType = currentScope.enclosingSourceType();
- // the declaringClass of the target binding must be compatible with the enclosing
- // type at <depth> levels outside
- for (int i = 0, depth = (bits & DepthMASK) >> DepthSHIFT; i < depth; i++) {
- compatibleType = compatibleType.enclosingType();
- }
- currentScope.emulateOuterAccess(compatibleType, false); // request cascade of accesses
- break;
- case LOCAL :
- currentScope.emulateOuterAccess((LocalVariableBinding) binding);
- }
-}
-public void manageSyntheticReadAccessIfNecessary(BlockScope currentScope, FieldBinding fieldBinding, int index) {
- // index == 0 denotes the first fieldBinding, index > 0 denotes one of the 'otherBindings'
-
- if (fieldBinding.constant != NotAConstant) return;
- if (fieldBinding.isPrivate()) { // private access
- if (fieldBinding.declaringClass != currentScope.enclosingSourceType()) {
- if (syntheticReadAccessors == null) {
- if (otherBindings == null)
- syntheticReadAccessors = new SyntheticAccessMethodBinding[1];
- else
- syntheticReadAccessors = new SyntheticAccessMethodBinding[otherBindings.length + 1];
- }
- syntheticReadAccessors[index] = fieldBinding.getSyntheticReadAccess();
- currentScope.problemReporter().needToEmulateFieldReadAccess(fieldBinding, this);
- }
- return;
- }
- if (fieldBinding.isProtected() // implicit protected access (only for first one)
- && index == 0
- && (bits & DepthMASK) != 0
- && (fieldBinding.declaringClass.getPackage()
- != currentScope.enclosingSourceType().getPackage())){
- if (syntheticReadAccessors == null) {
- if (otherBindings == null)
- syntheticReadAccessors = new SyntheticAccessMethodBinding[1];
- else
- syntheticReadAccessors = new SyntheticAccessMethodBinding[otherBindings.length + 1];
- }
- syntheticReadAccessors[index] =
- ((SourceTypeBinding)currentScope.enclosingSourceType().
- enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT)).
- addSyntheticMethod(fieldBinding, true);
- currentScope.problemReporter().needToEmulateFieldReadAccess(fieldBinding, this);
- }
-}
-/*
- * No need to emulate access to protected fields since not implicitly accessed
- */
-public void manageSyntheticWriteAccessIfNecessary(BlockScope currentScope, FieldBinding fieldBinding) {
- if (fieldBinding.isPrivate() && fieldBinding.declaringClass != currentScope.enclosingSourceType()) {
- syntheticWriteAccessor = fieldBinding.getSyntheticWriteAccess();
- currentScope.problemReporter().needToEmulateFieldWriteAccess(fieldBinding, this);
- }
-}
-/**
- * Normal field binding did not work, try to bind to a field of the delegate receiver.
- */
-public TypeBinding reportError(BlockScope scope) {
- if (binding instanceof ProblemFieldBinding) {
- scope.problemReporter().invalidField(this, (FieldBinding) binding);
- } else if (binding instanceof ProblemReferenceBinding) {
- scope.problemReporter().invalidType(this, (TypeBinding) binding);
- } else {
- scope.problemReporter().unresolvableReference(this, binding);
- }
- return null;
-}
-public TypeBinding resolveType(BlockScope scope) {
- // field and/or local are done before type lookups
-
- // the only available value for the restrictiveFlag BEFORE
- // the TC is Flag_Type Flag_LocalField and Flag_TypeLocalField
- this.receiverType = scope.enclosingSourceType();
-
- constant = Constant.NotAConstant;
- if ((binding = scope.getBinding(tokens, bits & RestrictiveFlagMASK, this)).isValidBinding()) {
- switch (bits & RestrictiveFlagMASK) {
- case VARIABLE : //============only variable===========
- case TYPE | VARIABLE :
- if (binding instanceof LocalVariableBinding) {
- if (!((LocalVariableBinding) binding).isFinal() && ((bits & DepthMASK) != 0))
- scope.problemReporter().cannotReferToNonFinalOuterLocal((LocalVariableBinding) binding, this);
- bits &= ~RestrictiveFlagMASK; // clear bits
- bits |= LOCAL;
- return getOtherFieldBindings(scope);
- }
- if (binding instanceof FieldBinding) {
- // check for forward references
- FieldBinding fieldBinding = (FieldBinding) binding;
- MethodScope methodScope = scope.methodScope() ;
- if (methodScope.enclosingSourceType() == fieldBinding.declaringClass
- && methodScope.fieldDeclarationIndex != methodScope.NotInFieldDecl
- && fieldBinding.id >= methodScope.fieldDeclarationIndex) {
- if ((!fieldBinding.isStatic() || methodScope.isStatic) && this.indexOfFirstFieldBinding == 1)
- scope.problemReporter().forwardReference(this,0,scope.enclosingSourceType());
- }
- bits &= ~RestrictiveFlagMASK; // clear bits
- bits |= FIELD;
- return getOtherFieldBindings(scope);
- }
-
- // thus it was a type
- bits &= ~RestrictiveFlagMASK; // clear bits
- bits |= TYPE;
- case TYPE : //=============only type ==============
- //deprecated test
- if (isTypeUseDeprecated((TypeBinding) binding, scope))
- scope.problemReporter().deprecatedType((TypeBinding) binding, this);
- return (TypeBinding) binding;
- }
- }
-
- //========error cases===============
- return this.reportError(scope);
-}
-public void setFieldIndex(int index){
-
- indexOfFirstFieldBinding = index ;
-}
-public String toStringExpression() {
- /* slow speed */
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < tokens.length; i++) {
- buffer.append(tokens[i]);
- if (i < (tokens.length - 1)) {
- buffer.append("."/*nonNLS*/);
- }
- }
- return buffer.toString();
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-public String unboundReferenceErrorName(){
-
- return new String(tokens[0]);}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.impl.*;
+import org.eclipse.jdt.internal.compiler.codegen.*;
+import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class QualifiedNameReference extends NameReference {
+ public char[][] tokens;
+ public FieldBinding[] otherBindings;
+ public int indexOfFirstFieldBinding; //points (into tokens) for the first token that corresponds to first FieldBinding
+
+ SyntheticAccessMethodBinding syntheticWriteAccessor;
+ SyntheticAccessMethodBinding[] syntheticReadAccessors;
+ protected FieldBinding lastFieldBinding;
+public QualifiedNameReference(char[][] sources, int sourceStart, int sourceEnd) {
+ super();
+ tokens = sources;
+ this.sourceStart = sourceStart;
+ this.sourceEnd = sourceEnd;
+}
+public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment, boolean isCompound) {
+ if (assignment.expression != null) {
+ flowInfo = assignment.expression.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
+ }
+ // determine the rank until which we now we do not need any actual value for the field access
+ int otherBindingsCount = otherBindings == null ? 0 : otherBindings.length;
+ int indexOfFirstValueRequired = otherBindingsCount;
+ while (indexOfFirstValueRequired > 0) {
+ FieldBinding otherBinding = otherBindings[indexOfFirstValueRequired - 1];
+ if (otherBinding.isStatic())
+ break; // no longer need any value before this point
+ indexOfFirstValueRequired--;
+ }
+
+ FieldBinding lastFieldBinding = null;
+ if ((bits & FIELD) != 0) {
+ // reading from a field
+ // check if final blank field
+ if ((lastFieldBinding = (FieldBinding) binding).isFinal() && currentScope.allowBlankFinalFieldAssignment(lastFieldBinding)) {
+ if (!flowInfo.isDefinitelyAssigned(lastFieldBinding)) {
+ currentScope.problemReporter().uninitializedBlankFinalField(lastFieldBinding, this);
+ }
+ }
+ } else {
+ if ((bits & LOCAL) != 0) {
+ // first binding is a local variable
+ LocalVariableBinding localBinding;
+ if (!flowInfo.isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
+ currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
+ }
+ if (!flowInfo.isFakeReachable()) localBinding.used = true;
+ }
+ }
+ if (indexOfFirstValueRequired == 0) {
+ manageEnclosingInstanceAccessIfNecessary(currentScope); // only for first binding
+ }
+ // all intermediate field accesses are read accesses
+ if (otherBindings != null) {
+ int start = indexOfFirstValueRequired == 0 ? 0 : indexOfFirstValueRequired - 1;
+ for (int i = start; i < otherBindingsCount; i++) {
+ if (lastFieldBinding != null) { // could be null if first was a local variable
+ manageSyntheticReadAccessIfNecessary(currentScope, lastFieldBinding, i);
+ }
+ lastFieldBinding = otherBindings[i];
+ }
+ }
+ if (isCompound) {
+ if (binding == lastFieldBinding && currentScope.allowBlankFinalFieldAssignment(lastFieldBinding) && (!flowInfo.isDefinitelyAssigned(lastFieldBinding))) {
+ currentScope.problemReporter().uninitializedBlankFinalField(lastFieldBinding, this);
+ }
+ manageSyntheticReadAccessIfNecessary(currentScope, lastFieldBinding, binding == lastFieldBinding ? 0 : otherBindings.length);
+ }
+ // the last field access is a write access
+ if (lastFieldBinding.isFinal()) {
+ // in a context where it can be assigned?
+ if (currentScope.allowBlankFinalFieldAssignment(lastFieldBinding)) {
+ if (flowInfo.isPotentiallyAssigned(lastFieldBinding)) {
+ if (indexOfFirstFieldBinding == 1) { // was an implicit reference to the first field binding
+ currentScope.problemReporter().duplicateInitializationOfBlankFinalField(lastFieldBinding, this);
+ } else {
+ currentScope.problemReporter().cannotAssignToFinalField(lastFieldBinding, this); // attempting to assign a non implicit reference
+ }
+ }
+ flowInfo.markAsDefinitelyAssigned(lastFieldBinding);
+ flowContext.recordSettingFinal(lastFieldBinding, this);
+ } else {
+ currentScope.problemReporter().cannotAssignToFinalField(lastFieldBinding, this);
+ }
+ }
+ // equivalent to valuesRequired[maxOtherBindings]
+ manageSyntheticWriteAccessIfNecessary(currentScope, lastFieldBinding);
+ return flowInfo;
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ return analyseCode(currentScope, flowContext, flowInfo, true);
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired) {
+
+ // determine the rank until which we now we do not need any actual value for the field access
+ int otherBindingsCount = otherBindings == null ? 0 : otherBindings.length;
+ int indexOfFirstValueRequired;
+ if (valueRequired) {
+ indexOfFirstValueRequired = otherBindingsCount;
+ while (indexOfFirstValueRequired > 0) {
+ FieldBinding otherBinding = otherBindings[indexOfFirstValueRequired - 1];
+ if (otherBinding.isStatic())
+ break; // no longer need any value before this point
+ indexOfFirstValueRequired--;
+ }
+ } else {
+ indexOfFirstValueRequired = otherBindingsCount + 1;
+ }
+ switch (bits & RestrictiveFlagMASK) {
+ case FIELD : // reading a field
+ if (indexOfFirstValueRequired == 0) {
+ manageSyntheticReadAccessIfNecessary(currentScope, (FieldBinding) binding, 0);
+ }
+ // check if reading a final blank field
+ FieldBinding fieldBinding;
+ if ((fieldBinding = (FieldBinding) binding).isFinal()
+ && (indexOfFirstFieldBinding == 1) // was an implicit reference to the first field binding
+ && currentScope.allowBlankFinalFieldAssignment(fieldBinding)
+ && (!flowInfo.isDefinitelyAssigned(fieldBinding))) {
+ currentScope.problemReporter().uninitializedBlankFinalField(fieldBinding, this);
+ }
+ break;
+ case LOCAL : // reading a local variable
+ LocalVariableBinding localBinding;
+ if (!flowInfo.isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
+ currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
+ }
+ if (!flowInfo.isFakeReachable()) localBinding.used = true;
+ }
+ if (indexOfFirstValueRequired == 0) {
+ manageEnclosingInstanceAccessIfNecessary(currentScope); // only for first binding
+ }
+ if (otherBindings != null) {
+ int start = indexOfFirstValueRequired == 0 ? 0 : indexOfFirstValueRequired - 1;
+ for (int i = start; i < otherBindingsCount; i++) {
+ manageSyntheticReadAccessIfNecessary(currentScope, otherBindings[i], i + 1);
+ }
+ }
+ return flowInfo;
+}
+/**
+ * Check and/or redirect the field access to the delegate receiver if any
+ */
+public TypeBinding checkFieldAccess(BlockScope scope) {
+ // check for forward references
+ FieldBinding fieldBinding = (FieldBinding) binding;
+ MethodScope methodScope = scope.methodScope();
+ if (methodScope.enclosingSourceType() == fieldBinding.declaringClass
+ && methodScope.fieldDeclarationIndex != MethodScope.NotInFieldDecl
+ && fieldBinding.id >= methodScope.fieldDeclarationIndex) {
+ if ((!fieldBinding.isStatic() || methodScope.isStatic)
+ && this.indexOfFirstFieldBinding == 1)
+ scope.problemReporter().forwardReference(this, 0, scope.enclosingSourceType());
+ }
+ bits &= ~RestrictiveFlagMASK; // clear bits
+ bits |= FIELD;
+ return getOtherFieldBindings(scope);
+}
+public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) {
+ generateReadSequence(currentScope, codeStream, true);
+ // the last field access is a write access
+ assignment.expression.generateCode(currentScope, codeStream, true);
+ fieldStore(codeStream, lastFieldBinding, syntheticWriteAccessor, valueRequired); // equivalent to valuesRequired[maxOtherBindings]
+ if (valueRequired) {
+ codeStream.generateImplicitConversion(assignment.implicitConversion);
+ }
+}
+public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+ int pc = codeStream.position;
+ if (constant != NotAConstant) {
+ if (valueRequired) {
+ codeStream.generateConstant(constant, implicitConversion);
+ }
+ } else {
+ generateReadSequence(currentScope, codeStream, valueRequired);
+ if (valueRequired) {
+ if (lastFieldBinding.declaringClass == null) { // array length
+ codeStream.arraylength();
+ codeStream.generateImplicitConversion(implicitConversion);
+ } else {
+ if (lastFieldBinding.constant != NotAConstant) {
+ // inline the last field constant
+ codeStream.generateConstant(lastFieldBinding.constant, implicitConversion);
+ } else {
+ SyntheticAccessMethodBinding accessor = syntheticReadAccessors == null ? null : syntheticReadAccessors[syntheticReadAccessors.length - 1];
+ if (accessor == null) {
+ if (lastFieldBinding.isStatic()) {
+ codeStream.getstatic(lastFieldBinding);
+ } else {
+ codeStream.getfield(lastFieldBinding);
+ }
+ } else {
+ codeStream.invokestatic(accessor);
+ }
+ codeStream.generateImplicitConversion(implicitConversion);
+ }
+ }
+ }
+ }
+ codeStream.recordPositionsFrom(pc, this);
+}
+public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) {
+
+ generateReadSequence(currentScope, codeStream, true);
+ SyntheticAccessMethodBinding accessor = syntheticReadAccessors == null ? null : syntheticReadAccessors[syntheticReadAccessors.length - 1];
+
+ if (lastFieldBinding.isStatic()){
+ if (accessor == null) {
+ codeStream.getstatic(lastFieldBinding);
+ } else {
+ codeStream.invokestatic(accessor);
+ }
+ } else {
+ codeStream.dup();
+ if (accessor == null) {
+ codeStream.getfield(lastFieldBinding);
+ } else {
+ codeStream.invokestatic(accessor);
+ }
+ }
+ // the last field access is a write access
+ // perform the actual compound operation
+ int operationTypeID;
+ if ((operationTypeID = implicitConversion >> 4) == T_String) {
+ codeStream.generateStringAppend(currentScope, null, expression);
+ } else {
+ // promote the array reference to the suitable operation type
+ codeStream.generateImplicitConversion(implicitConversion);
+ // generate the increment value (will by itself be promoted to the operation value)
+ if (expression == IntLiteral.One){ // prefix operation
+ codeStream.generateConstant(expression.constant, implicitConversion);
+ } else {
+ expression.generateCode(currentScope, codeStream, true);
+ }
+ // perform the operation
+ codeStream.sendOperator(operator, operationTypeID);
+ // cast the value back to the array reference type
+ codeStream.generateImplicitConversion(assignmentImplicitConversion);
+ }
+ // actual assignment
+ fieldStore(codeStream, lastFieldBinding, syntheticWriteAccessor, valueRequired); // equivalent to valuesRequired[maxOtherBindings]
+}
+public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired) {
+ generateReadSequence(currentScope, codeStream, true);
+ SyntheticAccessMethodBinding accessor = syntheticReadAccessors == null ? null : syntheticReadAccessors[syntheticReadAccessors.length - 1];
+
+ if (lastFieldBinding.isStatic()){
+ if (accessor == null) {
+ codeStream.getstatic(lastFieldBinding);
+ } else {
+ codeStream.invokestatic(accessor);
+ }
+ } else {
+ codeStream.dup();
+ if (accessor == null) {
+ codeStream.getfield(lastFieldBinding);
+ } else {
+ codeStream.invokestatic(accessor);
+ }
+ }
+ // duplicate the old field value
+ if (valueRequired) {
+ if (lastFieldBinding.isStatic()) {
+ if ((lastFieldBinding.type == LongBinding) || (lastFieldBinding.type == DoubleBinding)) {
+ codeStream.dup2();
+ } else {
+ codeStream.dup();
+ }
+ } else { // Stack: [owner][old field value] ---> [old field value][owner][old field value]
+ if ((lastFieldBinding.type == LongBinding) || (lastFieldBinding.type == DoubleBinding)) {
+ codeStream.dup2_x1();
+ } else {
+ codeStream.dup_x1();
+ }
+ }
+ }
+ codeStream.generateConstant(postIncrement.expression.constant, implicitConversion);
+ codeStream.sendOperator(postIncrement.operator, lastFieldBinding.type.id);
+ codeStream.generateImplicitConversion(postIncrement.assignmentImplicitConversion);
+
+ fieldStore(codeStream, lastFieldBinding, syntheticWriteAccessor, false);
+}
+/*
+ * Generate code for all bindings (local and fields) excluding the last one, which may then be generated code
+ * for a read or write access.
+ */
+public void generateReadSequence(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+
+ // determine the rank until which we now we do not need any actual value for the field access
+ int otherBindingsCount = otherBindings == null ? 0 : otherBindings.length;
+ int indexOfFirstValueRequired;
+ if (valueRequired) {
+ indexOfFirstValueRequired = otherBindingsCount;
+ while (indexOfFirstValueRequired > 0) {
+ FieldBinding otherBinding = otherBindings[indexOfFirstValueRequired - 1];
+ if (otherBinding.isStatic() || otherBinding.constant != NotAConstant)
+ break; // no longer need any value before this point
+ indexOfFirstValueRequired--;
+ }
+ } else {
+ indexOfFirstValueRequired = otherBindingsCount + 1;
+ }
+ if (indexOfFirstValueRequired == 0) {
+ switch (bits & RestrictiveFlagMASK) {
+ case FIELD :
+ lastFieldBinding = (FieldBinding) binding;
+
+ // if first field is actually constant, we can inline it
+ if (lastFieldBinding.constant != NotAConstant) {
+ codeStream.generateConstant(lastFieldBinding.constant, 0); // no implicit conversion
+ lastFieldBinding = null; // will not generate it again
+ break;
+ }
+ if (!lastFieldBinding.isStatic()) {
+ if ((bits & DepthMASK) != 0) {
+ Object[] emulationPath = currentScope.getExactEmulationPath(currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT));
+ if (emulationPath == null) {
+ // internal error, per construction we should have found it
+ currentScope.problemReporter().needImplementation();
+ } else {
+ codeStream.generateOuterAccess(emulationPath, this, currentScope);
+ }
+ } else {
+ generateReceiver(codeStream);
+ }
+ }
+ break;
+ case LOCAL : // reading the first local variable
+ lastFieldBinding = null;
+ LocalVariableBinding localBinding = (LocalVariableBinding) binding;
+
+ // regular local variable read
+ if (localBinding.constant != NotAConstant) {
+ codeStream.generateConstant(localBinding.constant, 0); // no implicit conversion
+ } else {
+ // outer local?
+ if ((bits & DepthMASK) != 0) {
+ // outer local can be reached either through a synthetic arg or a synthetic field
+ VariableBinding[] path = currentScope.getEmulationPath(localBinding);
+ if (path == null) {
+ // emulation was not possible (should not happen per construction)
+ currentScope.problemReporter().needImplementation();
+ } else {
+ codeStream.generateOuterAccess(path, this, currentScope);
+ }
+ } else {
+ codeStream.load(localBinding);
+ }
+ }
+ }
+ } else {
+ lastFieldBinding = null;
+ }
+ // all intermediate field accesses are read accesses
+ // only the last field binding is a write access
+ if (otherBindings != null) {
+ int start = indexOfFirstValueRequired == 0 ? 0 : indexOfFirstValueRequired - 1;
+ for (int i = start; i < otherBindingsCount; i++) {
+ if (lastFieldBinding != null) {
+ MethodBinding accessor = syntheticReadAccessors == null ? null : syntheticReadAccessors[i];
+ if (accessor == null)
+ if (lastFieldBinding.isStatic())
+ codeStream.getstatic(lastFieldBinding);
+ else
+ codeStream.getfield(lastFieldBinding);
+ else
+ codeStream.invokestatic(accessor);
+ }
+ lastFieldBinding = otherBindings[i];
+ }
+ }
+}
+public void generateReceiver(CodeStream codeStream) {
+ codeStream.aload_0();
+}
+public TypeBinding getOtherFieldBindings(BlockScope scope) {
+ // At this point restrictiveFlag may ONLY have two potential value : FIELD LOCAL (i.e cast <<(VariableBinding) binding>> is valid)
+
+ if ((bits & FIELD) != 0) {
+ if (!((FieldBinding) binding).isStatic()) { //must check for the static status....
+ if (indexOfFirstFieldBinding == 1) {
+ //the field is the first token of the qualified reference....
+ if (scope.methodScope().isStatic) {
+ scope.problemReporter().staticFieldAccessToNonStaticVariable(this, (FieldBinding) binding);
+ return null;
+ }
+ } else { //accessing to a field using a type as "receiver" is allowed only with static field
+ scope.problemReporter().staticFieldAccessToNonStaticVariable(this, (FieldBinding) binding);
+ return null;
+ }
+ }
+ if (isFieldUseDeprecated((FieldBinding) binding, scope))
+ scope.problemReporter().deprecatedField((FieldBinding) binding, this);
+
+ // if the binding declaring class is not visible, need special action
+ // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
+ FieldBinding fieldBinding = (FieldBinding)binding;
+ if (fieldBinding.declaringClass != null
+ && fieldBinding.constant == NotAConstant
+ && !fieldBinding.declaringClass.canBeSeenBy(scope))
+ binding = new FieldBinding(fieldBinding, scope.enclosingSourceType());
+ }
+
+ TypeBinding type = ((VariableBinding) binding).type;
+ int index = indexOfFirstFieldBinding;
+ int length = tokens.length;
+ if (index == length) { // restrictiveFlag == FIELD
+ constant = FieldReference.getConstantFor((FieldBinding) binding, false, this, index - 1);
+ return type;
+ }
+
+ // allocation of the fieldBindings array and its respective constants
+ int otherBindingsLength = length - index;
+ otherBindings = new FieldBinding[otherBindingsLength];
+
+ // fill the first constant (the one of the binding)
+ constant =
+ ((bits & FIELD) != 0)
+ ? FieldReference.getConstantFor((FieldBinding) binding, false, this, index - 1)
+ : ((VariableBinding) binding).constant;
+
+ // iteration on each field
+ while (index < length) {
+ char[] token = tokens[index];
+ if (type == null) return null; // could not resolve type prior to this point
+ FieldBinding field = scope.getField(type, token, this);
+ int place = index - indexOfFirstFieldBinding;
+ otherBindings[place] = field;
+ if (field.isValidBinding()) {
+ if (isFieldUseDeprecated(field, scope))
+ scope.problemReporter().deprecatedField(field, this);
+ Constant someConstant = FieldReference.getConstantFor(field, false, this, place);
+ // constant propagation can only be performed as long as the previous one is a constant too.
+ if (constant != NotAConstant){
+ constant = someConstant;
+ }
+ // if the binding declaring class is not visible, need special action
+ // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
+ if (field.declaringClass != type
+ && field.declaringClass != null // array.length
+ && field.constant == NotAConstant
+ && !field.declaringClass.canBeSeenBy(scope))
+ otherBindings[place] = new FieldBinding(field, (ReferenceBinding)type);
+ type = field.type;
+ index++;
+ } else {
+ constant = NotAConstant; //don't fill other constants slots...
+ scope.problemReporter().invalidField(this, field, index, type);
+ return null;
+ }
+ }
+ return (otherBindings[otherBindingsLength - 1]).type;
+}
+public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
+ //If inlinable field, forget the access emulation, the code gen will directly target it
+ if (((bits & DepthMASK) == 0) || (constant != NotAConstant)) {
+ return;
+ }
+ switch (bits & RestrictiveFlagMASK) {
+ case FIELD :
+ FieldBinding fieldBinding;
+ if ((fieldBinding = (FieldBinding)binding).isStatic() || (fieldBinding.constant != NotAConstant)) return;
+ ReferenceBinding compatibleType = currentScope.enclosingSourceType();
+ // the declaringClass of the target binding must be compatible with the enclosing
+ // type at <depth> levels outside
+ for (int i = 0, depth = (bits & DepthMASK) >> DepthSHIFT; i < depth; i++) {
+ compatibleType = compatibleType.enclosingType();
+ }
+ currentScope.emulateOuterAccess(compatibleType, false); // request cascade of accesses
+ break;
+ case LOCAL :
+ currentScope.emulateOuterAccess((LocalVariableBinding) binding);
+ }
+}
+public void manageSyntheticReadAccessIfNecessary(BlockScope currentScope, FieldBinding fieldBinding, int index) {
+ // index == 0 denotes the first fieldBinding, index > 0 denotes one of the 'otherBindings'
+
+ if (fieldBinding.constant != NotAConstant) return;
+ if (fieldBinding.isPrivate()) { // private access
+ if (fieldBinding.declaringClass != currentScope.enclosingSourceType()) {
+ if (syntheticReadAccessors == null) {
+ if (otherBindings == null)
+ syntheticReadAccessors = new SyntheticAccessMethodBinding[1];
+ else
+ syntheticReadAccessors = new SyntheticAccessMethodBinding[otherBindings.length + 1];
+ }
+ syntheticReadAccessors[index] = fieldBinding.getSyntheticReadAccess();
+ currentScope.problemReporter().needToEmulateFieldReadAccess(fieldBinding, this);
+ }
+ return;
+ }
+ if (fieldBinding.isProtected() // implicit protected access (only for first one)
+ && index == 0
+ && (bits & DepthMASK) != 0
+ && (fieldBinding.declaringClass.getPackage()
+ != currentScope.enclosingSourceType().getPackage())){
+ if (syntheticReadAccessors == null) {
+ if (otherBindings == null)
+ syntheticReadAccessors = new SyntheticAccessMethodBinding[1];
+ else
+ syntheticReadAccessors = new SyntheticAccessMethodBinding[otherBindings.length + 1];
+ }
+ syntheticReadAccessors[index] =
+ ((SourceTypeBinding)currentScope.enclosingSourceType().
+ enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT)).
+ addSyntheticMethod(fieldBinding, true);
+ currentScope.problemReporter().needToEmulateFieldReadAccess(fieldBinding, this);
+ }
+}
+/*
+ * No need to emulate access to protected fields since not implicitly accessed
+ */
+public void manageSyntheticWriteAccessIfNecessary(BlockScope currentScope, FieldBinding fieldBinding) {
+ if (fieldBinding.isPrivate() && fieldBinding.declaringClass != currentScope.enclosingSourceType()) {
+ syntheticWriteAccessor = fieldBinding.getSyntheticWriteAccess();
+ currentScope.problemReporter().needToEmulateFieldWriteAccess(fieldBinding, this);
+ }
+}
+/**
+ * Normal field binding did not work, try to bind to a field of the delegate receiver.
+ */
+public TypeBinding reportError(BlockScope scope) {
+ if (binding instanceof ProblemFieldBinding) {
+ scope.problemReporter().invalidField(this, (FieldBinding) binding);
+ } else if (binding instanceof ProblemReferenceBinding) {
+ scope.problemReporter().invalidType(this, (TypeBinding) binding);
+ } else {
+ scope.problemReporter().unresolvableReference(this, binding);
+ }
+ return null;
+}
+public TypeBinding resolveType(BlockScope scope) {
+ // field and/or local are done before type lookups
+
+ // the only available value for the restrictiveFlag BEFORE
+ // the TC is Flag_Type Flag_LocalField and Flag_TypeLocalField
+ this.receiverType = scope.enclosingSourceType();
+
+ constant = Constant.NotAConstant;
+ if ((binding = scope.getBinding(tokens, bits & RestrictiveFlagMASK, this)).isValidBinding()) {
+ switch (bits & RestrictiveFlagMASK) {
+ case VARIABLE : //============only variable===========
+ case TYPE | VARIABLE :
+ if (binding instanceof LocalVariableBinding) {
+ if (!((LocalVariableBinding) binding).isFinal() && ((bits & DepthMASK) != 0))
+ scope.problemReporter().cannotReferToNonFinalOuterLocal((LocalVariableBinding) binding, this);
+ bits &= ~RestrictiveFlagMASK; // clear bits
+ bits |= LOCAL;
+ return getOtherFieldBindings(scope);
+ }
+ if (binding instanceof FieldBinding) {
+ // check for forward references
+ FieldBinding fieldBinding = (FieldBinding) binding;
+ MethodScope methodScope = scope.methodScope() ;
+ if (methodScope.enclosingSourceType() == fieldBinding.declaringClass
+ && methodScope.fieldDeclarationIndex != MethodScope.NotInFieldDecl
+ && fieldBinding.id >= methodScope.fieldDeclarationIndex) {
+ if ((!fieldBinding.isStatic() || methodScope.isStatic) && this.indexOfFirstFieldBinding == 1)
+ scope.problemReporter().forwardReference(this,0,scope.enclosingSourceType());
+ }
+ bits &= ~RestrictiveFlagMASK; // clear bits
+ bits |= FIELD;
+ return getOtherFieldBindings(scope);
+ }
+
+ // thus it was a type
+ bits &= ~RestrictiveFlagMASK; // clear bits
+ bits |= TYPE;
+ case TYPE : //=============only type ==============
+ //deprecated test
+ if (isTypeUseDeprecated((TypeBinding) binding, scope))
+ scope.problemReporter().deprecatedType((TypeBinding) binding, this);
+ return (TypeBinding) binding;
+ }
+ }
+
+ //========error cases===============
+ return this.reportError(scope);
+}
+public void setFieldIndex(int index){
+
+ indexOfFirstFieldBinding = index ;
+}
+public String toStringExpression() {
+ /* slow speed */
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < tokens.length; i++) {
+ buffer.append(tokens[i]);
+ if (i < (tokens.length - 1)) {
+ buffer.append("."/*nonNLS*/);
+ }
+ }
+ return buffer.toString();
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+}
+public String unboundReferenceErrorName(){
+
+ return new String(tokens[0]);}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedSuperReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedSuperReference.java
index 7b401150cc..ba98d9a636 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedSuperReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedSuperReference.java
@@ -1,47 +1,44 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-
-public class QualifiedSuperReference extends QualifiedThisReference {
-public QualifiedSuperReference(TypeReference name, int pos, int sourceEnd) {
- super(name, pos, sourceEnd);
-}
-public boolean isSuper() {
-
- return true;
-}
-public boolean isThis() {
-
- return false ;
-}
-public TypeBinding resolveType(BlockScope scope) {
-
- super.resolveType(scope);
- if (currentCompatibleType == null) return null; // error case
-
- if (scope.isJavaLangObject(currentCompatibleType)) {
- scope.problemReporter().cannotUseSuperInJavaLangObject(this);
- return null;
- }
- return currentCompatibleType.superclass();
-}
-public String toStringExpression(){
- /* slow code */
-
- return qualification.toString(0)+".super"/*nonNLS*/ ;
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
- if (visitor.visit(this, blockScope)) {
- qualification.traverse(visitor, blockScope);
- }
- visitor.endVisit(this, blockScope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class QualifiedSuperReference extends QualifiedThisReference {
+public QualifiedSuperReference(TypeReference name, int pos, int sourceEnd) {
+ super(name, pos, sourceEnd);
+}
+public boolean isSuper() {
+
+ return true;
+}
+public boolean isThis() {
+
+ return false ;
+}
+public TypeBinding resolveType(BlockScope scope) {
+
+ super.resolveType(scope);
+ if (currentCompatibleType == null) return null; // error case
+
+ if (scope.isJavaLangObject(currentCompatibleType)) {
+ scope.problemReporter().cannotUseSuperInJavaLangObject(this);
+ return null;
+ }
+ return currentCompatibleType.superclass();
+}
+public String toStringExpression(){
+ /* slow code */
+
+ return qualification.toString(0)+".super"/*nonNLS*/ ;
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
+ if (visitor.visit(this, blockScope)) {
+ qualification.traverse(visitor, blockScope);
+ }
+ visitor.endVisit(this, blockScope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java
index 45987d18c2..304dbd1d47 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java
@@ -1,130 +1,129 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-
-public class QualifiedThisReference extends ThisReference {
- public TypeReference qualification;
-
- ReferenceBinding currentCompatibleType;
-public QualifiedThisReference(TypeReference name, int pos, int sourceEnd) {
- qualification = name ;
- this.sourceEnd = sourceEnd;
- this.sourceStart = name.sourceStart;
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- manageEnclosingInstanceAccessIfNecessary(currentScope);
- return flowInfo;
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired) {
- if (valueRequired) {
- manageEnclosingInstanceAccessIfNecessary(currentScope);
- }
- return flowInfo;
-}
-protected boolean checkAccess(MethodScope methodScope, TypeBinding targetType) {
- // this/super cannot be used in constructor call
- if (methodScope.isConstructorCall) {
- methodScope.problemReporter().fieldsOrThisBeforeConstructorInvocation(this);
- return false;
- }
-
- // static may not refer to this/super
- if (methodScope.isStatic) {
- methodScope.problemReporter().incorrectEnclosingInstanceReference(this, targetType);
- return false;
- }
- return true;
-}
-/**
- * Code generation for QualifiedThisReference
- *
- * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
- * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
- int pc = codeStream.position;
- if (valueRequired) {
- if ((bits & DepthMASK) != 0) {
- Object[] emulationPath = currentScope.getExactEmulationPath(currentCompatibleType);
- if (emulationPath == null) {
- // internal error, per construction we should have found it
- currentScope.problemReporter().needImplementation();
- } else {
- codeStream.generateOuterAccess(emulationPath, this, currentScope);
- }
- } else {
- // nothing particular after all
- codeStream.aload_0();
- }
- }
- codeStream.recordPositionsFrom(pc, this);
-}
-void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
- currentScope.emulateOuterAccess((SourceTypeBinding) currentCompatibleType, false); // request cascade of accesses
-}
-public TypeBinding resolveType(BlockScope scope) {
- constant = NotAConstant;
- TypeBinding qualificationTb = qualification.resolveType(scope);
- if (qualificationTb == null)
- return null;
-
- // the qualification MUST exactly match some enclosing type name
- // Its possible to qualify 'this' by the name of the current class
- int depth = 0;
- currentCompatibleType = scope.referenceType().binding;
- while (currentCompatibleType != null && currentCompatibleType != qualificationTb) {
- depth++;
- currentCompatibleType = currentCompatibleType.isStatic() ? null : currentCompatibleType.enclosingType();
- }
- bits |= (depth & 0xFF) << DepthSHIFT; // encoded depth into 8 bits
-
- if (currentCompatibleType == null) {
- scope.problemReporter().incorrectEnclosingInstanceReference(this, qualificationTb);
- return null;
- }
-
- // Ensure one cannot write code like: B() { super(B.this); }
- if (depth == 0) {
- if (!checkAccess(scope.methodScope(), qualificationTb))
- return null;
- } else {
- // Could also be targeting an enclosing instance inside a super constructor invocation
- // class X {
- // public X(int i) {
- // this(new Object() { Object obj = X.this; });
- // }
- // }
-
- MethodScope methodScope = scope.methodScope();
- while (methodScope != null) {
- if (methodScope.enclosingSourceType() == currentCompatibleType) {
- if (!this.checkAccess(methodScope, qualificationTb))
- return null;
- break;
- }
- methodScope = methodScope.parent.methodScope();
- }
- }
- return qualificationTb;
-}
-public String toStringExpression(){
- /* slow code */
-
- return qualification.toString(0)+".this"/*nonNLS*/ ;
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
- if (visitor.visit(this, blockScope)) {
- qualification.traverse(visitor, blockScope);
- }
- visitor.endVisit(this, blockScope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.codegen.*;
+import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class QualifiedThisReference extends ThisReference {
+ public TypeReference qualification;
+
+ ReferenceBinding currentCompatibleType;
+public QualifiedThisReference(TypeReference name, int pos, int sourceEnd) {
+ qualification = name ;
+ this.sourceEnd = sourceEnd;
+ this.sourceStart = name.sourceStart;
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ manageEnclosingInstanceAccessIfNecessary(currentScope);
+ return flowInfo;
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired) {
+ if (valueRequired) {
+ manageEnclosingInstanceAccessIfNecessary(currentScope);
+ }
+ return flowInfo;
+}
+protected boolean checkAccess(MethodScope methodScope, TypeBinding targetType) {
+ // this/super cannot be used in constructor call
+ if (methodScope.isConstructorCall) {
+ methodScope.problemReporter().fieldsOrThisBeforeConstructorInvocation(this);
+ return false;
+ }
+
+ // static may not refer to this/super
+ if (methodScope.isStatic) {
+ methodScope.problemReporter().incorrectEnclosingInstanceReference(this, targetType);
+ return false;
+ }
+ return true;
+}
+/**
+ * Code generation for QualifiedThisReference
+ *
+ * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
+ * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+ int pc = codeStream.position;
+ if (valueRequired) {
+ if ((bits & DepthMASK) != 0) {
+ Object[] emulationPath = currentScope.getExactEmulationPath(currentCompatibleType);
+ if (emulationPath == null) {
+ // internal error, per construction we should have found it
+ currentScope.problemReporter().needImplementation();
+ } else {
+ codeStream.generateOuterAccess(emulationPath, this, currentScope);
+ }
+ } else {
+ // nothing particular after all
+ codeStream.aload_0();
+ }
+ }
+ codeStream.recordPositionsFrom(pc, this);
+}
+void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
+ currentScope.emulateOuterAccess((SourceTypeBinding) currentCompatibleType, false); // request cascade of accesses
+}
+public TypeBinding resolveType(BlockScope scope) {
+ constant = NotAConstant;
+ TypeBinding qualificationTb = qualification.resolveType(scope);
+ if (qualificationTb == null)
+ return null;
+
+ // the qualification MUST exactly match some enclosing type name
+ // Its possible to qualify 'this' by the name of the current class
+ int depth = 0;
+ currentCompatibleType = scope.referenceType().binding;
+ while (currentCompatibleType != null && currentCompatibleType != qualificationTb) {
+ depth++;
+ currentCompatibleType = currentCompatibleType.isStatic() ? null : currentCompatibleType.enclosingType();
+ }
+ bits |= (depth & 0xFF) << DepthSHIFT; // encoded depth into 8 bits
+
+ if (currentCompatibleType == null) {
+ scope.problemReporter().incorrectEnclosingInstanceReference(this, qualificationTb);
+ return null;
+ }
+
+ // Ensure one cannot write code like: B() { super(B.this); }
+ if (depth == 0) {
+ if (!checkAccess(scope.methodScope(), qualificationTb))
+ return null;
+ } else {
+ // Could also be targeting an enclosing instance inside a super constructor invocation
+ // class X {
+ // public X(int i) {
+ // this(new Object() { Object obj = X.this; });
+ // }
+ // }
+
+ MethodScope methodScope = scope.methodScope();
+ while (methodScope != null) {
+ if (methodScope.enclosingSourceType() == currentCompatibleType) {
+ if (!this.checkAccess(methodScope, qualificationTb))
+ return null;
+ break;
+ }
+ methodScope = methodScope.parent.methodScope();
+ }
+ }
+ return qualificationTb;
+}
+public String toStringExpression(){
+ /* slow code */
+
+ return qualification.toString(0)+".this"/*nonNLS*/ ;
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
+ if (visitor.visit(this, blockScope)) {
+ qualification.traverse(visitor, blockScope);
+ }
+ visitor.endVisit(this, blockScope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java
index cb2cccaef2..f97f23896e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java
@@ -1,57 +1,56 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-
-public class QualifiedTypeReference extends TypeReference {
- public char[][] tokens;
- public long[] sourcePositions;
-public QualifiedTypeReference(char[][] sources , long[] poss) {
- tokens = sources ;
- sourcePositions = poss ;
- sourceStart = (int) (sourcePositions[0]>>>32) ;
- sourceEnd = (int)(sourcePositions[sourcePositions.length-1] & 0x00000000FFFFFFFFL ) ;
-}
-public QualifiedTypeReference(char[][] sources , TypeBinding tb , long[] poss) {
- this(sources,poss);
- binding = tb;
-}
-public TypeReference copyDims(int dim){
- //return a type reference copy of me with some dimensions
- //warning : the new type ref has a null binding
-
- return new ArrayQualifiedTypeReference(tokens,null,dim,sourcePositions) ;
-}
-public TypeBinding getTypeBinding(Scope scope) {
- if (binding != null)
- return binding;
- return scope.getType(tokens);
-}
-public char[][] getTypeName(){
-
- return tokens;
-}
-public String toStringExpression(int tab) {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < tokens.length; i++) {
- buffer.append(tokens[i]);
- if (i < (tokens.length - 1)) {
- buffer.append("."/*nonNLS*/);
- }
- }
- return buffer.toString();
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class QualifiedTypeReference extends TypeReference {
+ public char[][] tokens;
+ public long[] sourcePositions;
+public QualifiedTypeReference(char[][] sources , long[] poss) {
+ tokens = sources ;
+ sourcePositions = poss ;
+ sourceStart = (int) (sourcePositions[0]>>>32) ;
+ sourceEnd = (int)(sourcePositions[sourcePositions.length-1] & 0x00000000FFFFFFFFL ) ;
+}
+public QualifiedTypeReference(char[][] sources , TypeBinding tb , long[] poss) {
+ this(sources,poss);
+ binding = tb;
+}
+public TypeReference copyDims(int dim){
+ //return a type reference copy of me with some dimensions
+ //warning : the new type ref has a null binding
+
+ return new ArrayQualifiedTypeReference(tokens,null,dim,sourcePositions) ;
+}
+public TypeBinding getTypeBinding(Scope scope) {
+ if (binding != null)
+ return binding;
+ return scope.getType(tokens);
+}
+public char[][] getTypeName(){
+
+ return tokens;
+}
+public String toStringExpression(int tab) {
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < tokens.length; i++) {
+ buffer.append(tokens[i]);
+ if (i < (tokens.length - 1)) {
+ buffer.append("."/*nonNLS*/);
+ }
+ }
+ return buffer.toString();
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Reference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Reference.java
index c69fd1ea94..f4d0779ef3 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Reference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Reference.java
@@ -1,72 +1,71 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-import org.eclipse.jdt.internal.compiler.problem.*;
-import org.eclipse.jdt.internal.compiler.util.Util;
-
-public abstract class Reference extends Expression {
-/**
- * BaseLevelReference constructor comment.
- */
-public Reference() {
- super();
-}
-public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment, boolean isCompound) {
- throw new ShouldNotImplement(Util.bind("ast.variableShouldProvide"/*nonNLS*/));
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- return flowInfo;
-}
-public FieldBinding fieldBinding() {
- //this method should be sent ONLY after a check against isFieldReference()
- //check its use doing senders.........
-
- return null ;
-}
-public void fieldStore(CodeStream codeStream, FieldBinding fieldBinding, MethodBinding syntheticWriteAccessor, boolean valueRequired) {
-
- if (fieldBinding.isStatic()) {
- if (valueRequired) {
- if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
- codeStream.dup2();
- } else {
- codeStream.dup();
- }
- }
- if (syntheticWriteAccessor == null) {
- codeStream.putstatic(fieldBinding);
- } else {
- codeStream.invokestatic(syntheticWriteAccessor);
- }
- } else { // Stack: [owner][new field value] ---> [new field value][owner][new field value]
- if (valueRequired) {
- if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
- codeStream.dup2_x1();
- } else {
- codeStream.dup_x1();
- }
- }
- if (syntheticWriteAccessor == null) {
- codeStream.putfield(fieldBinding);
- } else {
- codeStream.invokestatic(syntheticWriteAccessor);
- }
- }
-}
-public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) {
- throw new ShouldNotImplement(Util.bind("ast.compoundPreShouldProvide"/*nonNLS*/));
-}
-public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) {
- throw new ShouldNotImplement(Util.bind("ast.compoundVariableShouldProvide"/*nonNLS*/));
-}
-public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired) {
- throw new ShouldNotImplement(Util.bind("ast.postIncrShouldProvide"/*nonNLS*/));
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.codegen.*;
+import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+import org.eclipse.jdt.internal.compiler.problem.*;
+import org.eclipse.jdt.internal.compiler.util.Util;
+
+public abstract class Reference extends Expression {
+/**
+ * BaseLevelReference constructor comment.
+ */
+public Reference() {
+ super();
+}
+public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment, boolean isCompound) {
+ throw new ShouldNotImplement(Util.bind("ast.variableShouldProvide"/*nonNLS*/));
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ return flowInfo;
+}
+public FieldBinding fieldBinding() {
+ //this method should be sent ONLY after a check against isFieldReference()
+ //check its use doing senders.........
+
+ return null ;
+}
+public void fieldStore(CodeStream codeStream, FieldBinding fieldBinding, MethodBinding syntheticWriteAccessor, boolean valueRequired) {
+
+ if (fieldBinding.isStatic()) {
+ if (valueRequired) {
+ if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
+ codeStream.dup2();
+ } else {
+ codeStream.dup();
+ }
+ }
+ if (syntheticWriteAccessor == null) {
+ codeStream.putstatic(fieldBinding);
+ } else {
+ codeStream.invokestatic(syntheticWriteAccessor);
+ }
+ } else { // Stack: [owner][new field value] ---> [new field value][owner][new field value]
+ if (valueRequired) {
+ if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
+ codeStream.dup2_x1();
+ } else {
+ codeStream.dup_x1();
+ }
+ }
+ if (syntheticWriteAccessor == null) {
+ codeStream.putfield(fieldBinding);
+ } else {
+ codeStream.invokestatic(syntheticWriteAccessor);
+ }
+ }
+}
+public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) {
+ throw new ShouldNotImplement(Util.bind("ast.compoundPreShouldProvide"/*nonNLS*/));
+}
+public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) {
+ throw new ShouldNotImplement(Util.bind("ast.compoundVariableShouldProvide"/*nonNLS*/));
+}
+public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired) {
+ throw new ShouldNotImplement(Util.bind("ast.postIncrShouldProvide"/*nonNLS*/));
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
index 633908bdca..949c09690e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
@@ -5,7 +5,6 @@ package org.eclipse.jdt.internal.compiler.ast;
* All Rights Reserved.
*/
import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
import org.eclipse.jdt.internal.compiler.codegen.*;
import org.eclipse.jdt.internal.compiler.flow.*;
import org.eclipse.jdt.internal.compiler.lookup.*;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java
index 3f9b1d6d59..d88300d928 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java
@@ -1,658 +1,658 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-
-public class SingleNameReference extends NameReference implements OperatorIds {
- public char[] token;
-
- public MethodBinding[] syntheticAccessors; // [0]=read accessor [1]=write accessor
- public static final int READ = 0;
- public static final int WRITE = 1;
-public SingleNameReference(char[] source, long pos) {
- super();
- token = source;
- sourceStart = (int) (pos >>> 32);
- sourceEnd = (int) pos;
-}
-public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment, boolean isCompound) {
-
- // compound assignment extra work
- if (isCompound) { // check the variable part is initialized if blank final
- switch (bits & RestrictiveFlagMASK) {
- case FIELD : // reading a field
- FieldBinding fieldBinding;
- if ((fieldBinding = (FieldBinding) binding).isFinal() && currentScope.allowBlankFinalFieldAssignment(fieldBinding)) {
- if (!flowInfo.isDefinitelyAssigned(fieldBinding)) {
- currentScope.problemReporter().uninitializedBlankFinalField(fieldBinding, this);
- // we could improve error msg here telling "cannot use compound assignment on final blank field"
- }
- }
- manageSyntheticReadAccessIfNecessary(currentScope);
- break;
- case LOCAL : // reading a local variable
- // check if assigning a final blank field
- LocalVariableBinding localBinding;
- if (!flowInfo.isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
- currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
- // we could improve error msg here telling "cannot use compound assignment on final local variable"
- }
- if (!flowInfo.isFakeReachable()) localBinding.used = true;
- }
- }
- if (assignment.expression != null) {
- flowInfo = assignment.expression.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
- }
- switch (bits & RestrictiveFlagMASK) {
- case FIELD : // assigning to a field
- manageSyntheticWriteAccessIfNecessary(currentScope);
-
- // check if assigning a final field
- FieldBinding fieldBinding;
- if ((fieldBinding = (FieldBinding) binding).isFinal()) {
- // inside a context where allowed
- if (currentScope.allowBlankFinalFieldAssignment(fieldBinding)) {
- if (flowInfo.isPotentiallyAssigned(fieldBinding)) {
- currentScope.problemReporter().duplicateInitializationOfBlankFinalField(fieldBinding, this);
- }
- flowInfo.markAsDefinitelyAssigned(fieldBinding);
- flowContext.recordSettingFinal(fieldBinding, this);
- } else {
- currentScope.problemReporter().cannotAssignToFinalField(fieldBinding, this);
- }
- }
- break;
- case LOCAL : // assigning to a local variable
- LocalVariableBinding localBinding = (LocalVariableBinding) binding;
- if (!flowInfo.isDefinitelyAssigned(localBinding)){// for local variable debug attributes
- bits |= FirstAssignmentToLocalMASK;
- } else {
- bits &= ~FirstAssignmentToLocalMASK;
- }
- if (localBinding.isFinal()) {
- if ((bits & DepthMASK) == 0) {
- if (flowInfo.isPotentiallyAssigned(localBinding)) {
- currentScope.problemReporter().duplicateInitializationOfFinalLocal(localBinding, this);
- }
- flowContext.recordSettingFinal(localBinding, this);
- } else {
- currentScope.problemReporter().cannotAssignToFinalOuterLocal(localBinding, this);
- }
- }
- flowInfo.markAsDefinitelyAssigned(localBinding);
- }
- manageEnclosingInstanceAccessIfNecessary(currentScope);
- return flowInfo;
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- return analyseCode(currentScope, flowContext, flowInfo, true);
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired) {
- switch (bits & RestrictiveFlagMASK) {
- case FIELD : // reading a field
- if (valueRequired) {
- manageSyntheticReadAccessIfNecessary(currentScope);
- }
- // check if reading a final blank field
- FieldBinding fieldBinding;
- if ((fieldBinding = (FieldBinding) binding).isFinal() && currentScope.allowBlankFinalFieldAssignment(fieldBinding)) {
- if (!flowInfo.isDefinitelyAssigned(fieldBinding)) {
- currentScope.problemReporter().uninitializedBlankFinalField(fieldBinding, this);
- }
- }
- break;
- case LOCAL : // reading a local variable
- LocalVariableBinding localBinding;
- if (!flowInfo.isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
- currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
- }
- if (!flowInfo.isFakeReachable()) localBinding.used = true;
- }
- if (valueRequired) {
- manageEnclosingInstanceAccessIfNecessary(currentScope);
- }
- return flowInfo;
-}
-public TypeBinding checkFieldAccess(BlockScope scope) {
-
- FieldBinding fieldBinding = (FieldBinding) binding;
-
- bits &= ~RestrictiveFlagMASK; // clear bits
- bits |= FIELD;
- if (!((FieldBinding) binding).isStatic()) {
- // must check for the static status....
- if (scope.methodScope().isStatic) {
- scope.problemReporter().staticFieldAccessToNonStaticVariable(
- this,
- fieldBinding);
- constant = NotAConstant;
- return null;
- }
- }
- constant = FieldReference.getConstantFor(fieldBinding, true, this, 0);
- if (isFieldUseDeprecated(fieldBinding, scope))
- scope.problemReporter().deprecatedField(fieldBinding, this);
- // if the binding declaring class is not visible, need special action
- // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
- if (fieldBinding.declaringClass != null
- && fieldBinding.constant == NotAConstant
- && !fieldBinding.declaringClass.canBeSeenBy(scope))
- binding = new FieldBinding(fieldBinding, scope.enclosingSourceType());
-
- //===============================================
- //cycle are forbidden ONLY within the same class...why ?????? (poor javac....)
- //Cycle can be done using cross class ref but not direct into a same class reference ????
- //class A { static int k = B.k+1;}
- //class B { static int k = A.k+2;}
- //The k-cycle in this example is valid.
-
- //class C { static int k = k + 1 ;}
- //here it is forbidden ! ????
- //but the next one is valid !!!
- //class C { static int k = C.k + 1;}
-
- //notice that the next one is also valid ?!?!
- //class A { static int k = foo().k+1 ; static A foo(){return new A();}}
-
- //for all these reasons, the next piece of code is only here and not
- //commun for all FieldRef and QualifiedNameRef....(i.e. in the getField(..) API.....
-
- //instance field may refer to forward static field, like in
- //int i = staticI;
- //static int staticI = 2 ;
-
- MethodScope ms = scope.methodScope();
- if (ms.enclosingSourceType() == fieldBinding.declaringClass
- && ms.fieldDeclarationIndex != ms.NotInFieldDecl
- && fieldBinding.id >= ms.fieldDeclarationIndex) {
- //if the field is static and ms is not .... then it is valid
- if (!fieldBinding.isStatic() || ms.isStatic)
- scope.problemReporter().forwardReference(this, 0, scope.enclosingSourceType());
- }
- //====================================================
-
- return fieldBinding.type;
-
-}
-public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) {
-
- // optimizing assignment like: i = i + 1 or i = 1 + i
- if (assignment.expression.isCompactableOperation()) {
- BinaryExpression operation = (BinaryExpression) assignment.expression;
- SingleNameReference variableReference;
- if ((operation.left instanceof SingleNameReference) && ((variableReference = (SingleNameReference) operation.left).binding == binding)) {
- // i = i + value, then use the variable on the right hand side, since it has the correct implicit conversion
- variableReference.generateCompoundAssignment(currentScope, codeStream, syntheticAccessors == null ? null : syntheticAccessors[WRITE], operation.right, (operation.bits & OperatorMASK) >> OperatorSHIFT, operation.left.implicitConversion /*should be equivalent to no conversion*/, valueRequired);
- return;
- }
- int operator = (operation.bits & OperatorMASK) >> OperatorSHIFT;
- if ((operation.right instanceof SingleNameReference)
- && ((operator == PLUS) || (operator == MULTIPLY)) // only commutative operations
- && ((variableReference = (SingleNameReference) operation.right).binding == binding)
- && (operation.left.constant != NotAConstant) // exclude non constant expressions, since could have side-effect
- && ((operation.left.implicitConversion >> 4) != T_String) // exclude string concatenation which would occur backwards
- && ((operation.right.implicitConversion >> 4) != T_String)) { // exclude string concatenation which would occur backwards
- // i = value + i, then use the variable on the right hand side, since it has the correct implicit conversion
- variableReference.generateCompoundAssignment(currentScope, codeStream, syntheticAccessors == null ? null : syntheticAccessors[WRITE], operation.left, operator, operation.right.implicitConversion /*should be equivalent to no conversion*/, valueRequired);
- return;
- }
- }
- switch (bits & RestrictiveFlagMASK) {
- case FIELD : // assigning to a field
- FieldBinding fieldBinding;
- if (!(fieldBinding = (FieldBinding) binding).isStatic()) { // need a receiver?
- if ((bits & DepthMASK) != 0) {
- Object[] emulationPath = currentScope.getExactEmulationPath(currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT));
- if (emulationPath == null) {
- // internal error, per construction we should have found it
- currentScope.problemReporter().needImplementation();
- } else {
- codeStream.generateOuterAccess(emulationPath, this, currentScope);
- }
- } else {
- this.generateReceiver(codeStream);
- }
- }
- assignment.expression.generateCode(currentScope, codeStream, true);
- fieldStore(codeStream, fieldBinding, syntheticAccessors == null ? null : syntheticAccessors[WRITE], valueRequired);
- if (valueRequired) {
- codeStream.generateImplicitConversion(assignment.implicitConversion);
- }
- return;
- case LOCAL : // assigning to a local variable
- LocalVariableBinding localBinding = (LocalVariableBinding) binding;
- if (localBinding.resolvedPosition != -1) {
- assignment.expression.generateCode(currentScope, codeStream, true);
- } else {
- if (assignment.expression.constant != NotAConstant) {
- // assigning an unused local to a constant value = no actual assignment is necessary
- if (valueRequired) {
- codeStream.generateConstant(assignment.expression.constant, assignment.implicitConversion);
- }
- } else {
- assignment.expression.generateCode(currentScope, codeStream, true);
- /* Even though the value may not be required, we force it to be produced, and discard it later
- on if it was actually not necessary, so as to provide the same behavior as JDK1.2beta3. */
- if (valueRequired) {
- codeStream.generateImplicitConversion(assignment.implicitConversion); // implicit conversion
- } else {
- if ((localBinding.type == LongBinding) || (localBinding.type == DoubleBinding)) {
- codeStream.pop2();
- } else {
- codeStream.pop();
- }
- }
- }
- return;
- }
- // normal local assignment (since cannot store in outer local which are final locations)
- codeStream.store(localBinding, valueRequired);
- if ((bits & FirstAssignmentToLocalMASK) != 0) { // for local variable debug attributes
- localBinding.recordInitializationStartPC(codeStream.position);
- }
- // implicit conversion
- if (valueRequired) {
- codeStream.generateImplicitConversion(assignment.implicitConversion);
- }
- }
-}
-public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
- int pc = codeStream.position;
- if (constant != NotAConstant) {
- if (valueRequired) {
- codeStream.generateConstant(constant, implicitConversion);
- }
- } else {
- switch (bits & RestrictiveFlagMASK) {
- case FIELD : // reading a field
- FieldBinding fieldBinding;
- if (valueRequired) {
- if ((fieldBinding = (FieldBinding) binding).constant == NotAConstant) { // directly use inlined value for constant fields
- boolean isStatic;
- if (!(isStatic = fieldBinding.isStatic())) {
- if ((bits & DepthMASK) != 0) {
- Object[] emulationPath = currentScope.getExactEmulationPath(currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT));
- if (emulationPath == null) {
- // internal error, per construction we should have found it
- currentScope.problemReporter().needImplementation();
- } else {
- codeStream.generateOuterAccess(emulationPath, this, currentScope);
- }
- } else {
- generateReceiver(codeStream);
- }
- }
- // managing private access
- if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
- if (isStatic) {
- codeStream.getstatic(fieldBinding);
- } else {
- codeStream.getfield(fieldBinding);
- }
- } else {
- codeStream.invokestatic(syntheticAccessors[READ]);
- }
- codeStream.generateImplicitConversion(implicitConversion);
- } else { // directly use the inlined value
- codeStream.generateConstant(fieldBinding.constant, implicitConversion);
- }
- }
- break;
- case LOCAL : // reading a local
- LocalVariableBinding localBinding = (LocalVariableBinding) binding;
- if (valueRequired) {
- // outer local?
- if ((bits & DepthMASK) != 0) {
- // outer local can be reached either through a synthetic arg or a synthetic field
- VariableBinding[] path = currentScope.getEmulationPath(localBinding);
- if (path == null) {
- // emulation was not possible (should not happen per construction)
- currentScope.problemReporter().needImplementation();
- } else {
- codeStream.generateOuterAccess(path, this, currentScope);
- }
- } else {
- // regular local variable read
- codeStream.load(localBinding);
- }
- codeStream.generateImplicitConversion(implicitConversion);
- }
- }
- }
- codeStream.recordPositionsFrom(pc, this);
-}
-/*
- * Regular API for compound assignment, relies on the fact that there is only one reference to the
- * variable, which carries both synthetic read/write accessors.
- * The APIs with an extra argument is used whenever there are two references to the same variable which
- * are optimized in one access: e.g "a = a + 1" optimized into "a++".
- */
-public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) {
-
- this.generateCompoundAssignment(
- currentScope,
- codeStream,
- syntheticAccessors == null ? null : syntheticAccessors[WRITE],
- expression,
- operator,
- assignmentImplicitConversion,
- valueRequired);
-}
-/*
- * The APIs with an extra argument is used whenever there are two references to the same variable which
- * are optimized in one access: e.g "a = a + 1" optimized into "a++".
- */
-public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, MethodBinding writeAccessor, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) {
- switch (bits & RestrictiveFlagMASK) {
- case FIELD : // assigning to a field
- FieldBinding fieldBinding;
- if ((fieldBinding = (FieldBinding) binding).isStatic()) {
- if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
- codeStream.getstatic(fieldBinding);
- } else {
- codeStream.invokestatic(syntheticAccessors[READ]);
- }
- } else {
- if ((bits & DepthMASK) != 0) {
- Object[] emulationPath = currentScope.getExactEmulationPath(currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT));
- if (emulationPath == null) {
- // internal error, per construction we should have found it
- currentScope.problemReporter().needImplementation();
- } else {
- codeStream.generateOuterAccess(emulationPath, this, currentScope);
- }
- } else {
- codeStream.aload_0();
- }
- codeStream.dup();
- if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
- codeStream.getfield(fieldBinding);
- } else {
- codeStream.invokestatic(syntheticAccessors[READ]);
- }
- }
- break;
- case LOCAL : // assigning to a local variable (cannot assign to outer local)
- LocalVariableBinding localBinding = (LocalVariableBinding) binding;
- Constant assignConstant;
- int increment;
- // using incr bytecode if possible
- switch (localBinding.type.id) {
- case T_String :
- codeStream.generateStringAppend(currentScope, this, expression);
- if (valueRequired) {
- codeStream.dup();
- }
- codeStream.store(localBinding, false);
- return;
- case T_int :
- if (((assignConstant = expression.constant) != NotAConstant) && ((increment = assignConstant.intValue()) == (short) increment)) { // 16 bits value
- switch (operator) {
- case PLUS :
- codeStream.iinc(localBinding.resolvedPosition, increment);
- if (valueRequired) {
- codeStream.load(localBinding);
- }
- return;
- case MINUS :
- codeStream.iinc(localBinding.resolvedPosition, -increment);
- if (valueRequired) {
- codeStream.load(localBinding);
- }
- return;
- }
- }
- default :
- codeStream.load(localBinding);
- }
- }
- // perform the actual compound operation
- int operationTypeID;
- if ((operationTypeID = implicitConversion >> 4) == T_String || operationTypeID == T_Object) {
- // we enter here if the single name reference is a field of type java.lang.String or if the type of the
- // operation is java.lang.Object
- // For example: o = o + ""; // where the compiled type of o is java.lang.Object.
- codeStream.generateStringAppend(currentScope, null, expression);
- } else {
- // promote the array reference to the suitable operation type
- codeStream.generateImplicitConversion(implicitConversion);
- // generate the increment value (will by itself be promoted to the operation value)
- if (expression == IntLiteral.One){ // prefix operation
- codeStream.generateConstant(expression.constant, implicitConversion);
- } else {
- expression.generateCode(currentScope, codeStream, true);
- }
- // perform the operation
- codeStream.sendOperator(operator, operationTypeID);
- // cast the value back to the array reference type
- codeStream.generateImplicitConversion(assignmentImplicitConversion);
- }
- // store the result back into the variable
- switch (bits & RestrictiveFlagMASK) {
- case FIELD : // assigning to a field
- fieldStore(codeStream, (FieldBinding) binding, writeAccessor, valueRequired);
- return;
- case LOCAL : // assigning to a local variable
- LocalVariableBinding localBinding = (LocalVariableBinding) binding;
- if (valueRequired) {
- if ((localBinding.type == LongBinding) || (localBinding.type == DoubleBinding)) {
- codeStream.dup2();
- } else {
- codeStream.dup();
- }
- }
- codeStream.store(localBinding, false);
- }
-}
-public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired) {
- switch (bits & RestrictiveFlagMASK) {
- case FIELD : // assigning to a field
- FieldBinding fieldBinding;
- if ((fieldBinding = (FieldBinding) binding).isStatic()) {
- if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
- codeStream.getstatic(fieldBinding);
- } else {
- codeStream.invokestatic(syntheticAccessors[READ]);
- }
- } else {
- if ((bits & DepthMASK) != 0) {
- Object[] emulationPath = currentScope.getExactEmulationPath(currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT));
- if (emulationPath == null) {
- // internal error, per construction we should have found it
- currentScope.problemReporter().needImplementation();
- } else {
- codeStream.generateOuterAccess(emulationPath, this, currentScope);
- }
- } else {
- codeStream.aload_0();
- }
- codeStream.dup();
- if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
- codeStream.getfield(fieldBinding);
- } else {
- codeStream.invokestatic(syntheticAccessors[READ]);
- }
- }
- if (valueRequired) {
- if (fieldBinding.isStatic()) {
- if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
- codeStream.dup2();
- } else {
- codeStream.dup();
- }
- } else { // Stack: [owner][old field value] ---> [old field value][owner][old field value]
- if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
- codeStream.dup2_x1();
- } else {
- codeStream.dup_x1();
- }
- }
- }
- codeStream.generateConstant(postIncrement.expression.constant, implicitConversion);
- codeStream.sendOperator(postIncrement.operator, fieldBinding.type.id);
- codeStream.generateImplicitConversion(postIncrement.assignmentImplicitConversion);
- fieldStore(codeStream, fieldBinding, syntheticAccessors == null ? null : syntheticAccessors[WRITE], false);
- return;
- case LOCAL : // assigning to a local variable
- LocalVariableBinding localBinding = (LocalVariableBinding) binding;
- // using incr bytecode if possible
- if (localBinding.type == IntBinding) {
- if (valueRequired) {
- codeStream.load(localBinding);
- }
- if (postIncrement.operator == PLUS) {
- codeStream.iinc(localBinding.resolvedPosition, 1);
- } else {
- codeStream.iinc(localBinding.resolvedPosition, -1);
- }
- } else {
- codeStream.load(localBinding);
- if (valueRequired){
- if ((localBinding.type == LongBinding) || (localBinding.type == DoubleBinding)) {
- codeStream.dup2();
- } else {
- codeStream.dup();
- }
- }
- codeStream.generateConstant(postIncrement.expression.constant, implicitConversion);
- codeStream.sendOperator(postIncrement.operator, localBinding.type.id);
- codeStream.generateImplicitConversion(postIncrement.assignmentImplicitConversion);
-
- codeStream.store(localBinding, false);
- }
- }
-}
-public void generateReceiver(CodeStream codeStream) {
- codeStream.aload_0();
-}
-public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
-
- //If inlinable field, forget the access emulation, the code gen will directly target it
- if (((bits & DepthMASK) == 0) || (constant != NotAConstant)) return;
-
- switch (bits & RestrictiveFlagMASK) {
- case FIELD :
- FieldBinding fieldBinding;
- if ((fieldBinding = (FieldBinding)binding).isStatic() || (fieldBinding.constant != NotAConstant)) return;
- ReferenceBinding compatibleType = currentScope.enclosingSourceType();
- // the declaringClass of the target binding must be compatible with the enclosing
- // type at <depth> levels outside
- for (int i = 0, depth = (bits & DepthMASK) >> DepthSHIFT; i < depth; i++) {
- compatibleType = compatibleType.enclosingType();
- }
- currentScope.emulateOuterAccess(compatibleType, false); // request cascade of accesses
- break;
- case LOCAL :
- currentScope.emulateOuterAccess((LocalVariableBinding) binding);
- }
-}
-public void manageSyntheticReadAccessIfNecessary(BlockScope currentScope) {
-
- //If inlinable field, forget the access emulation, the code gen will directly target it
- if (constant != NotAConstant)
- return;
-
- if ((bits & FIELD) != 0) {
- FieldBinding fieldBinding = (FieldBinding) binding;
- if (((bits & DepthMASK) != 0)
- && (fieldBinding.isPrivate() // private access
- || (fieldBinding.isProtected() // implicit protected access
- && fieldBinding.declaringClass.getPackage()
- != currentScope.enclosingSourceType().getPackage()))) {
- if (syntheticAccessors == null)
- syntheticAccessors = new MethodBinding[2];
- syntheticAccessors[READ] =
- ((SourceTypeBinding)currentScope.enclosingSourceType().
- enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT)).
- addSyntheticMethod(fieldBinding, true);
- currentScope.problemReporter().needToEmulateFieldReadAccess(fieldBinding, this);
- }
- }
-}
-public void manageSyntheticWriteAccessIfNecessary(BlockScope currentScope) {
-
- if ((bits & FIELD) != 0) {
- FieldBinding fieldBinding = (FieldBinding) binding;
- if (((bits & DepthMASK) != 0)
- && (fieldBinding.isPrivate() // private access
- || (fieldBinding.isProtected() // implicit protected access
- && fieldBinding.declaringClass.getPackage()
- != currentScope.enclosingSourceType().getPackage()))) {
- if (syntheticAccessors == null)
- syntheticAccessors = new MethodBinding[2];
- syntheticAccessors[WRITE] =
- ((SourceTypeBinding)currentScope.enclosingSourceType().
- enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT)).
- addSyntheticMethod(fieldBinding, false);
- currentScope.problemReporter().needToEmulateFieldWriteAccess(fieldBinding, this);
- }
- }
-}
-public TypeBinding reportError(BlockScope scope) {
- //=====error cases=======
- constant = Constant.NotAConstant;
- if (binding instanceof ProblemFieldBinding) {
- scope.problemReporter().invalidField(this, (FieldBinding) binding);
- } else if (binding instanceof ProblemReferenceBinding) {
- scope.problemReporter().invalidType(this, (TypeBinding) binding);
- } else {
- scope.problemReporter().unresolvableReference(this, binding);
- }
- return null;
-}
-public TypeBinding resolveType(BlockScope scope) {
- // for code gen, harm the restrictiveFlag
-
- this.receiverType = scope.enclosingSourceType();
-
- if ((binding = scope.getBinding(token, bits & RestrictiveFlagMASK, this)).isValidBinding()) {
- switch (bits & RestrictiveFlagMASK) {
- case VARIABLE : // =========only variable============
- case VARIABLE | TYPE : //====both variable and type============
- if (binding instanceof VariableBinding) {
- VariableBinding vb = (VariableBinding) binding;
- if (binding instanceof LocalVariableBinding) {
- bits &= ~RestrictiveFlagMASK; // clear bits
- bits |= LOCAL;
- constant = vb.constant;
- if ((!vb.isFinal()) && ((bits & DepthMASK) != 0))
- scope.problemReporter().cannotReferToNonFinalOuterLocal((LocalVariableBinding)vb, this);
- return vb.type;
- }
- // a field
- return checkFieldAccess(scope);
- }
-
- // thus it was a type
- bits &= ~RestrictiveFlagMASK; // clear bits
- bits |= TYPE;
- case TYPE : //========only type==============
- constant = Constant.NotAConstant;
- //deprecated test
- if (isTypeUseDeprecated((TypeBinding) binding, scope))
- scope.problemReporter().deprecatedType((TypeBinding) binding, this);
- return (TypeBinding) binding;
- }
- }
-
- // error scenarii
- return this.reportError(scope);
-}
-public String toStringExpression(){
-
- return new String(token);}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-public String unboundReferenceErrorName(){
-
- return new String(token);}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.impl.*;
+import org.eclipse.jdt.internal.compiler.codegen.*;
+import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class SingleNameReference extends NameReference implements OperatorIds {
+ public char[] token;
+
+ public MethodBinding[] syntheticAccessors; // [0]=read accessor [1]=write accessor
+ public static final int READ = 0;
+ public static final int WRITE = 1;
+public SingleNameReference(char[] source, long pos) {
+ super();
+ token = source;
+ sourceStart = (int) (pos >>> 32);
+ sourceEnd = (int) pos;
+}
+public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment, boolean isCompound) {
+
+ // compound assignment extra work
+ if (isCompound) { // check the variable part is initialized if blank final
+ switch (bits & RestrictiveFlagMASK) {
+ case FIELD : // reading a field
+ FieldBinding fieldBinding;
+ if ((fieldBinding = (FieldBinding) binding).isFinal() && currentScope.allowBlankFinalFieldAssignment(fieldBinding)) {
+ if (!flowInfo.isDefinitelyAssigned(fieldBinding)) {
+ currentScope.problemReporter().uninitializedBlankFinalField(fieldBinding, this);
+ // we could improve error msg here telling "cannot use compound assignment on final blank field"
+ }
+ }
+ manageSyntheticReadAccessIfNecessary(currentScope);
+ break;
+ case LOCAL : // reading a local variable
+ // check if assigning a final blank field
+ LocalVariableBinding localBinding;
+ if (!flowInfo.isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
+ currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
+ // we could improve error msg here telling "cannot use compound assignment on final local variable"
+ }
+ if (!flowInfo.isFakeReachable()) localBinding.used = true;
+ }
+ }
+ if (assignment.expression != null) {
+ flowInfo = assignment.expression.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
+ }
+ switch (bits & RestrictiveFlagMASK) {
+ case FIELD : // assigning to a field
+ manageSyntheticWriteAccessIfNecessary(currentScope);
+
+ // check if assigning a final field
+ FieldBinding fieldBinding;
+ if ((fieldBinding = (FieldBinding) binding).isFinal()) {
+ // inside a context where allowed
+ if (currentScope.allowBlankFinalFieldAssignment(fieldBinding)) {
+ if (flowInfo.isPotentiallyAssigned(fieldBinding)) {
+ currentScope.problemReporter().duplicateInitializationOfBlankFinalField(fieldBinding, this);
+ }
+ flowInfo.markAsDefinitelyAssigned(fieldBinding);
+ flowContext.recordSettingFinal(fieldBinding, this);
+ } else {
+ currentScope.problemReporter().cannotAssignToFinalField(fieldBinding, this);
+ }
+ }
+ break;
+ case LOCAL : // assigning to a local variable
+ LocalVariableBinding localBinding = (LocalVariableBinding) binding;
+ if (!flowInfo.isDefinitelyAssigned(localBinding)){// for local variable debug attributes
+ bits |= FirstAssignmentToLocalMASK;
+ } else {
+ bits &= ~FirstAssignmentToLocalMASK;
+ }
+ if (localBinding.isFinal()) {
+ if ((bits & DepthMASK) == 0) {
+ if (flowInfo.isPotentiallyAssigned(localBinding)) {
+ currentScope.problemReporter().duplicateInitializationOfFinalLocal(localBinding, this);
+ }
+ flowContext.recordSettingFinal(localBinding, this);
+ } else {
+ currentScope.problemReporter().cannotAssignToFinalOuterLocal(localBinding, this);
+ }
+ }
+ flowInfo.markAsDefinitelyAssigned(localBinding);
+ }
+ manageEnclosingInstanceAccessIfNecessary(currentScope);
+ return flowInfo;
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ return analyseCode(currentScope, flowContext, flowInfo, true);
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired) {
+ switch (bits & RestrictiveFlagMASK) {
+ case FIELD : // reading a field
+ if (valueRequired) {
+ manageSyntheticReadAccessIfNecessary(currentScope);
+ }
+ // check if reading a final blank field
+ FieldBinding fieldBinding;
+ if ((fieldBinding = (FieldBinding) binding).isFinal() && currentScope.allowBlankFinalFieldAssignment(fieldBinding)) {
+ if (!flowInfo.isDefinitelyAssigned(fieldBinding)) {
+ currentScope.problemReporter().uninitializedBlankFinalField(fieldBinding, this);
+ }
+ }
+ break;
+ case LOCAL : // reading a local variable
+ LocalVariableBinding localBinding;
+ if (!flowInfo.isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
+ currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
+ }
+ if (!flowInfo.isFakeReachable()) localBinding.used = true;
+ }
+ if (valueRequired) {
+ manageEnclosingInstanceAccessIfNecessary(currentScope);
+ }
+ return flowInfo;
+}
+public TypeBinding checkFieldAccess(BlockScope scope) {
+
+ FieldBinding fieldBinding = (FieldBinding) binding;
+
+ bits &= ~RestrictiveFlagMASK; // clear bits
+ bits |= FIELD;
+ if (!((FieldBinding) binding).isStatic()) {
+ // must check for the static status....
+ if (scope.methodScope().isStatic) {
+ scope.problemReporter().staticFieldAccessToNonStaticVariable(
+ this,
+ fieldBinding);
+ constant = NotAConstant;
+ return null;
+ }
+ }
+ constant = FieldReference.getConstantFor(fieldBinding, true, this, 0);
+ if (isFieldUseDeprecated(fieldBinding, scope))
+ scope.problemReporter().deprecatedField(fieldBinding, this);
+ // if the binding declaring class is not visible, need special action
+ // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
+ if (fieldBinding.declaringClass != null
+ && fieldBinding.constant == NotAConstant
+ && !fieldBinding.declaringClass.canBeSeenBy(scope))
+ binding = new FieldBinding(fieldBinding, scope.enclosingSourceType());
+
+ //===============================================
+ //cycle are forbidden ONLY within the same class...why ?????? (poor javac....)
+ //Cycle can be done using cross class ref but not direct into a same class reference ????
+ //class A { static int k = B.k+1;}
+ //class B { static int k = A.k+2;}
+ //The k-cycle in this example is valid.
+
+ //class C { static int k = k + 1 ;}
+ //here it is forbidden ! ????
+ //but the next one is valid !!!
+ //class C { static int k = C.k + 1;}
+
+ //notice that the next one is also valid ?!?!
+ //class A { static int k = foo().k+1 ; static A foo(){return new A();}}
+
+ //for all these reasons, the next piece of code is only here and not
+ //commun for all FieldRef and QualifiedNameRef....(i.e. in the getField(..) API.....
+
+ //instance field may refer to forward static field, like in
+ //int i = staticI;
+ //static int staticI = 2 ;
+
+ MethodScope ms = scope.methodScope();
+ if (ms.enclosingSourceType() == fieldBinding.declaringClass
+ && ms.fieldDeclarationIndex != MethodScope.NotInFieldDecl
+ && fieldBinding.id >= ms.fieldDeclarationIndex) {
+ //if the field is static and ms is not .... then it is valid
+ if (!fieldBinding.isStatic() || ms.isStatic)
+ scope.problemReporter().forwardReference(this, 0, scope.enclosingSourceType());
+ }
+ //====================================================
+
+ return fieldBinding.type;
+
+}
+public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) {
+
+ // optimizing assignment like: i = i + 1 or i = 1 + i
+ if (assignment.expression.isCompactableOperation()) {
+ BinaryExpression operation = (BinaryExpression) assignment.expression;
+ SingleNameReference variableReference;
+ if ((operation.left instanceof SingleNameReference) && ((variableReference = (SingleNameReference) operation.left).binding == binding)) {
+ // i = i + value, then use the variable on the right hand side, since it has the correct implicit conversion
+ variableReference.generateCompoundAssignment(currentScope, codeStream, syntheticAccessors == null ? null : syntheticAccessors[WRITE], operation.right, (operation.bits & OperatorMASK) >> OperatorSHIFT, operation.left.implicitConversion /*should be equivalent to no conversion*/, valueRequired);
+ return;
+ }
+ int operator = (operation.bits & OperatorMASK) >> OperatorSHIFT;
+ if ((operation.right instanceof SingleNameReference)
+ && ((operator == PLUS) || (operator == MULTIPLY)) // only commutative operations
+ && ((variableReference = (SingleNameReference) operation.right).binding == binding)
+ && (operation.left.constant != NotAConstant) // exclude non constant expressions, since could have side-effect
+ && ((operation.left.implicitConversion >> 4) != T_String) // exclude string concatenation which would occur backwards
+ && ((operation.right.implicitConversion >> 4) != T_String)) { // exclude string concatenation which would occur backwards
+ // i = value + i, then use the variable on the right hand side, since it has the correct implicit conversion
+ variableReference.generateCompoundAssignment(currentScope, codeStream, syntheticAccessors == null ? null : syntheticAccessors[WRITE], operation.left, operator, operation.right.implicitConversion /*should be equivalent to no conversion*/, valueRequired);
+ return;
+ }
+ }
+ switch (bits & RestrictiveFlagMASK) {
+ case FIELD : // assigning to a field
+ FieldBinding fieldBinding;
+ if (!(fieldBinding = (FieldBinding) binding).isStatic()) { // need a receiver?
+ if ((bits & DepthMASK) != 0) {
+ Object[] emulationPath = currentScope.getExactEmulationPath(currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT));
+ if (emulationPath == null) {
+ // internal error, per construction we should have found it
+ currentScope.problemReporter().needImplementation();
+ } else {
+ codeStream.generateOuterAccess(emulationPath, this, currentScope);
+ }
+ } else {
+ this.generateReceiver(codeStream);
+ }
+ }
+ assignment.expression.generateCode(currentScope, codeStream, true);
+ fieldStore(codeStream, fieldBinding, syntheticAccessors == null ? null : syntheticAccessors[WRITE], valueRequired);
+ if (valueRequired) {
+ codeStream.generateImplicitConversion(assignment.implicitConversion);
+ }
+ return;
+ case LOCAL : // assigning to a local variable
+ LocalVariableBinding localBinding = (LocalVariableBinding) binding;
+ if (localBinding.resolvedPosition != -1) {
+ assignment.expression.generateCode(currentScope, codeStream, true);
+ } else {
+ if (assignment.expression.constant != NotAConstant) {
+ // assigning an unused local to a constant value = no actual assignment is necessary
+ if (valueRequired) {
+ codeStream.generateConstant(assignment.expression.constant, assignment.implicitConversion);
+ }
+ } else {
+ assignment.expression.generateCode(currentScope, codeStream, true);
+ /* Even though the value may not be required, we force it to be produced, and discard it later
+ on if it was actually not necessary, so as to provide the same behavior as JDK1.2beta3. */
+ if (valueRequired) {
+ codeStream.generateImplicitConversion(assignment.implicitConversion); // implicit conversion
+ } else {
+ if ((localBinding.type == LongBinding) || (localBinding.type == DoubleBinding)) {
+ codeStream.pop2();
+ } else {
+ codeStream.pop();
+ }
+ }
+ }
+ return;
+ }
+ // normal local assignment (since cannot store in outer local which are final locations)
+ codeStream.store(localBinding, valueRequired);
+ if ((bits & FirstAssignmentToLocalMASK) != 0) { // for local variable debug attributes
+ localBinding.recordInitializationStartPC(codeStream.position);
+ }
+ // implicit conversion
+ if (valueRequired) {
+ codeStream.generateImplicitConversion(assignment.implicitConversion);
+ }
+ }
+}
+public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+ int pc = codeStream.position;
+ if (constant != NotAConstant) {
+ if (valueRequired) {
+ codeStream.generateConstant(constant, implicitConversion);
+ }
+ } else {
+ switch (bits & RestrictiveFlagMASK) {
+ case FIELD : // reading a field
+ FieldBinding fieldBinding;
+ if (valueRequired) {
+ if ((fieldBinding = (FieldBinding) binding).constant == NotAConstant) { // directly use inlined value for constant fields
+ boolean isStatic;
+ if (!(isStatic = fieldBinding.isStatic())) {
+ if ((bits & DepthMASK) != 0) {
+ Object[] emulationPath = currentScope.getExactEmulationPath(currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT));
+ if (emulationPath == null) {
+ // internal error, per construction we should have found it
+ currentScope.problemReporter().needImplementation();
+ } else {
+ codeStream.generateOuterAccess(emulationPath, this, currentScope);
+ }
+ } else {
+ generateReceiver(codeStream);
+ }
+ }
+ // managing private access
+ if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
+ if (isStatic) {
+ codeStream.getstatic(fieldBinding);
+ } else {
+ codeStream.getfield(fieldBinding);
+ }
+ } else {
+ codeStream.invokestatic(syntheticAccessors[READ]);
+ }
+ codeStream.generateImplicitConversion(implicitConversion);
+ } else { // directly use the inlined value
+ codeStream.generateConstant(fieldBinding.constant, implicitConversion);
+ }
+ }
+ break;
+ case LOCAL : // reading a local
+ LocalVariableBinding localBinding = (LocalVariableBinding) binding;
+ if (valueRequired) {
+ // outer local?
+ if ((bits & DepthMASK) != 0) {
+ // outer local can be reached either through a synthetic arg or a synthetic field
+ VariableBinding[] path = currentScope.getEmulationPath(localBinding);
+ if (path == null) {
+ // emulation was not possible (should not happen per construction)
+ currentScope.problemReporter().needImplementation();
+ } else {
+ codeStream.generateOuterAccess(path, this, currentScope);
+ }
+ } else {
+ // regular local variable read
+ codeStream.load(localBinding);
+ }
+ codeStream.generateImplicitConversion(implicitConversion);
+ }
+ }
+ }
+ codeStream.recordPositionsFrom(pc, this);
+}
+/*
+ * Regular API for compound assignment, relies on the fact that there is only one reference to the
+ * variable, which carries both synthetic read/write accessors.
+ * The APIs with an extra argument is used whenever there are two references to the same variable which
+ * are optimized in one access: e.g "a = a + 1" optimized into "a++".
+ */
+public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) {
+
+ this.generateCompoundAssignment(
+ currentScope,
+ codeStream,
+ syntheticAccessors == null ? null : syntheticAccessors[WRITE],
+ expression,
+ operator,
+ assignmentImplicitConversion,
+ valueRequired);
+}
+/*
+ * The APIs with an extra argument is used whenever there are two references to the same variable which
+ * are optimized in one access: e.g "a = a + 1" optimized into "a++".
+ */
+public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, MethodBinding writeAccessor, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) {
+ switch (bits & RestrictiveFlagMASK) {
+ case FIELD : // assigning to a field
+ FieldBinding fieldBinding;
+ if ((fieldBinding = (FieldBinding) binding).isStatic()) {
+ if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
+ codeStream.getstatic(fieldBinding);
+ } else {
+ codeStream.invokestatic(syntheticAccessors[READ]);
+ }
+ } else {
+ if ((bits & DepthMASK) != 0) {
+ Object[] emulationPath = currentScope.getExactEmulationPath(currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT));
+ if (emulationPath == null) {
+ // internal error, per construction we should have found it
+ currentScope.problemReporter().needImplementation();
+ } else {
+ codeStream.generateOuterAccess(emulationPath, this, currentScope);
+ }
+ } else {
+ codeStream.aload_0();
+ }
+ codeStream.dup();
+ if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
+ codeStream.getfield(fieldBinding);
+ } else {
+ codeStream.invokestatic(syntheticAccessors[READ]);
+ }
+ }
+ break;
+ case LOCAL : // assigning to a local variable (cannot assign to outer local)
+ LocalVariableBinding localBinding = (LocalVariableBinding) binding;
+ Constant assignConstant;
+ int increment;
+ // using incr bytecode if possible
+ switch (localBinding.type.id) {
+ case T_String :
+ codeStream.generateStringAppend(currentScope, this, expression);
+ if (valueRequired) {
+ codeStream.dup();
+ }
+ codeStream.store(localBinding, false);
+ return;
+ case T_int :
+ if (((assignConstant = expression.constant) != NotAConstant) && ((increment = assignConstant.intValue()) == (short) increment)) { // 16 bits value
+ switch (operator) {
+ case PLUS :
+ codeStream.iinc(localBinding.resolvedPosition, increment);
+ if (valueRequired) {
+ codeStream.load(localBinding);
+ }
+ return;
+ case MINUS :
+ codeStream.iinc(localBinding.resolvedPosition, -increment);
+ if (valueRequired) {
+ codeStream.load(localBinding);
+ }
+ return;
+ }
+ }
+ default :
+ codeStream.load(localBinding);
+ }
+ }
+ // perform the actual compound operation
+ int operationTypeID;
+ if ((operationTypeID = implicitConversion >> 4) == T_String || operationTypeID == T_Object) {
+ // we enter here if the single name reference is a field of type java.lang.String or if the type of the
+ // operation is java.lang.Object
+ // For example: o = o + ""; // where the compiled type of o is java.lang.Object.
+ codeStream.generateStringAppend(currentScope, null, expression);
+ } else {
+ // promote the array reference to the suitable operation type
+ codeStream.generateImplicitConversion(implicitConversion);
+ // generate the increment value (will by itself be promoted to the operation value)
+ if (expression == IntLiteral.One){ // prefix operation
+ codeStream.generateConstant(expression.constant, implicitConversion);
+ } else {
+ expression.generateCode(currentScope, codeStream, true);
+ }
+ // perform the operation
+ codeStream.sendOperator(operator, operationTypeID);
+ // cast the value back to the array reference type
+ codeStream.generateImplicitConversion(assignmentImplicitConversion);
+ }
+ // store the result back into the variable
+ switch (bits & RestrictiveFlagMASK) {
+ case FIELD : // assigning to a field
+ fieldStore(codeStream, (FieldBinding) binding, writeAccessor, valueRequired);
+ return;
+ case LOCAL : // assigning to a local variable
+ LocalVariableBinding localBinding = (LocalVariableBinding) binding;
+ if (valueRequired) {
+ if ((localBinding.type == LongBinding) || (localBinding.type == DoubleBinding)) {
+ codeStream.dup2();
+ } else {
+ codeStream.dup();
+ }
+ }
+ codeStream.store(localBinding, false);
+ }
+}
+public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired) {
+ switch (bits & RestrictiveFlagMASK) {
+ case FIELD : // assigning to a field
+ FieldBinding fieldBinding;
+ if ((fieldBinding = (FieldBinding) binding).isStatic()) {
+ if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
+ codeStream.getstatic(fieldBinding);
+ } else {
+ codeStream.invokestatic(syntheticAccessors[READ]);
+ }
+ } else {
+ if ((bits & DepthMASK) != 0) {
+ Object[] emulationPath = currentScope.getExactEmulationPath(currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT));
+ if (emulationPath == null) {
+ // internal error, per construction we should have found it
+ currentScope.problemReporter().needImplementation();
+ } else {
+ codeStream.generateOuterAccess(emulationPath, this, currentScope);
+ }
+ } else {
+ codeStream.aload_0();
+ }
+ codeStream.dup();
+ if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
+ codeStream.getfield(fieldBinding);
+ } else {
+ codeStream.invokestatic(syntheticAccessors[READ]);
+ }
+ }
+ if (valueRequired) {
+ if (fieldBinding.isStatic()) {
+ if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
+ codeStream.dup2();
+ } else {
+ codeStream.dup();
+ }
+ } else { // Stack: [owner][old field value] ---> [old field value][owner][old field value]
+ if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
+ codeStream.dup2_x1();
+ } else {
+ codeStream.dup_x1();
+ }
+ }
+ }
+ codeStream.generateConstant(postIncrement.expression.constant, implicitConversion);
+ codeStream.sendOperator(postIncrement.operator, fieldBinding.type.id);
+ codeStream.generateImplicitConversion(postIncrement.assignmentImplicitConversion);
+ fieldStore(codeStream, fieldBinding, syntheticAccessors == null ? null : syntheticAccessors[WRITE], false);
+ return;
+ case LOCAL : // assigning to a local variable
+ LocalVariableBinding localBinding = (LocalVariableBinding) binding;
+ // using incr bytecode if possible
+ if (localBinding.type == IntBinding) {
+ if (valueRequired) {
+ codeStream.load(localBinding);
+ }
+ if (postIncrement.operator == PLUS) {
+ codeStream.iinc(localBinding.resolvedPosition, 1);
+ } else {
+ codeStream.iinc(localBinding.resolvedPosition, -1);
+ }
+ } else {
+ codeStream.load(localBinding);
+ if (valueRequired){
+ if ((localBinding.type == LongBinding) || (localBinding.type == DoubleBinding)) {
+ codeStream.dup2();
+ } else {
+ codeStream.dup();
+ }
+ }
+ codeStream.generateConstant(postIncrement.expression.constant, implicitConversion);
+ codeStream.sendOperator(postIncrement.operator, localBinding.type.id);
+ codeStream.generateImplicitConversion(postIncrement.assignmentImplicitConversion);
+
+ codeStream.store(localBinding, false);
+ }
+ }
+}
+public void generateReceiver(CodeStream codeStream) {
+ codeStream.aload_0();
+}
+public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
+
+ //If inlinable field, forget the access emulation, the code gen will directly target it
+ if (((bits & DepthMASK) == 0) || (constant != NotAConstant)) return;
+
+ switch (bits & RestrictiveFlagMASK) {
+ case FIELD :
+ FieldBinding fieldBinding;
+ if ((fieldBinding = (FieldBinding)binding).isStatic() || (fieldBinding.constant != NotAConstant)) return;
+ ReferenceBinding compatibleType = currentScope.enclosingSourceType();
+ // the declaringClass of the target binding must be compatible with the enclosing
+ // type at <depth> levels outside
+ for (int i = 0, depth = (bits & DepthMASK) >> DepthSHIFT; i < depth; i++) {
+ compatibleType = compatibleType.enclosingType();
+ }
+ currentScope.emulateOuterAccess(compatibleType, false); // request cascade of accesses
+ break;
+ case LOCAL :
+ currentScope.emulateOuterAccess((LocalVariableBinding) binding);
+ }
+}
+public void manageSyntheticReadAccessIfNecessary(BlockScope currentScope) {
+
+ //If inlinable field, forget the access emulation, the code gen will directly target it
+ if (constant != NotAConstant)
+ return;
+
+ if ((bits & FIELD) != 0) {
+ FieldBinding fieldBinding = (FieldBinding) binding;
+ if (((bits & DepthMASK) != 0)
+ && (fieldBinding.isPrivate() // private access
+ || (fieldBinding.isProtected() // implicit protected access
+ && fieldBinding.declaringClass.getPackage()
+ != currentScope.enclosingSourceType().getPackage()))) {
+ if (syntheticAccessors == null)
+ syntheticAccessors = new MethodBinding[2];
+ syntheticAccessors[READ] =
+ ((SourceTypeBinding)currentScope.enclosingSourceType().
+ enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT)).
+ addSyntheticMethod(fieldBinding, true);
+ currentScope.problemReporter().needToEmulateFieldReadAccess(fieldBinding, this);
+ }
+ }
+}
+public void manageSyntheticWriteAccessIfNecessary(BlockScope currentScope) {
+
+ if ((bits & FIELD) != 0) {
+ FieldBinding fieldBinding = (FieldBinding) binding;
+ if (((bits & DepthMASK) != 0)
+ && (fieldBinding.isPrivate() // private access
+ || (fieldBinding.isProtected() // implicit protected access
+ && fieldBinding.declaringClass.getPackage()
+ != currentScope.enclosingSourceType().getPackage()))) {
+ if (syntheticAccessors == null)
+ syntheticAccessors = new MethodBinding[2];
+ syntheticAccessors[WRITE] =
+ ((SourceTypeBinding)currentScope.enclosingSourceType().
+ enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT)).
+ addSyntheticMethod(fieldBinding, false);
+ currentScope.problemReporter().needToEmulateFieldWriteAccess(fieldBinding, this);
+ }
+ }
+}
+public TypeBinding reportError(BlockScope scope) {
+ //=====error cases=======
+ constant = Constant.NotAConstant;
+ if (binding instanceof ProblemFieldBinding) {
+ scope.problemReporter().invalidField(this, (FieldBinding) binding);
+ } else if (binding instanceof ProblemReferenceBinding) {
+ scope.problemReporter().invalidType(this, (TypeBinding) binding);
+ } else {
+ scope.problemReporter().unresolvableReference(this, binding);
+ }
+ return null;
+}
+public TypeBinding resolveType(BlockScope scope) {
+ // for code gen, harm the restrictiveFlag
+
+ this.receiverType = scope.enclosingSourceType();
+
+ if ((binding = scope.getBinding(token, bits & RestrictiveFlagMASK, this)).isValidBinding()) {
+ switch (bits & RestrictiveFlagMASK) {
+ case VARIABLE : // =========only variable============
+ case VARIABLE | TYPE : //====both variable and type============
+ if (binding instanceof VariableBinding) {
+ VariableBinding vb = (VariableBinding) binding;
+ if (binding instanceof LocalVariableBinding) {
+ bits &= ~RestrictiveFlagMASK; // clear bits
+ bits |= LOCAL;
+ constant = vb.constant;
+ if ((!vb.isFinal()) && ((bits & DepthMASK) != 0))
+ scope.problemReporter().cannotReferToNonFinalOuterLocal((LocalVariableBinding)vb, this);
+ return vb.type;
+ }
+ // a field
+ return checkFieldAccess(scope);
+ }
+
+ // thus it was a type
+ bits &= ~RestrictiveFlagMASK; // clear bits
+ bits |= TYPE;
+ case TYPE : //========only type==============
+ constant = Constant.NotAConstant;
+ //deprecated test
+ if (isTypeUseDeprecated((TypeBinding) binding, scope))
+ scope.problemReporter().deprecatedType((TypeBinding) binding, this);
+ return (TypeBinding) binding;
+ }
+ }
+
+ // error scenarii
+ return this.reportError(scope);
+}
+public String toStringExpression(){
+
+ return new String(token);}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+}
+public String unboundReferenceErrorName(){
+
+ return new String(token);}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java
index 311709e53f..8dc1568df5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java
@@ -1,60 +1,59 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import org.eclipse.jdt.internal.compiler.impl.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
-
-public class SingleTypeReference extends TypeReference {
- public char[] token;
-
-
-public SingleTypeReference(char[] source, long pos) {
- token = source;
- sourceStart = (int) (pos>>>32) ;
- sourceEnd = (int) (pos & 0x00000000FFFFFFFFL) ;
-
-}
-public SingleTypeReference(char[] source ,TypeBinding tb, long pos) {
- this(source, pos) ;
- binding = tb ;
-}
-public TypeReference copyDims(int dim){
- //return a type reference copy of me with some dimensions
- //warning : the new type ref has a null binding
-
- return new ArrayTypeReference(token,null,dim,(((long)sourceStart)<<32)+sourceEnd) ;
-}
-public TypeBinding getTypeBinding(Scope scope) {
- if (binding != null)
- return binding;
- return scope.getType(token);
-}
-public char [][] getTypeName() {
- return new char[][] { token };
-}
-public TypeBinding resolveTypeEnclosing(BlockScope scope, ReferenceBinding enclosingType) {
- ReferenceBinding memberTb = scope.getMemberType(token, enclosingType);
- if (!memberTb.isValidBinding()) {
- scope.problemReporter().invalidEnclosingType(this, memberTb, enclosingType);
- return null;
- }
- if (isTypeUseDeprecated(memberTb, scope))
- scope.problemReporter().deprecatedType(memberTb, this);
- return binding = memberTb;
-}
-public String toStringExpression(int tab){
- return new String(token) ;
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-}
+package org.eclipse.jdt.internal.compiler.ast;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class SingleTypeReference extends TypeReference {
+ public char[] token;
+
+
+public SingleTypeReference(char[] source, long pos) {
+ token = source;
+ sourceStart = (int) (pos>>>32) ;
+ sourceEnd = (int) (pos & 0x00000000FFFFFFFFL) ;
+
+}
+public SingleTypeReference(char[] source ,TypeBinding tb, long pos) {
+ this(source, pos) ;
+ binding = tb ;
+}
+public TypeReference copyDims(int dim){
+ //return a type reference copy of me with some dimensions
+ //warning : the new type ref has a null binding
+
+ return new ArrayTypeReference(token,null,dim,(((long)sourceStart)<<32)+sourceEnd) ;
+}
+public TypeBinding getTypeBinding(Scope scope) {
+ if (binding != null)
+ return binding;
+ return scope.getType(token);
+}
+public char [][] getTypeName() {
+ return new char[][] { token };
+}
+public TypeBinding resolveTypeEnclosing(BlockScope scope, ReferenceBinding enclosingType) {
+ ReferenceBinding memberTb = scope.getMemberType(token, enclosingType);
+ if (!memberTb.isValidBinding()) {
+ scope.problemReporter().invalidEnclosingType(this, memberTb, enclosingType);
+ return null;
+ }
+ if (isTypeUseDeprecated(memberTb, scope))
+ scope.problemReporter().deprecatedType(memberTb, this);
+ return binding = memberTb;
+}
+public String toStringExpression(int tab){
+ return new String(token) ;
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java
index 5060063c54..0145ca93f5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java
@@ -1,108 +1,103 @@
-package org.eclipse.jdt.internal.compiler.ast;
-
-/*