replaced a lot of deprecated code; if someone runs into a commit conflict afterwards...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / lookup / SourceTypeBinding.java
index 87fd4e9..266a332 100644 (file)
@@ -1,10 +1,10 @@
 /*******************************************************************************
  * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials 
+ * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Common Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/cpl-v10.html
- * 
+ *
  * Contributors:
  *     IBM Corporation - initial API and implementation
  *******************************************************************************/
@@ -40,9 +40,9 @@ public class SourceTypeBinding extends ReferenceBinding {
        public final static int FIELD = 1;
        public final static int CLASS_LITERAL = 2;
        public final static int CHANGED_DECLARING_CLASS = 3;
-       
+
        Hashtable[] synthetics;
-       
+
 protected SourceTypeBinding() {
 }
 public SourceTypeBinding(char[][] compoundName, PackageBinding fPackage, ClassScope scope) {
@@ -115,14 +115,14 @@ public FieldBinding addSyntheticField(LocalVariableBinding actualOuterLocalVaria
        if (synthetics[FIELD] == null) {
                synthetics[FIELD] = new Hashtable(5);
        }
-       
+
        FieldBinding synthField = (FieldBinding) synthetics[FIELD].get(actualOuterLocalVariable);
        if (synthField == null) {
                synthField = new SyntheticFieldBinding(
-                       CharOperation.concat(SyntheticArgumentBinding.OuterLocalPrefix, actualOuterLocalVariable.name), 
-                       actualOuterLocalVariable.type, 
-                       AccPrivate | AccFinal ,//| AccSynthetic, 
-                       this, 
+                       CharOperation.concat(SyntheticArgumentBinding.OuterLocalPrefix, actualOuterLocalVariable.name),
+                       actualOuterLocalVariable.type,
+                       AccPrivate | AccFinal ,//| AccSynthetic,
+                       this,
                        Constant.NotAConstant,
                        synthetics[FIELD].size());
                synthetics[FIELD].put(actualOuterLocalVariable, synthField);
@@ -188,7 +188,7 @@ public FieldBinding addSyntheticField(ReferenceBinding enclosingType) {
                                break;
                        }
                }
-       }               
+       }
        return synthField;
 }
 /* Add a new synthetic field for a class literal access.
@@ -227,7 +227,7 @@ public FieldBinding addSyntheticField(TypeBinding targetType, BlockScope blockSc
                                break;
                        }
                }
-       }               
+       }
        return synthField;
 }
 
@@ -296,7 +296,7 @@ public SyntheticAccessMethodBinding addSyntheticMethod(FieldBinding targetField,
        if (accessors == null) {
                accessMethod = new SyntheticAccessMethodBinding(targetField, isReadAccess, this);
                synthetics[METHOD].put(targetField, accessors = new SyntheticAccessMethodBinding[2]);
-               accessors[isReadAccess ? 0 : 1] = accessMethod;         
+               accessors[isReadAccess ? 0 : 1] = accessMethod;
        } else {
                if ((accessMethod = accessors[isReadAccess ? 0 : 1]) == null) {
                        accessMethod = new SyntheticAccessMethodBinding(targetField, isReadAccess, this);
@@ -324,7 +324,7 @@ public SyntheticAccessMethodBinding addSyntheticMethod(MethodBinding targetMetho
        if (accessors == null) {
                accessMethod = new SyntheticAccessMethodBinding(targetMethod, isSuperAccess, this);
                synthetics[METHOD].put(targetMethod, accessors = new SyntheticAccessMethodBinding[2]);
-               accessors[isSuperAccess ? 0 : 1] = accessMethod;                
+               accessors[isSuperAccess ? 0 : 1] = accessMethod;
        } else {
                if ((accessMethod = accessors[isSuperAccess ? 0 : 1]) == null) {
                        accessMethod = new SyntheticAccessMethodBinding(targetMethod, isSuperAccess, this);
@@ -365,7 +365,7 @@ public FieldBinding[] fields() {
                        int newSize = fields.length - failed;
                        if (newSize == 0)
                                return fields = NoFields;
-       
+
                        FieldBinding[] newFields = new FieldBinding[newSize];
                        for (int i = 0, n = 0, max = fields.length; i < max; i++)
                                if (fields[i] != null)
@@ -386,7 +386,7 @@ public FieldBinding[] fields() {
                }
                if (newFields != null){
                        System.arraycopy(newFields, 0, fields = new FieldBinding[count], 0, count);
-               }                       
+               }
                throw e;
        }
        return fields;
@@ -543,7 +543,7 @@ public MethodBinding[] getMethods(char[] selector) {
                                        }
                                }
                        }
-       
+
                        if (foundProblem || count > 1) {
                                for (int m = methods.length; --m >= 0;) {
                                        MethodBinding method = methods[m];
@@ -574,12 +574,12 @@ public MethodBinding[] getMethods(char[] selector) {
                                                }
                                        }
                                }
-       
+
                                if (failed > 0) {
                                        int newSize = methods.length - failed;
                                        if (newSize == 0)
                                                return methods = NoMethods;
-       
+
                                        MethodBinding[] newMethods = new MethodBinding[newSize];
                                        for (int i = 0, n = 0, max = methods.length; i < max; i++)
                                                if (methods[i] != null)
@@ -615,10 +615,10 @@ public MethodBinding[] getMethods(char[] selector) {
                }
                if (newMethods != null){
                        System.arraycopy(newMethods, 0, methods = new MethodBinding[count], 0, count);
-               }                       
+               }
                modifiers ^= AccUnresolved;
                throw e;
-       }               
+       }
        return NoMethods;
 }
 /* Answer the synthetic field for <actualOuterLocalVariable>
@@ -626,7 +626,7 @@ public MethodBinding[] getMethods(char[] selector) {
 */
 
 public FieldBinding getSyntheticField(LocalVariableBinding actualOuterLocalVariable) {
-       
+
        if (synthetics == null || synthetics[FIELD] == null) return null;
        return (FieldBinding) synthetics[FIELD].get(actualOuterLocalVariable);
 }
@@ -683,7 +683,7 @@ public MethodBinding[] methods() {
        try {
                if ((modifiers & AccUnresolved) == 0)
                        return methods;
-       
+
                int failed = 0;
                for (int m = 0, max = methods.length; m < max; m++) {
                        if (resolveTypesFor(methods[m]) == null) {
@@ -691,7 +691,7 @@ public MethodBinding[] methods() {
                                failed++;
                        }
                }
-       
+
                for (int m = methods.length; --m >= 0;) {
                        MethodBinding method = methods[m];
                        if (method != null) {
@@ -721,7 +721,7 @@ public MethodBinding[] methods() {
                                }
                        }
                }
-       
+
                if (failed > 0) {
                        int newSize = methods.length - failed;
                        if (newSize == 0) {
@@ -734,7 +734,7 @@ public MethodBinding[] methods() {
                                methods = newMethods;
                        }
                }
-       
+
                // handle forward references to potential default abstract methods
                addDefaultAbstractMethods();
        } catch(AbortCompilation e){
@@ -751,10 +751,10 @@ public MethodBinding[] methods() {
                }
                if (newMethods != null){
                        System.arraycopy(newMethods, 0, methods = new MethodBinding[count], 0, count);
-               }                       
+               }
                modifiers ^= AccUnresolved;
                throw e;
-       }               
+       }
        modifiers ^= AccUnresolved;
        return methods;
 }
@@ -883,7 +883,7 @@ public ReferenceBinding[] superInterfaces() {
        return superInterfaces;
 }
 public SyntheticAccessMethodBinding[] syntheticAccessMethods() {
-       
+
        if (synthetics == null || synthetics[METHOD] == null || synthetics[METHOD].size() == 0) return null;
 
        // difficult to compute size up front because of the embedded arrays so assume there is only 1
@@ -902,9 +902,9 @@ public SyntheticAccessMethodBinding[] syntheticAccessMethods() {
                        if (methodAccessors[1] != null) numberOfAccessors++;
                        if (index + numberOfAccessors > bindings.length)
                                System.arraycopy(bindings, 0, (bindings = new SyntheticAccessMethodBinding[index + numberOfAccessors]), 0, index);
-                       if (methodAccessors[0] != null) 
-                               bindings[index++] = methodAccessors[0]; // super access 
-                       if (methodAccessors[1] != null) 
+                       if (methodAccessors[0] != null)
+                               bindings[index++] = methodAccessors[0]; // super access
+                       if (methodAccessors[1] != null)
                                bindings[index++] = methodAccessors[1]; // normal access
 
                } else {
@@ -915,9 +915,9 @@ public SyntheticAccessMethodBinding[] syntheticAccessMethods() {
                        if (fieldAccessors[1] != null) numberOfAccessors++;
                        if (index + numberOfAccessors > bindings.length)
                                System.arraycopy(bindings, 0, (bindings = new SyntheticAccessMethodBinding[index + numberOfAccessors]), 0, index);
-                       if (fieldAccessors[0] != null) 
+                       if (fieldAccessors[0] != null)
                                bindings[index++] = fieldAccessors[0]; // read access
-                       if (fieldAccessors[1] != null) 
+                       if (fieldAccessors[1] != null)
                                bindings[index++] = fieldAccessors[1]; // write access
                }
        }
@@ -935,7 +935,7 @@ public SyntheticAccessMethodBinding[] syntheticAccessMethods() {
  * Answer the collection of synthetic fields to append into the classfile
  */
 public FieldBinding[] syntheticFields() {
-       
+
        if (synthetics == null) return null;
 
        int fieldSize = synthetics[FIELD] == null ? 0 : synthetics[FIELD].size();
@@ -1051,9 +1051,9 @@ public FieldBinding getSyntheticField(ReferenceBinding targetEnclosingType, bool
        // class T { class M{}}
        // class S extends T { class N extends M {}} --> need to use S as a default enclosing instance for the super constructor call in N().
        if (!onlyExactMatch){
-               Enumeration enum = synthetics[FIELD].elements();
-               while (enum.hasMoreElements()) {
-                       field = (FieldBinding) enum.nextElement();
+               Enumeration e = synthetics[FIELD].elements();
+               while (e.hasMoreElements()) {
+                       field = (FieldBinding) e.nextElement();
                        if (CharOperation.prefixEquals(SyntheticArgumentBinding.EnclosingInstancePrefix, field.name)
                                && targetEnclosingType.isSuperclassOf((ReferenceBinding) field.type))
                                        return field;