<s> package org . eclipse . jdt . internal . compiler . ast ; import org . eclipse . jdt . core . compiler . * ; import org . eclipse . jdt . internal . compiler . * ; import org . eclipse . jdt . internal . compiler . impl . * ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; 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 . Util ; public class TypeDeclaration extends Statement implements ProblemSeverities , ReferenceContext { public static final int CLASS_DECL = 1 ; public static final int INTERFACE_DECL = 2 ; public static final int ENUM_DECL = 3 ; public static final int ANNOTATION_TYPE_DECL = 4 ; public int modifiers = ClassFileConstants . AccDefault ; public int modifiersSourceStart ; public Annotation [ ] annotations ; public char [ ] name ; public TypeReference superclass ; public TypeReference [ ] superInterfaces ; public FieldDeclaration [ ] fields ; public AbstractMethodDeclaration [ ] methods ; public TypeDeclaration [ ] memberTypes ; public SourceTypeBinding binding ; public ClassScope scope ; public MethodScope initializerScope ; public MethodScope staticInitializerScope ; public boolean ignoreFurtherInvestigation = false ; public int maxFieldCount ; public int declarationSourceStart ; public int declarationSourceEnd ; public int bodyStart ; public int bodyEnd ; public CompilationResult compilationResult ; public MethodDeclaration [ ] missingAbstractMethods ; public Javadoc javadoc ; public QualifiedAllocationExpression allocation ; public TypeDeclaration enclosingType ; public FieldBinding enumValuesSyntheticfield ; public int enumConstantsCounter ; public TypeParameter [ ] typeParameters ; public TypeDeclaration ( CompilationResult compilationResult ) { this . compilationResult = compilationResult ; } public void abort ( int abortLevel , CategorizedProblem problem ) { switch ( abortLevel ) { case AbortCompilation : throw new AbortCompilation ( this . compilationResult , problem ) ; case AbortCompilationUnit : throw new AbortCompilationUnit ( this . compilationResult , problem ) ; case AbortMethod : throw new AbortMethod ( this . compilationResult , problem ) ; default : throw new AbortType ( this . compilationResult , problem ) ; } } public final void addClinit ( ) { if ( needClassInitMethod ( ) ) { int length ; AbstractMethodDeclaration [ ] methodDeclarations ; if ( ( methodDeclarations = this . methods ) == null ) { length = 0 ; methodDeclarations = new AbstractMethodDeclaration [ 1 ] ; } else { length = methodDeclarations . length ; System . arraycopy ( methodDeclarations , 0 , ( methodDeclarations = new AbstractMethodDeclaration [ length + 1 ] ) , 1 , length ) ; } Clinit clinit = new Clinit ( this . compilationResult ) ; methodDeclarations [ 0 ] = clinit ; clinit . declarationSourceStart = clinit . sourceStart = this . sourceStart ; clinit . declarationSourceEnd = clinit . sourceEnd = this . sourceEnd ; clinit . bodyEnd = this . sourceEnd ; this . methods = methodDeclarations ; } } public MethodDeclaration addMissingAbstractMethodFor ( MethodBinding methodBinding ) { TypeBinding [ ] argumentTypes = methodBinding . parameters ; int argumentsLength = argumentTypes . length ; MethodDeclaration methodDeclaration = new MethodDeclaration ( this . compilationResult ) ; methodDeclaration . selector = methodBinding . selector ; methodDeclaration . sourceStart = this . sourceStart ; methodDeclaration . sourceEnd = this . sourceEnd ; methodDeclaration . modifiers = methodBinding . getAccessFlags ( ) & ~ ClassFileConstants . AccAbstract ; if ( argumentsLength > 0 ) { String baseName = "arg" ; Argument [ ] arguments = ( methodDeclaration . arguments = new Argument [ argumentsLength ] ) ; for ( int i = argumentsLength ; -- i >= 0 ; ) { arguments [ i ] = new Argument ( ( baseName + i ) . toCharArray ( ) , 0L , null , ClassFileConstants . AccDefault ) ; } } if ( this . missingAbstractMethods == null ) { this . missingAbstractMethods = new MethodDeclaration [ ] { methodDeclaration } ; } else { MethodDeclaration [ ] newMethods ; System . arraycopy ( this . missingAbstractMethods , 0 , newMethods = new MethodDeclaration [ this . missingAbstractMethods . length + 1 ] , 1 , this . missingAbstractMethods . length ) ; newMethods [ 0 ] = methodDeclaration ; this . missingAbstractMethods = newMethods ; } methodDeclaration . binding = new MethodBinding ( methodDeclaration . modifiers | ClassFileConstants . AccSynthetic , methodBinding . selector , methodBinding . returnType , argumentsLength == 0 ? Binding . NO_PARAMETERS : argumentTypes , methodBinding . thrownExceptions , this . binding ) ; methodDeclaration . scope = new MethodScope ( this . scope , methodDeclaration , true ) ; methodDeclaration . bindArguments ( ) ; return methodDeclaration ; } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { if ( this . ignoreFurtherInvestigation ) return flowInfo ; try { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) == 0 ) { this . bits |= ASTNode . IsReachable ; LocalTypeBinding localType = ( LocalTypeBinding ) this . binding ; localType . setConstantPoolName ( currentScope . compilationUnitScope ( ) . computeConstantPoolName ( localType ) ) ; } manageEnclosingInstanceAccessIfNecessary ( currentScope , flowInfo ) ; updateMaxFieldCount ( ) ; internalAnalyseCode ( flowContext , flowInfo ) ; } catch ( AbortType e ) { this . ignoreFurtherInvestigation = true ; } return flowInfo ; } public void analyseCode ( ClassScope enclosingClassScope ) { if ( this . ignoreFurtherInvestigation ) return ; try { updateMaxFieldCount ( ) ; internalAnalyseCode ( null , FlowInfo . initial ( this . maxFieldCount ) ) ; } catch ( AbortType e ) { this . ignoreFurtherInvestigation = true ; } } public void analyseCode ( ClassScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { if ( this . ignoreFurtherInvestigation ) return ; try { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) == 0 ) { this . bits |= ASTNode . IsReachable ; LocalTypeBinding localType = ( LocalTypeBinding ) this . binding ; localType . setConstantPoolName ( currentScope . compilationUnitScope ( ) . computeConstantPoolName ( localType ) ) ; } manageEnclosingInstanceAccessIfNecessary ( currentScope , flowInfo ) ; updateMaxFieldCount ( ) ; internalAnalyseCode ( flowContext , flowInfo ) ; } catch ( AbortType e ) { this . ignoreFurtherInvestigation = true ; } } public void analyseCode ( CompilationUnitScope unitScope ) { if ( this . ignoreFurtherInvestigation ) return ; try { internalAnalyseCode ( null , FlowInfo . initial ( this . maxFieldCount ) ) ; } catch ( AbortType e ) { this . ignoreFurtherInvestigation = true ; } } public boolean checkConstructors ( Parser parser ) { boolean hasConstructor = false ; if ( this . methods != null ) { for ( int i = this . methods . length ; -- i >= 0 ; ) { AbstractMethodDeclaration am ; if ( ( am = this . methods [ i ] ) . isConstructor ( ) ) { if ( ! CharOperation . equals ( am . selector , this . name ) ) { ConstructorDeclaration c = ( ConstructorDeclaration ) am ; if ( c . constructorCall == null || c . constructorCall . isImplicitSuper ( ) ) { MethodDeclaration m = parser . convertToMethodDeclaration ( c , this . compilationResult ) ; this . methods [ i ] = m ; } } else { switch ( kind ( this . modifiers ) ) { case TypeDeclaration . INTERFACE_DECL : parser . problemReporter ( ) . interfaceCannotHaveConstructors ( ( ConstructorDeclaration ) am ) ; break ; case TypeDeclaration . ANNOTATION_TYPE_DECL : parser . problemReporter ( ) . annotationTypeDeclarationCannotHaveConstructor ( ( ConstructorDeclaration ) am ) ; break ; } hasConstructor = true ; } } } } return hasConstructor ; } public CompilationResult compilationResult ( ) { return this . compilationResult ; } public ConstructorDeclaration createDefaultConstructor ( boolean needExplicitConstructorCall , boolean needToInsert ) { ConstructorDeclaration constructor = new ConstructorDeclaration ( this . compilationResult ) ; constructor . bits |= ASTNode . IsDefaultConstructor ; constructor . selector = this . name ; constructor . modifiers = this . modifiers & ExtraCompilerModifiers . AccVisibilityMASK ; constructor . declarationSourceStart = constructor . sourceStart = this . sourceStart ; constructor . declarationSourceEnd = constructor . sourceEnd = constructor . bodyEnd = this . sourceEnd ; if ( needExplicitConstructorCall ) { constructor . constructorCall = SuperReference . implicitSuperConstructorCall ( ) ; constructor . constructorCall . sourceStart = this . sourceStart ; constructor . constructorCall . sourceEnd = this . sourceEnd ; } if ( needToInsert ) { if ( this . methods == null ) { this . methods = new AbstractMethodDeclaration [ ] { constructor } ; } else { AbstractMethodDeclaration [ ] newMethods ; System . arraycopy ( this . methods , 0 , newMethods = new AbstractMethodDeclaration [ this . methods . length + 1 ] , 1 , this . methods . length ) ; newMethods [ 0 ] = constructor ; this . methods = newMethods ; } } return constructor ; } public MethodBinding createDefaultConstructorWithBinding ( MethodBinding inheritedConstructorBinding , boolean eraseThrownExceptions ) { String baseName = "$anonymous" ; TypeBinding [ ] argumentTypes = inheritedConstructorBinding . parameters ; int argumentsLength = argumentTypes . length ; ConstructorDeclaration constructor = new ConstructorDeclaration ( this . compilationResult ) ; constructor . selector = new char [ ] { 'x' } ; constructor . sourceStart = this . sourceStart ; constructor . sourceEnd = this . sourceEnd ; int newModifiers = this . modifiers & ExtraCompilerModifiers . AccVisibilityMASK ; if ( inheritedConstructorBinding . isVarargs ( ) ) { newModifiers |= ClassFileConstants . AccVarargs ; } constructor . modifiers = newModifiers ; constructor . bits |= ASTNode . IsDefaultConstructor ; if ( argumentsLength > 0 ) { Argument [ ] arguments = ( constructor . arguments = new Argument [ argumentsLength ] ) ; for ( int i = argumentsLength ; -- i >= 0 ; ) { arguments [ i ] = new Argument ( ( baseName + i ) . toCharArray ( ) , 0L , null , ClassFileConstants . AccDefault ) ; } } constructor . constructorCall = SuperReference . implicitSuperConstructorCall ( ) ; constructor . constructorCall . sourceStart = this . sourceStart ; constructor . constructorCall . sourceEnd = this . sourceEnd ; if ( argumentsLength > 0 ) { Expression [ ] args ; args = constructor . constructorCall . arguments = new Expression [ argumentsLength ] ; for ( int i = argumentsLength ; -- i >= 0 ; ) { args [ i ] = new SingleNameReference ( ( baseName + i ) . toCharArray ( ) , 0L ) ; } } if ( this . methods == null ) { this . methods = new AbstractMethodDeclaration [ ] { constructor } ; } else { AbstractMethodDeclaration [ ] newMethods ; System . arraycopy ( this . methods , 0 , newMethods = new AbstractMethodDeclaration [ this . methods . length + 1 ] , 1 , this . methods . length ) ; newMethods [ 0 ] = constructor ; this . methods = newMethods ; } ReferenceBinding [ ] thrownExceptions = eraseThrownExceptions ? this . scope . environment ( ) . convertToRawTypes ( inheritedConstructorBinding . thrownExceptions , true , true ) : inheritedConstructorBinding . thrownExceptions ; SourceTypeBinding sourceType = this . binding ; constructor . binding = new MethodBinding ( constructor . modifiers , argumentsLength == 0 ? Binding . NO_PARAMETERS : argumentTypes , thrownExceptions , sourceType ) ; constructor . binding . tagBits |= ( inheritedConstructorBinding . tagBits & TagBits . HasMissingType ) ; constructor . binding . modifiers |= ExtraCompilerModifiers . AccIsDefaultConstructor ; constructor . scope = new MethodScope ( this . scope , constructor , true ) ; constructor . bindArguments ( ) ; constructor . constructorCall . resolve ( constructor . scope ) ; MethodBinding [ ] methodBindings = sourceType . methods ( ) ; int length ; System . arraycopy ( methodBindings , 0 , methodBindings = new MethodBinding [ ( length = methodBindings . length ) + 1 ] , 1 , length ) ; methodBindings [ 0 ] = constructor . binding ; if ( ++ length > 1 ) ReferenceBinding . sortMethods ( methodBindings , 0 , length ) ; sourceType . setMethods ( methodBindings ) ; return constructor . binding ; } public FieldDeclaration declarationOf ( FieldBinding fieldBinding ) { if ( fieldBinding != null && this . fields != null ) { for ( int i = 0 , max = this . fields . length ; i < max ; i ++ ) { FieldDeclaration fieldDecl ; if ( ( fieldDecl = this . fields [ i ] ) . binding == fieldBinding ) return fieldDecl ; } } return null ; } public TypeDeclaration declarationOf ( MemberTypeBinding memberTypeBinding ) { if ( memberTypeBinding != null && this . memberTypes != null ) { for ( int i = 0 , max = this . memberTypes . length ; i < max ; i ++ ) { TypeDeclaration memberTypeDecl ; if ( ( memberTypeDecl = this . memberTypes [ i ] ) . binding == memberTypeBinding ) return memberTypeDecl ; } } return null ; } public AbstractMethodDeclaration declarationOf ( MethodBinding methodBinding ) { if ( methodBinding != null && this . methods != null ) { for ( int i = 0 , max = this . methods . length ; i < max ; i ++ ) { AbstractMethodDeclaration methodDecl ; if ( ( methodDecl = this . methods [ i ] ) . binding == methodBinding ) return methodDecl ; } } return null ; } public TypeDeclaration declarationOfType ( char [ ] [ ] typeName ) { int typeNameLength = typeName . length ; if ( typeNameLength < 1 || ! CharOperation . equals ( typeName [ 0 ] , this . name ) ) { return null ; } if ( typeNameLength == 1 ) { return this ; } char [ ] [ ] subTypeName = new char [ typeNameLength - 1 ] [ ] ; System . arraycopy ( typeName , 1 , subTypeName , 0 , typeNameLength - 1 ) ; for ( int i = 0 ; i < this . memberTypes . length ; i ++ ) { TypeDeclaration typeDecl = this . memberTypes [ i ] . declarationOfType ( subTypeName ) ; if ( typeDecl != null ) { return typeDecl ; } } return null ; } public void generateCode ( ClassFile enclosingClassFile ) { if ( ( this . bits & ASTNode . HasBeenGenerated ) != 0 ) return ; this . bits |= ASTNode . HasBeenGenerated ; if ( this . ignoreFurtherInvestigation ) { if ( this . binding == null ) return ; ClassFile . createProblemType ( this , this . scope . referenceCompilationUnit ( ) . compilationResult ) ; return ; } try { ClassFile classFile = ClassFile . getNewInstance ( this . binding ) ; classFile . initialize ( this . binding , enclosingClassFile , false ) ; if ( this . binding . isMemberType ( ) ) { classFile . recordInnerClasses ( this . binding ) ; } else if ( this . binding . isLocalType ( ) ) { enclosingClassFile . recordInnerClasses ( this . binding ) ; classFile . recordInnerClasses ( this . binding ) ; } TypeVariableBinding [ ] typeVariables = this . binding . typeVariables ( ) ; for ( int i = 0 , max = typeVariables . length ; i < max ; i ++ ) { TypeVariableBinding typeVariableBinding = typeVariables [ i ] ; if ( ( typeVariableBinding . tagBits & TagBits . ContainsNestedTypeReferences ) != 0 ) { Util . recordNestedType ( classFile , typeVariableBinding ) ; } } classFile . addFieldInfos ( ) ; if ( this . memberTypes != null ) { for ( int i = 0 , max = this . memberTypes . length ; i < max ; i ++ ) { TypeDeclaration memberType = this . memberTypes [ i ] ; classFile . recordInnerClasses ( memberType . binding ) ; memberType . generateCode ( this . scope , classFile ) ; } } classFile . setForMethodInfos ( ) ; if ( this . methods != null ) { for ( int i = 0 , max = this . methods . length ; i < max ; i ++ ) { this . methods [ i ] . generateCode ( this . scope , classFile ) ; } } classFile . addSpecialMethods ( ) ; if ( this . ignoreFurtherInvestigation ) { throw new AbortType ( this . scope . referenceCompilationUnit ( ) . compilationResult , null ) ; } classFile . addAttributes ( ) ; this . scope . referenceCompilationUnit ( ) . compilationResult . record ( this . binding . constantPoolName ( ) , classFile ) ; } catch ( AbortType e ) { if ( this . binding == null ) return ; ClassFile . createProblemType ( this , this . scope . referenceCompilationUnit ( ) . compilationResult ) ; } } public void generateCode ( BlockScope blockScope , CodeStream codeStream ) { if ( ( this . bits & ASTNode . IsReachable ) == 0 ) { return ; } if ( ( this . bits & ASTNode . HasBeenGenerated ) != 0 ) return ; int pc = codeStream . position ; if ( this . binding != null ) { SyntheticArgumentBinding [ ] enclosingInstances = ( ( NestedTypeBinding ) this . binding ) . syntheticEnclosingInstances ( ) ; for ( int i = 0 , slotSize = 0 , count = enclosingInstances == null ? 0 : enclosingInstances . length ; i < count ; i ++ ) { SyntheticArgumentBinding enclosingInstance = enclosingInstances [ i ] ; enclosingInstance . resolvedPosition = ++ slotSize ; if ( slotSize > 0xFF ) { blockScope . problemReporter ( ) . noMoreAvailableSpaceForArgument ( enclosingInstance , blockScope . referenceType ( ) ) ; } } } generateCode ( codeStream . classFile ) ; codeStream . recordPositionsFrom ( pc , this . sourceStart ) ; } public void generateCode ( ClassScope classScope , ClassFile enclosingClassFile ) { if ( ( this . bits & ASTNode . HasBeenGenerated ) != 0 ) return ; if ( this . binding != null ) { SyntheticArgumentBinding [ ] enclosingInstances = ( ( NestedTypeBinding ) this . binding ) . syntheticEnclosingInstances ( ) ; for ( int i = 0 , slotSize = 0 , count = enclosingInstances == null ? 0 : enclosingInstances . length ; i < count ; i ++ ) { SyntheticArgumentBinding enclosingInstance = enclosingInstances [ i ] ; enclosingInstance . resolvedPosition = ++ slotSize ; if ( slotSize > 0xFF ) { classScope . problemReporter ( ) . noMoreAvailableSpaceForArgument ( enclosingInstance , classScope . referenceType ( ) ) ; } } } generateCode ( enclosingClassFile ) ; } public void generateCode ( CompilationUnitScope unitScope ) { generateCode ( ( ClassFile ) null ) ; } public boolean hasErrors ( ) { return this . ignoreFurtherInvestigation ; } private void internalAnalyseCode ( FlowContext flowContext , FlowInfo flowInfo ) { if ( ! this . binding . isUsed ( ) && this . binding . isOrEnclosedByPrivateType ( ) ) { if ( ! this . scope . referenceCompilationUnit ( ) . compilationResult . hasSyntaxError ) { this . scope . problemReporter ( ) . unusedPrivateType ( this ) ; } } InitializationFlowContext initializerContext = new InitializationFlowContext ( null , this , flowInfo , flowContext , this . initializerScope ) ; InitializationFlowContext staticInitializerContext = new InitializationFlowContext ( null , this , flowInfo , flowContext , this . staticInitializerScope ) ; FlowInfo nonStaticFieldInfo = flowInfo . unconditionalFieldLessCopy ( ) ; FlowInfo staticFieldInfo = flowInfo . unconditionalFieldLessCopy ( ) ; if ( this . fields != null ) { for ( int i = 0 , count = this . fields . length ; i < count ; i ++ ) { FieldDeclaration field = this . fields [ i ] ; if ( field . isStatic ( ) ) { if ( ( staticFieldInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) != 0 ) field . bits &= ~ ASTNode . IsReachable ; staticInitializerContext . handledExceptions = Binding . ANY_EXCEPTION ; staticFieldInfo = field . analyseCode ( this . staticInitializerScope , staticInitializerContext , staticFieldInfo ) ; if ( staticFieldInfo == FlowInfo . DEAD_END ) { this . staticInitializerScope . problemReporter ( ) . initializerMustCompleteNormally ( field ) ; staticFieldInfo = FlowInfo . initial ( this . maxFieldCount ) . setReachMode ( FlowInfo . UNREACHABLE_OR_DEAD ) ; } } else { if ( ( nonStaticFieldInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) != 0 ) field . bits &= ~ ASTNode . IsReachable ; initializerContext . handledExceptions = Binding . ANY_EXCEPTION ; nonStaticFieldInfo = field . analyseCode ( this . initializerScope , initializerContext , nonStaticFieldInfo ) ; if ( nonStaticFieldInfo == FlowInfo . DEAD_END ) { this . initializerScope . problemReporter ( ) . initializerMustCompleteNormally ( field ) ; nonStaticFieldInfo = FlowInfo . initial ( this . maxFieldCount ) . setReachMode ( FlowInfo . UNREACHABLE_OR_DEAD ) ; } } } } if ( this . memberTypes != null ) { for ( int i = 0 , count = this . memberTypes . length ; i < count ; i ++ ) { if ( flowContext != null ) { this . memberTypes [ i ] . analyseCode ( this . scope , flowContext , nonStaticFieldInfo . copy ( ) . setReachMode ( flowInfo . reachMode ( ) ) ) ; } else { this . memberTypes [ i ] . analyseCode ( this . scope ) ; } } } if ( this . methods != null ) { UnconditionalFlowInfo outerInfo = flowInfo . unconditionalFieldLessCopy ( ) ; FlowInfo constructorInfo = nonStaticFieldInfo . unconditionalInits ( ) . discardNonFieldInitializations ( ) . addInitializationsFrom ( outerInfo ) ; for ( int i = 0 , count = this . methods . length ; i < count ; i ++ ) { AbstractMethodDeclaration method = this . methods [ i ] ; if ( method . ignoreFurtherInvestigation ) continue ; if ( method . isInitializationMethod ( ) ) { if ( method . isStatic ( ) ) { method . analyseCode ( this . scope , staticInitializerContext , staticFieldInfo . unconditionalInits ( ) . discardNonFieldInitializations ( ) . addInitializationsFrom ( outerInfo ) ) ; } else { ( ( ConstructorDeclaration ) method ) . analyseCode ( this . scope , initializerContext , constructorInfo . copy ( ) , flowInfo . reachMode ( ) ) ; } } else { method . analyseCode ( this . scope , null , flowInfo . copy ( ) ) ; } } } if ( this . binding . isEnum ( ) && ! this . binding . isAnonymousType ( ) ) { this . enumValuesSyntheticfield = this . binding . addSyntheticFieldForEnumValues ( ) ; } } public final static int kind ( int flags ) { switch ( flags & ( ClassFileConstants . AccInterface | ClassFileConstants . AccAnnotation | ClassFileConstants . AccEnum ) ) { case ClassFileConstants . AccInterface : return TypeDeclaration . INTERFACE_DECL ; case ClassFileConstants . AccInterface | ClassFileConstants . AccAnnotation : return TypeDeclaration . ANNOTATION_TYPE_DECL ; case ClassFileConstants . AccEnum : return TypeDeclaration . ENUM_DECL ; default : return TypeDeclaration . CLASS_DECL ; } } public void manageEnclosingInstanceAccessIfNecessary ( BlockScope currentScope , FlowInfo flowInfo ) { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) != 0 ) return ; NestedTypeBinding nestedType = ( NestedTypeBinding ) this . binding ; MethodScope methodScope = currentScope . methodScope ( ) ; if ( ! methodScope . isStatic && ! methodScope . isConstructorCall ) { nestedType . addSyntheticArgumentAndField ( nestedType . enclosingType ( ) ) ; } if ( nestedType . isAnonymousType ( ) ) { ReferenceBinding superclassBinding = ( ReferenceBinding ) nestedType . superclass . erasure ( ) ; if ( superclassBinding . enclosingType ( ) != null && ! superclassBinding . isStatic ( ) ) { if ( ! superclassBinding . isLocalType ( ) || ( ( NestedTypeBinding ) superclassBinding ) . getSyntheticField ( superclassBinding . enclosingType ( ) , true ) != null ) { nestedType . addSyntheticArgument ( superclassBinding . enclosingType ( ) ) ; } } if ( ! methodScope . isStatic && methodScope . isConstructorCall && currentScope . compilerOptions ( ) . complianceLevel >= ClassFileConstants . JDK1_5 ) { ReferenceBinding enclosing = nestedType . enclosingType ( ) ; if ( enclosing . isNestedType ( ) ) { NestedTypeBinding nestedEnclosing = ( NestedTypeBinding ) enclosing ; SyntheticArgumentBinding syntheticEnclosingInstanceArgument = nestedEnclosing . getSyntheticArgument ( nestedEnclosing . enclosingType ( ) , true ) ; if ( syntheticEnclosingInstanceArgument != null ) { nestedType . addSyntheticArgumentAndField ( syntheticEnclosingInstanceArgument ) ; } } } } } public void manageEnclosingInstanceAccessIfNecessary ( ClassScope currentScope , FlowInfo flowInfo ) { if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE_OR_DEAD ) == 0 ) { NestedTypeBinding nestedType = ( NestedTypeBinding ) this . binding ; nestedType . addSyntheticArgumentAndField ( this . binding . enclosingType ( ) ) ; } } public final boolean needClassInitMethod ( ) { if ( ( this . bits & ASTNode . ContainsAssertion ) != 0 ) return true ; switch ( kind ( this . modifiers ) ) { case TypeDeclaration . INTERFACE_DECL : case TypeDeclaration . ANNOTATION_TYPE_DECL : return this . fields != null ; case TypeDeclaration . ENUM_DECL : return true ; } if ( this . fields != null ) { for ( int i = this . fields . length ; -- i >= 0 ; ) { FieldDeclaration field = this . fields [ i ] ; if ( ( field . modifiers & ClassFileConstants . AccStatic ) != 0 ) return true ; } } return false ; } public void parseMethods ( Parser parser , CompilationUnitDeclaration unit ) { if ( unit . ignoreMethodBodies ) return ; if ( this . memberTypes != null ) { int length = this . memberTypes . length ; for ( int i = 0 ; i < length ; i ++ ) { TypeDeclaration typeDeclaration = this . memberTypes [ i ] ; typeDeclaration . parseMethods ( parser , unit ) ; this . bits |= ( typeDeclaration . bits & ASTNode . HasSyntaxErrors ) ; } } if ( this . methods != null ) { int length = this . methods . length ; for ( int i = 0 ; i < length ; i ++ ) { AbstractMethodDeclaration abstractMethodDeclaration = this . methods [ i ] ; abstractMethodDeclaration . parseStatements ( parser , unit ) ; this . bits |= ( abstractMethodDeclaration . bits & ASTNode . HasSyntaxErrors ) ; } } if ( this . fields != null ) { int length = this . fields . length ; for ( int i = 0 ; i < length ; i ++ ) { final FieldDeclaration fieldDeclaration = this . fields [ i ] ; switch ( fieldDeclaration . getKind ( ) ) { case AbstractVariableDeclaration . INITIALIZER : ( ( Initializer ) fieldDeclaration ) . parseStatements ( parser , this , unit ) ; this . bits |= ( fieldDeclaration . bits & ASTNode . HasSyntaxErrors ) ; break ; } } } } public StringBuffer print ( int indent , StringBuffer output ) { if ( this . javadoc != null ) { this . javadoc . print ( indent , output ) ; } if ( ( this . bits & ASTNode . IsAnonymousType ) == 0 ) { printIndent ( indent , output ) ; printHeader ( 0 , output ) ; } return printBody ( indent , output ) ; } public StringBuffer printBody ( int indent , StringBuffer output ) { output . append ( " {" ) ; if ( this . memberTypes != null ) { for ( int i = 0 ; i < this . memberTypes . length ; i ++ ) { if ( this . memberTypes [ i ] != null ) { output . append ( '\n' ) ; this . memberTypes [ i ] . print ( indent + 1 , output ) ; } } } if ( this . fields != null ) { for ( int fieldI = 0 ; fieldI < this . fields . length ; fieldI ++ ) { if ( this . fields [ fieldI ] != null ) { output . append ( '\n' ) ; this . fields [ fieldI ] . print ( indent + 1 , output ) ; } } } if ( this . methods != null ) { for ( int i = 0 ; i < this . methods . length ; i ++ ) { if ( this . methods [ i ] != null ) { output . append ( '\n' ) ; this . methods [ i ] . print ( indent + 1 , output ) ; } } } output . append ( '\n' ) ; return printIndent ( indent , output ) . append ( '}' ) ; } public StringBuffer printHeader ( int indent , StringBuffer output ) { printModifiers ( this . modifiers , output ) ; if ( this . annotations != null ) printAnnotations ( this . annotations , output ) ; switch ( kind ( this . modifiers ) ) { case TypeDeclaration . CLASS_DECL : output . append ( "class " ) ; break ; case TypeDeclaration . INTERFACE_DECL : output . append ( "interface " ) ; break ; case TypeDeclaration . ENUM_DECL : output . append ( "enum " ) ; break ; case TypeDeclaration . ANNOTATION_TYPE_DECL : output . append ( "@interface " ) ; break ; } output . append ( this . name ) ; if ( this . typeParameters != null ) { output . append ( "<" ) ; for ( int i = 0 ; i < this . typeParameters . length ; i ++ ) { if ( i > 0 ) output . append ( ", " ) ; this . typeParameters [ i ] . print ( 0 , output ) ; } output . append ( ">" ) ; } if ( this . superclass != null ) { output . append ( " extends " ) ; this . superclass . print ( 0 , output ) ; } if ( this . superInterfaces != null && this . superInterfaces . length > 0 ) { switch ( kind ( this . modifiers ) ) { case TypeDeclaration . CLASS_DECL : case TypeDeclaration . ENUM_DECL : output . append ( " implements " ) ; break ; case TypeDeclaration . INTERFACE_DECL : case TypeDeclaration . ANNOTATION_TYPE_DECL : output . append ( " extends " ) ; break ; } for ( int i = 0 ; i < this . superInterfaces . length ; i ++ ) { if ( i > 0 ) output . append ( ", " ) ; this . superInterfaces [ i ] . print ( 0 , output ) ; } } return output ; } public StringBuffer printStatement ( int tab , StringBuffer output ) { return print ( tab , output ) ; } public void resolve ( ) { SourceTypeBinding sourceType = this . binding ; if ( sourceType == null ) { this . ignoreFurtherInvestigation = true ; return ; } try { boolean old = this . staticInitializerScope . insideTypeAnnotation ; try { this . staticInitializerScope . insideTypeAnnotation = true ; resolveAnnotations ( this . staticInitializerScope , this . annotations , sourceType ) ; } finally { this . staticInitializerScope . insideTypeAnnotation = old ; } if ( ( sourceType . getAnnotationTagBits ( ) & TagBits . AnnotationDeprecated ) == 0 && ( sourceType . modifiers & ClassFileConstants . AccDeprecated ) != 0 && this . scope . compilerOptions ( ) . sourceLevel >= ClassFileConstants . JDK1_5 ) { this . scope . problemReporter ( ) . missingDeprecatedAnnotationForType ( this ) ; } if ( ( this . bits & ASTNode . UndocumentedEmptyBlock ) != 0 ) { this . scope . problemReporter ( ) . undocumentedEmptyBlock ( this . bodyStart - 1 , this . bodyEnd ) ; } boolean needSerialVersion = this . scope . compilerOptions ( ) . getSeverity ( CompilerOptions . MissingSerialVersion ) != ProblemSeverities . Ignore && sourceType . isClass ( ) && sourceType . findSuperTypeOriginatingFrom ( TypeIds . T_JavaIoExternalizable , false ) == null && sourceType . findSuperTypeOriginatingFrom ( TypeIds . T_JavaIoSerializable , false ) != null ; if ( needSerialVersion ) { CompilationUnitScope compilationUnitScope = this . scope . compilationUnitScope ( ) ; MethodBinding methodBinding = sourceType . getExactMethod ( TypeConstants . WRITEREPLACE , Binding . NO_TYPES , compilationUnitScope ) ; ReferenceBinding [ ] throwsExceptions ; needSerialVersion = methodBinding == null || ! methodBinding . isValidBinding ( ) || methodBinding . returnType . id != TypeIds . T_JavaLangObject || ( throwsExceptions = methodBinding . thrownExceptions ) . length != 1 || throwsExceptions [ 0 ] . id != TypeIds . T_JavaIoObjectStreamException ; if ( needSerialVersion ) { boolean hasWriteObjectMethod = false ; boolean hasReadObjectMethod = false ; TypeBinding argumentTypeBinding = this . scope . getType ( TypeConstants . JAVA_IO_OBJECTOUTPUTSTREAM , 3 ) ; if ( argumentTypeBinding . isValidBinding ( ) ) { methodBinding = sourceType . getExactMethod ( TypeConstants . WRITEOBJECT , new TypeBinding [ ] { argumentTypeBinding } , compilationUnitScope ) ; hasWriteObjectMethod = methodBinding != null && methodBinding . isValidBinding ( ) && methodBinding . modifiers == ClassFileConstants . AccPrivate && methodBinding . returnType == TypeBinding . VOID && ( throwsExceptions = methodBinding . thrownExceptions ) . length == 1 && throwsExceptions [ 0 ] . id == TypeIds . T_JavaIoException ; } argumentTypeBinding = this . scope . getType ( TypeConstants . JAVA_IO_OBJECTINPUTSTREAM , 3 ) ; if ( argumentTypeBinding . isValidBinding ( ) ) { methodBinding = sourceType . getExactMethod ( TypeConstants . READOBJECT , new TypeBinding [ ] { argumentTypeBinding } , compilationUnitScope ) ; hasReadObjectMethod = methodBinding != null && methodBinding . isValidBinding ( ) && methodBinding . modifiers == ClassFileConstants . AccPrivate && methodBinding . returnType == TypeBinding . VOID && ( throwsExceptions = methodBinding . thrownExceptions ) . length == 1 && throwsExceptions [ 0 ] . id == TypeIds . T_JavaIoException ; } needSerialVersion = ! hasWriteObjectMethod || ! hasReadObjectMethod ; } } if ( sourceType . findSuperTypeOriginatingFrom ( TypeIds . T_JavaLangThrowable , true ) != null ) { ReferenceBinding current = sourceType ; checkEnclosedInGeneric : do { if ( current . isGenericType ( ) ) { this . scope . problemReporter ( ) . genericTypeCannotExtendThrowable ( this ) ; break checkEnclosedInGeneric ; } if ( current . isStatic ( ) ) break checkEnclosedInGeneric ; if ( current . isLocalType ( ) ) { NestedTypeBinding nestedType = ( NestedTypeBinding ) current . erasure ( ) ; if ( nestedType . scope . methodScope ( ) . isStatic ) break checkEnclosedInGeneric ; } } while ( ( current = current . enclosingType ( ) ) != null ) ; } int localMaxFieldCount = 0 ; int lastVisibleFieldID = - 1 ; boolean hasEnumConstants = false ; FieldDeclaration [ ] enumConstantsWithoutBody = null ; if ( this . typeParameters != null ) { for ( int i = 0 , count = this . typeParameters . length ; i < count ; i ++ ) { this . typeParameters [ i ] . resolve ( this . scope ) ; } } if ( this . memberTypes != null ) { for ( int i = 0 , count = this . memberTypes . length ; i < count ; i ++ ) { this . memberTypes [ i ] . resolve ( this . scope ) ; } } if ( this . fields != null ) { for ( int i = 0 , count = this . fields . length ; i < count ; i ++ ) { FieldDeclaration field = this . fields [ i ] ; switch ( field . getKind ( ) ) { case AbstractVariableDeclaration . ENUM_CONSTANT : hasEnumConstants = true ; if ( ! ( field . initialization instanceof QualifiedAllocationExpression ) ) { if ( enumConstantsWithoutBody == null ) enumConstantsWithoutBody = new FieldDeclaration [ count ] ; enumConstantsWithoutBody [ i ] = field ; } case AbstractVariableDeclaration . FIELD : FieldBinding fieldBinding = field . binding ; if ( fieldBinding == null ) { if ( field . initialization != null ) field . initialization . resolve ( field . isStatic ( ) ? this . staticInitializerScope : this . initializerScope ) ; this . ignoreFurtherInvestigation = true ; continue ; } if ( needSerialVersion && ( ( fieldBinding . modifiers & ( ClassFileConstants . AccStatic | ClassFileConstants . AccFinal ) ) == ( ClassFileConstants . AccStatic | ClassFileConstants . AccFinal ) ) && CharOperation . equals ( TypeConstants . SERIALVERSIONUID , fieldBinding . name ) && TypeBinding . LONG == fieldBinding . type ) { needSerialVersion = false ; } localMaxFieldCount ++ ; lastVisibleFieldID = field . binding . id ; break ; case AbstractVariableDeclaration . INITIALIZER : ( ( Initializer ) field ) . lastVisibleFieldID = lastVisibleFieldID + 1 ; break ; } field . resolve ( field . isStatic ( ) ? this . staticInitializerScope : this . initializerScope ) ; } } if ( this . maxFieldCount < localMaxFieldCount ) { this . maxFieldCount = localMaxFieldCount ; } if ( needSerialVersion ) { TypeBinding javaxRmiCorbaStub = this . scope . getType ( TypeConstants . JAVAX_RMI_CORBA_STUB , 4 ) ; if ( javaxRmiCorbaStub . isValidBinding ( ) ) { ReferenceBinding superclassBinding = this . binding . superclass ; loop : while ( superclassBinding != null ) { if ( superclassBinding == javaxRmiCorbaStub ) { needSerialVersion = false ; break loop ; } superclassBinding = superclassBinding . superclass ( ) ; } } if ( needSerialVersion ) { this . scope . problemReporter ( ) . missingSerialVersion ( this ) ; } } switch ( kind ( this . modifiers ) ) { case TypeDeclaration . ANNOTATION_TYPE_DECL : if ( this . superclass != null ) { this . scope . problemReporter ( ) . annotationTypeDeclarationCannotHaveSuperclass ( this ) ; } if ( this . superInterfaces != null ) { this . scope . problemReporter ( ) . annotationTypeDeclarationCannotHaveSuperinterfaces ( this ) ; } break ; case TypeDeclaration . ENUM_DECL : if ( this . binding . isAbstract ( ) ) { if ( ! hasEnumConstants ) { for ( int i = 0 , count = this . methods . length ; i < count ; i ++ ) { final AbstractMethodDeclaration methodDeclaration = this . methods [ i ] ; if ( methodDeclaration . isAbstract ( ) && methodDeclaration . binding != null ) this . scope . problemReporter ( ) . enumAbstractMethodMustBeImplemented ( methodDeclaration ) ; } } else if ( enumConstantsWithoutBody != null ) { for ( int i = 0 , count = this . methods . length ; i < count ; i ++ ) { final AbstractMethodDeclaration methodDeclaration = this . methods [ i ] ; if ( methodDeclaration . isAbstract ( ) && methodDeclaration . binding != null ) { for ( int f = 0 , l = enumConstantsWithoutBody . length ; f < l ; f ++ ) if ( enumConstantsWithoutBody [ f ] != null ) this . scope . problemReporter ( ) . enumConstantMustImplementAbstractMethod ( methodDeclaration , enumConstantsWithoutBody [ f ] ) ; } } } } break ; } int missingAbstractMethodslength = this . missingAbstractMethods == null ? 0 : this . missingAbstractMethods . length ; int methodsLength = this . methods == null ? 0 : this . methods . length ; if ( ( methodsLength + missingAbstractMethodslength ) > 0xFFFF ) { this . scope . problemReporter ( ) . tooManyMethods ( this ) ; } if ( this . methods != null ) { for ( int i = 0 , count = this . methods . length ; i < count ; i ++ ) { this . methods [ i ] . resolve ( this . scope ) ; } } if ( this . javadoc != null ) { if ( this . scope != null && ( this . name != TypeConstants . PACKAGE_INFO_NAME ) ) { this . javadoc . resolve ( this . scope ) ; } } else if ( ! sourceType . isLocalType ( ) ) { int visibility = sourceType . modifiers & ExtraCompilerModifiers . AccVisibilityMASK ; ProblemReporter reporter = this . scope . problemReporter ( ) ; int severity = reporter . computeSeverity ( IProblem . JavadocMissing ) ; if ( severity != ProblemSeverities . Ignore ) { if ( this . enclosingType != null ) { visibility = Util . computeOuterMostVisibility ( this . enclosingType , visibility ) ; } int javadocModifiers = ( this . binding . modifiers & ~ ExtraCompilerModifiers . AccVisibilityMASK ) | visibility ; reporter . javadocMissing ( this . sourceStart , this . sourceEnd , severity , javadocModifiers ) ; } } } catch ( AbortType e ) { this . ignoreFurtherInvestigation = true ; return ; } } public void resolve ( BlockScope blockScope ) { if ( ( this . bits & ASTNode . IsAnonymousType ) == 0 ) { Binding existing = blockScope . getType ( this . name ) ; if ( existing instanceof ReferenceBinding && existing != this . binding && existing . isValidBinding ( ) ) { ReferenceBinding existingType = ( ReferenceBinding ) existing ; if ( existingType instanceof TypeVariableBinding ) { blockScope . problemReporter ( ) . typeHiding ( this , ( TypeVariableBinding ) existingType ) ; Scope outerScope = blockScope . parent ; checkOuterScope : while ( outerScope != null ) { Binding existing2 = outerScope . getType ( this . name ) ; if ( existing2 instanceof TypeVariableBinding && existing2 . isValidBinding ( ) ) { TypeVariableBinding tvb = ( TypeVariableBinding ) existingType ; Binding declaringElement = tvb . declaringElement ; if ( declaringElement instanceof ReferenceBinding && CharOperation . equals ( ( ( ReferenceBinding ) declaringElement ) . sourceName ( ) , this . name ) ) { blockScope . problemReporter ( ) . typeCollidesWithEnclosingType ( this ) ; break checkOuterScope ; } } else if ( existing2 instanceof ReferenceBinding && existing2 . isValidBinding ( ) && outerScope . isDefinedInType ( ( ReferenceBinding ) existing2 ) ) { blockScope . problemReporter ( ) . typeCollidesWithEnclosingType ( this ) ; break checkOuterScope ; } else if ( existing2 == null ) { break checkOuterScope ; } outerScope = outerScope . parent ; } } else if ( existingType instanceof LocalTypeBinding && ( ( LocalTypeBinding ) existingType ) . scope . methodScope ( ) == blockScope . methodScope ( ) ) { blockScope . problemReporter ( ) . duplicateNestedType ( this ) ; } else if ( blockScope . isDefinedInType ( existingType ) ) { blockScope . problemReporter ( ) . typeCollidesWithEnclosingType ( this ) ; } else if ( blockScope . isDefinedInSameUnit ( existingType ) ) { blockScope . problemReporter ( ) . typeHiding ( this , existingType ) ; } } blockScope . addLocalType ( this ) ; } if ( this . binding != null ) { blockScope . referenceCompilationUnit ( ) . record ( ( LocalTypeBinding ) this . binding ) ; resolve ( ) ; updateMaxFieldCount ( ) ; } } public void resolve ( ClassScope upperScope ) { if ( this . binding != null && this . binding instanceof LocalTypeBinding ) { upperScope . referenceCompilationUnit ( ) . record ( ( LocalTypeBinding ) this . binding ) ; } resolve ( ) ; updateMaxFieldCount ( ) ; } public void resolve ( CompilationUnitScope upperScope ) { resolve ( ) ; updateMaxFieldCount ( ) ; } public void tagAsHavingErrors ( ) { this . ignoreFurtherInvestigation = true ; } public void traverse ( ASTVisitor visitor , CompilationUnitScope unitScope ) { try { if ( visitor . visit ( this , unitScope ) ) { if ( this . javadoc != null ) { this . javadoc . traverse ( visitor , this . scope ) ; } if ( this . annotations != null ) { int annotationsLength = this . annotations . length ; for ( int i = 0 ; i < annotationsLength ; i ++ ) this . annotations [ i ] . traverse ( visitor , this . staticInitializerScope ) ; } if ( this . superclass != null ) this . superclass . traverse ( visitor , this . scope ) ; if ( this . superInterfaces != null ) { int length = this . superInterfaces . length ; for ( int i = 0 ; i < length ; i ++ ) this . superInterfaces [ i ] . traverse ( visitor , this . scope ) ; } if ( this . typeParameters != null ) { int length = this . typeParameters . length ; for ( int i = 0 ; i < length ; i ++ ) { this . typeParameters [ i ] . traverse ( visitor , this . scope ) ; } } if ( this . memberTypes != null ) { int length = this . memberTypes . length ; for ( int i = 0 ; i < length ; i ++ ) this . memberTypes [ i ] . traverse ( visitor , this . scope ) ; } if ( this . fields != null ) { int length = this . fields . length ; for ( int i = 0 ; i < length ; i ++ ) { FieldDeclaration field ; if ( ( field = this . fields [ i ] ) . isStatic ( ) ) { field . traverse ( visitor , this . staticInitializerScope ) ; } else { field . traverse ( visitor , this . initializerScope ) ; } } } if ( this . methods != null ) { int length = this . methods . length ; for ( int i = 0 ; i < length ; i ++ ) this . methods [ i ] . traverse ( visitor , this . scope ) ; } } visitor . endVisit ( this , unitScope ) ; } catch ( AbortType e ) { } } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { try { if ( visitor . visit ( this , blockScope ) ) { if ( this . javadoc != null ) { this . javadoc . traverse ( visitor , this . scope ) ; } if ( this . annotations != null ) { int annotationsLength = this . annotations . length ; for ( int i = 0 ; i < annotationsLength ; i ++ ) this . annotations [ i ] . traverse ( visitor , this . staticInitializerScope ) ; } if ( this . superclass != null ) this . superclass . traverse ( visitor , this . scope ) ; if ( this . superInterfaces != null ) { int length = this . superInterfaces . length ; for ( int i = 0 ; i < length ; i ++ ) this . superInterfaces [ i ] . traverse ( visitor , this . scope ) ; } if ( this . typeParameters != null ) { int length = this . typeParameters . length ; for ( int i = 0 ; i < length ; i ++ ) { this . typeParameters [ i ] . traverse ( visitor , this . scope ) ; } } if ( this . memberTypes != null ) { int length = this . memberTypes . length ; for ( int i = 0 ; i < length ; i ++ ) this . memberTypes [ i ] . traverse ( visitor , this . scope ) ; } if ( this . fields != null ) { int length = this . fields . length ; for ( int i = 0 ; i < length ; i ++ ) { FieldDeclaration field ; if ( ( field = this . fields [ i ] ) . isStatic ( ) ) { } else { field . traverse ( visitor , this . initializerScope ) ; } } } if ( this . methods != null ) { int length = this . methods . length ; for ( int i = 0 ; i < length ; i ++ ) this . methods [ i ] . traverse ( visitor , this . scope ) ; } } visitor . endVisit ( this , blockScope ) ; } catch ( AbortType e ) { } } public void traverse ( ASTVisitor visitor , ClassScope classScope ) { try { if ( visitor . visit ( this , classScope ) ) { if ( this . javadoc != null ) { this . javadoc . traverse ( visitor , this . scope ) ; } if ( this . annotations != null ) { int annotationsLength = this . annotations . length ; for ( int i = 0 ; i < annotationsLength ; i ++ ) this . annotations [ i ] . traverse ( visitor , this . staticInitializerScope ) ; } if ( this . superclass != null ) this . superclass . traverse ( visitor , this . scope ) ; if ( this . superInterfaces != null ) { int length = this . superInterfaces . length ; for ( int i = 0 ; i < length ; i ++ ) this . superInterfaces [ i ] . traverse ( visitor , this . scope ) ; } if ( this . typeParameters != null ) { int length = this . typeParameters . length ; for ( int i = 0 ; i < length ; i ++ ) { this . typeParameters [ i ] . traverse ( visitor , this . scope ) ; } } if ( this . memberTypes != null ) { int length = this . memberTypes . length ; for ( int i = 0 ; i < length ; i ++ ) this . memberTypes [ i ] . traverse ( visitor , this . scope ) ; } if ( this . fields != null ) { int length = this . fields . length ; for ( int i = 0 ; i < length ; i ++ ) { FieldDeclaration field ; if ( ( field = this . fields [ i ] ) . isStatic ( ) ) { field . traverse ( visitor , this . staticInitializerScope ) ; } else { field . traverse ( visitor , this . initializerScope ) ; } } } if ( this . methods != null ) { int length = this . methods . length ; for ( int i = 0 ; i < length ; i ++ ) this . methods [ i ] . traverse ( visitor , this . scope ) ; } } visitor . endVisit ( this , classScope ) ; } catch ( AbortType e ) { } } void updateMaxFieldCount ( ) { if ( this . binding == null ) return ; TypeDeclaration outerMostType = this . scope . outerMostClassScope ( ) . referenceType ( ) ; if ( this . maxFieldCount > outerMostType . maxFieldCount ) { outerMostType . maxFieldCount = this . maxFieldCount ; } else { this . maxFieldCount = outerMostType . maxFieldCount ; } } public boolean isSecondary ( ) { return ( this . bits & ASTNode . IsSecondaryType ) != 0 ; } public boolean isScannerUsableOnThisDeclaration ( ) { return true ; } } </s>