<s> package org . eclipse . jdt . internal . compiler . lookup ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . Annotation ; public class NestedTypeBinding extends SourceTypeBinding { public SourceTypeBinding enclosingType ; public SyntheticArgumentBinding [ ] enclosingInstances ; private ReferenceBinding [ ] enclosingTypes = Binding . UNINITIALIZED_REFERENCE_TYPES ; public SyntheticArgumentBinding [ ] outerLocalVariables ; private int outerLocalVariablesSlotSize = - 1 ; public NestedTypeBinding ( char [ ] [ ] typeName , ClassScope scope , SourceTypeBinding enclosingType ) { super ( typeName , enclosingType . fPackage , scope ) ; this . tagBits |= ( TagBits . IsNestedType | TagBits . ContainsNestedTypeReferences ) ; this . enclosingType = enclosingType ; } public SyntheticArgumentBinding addSyntheticArgument ( LocalVariableBinding actualOuterLocalVariable ) { SyntheticArgumentBinding synthLocal = null ; if ( this . outerLocalVariables == null ) { synthLocal = new SyntheticArgumentBinding ( actualOuterLocalVariable ) ; this . outerLocalVariables = new SyntheticArgumentBinding [ ] { synthLocal } ; } else { int size = this . outerLocalVariables . length ; int newArgIndex = size ; for ( int i = size ; -- i >= 0 ; ) { if ( this . outerLocalVariables [ i ] . actualOuterLocalVariable == actualOuterLocalVariable ) return this . outerLocalVariables [ i ] ; if ( this . outerLocalVariables [ i ] . id > actualOuterLocalVariable . id ) newArgIndex = i ; } SyntheticArgumentBinding [ ] synthLocals = new SyntheticArgumentBinding [ size + 1 ] ; System . arraycopy ( this . outerLocalVariables , 0 , synthLocals , 0 , newArgIndex ) ; synthLocals [ newArgIndex ] = synthLocal = new SyntheticArgumentBinding ( actualOuterLocalVariable ) ; System . arraycopy ( this . outerLocalVariables , newArgIndex , synthLocals , newArgIndex + 1 , size - newArgIndex ) ; this . outerLocalVariables = synthLocals ; } if ( this . scope . referenceCompilationUnit ( ) . isPropagatingInnerClassEmulation ) updateInnerEmulationDependents ( ) ; return synthLocal ; } public SyntheticArgumentBinding addSyntheticArgument ( ReferenceBinding targetEnclosingType ) { SyntheticArgumentBinding synthLocal = null ; if ( this . enclosingInstances == null ) { synthLocal = new SyntheticArgumentBinding ( targetEnclosingType ) ; this . enclosingInstances = new SyntheticArgumentBinding [ ] { synthLocal } ; } else { int size = this . enclosingInstances . length ; int newArgIndex = size ; for ( int i = size ; -- i >= 0 ; ) { if ( this . enclosingInstances [ i ] . type == targetEnclosingType ) return this . enclosingInstances [ i ] ; if ( enclosingType ( ) == targetEnclosingType ) newArgIndex = 0 ; } SyntheticArgumentBinding [ ] newInstances = new SyntheticArgumentBinding [ size + 1 ] ; System . arraycopy ( this . enclosingInstances , 0 , newInstances , newArgIndex == 0 ? 1 : 0 , size ) ; newInstances [ newArgIndex ] = synthLocal = new SyntheticArgumentBinding ( targetEnclosingType ) ; this . enclosingInstances = newInstances ; } if ( this . scope . referenceCompilationUnit ( ) . isPropagatingInnerClassEmulation ) updateInnerEmulationDependents ( ) ; return synthLocal ; } public SyntheticArgumentBinding addSyntheticArgumentAndField ( LocalVariableBinding actualOuterLocalVariable ) { SyntheticArgumentBinding synthLocal = addSyntheticArgument ( actualOuterLocalVariable ) ; if ( synthLocal == null ) return null ; if ( synthLocal . matchingField == null ) synthLocal . matchingField = addSyntheticFieldForInnerclass ( actualOuterLocalVariable ) ; return synthLocal ; } public SyntheticArgumentBinding addSyntheticArgumentAndField ( ReferenceBinding targetEnclosingType ) { SyntheticArgumentBinding synthLocal = addSyntheticArgument ( targetEnclosingType ) ; if ( synthLocal == null ) return null ; if ( synthLocal . matchingField == null ) synthLocal . matchingField = addSyntheticFieldForInnerclass ( targetEnclosingType ) ; return synthLocal ; } protected void checkRedundantNullnessDefaultRecurse ( ASTNode location , Annotation [ ] annotations , long annotationTagBits ) { ReferenceBinding currentType = this . enclosingType ; do { if ( ! ( ( SourceTypeBinding ) currentType ) . checkRedundantNullnessDefaultOne ( location , annotations , annotationTagBits ) ) { return ; } currentType = currentType . enclosingType ( ) ; } while ( currentType instanceof SourceTypeBinding ) ; super . checkRedundantNullnessDefaultRecurse ( location , annotations , annotationTagBits ) ; } public ReferenceBinding enclosingType ( ) { return this . enclosingType ; } public int getEnclosingInstancesSlotSize ( ) { return this . enclosingInstances == null ? 0 : this . enclosingInstances . length ; } public int getOuterLocalVariablesSlotSize ( ) { if ( this . outerLocalVariablesSlotSize < 0 ) { this . outerLocalVariablesSlotSize = 0 ; int outerLocalsCount = this . outerLocalVariables == null ? 0 : this . outerLocalVariables . length ; for ( int i = 0 ; i < outerLocalsCount ; i ++ ) { SyntheticArgumentBinding argument = this . outerLocalVariables [ i ] ; switch ( argument . type . id ) { case TypeIds . T_long : case TypeIds . T_double : this . outerLocalVariablesSlotSize += 2 ; break ; default : this . outerLocalVariablesSlotSize ++ ; break ; } } } return this . outerLocalVariablesSlotSize ; } public SyntheticArgumentBinding getSyntheticArgument ( LocalVariableBinding actualOuterLocalVariable ) { if ( this . outerLocalVariables == null ) return null ; for ( int i = this . outerLocalVariables . length ; -- i >= 0 ; ) if ( this . outerLocalVariables [ i ] . actualOuterLocalVariable == actualOuterLocalVariable ) return this . outerLocalVariables [ i ] ; return null ; } public SyntheticArgumentBinding getSyntheticArgument ( ReferenceBinding targetEnclosingType , boolean onlyExactMatch ) { if ( this . enclosingInstances == null ) return null ; for ( int i = this . enclosingInstances . length ; -- i >= 0 ; ) if ( this . enclosingInstances [ i ] . type == targetEnclosingType ) if ( this . enclosingInstances [ i ] . actualOuterLocalVariable == null ) return this . enclosingInstances [ i ] ; if ( ! onlyExactMatch ) { for ( int i = this . enclosingInstances . length ; -- i >= 0 ; ) if ( this . enclosingInstances [ i ] . actualOuterLocalVariable == null ) if ( this . enclosingInstances [ i ] . type . findSuperTypeOriginatingFrom ( targetEnclosingType ) != null ) return this . enclosingInstances [ i ] ; } return null ; } public SyntheticArgumentBinding [ ] syntheticEnclosingInstances ( ) { return this . enclosingInstances ; } public ReferenceBinding [ ] syntheticEnclosingInstanceTypes ( ) { if ( this . enclosingTypes == UNINITIALIZED_REFERENCE_TYPES ) { if ( this . enclosingInstances == null ) { this . enclosingTypes = null ; } else { int length = this . enclosingInstances . length ; this . enclosingTypes = new ReferenceBinding [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { this . enclosingTypes [ i ] = ( ReferenceBinding ) this . enclosingInstances [ i ] . type ; } } } return this . enclosingTypes ; } public SyntheticArgumentBinding [ ] syntheticOuterLocalVariables ( ) { return this . outerLocalVariables ; } public void updateInnerEmulationDependents ( ) { } } </s>