text
stringlengths
30
1.67M
<s> package org . eclipse . jdt . internal . core . search . matching ; import java . io . IOException ; import org . eclipse . jdt . core . search . SearchPattern ; import org . eclipse . jdt . internal . core . index . EntryResult ; import org . eclipse . jdt . internal . core . index . Index ; import org . eclipse . jdt . internal . core . search . indexing . IIndexConstants ; public class SecondaryTypeDeclarationPattern extends TypeDeclarationPattern { private final static char [ ] SECONDARY_PATTERN_KEY = "<STR_LIT>" . toCharArray ( ) ; public SecondaryTypeDeclarationPattern ( ) { super ( null , null , null , IIndexConstants . SECONDARY_SUFFIX , R_EXACT_MATCH | R_CASE_SENSITIVE ) ; } public SecondaryTypeDeclarationPattern ( int matchRule ) { super ( matchRule ) ; } public SearchPattern getBlankPattern ( ) { return new SecondaryTypeDeclarationPattern ( R_EXACT_MATCH | R_CASE_SENSITIVE ) ; } protected StringBuffer print ( StringBuffer output ) { output . append ( "<STR_LIT>" ) ; return super . print ( output ) ; } public EntryResult [ ] queryIn ( Index index ) throws IOException { return index . query ( CATEGORIES , SECONDARY_PATTERN_KEY , R_PATTERN_MATCH | R_CASE_SENSITIVE ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . search . matching ; import org . eclipse . jdt . internal . compiler . ast . * ; public class VariableLocator extends PatternLocator { protected VariablePattern pattern ; public VariableLocator ( VariablePattern pattern ) { super ( pattern ) ; this . pattern = pattern ; } public int match ( Expression node , MatchingNodeSet nodeSet ) { if ( this . pattern . writeAccess ) { if ( this . pattern . readAccess ) return IMPOSSIBLE_MATCH ; if ( node instanceof Assignment ) { Expression lhs = ( ( Assignment ) node ) . lhs ; if ( lhs instanceof Reference ) return matchReference ( ( Reference ) lhs , nodeSet , true ) ; } } else if ( this . pattern . readAccess || this . pattern . fineGrain != <NUM_LIT:0> ) { if ( node instanceof Assignment && ! ( node instanceof CompoundAssignment ) ) { char [ ] lastToken = null ; Expression lhs = ( ( Assignment ) node ) . lhs ; if ( lhs instanceof QualifiedNameReference ) { char [ ] [ ] tokens = ( ( QualifiedNameReference ) lhs ) . tokens ; lastToken = tokens [ tokens . length - <NUM_LIT:1> ] ; } if ( lastToken == null || matchesName ( this . pattern . name , lastToken ) ) { nodeSet . removePossibleMatch ( lhs ) ; nodeSet . removeTrustedMatch ( lhs ) ; } } } return IMPOSSIBLE_MATCH ; } public int match ( Reference node , MatchingNodeSet nodeSet ) { return ( this . pattern . readAccess || this . pattern . fineGrain != <NUM_LIT:0> ) ? matchReference ( node , nodeSet , false ) : IMPOSSIBLE_MATCH ; } protected int matchReference ( Reference node , MatchingNodeSet nodeSet , boolean writeOnlyAccess ) { if ( node instanceof NameReference ) { if ( this . pattern . name == null ) { return nodeSet . addMatch ( node , this . pattern . mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH ) ; } else if ( node instanceof SingleNameReference ) { if ( matchesName ( this . pattern . name , ( ( SingleNameReference ) node ) . token ) ) return nodeSet . addMatch ( node , POSSIBLE_MATCH ) ; } else { QualifiedNameReference qNameRef = ( QualifiedNameReference ) node ; char [ ] [ ] tokens = qNameRef . tokens ; if ( writeOnlyAccess ) { if ( matchesName ( this . pattern . name , tokens [ tokens . length - <NUM_LIT:1> ] ) ) return nodeSet . addMatch ( node , POSSIBLE_MATCH ) ; } else { for ( int i = <NUM_LIT:0> , max = tokens . length ; i < max ; i ++ ) if ( matchesName ( this . pattern . name , tokens [ i ] ) ) return nodeSet . addMatch ( node , POSSIBLE_MATCH ) ; } } } return IMPOSSIBLE_MATCH ; } public String toString ( ) { return "<STR_LIT>" + this . pattern . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . search . matching ; import java . util . ArrayList ; import org . eclipse . jdt . core . search . SearchMatch ; import org . eclipse . jdt . core . search . SearchPattern ; import org . eclipse . jdt . internal . compiler . ast . * ; import org . eclipse . jdt . internal . compiler . util . HashtableOfLong ; import org . eclipse . jdt . internal . compiler . util . SimpleLookupTable ; import org . eclipse . jdt . internal . compiler . util . SimpleSet ; import org . eclipse . jdt . internal . core . util . Util ; public class MatchingNodeSet { SimpleLookupTable matchingNodes = new SimpleLookupTable ( <NUM_LIT:3> ) ; private HashtableOfLong matchingNodesKeys = new HashtableOfLong ( <NUM_LIT:3> ) ; static Integer EXACT_MATCH = new Integer ( SearchMatch . A_ACCURATE ) ; static Integer POTENTIAL_MATCH = new Integer ( SearchMatch . A_INACCURATE ) ; static Integer ERASURE_MATCH = new Integer ( SearchPattern . R_ERASURE_MATCH ) ; public boolean mustResolve ; SimpleSet possibleMatchingNodesSet = new SimpleSet ( <NUM_LIT:7> ) ; private HashtableOfLong possibleMatchingNodesKeys = new HashtableOfLong ( <NUM_LIT:7> ) ; public MatchingNodeSet ( boolean mustResolvePattern ) { super ( ) ; this . mustResolve = mustResolvePattern ; } public int addMatch ( ASTNode node , int matchLevel ) { int maskedLevel = matchLevel & PatternLocator . MATCH_LEVEL_MASK ; switch ( maskedLevel ) { case PatternLocator . INACCURATE_MATCH : if ( matchLevel != maskedLevel ) { addTrustedMatch ( node , new Integer ( SearchMatch . A_INACCURATE + ( matchLevel & PatternLocator . FLAVORS_MASK ) ) ) ; } else { addTrustedMatch ( node , POTENTIAL_MATCH ) ; } break ; case PatternLocator . POSSIBLE_MATCH : addPossibleMatch ( node ) ; break ; case PatternLocator . ERASURE_MATCH : if ( matchLevel != maskedLevel ) { addTrustedMatch ( node , new Integer ( SearchPattern . R_ERASURE_MATCH + ( matchLevel & PatternLocator . FLAVORS_MASK ) ) ) ; } else { addTrustedMatch ( node , ERASURE_MATCH ) ; } break ; case PatternLocator . ACCURATE_MATCH : if ( matchLevel != maskedLevel ) { addTrustedMatch ( node , new Integer ( SearchMatch . A_ACCURATE + ( matchLevel & PatternLocator . FLAVORS_MASK ) ) ) ; } else { addTrustedMatch ( node , EXACT_MATCH ) ; } break ; } return matchLevel ; } public void addPossibleMatch ( ASTNode node ) { long key = ( ( ( long ) node . sourceStart ) << <NUM_LIT:32> ) + node . sourceEnd ; ASTNode existing = ( ASTNode ) this . possibleMatchingNodesKeys . get ( key ) ; if ( existing != null && existing . getClass ( ) . equals ( node . getClass ( ) ) ) this . possibleMatchingNodesSet . remove ( existing ) ; this . possibleMatchingNodesSet . add ( node ) ; this . possibleMatchingNodesKeys . put ( key , node ) ; } public void addTrustedMatch ( ASTNode node , boolean isExact ) { addTrustedMatch ( node , isExact ? EXACT_MATCH : POTENTIAL_MATCH ) ; } void addTrustedMatch ( ASTNode node , Integer level ) { long key = ( ( ( long ) node . sourceStart ) << <NUM_LIT:32> ) + node . sourceEnd ; ASTNode existing = ( ASTNode ) this . matchingNodesKeys . get ( key ) ; if ( existing != null && existing . getClass ( ) . equals ( node . getClass ( ) ) ) this . matchingNodes . removeKey ( existing ) ; this . matchingNodes . put ( node , level ) ; this . matchingNodesKeys . put ( key , node ) ; } protected boolean hasPossibleNodes ( int start , int end ) { Object [ ] nodes = this . possibleMatchingNodesSet . values ; for ( int i = <NUM_LIT:0> , l = nodes . length ; i < l ; i ++ ) { ASTNode node = ( ASTNode ) nodes [ i ] ; if ( node != null && start <= node . sourceStart && node . sourceEnd <= end ) return true ; } nodes = this . matchingNodes . keyTable ; for ( int i = <NUM_LIT:0> , l = nodes . length ; i < l ; i ++ ) { ASTNode node = ( ASTNode ) nodes [ i ] ; if ( node != null && start <= node . sourceStart && node . sourceEnd <= end ) return true ; } return false ; } protected ASTNode [ ] matchingNodes ( int start , int end ) { ArrayList nodes = null ; Object [ ] keyTable = this . matchingNodes . keyTable ; for ( int i = <NUM_LIT:0> , l = keyTable . length ; i < l ; i ++ ) { ASTNode node = ( ASTNode ) keyTable [ i ] ; if ( node != null && start <= node . sourceStart && node . sourceEnd <= end ) { if ( nodes == null ) nodes = new ArrayList ( ) ; nodes . add ( node ) ; } } if ( nodes == null ) return null ; ASTNode [ ] result = new ASTNode [ nodes . size ( ) ] ; nodes . toArray ( result ) ; Util . Comparer comparer = new Util . Comparer ( ) { public int compare ( Object o1 , Object o2 ) { return ( ( ASTNode ) o1 ) . sourceStart - ( ( ASTNode ) o2 ) . sourceStart ; } } ; Util . sort ( result , comparer ) ; return result ; } public Object removePossibleMatch ( ASTNode node ) { long key = ( ( ( long ) node . sourceStart ) << <NUM_LIT:32> ) + node . sourceEnd ; ASTNode existing = ( ASTNode ) this . possibleMatchingNodesKeys . get ( key ) ; if ( existing == null ) return null ; this . possibleMatchingNodesKeys . put ( key , null ) ; return this . possibleMatchingNodesSet . remove ( node ) ; } public Object removeTrustedMatch ( ASTNode node ) { long key = ( ( ( long ) node . sourceStart ) << <NUM_LIT:32> ) + node . sourceEnd ; ASTNode existing = ( ASTNode ) this . matchingNodesKeys . get ( key ) ; if ( existing == null ) return null ; this . matchingNodesKeys . put ( key , null ) ; return this . matchingNodes . removeKey ( node ) ; } public String toString ( ) { StringBuffer result = new StringBuffer ( ) ; result . append ( "<STR_LIT>" ) ; Object [ ] keyTable = this . matchingNodes . keyTable ; Object [ ] valueTable = this . matchingNodes . valueTable ; for ( int i = <NUM_LIT:0> , l = keyTable . length ; i < l ; i ++ ) { ASTNode node = ( ASTNode ) keyTable [ i ] ; if ( node == null ) continue ; result . append ( "<STR_LIT>" ) ; switch ( ( ( Integer ) valueTable [ i ] ) . intValue ( ) ) { case SearchMatch . A_ACCURATE : result . append ( "<STR_LIT>" ) ; break ; case SearchMatch . A_INACCURATE : result . append ( "<STR_LIT>" ) ; break ; case SearchPattern . R_ERASURE_MATCH : result . append ( "<STR_LIT>" ) ; break ; } node . print ( <NUM_LIT:0> , result ) ; } result . append ( "<STR_LIT>" ) ; Object [ ] nodes = this . possibleMatchingNodesSet . values ; for ( int i = <NUM_LIT:0> , l = nodes . length ; i < l ; i ++ ) { ASTNode node = ( ASTNode ) nodes [ i ] ; if ( node == null ) continue ; result . append ( "<STR_LIT>" ) ; node . print ( <NUM_LIT:0> , result ) ; } return result . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . search . matching ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ; import org . eclipse . jdt . internal . compiler . lookup . * ; public class TypeDeclarationLocator extends PatternLocator { protected TypeDeclarationPattern pattern ; public TypeDeclarationLocator ( TypeDeclarationPattern pattern ) { super ( pattern ) ; this . pattern = pattern ; } public int match ( TypeDeclaration node , MatchingNodeSet nodeSet ) { if ( this . pattern . simpleName == null || matchesName ( this . pattern . simpleName , node . name ) ) return nodeSet . addMatch ( node , this . pattern . mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH ) ; return IMPOSSIBLE_MATCH ; } public int resolveLevel ( ASTNode node ) { if ( ! ( node instanceof TypeDeclaration ) ) return IMPOSSIBLE_MATCH ; return resolveLevel ( ( ( TypeDeclaration ) node ) . binding ) ; } public int resolveLevel ( Binding binding ) { if ( binding == null ) return INACCURATE_MATCH ; if ( ! ( binding instanceof TypeBinding ) ) return IMPOSSIBLE_MATCH ; TypeBinding type = ( TypeBinding ) binding ; switch ( this . pattern . typeSuffix ) { case CLASS_SUFFIX : if ( ! type . isClass ( ) ) return IMPOSSIBLE_MATCH ; break ; case CLASS_AND_INTERFACE_SUFFIX : if ( ! ( type . isClass ( ) || ( type . isInterface ( ) && ! type . isAnnotationType ( ) ) ) ) return IMPOSSIBLE_MATCH ; break ; case CLASS_AND_ENUM_SUFFIX : if ( ! ( type . isClass ( ) || type . isEnum ( ) ) ) return IMPOSSIBLE_MATCH ; break ; case INTERFACE_SUFFIX : if ( ! type . isInterface ( ) || type . isAnnotationType ( ) ) return IMPOSSIBLE_MATCH ; break ; case INTERFACE_AND_ANNOTATION_SUFFIX : if ( ! ( type . isInterface ( ) || type . isAnnotationType ( ) ) ) return IMPOSSIBLE_MATCH ; break ; case ENUM_SUFFIX : if ( ! type . isEnum ( ) ) return IMPOSSIBLE_MATCH ; break ; case ANNOTATION_TYPE_SUFFIX : if ( ! type . isAnnotationType ( ) ) return IMPOSSIBLE_MATCH ; break ; case TYPE_SUFFIX : } if ( this . pattern instanceof QualifiedTypeDeclarationPattern ) { QualifiedTypeDeclarationPattern qualifiedPattern = ( QualifiedTypeDeclarationPattern ) this . pattern ; return resolveLevelForType ( qualifiedPattern . simpleName , qualifiedPattern . qualification , type ) ; } else { char [ ] enclosingTypeName = this . pattern . enclosingTypeNames == null ? null : CharOperation . concatWith ( this . pattern . enclosingTypeNames , '<CHAR_LIT:.>' ) ; return resolveLevelForType ( this . pattern . simpleName , this . pattern . pkg , enclosingTypeName , type ) ; } } protected int resolveLevelForType ( char [ ] simpleNamePattern , char [ ] qualificationPattern , char [ ] enclosingNamePattern , TypeBinding type ) { if ( enclosingNamePattern == null ) return resolveLevelForType ( simpleNamePattern , qualificationPattern , type ) ; if ( qualificationPattern == null ) return resolveLevelForType ( simpleNamePattern , enclosingNamePattern , type ) ; if ( type instanceof ProblemReferenceBinding ) return IMPOSSIBLE_MATCH ; char [ ] fullQualificationPattern = CharOperation . concat ( qualificationPattern , enclosingNamePattern , '<CHAR_LIT:.>' ) ; if ( CharOperation . equals ( this . pattern . pkg , CharOperation . concatWith ( type . getPackage ( ) . compoundName , '<CHAR_LIT:.>' ) ) ) return resolveLevelForType ( simpleNamePattern , fullQualificationPattern , type ) ; return IMPOSSIBLE_MATCH ; } public String toString ( ) { return "<STR_LIT>" + this . pattern . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . search . matching ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . * ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . search . * ; import org . eclipse . jdt . internal . compiler . ast . * ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . compiler . lookup . * ; import org . eclipse . jdt . internal . compiler . util . SimpleSet ; import org . eclipse . jdt . internal . core . JavaElement ; public class TypeReferenceLocator extends PatternLocator { protected TypeReferencePattern pattern ; protected boolean isDeclarationOfReferencedTypesPattern ; private final int fineGrain ; public TypeReferenceLocator ( TypeReferencePattern pattern ) { super ( pattern ) ; this . pattern = pattern ; this . fineGrain = pattern == null ? <NUM_LIT:0> : pattern . fineGrain ; this . isDeclarationOfReferencedTypesPattern = this . pattern instanceof DeclarationOfReferencedTypesPattern ; } protected IJavaElement findElement ( IJavaElement element , int accuracy ) { if ( accuracy != SearchMatch . A_ACCURATE ) return null ; DeclarationOfReferencedTypesPattern declPattern = ( DeclarationOfReferencedTypesPattern ) this . pattern ; while ( element != null && ! declPattern . enclosingElement . equals ( element ) ) element = element . getParent ( ) ; return element ; } protected int fineGrain ( ) { return this . fineGrain ; } public int match ( Annotation node , MatchingNodeSet nodeSet ) { return match ( node . type , nodeSet ) ; } public int match ( ASTNode node , MatchingNodeSet nodeSet ) { if ( ! ( node instanceof ImportReference ) ) return IMPOSSIBLE_MATCH ; return nodeSet . addMatch ( node , matchLevel ( ( ImportReference ) node ) ) ; } public int match ( Reference node , MatchingNodeSet nodeSet ) { if ( ! ( node instanceof NameReference ) ) return IMPOSSIBLE_MATCH ; if ( this . pattern . simpleName == null ) return nodeSet . addMatch ( node , this . pattern . mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH ) ; if ( node instanceof SingleNameReference ) { if ( matchesName ( this . pattern . simpleName , ( ( SingleNameReference ) node ) . token ) ) return nodeSet . addMatch ( node , POSSIBLE_MATCH ) ; } else { char [ ] [ ] tokens = ( ( QualifiedNameReference ) node ) . tokens ; for ( int i = <NUM_LIT:0> , max = tokens . length ; i < max ; i ++ ) if ( matchesName ( this . pattern . simpleName , tokens [ i ] ) ) return nodeSet . addMatch ( node , POSSIBLE_MATCH ) ; } return IMPOSSIBLE_MATCH ; } public int match ( TypeReference node , MatchingNodeSet nodeSet ) { if ( this . pattern . simpleName == null ) return nodeSet . addMatch ( node , this . pattern . mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH ) ; if ( node instanceof SingleTypeReference ) { if ( matchesName ( this . pattern . simpleName , ( ( SingleTypeReference ) node ) . token ) ) return nodeSet . addMatch ( node , this . pattern . mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH ) ; } else { char [ ] [ ] tokens = ( ( QualifiedTypeReference ) node ) . tokens ; for ( int i = <NUM_LIT:0> , max = tokens . length ; i < max ; i ++ ) if ( matchesName ( this . pattern . simpleName , tokens [ i ] ) ) return nodeSet . addMatch ( node , POSSIBLE_MATCH ) ; } return IMPOSSIBLE_MATCH ; } protected int matchLevel ( ImportReference importRef ) { if ( this . pattern . qualification == null ) { if ( this . pattern . simpleName == null ) return ACCURATE_MATCH ; char [ ] [ ] tokens = importRef . tokens ; boolean onDemand = ( importRef . bits & ASTNode . OnDemand ) != <NUM_LIT:0> ; final boolean isStatic = importRef . isStatic ( ) ; if ( ! isStatic && onDemand ) { return IMPOSSIBLE_MATCH ; } int length = tokens . length ; if ( matchesName ( this . pattern . simpleName , tokens [ length - <NUM_LIT:1> ] ) ) { return ACCURATE_MATCH ; } if ( isStatic && ! onDemand && length > <NUM_LIT:1> ) { if ( matchesName ( this . pattern . simpleName , tokens [ length - <NUM_LIT:2> ] ) ) { return ACCURATE_MATCH ; } } } else { char [ ] [ ] tokens = importRef . tokens ; char [ ] qualifiedPattern = this . pattern . simpleName == null ? this . pattern . qualification : CharOperation . concat ( this . pattern . qualification , this . pattern . simpleName , '<CHAR_LIT:.>' ) ; char [ ] qualifiedTypeName = CharOperation . concatWith ( tokens , '<CHAR_LIT:.>' ) ; if ( qualifiedPattern == null ) return ACCURATE_MATCH ; if ( qualifiedTypeName == null ) return IMPOSSIBLE_MATCH ; if ( qualifiedTypeName . length == <NUM_LIT:0> ) { if ( qualifiedPattern . length == <NUM_LIT:0> ) { return ACCURATE_MATCH ; } return IMPOSSIBLE_MATCH ; } boolean matchFirstChar = ! this . isCaseSensitive || ( qualifiedPattern [ <NUM_LIT:0> ] == qualifiedTypeName [ <NUM_LIT:0> ] ) ; switch ( this . matchMode ) { case SearchPattern . R_EXACT_MATCH : case SearchPattern . R_PREFIX_MATCH : if ( CharOperation . prefixEquals ( qualifiedPattern , qualifiedTypeName , this . isCaseSensitive ) ) { return POSSIBLE_MATCH ; } break ; case SearchPattern . R_PATTERN_MATCH : if ( CharOperation . match ( qualifiedPattern , qualifiedTypeName , this . isCaseSensitive ) ) { return POSSIBLE_MATCH ; } break ; case SearchPattern . R_REGEXP_MATCH : break ; case SearchPattern . R_CAMELCASE_MATCH : if ( matchFirstChar && CharOperation . camelCaseMatch ( qualifiedPattern , qualifiedTypeName , false ) ) { return POSSIBLE_MATCH ; } if ( ! this . isCaseSensitive && CharOperation . prefixEquals ( qualifiedPattern , qualifiedTypeName , false ) ) { return POSSIBLE_MATCH ; } break ; case SearchPattern . R_CAMELCASE_SAME_PART_COUNT_MATCH : if ( matchFirstChar && CharOperation . camelCaseMatch ( qualifiedPattern , qualifiedTypeName , true ) ) { return POSSIBLE_MATCH ; } break ; } } return IMPOSSIBLE_MATCH ; } protected void matchLevelAndReportImportRef ( ImportReference importRef , Binding binding , MatchLocator locator ) throws CoreException { Binding refBinding = binding ; if ( importRef . isStatic ( ) ) { if ( binding instanceof FieldBinding ) { FieldBinding fieldBinding = ( FieldBinding ) binding ; if ( ! fieldBinding . isStatic ( ) ) return ; refBinding = fieldBinding . declaringClass ; } else if ( binding instanceof MethodBinding ) { MethodBinding methodBinding = ( MethodBinding ) binding ; if ( ! methodBinding . isStatic ( ) ) return ; refBinding = methodBinding . declaringClass ; } else if ( binding instanceof MemberTypeBinding ) { MemberTypeBinding memberBinding = ( MemberTypeBinding ) binding ; if ( ! memberBinding . isStatic ( ) ) return ; } int level = resolveLevel ( refBinding ) ; if ( level >= INACCURATE_MATCH ) { matchReportImportRef ( importRef , binding , locator . createImportHandle ( importRef ) , level == ACCURATE_MATCH ? SearchMatch . A_ACCURATE : SearchMatch . A_INACCURATE , locator ) ; } return ; } super . matchLevelAndReportImportRef ( importRef , refBinding , locator ) ; } protected void matchReportImportRef ( ImportReference importRef , Binding binding , IJavaElement element , int accuracy , MatchLocator locator ) throws CoreException { if ( this . isDeclarationOfReferencedTypesPattern ) { if ( ( element = findElement ( element , accuracy ) ) != null ) { SimpleSet knownTypes = ( ( DeclarationOfReferencedTypesPattern ) this . pattern ) . knownTypes ; while ( binding instanceof ReferenceBinding ) { ReferenceBinding typeBinding = ( ReferenceBinding ) binding ; reportDeclaration ( typeBinding , <NUM_LIT:1> , locator , knownTypes ) ; binding = typeBinding . enclosingType ( ) ; } } return ; } if ( this . pattern . hasTypeArguments ( ) && ! this . isEquivalentMatch && ! this . isErasureMatch ) { return ; } if ( ( this . pattern . fineGrain != <NUM_LIT:0> && ( this . pattern . fineGrain & IJavaSearchConstants . IMPORT_DECLARATION_TYPE_REFERENCE ) == <NUM_LIT:0> ) ) { return ; } this . match = locator . newTypeReferenceMatch ( element , binding , accuracy , importRef ) ; this . match . setRaw ( true ) ; if ( this . pattern . hasTypeArguments ( ) ) { this . match . setRule ( this . match . getRule ( ) & ( ~ SearchPattern . R_FULL_MATCH ) ) ; } TypeBinding typeBinding = null ; boolean lastButOne = false ; if ( binding instanceof ReferenceBinding ) { typeBinding = ( ReferenceBinding ) binding ; } else if ( binding instanceof FieldBinding ) { typeBinding = ( ( FieldBinding ) binding ) . declaringClass ; lastButOne = importRef . isStatic ( ) && ( ( importRef . bits & ASTNode . OnDemand ) == <NUM_LIT:0> ) ; } else if ( binding instanceof MethodBinding ) { typeBinding = ( ( MethodBinding ) binding ) . declaringClass ; lastButOne = importRef . isStatic ( ) && ( ( importRef . bits & ASTNode . OnDemand ) == <NUM_LIT:0> ) ; } if ( typeBinding != null ) { int lastIndex = importRef . tokens . length - <NUM_LIT:1> ; if ( lastButOne ) { lastIndex -- ; } if ( typeBinding instanceof ProblemReferenceBinding ) { ProblemReferenceBinding pbBinding = ( ProblemReferenceBinding ) typeBinding ; typeBinding = pbBinding . closestMatch ( ) ; lastIndex = pbBinding . compoundName . length - <NUM_LIT:1> ; } while ( typeBinding != null && lastIndex >= <NUM_LIT:0> ) { if ( resolveLevelForType ( typeBinding ) != IMPOSSIBLE_MATCH ) { if ( locator . encloses ( element ) ) { long [ ] positions = importRef . sourcePositions ; int index = lastIndex ; if ( this . pattern . qualification != null ) { index = lastIndex - this . pattern . segmentsSize ; } if ( index < <NUM_LIT:0> ) index = <NUM_LIT:0> ; int start = ( int ) ( ( positions [ index ] ) > > > <NUM_LIT:32> ) ; int end = ( int ) positions [ lastIndex ] ; this . match . setOffset ( start ) ; this . match . setLength ( end - start + <NUM_LIT:1> ) ; locator . report ( this . match ) ; } return ; } lastIndex -- ; typeBinding = typeBinding . enclosingType ( ) ; } } locator . reportAccurateTypeReference ( this . match , importRef , this . pattern . simpleName ) ; } protected void matchReportReference ( ArrayTypeReference arrayRef , IJavaElement element , Binding elementBinding , int accuracy , MatchLocator locator ) throws CoreException { if ( this . pattern . simpleName == null ) { if ( locator . encloses ( element ) ) { int offset = arrayRef . sourceStart ; int length = arrayRef . sourceEnd - offset + <NUM_LIT:1> ; if ( this . match == null ) { this . match = locator . newTypeReferenceMatch ( element , elementBinding , accuracy , offset , length , arrayRef ) ; } else { this . match . setOffset ( offset ) ; this . match . setLength ( length ) ; } locator . report ( this . match ) ; return ; } } this . match = locator . newTypeReferenceMatch ( element , elementBinding , accuracy , arrayRef ) ; if ( arrayRef . resolvedType != null ) { matchReportReference ( arrayRef , - <NUM_LIT:1> , arrayRef . resolvedType . leafComponentType ( ) , locator ) ; return ; } locator . reportAccurateTypeReference ( this . match , arrayRef , this . pattern . simpleName ) ; } protected void matchReportReference ( ASTNode reference , IJavaElement element , Binding elementBinding , int accuracy , MatchLocator locator ) throws CoreException { matchReportReference ( reference , element , null , null , elementBinding , accuracy , locator ) ; } protected void matchReportReference ( ASTNode reference , IJavaElement element , IJavaElement localElement , IJavaElement [ ] otherElements , Binding elementBinding , int accuracy , MatchLocator locator ) throws CoreException { if ( this . isDeclarationOfReferencedTypesPattern ) { if ( ( element = findElement ( element , accuracy ) ) != null ) reportDeclaration ( reference , element , locator , ( ( DeclarationOfReferencedTypesPattern ) this . pattern ) . knownTypes ) ; return ; } TypeReferenceMatch refMatch = locator . newTypeReferenceMatch ( element , elementBinding , accuracy , reference ) ; refMatch . setLocalElement ( localElement ) ; refMatch . setOtherElements ( otherElements ) ; this . match = refMatch ; if ( reference instanceof QualifiedNameReference ) matchReportReference ( ( QualifiedNameReference ) reference , element , elementBinding , accuracy , locator ) ; else if ( reference instanceof QualifiedTypeReference ) matchReportReference ( ( QualifiedTypeReference ) reference , element , elementBinding , accuracy , locator ) ; else if ( reference instanceof ArrayTypeReference ) matchReportReference ( ( ArrayTypeReference ) reference , element , elementBinding , accuracy , locator ) ; else { TypeBinding typeBinding = reference instanceof Expression ? ( ( Expression ) reference ) . resolvedType : null ; if ( typeBinding != null ) { matchReportReference ( ( Expression ) reference , - <NUM_LIT:1> , typeBinding , locator ) ; return ; } locator . report ( this . match ) ; } } protected void matchReportReference ( QualifiedNameReference qNameRef , IJavaElement element , Binding elementBinding , int accuracy , MatchLocator locator ) throws CoreException { Binding binding = qNameRef . binding ; TypeBinding typeBinding = null ; int lastIndex = qNameRef . tokens . length - <NUM_LIT:1> ; switch ( qNameRef . bits & ASTNode . RestrictiveFlagMASK ) { case Binding . FIELD : typeBinding = qNameRef . actualReceiverType ; lastIndex -= qNameRef . otherBindings == null ? <NUM_LIT:1> : qNameRef . otherBindings . length + <NUM_LIT:1> ; break ; case Binding . TYPE : if ( binding instanceof TypeBinding ) typeBinding = ( TypeBinding ) binding ; break ; case Binding . VARIABLE : case Binding . TYPE | Binding . VARIABLE : if ( binding instanceof ProblemReferenceBinding ) { typeBinding = ( TypeBinding ) binding ; } else if ( binding instanceof ProblemFieldBinding ) { typeBinding = qNameRef . actualReceiverType ; lastIndex -= qNameRef . otherBindings == null ? <NUM_LIT:1> : qNameRef . otherBindings . length + <NUM_LIT:1> ; } else if ( binding instanceof ProblemBinding ) { typeBinding = ( ( ProblemBinding ) binding ) . searchType ; } break ; } if ( typeBinding instanceof ProblemReferenceBinding ) { ProblemReferenceBinding pbBinding = ( ProblemReferenceBinding ) typeBinding ; typeBinding = pbBinding . closestMatch ( ) ; lastIndex = pbBinding . compoundName . length - <NUM_LIT:1> ; } if ( this . match == null ) { this . match = locator . newTypeReferenceMatch ( element , elementBinding , accuracy , qNameRef ) ; } if ( typeBinding instanceof ReferenceBinding ) { ReferenceBinding refBinding = ( ReferenceBinding ) typeBinding ; while ( refBinding != null && lastIndex >= <NUM_LIT:0> ) { if ( resolveLevelForType ( refBinding ) == ACCURATE_MATCH ) { if ( locator . encloses ( element ) ) { long [ ] positions = qNameRef . sourcePositions ; int index = lastIndex ; if ( this . pattern . qualification != null ) { index = lastIndex - this . pattern . segmentsSize ; } if ( index < <NUM_LIT:0> ) index = <NUM_LIT:0> ; int start = ( int ) ( ( positions [ index ] ) > > > <NUM_LIT:32> ) ; int end = ( int ) positions [ lastIndex ] ; this . match . setOffset ( start ) ; this . match . setLength ( end - start + <NUM_LIT:1> ) ; matchReportReference ( qNameRef , lastIndex , refBinding , locator ) ; } return ; } lastIndex -- ; refBinding = refBinding . enclosingType ( ) ; } } locator . reportAccurateTypeReference ( this . match , qNameRef , this . pattern . simpleName ) ; } protected void matchReportReference ( QualifiedTypeReference qTypeRef , IJavaElement element , Binding elementBinding , int accuracy , MatchLocator locator ) throws CoreException { TypeBinding typeBinding = qTypeRef . resolvedType ; int lastIndex = qTypeRef . tokens . length - <NUM_LIT:1> ; if ( typeBinding instanceof ArrayBinding ) typeBinding = ( ( ArrayBinding ) typeBinding ) . leafComponentType ; if ( typeBinding instanceof ProblemReferenceBinding ) { ProblemReferenceBinding pbBinding = ( ProblemReferenceBinding ) typeBinding ; typeBinding = pbBinding . closestMatch ( ) ; lastIndex = pbBinding . compoundName . length - <NUM_LIT:1> ; } if ( this . match == null ) { this . match = locator . newTypeReferenceMatch ( element , elementBinding , accuracy , qTypeRef ) ; } if ( typeBinding instanceof ReferenceBinding ) { ReferenceBinding refBinding = ( ReferenceBinding ) typeBinding ; while ( refBinding != null && lastIndex >= <NUM_LIT:0> ) { if ( resolveLevelForType ( refBinding ) != IMPOSSIBLE_MATCH ) { if ( locator . encloses ( element ) ) { long [ ] positions = qTypeRef . sourcePositions ; int index = lastIndex ; if ( this . pattern . qualification != null ) { index = lastIndex - this . pattern . segmentsSize ; } if ( index < <NUM_LIT:0> ) index = <NUM_LIT:0> ; int start = ( int ) ( ( positions [ index ] ) > > > <NUM_LIT:32> ) ; int end = ( int ) positions [ lastIndex ] ; this . match . setOffset ( start ) ; this . match . setLength ( end - start + <NUM_LIT:1> ) ; matchReportReference ( qTypeRef , lastIndex , refBinding , locator ) ; } return ; } lastIndex -- ; refBinding = refBinding . enclosingType ( ) ; } } locator . reportAccurateTypeReference ( this . match , qTypeRef , this . pattern . simpleName ) ; } void matchReportReference ( Expression expr , int lastIndex , TypeBinding refBinding , MatchLocator locator ) throws CoreException { if ( refBinding . isParameterizedType ( ) || refBinding . isRawType ( ) ) { ParameterizedTypeBinding parameterizedBinding = ( ParameterizedTypeBinding ) refBinding ; updateMatch ( parameterizedBinding , this . pattern . getTypeArguments ( ) , this . pattern . hasTypeParameters ( ) , <NUM_LIT:0> , locator ) ; if ( this . match . getRule ( ) == <NUM_LIT:0> ) return ; boolean report = ( this . isErasureMatch && this . match . isErasure ( ) ) || ( this . isEquivalentMatch && this . match . isEquivalent ( ) ) || this . match . isExact ( ) ; if ( ! report ) return ; if ( refBinding . isParameterizedType ( ) && this . pattern . hasTypeArguments ( ) ) { TypeReference typeRef = null ; TypeReference [ ] typeArguments = null ; if ( expr instanceof ParameterizedQualifiedTypeReference ) { typeRef = ( ParameterizedQualifiedTypeReference ) expr ; typeArguments = ( ( ParameterizedQualifiedTypeReference ) expr ) . typeArguments [ lastIndex ] ; } else if ( expr instanceof ParameterizedSingleTypeReference ) { typeRef = ( ParameterizedSingleTypeReference ) expr ; typeArguments = ( ( ParameterizedSingleTypeReference ) expr ) . typeArguments ; } if ( typeRef != null ) { locator . reportAccurateParameterizedTypeReference ( this . match , typeRef , lastIndex , typeArguments ) ; return ; } } } else if ( this . pattern . hasTypeArguments ( ) ) { this . match . setRule ( SearchPattern . R_ERASURE_MATCH ) ; } if ( expr instanceof ArrayTypeReference ) { locator . reportAccurateTypeReference ( this . match , expr , this . pattern . simpleName ) ; return ; } if ( refBinding . isLocalType ( ) ) { LocalTypeBinding local = ( LocalTypeBinding ) refBinding . erasure ( ) ; IJavaElement focus = this . pattern . focus ; if ( focus != null && local . enclosingMethod != null && focus . getParent ( ) . getElementType ( ) == IJavaElement . METHOD ) { IMethod method = ( IMethod ) focus . getParent ( ) ; if ( ! CharOperation . equals ( local . enclosingMethod . selector , method . getElementName ( ) . toCharArray ( ) ) ) { return ; } } } if ( this . pattern . simpleName == null ) { this . match . setOffset ( expr . sourceStart ) ; this . match . setLength ( expr . sourceEnd - expr . sourceStart + <NUM_LIT:1> ) ; } locator . report ( this . match ) ; } protected int referenceType ( ) { return IJavaElement . TYPE ; } protected void reportDeclaration ( ASTNode reference , IJavaElement element , MatchLocator locator , SimpleSet knownTypes ) throws CoreException { int maxType = - <NUM_LIT:1> ; TypeBinding typeBinding = null ; if ( reference instanceof TypeReference ) { typeBinding = ( ( TypeReference ) reference ) . resolvedType ; maxType = Integer . MAX_VALUE ; } else if ( reference instanceof QualifiedNameReference ) { QualifiedNameReference qNameRef = ( QualifiedNameReference ) reference ; Binding binding = qNameRef . binding ; maxType = qNameRef . tokens . length - <NUM_LIT:1> ; switch ( qNameRef . bits & ASTNode . RestrictiveFlagMASK ) { case Binding . FIELD : typeBinding = qNameRef . actualReceiverType ; maxType -= qNameRef . otherBindings == null ? <NUM_LIT:1> : qNameRef . otherBindings . length + <NUM_LIT:1> ; break ; case Binding . TYPE : if ( binding instanceof TypeBinding ) typeBinding = ( TypeBinding ) binding ; break ; case Binding . VARIABLE : case Binding . TYPE | Binding . VARIABLE : if ( binding instanceof ProblemFieldBinding ) { typeBinding = qNameRef . actualReceiverType ; maxType -= qNameRef . otherBindings == null ? <NUM_LIT:1> : qNameRef . otherBindings . length + <NUM_LIT:1> ; } else if ( binding instanceof ProblemBinding ) { ProblemBinding pbBinding = ( ProblemBinding ) binding ; typeBinding = pbBinding . searchType ; char [ ] partialQualifiedName = pbBinding . name ; maxType = CharOperation . occurencesOf ( '<CHAR_LIT:.>' , partialQualifiedName ) - <NUM_LIT:1> ; if ( typeBinding == null || maxType < <NUM_LIT:0> ) return ; } break ; } } else if ( reference instanceof SingleNameReference ) { typeBinding = ( TypeBinding ) ( ( SingleNameReference ) reference ) . binding ; maxType = <NUM_LIT:1> ; } if ( typeBinding instanceof ArrayBinding ) typeBinding = ( ( ArrayBinding ) typeBinding ) . leafComponentType ; if ( typeBinding == null || typeBinding instanceof BaseTypeBinding ) return ; if ( typeBinding instanceof ProblemReferenceBinding ) { TypeBinding original = typeBinding . closestMatch ( ) ; if ( original == null ) return ; typeBinding = original ; } typeBinding = typeBinding . erasure ( ) ; reportDeclaration ( ( ReferenceBinding ) typeBinding , maxType , locator , knownTypes ) ; } protected void reportDeclaration ( ReferenceBinding typeBinding , int maxType , MatchLocator locator , SimpleSet knownTypes ) throws CoreException { IType type = locator . lookupType ( typeBinding ) ; if ( type == null ) return ; IResource resource = type . getResource ( ) ; boolean isBinary = type . isBinary ( ) ; IBinaryType info = null ; if ( isBinary ) { if ( resource == null ) resource = type . getJavaProject ( ) . getProject ( ) ; info = locator . getBinaryInfo ( ( org . eclipse . jdt . internal . core . ClassFile ) type . getClassFile ( ) , resource ) ; } while ( maxType >= <NUM_LIT:0> && type != null ) { if ( ! knownTypes . includes ( type ) ) { if ( isBinary ) { locator . reportBinaryMemberDeclaration ( resource , type , typeBinding , info , SearchMatch . A_ACCURATE ) ; } else { if ( typeBinding instanceof ParameterizedTypeBinding ) typeBinding = ( ( ParameterizedTypeBinding ) typeBinding ) . genericType ( ) ; ClassScope scope = ( ( SourceTypeBinding ) typeBinding ) . scope ; if ( scope != null ) { TypeDeclaration typeDecl = scope . referenceContext ; int offset = typeDecl . sourceStart ; this . match = new TypeDeclarationMatch ( ( ( JavaElement ) type ) . resolved ( typeBinding ) , SearchMatch . A_ACCURATE , offset , typeDecl . sourceEnd - offset + <NUM_LIT:1> , locator . getParticipant ( ) , resource ) ; locator . report ( this . match ) ; } } knownTypes . add ( type ) ; } typeBinding = typeBinding . enclosingType ( ) ; IJavaElement parent = type . getParent ( ) ; if ( parent instanceof IType ) { type = ( IType ) parent ; } else { type = null ; } maxType -- ; } } public int resolveLevel ( ASTNode node ) { if ( node instanceof TypeReference ) return resolveLevel ( ( TypeReference ) node ) ; if ( node instanceof NameReference ) return resolveLevel ( ( NameReference ) node ) ; return IMPOSSIBLE_MATCH ; } public int resolveLevel ( Binding binding ) { if ( binding == null ) return INACCURATE_MATCH ; if ( ! ( binding instanceof TypeBinding ) ) return IMPOSSIBLE_MATCH ; TypeBinding typeBinding = ( TypeBinding ) binding ; if ( typeBinding instanceof ArrayBinding ) typeBinding = ( ( ArrayBinding ) typeBinding ) . leafComponentType ; if ( typeBinding instanceof ProblemReferenceBinding ) typeBinding = ( ( ProblemReferenceBinding ) typeBinding ) . closestMatch ( ) ; return resolveLevelForTypeOrEnclosingTypes ( this . pattern . simpleName , this . pattern . qualification , typeBinding ) ; } protected int resolveLevel ( NameReference nameRef ) { Binding binding = nameRef . binding ; if ( nameRef instanceof SingleNameReference ) { if ( binding instanceof ProblemReferenceBinding ) binding = ( ( ProblemReferenceBinding ) binding ) . closestMatch ( ) ; if ( binding instanceof ReferenceBinding ) return resolveLevelForType ( ( ReferenceBinding ) binding ) ; return binding == null || binding instanceof ProblemBinding ? INACCURATE_MATCH : IMPOSSIBLE_MATCH ; } TypeBinding typeBinding = null ; QualifiedNameReference qNameRef = ( QualifiedNameReference ) nameRef ; switch ( qNameRef . bits & ASTNode . RestrictiveFlagMASK ) { case Binding . FIELD : if ( qNameRef . tokens . length < ( qNameRef . otherBindings == null ? <NUM_LIT:2> : qNameRef . otherBindings . length + <NUM_LIT:2> ) ) return IMPOSSIBLE_MATCH ; typeBinding = nameRef . actualReceiverType ; break ; case Binding . LOCAL : return IMPOSSIBLE_MATCH ; case Binding . TYPE : if ( binding instanceof TypeBinding ) typeBinding = ( TypeBinding ) binding ; break ; case Binding . VARIABLE : case Binding . TYPE | Binding . VARIABLE : if ( binding instanceof ProblemReferenceBinding ) { typeBinding = ( TypeBinding ) binding ; } else if ( binding instanceof ProblemFieldBinding ) { if ( qNameRef . tokens . length < ( qNameRef . otherBindings == null ? <NUM_LIT:2> : qNameRef . otherBindings . length + <NUM_LIT:2> ) ) return IMPOSSIBLE_MATCH ; typeBinding = nameRef . actualReceiverType ; } else if ( binding instanceof ProblemBinding ) { ProblemBinding pbBinding = ( ProblemBinding ) binding ; if ( CharOperation . occurencesOf ( '<CHAR_LIT:.>' , pbBinding . name ) <= <NUM_LIT:0> ) return INACCURATE_MATCH ; typeBinding = pbBinding . searchType ; } break ; } return resolveLevel ( typeBinding ) ; } protected int resolveLevel ( TypeReference typeRef ) { TypeBinding typeBinding = typeRef . resolvedType ; if ( typeBinding instanceof ArrayBinding ) typeBinding = ( ( ArrayBinding ) typeBinding ) . leafComponentType ; if ( typeBinding instanceof ProblemReferenceBinding ) typeBinding = ( ( ProblemReferenceBinding ) typeBinding ) . closestMatch ( ) ; if ( typeRef instanceof SingleTypeReference ) { return resolveLevelForType ( typeBinding ) ; } else return resolveLevelForTypeOrEnclosingTypes ( this . pattern . simpleName , this . pattern . qualification , typeBinding ) ; } protected int resolveLevelForType ( TypeBinding typeBinding ) { if ( typeBinding == null || ! typeBinding . isValidBinding ( ) ) { if ( this . pattern . typeSuffix != TYPE_SUFFIX ) return INACCURATE_MATCH ; } else { switch ( this . pattern . typeSuffix ) { case CLASS_SUFFIX : if ( ! typeBinding . isClass ( ) ) return IMPOSSIBLE_MATCH ; break ; case CLASS_AND_INTERFACE_SUFFIX : if ( ! ( typeBinding . isClass ( ) || ( typeBinding . isInterface ( ) && ! typeBinding . isAnnotationType ( ) ) ) ) return IMPOSSIBLE_MATCH ; break ; case CLASS_AND_ENUM_SUFFIX : if ( ! ( typeBinding . isClass ( ) || typeBinding . isEnum ( ) ) ) return IMPOSSIBLE_MATCH ; break ; case INTERFACE_SUFFIX : if ( ! typeBinding . isInterface ( ) || typeBinding . isAnnotationType ( ) ) return IMPOSSIBLE_MATCH ; break ; case INTERFACE_AND_ANNOTATION_SUFFIX : if ( ! ( typeBinding . isInterface ( ) || typeBinding . isAnnotationType ( ) ) ) return IMPOSSIBLE_MATCH ; break ; case ENUM_SUFFIX : if ( ! typeBinding . isEnum ( ) ) return IMPOSSIBLE_MATCH ; break ; case ANNOTATION_TYPE_SUFFIX : if ( ! typeBinding . isAnnotationType ( ) ) return IMPOSSIBLE_MATCH ; break ; case TYPE_SUFFIX : } } return resolveLevelForType ( this . pattern . simpleName , this . pattern . qualification , this . pattern . getTypeArguments ( ) , <NUM_LIT:0> , typeBinding ) ; } protected int resolveLevelForTypeOrEnclosingTypes ( char [ ] simpleNamePattern , char [ ] qualificationPattern , TypeBinding binding ) { if ( binding == null ) return INACCURATE_MATCH ; if ( binding instanceof ReferenceBinding ) { ReferenceBinding type = ( ReferenceBinding ) binding ; while ( type != null ) { int level = resolveLevelForType ( type ) ; if ( level != IMPOSSIBLE_MATCH ) return level ; type = type . enclosingType ( ) ; } } return IMPOSSIBLE_MATCH ; } public String toString ( ) { return "<STR_LIT>" + this . pattern . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . search ; import org . eclipse . jdt . core . IJavaElementDelta ; import org . eclipse . jdt . core . search . IJavaSearchScope ; public abstract class AbstractSearchScope implements IJavaSearchScope { public boolean includesBinaries ( ) { return true ; } public boolean includesClasspaths ( ) { return true ; } public abstract void processDelta ( IJavaElementDelta delta , int eventType ) ; public void setIncludesBinaries ( boolean includesBinaries ) { } public void setIncludesClasspaths ( boolean includesClasspaths ) { } } </s>
<s> package org . eclipse . jdt . internal . core . search ; import java . util . * ; import org . eclipse . core . resources . * ; import org . eclipse . core . runtime . * ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . search . * ; import org . eclipse . jdt . internal . compiler . * ; import org . eclipse . jdt . internal . compiler . ast . * ; import org . eclipse . jdt . internal . compiler . env . AccessRestriction ; import org . eclipse . jdt . internal . compiler . env . AccessRuleSet ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . lookup . * ; import org . eclipse . jdt . internal . compiler . parser . Parser ; import org . eclipse . jdt . internal . compiler . problem . DefaultProblemFactory ; import org . eclipse . jdt . internal . compiler . problem . ProblemReporter ; import org . eclipse . jdt . internal . core . * ; import org . eclipse . jdt . internal . core . search . indexing . * ; import org . eclipse . jdt . internal . core . search . matching . * ; import org . eclipse . jdt . internal . core . util . Messages ; import org . eclipse . jdt . internal . core . util . Util ; public class BasicSearchEngine { private Parser parser ; private CompilerOptions compilerOptions ; private ICompilationUnit [ ] workingCopies ; private WorkingCopyOwner workingCopyOwner ; public static boolean VERBOSE = false ; public BasicSearchEngine ( ) { } public BasicSearchEngine ( ICompilationUnit [ ] workingCopies ) { this . workingCopies = workingCopies ; } char convertTypeKind ( int typeDeclarationKind ) { switch ( typeDeclarationKind ) { case TypeDeclaration . CLASS_DECL : return IIndexConstants . CLASS_SUFFIX ; case TypeDeclaration . INTERFACE_DECL : return IIndexConstants . INTERFACE_SUFFIX ; case TypeDeclaration . ENUM_DECL : return IIndexConstants . ENUM_SUFFIX ; case TypeDeclaration . ANNOTATION_TYPE_DECL : return IIndexConstants . ANNOTATION_TYPE_SUFFIX ; default : return IIndexConstants . TYPE_SUFFIX ; } } public BasicSearchEngine ( WorkingCopyOwner workingCopyOwner ) { this . workingCopyOwner = workingCopyOwner ; } public static IJavaSearchScope createHierarchyScope ( IType type ) throws JavaModelException { return createHierarchyScope ( type , DefaultWorkingCopyOwner . PRIMARY ) ; } public static IJavaSearchScope createHierarchyScope ( IType type , WorkingCopyOwner owner ) throws JavaModelException { return new HierarchyScope ( type , owner ) ; } public static IJavaSearchScope createStrictHierarchyScope ( IJavaProject project , IType type , boolean onlySubtypes , boolean includeFocusType , WorkingCopyOwner owner ) throws JavaModelException { return new HierarchyScope ( project , type , owner , onlySubtypes , true , includeFocusType ) ; } public static IJavaSearchScope createJavaSearchScope ( IJavaElement [ ] elements ) { return createJavaSearchScope ( elements , true ) ; } public static IJavaSearchScope createJavaSearchScope ( IJavaElement [ ] elements , boolean includeReferencedProjects ) { int includeMask = IJavaSearchScope . SOURCES | IJavaSearchScope . APPLICATION_LIBRARIES | IJavaSearchScope . SYSTEM_LIBRARIES ; if ( includeReferencedProjects ) { includeMask |= IJavaSearchScope . REFERENCED_PROJECTS ; } return createJavaSearchScope ( elements , includeMask ) ; } public static IJavaSearchScope createJavaSearchScope ( IJavaElement [ ] elements , int includeMask ) { HashSet projectsToBeAdded = new HashSet ( <NUM_LIT:2> ) ; for ( int i = <NUM_LIT:0> , length = elements . length ; i < length ; i ++ ) { IJavaElement element = elements [ i ] ; if ( element instanceof JavaProject ) { projectsToBeAdded . add ( element ) ; } } JavaSearchScope scope = new JavaSearchScope ( ) ; for ( int i = <NUM_LIT:0> , length = elements . length ; i < length ; i ++ ) { IJavaElement element = elements [ i ] ; if ( element != null ) { try { if ( projectsToBeAdded . contains ( element ) ) { scope . add ( ( JavaProject ) element , includeMask , projectsToBeAdded ) ; } else { scope . add ( element ) ; } } catch ( JavaModelException e ) { } } } return scope ; } public static TypeNameMatch createTypeNameMatch ( IType type , int modifiers ) { return new JavaSearchTypeNameMatch ( type , modifiers ) ; } public static IJavaSearchScope createWorkspaceScope ( ) { return JavaModelManager . getJavaModelManager ( ) . getWorkspaceScope ( ) ; } void findMatches ( SearchPattern pattern , SearchParticipant [ ] participants , IJavaSearchScope scope , SearchRequestor requestor , IProgressMonitor monitor ) throws CoreException { if ( monitor != null && monitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; try { if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" + pattern . toString ( ) ) ; Util . verbose ( scope . toString ( ) ) ; } if ( participants == null ) { if ( VERBOSE ) Util . verbose ( "<STR_LIT>" ) ; return ; } int length = participants . length ; if ( monitor != null ) monitor . beginTask ( Messages . engine_searching , <NUM_LIT:100> * length ) ; IndexManager indexManager = JavaModelManager . getIndexManager ( ) ; requestor . beginReporting ( ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( monitor != null && monitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; SearchParticipant participant = participants [ i ] ; try { if ( monitor != null ) monitor . subTask ( Messages . bind ( Messages . engine_searching_indexing , new String [ ] { participant . getDescription ( ) } ) ) ; participant . beginSearching ( ) ; requestor . enterParticipant ( participant ) ; PathCollector pathCollector = new PathCollector ( ) ; indexManager . performConcurrentJob ( new PatternSearchJob ( pattern , participant , scope , pathCollector ) , IJavaSearchConstants . WAIT_UNTIL_READY_TO_SEARCH , monitor == null ? null : new SubProgressMonitor ( monitor , <NUM_LIT> ) ) ; if ( monitor != null && monitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; if ( monitor != null ) monitor . subTask ( Messages . bind ( Messages . engine_searching_matching , new String [ ] { participant . getDescription ( ) } ) ) ; String [ ] indexMatchPaths = pathCollector . getPaths ( ) ; if ( indexMatchPaths != null ) { pathCollector = null ; int indexMatchLength = indexMatchPaths . length ; SearchDocument [ ] indexMatches = new SearchDocument [ indexMatchLength ] ; for ( int j = <NUM_LIT:0> ; j < indexMatchLength ; j ++ ) { indexMatches [ j ] = participant . getDocument ( indexMatchPaths [ j ] ) ; } SearchDocument [ ] matches = MatchLocator . addWorkingCopies ( pattern , indexMatches , getWorkingCopies ( ) , participant ) ; participant . locateMatches ( matches , pattern , scope , requestor , monitor == null ? null : new SubProgressMonitor ( monitor , <NUM_LIT> ) ) ; } } finally { requestor . exitParticipant ( participant ) ; participant . doneSearching ( ) ; } } } finally { requestor . endReporting ( ) ; if ( monitor != null ) monitor . done ( ) ; } } public static SearchParticipant getDefaultSearchParticipant ( ) { return new JavaSearchParticipant ( ) ; } public static String getMatchRuleString ( final int matchRule ) { if ( matchRule == <NUM_LIT:0> ) { return "<STR_LIT>" ; } StringBuffer buffer = new StringBuffer ( ) ; for ( int i = <NUM_LIT:1> ; i <= <NUM_LIT:16> ; i ++ ) { int bit = matchRule & ( <NUM_LIT:1> << ( i - <NUM_LIT:1> ) ) ; if ( bit != <NUM_LIT:0> && buffer . length ( ) > <NUM_LIT:0> ) buffer . append ( "<STR_LIT>" ) ; switch ( bit ) { case SearchPattern . R_PREFIX_MATCH : buffer . append ( "<STR_LIT>" ) ; break ; case SearchPattern . R_CASE_SENSITIVE : buffer . append ( "<STR_LIT>" ) ; break ; case SearchPattern . R_EQUIVALENT_MATCH : buffer . append ( "<STR_LIT>" ) ; break ; case SearchPattern . R_ERASURE_MATCH : buffer . append ( "<STR_LIT>" ) ; break ; case SearchPattern . R_FULL_MATCH : buffer . append ( "<STR_LIT>" ) ; break ; case SearchPattern . R_PATTERN_MATCH : buffer . append ( "<STR_LIT>" ) ; break ; case SearchPattern . R_REGEXP_MATCH : buffer . append ( "<STR_LIT>" ) ; break ; case SearchPattern . R_CAMELCASE_MATCH : buffer . append ( "<STR_LIT>" ) ; break ; case SearchPattern . R_CAMELCASE_SAME_PART_COUNT_MATCH : buffer . append ( "<STR_LIT>" ) ; break ; } } return buffer . toString ( ) ; } public static String getSearchForString ( final int searchFor ) { switch ( searchFor ) { case IJavaSearchConstants . TYPE : return ( "<STR_LIT>" ) ; case IJavaSearchConstants . METHOD : return ( "<STR_LIT>" ) ; case IJavaSearchConstants . PACKAGE : return ( "<STR_LIT>" ) ; case IJavaSearchConstants . CONSTRUCTOR : return ( "<STR_LIT>" ) ; case IJavaSearchConstants . FIELD : return ( "<STR_LIT>" ) ; case IJavaSearchConstants . CLASS : return ( "<STR_LIT>" ) ; case IJavaSearchConstants . INTERFACE : return ( "<STR_LIT>" ) ; case IJavaSearchConstants . ENUM : return ( "<STR_LIT>" ) ; case IJavaSearchConstants . ANNOTATION_TYPE : return ( "<STR_LIT>" ) ; case IJavaSearchConstants . CLASS_AND_ENUM : return ( "<STR_LIT>" ) ; case IJavaSearchConstants . CLASS_AND_INTERFACE : return ( "<STR_LIT>" ) ; case IJavaSearchConstants . INTERFACE_AND_ANNOTATION : return ( "<STR_LIT>" ) ; } return "<STR_LIT>" ; } private Parser getParser ( ) { if ( this . parser == null ) { this . compilerOptions = new CompilerOptions ( JavaCore . getOptions ( ) ) ; ProblemReporter problemReporter = new ProblemReporter ( DefaultErrorHandlingPolicies . proceedWithAllProblems ( ) , this . compilerOptions , new DefaultProblemFactory ( ) ) ; this . parser = new Parser ( problemReporter , true ) ; } return this . parser ; } private ICompilationUnit [ ] getWorkingCopies ( ) { ICompilationUnit [ ] copies ; if ( this . workingCopies != null ) { if ( this . workingCopyOwner == null ) { copies = JavaModelManager . getJavaModelManager ( ) . getWorkingCopies ( DefaultWorkingCopyOwner . PRIMARY , false ) ; if ( copies == null ) { copies = this . workingCopies ; } else { HashMap pathToCUs = new HashMap ( ) ; for ( int i = <NUM_LIT:0> , length = copies . length ; i < length ; i ++ ) { ICompilationUnit unit = copies [ i ] ; pathToCUs . put ( unit . getPath ( ) , unit ) ; } for ( int i = <NUM_LIT:0> , length = this . workingCopies . length ; i < length ; i ++ ) { ICompilationUnit unit = this . workingCopies [ i ] ; pathToCUs . put ( unit . getPath ( ) , unit ) ; } int length = pathToCUs . size ( ) ; copies = new ICompilationUnit [ length ] ; pathToCUs . values ( ) . toArray ( copies ) ; } } else { copies = this . workingCopies ; } } else if ( this . workingCopyOwner != null ) { copies = JavaModelManager . getJavaModelManager ( ) . getWorkingCopies ( this . workingCopyOwner , true ) ; } else { copies = JavaModelManager . getJavaModelManager ( ) . getWorkingCopies ( DefaultWorkingCopyOwner . PRIMARY , false ) ; } if ( copies == null ) return null ; ICompilationUnit [ ] result = null ; int length = copies . length ; int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { CompilationUnit copy = ( CompilationUnit ) copies [ i ] ; try { if ( ! copy . isPrimary ( ) || copy . hasUnsavedChanges ( ) || copy . hasResourceChanged ( ) ) { if ( result == null ) { result = new ICompilationUnit [ length ] ; } result [ index ++ ] = copy ; } } catch ( JavaModelException e ) { } } if ( index != length && result != null ) { System . arraycopy ( result , <NUM_LIT:0> , result = new ICompilationUnit [ index ] , <NUM_LIT:0> , index ) ; } return result ; } private ICompilationUnit [ ] getWorkingCopies ( IJavaElement element ) { if ( element instanceof IMember ) { ICompilationUnit cu = ( ( IMember ) element ) . getCompilationUnit ( ) ; if ( cu != null && cu . isWorkingCopy ( ) ) { return new ICompilationUnit [ ] { cu } ; } } else if ( element instanceof ICompilationUnit ) { return new ICompilationUnit [ ] { ( ICompilationUnit ) element } ; } return null ; } boolean match ( char patternTypeSuffix , int modifiers ) { switch ( patternTypeSuffix ) { case IIndexConstants . CLASS_SUFFIX : return ( modifiers & ( Flags . AccAnnotation | Flags . AccInterface | Flags . AccEnum ) ) == <NUM_LIT:0> ; case IIndexConstants . CLASS_AND_INTERFACE_SUFFIX : return ( modifiers & ( Flags . AccAnnotation | Flags . AccEnum ) ) == <NUM_LIT:0> ; case IIndexConstants . CLASS_AND_ENUM_SUFFIX : return ( modifiers & ( Flags . AccAnnotation | Flags . AccInterface ) ) == <NUM_LIT:0> ; case IIndexConstants . INTERFACE_SUFFIX : return ( modifiers & Flags . AccInterface ) != <NUM_LIT:0> ; case IIndexConstants . INTERFACE_AND_ANNOTATION_SUFFIX : return ( modifiers & ( Flags . AccInterface | Flags . AccAnnotation ) ) != <NUM_LIT:0> ; case IIndexConstants . ENUM_SUFFIX : return ( modifiers & Flags . AccEnum ) != <NUM_LIT:0> ; case IIndexConstants . ANNOTATION_TYPE_SUFFIX : return ( modifiers & Flags . AccAnnotation ) != <NUM_LIT:0> ; } return true ; } boolean match ( char patternTypeSuffix , char [ ] patternPkg , int matchRulePkg , char [ ] patternTypeName , int matchRuleType , int typeKind , char [ ] pkg , char [ ] typeName ) { switch ( patternTypeSuffix ) { case IIndexConstants . CLASS_SUFFIX : if ( typeKind != TypeDeclaration . CLASS_DECL ) return false ; break ; case IIndexConstants . CLASS_AND_INTERFACE_SUFFIX : if ( typeKind != TypeDeclaration . CLASS_DECL && typeKind != TypeDeclaration . INTERFACE_DECL ) return false ; break ; case IIndexConstants . CLASS_AND_ENUM_SUFFIX : if ( typeKind != TypeDeclaration . CLASS_DECL && typeKind != TypeDeclaration . ENUM_DECL ) return false ; break ; case IIndexConstants . INTERFACE_SUFFIX : if ( typeKind != TypeDeclaration . INTERFACE_DECL ) return false ; break ; case IIndexConstants . INTERFACE_AND_ANNOTATION_SUFFIX : if ( typeKind != TypeDeclaration . INTERFACE_DECL && typeKind != TypeDeclaration . ANNOTATION_TYPE_DECL ) return false ; break ; case IIndexConstants . ENUM_SUFFIX : if ( typeKind != TypeDeclaration . ENUM_DECL ) return false ; break ; case IIndexConstants . ANNOTATION_TYPE_SUFFIX : if ( typeKind != TypeDeclaration . ANNOTATION_TYPE_DECL ) return false ; break ; case IIndexConstants . TYPE_SUFFIX : } boolean isPkgCaseSensitive = ( matchRulePkg & SearchPattern . R_CASE_SENSITIVE ) != <NUM_LIT:0> ; if ( patternPkg != null && ! CharOperation . equals ( patternPkg , pkg , isPkgCaseSensitive ) ) return false ; boolean isCaseSensitive = ( matchRuleType & SearchPattern . R_CASE_SENSITIVE ) != <NUM_LIT:0> ; if ( patternTypeName != null ) { boolean isCamelCase = ( matchRuleType & ( SearchPattern . R_CAMELCASE_MATCH | SearchPattern . R_CAMELCASE_SAME_PART_COUNT_MATCH ) ) != <NUM_LIT:0> ; int matchMode = matchRuleType & JavaSearchPattern . MATCH_MODE_MASK ; if ( ! isCaseSensitive && ! isCamelCase ) { patternTypeName = CharOperation . toLowerCase ( patternTypeName ) ; } boolean matchFirstChar = ! isCaseSensitive || patternTypeName [ <NUM_LIT:0> ] == typeName [ <NUM_LIT:0> ] ; switch ( matchMode ) { case SearchPattern . R_EXACT_MATCH : return matchFirstChar && CharOperation . equals ( patternTypeName , typeName , isCaseSensitive ) ; case SearchPattern . R_PREFIX_MATCH : return matchFirstChar && CharOperation . prefixEquals ( patternTypeName , typeName , isCaseSensitive ) ; case SearchPattern . R_PATTERN_MATCH : return CharOperation . match ( patternTypeName , typeName , isCaseSensitive ) ; case SearchPattern . R_REGEXP_MATCH : break ; case SearchPattern . R_CAMELCASE_MATCH : if ( matchFirstChar && CharOperation . camelCaseMatch ( patternTypeName , typeName , false ) ) { return true ; } return ! isCaseSensitive && matchFirstChar && CharOperation . prefixEquals ( patternTypeName , typeName , false ) ; case SearchPattern . R_CAMELCASE_SAME_PART_COUNT_MATCH : return matchFirstChar && CharOperation . camelCaseMatch ( patternTypeName , typeName , true ) ; } } return true ; } public void search ( SearchPattern pattern , SearchParticipant [ ] participants , IJavaSearchScope scope , SearchRequestor requestor , IProgressMonitor monitor ) throws CoreException { if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" ) ; } findMatches ( pattern , participants , scope , requestor , monitor ) ; } public void searchAllConstructorDeclarations ( final char [ ] packageName , final char [ ] typeName , final int typeMatchRule , IJavaSearchScope scope , final IRestrictedAccessConstructorRequestor nameRequestor , int waitingPolicy , IProgressMonitor progressMonitor ) throws JavaModelException { final int validatedTypeMatchRule = SearchPattern . validateMatchRule ( typeName == null ? null : new String ( typeName ) , typeMatchRule ) ; final int pkgMatchRule = SearchPattern . R_EXACT_MATCH | SearchPattern . R_CASE_SENSITIVE ; final char NoSuffix = IIndexConstants . TYPE_SUFFIX ; if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" ) ; Util . verbose ( "<STR_LIT>" + ( packageName == null ? "<STR_LIT:null>" : new String ( packageName ) ) ) ; Util . verbose ( "<STR_LIT>" + ( typeName == null ? "<STR_LIT:null>" : new String ( typeName ) ) ) ; Util . verbose ( "<STR_LIT>" + getMatchRuleString ( typeMatchRule ) ) ; if ( validatedTypeMatchRule != typeMatchRule ) { Util . verbose ( "<STR_LIT>" + getMatchRuleString ( validatedTypeMatchRule ) ) ; } Util . verbose ( "<STR_LIT>" + scope ) ; } if ( validatedTypeMatchRule == - <NUM_LIT:1> ) return ; IndexManager indexManager = JavaModelManager . getIndexManager ( ) ; final ConstructorDeclarationPattern pattern = new ConstructorDeclarationPattern ( packageName , typeName , validatedTypeMatchRule ) ; final HashSet workingCopyPaths = new HashSet ( ) ; String workingCopyPath = null ; ICompilationUnit [ ] copies = getWorkingCopies ( ) ; final int copiesLength = copies == null ? <NUM_LIT:0> : copies . length ; if ( copies != null ) { if ( copiesLength == <NUM_LIT:1> ) { workingCopyPath = copies [ <NUM_LIT:0> ] . getPath ( ) . toString ( ) ; } else { for ( int i = <NUM_LIT:0> ; i < copiesLength ; i ++ ) { ICompilationUnit workingCopy = copies [ i ] ; workingCopyPaths . add ( workingCopy . getPath ( ) . toString ( ) ) ; } } } final String singleWkcpPath = workingCopyPath ; IndexQueryRequestor searchRequestor = new IndexQueryRequestor ( ) { public boolean acceptIndexMatch ( String documentPath , SearchPattern indexRecord , SearchParticipant participant , AccessRuleSet access ) { ConstructorDeclarationPattern record = ( ConstructorDeclarationPattern ) indexRecord ; if ( ( record . extraFlags & ExtraFlags . IsMemberType ) != <NUM_LIT:0> ) { return true ; } if ( ( record . extraFlags & ExtraFlags . IsLocalType ) != <NUM_LIT:0> ) { return true ; } switch ( copiesLength ) { case <NUM_LIT:0> : break ; case <NUM_LIT:1> : if ( singleWkcpPath . equals ( documentPath ) ) { return true ; } break ; default : if ( workingCopyPaths . contains ( documentPath ) ) { return true ; } break ; } AccessRestriction accessRestriction = null ; if ( access != null ) { int pkgLength = ( record . declaringPackageName == null || record . declaringPackageName . length == <NUM_LIT:0> ) ? <NUM_LIT:0> : record . declaringPackageName . length + <NUM_LIT:1> ; int nameLength = record . declaringSimpleName == null ? <NUM_LIT:0> : record . declaringSimpleName . length ; char [ ] path = new char [ pkgLength + nameLength ] ; int pos = <NUM_LIT:0> ; if ( pkgLength > <NUM_LIT:0> ) { System . arraycopy ( record . declaringPackageName , <NUM_LIT:0> , path , pos , pkgLength - <NUM_LIT:1> ) ; CharOperation . replace ( path , '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) ; path [ pkgLength - <NUM_LIT:1> ] = '<CHAR_LIT:/>' ; pos += pkgLength ; } if ( nameLength > <NUM_LIT:0> ) { System . arraycopy ( record . declaringSimpleName , <NUM_LIT:0> , path , pos , nameLength ) ; pos += nameLength ; } if ( pos > <NUM_LIT:0> ) { accessRestriction = access . getViolatedRestriction ( path ) ; } } nameRequestor . acceptConstructor ( record . modifiers , record . declaringSimpleName , record . parameterCount , record . signature , record . parameterTypes , record . parameterNames , record . declaringTypeModifiers , record . declaringPackageName , record . extraFlags , documentPath , accessRestriction ) ; return true ; } } ; try { if ( progressMonitor != null ) { progressMonitor . beginTask ( Messages . engine_searching , <NUM_LIT:1000> ) ; } indexManager . performConcurrentJob ( new PatternSearchJob ( pattern , getDefaultSearchParticipant ( ) , scope , searchRequestor ) , waitingPolicy , progressMonitor == null ? null : new SubProgressMonitor ( progressMonitor , <NUM_LIT:1000> - copiesLength ) ) ; if ( copies != null ) { for ( int i = <NUM_LIT:0> ; i < copiesLength ; i ++ ) { final ICompilationUnit workingCopy = copies [ i ] ; if ( scope instanceof HierarchyScope ) { if ( ! ( ( HierarchyScope ) scope ) . encloses ( workingCopy , progressMonitor ) ) continue ; } else { if ( ! scope . encloses ( workingCopy ) ) continue ; } final String path = workingCopy . getPath ( ) . toString ( ) ; if ( workingCopy . isConsistent ( ) ) { IPackageDeclaration [ ] packageDeclarations = workingCopy . getPackageDeclarations ( ) ; char [ ] packageDeclaration = packageDeclarations . length == <NUM_LIT:0> ? CharOperation . NO_CHAR : packageDeclarations [ <NUM_LIT:0> ] . getElementName ( ) . toCharArray ( ) ; IType [ ] allTypes = workingCopy . getAllTypes ( ) ; for ( int j = <NUM_LIT:0> , allTypesLength = allTypes . length ; j < allTypesLength ; j ++ ) { IType type = allTypes [ j ] ; char [ ] simpleName = type . getElementName ( ) . toCharArray ( ) ; if ( match ( NoSuffix , packageName , pkgMatchRule , typeName , validatedTypeMatchRule , <NUM_LIT:0> , packageDeclaration , simpleName ) && ! type . isMember ( ) ) { int extraFlags = ExtraFlags . getExtraFlags ( type ) ; boolean hasConstructor = false ; IMethod [ ] methods = type . getMethods ( ) ; for ( int k = <NUM_LIT:0> ; k < methods . length ; k ++ ) { IMethod method = methods [ k ] ; if ( method . isConstructor ( ) ) { hasConstructor = true ; String [ ] stringParameterNames = method . getParameterNames ( ) ; String [ ] stringParameterTypes = method . getParameterTypes ( ) ; int length = stringParameterNames . length ; char [ ] [ ] parameterNames = new char [ length ] [ ] ; char [ ] [ ] parameterTypes = new char [ length ] [ ] ; for ( int l = <NUM_LIT:0> ; l < length ; l ++ ) { parameterNames [ l ] = stringParameterNames [ l ] . toCharArray ( ) ; parameterTypes [ l ] = Signature . toCharArray ( Signature . getTypeErasure ( stringParameterTypes [ l ] ) . toCharArray ( ) ) ; } nameRequestor . acceptConstructor ( method . getFlags ( ) , simpleName , parameterNames . length , null , parameterTypes , parameterNames , type . getFlags ( ) , packageDeclaration , extraFlags , path , null ) ; } } if ( ! hasConstructor ) { nameRequestor . acceptConstructor ( Flags . AccPublic , simpleName , - <NUM_LIT:1> , null , CharOperation . NO_CHAR_CHAR , CharOperation . NO_CHAR_CHAR , type . getFlags ( ) , packageDeclaration , extraFlags , path , null ) ; } } } } else { Parser basicParser = getParser ( ) ; org . eclipse . jdt . internal . compiler . env . ICompilationUnit unit = ( org . eclipse . jdt . internal . compiler . env . ICompilationUnit ) workingCopy ; CompilationResult compilationUnitResult = new CompilationResult ( unit , <NUM_LIT:0> , <NUM_LIT:0> , this . compilerOptions . maxProblemsPerUnit ) ; CompilationUnitDeclaration parsedUnit = basicParser . dietParse ( unit , compilationUnitResult ) ; if ( parsedUnit != null ) { final char [ ] packageDeclaration = parsedUnit . currentPackage == null ? CharOperation . NO_CHAR : CharOperation . concatWith ( parsedUnit . currentPackage . getImportName ( ) , '<CHAR_LIT:.>' ) ; class AllConstructorDeclarationsVisitor extends ASTVisitor { private TypeDeclaration [ ] declaringTypes = new TypeDeclaration [ <NUM_LIT:0> ] ; private int declaringTypesPtr = - <NUM_LIT:1> ; private void endVisit ( TypeDeclaration typeDeclaration ) { if ( ! hasConstructor ( typeDeclaration ) && typeDeclaration . enclosingType == null ) { if ( match ( NoSuffix , packageName , pkgMatchRule , typeName , validatedTypeMatchRule , <NUM_LIT:0> , packageDeclaration , typeDeclaration . name ) ) { nameRequestor . acceptConstructor ( Flags . AccPublic , typeName , - <NUM_LIT:1> , null , CharOperation . NO_CHAR_CHAR , CharOperation . NO_CHAR_CHAR , typeDeclaration . modifiers , packageDeclaration , ExtraFlags . getExtraFlags ( typeDeclaration ) , path , null ) ; } } this . declaringTypes [ this . declaringTypesPtr ] = null ; this . declaringTypesPtr -- ; } public void endVisit ( TypeDeclaration typeDeclaration , CompilationUnitScope s ) { endVisit ( typeDeclaration ) ; } public void endVisit ( TypeDeclaration memberTypeDeclaration , ClassScope s ) { endVisit ( memberTypeDeclaration ) ; } private boolean hasConstructor ( TypeDeclaration typeDeclaration ) { AbstractMethodDeclaration [ ] methods = typeDeclaration . methods ; int length = methods == null ? <NUM_LIT:0> : methods . length ; for ( int j = <NUM_LIT:0> ; j < length ; j ++ ) { if ( methods [ j ] . isConstructor ( ) ) { return true ; } } return false ; } public boolean visit ( ConstructorDeclaration constructorDeclaration , ClassScope classScope ) { TypeDeclaration typeDeclaration = this . declaringTypes [ this . declaringTypesPtr ] ; if ( match ( NoSuffix , packageName , pkgMatchRule , typeName , validatedTypeMatchRule , <NUM_LIT:0> , packageDeclaration , typeDeclaration . name ) ) { Argument [ ] arguments = constructorDeclaration . arguments ; int length = arguments == null ? <NUM_LIT:0> : arguments . length ; char [ ] [ ] parameterNames = new char [ length ] [ ] ; char [ ] [ ] parameterTypes = new char [ length ] [ ] ; for ( int l = <NUM_LIT:0> ; l < length ; l ++ ) { Argument argument = arguments [ l ] ; parameterNames [ l ] = argument . name ; if ( argument . type instanceof SingleTypeReference ) { parameterTypes [ l ] = ( ( SingleTypeReference ) argument . type ) . token ; } else { parameterTypes [ l ] = CharOperation . concatWith ( ( ( QualifiedTypeReference ) argument . type ) . tokens , '<CHAR_LIT:.>' ) ; } } TypeDeclaration enclosing = typeDeclaration . enclosingType ; char [ ] [ ] enclosingTypeNames = CharOperation . NO_CHAR_CHAR ; while ( enclosing != null ) { enclosingTypeNames = CharOperation . arrayConcat ( new char [ ] [ ] { enclosing . name } , enclosingTypeNames ) ; if ( ( enclosing . bits & ASTNode . IsMemberType ) != <NUM_LIT:0> ) { enclosing = enclosing . enclosingType ; } else { enclosing = null ; } } nameRequestor . acceptConstructor ( constructorDeclaration . modifiers , typeName , parameterNames . length , null , parameterTypes , parameterNames , typeDeclaration . modifiers , packageDeclaration , ExtraFlags . getExtraFlags ( typeDeclaration ) , path , null ) ; } return false ; } public boolean visit ( TypeDeclaration typeDeclaration , BlockScope blockScope ) { return false ; } private boolean visit ( TypeDeclaration typeDeclaration ) { if ( this . declaringTypes . length <= ++ this . declaringTypesPtr ) { int length = this . declaringTypesPtr ; System . arraycopy ( this . declaringTypes , <NUM_LIT:0> , this . declaringTypes = new TypeDeclaration [ length * <NUM_LIT:2> + <NUM_LIT:1> ] , <NUM_LIT:0> , length ) ; } this . declaringTypes [ this . declaringTypesPtr ] = typeDeclaration ; return true ; } public boolean visit ( TypeDeclaration typeDeclaration , CompilationUnitScope s ) { return visit ( typeDeclaration ) ; } public boolean visit ( TypeDeclaration memberTypeDeclaration , ClassScope s ) { return visit ( memberTypeDeclaration ) ; } } parsedUnit . traverse ( new AllConstructorDeclarationsVisitor ( ) , parsedUnit . scope ) ; } } if ( progressMonitor != null ) { if ( progressMonitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; progressMonitor . worked ( <NUM_LIT:1> ) ; } } } } finally { if ( progressMonitor != null ) { progressMonitor . done ( ) ; } } } public void searchAllSecondaryTypeNames ( IPackageFragmentRoot [ ] sourceFolders , final IRestrictedAccessTypeRequestor nameRequestor , boolean waitForIndexes , IProgressMonitor progressMonitor ) throws JavaModelException { if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" ) ; StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; int length = sourceFolders . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( i == <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT:[>' ) ; } else { buffer . append ( '<CHAR_LIT:U+002C>' ) ; } buffer . append ( sourceFolders [ i ] . getElementName ( ) ) ; } buffer . append ( "<STR_LIT>" ) ; buffer . append ( waitForIndexes ) ; Util . verbose ( buffer . toString ( ) ) ; } IndexManager indexManager = JavaModelManager . getIndexManager ( ) ; final TypeDeclarationPattern pattern = new SecondaryTypeDeclarationPattern ( ) ; final HashSet workingCopyPaths = new HashSet ( ) ; String workingCopyPath = null ; ICompilationUnit [ ] copies = getWorkingCopies ( ) ; final int copiesLength = copies == null ? <NUM_LIT:0> : copies . length ; if ( copies != null ) { if ( copiesLength == <NUM_LIT:1> ) { workingCopyPath = copies [ <NUM_LIT:0> ] . getPath ( ) . toString ( ) ; } else { for ( int i = <NUM_LIT:0> ; i < copiesLength ; i ++ ) { ICompilationUnit workingCopy = copies [ i ] ; workingCopyPaths . add ( workingCopy . getPath ( ) . toString ( ) ) ; } } } final String singleWkcpPath = workingCopyPath ; IndexQueryRequestor searchRequestor = new IndexQueryRequestor ( ) { public boolean acceptIndexMatch ( String documentPath , SearchPattern indexRecord , SearchParticipant participant , AccessRuleSet access ) { TypeDeclarationPattern record = ( TypeDeclarationPattern ) indexRecord ; if ( ! record . secondary ) { return true ; } if ( record . enclosingTypeNames == IIndexConstants . ONE_ZERO_CHAR ) { return true ; } switch ( copiesLength ) { case <NUM_LIT:0> : break ; case <NUM_LIT:1> : if ( singleWkcpPath . equals ( documentPath ) ) { return true ; } break ; default : if ( workingCopyPaths . contains ( documentPath ) ) { return true ; } break ; } AccessRestriction accessRestriction = null ; if ( access != null ) { int pkgLength = ( record . pkg == null || record . pkg . length == <NUM_LIT:0> ) ? <NUM_LIT:0> : record . pkg . length + <NUM_LIT:1> ; int nameLength = record . simpleName == null ? <NUM_LIT:0> : record . simpleName . length ; char [ ] path = new char [ pkgLength + nameLength ] ; int pos = <NUM_LIT:0> ; if ( pkgLength > <NUM_LIT:0> ) { System . arraycopy ( record . pkg , <NUM_LIT:0> , path , pos , pkgLength - <NUM_LIT:1> ) ; CharOperation . replace ( path , '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) ; path [ pkgLength - <NUM_LIT:1> ] = '<CHAR_LIT:/>' ; pos += pkgLength ; } if ( nameLength > <NUM_LIT:0> ) { System . arraycopy ( record . simpleName , <NUM_LIT:0> , path , pos , nameLength ) ; pos += nameLength ; } if ( pos > <NUM_LIT:0> ) { accessRestriction = access . getViolatedRestriction ( path ) ; } } nameRequestor . acceptType ( record . modifiers , record . pkg , record . simpleName , record . enclosingTypeNames , documentPath , accessRestriction ) ; return true ; } } ; try { if ( progressMonitor != null ) { progressMonitor . beginTask ( Messages . engine_searching , <NUM_LIT:100> ) ; } indexManager . performConcurrentJob ( new PatternSearchJob ( pattern , getDefaultSearchParticipant ( ) , createJavaSearchScope ( sourceFolders ) , searchRequestor ) , waitForIndexes ? IJavaSearchConstants . WAIT_UNTIL_READY_TO_SEARCH : IJavaSearchConstants . FORCE_IMMEDIATE_SEARCH , progressMonitor == null ? null : new SubProgressMonitor ( progressMonitor , <NUM_LIT:100> ) ) ; } catch ( OperationCanceledException oce ) { } finally { if ( progressMonitor != null ) { progressMonitor . done ( ) ; } } } public void searchAllTypeNames ( final char [ ] packageName , final int packageMatchRule , final char [ ] typeName , final int typeMatchRule , int searchFor , IJavaSearchScope scope , final IRestrictedAccessTypeRequestor nameRequestor , int waitingPolicy , IProgressMonitor progressMonitor ) throws JavaModelException { final int validatedTypeMatchRule = SearchPattern . validateMatchRule ( typeName == null ? null : new String ( typeName ) , typeMatchRule ) ; if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" ) ; Util . verbose ( "<STR_LIT>" + ( packageName == null ? "<STR_LIT:null>" : new String ( packageName ) ) ) ; Util . verbose ( "<STR_LIT>" + getMatchRuleString ( packageMatchRule ) ) ; Util . verbose ( "<STR_LIT>" + ( typeName == null ? "<STR_LIT:null>" : new String ( typeName ) ) ) ; Util . verbose ( "<STR_LIT>" + getMatchRuleString ( typeMatchRule ) ) ; if ( validatedTypeMatchRule != typeMatchRule ) { Util . verbose ( "<STR_LIT>" + getMatchRuleString ( validatedTypeMatchRule ) ) ; } Util . verbose ( "<STR_LIT>" + searchFor ) ; Util . verbose ( "<STR_LIT>" + scope ) ; } if ( validatedTypeMatchRule == - <NUM_LIT:1> ) return ; IndexManager indexManager = JavaModelManager . getIndexManager ( ) ; final char typeSuffix ; switch ( searchFor ) { case IJavaSearchConstants . CLASS : typeSuffix = IIndexConstants . CLASS_SUFFIX ; break ; case IJavaSearchConstants . CLASS_AND_INTERFACE : typeSuffix = IIndexConstants . CLASS_AND_INTERFACE_SUFFIX ; break ; case IJavaSearchConstants . CLASS_AND_ENUM : typeSuffix = IIndexConstants . CLASS_AND_ENUM_SUFFIX ; break ; case IJavaSearchConstants . INTERFACE : typeSuffix = IIndexConstants . INTERFACE_SUFFIX ; break ; case IJavaSearchConstants . INTERFACE_AND_ANNOTATION : typeSuffix = IIndexConstants . INTERFACE_AND_ANNOTATION_SUFFIX ; break ; case IJavaSearchConstants . ENUM : typeSuffix = IIndexConstants . ENUM_SUFFIX ; break ; case IJavaSearchConstants . ANNOTATION_TYPE : typeSuffix = IIndexConstants . ANNOTATION_TYPE_SUFFIX ; break ; default : typeSuffix = IIndexConstants . TYPE_SUFFIX ; break ; } final TypeDeclarationPattern pattern = packageMatchRule == SearchPattern . R_EXACT_MATCH ? new TypeDeclarationPattern ( packageName , null , typeName , typeSuffix , validatedTypeMatchRule ) : new QualifiedTypeDeclarationPattern ( packageName , packageMatchRule , typeName , typeSuffix , validatedTypeMatchRule ) ; final HashSet workingCopyPaths = new HashSet ( ) ; String workingCopyPath = null ; ICompilationUnit [ ] copies = getWorkingCopies ( ) ; final int copiesLength = copies == null ? <NUM_LIT:0> : copies . length ; if ( copies != null ) { if ( copiesLength == <NUM_LIT:1> ) { workingCopyPath = copies [ <NUM_LIT:0> ] . getPath ( ) . toString ( ) ; } else { for ( int i = <NUM_LIT:0> ; i < copiesLength ; i ++ ) { ICompilationUnit workingCopy = copies [ i ] ; workingCopyPaths . add ( workingCopy . getPath ( ) . toString ( ) ) ; } } } final String singleWkcpPath = workingCopyPath ; IndexQueryRequestor searchRequestor = new IndexQueryRequestor ( ) { public boolean acceptIndexMatch ( String documentPath , SearchPattern indexRecord , SearchParticipant participant , AccessRuleSet access ) { TypeDeclarationPattern record = ( TypeDeclarationPattern ) indexRecord ; if ( record . enclosingTypeNames == IIndexConstants . ONE_ZERO_CHAR ) { return true ; } switch ( copiesLength ) { case <NUM_LIT:0> : break ; case <NUM_LIT:1> : if ( singleWkcpPath . equals ( documentPath ) ) { return true ; } break ; default : if ( workingCopyPaths . contains ( documentPath ) ) { return true ; } break ; } AccessRestriction accessRestriction = null ; if ( access != null ) { int pkgLength = ( record . pkg == null || record . pkg . length == <NUM_LIT:0> ) ? <NUM_LIT:0> : record . pkg . length + <NUM_LIT:1> ; int nameLength = record . simpleName == null ? <NUM_LIT:0> : record . simpleName . length ; char [ ] path = new char [ pkgLength + nameLength ] ; int pos = <NUM_LIT:0> ; if ( pkgLength > <NUM_LIT:0> ) { System . arraycopy ( record . pkg , <NUM_LIT:0> , path , pos , pkgLength - <NUM_LIT:1> ) ; CharOperation . replace ( path , '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) ; path [ pkgLength - <NUM_LIT:1> ] = '<CHAR_LIT:/>' ; pos += pkgLength ; } if ( nameLength > <NUM_LIT:0> ) { System . arraycopy ( record . simpleName , <NUM_LIT:0> , path , pos , nameLength ) ; pos += nameLength ; } if ( pos > <NUM_LIT:0> ) { accessRestriction = access . getViolatedRestriction ( path ) ; } } if ( match ( record . typeSuffix , record . modifiers ) ) { nameRequestor . acceptType ( record . modifiers , record . pkg , record . simpleName , record . enclosingTypeNames , documentPath , accessRestriction ) ; } return true ; } } ; try { if ( progressMonitor != null ) { progressMonitor . beginTask ( Messages . engine_searching , <NUM_LIT:1000> ) ; } indexManager . performConcurrentJob ( new PatternSearchJob ( pattern , getDefaultSearchParticipant ( ) , scope , searchRequestor ) , waitingPolicy , progressMonitor == null ? null : new SubProgressMonitor ( progressMonitor , <NUM_LIT:1000> - copiesLength ) ) ; if ( copies != null ) { for ( int i = <NUM_LIT:0> ; i < copiesLength ; i ++ ) { final ICompilationUnit workingCopy = copies [ i ] ; if ( scope instanceof HierarchyScope ) { if ( ! ( ( HierarchyScope ) scope ) . encloses ( workingCopy , progressMonitor ) ) continue ; } else { if ( ! scope . encloses ( workingCopy ) ) continue ; } final String path = workingCopy . getPath ( ) . toString ( ) ; if ( workingCopy . isConsistent ( ) ) { IPackageDeclaration [ ] packageDeclarations = workingCopy . getPackageDeclarations ( ) ; char [ ] packageDeclaration = packageDeclarations . length == <NUM_LIT:0> ? CharOperation . NO_CHAR : packageDeclarations [ <NUM_LIT:0> ] . getElementName ( ) . toCharArray ( ) ; IType [ ] allTypes = workingCopy . getAllTypes ( ) ; for ( int j = <NUM_LIT:0> , allTypesLength = allTypes . length ; j < allTypesLength ; j ++ ) { IType type = allTypes [ j ] ; IJavaElement parent = type . getParent ( ) ; char [ ] [ ] enclosingTypeNames ; if ( parent instanceof IType ) { char [ ] parentQualifiedName = ( ( IType ) parent ) . getTypeQualifiedName ( '<CHAR_LIT:.>' ) . toCharArray ( ) ; enclosingTypeNames = CharOperation . splitOn ( '<CHAR_LIT:.>' , parentQualifiedName ) ; } else { enclosingTypeNames = CharOperation . NO_CHAR_CHAR ; } char [ ] simpleName = type . getElementName ( ) . toCharArray ( ) ; int kind ; if ( type . isEnum ( ) ) { kind = TypeDeclaration . ENUM_DECL ; } else if ( type . isAnnotation ( ) ) { kind = TypeDeclaration . ANNOTATION_TYPE_DECL ; } else if ( type . isClass ( ) ) { kind = TypeDeclaration . CLASS_DECL ; } else { kind = TypeDeclaration . INTERFACE_DECL ; } if ( match ( typeSuffix , packageName , packageMatchRule , typeName , validatedTypeMatchRule , kind , packageDeclaration , simpleName ) ) { if ( nameRequestor instanceof TypeNameMatchRequestorWrapper ) { ( ( TypeNameMatchRequestorWrapper ) nameRequestor ) . requestor . acceptTypeNameMatch ( new JavaSearchTypeNameMatch ( type , type . getFlags ( ) ) ) ; } else { nameRequestor . acceptType ( type . getFlags ( ) , packageDeclaration , simpleName , enclosingTypeNames , path , null ) ; } } } } else { Parser basicParser = getParser ( ) ; org . eclipse . jdt . internal . compiler . env . ICompilationUnit unit = ( org . eclipse . jdt . internal . compiler . env . ICompilationUnit ) workingCopy ; CompilationResult compilationUnitResult = new CompilationResult ( unit , <NUM_LIT:0> , <NUM_LIT:0> , this . compilerOptions . maxProblemsPerUnit ) ; CompilationUnitDeclaration parsedUnit = basicParser . dietParse ( unit , compilationUnitResult ) ; if ( parsedUnit != null ) { final char [ ] packageDeclaration = parsedUnit . currentPackage == null ? CharOperation . NO_CHAR : CharOperation . concatWith ( parsedUnit . currentPackage . getImportName ( ) , '<CHAR_LIT:.>' ) ; class AllTypeDeclarationsVisitor extends ASTVisitor { public boolean visit ( TypeDeclaration typeDeclaration , BlockScope blockScope ) { return false ; } public boolean visit ( TypeDeclaration typeDeclaration , CompilationUnitScope compilationUnitScope ) { if ( match ( typeSuffix , packageName , packageMatchRule , typeName , validatedTypeMatchRule , TypeDeclaration . kind ( typeDeclaration . modifiers ) , packageDeclaration , typeDeclaration . name ) ) { if ( nameRequestor instanceof TypeNameMatchRequestorWrapper ) { IType type = workingCopy . getType ( new String ( typeName ) ) ; ( ( TypeNameMatchRequestorWrapper ) nameRequestor ) . requestor . acceptTypeNameMatch ( new JavaSearchTypeNameMatch ( type , typeDeclaration . modifiers ) ) ; } else { nameRequestor . acceptType ( typeDeclaration . modifiers , packageDeclaration , typeDeclaration . name , CharOperation . NO_CHAR_CHAR , path , null ) ; } } return true ; } public boolean visit ( TypeDeclaration memberTypeDeclaration , ClassScope classScope ) { if ( match ( typeSuffix , packageName , packageMatchRule , typeName , validatedTypeMatchRule , TypeDeclaration . kind ( memberTypeDeclaration . modifiers ) , packageDeclaration , memberTypeDeclaration . name ) ) { TypeDeclaration enclosing = memberTypeDeclaration . enclosingType ; char [ ] [ ] enclosingTypeNames = CharOperation . NO_CHAR_CHAR ; while ( enclosing != null ) { enclosingTypeNames = CharOperation . arrayConcat ( new char [ ] [ ] { enclosing . name } , enclosingTypeNames ) ; if ( ( enclosing . bits & ASTNode . IsMemberType ) != <NUM_LIT:0> ) { enclosing = enclosing . enclosingType ; } else { enclosing = null ; } } if ( nameRequestor instanceof TypeNameMatchRequestorWrapper ) { IType type = workingCopy . getType ( new String ( enclosingTypeNames [ <NUM_LIT:0> ] ) ) ; for ( int j = <NUM_LIT:1> , l = enclosingTypeNames . length ; j < l ; j ++ ) { type = type . getType ( new String ( enclosingTypeNames [ j ] ) ) ; } ( ( TypeNameMatchRequestorWrapper ) nameRequestor ) . requestor . acceptTypeNameMatch ( new JavaSearchTypeNameMatch ( type , <NUM_LIT:0> ) ) ; } else { nameRequestor . acceptType ( memberTypeDeclaration . modifiers , packageDeclaration , memberTypeDeclaration . name , enclosingTypeNames , path , null ) ; } } return true ; } } parsedUnit . traverse ( new AllTypeDeclarationsVisitor ( ) , parsedUnit . scope ) ; } } if ( progressMonitor != null ) { if ( progressMonitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; progressMonitor . worked ( <NUM_LIT:1> ) ; } } } } finally { if ( progressMonitor != null ) { progressMonitor . done ( ) ; } } } public void searchAllTypeNames ( final char [ ] [ ] qualifications , final char [ ] [ ] typeNames , final int matchRule , int searchFor , IJavaSearchScope scope , final IRestrictedAccessTypeRequestor nameRequestor , int waitingPolicy , IProgressMonitor progressMonitor ) throws JavaModelException { if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" ) ; Util . verbose ( "<STR_LIT>" + ( qualifications == null ? "<STR_LIT:null>" : new String ( CharOperation . concatWith ( qualifications , '<CHAR_LIT:U+002C>' ) ) ) ) ; Util . verbose ( "<STR_LIT>" + ( typeNames == null ? "<STR_LIT:null>" : new String ( CharOperation . concatWith ( typeNames , '<CHAR_LIT:U+002C>' ) ) ) ) ; Util . verbose ( "<STR_LIT>" + getMatchRuleString ( matchRule ) ) ; Util . verbose ( "<STR_LIT>" + searchFor ) ; Util . verbose ( "<STR_LIT>" + scope ) ; } IndexManager indexManager = JavaModelManager . getIndexManager ( ) ; final char typeSuffix ; switch ( searchFor ) { case IJavaSearchConstants . CLASS : typeSuffix = IIndexConstants . CLASS_SUFFIX ; break ; case IJavaSearchConstants . CLASS_AND_INTERFACE : typeSuffix = IIndexConstants . CLASS_AND_INTERFACE_SUFFIX ; break ; case IJavaSearchConstants . CLASS_AND_ENUM : typeSuffix = IIndexConstants . CLASS_AND_ENUM_SUFFIX ; break ; case IJavaSearchConstants . INTERFACE : typeSuffix = IIndexConstants . INTERFACE_SUFFIX ; break ; case IJavaSearchConstants . INTERFACE_AND_ANNOTATION : typeSuffix = IIndexConstants . INTERFACE_AND_ANNOTATION_SUFFIX ; break ; case IJavaSearchConstants . ENUM : typeSuffix = IIndexConstants . ENUM_SUFFIX ; break ; case IJavaSearchConstants . ANNOTATION_TYPE : typeSuffix = IIndexConstants . ANNOTATION_TYPE_SUFFIX ; break ; default : typeSuffix = IIndexConstants . TYPE_SUFFIX ; break ; } final MultiTypeDeclarationPattern pattern = new MultiTypeDeclarationPattern ( qualifications , typeNames , typeSuffix , matchRule ) ; final HashSet workingCopyPaths = new HashSet ( ) ; String workingCopyPath = null ; ICompilationUnit [ ] copies = getWorkingCopies ( ) ; final int copiesLength = copies == null ? <NUM_LIT:0> : copies . length ; if ( copies != null ) { if ( copiesLength == <NUM_LIT:1> ) { workingCopyPath = copies [ <NUM_LIT:0> ] . getPath ( ) . toString ( ) ; } else { for ( int i = <NUM_LIT:0> ; i < copiesLength ; i ++ ) { ICompilationUnit workingCopy = copies [ i ] ; workingCopyPaths . add ( workingCopy . getPath ( ) . toString ( ) ) ; } } } final String singleWkcpPath = workingCopyPath ; IndexQueryRequestor searchRequestor = new IndexQueryRequestor ( ) { public boolean acceptIndexMatch ( String documentPath , SearchPattern indexRecord , SearchParticipant participant , AccessRuleSet access ) { QualifiedTypeDeclarationPattern record = ( QualifiedTypeDeclarationPattern ) indexRecord ; if ( record . enclosingTypeNames == IIndexConstants . ONE_ZERO_CHAR ) { return true ; } switch ( copiesLength ) { case <NUM_LIT:0> : break ; case <NUM_LIT:1> : if ( singleWkcpPath . equals ( documentPath ) ) { return true ; } break ; default : if ( workingCopyPaths . contains ( documentPath ) ) { return true ; } break ; } AccessRestriction accessRestriction = null ; if ( access != null ) { int qualificationLength = ( record . qualification == null || record . qualification . length == <NUM_LIT:0> ) ? <NUM_LIT:0> : record . qualification . length + <NUM_LIT:1> ; int nameLength = record . simpleName == null ? <NUM_LIT:0> : record . simpleName . length ; char [ ] path = new char [ qualificationLength + nameLength ] ; int pos = <NUM_LIT:0> ; if ( qualificationLength > <NUM_LIT:0> ) { System . arraycopy ( record . qualification , <NUM_LIT:0> , path , pos , qualificationLength - <NUM_LIT:1> ) ; CharOperation . replace ( path , '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) ; path [ qualificationLength - <NUM_LIT:1> ] = '<CHAR_LIT:/>' ; pos += qualificationLength ; } if ( nameLength > <NUM_LIT:0> ) { System . arraycopy ( record . simpleName , <NUM_LIT:0> , path , pos , nameLength ) ; pos += nameLength ; } if ( pos > <NUM_LIT:0> ) { accessRestriction = access . getViolatedRestriction ( path ) ; } } nameRequestor . acceptType ( record . modifiers , record . pkg , record . simpleName , record . enclosingTypeNames , documentPath , accessRestriction ) ; return true ; } } ; try { if ( progressMonitor != null ) { progressMonitor . beginTask ( Messages . engine_searching , <NUM_LIT:100> ) ; } indexManager . performConcurrentJob ( new PatternSearchJob ( pattern , getDefaultSearchParticipant ( ) , scope , searchRequestor ) , waitingPolicy , progressMonitor == null ? null : new SubProgressMonitor ( progressMonitor , <NUM_LIT:100> ) ) ; if ( copies != null ) { for ( int i = <NUM_LIT:0> , length = copies . length ; i < length ; i ++ ) { ICompilationUnit workingCopy = copies [ i ] ; final String path = workingCopy . getPath ( ) . toString ( ) ; if ( workingCopy . isConsistent ( ) ) { IPackageDeclaration [ ] packageDeclarations = workingCopy . getPackageDeclarations ( ) ; char [ ] packageDeclaration = packageDeclarations . length == <NUM_LIT:0> ? CharOperation . NO_CHAR : packageDeclarations [ <NUM_LIT:0> ] . getElementName ( ) . toCharArray ( ) ; IType [ ] allTypes = workingCopy . getAllTypes ( ) ; for ( int j = <NUM_LIT:0> , allTypesLength = allTypes . length ; j < allTypesLength ; j ++ ) { IType type = allTypes [ j ] ; IJavaElement parent = type . getParent ( ) ; char [ ] [ ] enclosingTypeNames ; char [ ] qualification = packageDeclaration ; if ( parent instanceof IType ) { char [ ] parentQualifiedName = ( ( IType ) parent ) . getTypeQualifiedName ( '<CHAR_LIT:.>' ) . toCharArray ( ) ; enclosingTypeNames = CharOperation . splitOn ( '<CHAR_LIT:.>' , parentQualifiedName ) ; qualification = CharOperation . concat ( qualification , parentQualifiedName ) ; } else { enclosingTypeNames = CharOperation . NO_CHAR_CHAR ; } char [ ] simpleName = type . getElementName ( ) . toCharArray ( ) ; char suffix = IIndexConstants . TYPE_SUFFIX ; if ( type . isClass ( ) ) { suffix = IIndexConstants . CLASS_SUFFIX ; } else if ( type . isInterface ( ) ) { suffix = IIndexConstants . INTERFACE_SUFFIX ; } else if ( type . isEnum ( ) ) { suffix = IIndexConstants . ENUM_SUFFIX ; } else if ( type . isAnnotation ( ) ) { suffix = IIndexConstants . ANNOTATION_TYPE_SUFFIX ; } if ( pattern . matchesDecodedKey ( new QualifiedTypeDeclarationPattern ( qualification , simpleName , suffix , matchRule ) ) ) { nameRequestor . acceptType ( type . getFlags ( ) , packageDeclaration , simpleName , enclosingTypeNames , path , null ) ; } } } else { Parser basicParser = getParser ( ) ; org . eclipse . jdt . internal . compiler . env . ICompilationUnit unit = ( org . eclipse . jdt . internal . compiler . env . ICompilationUnit ) workingCopy ; CompilationResult compilationUnitResult = new CompilationResult ( unit , <NUM_LIT:0> , <NUM_LIT:0> , this . compilerOptions . maxProblemsPerUnit ) ; CompilationUnitDeclaration parsedUnit = basicParser . dietParse ( unit , compilationUnitResult ) ; if ( parsedUnit != null ) { final char [ ] packageDeclaration = parsedUnit . currentPackage == null ? CharOperation . NO_CHAR : CharOperation . concatWith ( parsedUnit . currentPackage . getImportName ( ) , '<CHAR_LIT:.>' ) ; class AllTypeDeclarationsVisitor extends ASTVisitor { public boolean visit ( TypeDeclaration typeDeclaration , BlockScope blockScope ) { return false ; } public boolean visit ( TypeDeclaration typeDeclaration , CompilationUnitScope compilationUnitScope ) { SearchPattern decodedPattern = new QualifiedTypeDeclarationPattern ( packageDeclaration , typeDeclaration . name , convertTypeKind ( TypeDeclaration . kind ( typeDeclaration . modifiers ) ) , matchRule ) ; if ( pattern . matchesDecodedKey ( decodedPattern ) ) { nameRequestor . acceptType ( typeDeclaration . modifiers , packageDeclaration , typeDeclaration . name , CharOperation . NO_CHAR_CHAR , path , null ) ; } return true ; } public boolean visit ( TypeDeclaration memberTypeDeclaration , ClassScope classScope ) { char [ ] qualification = packageDeclaration ; TypeDeclaration enclosing = memberTypeDeclaration . enclosingType ; char [ ] [ ] enclosingTypeNames = CharOperation . NO_CHAR_CHAR ; while ( enclosing != null ) { qualification = CharOperation . concat ( qualification , enclosing . name , '<CHAR_LIT:.>' ) ; enclosingTypeNames = CharOperation . arrayConcat ( new char [ ] [ ] { enclosing . name } , enclosingTypeNames ) ; if ( ( enclosing . bits & ASTNode . IsMemberType ) != <NUM_LIT:0> ) { enclosing = enclosing . enclosingType ; } else { enclosing = null ; } } SearchPattern decodedPattern = new QualifiedTypeDeclarationPattern ( qualification , memberTypeDeclaration . name , convertTypeKind ( TypeDeclaration . kind ( memberTypeDeclaration . modifiers ) ) , matchRule ) ; if ( pattern . matchesDecodedKey ( decodedPattern ) ) { nameRequestor . acceptType ( memberTypeDeclaration . modifiers , packageDeclaration , memberTypeDeclaration . name , enclosingTypeNames , path , null ) ; } return true ; } } parsedUnit . traverse ( new AllTypeDeclarationsVisitor ( ) , parsedUnit . scope ) ; } } } } } finally { if ( progressMonitor != null ) { progressMonitor . done ( ) ; } } } public void searchDeclarations ( IJavaElement enclosingElement , SearchRequestor requestor , SearchPattern pattern , IProgressMonitor monitor ) throws JavaModelException { if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" + enclosingElement ) ; } IJavaSearchScope scope = createJavaSearchScope ( new IJavaElement [ ] { enclosingElement } ) ; IResource resource = ( ( JavaElement ) enclosingElement ) . resource ( ) ; if ( enclosingElement instanceof IMember ) { IMember member = ( IMember ) enclosingElement ; ICompilationUnit cu = member . getCompilationUnit ( ) ; if ( cu != null ) { resource = cu . getResource ( ) ; } else if ( member . isBinary ( ) ) { resource = null ; } } try { if ( resource instanceof IFile ) { try { requestor . beginReporting ( ) ; if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" + pattern + "<STR_LIT>" + resource . getFullPath ( ) ) ; } SearchParticipant participant = getDefaultSearchParticipant ( ) ; SearchDocument [ ] documents = MatchLocator . addWorkingCopies ( pattern , new SearchDocument [ ] { new JavaSearchDocument ( enclosingElement . getPath ( ) . toString ( ) , participant ) } , getWorkingCopies ( enclosingElement ) , participant ) ; participant . locateMatches ( documents , pattern , scope , requestor , monitor ) ; } finally { requestor . endReporting ( ) ; } } else { search ( pattern , new SearchParticipant [ ] { getDefaultSearchParticipant ( ) } , scope , requestor , monitor ) ; } } catch ( CoreException e ) { if ( e instanceof JavaModelException ) throw ( JavaModelException ) e ; throw new JavaModelException ( e ) ; } } public void searchDeclarationsOfAccessedFields ( IJavaElement enclosingElement , SearchRequestor requestor , IProgressMonitor monitor ) throws JavaModelException { if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" ) ; } switch ( enclosingElement . getElementType ( ) ) { case IJavaElement . FIELD : case IJavaElement . METHOD : case IJavaElement . TYPE : case IJavaElement . COMPILATION_UNIT : break ; default : throw new IllegalArgumentException ( ) ; } SearchPattern pattern = new DeclarationOfAccessedFieldsPattern ( enclosingElement ) ; searchDeclarations ( enclosingElement , requestor , pattern , monitor ) ; } public void searchDeclarationsOfReferencedTypes ( IJavaElement enclosingElement , SearchRequestor requestor , IProgressMonitor monitor ) throws JavaModelException { if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" ) ; } switch ( enclosingElement . getElementType ( ) ) { case IJavaElement . FIELD : case IJavaElement . METHOD : case IJavaElement . TYPE : case IJavaElement . COMPILATION_UNIT : break ; default : throw new IllegalArgumentException ( ) ; } SearchPattern pattern = new DeclarationOfReferencedTypesPattern ( enclosingElement ) ; searchDeclarations ( enclosingElement , requestor , pattern , monitor ) ; } public void searchDeclarationsOfSentMessages ( IJavaElement enclosingElement , SearchRequestor requestor , IProgressMonitor monitor ) throws JavaModelException { if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" ) ; } switch ( enclosingElement . getElementType ( ) ) { case IJavaElement . FIELD : case IJavaElement . METHOD : case IJavaElement . TYPE : case IJavaElement . COMPILATION_UNIT : break ; default : throw new IllegalArgumentException ( ) ; } SearchPattern pattern = new DeclarationOfReferencedMethodsPattern ( enclosingElement ) ; searchDeclarations ( enclosingElement , requestor , pattern , monitor ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . search ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . Map ; import org . eclipse . core . resources . IFolder ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . Path ; import org . eclipse . jdt . core . IClasspathContainer ; import org . eclipse . jdt . core . IClasspathEntry ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaElementDelta ; import org . eclipse . jdt . core . IJavaModel ; import org . eclipse . jdt . core . IJavaProject ; import org . eclipse . jdt . core . IMember ; import org . eclipse . jdt . core . IPackageFragmentRoot ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . internal . compiler . env . AccessRuleSet ; import org . eclipse . jdt . internal . core . ClasspathEntry ; import org . eclipse . jdt . internal . core . ExternalFoldersManager ; import org . eclipse . jdt . internal . core . JavaElement ; import org . eclipse . jdt . internal . core . JavaModel ; import org . eclipse . jdt . internal . core . JavaModelManager ; import org . eclipse . jdt . internal . core . JavaProject ; import org . eclipse . jdt . internal . core . PackageFragment ; import org . eclipse . jdt . internal . core . PackageFragmentRoot ; import org . eclipse . jdt . internal . core . util . Util ; public class JavaSearchScope extends AbstractJavaSearchScope { private ArrayList elements ; private ArrayList projectPaths = new ArrayList ( ) ; private int [ ] projectIndexes ; private String [ ] containerPaths ; private String [ ] relativePaths ; private boolean [ ] isPkgPath ; protected AccessRuleSet [ ] pathRestrictions ; private int pathsCount ; private int threshold ; private IPath [ ] enclosingProjectsAndJars ; public final static AccessRuleSet NOT_ENCLOSED = new AccessRuleSet ( null , ( byte ) <NUM_LIT:0> , null ) ; public JavaSearchScope ( ) { this ( <NUM_LIT:5> ) ; } private JavaSearchScope ( int size ) { initialize ( size ) ; } private void addEnclosingProjectOrJar ( IPath path ) { int length = this . enclosingProjectsAndJars . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( this . enclosingProjectsAndJars [ i ] . equals ( path ) ) return ; } System . arraycopy ( this . enclosingProjectsAndJars , <NUM_LIT:0> , this . enclosingProjectsAndJars = new IPath [ length + <NUM_LIT:1> ] , <NUM_LIT:0> , length ) ; this . enclosingProjectsAndJars [ length ] = path ; } public void add ( JavaProject project , int includeMask , HashSet projectsToBeAdded ) throws JavaModelException { add ( project , null , includeMask , projectsToBeAdded , new HashSet ( <NUM_LIT:2> ) , null ) ; } void add ( JavaProject javaProject , IPath pathToAdd , int includeMask , HashSet projectsToBeAdded , HashSet visitedProjects , IClasspathEntry referringEntry ) throws JavaModelException { IProject project = javaProject . getProject ( ) ; if ( ! project . isAccessible ( ) || ! visitedProjects . add ( project ) ) return ; IPath projectPath = project . getFullPath ( ) ; String projectPathString = projectPath . toString ( ) ; addEnclosingProjectOrJar ( projectPath ) ; IClasspathEntry [ ] entries = javaProject . getResolvedClasspath ( ) ; IJavaModel model = javaProject . getJavaModel ( ) ; JavaModelManager . PerProjectInfo perProjectInfo = javaProject . getPerProjectInfo ( ) ; for ( int i = <NUM_LIT:0> , length = entries . length ; i < length ; i ++ ) { IClasspathEntry entry = entries [ i ] ; AccessRuleSet access = null ; ClasspathEntry cpEntry = ( ClasspathEntry ) entry ; if ( referringEntry != null ) { if ( ! entry . isExported ( ) && entry . getEntryKind ( ) != IClasspathEntry . CPE_SOURCE ) { continue ; } cpEntry = cpEntry . combineWith ( ( ClasspathEntry ) referringEntry ) ; } access = cpEntry . getAccessRuleSet ( ) ; switch ( entry . getEntryKind ( ) ) { case IClasspathEntry . CPE_LIBRARY : IClasspathEntry rawEntry = null ; Map rootPathToRawEntries = perProjectInfo . rootPathToRawEntries ; if ( rootPathToRawEntries != null ) { rawEntry = ( IClasspathEntry ) rootPathToRawEntries . get ( entry . getPath ( ) ) ; } if ( rawEntry == null ) break ; rawKind : switch ( rawEntry . getEntryKind ( ) ) { case IClasspathEntry . CPE_LIBRARY : case IClasspathEntry . CPE_VARIABLE : if ( ( includeMask & APPLICATION_LIBRARIES ) != <NUM_LIT:0> ) { IPath path = entry . getPath ( ) ; if ( pathToAdd == null || pathToAdd . equals ( path ) ) { Object target = JavaModel . getTarget ( path , false ) ; if ( target instanceof IFolder ) path = ( ( IFolder ) target ) . getFullPath ( ) ; String pathToString = path . getDevice ( ) == null ? path . toString ( ) : path . toOSString ( ) ; add ( projectPath . toString ( ) , "<STR_LIT>" , pathToString , false , access ) ; addEnclosingProjectOrJar ( entry . getPath ( ) ) ; } } break ; case IClasspathEntry . CPE_CONTAINER : IClasspathContainer container = JavaCore . getClasspathContainer ( rawEntry . getPath ( ) , javaProject ) ; if ( container == null ) break ; switch ( container . getKind ( ) ) { case IClasspathContainer . K_APPLICATION : if ( ( includeMask & APPLICATION_LIBRARIES ) == <NUM_LIT:0> ) break rawKind ; break ; case IClasspathContainer . K_SYSTEM : case IClasspathContainer . K_DEFAULT_SYSTEM : if ( ( includeMask & SYSTEM_LIBRARIES ) == <NUM_LIT:0> ) break rawKind ; break ; default : break rawKind ; } IPath path = entry . getPath ( ) ; if ( pathToAdd == null || pathToAdd . equals ( path ) ) { Object target = JavaModel . getTarget ( path , false ) ; if ( target instanceof IFolder ) path = ( ( IFolder ) target ) . getFullPath ( ) ; String pathToString = path . getDevice ( ) == null ? path . toString ( ) : path . toOSString ( ) ; add ( projectPath . toString ( ) , "<STR_LIT>" , pathToString , false , access ) ; addEnclosingProjectOrJar ( entry . getPath ( ) ) ; } break ; } break ; case IClasspathEntry . CPE_PROJECT : if ( ( includeMask & REFERENCED_PROJECTS ) != <NUM_LIT:0> ) { IPath path = entry . getPath ( ) ; if ( pathToAdd == null || pathToAdd . equals ( path ) ) { JavaProject referencedProject = ( JavaProject ) model . getJavaProject ( path . lastSegment ( ) ) ; if ( ! projectsToBeAdded . contains ( referencedProject ) ) { add ( referencedProject , null , includeMask , projectsToBeAdded , visitedProjects , cpEntry ) ; } } } break ; case IClasspathEntry . CPE_SOURCE : if ( ( includeMask & SOURCES ) != <NUM_LIT:0> ) { IPath path = entry . getPath ( ) ; if ( pathToAdd == null || pathToAdd . equals ( path ) ) { add ( projectPath . toString ( ) , Util . relativePath ( path , <NUM_LIT:1> ) , projectPathString , false , access ) ; } } break ; } } } public void add ( IJavaElement element ) throws JavaModelException { IPath containerPath = null ; String containerPathToString = null ; PackageFragmentRoot root = null ; int includeMask = SOURCES | APPLICATION_LIBRARIES | SYSTEM_LIBRARIES ; switch ( element . getElementType ( ) ) { case IJavaElement . JAVA_MODEL : break ; case IJavaElement . JAVA_PROJECT : add ( ( JavaProject ) element , null , includeMask , new HashSet ( <NUM_LIT:2> ) , new HashSet ( <NUM_LIT:2> ) , null ) ; break ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : root = ( PackageFragmentRoot ) element ; IPath rootPath = root . internalPath ( ) ; containerPath = root . getKind ( ) == IPackageFragmentRoot . K_SOURCE ? root . getParent ( ) . getPath ( ) : rootPath ; containerPathToString = containerPath . getDevice ( ) == null ? containerPath . toString ( ) : containerPath . toOSString ( ) ; IResource rootResource = root . resource ( ) ; String projectPath = root . getJavaProject ( ) . getPath ( ) . toString ( ) ; if ( rootResource != null && rootResource . isAccessible ( ) ) { String relativePath = Util . relativePath ( rootResource . getFullPath ( ) , containerPath . segmentCount ( ) ) ; add ( projectPath , relativePath , containerPathToString , false , null ) ; } else { add ( projectPath , "<STR_LIT>" , containerPathToString , false , null ) ; } break ; case IJavaElement . PACKAGE_FRAGMENT : root = ( PackageFragmentRoot ) element . getParent ( ) ; projectPath = root . getJavaProject ( ) . getPath ( ) . toString ( ) ; if ( root . isArchive ( ) ) { String relativePath = Util . concatWith ( ( ( PackageFragment ) element ) . names , '<CHAR_LIT:/>' ) ; containerPath = root . getPath ( ) ; containerPathToString = containerPath . getDevice ( ) == null ? containerPath . toString ( ) : containerPath . toOSString ( ) ; add ( projectPath , relativePath , containerPathToString , true , null ) ; } else { IResource resource = ( ( JavaElement ) element ) . resource ( ) ; if ( resource != null ) { if ( resource . isAccessible ( ) ) { containerPath = root . getKind ( ) == IPackageFragmentRoot . K_SOURCE ? root . getParent ( ) . getPath ( ) : root . internalPath ( ) ; } else { containerPath = resource . getParent ( ) . getFullPath ( ) ; } containerPathToString = containerPath . getDevice ( ) == null ? containerPath . toString ( ) : containerPath . toOSString ( ) ; String relativePath = Util . relativePath ( resource . getFullPath ( ) , containerPath . segmentCount ( ) ) ; add ( projectPath , relativePath , containerPathToString , true , null ) ; } } break ; default : if ( element instanceof IMember ) { if ( this . elements == null ) { this . elements = new ArrayList ( ) ; } this . elements . add ( element ) ; } root = ( PackageFragmentRoot ) element . getAncestor ( IJavaElement . PACKAGE_FRAGMENT_ROOT ) ; projectPath = root . getJavaProject ( ) . getPath ( ) . toString ( ) ; String relativePath ; if ( root . getKind ( ) == IPackageFragmentRoot . K_SOURCE ) { containerPath = root . getParent ( ) . getPath ( ) ; relativePath = Util . relativePath ( getPath ( element , false ) , <NUM_LIT:1> ) ; } else { containerPath = root . internalPath ( ) ; relativePath = getPath ( element , true ) . toString ( ) ; } containerPathToString = containerPath . getDevice ( ) == null ? containerPath . toString ( ) : containerPath . toOSString ( ) ; add ( projectPath , relativePath , containerPathToString , false , null ) ; } if ( root != null ) addEnclosingProjectOrJar ( root . getKind ( ) == IPackageFragmentRoot . K_SOURCE ? root . getParent ( ) . getPath ( ) : root . getPath ( ) ) ; } private void add ( String projectPath , String relativePath , String containerPath , boolean isPackage , AccessRuleSet access ) { containerPath = normalize ( containerPath ) ; relativePath = normalize ( relativePath ) ; int length = this . containerPaths . length , index = ( containerPath . hashCode ( ) & <NUM_LIT> ) % length ; String currentRelativePath , currentContainerPath ; while ( ( currentRelativePath = this . relativePaths [ index ] ) != null && ( currentContainerPath = this . containerPaths [ index ] ) != null ) { if ( currentRelativePath . equals ( relativePath ) && currentContainerPath . equals ( containerPath ) ) return ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } int idx = this . projectPaths . indexOf ( projectPath ) ; if ( idx == - <NUM_LIT:1> ) { this . projectPaths . add ( projectPath ) ; idx = this . projectPaths . indexOf ( projectPath ) ; } this . projectIndexes [ index ] = idx ; this . relativePaths [ index ] = relativePath ; this . containerPaths [ index ] = containerPath ; this . isPkgPath [ index ] = isPackage ; if ( this . pathRestrictions != null ) this . pathRestrictions [ index ] = access ; else if ( access != null ) { this . pathRestrictions = new AccessRuleSet [ this . relativePaths . length ] ; this . pathRestrictions [ index ] = access ; } if ( ++ this . pathsCount > this . threshold ) rehash ( ) ; } public boolean encloses ( String resourcePathString ) { int separatorIndex = resourcePathString . indexOf ( JAR_FILE_ENTRY_SEPARATOR ) ; if ( separatorIndex != - <NUM_LIT:1> ) { String jarPath = resourcePathString . substring ( <NUM_LIT:0> , separatorIndex ) ; String relativePath = resourcePathString . substring ( separatorIndex + <NUM_LIT:1> ) ; return indexOf ( jarPath , relativePath ) >= <NUM_LIT:0> ; } return indexOf ( resourcePathString ) >= <NUM_LIT:0> ; } private int indexOf ( String fullPath ) { for ( int i = <NUM_LIT:0> , length = this . relativePaths . length ; i < length ; i ++ ) { String currentRelativePath = this . relativePaths [ i ] ; if ( currentRelativePath == null ) continue ; String currentContainerPath = this . containerPaths [ i ] ; String currentFullPath = currentRelativePath . length ( ) == <NUM_LIT:0> ? currentContainerPath : ( currentContainerPath + '<CHAR_LIT:/>' + currentRelativePath ) ; if ( encloses ( currentFullPath , fullPath , i ) ) return i ; } return - <NUM_LIT:1> ; } private int indexOf ( String containerPath , String relativePath ) { int length = this . containerPaths . length , index = ( containerPath . hashCode ( ) & <NUM_LIT> ) % length ; String currentContainerPath ; while ( ( currentContainerPath = this . containerPaths [ index ] ) != null ) { if ( currentContainerPath . equals ( containerPath ) ) { String currentRelativePath = this . relativePaths [ index ] ; if ( encloses ( currentRelativePath , relativePath , index ) ) return index ; } if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return - <NUM_LIT:1> ; } private boolean encloses ( String enclosingPath , String path , int index ) { path = normalize ( path ) ; int pathLength = path . length ( ) ; int enclosingLength = enclosingPath . length ( ) ; if ( pathLength < enclosingLength ) { return false ; } if ( enclosingLength == <NUM_LIT:0> ) { return true ; } if ( pathLength == enclosingLength ) { return path . equals ( enclosingPath ) ; } if ( ! this . isPkgPath [ index ] ) { return path . startsWith ( enclosingPath ) && path . charAt ( enclosingLength ) == '<CHAR_LIT:/>' ; } else { if ( path . startsWith ( enclosingPath ) && ( ( enclosingPath . length ( ) == path . lastIndexOf ( '<CHAR_LIT:/>' ) ) || ( enclosingPath . length ( ) == path . length ( ) ) ) ) { return true ; } } return false ; } public boolean encloses ( IJavaElement element ) { if ( this . elements != null ) { for ( int i = <NUM_LIT:0> , length = this . elements . size ( ) ; i < length ; i ++ ) { IJavaElement scopeElement = ( IJavaElement ) this . elements . get ( i ) ; IJavaElement searchedElement = element ; while ( searchedElement != null ) { if ( searchedElement . equals ( scopeElement ) ) return true ; searchedElement = searchedElement . getParent ( ) ; } } return false ; } IPackageFragmentRoot root = ( IPackageFragmentRoot ) element . getAncestor ( IJavaElement . PACKAGE_FRAGMENT_ROOT ) ; if ( root != null && root . isArchive ( ) ) { IPath rootPath = root . getPath ( ) ; String rootPathToString = rootPath . getDevice ( ) == null ? rootPath . toString ( ) : rootPath . toOSString ( ) ; IPath relativePath = getPath ( element , true ) ; return indexOf ( rootPathToString , relativePath . toString ( ) ) >= <NUM_LIT:0> ; } String fullResourcePathString = getPath ( element , false ) . toString ( ) ; return indexOf ( fullResourcePathString ) >= <NUM_LIT:0> ; } public IPath [ ] enclosingProjectsAndJars ( ) { return this . enclosingProjectsAndJars ; } private IPath getPath ( IJavaElement element , boolean relativeToRoot ) { switch ( element . getElementType ( ) ) { case IJavaElement . JAVA_MODEL : return Path . EMPTY ; case IJavaElement . JAVA_PROJECT : return element . getPath ( ) ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : if ( relativeToRoot ) return Path . EMPTY ; return element . getPath ( ) ; case IJavaElement . PACKAGE_FRAGMENT : String relativePath = Util . concatWith ( ( ( PackageFragment ) element ) . names , '<CHAR_LIT:/>' ) ; return getPath ( element . getParent ( ) , relativeToRoot ) . append ( new Path ( relativePath ) ) ; case IJavaElement . COMPILATION_UNIT : case IJavaElement . CLASS_FILE : return getPath ( element . getParent ( ) , relativeToRoot ) . append ( new Path ( element . getElementName ( ) ) ) ; default : return getPath ( element . getParent ( ) , relativeToRoot ) ; } } public AccessRuleSet getAccessRuleSet ( String relativePath , String containerPath ) { int index = indexOf ( containerPath , relativePath ) ; if ( index == - <NUM_LIT:1> ) { return NOT_ENCLOSED ; } if ( this . pathRestrictions == null ) return null ; return this . pathRestrictions [ index ] ; } protected void initialize ( int size ) { this . pathsCount = <NUM_LIT:0> ; this . threshold = size ; int extraRoom = ( int ) ( size * <NUM_LIT> ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . relativePaths = new String [ extraRoom ] ; this . containerPaths = new String [ extraRoom ] ; this . projectPaths = new ArrayList ( ) ; this . projectIndexes = new int [ extraRoom ] ; this . isPkgPath = new boolean [ extraRoom ] ; this . pathRestrictions = null ; this . enclosingProjectsAndJars = new IPath [ <NUM_LIT:0> ] ; } private String normalize ( String path ) { int pathLength = path . length ( ) ; int index = pathLength - <NUM_LIT:1> ; while ( index >= <NUM_LIT:0> && path . charAt ( index ) == '<CHAR_LIT:/>' ) index -- ; if ( index != pathLength - <NUM_LIT:1> ) return path . substring ( <NUM_LIT:0> , index + <NUM_LIT:1> ) ; return path ; } public void processDelta ( IJavaElementDelta delta , int eventType ) { switch ( delta . getKind ( ) ) { case IJavaElementDelta . CHANGED : IJavaElementDelta [ ] children = delta . getAffectedChildren ( ) ; for ( int i = <NUM_LIT:0> , length = children . length ; i < length ; i ++ ) { IJavaElementDelta child = children [ i ] ; processDelta ( child , eventType ) ; } break ; case IJavaElementDelta . REMOVED : IJavaElement element = delta . getElement ( ) ; if ( this . encloses ( element ) ) { if ( this . elements != null ) { this . elements . remove ( element ) ; } String path = null ; switch ( element . getElementType ( ) ) { case IJavaElement . JAVA_PROJECT : path = ( ( IJavaProject ) element ) . getProject ( ) . getFullPath ( ) . toString ( ) ; break ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : path = ( ( IPackageFragmentRoot ) element ) . getPath ( ) . toString ( ) ; break ; default : return ; } for ( int i = <NUM_LIT:0> ; i < this . pathsCount ; i ++ ) { if ( this . relativePaths [ i ] . equals ( path ) ) { this . relativePaths [ i ] = null ; rehash ( ) ; break ; } } } break ; } } public IPackageFragmentRoot packageFragmentRoot ( String resourcePathString , int jarSeparatorIndex , String jarPath ) { int index = - <NUM_LIT:1> ; boolean isJarFile = jarSeparatorIndex != - <NUM_LIT:1> ; if ( isJarFile ) { String relativePath = resourcePathString . substring ( jarSeparatorIndex + <NUM_LIT:1> ) ; index = indexOf ( jarPath , relativePath ) ; } else { index = indexOf ( resourcePathString ) ; } if ( index >= <NUM_LIT:0> ) { int idx = this . projectIndexes [ index ] ; String projectPath = idx == - <NUM_LIT:1> ? null : ( String ) this . projectPaths . get ( idx ) ; if ( projectPath != null ) { IJavaProject project = JavaCore . create ( ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getProject ( projectPath ) ) ; if ( isJarFile ) { IResource resource = JavaModel . getWorkspaceTarget ( new Path ( jarPath ) ) ; if ( resource != null ) return project . getPackageFragmentRoot ( resource ) ; return project . getPackageFragmentRoot ( jarPath ) ; } Object target = JavaModel . getWorkspaceTarget ( new Path ( this . containerPaths [ index ] + '<CHAR_LIT:/>' + this . relativePaths [ index ] ) ) ; if ( target != null ) { if ( target instanceof IProject ) { return project . getPackageFragmentRoot ( ( IProject ) target ) ; } IJavaElement element = JavaModelManager . create ( ( IResource ) target , project ) ; return ( IPackageFragmentRoot ) element . getAncestor ( IJavaElement . PACKAGE_FRAGMENT_ROOT ) ; } } } return null ; } private void rehash ( ) { JavaSearchScope newScope = new JavaSearchScope ( this . pathsCount * <NUM_LIT:2> ) ; newScope . projectPaths . ensureCapacity ( this . projectPaths . size ( ) ) ; String currentPath ; for ( int i = <NUM_LIT:0> , length = this . relativePaths . length ; i < length ; i ++ ) if ( ( currentPath = this . relativePaths [ i ] ) != null ) { int idx = this . projectIndexes [ i ] ; String projectPath = idx == - <NUM_LIT:1> ? null : ( String ) this . projectPaths . get ( idx ) ; newScope . add ( projectPath , currentPath , this . containerPaths [ i ] , this . isPkgPath [ i ] , this . pathRestrictions == null ? null : this . pathRestrictions [ i ] ) ; } this . relativePaths = newScope . relativePaths ; this . containerPaths = newScope . containerPaths ; this . projectPaths = newScope . projectPaths ; this . projectIndexes = newScope . projectIndexes ; this . isPkgPath = newScope . isPkgPath ; this . pathRestrictions = newScope . pathRestrictions ; this . threshold = newScope . threshold ; } public String toString ( ) { StringBuffer result = new StringBuffer ( "<STR_LIT>" ) ; if ( this . elements != null ) { result . append ( "<STR_LIT:[>" ) ; for ( int i = <NUM_LIT:0> , length = this . elements . size ( ) ; i < length ; i ++ ) { JavaElement element = ( JavaElement ) this . elements . get ( i ) ; result . append ( "<STR_LIT>" ) ; result . append ( element . toStringWithAncestors ( ) ) ; } result . append ( "<STR_LIT>" ) ; } else { if ( this . pathsCount == <NUM_LIT:0> ) { result . append ( "<STR_LIT>" ) ; } else { result . append ( "<STR_LIT:[>" ) ; String [ ] paths = new String [ this . relativePaths . length ] ; int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < this . relativePaths . length ; i ++ ) { String path = this . relativePaths [ i ] ; if ( path == null ) continue ; String containerPath ; if ( ExternalFoldersManager . isInternalPathForExternalFolder ( new Path ( this . containerPaths [ i ] ) ) ) { Object target = JavaModel . getWorkspaceTarget ( new Path ( this . containerPaths [ i ] ) ) ; containerPath = ( ( IFolder ) target ) . getLocation ( ) . toOSString ( ) ; } else { containerPath = this . containerPaths [ i ] ; } if ( path . length ( ) > <NUM_LIT:0> ) { paths [ index ++ ] = containerPath + '<CHAR_LIT:/>' + path ; } else { paths [ index ++ ] = containerPath ; } } System . arraycopy ( paths , <NUM_LIT:0> , paths = new String [ index ] , <NUM_LIT:0> , index ) ; Util . sort ( paths ) ; for ( int i = <NUM_LIT:0> ; i < index ; i ++ ) { result . append ( "<STR_LIT>" ) ; result . append ( paths [ i ] ) ; } result . append ( "<STR_LIT>" ) ; } } return result . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . search ; import org . eclipse . core . runtime . Path ; import org . eclipse . jdt . core . IAccessRule ; import org . eclipse . jdt . core . IClassFile ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaProject ; import org . eclipse . jdt . core . IPackageFragment ; import org . eclipse . jdt . core . IPackageFragmentRoot ; import org . eclipse . jdt . core . IType ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . core . search . IJavaSearchScope ; import org . eclipse . jdt . core . search . TypeNameMatchRequestor ; import org . eclipse . jdt . core . search . TypeNameRequestor ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . env . AccessRestriction ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . core . Openable ; import org . eclipse . jdt . internal . core . PackageFragmentRoot ; import org . eclipse . jdt . internal . core . util . HandleFactory ; import org . eclipse . jdt . internal . core . util . HashtableOfArrayToObject ; public class TypeNameMatchRequestorWrapper implements IRestrictedAccessTypeRequestor { TypeNameMatchRequestor requestor ; private IJavaSearchScope scope ; private HandleFactory handleFactory ; private String lastPkgFragmentRootPath ; private IPackageFragmentRoot lastPkgFragmentRoot ; private HashtableOfArrayToObject packageHandles ; private Object lastProject ; private long complianceValue ; public TypeNameMatchRequestorWrapper ( TypeNameMatchRequestor requestor , IJavaSearchScope scope ) { this . requestor = requestor ; this . scope = scope ; if ( ! ( scope instanceof AbstractJavaSearchScope ) ) { this . handleFactory = new HandleFactory ( ) ; } } public void acceptType ( int modifiers , char [ ] packageName , char [ ] simpleTypeName , char [ ] [ ] enclosingTypeNames , String path , AccessRestriction access ) { try { IType type = null ; if ( this . handleFactory != null ) { Openable openable = this . handleFactory . createOpenable ( path , this . scope ) ; if ( openable == null ) return ; switch ( openable . getElementType ( ) ) { case IJavaElement . COMPILATION_UNIT : ICompilationUnit cu = ( ICompilationUnit ) openable ; if ( enclosingTypeNames != null && enclosingTypeNames . length > <NUM_LIT:0> ) { type = cu . getType ( new String ( enclosingTypeNames [ <NUM_LIT:0> ] ) ) ; for ( int j = <NUM_LIT:1> , l = enclosingTypeNames . length ; j < l ; j ++ ) { type = type . getType ( new String ( enclosingTypeNames [ j ] ) ) ; } type = type . getType ( new String ( simpleTypeName ) ) ; } else { type = cu . getType ( new String ( simpleTypeName ) ) ; } break ; case IJavaElement . CLASS_FILE : type = ( ( IClassFile ) openable ) . getType ( ) ; break ; } } else { int separatorIndex = path . indexOf ( IJavaSearchScope . JAR_FILE_ENTRY_SEPARATOR ) ; type = separatorIndex == - <NUM_LIT:1> ? createTypeFromPath ( path , new String ( simpleTypeName ) , enclosingTypeNames ) : createTypeFromJar ( path , separatorIndex ) ; } if ( type != null ) { if ( ! ( this . scope instanceof HierarchyScope ) || ( ( HierarchyScope ) this . scope ) . enclosesFineGrained ( type ) ) { final JavaSearchTypeNameMatch match = new JavaSearchTypeNameMatch ( type , modifiers ) ; if ( access != null ) { switch ( access . getProblemId ( ) ) { case IProblem . ForbiddenReference : match . setAccessibility ( IAccessRule . K_NON_ACCESSIBLE ) ; break ; case IProblem . DiscouragedReference : match . setAccessibility ( IAccessRule . K_DISCOURAGED ) ; break ; } } this . requestor . acceptTypeNameMatch ( match ) ; } } } catch ( JavaModelException e ) { } } private IType createTypeFromJar ( String resourcePath , int separatorIndex ) throws JavaModelException { if ( this . lastPkgFragmentRootPath == null || this . lastPkgFragmentRootPath . length ( ) > resourcePath . length ( ) || ! resourcePath . startsWith ( this . lastPkgFragmentRootPath ) ) { String jarPath = resourcePath . substring ( <NUM_LIT:0> , separatorIndex ) ; IPackageFragmentRoot root = ( ( AbstractJavaSearchScope ) this . scope ) . packageFragmentRoot ( resourcePath , separatorIndex , jarPath ) ; if ( root == null ) return null ; this . lastPkgFragmentRootPath = jarPath ; this . lastPkgFragmentRoot = root ; this . packageHandles = new HashtableOfArrayToObject ( <NUM_LIT:5> ) ; } String classFilePath = resourcePath . substring ( separatorIndex + <NUM_LIT:1> ) ; String [ ] simpleNames = new Path ( classFilePath ) . segments ( ) ; String [ ] pkgName ; int length = simpleNames . length - <NUM_LIT:1> ; if ( length > <NUM_LIT:0> ) { pkgName = new String [ length ] ; System . arraycopy ( simpleNames , <NUM_LIT:0> , pkgName , <NUM_LIT:0> , length ) ; } else { pkgName = CharOperation . NO_STRINGS ; } IPackageFragment pkgFragment = ( IPackageFragment ) this . packageHandles . get ( pkgName ) ; if ( pkgFragment == null ) { pkgFragment = ( ( PackageFragmentRoot ) this . lastPkgFragmentRoot ) . getPackageFragment ( pkgName ) ; if ( length == <NUM_LIT:5> && pkgName [ <NUM_LIT:4> ] . equals ( "<STR_LIT>" ) ) { IJavaProject proj = ( IJavaProject ) pkgFragment . getAncestor ( IJavaElement . JAVA_PROJECT ) ; if ( ! proj . equals ( this . lastProject ) ) { String complianceStr = proj . getOption ( CompilerOptions . OPTION_Source , true ) ; this . complianceValue = CompilerOptions . versionToJdkLevel ( complianceStr ) ; this . lastProject = proj ; } if ( this . complianceValue >= ClassFileConstants . JDK1_5 ) return null ; } this . packageHandles . put ( pkgName , pkgFragment ) ; } return pkgFragment . getClassFile ( simpleNames [ length ] ) . getType ( ) ; } private IType createTypeFromPath ( String resourcePath , String simpleTypeName , char [ ] [ ] enclosingTypeNames ) throws JavaModelException { int rootPathLength = - <NUM_LIT:1> ; if ( this . lastPkgFragmentRootPath == null || ! ( resourcePath . startsWith ( this . lastPkgFragmentRootPath ) && ( rootPathLength = this . lastPkgFragmentRootPath . length ( ) ) > <NUM_LIT:0> && resourcePath . charAt ( rootPathLength ) == '<CHAR_LIT:/>' ) ) { PackageFragmentRoot root = ( PackageFragmentRoot ) ( ( AbstractJavaSearchScope ) this . scope ) . packageFragmentRoot ( resourcePath , - <NUM_LIT:1> , null ) ; if ( root == null ) return null ; this . lastPkgFragmentRoot = root ; this . lastPkgFragmentRootPath = root . internalPath ( ) . toString ( ) ; this . packageHandles = new HashtableOfArrayToObject ( <NUM_LIT:5> ) ; } resourcePath = resourcePath . substring ( this . lastPkgFragmentRootPath . length ( ) + <NUM_LIT:1> ) ; String [ ] simpleNames = new Path ( resourcePath ) . segments ( ) ; String [ ] pkgName ; int length = simpleNames . length - <NUM_LIT:1> ; if ( length > <NUM_LIT:0> ) { pkgName = new String [ length ] ; System . arraycopy ( simpleNames , <NUM_LIT:0> , pkgName , <NUM_LIT:0> , length ) ; } else { pkgName = CharOperation . NO_STRINGS ; } IPackageFragment pkgFragment = ( IPackageFragment ) this . packageHandles . get ( pkgName ) ; if ( pkgFragment == null ) { pkgFragment = ( ( PackageFragmentRoot ) this . lastPkgFragmentRoot ) . getPackageFragment ( pkgName ) ; this . packageHandles . put ( pkgName , pkgFragment ) ; } String simpleName = simpleNames [ length ] ; if ( org . eclipse . jdt . internal . core . util . Util . isJavaLikeFileName ( simpleName ) ) { ICompilationUnit unit = pkgFragment . getCompilationUnit ( simpleName ) ; int etnLength = enclosingTypeNames == null ? <NUM_LIT:0> : enclosingTypeNames . length ; IType type = ( etnLength == <NUM_LIT:0> ) ? unit . getType ( simpleTypeName ) : unit . getType ( new String ( enclosingTypeNames [ <NUM_LIT:0> ] ) ) ; if ( etnLength > <NUM_LIT:0> ) { for ( int i = <NUM_LIT:1> ; i < etnLength ; i ++ ) { type = type . getType ( new String ( enclosingTypeNames [ i ] ) ) ; } type = type . getType ( simpleTypeName ) ; } return type ; } else if ( org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( simpleName ) ) { IClassFile classFile = pkgFragment . getClassFile ( simpleName ) ; return classFile . getType ( ) ; } return null ; } } </s>
<s> package org . eclipse . jdt . internal . core . search ; import org . eclipse . jdt . internal . compiler . env . AccessRestriction ; public interface IRestrictedAccessConstructorRequestor { public void acceptConstructor ( int modifiers , char [ ] simpleTypeName , int parameterCount , char [ ] signature , char [ ] [ ] parameterTypes , char [ ] [ ] parameterNames , int typeModifiers , char [ ] packageName , int extraFlags , String path , AccessRestriction access ) ; } </s>
<s> package org . eclipse . jdt . internal . core . search ; import org . eclipse . jdt . internal . compiler . env . AccessRestriction ; public interface IRestrictedAccessTypeRequestor { public void acceptType ( int modifiers , char [ ] packageName , char [ ] simpleTypeName , char [ ] [ ] enclosingTypeNames , String path , AccessRestriction access ) ; } </s>
<s> package org . eclipse . jdt . internal . core . search ; import org . eclipse . jdt . core . search . TypeNameRequestor ; import org . eclipse . jdt . internal . compiler . env . AccessRestriction ; public class TypeNameRequestorWrapper implements IRestrictedAccessTypeRequestor { TypeNameRequestor requestor ; public TypeNameRequestorWrapper ( TypeNameRequestor requestor ) { this . requestor = requestor ; } public void acceptType ( int modifiers , char [ ] packageName , char [ ] simpleTypeName , char [ ] [ ] enclosingTypeNames , String path , AccessRestriction access ) { this . requestor . acceptType ( modifiers , packageName , simpleTypeName , enclosingTypeNames , path ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . search ; import java . io . File ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import org . eclipse . core . resources . * ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . core . * ; import org . eclipse . jdt . internal . core . hierarchy . TypeHierarchy ; public class HierarchyScope extends AbstractSearchScope implements SuffixConstants { public IType focusType ; private String focusPath ; private WorkingCopyOwner owner ; private ITypeHierarchy hierarchy ; private HashSet resourcePaths ; private IPath [ ] enclosingProjectsAndJars ; protected IResource [ ] elements ; protected int elementCount ; public boolean needsRefresh ; private HashSet subTypes = null ; private IJavaProject javaProject = null ; private boolean allowMemberAndEnclosingTypes = true ; private boolean includeFocusType = true ; public void add ( IResource element ) { if ( this . elementCount == this . elements . length ) { System . arraycopy ( this . elements , <NUM_LIT:0> , this . elements = new IResource [ this . elementCount * <NUM_LIT:2> ] , <NUM_LIT:0> , this . elementCount ) ; } this . elements [ this . elementCount ++ ] = element ; } public HierarchyScope ( IJavaProject project , IType type , WorkingCopyOwner owner , boolean onlySubtypes , boolean noMembersOrEnclosingTypes , boolean includeFocusType ) throws JavaModelException { this ( type , owner ) ; this . javaProject = project ; if ( onlySubtypes ) { this . subTypes = new HashSet ( ) ; } this . includeFocusType = includeFocusType ; this . allowMemberAndEnclosingTypes = ! noMembersOrEnclosingTypes ; } public HierarchyScope ( IType type , WorkingCopyOwner owner ) throws JavaModelException { this . focusType = type ; this . owner = owner ; this . enclosingProjectsAndJars = computeProjectsAndJars ( type ) ; IPackageFragmentRoot root = ( IPackageFragmentRoot ) type . getPackageFragment ( ) . getParent ( ) ; if ( root . isArchive ( ) ) { IPath jarPath = root . getPath ( ) ; Object target = JavaModel . getTarget ( jarPath , true ) ; String zipFileName ; if ( target instanceof IFile ) { zipFileName = jarPath . toString ( ) ; } else if ( target instanceof File ) { zipFileName = ( ( File ) target ) . getPath ( ) ; } else { return ; } this . focusPath = zipFileName + JAR_FILE_ENTRY_SEPARATOR + type . getFullyQualifiedName ( ) . replace ( '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) + SUFFIX_STRING_class ; } else { this . focusPath = type . getPath ( ) . toString ( ) ; } this . needsRefresh = true ; } private void buildResourceVector ( ) { HashMap resources = new HashMap ( ) ; HashMap paths = new HashMap ( ) ; IType [ ] types = null ; if ( this . subTypes != null ) { types = this . hierarchy . getAllSubtypes ( this . focusType ) ; if ( this . includeFocusType ) { int len = types . length ; System . arraycopy ( types , <NUM_LIT:0> , types = new IType [ len + <NUM_LIT:1> ] , <NUM_LIT:0> , len ) ; types [ len ] = this . focusType ; } } else { types = this . hierarchy . getAllTypes ( ) ; } for ( int i = <NUM_LIT:0> ; i < types . length ; i ++ ) { IType type = types [ i ] ; if ( this . subTypes != null ) { this . subTypes . add ( type ) ; } IResource resource = ( ( JavaElement ) type ) . resource ( ) ; if ( resource != null && resources . get ( resource ) == null ) { resources . put ( resource , resource ) ; add ( resource ) ; } IPackageFragmentRoot root = ( IPackageFragmentRoot ) type . getPackageFragment ( ) . getParent ( ) ; if ( root instanceof JarPackageFragmentRoot ) { JarPackageFragmentRoot jar = ( JarPackageFragmentRoot ) root ; IPath jarPath = jar . getPath ( ) ; Object target = JavaModel . getTarget ( jarPath , true ) ; String zipFileName ; if ( target instanceof IFile ) { zipFileName = jarPath . toString ( ) ; } else if ( target instanceof File ) { zipFileName = ( ( File ) target ) . getPath ( ) ; } else { continue ; } String resourcePath = zipFileName + JAR_FILE_ENTRY_SEPARATOR + type . getFullyQualifiedName ( ) . replace ( '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) + SUFFIX_STRING_class ; this . resourcePaths . add ( resourcePath ) ; paths . put ( jarPath , type ) ; } else { paths . put ( type . getJavaProject ( ) . getProject ( ) . getFullPath ( ) , type ) ; } } this . enclosingProjectsAndJars = new IPath [ paths . size ( ) ] ; int i = <NUM_LIT:0> ; for ( Iterator iter = paths . keySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { this . enclosingProjectsAndJars [ i ++ ] = ( IPath ) iter . next ( ) ; } } private IPath [ ] computeProjectsAndJars ( IType type ) throws JavaModelException { HashSet set = new HashSet ( ) ; IPackageFragmentRoot root = ( IPackageFragmentRoot ) type . getPackageFragment ( ) . getParent ( ) ; if ( root . isArchive ( ) ) { set . add ( root . getPath ( ) ) ; IPath rootPath = root . getPath ( ) ; IJavaModel model = JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) ; IJavaProject [ ] projects = model . getJavaProjects ( ) ; HashSet visited = new HashSet ( ) ; for ( int i = <NUM_LIT:0> ; i < projects . length ; i ++ ) { JavaProject project = ( JavaProject ) projects [ i ] ; IClasspathEntry entry = project . getClasspathEntryFor ( rootPath ) ; if ( entry != null ) { IPackageFragmentRoot [ ] roots = project . getAllPackageFragmentRoots ( ) ; set . add ( project . getPath ( ) ) ; for ( int k = <NUM_LIT:0> ; k < roots . length ; k ++ ) { IPackageFragmentRoot pkgFragmentRoot = roots [ k ] ; if ( pkgFragmentRoot . getKind ( ) == IPackageFragmentRoot . K_BINARY ) { set . add ( pkgFragmentRoot . getPath ( ) ) ; } } computeDependents ( project , set , visited ) ; } } } else { IJavaProject project = ( IJavaProject ) root . getParent ( ) ; IPackageFragmentRoot [ ] roots = project . getAllPackageFragmentRoots ( ) ; for ( int i = <NUM_LIT:0> ; i < roots . length ; i ++ ) { IPackageFragmentRoot pkgFragmentRoot = roots [ i ] ; if ( pkgFragmentRoot . getKind ( ) == IPackageFragmentRoot . K_BINARY ) { set . add ( pkgFragmentRoot . getPath ( ) ) ; } else { set . add ( pkgFragmentRoot . getParent ( ) . getPath ( ) ) ; } } computeDependents ( project , set , new HashSet ( ) ) ; } IPath [ ] result = new IPath [ set . size ( ) ] ; set . toArray ( result ) ; return result ; } private void computeDependents ( IJavaProject project , HashSet set , HashSet visited ) { if ( visited . contains ( project ) ) return ; visited . add ( project ) ; IProject [ ] dependents = project . getProject ( ) . getReferencingProjects ( ) ; for ( int i = <NUM_LIT:0> ; i < dependents . length ; i ++ ) { try { IJavaProject dependent = JavaCore . create ( dependents [ i ] ) ; IPackageFragmentRoot [ ] roots = dependent . getPackageFragmentRoots ( ) ; set . add ( dependent . getPath ( ) ) ; for ( int j = <NUM_LIT:0> ; j < roots . length ; j ++ ) { IPackageFragmentRoot pkgFragmentRoot = roots [ j ] ; if ( pkgFragmentRoot . isArchive ( ) ) { set . add ( pkgFragmentRoot . getPath ( ) ) ; } } computeDependents ( dependent , set , visited ) ; } catch ( JavaModelException e ) { } } } public boolean encloses ( String resourcePath ) { return encloses ( resourcePath , null ) ; } public boolean encloses ( String resourcePath , IProgressMonitor progressMonitor ) { if ( this . hierarchy == null ) { if ( resourcePath . equals ( this . focusPath ) ) { return true ; } else { if ( this . needsRefresh ) { try { initialize ( progressMonitor ) ; } catch ( JavaModelException e ) { return false ; } } else { return true ; } } } if ( this . needsRefresh ) { try { refresh ( progressMonitor ) ; } catch ( JavaModelException e ) { return false ; } } int separatorIndex = resourcePath . indexOf ( JAR_FILE_ENTRY_SEPARATOR ) ; if ( separatorIndex != - <NUM_LIT:1> ) { return this . resourcePaths . contains ( resourcePath ) ; } else { for ( int i = <NUM_LIT:0> ; i < this . elementCount ; i ++ ) { if ( resourcePath . startsWith ( this . elements [ i ] . getFullPath ( ) . toString ( ) ) ) { return true ; } } } return false ; } public boolean enclosesFineGrained ( IJavaElement element ) { if ( ( this . subTypes == null ) && this . allowMemberAndEnclosingTypes ) return true ; return encloses ( element , null ) ; } public boolean encloses ( IJavaElement element ) { return encloses ( element , null ) ; } public boolean encloses ( IJavaElement element , IProgressMonitor progressMonitor ) { if ( this . hierarchy == null ) { if ( this . includeFocusType && this . focusType . equals ( element . getAncestor ( IJavaElement . TYPE ) ) ) { return true ; } else { if ( this . needsRefresh ) { try { initialize ( progressMonitor ) ; } catch ( JavaModelException e ) { return false ; } } else { return true ; } } } if ( this . needsRefresh ) { try { refresh ( progressMonitor ) ; } catch ( JavaModelException e ) { return false ; } } IType type = null ; if ( element instanceof IType ) { type = ( IType ) element ; } else if ( element instanceof IMember ) { type = ( ( IMember ) element ) . getDeclaringType ( ) ; } if ( type != null ) { if ( this . focusType . equals ( type ) ) return this . includeFocusType ; if ( enclosesType ( type , this . allowMemberAndEnclosingTypes ) ) { return true ; } if ( this . allowMemberAndEnclosingTypes ) { IType enclosing = type . getDeclaringType ( ) ; while ( enclosing != null ) { if ( enclosesType ( enclosing , false ) ) { return true ; } enclosing = enclosing . getDeclaringType ( ) ; } } } return false ; } private boolean enclosesType ( IType type , boolean recurse ) { if ( this . subTypes != null ) { if ( this . subTypes . contains ( type ) ) { return true ; } IType original = type . isBinary ( ) ? null : ( IType ) type . getPrimaryElement ( ) ; if ( original != type && this . subTypes . contains ( original ) ) { return true ; } } else { if ( this . hierarchy . contains ( type ) ) { return true ; } else { IType original ; if ( ! type . isBinary ( ) && ( original = ( IType ) type . getPrimaryElement ( ) ) != null ) { if ( this . hierarchy . contains ( original ) ) { return true ; } } } } if ( recurse ) { try { IType [ ] memberTypes = type . getTypes ( ) ; for ( int i = <NUM_LIT:0> ; i < memberTypes . length ; i ++ ) { if ( enclosesType ( memberTypes [ i ] , recurse ) ) { return true ; } } } catch ( JavaModelException e ) { return false ; } } return false ; } public IPath [ ] enclosingProjectsAndJars ( ) { if ( this . needsRefresh ) { try { refresh ( null ) ; } catch ( JavaModelException e ) { return new IPath [ <NUM_LIT:0> ] ; } } return this . enclosingProjectsAndJars ; } protected void initialize ( ) throws JavaModelException { initialize ( null ) ; } protected void initialize ( IProgressMonitor progressMonitor ) throws JavaModelException { this . resourcePaths = new HashSet ( ) ; this . elements = new IResource [ <NUM_LIT:5> ] ; this . elementCount = <NUM_LIT:0> ; this . needsRefresh = false ; if ( this . hierarchy == null ) { if ( this . javaProject != null ) { this . hierarchy = this . focusType . newTypeHierarchy ( this . javaProject , this . owner , progressMonitor ) ; } else { this . hierarchy = this . focusType . newTypeHierarchy ( this . owner , progressMonitor ) ; } } else { this . hierarchy . refresh ( progressMonitor ) ; } buildResourceVector ( ) ; } public void processDelta ( IJavaElementDelta delta , int eventType ) { if ( this . needsRefresh ) return ; this . needsRefresh = this . hierarchy == null ? false : ( ( TypeHierarchy ) this . hierarchy ) . isAffected ( delta , eventType ) ; } protected void refresh ( ) throws JavaModelException { refresh ( null ) ; } protected void refresh ( IProgressMonitor progressMonitor ) throws JavaModelException { if ( this . hierarchy != null ) { initialize ( progressMonitor ) ; } } public String toString ( ) { return "<STR_LIT>" + ( ( JavaElement ) this . focusType ) . toStringWithAncestors ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . search ; import org . eclipse . core . resources . IFolder ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . IPath ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . search . IJavaSearchScope ; import org . eclipse . jdt . core . search . SearchPattern ; import org . eclipse . jdt . internal . compiler . util . ObjectVector ; import org . eclipse . jdt . internal . compiler . util . SimpleSet ; import org . eclipse . jdt . internal . core . JarPackageFragmentRoot ; import org . eclipse . jdt . internal . core . JavaModel ; import org . eclipse . jdt . internal . core . JavaModelManager ; import org . eclipse . jdt . internal . core . JavaProject ; import org . eclipse . jdt . internal . core . builder . ReferenceCollection ; import org . eclipse . jdt . internal . core . builder . State ; import org . eclipse . jdt . internal . core . search . indexing . IndexManager ; import org . eclipse . jdt . internal . core . search . matching . MatchLocator ; import org . eclipse . jdt . internal . core . search . matching . MethodPattern ; public class IndexSelector { IJavaSearchScope searchScope ; SearchPattern pattern ; IPath [ ] indexLocations ; public IndexSelector ( IJavaSearchScope searchScope , SearchPattern pattern ) { this . searchScope = searchScope ; this . pattern = pattern ; } public static boolean canSeeFocus ( SearchPattern pattern , IPath projectOrJarPath ) { try { IJavaModel model = JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) ; IJavaProject project = getJavaProject ( projectOrJarPath , model ) ; IJavaElement [ ] focuses = getFocusedElementsAndTypes ( pattern , project , null ) ; if ( focuses . length == <NUM_LIT:0> ) return false ; if ( project != null ) { return canSeeFocus ( focuses , ( JavaProject ) project , null ) ; } IJavaProject [ ] allProjects = model . getJavaProjects ( ) ; for ( int i = <NUM_LIT:0> , length = allProjects . length ; i < length ; i ++ ) { JavaProject otherProject = ( JavaProject ) allProjects [ i ] ; IClasspathEntry entry = otherProject . getClasspathEntryFor ( projectOrJarPath ) ; if ( entry != null && entry . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY ) { if ( canSeeFocus ( focuses , otherProject , null ) ) { return true ; } } } return false ; } catch ( JavaModelException e ) { return false ; } } private static boolean canSeeFocus ( IJavaElement [ ] focuses , JavaProject javaProject , char [ ] [ ] [ ] focusQualifiedNames ) { int length = focuses . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( canSeeFocus ( focuses [ i ] , javaProject , focusQualifiedNames ) ) return true ; } return false ; } private static boolean canSeeFocus ( IJavaElement focus , JavaProject javaProject , char [ ] [ ] [ ] focusQualifiedNames ) { try { if ( focus == null ) return false ; if ( focus . equals ( javaProject ) ) return true ; if ( focus instanceof JarPackageFragmentRoot ) { IPath focusPath = focus . getPath ( ) ; IClasspathEntry [ ] entries = javaProject . getExpandedClasspath ( ) ; for ( int i = <NUM_LIT:0> , length = entries . length ; i < length ; i ++ ) { IClasspathEntry entry = entries [ i ] ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY && entry . getPath ( ) . equals ( focusPath ) ) return true ; } return false ; } IPath focusPath = ( ( JavaProject ) focus ) . getProject ( ) . getFullPath ( ) ; IClasspathEntry [ ] entries = javaProject . getExpandedClasspath ( ) ; for ( int i = <NUM_LIT:0> , length = entries . length ; i < length ; i ++ ) { IClasspathEntry entry = entries [ i ] ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_PROJECT && entry . getPath ( ) . equals ( focusPath ) ) { if ( focusQualifiedNames != null ) { State projectState = ( State ) JavaModelManager . getJavaModelManager ( ) . getLastBuiltState ( javaProject . getProject ( ) , null ) ; if ( projectState != null ) { Object [ ] values = projectState . getReferences ( ) . valueTable ; int vLength = values . length ; for ( int j = <NUM_LIT:0> ; j < vLength ; j ++ ) { if ( values [ j ] == null ) continue ; ReferenceCollection references = ( ReferenceCollection ) values [ j ] ; if ( references . includes ( focusQualifiedNames , null , null ) ) { return true ; } } return false ; } } return true ; } } return false ; } catch ( JavaModelException e ) { return false ; } } private static IJavaElement [ ] getFocusedElementsAndTypes ( SearchPattern pattern , IJavaElement focusElement , ObjectVector superTypes ) throws JavaModelException { if ( pattern instanceof MethodPattern ) { IType type = ( IType ) pattern . focus . getAncestor ( IJavaElement . TYPE ) ; MethodPattern methodPattern = ( MethodPattern ) pattern ; String selector = new String ( methodPattern . selector ) ; int parameterCount = methodPattern . parameterCount ; ITypeHierarchy superHierarchy = type . newSupertypeHierarchy ( null ) ; IType [ ] allTypes = superHierarchy . getAllSupertypes ( type ) ; int length = allTypes . length ; SimpleSet focusSet = new SimpleSet ( length + <NUM_LIT:1> ) ; if ( focusElement != null ) focusSet . add ( focusElement ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IMethod [ ] methods = allTypes [ i ] . getMethods ( ) ; int mLength = methods . length ; for ( int m = <NUM_LIT:0> ; m < mLength ; m ++ ) { if ( parameterCount == methods [ m ] . getNumberOfParameters ( ) && methods [ m ] . getElementName ( ) . equals ( selector ) ) { IPackageFragmentRoot root = ( IPackageFragmentRoot ) allTypes [ i ] . getAncestor ( IJavaElement . PACKAGE_FRAGMENT_ROOT ) ; IJavaElement element = root . isArchive ( ) ? root : root . getParent ( ) ; focusSet . add ( element ) ; if ( superTypes != null ) superTypes . add ( allTypes [ i ] ) ; break ; } } } IJavaElement [ ] focuses = new IJavaElement [ focusSet . elementSize ] ; Object [ ] values = focusSet . values ; int count = <NUM_LIT:0> ; for ( int i = values . length ; -- i >= <NUM_LIT:0> ; ) { if ( values [ i ] != null ) { focuses [ count ++ ] = ( IJavaElement ) values [ i ] ; } } return focuses ; } if ( focusElement == null ) return new IJavaElement [ <NUM_LIT:0> ] ; return new IJavaElement [ ] { focusElement } ; } private void initializeIndexLocations ( ) { IPath [ ] projectsAndJars = this . searchScope . enclosingProjectsAndJars ( ) ; IndexManager manager = JavaModelManager . getIndexManager ( ) ; SimpleSet locations = new SimpleSet ( ) ; IJavaElement focus = MatchLocator . projectOrJarFocus ( this . pattern ) ; if ( focus == null ) { for ( int i = <NUM_LIT:0> ; i < projectsAndJars . length ; i ++ ) { IPath path = projectsAndJars [ i ] ; Object target = JavaModel . getTarget ( path , false ) ; if ( target instanceof IFolder ) path = ( ( IFolder ) target ) . getFullPath ( ) ; locations . add ( manager . computeIndexLocation ( path ) ) ; } } else { try { int length = projectsAndJars . length ; JavaProject [ ] projectsCanSeeFocus = new JavaProject [ length ] ; SimpleSet visitedProjects = new SimpleSet ( length ) ; int projectIndex = <NUM_LIT:0> ; SimpleSet externalLibsToCheck = new SimpleSet ( length ) ; ObjectVector superTypes = new ObjectVector ( ) ; IJavaElement [ ] focuses = getFocusedElementsAndTypes ( this . pattern , focus , superTypes ) ; char [ ] [ ] [ ] focusQualifiedNames = null ; boolean isAutoBuilding = ResourcesPlugin . getWorkspace ( ) . getDescription ( ) . isAutoBuilding ( ) ; if ( isAutoBuilding && focus instanceof IJavaProject ) { focusQualifiedNames = getQualifiedNames ( superTypes ) ; } IJavaModel model = JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IPath path = projectsAndJars [ i ] ; JavaProject project = ( JavaProject ) getJavaProject ( path , model ) ; if ( project != null ) { visitedProjects . add ( project ) ; if ( canSeeFocus ( focuses , project , focusQualifiedNames ) ) { locations . add ( manager . computeIndexLocation ( path ) ) ; projectsCanSeeFocus [ projectIndex ++ ] = project ; } } else { externalLibsToCheck . add ( path ) ; } } for ( int i = <NUM_LIT:0> ; i < projectIndex && externalLibsToCheck . elementSize > <NUM_LIT:0> ; i ++ ) { IClasspathEntry [ ] entries = projectsCanSeeFocus [ i ] . getResolvedClasspath ( ) ; for ( int j = entries . length ; -- j >= <NUM_LIT:0> ; ) { IClasspathEntry entry = entries [ j ] ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY ) { IPath path = entry . getPath ( ) ; if ( externalLibsToCheck . remove ( path ) != null ) { Object target = JavaModel . getTarget ( path , false ) ; if ( target instanceof IFolder ) path = ( ( IFolder ) target ) . getFullPath ( ) ; locations . add ( manager . computeIndexLocation ( path ) ) ; } } } } if ( externalLibsToCheck . elementSize > <NUM_LIT:0> ) { IJavaProject [ ] allProjects = model . getJavaProjects ( ) ; for ( int i = <NUM_LIT:0> , l = allProjects . length ; i < l && externalLibsToCheck . elementSize > <NUM_LIT:0> ; i ++ ) { JavaProject project = ( JavaProject ) allProjects [ i ] ; if ( ! visitedProjects . includes ( project ) ) { IClasspathEntry [ ] entries = project . getResolvedClasspath ( ) ; for ( int j = entries . length ; -- j >= <NUM_LIT:0> ; ) { IClasspathEntry entry = entries [ j ] ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY ) { IPath path = entry . getPath ( ) ; if ( externalLibsToCheck . remove ( path ) != null ) { Object target = JavaModel . getTarget ( path , false ) ; if ( target instanceof IFolder ) path = ( ( IFolder ) target ) . getFullPath ( ) ; locations . add ( manager . computeIndexLocation ( path ) ) ; } } } } } } } catch ( JavaModelException e ) { } } this . indexLocations = new IPath [ locations . elementSize ] ; Object [ ] values = locations . values ; int count = <NUM_LIT:0> ; for ( int i = values . length ; -- i >= <NUM_LIT:0> ; ) if ( values [ i ] != null ) this . indexLocations [ count ++ ] = ( IPath ) values [ i ] ; } public IPath [ ] getIndexLocations ( ) { if ( this . indexLocations == null ) { initializeIndexLocations ( ) ; } return this . indexLocations ; } private static IJavaProject getJavaProject ( IPath path , IJavaModel model ) { IJavaProject project = model . getJavaProject ( path . lastSegment ( ) ) ; if ( project . exists ( ) ) { return project ; } return null ; } private char [ ] [ ] [ ] getQualifiedNames ( ObjectVector types ) { final int size = types . size ; char [ ] [ ] [ ] focusQualifiedNames = null ; IJavaElement javaElement = this . pattern . focus ; int index = <NUM_LIT:0> ; while ( javaElement != null && ! ( javaElement instanceof ITypeRoot ) ) { javaElement = javaElement . getParent ( ) ; } if ( javaElement != null ) { IType primaryType = ( ( ITypeRoot ) javaElement ) . findPrimaryType ( ) ; if ( primaryType != null ) { focusQualifiedNames = new char [ size + <NUM_LIT:1> ] [ ] [ ] ; focusQualifiedNames [ index ++ ] = CharOperation . splitOn ( '<CHAR_LIT:.>' , primaryType . getFullyQualifiedName ( ) . toCharArray ( ) ) ; } } if ( focusQualifiedNames == null ) { focusQualifiedNames = new char [ size ] [ ] [ ] ; } for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { focusQualifiedNames [ index ++ ] = CharOperation . splitOn ( '<CHAR_LIT:.>' , ( ( IType ) ( types . elementAt ( i ) ) ) . getFullyQualifiedName ( ) . toCharArray ( ) ) ; } return focusQualifiedNames . length == <NUM_LIT:0> ? null : ReferenceCollection . internQualifiedNames ( focusQualifiedNames , true ) ; } } </s>
<s> package org . eclipse . jdt . core ; import java . io . File ; import java . io . IOException ; import java . io . PrintWriter ; import java . lang . reflect . Constructor ; import java . lang . reflect . InvocationTargetException ; import java . lang . reflect . Method ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Comparator ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import org . apache . tools . ant . BuildException ; import org . apache . tools . ant . Project ; import org . apache . tools . ant . taskdefs . Javac ; import org . apache . tools . ant . taskdefs . compilers . DefaultCompilerAdapter ; import org . apache . tools . ant . types . Commandline ; import org . apache . tools . ant . types . Path ; import org . apache . tools . ant . types . Commandline . Argument ; import org . apache . tools . ant . util . JavaEnvUtils ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . antadapter . AntAdapterMessages ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . compiler . util . Util ; public class JDTCompilerAdapter extends DefaultCompilerAdapter { private static final char [ ] SEPARATOR_CHARS = new char [ ] { '<CHAR_LIT:/>' , '<STR_LIT:\\>' } ; private static final char [ ] ADAPTER_PREFIX = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] ADAPTER_ENCODING = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] ADAPTER_ACCESS = "<STR_LIT>" . toCharArray ( ) ; private static String compilerClass = "<STR_LIT>" ; String logFileName ; Map customDefaultOptions ; private Map fileEncodings = null ; private Map dirEncodings = null ; private List accessRules = null ; public boolean execute ( ) throws BuildException { this . attributes . log ( AntAdapterMessages . getString ( "<STR_LIT>" ) , Project . MSG_VERBOSE ) ; Commandline cmd = setupJavacCommand ( ) ; try { Class c = Class . forName ( compilerClass ) ; Constructor batchCompilerConstructor = c . getConstructor ( new Class [ ] { PrintWriter . class , PrintWriter . class , Boolean . TYPE , Map . class } ) ; Object batchCompilerInstance = batchCompilerConstructor . newInstance ( new Object [ ] { new PrintWriter ( System . out ) , new PrintWriter ( System . err ) , Boolean . TRUE , this . customDefaultOptions } ) ; Method compile = c . getMethod ( "<STR_LIT>" , new Class [ ] { String [ ] . class } ) ; Object result = compile . invoke ( batchCompilerInstance , new Object [ ] { cmd . getArguments ( ) } ) ; final boolean resultValue = ( ( Boolean ) result ) . booleanValue ( ) ; if ( ! resultValue && this . logFileName != null ) { this . attributes . log ( AntAdapterMessages . getString ( "<STR_LIT>" , this . logFileName ) ) ; } return resultValue ; } catch ( ClassNotFoundException cnfe ) { throw new BuildException ( AntAdapterMessages . getString ( "<STR_LIT>" ) ) ; } catch ( Exception ex ) { throw new BuildException ( ex ) ; } } protected Commandline setupJavacCommand ( ) throws BuildException { Commandline cmd = new Commandline ( ) ; this . customDefaultOptions = new CompilerOptions ( ) . getMap ( ) ; Class javacClass = Javac . class ; String [ ] compilerArgs = processCompilerArguments ( javacClass ) ; cmd . createArgument ( ) . setValue ( "<STR_LIT>" ) ; if ( this . bootclasspath != null ) { cmd . createArgument ( ) . setValue ( "<STR_LIT>" ) ; if ( this . bootclasspath . size ( ) != <NUM_LIT:0> ) { cmd . createArgument ( ) . setPath ( this . bootclasspath ) ; } else { cmd . createArgument ( ) . setValue ( Util . EMPTY_STRING ) ; } } Path classpath = new Path ( this . project ) ; if ( this . extdirs != null ) { cmd . createArgument ( ) . setValue ( "<STR_LIT>" ) ; cmd . createArgument ( ) . setPath ( this . extdirs ) ; } classpath . append ( getCompileClasspath ( ) ) ; Path sourcepath = null ; Method getSourcepathMethod = null ; try { getSourcepathMethod = javacClass . getMethod ( "<STR_LIT>" , null ) ; } catch ( NoSuchMethodException e ) { } Path compileSourcePath = null ; if ( getSourcepathMethod != null ) { try { compileSourcePath = ( Path ) getSourcepathMethod . invoke ( this . attributes , null ) ; } catch ( IllegalAccessException e ) { } catch ( InvocationTargetException e ) { } } if ( compileSourcePath != null ) { sourcepath = compileSourcePath ; } else { sourcepath = this . src ; } classpath . append ( sourcepath ) ; cmd . createArgument ( ) . setValue ( "<STR_LIT>" ) ; createClasspathArgument ( cmd , classpath ) ; final String javaVersion = JavaEnvUtils . getJavaVersion ( ) ; String memoryParameterPrefix = javaVersion . equals ( JavaEnvUtils . JAVA_1_1 ) ? "<STR_LIT>" : "<STR_LIT>" ; if ( this . memoryInitialSize != null ) { if ( ! this . attributes . isForkedJavac ( ) ) { this . attributes . log ( AntAdapterMessages . getString ( "<STR_LIT>" ) , Project . MSG_WARN ) ; } else { cmd . createArgument ( ) . setValue ( memoryParameterPrefix + "<STR_LIT>" + this . memoryInitialSize ) ; } } if ( this . memoryMaximumSize != null ) { if ( ! this . attributes . isForkedJavac ( ) ) { this . attributes . log ( AntAdapterMessages . getString ( "<STR_LIT>" ) , Project . MSG_WARN ) ; } else { cmd . createArgument ( ) . setValue ( memoryParameterPrefix + "<STR_LIT>" + this . memoryMaximumSize ) ; } } if ( this . debug ) { Method getDebugLevelMethod = null ; try { getDebugLevelMethod = javacClass . getMethod ( "<STR_LIT>" , null ) ; } catch ( NoSuchMethodException e ) { } String debugLevel = null ; if ( getDebugLevelMethod != null ) { try { debugLevel = ( String ) getDebugLevelMethod . invoke ( this . attributes , null ) ; } catch ( IllegalAccessException e ) { } catch ( InvocationTargetException e ) { } } if ( debugLevel != null ) { this . customDefaultOptions . put ( CompilerOptions . OPTION_LocalVariableAttribute , CompilerOptions . DO_NOT_GENERATE ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_LineNumberAttribute , CompilerOptions . DO_NOT_GENERATE ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_SourceFileAttribute , CompilerOptions . DO_NOT_GENERATE ) ; if ( debugLevel . length ( ) != <NUM_LIT:0> ) { if ( debugLevel . indexOf ( "<STR_LIT>" ) != - <NUM_LIT:1> ) { this . customDefaultOptions . put ( CompilerOptions . OPTION_LocalVariableAttribute , CompilerOptions . GENERATE ) ; } if ( debugLevel . indexOf ( "<STR_LIT>" ) != - <NUM_LIT:1> ) { this . customDefaultOptions . put ( CompilerOptions . OPTION_LineNumberAttribute , CompilerOptions . GENERATE ) ; } if ( debugLevel . indexOf ( "<STR_LIT:source>" ) != - <NUM_LIT:1> ) { this . customDefaultOptions . put ( CompilerOptions . OPTION_SourceFileAttribute , CompilerOptions . GENERATE ) ; } } } else { this . customDefaultOptions . put ( CompilerOptions . OPTION_LocalVariableAttribute , CompilerOptions . GENERATE ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_LineNumberAttribute , CompilerOptions . GENERATE ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_SourceFileAttribute , CompilerOptions . GENERATE ) ; } } else { this . customDefaultOptions . put ( CompilerOptions . OPTION_LocalVariableAttribute , CompilerOptions . DO_NOT_GENERATE ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_LineNumberAttribute , CompilerOptions . DO_NOT_GENERATE ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_SourceFileAttribute , CompilerOptions . DO_NOT_GENERATE ) ; } if ( this . attributes . getNowarn ( ) ) { Object [ ] entries = this . customDefaultOptions . entrySet ( ) . toArray ( ) ; for ( int i = <NUM_LIT:0> , max = entries . length ; i < max ; i ++ ) { Map . Entry entry = ( Map . Entry ) entries [ i ] ; if ( ! ( entry . getKey ( ) instanceof String ) ) continue ; if ( ! ( entry . getValue ( ) instanceof String ) ) continue ; if ( ( ( String ) entry . getValue ( ) ) . equals ( CompilerOptions . WARNING ) ) { this . customDefaultOptions . put ( entry . getKey ( ) , CompilerOptions . IGNORE ) ; } } this . customDefaultOptions . put ( CompilerOptions . OPTION_TaskTags , Util . EMPTY_STRING ) ; if ( this . deprecation ) { this . customDefaultOptions . put ( CompilerOptions . OPTION_ReportDeprecation , CompilerOptions . WARNING ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_ReportDeprecationInDeprecatedCode , CompilerOptions . ENABLED ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_ReportDeprecationWhenOverridingDeprecatedMethod , CompilerOptions . ENABLED ) ; } } else if ( this . deprecation ) { this . customDefaultOptions . put ( CompilerOptions . OPTION_ReportDeprecation , CompilerOptions . WARNING ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_ReportDeprecationInDeprecatedCode , CompilerOptions . ENABLED ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_ReportDeprecationWhenOverridingDeprecatedMethod , CompilerOptions . ENABLED ) ; } else { this . customDefaultOptions . put ( CompilerOptions . OPTION_ReportDeprecation , CompilerOptions . IGNORE ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_ReportDeprecationInDeprecatedCode , CompilerOptions . DISABLED ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_ReportDeprecationWhenOverridingDeprecatedMethod , CompilerOptions . DISABLED ) ; } if ( this . destDir != null ) { cmd . createArgument ( ) . setValue ( "<STR_LIT>" ) ; cmd . createArgument ( ) . setFile ( this . destDir . getAbsoluteFile ( ) ) ; } if ( this . verbose ) { cmd . createArgument ( ) . setValue ( "<STR_LIT>" ) ; } if ( ! this . attributes . getFailonerror ( ) ) { cmd . createArgument ( ) . setValue ( "<STR_LIT>" ) ; } if ( this . target != null ) { this . customDefaultOptions . put ( CompilerOptions . OPTION_TargetPlatform , this . target ) ; } String source = this . attributes . getSource ( ) ; if ( source != null ) { this . customDefaultOptions . put ( CompilerOptions . OPTION_Source , source ) ; } if ( compilerArgs != null ) { final int length = compilerArgs . length ; if ( length != <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> , max = length ; i < max ; i ++ ) { String arg = compilerArgs [ i ] ; if ( this . logFileName == null && "<STR_LIT>" . equals ( arg ) && ( ( i + <NUM_LIT:1> ) < max ) ) { this . logFileName = compilerArgs [ i + <NUM_LIT:1> ] ; } cmd . createArgument ( ) . setValue ( arg ) ; } } } if ( this . encoding != null ) { cmd . createArgument ( ) . setValue ( "<STR_LIT>" ) ; cmd . createArgument ( ) . setValue ( this . encoding ) ; } logAndAddFilesToCompile ( cmd ) ; return cmd ; } private String [ ] processCompilerArguments ( Class javacClass ) { Method getCurrentCompilerArgsMethod = null ; try { getCurrentCompilerArgsMethod = javacClass . getMethod ( "<STR_LIT>" , null ) ; } catch ( NoSuchMethodException e ) { } String [ ] compilerArgs = null ; if ( getCurrentCompilerArgsMethod != null ) { try { compilerArgs = ( String [ ] ) getCurrentCompilerArgsMethod . invoke ( this . attributes , null ) ; } catch ( IllegalAccessException e ) { } catch ( InvocationTargetException e ) { } } if ( compilerArgs != null ) checkCompilerArgs ( compilerArgs ) ; return compilerArgs ; } private void checkCompilerArgs ( String [ ] args ) { for ( int i = <NUM_LIT:0> ; i < args . length ; i ++ ) { if ( args [ i ] . charAt ( <NUM_LIT:0> ) == '<CHAR_LIT>' ) { try { char [ ] content = Util . getFileCharContent ( new File ( args [ i ] . substring ( <NUM_LIT:1> ) ) , null ) ; int offset = <NUM_LIT:0> ; int prefixLength = ADAPTER_PREFIX . length ; while ( ( offset = CharOperation . indexOf ( ADAPTER_PREFIX , content , true , offset ) ) > - <NUM_LIT:1> ) { int start = offset + prefixLength ; int end = CharOperation . indexOf ( '<STR_LIT:\n>' , content , start ) ; if ( end == - <NUM_LIT:1> ) end = content . length ; while ( CharOperation . isWhitespace ( content [ end ] ) ) { end -- ; } if ( CharOperation . equals ( ADAPTER_ENCODING , content , start , start + ADAPTER_ENCODING . length ) ) { CharOperation . replace ( content , SEPARATOR_CHARS , File . separatorChar , start , end + <NUM_LIT:1> ) ; start += ADAPTER_ENCODING . length ; int encodeStart = CharOperation . lastIndexOf ( '<CHAR_LIT:[>' , content , start , end ) ; if ( start < encodeStart && encodeStart < end ) { boolean isFile = CharOperation . equals ( SuffixConstants . SUFFIX_java , content , encodeStart - <NUM_LIT:5> , encodeStart , false ) ; String str = String . valueOf ( content , start , encodeStart - start ) ; String enc = String . valueOf ( content , encodeStart , end - encodeStart + <NUM_LIT:1> ) ; if ( isFile ) { if ( this . fileEncodings == null ) this . fileEncodings = new HashMap ( ) ; this . fileEncodings . put ( str , enc ) ; } else { if ( this . dirEncodings == null ) this . dirEncodings = new HashMap ( ) ; this . dirEncodings . put ( str , enc ) ; } } } else if ( CharOperation . equals ( ADAPTER_ACCESS , content , start , start + ADAPTER_ACCESS . length ) ) { start += ADAPTER_ACCESS . length ; int accessStart = CharOperation . indexOf ( '<CHAR_LIT:[>' , content , start , end ) ; CharOperation . replace ( content , SEPARATOR_CHARS , File . separatorChar , start , accessStart ) ; if ( start < accessStart && accessStart < end ) { String path = String . valueOf ( content , start , accessStart - start ) ; String access = String . valueOf ( content , accessStart , end - accessStart + <NUM_LIT:1> ) ; if ( this . accessRules == null ) this . accessRules = new ArrayList ( ) ; this . accessRules . add ( path ) ; this . accessRules . add ( access ) ; } } offset = end ; } } catch ( IOException e ) { } } } } private void createClasspathArgument ( Commandline cmd , Path classpath ) { Argument arg = cmd . createArgument ( ) ; final String [ ] pathElements = classpath . list ( ) ; if ( pathElements . length == <NUM_LIT:0> ) { arg . setValue ( Util . EMPTY_STRING ) ; return ; } if ( this . accessRules == null ) { arg . setPath ( classpath ) ; return ; } int rulesLength = this . accessRules . size ( ) ; String [ ] rules = ( String [ ] ) this . accessRules . toArray ( new String [ rulesLength ] ) ; int nextRule = <NUM_LIT:0> ; final StringBuffer result = new StringBuffer ( ) ; for ( int i = <NUM_LIT:0> , max = pathElements . length ; i < max ; i ++ ) { if ( i > <NUM_LIT:0> ) result . append ( File . pathSeparatorChar ) ; String pathElement = pathElements [ i ] ; result . append ( pathElement ) ; for ( int j = nextRule ; j < rulesLength ; j += <NUM_LIT:2> ) { String rule = rules [ j ] ; if ( pathElement . endsWith ( rule ) ) { result . append ( rules [ j + <NUM_LIT:1> ] ) ; nextRule = j + <NUM_LIT:2> ; break ; } if ( rule . endsWith ( File . separator ) ) { int ruleLength = rule . length ( ) ; if ( pathElement . regionMatches ( false , pathElement . length ( ) - ruleLength + <NUM_LIT:1> , rule , <NUM_LIT:0> , ruleLength - <NUM_LIT:1> ) ) { result . append ( rules [ j + <NUM_LIT:1> ] ) ; nextRule = j + <NUM_LIT:2> ; break ; } } else if ( pathElement . endsWith ( File . separator ) ) { int ruleLength = rule . length ( ) ; if ( pathElement . regionMatches ( false , pathElement . length ( ) - ruleLength - <NUM_LIT:1> , rule , <NUM_LIT:0> , ruleLength ) ) { result . append ( rules [ j + <NUM_LIT:1> ] ) ; nextRule = j + <NUM_LIT:2> ; break ; } } } } arg . setValue ( result . toString ( ) ) ; } protected void logAndAddFilesToCompile ( Commandline cmd ) { this . attributes . log ( "<STR_LIT>" + cmd . describeArguments ( ) , Project . MSG_VERBOSE ) ; StringBuffer niceSourceList = new StringBuffer ( "<STR_LIT>" ) ; if ( this . compileList . length != <NUM_LIT:1> ) { niceSourceList . append ( "<STR_LIT:s>" ) ; } niceSourceList . append ( "<STR_LIT>" ) ; niceSourceList . append ( lSep ) ; String [ ] encodedFiles = null , encodedDirs = null ; int encodedFilesLength = <NUM_LIT:0> , encodedDirsLength = <NUM_LIT:0> ; if ( this . fileEncodings != null ) { encodedFilesLength = this . fileEncodings . size ( ) ; encodedFiles = new String [ encodedFilesLength ] ; this . fileEncodings . keySet ( ) . toArray ( encodedFiles ) ; } if ( this . dirEncodings != null ) { encodedDirsLength = this . dirEncodings . size ( ) ; encodedDirs = new String [ encodedDirsLength ] ; this . dirEncodings . keySet ( ) . toArray ( encodedDirs ) ; Comparator comparator = new Comparator ( ) { public int compare ( Object o1 , Object o2 ) { return ( ( String ) o2 ) . length ( ) - ( ( String ) o1 ) . length ( ) ; } } ; Arrays . sort ( encodedDirs , comparator ) ; } for ( int i = <NUM_LIT:0> ; i < this . compileList . length ; i ++ ) { String arg = this . compileList [ i ] . getAbsolutePath ( ) ; boolean encoded = false ; if ( encodedFiles != null ) { for ( int j = <NUM_LIT:0> ; j < encodedFilesLength ; j ++ ) { if ( arg . endsWith ( encodedFiles [ j ] ) ) { arg = arg + ( String ) this . fileEncodings . get ( encodedFiles [ j ] ) ; if ( j < encodedFilesLength - <NUM_LIT:1> ) { System . arraycopy ( encodedFiles , j + <NUM_LIT:1> , encodedFiles , j , encodedFilesLength - j - <NUM_LIT:1> ) ; } encodedFiles [ -- encodedFilesLength ] = null ; encoded = true ; break ; } } } if ( ! encoded && encodedDirs != null ) { for ( int j = <NUM_LIT:0> ; j < encodedDirsLength ; j ++ ) { if ( arg . lastIndexOf ( encodedDirs [ j ] ) != - <NUM_LIT:1> ) { arg = arg + ( String ) this . dirEncodings . get ( encodedDirs [ j ] ) ; break ; } } } cmd . createArgument ( ) . setValue ( arg ) ; niceSourceList . append ( "<STR_LIT:U+0020U+0020U+0020U+0020>" + arg + lSep ) ; } this . attributes . log ( niceSourceList . toString ( ) , Project . MSG_VERBOSE ) ; } } </s>
<s> package org . eclipse . jdt . core ; import java . io . IOException ; import java . util . Enumeration ; import java . util . zip . ZipEntry ; import java . util . zip . ZipException ; import java . util . zip . ZipFile ; import org . apache . tools . ant . BuildException ; import org . apache . tools . ant . Task ; import org . eclipse . jdt . core . util . IClassFileReader ; import org . eclipse . jdt . core . util . ICodeAttribute ; import org . eclipse . jdt . core . util . IMethodInfo ; import org . eclipse . jdt . internal . antadapter . AntAdapterMessages ; public final class CheckDebugAttributes extends Task { private String file ; private String property ; public void execute ( ) throws BuildException { if ( this . file == null ) { throw new BuildException ( AntAdapterMessages . getString ( "<STR_LIT>" ) ) ; } if ( this . property == null ) { throw new BuildException ( AntAdapterMessages . getString ( "<STR_LIT>" ) ) ; } try { boolean hasDebugAttributes = false ; if ( org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( this . file ) ) { IClassFileReader classFileReader = ToolFactory . createDefaultClassFileReader ( this . file , IClassFileReader . ALL ) ; hasDebugAttributes = checkClassFile ( classFileReader ) ; } else { ZipFile jarFile = null ; try { jarFile = new ZipFile ( this . file ) ; } catch ( ZipException e ) { throw new BuildException ( AntAdapterMessages . getString ( "<STR_LIT>" ) ) ; } for ( Enumeration entries = jarFile . entries ( ) ; ! hasDebugAttributes && entries . hasMoreElements ( ) ; ) { ZipEntry entry = ( ZipEntry ) entries . nextElement ( ) ; if ( org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( entry . getName ( ) ) ) { IClassFileReader classFileReader = ToolFactory . createDefaultClassFileReader ( this . file , entry . getName ( ) , IClassFileReader . ALL ) ; hasDebugAttributes = checkClassFile ( classFileReader ) ; } } } if ( hasDebugAttributes ) { getProject ( ) . setUserProperty ( this . property , "<STR_LIT>" ) ; } } catch ( IOException e ) { throw new BuildException ( AntAdapterMessages . getString ( "<STR_LIT>" ) + this . file ) ; } } private boolean checkClassFile ( IClassFileReader classFileReader ) { IMethodInfo [ ] methodInfos = classFileReader . getMethodInfos ( ) ; for ( int i = <NUM_LIT:0> , max = methodInfos . length ; i < max ; i ++ ) { ICodeAttribute codeAttribute = methodInfos [ i ] . getCodeAttribute ( ) ; if ( codeAttribute != null && codeAttribute . getLineNumberAttribute ( ) != null ) { return true ; } } return false ; } public void setFile ( String value ) { this . file = value ; } public void setProperty ( String value ) { this . property = value ; } } </s>
<s> package org . eclipse . jdt . internal . antadapter ; import java . text . MessageFormat ; import java . util . Locale ; import java . util . MissingResourceException ; import java . util . ResourceBundle ; public class AntAdapterMessages { private static final String BUNDLE_NAME = "<STR_LIT>" ; private static ResourceBundle RESOURCE_BUNDLE ; static { try { RESOURCE_BUNDLE = ResourceBundle . getBundle ( BUNDLE_NAME , Locale . getDefault ( ) ) ; } catch ( MissingResourceException e ) { System . out . println ( "<STR_LIT>" + BUNDLE_NAME . replace ( '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) + "<STR_LIT>" + Locale . getDefault ( ) ) ; throw e ; } } private AntAdapterMessages ( ) { } public static String getString ( String key ) { try { return RESOURCE_BUNDLE . getString ( key ) ; } catch ( MissingResourceException e ) { return '<CHAR_LIT>' + key + '<CHAR_LIT>' ; } } public static String getString ( String key , String argument ) { try { String message = RESOURCE_BUNDLE . getString ( key ) ; MessageFormat messageFormat = new MessageFormat ( message ) ; return messageFormat . format ( new String [ ] { argument } ) ; } catch ( MissingResourceException e ) { return '<CHAR_LIT>' + key + '<CHAR_LIT>' ; } } } </s>
<s> package org . eclipse . jdt . core . dom ; import org . eclipse . jdt . core . WorkingCopyOwner ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . CompilationUnitScope ; import org . eclipse . jdt . internal . compiler . lookup . ElementValuePair ; import org . eclipse . jdt . internal . compiler . lookup . LookupEnvironment ; class BindingResolver { BindingResolver ( ) { } ASTNode findDeclaringNode ( IBinding binding ) { return null ; } ASTNode findDeclaringNode ( String bindingKey ) { return null ; } ASTNode findDeclaringNode ( IAnnotationBinding instance ) { return null ; } org . eclipse . jdt . internal . compiler . ast . ASTNode getCorrespondingNode ( ASTNode currentNode ) { return null ; } IMethodBinding getMethodBinding ( org . eclipse . jdt . internal . compiler . lookup . MethodBinding methodBinding ) { return null ; } IMemberValuePairBinding getMemberValuePairBinding ( ElementValuePair valuePair ) { return null ; } IPackageBinding getPackageBinding ( org . eclipse . jdt . internal . compiler . lookup . PackageBinding packageBinding ) { return null ; } ITypeBinding getTypeBinding ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding referenceBinding ) { return null ; } ITypeBinding getTypeBinding ( VariableDeclaration variableDeclaration ) { return null ; } ITypeBinding getTypeBinding ( Type type ) { return null ; } ITypeBinding getTypeBinding ( RecoveredTypeBinding recoveredTypeBinding , int dimensions ) { return null ; } IVariableBinding getVariableBinding ( org . eclipse . jdt . internal . compiler . lookup . VariableBinding binding ) { return null ; } public WorkingCopyOwner getWorkingCopyOwner ( ) { return null ; } IAnnotationBinding getAnnotationInstance ( org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding instance ) { return null ; } boolean isResolvedTypeInferredFromExpectedType ( MethodInvocation methodInvocation ) { return false ; } boolean isResolvedTypeInferredFromExpectedType ( SuperMethodInvocation methodInvocation ) { return false ; } LookupEnvironment lookupEnvironment ( ) { return null ; } void recordScope ( ASTNode astNode , BlockScope blockScope ) { } boolean resolveBoxing ( Expression expression ) { return false ; } boolean resolveUnboxing ( Expression expression ) { return false ; } Object resolveConstantExpressionValue ( Expression expression ) { return null ; } IMethodBinding resolveConstructor ( ClassInstanceCreation expression ) { return null ; } IMethodBinding resolveConstructor ( ConstructorInvocation expression ) { return null ; } IMethodBinding resolveConstructor ( EnumConstantDeclaration enumConstantDeclaration ) { return null ; } IMethodBinding resolveConstructor ( SuperConstructorInvocation expression ) { return null ; } ITypeBinding resolveExpressionType ( Expression expression ) { return null ; } IVariableBinding resolveField ( FieldAccess fieldAccess ) { return null ; } IVariableBinding resolveField ( SuperFieldAccess fieldAccess ) { return null ; } IBinding resolveImport ( ImportDeclaration importDeclaration ) { return null ; } IMethodBinding resolveMember ( AnnotationTypeMemberDeclaration member ) { return null ; } IMethodBinding resolveMethod ( MethodDeclaration method ) { return null ; } IMethodBinding resolveMethod ( MethodInvocation method ) { return null ; } IMethodBinding resolveMethod ( SuperMethodInvocation method ) { return null ; } IBinding resolveName ( Name name ) { return null ; } IPackageBinding resolvePackage ( PackageDeclaration pkg ) { return null ; } IBinding resolveReference ( MemberRef ref ) { return null ; } IMemberValuePairBinding resolveMemberValuePair ( MemberValuePair memberValuePair ) { return null ; } IBinding resolveReference ( MethodRef ref ) { return null ; } ITypeBinding resolveType ( AnnotationTypeDeclaration type ) { return null ; } ITypeBinding resolveType ( AnonymousClassDeclaration type ) { return null ; } ITypeBinding resolveType ( EnumDeclaration type ) { return null ; } ITypeBinding resolveType ( Type type ) { return null ; } ITypeBinding resolveType ( TypeDeclaration type ) { return null ; } ITypeBinding resolveTypeParameter ( TypeParameter typeParameter ) { return null ; } IVariableBinding resolveVariable ( EnumConstantDeclaration enumConstant ) { return null ; } IVariableBinding resolveVariable ( VariableDeclaration variable ) { return null ; } ITypeBinding resolveWellKnownType ( String name ) { return null ; } IAnnotationBinding resolveAnnotation ( Annotation annotation ) { return null ; } ITypeBinding resolveArrayType ( ITypeBinding typeBinding , int dimensions ) { return null ; } public CompilationUnitScope scope ( ) { return null ; } void store ( ASTNode newNode , org . eclipse . jdt . internal . compiler . ast . ASTNode oldASTNode ) { } void updateKey ( ASTNode node , ASTNode newNode ) { } } </s>
<s> package org . eclipse . jdt . core . dom ; public final class SimplePropertyDescriptor extends StructuralPropertyDescriptor { private final Class valueType ; private final boolean mandatory ; SimplePropertyDescriptor ( Class nodeClass , String propertyId , Class valueType , boolean mandatory ) { super ( nodeClass , propertyId ) ; if ( valueType == null || ASTNode . class . isAssignableFrom ( valueType ) ) { throw new IllegalArgumentException ( ) ; } this . valueType = valueType ; this . mandatory = mandatory ; } public Class getValueType ( ) { return this . valueType ; } public boolean isMandatory ( ) { return this . mandatory ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; public class SingleVariableDeclaration extends VariableDeclaration { public static final SimplePropertyDescriptor MODIFIERS_PROPERTY = new SimplePropertyDescriptor ( SingleVariableDeclaration . class , "<STR_LIT>" , int . class , MANDATORY ) ; public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY = new ChildListPropertyDescriptor ( SingleVariableDeclaration . class , "<STR_LIT>" , IExtendedModifier . class , CYCLE_RISK ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( SingleVariableDeclaration . class , "<STR_LIT:name>" , SimpleName . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor ( SingleVariableDeclaration . class , "<STR_LIT:type>" , Type . class , MANDATORY , NO_CYCLE_RISK ) ; public static final SimplePropertyDescriptor VARARGS_PROPERTY = new SimplePropertyDescriptor ( SingleVariableDeclaration . class , "<STR_LIT>" , boolean . class , MANDATORY ) ; public static final SimplePropertyDescriptor EXTRA_DIMENSIONS_PROPERTY = new SimplePropertyDescriptor ( SingleVariableDeclaration . class , "<STR_LIT>" , int . class , MANDATORY ) ; public static final ChildPropertyDescriptor INITIALIZER_PROPERTY = new ChildPropertyDescriptor ( SingleVariableDeclaration . class , "<STR_LIT>" , Expression . class , OPTIONAL , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS_2_0 ; private static final List PROPERTY_DESCRIPTORS_3_0 ; static { List propertyList = new ArrayList ( <NUM_LIT:6> ) ; createPropertyList ( SingleVariableDeclaration . class , propertyList ) ; addProperty ( MODIFIERS_PROPERTY , propertyList ) ; addProperty ( TYPE_PROPERTY , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; addProperty ( EXTRA_DIMENSIONS_PROPERTY , propertyList ) ; addProperty ( INITIALIZER_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( propertyList ) ; propertyList = new ArrayList ( <NUM_LIT:7> ) ; createPropertyList ( SingleVariableDeclaration . class , propertyList ) ; addProperty ( MODIFIERS2_PROPERTY , propertyList ) ; addProperty ( TYPE_PROPERTY , propertyList ) ; addProperty ( VARARGS_PROPERTY , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; addProperty ( EXTRA_DIMENSIONS_PROPERTY , propertyList ) ; addProperty ( INITIALIZER_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_3_0 = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { if ( apiLevel == AST . JLS2_INTERNAL ) { return PROPERTY_DESCRIPTORS_2_0 ; } else { return PROPERTY_DESCRIPTORS_3_0 ; } } private ASTNode . NodeList modifiers = null ; private int modifierFlags = Modifier . NONE ; private SimpleName variableName = null ; private Type type = null ; private boolean variableArity = false ; private int extraArrayDimensions = <NUM_LIT:0> ; private Expression optionalInitializer = null ; SingleVariableDeclaration ( AST ast ) { super ( ast ) ; if ( ast . apiLevel >= AST . JLS3 ) { this . modifiers = new ASTNode . NodeList ( MODIFIERS2_PROPERTY ) ; } } final SimplePropertyDescriptor internalExtraDimensionsProperty ( ) { return EXTRA_DIMENSIONS_PROPERTY ; } final ChildPropertyDescriptor internalInitializerProperty ( ) { return INITIALIZER_PROPERTY ; } final ChildPropertyDescriptor internalNameProperty ( ) { return NAME_PROPERTY ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final int internalGetSetIntProperty ( SimplePropertyDescriptor property , boolean get , int value ) { if ( property == MODIFIERS_PROPERTY ) { if ( get ) { return getModifiers ( ) ; } else { setModifiers ( value ) ; return <NUM_LIT:0> ; } } if ( property == EXTRA_DIMENSIONS_PROPERTY ) { if ( get ) { return getExtraDimensions ( ) ; } else { setExtraDimensions ( value ) ; return <NUM_LIT:0> ; } } return super . internalGetSetIntProperty ( property , get , value ) ; } final boolean internalGetSetBooleanProperty ( SimplePropertyDescriptor property , boolean get , boolean value ) { if ( property == VARARGS_PROPERTY ) { if ( get ) { return isVarargs ( ) ; } else { setVarargs ( value ) ; return false ; } } return super . internalGetSetBooleanProperty ( property , get , value ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } if ( property == TYPE_PROPERTY ) { if ( get ) { return getType ( ) ; } else { setType ( ( Type ) child ) ; return null ; } } if ( property == INITIALIZER_PROPERTY ) { if ( get ) { return getInitializer ( ) ; } else { setInitializer ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == MODIFIERS2_PROPERTY ) { return modifiers ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return SINGLE_VARIABLE_DECLARATION ; } ASTNode clone0 ( AST target ) { SingleVariableDeclaration result = new SingleVariableDeclaration ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { result . setModifiers ( getModifiers ( ) ) ; } else { result . modifiers ( ) . addAll ( ASTNode . copySubtrees ( target , modifiers ( ) ) ) ; result . setVarargs ( isVarargs ( ) ) ; } result . setType ( ( Type ) getType ( ) . clone ( target ) ) ; result . setExtraDimensions ( getExtraDimensions ( ) ) ; result . setName ( ( SimpleName ) getName ( ) . clone ( target ) ) ; result . setInitializer ( ( Expression ) ASTNode . copySubtree ( target , getInitializer ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { if ( this . ast . apiLevel >= AST . JLS3 ) { acceptChildren ( visitor , this . modifiers ) ; } acceptChild ( visitor , getType ( ) ) ; acceptChild ( visitor , getName ( ) ) ; acceptChild ( visitor , getInitializer ( ) ) ; } visitor . endVisit ( this ) ; } public List modifiers ( ) { if ( this . modifiers == null ) { unsupportedIn2 ( ) ; } return this . modifiers ; } public int getModifiers ( ) { if ( this . modifiers == null ) { return this . modifierFlags ; } else { int computedModifierFlags = Modifier . NONE ; for ( Iterator it = modifiers ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Object x = it . next ( ) ; if ( x instanceof Modifier ) { computedModifierFlags |= ( ( Modifier ) x ) . getKeyword ( ) . toFlagValue ( ) ; } } return computedModifierFlags ; } } public void setModifiers ( int modifiers ) { internalSetModifiers ( modifiers ) ; } final void internalSetModifiers ( int pmodifiers ) { supportedOnlyIn2 ( ) ; preValueChange ( MODIFIERS_PROPERTY ) ; this . modifierFlags = pmodifiers ; postValueChange ( MODIFIERS_PROPERTY ) ; } public SimpleName getName ( ) { if ( this . variableName == null ) { synchronized ( this ) { if ( this . variableName == null ) { preLazyInit ( ) ; this . variableName = new SimpleName ( this . ast ) ; postLazyInit ( this . variableName , NAME_PROPERTY ) ; } } } return this . variableName ; } public void setName ( SimpleName variableName ) { if ( variableName == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . variableName ; preReplaceChild ( oldChild , variableName , NAME_PROPERTY ) ; this . variableName = variableName ; postReplaceChild ( oldChild , variableName , NAME_PROPERTY ) ; } public Type getType ( ) { if ( this . type == null ) { synchronized ( this ) { if ( this . type == null ) { preLazyInit ( ) ; this . type = this . ast . newPrimitiveType ( PrimitiveType . INT ) ; postLazyInit ( this . type , TYPE_PROPERTY ) ; } } } return this . type ; } public void setType ( Type type ) { if ( type == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . type ; preReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; this . type = type ; postReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; } public boolean isVarargs ( ) { if ( this . modifiers == null ) { unsupportedIn2 ( ) ; } return this . variableArity ; } public void setVarargs ( boolean variableArity ) { if ( this . modifiers == null ) { unsupportedIn2 ( ) ; } preValueChange ( VARARGS_PROPERTY ) ; this . variableArity = variableArity ; postValueChange ( VARARGS_PROPERTY ) ; } public int getExtraDimensions ( ) { return this . extraArrayDimensions ; } public void setExtraDimensions ( int dimensions ) { if ( dimensions < <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } preValueChange ( EXTRA_DIMENSIONS_PROPERTY ) ; this . extraArrayDimensions = dimensions ; postValueChange ( EXTRA_DIMENSIONS_PROPERTY ) ; } public Expression getInitializer ( ) { return this . optionalInitializer ; } public void setInitializer ( Expression initializer ) { ASTNode oldChild = this . optionalInitializer ; preReplaceChild ( oldChild , initializer , INITIALIZER_PROPERTY ) ; this . optionalInitializer = initializer ; postReplaceChild ( oldChild , initializer , INITIALIZER_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:7> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . modifiers == null ? <NUM_LIT:0> : this . modifiers . listSize ( ) ) + ( this . type == null ? <NUM_LIT:0> : getType ( ) . treeSize ( ) ) + ( this . variableName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) + ( this . optionalInitializer == null ? <NUM_LIT:0> : getInitializer ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class SuperConstructorInvocation extends Statement { public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( SuperConstructorInvocation . class , "<STR_LIT>" , Expression . class , OPTIONAL , CYCLE_RISK ) ; public static final ChildListPropertyDescriptor TYPE_ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor ( SuperConstructorInvocation . class , "<STR_LIT>" , Type . class , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor ( SuperConstructorInvocation . class , "<STR_LIT>" , Expression . class , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS_2_0 ; private static final List PROPERTY_DESCRIPTORS_3_0 ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( SuperConstructorInvocation . class , propertyList ) ; addProperty ( EXPRESSION_PROPERTY , propertyList ) ; addProperty ( ARGUMENTS_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( propertyList ) ; propertyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( SuperConstructorInvocation . class , propertyList ) ; addProperty ( EXPRESSION_PROPERTY , propertyList ) ; addProperty ( TYPE_ARGUMENTS_PROPERTY , propertyList ) ; addProperty ( ARGUMENTS_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_3_0 = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { if ( apiLevel == AST . JLS2_INTERNAL ) { return PROPERTY_DESCRIPTORS_2_0 ; } else { return PROPERTY_DESCRIPTORS_3_0 ; } } private Expression optionalExpression = null ; private ASTNode . NodeList typeArguments = null ; private ASTNode . NodeList arguments = new ASTNode . NodeList ( ARGUMENTS_PROPERTY ) ; SuperConstructorInvocation ( AST ast ) { super ( ast ) ; if ( ast . apiLevel >= AST . JLS3 ) { this . typeArguments = new ASTNode . NodeList ( TYPE_ARGUMENTS_PROPERTY ) ; } } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == EXPRESSION_PROPERTY ) { if ( get ) { return getExpression ( ) ; } else { setExpression ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == ARGUMENTS_PROPERTY ) { return arguments ( ) ; } if ( property == TYPE_ARGUMENTS_PROPERTY ) { return typeArguments ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return SUPER_CONSTRUCTOR_INVOCATION ; } ASTNode clone0 ( AST target ) { SuperConstructorInvocation result = new SuperConstructorInvocation ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; result . setExpression ( ( Expression ) ASTNode . copySubtree ( target , getExpression ( ) ) ) ; if ( this . ast . apiLevel >= AST . JLS3 ) { result . typeArguments ( ) . addAll ( ASTNode . copySubtrees ( target , typeArguments ( ) ) ) ; } result . arguments ( ) . addAll ( ASTNode . copySubtrees ( target , arguments ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getExpression ( ) ) ; if ( this . ast . apiLevel >= AST . JLS3 ) { acceptChildren ( visitor , this . typeArguments ) ; } acceptChildren ( visitor , this . arguments ) ; } visitor . endVisit ( this ) ; } public Expression getExpression ( ) { return this . optionalExpression ; } public void setExpression ( Expression expression ) { ASTNode oldChild = this . optionalExpression ; preReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; this . optionalExpression = expression ; postReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; } public List typeArguments ( ) { if ( this . typeArguments == null ) { unsupportedIn2 ( ) ; } return this . typeArguments ; } public List arguments ( ) { return this . arguments ; } public IMethodBinding resolveConstructorBinding ( ) { return this . ast . getBindingResolver ( ) . resolveConstructor ( this ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:3> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalExpression == null ? <NUM_LIT:0> : getExpression ( ) . treeSize ( ) ) + ( this . typeArguments == null ? <NUM_LIT:0> : this . typeArguments . listSize ( ) ) + ( this . arguments == null ? <NUM_LIT:0> : this . arguments . listSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import org . eclipse . jdt . core . IAnnotation ; import org . eclipse . jdt . core . IJavaElement ; public interface IBinding { public static final int PACKAGE = <NUM_LIT:1> ; public static final int TYPE = <NUM_LIT:2> ; public static final int VARIABLE = <NUM_LIT:3> ; public static final int METHOD = <NUM_LIT:4> ; public static final int ANNOTATION = <NUM_LIT:5> ; public static final int MEMBER_VALUE_PAIR = <NUM_LIT:6> ; public IAnnotationBinding [ ] getAnnotations ( ) ; public int getKind ( ) ; public String getName ( ) ; public int getModifiers ( ) ; public boolean isDeprecated ( ) ; public boolean isRecovered ( ) ; public boolean isSynthetic ( ) ; public IJavaElement getJavaElement ( ) ; public String getKey ( ) ; public boolean equals ( Object obj ) ; public boolean isEqualTo ( IBinding binding ) ; public String toString ( ) ; } </s>
<s> package org . eclipse . jdt . core . dom ; public final class ChildListPropertyDescriptor extends StructuralPropertyDescriptor { final Class elementType ; final boolean cycleRisk ; ChildListPropertyDescriptor ( Class nodeClass , String propertyId , Class elementType , boolean cycleRisk ) { super ( nodeClass , propertyId ) ; if ( elementType == null ) { throw new IllegalArgumentException ( ) ; } this . elementType = elementType ; this . cycleRisk = cycleRisk ; } public final Class getElementType ( ) { return this . elementType ; } public final boolean cycleRisk ( ) { return this . cycleRisk ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import org . eclipse . jdt . core . dom . BindingResolver ; import org . eclipse . jdt . core . dom . IMethodBinding ; class DefaultValuePairBinding extends MemberValuePairBinding { private org . eclipse . jdt . internal . compiler . lookup . MethodBinding method ; DefaultValuePairBinding ( org . eclipse . jdt . internal . compiler . lookup . MethodBinding binding , BindingResolver resolver ) { super ( null , resolver ) ; this . method = binding ; this . value = MemberValuePairBinding . buildDOMValue ( binding . getDefaultValue ( ) , resolver ) ; } public IMethodBinding getMethodBinding ( ) { return this . bindingResolver . getMethodBinding ( this . method ) ; } public String getName ( ) { return new String ( this . method . selector ) ; } public Object getValue ( ) { return this . value ; } public boolean isDefault ( ) { return true ; } public boolean isDeprecated ( ) { return this . method . isDeprecated ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . jdt . internal . compiler . batch . FileSystem ; import org . eclipse . jdt . internal . compiler . env . NameEnvironmentAnswer ; import org . eclipse . jdt . internal . compiler . problem . AbortCompilation ; import org . eclipse . jdt . internal . core . INameEnviromentWithProgress ; import org . eclipse . jdt . internal . core . NameLookup ; class NameEnviromentWithProgress extends FileSystem implements INameEnviromentWithProgress { IProgressMonitor monitor ; public NameEnviromentWithProgress ( Classpath [ ] paths , String [ ] initialFileNames , IProgressMonitor monitor ) { super ( paths , initialFileNames ) ; setMonitor ( monitor ) ; } private void checkCanceled ( ) { if ( this . monitor != null && this . monitor . isCanceled ( ) ) { if ( NameLookup . VERBOSE ) { System . out . println ( Thread . currentThread ( ) + "<STR_LIT>" ) ; } throw new AbortCompilation ( true , new OperationCanceledException ( ) ) ; } } public NameEnvironmentAnswer findType ( char [ ] typeName , char [ ] [ ] packageName ) { checkCanceled ( ) ; return super . findType ( typeName , packageName ) ; } public NameEnvironmentAnswer findType ( char [ ] [ ] compoundName ) { checkCanceled ( ) ; return super . findType ( compoundName ) ; } public boolean isPackage ( char [ ] [ ] compoundName , char [ ] packageName ) { checkCanceled ( ) ; return super . isPackage ( compoundName , packageName ) ; } public void setMonitor ( IProgressMonitor monitor ) { this . monitor = monitor ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; public class Assignment extends Expression { public static class Operator { private String op ; private Operator ( String op ) { this . op = op ; } public String toString ( ) { return this . op ; } public static final Operator ASSIGN = new Operator ( "<STR_LIT:=>" ) ; public static final Operator PLUS_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator MINUS_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator TIMES_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator DIVIDE_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator BIT_AND_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator BIT_OR_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator BIT_XOR_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator REMAINDER_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator LEFT_SHIFT_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator RIGHT_SHIFT_SIGNED_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator RIGHT_SHIFT_UNSIGNED_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static Operator toOperator ( String token ) { return ( Operator ) CODES . get ( token ) ; } private static final Map CODES ; static { CODES = new HashMap ( <NUM_LIT:20> ) ; Operator [ ] ops = { ASSIGN , PLUS_ASSIGN , MINUS_ASSIGN , TIMES_ASSIGN , DIVIDE_ASSIGN , BIT_AND_ASSIGN , BIT_OR_ASSIGN , BIT_XOR_ASSIGN , REMAINDER_ASSIGN , LEFT_SHIFT_ASSIGN , RIGHT_SHIFT_SIGNED_ASSIGN , RIGHT_SHIFT_UNSIGNED_ASSIGN } ; for ( int i = <NUM_LIT:0> ; i < ops . length ; i ++ ) { CODES . put ( ops [ i ] . toString ( ) , ops [ i ] ) ; } } } public static final ChildPropertyDescriptor LEFT_HAND_SIDE_PROPERTY = new ChildPropertyDescriptor ( Assignment . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; public static final SimplePropertyDescriptor OPERATOR_PROPERTY = new SimplePropertyDescriptor ( Assignment . class , "<STR_LIT>" , Assignment . Operator . class , MANDATORY ) ; public static final ChildPropertyDescriptor RIGHT_HAND_SIDE_PROPERTY = new ChildPropertyDescriptor ( Assignment . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( Assignment . class , properyList ) ; addProperty ( LEFT_HAND_SIDE_PROPERTY , properyList ) ; addProperty ( OPERATOR_PROPERTY , properyList ) ; addProperty ( RIGHT_HAND_SIDE_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Assignment . Operator assignmentOperator = Assignment . Operator . ASSIGN ; private Expression leftHandSide = null ; private Expression rightHandSide = null ; Assignment ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final Object internalGetSetObjectProperty ( SimplePropertyDescriptor property , boolean get , Object value ) { if ( property == OPERATOR_PROPERTY ) { if ( get ) { return getOperator ( ) ; } else { setOperator ( ( Operator ) value ) ; return null ; } } return super . internalGetSetObjectProperty ( property , get , value ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == LEFT_HAND_SIDE_PROPERTY ) { if ( get ) { return getLeftHandSide ( ) ; } else { setLeftHandSide ( ( Expression ) child ) ; return null ; } } if ( property == RIGHT_HAND_SIDE_PROPERTY ) { if ( get ) { return getRightHandSide ( ) ; } else { setRightHandSide ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return ASSIGNMENT ; } ASTNode clone0 ( AST target ) { Assignment result = new Assignment ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setOperator ( getOperator ( ) ) ; result . setLeftHandSide ( ( Expression ) getLeftHandSide ( ) . clone ( target ) ) ; result . setRightHandSide ( ( Expression ) getRightHandSide ( ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getLeftHandSide ( ) ) ; acceptChild ( visitor , getRightHandSide ( ) ) ; } visitor . endVisit ( this ) ; } public Assignment . Operator getOperator ( ) { return this . assignmentOperator ; } public void setOperator ( Assignment . Operator assignmentOperator ) { if ( assignmentOperator == null ) { throw new IllegalArgumentException ( ) ; } preValueChange ( OPERATOR_PROPERTY ) ; this . assignmentOperator = assignmentOperator ; postValueChange ( OPERATOR_PROPERTY ) ; } public Expression getLeftHandSide ( ) { if ( this . leftHandSide == null ) { synchronized ( this ) { if ( this . leftHandSide == null ) { preLazyInit ( ) ; this . leftHandSide = new SimpleName ( this . ast ) ; postLazyInit ( this . leftHandSide , LEFT_HAND_SIDE_PROPERTY ) ; } } } return this . leftHandSide ; } public void setLeftHandSide ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . leftHandSide ; preReplaceChild ( oldChild , expression , LEFT_HAND_SIDE_PROPERTY ) ; this . leftHandSide = expression ; postReplaceChild ( oldChild , expression , LEFT_HAND_SIDE_PROPERTY ) ; } public Expression getRightHandSide ( ) { if ( this . rightHandSide == null ) { synchronized ( this ) { if ( this . rightHandSide == null ) { preLazyInit ( ) ; this . rightHandSide = new SimpleName ( this . ast ) ; postLazyInit ( this . rightHandSide , RIGHT_HAND_SIDE_PROPERTY ) ; } } } return this . rightHandSide ; } public void setRightHandSide ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . rightHandSide ; preReplaceChild ( oldChild , expression , RIGHT_HAND_SIDE_PROPERTY ) ; this . rightHandSide = expression ; postReplaceChild ( oldChild , expression , RIGHT_HAND_SIDE_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:3> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . leftHandSide == null ? <NUM_LIT:0> : getLeftHandSide ( ) . treeSize ( ) ) + ( this . rightHandSide == null ? <NUM_LIT:0> : getRightHandSide ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class ArrayCreation extends Expression { public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor ( ArrayCreation . class , "<STR_LIT:type>" , ArrayType . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor DIMENSIONS_PROPERTY = new ChildListPropertyDescriptor ( ArrayCreation . class , "<STR_LIT>" , Expression . class , CYCLE_RISK ) ; public static final ChildPropertyDescriptor INITIALIZER_PROPERTY = new ChildPropertyDescriptor ( ArrayCreation . class , "<STR_LIT>" , ArrayInitializer . class , OPTIONAL , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( ArrayCreation . class , properyList ) ; addProperty ( TYPE_PROPERTY , properyList ) ; addProperty ( DIMENSIONS_PROPERTY , properyList ) ; addProperty ( INITIALIZER_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private ArrayType arrayType = null ; private ASTNode . NodeList dimensions = new ASTNode . NodeList ( DIMENSIONS_PROPERTY ) ; private ArrayInitializer optionalInitializer = null ; ArrayCreation ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == INITIALIZER_PROPERTY ) { if ( get ) { return getInitializer ( ) ; } else { setInitializer ( ( ArrayInitializer ) child ) ; return null ; } } if ( property == TYPE_PROPERTY ) { if ( get ) { return getType ( ) ; } else { setType ( ( ArrayType ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == DIMENSIONS_PROPERTY ) { return dimensions ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return ARRAY_CREATION ; } ASTNode clone0 ( AST target ) { ArrayCreation result = new ArrayCreation ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setType ( ( ArrayType ) getType ( ) . clone ( target ) ) ; result . dimensions ( ) . addAll ( ASTNode . copySubtrees ( target , dimensions ( ) ) ) ; result . setInitializer ( ( ArrayInitializer ) ASTNode . copySubtree ( target , getInitializer ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getType ( ) ) ; acceptChildren ( visitor , this . dimensions ) ; acceptChild ( visitor , getInitializer ( ) ) ; } visitor . endVisit ( this ) ; } public ArrayType getType ( ) { if ( this . arrayType == null ) { synchronized ( this ) { if ( this . arrayType == null ) { preLazyInit ( ) ; this . arrayType = this . ast . newArrayType ( this . ast . newPrimitiveType ( PrimitiveType . INT ) ) ; postLazyInit ( this . arrayType , TYPE_PROPERTY ) ; } } } return this . arrayType ; } public void setType ( ArrayType type ) { if ( type == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . arrayType ; preReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; this . arrayType = type ; postReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; } public List dimensions ( ) { return this . dimensions ; } public ArrayInitializer getInitializer ( ) { return this . optionalInitializer ; } public void setInitializer ( ArrayInitializer initializer ) { ASTNode oldChild = this . optionalInitializer ; preReplaceChild ( oldChild , initializer , INITIALIZER_PROPERTY ) ; this . optionalInitializer = initializer ; postReplaceChild ( oldChild , initializer , INITIALIZER_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:3> * <NUM_LIT:4> ; } int treeSize ( ) { int size = memSize ( ) + ( this . arrayType == null ? <NUM_LIT:0> : getType ( ) . treeSize ( ) ) + ( this . optionalInitializer == null ? <NUM_LIT:0> : getInitializer ( ) . treeSize ( ) ) + this . dimensions . listSize ( ) ; return size ; } } </s>
<s> package org . eclipse . jdt . core . dom ; public abstract class StructuralPropertyDescriptor { private final String propertyId ; private final Class nodeClass ; StructuralPropertyDescriptor ( Class nodeClass , String propertyId ) { if ( nodeClass == null || propertyId == null ) { throw new IllegalArgumentException ( ) ; } this . propertyId = propertyId ; this . nodeClass = nodeClass ; } public final String getId ( ) { return this . propertyId ; } public final Class getNodeClass ( ) { return this . nodeClass ; } public final boolean isSimpleProperty ( ) { return ( this instanceof SimplePropertyDescriptor ) ; } public final boolean isChildProperty ( ) { return ( this instanceof ChildPropertyDescriptor ) ; } public final boolean isChildListProperty ( ) { return ( this instanceof ChildListPropertyDescriptor ) ; } public String toString ( ) { StringBuffer b = new StringBuffer ( ) ; if ( isChildListProperty ( ) ) { b . append ( "<STR_LIT>" ) ; } if ( isChildProperty ( ) ) { b . append ( "<STR_LIT>" ) ; } if ( isSimpleProperty ( ) ) { b . append ( "<STR_LIT>" ) ; } b . append ( "<STR_LIT>" ) ; if ( this . nodeClass != null ) { b . append ( this . nodeClass . getName ( ) ) ; } b . append ( "<STR_LIT:U+002C>" ) ; if ( this . propertyId != null ) { b . append ( this . propertyId ) ; } b . append ( "<STR_LIT:]>" ) ; return b . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . internal . compiler . lookup . ExtraCompilerModifiers ; import org . eclipse . jdt . internal . compiler . lookup . LookupEnvironment ; import org . eclipse . jdt . internal . compiler . lookup . ParameterizedGenericMethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . RawTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeVariableBinding ; import org . eclipse . jdt . internal . compiler . problem . AbortCompilation ; import org . eclipse . jdt . internal . core . JavaElement ; import org . eclipse . jdt . internal . core . util . Util ; class MethodBinding implements IMethodBinding { private static final int VALID_MODIFIERS = Modifier . PUBLIC | Modifier . PROTECTED | Modifier . PRIVATE | Modifier . ABSTRACT | Modifier . STATIC | Modifier . FINAL | Modifier . SYNCHRONIZED | Modifier . NATIVE | Modifier . STRICTFP ; private static final ITypeBinding [ ] NO_TYPE_BINDINGS = new ITypeBinding [ <NUM_LIT:0> ] ; private org . eclipse . jdt . internal . compiler . lookup . MethodBinding binding ; private BindingResolver resolver ; private ITypeBinding [ ] parameterTypes ; private ITypeBinding [ ] exceptionTypes ; private String name ; private ITypeBinding declaringClass ; private ITypeBinding returnType ; private String key ; private ITypeBinding [ ] typeParameters ; private ITypeBinding [ ] typeArguments ; private IAnnotationBinding [ ] annotations ; private IAnnotationBinding [ ] [ ] parameterAnnotations ; MethodBinding ( BindingResolver resolver , org . eclipse . jdt . internal . compiler . lookup . MethodBinding binding ) { this . resolver = resolver ; this . binding = binding ; } public boolean isAnnotationMember ( ) { return getDeclaringClass ( ) . isAnnotation ( ) ; } public boolean isConstructor ( ) { return this . binding . isConstructor ( ) ; } public boolean isDefaultConstructor ( ) { final ReferenceBinding declaringClassBinding = this . binding . declaringClass ; if ( declaringClassBinding . isRawType ( ) ) { RawTypeBinding rawTypeBinding = ( RawTypeBinding ) declaringClassBinding ; if ( rawTypeBinding . genericType ( ) . isBinaryBinding ( ) ) { return false ; } return ( this . binding . modifiers & ExtraCompilerModifiers . AccIsDefaultConstructor ) != <NUM_LIT:0> ; } if ( declaringClassBinding . isBinaryBinding ( ) ) { return false ; } return ( this . binding . modifiers & ExtraCompilerModifiers . AccIsDefaultConstructor ) != <NUM_LIT:0> ; } public String getName ( ) { if ( this . name == null ) { if ( this . binding . isConstructor ( ) ) { this . name = getDeclaringClass ( ) . getName ( ) ; } else { this . name = new String ( this . binding . selector ) ; } } return this . name ; } public IAnnotationBinding [ ] getAnnotations ( ) { if ( this . annotations != null ) { return this . annotations ; } org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding [ ] internalAnnotations = this . binding . getAnnotations ( ) ; int length = internalAnnotations == null ? <NUM_LIT:0> : internalAnnotations . length ; if ( length != <NUM_LIT:0> ) { IAnnotationBinding [ ] tempAnnotations = new IAnnotationBinding [ length ] ; int convertedAnnotationCount = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding internalAnnotation = internalAnnotations [ i ] ; final IAnnotationBinding annotationInstance = this . resolver . getAnnotationInstance ( internalAnnotation ) ; if ( annotationInstance == null ) { continue ; } tempAnnotations [ convertedAnnotationCount ++ ] = annotationInstance ; } if ( convertedAnnotationCount != length ) { if ( convertedAnnotationCount == <NUM_LIT:0> ) { return this . annotations = AnnotationBinding . NoAnnotations ; } System . arraycopy ( tempAnnotations , <NUM_LIT:0> , ( tempAnnotations = new IAnnotationBinding [ convertedAnnotationCount ] ) , <NUM_LIT:0> , convertedAnnotationCount ) ; } return this . annotations = tempAnnotations ; } return this . annotations = AnnotationBinding . NoAnnotations ; } public ITypeBinding getDeclaringClass ( ) { if ( this . declaringClass == null ) { this . declaringClass = this . resolver . getTypeBinding ( this . binding . declaringClass ) ; } return this . declaringClass ; } public IAnnotationBinding [ ] getParameterAnnotations ( int index ) { if ( getParameterTypes ( ) == NO_TYPE_BINDINGS ) { return AnnotationBinding . NoAnnotations ; } if ( this . parameterAnnotations != null ) { return this . parameterAnnotations [ index ] ; } org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding [ ] [ ] bindingAnnotations = this . binding . getParameterAnnotations ( ) ; if ( bindingAnnotations == null ) return AnnotationBinding . NoAnnotations ; int length = bindingAnnotations . length ; IAnnotationBinding [ ] [ ] domAnnotations = new IAnnotationBinding [ length ] [ ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding [ ] paramBindingAnnotations = bindingAnnotations [ i ] ; int pLength = paramBindingAnnotations . length ; domAnnotations [ i ] = new AnnotationBinding [ pLength ] ; for ( int j = <NUM_LIT:0> ; j < pLength ; j ++ ) { IAnnotationBinding domAnnotation = this . resolver . getAnnotationInstance ( paramBindingAnnotations [ j ] ) ; if ( domAnnotation == null ) { domAnnotations [ i ] = AnnotationBinding . NoAnnotations ; break ; } domAnnotations [ i ] [ j ] = domAnnotation ; } } this . parameterAnnotations = domAnnotations ; return this . parameterAnnotations [ index ] ; } public ITypeBinding [ ] getParameterTypes ( ) { if ( this . parameterTypes != null ) { return this . parameterTypes ; } org . eclipse . jdt . internal . compiler . lookup . TypeBinding [ ] parameters = this . binding . parameters ; int length = parameters == null ? <NUM_LIT:0> : parameters . length ; if ( length == <NUM_LIT:0> ) { return this . parameterTypes = NO_TYPE_BINDINGS ; } else { ITypeBinding [ ] paramTypes = new ITypeBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { final TypeBinding parameterBinding = parameters [ i ] ; if ( parameterBinding != null ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( parameterBinding ) ; if ( typeBinding == null ) { return this . parameterTypes = NO_TYPE_BINDINGS ; } paramTypes [ i ] = typeBinding ; } else { StringBuffer message = new StringBuffer ( "<STR_LIT>" ) ; message . append ( toString ( ) ) ; Util . log ( new IllegalArgumentException ( ) , message . toString ( ) ) ; return this . parameterTypes = NO_TYPE_BINDINGS ; } } return this . parameterTypes = paramTypes ; } } public ITypeBinding getReturnType ( ) { if ( this . returnType == null ) { this . returnType = this . resolver . getTypeBinding ( this . binding . returnType ) ; } return this . returnType ; } public Object getDefaultValue ( ) { if ( isAnnotationMember ( ) ) return MemberValuePairBinding . buildDOMValue ( this . binding . getDefaultValue ( ) , this . resolver ) ; return null ; } public ITypeBinding [ ] getExceptionTypes ( ) { if ( this . exceptionTypes != null ) { return this . exceptionTypes ; } org . eclipse . jdt . internal . compiler . lookup . TypeBinding [ ] exceptions = this . binding . thrownExceptions ; int length = exceptions == null ? <NUM_LIT:0> : exceptions . length ; if ( length == <NUM_LIT:0> ) { return this . exceptionTypes = NO_TYPE_BINDINGS ; } ITypeBinding [ ] exTypes = new ITypeBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( exceptions [ i ] ) ; if ( typeBinding == null ) { return this . exceptionTypes = NO_TYPE_BINDINGS ; } exTypes [ i ] = typeBinding ; } return this . exceptionTypes = exTypes ; } public IJavaElement getJavaElement ( ) { JavaElement element = getUnresolvedJavaElement ( ) ; if ( element == null ) return null ; return element . resolved ( this . binding ) ; } private JavaElement getUnresolvedJavaElement ( ) { if ( JavaCore . getPlugin ( ) == null ) { return null ; } if ( ! ( this . resolver instanceof DefaultBindingResolver ) ) return null ; DefaultBindingResolver defaultBindingResolver = ( DefaultBindingResolver ) this . resolver ; if ( ! defaultBindingResolver . fromJavaProject ) return null ; return Util . getUnresolvedJavaElement ( this . binding , defaultBindingResolver . workingCopyOwner , defaultBindingResolver . getBindingsToNodesMap ( ) ) ; } public int getKind ( ) { return IBinding . METHOD ; } public int getModifiers ( ) { return this . binding . getAccessFlags ( ) & VALID_MODIFIERS ; } public boolean isDeprecated ( ) { return this . binding . isDeprecated ( ) ; } public boolean isRecovered ( ) { return false ; } public boolean isSynthetic ( ) { return this . binding . isSynthetic ( ) ; } public boolean isVarargs ( ) { return this . binding . isVarargs ( ) ; } public String getKey ( ) { if ( this . key == null ) { this . key = new String ( this . binding . computeUniqueKey ( ) ) ; } return this . key ; } public boolean isEqualTo ( IBinding other ) { if ( other == this ) { return true ; } if ( other == null ) { return false ; } if ( ! ( other instanceof MethodBinding ) ) { return false ; } org . eclipse . jdt . internal . compiler . lookup . MethodBinding otherBinding = ( ( MethodBinding ) other ) . binding ; return BindingComparator . isEqual ( this . binding , otherBinding ) ; } public ITypeBinding [ ] getTypeParameters ( ) { if ( this . typeParameters != null ) { return this . typeParameters ; } TypeVariableBinding [ ] typeVariableBindings = this . binding . typeVariables ( ) ; int typeVariableBindingsLength = typeVariableBindings == null ? <NUM_LIT:0> : typeVariableBindings . length ; if ( typeVariableBindingsLength == <NUM_LIT:0> ) { return this . typeParameters = NO_TYPE_BINDINGS ; } ITypeBinding [ ] tParameters = new ITypeBinding [ typeVariableBindingsLength ] ; for ( int i = <NUM_LIT:0> ; i < typeVariableBindingsLength ; i ++ ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( typeVariableBindings [ i ] ) ; if ( typeBinding == null ) { return this . typeParameters = NO_TYPE_BINDINGS ; } tParameters [ i ] = typeBinding ; } return this . typeParameters = tParameters ; } public boolean isGenericMethod ( ) { if ( this . typeParameters != null ) { return this . typeParameters . length > <NUM_LIT:0> ; } TypeVariableBinding [ ] typeVariableBindings = this . binding . typeVariables ( ) ; return ( typeVariableBindings != null && typeVariableBindings . length > <NUM_LIT:0> ) ; } public ITypeBinding [ ] getTypeArguments ( ) { if ( this . typeArguments != null ) { return this . typeArguments ; } if ( this . binding instanceof ParameterizedGenericMethodBinding ) { ParameterizedGenericMethodBinding genericMethodBinding = ( ParameterizedGenericMethodBinding ) this . binding ; org . eclipse . jdt . internal . compiler . lookup . TypeBinding [ ] typeArgumentsBindings = genericMethodBinding . typeArguments ; int typeArgumentsLength = typeArgumentsBindings == null ? <NUM_LIT:0> : typeArgumentsBindings . length ; if ( typeArgumentsLength != <NUM_LIT:0> ) { ITypeBinding [ ] tArguments = new ITypeBinding [ typeArgumentsLength ] ; for ( int i = <NUM_LIT:0> ; i < typeArgumentsLength ; i ++ ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( typeArgumentsBindings [ i ] ) ; if ( typeBinding == null ) { return this . typeArguments = NO_TYPE_BINDINGS ; } tArguments [ i ] = typeBinding ; } return this . typeArguments = tArguments ; } } return this . typeArguments = NO_TYPE_BINDINGS ; } public boolean isParameterizedMethod ( ) { return ( this . binding instanceof ParameterizedGenericMethodBinding ) && ! ( ( ParameterizedGenericMethodBinding ) this . binding ) . isRaw ; } public boolean isRawMethod ( ) { return ( this . binding instanceof ParameterizedGenericMethodBinding ) && ( ( ParameterizedGenericMethodBinding ) this . binding ) . isRaw ; } public boolean isSubsignature ( IMethodBinding otherMethod ) { try { LookupEnvironment lookupEnvironment = this . resolver . lookupEnvironment ( ) ; return lookupEnvironment != null && lookupEnvironment . methodVerifier ( ) . isMethodSubsignature ( this . binding , ( ( MethodBinding ) otherMethod ) . binding ) ; } catch ( AbortCompilation e ) { return false ; } } public IMethodBinding getMethodDeclaration ( ) { return this . resolver . getMethodBinding ( this . binding . original ( ) ) ; } public boolean overrides ( IMethodBinding otherMethod ) { LookupEnvironment lookupEnvironment = this . resolver . lookupEnvironment ( ) ; return lookupEnvironment != null && lookupEnvironment . methodVerifier ( ) . doesMethodOverride ( this . binding , ( ( MethodBinding ) otherMethod ) . binding ) ; } public String toString ( ) { return this . binding . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class ForStatement extends Statement { public static final ChildListPropertyDescriptor INITIALIZERS_PROPERTY = new ChildListPropertyDescriptor ( ForStatement . class , "<STR_LIT>" , Expression . class , CYCLE_RISK ) ; public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( ForStatement . class , "<STR_LIT>" , Expression . class , OPTIONAL , CYCLE_RISK ) ; public static final ChildListPropertyDescriptor UPDATERS_PROPERTY = new ChildListPropertyDescriptor ( ForStatement . class , "<STR_LIT>" , Expression . class , CYCLE_RISK ) ; public static final ChildPropertyDescriptor BODY_PROPERTY = new ChildPropertyDescriptor ( ForStatement . class , "<STR_LIT:body>" , Statement . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:5> ) ; createPropertyList ( ForStatement . class , properyList ) ; addProperty ( INITIALIZERS_PROPERTY , properyList ) ; addProperty ( EXPRESSION_PROPERTY , properyList ) ; addProperty ( UPDATERS_PROPERTY , properyList ) ; addProperty ( BODY_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private ASTNode . NodeList initializers = new ASTNode . NodeList ( INITIALIZERS_PROPERTY ) ; private Expression optionalConditionExpression = null ; private ASTNode . NodeList updaters = new ASTNode . NodeList ( UPDATERS_PROPERTY ) ; private Statement body = null ; ForStatement ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == EXPRESSION_PROPERTY ) { if ( get ) { return getExpression ( ) ; } else { setExpression ( ( Expression ) child ) ; return null ; } } if ( property == BODY_PROPERTY ) { if ( get ) { return getBody ( ) ; } else { setBody ( ( Statement ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == INITIALIZERS_PROPERTY ) { return initializers ( ) ; } if ( property == UPDATERS_PROPERTY ) { return updaters ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return FOR_STATEMENT ; } ASTNode clone0 ( AST target ) { ForStatement result = new ForStatement ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; result . initializers ( ) . addAll ( ASTNode . copySubtrees ( target , initializers ( ) ) ) ; result . setExpression ( ( Expression ) ASTNode . copySubtree ( target , getExpression ( ) ) ) ; result . updaters ( ) . addAll ( ASTNode . copySubtrees ( target , updaters ( ) ) ) ; result . setBody ( ( Statement ) ASTNode . copySubtree ( target , getBody ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChildren ( visitor , this . initializers ) ; acceptChild ( visitor , getExpression ( ) ) ; acceptChildren ( visitor , this . updaters ) ; acceptChild ( visitor , getBody ( ) ) ; } visitor . endVisit ( this ) ; } public List initializers ( ) { return this . initializers ; } public Expression getExpression ( ) { return this . optionalConditionExpression ; } public void setExpression ( Expression expression ) { ASTNode oldChild = this . optionalConditionExpression ; preReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; this . optionalConditionExpression = expression ; postReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; } public List updaters ( ) { return this . updaters ; } public Statement getBody ( ) { if ( this . body == null ) { synchronized ( this ) { if ( this . body == null ) { preLazyInit ( ) ; this . body = new Block ( this . ast ) ; postLazyInit ( this . body , BODY_PROPERTY ) ; } } } return this . body ; } public void setBody ( Statement statement ) { if ( statement == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . body ; preReplaceChild ( oldChild , statement , BODY_PROPERTY ) ; this . body = statement ; postReplaceChild ( oldChild , statement , BODY_PROPERTY ) ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:4> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + this . initializers . listSize ( ) + this . updaters . listSize ( ) + ( this . optionalConditionExpression == null ? <NUM_LIT:0> : getExpression ( ) . treeSize ( ) ) + ( this . body == null ? <NUM_LIT:0> : getBody ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; public class PrimitiveType extends Type { public static class Code { private String name ; Code ( String name ) { this . name = name ; } public String toString ( ) { return this . name ; } } public static final Code INT = new Code ( "<STR_LIT:int>" ) ; public static final Code CHAR = new Code ( "<STR_LIT>" ) ; public static final Code BOOLEAN = new Code ( "<STR_LIT:boolean>" ) ; public static final Code SHORT = new Code ( "<STR_LIT>" ) ; public static final Code LONG = new Code ( "<STR_LIT:long>" ) ; public static final Code FLOAT = new Code ( "<STR_LIT:float>" ) ; public static final Code DOUBLE = new Code ( "<STR_LIT:double>" ) ; public static final Code BYTE = new Code ( "<STR_LIT>" ) ; public static final Code VOID = new Code ( "<STR_LIT>" ) ; private PrimitiveType . Code typeCode = INT ; private static final Map CODES ; static { CODES = new HashMap ( <NUM_LIT:20> ) ; Code [ ] ops = { INT , BYTE , CHAR , BOOLEAN , SHORT , LONG , FLOAT , DOUBLE , VOID , } ; for ( int i = <NUM_LIT:0> ; i < ops . length ; i ++ ) { CODES . put ( ops [ i ] . toString ( ) , ops [ i ] ) ; } } public static PrimitiveType . Code toCode ( String token ) { return ( PrimitiveType . Code ) CODES . get ( token ) ; } public static final SimplePropertyDescriptor PRIMITIVE_TYPE_CODE_PROPERTY = new SimplePropertyDescriptor ( PrimitiveType . class , "<STR_LIT>" , PrimitiveType . Code . class , MANDATORY ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( PrimitiveType . class , propertyList ) ; addProperty ( PRIMITIVE_TYPE_CODE_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } PrimitiveType ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final Object internalGetSetObjectProperty ( SimplePropertyDescriptor property , boolean get , Object value ) { if ( property == PRIMITIVE_TYPE_CODE_PROPERTY ) { if ( get ) { return getPrimitiveTypeCode ( ) ; } else { setPrimitiveTypeCode ( ( Code ) value ) ; return null ; } } return super . internalGetSetObjectProperty ( property , get , value ) ; } final int getNodeType0 ( ) { return PRIMITIVE_TYPE ; } ASTNode clone0 ( AST target ) { PrimitiveType result = new PrimitiveType ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setPrimitiveTypeCode ( getPrimitiveTypeCode ( ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { visitor . visit ( this ) ; visitor . endVisit ( this ) ; } public PrimitiveType . Code getPrimitiveTypeCode ( ) { return this . typeCode ; } public void setPrimitiveTypeCode ( PrimitiveType . Code typeCode ) { if ( typeCode == null ) { throw new IllegalArgumentException ( ) ; } preValueChange ( PRIMITIVE_TYPE_CODE_PROPERTY ) ; this . typeCode = typeCode ; postValueChange ( PRIMITIVE_TYPE_CODE_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:1> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . AbstractList ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import org . eclipse . jdt . internal . core . dom . NaiveASTFlattener ; public abstract class ASTNode { public static final int ANONYMOUS_CLASS_DECLARATION = <NUM_LIT:1> ; public static final int ARRAY_ACCESS = <NUM_LIT:2> ; public static final int ARRAY_CREATION = <NUM_LIT:3> ; public static final int ARRAY_INITIALIZER = <NUM_LIT:4> ; public static final int ARRAY_TYPE = <NUM_LIT:5> ; public static final int ASSERT_STATEMENT = <NUM_LIT:6> ; public static final int ASSIGNMENT = <NUM_LIT:7> ; public static final int BLOCK = <NUM_LIT:8> ; public static final int BOOLEAN_LITERAL = <NUM_LIT:9> ; public static final int BREAK_STATEMENT = <NUM_LIT:10> ; public static final int CAST_EXPRESSION = <NUM_LIT:11> ; public static final int CATCH_CLAUSE = <NUM_LIT:12> ; public static final int CHARACTER_LITERAL = <NUM_LIT> ; public static final int CLASS_INSTANCE_CREATION = <NUM_LIT> ; public static final int COMPILATION_UNIT = <NUM_LIT:15> ; public static final int CONDITIONAL_EXPRESSION = <NUM_LIT:16> ; public static final int CONSTRUCTOR_INVOCATION = <NUM_LIT> ; public static final int CONTINUE_STATEMENT = <NUM_LIT> ; public static final int DO_STATEMENT = <NUM_LIT> ; public static final int EMPTY_STATEMENT = <NUM_LIT:20> ; public static final int EXPRESSION_STATEMENT = <NUM_LIT> ; public static final int FIELD_ACCESS = <NUM_LIT> ; public static final int FIELD_DECLARATION = <NUM_LIT> ; public static final int FOR_STATEMENT = <NUM_LIT:24> ; public static final int IF_STATEMENT = <NUM_LIT> ; public static final int IMPORT_DECLARATION = <NUM_LIT> ; public static final int INFIX_EXPRESSION = <NUM_LIT> ; public static final int INITIALIZER = <NUM_LIT> ; public static final int JAVADOC = <NUM_LIT> ; public static final int LABELED_STATEMENT = <NUM_LIT:30> ; public static final int METHOD_DECLARATION = <NUM_LIT:31> ; public static final int METHOD_INVOCATION = <NUM_LIT:32> ; public static final int NULL_LITERAL = <NUM_LIT> ; public static final int NUMBER_LITERAL = <NUM_LIT> ; public static final int PACKAGE_DECLARATION = <NUM_LIT> ; public static final int PARENTHESIZED_EXPRESSION = <NUM_LIT> ; public static final int POSTFIX_EXPRESSION = <NUM_LIT> ; public static final int PREFIX_EXPRESSION = <NUM_LIT> ; public static final int PRIMITIVE_TYPE = <NUM_LIT> ; public static final int QUALIFIED_NAME = <NUM_LIT> ; public static final int RETURN_STATEMENT = <NUM_LIT> ; public static final int SIMPLE_NAME = <NUM_LIT> ; public static final int SIMPLE_TYPE = <NUM_LIT> ; public static final int SINGLE_VARIABLE_DECLARATION = <NUM_LIT> ; public static final int STRING_LITERAL = <NUM_LIT> ; public static final int SUPER_CONSTRUCTOR_INVOCATION = <NUM_LIT> ; public static final int SUPER_FIELD_ACCESS = <NUM_LIT> ; public static final int SUPER_METHOD_INVOCATION = <NUM_LIT> ; public static final int SWITCH_CASE = <NUM_LIT> ; public static final int SWITCH_STATEMENT = <NUM_LIT> ; public static final int SYNCHRONIZED_STATEMENT = <NUM_LIT> ; public static final int THIS_EXPRESSION = <NUM_LIT> ; public static final int THROW_STATEMENT = <NUM_LIT> ; public static final int TRY_STATEMENT = <NUM_LIT> ; public static final int TYPE_DECLARATION = <NUM_LIT> ; public static final int TYPE_DECLARATION_STATEMENT = <NUM_LIT> ; public static final int TYPE_LITERAL = <NUM_LIT> ; public static final int VARIABLE_DECLARATION_EXPRESSION = <NUM_LIT> ; public static final int VARIABLE_DECLARATION_FRAGMENT = <NUM_LIT> ; public static final int VARIABLE_DECLARATION_STATEMENT = <NUM_LIT> ; public static final int WHILE_STATEMENT = <NUM_LIT> ; public static final int INSTANCEOF_EXPRESSION = <NUM_LIT> ; public static final int LINE_COMMENT = <NUM_LIT> ; public static final int BLOCK_COMMENT = <NUM_LIT> ; public static final int TAG_ELEMENT = <NUM_LIT> ; public static final int TEXT_ELEMENT = <NUM_LIT> ; public static final int MEMBER_REF = <NUM_LIT> ; public static final int METHOD_REF = <NUM_LIT> ; public static final int METHOD_REF_PARAMETER = <NUM_LIT> ; public static final int ENHANCED_FOR_STATEMENT = <NUM_LIT> ; public static final int ENUM_DECLARATION = <NUM_LIT> ; public static final int ENUM_CONSTANT_DECLARATION = <NUM_LIT> ; public static final int TYPE_PARAMETER = <NUM_LIT> ; public static final int PARAMETERIZED_TYPE = <NUM_LIT> ; public static final int QUALIFIED_TYPE = <NUM_LIT> ; public static final int WILDCARD_TYPE = <NUM_LIT> ; public static final int NORMAL_ANNOTATION = <NUM_LIT> ; public static final int MARKER_ANNOTATION = <NUM_LIT> ; public static final int SINGLE_MEMBER_ANNOTATION = <NUM_LIT> ; public static final int MEMBER_VALUE_PAIR = <NUM_LIT> ; public static final int ANNOTATION_TYPE_DECLARATION = <NUM_LIT> ; public static final int ANNOTATION_TYPE_MEMBER_DECLARATION = <NUM_LIT> ; public static final int MODIFIER = <NUM_LIT> ; public static Class nodeClassForType ( int nodeType ) { switch ( nodeType ) { case ANNOTATION_TYPE_DECLARATION : return AnnotationTypeDeclaration . class ; case ANNOTATION_TYPE_MEMBER_DECLARATION : return AnnotationTypeMemberDeclaration . class ; case ANONYMOUS_CLASS_DECLARATION : return AnonymousClassDeclaration . class ; case ARRAY_ACCESS : return ArrayAccess . class ; case ARRAY_CREATION : return ArrayCreation . class ; case ARRAY_INITIALIZER : return ArrayInitializer . class ; case ARRAY_TYPE : return ArrayType . class ; case ASSERT_STATEMENT : return AssertStatement . class ; case ASSIGNMENT : return Assignment . class ; case BLOCK : return Block . class ; case BLOCK_COMMENT : return BlockComment . class ; case BOOLEAN_LITERAL : return BooleanLiteral . class ; case BREAK_STATEMENT : return BreakStatement . class ; case CAST_EXPRESSION : return CastExpression . class ; case CATCH_CLAUSE : return CatchClause . class ; case CHARACTER_LITERAL : return CharacterLiteral . class ; case CLASS_INSTANCE_CREATION : return ClassInstanceCreation . class ; case COMPILATION_UNIT : return CompilationUnit . class ; case CONDITIONAL_EXPRESSION : return ConditionalExpression . class ; case CONSTRUCTOR_INVOCATION : return ConstructorInvocation . class ; case CONTINUE_STATEMENT : return ContinueStatement . class ; case DO_STATEMENT : return DoStatement . class ; case EMPTY_STATEMENT : return EmptyStatement . class ; case ENHANCED_FOR_STATEMENT : return EnhancedForStatement . class ; case ENUM_CONSTANT_DECLARATION : return EnumConstantDeclaration . class ; case ENUM_DECLARATION : return EnumDeclaration . class ; case EXPRESSION_STATEMENT : return ExpressionStatement . class ; case FIELD_ACCESS : return FieldAccess . class ; case FIELD_DECLARATION : return FieldDeclaration . class ; case FOR_STATEMENT : return ForStatement . class ; case IF_STATEMENT : return IfStatement . class ; case IMPORT_DECLARATION : return ImportDeclaration . class ; case INFIX_EXPRESSION : return InfixExpression . class ; case INITIALIZER : return Initializer . class ; case INSTANCEOF_EXPRESSION : return InstanceofExpression . class ; case JAVADOC : return Javadoc . class ; case LABELED_STATEMENT : return LabeledStatement . class ; case LINE_COMMENT : return LineComment . class ; case MARKER_ANNOTATION : return MarkerAnnotation . class ; case MEMBER_REF : return MemberRef . class ; case MEMBER_VALUE_PAIR : return MemberValuePair . class ; case METHOD_DECLARATION : return MethodDeclaration . class ; case METHOD_INVOCATION : return MethodInvocation . class ; case METHOD_REF : return MethodRef . class ; case METHOD_REF_PARAMETER : return MethodRefParameter . class ; case MODIFIER : return Modifier . class ; case NORMAL_ANNOTATION : return NormalAnnotation . class ; case NULL_LITERAL : return NullLiteral . class ; case NUMBER_LITERAL : return NumberLiteral . class ; case PACKAGE_DECLARATION : return PackageDeclaration . class ; case PARAMETERIZED_TYPE : return ParameterizedType . class ; case PARENTHESIZED_EXPRESSION : return ParenthesizedExpression . class ; case POSTFIX_EXPRESSION : return PostfixExpression . class ; case PREFIX_EXPRESSION : return PrefixExpression . class ; case PRIMITIVE_TYPE : return PrimitiveType . class ; case QUALIFIED_NAME : return QualifiedName . class ; case QUALIFIED_TYPE : return QualifiedType . class ; case RETURN_STATEMENT : return ReturnStatement . class ; case SIMPLE_NAME : return SimpleName . class ; case SIMPLE_TYPE : return SimpleType . class ; case SINGLE_MEMBER_ANNOTATION : return SingleMemberAnnotation . class ; case SINGLE_VARIABLE_DECLARATION : return SingleVariableDeclaration . class ; case STRING_LITERAL : return StringLiteral . class ; case SUPER_CONSTRUCTOR_INVOCATION : return SuperConstructorInvocation . class ; case SUPER_FIELD_ACCESS : return SuperFieldAccess . class ; case SUPER_METHOD_INVOCATION : return SuperMethodInvocation . class ; case SWITCH_CASE : return SwitchCase . class ; case SWITCH_STATEMENT : return SwitchStatement . class ; case SYNCHRONIZED_STATEMENT : return SynchronizedStatement . class ; case TAG_ELEMENT : return TagElement . class ; case TEXT_ELEMENT : return TextElement . class ; case THIS_EXPRESSION : return ThisExpression . class ; case THROW_STATEMENT : return ThrowStatement . class ; case TRY_STATEMENT : return TryStatement . class ; case TYPE_DECLARATION : return TypeDeclaration . class ; case TYPE_DECLARATION_STATEMENT : return TypeDeclarationStatement . class ; case TYPE_LITERAL : return TypeLiteral . class ; case TYPE_PARAMETER : return TypeParameter . class ; case VARIABLE_DECLARATION_EXPRESSION : return VariableDeclarationExpression . class ; case VARIABLE_DECLARATION_FRAGMENT : return VariableDeclarationFragment . class ; case VARIABLE_DECLARATION_STATEMENT : return VariableDeclarationStatement . class ; case WHILE_STATEMENT : return WhileStatement . class ; case WILDCARD_TYPE : return WildcardType . class ; } throw new IllegalArgumentException ( ) ; } final AST ast ; private ASTNode parent = null ; private static final Map UNMODIFIABLE_EMPTY_MAP = Collections . unmodifiableMap ( new HashMap ( <NUM_LIT:1> ) ) ; private Object property1 = null ; private Object property2 = null ; private int startPosition = - <NUM_LIT:1> ; private int length = <NUM_LIT:0> ; public static final int MALFORMED = <NUM_LIT:1> ; public static final int ORIGINAL = <NUM_LIT:2> ; public static final int PROTECT = <NUM_LIT:4> ; public static final int RECOVERED = <NUM_LIT:8> ; int typeAndFlags = <NUM_LIT:0> ; private StructuralPropertyDescriptor location = null ; static final boolean CYCLE_RISK = true ; static final boolean NO_CYCLE_RISK = false ; static final boolean MANDATORY = true ; static final boolean OPTIONAL = false ; class NodeList extends AbstractList { ArrayList store = new ArrayList ( <NUM_LIT:0> ) ; ChildListPropertyDescriptor propertyDescriptor ; class Cursor implements Iterator { private int position = <NUM_LIT:0> ; public boolean hasNext ( ) { return this . position < NodeList . this . store . size ( ) ; } public Object next ( ) { Object result = NodeList . this . store . get ( this . position ) ; this . position ++ ; return result ; } public void remove ( ) { throw new UnsupportedOperationException ( ) ; } void update ( int index , int delta ) { if ( this . position > index ) { this . position += delta ; } } } private List cursors = null ; NodeList ( ChildListPropertyDescriptor property ) { super ( ) ; this . propertyDescriptor = property ; } public int size ( ) { return this . store . size ( ) ; } public Object get ( int index ) { return this . store . get ( index ) ; } public Object set ( int index , Object element ) { if ( element == null ) { throw new IllegalArgumentException ( ) ; } if ( ( ASTNode . this . typeAndFlags & PROTECT ) != <NUM_LIT:0> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } ASTNode newChild = ( ASTNode ) element ; ASTNode oldChild = ( ASTNode ) this . store . get ( index ) ; if ( oldChild == newChild ) { return oldChild ; } if ( ( oldChild . typeAndFlags & PROTECT ) != <NUM_LIT:0> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } ASTNode . checkNewChild ( ASTNode . this , newChild , this . propertyDescriptor . cycleRisk , this . propertyDescriptor . elementType ) ; ASTNode . this . ast . preReplaceChildEvent ( ASTNode . this , oldChild , newChild , this . propertyDescriptor ) ; Object result = this . store . set ( index , newChild ) ; oldChild . setParent ( null , null ) ; newChild . setParent ( ASTNode . this , this . propertyDescriptor ) ; ASTNode . this . ast . postReplaceChildEvent ( ASTNode . this , oldChild , newChild , this . propertyDescriptor ) ; return result ; } public void add ( int index , Object element ) { if ( element == null ) { throw new IllegalArgumentException ( ) ; } if ( ( ASTNode . this . typeAndFlags & PROTECT ) != <NUM_LIT:0> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } ASTNode newChild = ( ASTNode ) element ; ASTNode . checkNewChild ( ASTNode . this , newChild , this . propertyDescriptor . cycleRisk , this . propertyDescriptor . elementType ) ; ASTNode . this . ast . preAddChildEvent ( ASTNode . this , newChild , this . propertyDescriptor ) ; this . store . add ( index , element ) ; updateCursors ( index , + <NUM_LIT:1> ) ; newChild . setParent ( ASTNode . this , this . propertyDescriptor ) ; ASTNode . this . ast . postAddChildEvent ( ASTNode . this , newChild , this . propertyDescriptor ) ; } public Object remove ( int index ) { if ( ( ASTNode . this . typeAndFlags & PROTECT ) != <NUM_LIT:0> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } ASTNode oldChild = ( ASTNode ) this . store . get ( index ) ; if ( ( oldChild . typeAndFlags & PROTECT ) != <NUM_LIT:0> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } ASTNode . this . ast . preRemoveChildEvent ( ASTNode . this , oldChild , this . propertyDescriptor ) ; oldChild . setParent ( null , null ) ; Object result = this . store . remove ( index ) ; updateCursors ( index , - <NUM_LIT:1> ) ; ASTNode . this . ast . postRemoveChildEvent ( ASTNode . this , oldChild , this . propertyDescriptor ) ; return result ; } Cursor newCursor ( ) { synchronized ( this ) { if ( this . cursors == null ) { this . cursors = new ArrayList ( <NUM_LIT:1> ) ; } Cursor result = new Cursor ( ) ; this . cursors . add ( result ) ; return result ; } } void releaseCursor ( Cursor cursor ) { synchronized ( this ) { this . cursors . remove ( cursor ) ; if ( this . cursors . isEmpty ( ) ) { this . cursors = null ; } } } private synchronized void updateCursors ( int index , int delta ) { if ( this . cursors == null ) { return ; } for ( Iterator it = this . cursors . iterator ( ) ; it . hasNext ( ) ; ) { Cursor c = ( Cursor ) it . next ( ) ; c . update ( index , delta ) ; } } int memSize ( ) { int result = HEADERS + <NUM_LIT:5> * <NUM_LIT:4> ; result += HEADERS + <NUM_LIT:2> * <NUM_LIT:4> ; result += HEADERS + <NUM_LIT:4> * size ( ) ; return result ; } int listSize ( ) { int result = memSize ( ) ; for ( Iterator it = iterator ( ) ; it . hasNext ( ) ; ) { ASTNode child = ( ASTNode ) it . next ( ) ; result += child . treeSize ( ) ; } return result ; } } ASTNode ( AST ast ) { if ( ast == null ) { throw new IllegalArgumentException ( ) ; } this . ast = ast ; setNodeType ( getNodeType0 ( ) ) ; setFlags ( ast . getDefaultNodeFlag ( ) ) ; } public final AST getAST ( ) { return this . ast ; } public final ASTNode getParent ( ) { return this . parent ; } public final StructuralPropertyDescriptor getLocationInParent ( ) { return this . location ; } public final ASTNode getRoot ( ) { ASTNode candidate = this ; while ( true ) { ASTNode p = candidate . getParent ( ) ; if ( p == null ) { return candidate ; } candidate = p ; } } public final Object getStructuralProperty ( StructuralPropertyDescriptor property ) { if ( property instanceof SimplePropertyDescriptor ) { SimplePropertyDescriptor p = ( SimplePropertyDescriptor ) property ; if ( p . getValueType ( ) == int . class ) { int result = internalGetSetIntProperty ( p , true , <NUM_LIT:0> ) ; return new Integer ( result ) ; } else if ( p . getValueType ( ) == boolean . class ) { boolean result = internalGetSetBooleanProperty ( p , true , false ) ; return Boolean . valueOf ( result ) ; } else { return internalGetSetObjectProperty ( p , true , null ) ; } } if ( property instanceof ChildPropertyDescriptor ) { return internalGetSetChildProperty ( ( ChildPropertyDescriptor ) property , true , null ) ; } if ( property instanceof ChildListPropertyDescriptor ) { return internalGetChildListProperty ( ( ChildListPropertyDescriptor ) property ) ; } throw new IllegalArgumentException ( ) ; } public final void setStructuralProperty ( StructuralPropertyDescriptor property , Object value ) { if ( property instanceof SimplePropertyDescriptor ) { SimplePropertyDescriptor p = ( SimplePropertyDescriptor ) property ; if ( p . getValueType ( ) == int . class ) { int arg = ( ( Integer ) value ) . intValue ( ) ; internalGetSetIntProperty ( p , false , arg ) ; return ; } else if ( p . getValueType ( ) == boolean . class ) { boolean arg = ( ( Boolean ) value ) . booleanValue ( ) ; internalGetSetBooleanProperty ( p , false , arg ) ; return ; } else { if ( value == null && p . isMandatory ( ) ) { throw new IllegalArgumentException ( ) ; } internalGetSetObjectProperty ( p , false , value ) ; return ; } } if ( property instanceof ChildPropertyDescriptor ) { ChildPropertyDescriptor p = ( ChildPropertyDescriptor ) property ; ASTNode child = ( ASTNode ) value ; if ( child == null && p . isMandatory ( ) ) { throw new IllegalArgumentException ( ) ; } internalGetSetChildProperty ( p , false , child ) ; return ; } if ( property instanceof ChildListPropertyDescriptor ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } } int internalGetSetIntProperty ( SimplePropertyDescriptor property , boolean get , int value ) { throw new RuntimeException ( "<STR_LIT>" ) ; } boolean internalGetSetBooleanProperty ( SimplePropertyDescriptor property , boolean get , boolean value ) { throw new RuntimeException ( "<STR_LIT>" ) ; } Object internalGetSetObjectProperty ( SimplePropertyDescriptor property , boolean get , Object value ) { throw new RuntimeException ( "<STR_LIT>" ) ; } ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { throw new RuntimeException ( "<STR_LIT>" ) ; } List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { throw new RuntimeException ( "<STR_LIT>" ) ; } public final List structuralPropertiesForType ( ) { return internalStructuralPropertiesForType ( this . ast . apiLevel ) ; } abstract List internalStructuralPropertiesForType ( int apiLevel ) ; static void createPropertyList ( Class nodeClass , List propertyList ) { propertyList . add ( nodeClass ) ; } static void addProperty ( StructuralPropertyDescriptor property , List propertyList ) { Class nodeClass = ( Class ) propertyList . get ( <NUM_LIT:0> ) ; if ( property . getNodeClass ( ) != nodeClass ) { throw new RuntimeException ( "<STR_LIT>" ) ; } propertyList . add ( property ) ; } static List reapPropertyList ( List propertyList ) { propertyList . remove ( <NUM_LIT:0> ) ; ArrayList a = new ArrayList ( propertyList . size ( ) ) ; a . addAll ( propertyList ) ; return Collections . unmodifiableList ( a ) ; } final void unsupportedIn2 ( ) { if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { throw new UnsupportedOperationException ( "<STR_LIT>" ) ; } } final void supportedOnlyIn2 ( ) { if ( this . ast . apiLevel != AST . JLS2_INTERNAL ) { throw new UnsupportedOperationException ( "<STR_LIT>" ) ; } } final void setParent ( ASTNode parent , StructuralPropertyDescriptor property ) { this . ast . modifying ( ) ; this . parent = parent ; this . location = property ; } public final void delete ( ) { StructuralPropertyDescriptor p = getLocationInParent ( ) ; if ( p == null ) { return ; } if ( p . isChildProperty ( ) ) { getParent ( ) . setStructuralProperty ( this . location , null ) ; return ; } if ( p . isChildListProperty ( ) ) { List l = ( List ) getParent ( ) . getStructuralProperty ( this . location ) ; l . remove ( this ) ; } } static void checkNewChild ( ASTNode node , ASTNode newChild , boolean cycleCheck , Class nodeType ) { if ( newChild . ast != node . ast ) { throw new IllegalArgumentException ( ) ; } if ( newChild . getParent ( ) != null ) { throw new IllegalArgumentException ( ) ; } if ( cycleCheck && newChild == node . getRoot ( ) ) { throw new IllegalArgumentException ( ) ; } Class childClass = newChild . getClass ( ) ; if ( nodeType != null && ! nodeType . isAssignableFrom ( childClass ) ) { throw new ClassCastException ( ) ; } if ( ( newChild . typeAndFlags & PROTECT ) != <NUM_LIT:0> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } } final void preReplaceChild ( ASTNode oldChild , ASTNode newChild , ChildPropertyDescriptor property ) { if ( ( this . typeAndFlags & PROTECT ) != <NUM_LIT:0> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } if ( newChild != null ) { checkNewChild ( this , newChild , property . cycleRisk , null ) ; } if ( oldChild != null ) { if ( ( oldChild . typeAndFlags & PROTECT ) != <NUM_LIT:0> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } if ( newChild != null ) { this . ast . preReplaceChildEvent ( this , oldChild , newChild , property ) ; } else { this . ast . preRemoveChildEvent ( this , oldChild , property ) ; } oldChild . setParent ( null , null ) ; } else { if ( newChild != null ) { this . ast . preAddChildEvent ( this , newChild , property ) ; } } if ( newChild != null ) { newChild . setParent ( this , property ) ; } } final void postReplaceChild ( ASTNode oldChild , ASTNode newChild , ChildPropertyDescriptor property ) { if ( newChild != null ) { if ( oldChild != null ) { this . ast . postReplaceChildEvent ( this , oldChild , newChild , property ) ; } else { this . ast . postAddChildEvent ( this , newChild , property ) ; } } else { this . ast . postRemoveChildEvent ( this , oldChild , property ) ; } } final void preValueChange ( SimplePropertyDescriptor property ) { if ( ( this . typeAndFlags & PROTECT ) != <NUM_LIT:0> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } this . ast . preValueChangeEvent ( this , property ) ; this . ast . modifying ( ) ; } final void postValueChange ( SimplePropertyDescriptor property ) { this . ast . postValueChangeEvent ( this , property ) ; } final void checkModifiable ( ) { if ( ( this . typeAndFlags & PROTECT ) != <NUM_LIT:0> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } this . ast . modifying ( ) ; } final void preLazyInit ( ) { this . ast . disableEvents ( ) ; } final void postLazyInit ( ASTNode newChild , ChildPropertyDescriptor property ) { newChild . setParent ( this , property ) ; this . ast . reenableEvents ( ) ; } public final Object getProperty ( String propertyName ) { if ( propertyName == null ) { throw new IllegalArgumentException ( ) ; } if ( this . property1 == null ) { return null ; } if ( this . property1 instanceof String ) { if ( propertyName . equals ( this . property1 ) ) { return this . property2 ; } else { return null ; } } Map m = ( Map ) this . property1 ; return m . get ( propertyName ) ; } public final void setProperty ( String propertyName , Object data ) { if ( propertyName == null ) { throw new IllegalArgumentException ( ) ; } if ( this . property1 == null ) { if ( data == null ) { return ; } this . property1 = propertyName ; this . property2 = data ; return ; } if ( this . property1 instanceof String ) { if ( propertyName . equals ( this . property1 ) ) { this . property2 = data ; if ( data == null ) { this . property1 = null ; this . property2 = null ; } return ; } if ( data == null ) { return ; } HashMap m = new HashMap ( <NUM_LIT:2> ) ; m . put ( this . property1 , this . property2 ) ; m . put ( propertyName , data ) ; this . property1 = m ; this . property2 = null ; return ; } HashMap m = ( HashMap ) this . property1 ; if ( data == null ) { m . remove ( propertyName ) ; if ( m . size ( ) == <NUM_LIT:1> ) { Map . Entry [ ] entries = ( Map . Entry [ ] ) m . entrySet ( ) . toArray ( new Map . Entry [ <NUM_LIT:1> ] ) ; this . property1 = entries [ <NUM_LIT:0> ] . getKey ( ) ; this . property2 = entries [ <NUM_LIT:0> ] . getValue ( ) ; } return ; } else { m . put ( propertyName , data ) ; return ; } } public final Map properties ( ) { if ( this . property1 == null ) { return UNMODIFIABLE_EMPTY_MAP ; } if ( this . property1 instanceof String ) { return Collections . singletonMap ( this . property1 , this . property2 ) ; } if ( this . property2 == null ) { this . property2 = Collections . unmodifiableMap ( ( Map ) this . property1 ) ; } return ( Map ) this . property2 ; } public final int getFlags ( ) { return this . typeAndFlags & <NUM_LIT> ; } public final void setFlags ( int flags ) { this . ast . modifying ( ) ; int old = this . typeAndFlags & <NUM_LIT> ; this . typeAndFlags = old | ( flags & <NUM_LIT> ) ; } public final int getNodeType ( ) { return this . typeAndFlags > > > <NUM_LIT:16> ; } private void setNodeType ( int nodeType ) { int old = this . typeAndFlags & <NUM_LIT> ; this . typeAndFlags = old | ( nodeType << <NUM_LIT:16> ) ; } abstract int getNodeType0 ( ) ; public final boolean equals ( Object obj ) { return this == obj ; } public final int hashCode ( ) { return super . hashCode ( ) ; } public final boolean subtreeMatch ( ASTMatcher matcher , Object other ) { return subtreeMatch0 ( matcher , other ) ; } abstract boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) ; public static ASTNode copySubtree ( AST target , ASTNode node ) { if ( node == null ) { return null ; } if ( target == null ) { throw new IllegalArgumentException ( ) ; } if ( target . apiLevel ( ) != node . getAST ( ) . apiLevel ( ) ) { throw new UnsupportedOperationException ( ) ; } ASTNode newNode = node . clone ( target ) ; return newNode ; } public static List copySubtrees ( AST target , List nodes ) { List result = new ArrayList ( nodes . size ( ) ) ; for ( Iterator it = nodes . iterator ( ) ; it . hasNext ( ) ; ) { ASTNode oldNode = ( ASTNode ) it . next ( ) ; ASTNode newNode = oldNode . clone ( target ) ; result . add ( newNode ) ; } return result ; } final ASTNode clone ( AST target ) { this . ast . preCloneNodeEvent ( this ) ; ASTNode c = clone0 ( target ) ; this . ast . postCloneNodeEvent ( this , c ) ; return c ; } abstract ASTNode clone0 ( AST target ) ; public final void accept ( ASTVisitor visitor ) { if ( visitor == null ) { throw new IllegalArgumentException ( ) ; } if ( visitor . preVisit2 ( this ) ) { accept0 ( visitor ) ; } visitor . postVisit ( this ) ; } abstract void accept0 ( ASTVisitor visitor ) ; final void acceptChild ( ASTVisitor visitor , ASTNode child ) { if ( child == null ) { return ; } child . accept ( visitor ) ; } final void acceptChildren ( ASTVisitor visitor , ASTNode . NodeList children ) { NodeList . Cursor cursor = children . newCursor ( ) ; try { while ( cursor . hasNext ( ) ) { ASTNode child = ( ASTNode ) cursor . next ( ) ; child . accept ( visitor ) ; } } finally { children . releaseCursor ( cursor ) ; } } public final int getStartPosition ( ) { return this . startPosition ; } public final int getLength ( ) { return this . length ; } public final void setSourceRange ( int startPosition , int length ) { if ( startPosition >= <NUM_LIT:0> && length < <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } if ( startPosition < <NUM_LIT:0> && length != <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } checkModifiable ( ) ; this . startPosition = startPosition ; this . length = length ; } public final String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; int p = buffer . length ( ) ; try { appendDebugString ( buffer ) ; } catch ( RuntimeException e ) { buffer . setLength ( p ) ; buffer . append ( "<STR_LIT:!>" ) ; buffer . append ( standardToString ( ) ) ; } return buffer . toString ( ) ; } final String standardToString ( ) { return super . toString ( ) ; } void appendDebugString ( StringBuffer buffer ) { appendPrintString ( buffer ) ; } final void appendPrintString ( StringBuffer buffer ) { NaiveASTFlattener printer = new NaiveASTFlattener ( ) ; accept ( printer ) ; buffer . append ( printer . getResult ( ) ) ; } static final int HEADERS = <NUM_LIT:12> ; static final int BASE_NODE_SIZE = HEADERS + <NUM_LIT:7> * <NUM_LIT:4> ; static int stringSize ( String string ) { int size = <NUM_LIT:0> ; if ( string != null ) { size += HEADERS + <NUM_LIT:4> * <NUM_LIT:4> ; size += HEADERS + <NUM_LIT:2> * string . length ( ) ; } return size ; } public final int subtreeBytes ( ) { return treeSize ( ) ; } abstract int treeSize ( ) ; abstract int memSize ( ) ; } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class SynchronizedStatement extends Statement { public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( SynchronizedStatement . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; public static final ChildPropertyDescriptor BODY_PROPERTY = new ChildPropertyDescriptor ( SynchronizedStatement . class , "<STR_LIT:body>" , Block . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( SynchronizedStatement . class , propertyList ) ; addProperty ( EXPRESSION_PROPERTY , propertyList ) ; addProperty ( BODY_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Expression expression = null ; private Block body = null ; SynchronizedStatement ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == EXPRESSION_PROPERTY ) { if ( get ) { return getExpression ( ) ; } else { setExpression ( ( Expression ) child ) ; return null ; } } if ( property == BODY_PROPERTY ) { if ( get ) { return getBody ( ) ; } else { setBody ( ( Block ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return SYNCHRONIZED_STATEMENT ; } ASTNode clone0 ( AST target ) { SynchronizedStatement result = new SynchronizedStatement ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; result . setExpression ( ( Expression ) getExpression ( ) . clone ( target ) ) ; result . setBody ( ( Block ) getBody ( ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getExpression ( ) ) ; acceptChild ( visitor , getBody ( ) ) ; } visitor . endVisit ( this ) ; } public Expression getExpression ( ) { if ( this . expression == null ) { synchronized ( this ) { if ( this . expression == null ) { preLazyInit ( ) ; this . expression = new SimpleName ( this . ast ) ; postLazyInit ( this . expression , EXPRESSION_PROPERTY ) ; } } } return this . expression ; } public void setExpression ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . expression ; preReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; this . expression = expression ; postReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; } public Block getBody ( ) { if ( this . body == null ) { synchronized ( this ) { if ( this . body == null ) { preLazyInit ( ) ; this . body = new Block ( this . ast ) ; postLazyInit ( this . body , BODY_PROPERTY ) ; } } } return this . body ; } public void setBody ( Block block ) { if ( block == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . body ; preReplaceChild ( oldChild , block , BODY_PROPERTY ) ; this . body = block ; postReplaceChild ( oldChild , block , BODY_PROPERTY ) ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . expression == null ? <NUM_LIT:0> : getExpression ( ) . treeSize ( ) ) + ( this . body == null ? <NUM_LIT:0> : getBody ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class InstanceofExpression extends Expression { public static final ChildPropertyDescriptor LEFT_OPERAND_PROPERTY = new ChildPropertyDescriptor ( InstanceofExpression . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; public static final ChildPropertyDescriptor RIGHT_OPERAND_PROPERTY = new ChildPropertyDescriptor ( InstanceofExpression . class , "<STR_LIT>" , Type . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( InstanceofExpression . class , properyList ) ; addProperty ( LEFT_OPERAND_PROPERTY , properyList ) ; addProperty ( RIGHT_OPERAND_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Expression leftOperand = null ; private Type rightOperand = null ; InstanceofExpression ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == LEFT_OPERAND_PROPERTY ) { if ( get ) { return getLeftOperand ( ) ; } else { setLeftOperand ( ( Expression ) child ) ; return null ; } } if ( property == RIGHT_OPERAND_PROPERTY ) { if ( get ) { return getRightOperand ( ) ; } else { setRightOperand ( ( Type ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return INSTANCEOF_EXPRESSION ; } ASTNode clone0 ( AST target ) { InstanceofExpression result = new InstanceofExpression ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setLeftOperand ( ( Expression ) getLeftOperand ( ) . clone ( target ) ) ; result . setRightOperand ( ( Type ) getRightOperand ( ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getLeftOperand ( ) ) ; acceptChild ( visitor , getRightOperand ( ) ) ; } visitor . endVisit ( this ) ; } public Expression getLeftOperand ( ) { if ( this . leftOperand == null ) { synchronized ( this ) { if ( this . leftOperand == null ) { preLazyInit ( ) ; this . leftOperand = new SimpleName ( this . ast ) ; postLazyInit ( this . leftOperand , LEFT_OPERAND_PROPERTY ) ; } } } return this . leftOperand ; } public void setLeftOperand ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . leftOperand ; preReplaceChild ( oldChild , expression , LEFT_OPERAND_PROPERTY ) ; this . leftOperand = expression ; postReplaceChild ( oldChild , expression , LEFT_OPERAND_PROPERTY ) ; } public Type getRightOperand ( ) { if ( this . rightOperand == null ) { synchronized ( this ) { if ( this . rightOperand == null ) { preLazyInit ( ) ; this . rightOperand = new SimpleType ( this . ast ) ; postLazyInit ( this . rightOperand , RIGHT_OPERAND_PROPERTY ) ; } } } return this . rightOperand ; } public void setRightOperand ( Type referenceType ) { if ( referenceType == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . rightOperand ; preReplaceChild ( oldChild , referenceType , RIGHT_OPERAND_PROPERTY ) ; this . rightOperand = referenceType ; postReplaceChild ( oldChild , referenceType , RIGHT_OPERAND_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . leftOperand == null ? <NUM_LIT:0> : getLeftOperand ( ) . treeSize ( ) ) + ( this . rightOperand == null ? <NUM_LIT:0> : getRightOperand ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class ParameterizedType extends Type { int index ; public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor ( ParameterizedType . class , "<STR_LIT:type>" , Type . class , MANDATORY , CYCLE_RISK ) ; public static final ChildListPropertyDescriptor TYPE_ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor ( ParameterizedType . class , "<STR_LIT>" , Type . class , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( ParameterizedType . class , propertyList ) ; addProperty ( TYPE_PROPERTY , propertyList ) ; addProperty ( TYPE_ARGUMENTS_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Type type = null ; private ASTNode . NodeList typeArguments = new ASTNode . NodeList ( TYPE_ARGUMENTS_PROPERTY ) ; ParameterizedType ( AST ast ) { super ( ast ) ; unsupportedIn2 ( ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == TYPE_PROPERTY ) { if ( get ) { return getType ( ) ; } else { setType ( ( Type ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == TYPE_ARGUMENTS_PROPERTY ) { return typeArguments ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return PARAMETERIZED_TYPE ; } ASTNode clone0 ( AST target ) { ParameterizedType result = new ParameterizedType ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setType ( ( Type ) ( ( ASTNode ) getType ( ) ) . clone ( target ) ) ; result . typeArguments ( ) . addAll ( ASTNode . copySubtrees ( target , typeArguments ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getType ( ) ) ; acceptChildren ( visitor , this . typeArguments ) ; } visitor . endVisit ( this ) ; } public Type getType ( ) { if ( this . type == null ) { synchronized ( this ) { if ( this . type == null ) { preLazyInit ( ) ; this . type = new SimpleType ( this . ast ) ; postLazyInit ( this . type , TYPE_PROPERTY ) ; } } } return this . type ; } public void setType ( Type type ) { if ( type == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . type ; preReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; this . type = type ; postReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; } public List typeArguments ( ) { return this . typeArguments ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:3> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . type == null ? <NUM_LIT:0> : getType ( ) . treeSize ( ) ) + this . typeArguments . listSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; public abstract class Expression extends ASTNode { Expression ( AST ast ) { super ( ast ) ; } public final Object resolveConstantExpressionValue ( ) { return this . ast . getBindingResolver ( ) . resolveConstantExpressionValue ( this ) ; } public final ITypeBinding resolveTypeBinding ( ) { return this . ast . getBindingResolver ( ) . resolveExpressionType ( this ) ; } public final boolean resolveBoxing ( ) { return this . ast . getBindingResolver ( ) . resolveBoxing ( this ) ; } public final boolean resolveUnboxing ( ) { return this . ast . getBindingResolver ( ) . resolveUnboxing ( this ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class TypeParameter extends ASTNode { public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( TypeParameter . class , "<STR_LIT:name>" , SimpleName . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor TYPE_BOUNDS_PROPERTY = new ChildListPropertyDescriptor ( TypeParameter . class , "<STR_LIT>" , Type . class , NO_CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( TypeParameter . class , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; addProperty ( TYPE_BOUNDS_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private SimpleName typeVariableName = null ; private ASTNode . NodeList typeBounds = new ASTNode . NodeList ( TYPE_BOUNDS_PROPERTY ) ; TypeParameter ( AST ast ) { super ( ast ) ; unsupportedIn2 ( ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == TYPE_BOUNDS_PROPERTY ) { return typeBounds ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return TYPE_PARAMETER ; } ASTNode clone0 ( AST target ) { TypeParameter result = new TypeParameter ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setName ( ( SimpleName ) ( ( ASTNode ) getName ( ) ) . clone ( target ) ) ; result . typeBounds ( ) . addAll ( ASTNode . copySubtrees ( target , typeBounds ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getName ( ) ) ; acceptChildren ( visitor , this . typeBounds ) ; } visitor . endVisit ( this ) ; } public SimpleName getName ( ) { if ( this . typeVariableName == null ) { synchronized ( this ) { if ( this . typeVariableName == null ) { preLazyInit ( ) ; this . typeVariableName = new SimpleName ( this . ast ) ; postLazyInit ( this . typeVariableName , NAME_PROPERTY ) ; } } } return this . typeVariableName ; } public final ITypeBinding resolveBinding ( ) { return this . ast . getBindingResolver ( ) . resolveTypeParameter ( this ) ; } public void setName ( SimpleName typeName ) { if ( typeName == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . typeVariableName ; preReplaceChild ( oldChild , typeName , NAME_PROPERTY ) ; this . typeVariableName = typeName ; postReplaceChild ( oldChild , typeName , NAME_PROPERTY ) ; } public List typeBounds ( ) { return this . typeBounds ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . typeVariableName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) + this . typeBounds . listSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; public abstract class Type extends ASTNode { Type ( AST ast ) { super ( ast ) ; } public final boolean isPrimitiveType ( ) { return ( this instanceof PrimitiveType ) ; } public final boolean isSimpleType ( ) { return ( this instanceof SimpleType ) ; } public final boolean isArrayType ( ) { return ( this instanceof ArrayType ) ; } public final boolean isParameterizedType ( ) { return ( this instanceof ParameterizedType ) ; } public final boolean isQualifiedType ( ) { return ( this instanceof QualifiedType ) ; } public final boolean isWildcardType ( ) { return ( this instanceof WildcardType ) ; } public final ITypeBinding resolveBinding ( ) { return this . ast . getBindingResolver ( ) . resolveType ( this ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public final class NormalAnnotation extends Annotation { public static final ChildPropertyDescriptor TYPE_NAME_PROPERTY = internalTypeNamePropertyFactory ( NormalAnnotation . class ) ; public static final ChildListPropertyDescriptor VALUES_PROPERTY = new ChildListPropertyDescriptor ( NormalAnnotation . class , "<STR_LIT>" , MemberValuePair . class , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( NormalAnnotation . class , propertyList ) ; addProperty ( TYPE_NAME_PROPERTY , propertyList ) ; addProperty ( VALUES_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private ASTNode . NodeList values = new ASTNode . NodeList ( VALUES_PROPERTY ) ; NormalAnnotation ( AST ast ) { super ( ast ) ; unsupportedIn2 ( ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == TYPE_NAME_PROPERTY ) { if ( get ) { return getTypeName ( ) ; } else { setTypeName ( ( Name ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == VALUES_PROPERTY ) { return values ( ) ; } return super . internalGetChildListProperty ( property ) ; } final ChildPropertyDescriptor internalTypeNameProperty ( ) { return TYPE_NAME_PROPERTY ; } final int getNodeType0 ( ) { return NORMAL_ANNOTATION ; } ASTNode clone0 ( AST target ) { NormalAnnotation result = new NormalAnnotation ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setTypeName ( ( Name ) ASTNode . copySubtree ( target , getTypeName ( ) ) ) ; result . values ( ) . addAll ( ASTNode . copySubtrees ( target , values ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getTypeName ( ) ) ; acceptChildren ( visitor , this . values ) ; } visitor . endVisit ( this ) ; } public List values ( ) { return this . values ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:1> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . typeName == null ? <NUM_LIT:0> : getTypeName ( ) . treeSize ( ) ) + this . values . listSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class MemberValuePair extends ASTNode { public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( MemberValuePair . class , "<STR_LIT:name>" , SimpleName . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor VALUE_PROPERTY = new ChildPropertyDescriptor ( MemberValuePair . class , "<STR_LIT:value>" , Expression . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( MemberValuePair . class , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; addProperty ( VALUE_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private SimpleName name = null ; private Expression value = null ; MemberValuePair ( AST ast ) { super ( ast ) ; unsupportedIn2 ( ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } if ( property == VALUE_PROPERTY ) { if ( get ) { return getValue ( ) ; } else { setValue ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return MEMBER_VALUE_PAIR ; } ASTNode clone0 ( AST target ) { MemberValuePair result = new MemberValuePair ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setName ( ( SimpleName ) ASTNode . copySubtree ( target , getName ( ) ) ) ; result . setValue ( ( Expression ) ASTNode . copySubtree ( target , getValue ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getName ( ) ) ; acceptChild ( visitor , getValue ( ) ) ; } visitor . endVisit ( this ) ; } public SimpleName getName ( ) { if ( this . name == null ) { synchronized ( this ) { if ( this . name == null ) { preLazyInit ( ) ; this . name = new SimpleName ( this . ast ) ; postLazyInit ( this . name , NAME_PROPERTY ) ; } } } return this . name ; } public final IMemberValuePairBinding resolveMemberValuePairBinding ( ) { return this . ast . getBindingResolver ( ) . resolveMemberValuePair ( this ) ; } public void setName ( SimpleName name ) { if ( name == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . name ; preReplaceChild ( oldChild , name , NAME_PROPERTY ) ; this . name = name ; postReplaceChild ( oldChild , name , NAME_PROPERTY ) ; } public Expression getValue ( ) { if ( this . value == null ) { synchronized ( this ) { if ( this . value == null ) { preLazyInit ( ) ; this . value = new SimpleName ( this . ast ) ; postLazyInit ( this . value , VALUE_PROPERTY ) ; } } } return this . value ; } public void setValue ( Expression value ) { if ( value == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . value ; preReplaceChild ( oldChild , value , VALUE_PROPERTY ) ; this . value = value ; postReplaceChild ( oldChild , value , VALUE_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . name == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) + ( this . value == null ? <NUM_LIT:0> : getValue ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; public interface IMethodBinding extends IBinding { public boolean isConstructor ( ) ; public boolean isDefaultConstructor ( ) ; public String getName ( ) ; public ITypeBinding getDeclaringClass ( ) ; public Object getDefaultValue ( ) ; public IAnnotationBinding [ ] getParameterAnnotations ( int paramIndex ) ; public ITypeBinding [ ] getParameterTypes ( ) ; public ITypeBinding getReturnType ( ) ; public ITypeBinding [ ] getExceptionTypes ( ) ; public ITypeBinding [ ] getTypeParameters ( ) ; public boolean isAnnotationMember ( ) ; public boolean isGenericMethod ( ) ; public boolean isParameterizedMethod ( ) ; public ITypeBinding [ ] getTypeArguments ( ) ; public IMethodBinding getMethodDeclaration ( ) ; public boolean isRawMethod ( ) ; public boolean isSubsignature ( IMethodBinding otherMethod ) ; public boolean isVarargs ( ) ; public boolean overrides ( IMethodBinding method ) ; } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import java . util . Map ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . ITypeRoot ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . internal . compiler . parser . Scanner ; import org . eclipse . jdt . internal . compiler . util . Util ; import org . eclipse . jface . text . IDocument ; import org . eclipse . text . edits . TextEdit ; public class CompilationUnit extends ASTNode { private static final Message [ ] EMPTY_MESSAGES = new Message [ <NUM_LIT:0> ] ; private static final IProblem [ ] EMPTY_PROBLEMS = new IProblem [ <NUM_LIT:0> ] ; public static final ChildListPropertyDescriptor IMPORTS_PROPERTY = new ChildListPropertyDescriptor ( CompilationUnit . class , "<STR_LIT>" , ImportDeclaration . class , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor PACKAGE_PROPERTY = new ChildPropertyDescriptor ( CompilationUnit . class , "<STR_LIT>" , PackageDeclaration . class , OPTIONAL , NO_CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; public static final ChildListPropertyDescriptor TYPES_PROPERTY = new ChildListPropertyDescriptor ( CompilationUnit . class , "<STR_LIT>" , AbstractTypeDeclaration . class , CYCLE_RISK ) ; static { List properyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( CompilationUnit . class , properyList ) ; addProperty ( PACKAGE_PROPERTY , properyList ) ; addProperty ( IMPORTS_PROPERTY , properyList ) ; addProperty ( TYPES_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private DefaultCommentMapper commentMapper = null ; private ITypeRoot typeRoot = null ; private ASTNode . NodeList imports = new ASTNode . NodeList ( IMPORTS_PROPERTY ) ; private int [ ] lineEndTable = Util . EMPTY_INT_ARRAY ; private Message [ ] messages ; private List optionalCommentList = null ; Comment [ ] optionalCommentTable = null ; private PackageDeclaration optionalPackageDeclaration = null ; private IProblem [ ] problems = EMPTY_PROBLEMS ; private Object statementsRecoveryData ; private ASTNode . NodeList types = new ASTNode . NodeList ( TYPES_PROPERTY ) ; protected CompilationUnit ( AST ast ) { super ( ast ) ; } protected void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getPackage ( ) ) ; acceptChildren ( visitor , this . imports ) ; acceptChildren ( visitor , this . types ) ; } visitor . endVisit ( this ) ; } ASTNode clone0 ( AST target ) { CompilationUnit result = new CompilationUnit ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setPackage ( ( PackageDeclaration ) ASTNode . copySubtree ( target , getPackage ( ) ) ) ; result . imports ( ) . addAll ( ASTNode . copySubtrees ( target , imports ( ) ) ) ; result . types ( ) . addAll ( ASTNode . copySubtrees ( target , types ( ) ) ) ; return result ; } public int getColumnNumber ( final int position ) { if ( this . lineEndTable == null ) return - <NUM_LIT:2> ; final int line = getLineNumber ( position ) ; if ( line == - <NUM_LIT:1> ) { return - <NUM_LIT:1> ; } if ( line == <NUM_LIT:1> ) { if ( position >= getStartPosition ( ) + getLength ( ) ) return - <NUM_LIT:1> ; return position ; } int length = this . lineEndTable . length ; final int previousLineOffset = this . lineEndTable [ line - <NUM_LIT:2> ] ; final int offsetForLine = previousLineOffset + <NUM_LIT:1> ; final int currentLineEnd = line == length + <NUM_LIT:1> ? getStartPosition ( ) + getLength ( ) - <NUM_LIT:1> : this . lineEndTable [ line - <NUM_LIT:1> ] ; if ( offsetForLine > currentLineEnd ) { return - <NUM_LIT:1> ; } else { return position - offsetForLine ; } } public ASTNode findDeclaringNode ( IBinding binding ) { return this . ast . getBindingResolver ( ) . findDeclaringNode ( binding ) ; } public ASTNode findDeclaringNode ( String key ) { return this . ast . getBindingResolver ( ) . findDeclaringNode ( key ) ; } public List getCommentList ( ) { return this . optionalCommentList ; } DefaultCommentMapper getCommentMapper ( ) { return this . commentMapper ; } public int getExtendedLength ( ASTNode node ) { if ( node == null ) { throw new IllegalArgumentException ( ) ; } if ( this . commentMapper == null || node . getAST ( ) != getAST ( ) ) { return node . getLength ( ) ; } else { return this . commentMapper . getExtendedLength ( node ) ; } } public int getExtendedStartPosition ( ASTNode node ) { if ( node == null ) { throw new IllegalArgumentException ( ) ; } if ( this . commentMapper == null || node . getAST ( ) != getAST ( ) ) { return node . getStartPosition ( ) ; } else { return this . commentMapper . getExtendedStartPosition ( node ) ; } } public IJavaElement getJavaElement ( ) { return this . typeRoot ; } public Message [ ] getMessages ( ) { if ( this . messages == null ) { int problemLength = this . problems . length ; if ( problemLength == <NUM_LIT:0> ) { this . messages = EMPTY_MESSAGES ; } else { this . messages = new Message [ problemLength ] ; for ( int i = <NUM_LIT:0> ; i < problemLength ; i ++ ) { IProblem problem = this . problems [ i ] ; int start = problem . getSourceStart ( ) ; int end = problem . getSourceEnd ( ) ; this . messages [ i ] = new Message ( problem . getMessage ( ) , start , end - start + <NUM_LIT:1> ) ; } } } return this . messages ; } final int getNodeType0 ( ) { return COMPILATION_UNIT ; } public PackageDeclaration getPackage ( ) { return this . optionalPackageDeclaration ; } public int getPosition ( int line , int column ) { if ( this . lineEndTable == null ) return - <NUM_LIT:2> ; if ( line < <NUM_LIT:1> || column < <NUM_LIT:0> ) return - <NUM_LIT:1> ; int length ; if ( ( length = this . lineEndTable . length ) == <NUM_LIT:0> ) { if ( line != <NUM_LIT:1> ) return - <NUM_LIT:1> ; return column >= getStartPosition ( ) + getLength ( ) ? - <NUM_LIT:1> : column ; } if ( line == <NUM_LIT:1> ) { final int endOfLine = this . lineEndTable [ <NUM_LIT:0> ] ; return column > endOfLine ? - <NUM_LIT:1> : column ; } else if ( line > length + <NUM_LIT:1> ) { return - <NUM_LIT:1> ; } final int previousLineOffset = this . lineEndTable [ line - <NUM_LIT:2> ] ; final int offsetForLine = previousLineOffset + <NUM_LIT:1> ; final int currentLineEnd = line == length + <NUM_LIT:1> ? getStartPosition ( ) + getLength ( ) - <NUM_LIT:1> : this . lineEndTable [ line - <NUM_LIT:1> ] ; if ( ( offsetForLine + column ) > currentLineEnd ) { return - <NUM_LIT:1> ; } else { return offsetForLine + column ; } } public IProblem [ ] getProblems ( ) { return this . problems ; } public Object getStatementsRecoveryData ( ) { return this . statementsRecoveryData ; } public ITypeRoot getTypeRoot ( ) { return this . typeRoot ; } public List imports ( ) { return this . imports ; } public int firstLeadingCommentIndex ( ASTNode node ) { if ( node == null ) { throw new IllegalArgumentException ( ) ; } if ( this . commentMapper == null || node . getAST ( ) != getAST ( ) ) { return - <NUM_LIT:1> ; } return this . commentMapper . firstLeadingCommentIndex ( node ) ; } public int lastTrailingCommentIndex ( ASTNode node ) { if ( node == null ) { throw new IllegalArgumentException ( ) ; } if ( this . commentMapper == null || node . getAST ( ) != getAST ( ) ) { return - <NUM_LIT:1> ; } return this . commentMapper . lastTrailingCommentIndex ( node ) ; } void initCommentMapper ( Scanner scanner ) { this . commentMapper = new DefaultCommentMapper ( this . optionalCommentTable ) ; this . commentMapper . initialize ( this , scanner ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == IMPORTS_PROPERTY ) { return imports ( ) ; } if ( property == TYPES_PROPERTY ) { return types ( ) ; } return super . internalGetChildListProperty ( property ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == PACKAGE_PROPERTY ) { if ( get ) { return getPackage ( ) ; } else { setPackage ( ( PackageDeclaration ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } public int lineNumber ( int position ) { int lineNumber = getLineNumber ( position ) ; return lineNumber < <NUM_LIT:1> ? <NUM_LIT:1> : lineNumber ; } public int getLineNumber ( int position ) { if ( this . lineEndTable == null ) return - <NUM_LIT:2> ; int length ; if ( ( length = this . lineEndTable . length ) == <NUM_LIT:0> ) { if ( position >= getStartPosition ( ) + getLength ( ) ) { return - <NUM_LIT:1> ; } return <NUM_LIT:1> ; } int low = <NUM_LIT:0> ; if ( position < <NUM_LIT:0> ) { return - <NUM_LIT:1> ; } if ( position <= this . lineEndTable [ low ] ) { return <NUM_LIT:1> ; } int hi = length - <NUM_LIT:1> ; if ( position > this . lineEndTable [ hi ] ) { if ( position >= getStartPosition ( ) + getLength ( ) ) { return - <NUM_LIT:1> ; } else { return length + <NUM_LIT:1> ; } } while ( true ) { if ( low + <NUM_LIT:1> == hi ) { return low + <NUM_LIT:2> ; } int mid = low + ( hi - low ) / <NUM_LIT:2> ; if ( position <= this . lineEndTable [ mid ] ) { hi = mid ; } else { low = mid ; } } } int memSize ( ) { int size = BASE_NODE_SIZE + <NUM_LIT:8> * <NUM_LIT:4> ; if ( this . lineEndTable != null ) { size += HEADERS + <NUM_LIT:4> * this . lineEndTable . length ; } if ( this . optionalCommentTable != null ) { size += HEADERS + <NUM_LIT:4> * this . optionalCommentTable . length ; } return size ; } public void recordModifications ( ) { getAST ( ) . recordModifications ( this ) ; } public TextEdit rewrite ( IDocument document , Map options ) { return getAST ( ) . rewrite ( document , options ) ; } void setCommentTable ( Comment [ ] commentTable ) { if ( commentTable == null ) { this . optionalCommentList = null ; this . optionalCommentTable = null ; } else { int nextAvailablePosition = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < commentTable . length ; i ++ ) { Comment comment = commentTable [ i ] ; if ( comment == null ) { throw new IllegalArgumentException ( ) ; } int start = comment . getStartPosition ( ) ; int length = comment . getLength ( ) ; if ( start < <NUM_LIT:0> || length < <NUM_LIT:0> || start < nextAvailablePosition ) { throw new IllegalArgumentException ( ) ; } nextAvailablePosition = comment . getStartPosition ( ) + comment . getLength ( ) ; } this . optionalCommentTable = commentTable ; List commentList = Arrays . asList ( commentTable ) ; this . optionalCommentList = Collections . unmodifiableList ( commentList ) ; } } void setTypeRoot ( ITypeRoot typeRoot ) { this . typeRoot = typeRoot ; } void setLineEndTable ( int [ ] lineEndTable ) { if ( lineEndTable == null ) { throw new NullPointerException ( ) ; } checkModifiable ( ) ; this . lineEndTable = lineEndTable ; } public void setPackage ( PackageDeclaration pkgDecl ) { ASTNode oldChild = this . optionalPackageDeclaration ; preReplaceChild ( oldChild , pkgDecl , PACKAGE_PROPERTY ) ; this . optionalPackageDeclaration = pkgDecl ; postReplaceChild ( oldChild , pkgDecl , PACKAGE_PROPERTY ) ; } void setProblems ( IProblem [ ] problems ) { if ( problems == null ) { throw new IllegalArgumentException ( ) ; } this . problems = problems ; } void setStatementsRecoveryData ( Object data ) { this . statementsRecoveryData = data ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } int treeSize ( ) { int size = memSize ( ) ; if ( this . optionalPackageDeclaration != null ) { size += getPackage ( ) . treeSize ( ) ; } size += this . imports . listSize ( ) ; size += this . types . listSize ( ) ; if ( this . optionalCommentList != null ) { for ( int i = <NUM_LIT:0> ; i < this . optionalCommentList . size ( ) ; i ++ ) { Comment comment = ( Comment ) this . optionalCommentList . get ( i ) ; if ( comment != null && comment . getParent ( ) == null ) { size += comment . treeSize ( ) ; } } } return size ; } public List types ( ) { return this . types ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class AssertStatement extends Statement { public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( AssertStatement . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; public static final ChildPropertyDescriptor MESSAGE_PROPERTY = new ChildPropertyDescriptor ( AssertStatement . class , "<STR_LIT:message>" , Expression . class , OPTIONAL , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( AssertStatement . class , properyList ) ; addProperty ( EXPRESSION_PROPERTY , properyList ) ; addProperty ( MESSAGE_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Expression expression = null ; private Expression optionalMessageExpression = null ; AssertStatement ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == EXPRESSION_PROPERTY ) { if ( get ) { return getExpression ( ) ; } else { setExpression ( ( Expression ) child ) ; return null ; } } if ( property == MESSAGE_PROPERTY ) { if ( get ) { return getMessage ( ) ; } else { setMessage ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return ASSERT_STATEMENT ; } ASTNode clone0 ( AST target ) { AssertStatement result = new AssertStatement ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; result . setExpression ( ( Expression ) ASTNode . copySubtree ( target , getExpression ( ) ) ) ; result . setMessage ( ( Expression ) ASTNode . copySubtree ( target , getMessage ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getExpression ( ) ) ; acceptChild ( visitor , getMessage ( ) ) ; } visitor . endVisit ( this ) ; } public Expression getExpression ( ) { if ( this . expression == null ) { synchronized ( this ) { if ( this . expression == null ) { preLazyInit ( ) ; this . expression = new SimpleName ( this . ast ) ; postLazyInit ( this . expression , EXPRESSION_PROPERTY ) ; } } } return this . expression ; } public void setExpression ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . expression ; preReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; this . expression = expression ; postReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; } public Expression getMessage ( ) { return this . optionalMessageExpression ; } public void setMessage ( Expression expression ) { ASTNode oldChild = this . optionalMessageExpression ; preReplaceChild ( oldChild , expression , MESSAGE_PROPERTY ) ; this . optionalMessageExpression = expression ; postReplaceChild ( oldChild , expression , MESSAGE_PROPERTY ) ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . expression == null ? <NUM_LIT:0> : getExpression ( ) . treeSize ( ) ) + ( this . optionalMessageExpression == null ? <NUM_LIT:0> : getMessage ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class Block extends Statement { public static final ChildListPropertyDescriptor STATEMENTS_PROPERTY = new ChildListPropertyDescriptor ( Block . class , "<STR_LIT>" , Statement . class , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( Block . class , properyList ) ; addProperty ( STATEMENTS_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private ASTNode . NodeList statements = new ASTNode . NodeList ( STATEMENTS_PROPERTY ) ; Block ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == STATEMENTS_PROPERTY ) { return statements ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return BLOCK ; } ASTNode clone0 ( AST target ) { Block result = new Block ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; result . statements ( ) . addAll ( ASTNode . copySubtrees ( target , statements ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChildren ( visitor , this . statements ) ; } visitor . endVisit ( this ) ; } public List statements ( ) { return this . statements ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:1> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + this . statements . listSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; public interface IExtendedModifier { public boolean isModifier ( ) ; public boolean isAnnotation ( ) ; } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . Iterator ; import java . util . List ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Status ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IPackageFragment ; import org . eclipse . jdt . core . IPackageFragmentRoot ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . env . IBinaryAnnotation ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . compiler . env . INameEnvironment ; import org . eclipse . jdt . internal . compiler . env . NameEnvironmentAnswer ; import org . eclipse . jdt . internal . compiler . lookup . BinaryTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . compiler . util . Util ; import org . eclipse . jdt . internal . core . NameLookup ; import org . eclipse . jdt . internal . core . SearchableEnvironment ; class PackageBinding implements IPackageBinding { private static final String [ ] NO_NAME_COMPONENTS = CharOperation . NO_STRINGS ; private static final String UNNAMED = Util . EMPTY_STRING ; private static final char PACKAGE_NAME_SEPARATOR = '<CHAR_LIT:.>' ; private org . eclipse . jdt . internal . compiler . lookup . PackageBinding binding ; private String name ; private BindingResolver resolver ; private String [ ] components ; PackageBinding ( org . eclipse . jdt . internal . compiler . lookup . PackageBinding binding , BindingResolver resolver ) { this . binding = binding ; this . resolver = resolver ; } public IAnnotationBinding [ ] getAnnotations ( ) { try { INameEnvironment nameEnvironment = this . binding . environment . nameEnvironment ; if ( ! ( nameEnvironment instanceof SearchableEnvironment ) ) return AnnotationBinding . NoAnnotations ; NameLookup nameLookup = ( ( SearchableEnvironment ) nameEnvironment ) . nameLookup ; if ( nameLookup == null ) return AnnotationBinding . NoAnnotations ; final String pkgName = getName ( ) ; IPackageFragment [ ] pkgs = nameLookup . findPackageFragments ( pkgName , false ) ; if ( pkgs == null ) return AnnotationBinding . NoAnnotations ; for ( int i = <NUM_LIT:0> , len = pkgs . length ; i < len ; i ++ ) { int fragType = pkgs [ i ] . getKind ( ) ; switch ( fragType ) { case IPackageFragmentRoot . K_SOURCE : String unitName = "<STR_LIT>" ; ICompilationUnit unit = pkgs [ i ] . getCompilationUnit ( unitName ) ; if ( unit != null && unit . exists ( ) ) { ASTParser p = ASTParser . newParser ( AST . JLS3 ) ; p . setSource ( unit ) ; p . setResolveBindings ( true ) ; p . setUnitName ( unitName ) ; p . setFocalPosition ( <NUM_LIT:0> ) ; p . setKind ( ASTParser . K_COMPILATION_UNIT ) ; CompilationUnit domUnit = ( CompilationUnit ) p . createAST ( null ) ; PackageDeclaration pkgDecl = domUnit . getPackage ( ) ; if ( pkgDecl != null ) { List annos = pkgDecl . annotations ( ) ; if ( annos == null || annos . isEmpty ( ) ) return AnnotationBinding . NoAnnotations ; IAnnotationBinding [ ] result = new IAnnotationBinding [ annos . size ( ) ] ; int index = <NUM_LIT:0> ; for ( Iterator it = annos . iterator ( ) ; it . hasNext ( ) ; index ++ ) { result [ index ] = ( ( Annotation ) it . next ( ) ) . resolveAnnotationBinding ( ) ; if ( result [ index ] == null ) return AnnotationBinding . NoAnnotations ; } return result ; } } break ; case IPackageFragmentRoot . K_BINARY : NameEnvironmentAnswer answer = nameEnvironment . findType ( TypeConstants . PACKAGE_INFO_NAME , this . binding . compoundName ) ; if ( answer != null && answer . isBinaryType ( ) ) { IBinaryType type = answer . getBinaryType ( ) ; char [ ] [ ] [ ] missingTypeNames = type . getMissingTypeNames ( ) ; IBinaryAnnotation [ ] binaryAnnotations = type . getAnnotations ( ) ; org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding [ ] binaryInstances = BinaryTypeBinding . createAnnotations ( binaryAnnotations , this . binding . environment , missingTypeNames ) ; org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding [ ] allInstances = org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding . addStandardAnnotations ( binaryInstances , type . getTagBits ( ) , this . binding . environment ) ; int total = allInstances . length ; IAnnotationBinding [ ] domInstances = new AnnotationBinding [ total ] ; for ( int a = <NUM_LIT:0> ; a < total ; a ++ ) { final IAnnotationBinding annotationInstance = this . resolver . getAnnotationInstance ( allInstances [ a ] ) ; if ( annotationInstance == null ) { return AnnotationBinding . NoAnnotations ; } domInstances [ a ] = annotationInstance ; } return domInstances ; } } } } catch ( JavaModelException e ) { return AnnotationBinding . NoAnnotations ; } return AnnotationBinding . NoAnnotations ; } public String getName ( ) { if ( this . name == null ) { computeNameAndComponents ( ) ; } return this . name ; } public boolean isUnnamed ( ) { return getName ( ) . equals ( UNNAMED ) ; } public String [ ] getNameComponents ( ) { if ( this . components == null ) { computeNameAndComponents ( ) ; } return this . components ; } public int getKind ( ) { return IBinding . PACKAGE ; } public int getModifiers ( ) { return Modifier . NONE ; } public boolean isDeprecated ( ) { return false ; } public boolean isRecovered ( ) { return false ; } public boolean isSynthetic ( ) { return false ; } public IJavaElement getJavaElement ( ) { INameEnvironment nameEnvironment = this . binding . environment . nameEnvironment ; if ( ! ( nameEnvironment instanceof SearchableEnvironment ) ) return null ; NameLookup nameLookup = ( ( SearchableEnvironment ) nameEnvironment ) . nameLookup ; if ( nameLookup == null ) return null ; IJavaElement [ ] pkgs = nameLookup . findPackageFragments ( getName ( ) , false ) ; if ( pkgs == null ) return null ; if ( pkgs . length == <NUM_LIT:0> ) { org . eclipse . jdt . internal . core . util . Util . log ( new Status ( IStatus . WARNING , JavaCore . PLUGIN_ID , "<STR_LIT>" + getName ( ) + "<STR_LIT>" ) ) ; return null ; } return pkgs [ <NUM_LIT:0> ] ; } public String getKey ( ) { return new String ( this . binding . computeUniqueKey ( ) ) ; } public boolean isEqualTo ( IBinding other ) { if ( other == this ) { return true ; } if ( other == null ) { return false ; } if ( ! ( other instanceof PackageBinding ) ) { return false ; } org . eclipse . jdt . internal . compiler . lookup . PackageBinding packageBinding2 = ( ( PackageBinding ) other ) . binding ; return CharOperation . equals ( this . binding . compoundName , packageBinding2 . compoundName ) ; } private void computeNameAndComponents ( ) { char [ ] [ ] compoundName = this . binding . compoundName ; if ( compoundName == CharOperation . NO_CHAR_CHAR || compoundName == null ) { this . name = UNNAMED ; this . components = NO_NAME_COMPONENTS ; } else { int length = compoundName . length ; this . components = new String [ length ] ; StringBuffer buffer = new StringBuffer ( ) ; for ( int i = <NUM_LIT:0> ; i < length - <NUM_LIT:1> ; i ++ ) { this . components [ i ] = new String ( compoundName [ i ] ) ; buffer . append ( compoundName [ i ] ) . append ( PACKAGE_NAME_SEPARATOR ) ; } this . components [ length - <NUM_LIT:1> ] = new String ( compoundName [ length - <NUM_LIT:1> ] ) ; buffer . append ( compoundName [ length - <NUM_LIT:1> ] ) ; this . name = buffer . toString ( ) ; } } public String toString ( ) { return this . binding . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class ConditionalExpression extends Expression { public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( ConditionalExpression . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; public static final ChildPropertyDescriptor THEN_EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( ConditionalExpression . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; public static final ChildPropertyDescriptor ELSE_EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( ConditionalExpression . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( ConditionalExpression . class , properyList ) ; addProperty ( EXPRESSION_PROPERTY , properyList ) ; addProperty ( THEN_EXPRESSION_PROPERTY , properyList ) ; addProperty ( ELSE_EXPRESSION_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Expression conditionExpression = null ; private Expression thenExpression = null ; private Expression elseExpression = null ; ConditionalExpression ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == EXPRESSION_PROPERTY ) { if ( get ) { return getExpression ( ) ; } else { setExpression ( ( Expression ) child ) ; return null ; } } if ( property == THEN_EXPRESSION_PROPERTY ) { if ( get ) { return getThenExpression ( ) ; } else { setThenExpression ( ( Expression ) child ) ; return null ; } } if ( property == ELSE_EXPRESSION_PROPERTY ) { if ( get ) { return getElseExpression ( ) ; } else { setElseExpression ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return CONDITIONAL_EXPRESSION ; } ASTNode clone0 ( AST target ) { ConditionalExpression result = new ConditionalExpression ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setExpression ( ( Expression ) getExpression ( ) . clone ( target ) ) ; result . setThenExpression ( ( Expression ) getThenExpression ( ) . clone ( target ) ) ; result . setElseExpression ( ( Expression ) getElseExpression ( ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getExpression ( ) ) ; acceptChild ( visitor , getThenExpression ( ) ) ; acceptChild ( visitor , getElseExpression ( ) ) ; } visitor . endVisit ( this ) ; } public Expression getExpression ( ) { if ( this . conditionExpression == null ) { synchronized ( this ) { if ( this . conditionExpression == null ) { preLazyInit ( ) ; this . conditionExpression = new SimpleName ( this . ast ) ; postLazyInit ( this . conditionExpression , EXPRESSION_PROPERTY ) ; } } } return this . conditionExpression ; } public void setExpression ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . conditionExpression ; preReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; this . conditionExpression = expression ; postReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; } public Expression getThenExpression ( ) { if ( this . thenExpression == null ) { synchronized ( this ) { if ( this . thenExpression == null ) { preLazyInit ( ) ; this . thenExpression = new SimpleName ( this . ast ) ; postLazyInit ( this . thenExpression , THEN_EXPRESSION_PROPERTY ) ; } } } return this . thenExpression ; } public void setThenExpression ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . thenExpression ; preReplaceChild ( oldChild , expression , THEN_EXPRESSION_PROPERTY ) ; this . thenExpression = expression ; postReplaceChild ( oldChild , expression , THEN_EXPRESSION_PROPERTY ) ; } public Expression getElseExpression ( ) { if ( this . elseExpression == null ) { synchronized ( this ) { if ( this . elseExpression == null ) { preLazyInit ( ) ; this . elseExpression = new SimpleName ( this . ast ) ; postLazyInit ( this . elseExpression , ELSE_EXPRESSION_PROPERTY ) ; } } } return this . elseExpression ; } public void setElseExpression ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . elseExpression ; preReplaceChild ( oldChild , expression , ELSE_EXPRESSION_PROPERTY ) ; this . elseExpression = expression ; postReplaceChild ( oldChild , expression , ELSE_EXPRESSION_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:3> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . conditionExpression == null ? <NUM_LIT:0> : getExpression ( ) . treeSize ( ) ) + ( this . thenExpression == null ? <NUM_LIT:0> : getThenExpression ( ) . treeSize ( ) ) + ( this . elseExpression == null ? <NUM_LIT:0> : getElseExpression ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . ast . ConstructorDeclaration ; import org . eclipse . jdt . internal . compiler . ast . FieldDeclaration ; import org . eclipse . jdt . internal . compiler . ast . Initializer ; import org . eclipse . jdt . internal . compiler . ast . MethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ; import org . eclipse . jdt . internal . compiler . lookup . ClassScope ; import org . eclipse . jdt . internal . compiler . lookup . CompilationUnitScope ; import org . eclipse . jdt . internal . compiler . lookup . MethodScope ; class NodeSearcher extends ASTVisitor { public org . eclipse . jdt . internal . compiler . ast . ASTNode found ; public TypeDeclaration enclosingType ; public int position ; NodeSearcher ( int position ) { this . position = position ; } public boolean visit ( ConstructorDeclaration constructorDeclaration , ClassScope scope ) { if ( constructorDeclaration . declarationSourceStart <= this . position && this . position <= constructorDeclaration . declarationSourceEnd ) { this . found = constructorDeclaration ; return false ; } return true ; } public boolean visit ( FieldDeclaration fieldDeclaration , MethodScope scope ) { if ( fieldDeclaration . declarationSourceStart <= this . position && this . position <= fieldDeclaration . declarationSourceEnd ) { this . found = fieldDeclaration ; return false ; } return true ; } public boolean visit ( Initializer initializer , MethodScope scope ) { if ( initializer . declarationSourceStart <= this . position && this . position <= initializer . declarationSourceEnd ) { this . found = initializer ; return false ; } return true ; } public boolean visit ( TypeDeclaration memberTypeDeclaration , ClassScope scope ) { if ( memberTypeDeclaration . declarationSourceStart <= this . position && this . position <= memberTypeDeclaration . declarationSourceEnd ) { this . enclosingType = memberTypeDeclaration ; return true ; } return false ; } public boolean visit ( MethodDeclaration methodDeclaration , ClassScope scope ) { if ( methodDeclaration . declarationSourceStart <= this . position && this . position <= methodDeclaration . declarationSourceEnd ) { this . found = methodDeclaration ; return false ; } return true ; } public boolean visit ( TypeDeclaration typeDeclaration , CompilationUnitScope scope ) { if ( typeDeclaration . declarationSourceStart <= this . position && this . position <= typeDeclaration . declarationSourceEnd ) { this . enclosingType = typeDeclaration ; return true ; } return false ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class MemberRef extends ASTNode implements IDocElement { public static final ChildPropertyDescriptor QUALIFIER_PROPERTY = new ChildPropertyDescriptor ( MemberRef . class , "<STR_LIT>" , Name . class , OPTIONAL , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( MemberRef . class , "<STR_LIT:name>" , SimpleName . class , MANDATORY , NO_CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( MemberRef . class , propertyList ) ; addProperty ( QUALIFIER_PROPERTY , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Name optionalQualifier = null ; private SimpleName memberName = null ; MemberRef ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == QUALIFIER_PROPERTY ) { if ( get ) { return getQualifier ( ) ; } else { setQualifier ( ( Name ) child ) ; return null ; } } if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return MEMBER_REF ; } ASTNode clone0 ( AST target ) { MemberRef result = new MemberRef ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setQualifier ( ( Name ) ASTNode . copySubtree ( target , getQualifier ( ) ) ) ; result . setName ( ( SimpleName ) ASTNode . copySubtree ( target , getName ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getQualifier ( ) ) ; acceptChild ( visitor , getName ( ) ) ; } visitor . endVisit ( this ) ; } public Name getQualifier ( ) { return this . optionalQualifier ; } public void setQualifier ( Name name ) { ASTNode oldChild = this . optionalQualifier ; preReplaceChild ( oldChild , name , QUALIFIER_PROPERTY ) ; this . optionalQualifier = name ; postReplaceChild ( oldChild , name , QUALIFIER_PROPERTY ) ; } public SimpleName getName ( ) { if ( this . memberName == null ) { synchronized ( this ) { if ( this . memberName == null ) { preLazyInit ( ) ; this . memberName = new SimpleName ( this . ast ) ; postLazyInit ( this . memberName , NAME_PROPERTY ) ; } } } return this . memberName ; } public void setName ( SimpleName name ) { if ( name == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . memberName ; preReplaceChild ( oldChild , name , NAME_PROPERTY ) ; this . memberName = name ; postReplaceChild ( oldChild , name , NAME_PROPERTY ) ; } public final IBinding resolveBinding ( ) { return this . ast . getBindingResolver ( ) . resolveReference ( this ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalQualifier == null ? <NUM_LIT:0> : getQualifier ( ) . treeSize ( ) ) + ( this . memberName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import org . eclipse . jdt . core . ICompilationUnit ; public abstract class ASTRequestor { CompilationUnitResolver compilationUnitResolver = null ; protected ASTRequestor ( ) { } public void acceptAST ( ICompilationUnit source , CompilationUnit ast ) { } public void acceptBinding ( String bindingKey , IBinding binding ) { } public final IBinding [ ] createBindings ( String [ ] bindingKeys ) { int length = bindingKeys . length ; IBinding [ ] result = new IBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { result [ i ] = null ; if ( this . compilationUnitResolver != null ) { result [ i ] = this . compilationUnitResolver . createBinding ( bindingKeys [ i ] ) ; } } return result ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class EnumDeclaration extends AbstractTypeDeclaration { public static final ChildPropertyDescriptor JAVADOC_PROPERTY = internalJavadocPropertyFactory ( EnumDeclaration . class ) ; public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY = internalModifiers2PropertyFactory ( EnumDeclaration . class ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = internalNamePropertyFactory ( EnumDeclaration . class ) ; public static final ChildListPropertyDescriptor SUPER_INTERFACE_TYPES_PROPERTY = new ChildListPropertyDescriptor ( EnumDeclaration . class , "<STR_LIT>" , Type . class , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor ENUM_CONSTANTS_PROPERTY = new ChildListPropertyDescriptor ( EnumDeclaration . class , "<STR_LIT>" , EnumConstantDeclaration . class , CYCLE_RISK ) ; public static final ChildListPropertyDescriptor BODY_DECLARATIONS_PROPERTY = internalBodyDeclarationPropertyFactory ( EnumDeclaration . class ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:6> ) ; createPropertyList ( EnumDeclaration . class , properyList ) ; addProperty ( JAVADOC_PROPERTY , properyList ) ; addProperty ( MODIFIERS2_PROPERTY , properyList ) ; addProperty ( NAME_PROPERTY , properyList ) ; addProperty ( SUPER_INTERFACE_TYPES_PROPERTY , properyList ) ; addProperty ( ENUM_CONSTANTS_PROPERTY , properyList ) ; addProperty ( BODY_DECLARATIONS_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private ASTNode . NodeList superInterfaceTypes = new ASTNode . NodeList ( SUPER_INTERFACE_TYPES_PROPERTY ) ; private ASTNode . NodeList enumConstants = new ASTNode . NodeList ( ENUM_CONSTANTS_PROPERTY ) ; EnumDeclaration ( AST ast ) { super ( ast ) ; unsupportedIn2 ( ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == JAVADOC_PROPERTY ) { if ( get ) { return getJavadoc ( ) ; } else { setJavadoc ( ( Javadoc ) child ) ; return null ; } } if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == MODIFIERS2_PROPERTY ) { return modifiers ( ) ; } if ( property == SUPER_INTERFACE_TYPES_PROPERTY ) { return superInterfaceTypes ( ) ; } if ( property == ENUM_CONSTANTS_PROPERTY ) { return enumConstants ( ) ; } if ( property == BODY_DECLARATIONS_PROPERTY ) { return bodyDeclarations ( ) ; } return super . internalGetChildListProperty ( property ) ; } final ChildPropertyDescriptor internalJavadocProperty ( ) { return JAVADOC_PROPERTY ; } final ChildListPropertyDescriptor internalModifiers2Property ( ) { return MODIFIERS2_PROPERTY ; } final SimplePropertyDescriptor internalModifiersProperty ( ) { return null ; } final ChildPropertyDescriptor internalNameProperty ( ) { return NAME_PROPERTY ; } final ChildListPropertyDescriptor internalBodyDeclarationsProperty ( ) { return BODY_DECLARATIONS_PROPERTY ; } final int getNodeType0 ( ) { return ENUM_DECLARATION ; } ASTNode clone0 ( AST target ) { EnumDeclaration result = new EnumDeclaration ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setJavadoc ( ( Javadoc ) ASTNode . copySubtree ( target , getJavadoc ( ) ) ) ; result . modifiers ( ) . addAll ( ASTNode . copySubtrees ( target , modifiers ( ) ) ) ; result . setName ( ( SimpleName ) getName ( ) . clone ( target ) ) ; result . superInterfaceTypes ( ) . addAll ( ASTNode . copySubtrees ( target , superInterfaceTypes ( ) ) ) ; result . enumConstants ( ) . addAll ( ASTNode . copySubtrees ( target , enumConstants ( ) ) ) ; result . bodyDeclarations ( ) . addAll ( ASTNode . copySubtrees ( target , bodyDeclarations ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getJavadoc ( ) ) ; acceptChildren ( visitor , this . modifiers ) ; acceptChild ( visitor , getName ( ) ) ; acceptChildren ( visitor , this . superInterfaceTypes ) ; acceptChildren ( visitor , this . enumConstants ) ; acceptChildren ( visitor , this . bodyDeclarations ) ; } visitor . endVisit ( this ) ; } public List superInterfaceTypes ( ) { return this . superInterfaceTypes ; } public List enumConstants ( ) { return this . enumConstants ; } ITypeBinding internalResolveBinding ( ) { return this . ast . getBindingResolver ( ) . resolveType ( this ) ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalDocComment == null ? <NUM_LIT:0> : getJavadoc ( ) . treeSize ( ) ) + this . modifiers . listSize ( ) + ( this . typeName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) + this . superInterfaceTypes . listSize ( ) + this . enumConstants . listSize ( ) + this . bodyDeclarations . listSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ast . StringLiteral ; import org . eclipse . jdt . internal . compiler . ast . Wildcard ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . lookup . ArrayBinding ; import org . eclipse . jdt . internal . compiler . lookup . BaseTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . CaptureBinding ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . LocalTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . PackageBinding ; import org . eclipse . jdt . internal . compiler . lookup . ParameterizedTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . RawTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . Scope ; import org . eclipse . jdt . internal . compiler . lookup . TagBits ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . compiler . lookup . TypeVariableBinding ; import org . eclipse . jdt . internal . compiler . lookup . WildcardBinding ; import org . eclipse . jdt . internal . compiler . problem . AbortCompilation ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . core . JavaElement ; import org . eclipse . jdt . internal . core . PackageFragment ; class TypeBinding implements ITypeBinding { private static final StringLiteral EXPRESSION = new org . eclipse . jdt . internal . compiler . ast . StringLiteral ( <NUM_LIT:0> , <NUM_LIT:0> ) ; protected static final IMethodBinding [ ] NO_METHOD_BINDINGS = new IMethodBinding [ <NUM_LIT:0> ] ; private static final String NO_NAME = "<STR_LIT>" ; protected static final ITypeBinding [ ] NO_TYPE_BINDINGS = new ITypeBinding [ <NUM_LIT:0> ] ; protected static final IVariableBinding [ ] NO_VARIABLE_BINDINGS = new IVariableBinding [ <NUM_LIT:0> ] ; private static final int VALID_MODIFIERS = Modifier . PUBLIC | Modifier . PROTECTED | Modifier . PRIVATE | Modifier . ABSTRACT | Modifier . STATIC | Modifier . FINAL | Modifier . STRICTFP ; org . eclipse . jdt . internal . compiler . lookup . TypeBinding binding ; private String key ; private BindingResolver resolver ; private IVariableBinding [ ] fields ; private IAnnotationBinding [ ] annotations ; private IMethodBinding [ ] methods ; private ITypeBinding [ ] members ; private ITypeBinding [ ] interfaces ; private ITypeBinding [ ] typeArguments ; private ITypeBinding [ ] bounds ; private ITypeBinding [ ] typeParameters ; public TypeBinding ( BindingResolver resolver , org . eclipse . jdt . internal . compiler . lookup . TypeBinding binding ) { this . binding = binding ; this . resolver = resolver ; } public ITypeBinding createArrayType ( int dimension ) { int realDimensions = dimension ; realDimensions += getDimensions ( ) ; if ( realDimensions < <NUM_LIT:1> || realDimensions > <NUM_LIT:255> ) { throw new IllegalArgumentException ( ) ; } return this . resolver . resolveArrayType ( this , dimension ) ; } public IAnnotationBinding [ ] getAnnotations ( ) { if ( this . annotations != null ) { return this . annotations ; } org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding refType = null ; if ( this . binding instanceof ParameterizedTypeBinding ) { refType = ( ( ParameterizedTypeBinding ) this . binding ) . genericType ( ) ; } else if ( this . binding . isAnnotationType ( ) || this . binding . isClass ( ) || this . binding . isEnum ( ) || this . binding . isInterface ( ) ) { refType = ( org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ) this . binding ; } if ( refType != null ) { org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding [ ] internalAnnotations = refType . getAnnotations ( ) ; int length = internalAnnotations == null ? <NUM_LIT:0> : internalAnnotations . length ; if ( length != <NUM_LIT:0> ) { IAnnotationBinding [ ] tempAnnotations = new IAnnotationBinding [ length ] ; int convertedAnnotationCount = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding internalAnnotation = internalAnnotations [ i ] ; IAnnotationBinding annotationInstance = this . resolver . getAnnotationInstance ( internalAnnotation ) ; if ( annotationInstance == null ) { continue ; } tempAnnotations [ convertedAnnotationCount ++ ] = annotationInstance ; } if ( convertedAnnotationCount != length ) { if ( convertedAnnotationCount == <NUM_LIT:0> ) { return this . annotations = AnnotationBinding . NoAnnotations ; } System . arraycopy ( tempAnnotations , <NUM_LIT:0> , ( tempAnnotations = new IAnnotationBinding [ convertedAnnotationCount ] ) , <NUM_LIT:0> , convertedAnnotationCount ) ; } return this . annotations = tempAnnotations ; } } return this . annotations = AnnotationBinding . NoAnnotations ; } public String getBinaryName ( ) { if ( this . binding . isCapture ( ) ) { return null ; } else if ( this . binding . isTypeVariable ( ) ) { TypeVariableBinding typeVariableBinding = ( TypeVariableBinding ) this . binding ; org . eclipse . jdt . internal . compiler . lookup . Binding declaring = typeVariableBinding . declaringElement ; StringBuffer binaryName = new StringBuffer ( ) ; switch ( declaring . kind ( ) ) { case org . eclipse . jdt . internal . compiler . lookup . Binding . METHOD : MethodBinding methodBinding = ( MethodBinding ) declaring ; char [ ] constantPoolName = methodBinding . declaringClass . constantPoolName ( ) ; if ( constantPoolName == null ) return null ; binaryName . append ( CharOperation . replaceOnCopy ( constantPoolName , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ) . append ( '<CHAR_LIT>' ) . append ( methodBinding . signature ( ) ) . append ( '<CHAR_LIT>' ) . append ( typeVariableBinding . sourceName ) ; break ; default : org . eclipse . jdt . internal . compiler . lookup . TypeBinding typeBinding = ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) declaring ; constantPoolName = typeBinding . constantPoolName ( ) ; if ( constantPoolName == null ) return null ; binaryName . append ( CharOperation . replaceOnCopy ( constantPoolName , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ) . append ( '<CHAR_LIT>' ) . append ( typeVariableBinding . sourceName ) ; } return String . valueOf ( binaryName ) ; } char [ ] constantPoolName = this . binding . constantPoolName ( ) ; if ( constantPoolName == null ) return null ; char [ ] dotSeparated = CharOperation . replaceOnCopy ( constantPoolName , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; return new String ( dotSeparated ) ; } public ITypeBinding getBound ( ) { switch ( this . binding . kind ( ) ) { case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : WildcardBinding wildcardBinding = ( WildcardBinding ) this . binding ; if ( wildcardBinding . bound != null ) { return this . resolver . getTypeBinding ( wildcardBinding . bound ) ; } break ; } return null ; } public ITypeBinding getGenericTypeOfWildcardType ( ) { switch ( this . binding . kind ( ) ) { case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : WildcardBinding wildcardBinding = ( WildcardBinding ) this . binding ; if ( wildcardBinding . genericType != null ) { return this . resolver . getTypeBinding ( wildcardBinding . genericType ) ; } break ; } return null ; } public int getRank ( ) { switch ( this . binding . kind ( ) ) { case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : WildcardBinding wildcardBinding = ( WildcardBinding ) this . binding ; return wildcardBinding . rank ; default : return - <NUM_LIT:1> ; } } public ITypeBinding getComponentType ( ) { if ( ! isArray ( ) ) { return null ; } ArrayBinding arrayBinding = ( ArrayBinding ) this . binding ; return this . resolver . getTypeBinding ( arrayBinding . elementsType ( ) ) ; } public synchronized IVariableBinding [ ] getDeclaredFields ( ) { if ( this . fields != null ) { return this . fields ; } try { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; FieldBinding [ ] fieldBindings = referenceBinding . availableFields ( ) ; int length = fieldBindings . length ; if ( length != <NUM_LIT:0> ) { int convertedFieldCount = <NUM_LIT:0> ; IVariableBinding [ ] newFields = new IVariableBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { FieldBinding fieldBinding = fieldBindings [ i ] ; IVariableBinding variableBinding = this . resolver . getVariableBinding ( fieldBinding ) ; if ( variableBinding != null ) { newFields [ convertedFieldCount ++ ] = variableBinding ; } } if ( convertedFieldCount != length ) { if ( convertedFieldCount == <NUM_LIT:0> ) { return this . fields = NO_VARIABLE_BINDINGS ; } System . arraycopy ( newFields , <NUM_LIT:0> , ( newFields = new IVariableBinding [ convertedFieldCount ] ) , <NUM_LIT:0> , convertedFieldCount ) ; } return this . fields = newFields ; } } } catch ( RuntimeException e ) { org . eclipse . jdt . internal . core . util . Util . log ( e , "<STR_LIT>" ) ; } return this . fields = NO_VARIABLE_BINDINGS ; } public synchronized IMethodBinding [ ] getDeclaredMethods ( ) { if ( this . methods != null ) { return this . methods ; } try { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; org . eclipse . jdt . internal . compiler . lookup . MethodBinding [ ] internalMethods = referenceBinding . availableMethods ( ) ; int length = internalMethods . length ; if ( length != <NUM_LIT:0> ) { int convertedMethodCount = <NUM_LIT:0> ; IMethodBinding [ ] newMethods = new IMethodBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { org . eclipse . jdt . internal . compiler . lookup . MethodBinding methodBinding = internalMethods [ i ] ; if ( methodBinding . isDefaultAbstract ( ) || methodBinding . isSynthetic ( ) || ( methodBinding . isConstructor ( ) && isInterface ( ) ) ) { continue ; } IMethodBinding methodBinding2 = this . resolver . getMethodBinding ( methodBinding ) ; if ( methodBinding2 != null ) { newMethods [ convertedMethodCount ++ ] = methodBinding2 ; } } if ( convertedMethodCount != length ) { if ( convertedMethodCount == <NUM_LIT:0> ) { return this . methods = NO_METHOD_BINDINGS ; } System . arraycopy ( newMethods , <NUM_LIT:0> , ( newMethods = new IMethodBinding [ convertedMethodCount ] ) , <NUM_LIT:0> , convertedMethodCount ) ; } return this . methods = newMethods ; } } } catch ( RuntimeException e ) { org . eclipse . jdt . internal . core . util . Util . log ( e , "<STR_LIT>" ) ; } return this . methods = NO_METHOD_BINDINGS ; } public int getDeclaredModifiers ( ) { return getModifiers ( ) ; } public synchronized ITypeBinding [ ] getDeclaredTypes ( ) { if ( this . members != null ) { return this . members ; } try { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; ReferenceBinding [ ] internalMembers = referenceBinding . memberTypes ( ) ; int length = internalMembers . length ; if ( length != <NUM_LIT:0> ) { ITypeBinding [ ] newMembers = new ITypeBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( internalMembers [ i ] ) ; if ( typeBinding == null ) { return this . members = NO_TYPE_BINDINGS ; } newMembers [ i ] = typeBinding ; } return this . members = newMembers ; } } } catch ( RuntimeException e ) { org . eclipse . jdt . internal . core . util . Util . log ( e , "<STR_LIT>" ) ; } return this . members = NO_TYPE_BINDINGS ; } public synchronized IMethodBinding getDeclaringMethod ( ) { if ( this . binding instanceof LocalTypeBinding ) { LocalTypeBinding localTypeBinding = ( LocalTypeBinding ) this . binding ; MethodBinding methodBinding = localTypeBinding . enclosingMethod ; if ( methodBinding != null ) { try { return this . resolver . getMethodBinding ( localTypeBinding . enclosingMethod ) ; } catch ( RuntimeException e ) { org . eclipse . jdt . internal . core . util . Util . log ( e , "<STR_LIT>" ) ; } } } else if ( this . binding . isTypeVariable ( ) ) { TypeVariableBinding typeVariableBinding = ( TypeVariableBinding ) this . binding ; Binding declaringElement = typeVariableBinding . declaringElement ; if ( declaringElement instanceof MethodBinding ) { try { return this . resolver . getMethodBinding ( ( MethodBinding ) declaringElement ) ; } catch ( RuntimeException e ) { org . eclipse . jdt . internal . core . util . Util . log ( e , "<STR_LIT>" ) ; } } } return null ; } public synchronized ITypeBinding getDeclaringClass ( ) { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; if ( referenceBinding . isNestedType ( ) ) { try { return this . resolver . getTypeBinding ( referenceBinding . enclosingType ( ) ) ; } catch ( RuntimeException e ) { org . eclipse . jdt . internal . core . util . Util . log ( e , "<STR_LIT>" ) ; } } } else if ( this . binding . isTypeVariable ( ) ) { TypeVariableBinding typeVariableBinding = ( TypeVariableBinding ) this . binding ; Binding declaringElement = typeVariableBinding . isCapture ( ) ? ( ( CaptureBinding ) typeVariableBinding ) . sourceType : typeVariableBinding . declaringElement ; if ( declaringElement instanceof ReferenceBinding ) { try { return this . resolver . getTypeBinding ( ( ReferenceBinding ) declaringElement ) ; } catch ( RuntimeException e ) { org . eclipse . jdt . internal . core . util . Util . log ( e , "<STR_LIT>" ) ; } } } return null ; } public int getDimensions ( ) { if ( ! isArray ( ) ) { return <NUM_LIT:0> ; } ArrayBinding arrayBinding = ( ArrayBinding ) this . binding ; return arrayBinding . dimensions ; } public ITypeBinding getElementType ( ) { if ( ! isArray ( ) ) { return null ; } ArrayBinding arrayBinding = ( ArrayBinding ) this . binding ; return this . resolver . getTypeBinding ( arrayBinding . leafComponentType ) ; } public ITypeBinding getTypeDeclaration ( ) { if ( this . binding instanceof ParameterizedTypeBinding ) return this . resolver . getTypeBinding ( ( ( ParameterizedTypeBinding ) this . binding ) . genericType ( ) ) ; return this ; } public ITypeBinding getErasure ( ) { return this . resolver . getTypeBinding ( this . binding . erasure ( ) ) ; } public synchronized ITypeBinding [ ] getInterfaces ( ) { if ( this . interfaces != null ) { return this . interfaces ; } if ( this . binding == null ) return this . interfaces = NO_TYPE_BINDINGS ; switch ( this . binding . kind ( ) ) { case Binding . ARRAY_TYPE : case Binding . BASE_TYPE : return this . interfaces = NO_TYPE_BINDINGS ; } ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; ReferenceBinding [ ] internalInterfaces = null ; try { internalInterfaces = referenceBinding . superInterfaces ( ) ; } catch ( RuntimeException e ) { org . eclipse . jdt . internal . core . util . Util . log ( e , "<STR_LIT>" ) ; } int length = internalInterfaces == null ? <NUM_LIT:0> : internalInterfaces . length ; if ( length != <NUM_LIT:0> ) { ITypeBinding [ ] newInterfaces = new ITypeBinding [ length ] ; int interfacesCounter = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( internalInterfaces [ i ] ) ; if ( typeBinding == null ) { continue ; } newInterfaces [ interfacesCounter ++ ] = typeBinding ; } if ( length != interfacesCounter ) { System . arraycopy ( newInterfaces , <NUM_LIT:0> , ( newInterfaces = new ITypeBinding [ interfacesCounter ] ) , <NUM_LIT:0> , interfacesCounter ) ; } return this . interfaces = newInterfaces ; } return this . interfaces = NO_TYPE_BINDINGS ; } public IJavaElement getJavaElement ( ) { JavaElement element = getUnresolvedJavaElement ( ) ; if ( element != null ) return element . resolved ( this . binding ) ; if ( isRecovered ( ) ) { IPackageBinding packageBinding = getPackage ( ) ; if ( packageBinding != null ) { final IJavaElement javaElement = packageBinding . getJavaElement ( ) ; if ( javaElement != null && javaElement . getElementType ( ) == IJavaElement . PACKAGE_FRAGMENT ) { return ( ( PackageFragment ) javaElement ) . getCompilationUnit ( new String ( this . binding . sourceName ( ) ) + SuffixConstants . SUFFIX_STRING_java ) ; } } return null ; } return null ; } private JavaElement getUnresolvedJavaElement ( ) { return getUnresolvedJavaElement ( this . binding ) ; } private JavaElement getUnresolvedJavaElement ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding typeBinding ) { if ( JavaCore . getPlugin ( ) == null ) { return null ; } if ( this . resolver instanceof DefaultBindingResolver ) { DefaultBindingResolver defaultBindingResolver = ( DefaultBindingResolver ) this . resolver ; if ( ! defaultBindingResolver . fromJavaProject ) return null ; return org . eclipse . jdt . internal . core . util . Util . getUnresolvedJavaElement ( typeBinding , defaultBindingResolver . workingCopyOwner , defaultBindingResolver . getBindingsToNodesMap ( ) ) ; } return null ; } public String getKey ( ) { if ( this . key == null ) { this . key = new String ( this . binding . computeUniqueKey ( ) ) ; } return this . key ; } public int getKind ( ) { return IBinding . TYPE ; } public int getModifiers ( ) { if ( isClass ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; final int accessFlags = referenceBinding . getAccessFlags ( ) & VALID_MODIFIERS ; if ( referenceBinding . isAnonymousType ( ) ) { return accessFlags & ~ Modifier . FINAL ; } return accessFlags ; } else if ( isAnnotation ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; final int accessFlags = referenceBinding . getAccessFlags ( ) & VALID_MODIFIERS ; return accessFlags & ~ ( ClassFileConstants . AccAbstract | ClassFileConstants . AccInterface | ClassFileConstants . AccAnnotation ) ; } else if ( isInterface ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; final int accessFlags = referenceBinding . getAccessFlags ( ) & VALID_MODIFIERS ; return accessFlags & ~ ( ClassFileConstants . AccAbstract | ClassFileConstants . AccInterface ) ; } else if ( isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; final int accessFlags = referenceBinding . getAccessFlags ( ) & VALID_MODIFIERS ; return accessFlags & ~ ClassFileConstants . AccEnum ; } else { return Modifier . NONE ; } } public String getName ( ) { StringBuffer buffer ; switch ( this . binding . kind ( ) ) { case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : WildcardBinding wildcardBinding = ( WildcardBinding ) this . binding ; buffer = new StringBuffer ( ) ; buffer . append ( TypeConstants . WILDCARD_NAME ) ; if ( wildcardBinding . bound != null ) { switch ( wildcardBinding . boundKind ) { case Wildcard . SUPER : buffer . append ( TypeConstants . WILDCARD_SUPER ) ; break ; case Wildcard . EXTENDS : buffer . append ( TypeConstants . WILDCARD_EXTENDS ) ; } buffer . append ( getBound ( ) . getName ( ) ) ; } return String . valueOf ( buffer ) ; case Binding . TYPE_PARAMETER : if ( isCapture ( ) ) { return NO_NAME ; } TypeVariableBinding typeVariableBinding = ( TypeVariableBinding ) this . binding ; return new String ( typeVariableBinding . sourceName ) ; case Binding . PARAMETERIZED_TYPE : ParameterizedTypeBinding parameterizedTypeBinding = ( ParameterizedTypeBinding ) this . binding ; buffer = new StringBuffer ( ) ; buffer . append ( parameterizedTypeBinding . sourceName ( ) ) ; ITypeBinding [ ] tArguments = getTypeArguments ( ) ; final int typeArgumentsLength = tArguments . length ; if ( typeArgumentsLength != <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> ; i < typeArgumentsLength ; i ++ ) { if ( i > <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT:U+002C>' ) ; } buffer . append ( tArguments [ i ] . getName ( ) ) ; } buffer . append ( '<CHAR_LIT:>>' ) ; } return String . valueOf ( buffer ) ; case Binding . RAW_TYPE : return getTypeDeclaration ( ) . getName ( ) ; case Binding . ARRAY_TYPE : ITypeBinding elementType = getElementType ( ) ; if ( elementType . isLocal ( ) || elementType . isAnonymous ( ) || elementType . isCapture ( ) ) { return NO_NAME ; } int dimensions = getDimensions ( ) ; char [ ] brackets = new char [ dimensions * <NUM_LIT:2> ] ; for ( int i = dimensions * <NUM_LIT:2> - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -= <NUM_LIT:2> ) { brackets [ i ] = '<CHAR_LIT:]>' ; brackets [ i - <NUM_LIT:1> ] = '<CHAR_LIT:[>' ; } buffer = new StringBuffer ( elementType . getName ( ) ) ; buffer . append ( brackets ) ; return String . valueOf ( buffer ) ; default : if ( isPrimitive ( ) || isNullType ( ) ) { BaseTypeBinding baseTypeBinding = ( BaseTypeBinding ) this . binding ; return new String ( baseTypeBinding . simpleName ) ; } if ( isAnonymous ( ) ) { return NO_NAME ; } return new String ( this . binding . sourceName ( ) ) ; } } public IPackageBinding getPackage ( ) { switch ( this . binding . kind ( ) ) { case Binding . BASE_TYPE : case Binding . ARRAY_TYPE : case Binding . TYPE_PARAMETER : case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : return null ; } ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; return this . resolver . getPackageBinding ( referenceBinding . getPackage ( ) ) ; } public String getQualifiedName ( ) { StringBuffer buffer ; switch ( this . binding . kind ( ) ) { case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : WildcardBinding wildcardBinding = ( WildcardBinding ) this . binding ; buffer = new StringBuffer ( ) ; buffer . append ( TypeConstants . WILDCARD_NAME ) ; final ITypeBinding bound = getBound ( ) ; if ( bound != null ) { switch ( wildcardBinding . boundKind ) { case Wildcard . SUPER : buffer . append ( TypeConstants . WILDCARD_SUPER ) ; break ; case Wildcard . EXTENDS : buffer . append ( TypeConstants . WILDCARD_EXTENDS ) ; } buffer . append ( bound . getQualifiedName ( ) ) ; } return String . valueOf ( buffer ) ; case Binding . RAW_TYPE : return getTypeDeclaration ( ) . getQualifiedName ( ) ; case Binding . ARRAY_TYPE : ITypeBinding elementType = getElementType ( ) ; if ( elementType . isLocal ( ) || elementType . isAnonymous ( ) || elementType . isCapture ( ) ) { return elementType . getQualifiedName ( ) ; } final int dimensions = getDimensions ( ) ; char [ ] brackets = new char [ dimensions * <NUM_LIT:2> ] ; for ( int i = dimensions * <NUM_LIT:2> - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -= <NUM_LIT:2> ) { brackets [ i ] = '<CHAR_LIT:]>' ; brackets [ i - <NUM_LIT:1> ] = '<CHAR_LIT:[>' ; } buffer = new StringBuffer ( elementType . getQualifiedName ( ) ) ; buffer . append ( brackets ) ; return String . valueOf ( buffer ) ; case Binding . TYPE_PARAMETER : if ( isCapture ( ) ) { return NO_NAME ; } TypeVariableBinding typeVariableBinding = ( TypeVariableBinding ) this . binding ; return new String ( typeVariableBinding . sourceName ) ; case Binding . PARAMETERIZED_TYPE : if ( this . binding . isLocalType ( ) ) { return NO_NAME ; } buffer = new StringBuffer ( ) ; if ( isMember ( ) ) { buffer . append ( getDeclaringClass ( ) . getQualifiedName ( ) ) . append ( '<CHAR_LIT:.>' ) ; ParameterizedTypeBinding parameterizedTypeBinding = ( ParameterizedTypeBinding ) this . binding ; buffer . append ( parameterizedTypeBinding . sourceName ( ) ) ; ITypeBinding [ ] tArguments = getTypeArguments ( ) ; final int typeArgumentsLength = tArguments . length ; if ( typeArgumentsLength != <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> ; i < typeArgumentsLength ; i ++ ) { if ( i > <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT:U+002C>' ) ; } buffer . append ( tArguments [ i ] . getQualifiedName ( ) ) ; } buffer . append ( '<CHAR_LIT:>>' ) ; } return String . valueOf ( buffer ) ; } buffer . append ( getTypeDeclaration ( ) . getQualifiedName ( ) ) ; ITypeBinding [ ] tArguments = getTypeArguments ( ) ; final int typeArgumentsLength = tArguments . length ; if ( typeArgumentsLength != <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> ; i < typeArgumentsLength ; i ++ ) { if ( i > <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT:U+002C>' ) ; } buffer . append ( tArguments [ i ] . getQualifiedName ( ) ) ; } buffer . append ( '<CHAR_LIT:>>' ) ; } return String . valueOf ( buffer ) ; default : if ( isAnonymous ( ) || this . binding . isLocalType ( ) ) { return NO_NAME ; } if ( isPrimitive ( ) || isNullType ( ) ) { BaseTypeBinding baseTypeBinding = ( BaseTypeBinding ) this . binding ; return new String ( baseTypeBinding . simpleName ) ; } if ( isMember ( ) ) { buffer = new StringBuffer ( ) ; buffer . append ( getDeclaringClass ( ) . getQualifiedName ( ) ) . append ( '<CHAR_LIT:.>' ) ; buffer . append ( getName ( ) ) ; return String . valueOf ( buffer ) ; } PackageBinding packageBinding = this . binding . getPackage ( ) ; buffer = new StringBuffer ( ) ; if ( packageBinding != null && packageBinding . compoundName != CharOperation . NO_CHAR_CHAR ) { buffer . append ( CharOperation . concatWith ( packageBinding . compoundName , '<CHAR_LIT:.>' ) ) . append ( '<CHAR_LIT:.>' ) ; } buffer . append ( getName ( ) ) ; return String . valueOf ( buffer ) ; } } public synchronized ITypeBinding getSuperclass ( ) { if ( this . binding == null ) return null ; switch ( this . binding . kind ( ) ) { case Binding . ARRAY_TYPE : case Binding . BASE_TYPE : return null ; default : if ( this . binding . isInterface ( ) ) return null ; } ReferenceBinding superclass = null ; try { superclass = ( ( ReferenceBinding ) this . binding ) . superclass ( ) ; } catch ( RuntimeException e ) { org . eclipse . jdt . internal . core . util . Util . log ( e , "<STR_LIT>" ) ; return this . resolver . resolveWellKnownType ( "<STR_LIT>" ) ; } if ( superclass == null ) { return null ; } return this . resolver . getTypeBinding ( superclass ) ; } public ITypeBinding [ ] getTypeArguments ( ) { if ( this . typeArguments != null ) { return this . typeArguments ; } if ( this . binding . isParameterizedTypeWithActualArguments ( ) ) { ParameterizedTypeBinding parameterizedTypeBinding = ( ParameterizedTypeBinding ) this . binding ; final org . eclipse . jdt . internal . compiler . lookup . TypeBinding [ ] arguments = parameterizedTypeBinding . arguments ; int argumentsLength = arguments . length ; ITypeBinding [ ] newTypeArguments = new ITypeBinding [ argumentsLength ] ; for ( int i = <NUM_LIT:0> ; i < argumentsLength ; i ++ ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( arguments [ i ] ) ; if ( typeBinding == null ) { return this . typeArguments = NO_TYPE_BINDINGS ; } newTypeArguments [ i ] = typeBinding ; } return this . typeArguments = newTypeArguments ; } return this . typeArguments = NO_TYPE_BINDINGS ; } public ITypeBinding [ ] getTypeBounds ( ) { if ( this . bounds != null ) { return this . bounds ; } if ( this . binding instanceof TypeVariableBinding ) { TypeVariableBinding typeVariableBinding = ( TypeVariableBinding ) this . binding ; ReferenceBinding varSuperclass = typeVariableBinding . superclass ( ) ; org . eclipse . jdt . internal . compiler . lookup . TypeBinding firstClassOrArrayBound = typeVariableBinding . firstBound ; int boundsLength = <NUM_LIT:0> ; if ( firstClassOrArrayBound != null ) { if ( firstClassOrArrayBound == varSuperclass ) { boundsLength ++ ; } else if ( firstClassOrArrayBound . isArrayType ( ) ) { boundsLength ++ ; } else { firstClassOrArrayBound = null ; } } ReferenceBinding [ ] superinterfaces = typeVariableBinding . superInterfaces ( ) ; int superinterfacesLength = <NUM_LIT:0> ; if ( superinterfaces != null ) { superinterfacesLength = superinterfaces . length ; boundsLength += superinterfacesLength ; } if ( boundsLength != <NUM_LIT:0> ) { ITypeBinding [ ] typeBounds = new ITypeBinding [ boundsLength ] ; int boundsIndex = <NUM_LIT:0> ; if ( firstClassOrArrayBound != null ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( firstClassOrArrayBound ) ; if ( typeBinding == null ) { return this . bounds = NO_TYPE_BINDINGS ; } typeBounds [ boundsIndex ++ ] = typeBinding ; } if ( superinterfaces != null ) { for ( int i = <NUM_LIT:0> ; i < superinterfacesLength ; i ++ , boundsIndex ++ ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( superinterfaces [ i ] ) ; if ( typeBinding == null ) { return this . bounds = NO_TYPE_BINDINGS ; } typeBounds [ boundsIndex ] = typeBinding ; } } return this . bounds = typeBounds ; } } return this . bounds = NO_TYPE_BINDINGS ; } public ITypeBinding [ ] getTypeParameters ( ) { if ( this . typeParameters != null ) { return this . typeParameters ; } switch ( this . binding . kind ( ) ) { case Binding . RAW_TYPE : case Binding . PARAMETERIZED_TYPE : return this . typeParameters = NO_TYPE_BINDINGS ; } TypeVariableBinding [ ] typeVariableBindings = this . binding . typeVariables ( ) ; int typeVariableBindingsLength = typeVariableBindings == null ? <NUM_LIT:0> : typeVariableBindings . length ; if ( typeVariableBindingsLength != <NUM_LIT:0> ) { ITypeBinding [ ] newTypeParameters = new ITypeBinding [ typeVariableBindingsLength ] ; for ( int i = <NUM_LIT:0> ; i < typeVariableBindingsLength ; i ++ ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( typeVariableBindings [ i ] ) ; if ( typeBinding == null ) { return this . typeParameters = NO_TYPE_BINDINGS ; } newTypeParameters [ i ] = typeBinding ; } return this . typeParameters = newTypeParameters ; } return this . typeParameters = NO_TYPE_BINDINGS ; } public ITypeBinding getWildcard ( ) { if ( this . binding instanceof CaptureBinding ) { CaptureBinding captureBinding = ( CaptureBinding ) this . binding ; return this . resolver . getTypeBinding ( captureBinding . wildcard ) ; } return null ; } public boolean isGenericType ( ) { if ( isRawType ( ) ) { return false ; } TypeVariableBinding [ ] typeVariableBindings = this . binding . typeVariables ( ) ; return ( typeVariableBindings != null && typeVariableBindings . length > <NUM_LIT:0> ) ; } public boolean isAnnotation ( ) { return this . binding . isAnnotationType ( ) ; } public boolean isAnonymous ( ) { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; return referenceBinding . isAnonymousType ( ) ; } return false ; } public boolean isArray ( ) { return this . binding . isArrayType ( ) ; } public boolean isAssignmentCompatible ( ITypeBinding type ) { try { if ( this == type ) return true ; if ( ! ( type instanceof TypeBinding ) ) return false ; TypeBinding other = ( TypeBinding ) type ; Scope scope = this . resolver . scope ( ) ; if ( scope == null ) return false ; return this . binding . isCompatibleWith ( other . binding ) || scope . isBoxingCompatibleWith ( this . binding , other . binding ) ; } catch ( AbortCompilation e ) { return false ; } } public boolean isCapture ( ) { return this . binding . isCapture ( ) ; } public boolean isCastCompatible ( ITypeBinding type ) { try { Scope scope = this . resolver . scope ( ) ; if ( scope == null ) return false ; if ( ! ( type instanceof TypeBinding ) ) return false ; org . eclipse . jdt . internal . compiler . lookup . TypeBinding expressionType = ( ( TypeBinding ) type ) . binding ; expressionType = expressionType . capture ( scope , <NUM_LIT:0> ) ; return TypeBinding . EXPRESSION . checkCastTypesCompatibility ( scope , this . binding , expressionType , null ) ; } catch ( AbortCompilation e ) { return false ; } } public boolean isClass ( ) { switch ( this . binding . kind ( ) ) { case Binding . TYPE_PARAMETER : case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : return false ; } return this . binding . isClass ( ) ; } public boolean isDeprecated ( ) { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; return referenceBinding . isDeprecated ( ) ; } return false ; } public boolean isEnum ( ) { return this . binding . isEnum ( ) ; } public boolean isEqualTo ( IBinding other ) { if ( other == this ) { return true ; } if ( other == null ) { return false ; } if ( ! ( other instanceof TypeBinding ) ) { return false ; } org . eclipse . jdt . internal . compiler . lookup . TypeBinding otherBinding = ( ( TypeBinding ) other ) . binding ; return BindingComparator . isEqual ( this . binding , otherBinding ) ; } public boolean isFromSource ( ) { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; if ( referenceBinding . isRawType ( ) ) { return ! ( ( RawTypeBinding ) referenceBinding ) . genericType ( ) . isBinaryBinding ( ) ; } else if ( referenceBinding . isParameterizedType ( ) ) { ParameterizedTypeBinding parameterizedTypeBinding = ( ParameterizedTypeBinding ) referenceBinding ; org . eclipse . jdt . internal . compiler . lookup . TypeBinding erasure = parameterizedTypeBinding . erasure ( ) ; if ( erasure instanceof ReferenceBinding ) { return ! ( ( ReferenceBinding ) erasure ) . isBinaryBinding ( ) ; } return false ; } else { return ! referenceBinding . isBinaryBinding ( ) ; } } else if ( isTypeVariable ( ) ) { final TypeVariableBinding typeVariableBinding = ( TypeVariableBinding ) this . binding ; final Binding declaringElement = typeVariableBinding . declaringElement ; if ( declaringElement instanceof MethodBinding ) { MethodBinding methodBinding = ( MethodBinding ) declaringElement ; return ! methodBinding . declaringClass . isBinaryBinding ( ) ; } else { final org . eclipse . jdt . internal . compiler . lookup . TypeBinding typeBinding = ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) declaringElement ; if ( typeBinding instanceof ReferenceBinding ) { return ! ( ( ReferenceBinding ) typeBinding ) . isBinaryBinding ( ) ; } else if ( typeBinding instanceof ArrayBinding ) { final ArrayBinding arrayBinding = ( ArrayBinding ) typeBinding ; final org . eclipse . jdt . internal . compiler . lookup . TypeBinding leafComponentType = arrayBinding . leafComponentType ; if ( leafComponentType instanceof ReferenceBinding ) { return ! ( ( ReferenceBinding ) leafComponentType ) . isBinaryBinding ( ) ; } } } } else if ( isCapture ( ) ) { CaptureBinding captureBinding = ( CaptureBinding ) this . binding ; return ! captureBinding . sourceType . isBinaryBinding ( ) ; } return false ; } public boolean isInterface ( ) { switch ( this . binding . kind ( ) ) { case Binding . TYPE_PARAMETER : case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : return false ; } return this . binding . isInterface ( ) ; } public boolean isLocal ( ) { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; return referenceBinding . isLocalType ( ) && ! referenceBinding . isMemberType ( ) ; } return false ; } public boolean isMember ( ) { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; return referenceBinding . isMemberType ( ) ; } return false ; } public boolean isNested ( ) { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; return referenceBinding . isNestedType ( ) ; } return false ; } public boolean isNullType ( ) { return this . binding == org . eclipse . jdt . internal . compiler . lookup . TypeBinding . NULL ; } public boolean isParameterizedType ( ) { return this . binding . isParameterizedTypeWithActualArguments ( ) ; } public boolean isPrimitive ( ) { return ! isNullType ( ) && this . binding . isBaseType ( ) ; } public boolean isRawType ( ) { return this . binding . isRawType ( ) ; } public boolean isRecovered ( ) { return ( this . binding . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ; } public boolean isSubTypeCompatible ( ITypeBinding type ) { try { if ( this == type ) return true ; if ( this . binding . isBaseType ( ) ) return false ; if ( ! ( type instanceof TypeBinding ) ) return false ; TypeBinding other = ( TypeBinding ) type ; if ( other . binding . isBaseType ( ) ) return false ; return this . binding . isCompatibleWith ( other . binding ) ; } catch ( AbortCompilation e ) { return false ; } } public boolean isSynthetic ( ) { return false ; } public boolean isTopLevel ( ) { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; return ! referenceBinding . isNestedType ( ) ; } return false ; } public boolean isTypeVariable ( ) { return this . binding . isTypeVariable ( ) && ! this . binding . isCapture ( ) ; } public boolean isUpperbound ( ) { switch ( this . binding . kind ( ) ) { case Binding . WILDCARD_TYPE : return ( ( WildcardBinding ) this . binding ) . boundKind == Wildcard . EXTENDS ; case Binding . INTERSECTION_TYPE : return true ; } return false ; } public boolean isWildcardType ( ) { return this . binding . isWildcard ( ) ; } public String toString ( ) { return this . binding . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; public interface IAnnotationBinding extends IBinding { IMemberValuePairBinding [ ] getAllMemberValuePairs ( ) ; ITypeBinding getAnnotationType ( ) ; IMemberValuePairBinding [ ] getDeclaredMemberValuePairs ( ) ; public String getName ( ) ; } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class SuperMethodInvocation extends Expression { public static final ChildPropertyDescriptor QUALIFIER_PROPERTY = new ChildPropertyDescriptor ( SuperMethodInvocation . class , "<STR_LIT>" , Name . class , OPTIONAL , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor TYPE_ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor ( SuperMethodInvocation . class , "<STR_LIT>" , Type . class , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( SuperMethodInvocation . class , "<STR_LIT:name>" , SimpleName . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor ( SuperMethodInvocation . class , "<STR_LIT>" , Expression . class , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS_2_0 ; private static final List PROPERTY_DESCRIPTORS_3_0 ; static { List propertyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( SuperMethodInvocation . class , propertyList ) ; addProperty ( QUALIFIER_PROPERTY , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; addProperty ( ARGUMENTS_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( propertyList ) ; propertyList = new ArrayList ( <NUM_LIT:5> ) ; createPropertyList ( SuperMethodInvocation . class , propertyList ) ; addProperty ( QUALIFIER_PROPERTY , propertyList ) ; addProperty ( TYPE_ARGUMENTS_PROPERTY , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; addProperty ( ARGUMENTS_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_3_0 = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { if ( apiLevel == AST . JLS2_INTERNAL ) { return PROPERTY_DESCRIPTORS_2_0 ; } else { return PROPERTY_DESCRIPTORS_3_0 ; } } private Name optionalQualifier = null ; private ASTNode . NodeList typeArguments = null ; private SimpleName methodName = null ; private ASTNode . NodeList arguments = new ASTNode . NodeList ( ARGUMENTS_PROPERTY ) ; SuperMethodInvocation ( AST ast ) { super ( ast ) ; if ( ast . apiLevel >= AST . JLS3 ) { this . typeArguments = new ASTNode . NodeList ( TYPE_ARGUMENTS_PROPERTY ) ; } } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == QUALIFIER_PROPERTY ) { if ( get ) { return getQualifier ( ) ; } else { setQualifier ( ( Name ) child ) ; return null ; } } if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == ARGUMENTS_PROPERTY ) { return arguments ( ) ; } if ( property == TYPE_ARGUMENTS_PROPERTY ) { return typeArguments ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return SUPER_METHOD_INVOCATION ; } ASTNode clone0 ( AST target ) { SuperMethodInvocation result = new SuperMethodInvocation ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setName ( ( SimpleName ) getName ( ) . clone ( target ) ) ; result . setQualifier ( ( Name ) ASTNode . copySubtree ( target , getQualifier ( ) ) ) ; if ( this . ast . apiLevel >= AST . JLS3 ) { result . typeArguments ( ) . addAll ( ASTNode . copySubtrees ( target , typeArguments ( ) ) ) ; } result . arguments ( ) . addAll ( ASTNode . copySubtrees ( target , arguments ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getQualifier ( ) ) ; if ( this . ast . apiLevel >= AST . JLS3 ) { acceptChildren ( visitor , this . typeArguments ) ; } acceptChild ( visitor , getName ( ) ) ; acceptChildren ( visitor , this . arguments ) ; } visitor . endVisit ( this ) ; } public Name getQualifier ( ) { return this . optionalQualifier ; } public boolean isResolvedTypeInferredFromExpectedType ( ) { return this . ast . getBindingResolver ( ) . isResolvedTypeInferredFromExpectedType ( this ) ; } public void setQualifier ( Name name ) { ASTNode oldChild = this . optionalQualifier ; preReplaceChild ( oldChild , name , QUALIFIER_PROPERTY ) ; this . optionalQualifier = name ; postReplaceChild ( oldChild , name , QUALIFIER_PROPERTY ) ; } public List typeArguments ( ) { if ( this . typeArguments == null ) { unsupportedIn2 ( ) ; } return this . typeArguments ; } public SimpleName getName ( ) { if ( this . methodName == null ) { synchronized ( this ) { if ( this . methodName == null ) { preLazyInit ( ) ; this . methodName = new SimpleName ( this . ast ) ; postLazyInit ( this . methodName , NAME_PROPERTY ) ; } } } return this . methodName ; } public void setName ( SimpleName name ) { if ( name == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . methodName ; preReplaceChild ( oldChild , name , NAME_PROPERTY ) ; this . methodName = name ; postReplaceChild ( oldChild , name , NAME_PROPERTY ) ; } public List arguments ( ) { return this . arguments ; } public IMethodBinding resolveMethodBinding ( ) { return this . ast . getBindingResolver ( ) . resolveMethod ( this ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:4> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalQualifier == null ? <NUM_LIT:0> : getQualifier ( ) . treeSize ( ) ) + ( this . typeArguments == null ? <NUM_LIT:0> : this . typeArguments . listSize ( ) ) + ( this . methodName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) + ( this . arguments == null ? <NUM_LIT:0> : this . arguments . listSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class ContinueStatement extends Statement { public static final ChildPropertyDescriptor LABEL_PROPERTY = new ChildPropertyDescriptor ( ContinueStatement . class , "<STR_LIT:label>" , SimpleName . class , OPTIONAL , NO_CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( ContinueStatement . class , properyList ) ; addProperty ( LABEL_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private SimpleName optionalLabel = null ; ContinueStatement ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == LABEL_PROPERTY ) { if ( get ) { return getLabel ( ) ; } else { setLabel ( ( SimpleName ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return CONTINUE_STATEMENT ; } ASTNode clone0 ( AST target ) { ContinueStatement result = new ContinueStatement ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; result . setLabel ( ( SimpleName ) ASTNode . copySubtree ( target , getLabel ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getLabel ( ) ) ; } visitor . endVisit ( this ) ; } public SimpleName getLabel ( ) { return this . optionalLabel ; } public void setLabel ( SimpleName label ) { ASTNode oldChild = this . optionalLabel ; preReplaceChild ( oldChild , label , LABEL_PROPERTY ) ; this . optionalLabel = label ; postReplaceChild ( oldChild , label , LABEL_PROPERTY ) ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:1> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalLabel == null ? <NUM_LIT:0> : getLabel ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; public abstract class Comment extends ASTNode { private ASTNode alternateRoot = null ; Comment ( AST ast ) { super ( ast ) ; } public final boolean isBlockComment ( ) { return ( this instanceof BlockComment ) ; } public final boolean isLineComment ( ) { return ( this instanceof LineComment ) ; } public final boolean isDocComment ( ) { return ( this instanceof Javadoc ) ; } public final ASTNode getAlternateRoot ( ) { return this . alternateRoot ; } public final void setAlternateRoot ( ASTNode root ) { checkModifiable ( ) ; this . alternateRoot = root ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:1> * <NUM_LIT:4> ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class ImportDeclaration extends ASTNode { public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( ImportDeclaration . class , "<STR_LIT:name>" , Name . class , MANDATORY , NO_CYCLE_RISK ) ; public static final SimplePropertyDescriptor ON_DEMAND_PROPERTY = new SimplePropertyDescriptor ( ImportDeclaration . class , "<STR_LIT>" , boolean . class , MANDATORY ) ; public static final SimplePropertyDescriptor STATIC_PROPERTY = new SimplePropertyDescriptor ( ImportDeclaration . class , "<STR_LIT>" , boolean . class , MANDATORY ) ; private static final List PROPERTY_DESCRIPTORS_2_0 ; private static final List PROPERTY_DESCRIPTORS_3_0 ; static { List properyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( ImportDeclaration . class , properyList ) ; addProperty ( NAME_PROPERTY , properyList ) ; addProperty ( ON_DEMAND_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( properyList ) ; properyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( ImportDeclaration . class , properyList ) ; addProperty ( STATIC_PROPERTY , properyList ) ; addProperty ( NAME_PROPERTY , properyList ) ; addProperty ( ON_DEMAND_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS_3_0 = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { if ( apiLevel == AST . JLS2_INTERNAL ) { return PROPERTY_DESCRIPTORS_2_0 ; } else { return PROPERTY_DESCRIPTORS_3_0 ; } } private Name importName = null ; private boolean onDemand = false ; private boolean isStatic = false ; ImportDeclaration ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final boolean internalGetSetBooleanProperty ( SimplePropertyDescriptor property , boolean get , boolean value ) { if ( property == ON_DEMAND_PROPERTY ) { if ( get ) { return isOnDemand ( ) ; } else { setOnDemand ( value ) ; return false ; } } if ( property == STATIC_PROPERTY ) { if ( get ) { return isStatic ( ) ; } else { setStatic ( value ) ; return false ; } } return super . internalGetSetBooleanProperty ( property , get , value ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( Name ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return IMPORT_DECLARATION ; } ASTNode clone0 ( AST target ) { ImportDeclaration result = new ImportDeclaration ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setOnDemand ( isOnDemand ( ) ) ; if ( this . ast . apiLevel >= AST . JLS3 ) { result . setStatic ( isStatic ( ) ) ; } result . setName ( ( Name ) getName ( ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getName ( ) ) ; } visitor . endVisit ( this ) ; } public Name getName ( ) { if ( this . importName == null ) { synchronized ( this ) { if ( this . importName == null ) { preLazyInit ( ) ; this . importName = this . ast . newQualifiedName ( new SimpleName ( this . ast ) , new SimpleName ( this . ast ) ) ; postLazyInit ( this . importName , NAME_PROPERTY ) ; } } } return this . importName ; } public void setName ( Name name ) { if ( name == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . importName ; preReplaceChild ( oldChild , name , NAME_PROPERTY ) ; this . importName = name ; postReplaceChild ( oldChild , name , NAME_PROPERTY ) ; } public boolean isOnDemand ( ) { return this . onDemand ; } public void setOnDemand ( boolean onDemand ) { preValueChange ( ON_DEMAND_PROPERTY ) ; this . onDemand = onDemand ; postValueChange ( ON_DEMAND_PROPERTY ) ; } public boolean isStatic ( ) { unsupportedIn2 ( ) ; return this . isStatic ; } public void setStatic ( boolean isStatic ) { unsupportedIn2 ( ) ; preValueChange ( STATIC_PROPERTY ) ; this . isStatic = isStatic ; postValueChange ( STATIC_PROPERTY ) ; } public IBinding resolveBinding ( ) { return this . ast . getBindingResolver ( ) . resolveImport ( this ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:3> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . importName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; public class PrefixExpression extends Expression { public static class Operator { private String token ; private Operator ( String token ) { this . token = token ; } public String toString ( ) { return this . token ; } public static final Operator INCREMENT = new Operator ( "<STR_LIT>" ) ; public static final Operator DECREMENT = new Operator ( "<STR_LIT:-->" ) ; public static final Operator PLUS = new Operator ( "<STR_LIT:+>" ) ; public static final Operator MINUS = new Operator ( "<STR_LIT:->" ) ; public static final Operator COMPLEMENT = new Operator ( "<STR_LIT>" ) ; public static final Operator NOT = new Operator ( "<STR_LIT:!>" ) ; private static final Map CODES ; static { CODES = new HashMap ( <NUM_LIT:20> ) ; Operator [ ] ops = { INCREMENT , DECREMENT , PLUS , MINUS , COMPLEMENT , NOT , } ; for ( int i = <NUM_LIT:0> ; i < ops . length ; i ++ ) { CODES . put ( ops [ i ] . toString ( ) , ops [ i ] ) ; } } public static Operator toOperator ( String token ) { return ( Operator ) CODES . get ( token ) ; } } public static final SimplePropertyDescriptor OPERATOR_PROPERTY = new SimplePropertyDescriptor ( PrefixExpression . class , "<STR_LIT>" , PrefixExpression . Operator . class , MANDATORY ) ; public static final ChildPropertyDescriptor OPERAND_PROPERTY = new ChildPropertyDescriptor ( PrefixExpression . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( PrefixExpression . class , propertyList ) ; addProperty ( OPERATOR_PROPERTY , propertyList ) ; addProperty ( OPERAND_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private PrefixExpression . Operator operator = PrefixExpression . Operator . PLUS ; private Expression operand = null ; PrefixExpression ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final Object internalGetSetObjectProperty ( SimplePropertyDescriptor property , boolean get , Object value ) { if ( property == OPERATOR_PROPERTY ) { if ( get ) { return getOperator ( ) ; } else { setOperator ( ( Operator ) value ) ; return null ; } } return super . internalGetSetObjectProperty ( property , get , value ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == OPERAND_PROPERTY ) { if ( get ) { return getOperand ( ) ; } else { setOperand ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return PREFIX_EXPRESSION ; } ASTNode clone0 ( AST target ) { PrefixExpression result = new PrefixExpression ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setOperator ( getOperator ( ) ) ; result . setOperand ( ( Expression ) getOperand ( ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getOperand ( ) ) ; } visitor . endVisit ( this ) ; } public PrefixExpression . Operator getOperator ( ) { return this . operator ; } public void setOperator ( PrefixExpression . Operator operator ) { if ( operator == null ) { throw new IllegalArgumentException ( ) ; } preValueChange ( OPERATOR_PROPERTY ) ; this . operator = operator ; postValueChange ( OPERATOR_PROPERTY ) ; } public Expression getOperand ( ) { if ( this . operand == null ) { synchronized ( this ) { if ( this . operand == null ) { preLazyInit ( ) ; this . operand = new SimpleName ( this . ast ) ; postLazyInit ( this . operand , OPERAND_PROPERTY ) ; } } } return this . operand ; } public void setOperand ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . operand ; preReplaceChild ( oldChild , expression , OPERAND_PROPERTY ) ; this . operand = expression ; postReplaceChild ( oldChild , expression , OPERAND_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . operand == null ? <NUM_LIT:0> : getOperand ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class QualifiedType extends Type { int index ; public static final ChildPropertyDescriptor QUALIFIER_PROPERTY = new ChildPropertyDescriptor ( QualifiedType . class , "<STR_LIT>" , Type . class , MANDATORY , CYCLE_RISK ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( QualifiedType . class , "<STR_LIT:name>" , SimpleName . class , MANDATORY , NO_CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( QualifiedType . class , propertyList ) ; addProperty ( QUALIFIER_PROPERTY , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Type qualifier = null ; private SimpleName name = null ; QualifiedType ( AST ast ) { super ( ast ) ; unsupportedIn2 ( ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == QUALIFIER_PROPERTY ) { if ( get ) { return getQualifier ( ) ; } else { setQualifier ( ( Type ) child ) ; return null ; } } if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return QUALIFIED_TYPE ; } ASTNode clone0 ( AST target ) { QualifiedType result = new QualifiedType ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setQualifier ( ( Type ) ( ( ASTNode ) getQualifier ( ) ) . clone ( target ) ) ; result . setName ( ( SimpleName ) ( ( ASTNode ) getName ( ) ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getQualifier ( ) ) ; acceptChild ( visitor , getName ( ) ) ; } visitor . endVisit ( this ) ; } public Type getQualifier ( ) { if ( this . qualifier == null ) { synchronized ( this ) { if ( this . qualifier == null ) { preLazyInit ( ) ; this . qualifier = new SimpleType ( this . ast ) ; postLazyInit ( this . qualifier , QUALIFIER_PROPERTY ) ; } } } return this . qualifier ; } public void setQualifier ( Type type ) { if ( type == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . qualifier ; preReplaceChild ( oldChild , type , QUALIFIER_PROPERTY ) ; this . qualifier = type ; postReplaceChild ( oldChild , type , QUALIFIER_PROPERTY ) ; } public SimpleName getName ( ) { if ( this . name == null ) { synchronized ( this ) { if ( this . name == null ) { preLazyInit ( ) ; this . name = new SimpleName ( this . ast ) ; postLazyInit ( this . name , NAME_PROPERTY ) ; } } } return this . name ; } public void setName ( SimpleName name ) { if ( name == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . name ; preReplaceChild ( oldChild , name , NAME_PROPERTY ) ; this . name = name ; postReplaceChild ( oldChild , name , NAME_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:3> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . qualifier == null ? <NUM_LIT:0> : getQualifier ( ) . treeSize ( ) ) + ( this . name == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class Initializer extends BodyDeclaration { public static final ChildPropertyDescriptor JAVADOC_PROPERTY = internalJavadocPropertyFactory ( Initializer . class ) ; public static final SimplePropertyDescriptor MODIFIERS_PROPERTY = internalModifiersPropertyFactory ( Initializer . class ) ; public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY = internalModifiers2PropertyFactory ( Initializer . class ) ; public static final ChildPropertyDescriptor BODY_PROPERTY = new ChildPropertyDescriptor ( Initializer . class , "<STR_LIT:body>" , Block . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS_2_0 ; private static final List PROPERTY_DESCRIPTORS_3_0 ; static { List properyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( Initializer . class , properyList ) ; addProperty ( JAVADOC_PROPERTY , properyList ) ; addProperty ( MODIFIERS_PROPERTY , properyList ) ; addProperty ( BODY_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( properyList ) ; properyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( Initializer . class , properyList ) ; addProperty ( JAVADOC_PROPERTY , properyList ) ; addProperty ( MODIFIERS2_PROPERTY , properyList ) ; addProperty ( BODY_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS_3_0 = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { if ( apiLevel == AST . JLS2_INTERNAL ) { return PROPERTY_DESCRIPTORS_2_0 ; } else { return PROPERTY_DESCRIPTORS_3_0 ; } } private Block body = null ; Initializer ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final int internalGetSetIntProperty ( SimplePropertyDescriptor property , boolean get , int value ) { if ( property == MODIFIERS_PROPERTY ) { if ( get ) { return getModifiers ( ) ; } else { internalSetModifiers ( value ) ; return <NUM_LIT:0> ; } } return super . internalGetSetIntProperty ( property , get , value ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == JAVADOC_PROPERTY ) { if ( get ) { return getJavadoc ( ) ; } else { setJavadoc ( ( Javadoc ) child ) ; return null ; } } if ( property == BODY_PROPERTY ) { if ( get ) { return getBody ( ) ; } else { setBody ( ( Block ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == MODIFIERS2_PROPERTY ) { return modifiers ( ) ; } return super . internalGetChildListProperty ( property ) ; } final ChildPropertyDescriptor internalJavadocProperty ( ) { return JAVADOC_PROPERTY ; } final ChildListPropertyDescriptor internalModifiers2Property ( ) { return MODIFIERS2_PROPERTY ; } final SimplePropertyDescriptor internalModifiersProperty ( ) { return MODIFIERS_PROPERTY ; } final int getNodeType0 ( ) { return INITIALIZER ; } ASTNode clone0 ( AST target ) { Initializer result = new Initializer ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { result . internalSetModifiers ( getModifiers ( ) ) ; } if ( this . ast . apiLevel >= AST . JLS3 ) { result . modifiers ( ) . addAll ( ASTNode . copySubtrees ( target , modifiers ( ) ) ) ; } result . setJavadoc ( ( Javadoc ) ASTNode . copySubtree ( target , getJavadoc ( ) ) ) ; result . setBody ( ( Block ) getBody ( ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getJavadoc ( ) ) ; if ( this . ast . apiLevel >= AST . JLS3 ) { acceptChildren ( visitor , this . modifiers ) ; } acceptChild ( visitor , getBody ( ) ) ; } visitor . endVisit ( this ) ; } public Block getBody ( ) { if ( this . body == null ) { synchronized ( this ) { if ( this . body == null ) { preLazyInit ( ) ; this . body = new Block ( this . ast ) ; postLazyInit ( this . body , BODY_PROPERTY ) ; } } } return this . body ; } public void setBody ( Block body ) { if ( body == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . body ; preReplaceChild ( oldChild , body , BODY_PROPERTY ) ; this . body = body ; postReplaceChild ( oldChild , body , BODY_PROPERTY ) ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:1> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalDocComment == null ? <NUM_LIT:0> : getJavadoc ( ) . treeSize ( ) ) + ( this . modifiers == null ? <NUM_LIT:0> : this . modifiers . listSize ( ) ) + ( this . body == null ? <NUM_LIT:0> : getBody ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; interface IDocElement { } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . jdt . core . compiler . InvalidInputException ; import org . eclipse . jdt . internal . compiler . parser . Scanner ; import org . eclipse . jdt . internal . compiler . parser . TerminalTokens ; public class NumberLiteral extends Expression { public static final SimplePropertyDescriptor TOKEN_PROPERTY = new SimplePropertyDescriptor ( NumberLiteral . class , "<STR_LIT>" , String . class , MANDATORY ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( NumberLiteral . class , propertyList ) ; addProperty ( TOKEN_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private String tokenValue = "<STR_LIT:0>" ; NumberLiteral ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final Object internalGetSetObjectProperty ( SimplePropertyDescriptor property , boolean get , Object value ) { if ( property == TOKEN_PROPERTY ) { if ( get ) { return getToken ( ) ; } else { setToken ( ( String ) value ) ; return null ; } } return super . internalGetSetObjectProperty ( property , get , value ) ; } final int getNodeType0 ( ) { return NUMBER_LITERAL ; } ASTNode clone0 ( AST target ) { NumberLiteral result = new NumberLiteral ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setToken ( getToken ( ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { visitor . visit ( this ) ; visitor . endVisit ( this ) ; } public String getToken ( ) { return this . tokenValue ; } public void setToken ( String token ) { if ( token == null || token . length ( ) == <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } Scanner scanner = this . ast . scanner ; char [ ] source = token . toCharArray ( ) ; scanner . setSource ( source ) ; scanner . resetTo ( <NUM_LIT:0> , source . length ) ; scanner . tokenizeComments = false ; scanner . tokenizeWhiteSpace = false ; try { int tokenType = scanner . getNextToken ( ) ; switch ( tokenType ) { case TerminalTokens . TokenNameDoubleLiteral : case TerminalTokens . TokenNameIntegerLiteral : case TerminalTokens . TokenNameFloatingPointLiteral : case TerminalTokens . TokenNameLongLiteral : break ; case TerminalTokens . TokenNameMINUS : tokenType = scanner . getNextToken ( ) ; switch ( tokenType ) { case TerminalTokens . TokenNameDoubleLiteral : case TerminalTokens . TokenNameIntegerLiteral : case TerminalTokens . TokenNameFloatingPointLiteral : case TerminalTokens . TokenNameLongLiteral : break ; default : throw new IllegalArgumentException ( "<STR_LIT>" + token + "<STR_LIT:<>" ) ; } break ; default : throw new IllegalArgumentException ( "<STR_LIT>" + token + "<STR_LIT:<>" ) ; } } catch ( InvalidInputException e ) { throw new IllegalArgumentException ( ) ; } finally { scanner . tokenizeComments = true ; scanner . tokenizeWhiteSpace = true ; } preValueChange ( TOKEN_PROPERTY ) ; this . tokenValue = token ; postValueChange ( TOKEN_PROPERTY ) ; } void internalSetToken ( String token ) { preValueChange ( TOKEN_PROPERTY ) ; this . tokenValue = token ; postValueChange ( TOKEN_PROPERTY ) ; } int memSize ( ) { int size = BASE_NODE_SIZE + <NUM_LIT:1> * <NUM_LIT:4> + stringSize ( this . tokenValue ) ; return size ; } int treeSize ( ) { return memSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import org . eclipse . jdt . core . IBuffer ; import org . eclipse . jdt . core . ISourceRange ; import org . eclipse . jdt . core . ITypeRoot ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . ToolFactory ; import org . eclipse . jdt . core . compiler . IScanner ; import org . eclipse . jdt . core . compiler . ITerminalSymbols ; import org . eclipse . jdt . core . compiler . InvalidInputException ; public final class NodeFinder { private static class NodeFinderVisitor extends ASTVisitor { private int fStart ; private int fEnd ; private ASTNode fCoveringNode ; private ASTNode fCoveredNode ; NodeFinderVisitor ( int offset , int length ) { super ( true ) ; this . fStart = offset ; this . fEnd = offset + length ; } public boolean preVisit2 ( ASTNode node ) { int nodeStart = node . getStartPosition ( ) ; int nodeEnd = nodeStart + node . getLength ( ) ; if ( nodeEnd < this . fStart || this . fEnd < nodeStart ) { return false ; } if ( nodeStart <= this . fStart && this . fEnd <= nodeEnd ) { this . fCoveringNode = node ; } if ( this . fStart <= nodeStart && nodeEnd <= this . fEnd ) { if ( this . fCoveringNode == node ) { this . fCoveredNode = node ; return true ; } else if ( this . fCoveredNode == null ) { this . fCoveredNode = node ; } return false ; } return true ; } public ASTNode getCoveredNode ( ) { return this . fCoveredNode ; } public ASTNode getCoveringNode ( ) { return this . fCoveringNode ; } } public static ASTNode perform ( ASTNode root , int start , int length ) { NodeFinder finder = new NodeFinder ( root , start , length ) ; ASTNode result = finder . getCoveredNode ( ) ; if ( result == null || result . getStartPosition ( ) != start || result . getLength ( ) != length ) { return finder . getCoveringNode ( ) ; } return result ; } public static ASTNode perform ( ASTNode root , ISourceRange range ) { return perform ( root , range . getOffset ( ) , range . getLength ( ) ) ; } public static ASTNode perform ( ASTNode root , int start , int length , ITypeRoot source ) throws JavaModelException { NodeFinder finder = new NodeFinder ( root , start , length ) ; ASTNode result = finder . getCoveredNode ( ) ; if ( result == null ) return null ; int nodeStart = result . getStartPosition ( ) ; if ( start <= nodeStart && ( ( nodeStart + result . getLength ( ) ) <= ( start + length ) ) ) { IBuffer buffer = source . getBuffer ( ) ; if ( buffer != null ) { IScanner scanner = ToolFactory . createScanner ( false , false , false , false ) ; try { scanner . setSource ( buffer . getText ( start , length ) . toCharArray ( ) ) ; int token = scanner . getNextToken ( ) ; if ( token != ITerminalSymbols . TokenNameEOF ) { int tStart = scanner . getCurrentTokenStartPosition ( ) ; if ( tStart == result . getStartPosition ( ) - start ) { scanner . resetTo ( tStart + result . getLength ( ) , length - <NUM_LIT:1> ) ; token = scanner . getNextToken ( ) ; if ( token == ITerminalSymbols . TokenNameEOF ) return result ; } } } catch ( InvalidInputException e ) { } catch ( IndexOutOfBoundsException e ) { return null ; } } } return finder . getCoveringNode ( ) ; } private ASTNode fCoveringNode ; private ASTNode fCoveredNode ; public NodeFinder ( ASTNode root , int start , int length ) { NodeFinderVisitor nodeFinderVisitor = new NodeFinderVisitor ( start , length ) ; root . accept ( nodeFinderVisitor ) ; this . fCoveredNode = nodeFinderVisitor . getCoveredNode ( ) ; this . fCoveringNode = nodeFinderVisitor . getCoveringNode ( ) ; } public ASTNode getCoveredNode ( ) { return this . fCoveredNode ; } public ASTNode getCoveringNode ( ) { return this . fCoveringNode ; } } </s>
<s> package org . eclipse . jdt . core . dom ; public abstract class ASTVisitor { private boolean visitDocTags ; public ASTVisitor ( ) { this ( false ) ; } public ASTVisitor ( boolean visitDocTags ) { this . visitDocTags = visitDocTags ; } public void preVisit ( ASTNode node ) { } public boolean preVisit2 ( ASTNode node ) { preVisit ( node ) ; return true ; } public void postVisit ( ASTNode node ) { } public boolean visit ( AnnotationTypeDeclaration node ) { return true ; } public boolean visit ( AnnotationTypeMemberDeclaration node ) { return true ; } public boolean visit ( AnonymousClassDeclaration node ) { return true ; } public boolean visit ( ArrayAccess node ) { return true ; } public boolean visit ( ArrayCreation node ) { return true ; } public boolean visit ( ArrayInitializer node ) { return true ; } public boolean visit ( ArrayType node ) { return true ; } public boolean visit ( AssertStatement node ) { return true ; } public boolean visit ( Assignment node ) { return true ; } public boolean visit ( Block node ) { return true ; } public boolean visit ( BlockComment node ) { return true ; } public boolean visit ( BooleanLiteral node ) { return true ; } public boolean visit ( BreakStatement node ) { return true ; } public boolean visit ( CastExpression node ) { return true ; } public boolean visit ( CatchClause node ) { return true ; } public boolean visit ( CharacterLiteral node ) { return true ; } public boolean visit ( ClassInstanceCreation node ) { return true ; } public boolean visit ( CompilationUnit node ) { return true ; } public boolean visit ( ConditionalExpression node ) { return true ; } public boolean visit ( ConstructorInvocation node ) { return true ; } public boolean visit ( ContinueStatement node ) { return true ; } public boolean visit ( DoStatement node ) { return true ; } public boolean visit ( EmptyStatement node ) { return true ; } public boolean visit ( EnhancedForStatement node ) { return true ; } public boolean visit ( EnumConstantDeclaration node ) { return true ; } public boolean visit ( EnumDeclaration node ) { return true ; } public boolean visit ( ExpressionStatement node ) { return true ; } public boolean visit ( FieldAccess node ) { return true ; } public boolean visit ( FieldDeclaration node ) { return true ; } public boolean visit ( ForStatement node ) { return true ; } public boolean visit ( IfStatement node ) { return true ; } public boolean visit ( ImportDeclaration node ) { return true ; } public boolean visit ( InfixExpression node ) { return true ; } public boolean visit ( InstanceofExpression node ) { return true ; } public boolean visit ( Initializer node ) { return true ; } public boolean visit ( Javadoc node ) { return this . visitDocTags ; } public boolean visit ( LabeledStatement node ) { return true ; } public boolean visit ( LineComment node ) { return true ; } public boolean visit ( MarkerAnnotation node ) { return true ; } public boolean visit ( MemberRef node ) { return true ; } public boolean visit ( MemberValuePair node ) { return true ; } public boolean visit ( MethodRef node ) { return true ; } public boolean visit ( MethodRefParameter node ) { return true ; } public boolean visit ( MethodDeclaration node ) { return true ; } public boolean visit ( MethodInvocation node ) { return true ; } public boolean visit ( Modifier node ) { return true ; } public boolean visit ( NormalAnnotation node ) { return true ; } public boolean visit ( NullLiteral node ) { return true ; } public boolean visit ( NumberLiteral node ) { return true ; } public boolean visit ( PackageDeclaration node ) { return true ; } public boolean visit ( ParameterizedType node ) { return true ; } public boolean visit ( ParenthesizedExpression node ) { return true ; } public boolean visit ( PostfixExpression node ) { return true ; } public boolean visit ( PrefixExpression node ) { return true ; } public boolean visit ( PrimitiveType node ) { return true ; } public boolean visit ( QualifiedName node ) { return true ; } public boolean visit ( QualifiedType node ) { return true ; } public boolean visit ( ReturnStatement node ) { return true ; } public boolean visit ( SimpleName node ) { return true ; } public boolean visit ( SimpleType node ) { return true ; } public boolean visit ( SingleMemberAnnotation node ) { return true ; } public boolean visit ( SingleVariableDeclaration node ) { return true ; } public boolean visit ( StringLiteral node ) { return true ; } public boolean visit ( SuperConstructorInvocation node ) { return true ; } public boolean visit ( SuperFieldAccess node ) { return true ; } public boolean visit ( SuperMethodInvocation node ) { return true ; } public boolean visit ( SwitchCase node ) { return true ; } public boolean visit ( SwitchStatement node ) { return true ; } public boolean visit ( SynchronizedStatement node ) { return true ; } public boolean visit ( TagElement node ) { return true ; } public boolean visit ( TextElement node ) { return true ; } public boolean visit ( ThisExpression node ) { return true ; } public boolean visit ( ThrowStatement node ) { return true ; } public boolean visit ( TryStatement node ) { return true ; } public boolean visit ( TypeDeclaration node ) { return true ; } public boolean visit ( TypeDeclarationStatement node ) { return true ; } public boolean visit ( TypeLiteral node ) { return true ; } public boolean visit ( TypeParameter node ) { return true ; } public boolean visit ( VariableDeclarationExpression node ) { return true ; } public boolean visit ( VariableDeclarationStatement node ) { return true ; } public boolean visit ( VariableDeclarationFragment node ) { return true ; } public boolean visit ( WhileStatement node ) { return true ; } public boolean visit ( WildcardType node ) { return true ; } public void endVisit ( AnnotationTypeDeclaration node ) { } public void endVisit ( AnnotationTypeMemberDeclaration node ) { } public void endVisit ( AnonymousClassDeclaration node ) { } public void endVisit ( ArrayAccess node ) { } public void endVisit ( ArrayCreation node ) { } public void endVisit ( ArrayInitializer node ) { } public void endVisit ( ArrayType node ) { } public void endVisit ( AssertStatement node ) { } public void endVisit ( Assignment node ) { } public void endVisit ( Block node ) { } public void endVisit ( BlockComment node ) { } public void endVisit ( BooleanLiteral node ) { } public void endVisit ( BreakStatement node ) { } public void endVisit ( CastExpression node ) { } public void endVisit ( CatchClause node ) { } public void endVisit ( CharacterLiteral node ) { } public void endVisit ( ClassInstanceCreation node ) { } public void endVisit ( CompilationUnit node ) { } public void endVisit ( ConditionalExpression node ) { } public void endVisit ( ConstructorInvocation node ) { } public void endVisit ( ContinueStatement node ) { } public void endVisit ( DoStatement node ) { } public void endVisit ( EmptyStatement node ) { } public void endVisit ( EnhancedForStatement node ) { } public void endVisit ( EnumConstantDeclaration node ) { } public void endVisit ( EnumDeclaration node ) { } public void endVisit ( ExpressionStatement node ) { } public void endVisit ( FieldAccess node ) { } public void endVisit ( FieldDeclaration node ) { } public void endVisit ( ForStatement node ) { } public void endVisit ( IfStatement node ) { } public void endVisit ( ImportDeclaration node ) { } public void endVisit ( InfixExpression node ) { } public void endVisit ( InstanceofExpression node ) { } public void endVisit ( Initializer node ) { } public void endVisit ( Javadoc node ) { } public void endVisit ( LabeledStatement node ) { } public void endVisit ( LineComment node ) { } public void endVisit ( MarkerAnnotation node ) { } public void endVisit ( MemberRef node ) { } public void endVisit ( MemberValuePair node ) { } public void endVisit ( MethodRef node ) { } public void endVisit ( MethodRefParameter node ) { } public void endVisit ( MethodDeclaration node ) { } public void endVisit ( MethodInvocation node ) { } public void endVisit ( Modifier node ) { } public void endVisit ( NormalAnnotation node ) { } public void endVisit ( NullLiteral node ) { } public void endVisit ( NumberLiteral node ) { } public void endVisit ( PackageDeclaration node ) { } public void endVisit ( ParameterizedType node ) { } public void endVisit ( ParenthesizedExpression node ) { } public void endVisit ( PostfixExpression node ) { } public void endVisit ( PrefixExpression node ) { } public void endVisit ( PrimitiveType node ) { } public void endVisit ( QualifiedName node ) { } public void endVisit ( QualifiedType node ) { } public void endVisit ( ReturnStatement node ) { } public void endVisit ( SimpleName node ) { } public void endVisit ( SimpleType node ) { } public void endVisit ( SingleMemberAnnotation node ) { } public void endVisit ( SingleVariableDeclaration node ) { } public void endVisit ( StringLiteral node ) { } public void endVisit ( SuperConstructorInvocation node ) { } public void endVisit ( SuperFieldAccess node ) { } public void endVisit ( SuperMethodInvocation node ) { } public void endVisit ( SwitchCase node ) { } public void endVisit ( SwitchStatement node ) { } public void endVisit ( SynchronizedStatement node ) { } public void endVisit ( TagElement node ) { } public void endVisit ( TextElement node ) { } public void endVisit ( ThisExpression node ) { } public void endVisit ( ThrowStatement node ) { } public void endVisit ( TryStatement node ) { } public void endVisit ( TypeDeclaration node ) { } public void endVisit ( TypeDeclarationStatement node ) { } public void endVisit ( TypeLiteral node ) { } public void endVisit ( TypeParameter node ) { } public void endVisit ( VariableDeclarationExpression node ) { } public void endVisit ( VariableDeclarationStatement node ) { } public void endVisit ( VariableDeclarationFragment node ) { } public void endVisit ( WhileStatement node ) { } public void endVisit ( WildcardType node ) { } } </s>
<s> package org . eclipse . jdt . core . dom ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . ElementValuePair ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; class MemberValuePairBinding implements IMemberValuePairBinding { static final MemberValuePairBinding [ ] NoPair = new MemberValuePairBinding [ <NUM_LIT:0> ] ; private static final Object NoValue = new Object ( ) ; private static final Object [ ] EmptyArray = new Object [ <NUM_LIT:0> ] ; private ElementValuePair internalPair ; protected Object value = null ; protected BindingResolver bindingResolver ; static void appendValue ( Object value , StringBuffer buffer ) { if ( value instanceof Object [ ] ) { Object [ ] values = ( Object [ ] ) value ; buffer . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> , l = values . length ; i < l ; i ++ ) { if ( i != <NUM_LIT:0> ) buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; appendValue ( values [ i ] , buffer ) ; } buffer . append ( '<CHAR_LIT:}>' ) ; } else if ( value instanceof ITypeBinding ) { buffer . append ( ( ( ITypeBinding ) value ) . getName ( ) ) ; buffer . append ( "<STR_LIT:.class>" ) ; } else { buffer . append ( value ) ; } } static Object buildDOMValue ( final Object internalObject , BindingResolver resolver ) { if ( internalObject == null ) return null ; if ( internalObject instanceof Constant ) { Constant constant = ( Constant ) internalObject ; switch ( constant . typeID ( ) ) { case TypeIds . T_boolean : return Boolean . valueOf ( constant . booleanValue ( ) ) ; case TypeIds . T_byte : return new Byte ( constant . byteValue ( ) ) ; case TypeIds . T_char : return new Character ( constant . charValue ( ) ) ; case TypeIds . T_double : return new Double ( constant . doubleValue ( ) ) ; case TypeIds . T_float : return new Float ( constant . floatValue ( ) ) ; case TypeIds . T_int : return new Integer ( constant . intValue ( ) ) ; case TypeIds . T_long : return new Long ( constant . longValue ( ) ) ; case TypeIds . T_short : return new Short ( constant . shortValue ( ) ) ; case TypeIds . T_JavaLangString : return constant . stringValue ( ) ; } } else if ( internalObject instanceof org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) { return resolver . getTypeBinding ( ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) internalObject ) ; } else if ( internalObject instanceof org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding ) { return resolver . getAnnotationInstance ( ( org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding ) internalObject ) ; } else if ( internalObject instanceof org . eclipse . jdt . internal . compiler . lookup . FieldBinding ) { return resolver . getVariableBinding ( ( org . eclipse . jdt . internal . compiler . lookup . FieldBinding ) internalObject ) ; } else if ( internalObject instanceof Object [ ] ) { Object [ ] elements = ( Object [ ] ) internalObject ; int length = elements . length ; Object [ ] values = length == <NUM_LIT:0> ? EmptyArray : new Object [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) values [ i ] = buildDOMValue ( elements [ i ] , resolver ) ; return values ; } return null ; } MemberValuePairBinding ( ElementValuePair pair , BindingResolver resolver ) { this . internalPair = pair ; this . bindingResolver = resolver ; } public IAnnotationBinding [ ] getAnnotations ( ) { return AnnotationBinding . NoAnnotations ; } public IJavaElement getJavaElement ( ) { return null ; } public String getKey ( ) { return null ; } public int getKind ( ) { return IBinding . MEMBER_VALUE_PAIR ; } public IMethodBinding getMethodBinding ( ) { return this . bindingResolver . getMethodBinding ( this . internalPair . getMethodBinding ( ) ) ; } public int getModifiers ( ) { return Modifier . NONE ; } public String getName ( ) { if ( this . internalPair == null ) return null ; final char [ ] membername = this . internalPair . getName ( ) ; return membername == null ? null : new String ( membername ) ; } public Object getValue ( ) { if ( this . value == null ) init ( ) ; return this . value == NoValue ? null : this . value ; } private void init ( ) { this . value = buildDOMValue ( this . internalPair . getValue ( ) , this . bindingResolver ) ; if ( this . value == null ) this . value = NoValue ; } char [ ] internalName ( ) { return this . internalPair == null ? null : this . internalPair . getName ( ) ; } public boolean isDefault ( ) { Object value2 = getValue ( ) ; Object defaultValue = getMethodBinding ( ) . getDefaultValue ( ) ; if ( value2 instanceof IBinding ) { if ( defaultValue instanceof IBinding ) { return ( ( IBinding ) value2 ) . isEqualTo ( ( IBinding ) defaultValue ) ; } return false ; } if ( defaultValue == null ) return false ; return defaultValue . equals ( value2 ) ; } public boolean isDeprecated ( ) { MethodBinding methodBinding = this . internalPair . getMethodBinding ( ) ; return methodBinding == null ? false : methodBinding . isDeprecated ( ) ; } public boolean isEqualTo ( IBinding binding ) { if ( this == binding ) return true ; if ( binding . getKind ( ) != IBinding . MEMBER_VALUE_PAIR ) return false ; IMemberValuePairBinding other = ( IMemberValuePairBinding ) binding ; if ( ! getMethodBinding ( ) . isEqualTo ( other . getMethodBinding ( ) ) ) { return false ; } Object otherValue = other . getValue ( ) ; Object currentValue = getValue ( ) ; if ( currentValue == null ) { return otherValue == null ; } if ( currentValue instanceof IBinding ) { if ( otherValue instanceof IBinding ) { return ( ( IBinding ) currentValue ) . isEqualTo ( ( IBinding ) otherValue ) ; } return false ; } return currentValue . equals ( otherValue ) ; } public boolean isRecovered ( ) { return false ; } public boolean isSynthetic ( ) { return false ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( getName ( ) ) ; buffer . append ( "<STR_LIT:U+0020=U+0020>" ) ; appendValue ( getValue ( ) , buffer ) ; return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . List ; public abstract class AbstractTypeDeclaration extends BodyDeclaration { SimpleName typeName = null ; ASTNode . NodeList bodyDeclarations ; abstract ChildListPropertyDescriptor internalBodyDeclarationsProperty ( ) ; public final ChildListPropertyDescriptor getBodyDeclarationsProperty ( ) { return internalBodyDeclarationsProperty ( ) ; } abstract ChildPropertyDescriptor internalNameProperty ( ) ; public final ChildPropertyDescriptor getNameProperty ( ) { return internalNameProperty ( ) ; } static final ChildListPropertyDescriptor internalBodyDeclarationPropertyFactory ( Class nodeClass ) { return new ChildListPropertyDescriptor ( nodeClass , "<STR_LIT>" , BodyDeclaration . class , CYCLE_RISK ) ; } static final ChildPropertyDescriptor internalNamePropertyFactory ( Class nodeClass ) { return new ChildPropertyDescriptor ( nodeClass , "<STR_LIT:name>" , SimpleName . class , MANDATORY , NO_CYCLE_RISK ) ; } AbstractTypeDeclaration ( AST ast ) { super ( ast ) ; this . bodyDeclarations = new ASTNode . NodeList ( internalBodyDeclarationsProperty ( ) ) ; } public SimpleName getName ( ) { if ( this . typeName == null ) { synchronized ( this ) { if ( this . typeName == null ) { preLazyInit ( ) ; this . typeName = new SimpleName ( this . ast ) ; postLazyInit ( this . typeName , internalNameProperty ( ) ) ; } } } return this . typeName ; } public void setName ( SimpleName typeName ) { if ( typeName == null ) { throw new IllegalArgumentException ( ) ; } ChildPropertyDescriptor p = internalNameProperty ( ) ; ASTNode oldChild = this . typeName ; preReplaceChild ( oldChild , typeName , p ) ; this . typeName = typeName ; postReplaceChild ( oldChild , typeName , p ) ; } public List bodyDeclarations ( ) { return this . bodyDeclarations ; } public boolean isPackageMemberTypeDeclaration ( ) { ASTNode parent = getParent ( ) ; return ( parent instanceof CompilationUnit ) ; } public boolean isMemberTypeDeclaration ( ) { ASTNode parent = getParent ( ) ; return ( parent instanceof AbstractTypeDeclaration ) || ( parent instanceof AnonymousClassDeclaration ) ; } public boolean isLocalTypeDeclaration ( ) { ASTNode parent = getParent ( ) ; return ( parent instanceof TypeDeclarationStatement ) ; } public final ITypeBinding resolveBinding ( ) { return internalResolveBinding ( ) ; } abstract ITypeBinding internalResolveBinding ( ) ; int memSize ( ) { return super . memSize ( ) + <NUM_LIT:2> * <NUM_LIT:4> ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . jdt . internal . compiler . util . Util ; public final class TextElement extends ASTNode implements IDocElement { public static final SimplePropertyDescriptor TEXT_PROPERTY = new SimplePropertyDescriptor ( TextElement . class , "<STR_LIT:text>" , String . class , MANDATORY ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( TextElement . class , propertyList ) ; addProperty ( TEXT_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private String text = Util . EMPTY_STRING ; TextElement ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final Object internalGetSetObjectProperty ( SimplePropertyDescriptor property , boolean get , Object value ) { if ( property == TEXT_PROPERTY ) { if ( get ) { return getText ( ) ; } else { setText ( ( String ) value ) ; return null ; } } return super . internalGetSetObjectProperty ( property , get , value ) ; } final int getNodeType0 ( ) { return TEXT_ELEMENT ; } ASTNode clone0 ( AST target ) { TextElement result = new TextElement ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setText ( getText ( ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { visitor . visit ( this ) ; visitor . endVisit ( this ) ; } public String getText ( ) { return this . text ; } public void setText ( String text ) { if ( text == null ) { throw new IllegalArgumentException ( ) ; } if ( text . indexOf ( "<STR_LIT>" ) > <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } preValueChange ( TEXT_PROPERTY ) ; this . text = text ; postValueChange ( TEXT_PROPERTY ) ; } int memSize ( ) { int size = BASE_NODE_SIZE + <NUM_LIT:1> * <NUM_LIT:4> ; if ( this . text != Util . EMPTY_STRING ) { size += stringSize ( this . text ) ; } return size ; } int treeSize ( ) { return memSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class DoStatement extends Statement { public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( DoStatement . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; public static final ChildPropertyDescriptor BODY_PROPERTY = new ChildPropertyDescriptor ( DoStatement . class , "<STR_LIT:body>" , Statement . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( DoStatement . class , properyList ) ; addProperty ( EXPRESSION_PROPERTY , properyList ) ; addProperty ( BODY_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Expression expression = null ; private Statement body = null ; DoStatement ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == EXPRESSION_PROPERTY ) { if ( get ) { return getExpression ( ) ; } else { setExpression ( ( Expression ) child ) ; return null ; } } if ( property == BODY_PROPERTY ) { if ( get ) { return getBody ( ) ; } else { setBody ( ( Statement ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return DO_STATEMENT ; } ASTNode clone0 ( AST target ) { DoStatement result = new DoStatement ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; result . setExpression ( ( Expression ) getExpression ( ) . clone ( target ) ) ; result . setBody ( ( Statement ) getBody ( ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getBody ( ) ) ; acceptChild ( visitor , getExpression ( ) ) ; } visitor . endVisit ( this ) ; } public Expression getExpression ( ) { if ( this . expression == null ) { synchronized ( this ) { if ( this . expression == null ) { preLazyInit ( ) ; this . expression = new SimpleName ( this . ast ) ; postLazyInit ( this . expression , EXPRESSION_PROPERTY ) ; } } } return this . expression ; } public void setExpression ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . expression ; preReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; this . expression = expression ; postReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; } public Statement getBody ( ) { if ( this . body == null ) { synchronized ( this ) { if ( this . body == null ) { preLazyInit ( ) ; this . body = new Block ( this . ast ) ; postLazyInit ( this . body , BODY_PROPERTY ) ; } } } return this . body ; } public void setBody ( Statement statement ) { if ( statement == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . body ; preReplaceChild ( oldChild , statement , BODY_PROPERTY ) ; this . body = statement ; postReplaceChild ( oldChild , statement , BODY_PROPERTY ) ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . expression == null ? <NUM_LIT:0> : getExpression ( ) . treeSize ( ) ) + ( this . body == null ? <NUM_LIT:0> : getBody ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public final class MarkerAnnotation extends Annotation { public static final ChildPropertyDescriptor TYPE_NAME_PROPERTY = internalTypeNamePropertyFactory ( MarkerAnnotation . class ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( MarkerAnnotation . class , propertyList ) ; addProperty ( TYPE_NAME_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } MarkerAnnotation ( AST ast ) { super ( ast ) ; unsupportedIn2 ( ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == TYPE_NAME_PROPERTY ) { if ( get ) { return getTypeName ( ) ; } else { setTypeName ( ( Name ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final ChildPropertyDescriptor internalTypeNameProperty ( ) { return TYPE_NAME_PROPERTY ; } final int getNodeType0 ( ) { return MARKER_ANNOTATION ; } ASTNode clone0 ( AST target ) { MarkerAnnotation result = new MarkerAnnotation ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setTypeName ( ( Name ) ASTNode . copySubtree ( target , getTypeName ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getTypeName ( ) ) ; } visitor . endVisit ( this ) ; } int memSize ( ) { return super . memSize ( ) ; } int treeSize ( ) { return memSize ( ) + ( this . typeName == null ? <NUM_LIT:0> : getTypeName ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; public class TypeDeclaration extends AbstractTypeDeclaration { public static final ChildPropertyDescriptor JAVADOC_PROPERTY = internalJavadocPropertyFactory ( TypeDeclaration . class ) ; public static final SimplePropertyDescriptor MODIFIERS_PROPERTY = internalModifiersPropertyFactory ( TypeDeclaration . class ) ; public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY = internalModifiers2PropertyFactory ( TypeDeclaration . class ) ; public static final SimplePropertyDescriptor INTERFACE_PROPERTY = new SimplePropertyDescriptor ( TypeDeclaration . class , "<STR_LIT>" , boolean . class , MANDATORY ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = internalNamePropertyFactory ( TypeDeclaration . class ) ; public static final ChildPropertyDescriptor SUPERCLASS_PROPERTY = new ChildPropertyDescriptor ( TypeDeclaration . class , "<STR_LIT>" , Name . class , OPTIONAL , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor SUPER_INTERFACES_PROPERTY = new ChildListPropertyDescriptor ( TypeDeclaration . class , "<STR_LIT>" , Name . class , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor SUPERCLASS_TYPE_PROPERTY = new ChildPropertyDescriptor ( TypeDeclaration . class , "<STR_LIT>" , Type . class , OPTIONAL , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor SUPER_INTERFACE_TYPES_PROPERTY = new ChildListPropertyDescriptor ( TypeDeclaration . class , "<STR_LIT>" , Type . class , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor TYPE_PARAMETERS_PROPERTY = new ChildListPropertyDescriptor ( TypeDeclaration . class , "<STR_LIT>" , TypeParameter . class , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor BODY_DECLARATIONS_PROPERTY = internalBodyDeclarationPropertyFactory ( TypeDeclaration . class ) ; private static final List PROPERTY_DESCRIPTORS_2_0 ; private static final List PROPERTY_DESCRIPTORS_3_0 ; static { List propertyList = new ArrayList ( <NUM_LIT:8> ) ; createPropertyList ( TypeDeclaration . class , propertyList ) ; addProperty ( JAVADOC_PROPERTY , propertyList ) ; addProperty ( MODIFIERS_PROPERTY , propertyList ) ; addProperty ( INTERFACE_PROPERTY , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; addProperty ( SUPERCLASS_PROPERTY , propertyList ) ; addProperty ( SUPER_INTERFACES_PROPERTY , propertyList ) ; addProperty ( BODY_DECLARATIONS_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( propertyList ) ; propertyList = new ArrayList ( <NUM_LIT:9> ) ; createPropertyList ( TypeDeclaration . class , propertyList ) ; addProperty ( JAVADOC_PROPERTY , propertyList ) ; addProperty ( MODIFIERS2_PROPERTY , propertyList ) ; addProperty ( INTERFACE_PROPERTY , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; addProperty ( TYPE_PARAMETERS_PROPERTY , propertyList ) ; addProperty ( SUPERCLASS_TYPE_PROPERTY , propertyList ) ; addProperty ( SUPER_INTERFACE_TYPES_PROPERTY , propertyList ) ; addProperty ( BODY_DECLARATIONS_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_3_0 = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { if ( apiLevel == AST . JLS2_INTERNAL ) { return PROPERTY_DESCRIPTORS_2_0 ; } else { return PROPERTY_DESCRIPTORS_3_0 ; } } private boolean isInterface = false ; private ASTNode . NodeList typeParameters = null ; private Name optionalSuperclassName = null ; private ASTNode . NodeList superInterfaceNames = null ; private Type optionalSuperclassType = null ; private ASTNode . NodeList superInterfaceTypes = null ; TypeDeclaration ( AST ast ) { super ( ast ) ; if ( ast . apiLevel == AST . JLS2_INTERNAL ) { this . superInterfaceNames = new ASTNode . NodeList ( SUPER_INTERFACES_PROPERTY ) ; } if ( ast . apiLevel >= AST . JLS3 ) { this . typeParameters = new ASTNode . NodeList ( TYPE_PARAMETERS_PROPERTY ) ; this . superInterfaceTypes = new ASTNode . NodeList ( SUPER_INTERFACE_TYPES_PROPERTY ) ; } } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final int internalGetSetIntProperty ( SimplePropertyDescriptor property , boolean get , int value ) { if ( property == MODIFIERS_PROPERTY ) { if ( get ) { return getModifiers ( ) ; } else { internalSetModifiers ( value ) ; return <NUM_LIT:0> ; } } return super . internalGetSetIntProperty ( property , get , value ) ; } final boolean internalGetSetBooleanProperty ( SimplePropertyDescriptor property , boolean get , boolean value ) { if ( property == INTERFACE_PROPERTY ) { if ( get ) { return isInterface ( ) ; } else { setInterface ( value ) ; return false ; } } return super . internalGetSetBooleanProperty ( property , get , value ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == JAVADOC_PROPERTY ) { if ( get ) { return getJavadoc ( ) ; } else { setJavadoc ( ( Javadoc ) child ) ; return null ; } } if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } if ( property == SUPERCLASS_PROPERTY ) { if ( get ) { return getSuperclass ( ) ; } else { setSuperclass ( ( Name ) child ) ; return null ; } } if ( property == SUPERCLASS_TYPE_PROPERTY ) { if ( get ) { return getSuperclassType ( ) ; } else { setSuperclassType ( ( Type ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == MODIFIERS2_PROPERTY ) { return modifiers ( ) ; } if ( property == TYPE_PARAMETERS_PROPERTY ) { return typeParameters ( ) ; } if ( property == SUPER_INTERFACES_PROPERTY ) { return superInterfaces ( ) ; } if ( property == SUPER_INTERFACE_TYPES_PROPERTY ) { return superInterfaceTypes ( ) ; } if ( property == BODY_DECLARATIONS_PROPERTY ) { return bodyDeclarations ( ) ; } return super . internalGetChildListProperty ( property ) ; } final ChildPropertyDescriptor internalJavadocProperty ( ) { return JAVADOC_PROPERTY ; } final ChildListPropertyDescriptor internalModifiers2Property ( ) { return MODIFIERS2_PROPERTY ; } final SimplePropertyDescriptor internalModifiersProperty ( ) { return MODIFIERS_PROPERTY ; } final ChildPropertyDescriptor internalNameProperty ( ) { return NAME_PROPERTY ; } final ChildListPropertyDescriptor internalBodyDeclarationsProperty ( ) { return BODY_DECLARATIONS_PROPERTY ; } final int getNodeType0 ( ) { return TYPE_DECLARATION ; } ASTNode clone0 ( AST target ) { TypeDeclaration result = new TypeDeclaration ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setJavadoc ( ( Javadoc ) ASTNode . copySubtree ( target , getJavadoc ( ) ) ) ; if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { result . internalSetModifiers ( getModifiers ( ) ) ; result . setSuperclass ( ( Name ) ASTNode . copySubtree ( target , getSuperclass ( ) ) ) ; result . superInterfaces ( ) . addAll ( ASTNode . copySubtrees ( target , superInterfaces ( ) ) ) ; } result . setInterface ( isInterface ( ) ) ; result . setName ( ( SimpleName ) getName ( ) . clone ( target ) ) ; if ( this . ast . apiLevel >= AST . JLS3 ) { result . modifiers ( ) . addAll ( ASTNode . copySubtrees ( target , modifiers ( ) ) ) ; result . typeParameters ( ) . addAll ( ASTNode . copySubtrees ( target , typeParameters ( ) ) ) ; result . setSuperclassType ( ( Type ) ASTNode . copySubtree ( target , getSuperclassType ( ) ) ) ; result . superInterfaceTypes ( ) . addAll ( ASTNode . copySubtrees ( target , superInterfaceTypes ( ) ) ) ; } result . bodyDeclarations ( ) . addAll ( ASTNode . copySubtrees ( target , bodyDeclarations ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { acceptChild ( visitor , getJavadoc ( ) ) ; acceptChild ( visitor , getName ( ) ) ; acceptChild ( visitor , getSuperclass ( ) ) ; acceptChildren ( visitor , this . superInterfaceNames ) ; acceptChildren ( visitor , this . bodyDeclarations ) ; } if ( this . ast . apiLevel >= AST . JLS3 ) { acceptChild ( visitor , getJavadoc ( ) ) ; acceptChildren ( visitor , this . modifiers ) ; acceptChild ( visitor , getName ( ) ) ; acceptChildren ( visitor , this . typeParameters ) ; acceptChild ( visitor , getSuperclassType ( ) ) ; acceptChildren ( visitor , this . superInterfaceTypes ) ; acceptChildren ( visitor , this . bodyDeclarations ) ; } } visitor . endVisit ( this ) ; } public boolean isInterface ( ) { return this . isInterface ; } public void setInterface ( boolean isInterface ) { preValueChange ( INTERFACE_PROPERTY ) ; this . isInterface = isInterface ; postValueChange ( INTERFACE_PROPERTY ) ; } public List typeParameters ( ) { if ( this . typeParameters == null ) { unsupportedIn2 ( ) ; } return this . typeParameters ; } public Name getSuperclass ( ) { return internalGetSuperclass ( ) ; } final Name internalGetSuperclass ( ) { supportedOnlyIn2 ( ) ; return this . optionalSuperclassName ; } public Type getSuperclassType ( ) { unsupportedIn2 ( ) ; return this . optionalSuperclassType ; } public void setSuperclass ( Name superclassName ) { internalSetSuperclass ( superclassName ) ; } final void internalSetSuperclass ( Name superclassName ) { supportedOnlyIn2 ( ) ; ASTNode oldChild = this . optionalSuperclassName ; preReplaceChild ( oldChild , superclassName , SUPERCLASS_PROPERTY ) ; this . optionalSuperclassName = superclassName ; postReplaceChild ( oldChild , superclassName , SUPERCLASS_PROPERTY ) ; } public void setSuperclassType ( Type superclassType ) { unsupportedIn2 ( ) ; ASTNode oldChild = this . optionalSuperclassType ; preReplaceChild ( oldChild , superclassType , SUPERCLASS_TYPE_PROPERTY ) ; this . optionalSuperclassType = superclassType ; postReplaceChild ( oldChild , superclassType , SUPERCLASS_TYPE_PROPERTY ) ; } public List superInterfaces ( ) { return internalSuperInterfaces ( ) ; } final List internalSuperInterfaces ( ) { if ( this . superInterfaceNames == null ) { supportedOnlyIn2 ( ) ; } return this . superInterfaceNames ; } public List superInterfaceTypes ( ) { if ( this . superInterfaceTypes == null ) { unsupportedIn2 ( ) ; } return this . superInterfaceTypes ; } public FieldDeclaration [ ] getFields ( ) { List bd = bodyDeclarations ( ) ; int fieldCount = <NUM_LIT:0> ; for ( Iterator it = bd . listIterator ( ) ; it . hasNext ( ) ; ) { if ( it . next ( ) instanceof FieldDeclaration ) { fieldCount ++ ; } } FieldDeclaration [ ] fields = new FieldDeclaration [ fieldCount ] ; int next = <NUM_LIT:0> ; for ( Iterator it = bd . listIterator ( ) ; it . hasNext ( ) ; ) { Object decl = it . next ( ) ; if ( decl instanceof FieldDeclaration ) { fields [ next ++ ] = ( FieldDeclaration ) decl ; } } return fields ; } public MethodDeclaration [ ] getMethods ( ) { List bd = bodyDeclarations ( ) ; int methodCount = <NUM_LIT:0> ; for ( Iterator it = bd . listIterator ( ) ; it . hasNext ( ) ; ) { if ( it . next ( ) instanceof MethodDeclaration ) { methodCount ++ ; } } MethodDeclaration [ ] methods = new MethodDeclaration [ methodCount ] ; int next = <NUM_LIT:0> ; for ( Iterator it = bd . listIterator ( ) ; it . hasNext ( ) ; ) { Object decl = it . next ( ) ; if ( decl instanceof MethodDeclaration ) { methods [ next ++ ] = ( MethodDeclaration ) decl ; } } return methods ; } public TypeDeclaration [ ] getTypes ( ) { List bd = bodyDeclarations ( ) ; int typeCount = <NUM_LIT:0> ; for ( Iterator it = bd . listIterator ( ) ; it . hasNext ( ) ; ) { if ( it . next ( ) instanceof TypeDeclaration ) { typeCount ++ ; } } TypeDeclaration [ ] memberTypes = new TypeDeclaration [ typeCount ] ; int next = <NUM_LIT:0> ; for ( Iterator it = bd . listIterator ( ) ; it . hasNext ( ) ; ) { Object decl = it . next ( ) ; if ( decl instanceof TypeDeclaration ) { memberTypes [ next ++ ] = ( TypeDeclaration ) decl ; } } return memberTypes ; } ITypeBinding internalResolveBinding ( ) { return this . ast . getBindingResolver ( ) . resolveType ( this ) ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:6> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalDocComment == null ? <NUM_LIT:0> : getJavadoc ( ) . treeSize ( ) ) + ( this . modifiers == null ? <NUM_LIT:0> : this . modifiers . listSize ( ) ) + ( this . typeName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) + ( this . typeParameters == null ? <NUM_LIT:0> : this . typeParameters . listSize ( ) ) + ( this . optionalSuperclassName == null ? <NUM_LIT:0> : getSuperclass ( ) . treeSize ( ) ) + ( this . optionalSuperclassType == null ? <NUM_LIT:0> : getSuperclassType ( ) . treeSize ( ) ) + ( this . superInterfaceNames == null ? <NUM_LIT:0> : this . superInterfaceNames . listSize ( ) ) + ( this . superInterfaceTypes == null ? <NUM_LIT:0> : this . superInterfaceTypes . listSize ( ) ) + this . bodyDeclarations . listSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom . rewrite ; import java . util . Collections ; import java . util . List ; import org . eclipse . jdt . core . dom . ASTNode ; import org . eclipse . jdt . core . dom . Block ; import org . eclipse . jdt . core . dom . ChildListPropertyDescriptor ; import org . eclipse . jdt . core . dom . FieldDeclaration ; import org . eclipse . jdt . core . dom . Statement ; import org . eclipse . jdt . core . dom . StructuralPropertyDescriptor ; import org . eclipse . jdt . internal . core . dom . rewrite . ListRewriteEvent ; import org . eclipse . jdt . internal . core . dom . rewrite . NodeInfoStore ; import org . eclipse . jdt . internal . core . dom . rewrite . RewriteEvent ; import org . eclipse . jdt . internal . core . dom . rewrite . RewriteEventStore ; import org . eclipse . jdt . internal . core . dom . rewrite . RewriteEventStore . CopySourceInfo ; import org . eclipse . text . edits . TextEditGroup ; public final class ListRewrite { private ASTNode parent ; private StructuralPropertyDescriptor childProperty ; private ASTRewrite rewriter ; ListRewrite ( ASTRewrite rewriter , ASTNode parent , StructuralPropertyDescriptor childProperty ) { this . rewriter = rewriter ; this . parent = parent ; this . childProperty = childProperty ; } private RewriteEventStore getRewriteStore ( ) { return this . rewriter . getRewriteEventStore ( ) ; } private ListRewriteEvent getEvent ( ) { return getRewriteStore ( ) . getListEvent ( this . parent , this . childProperty , true ) ; } public ASTNode getParent ( ) { return this . parent ; } public StructuralPropertyDescriptor getLocationInParent ( ) { return this . childProperty ; } public void remove ( ASTNode node , TextEditGroup editGroup ) { if ( node == null ) { throw new IllegalArgumentException ( ) ; } RewriteEvent event = getEvent ( ) . removeEntry ( node ) ; if ( editGroup != null ) { getRewriteStore ( ) . setEventEditGroup ( event , editGroup ) ; } } public ASTRewrite getASTRewrite ( ) { return this . rewriter ; } public void replace ( ASTNode node , ASTNode replacement , TextEditGroup editGroup ) { if ( node == null ) { throw new IllegalArgumentException ( ) ; } RewriteEvent event = getEvent ( ) . replaceEntry ( node , replacement ) ; if ( editGroup != null ) { getRewriteStore ( ) . setEventEditGroup ( event , editGroup ) ; } } public void insertAfter ( ASTNode node , ASTNode element , TextEditGroup editGroup ) { if ( node == null || element == null ) { throw new IllegalArgumentException ( ) ; } int index = getEvent ( ) . getIndex ( element , ListRewriteEvent . BOTH ) ; if ( index == - <NUM_LIT:1> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } internalInsertAt ( node , index + <NUM_LIT:1> , true , editGroup ) ; } public void insertBefore ( ASTNode node , ASTNode element , TextEditGroup editGroup ) { if ( node == null || element == null ) { throw new IllegalArgumentException ( ) ; } int index = getEvent ( ) . getIndex ( element , ListRewriteEvent . BOTH ) ; if ( index == - <NUM_LIT:1> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } internalInsertAt ( node , index , false , editGroup ) ; } public void insertFirst ( ASTNode node , TextEditGroup editGroup ) { if ( node == null ) { throw new IllegalArgumentException ( ) ; } internalInsertAt ( node , <NUM_LIT:0> , false , editGroup ) ; } public void insertLast ( ASTNode node , TextEditGroup editGroup ) { if ( node == null ) { throw new IllegalArgumentException ( ) ; } internalInsertAt ( node , - <NUM_LIT:1> , true , editGroup ) ; } public void insertAt ( ASTNode node , int index , TextEditGroup editGroup ) { if ( node == null ) { throw new IllegalArgumentException ( ) ; } internalInsertAt ( node , index , isInsertBoundToPreviousByDefault ( node ) , editGroup ) ; } private void internalInsertAt ( ASTNode node , int index , boolean boundToPrevious , TextEditGroup editGroup ) { RewriteEvent event = getEvent ( ) . insert ( node , index ) ; if ( boundToPrevious ) { getRewriteStore ( ) . setInsertBoundToPrevious ( node ) ; } if ( editGroup != null ) { getRewriteStore ( ) . setEventEditGroup ( event , editGroup ) ; } } private ASTNode createTargetNode ( ASTNode first , ASTNode last , boolean isMove , ASTNode replacingNode , TextEditGroup editGroup ) { if ( first == null || last == null ) { throw new IllegalArgumentException ( ) ; } NodeInfoStore nodeStore = this . rewriter . getNodeStore ( ) ; ASTNode placeholder = nodeStore . newPlaceholderNode ( first . getNodeType ( ) ) ; if ( placeholder == null ) { throw new IllegalArgumentException ( "<STR_LIT>" + first . getClass ( ) . getName ( ) ) ; } Block internalPlaceHolder = nodeStore . createCollapsePlaceholder ( ) ; CopySourceInfo info = getRewriteStore ( ) . createRangeCopy ( this . parent , this . childProperty , first , last , isMove , internalPlaceHolder , replacingNode , editGroup ) ; nodeStore . markAsCopyTarget ( placeholder , info ) ; return placeholder ; } public final ASTNode createCopyTarget ( ASTNode first , ASTNode last ) { if ( first == last ) { return this . rewriter . createCopyTarget ( first ) ; } else { return createTargetNode ( first , last , false , null , null ) ; } } public final ASTNode createMoveTarget ( ASTNode first , ASTNode last ) { return createMoveTarget ( first , last , null , null ) ; } public final ASTNode createMoveTarget ( ASTNode first , ASTNode last , ASTNode replacingNode , TextEditGroup editGroup ) { if ( first == last ) { replace ( first , replacingNode , editGroup ) ; return this . rewriter . createMoveTarget ( first ) ; } else { return createTargetNode ( first , last , true , replacingNode , editGroup ) ; } } private boolean isInsertBoundToPreviousByDefault ( ASTNode node ) { return ( node instanceof Statement || node instanceof FieldDeclaration ) ; } public List getOriginalList ( ) { List list = ( List ) getEvent ( ) . getOriginalValue ( ) ; return Collections . unmodifiableList ( list ) ; } public List getRewrittenList ( ) { List list = ( List ) getEvent ( ) . getNewValue ( ) ; return Collections . unmodifiableList ( list ) ; } } </s>
<s> package org . eclipse . jdt . core . dom . rewrite ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import org . eclipse . jdt . core . IClassFile ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . ITypeRoot ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . dom . AST ; import org . eclipse . jdt . core . dom . ASTNode ; import org . eclipse . jdt . core . dom . ASTParser ; import org . eclipse . jdt . core . dom . Block ; import org . eclipse . jdt . core . dom . ChildListPropertyDescriptor ; import org . eclipse . jdt . core . dom . CompilationUnit ; import org . eclipse . jdt . core . dom . StructuralPropertyDescriptor ; import org . eclipse . jdt . internal . compiler . parser . RecoveryScannerData ; import org . eclipse . jdt . internal . core . dom . rewrite . ASTRewriteAnalyzer ; import org . eclipse . jdt . internal . core . dom . rewrite . LineInformation ; import org . eclipse . jdt . internal . core . dom . rewrite . NodeInfoStore ; import org . eclipse . jdt . internal . core . dom . rewrite . NodeRewriteEvent ; import org . eclipse . jdt . internal . core . dom . rewrite . RewriteEventStore ; import org . eclipse . jdt . internal . core . dom . rewrite . TrackedNodePosition ; import org . eclipse . jdt . internal . core . dom . rewrite . RewriteEventStore . CopySourceInfo ; import org . eclipse . jdt . internal . core . dom . rewrite . RewriteEventStore . PropertyLocation ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . TextUtilities ; import org . eclipse . text . edits . MultiTextEdit ; import org . eclipse . text . edits . TextEdit ; import org . eclipse . text . edits . TextEditGroup ; public class ASTRewrite { private final AST ast ; private final RewriteEventStore eventStore ; private final NodeInfoStore nodeStore ; private TargetSourceRangeComputer targetSourceRangeComputer = null ; public static ASTRewrite create ( AST ast ) { return new ASTRewrite ( ast ) ; } protected ASTRewrite ( AST ast ) { this . ast = ast ; this . eventStore = new RewriteEventStore ( ) ; this . nodeStore = new NodeInfoStore ( ast ) ; } public final AST getAST ( ) { return this . ast ; } protected final RewriteEventStore getRewriteEventStore ( ) { return this . eventStore ; } protected final NodeInfoStore getNodeStore ( ) { return this . nodeStore ; } public TextEdit rewriteAST ( IDocument document , Map options ) throws IllegalArgumentException { if ( document == null ) { throw new IllegalArgumentException ( ) ; } ASTNode rootNode = getRootNode ( ) ; if ( rootNode == null ) { return new MultiTextEdit ( ) ; } char [ ] content = document . get ( ) . toCharArray ( ) ; LineInformation lineInfo = LineInformation . create ( document ) ; String lineDelim = TextUtilities . getDefaultLineDelimiter ( document ) ; ASTNode astRoot = rootNode . getRoot ( ) ; List commentNodes = astRoot instanceof CompilationUnit ? ( ( CompilationUnit ) astRoot ) . getCommentList ( ) : null ; Map currentOptions = options == null ? JavaCore . getOptions ( ) : options ; return internalRewriteAST ( content , lineInfo , lineDelim , commentNodes , currentOptions , rootNode , ( RecoveryScannerData ) ( ( CompilationUnit ) astRoot ) . getStatementsRecoveryData ( ) ) ; } public TextEdit rewriteAST ( ) throws JavaModelException , IllegalArgumentException { ASTNode rootNode = getRootNode ( ) ; if ( rootNode == null ) { return new MultiTextEdit ( ) ; } ASTNode root = rootNode . getRoot ( ) ; if ( ! ( root instanceof CompilationUnit ) ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } CompilationUnit astRoot = ( CompilationUnit ) root ; ITypeRoot typeRoot = astRoot . getTypeRoot ( ) ; if ( typeRoot == null || typeRoot . getBuffer ( ) == null ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } char [ ] content = typeRoot . getBuffer ( ) . getCharacters ( ) ; LineInformation lineInfo = LineInformation . create ( astRoot ) ; String lineDelim = typeRoot . findRecommendedLineSeparator ( ) ; Map options = typeRoot . getJavaProject ( ) . getOptions ( true ) ; return internalRewriteAST ( content , lineInfo , lineDelim , astRoot . getCommentList ( ) , options , rootNode , ( RecoveryScannerData ) astRoot . getStatementsRecoveryData ( ) ) ; } private TextEdit internalRewriteAST ( char [ ] content , LineInformation lineInfo , String lineDelim , List commentNodes , Map options , ASTNode rootNode , RecoveryScannerData recoveryScannerData ) { TextEdit result = new MultiTextEdit ( ) ; TargetSourceRangeComputer sourceRangeComputer = getExtendedSourceRangeComputer ( ) ; this . eventStore . prepareMovedNodes ( sourceRangeComputer ) ; ASTRewriteAnalyzer visitor = new ASTRewriteAnalyzer ( content , lineInfo , lineDelim , result , this . eventStore , this . nodeStore , commentNodes , options , sourceRangeComputer , recoveryScannerData ) ; rootNode . accept ( visitor ) ; this . eventStore . revertMovedNodes ( ) ; return result ; } private ASTNode getRootNode ( ) { ASTNode node = null ; int start = - <NUM_LIT:1> ; int end = - <NUM_LIT:1> ; for ( Iterator iter = getRewriteEventStore ( ) . getChangeRootIterator ( ) ; iter . hasNext ( ) ; ) { ASTNode curr = ( ASTNode ) iter . next ( ) ; if ( ! RewriteEventStore . isNewNode ( curr ) ) { int currStart = curr . getStartPosition ( ) ; int currEnd = currStart + curr . getLength ( ) ; if ( node == null || currStart < start && currEnd > end ) { start = currStart ; end = currEnd ; node = curr ; } else if ( currStart < start ) { start = currStart ; } else if ( currEnd > end ) { end = currEnd ; } } } if ( node != null ) { int currStart = node . getStartPosition ( ) ; int currEnd = currStart + node . getLength ( ) ; while ( start < currStart || end > currEnd ) { node = node . getParent ( ) ; currStart = node . getStartPosition ( ) ; currEnd = currStart + node . getLength ( ) ; } ASTNode parent = node . getParent ( ) ; while ( parent != null && parent . getStartPosition ( ) == node . getStartPosition ( ) && parent . getLength ( ) == node . getLength ( ) ) { node = parent ; parent = node . getParent ( ) ; } } return node ; } public final void remove ( ASTNode node , TextEditGroup editGroup ) { if ( node == null ) { throw new IllegalArgumentException ( ) ; } StructuralPropertyDescriptor property ; ASTNode parent ; if ( RewriteEventStore . isNewNode ( node ) ) { PropertyLocation location = this . eventStore . getPropertyLocation ( node , RewriteEventStore . NEW ) ; if ( location != null ) { property = location . getProperty ( ) ; parent = location . getParent ( ) ; } else { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } } else { property = node . getLocationInParent ( ) ; parent = node . getParent ( ) ; } if ( property . isChildListProperty ( ) ) { getListRewrite ( parent , ( ChildListPropertyDescriptor ) property ) . remove ( node , editGroup ) ; } else { set ( parent , property , null , editGroup ) ; } } public final void replace ( ASTNode node , ASTNode replacement , TextEditGroup editGroup ) { if ( node == null ) { throw new IllegalArgumentException ( ) ; } StructuralPropertyDescriptor property ; ASTNode parent ; if ( RewriteEventStore . isNewNode ( node ) ) { PropertyLocation location = this . eventStore . getPropertyLocation ( node , RewriteEventStore . NEW ) ; if ( location != null ) { property = location . getProperty ( ) ; parent = location . getParent ( ) ; } else { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } } else { property = node . getLocationInParent ( ) ; parent = node . getParent ( ) ; } if ( property . isChildListProperty ( ) ) { getListRewrite ( parent , ( ChildListPropertyDescriptor ) property ) . replace ( node , replacement , editGroup ) ; } else { set ( parent , property , replacement , editGroup ) ; } } public final void set ( ASTNode node , StructuralPropertyDescriptor property , Object value , TextEditGroup editGroup ) { if ( node == null || property == null ) { throw new IllegalArgumentException ( ) ; } validateIsCorrectAST ( node ) ; validatePropertyType ( property , value ) ; validateIsPropertyOfNode ( property , node ) ; NodeRewriteEvent nodeEvent = this . eventStore . getNodeEvent ( node , property , true ) ; nodeEvent . setNewValue ( value ) ; if ( editGroup != null ) { this . eventStore . setEventEditGroup ( nodeEvent , editGroup ) ; } } public Object get ( ASTNode node , StructuralPropertyDescriptor property ) { if ( node == null || property == null ) { throw new IllegalArgumentException ( ) ; } if ( property . isChildListProperty ( ) ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } return this . eventStore . getNewValue ( node , property ) ; } public final ListRewrite getListRewrite ( ASTNode node , ChildListPropertyDescriptor property ) { if ( node == null || property == null ) { throw new IllegalArgumentException ( ) ; } validateIsCorrectAST ( node ) ; validateIsListProperty ( property ) ; validateIsPropertyOfNode ( property , node ) ; return new ListRewrite ( this , node , property ) ; } public final ITrackedNodePosition track ( ASTNode node ) { if ( node == null ) { throw new IllegalArgumentException ( ) ; } TextEditGroup group = this . eventStore . getTrackedNodeData ( node ) ; if ( group == null ) { group = new TextEditGroup ( "<STR_LIT>" ) ; this . eventStore . setTrackedNodeData ( node , group ) ; } return new TrackedNodePosition ( group , node ) ; } private void validateIsExistingNode ( ASTNode node ) { if ( node . getStartPosition ( ) == - <NUM_LIT:1> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } } private void validateIsCorrectAST ( ASTNode node ) { if ( node . getAST ( ) != getAST ( ) ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } } private void validateIsListProperty ( StructuralPropertyDescriptor property ) { if ( ! property . isChildListProperty ( ) ) { String message = property . getId ( ) + "<STR_LIT>" ; throw new IllegalArgumentException ( message ) ; } } private void validateIsPropertyOfNode ( StructuralPropertyDescriptor property , ASTNode node ) { if ( ! property . getNodeClass ( ) . isInstance ( node ) ) { String message = property . getId ( ) + "<STR_LIT>" + node . getClass ( ) . getName ( ) ; throw new IllegalArgumentException ( message ) ; } } private void validatePropertyType ( StructuralPropertyDescriptor prop , Object node ) { if ( prop . isChildListProperty ( ) ) { String message = "<STR_LIT>" ; throw new IllegalArgumentException ( message ) ; } } public final ASTNode createStringPlaceholder ( String code , int nodeType ) { if ( code == null ) { throw new IllegalArgumentException ( ) ; } ASTNode placeholder = getNodeStore ( ) . newPlaceholderNode ( nodeType ) ; if ( placeholder == null ) { throw new IllegalArgumentException ( "<STR_LIT>" + nodeType ) ; } getNodeStore ( ) . markAsStringPlaceholder ( placeholder , code ) ; return placeholder ; } public final ASTNode createGroupNode ( ASTNode [ ] targetNodes ) { if ( targetNodes == null || targetNodes . length == <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } Block res = getNodeStore ( ) . createCollapsePlaceholder ( ) ; ListRewrite listRewrite = getListRewrite ( res , Block . STATEMENTS_PROPERTY ) ; for ( int i = <NUM_LIT:0> ; i < targetNodes . length ; i ++ ) { listRewrite . insertLast ( targetNodes [ i ] , null ) ; } return res ; } private ASTNode createTargetNode ( ASTNode node , boolean isMove ) { if ( node == null ) { throw new IllegalArgumentException ( ) ; } validateIsExistingNode ( node ) ; validateIsCorrectAST ( node ) ; CopySourceInfo info = getRewriteEventStore ( ) . markAsCopySource ( node . getParent ( ) , node . getLocationInParent ( ) , node , isMove ) ; ASTNode placeholder = getNodeStore ( ) . newPlaceholderNode ( node . getNodeType ( ) ) ; if ( placeholder == null ) { throw new IllegalArgumentException ( "<STR_LIT>" + node . getClass ( ) . getName ( ) ) ; } getNodeStore ( ) . markAsCopyTarget ( placeholder , info ) ; return placeholder ; } public final ASTNode createCopyTarget ( ASTNode node ) { return createTargetNode ( node , false ) ; } public final ASTNode createMoveTarget ( ASTNode node ) { return createTargetNode ( node , true ) ; } public final TargetSourceRangeComputer getExtendedSourceRangeComputer ( ) { if ( this . targetSourceRangeComputer == null ) { this . targetSourceRangeComputer = new TargetSourceRangeComputer ( ) ; } return this . targetSourceRangeComputer ; } public final void setTargetSourceRangeComputer ( TargetSourceRangeComputer computer ) { this . targetSourceRangeComputer = computer ; } public String toString ( ) { StringBuffer buf = new StringBuffer ( ) ; buf . append ( "<STR_LIT>" ) ; if ( this . eventStore != null ) { buf . append ( this . eventStore . toString ( ) ) ; } return buf . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom . rewrite ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . eclipse . core . runtime . SubProgressMonitor ; import org . eclipse . jdt . core . Flags ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IImportDeclaration ; import org . eclipse . jdt . core . ITypeRoot ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . Signature ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . dom . * ; import org . eclipse . jdt . internal . core . dom . rewrite . ImportRewriteAnalyzer ; import org . eclipse . jdt . internal . core . util . Messages ; import org . eclipse . jdt . internal . core . util . Util ; import org . eclipse . text . edits . MultiTextEdit ; import org . eclipse . text . edits . TextEdit ; public final class ImportRewrite { public static abstract class ImportRewriteContext { public final static int RES_NAME_FOUND = <NUM_LIT:1> ; public final static int RES_NAME_UNKNOWN = <NUM_LIT:2> ; public final static int RES_NAME_CONFLICT = <NUM_LIT:3> ; public final static int KIND_TYPE = <NUM_LIT:1> ; public final static int KIND_STATIC_FIELD = <NUM_LIT:2> ; public final static int KIND_STATIC_METHOD = <NUM_LIT:3> ; public abstract int findInContext ( String qualifier , String name , int kind ) ; } private static final char STATIC_PREFIX = '<CHAR_LIT>' ; private static final char NORMAL_PREFIX = '<CHAR_LIT>' ; private final ImportRewriteContext defaultContext ; private final ICompilationUnit compilationUnit ; private final CompilationUnit astRoot ; private final boolean restoreExistingImports ; private final List existingImports ; private final Map importsKindMap ; private String [ ] importOrder ; private int importOnDemandThreshold ; private int staticImportOnDemandThreshold ; private List addedImports ; private List removedImports ; private String [ ] createdImports ; private String [ ] createdStaticImports ; private boolean filterImplicitImports ; private boolean useContextToFilterImplicitImports ; public static ImportRewrite create ( ICompilationUnit cu , boolean restoreExistingImports ) throws JavaModelException { if ( cu == null ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } List existingImport = null ; if ( restoreExistingImports ) { existingImport = new ArrayList ( ) ; IImportDeclaration [ ] imports = cu . getImports ( ) ; for ( int i = <NUM_LIT:0> ; i < imports . length ; i ++ ) { IImportDeclaration curr = imports [ i ] ; char prefix = Flags . isStatic ( curr . getFlags ( ) ) ? STATIC_PREFIX : NORMAL_PREFIX ; existingImport . add ( prefix + curr . getElementName ( ) ) ; } } return new ImportRewrite ( cu , null , existingImport ) ; } public static ImportRewrite create ( CompilationUnit astRoot , boolean restoreExistingImports ) { if ( astRoot == null ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } ITypeRoot typeRoot = astRoot . getTypeRoot ( ) ; if ( ! ( typeRoot instanceof ICompilationUnit ) ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } List existingImport = null ; if ( restoreExistingImports ) { existingImport = new ArrayList ( ) ; List imports = astRoot . imports ( ) ; for ( int i = <NUM_LIT:0> ; i < imports . size ( ) ; i ++ ) { ImportDeclaration curr = ( ImportDeclaration ) imports . get ( i ) ; StringBuffer buf = new StringBuffer ( ) ; buf . append ( curr . isStatic ( ) ? STATIC_PREFIX : NORMAL_PREFIX ) . append ( curr . getName ( ) . getFullyQualifiedName ( ) ) ; if ( curr . isOnDemand ( ) ) { if ( buf . length ( ) > <NUM_LIT:1> ) buf . append ( '<CHAR_LIT:.>' ) ; buf . append ( '<CHAR_LIT>' ) ; } existingImport . add ( buf . toString ( ) ) ; } } return new ImportRewrite ( ( ICompilationUnit ) typeRoot , astRoot , existingImport ) ; } private ImportRewrite ( ICompilationUnit cu , CompilationUnit astRoot , List existingImports ) { this . compilationUnit = cu ; this . astRoot = astRoot ; if ( existingImports != null ) { this . existingImports = existingImports ; this . restoreExistingImports = ! existingImports . isEmpty ( ) ; } else { this . existingImports = new ArrayList ( ) ; this . restoreExistingImports = false ; } this . filterImplicitImports = true ; this . useContextToFilterImplicitImports = false ; this . defaultContext = new ImportRewriteContext ( ) { public int findInContext ( String qualifier , String name , int kind ) { return findInImports ( qualifier , name , kind ) ; } } ; this . addedImports = null ; this . removedImports = null ; this . createdImports = null ; this . createdStaticImports = null ; this . importOrder = CharOperation . NO_STRINGS ; this . importOnDemandThreshold = <NUM_LIT> ; this . staticImportOnDemandThreshold = <NUM_LIT> ; this . importsKindMap = new HashMap ( ) ; } public void setImportOrder ( String [ ] order ) { if ( order == null ) throw new IllegalArgumentException ( "<STR_LIT>" ) ; this . importOrder = order ; } public void setOnDemandImportThreshold ( int threshold ) { if ( threshold <= <NUM_LIT:0> ) throw new IllegalArgumentException ( "<STR_LIT>" ) ; this . importOnDemandThreshold = threshold ; } public void setStaticOnDemandImportThreshold ( int threshold ) { if ( threshold <= <NUM_LIT:0> ) throw new IllegalArgumentException ( "<STR_LIT>" ) ; this . staticImportOnDemandThreshold = threshold ; } public ICompilationUnit getCompilationUnit ( ) { return this . compilationUnit ; } public ImportRewriteContext getDefaultImportRewriteContext ( ) { return this . defaultContext ; } public void setFilterImplicitImports ( boolean filterImplicitImports ) { this . filterImplicitImports = filterImplicitImports ; } public void setUseContextToFilterImplicitImports ( boolean useContextToFilterImplicitImports ) { this . useContextToFilterImplicitImports = useContextToFilterImplicitImports ; } private static int compareImport ( char prefix , String qualifier , String name , String curr ) { if ( curr . charAt ( <NUM_LIT:0> ) != prefix || ! curr . endsWith ( name ) ) { return ImportRewriteContext . RES_NAME_UNKNOWN ; } curr = curr . substring ( <NUM_LIT:1> ) ; if ( curr . length ( ) == name . length ( ) ) { if ( qualifier . length ( ) == <NUM_LIT:0> ) { return ImportRewriteContext . RES_NAME_FOUND ; } return ImportRewriteContext . RES_NAME_CONFLICT ; } int dotPos = curr . length ( ) - name . length ( ) - <NUM_LIT:1> ; if ( curr . charAt ( dotPos ) != '<CHAR_LIT:.>' ) { return ImportRewriteContext . RES_NAME_UNKNOWN ; } if ( qualifier . length ( ) != dotPos || ! curr . startsWith ( qualifier ) ) { return ImportRewriteContext . RES_NAME_CONFLICT ; } return ImportRewriteContext . RES_NAME_FOUND ; } final int findInImports ( String qualifier , String name , int kind ) { boolean allowAmbiguity = ( kind == ImportRewriteContext . KIND_STATIC_METHOD ) || ( name . length ( ) == <NUM_LIT:1> && name . charAt ( <NUM_LIT:0> ) == '<CHAR_LIT>' ) ; List imports = this . existingImports ; char prefix = ( kind == ImportRewriteContext . KIND_TYPE ) ? NORMAL_PREFIX : STATIC_PREFIX ; for ( int i = imports . size ( ) - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { String curr = ( String ) imports . get ( i ) ; int res = compareImport ( prefix , qualifier , name , curr ) ; if ( res != ImportRewriteContext . RES_NAME_UNKNOWN ) { if ( ! allowAmbiguity || res == ImportRewriteContext . RES_NAME_FOUND ) { if ( prefix != STATIC_PREFIX ) { return res ; } Object currKind = this . importsKindMap . get ( curr . substring ( <NUM_LIT:1> ) ) ; if ( currKind != null && currKind . equals ( this . importsKindMap . get ( qualifier + '<CHAR_LIT:.>' + name ) ) ) { return res ; } } } } if ( this . filterImplicitImports && this . useContextToFilterImplicitImports ) { String fPackageName = this . compilationUnit . getParent ( ) . getElementName ( ) ; String mainTypeSimpleName = JavaCore . removeJavaLikeExtension ( this . compilationUnit . getElementName ( ) ) ; String fMainTypeName = Util . concatenateName ( fPackageName , mainTypeSimpleName , '<CHAR_LIT:.>' ) ; if ( kind == ImportRewriteContext . KIND_TYPE && ( qualifier . equals ( fPackageName ) || fMainTypeName . equals ( Util . concatenateName ( qualifier , name , '<CHAR_LIT:.>' ) ) ) ) return ImportRewriteContext . RES_NAME_FOUND ; } return ImportRewriteContext . RES_NAME_UNKNOWN ; } public Type addImportFromSignature ( String typeSig , AST ast ) { return addImportFromSignature ( typeSig , ast , this . defaultContext ) ; } public Type addImportFromSignature ( String typeSig , AST ast , ImportRewriteContext context ) { if ( typeSig == null || typeSig . length ( ) == <NUM_LIT:0> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } int sigKind = Signature . getTypeSignatureKind ( typeSig ) ; switch ( sigKind ) { case Signature . BASE_TYPE_SIGNATURE : return ast . newPrimitiveType ( PrimitiveType . toCode ( Signature . toString ( typeSig ) ) ) ; case Signature . ARRAY_TYPE_SIGNATURE : Type elementType = addImportFromSignature ( Signature . getElementType ( typeSig ) , ast , context ) ; return ast . newArrayType ( elementType , Signature . getArrayCount ( typeSig ) ) ; case Signature . CLASS_TYPE_SIGNATURE : String erasureSig = Signature . getTypeErasure ( typeSig ) ; String erasureName = Signature . toString ( erasureSig ) ; if ( erasureSig . charAt ( <NUM_LIT:0> ) == Signature . C_RESOLVED ) { erasureName = internalAddImport ( erasureName , context ) ; } Type baseType = ast . newSimpleType ( ast . newName ( erasureName ) ) ; String [ ] typeArguments = Signature . getTypeArguments ( typeSig ) ; if ( typeArguments . length > <NUM_LIT:0> ) { ParameterizedType type = ast . newParameterizedType ( baseType ) ; List argNodes = type . typeArguments ( ) ; for ( int i = <NUM_LIT:0> ; i < typeArguments . length ; i ++ ) { String curr = typeArguments [ i ] ; if ( containsNestedCapture ( curr ) ) { argNodes . add ( ast . newWildcardType ( ) ) ; } else { argNodes . add ( addImportFromSignature ( curr , ast , context ) ) ; } } return type ; } return baseType ; case Signature . TYPE_VARIABLE_SIGNATURE : return ast . newSimpleType ( ast . newSimpleName ( Signature . toString ( typeSig ) ) ) ; case Signature . WILDCARD_TYPE_SIGNATURE : WildcardType wildcardType = ast . newWildcardType ( ) ; char ch = typeSig . charAt ( <NUM_LIT:0> ) ; if ( ch != Signature . C_STAR ) { Type bound = addImportFromSignature ( typeSig . substring ( <NUM_LIT:1> ) , ast , context ) ; wildcardType . setBound ( bound , ch == Signature . C_EXTENDS ) ; } return wildcardType ; case Signature . CAPTURE_TYPE_SIGNATURE : return addImportFromSignature ( typeSig . substring ( <NUM_LIT:1> ) , ast , context ) ; default : throw new IllegalArgumentException ( "<STR_LIT>" + typeSig ) ; } } public String addImport ( ITypeBinding binding ) { return addImport ( binding , this . defaultContext ) ; } public String addImport ( ITypeBinding binding , ImportRewriteContext context ) { if ( binding . isPrimitive ( ) || binding . isTypeVariable ( ) || binding . isRecovered ( ) ) { return binding . getName ( ) ; } ITypeBinding normalizedBinding = normalizeTypeBinding ( binding ) ; if ( normalizedBinding == null ) { return "<STR_LIT>" ; } if ( normalizedBinding . isWildcardType ( ) ) { StringBuffer res = new StringBuffer ( "<STR_LIT:?>" ) ; ITypeBinding bound = normalizedBinding . getBound ( ) ; if ( bound != null && ! bound . isWildcardType ( ) && ! bound . isCapture ( ) ) { if ( normalizedBinding . isUpperbound ( ) ) { res . append ( "<STR_LIT>" ) ; } else { res . append ( "<STR_LIT>" ) ; } res . append ( addImport ( bound , context ) ) ; } return res . toString ( ) ; } if ( normalizedBinding . isArray ( ) ) { StringBuffer res = new StringBuffer ( addImport ( normalizedBinding . getElementType ( ) , context ) ) ; for ( int i = normalizedBinding . getDimensions ( ) ; i > <NUM_LIT:0> ; i -- ) { res . append ( "<STR_LIT:[]>" ) ; } return res . toString ( ) ; } String qualifiedName = getRawQualifiedName ( normalizedBinding ) ; if ( qualifiedName . length ( ) > <NUM_LIT:0> ) { String str = internalAddImport ( qualifiedName , context ) ; ITypeBinding [ ] typeArguments = normalizedBinding . getTypeArguments ( ) ; if ( typeArguments . length > <NUM_LIT:0> ) { StringBuffer res = new StringBuffer ( str ) ; res . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> ; i < typeArguments . length ; i ++ ) { if ( i > <NUM_LIT:0> ) { res . append ( '<CHAR_LIT:U+002C>' ) ; } ITypeBinding curr = typeArguments [ i ] ; if ( containsNestedCapture ( curr , false ) ) { res . append ( '<CHAR_LIT>' ) ; } else { res . append ( addImport ( curr , context ) ) ; } } res . append ( '<CHAR_LIT:>>' ) ; return res . toString ( ) ; } return str ; } return getRawName ( normalizedBinding ) ; } private boolean containsNestedCapture ( ITypeBinding binding , boolean isNested ) { if ( binding == null || binding . isPrimitive ( ) || binding . isTypeVariable ( ) ) { return false ; } if ( binding . isCapture ( ) ) { if ( isNested ) { return true ; } return containsNestedCapture ( binding . getWildcard ( ) , true ) ; } if ( binding . isWildcardType ( ) ) { return containsNestedCapture ( binding . getBound ( ) , true ) ; } if ( binding . isArray ( ) ) { return containsNestedCapture ( binding . getElementType ( ) , true ) ; } ITypeBinding [ ] typeArguments = binding . getTypeArguments ( ) ; for ( int i = <NUM_LIT:0> ; i < typeArguments . length ; i ++ ) { if ( containsNestedCapture ( typeArguments [ i ] , true ) ) { return true ; } } return false ; } private boolean containsNestedCapture ( String signature ) { return signature . length ( ) > <NUM_LIT:1> && signature . indexOf ( Signature . C_CAPTURE , <NUM_LIT:1> ) != - <NUM_LIT:1> ; } private static ITypeBinding normalizeTypeBinding ( ITypeBinding binding ) { if ( binding != null && ! binding . isNullType ( ) && ! "<STR_LIT>" . equals ( binding . getName ( ) ) ) { if ( binding . isAnonymous ( ) ) { ITypeBinding [ ] baseBindings = binding . getInterfaces ( ) ; if ( baseBindings . length > <NUM_LIT:0> ) { return baseBindings [ <NUM_LIT:0> ] ; } return binding . getSuperclass ( ) ; } if ( binding . isCapture ( ) ) { return binding . getWildcard ( ) ; } return binding ; } return null ; } public Type addImport ( ITypeBinding binding , AST ast ) { return addImport ( binding , ast , this . defaultContext ) ; } public Type addImport ( ITypeBinding binding , AST ast , ImportRewriteContext context ) { if ( binding . isPrimitive ( ) ) { return ast . newPrimitiveType ( PrimitiveType . toCode ( binding . getName ( ) ) ) ; } ITypeBinding normalizedBinding = normalizeTypeBinding ( binding ) ; if ( normalizedBinding == null ) { return ast . newSimpleType ( ast . newSimpleName ( "<STR_LIT>" ) ) ; } if ( normalizedBinding . isTypeVariable ( ) ) { return ast . newSimpleType ( ast . newSimpleName ( binding . getName ( ) ) ) ; } if ( normalizedBinding . isWildcardType ( ) ) { WildcardType wcType = ast . newWildcardType ( ) ; ITypeBinding bound = normalizedBinding . getBound ( ) ; if ( bound != null && ! bound . isWildcardType ( ) && ! bound . isCapture ( ) ) { Type boundType = addImport ( bound , ast , context ) ; wcType . setBound ( boundType , normalizedBinding . isUpperbound ( ) ) ; } return wcType ; } if ( normalizedBinding . isArray ( ) ) { Type elementType = addImport ( normalizedBinding . getElementType ( ) , ast , context ) ; return ast . newArrayType ( elementType , normalizedBinding . getDimensions ( ) ) ; } String qualifiedName = getRawQualifiedName ( normalizedBinding ) ; if ( qualifiedName . length ( ) > <NUM_LIT:0> ) { String res = internalAddImport ( qualifiedName , context ) ; ITypeBinding [ ] typeArguments = normalizedBinding . getTypeArguments ( ) ; if ( typeArguments . length > <NUM_LIT:0> ) { Type erasureType = ast . newSimpleType ( ast . newName ( res ) ) ; ParameterizedType paramType = ast . newParameterizedType ( erasureType ) ; List arguments = paramType . typeArguments ( ) ; for ( int i = <NUM_LIT:0> ; i < typeArguments . length ; i ++ ) { ITypeBinding curr = typeArguments [ i ] ; if ( containsNestedCapture ( curr , false ) ) { arguments . add ( ast . newWildcardType ( ) ) ; } else { arguments . add ( addImport ( curr , ast , context ) ) ; } } return paramType ; } return ast . newSimpleType ( ast . newName ( res ) ) ; } return ast . newSimpleType ( ast . newName ( getRawName ( normalizedBinding ) ) ) ; } public String addImport ( String qualifiedTypeName , ImportRewriteContext context ) { int angleBracketOffset = qualifiedTypeName . indexOf ( '<CHAR_LIT>' ) ; if ( angleBracketOffset != - <NUM_LIT:1> ) { return internalAddImport ( qualifiedTypeName . substring ( <NUM_LIT:0> , angleBracketOffset ) , context ) + qualifiedTypeName . substring ( angleBracketOffset ) ; } int bracketOffset = qualifiedTypeName . indexOf ( '<CHAR_LIT:[>' ) ; if ( bracketOffset != - <NUM_LIT:1> ) { return internalAddImport ( qualifiedTypeName . substring ( <NUM_LIT:0> , bracketOffset ) , context ) + qualifiedTypeName . substring ( bracketOffset ) ; } return internalAddImport ( qualifiedTypeName , context ) ; } public String addImport ( String qualifiedTypeName ) { return addImport ( qualifiedTypeName , this . defaultContext ) ; } public String addStaticImport ( IBinding binding ) { return addStaticImport ( binding , this . defaultContext ) ; } public String addStaticImport ( IBinding binding , ImportRewriteContext context ) { if ( Modifier . isStatic ( binding . getModifiers ( ) ) ) { if ( binding instanceof IVariableBinding ) { IVariableBinding variableBinding = ( IVariableBinding ) binding ; if ( variableBinding . isField ( ) ) { ITypeBinding declaringType = variableBinding . getDeclaringClass ( ) ; return addStaticImport ( getRawQualifiedName ( declaringType ) , binding . getName ( ) , true , context ) ; } } else if ( binding instanceof IMethodBinding ) { ITypeBinding declaringType = ( ( IMethodBinding ) binding ) . getDeclaringClass ( ) ; return addStaticImport ( getRawQualifiedName ( declaringType ) , binding . getName ( ) , false , context ) ; } } throw new IllegalArgumentException ( "<STR_LIT>" ) ; } public String addStaticImport ( String declaringTypeName , String simpleName , boolean isField ) { return addStaticImport ( declaringTypeName , simpleName , isField , this . defaultContext ) ; } public String addStaticImport ( String declaringTypeName , String simpleName , boolean isField , ImportRewriteContext context ) { String key = declaringTypeName + '<CHAR_LIT:.>' + simpleName ; if ( declaringTypeName . indexOf ( '<CHAR_LIT:.>' ) == - <NUM_LIT:1> ) { return key ; } if ( context == null ) { context = this . defaultContext ; } int kind = isField ? ImportRewriteContext . KIND_STATIC_FIELD : ImportRewriteContext . KIND_STATIC_METHOD ; this . importsKindMap . put ( key , new Integer ( kind ) ) ; int res = context . findInContext ( declaringTypeName , simpleName , kind ) ; if ( res == ImportRewriteContext . RES_NAME_CONFLICT ) { return key ; } if ( res == ImportRewriteContext . RES_NAME_UNKNOWN ) { addEntry ( STATIC_PREFIX + key ) ; } return simpleName ; } private String internalAddImport ( String fullTypeName , ImportRewriteContext context ) { int idx = fullTypeName . lastIndexOf ( '<CHAR_LIT:.>' ) ; String typeContainerName , typeName ; if ( idx != - <NUM_LIT:1> ) { typeContainerName = fullTypeName . substring ( <NUM_LIT:0> , idx ) ; typeName = fullTypeName . substring ( idx + <NUM_LIT:1> ) ; } else { typeContainerName = "<STR_LIT>" ; typeName = fullTypeName ; } if ( typeContainerName . length ( ) == <NUM_LIT:0> && PrimitiveType . toCode ( typeName ) != null ) { return fullTypeName ; } if ( context == null ) context = this . defaultContext ; int res = context . findInContext ( typeContainerName , typeName , ImportRewriteContext . KIND_TYPE ) ; if ( res == ImportRewriteContext . RES_NAME_CONFLICT ) { return fullTypeName ; } if ( res == ImportRewriteContext . RES_NAME_UNKNOWN ) { addEntry ( NORMAL_PREFIX + fullTypeName ) ; } return typeName ; } private void addEntry ( String entry ) { this . existingImports . add ( entry ) ; if ( this . removedImports != null ) { if ( this . removedImports . remove ( entry ) ) { return ; } } if ( this . addedImports == null ) { this . addedImports = new ArrayList ( ) ; } this . addedImports . add ( entry ) ; } private boolean removeEntry ( String entry ) { if ( this . existingImports . remove ( entry ) ) { if ( this . addedImports != null ) { if ( this . addedImports . remove ( entry ) ) { return true ; } } if ( this . removedImports == null ) { this . removedImports = new ArrayList ( ) ; } this . removedImports . add ( entry ) ; return true ; } return false ; } public boolean removeImport ( String qualifiedName ) { return removeEntry ( NORMAL_PREFIX + qualifiedName ) ; } public boolean removeStaticImport ( String qualifiedName ) { return removeEntry ( STATIC_PREFIX + qualifiedName ) ; } private static String getRawName ( ITypeBinding normalizedBinding ) { return normalizedBinding . getTypeDeclaration ( ) . getName ( ) ; } private static String getRawQualifiedName ( ITypeBinding normalizedBinding ) { return normalizedBinding . getTypeDeclaration ( ) . getQualifiedName ( ) ; } public final TextEdit rewriteImports ( IProgressMonitor monitor ) throws CoreException { if ( monitor == null ) { monitor = new NullProgressMonitor ( ) ; } try { monitor . beginTask ( Messages . bind ( Messages . importRewrite_processDescription ) , <NUM_LIT:2> ) ; if ( ! hasRecordedChanges ( ) ) { this . createdImports = CharOperation . NO_STRINGS ; this . createdStaticImports = CharOperation . NO_STRINGS ; return new MultiTextEdit ( ) ; } CompilationUnit usedAstRoot = this . astRoot ; if ( usedAstRoot == null ) { ASTParser parser = ASTParser . newParser ( AST . JLS3 ) ; parser . setSource ( this . compilationUnit ) ; parser . setFocalPosition ( <NUM_LIT:0> ) ; parser . setResolveBindings ( false ) ; usedAstRoot = ( CompilationUnit ) parser . createAST ( new SubProgressMonitor ( monitor , <NUM_LIT:1> ) ) ; } ImportRewriteAnalyzer computer = new ImportRewriteAnalyzer ( this . compilationUnit , usedAstRoot , this . importOrder , this . importOnDemandThreshold , this . staticImportOnDemandThreshold , this . restoreExistingImports , this . useContextToFilterImplicitImports ) ; computer . setFilterImplicitImports ( this . filterImplicitImports ) ; if ( this . addedImports != null ) { for ( int i = <NUM_LIT:0> ; i < this . addedImports . size ( ) ; i ++ ) { String curr = ( String ) this . addedImports . get ( i ) ; computer . addImport ( curr . substring ( <NUM_LIT:1> ) , STATIC_PREFIX == curr . charAt ( <NUM_LIT:0> ) ) ; } } if ( this . removedImports != null ) { for ( int i = <NUM_LIT:0> ; i < this . removedImports . size ( ) ; i ++ ) { String curr = ( String ) this . removedImports . get ( i ) ; computer . removeImport ( curr . substring ( <NUM_LIT:1> ) , STATIC_PREFIX == curr . charAt ( <NUM_LIT:0> ) ) ; } } TextEdit result = computer . getResultingEdits ( new SubProgressMonitor ( monitor , <NUM_LIT:1> ) ) ; this . createdImports = computer . getCreatedImports ( ) ; this . createdStaticImports = computer . getCreatedStaticImports ( ) ; return result ; } finally { monitor . done ( ) ; } } public String [ ] getCreatedImports ( ) { return this . createdImports ; } public String [ ] getCreatedStaticImports ( ) { return this . createdStaticImports ; } public String [ ] getAddedImports ( ) { return filterFromList ( this . addedImports , NORMAL_PREFIX ) ; } public String [ ] getAddedStaticImports ( ) { return filterFromList ( this . addedImports , STATIC_PREFIX ) ; } public String [ ] getRemovedImports ( ) { return filterFromList ( this . removedImports , NORMAL_PREFIX ) ; } public String [ ] getRemovedStaticImports ( ) { return filterFromList ( this . removedImports , STATIC_PREFIX ) ; } public boolean hasRecordedChanges ( ) { return ! this . restoreExistingImports || ( this . addedImports != null && ! this . addedImports . isEmpty ( ) ) || ( this . removedImports != null && ! this . removedImports . isEmpty ( ) ) ; } private static String [ ] filterFromList ( List imports , char prefix ) { if ( imports == null ) { return CharOperation . NO_STRINGS ; } ArrayList res = new ArrayList ( ) ; for ( int i = <NUM_LIT:0> ; i < imports . size ( ) ; i ++ ) { String curr = ( String ) imports . get ( i ) ; if ( prefix == curr . charAt ( <NUM_LIT:0> ) ) { res . add ( curr . substring ( <NUM_LIT:1> ) ) ; } } return ( String [ ] ) res . toArray ( new String [ res . size ( ) ] ) ; } } </s>
<s> package org . eclipse . jdt . core . dom . rewrite ; public interface ITrackedNodePosition { public int getStartPosition ( ) ; public int getLength ( ) ; } </s>
<s> package org . eclipse . jdt . core . dom . rewrite ; import org . eclipse . jdt . core . dom . ASTNode ; import org . eclipse . jdt . core . dom . CompilationUnit ; public class TargetSourceRangeComputer { public static final class SourceRange { private int startPosition ; private int length ; public SourceRange ( int startPosition , int length ) { this . startPosition = startPosition ; this . length = length ; } public int getStartPosition ( ) { return this . startPosition ; } public int getLength ( ) { return this . length ; } } public TargetSourceRangeComputer ( ) { } public SourceRange computeSourceRange ( ASTNode node ) { ASTNode root = node . getRoot ( ) ; if ( root instanceof CompilationUnit ) { CompilationUnit cu = ( CompilationUnit ) root ; return new SourceRange ( cu . getExtendedStartPosition ( node ) , cu . getExtendedLength ( node ) ) ; } return new SourceRange ( node . getStartPosition ( ) , node . getLength ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class ThrowStatement extends Statement { public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( ThrowStatement . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( ThrowStatement . class , propertyList ) ; addProperty ( EXPRESSION_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Expression expression = null ; ThrowStatement ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == EXPRESSION_PROPERTY ) { if ( get ) { return getExpression ( ) ; } else { setExpression ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return THROW_STATEMENT ; } ASTNode clone0 ( AST target ) { ThrowStatement result = new ThrowStatement ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; result . setExpression ( ( Expression ) getExpression ( ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getExpression ( ) ) ; } visitor . endVisit ( this ) ; } public Expression getExpression ( ) { if ( this . expression == null ) { synchronized ( this ) { if ( this . expression == null ) { preLazyInit ( ) ; this . expression = new SimpleName ( this . ast ) ; postLazyInit ( this . expression , EXPRESSION_PROPERTY ) ; } } } return this . expression ; } public void setExpression ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . expression ; preReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; this . expression = expression ; postReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:1> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . expression == null ? <NUM_LIT:0> : getExpression ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class AnnotationTypeMemberDeclaration extends BodyDeclaration { public static final ChildPropertyDescriptor JAVADOC_PROPERTY = internalJavadocPropertyFactory ( AnnotationTypeMemberDeclaration . class ) ; public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY = internalModifiers2PropertyFactory ( AnnotationTypeMemberDeclaration . class ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( AnnotationTypeMemberDeclaration . class , "<STR_LIT:name>" , SimpleName . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor ( AnnotationTypeMemberDeclaration . class , "<STR_LIT:type>" , Type . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor DEFAULT_PROPERTY = new ChildPropertyDescriptor ( AnnotationTypeMemberDeclaration . class , "<STR_LIT:default>" , Expression . class , OPTIONAL , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:6> ) ; createPropertyList ( AnnotationTypeMemberDeclaration . class , properyList ) ; addProperty ( JAVADOC_PROPERTY , properyList ) ; addProperty ( MODIFIERS2_PROPERTY , properyList ) ; addProperty ( NAME_PROPERTY , properyList ) ; addProperty ( TYPE_PROPERTY , properyList ) ; addProperty ( DEFAULT_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private SimpleName memberName = null ; private Type memberType = null ; private Expression optionalDefaultValue = null ; AnnotationTypeMemberDeclaration ( AST ast ) { super ( ast ) ; unsupportedIn2 ( ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == JAVADOC_PROPERTY ) { if ( get ) { return getJavadoc ( ) ; } else { setJavadoc ( ( Javadoc ) child ) ; return null ; } } if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } if ( property == TYPE_PROPERTY ) { if ( get ) { return getType ( ) ; } else { setType ( ( Type ) child ) ; return null ; } } if ( property == DEFAULT_PROPERTY ) { if ( get ) { return getDefault ( ) ; } else { setDefault ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == MODIFIERS2_PROPERTY ) { return modifiers ( ) ; } return super . internalGetChildListProperty ( property ) ; } final ChildPropertyDescriptor internalJavadocProperty ( ) { return JAVADOC_PROPERTY ; } final ChildListPropertyDescriptor internalModifiers2Property ( ) { return MODIFIERS2_PROPERTY ; } final SimplePropertyDescriptor internalModifiersProperty ( ) { return null ; } final int getNodeType0 ( ) { return ANNOTATION_TYPE_MEMBER_DECLARATION ; } ASTNode clone0 ( AST target ) { AnnotationTypeMemberDeclaration result = new AnnotationTypeMemberDeclaration ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setJavadoc ( ( Javadoc ) ASTNode . copySubtree ( target , getJavadoc ( ) ) ) ; result . modifiers ( ) . addAll ( ASTNode . copySubtrees ( target , modifiers ( ) ) ) ; result . setType ( ( Type ) ASTNode . copySubtree ( target , getType ( ) ) ) ; result . setName ( ( SimpleName ) getName ( ) . clone ( target ) ) ; result . setDefault ( ( Expression ) ASTNode . copySubtree ( target , getDefault ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getJavadoc ( ) ) ; acceptChildren ( visitor , this . modifiers ) ; acceptChild ( visitor , getType ( ) ) ; acceptChild ( visitor , getName ( ) ) ; acceptChild ( visitor , getDefault ( ) ) ; } visitor . endVisit ( this ) ; } public SimpleName getName ( ) { if ( this . memberName == null ) { synchronized ( this ) { if ( this . memberName == null ) { preLazyInit ( ) ; this . memberName = new SimpleName ( this . ast ) ; postLazyInit ( this . memberName , NAME_PROPERTY ) ; } } } return this . memberName ; } public void setName ( SimpleName memberName ) { if ( memberName == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . memberName ; preReplaceChild ( oldChild , memberName , NAME_PROPERTY ) ; this . memberName = memberName ; postReplaceChild ( oldChild , memberName , NAME_PROPERTY ) ; } public Type getType ( ) { if ( this . memberType == null ) { synchronized ( this ) { if ( this . memberType == null ) { preLazyInit ( ) ; this . memberType = this . ast . newPrimitiveType ( PrimitiveType . INT ) ; postLazyInit ( this . memberType , TYPE_PROPERTY ) ; } } } return this . memberType ; } public void setType ( Type type ) { if ( type == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . memberType ; preReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; this . memberType = type ; postReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; } public Expression getDefault ( ) { return this . optionalDefaultValue ; } public void setDefault ( Expression defaultValue ) { ASTNode oldChild = this . optionalDefaultValue ; preReplaceChild ( oldChild , defaultValue , DEFAULT_PROPERTY ) ; this . optionalDefaultValue = defaultValue ; postReplaceChild ( oldChild , defaultValue , DEFAULT_PROPERTY ) ; } public IMethodBinding resolveBinding ( ) { return this . ast . getBindingResolver ( ) . resolveMember ( this ) ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:3> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalDocComment == null ? <NUM_LIT:0> : getJavadoc ( ) . treeSize ( ) ) + this . modifiers . listSize ( ) + ( this . memberName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) + ( this . memberType == null ? <NUM_LIT:0> : getType ( ) . treeSize ( ) ) + ( this . optionalDefaultValue == null ? <NUM_LIT:0> : getDefault ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class NullLiteral extends Expression { private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:1> ) ; createPropertyList ( NullLiteral . class , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } NullLiteral ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final int getNodeType0 ( ) { return NULL_LITERAL ; } ASTNode clone0 ( AST target ) { NullLiteral result = new NullLiteral ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { visitor . visit ( this ) ; visitor . endVisit ( this ) ; } int memSize ( ) { return BASE_NODE_SIZE ; } int treeSize ( ) { return memSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . jdt . core . compiler . InvalidInputException ; import org . eclipse . jdt . internal . compiler . parser . Scanner ; import org . eclipse . jdt . internal . compiler . parser . TerminalTokens ; public class StringLiteral extends Expression { public static final SimplePropertyDescriptor ESCAPED_VALUE_PROPERTY = new SimplePropertyDescriptor ( StringLiteral . class , "<STR_LIT>" , String . class , MANDATORY ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( StringLiteral . class , propertyList ) ; addProperty ( ESCAPED_VALUE_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private String escapedValue = "<STR_LIT>" ; StringLiteral ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final Object internalGetSetObjectProperty ( SimplePropertyDescriptor property , boolean get , Object value ) { if ( property == ESCAPED_VALUE_PROPERTY ) { if ( get ) { return getEscapedValue ( ) ; } else { setEscapedValue ( ( String ) value ) ; return null ; } } return super . internalGetSetObjectProperty ( property , get , value ) ; } final int getNodeType0 ( ) { return STRING_LITERAL ; } ASTNode clone0 ( AST target ) { StringLiteral result = new StringLiteral ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setEscapedValue ( getEscapedValue ( ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { visitor . visit ( this ) ; visitor . endVisit ( this ) ; } public String getEscapedValue ( ) { return this . escapedValue ; } public void setEscapedValue ( String token ) { if ( token == null ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } Scanner scanner = this . ast . scanner ; char [ ] source = token . toCharArray ( ) ; scanner . setSource ( source ) ; scanner . resetTo ( <NUM_LIT:0> , source . length ) ; try { int tokenType = scanner . getNextToken ( ) ; switch ( tokenType ) { case TerminalTokens . TokenNameStringLiteral : break ; default : throw new IllegalArgumentException ( "<STR_LIT>" + token + "<STR_LIT:<>" ) ; } } catch ( InvalidInputException e ) { throw new IllegalArgumentException ( "<STR_LIT>" + token + "<STR_LIT:<>" ) ; } preValueChange ( ESCAPED_VALUE_PROPERTY ) ; this . escapedValue = token ; postValueChange ( ESCAPED_VALUE_PROPERTY ) ; } void internalSetEscapedValue ( String token ) { preValueChange ( ESCAPED_VALUE_PROPERTY ) ; this . escapedValue = token ; postValueChange ( ESCAPED_VALUE_PROPERTY ) ; } public String getLiteralValue ( ) { String s = getEscapedValue ( ) ; int len = s . length ( ) ; if ( len < <NUM_LIT:2> || s . charAt ( <NUM_LIT:0> ) != '<STR_LIT:\">' || s . charAt ( len - <NUM_LIT:1> ) != '<STR_LIT:\">' ) { throw new IllegalArgumentException ( ) ; } Scanner scanner = this . ast . scanner ; char [ ] source = s . toCharArray ( ) ; scanner . setSource ( source ) ; scanner . resetTo ( <NUM_LIT:0> , source . length ) ; try { int tokenType = scanner . getNextToken ( ) ; switch ( tokenType ) { case TerminalTokens . TokenNameStringLiteral : return scanner . getCurrentStringLiteral ( ) ; default : throw new IllegalArgumentException ( ) ; } } catch ( InvalidInputException e ) { throw new IllegalArgumentException ( ) ; } } public void setLiteralValue ( String value ) { if ( value == null ) { throw new IllegalArgumentException ( ) ; } int len = value . length ( ) ; StringBuffer b = new StringBuffer ( len + <NUM_LIT:2> ) ; b . append ( "<STR_LIT:\">" ) ; for ( int i = <NUM_LIT:0> ; i < len ; i ++ ) { char c = value . charAt ( i ) ; switch ( c ) { case '<STR_LIT>' : b . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT:\t>' : b . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT:\n>' : b . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : b . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : b . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT:\">' : b . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT:\\>' : b . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : b . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : b . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : b . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : b . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : b . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : b . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : b . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : b . append ( "<STR_LIT>" ) ; break ; default : b . append ( c ) ; } } b . append ( "<STR_LIT:\">" ) ; setEscapedValue ( b . toString ( ) ) ; } int memSize ( ) { int size = BASE_NODE_SIZE + <NUM_LIT:1> * <NUM_LIT:4> + stringSize ( this . escapedValue ) ; return size ; } int treeSize ( ) { return memSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class ClassInstanceCreation extends Expression { public static final ChildListPropertyDescriptor TYPE_ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor ( ClassInstanceCreation . class , "<STR_LIT>" , Type . class , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( ClassInstanceCreation . class , "<STR_LIT>" , Expression . class , OPTIONAL , CYCLE_RISK ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( ClassInstanceCreation . class , "<STR_LIT:name>" , Name . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor ( ClassInstanceCreation . class , "<STR_LIT:type>" , Type . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor ( ClassInstanceCreation . class , "<STR_LIT>" , Expression . class , CYCLE_RISK ) ; public static final ChildPropertyDescriptor ANONYMOUS_CLASS_DECLARATION_PROPERTY = new ChildPropertyDescriptor ( ClassInstanceCreation . class , "<STR_LIT>" , AnonymousClassDeclaration . class , OPTIONAL , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS_2_0 ; private static final List PROPERTY_DESCRIPTORS_3_0 ; static { List properyList = new ArrayList ( <NUM_LIT:5> ) ; createPropertyList ( ClassInstanceCreation . class , properyList ) ; addProperty ( EXPRESSION_PROPERTY , properyList ) ; addProperty ( NAME_PROPERTY , properyList ) ; addProperty ( ARGUMENTS_PROPERTY , properyList ) ; addProperty ( ANONYMOUS_CLASS_DECLARATION_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( properyList ) ; properyList = new ArrayList ( <NUM_LIT:6> ) ; createPropertyList ( ClassInstanceCreation . class , properyList ) ; addProperty ( EXPRESSION_PROPERTY , properyList ) ; addProperty ( TYPE_ARGUMENTS_PROPERTY , properyList ) ; addProperty ( TYPE_PROPERTY , properyList ) ; addProperty ( ARGUMENTS_PROPERTY , properyList ) ; addProperty ( ANONYMOUS_CLASS_DECLARATION_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS_3_0 = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { if ( apiLevel == AST . JLS2_INTERNAL ) { return PROPERTY_DESCRIPTORS_2_0 ; } else { return PROPERTY_DESCRIPTORS_3_0 ; } } private Expression optionalExpression = null ; private ASTNode . NodeList typeArguments = null ; private Name typeName = null ; private Type type = null ; private ASTNode . NodeList arguments = new ASTNode . NodeList ( ARGUMENTS_PROPERTY ) ; private AnonymousClassDeclaration optionalAnonymousClassDeclaration = null ; ClassInstanceCreation ( AST ast ) { super ( ast ) ; if ( ast . apiLevel >= AST . JLS3 ) { this . typeArguments = new ASTNode . NodeList ( TYPE_ARGUMENTS_PROPERTY ) ; } } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == EXPRESSION_PROPERTY ) { if ( get ) { return getExpression ( ) ; } else { setExpression ( ( Expression ) child ) ; return null ; } } if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( Name ) child ) ; return null ; } } if ( property == TYPE_PROPERTY ) { if ( get ) { return getType ( ) ; } else { setType ( ( Type ) child ) ; return null ; } } if ( property == ANONYMOUS_CLASS_DECLARATION_PROPERTY ) { if ( get ) { return getAnonymousClassDeclaration ( ) ; } else { setAnonymousClassDeclaration ( ( AnonymousClassDeclaration ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == ARGUMENTS_PROPERTY ) { return arguments ( ) ; } if ( property == TYPE_ARGUMENTS_PROPERTY ) { return typeArguments ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return CLASS_INSTANCE_CREATION ; } ASTNode clone0 ( AST target ) { ClassInstanceCreation result = new ClassInstanceCreation ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setExpression ( ( Expression ) ASTNode . copySubtree ( target , getExpression ( ) ) ) ; if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { result . setName ( ( Name ) getName ( ) . clone ( target ) ) ; } if ( this . ast . apiLevel >= AST . JLS3 ) { result . typeArguments ( ) . addAll ( ASTNode . copySubtrees ( target , typeArguments ( ) ) ) ; result . setType ( ( Type ) getType ( ) . clone ( target ) ) ; } result . arguments ( ) . addAll ( ASTNode . copySubtrees ( target , arguments ( ) ) ) ; result . setAnonymousClassDeclaration ( ( AnonymousClassDeclaration ) ASTNode . copySubtree ( target , getAnonymousClassDeclaration ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getExpression ( ) ) ; if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { acceptChild ( visitor , getName ( ) ) ; } if ( this . ast . apiLevel >= AST . JLS3 ) { acceptChildren ( visitor , this . typeArguments ) ; acceptChild ( visitor , getType ( ) ) ; } acceptChildren ( visitor , this . arguments ) ; acceptChild ( visitor , getAnonymousClassDeclaration ( ) ) ; } visitor . endVisit ( this ) ; } public Expression getExpression ( ) { return this . optionalExpression ; } public void setExpression ( Expression expression ) { ASTNode oldChild = this . optionalExpression ; preReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; this . optionalExpression = expression ; postReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; } public List typeArguments ( ) { if ( this . typeArguments == null ) { unsupportedIn2 ( ) ; } return this . typeArguments ; } public Name getName ( ) { return internalGetName ( ) ; } Name internalGetName ( ) { supportedOnlyIn2 ( ) ; if ( this . typeName == null ) { synchronized ( this ) { if ( this . typeName == null ) { preLazyInit ( ) ; this . typeName = new SimpleName ( this . ast ) ; postLazyInit ( this . typeName , NAME_PROPERTY ) ; } } } return this . typeName ; } public void setName ( Name name ) { internalSetName ( name ) ; } void internalSetName ( Name name ) { supportedOnlyIn2 ( ) ; if ( name == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . typeName ; preReplaceChild ( oldChild , name , NAME_PROPERTY ) ; this . typeName = name ; postReplaceChild ( oldChild , name , NAME_PROPERTY ) ; } public Type getType ( ) { unsupportedIn2 ( ) ; if ( this . type == null ) { synchronized ( this ) { if ( this . type == null ) { preLazyInit ( ) ; this . type = new SimpleType ( this . ast ) ; postLazyInit ( this . type , TYPE_PROPERTY ) ; } } } return this . type ; } public void setType ( Type type ) { unsupportedIn2 ( ) ; if ( type == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . type ; preReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; this . type = type ; postReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; } public List arguments ( ) { return this . arguments ; } public AnonymousClassDeclaration getAnonymousClassDeclaration ( ) { return this . optionalAnonymousClassDeclaration ; } public void setAnonymousClassDeclaration ( AnonymousClassDeclaration decl ) { ASTNode oldChild = this . optionalAnonymousClassDeclaration ; preReplaceChild ( oldChild , decl , ANONYMOUS_CLASS_DECLARATION_PROPERTY ) ; this . optionalAnonymousClassDeclaration = decl ; postReplaceChild ( oldChild , decl , ANONYMOUS_CLASS_DECLARATION_PROPERTY ) ; } public IMethodBinding resolveConstructorBinding ( ) { return this . ast . getBindingResolver ( ) . resolveConstructor ( this ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:6> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . typeName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) + ( this . type == null ? <NUM_LIT:0> : getType ( ) . treeSize ( ) ) + ( this . optionalExpression == null ? <NUM_LIT:0> : getExpression ( ) . treeSize ( ) ) + ( this . typeArguments == null ? <NUM_LIT:0> : this . typeArguments . listSize ( ) ) + ( this . arguments == null ? <NUM_LIT:0> : this . arguments . listSize ( ) ) + ( this . optionalAnonymousClassDeclaration == null ? <NUM_LIT:0> : getAnonymousClassDeclaration ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class BreakStatement extends Statement { public static final ChildPropertyDescriptor LABEL_PROPERTY = new ChildPropertyDescriptor ( BreakStatement . class , "<STR_LIT:label>" , SimpleName . class , OPTIONAL , NO_CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( BreakStatement . class , properyList ) ; addProperty ( LABEL_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private SimpleName optionalLabel = null ; BreakStatement ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == LABEL_PROPERTY ) { if ( get ) { return getLabel ( ) ; } else { setLabel ( ( SimpleName ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return BREAK_STATEMENT ; } ASTNode clone0 ( AST target ) { BreakStatement result = new BreakStatement ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; result . setLabel ( ( SimpleName ) ASTNode . copySubtree ( target , getLabel ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getLabel ( ) ) ; } visitor . endVisit ( this ) ; } public SimpleName getLabel ( ) { return this . optionalLabel ; } public void setLabel ( SimpleName label ) { ASTNode oldChild = this . optionalLabel ; preReplaceChild ( oldChild , label , LABEL_PROPERTY ) ; this . optionalLabel = label ; postReplaceChild ( oldChild , label , LABEL_PROPERTY ) ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:1> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalLabel == null ? <NUM_LIT:0> : getLabel ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; public abstract class VariableDeclaration extends ASTNode { abstract SimplePropertyDescriptor internalExtraDimensionsProperty ( ) ; public final SimplePropertyDescriptor getExtraDimensionsProperty ( ) { return internalExtraDimensionsProperty ( ) ; } abstract ChildPropertyDescriptor internalInitializerProperty ( ) ; public final ChildPropertyDescriptor getInitializerProperty ( ) { return internalInitializerProperty ( ) ; } abstract ChildPropertyDescriptor internalNameProperty ( ) ; public final ChildPropertyDescriptor getNameProperty ( ) { return internalNameProperty ( ) ; } VariableDeclaration ( AST ast ) { super ( ast ) ; } public abstract SimpleName getName ( ) ; public abstract void setName ( SimpleName variableName ) ; public abstract int getExtraDimensions ( ) ; public abstract void setExtraDimensions ( int dimensions ) ; public abstract Expression getInitializer ( ) ; public abstract void setInitializer ( Expression initializer ) ; public IVariableBinding resolveBinding ( ) { return this . ast . getBindingResolver ( ) . resolveVariable ( this ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class ArrayType extends Type { public static final ChildPropertyDescriptor COMPONENT_TYPE_PROPERTY = new ChildPropertyDescriptor ( ArrayType . class , "<STR_LIT>" , Type . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( ArrayType . class , properyList ) ; addProperty ( COMPONENT_TYPE_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Type componentType = null ; ArrayType ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == COMPONENT_TYPE_PROPERTY ) { if ( get ) { return getComponentType ( ) ; } else { setComponentType ( ( Type ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return ARRAY_TYPE ; } ASTNode clone0 ( AST target ) { ArrayType result = new ArrayType ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setComponentType ( ( Type ) getComponentType ( ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getComponentType ( ) ) ; } visitor . endVisit ( this ) ; } public Type getComponentType ( ) { if ( this . componentType == null ) { synchronized ( this ) { if ( this . componentType == null ) { preLazyInit ( ) ; this . componentType = new SimpleType ( this . ast ) ; postLazyInit ( this . componentType , COMPONENT_TYPE_PROPERTY ) ; } } } return this . componentType ; } public void setComponentType ( Type componentType ) { if ( componentType == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . componentType ; preReplaceChild ( oldChild , componentType , COMPONENT_TYPE_PROPERTY ) ; this . componentType = componentType ; postReplaceChild ( oldChild , componentType , COMPONENT_TYPE_PROPERTY ) ; } public Type getElementType ( ) { Type t = getComponentType ( ) ; while ( t . isArrayType ( ) ) { t = ( ( ArrayType ) t ) . getComponentType ( ) ; } return t ; } public int getDimensions ( ) { Type t = getComponentType ( ) ; int dimensions = <NUM_LIT:1> ; while ( t . isArrayType ( ) ) { dimensions ++ ; t = ( ( ArrayType ) t ) . getComponentType ( ) ; } return dimensions ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:1> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . componentType == null ? <NUM_LIT:0> : getComponentType ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; public abstract class Annotation extends Expression implements IExtendedModifier { abstract ChildPropertyDescriptor internalTypeNameProperty ( ) ; public final ChildPropertyDescriptor getTypeNameProperty ( ) { return internalTypeNameProperty ( ) ; } static final ChildPropertyDescriptor internalTypeNamePropertyFactory ( Class nodeClass ) { return new ChildPropertyDescriptor ( nodeClass , "<STR_LIT>" , Name . class , MANDATORY , NO_CYCLE_RISK ) ; } Name typeName = null ; Annotation ( AST ast ) { super ( ast ) ; } public boolean isModifier ( ) { return false ; } public boolean isAnnotation ( ) { return true ; } public Name getTypeName ( ) { if ( this . typeName == null ) { synchronized ( this ) { if ( this . typeName == null ) { preLazyInit ( ) ; this . typeName = new SimpleName ( this . ast ) ; postLazyInit ( this . typeName , internalTypeNameProperty ( ) ) ; } } } return this . typeName ; } public void setTypeName ( Name typeName ) { if ( typeName == null ) { throw new IllegalArgumentException ( ) ; } ChildPropertyDescriptor p = internalTypeNameProperty ( ) ; ASTNode oldChild = this . typeName ; preReplaceChild ( oldChild , typeName , p ) ; this . typeName = typeName ; postReplaceChild ( oldChild , typeName , p ) ; } public boolean isNormalAnnotation ( ) { return ( this instanceof NormalAnnotation ) ; } public boolean isMarkerAnnotation ( ) { return ( this instanceof MarkerAnnotation ) ; } public boolean isSingleMemberAnnotation ( ) { return ( this instanceof SingleMemberAnnotation ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:1> * <NUM_LIT:4> ; } public IAnnotationBinding resolveAnnotationBinding ( ) { return this . ast . getBindingResolver ( ) . resolveAnnotation ( this ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class CatchClause extends ASTNode { public static final ChildPropertyDescriptor EXCEPTION_PROPERTY = new ChildPropertyDescriptor ( CatchClause . class , "<STR_LIT>" , SingleVariableDeclaration . class , MANDATORY , CYCLE_RISK ) ; public static final ChildPropertyDescriptor BODY_PROPERTY = new ChildPropertyDescriptor ( CatchClause . class , "<STR_LIT:body>" , Block . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( CatchClause . class , properyList ) ; addProperty ( EXCEPTION_PROPERTY , properyList ) ; addProperty ( BODY_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Block body = null ; private SingleVariableDeclaration exceptionDecl = null ; CatchClause ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == EXCEPTION_PROPERTY ) { if ( get ) { return getException ( ) ; } else { setException ( ( SingleVariableDeclaration ) child ) ; return null ; } } if ( property == BODY_PROPERTY ) { if ( get ) { return getBody ( ) ; } else { setBody ( ( Block ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return CATCH_CLAUSE ; } ASTNode clone0 ( AST target ) { CatchClause result = new CatchClause ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setBody ( ( Block ) getBody ( ) . clone ( target ) ) ; result . setException ( ( SingleVariableDeclaration ) ASTNode . copySubtree ( target , getException ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getException ( ) ) ; acceptChild ( visitor , getBody ( ) ) ; } visitor . endVisit ( this ) ; } public SingleVariableDeclaration getException ( ) { if ( this . exceptionDecl == null ) { synchronized ( this ) { if ( this . exceptionDecl == null ) { preLazyInit ( ) ; this . exceptionDecl = new SingleVariableDeclaration ( this . ast ) ; postLazyInit ( this . exceptionDecl , EXCEPTION_PROPERTY ) ; } } } return this . exceptionDecl ; } public void setException ( SingleVariableDeclaration exception ) { if ( exception == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . exceptionDecl ; preReplaceChild ( oldChild , exception , EXCEPTION_PROPERTY ) ; this . exceptionDecl = exception ; postReplaceChild ( oldChild , exception , EXCEPTION_PROPERTY ) ; } public Block getBody ( ) { if ( this . body == null ) { synchronized ( this ) { if ( this . body == null ) { preLazyInit ( ) ; this . body = new Block ( this . ast ) ; postLazyInit ( this . body , BODY_PROPERTY ) ; } } } return this . body ; } public void setBody ( Block body ) { if ( body == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . body ; preReplaceChild ( oldChild , body , BODY_PROPERTY ) ; this . body = body ; postReplaceChild ( oldChild , body , BODY_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . exceptionDecl == null ? <NUM_LIT:0> : getException ( ) . treeSize ( ) ) + ( this . body == null ? <NUM_LIT:0> : getBody ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . jdt . core . compiler . InvalidInputException ; import org . eclipse . jdt . internal . compiler . parser . Scanner ; import org . eclipse . jdt . internal . compiler . parser . TerminalTokens ; public class SimpleName extends Name { public static final SimplePropertyDescriptor IDENTIFIER_PROPERTY = new SimplePropertyDescriptor ( SimpleName . class , "<STR_LIT>" , String . class , MANDATORY ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( SimpleName . class , propertyList ) ; addProperty ( IDENTIFIER_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private static final String MISSING_IDENTIFIER = "<STR_LIT>" ; private String identifier = MISSING_IDENTIFIER ; SimpleName ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final Object internalGetSetObjectProperty ( SimplePropertyDescriptor property , boolean get , Object value ) { if ( property == IDENTIFIER_PROPERTY ) { if ( get ) { return getIdentifier ( ) ; } else { setIdentifier ( ( String ) value ) ; return null ; } } return super . internalGetSetObjectProperty ( property , get , value ) ; } final int getNodeType0 ( ) { return SIMPLE_NAME ; } ASTNode clone0 ( AST target ) { SimpleName result = new SimpleName ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setIdentifier ( getIdentifier ( ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { visitor . visit ( this ) ; visitor . endVisit ( this ) ; } public String getIdentifier ( ) { return this . identifier ; } public void setIdentifier ( String identifier ) { if ( identifier == null ) { throw new IllegalArgumentException ( ) ; } Scanner scanner = this . ast . scanner ; char [ ] source = identifier . toCharArray ( ) ; scanner . setSource ( source ) ; final int length = source . length ; scanner . resetTo ( <NUM_LIT:0> , length - <NUM_LIT:1> ) ; try { int tokenType = scanner . scanIdentifier ( ) ; if ( tokenType != TerminalTokens . TokenNameIdentifier ) { throw new IllegalArgumentException ( ) ; } if ( scanner . currentPosition != length ) { throw new IllegalArgumentException ( ) ; } } catch ( InvalidInputException e ) { throw new IllegalArgumentException ( ) ; } preValueChange ( IDENTIFIER_PROPERTY ) ; this . identifier = identifier ; postValueChange ( IDENTIFIER_PROPERTY ) ; } void internalSetIdentifier ( String ident ) { preValueChange ( IDENTIFIER_PROPERTY ) ; this . identifier = ident ; postValueChange ( IDENTIFIER_PROPERTY ) ; } public boolean isDeclaration ( ) { StructuralPropertyDescriptor d = getLocationInParent ( ) ; if ( d == null ) { return false ; } ASTNode parent = getParent ( ) ; if ( parent instanceof TypeDeclaration ) { return ( d == TypeDeclaration . NAME_PROPERTY ) ; } if ( parent instanceof MethodDeclaration ) { MethodDeclaration p = ( MethodDeclaration ) parent ; return ! p . isConstructor ( ) && ( d == MethodDeclaration . NAME_PROPERTY ) ; } if ( parent instanceof SingleVariableDeclaration ) { return ( d == SingleVariableDeclaration . NAME_PROPERTY ) ; } if ( parent instanceof VariableDeclarationFragment ) { return ( d == VariableDeclarationFragment . NAME_PROPERTY ) ; } if ( parent instanceof EnumDeclaration ) { return ( d == EnumDeclaration . NAME_PROPERTY ) ; } if ( parent instanceof EnumConstantDeclaration ) { return ( d == EnumConstantDeclaration . NAME_PROPERTY ) ; } if ( parent instanceof TypeParameter ) { return ( d == TypeParameter . NAME_PROPERTY ) ; } if ( parent instanceof AnnotationTypeDeclaration ) { return ( d == AnnotationTypeDeclaration . NAME_PROPERTY ) ; } if ( parent instanceof AnnotationTypeMemberDeclaration ) { return ( d == AnnotationTypeMemberDeclaration . NAME_PROPERTY ) ; } return false ; } void appendName ( StringBuffer buffer ) { buffer . append ( getIdentifier ( ) ) ; } int memSize ( ) { int size = BASE_NAME_NODE_SIZE + <NUM_LIT:2> * <NUM_LIT:4> ; if ( this . identifier != MISSING_IDENTIFIER ) { size += stringSize ( this . identifier ) ; } return size ; } int treeSize ( ) { return memSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . io . PrintWriter ; import java . io . StringWriter ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jdt . core . IClassFile ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . ITypeRoot ; import org . eclipse . jdt . core . IJavaProject ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . WorkingCopyOwner ; import org . eclipse . jdt . core . compiler . CategorizedProblem ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ast . CompilationUnitDeclaration ; import org . eclipse . jdt . internal . compiler . ast . ConstructorDeclaration ; import org . eclipse . jdt . internal . compiler . batch . Main ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . compiler . parser . RecoveryScanner ; import org . eclipse . jdt . internal . compiler . parser . RecoveryScannerData ; import org . eclipse . jdt . internal . compiler . parser . Scanner ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . core . * ; import org . eclipse . jdt . internal . core . util . CodeSnippetParsingUtil ; import org . eclipse . jdt . internal . core . util . RecordedParsingInformation ; import org . eclipse . jdt . internal . core . util . Util ; public class ASTParser { public static final int K_EXPRESSION = <NUM_LIT> ; public static final int K_STATEMENTS = <NUM_LIT> ; public static final int K_CLASS_BODY_DECLARATIONS = <NUM_LIT> ; public static final int K_COMPILATION_UNIT = <NUM_LIT> ; public static ASTParser newParser ( int level ) { return new ASTParser ( level ) ; } private final int apiLevel ; private int astKind ; private Map compilerOptions ; private int focalPointPosition ; private char [ ] rawSource = null ; private ITypeRoot typeRoot = null ; private int sourceOffset = <NUM_LIT:0> ; private int sourceLength = - <NUM_LIT:1> ; private WorkingCopyOwner workingCopyOwner = DefaultWorkingCopyOwner . PRIMARY ; private IJavaProject project = null ; private String unitName = null ; private String [ ] classpaths ; private String [ ] sourcepaths ; private String [ ] sourcepathsEncodings ; private int bits ; ASTParser ( int level ) { if ( ( level != AST . JLS2_INTERNAL ) && ( level != AST . JLS3 ) ) { throw new IllegalArgumentException ( ) ; } this . apiLevel = level ; initializeDefaults ( ) ; } private List getClasspath ( ) throws IllegalStateException { Main main = new Main ( new PrintWriter ( System . out ) , new PrintWriter ( System . err ) , false , null , null ) ; ArrayList allClasspaths = new ArrayList ( ) ; try { if ( ( this . bits & CompilationUnitResolver . INCLUDE_RUNNING_VM_BOOTCLASSPATH ) != <NUM_LIT:0> ) { org . eclipse . jdt . internal . compiler . util . Util . collectRunningVMBootclasspath ( allClasspaths ) ; } if ( this . sourcepaths != null ) { for ( int i = <NUM_LIT:0> , max = this . sourcepaths . length ; i < max ; i ++ ) { String encoding = this . sourcepathsEncodings == null ? null : this . sourcepathsEncodings [ i ] ; main . processPathEntries ( Main . DEFAULT_SIZE_CLASSPATH , allClasspaths , this . sourcepaths [ i ] , encoding , true , false ) ; } } if ( this . classpaths != null ) { for ( int i = <NUM_LIT:0> , max = this . classpaths . length ; i < max ; i ++ ) { main . processPathEntries ( Main . DEFAULT_SIZE_CLASSPATH , allClasspaths , this . classpaths [ i ] , null , false , false ) ; } } ArrayList pendingErrors = main . pendingErrors ; if ( pendingErrors != null && pendingErrors . size ( ) != <NUM_LIT:0> ) { throw new IllegalStateException ( "<STR_LIT>" ) ; } } catch ( IllegalArgumentException e ) { throw new IllegalStateException ( "<STR_LIT>" ) ; } return allClasspaths ; } private void initializeDefaults ( ) { this . astKind = K_COMPILATION_UNIT ; this . rawSource = null ; this . typeRoot = null ; this . bits = <NUM_LIT:0> ; this . sourceLength = - <NUM_LIT:1> ; this . sourceOffset = <NUM_LIT:0> ; this . workingCopyOwner = DefaultWorkingCopyOwner . PRIMARY ; this . unitName = null ; this . project = null ; this . classpaths = null ; this . sourcepaths = null ; this . sourcepathsEncodings = null ; Map options = JavaCore . getOptions ( ) ; options . remove ( JavaCore . COMPILER_TASK_TAGS ) ; this . compilerOptions = options ; } public void setBindingsRecovery ( boolean enabled ) { if ( enabled ) { this . bits |= CompilationUnitResolver . BINDING_RECOVERY ; } else { this . bits &= ~ CompilationUnitResolver . BINDING_RECOVERY ; } } public void setEnvironment ( String [ ] classpathEntries , String [ ] sourcepathEntries , String [ ] encodings , boolean includeRunningVMBootclasspath ) { this . classpaths = classpathEntries ; this . sourcepaths = sourcepathEntries ; this . sourcepathsEncodings = encodings ; if ( encodings != null ) { if ( sourcepathEntries == null || sourcepathEntries . length != encodings . length ) { throw new IllegalArgumentException ( ) ; } } this . bits |= CompilationUnitResolver . INCLUDE_RUNNING_VM_BOOTCLASSPATH ; } public void setCompilerOptions ( Map options ) { if ( options == null ) { options = JavaCore . getOptions ( ) ; } else { options = new HashMap ( options ) ; } options . remove ( JavaCore . COMPILER_TASK_TAGS ) ; this . compilerOptions = options ; } public void setResolveBindings ( boolean enabled ) { if ( enabled ) { this . bits |= CompilationUnitResolver . RESOLVE_BINDING ; } else { this . bits &= ~ CompilationUnitResolver . RESOLVE_BINDING ; } } public void setFocalPosition ( int position ) { this . bits |= CompilationUnitResolver . PARTIAL ; this . focalPointPosition = position ; } public void setKind ( int kind ) { if ( ( kind != K_COMPILATION_UNIT ) && ( kind != K_CLASS_BODY_DECLARATIONS ) && ( kind != K_EXPRESSION ) && ( kind != K_STATEMENTS ) ) { throw new IllegalArgumentException ( ) ; } this . astKind = kind ; } public void setSource ( char [ ] source ) { this . rawSource = source ; this . typeRoot = null ; } public void setSource ( ICompilationUnit source ) { setSource ( ( ITypeRoot ) source ) ; } public void setSource ( IClassFile source ) { setSource ( ( ITypeRoot ) source ) ; } public void setSource ( ITypeRoot source ) { this . typeRoot = source ; this . rawSource = null ; if ( source != null ) { this . project = source . getJavaProject ( ) ; Map options = this . project . getOptions ( true ) ; options . remove ( JavaCore . COMPILER_TASK_TAGS ) ; this . compilerOptions = options ; } } public void setSourceRange ( int offset , int length ) { if ( offset < <NUM_LIT:0> || length < - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } this . sourceOffset = offset ; this . sourceLength = length ; } public void setStatementsRecovery ( boolean enabled ) { if ( enabled ) { this . bits |= CompilationUnitResolver . STATEMENT_RECOVERY ; } else { this . bits &= ~ CompilationUnitResolver . STATEMENT_RECOVERY ; } } public void setIgnoreMethodBodies ( boolean enabled ) { if ( enabled ) { this . bits |= CompilationUnitResolver . IGNORE_METHOD_BODIES ; } else { this . bits &= ~ CompilationUnitResolver . IGNORE_METHOD_BODIES ; } } public void setWorkingCopyOwner ( WorkingCopyOwner owner ) { if ( owner == null ) { this . workingCopyOwner = DefaultWorkingCopyOwner . PRIMARY ; } else { this . workingCopyOwner = owner ; } } public void setUnitName ( String unitName ) { this . unitName = unitName ; } public void setProject ( IJavaProject project ) { this . project = project ; if ( project != null ) { Map options = project . getOptions ( true ) ; options . remove ( JavaCore . COMPILER_TASK_TAGS ) ; this . compilerOptions = options ; } } public ASTNode createAST ( IProgressMonitor monitor ) { ASTNode result = null ; if ( monitor != null ) monitor . beginTask ( "<STR_LIT>" , <NUM_LIT:1> ) ; try { if ( this . rawSource == null && this . typeRoot == null ) { throw new IllegalStateException ( "<STR_LIT>" ) ; } result = internalCreateAST ( monitor ) ; } finally { initializeDefaults ( ) ; if ( monitor != null ) monitor . done ( ) ; } return result ; } public void createASTs ( ICompilationUnit [ ] compilationUnits , String [ ] bindingKeys , ASTRequestor requestor , IProgressMonitor monitor ) { try { int flags = <NUM_LIT:0> ; if ( ( this . bits & CompilationUnitResolver . STATEMENT_RECOVERY ) != <NUM_LIT:0> ) { flags |= ICompilationUnit . ENABLE_STATEMENTS_RECOVERY ; } if ( ( this . bits & CompilationUnitResolver . IGNORE_METHOD_BODIES ) != <NUM_LIT:0> ) { flags |= ICompilationUnit . IGNORE_METHOD_BODIES ; } if ( ( this . bits & CompilationUnitResolver . RESOLVE_BINDING ) != <NUM_LIT:0> ) { if ( this . project == null ) throw new IllegalStateException ( "<STR_LIT>" ) ; if ( ( this . bits & CompilationUnitResolver . BINDING_RECOVERY ) != <NUM_LIT:0> ) { flags |= ICompilationUnit . ENABLE_BINDINGS_RECOVERY ; } CompilationUnitResolver . resolve ( compilationUnits , bindingKeys , requestor , this . apiLevel , this . compilerOptions , this . project , this . workingCopyOwner , flags , monitor ) ; } else { CompilationUnitResolver . parse ( compilationUnits , requestor , this . apiLevel , this . compilerOptions , flags , monitor ) ; } } finally { initializeDefaults ( ) ; } } public void createASTs ( String [ ] sourceFilePaths , String [ ] encodings , String [ ] bindingKeys , FileASTRequestor requestor , IProgressMonitor monitor ) { try { int flags = <NUM_LIT:0> ; if ( ( this . bits & CompilationUnitResolver . STATEMENT_RECOVERY ) != <NUM_LIT:0> ) { flags |= ICompilationUnit . ENABLE_STATEMENTS_RECOVERY ; } if ( ( this . bits & CompilationUnitResolver . IGNORE_METHOD_BODIES ) != <NUM_LIT:0> ) { flags |= ICompilationUnit . IGNORE_METHOD_BODIES ; } if ( ( this . bits & CompilationUnitResolver . RESOLVE_BINDING ) != <NUM_LIT:0> ) { if ( this . classpaths == null && this . sourcepaths == null && ( ( this . bits & CompilationUnitResolver . INCLUDE_RUNNING_VM_BOOTCLASSPATH ) == <NUM_LIT:0> ) ) { throw new IllegalStateException ( "<STR_LIT>" ) ; } if ( ( this . bits & CompilationUnitResolver . BINDING_RECOVERY ) != <NUM_LIT:0> ) { flags |= ICompilationUnit . ENABLE_BINDINGS_RECOVERY ; } CompilationUnitResolver . resolve ( sourceFilePaths , encodings , bindingKeys , requestor , this . apiLevel , this . compilerOptions , getClasspath ( ) , flags , monitor ) ; } else { CompilationUnitResolver . parse ( sourceFilePaths , encodings , requestor , this . apiLevel , this . compilerOptions , flags , monitor ) ; } } finally { initializeDefaults ( ) ; } } public IBinding [ ] createBindings ( IJavaElement [ ] elements , IProgressMonitor monitor ) { try { if ( this . project == null ) throw new IllegalStateException ( "<STR_LIT>" ) ; int flags = <NUM_LIT:0> ; if ( ( this . bits & CompilationUnitResolver . STATEMENT_RECOVERY ) != <NUM_LIT:0> ) { flags |= ICompilationUnit . ENABLE_STATEMENTS_RECOVERY ; } if ( ( this . bits & CompilationUnitResolver . BINDING_RECOVERY ) != <NUM_LIT:0> ) { flags |= ICompilationUnit . ENABLE_BINDINGS_RECOVERY ; } if ( ( this . bits & CompilationUnitResolver . IGNORE_METHOD_BODIES ) != <NUM_LIT:0> ) { flags |= ICompilationUnit . IGNORE_METHOD_BODIES ; } return CompilationUnitResolver . resolve ( elements , this . apiLevel , this . compilerOptions , this . project , this . workingCopyOwner , flags , monitor ) ; } finally { initializeDefaults ( ) ; } } private ASTNode internalCreateAST ( IProgressMonitor monitor ) { boolean needToResolveBindings = ( this . bits & CompilationUnitResolver . RESOLVE_BINDING ) != <NUM_LIT:0> ; switch ( this . astKind ) { case K_CLASS_BODY_DECLARATIONS : case K_EXPRESSION : case K_STATEMENTS : if ( this . rawSource == null ) { if ( this . typeRoot != null ) { if ( this . typeRoot instanceof ICompilationUnit ) { org . eclipse . jdt . internal . compiler . env . ICompilationUnit sourceUnit = ( org . eclipse . jdt . internal . compiler . env . ICompilationUnit ) this . typeRoot ; this . rawSource = sourceUnit . getContents ( ) ; } else if ( this . typeRoot instanceof IClassFile ) { try { String sourceString = this . typeRoot . getSource ( ) ; if ( sourceString != null ) { this . rawSource = sourceString . toCharArray ( ) ; } } catch ( JavaModelException e ) { StringWriter stringWriter = new StringWriter ( ) ; PrintWriter writer = null ; try { writer = new PrintWriter ( stringWriter ) ; e . printStackTrace ( writer ) ; } finally { if ( writer != null ) writer . close ( ) ; } throw new IllegalStateException ( String . valueOf ( stringWriter . getBuffer ( ) ) ) ; } } } } if ( this . rawSource != null ) { if ( this . sourceOffset + this . sourceLength > this . rawSource . length ) { throw new IllegalStateException ( ) ; } return internalCreateASTForKind ( ) ; } break ; case K_COMPILATION_UNIT : CompilationUnitDeclaration compilationUnitDeclaration = null ; try { NodeSearcher searcher = null ; org . eclipse . jdt . internal . compiler . env . ICompilationUnit sourceUnit = null ; WorkingCopyOwner wcOwner = this . workingCopyOwner ; if ( this . typeRoot instanceof ICompilationUnit ) { sourceUnit = ( org . eclipse . jdt . internal . compiler . env . ICompilationUnit ) this . typeRoot ; sourceUnit = new BasicCompilationUnit ( sourceUnit . getContents ( ) , sourceUnit . getPackageName ( ) , new String ( sourceUnit . getFileName ( ) ) , this . project ) ; wcOwner = ( ( ICompilationUnit ) this . typeRoot ) . getOwner ( ) ; } else if ( this . typeRoot instanceof IClassFile ) { try { String sourceString = this . typeRoot . getSource ( ) ; if ( sourceString == null ) { throw new IllegalStateException ( ) ; } PackageFragment packageFragment = ( PackageFragment ) this . typeRoot . getParent ( ) ; BinaryType type = ( BinaryType ) this . typeRoot . findPrimaryType ( ) ; IBinaryType binaryType = ( IBinaryType ) type . getElementInfo ( ) ; char [ ] fileName = binaryType . getFileName ( ) ; int firstDollar = CharOperation . indexOf ( '<CHAR_LIT>' , fileName ) ; if ( firstDollar != - <NUM_LIT:1> ) { char [ ] suffix = SuffixConstants . SUFFIX_class ; int suffixLength = suffix . length ; char [ ] newFileName = new char [ firstDollar + suffixLength ] ; System . arraycopy ( fileName , <NUM_LIT:0> , newFileName , <NUM_LIT:0> , firstDollar ) ; System . arraycopy ( suffix , <NUM_LIT:0> , newFileName , firstDollar , suffixLength ) ; fileName = newFileName ; } sourceUnit = new BasicCompilationUnit ( sourceString . toCharArray ( ) , Util . toCharArrays ( packageFragment . names ) , new String ( fileName ) , this . project ) ; } catch ( JavaModelException e ) { StringWriter stringWriter = new StringWriter ( ) ; PrintWriter writer = null ; try { writer = new PrintWriter ( stringWriter ) ; e . printStackTrace ( writer ) ; } finally { if ( writer != null ) writer . close ( ) ; } throw new IllegalStateException ( String . valueOf ( stringWriter . getBuffer ( ) ) ) ; } } else if ( this . rawSource != null ) { needToResolveBindings = ( ( this . bits & CompilationUnitResolver . RESOLVE_BINDING ) != <NUM_LIT:0> ) && this . unitName != null && ( this . project != null || this . classpaths != null || this . sourcepaths != null || ( ( this . bits & CompilationUnitResolver . INCLUDE_RUNNING_VM_BOOTCLASSPATH ) != <NUM_LIT:0> ) ) && this . compilerOptions != null ; sourceUnit = new BasicCompilationUnit ( this . rawSource , null , this . unitName == null ? "<STR_LIT>" : this . unitName , this . project ) ; } else { throw new IllegalStateException ( ) ; } if ( ( this . bits & CompilationUnitResolver . PARTIAL ) != <NUM_LIT:0> ) { searcher = new NodeSearcher ( this . focalPointPosition ) ; } int flags = <NUM_LIT:0> ; if ( ( this . bits & CompilationUnitResolver . STATEMENT_RECOVERY ) != <NUM_LIT:0> ) { flags |= ICompilationUnit . ENABLE_STATEMENTS_RECOVERY ; } if ( searcher == null && ( ( this . bits & CompilationUnitResolver . IGNORE_METHOD_BODIES ) != <NUM_LIT:0> ) ) { flags |= ICompilationUnit . IGNORE_METHOD_BODIES ; } if ( needToResolveBindings ) { if ( ( this . bits & CompilationUnitResolver . BINDING_RECOVERY ) != <NUM_LIT:0> ) { flags |= ICompilationUnit . ENABLE_BINDINGS_RECOVERY ; } try { compilationUnitDeclaration = CompilationUnitResolver . resolve ( sourceUnit , this . project , getClasspath ( ) , searcher , this . compilerOptions , this . workingCopyOwner , flags , monitor ) ; } catch ( JavaModelException e ) { flags &= ~ ICompilationUnit . ENABLE_BINDINGS_RECOVERY ; compilationUnitDeclaration = CompilationUnitResolver . parse ( sourceUnit , searcher , this . compilerOptions , flags ) ; needToResolveBindings = false ; } } else { compilationUnitDeclaration = CompilationUnitResolver . parse ( sourceUnit , searcher , this . compilerOptions , flags ) ; needToResolveBindings = false ; } CompilationUnit result = CompilationUnitResolver . convert ( compilationUnitDeclaration , sourceUnit . getContents ( ) , this . apiLevel , this . compilerOptions , needToResolveBindings , wcOwner , needToResolveBindings ? new DefaultBindingResolver . BindingTables ( ) : null , flags , monitor , this . project != null ) ; result . setTypeRoot ( this . typeRoot ) ; return result ; } finally { if ( compilationUnitDeclaration != null && ( ( this . bits & CompilationUnitResolver . RESOLVE_BINDING ) != <NUM_LIT:0> ) ) { compilationUnitDeclaration . cleanUp ( ) ; } } } throw new IllegalStateException ( ) ; } private ASTNode internalCreateASTForKind ( ) { final ASTConverter converter = new ASTConverter ( this . compilerOptions , false , null ) ; converter . compilationUnitSource = this . rawSource ; converter . compilationUnitSourceLength = this . rawSource . length ; converter . scanner . setSource ( this . rawSource ) ; AST ast = AST . newAST ( this . apiLevel ) ; ast . setDefaultNodeFlag ( ASTNode . ORIGINAL ) ; ast . setBindingResolver ( new BindingResolver ( ) ) ; if ( ( this . bits & CompilationUnitResolver . STATEMENT_RECOVERY ) != <NUM_LIT:0> ) { ast . setFlag ( ICompilationUnit . ENABLE_STATEMENTS_RECOVERY ) ; } converter . setAST ( ast ) ; CodeSnippetParsingUtil codeSnippetParsingUtil = new CodeSnippetParsingUtil ( ( this . bits & CompilationUnitResolver . IGNORE_METHOD_BODIES ) != <NUM_LIT:0> ) ; CompilationUnit compilationUnit = ast . newCompilationUnit ( ) ; if ( this . sourceLength == - <NUM_LIT:1> ) { this . sourceLength = this . rawSource . length ; } switch ( this . astKind ) { case K_STATEMENTS : ConstructorDeclaration constructorDeclaration = codeSnippetParsingUtil . parseStatements ( this . rawSource , this . sourceOffset , this . sourceLength , this . compilerOptions , true , ( this . bits & CompilationUnitResolver . STATEMENT_RECOVERY ) != <NUM_LIT:0> ) ; RecoveryScannerData data = constructorDeclaration . compilationResult . recoveryScannerData ; if ( data != null ) { Scanner scanner = converter . scanner ; converter . scanner = new RecoveryScanner ( scanner , data . removeUnused ( ) ) ; converter . docParser . scanner = converter . scanner ; converter . scanner . setSource ( scanner . source ) ; compilationUnit . setStatementsRecoveryData ( data ) ; } RecordedParsingInformation recordedParsingInformation = codeSnippetParsingUtil . recordedParsingInformation ; int [ ] [ ] comments = recordedParsingInformation . commentPositions ; if ( comments != null ) { converter . buildCommentsTable ( compilationUnit , comments ) ; } compilationUnit . setLineEndTable ( recordedParsingInformation . lineEnds ) ; Block block = ast . newBlock ( ) ; block . setSourceRange ( this . sourceOffset , this . sourceOffset + this . sourceLength ) ; org . eclipse . jdt . internal . compiler . ast . Statement [ ] statements = constructorDeclaration . statements ; if ( statements != null ) { int statementsLength = statements . length ; for ( int i = <NUM_LIT:0> ; i < statementsLength ; i ++ ) { if ( statements [ i ] instanceof org . eclipse . jdt . internal . compiler . ast . LocalDeclaration ) { converter . checkAndAddMultipleLocalDeclaration ( statements , i , block . statements ( ) ) ; } else { Statement statement = converter . convert ( statements [ i ] ) ; if ( statement != null ) { block . statements ( ) . add ( statement ) ; } } } } rootNodeToCompilationUnit ( ast , compilationUnit , block , recordedParsingInformation , data ) ; ast . setDefaultNodeFlag ( <NUM_LIT:0> ) ; ast . setOriginalModificationCount ( ast . modificationCount ( ) ) ; return block ; case K_EXPRESSION : org . eclipse . jdt . internal . compiler . ast . Expression expression = codeSnippetParsingUtil . parseExpression ( this . rawSource , this . sourceOffset , this . sourceLength , this . compilerOptions , true ) ; recordedParsingInformation = codeSnippetParsingUtil . recordedParsingInformation ; comments = recordedParsingInformation . commentPositions ; if ( comments != null ) { converter . buildCommentsTable ( compilationUnit , comments ) ; } compilationUnit . setLineEndTable ( recordedParsingInformation . lineEnds ) ; if ( expression != null ) { Expression expression2 = converter . convert ( expression ) ; rootNodeToCompilationUnit ( expression2 . getAST ( ) , compilationUnit , expression2 , codeSnippetParsingUtil . recordedParsingInformation , null ) ; ast . setDefaultNodeFlag ( <NUM_LIT:0> ) ; ast . setOriginalModificationCount ( ast . modificationCount ( ) ) ; return expression2 ; } else { CategorizedProblem [ ] problems = recordedParsingInformation . problems ; if ( problems != null ) { compilationUnit . setProblems ( problems ) ; } ast . setDefaultNodeFlag ( <NUM_LIT:0> ) ; ast . setOriginalModificationCount ( ast . modificationCount ( ) ) ; return compilationUnit ; } case K_CLASS_BODY_DECLARATIONS : final org . eclipse . jdt . internal . compiler . ast . ASTNode [ ] nodes = codeSnippetParsingUtil . parseClassBodyDeclarations ( this . rawSource , this . sourceOffset , this . sourceLength , this . compilerOptions , true , ( this . bits & CompilationUnitResolver . STATEMENT_RECOVERY ) != <NUM_LIT:0> ) ; recordedParsingInformation = codeSnippetParsingUtil . recordedParsingInformation ; comments = recordedParsingInformation . commentPositions ; if ( comments != null ) { converter . buildCommentsTable ( compilationUnit , comments ) ; } compilationUnit . setLineEndTable ( recordedParsingInformation . lineEnds ) ; if ( nodes != null ) { TypeDeclaration typeDeclaration = converter . convert ( nodes ) ; typeDeclaration . setSourceRange ( this . sourceOffset , this . sourceOffset + this . sourceLength ) ; rootNodeToCompilationUnit ( typeDeclaration . getAST ( ) , compilationUnit , typeDeclaration , codeSnippetParsingUtil . recordedParsingInformation , null ) ; ast . setDefaultNodeFlag ( <NUM_LIT:0> ) ; ast . setOriginalModificationCount ( ast . modificationCount ( ) ) ; return typeDeclaration ; } else { CategorizedProblem [ ] problems = recordedParsingInformation . problems ; if ( problems != null ) { compilationUnit . setProblems ( problems ) ; } ast . setDefaultNodeFlag ( <NUM_LIT:0> ) ; ast . setOriginalModificationCount ( ast . modificationCount ( ) ) ; return compilationUnit ; } } throw new IllegalStateException ( ) ; } private void propagateErrors ( ASTNode astNode , CategorizedProblem [ ] problems , RecoveryScannerData data ) { astNode . accept ( new ASTSyntaxErrorPropagator ( problems ) ) ; if ( data != null ) { astNode . accept ( new ASTRecoveryPropagator ( problems , data ) ) ; } } private void rootNodeToCompilationUnit ( AST ast , CompilationUnit compilationUnit , ASTNode node , RecordedParsingInformation recordedParsingInformation , RecoveryScannerData data ) { final int problemsCount = recordedParsingInformation . problemsCount ; switch ( node . getNodeType ( ) ) { case ASTNode . BLOCK : { Block block = ( Block ) node ; if ( problemsCount != <NUM_LIT:0> ) { final CategorizedProblem [ ] problems = recordedParsingInformation . problems ; propagateErrors ( block , problems , data ) ; compilationUnit . setProblems ( problems ) ; } TypeDeclaration typeDeclaration = ast . newTypeDeclaration ( ) ; Initializer initializer = ast . newInitializer ( ) ; initializer . setBody ( block ) ; typeDeclaration . bodyDeclarations ( ) . add ( initializer ) ; compilationUnit . types ( ) . add ( typeDeclaration ) ; } break ; case ASTNode . TYPE_DECLARATION : { TypeDeclaration typeDeclaration = ( TypeDeclaration ) node ; if ( problemsCount != <NUM_LIT:0> ) { final CategorizedProblem [ ] problems = recordedParsingInformation . problems ; propagateErrors ( typeDeclaration , problems , data ) ; compilationUnit . setProblems ( problems ) ; } compilationUnit . types ( ) . add ( typeDeclaration ) ; } break ; default : if ( node instanceof Expression ) { Expression expression = ( Expression ) node ; if ( problemsCount != <NUM_LIT:0> ) { final CategorizedProblem [ ] problems = recordedParsingInformation . problems ; propagateErrors ( expression , problems , data ) ; compilationUnit . setProblems ( problems ) ; } ExpressionStatement expressionStatement = ast . newExpressionStatement ( expression ) ; Block block = ast . newBlock ( ) ; block . statements ( ) . add ( expressionStatement ) ; Initializer initializer = ast . newInitializer ( ) ; initializer . setBody ( block ) ; TypeDeclaration typeDeclaration = ast . newTypeDeclaration ( ) ; typeDeclaration . bodyDeclarations ( ) . add ( initializer ) ; compilationUnit . types ( ) . add ( typeDeclaration ) ; } } } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class EnumConstantDeclaration extends BodyDeclaration { public static final ChildPropertyDescriptor JAVADOC_PROPERTY = internalJavadocPropertyFactory ( EnumConstantDeclaration . class ) ; public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY = internalModifiers2PropertyFactory ( EnumConstantDeclaration . class ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( EnumConstantDeclaration . class , "<STR_LIT:name>" , SimpleName . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor ( EnumConstantDeclaration . class , "<STR_LIT>" , Expression . class , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor ANONYMOUS_CLASS_DECLARATION_PROPERTY = new ChildPropertyDescriptor ( EnumConstantDeclaration . class , "<STR_LIT>" , AnonymousClassDeclaration . class , OPTIONAL , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:6> ) ; createPropertyList ( EnumConstantDeclaration . class , properyList ) ; addProperty ( JAVADOC_PROPERTY , properyList ) ; addProperty ( MODIFIERS2_PROPERTY , properyList ) ; addProperty ( NAME_PROPERTY , properyList ) ; addProperty ( ARGUMENTS_PROPERTY , properyList ) ; addProperty ( ANONYMOUS_CLASS_DECLARATION_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private SimpleName constantName = null ; private ASTNode . NodeList arguments = new ASTNode . NodeList ( ARGUMENTS_PROPERTY ) ; private AnonymousClassDeclaration optionalAnonymousClassDeclaration = null ; EnumConstantDeclaration ( AST ast ) { super ( ast ) ; unsupportedIn2 ( ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == JAVADOC_PROPERTY ) { if ( get ) { return getJavadoc ( ) ; } else { setJavadoc ( ( Javadoc ) child ) ; return null ; } } if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } if ( property == ANONYMOUS_CLASS_DECLARATION_PROPERTY ) { if ( get ) { return getAnonymousClassDeclaration ( ) ; } else { setAnonymousClassDeclaration ( ( AnonymousClassDeclaration ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == MODIFIERS2_PROPERTY ) { return modifiers ( ) ; } if ( property == ARGUMENTS_PROPERTY ) { return arguments ( ) ; } return super . internalGetChildListProperty ( property ) ; } final ChildPropertyDescriptor internalJavadocProperty ( ) { return JAVADOC_PROPERTY ; } final ChildListPropertyDescriptor internalModifiers2Property ( ) { return MODIFIERS2_PROPERTY ; } final SimplePropertyDescriptor internalModifiersProperty ( ) { return null ; } final int getNodeType0 ( ) { return ENUM_CONSTANT_DECLARATION ; } ASTNode clone0 ( AST target ) { EnumConstantDeclaration result = new EnumConstantDeclaration ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setJavadoc ( ( Javadoc ) ASTNode . copySubtree ( target , getJavadoc ( ) ) ) ; result . modifiers ( ) . addAll ( ASTNode . copySubtrees ( target , modifiers ( ) ) ) ; result . setName ( ( SimpleName ) getName ( ) . clone ( target ) ) ; result . arguments ( ) . addAll ( ASTNode . copySubtrees ( target , arguments ( ) ) ) ; result . setAnonymousClassDeclaration ( ( AnonymousClassDeclaration ) ASTNode . copySubtree ( target , getAnonymousClassDeclaration ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getJavadoc ( ) ) ; acceptChildren ( visitor , this . modifiers ) ; acceptChild ( visitor , getName ( ) ) ; acceptChildren ( visitor , this . arguments ) ; acceptChild ( visitor , getAnonymousClassDeclaration ( ) ) ; } visitor . endVisit ( this ) ; } public SimpleName getName ( ) { if ( this . constantName == null ) { synchronized ( this ) { if ( this . constantName == null ) { preLazyInit ( ) ; this . constantName = new SimpleName ( this . ast ) ; postLazyInit ( this . constantName , NAME_PROPERTY ) ; } } } return this . constantName ; } public void setName ( SimpleName constantName ) { if ( constantName == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . constantName ; preReplaceChild ( oldChild , constantName , NAME_PROPERTY ) ; this . constantName = constantName ; postReplaceChild ( oldChild , constantName , NAME_PROPERTY ) ; } public List arguments ( ) { return this . arguments ; } public AnonymousClassDeclaration getAnonymousClassDeclaration ( ) { return this . optionalAnonymousClassDeclaration ; } public void setAnonymousClassDeclaration ( AnonymousClassDeclaration decl ) { ASTNode oldChild = this . optionalAnonymousClassDeclaration ; preReplaceChild ( oldChild , decl , ANONYMOUS_CLASS_DECLARATION_PROPERTY ) ; this . optionalAnonymousClassDeclaration = decl ; postReplaceChild ( oldChild , decl , ANONYMOUS_CLASS_DECLARATION_PROPERTY ) ; } public IMethodBinding resolveConstructorBinding ( ) { return this . ast . getBindingResolver ( ) . resolveConstructor ( this ) ; } public IVariableBinding resolveVariable ( ) { return this . ast . getBindingResolver ( ) . resolveVariable ( this ) ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:3> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalDocComment == null ? <NUM_LIT:0> : getJavadoc ( ) . treeSize ( ) ) + this . modifiers . listSize ( ) + ( this . constantName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) + this . arguments . listSize ( ) + ( this . optionalAnonymousClassDeclaration == null ? <NUM_LIT:0> : getAnonymousClassDeclaration ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; public final class Modifier extends ASTNode implements IExtendedModifier { public static class ModifierKeyword { public static final ModifierKeyword ABSTRACT_KEYWORD = new ModifierKeyword ( "<STR_LIT>" , ABSTRACT ) ; public static final ModifierKeyword FINAL_KEYWORD = new ModifierKeyword ( "<STR_LIT>" , FINAL ) ; private static final Map KEYWORDS ; public static final ModifierKeyword NATIVE_KEYWORD = new ModifierKeyword ( "<STR_LIT>" , NATIVE ) ; public static final ModifierKeyword PRIVATE_KEYWORD = new ModifierKeyword ( "<STR_LIT>" , PRIVATE ) ; public static final ModifierKeyword PROTECTED_KEYWORD = new ModifierKeyword ( "<STR_LIT>" , PROTECTED ) ; public static final ModifierKeyword PUBLIC_KEYWORD = new ModifierKeyword ( "<STR_LIT>" , PUBLIC ) ; public static final ModifierKeyword STATIC_KEYWORD = new ModifierKeyword ( "<STR_LIT>" , STATIC ) ; public static final ModifierKeyword STRICTFP_KEYWORD = new ModifierKeyword ( "<STR_LIT>" , STRICTFP ) ; public static final ModifierKeyword SYNCHRONIZED_KEYWORD = new ModifierKeyword ( "<STR_LIT>" , SYNCHRONIZED ) ; public static final ModifierKeyword TRANSIENT_KEYWORD = new ModifierKeyword ( "<STR_LIT>" , TRANSIENT ) ; public static final ModifierKeyword VOLATILE_KEYWORD = new ModifierKeyword ( "<STR_LIT>" , VOLATILE ) ; static { KEYWORDS = new HashMap ( <NUM_LIT:20> ) ; ModifierKeyword [ ] ops = { PUBLIC_KEYWORD , PROTECTED_KEYWORD , PRIVATE_KEYWORD , STATIC_KEYWORD , ABSTRACT_KEYWORD , FINAL_KEYWORD , NATIVE_KEYWORD , SYNCHRONIZED_KEYWORD , TRANSIENT_KEYWORD , VOLATILE_KEYWORD , STRICTFP_KEYWORD } ; for ( int i = <NUM_LIT:0> ; i < ops . length ; i ++ ) { KEYWORDS . put ( ops [ i ] . toString ( ) , ops [ i ] ) ; } } public static ModifierKeyword fromFlagValue ( int flagValue ) { for ( Iterator it = KEYWORDS . values ( ) . iterator ( ) ; it . hasNext ( ) ; ) { ModifierKeyword k = ( ModifierKeyword ) it . next ( ) ; if ( k . toFlagValue ( ) == flagValue ) { return k ; } } return null ; } public static ModifierKeyword toKeyword ( String keyword ) { return ( ModifierKeyword ) KEYWORDS . get ( keyword ) ; } private int flagValue ; private String keyword ; private ModifierKeyword ( String keyword , int flagValue ) { this . keyword = keyword ; this . flagValue = flagValue ; } public int toFlagValue ( ) { return this . flagValue ; } public String toString ( ) { return this . keyword ; } } public static final int ABSTRACT = <NUM_LIT> ; public static final int FINAL = <NUM_LIT> ; public static final SimplePropertyDescriptor KEYWORD_PROPERTY = new SimplePropertyDescriptor ( Modifier . class , "<STR_LIT>" , Modifier . ModifierKeyword . class , MANDATORY ) ; public static final int NATIVE = <NUM_LIT> ; public static final int NONE = <NUM_LIT> ; public static final int PRIVATE = <NUM_LIT> ; private static final List PROPERTY_DESCRIPTORS ; public static final int PROTECTED = <NUM_LIT> ; public static final int PUBLIC = <NUM_LIT> ; public static final int STATIC = <NUM_LIT> ; public static final int STRICTFP = <NUM_LIT> ; public static final int SYNCHRONIZED = <NUM_LIT> ; public static final int TRANSIENT = <NUM_LIT> ; public static final int VOLATILE = <NUM_LIT> ; static { List properyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( Modifier . class , properyList ) ; addProperty ( KEYWORD_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static boolean isAbstract ( int flags ) { return ( flags & ABSTRACT ) != <NUM_LIT:0> ; } public static boolean isFinal ( int flags ) { return ( flags & FINAL ) != <NUM_LIT:0> ; } public static boolean isNative ( int flags ) { return ( flags & NATIVE ) != <NUM_LIT:0> ; } public static boolean isPrivate ( int flags ) { return ( flags & PRIVATE ) != <NUM_LIT:0> ; } public static boolean isProtected ( int flags ) { return ( flags & PROTECTED ) != <NUM_LIT:0> ; } public static boolean isPublic ( int flags ) { return ( flags & PUBLIC ) != <NUM_LIT:0> ; } public static boolean isStatic ( int flags ) { return ( flags & STATIC ) != <NUM_LIT:0> ; } public static boolean isStrictfp ( int flags ) { return ( flags & STRICTFP ) != <NUM_LIT:0> ; } public static boolean isSynchronized ( int flags ) { return ( flags & SYNCHRONIZED ) != <NUM_LIT:0> ; } public static boolean isTransient ( int flags ) { return ( flags & TRANSIENT ) != <NUM_LIT:0> ; } public static boolean isVolatile ( int flags ) { return ( flags & VOLATILE ) != <NUM_LIT:0> ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private ModifierKeyword modifierKeyword = ModifierKeyword . PUBLIC_KEYWORD ; Modifier ( AST ast ) { super ( ast ) ; unsupportedIn2 ( ) ; } void accept0 ( ASTVisitor visitor ) { visitor . visit ( this ) ; visitor . endVisit ( this ) ; } ASTNode clone0 ( AST target ) { Modifier result = new Modifier ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setKeyword ( getKeyword ( ) ) ; return result ; } public ModifierKeyword getKeyword ( ) { return this . modifierKeyword ; } final int getNodeType0 ( ) { return MODIFIER ; } final Object internalGetSetObjectProperty ( SimplePropertyDescriptor property , boolean get , Object value ) { if ( property == KEYWORD_PROPERTY ) { if ( get ) { return getKeyword ( ) ; } else { setKeyword ( ( ModifierKeyword ) value ) ; return null ; } } return super . internalGetSetObjectProperty ( property , get , value ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } public boolean isAbstract ( ) { return this . modifierKeyword == ModifierKeyword . ABSTRACT_KEYWORD ; } public boolean isAnnotation ( ) { return false ; } public boolean isFinal ( ) { return this . modifierKeyword == ModifierKeyword . FINAL_KEYWORD ; } public boolean isModifier ( ) { return true ; } public boolean isNative ( ) { return this . modifierKeyword == ModifierKeyword . NATIVE_KEYWORD ; } public boolean isPrivate ( ) { return this . modifierKeyword == ModifierKeyword . PRIVATE_KEYWORD ; } public boolean isProtected ( ) { return this . modifierKeyword == ModifierKeyword . PROTECTED_KEYWORD ; } public boolean isPublic ( ) { return this . modifierKeyword == ModifierKeyword . PUBLIC_KEYWORD ; } public boolean isStatic ( ) { return this . modifierKeyword == ModifierKeyword . STATIC_KEYWORD ; } public boolean isStrictfp ( ) { return this . modifierKeyword == ModifierKeyword . STRICTFP_KEYWORD ; } public boolean isSynchronized ( ) { return this . modifierKeyword == ModifierKeyword . SYNCHRONIZED_KEYWORD ; } public boolean isTransient ( ) { return this . modifierKeyword == ModifierKeyword . TRANSIENT_KEYWORD ; } public boolean isVolatile ( ) { return this . modifierKeyword == ModifierKeyword . VOLATILE_KEYWORD ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:1> * <NUM_LIT:4> ; } public void setKeyword ( ModifierKeyword modifierKeyord ) { if ( modifierKeyord == null ) { throw new IllegalArgumentException ( ) ; } preValueChange ( KEYWORD_PROPERTY ) ; this . modifierKeyword = modifierKeyord ; postValueChange ( KEYWORD_PROPERTY ) ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } int treeSize ( ) { return memSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class ReturnStatement extends Statement { public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( ReturnStatement . class , "<STR_LIT>" , Expression . class , OPTIONAL , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( ReturnStatement . class , propertyList ) ; addProperty ( EXPRESSION_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Expression optionalExpression = null ; ReturnStatement ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == EXPRESSION_PROPERTY ) { if ( get ) { return getExpression ( ) ; } else { setExpression ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return RETURN_STATEMENT ; } ASTNode clone0 ( AST target ) { ReturnStatement result = new ReturnStatement ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; result . setExpression ( ( Expression ) ASTNode . copySubtree ( target , getExpression ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getExpression ( ) ) ; } visitor . endVisit ( this ) ; } public Expression getExpression ( ) { return this . optionalExpression ; } public void setExpression ( Expression expression ) { ASTNode oldChild = this . optionalExpression ; preReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; this . optionalExpression = expression ; postReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:1> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalExpression == null ? <NUM_LIT:0> : getExpression ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class VariableDeclarationFragment extends VariableDeclaration { public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( VariableDeclarationFragment . class , "<STR_LIT:name>" , SimpleName . class , MANDATORY , NO_CYCLE_RISK ) ; public static final SimplePropertyDescriptor EXTRA_DIMENSIONS_PROPERTY = new SimplePropertyDescriptor ( VariableDeclarationFragment . class , "<STR_LIT>" , int . class , MANDATORY ) ; public static final ChildPropertyDescriptor INITIALIZER_PROPERTY = new ChildPropertyDescriptor ( VariableDeclarationFragment . class , "<STR_LIT>" , Expression . class , OPTIONAL , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( VariableDeclarationFragment . class , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; addProperty ( EXTRA_DIMENSIONS_PROPERTY , propertyList ) ; addProperty ( INITIALIZER_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private SimpleName variableName = null ; private int extraArrayDimensions = <NUM_LIT:0> ; private Expression optionalInitializer = null ; VariableDeclarationFragment ( AST ast ) { super ( ast ) ; } final SimplePropertyDescriptor internalExtraDimensionsProperty ( ) { return EXTRA_DIMENSIONS_PROPERTY ; } final ChildPropertyDescriptor internalInitializerProperty ( ) { return INITIALIZER_PROPERTY ; } final ChildPropertyDescriptor internalNameProperty ( ) { return NAME_PROPERTY ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final int internalGetSetIntProperty ( SimplePropertyDescriptor property , boolean get , int value ) { if ( property == EXTRA_DIMENSIONS_PROPERTY ) { if ( get ) { return getExtraDimensions ( ) ; } else { setExtraDimensions ( value ) ; return <NUM_LIT:0> ; } } return super . internalGetSetIntProperty ( property , get , value ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } if ( property == INITIALIZER_PROPERTY ) { if ( get ) { return getInitializer ( ) ; } else { setInitializer ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return VARIABLE_DECLARATION_FRAGMENT ; } ASTNode clone0 ( AST target ) { VariableDeclarationFragment result = new VariableDeclarationFragment ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setName ( ( SimpleName ) getName ( ) . clone ( target ) ) ; result . setExtraDimensions ( getExtraDimensions ( ) ) ; result . setInitializer ( ( Expression ) ASTNode . copySubtree ( target , getInitializer ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getName ( ) ) ; acceptChild ( visitor , getInitializer ( ) ) ; } visitor . endVisit ( this ) ; } public SimpleName getName ( ) { if ( this . variableName == null ) { synchronized ( this ) { if ( this . variableName == null ) { preLazyInit ( ) ; this . variableName = new SimpleName ( this . ast ) ; postLazyInit ( this . variableName , NAME_PROPERTY ) ; } } } return this . variableName ; } public void setName ( SimpleName variableName ) { if ( variableName == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . variableName ; preReplaceChild ( oldChild , variableName , NAME_PROPERTY ) ; this . variableName = variableName ; postReplaceChild ( oldChild , variableName , NAME_PROPERTY ) ; } public int getExtraDimensions ( ) { return this . extraArrayDimensions ; } public void setExtraDimensions ( int dimensions ) { if ( dimensions < <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } preValueChange ( EXTRA_DIMENSIONS_PROPERTY ) ; this . extraArrayDimensions = dimensions ; postValueChange ( EXTRA_DIMENSIONS_PROPERTY ) ; } public Expression getInitializer ( ) { return this . optionalInitializer ; } public void setInitializer ( Expression initializer ) { ASTNode oldChild = this . optionalInitializer ; preReplaceChild ( oldChild , initializer , INITIALIZER_PROPERTY ) ; this . optionalInitializer = initializer ; postReplaceChild ( oldChild , initializer , INITIALIZER_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:3> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . variableName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) + ( this . optionalInitializer == null ? <NUM_LIT:0> : getInitializer ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class MethodRefParameter extends ASTNode { public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor ( MethodRefParameter . class , "<STR_LIT:type>" , Type . class , MANDATORY , NO_CYCLE_RISK ) ; public static final SimplePropertyDescriptor VARARGS_PROPERTY = new SimplePropertyDescriptor ( MethodRefParameter . class , "<STR_LIT>" , boolean . class , MANDATORY ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( MethodRefParameter . class , "<STR_LIT:name>" , SimpleName . class , OPTIONAL , NO_CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS_2_0 ; private static final List PROPERTY_DESCRIPTORS_3_0 ; static { List properyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( MethodRefParameter . class , properyList ) ; addProperty ( TYPE_PROPERTY , properyList ) ; addProperty ( NAME_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( properyList ) ; properyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( MethodRefParameter . class , properyList ) ; addProperty ( TYPE_PROPERTY , properyList ) ; addProperty ( VARARGS_PROPERTY , properyList ) ; addProperty ( NAME_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS_3_0 = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { if ( apiLevel == AST . JLS2_INTERNAL ) { return PROPERTY_DESCRIPTORS_2_0 ; } else { return PROPERTY_DESCRIPTORS_3_0 ; } } private Type type = null ; private boolean variableArity = false ; private SimpleName optionalParameterName = null ; MethodRefParameter ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == TYPE_PROPERTY ) { if ( get ) { return getType ( ) ; } else { setType ( ( Type ) child ) ; return null ; } } if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final boolean internalGetSetBooleanProperty ( SimplePropertyDescriptor property , boolean get , boolean value ) { if ( property == VARARGS_PROPERTY ) { if ( get ) { return isVarargs ( ) ; } else { setVarargs ( value ) ; return false ; } } return super . internalGetSetBooleanProperty ( property , get , value ) ; } final int getNodeType0 ( ) { return METHOD_REF_PARAMETER ; } ASTNode clone0 ( AST target ) { MethodRefParameter result = new MethodRefParameter ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setType ( ( Type ) ASTNode . copySubtree ( target , getType ( ) ) ) ; if ( this . ast . apiLevel >= AST . JLS3 ) { result . setVarargs ( isVarargs ( ) ) ; } result . setName ( ( SimpleName ) ASTNode . copySubtree ( target , getName ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getType ( ) ) ; acceptChild ( visitor , getName ( ) ) ; } visitor . endVisit ( this ) ; } public Type getType ( ) { if ( this . type == null ) { synchronized ( this ) { if ( this . type == null ) { preLazyInit ( ) ; this . type = this . ast . newPrimitiveType ( PrimitiveType . INT ) ; postLazyInit ( this . type , TYPE_PROPERTY ) ; } } } return this . type ; } public void setType ( Type type ) { if ( type == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . type ; preReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; this . type = type ; postReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; } public boolean isVarargs ( ) { unsupportedIn2 ( ) ; return this . variableArity ; } public void setVarargs ( boolean variableArity ) { unsupportedIn2 ( ) ; preValueChange ( VARARGS_PROPERTY ) ; this . variableArity = variableArity ; postValueChange ( VARARGS_PROPERTY ) ; } public SimpleName getName ( ) { return this . optionalParameterName ; } public void setName ( SimpleName name ) { ASTNode oldChild = this . optionalParameterName ; preReplaceChild ( oldChild , name , NAME_PROPERTY ) ; this . optionalParameterName = name ; postReplaceChild ( oldChild , name , NAME_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:2> * <NUM_LIT:5> ; } int treeSize ( ) { return memSize ( ) + ( this . type == null ? <NUM_LIT:0> : getType ( ) . treeSize ( ) ) + ( this . optionalParameterName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class PackageDeclaration extends ASTNode { public static final ChildPropertyDescriptor JAVADOC_PROPERTY = new ChildPropertyDescriptor ( PackageDeclaration . class , "<STR_LIT>" , Javadoc . class , OPTIONAL , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor ANNOTATIONS_PROPERTY = new ChildListPropertyDescriptor ( PackageDeclaration . class , "<STR_LIT>" , Annotation . class , CYCLE_RISK ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( PackageDeclaration . class , "<STR_LIT:name>" , Name . class , MANDATORY , NO_CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS_2_0 ; private static final List PROPERTY_DESCRIPTORS_3_0 ; static { List propertyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( PackageDeclaration . class , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( propertyList ) ; propertyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( PackageDeclaration . class , propertyList ) ; addProperty ( JAVADOC_PROPERTY , propertyList ) ; addProperty ( ANNOTATIONS_PROPERTY , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_3_0 = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { if ( apiLevel == AST . JLS2_INTERNAL ) { return PROPERTY_DESCRIPTORS_2_0 ; } else { return PROPERTY_DESCRIPTORS_3_0 ; } } Javadoc optionalDocComment = null ; private ASTNode . NodeList annotations = null ; private Name packageName = null ; PackageDeclaration ( AST ast ) { super ( ast ) ; if ( ast . apiLevel >= AST . JLS3 ) { this . annotations = new ASTNode . NodeList ( ANNOTATIONS_PROPERTY ) ; } } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == JAVADOC_PROPERTY ) { if ( get ) { return getJavadoc ( ) ; } else { setJavadoc ( ( Javadoc ) child ) ; return null ; } } if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( Name ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == ANNOTATIONS_PROPERTY ) { return annotations ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return PACKAGE_DECLARATION ; } ASTNode clone0 ( AST target ) { PackageDeclaration result = new PackageDeclaration ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; if ( this . ast . apiLevel >= AST . JLS3 ) { result . setJavadoc ( ( Javadoc ) ASTNode . copySubtree ( target , getJavadoc ( ) ) ) ; result . annotations ( ) . addAll ( ASTNode . copySubtrees ( target , annotations ( ) ) ) ; } result . setName ( ( Name ) getName ( ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { if ( this . ast . apiLevel >= AST . JLS3 ) { acceptChild ( visitor , getJavadoc ( ) ) ; acceptChildren ( visitor , this . annotations ) ; } acceptChild ( visitor , getName ( ) ) ; } visitor . endVisit ( this ) ; } public List annotations ( ) { if ( this . annotations == null ) { unsupportedIn2 ( ) ; } return this . annotations ; } public Javadoc getJavadoc ( ) { if ( this . annotations == null ) { unsupportedIn2 ( ) ; } return this . optionalDocComment ; } public void setJavadoc ( Javadoc docComment ) { if ( this . annotations == null ) { unsupportedIn2 ( ) ; } ASTNode oldChild = this . optionalDocComment ; preReplaceChild ( oldChild , docComment , JAVADOC_PROPERTY ) ; this . optionalDocComment = docComment ; postReplaceChild ( oldChild , docComment , JAVADOC_PROPERTY ) ; } public Name getName ( ) { if ( this . packageName == null ) { synchronized ( this ) { if ( this . packageName == null ) { preLazyInit ( ) ; this . packageName = new SimpleName ( this . ast ) ; postLazyInit ( this . packageName , NAME_PROPERTY ) ; } } } return this . packageName ; } public void setName ( Name name ) { if ( name == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . packageName ; preReplaceChild ( oldChild , name , NAME_PROPERTY ) ; this . packageName = name ; postReplaceChild ( oldChild , name , NAME_PROPERTY ) ; } public IPackageBinding resolveBinding ( ) { return this . ast . getBindingResolver ( ) . resolvePackage ( this ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:3> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalDocComment == null ? <NUM_LIT:0> : getJavadoc ( ) . treeSize ( ) ) + ( this . annotations == null ? <NUM_LIT:0> : this . annotations . listSize ( ) ) + ( this . packageName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; public interface ITypeBinding extends IBinding { public ITypeBinding createArrayType ( int dimension ) ; public String getBinaryName ( ) ; public ITypeBinding getBound ( ) ; public ITypeBinding getGenericTypeOfWildcardType ( ) ; public int getRank ( ) ; public ITypeBinding getComponentType ( ) ; public IVariableBinding [ ] getDeclaredFields ( ) ; public IMethodBinding [ ] getDeclaredMethods ( ) ; public int getDeclaredModifiers ( ) ; public ITypeBinding [ ] getDeclaredTypes ( ) ; public ITypeBinding getDeclaringClass ( ) ; public IMethodBinding getDeclaringMethod ( ) ; public int getDimensions ( ) ; public ITypeBinding getElementType ( ) ; public ITypeBinding getErasure ( ) ; public ITypeBinding [ ] getInterfaces ( ) ; public int getModifiers ( ) ; public String getName ( ) ; public IPackageBinding getPackage ( ) ; public String getQualifiedName ( ) ; public ITypeBinding getSuperclass ( ) ; public ITypeBinding [ ] getTypeArguments ( ) ; public ITypeBinding [ ] getTypeBounds ( ) ; public ITypeBinding getTypeDeclaration ( ) ; public ITypeBinding [ ] getTypeParameters ( ) ; public ITypeBinding getWildcard ( ) ; public boolean isAnnotation ( ) ; public boolean isAnonymous ( ) ; public boolean isArray ( ) ; public boolean isAssignmentCompatible ( ITypeBinding variableType ) ; public boolean isCapture ( ) ; public boolean isCastCompatible ( ITypeBinding type ) ; public boolean isClass ( ) ; public boolean isEnum ( ) ; public boolean isFromSource ( ) ; public boolean isGenericType ( ) ; public boolean isInterface ( ) ; public boolean isLocal ( ) ; public boolean isMember ( ) ; public boolean isNested ( ) ; public boolean isNullType ( ) ; public boolean isParameterizedType ( ) ; public boolean isPrimitive ( ) ; public boolean isRawType ( ) ; public boolean isSubTypeCompatible ( ITypeBinding type ) ; public boolean isTopLevel ( ) ; public boolean isTypeVariable ( ) ; public boolean isUpperbound ( ) ; public boolean isWildcardType ( ) ; } </s>
<s> package org . eclipse . jdt . core . dom ; import java . lang . reflect . Constructor ; import java . lang . reflect . InvocationTargetException ; import java . util . ArrayList ; import java . util . List ; import java . util . Map ; import java . util . StringTokenizer ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jdt . core . IClassFile ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IJavaProject ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . parser . Scanner ; import org . eclipse . jface . text . IDocument ; import org . eclipse . text . edits . TextEdit ; public final class AST { public static final int JLS2 = <NUM_LIT:2> ; static final int JLS2_INTERNAL = JLS2 ; public static final int JLS3 = <NUM_LIT:3> ; private BindingResolver resolver = new BindingResolver ( ) ; private NodeEventHandler eventHandler = new NodeEventHandler ( ) ; int apiLevel ; private long modificationCount = <NUM_LIT:0> ; private long originalModificationCount = <NUM_LIT:0> ; private int disableEvents = <NUM_LIT:0> ; private final Object internalASTLock = new Object ( ) ; Scanner scanner ; InternalASTRewrite rewriter ; private int defaultNodeFlag = <NUM_LIT:0> ; private AST ( int level ) { if ( ( level != AST . JLS2 ) && ( level != AST . JLS3 ) ) { throw new IllegalArgumentException ( ) ; } this . apiLevel = level ; this . scanner = new Scanner ( true , true , false , ClassFileConstants . JDK1_3 , ClassFileConstants . JDK1_5 , null , null , true ) ; } public AST ( ) { this ( JavaCore . getDefaultOptions ( ) ) ; } public static CompilationUnit convertCompilationUnit ( int level , org . eclipse . jdt . internal . compiler . ast . CompilationUnitDeclaration compilationUnitDeclaration , Map options , boolean isResolved , org . eclipse . jdt . internal . core . CompilationUnit workingCopy , int reconcileFlags , IProgressMonitor monitor ) { ASTConverter converter = new ASTConverter ( options , isResolved , monitor ) ; AST ast = AST . newAST ( level ) ; int savedDefaultNodeFlag = ast . getDefaultNodeFlag ( ) ; ast . setDefaultNodeFlag ( ASTNode . ORIGINAL ) ; BindingResolver resolver = null ; if ( isResolved ) { resolver = new DefaultBindingResolver ( compilationUnitDeclaration . scope , workingCopy . owner , new DefaultBindingResolver . BindingTables ( ) , false , true ) ; ( ( DefaultBindingResolver ) resolver ) . isRecoveringBindings = ( reconcileFlags & ICompilationUnit . ENABLE_BINDINGS_RECOVERY ) != <NUM_LIT:0> ; ast . setFlag ( AST . RESOLVED_BINDINGS ) ; } else { resolver = new BindingResolver ( ) ; } ast . setFlag ( reconcileFlags ) ; ast . setBindingResolver ( resolver ) ; converter . setAST ( ast ) ; CompilationUnit unit = converter . convert ( compilationUnitDeclaration , workingCopy . getContents ( ) ) ; unit . setLineEndTable ( compilationUnitDeclaration . compilationResult . getLineSeparatorPositions ( ) ) ; unit . setTypeRoot ( workingCopy . originalFromClone ( ) ) ; ast . setDefaultNodeFlag ( savedDefaultNodeFlag ) ; return unit ; } public static CompilationUnit convertCompilationUnit ( int level , org . eclipse . jdt . internal . compiler . ast . CompilationUnitDeclaration compilationUnitDeclaration , char [ ] source , Map options , boolean isResolved , org . eclipse . jdt . internal . core . CompilationUnit workingCopy , int reconcileFlags , IProgressMonitor monitor ) { return null ; } public AST ( Map options ) { this ( JLS2 ) ; Object sourceLevelOption = options . get ( JavaCore . COMPILER_SOURCE ) ; long sourceLevel = ClassFileConstants . JDK1_3 ; if ( JavaCore . VERSION_1_4 . equals ( sourceLevelOption ) ) { sourceLevel = ClassFileConstants . JDK1_4 ; } else if ( JavaCore . VERSION_1_5 . equals ( sourceLevelOption ) ) { sourceLevel = ClassFileConstants . JDK1_5 ; } Object complianceLevelOption = options . get ( JavaCore . COMPILER_COMPLIANCE ) ; long complianceLevel = ClassFileConstants . JDK1_3 ; if ( JavaCore . VERSION_1_4 . equals ( complianceLevelOption ) ) { complianceLevel = ClassFileConstants . JDK1_4 ; } else if ( JavaCore . VERSION_1_5 . equals ( complianceLevelOption ) ) { complianceLevel = ClassFileConstants . JDK1_5 ; } this . scanner = new Scanner ( true , true , false , sourceLevel , complianceLevel , null , null , true ) ; } public static AST newAST ( int level ) { if ( ( level != AST . JLS2 ) && ( level != AST . JLS3 ) ) { throw new IllegalArgumentException ( ) ; } return new AST ( level ) ; } public long modificationCount ( ) { return this . modificationCount ; } public int apiLevel ( ) { return this . apiLevel ; } void modifying ( ) { if ( this . disableEvents > <NUM_LIT:0> ) { return ; } this . modificationCount ++ ; } final void disableEvents ( ) { synchronized ( this . internalASTLock ) { this . disableEvents ++ ; } } final void reenableEvents ( ) { synchronized ( this . internalASTLock ) { this . disableEvents -- ; } } void preRemoveChildEvent ( ASTNode node , ASTNode child , StructuralPropertyDescriptor property ) { synchronized ( this . internalASTLock ) { if ( this . disableEvents > <NUM_LIT:0> ) { return ; } else { disableEvents ( ) ; } } try { this . eventHandler . preRemoveChildEvent ( node , child , property ) ; } finally { reenableEvents ( ) ; } } void postRemoveChildEvent ( ASTNode node , ASTNode child , StructuralPropertyDescriptor property ) { synchronized ( this . internalASTLock ) { if ( this . disableEvents > <NUM_LIT:0> ) { return ; } else { disableEvents ( ) ; } } try { this . eventHandler . postRemoveChildEvent ( node , child , property ) ; } finally { reenableEvents ( ) ; } } void preReplaceChildEvent ( ASTNode node , ASTNode child , ASTNode newChild , StructuralPropertyDescriptor property ) { synchronized ( this . internalASTLock ) { if ( this . disableEvents > <NUM_LIT:0> ) { return ; } else { disableEvents ( ) ; } } try { this . eventHandler . preReplaceChildEvent ( node , child , newChild , property ) ; } finally { reenableEvents ( ) ; } } void postReplaceChildEvent ( ASTNode node , ASTNode child , ASTNode newChild , StructuralPropertyDescriptor property ) { synchronized ( this . internalASTLock ) { if ( this . disableEvents > <NUM_LIT:0> ) { return ; } else { disableEvents ( ) ; } } try { this . eventHandler . postReplaceChildEvent ( node , child , newChild , property ) ; } finally { reenableEvents ( ) ; } } void preAddChildEvent ( ASTNode node , ASTNode child , StructuralPropertyDescriptor property ) { synchronized ( this . internalASTLock ) { if ( this . disableEvents > <NUM_LIT:0> ) { return ; } else { disableEvents ( ) ; } } try { this . eventHandler . preAddChildEvent ( node , child , property ) ; } finally { reenableEvents ( ) ; } } void postAddChildEvent ( ASTNode node , ASTNode child , StructuralPropertyDescriptor property ) { synchronized ( this . internalASTLock ) { if ( this . disableEvents > <NUM_LIT:0> ) { return ; } else { disableEvents ( ) ; } } try { this . eventHandler . postAddChildEvent ( node , child , property ) ; } finally { reenableEvents ( ) ; } } void preValueChangeEvent ( ASTNode node , SimplePropertyDescriptor property ) { synchronized ( this . internalASTLock ) { if ( this . disableEvents > <NUM_LIT:0> ) { return ; } else { disableEvents ( ) ; } } try { this . eventHandler . preValueChangeEvent ( node , property ) ; } finally { reenableEvents ( ) ; } } void postValueChangeEvent ( ASTNode node , SimplePropertyDescriptor property ) { synchronized ( this . internalASTLock ) { if ( this . disableEvents > <NUM_LIT:0> ) { return ; } else { disableEvents ( ) ; } } try { this . eventHandler . postValueChangeEvent ( node , property ) ; } finally { reenableEvents ( ) ; } } void preCloneNodeEvent ( ASTNode node ) { synchronized ( this . internalASTLock ) { if ( this . disableEvents > <NUM_LIT:0> ) { return ; } else { disableEvents ( ) ; } } try { this . eventHandler . preCloneNodeEvent ( node ) ; } finally { reenableEvents ( ) ; } } void postCloneNodeEvent ( ASTNode node , ASTNode clone ) { synchronized ( this . internalASTLock ) { if ( this . disableEvents > <NUM_LIT:0> ) { return ; } else { disableEvents ( ) ; } } try { this . eventHandler . postCloneNodeEvent ( node , clone ) ; } finally { reenableEvents ( ) ; } } public static CompilationUnit parseCompilationUnit ( ICompilationUnit unit , boolean resolveBindings ) { try { ASTParser c = ASTParser . newParser ( AST . JLS2 ) ; c . setSource ( unit ) ; c . setResolveBindings ( resolveBindings ) ; ASTNode result = c . createAST ( null ) ; return ( CompilationUnit ) result ; } catch ( IllegalStateException e ) { throw new IllegalArgumentException ( ) ; } } public static CompilationUnit parseCompilationUnit ( IClassFile classFile , boolean resolveBindings ) { if ( classFile == null ) { throw new IllegalArgumentException ( ) ; } try { ASTParser c = ASTParser . newParser ( AST . JLS2 ) ; c . setSource ( classFile ) ; c . setResolveBindings ( resolveBindings ) ; ASTNode result = c . createAST ( null ) ; return ( CompilationUnit ) result ; } catch ( IllegalStateException e ) { throw new IllegalArgumentException ( ) ; } } public static CompilationUnit parseCompilationUnit ( char [ ] source , String unitName , IJavaProject project ) { if ( source == null ) { throw new IllegalArgumentException ( ) ; } ASTParser astParser = ASTParser . newParser ( AST . JLS2 ) ; astParser . setSource ( source ) ; astParser . setUnitName ( unitName ) ; astParser . setProject ( project ) ; astParser . setResolveBindings ( project != null ) ; ASTNode result = astParser . createAST ( null ) ; return ( CompilationUnit ) result ; } public static CompilationUnit parseCompilationUnit ( char [ ] source ) { if ( source == null ) { throw new IllegalArgumentException ( ) ; } ASTParser c = ASTParser . newParser ( AST . JLS2 ) ; c . setSource ( source ) ; ASTNode result = c . createAST ( null ) ; return ( CompilationUnit ) result ; } BindingResolver getBindingResolver ( ) { return this . resolver ; } NodeEventHandler getEventHandler ( ) { return this . eventHandler ; } void setEventHandler ( NodeEventHandler eventHandler ) { if ( this . eventHandler == null ) { throw new IllegalArgumentException ( ) ; } this . eventHandler = eventHandler ; } int getDefaultNodeFlag ( ) { return this . defaultNodeFlag ; } void setDefaultNodeFlag ( int flag ) { this . defaultNodeFlag = flag ; } void setOriginalModificationCount ( long count ) { this . originalModificationCount = count ; } public ITypeBinding resolveWellKnownType ( String name ) { if ( name == null ) { return null ; } return getBindingResolver ( ) . resolveWellKnownType ( name ) ; } void setBindingResolver ( BindingResolver resolver ) { if ( resolver == null ) { throw new IllegalArgumentException ( ) ; } this . resolver = resolver ; } void unsupportedIn2 ( ) { if ( this . apiLevel == AST . JLS2 ) { throw new UnsupportedOperationException ( "<STR_LIT>" ) ; } } void supportedOnlyIn2 ( ) { if ( this . apiLevel != AST . JLS2 ) { throw new UnsupportedOperationException ( "<STR_LIT>" ) ; } } private static final Class [ ] AST_CLASS = new Class [ ] { AST . class } ; private final Object [ ] THIS_AST = new Object [ ] { this } ; static final int RESOLVED_BINDINGS = <NUM_LIT> ; private int bits ; public ASTNode createInstance ( Class nodeClass ) { if ( nodeClass == null ) { throw new IllegalArgumentException ( ) ; } try { Constructor c = nodeClass . getDeclaredConstructor ( AST_CLASS ) ; Object result = c . newInstance ( this . THIS_AST ) ; return ( ASTNode ) result ; } catch ( NoSuchMethodException e ) { throw new IllegalArgumentException ( ) ; } catch ( InstantiationException e ) { throw new IllegalArgumentException ( ) ; } catch ( IllegalAccessException e ) { throw new IllegalArgumentException ( ) ; } catch ( InvocationTargetException e ) { throw new IllegalArgumentException ( ) ; } } public ASTNode createInstance ( int nodeType ) { Class nodeClass = ASTNode . nodeClassForType ( nodeType ) ; return createInstance ( nodeClass ) ; } public SimpleName newSimpleName ( String identifier ) { if ( identifier == null ) { throw new IllegalArgumentException ( ) ; } SimpleName result = new SimpleName ( this ) ; result . setIdentifier ( identifier ) ; return result ; } public QualifiedName newQualifiedName ( Name qualifier , SimpleName name ) { QualifiedName result = new QualifiedName ( this ) ; result . setQualifier ( qualifier ) ; result . setName ( name ) ; return result ; } public Name newName ( String [ ] identifiers ) { int count = identifiers . length ; if ( count == <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } Name result = newSimpleName ( identifiers [ <NUM_LIT:0> ] ) ; for ( int i = <NUM_LIT:1> ; i < count ; i ++ ) { SimpleName name = newSimpleName ( identifiers [ i ] ) ; result = newQualifiedName ( result , name ) ; } return result ; } Name internalNewName ( String [ ] identifiers ) { int count = identifiers . length ; if ( count == <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } final SimpleName simpleName = new SimpleName ( this ) ; simpleName . internalSetIdentifier ( identifiers [ <NUM_LIT:0> ] ) ; Name result = simpleName ; for ( int i = <NUM_LIT:1> ; i < count ; i ++ ) { SimpleName name = new SimpleName ( this ) ; name . internalSetIdentifier ( identifiers [ i ] ) ; result = newQualifiedName ( result , name ) ; } return result ; } public Name newName ( String qualifiedName ) { StringTokenizer t = new StringTokenizer ( qualifiedName , "<STR_LIT:.>" , true ) ; Name result = null ; int balance = <NUM_LIT:0> ; while ( t . hasMoreTokens ( ) ) { String s = t . nextToken ( ) ; if ( s . indexOf ( '<CHAR_LIT:.>' ) >= <NUM_LIT:0> ) { if ( s . length ( ) > <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } balance -- ; if ( balance < <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } } else { balance ++ ; SimpleName name = newSimpleName ( s ) ; if ( result == null ) { result = name ; } else { result = newQualifiedName ( result , name ) ; } } } if ( balance != <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } return result ; } public SimpleType newSimpleType ( Name typeName ) { SimpleType result = new SimpleType ( this ) ; result . setName ( typeName ) ; return result ; } public ArrayType newArrayType ( Type componentType ) { ArrayType result = new ArrayType ( this ) ; result . setComponentType ( componentType ) ; return result ; } public ArrayType newArrayType ( Type elementType , int dimensions ) { if ( elementType == null || elementType . isArrayType ( ) ) { throw new IllegalArgumentException ( ) ; } if ( dimensions < <NUM_LIT:1> || dimensions > <NUM_LIT:1000> ) { throw new IllegalArgumentException ( ) ; } ArrayType result = new ArrayType ( this ) ; result . setComponentType ( elementType ) ; for ( int i = <NUM_LIT:2> ; i <= dimensions ; i ++ ) { result = newArrayType ( result ) ; } return result ; } public PrimitiveType newPrimitiveType ( PrimitiveType . Code typeCode ) { PrimitiveType result = new PrimitiveType ( this ) ; result . setPrimitiveTypeCode ( typeCode ) ; return result ; } public ParameterizedType newParameterizedType ( Type type ) { ParameterizedType result = new ParameterizedType ( this ) ; result . setType ( type ) ; return result ; } public QualifiedType newQualifiedType ( Type qualifier , SimpleName name ) { QualifiedType result = new QualifiedType ( this ) ; result . setQualifier ( qualifier ) ; result . setName ( name ) ; return result ; } public WildcardType newWildcardType ( ) { WildcardType result = new WildcardType ( this ) ; return result ; } public CompilationUnit newCompilationUnit ( ) { return new CompilationUnit ( this ) ; } public PackageDeclaration newPackageDeclaration ( ) { PackageDeclaration result = new PackageDeclaration ( this ) ; return result ; } public ImportDeclaration newImportDeclaration ( ) { ImportDeclaration result = new ImportDeclaration ( this ) ; return result ; } public TypeDeclaration newTypeDeclaration ( ) { TypeDeclaration result = new TypeDeclaration ( this ) ; result . setInterface ( false ) ; return result ; } public MethodDeclaration newMethodDeclaration ( ) { MethodDeclaration result = new MethodDeclaration ( this ) ; result . setConstructor ( false ) ; return result ; } public SingleVariableDeclaration newSingleVariableDeclaration ( ) { SingleVariableDeclaration result = new SingleVariableDeclaration ( this ) ; return result ; } public VariableDeclarationFragment newVariableDeclarationFragment ( ) { VariableDeclarationFragment result = new VariableDeclarationFragment ( this ) ; return result ; } public Initializer newInitializer ( ) { Initializer result = new Initializer ( this ) ; return result ; } public EnumConstantDeclaration newEnumConstantDeclaration ( ) { EnumConstantDeclaration result = new EnumConstantDeclaration ( this ) ; return result ; } public EnumDeclaration newEnumDeclaration ( ) { EnumDeclaration result = new EnumDeclaration ( this ) ; return result ; } public TypeParameter newTypeParameter ( ) { TypeParameter result = new TypeParameter ( this ) ; return result ; } public AnnotationTypeDeclaration newAnnotationTypeDeclaration ( ) { AnnotationTypeDeclaration result = new AnnotationTypeDeclaration ( this ) ; return result ; } public AnnotationTypeMemberDeclaration newAnnotationTypeMemberDeclaration ( ) { AnnotationTypeMemberDeclaration result = new AnnotationTypeMemberDeclaration ( this ) ; return result ; } public Modifier newModifier ( Modifier . ModifierKeyword keyword ) { Modifier result = new Modifier ( this ) ; result . setKeyword ( keyword ) ; return result ; } public List newModifiers ( int flags ) { if ( this . apiLevel == AST . JLS2 ) { unsupportedIn2 ( ) ; } List result = new ArrayList ( <NUM_LIT:3> ) ; if ( Modifier . isPublic ( flags ) ) { result . add ( newModifier ( Modifier . ModifierKeyword . PUBLIC_KEYWORD ) ) ; } if ( Modifier . isProtected ( flags ) ) { result . add ( newModifier ( Modifier . ModifierKeyword . PROTECTED_KEYWORD ) ) ; } if ( Modifier . isPrivate ( flags ) ) { result . add ( newModifier ( Modifier . ModifierKeyword . PRIVATE_KEYWORD ) ) ; } if ( Modifier . isAbstract ( flags ) ) { result . add ( newModifier ( Modifier . ModifierKeyword . ABSTRACT_KEYWORD ) ) ; } if ( Modifier . isStatic ( flags ) ) { result . add ( newModifier ( Modifier . ModifierKeyword . STATIC_KEYWORD ) ) ; } if ( Modifier . isFinal ( flags ) ) { result . add ( newModifier ( Modifier . ModifierKeyword . FINAL_KEYWORD ) ) ; } if ( Modifier . isSynchronized ( flags ) ) { result . add ( newModifier ( Modifier . ModifierKeyword . SYNCHRONIZED_KEYWORD ) ) ; } if ( Modifier . isNative ( flags ) ) { result . add ( newModifier ( Modifier . ModifierKeyword . NATIVE_KEYWORD ) ) ; } if ( Modifier . isStrictfp ( flags ) ) { result . add ( newModifier ( Modifier . ModifierKeyword . STRICTFP_KEYWORD ) ) ; } if ( Modifier . isTransient ( flags ) ) { result . add ( newModifier ( Modifier . ModifierKeyword . TRANSIENT_KEYWORD ) ) ; } if ( Modifier . isVolatile ( flags ) ) { result . add ( newModifier ( Modifier . ModifierKeyword . VOLATILE_KEYWORD ) ) ; } return result ; } public BlockComment newBlockComment ( ) { BlockComment result = new BlockComment ( this ) ; return result ; } public LineComment newLineComment ( ) { LineComment result = new LineComment ( this ) ; return result ; } public Javadoc newJavadoc ( ) { Javadoc result = new Javadoc ( this ) ; return result ; } public TagElement newTagElement ( ) { TagElement result = new TagElement ( this ) ; return result ; } public TextElement newTextElement ( ) { TextElement result = new TextElement ( this ) ; return result ; } public MemberRef newMemberRef ( ) { MemberRef result = new MemberRef ( this ) ; return result ; } public MethodRef newMethodRef ( ) { MethodRef result = new MethodRef ( this ) ; return result ; } public MethodRefParameter newMethodRefParameter ( ) { MethodRefParameter result = new MethodRefParameter ( this ) ; return result ; } public VariableDeclarationStatement newVariableDeclarationStatement ( VariableDeclarationFragment fragment ) { if ( fragment == null ) { throw new IllegalArgumentException ( ) ; } VariableDeclarationStatement result = new VariableDeclarationStatement ( this ) ; result . fragments ( ) . add ( fragment ) ; return result ; } public TypeDeclarationStatement newTypeDeclarationStatement ( TypeDeclaration decl ) { TypeDeclarationStatement result = new TypeDeclarationStatement ( this ) ; result . setDeclaration ( decl ) ; return result ; } public TypeDeclarationStatement newTypeDeclarationStatement ( AbstractTypeDeclaration decl ) { TypeDeclarationStatement result = new TypeDeclarationStatement ( this ) ; if ( this . apiLevel == AST . JLS2 ) { result . internalSetTypeDeclaration ( ( TypeDeclaration ) decl ) ; } if ( this . apiLevel >= AST . JLS3 ) { result . setDeclaration ( decl ) ; } return result ; } public Block newBlock ( ) { return new Block ( this ) ; } public ContinueStatement newContinueStatement ( ) { return new ContinueStatement ( this ) ; } public BreakStatement newBreakStatement ( ) { return new BreakStatement ( this ) ; } public ExpressionStatement newExpressionStatement ( Expression expression ) { ExpressionStatement result = new ExpressionStatement ( this ) ; result . setExpression ( expression ) ; return result ; } public IfStatement newIfStatement ( ) { return new IfStatement ( this ) ; } public WhileStatement newWhileStatement ( ) { return new WhileStatement ( this ) ; } public DoStatement newDoStatement ( ) { return new DoStatement ( this ) ; } public TryStatement newTryStatement ( ) { return new TryStatement ( this ) ; } public CatchClause newCatchClause ( ) { return new CatchClause ( this ) ; } public ReturnStatement newReturnStatement ( ) { return new ReturnStatement ( this ) ; } public ThrowStatement newThrowStatement ( ) { return new ThrowStatement ( this ) ; } public AssertStatement newAssertStatement ( ) { return new AssertStatement ( this ) ; } public EmptyStatement newEmptyStatement ( ) { return new EmptyStatement ( this ) ; } public LabeledStatement newLabeledStatement ( ) { return new LabeledStatement ( this ) ; } public SwitchStatement newSwitchStatement ( ) { return new SwitchStatement ( this ) ; } public SwitchCase newSwitchCase ( ) { return new SwitchCase ( this ) ; } public SynchronizedStatement newSynchronizedStatement ( ) { return new SynchronizedStatement ( this ) ; } public ForStatement newForStatement ( ) { return new ForStatement ( this ) ; } public EnhancedForStatement newEnhancedForStatement ( ) { return new EnhancedForStatement ( this ) ; } public StringLiteral newStringLiteral ( ) { return new StringLiteral ( this ) ; } public CharacterLiteral newCharacterLiteral ( ) { return new CharacterLiteral ( this ) ; } public NumberLiteral newNumberLiteral ( String literal ) { if ( literal == null ) { throw new IllegalArgumentException ( ) ; } NumberLiteral result = new NumberLiteral ( this ) ; result . setToken ( literal ) ; return result ; } public NumberLiteral newNumberLiteral ( ) { NumberLiteral result = new NumberLiteral ( this ) ; return result ; } public NullLiteral newNullLiteral ( ) { return new NullLiteral ( this ) ; } public BooleanLiteral newBooleanLiteral ( boolean value ) { BooleanLiteral result = new BooleanLiteral ( this ) ; result . setBooleanValue ( value ) ; return result ; } public Assignment newAssignment ( ) { Assignment result = new Assignment ( this ) ; return result ; } public MethodInvocation newMethodInvocation ( ) { MethodInvocation result = new MethodInvocation ( this ) ; return result ; } public SuperMethodInvocation newSuperMethodInvocation ( ) { SuperMethodInvocation result = new SuperMethodInvocation ( this ) ; return result ; } public ConstructorInvocation newConstructorInvocation ( ) { ConstructorInvocation result = new ConstructorInvocation ( this ) ; return result ; } public SuperConstructorInvocation newSuperConstructorInvocation ( ) { SuperConstructorInvocation result = new SuperConstructorInvocation ( this ) ; return result ; } public VariableDeclarationExpression newVariableDeclarationExpression ( VariableDeclarationFragment fragment ) { if ( fragment == null ) { throw new IllegalArgumentException ( ) ; } VariableDeclarationExpression result = new VariableDeclarationExpression ( this ) ; result . fragments ( ) . add ( fragment ) ; return result ; } public FieldDeclaration newFieldDeclaration ( VariableDeclarationFragment fragment ) { if ( fragment == null ) { throw new IllegalArgumentException ( ) ; } FieldDeclaration result = new FieldDeclaration ( this ) ; result . fragments ( ) . add ( fragment ) ; return result ; } public ThisExpression newThisExpression ( ) { ThisExpression result = new ThisExpression ( this ) ; return result ; } public FieldAccess newFieldAccess ( ) { FieldAccess result = new FieldAccess ( this ) ; return result ; } public SuperFieldAccess newSuperFieldAccess ( ) { SuperFieldAccess result = new SuperFieldAccess ( this ) ; return result ; } public TypeLiteral newTypeLiteral ( ) { TypeLiteral result = new TypeLiteral ( this ) ; return result ; } public CastExpression newCastExpression ( ) { CastExpression result = new CastExpression ( this ) ; return result ; } public ParenthesizedExpression newParenthesizedExpression ( ) { ParenthesizedExpression result = new ParenthesizedExpression ( this ) ; return result ; } public InfixExpression newInfixExpression ( ) { InfixExpression result = new InfixExpression ( this ) ; return result ; } public InstanceofExpression newInstanceofExpression ( ) { InstanceofExpression result = new InstanceofExpression ( this ) ; return result ; } public PostfixExpression newPostfixExpression ( ) { PostfixExpression result = new PostfixExpression ( this ) ; return result ; } public PrefixExpression newPrefixExpression ( ) { PrefixExpression result = new PrefixExpression ( this ) ; return result ; } public ArrayAccess newArrayAccess ( ) { ArrayAccess result = new ArrayAccess ( this ) ; return result ; } public ArrayCreation newArrayCreation ( ) { ArrayCreation result = new ArrayCreation ( this ) ; return result ; } public ClassInstanceCreation newClassInstanceCreation ( ) { ClassInstanceCreation result = new ClassInstanceCreation ( this ) ; return result ; } public AnonymousClassDeclaration newAnonymousClassDeclaration ( ) { AnonymousClassDeclaration result = new AnonymousClassDeclaration ( this ) ; return result ; } public ArrayInitializer newArrayInitializer ( ) { ArrayInitializer result = new ArrayInitializer ( this ) ; return result ; } public ConditionalExpression newConditionalExpression ( ) { ConditionalExpression result = new ConditionalExpression ( this ) ; return result ; } public NormalAnnotation newNormalAnnotation ( ) { NormalAnnotation result = new NormalAnnotation ( this ) ; return result ; } public MarkerAnnotation newMarkerAnnotation ( ) { MarkerAnnotation result = new MarkerAnnotation ( this ) ; return result ; } public SingleMemberAnnotation newSingleMemberAnnotation ( ) { SingleMemberAnnotation result = new SingleMemberAnnotation ( this ) ; return result ; } public MemberValuePair newMemberValuePair ( ) { MemberValuePair result = new MemberValuePair ( this ) ; return result ; } void recordModifications ( CompilationUnit root ) { if ( this . modificationCount != this . originalModificationCount ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } else if ( this . rewriter != null ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } else if ( ( root . getFlags ( ) & ASTNode . PROTECT ) != <NUM_LIT:0> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } else if ( root . getAST ( ) != this ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } this . rewriter = new InternalASTRewrite ( root ) ; setEventHandler ( this . rewriter ) ; } TextEdit rewrite ( IDocument document , Map options ) { if ( document == null ) { throw new IllegalArgumentException ( ) ; } if ( this . rewriter == null ) { throw new IllegalStateException ( "<STR_LIT>" ) ; } return this . rewriter . rewriteAST ( document , options ) ; } public boolean hasResolvedBindings ( ) { return ( this . bits & RESOLVED_BINDINGS ) != <NUM_LIT:0> ; } public boolean hasStatementsRecovery ( ) { return ( this . bits & ICompilationUnit . ENABLE_STATEMENTS_RECOVERY ) != <NUM_LIT:0> ; } public boolean hasBindingsRecovery ( ) { return ( this . bits & ICompilationUnit . ENABLE_BINDINGS_RECOVERY ) != <NUM_LIT:0> ; } void setFlag ( int newValue ) { this . bits |= newValue ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class TypeLiteral extends Expression { public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor ( TypeLiteral . class , "<STR_LIT:type>" , Type . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( TypeLiteral . class , propertyList ) ; addProperty ( TYPE_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Type type = null ; TypeLiteral ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == TYPE_PROPERTY ) { if ( get ) { return getType ( ) ; } else { setType ( ( Type ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return TYPE_LITERAL ; } ASTNode clone0 ( AST target ) { TypeLiteral result = new TypeLiteral ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setType ( ( Type ) getType ( ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getType ( ) ) ; } visitor . endVisit ( this ) ; } public Type getType ( ) { if ( this . type == null ) { synchronized ( this ) { if ( this . type == null ) { preLazyInit ( ) ; this . type = this . ast . newPrimitiveType ( PrimitiveType . INT ) ; postLazyInit ( this . type , TYPE_PROPERTY ) ; } } } return this . type ; } public void setType ( Type type ) { if ( type == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . type ; preReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; this . type = type ; postReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:1> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . type == null ? <NUM_LIT:0> : getType ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class WhileStatement extends Statement { public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( WhileStatement . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; public static final ChildPropertyDescriptor BODY_PROPERTY = new ChildPropertyDescriptor ( WhileStatement . class , "<STR_LIT:body>" , Statement . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( WhileStatement . class , propertyList ) ; addProperty ( EXPRESSION_PROPERTY , propertyList ) ; addProperty ( BODY_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Expression expression = null ; private Statement body = null ; WhileStatement ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == EXPRESSION_PROPERTY ) { if ( get ) { return getExpression ( ) ; } else { setExpression ( ( Expression ) child ) ; return null ; } } if ( property == BODY_PROPERTY ) { if ( get ) { return getBody ( ) ; } else { setBody ( ( Statement ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return WHILE_STATEMENT ; } ASTNode clone0 ( AST target ) { WhileStatement result = new WhileStatement ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; result . setExpression ( ( Expression ) getExpression ( ) . clone ( target ) ) ; result . setBody ( ( Statement ) getBody ( ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getExpression ( ) ) ; acceptChild ( visitor , getBody ( ) ) ; } visitor . endVisit ( this ) ; } public Expression getExpression ( ) { if ( this . expression == null ) { synchronized ( this ) { if ( this . expression == null ) { preLazyInit ( ) ; this . expression = new SimpleName ( this . ast ) ; postLazyInit ( this . expression , EXPRESSION_PROPERTY ) ; } } } return this . expression ; } public void setExpression ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . expression ; preReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; this . expression = expression ; postReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; } public Statement getBody ( ) { if ( this . body == null ) { synchronized ( this ) { if ( this . body == null ) { preLazyInit ( ) ; this . body = new Block ( this . ast ) ; postLazyInit ( this . body , BODY_PROPERTY ) ; } } } return this . body ; } public void setBody ( Statement statement ) { if ( statement == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . body ; preReplaceChild ( oldChild , statement , BODY_PROPERTY ) ; this . body = statement ; postReplaceChild ( oldChild , statement , BODY_PROPERTY ) ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . expression == null ? <NUM_LIT:0> : getExpression ( ) . treeSize ( ) ) + ( this . body == null ? <NUM_LIT:0> : getBody ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class SimpleType extends Type { public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( SimpleType . class , "<STR_LIT:name>" , Name . class , MANDATORY , NO_CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( SimpleType . class , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Name typeName = null ; SimpleType ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( Name ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return SIMPLE_TYPE ; } ASTNode clone0 ( AST target ) { SimpleType result = new SimpleType ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setName ( ( Name ) ( getName ( ) ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getName ( ) ) ; } visitor . endVisit ( this ) ; } public Name getName ( ) { if ( this . typeName == null ) { synchronized ( this ) { if ( this . typeName == null ) { preLazyInit ( ) ; this . typeName = new SimpleName ( this . ast ) ; postLazyInit ( this . typeName , NAME_PROPERTY ) ; } } } return this . typeName ; } public void setName ( Name typeName ) { if ( typeName == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . typeName ; preReplaceChild ( oldChild , typeName , NAME_PROPERTY ) ; this . typeName = typeName ; postReplaceChild ( oldChild , typeName , NAME_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:1> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . typeName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; class NodeEventHandler { NodeEventHandler ( ) { } void preRemoveChildEvent ( ASTNode node , ASTNode child , StructuralPropertyDescriptor property ) { } void postRemoveChildEvent ( ASTNode node , ASTNode child , StructuralPropertyDescriptor property ) { } void preReplaceChildEvent ( ASTNode node , ASTNode child , ASTNode newChild , StructuralPropertyDescriptor property ) { } void postReplaceChildEvent ( ASTNode node , ASTNode child , ASTNode newChild , StructuralPropertyDescriptor property ) { } void preAddChildEvent ( ASTNode node , ASTNode child , StructuralPropertyDescriptor property ) { } void postAddChildEvent ( ASTNode node , ASTNode child , StructuralPropertyDescriptor property ) { } void preValueChangeEvent ( ASTNode node , SimplePropertyDescriptor property ) { } void postValueChangeEvent ( ASTNode node , SimplePropertyDescriptor property ) { } void preCloneNodeEvent ( ASTNode node ) { } void postCloneNodeEvent ( ASTNode node , ASTNode clone ) { } } </s>
<s> package org . eclipse . jdt . core . dom ; public interface IMemberValuePairBinding extends IBinding { public String getName ( ) ; public IMethodBinding getMethodBinding ( ) ; public Object getValue ( ) ; public boolean isDefault ( ) ; } </s>