text
stringlengths
30
1.67M
<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 ; 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 ; public interface IVariableBinding extends IBinding { public boolean isField ( ) ; public boolean isEnumConstant ( ) ; public boolean isParameter ( ) ; public String getName ( ) ; public ITypeBinding getDeclaringClass ( ) ; public ITypeBinding getType ( ) ; public int getVariableId ( ) ; public Object getConstantValue ( ) ; public IMethodBinding getDeclaringMethod ( ) ; public IVariableBinding getVariableDeclaration ( ) ; } </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 . classfmt . ClassFileConstants ; 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 ; long sourceLevel = scanner . sourceLevel ; long complianceLevel = scanner . complianceLevel ; try { scanner . sourceLevel = ClassFileConstants . JDK1_3 ; scanner . complianceLevel = ClassFileConstants . JDK1_5 ; 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 ( ) ; } } finally { this . ast . scanner . sourceLevel = sourceLevel ; this . ast . scanner . complianceLevel = complianceLevel ; } 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 . 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 . Iterator ; import java . util . List ; public abstract class BodyDeclaration extends ASTNode { Javadoc optionalDocComment = null ; private int modifierFlags = Modifier . NONE ; ASTNode . NodeList modifiers = null ; abstract SimplePropertyDescriptor internalModifiersProperty ( ) ; abstract ChildListPropertyDescriptor internalModifiers2Property ( ) ; public final ChildListPropertyDescriptor getModifiersProperty ( ) { return internalModifiers2Property ( ) ; } abstract ChildPropertyDescriptor internalJavadocProperty ( ) ; public final ChildPropertyDescriptor getJavadocProperty ( ) { return internalJavadocProperty ( ) ; } static final ChildPropertyDescriptor internalJavadocPropertyFactory ( Class nodeClass ) { return new ChildPropertyDescriptor ( nodeClass , "<STR_LIT>" , Javadoc . class , OPTIONAL , NO_CYCLE_RISK ) ; } static final SimplePropertyDescriptor internalModifiersPropertyFactory ( Class nodeClass ) { return new SimplePropertyDescriptor ( nodeClass , "<STR_LIT>" , int . class , MANDATORY ) ; } static final ChildListPropertyDescriptor internalModifiers2PropertyFactory ( Class nodeClass ) { return new ChildListPropertyDescriptor ( nodeClass , "<STR_LIT>" , IExtendedModifier . class , CYCLE_RISK ) ; } BodyDeclaration ( AST ast ) { super ( ast ) ; if ( ast . apiLevel >= AST . JLS3_INTERNAL ) { this . modifiers = new ASTNode . NodeList ( internalModifiers2Property ( ) ) ; } } public Javadoc getJavadoc ( ) { return this . optionalDocComment ; } public void setJavadoc ( Javadoc docComment ) { ChildPropertyDescriptor p = internalJavadocProperty ( ) ; ASTNode oldChild = this . optionalDocComment ; preReplaceChild ( oldChild , docComment , p ) ; this . optionalDocComment = docComment ; postReplaceChild ( oldChild , docComment , p ) ; } 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 ) { if ( this . modifiers != null ) { supportedOnlyIn2 ( ) ; } SimplePropertyDescriptor p = internalModifiersProperty ( ) ; preValueChange ( p ) ; this . modifierFlags = pmodifiers ; postValueChange ( p ) ; } public List modifiers ( ) { if ( this . modifiers == null ) { unsupportedIn2 ( ) ; } return this . modifiers ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:3> * <NUM_LIT:4> ; } } </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_INTERNAL ) { 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_INTERNAL ) { 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_INTERNAL ) { 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 ; import java . util . ArrayList ; import java . util . List ; public class TryStatement extends Statement { public static final ChildListPropertyDescriptor RESOURCES_PROPERTY = new ChildListPropertyDescriptor ( TryStatement . class , "<STR_LIT>" , VariableDeclarationExpression . class , CYCLE_RISK ) ; public static final ChildPropertyDescriptor BODY_PROPERTY = new ChildPropertyDescriptor ( TryStatement . class , "<STR_LIT:body>" , Block . class , MANDATORY , CYCLE_RISK ) ; public static final ChildListPropertyDescriptor CATCH_CLAUSES_PROPERTY = new ChildListPropertyDescriptor ( TryStatement . class , "<STR_LIT>" , CatchClause . class , CYCLE_RISK ) ; public static final ChildPropertyDescriptor FINALLY_PROPERTY = new ChildPropertyDescriptor ( TryStatement . class , "<STR_LIT>" , Block . class , OPTIONAL , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; private static final List PROPERTY_DESCRIPTORS_4_0 ; static { List propertyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( TryStatement . class , propertyList ) ; addProperty ( BODY_PROPERTY , propertyList ) ; addProperty ( CATCH_CLAUSES_PROPERTY , propertyList ) ; addProperty ( FINALLY_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; propertyList = new ArrayList ( <NUM_LIT:5> ) ; createPropertyList ( TryStatement . class , propertyList ) ; addProperty ( RESOURCES_PROPERTY , propertyList ) ; addProperty ( BODY_PROPERTY , propertyList ) ; addProperty ( CATCH_CLAUSES_PROPERTY , propertyList ) ; addProperty ( FINALLY_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_4_0 = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { switch ( apiLevel ) { case AST . JLS2_INTERNAL : case AST . JLS3_INTERNAL : return PROPERTY_DESCRIPTORS ; default : return PROPERTY_DESCRIPTORS_4_0 ; } } private ASTNode . NodeList resources = null ; private Block body = null ; private ASTNode . NodeList catchClauses = new ASTNode . NodeList ( CATCH_CLAUSES_PROPERTY ) ; private Block optionalFinallyBody = null ; TryStatement ( AST ast ) { super ( ast ) ; if ( ast . apiLevel >= AST . JLS4 ) { this . resources = new ASTNode . NodeList ( RESOURCES_PROPERTY ) ; } } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == BODY_PROPERTY ) { if ( get ) { return getBody ( ) ; } else { setBody ( ( Block ) child ) ; return null ; } } if ( property == FINALLY_PROPERTY ) { if ( get ) { return getFinally ( ) ; } else { setFinally ( ( Block ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == RESOURCES_PROPERTY ) { return resources ( ) ; } if ( property == CATCH_CLAUSES_PROPERTY ) { return catchClauses ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return TRY_STATEMENT ; } ASTNode clone0 ( AST target ) { TryStatement result = new TryStatement ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; if ( this . ast . apiLevel >= AST . JLS4 ) { result . resources ( ) . addAll ( ASTNode . copySubtrees ( target , resources ( ) ) ) ; } result . setBody ( ( Block ) getBody ( ) . clone ( target ) ) ; result . catchClauses ( ) . addAll ( ASTNode . copySubtrees ( target , catchClauses ( ) ) ) ; result . setFinally ( ( Block ) ASTNode . copySubtree ( target , getFinally ( ) ) ) ; 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 . JLS4 ) { acceptChildren ( visitor , this . resources ) ; } acceptChild ( visitor , getBody ( ) ) ; acceptChildren ( visitor , this . catchClauses ) ; acceptChild ( visitor , getFinally ( ) ) ; } 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 ) ; } public List catchClauses ( ) { return this . catchClauses ; } public Block getFinally ( ) { return this . optionalFinallyBody ; } public void setFinally ( Block block ) { ASTNode oldChild = this . optionalFinallyBody ; preReplaceChild ( oldChild , block , FINALLY_PROPERTY ) ; this . optionalFinallyBody = block ; postReplaceChild ( oldChild , block , FINALLY_PROPERTY ) ; } public List resources ( ) { if ( this . resources == null ) { unsupportedIn2_3 ( ) ; } return this . resources ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:4> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . resources == null ? <NUM_LIT:0> : this . resources . listSize ( ) ) + ( this . body == null ? <NUM_LIT:0> : getBody ( ) . treeSize ( ) ) + this . catchClauses . listSize ( ) + ( this . optionalFinallyBody == null ? <NUM_LIT:0> : getFinally ( ) . 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 Javadoc extends Comment { public static final SimplePropertyDescriptor COMMENT_PROPERTY = new SimplePropertyDescriptor ( Javadoc . class , "<STR_LIT>" , String . class , MANDATORY ) ; public static final ChildListPropertyDescriptor TAGS_PROPERTY = new ChildListPropertyDescriptor ( Javadoc . class , "<STR_LIT>" , TagElement . class , 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 ( Javadoc . class , properyList ) ; addProperty ( COMMENT_PROPERTY , properyList ) ; addProperty ( TAGS_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( properyList ) ; properyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( Javadoc . class , properyList ) ; addProperty ( TAGS_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 static final String MINIMAL_DOC_COMMENT = "<STR_LIT>" ; private String comment = MINIMAL_DOC_COMMENT ; private ASTNode . NodeList tags = new ASTNode . NodeList ( TAGS_PROPERTY ) ; Javadoc ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final Object internalGetSetObjectProperty ( SimplePropertyDescriptor property , boolean get , Object value ) { if ( property == COMMENT_PROPERTY ) { if ( get ) { return getComment ( ) ; } else { setComment ( ( String ) value ) ; return null ; } } return super . internalGetSetObjectProperty ( property , get , value ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == TAGS_PROPERTY ) { return tags ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return JAVADOC ; } ASTNode clone0 ( AST target ) { Javadoc result = new Javadoc ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { result . setComment ( getComment ( ) ) ; } result . tags ( ) . addAll ( ASTNode . copySubtrees ( target , tags ( ) ) ) ; 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 . tags ) ; } visitor . endVisit ( this ) ; } public String getComment ( ) { supportedOnlyIn2 ( ) ; return this . comment ; } public void setComment ( String docComment ) { supportedOnlyIn2 ( ) ; if ( docComment == null ) { throw new IllegalArgumentException ( ) ; } char [ ] source = docComment . toCharArray ( ) ; Scanner scanner = this . ast . scanner ; scanner . resetTo ( <NUM_LIT:0> , source . length ) ; scanner . setSource ( source ) ; try { int token ; boolean onlyOneComment = false ; while ( ( token = scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameCOMMENT_JAVADOC : if ( onlyOneComment ) { throw new IllegalArgumentException ( ) ; } onlyOneComment = true ; break ; default : onlyOneComment = false ; } } if ( ! onlyOneComment ) { throw new IllegalArgumentException ( ) ; } } catch ( InvalidInputException e ) { throw new IllegalArgumentException ( ) ; } preValueChange ( COMMENT_PROPERTY ) ; this . comment = docComment ; postValueChange ( COMMENT_PROPERTY ) ; } public List tags ( ) { return this . tags ; } int memSize ( ) { int size = super . memSize ( ) + <NUM_LIT:2> * <NUM_LIT:4> ; if ( this . comment != MINIMAL_DOC_COMMENT ) { size += stringSize ( this . comment ) ; } return size ; } int treeSize ( ) { return memSize ( ) + this . tags . listSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public final class TagElement extends ASTNode implements IDocElement { public static final SimplePropertyDescriptor TAG_NAME_PROPERTY = new SimplePropertyDescriptor ( TagElement . class , "<STR_LIT>" , String . class , OPTIONAL ) ; public static final ChildListPropertyDescriptor FRAGMENTS_PROPERTY = new ChildListPropertyDescriptor ( TagElement . class , "<STR_LIT>" , IDocElement . class , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( TagElement . class , propertyList ) ; addProperty ( TAG_NAME_PROPERTY , propertyList ) ; addProperty ( FRAGMENTS_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } public static final String TAG_AUTHOR = "<STR_LIT>" ; public static final String TAG_CODE = "<STR_LIT>" ; public static final String TAG_DEPRECATED = "<STR_LIT>" ; public static final String TAG_DOCROOT = "<STR_LIT>" ; public static final String TAG_EXCEPTION = "<STR_LIT>" ; public static final String TAG_INHERITDOC = "<STR_LIT>" ; public static final String TAG_LINK = "<STR_LIT>" ; public static final String TAG_LINKPLAIN = "<STR_LIT>" ; public static final String TAG_LITERAL = "<STR_LIT>" ; public static final String TAG_PARAM = "<STR_LIT>" ; public static final String TAG_RETURN = "<STR_LIT>" ; public static final String TAG_SEE = "<STR_LIT>" ; public static final String TAG_SERIAL = "<STR_LIT>" ; public static final String TAG_SERIALDATA = "<STR_LIT>" ; public static final String TAG_SERIALFIELD = "<STR_LIT>" ; public static final String TAG_SINCE = "<STR_LIT>" ; public static final String TAG_THROWS = "<STR_LIT>" ; public static final String TAG_VALUE = "<STR_LIT>" ; public static final String TAG_VERSION = "<STR_LIT>" ; private String optionalTagName = null ; private ASTNode . NodeList fragments = new ASTNode . NodeList ( FRAGMENTS_PROPERTY ) ; TagElement ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final Object internalGetSetObjectProperty ( SimplePropertyDescriptor property , boolean get , Object value ) { if ( property == TAG_NAME_PROPERTY ) { if ( get ) { return getTagName ( ) ; } else { setTagName ( ( String ) value ) ; return null ; } } return super . internalGetSetObjectProperty ( property , get , value ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == FRAGMENTS_PROPERTY ) { return fragments ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return TAG_ELEMENT ; } ASTNode clone0 ( AST target ) { TagElement result = new TagElement ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setTagName ( getTagName ( ) ) ; result . fragments ( ) . addAll ( ASTNode . copySubtrees ( target , fragments ( ) ) ) ; 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 . fragments ) ; } visitor . endVisit ( this ) ; } public String getTagName ( ) { return this . optionalTagName ; } public void setTagName ( String tagName ) { preValueChange ( TAG_NAME_PROPERTY ) ; this . optionalTagName = tagName ; postValueChange ( TAG_NAME_PROPERTY ) ; } public List fragments ( ) { return this . fragments ; } public boolean isNested ( ) { return ( getParent ( ) instanceof TagElement ) ; } int memSize ( ) { int size = BASE_NODE_SIZE + <NUM_LIT:2> * <NUM_LIT:4> + stringSize ( this . optionalTagName ) ; return size ; } int treeSize ( ) { return memSize ( ) + this . fragments . listSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; public abstract class FileASTRequestor { CompilationUnitResolver compilationUnitResolver = null ; public void acceptAST ( String sourceFilePath , 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 ; public class Message { private String message ; private int startPosition ; private int length ; public Message ( String message , int startPosition ) { if ( message == null ) { throw new IllegalArgumentException ( ) ; } if ( startPosition < - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } this . message = message ; this . startPosition = startPosition ; this . length = <NUM_LIT:0> ; } public Message ( String message , int startPosition , int length ) { if ( message == null ) { throw new IllegalArgumentException ( ) ; } if ( startPosition < - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } this . message = message ; this . startPosition = startPosition ; if ( length <= <NUM_LIT:0> ) { this . length = <NUM_LIT:0> ; } else { this . length = length ; } } public String getMessage ( ) { return this . message ; } public int getSourcePosition ( ) { return getStartPosition ( ) ; } public int getStartPosition ( ) { return this . startPosition ; } public int getLength ( ) { return this . length ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class QualifiedName extends Name { public static final ChildPropertyDescriptor QUALIFIER_PROPERTY = new ChildPropertyDescriptor ( QualifiedName . class , "<STR_LIT>" , Name . class , MANDATORY , CYCLE_RISK ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( QualifiedName . 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 ( QualifiedName . 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 qualifier = null ; private SimpleName name = null ; QualifiedName ( 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 QUALIFIED_NAME ; } ASTNode clone0 ( AST target ) { QualifiedName result = new QualifiedName ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setQualifier ( ( Name ) getQualifier ( ) . clone ( target ) ) ; result . setName ( ( SimpleName ) 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 Name getQualifier ( ) { if ( this . qualifier == null ) { synchronized ( this ) { if ( this . qualifier == null ) { preLazyInit ( ) ; this . qualifier = new SimpleName ( this . ast ) ; postLazyInit ( this . qualifier , QUALIFIER_PROPERTY ) ; } } } return this . qualifier ; } public void setQualifier ( Name qualifier ) { if ( qualifier == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . qualifier ; preReplaceChild ( oldChild , qualifier , QUALIFIER_PROPERTY ) ; this . qualifier = qualifier ; postReplaceChild ( oldChild , qualifier , 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 ) ; } void appendName ( StringBuffer buffer ) { getQualifier ( ) . appendName ( buffer ) ; buffer . append ( '<CHAR_LIT:.>' ) ; getName ( ) . appendName ( buffer ) ; } int memSize ( ) { return BASE_NAME_NODE_SIZE + <NUM_LIT:3> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . name == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) + ( this . qualifier == null ? <NUM_LIT:0> : getQualifier ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class ThisExpression extends Expression { public static final ChildPropertyDescriptor QUALIFIER_PROPERTY = new ChildPropertyDescriptor ( ThisExpression . class , "<STR_LIT>" , Name . class , OPTIONAL , NO_CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( ThisExpression . class , propertyList ) ; addProperty ( QUALIFIER_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Name optionalQualifier = null ; ThisExpression ( 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 ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return THIS_EXPRESSION ; } ASTNode clone0 ( AST target ) { ThisExpression result = new ThisExpression ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setQualifier ( ( Name ) ASTNode . copySubtree ( target , getQualifier ( ) ) ) ; 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 ( ) ) ; } 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 ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:1> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalQualifier == null ? <NUM_LIT:0> : getQualifier ( ) . treeSize ( ) ) ; } } </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 ) { switch ( level ) { case AST . JLS2_INTERNAL : case AST . JLS3_INTERNAL : case AST . JLS4 : break ; default : 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 ( ) ; } } if ( includeRunningVMBootclasspath ) { 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 SuperFieldAccess extends Expression { public static final ChildPropertyDescriptor QUALIFIER_PROPERTY = new ChildPropertyDescriptor ( SuperFieldAccess . class , "<STR_LIT>" , Name . class , OPTIONAL , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( SuperFieldAccess . 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 ( SuperFieldAccess . 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 fieldName = null ; SuperFieldAccess ( 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 SUPER_FIELD_ACCESS ; } ASTNode clone0 ( AST target ) { SuperFieldAccess result = new SuperFieldAccess ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setName ( ( SimpleName ) ASTNode . copySubtree ( target , getName ( ) ) ) ; result . setQualifier ( ( Name ) ASTNode . copySubtree ( target , getQualifier ( ) ) ) ; 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 . fieldName == null ) { synchronized ( this ) { if ( this . fieldName == null ) { preLazyInit ( ) ; this . fieldName = new SimpleName ( this . ast ) ; postLazyInit ( this . fieldName , NAME_PROPERTY ) ; } } } return this . fieldName ; } public IVariableBinding resolveFieldBinding ( ) { return this . ast . getBindingResolver ( ) . resolveField ( this ) ; } public void setName ( SimpleName fieldName ) { if ( fieldName == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . fieldName ; preReplaceChild ( oldChild , fieldName , NAME_PROPERTY ) ; this . fieldName = fieldName ; postReplaceChild ( oldChild , fieldName , NAME_PROPERTY ) ; } 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 . fieldName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class ArrayAccess extends Expression { public static final ChildPropertyDescriptor ARRAY_PROPERTY = new ChildPropertyDescriptor ( ArrayAccess . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; public static final ChildPropertyDescriptor INDEX_PROPERTY = new ChildPropertyDescriptor ( ArrayAccess . class , "<STR_LIT:index>" , Expression . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( ArrayAccess . class , properyList ) ; addProperty ( ARRAY_PROPERTY , properyList ) ; addProperty ( INDEX_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Expression arrayExpression = null ; private Expression indexExpression = null ; ArrayAccess ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == ARRAY_PROPERTY ) { if ( get ) { return getArray ( ) ; } else { setArray ( ( Expression ) child ) ; return null ; } } if ( property == INDEX_PROPERTY ) { if ( get ) { return getIndex ( ) ; } else { setIndex ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return ARRAY_ACCESS ; } ASTNode clone0 ( AST target ) { ArrayAccess result = new ArrayAccess ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setArray ( ( Expression ) getArray ( ) . clone ( target ) ) ; result . setIndex ( ( Expression ) getIndex ( ) . 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 , getArray ( ) ) ; acceptChild ( visitor , getIndex ( ) ) ; } visitor . endVisit ( this ) ; } public Expression getArray ( ) { if ( this . arrayExpression == null ) { synchronized ( this ) { if ( this . arrayExpression == null ) { preLazyInit ( ) ; this . arrayExpression = new SimpleName ( this . ast ) ; postLazyInit ( this . arrayExpression , ARRAY_PROPERTY ) ; } } } return this . arrayExpression ; } public void setArray ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . arrayExpression ; preReplaceChild ( oldChild , expression , ARRAY_PROPERTY ) ; this . arrayExpression = expression ; postReplaceChild ( oldChild , expression , ARRAY_PROPERTY ) ; } public Expression getIndex ( ) { if ( this . indexExpression == null ) { synchronized ( this ) { if ( this . indexExpression == null ) { preLazyInit ( ) ; this . indexExpression = new SimpleName ( this . ast ) ; postLazyInit ( this . indexExpression , INDEX_PROPERTY ) ; } } } return this . indexExpression ; } public void setIndex ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . indexExpression ; preReplaceChild ( oldChild , expression , INDEX_PROPERTY ) ; this . indexExpression = expression ; postReplaceChild ( oldChild , expression , INDEX_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . arrayExpression == null ? <NUM_LIT:0> : getArray ( ) . treeSize ( ) ) + ( this . indexExpression == null ? <NUM_LIT:0> : getIndex ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; public final class ChildPropertyDescriptor extends StructuralPropertyDescriptor { private final Class childClass ; private final boolean mandatory ; final boolean cycleRisk ; ChildPropertyDescriptor ( Class nodeClass , String propertyId , Class childType , boolean mandatory , boolean cycleRisk ) { super ( nodeClass , propertyId ) ; if ( childType == null || ! ASTNode . class . isAssignableFrom ( childType ) ) { throw new IllegalArgumentException ( ) ; } this . childClass = childType ; this . mandatory = mandatory ; this . cycleRisk = cycleRisk ; } public final Class getChildType ( ) { return this . childClass ; } public final boolean isMandatory ( ) { return this . mandatory ; } public final boolean cycleRisk ( ) { return this . cycleRisk ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class ParenthesizedExpression extends Expression { public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( ParenthesizedExpression . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( ParenthesizedExpression . class , propertyList ) ; addProperty ( EXPRESSION_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Expression expression = null ; ParenthesizedExpression ( 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 PARENTHESIZED_EXPRESSION ; } ASTNode clone0 ( AST target ) { ParenthesizedExpression result = new ParenthesizedExpression ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; 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 BASE_NODE_SIZE + <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 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 ; import java . util . ArrayList ; import java . util . List ; public final class SingleMemberAnnotation extends Annotation { public static final ChildPropertyDescriptor TYPE_NAME_PROPERTY = internalTypeNamePropertyFactory ( SingleMemberAnnotation . class ) ; public static final ChildPropertyDescriptor VALUE_PROPERTY = new ChildPropertyDescriptor ( SingleMemberAnnotation . class , "<STR_LIT:value>" , Expression . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( SingleMemberAnnotation . class , propertyList ) ; addProperty ( TYPE_NAME_PROPERTY , propertyList ) ; addProperty ( VALUE_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Expression value = null ; SingleMemberAnnotation ( 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 ; } } if ( property == VALUE_PROPERTY ) { if ( get ) { return getValue ( ) ; } else { setValue ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final ChildPropertyDescriptor internalTypeNameProperty ( ) { return TYPE_NAME_PROPERTY ; } final int getNodeType0 ( ) { return SINGLE_MEMBER_ANNOTATION ; } ASTNode clone0 ( AST target ) { SingleMemberAnnotation result = new SingleMemberAnnotation ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setTypeName ( ( Name ) ASTNode . copySubtree ( target , getTypeName ( ) ) ) ; 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 , getTypeName ( ) ) ; acceptChild ( visitor , getValue ( ) ) ; } visitor . endVisit ( this ) ; } 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 super . memSize ( ) + <NUM_LIT:1> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . typeName == null ? <NUM_LIT:0> : getTypeName ( ) . treeSize ( ) ) + ( this . value == null ? <NUM_LIT:0> : getValue ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class ArrayInitializer extends Expression { public static final ChildListPropertyDescriptor EXPRESSIONS_PROPERTY = new ChildListPropertyDescriptor ( ArrayInitializer . class , "<STR_LIT>" , Expression . class , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( ArrayInitializer . class , properyList ) ; addProperty ( EXPRESSIONS_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private ASTNode . NodeList expressions = new ASTNode . NodeList ( EXPRESSIONS_PROPERTY ) ; ArrayInitializer ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == EXPRESSIONS_PROPERTY ) { return expressions ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return ARRAY_INITIALIZER ; } ASTNode clone0 ( AST target ) { ArrayInitializer result = new ArrayInitializer ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . expressions ( ) . addAll ( ASTNode . copySubtrees ( target , expressions ( ) ) ) ; 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 . expressions ) ; } visitor . endVisit ( this ) ; } public List expressions ( ) { return this . expressions ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:1> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + this . expressions . listSize ( ) ; } } </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 org . eclipse . jdt . core . compiler . CategorizedProblem ; import org . eclipse . jdt . core . compiler . IProblem ; class ASTSyntaxErrorPropagator extends ASTVisitor { private CategorizedProblem [ ] problems ; ASTSyntaxErrorPropagator ( CategorizedProblem [ ] problems ) { super ( true ) ; this . problems = problems ; } private boolean checkAndTagAsMalformed ( ASTNode node ) { boolean tagWithErrors = false ; search : for ( int i = <NUM_LIT:0> , max = this . problems . length ; i < max ; i ++ ) { CategorizedProblem problem = this . problems [ i ] ; switch ( problem . getID ( ) ) { case IProblem . ParsingErrorOnKeywordNoSuggestion : case IProblem . ParsingErrorOnKeyword : case IProblem . ParsingError : case IProblem . ParsingErrorNoSuggestion : case IProblem . ParsingErrorInsertTokenBefore : case IProblem . ParsingErrorInsertTokenAfter : case IProblem . ParsingErrorDeleteToken : case IProblem . ParsingErrorDeleteTokens : case IProblem . ParsingErrorMergeTokens : case IProblem . ParsingErrorInvalidToken : case IProblem . ParsingErrorMisplacedConstruct : case IProblem . ParsingErrorReplaceTokens : case IProblem . ParsingErrorNoSuggestionForTokens : case IProblem . ParsingErrorUnexpectedEOF : case IProblem . ParsingErrorInsertToComplete : case IProblem . ParsingErrorInsertToCompleteScope : case IProblem . ParsingErrorInsertToCompletePhrase : case IProblem . EndOfSource : case IProblem . InvalidHexa : case IProblem . InvalidOctal : case IProblem . InvalidCharacterConstant : case IProblem . InvalidEscape : case IProblem . InvalidInput : case IProblem . InvalidUnicodeEscape : case IProblem . InvalidFloat : case IProblem . NullSourceString : case IProblem . UnterminatedString : case IProblem . UnterminatedComment : case IProblem . InvalidDigit : break ; default : continue search ; } int position = problem . getSourceStart ( ) ; int start = node . getStartPosition ( ) ; int end = start + node . getLength ( ) ; if ( ( start <= position ) && ( position <= end ) ) { node . setFlags ( node . getFlags ( ) | ASTNode . MALFORMED ) ; ASTNode currentNode = node . getParent ( ) ; while ( currentNode != null ) { currentNode . setFlags ( currentNode . getFlags ( ) & ~ ASTNode . MALFORMED ) ; currentNode = currentNode . getParent ( ) ; } tagWithErrors = true ; } } return tagWithErrors ; } public boolean visit ( FieldDeclaration node ) { return checkAndTagAsMalformed ( node ) ; } public boolean visit ( MethodDeclaration node ) { return checkAndTagAsMalformed ( node ) ; } public boolean visit ( PackageDeclaration node ) { return checkAndTagAsMalformed ( node ) ; } public boolean visit ( ImportDeclaration node ) { return checkAndTagAsMalformed ( node ) ; } public boolean visit ( CompilationUnit node ) { return checkAndTagAsMalformed ( node ) ; } public boolean visit ( AnnotationTypeDeclaration node ) { return checkAndTagAsMalformed ( node ) ; } public boolean visit ( EnumDeclaration node ) { return checkAndTagAsMalformed ( node ) ; } public boolean visit ( TypeDeclaration node ) { return checkAndTagAsMalformed ( node ) ; } public boolean visit ( Initializer node ) { return checkAndTagAsMalformed ( node ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; public abstract class Name extends Expression implements IDocElement { static final int BASE_NAME_NODE_SIZE = BASE_NODE_SIZE + <NUM_LIT:1> * <NUM_LIT:4> ; int index ; Name ( AST ast ) { super ( ast ) ; } public final boolean isSimpleName ( ) { return ( this instanceof SimpleName ) ; } public final boolean isQualifiedName ( ) { return ( this instanceof QualifiedName ) ; } public final IBinding resolveBinding ( ) { return this . ast . getBindingResolver ( ) . resolveName ( this ) ; } public final String getFullyQualifiedName ( ) { if ( isSimpleName ( ) ) { return ( ( SimpleName ) this ) . getIdentifier ( ) ; } else { StringBuffer buffer = new StringBuffer ( <NUM_LIT> ) ; appendName ( buffer ) ; return new String ( buffer ) ; } } abstract void appendName ( StringBuffer buffer ) ; } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class MethodRef extends ASTNode implements IDocElement { public static final ChildPropertyDescriptor QUALIFIER_PROPERTY = new ChildPropertyDescriptor ( MethodRef . class , "<STR_LIT>" , Name . class , OPTIONAL , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( MethodRef . class , "<STR_LIT:name>" , SimpleName . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor PARAMETERS_PROPERTY = new ChildListPropertyDescriptor ( MethodRef . class , "<STR_LIT>" , MethodRefParameter . class , NO_CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( MethodRef . class , properyList ) ; addProperty ( QUALIFIER_PROPERTY , properyList ) ; addProperty ( NAME_PROPERTY , properyList ) ; addProperty ( PARAMETERS_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Name optionalQualifier = null ; private SimpleName methodName = null ; private ASTNode . NodeList parameters = new ASTNode . NodeList ( PARAMETERS_PROPERTY ) ; MethodRef ( 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 List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == PARAMETERS_PROPERTY ) { return parameters ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return METHOD_REF ; } ASTNode clone0 ( AST target ) { MethodRef result = new MethodRef ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setQualifier ( ( Name ) ASTNode . copySubtree ( target , getQualifier ( ) ) ) ; result . setName ( ( SimpleName ) ASTNode . copySubtree ( target , getName ( ) ) ) ; result . parameters ( ) . addAll ( ASTNode . copySubtrees ( target , parameters ( ) ) ) ; 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 ( ) ) ; acceptChildren ( visitor , this . parameters ) ; } 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 . 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 parameters ( ) { return this . parameters ; } public final IBinding resolveBinding ( ) { return this . ast . getBindingResolver ( ) . resolveReference ( this ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:3> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalQualifier == null ? <NUM_LIT:0> : getQualifier ( ) . treeSize ( ) ) + ( this . methodName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) + this . parameters . listSize ( ) ; } } </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 org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . compiler . InvalidInputException ; import org . eclipse . jdt . internal . compiler . parser . Scanner ; import org . eclipse . jdt . internal . compiler . parser . TerminalTokens ; import org . eclipse . jdt . internal . compiler . util . Util ; class DefaultCommentMapper { Comment [ ] comments ; Scanner scanner ; int leadingPtr ; ASTNode [ ] leadingNodes ; long [ ] leadingIndexes ; int trailingPtr , lastTrailingPtr ; ASTNode [ ] trailingNodes ; long [ ] trailingIndexes ; static final int STORAGE_INCREMENT = <NUM_LIT:16> ; DefaultCommentMapper ( Comment [ ] table ) { this . comments = table ; } boolean hasSameTable ( Comment [ ] table ) { return this . comments == table ; } Comment getComment ( int position ) { if ( this . comments == null ) { return null ; } int size = this . comments . length ; if ( size == <NUM_LIT:0> ) { return null ; } int index = getCommentIndex ( <NUM_LIT:0> , position , <NUM_LIT:0> ) ; if ( index < <NUM_LIT:0> ) { return null ; } return this . comments [ index ] ; } private int getCommentIndex ( int start , int position , int exact ) { if ( position == <NUM_LIT:0> ) { if ( this . comments . length > <NUM_LIT:0> && this . comments [ <NUM_LIT:0> ] . getStartPosition ( ) == <NUM_LIT:0> ) { return <NUM_LIT:0> ; } return - <NUM_LIT:1> ; } int bottom = start , top = this . comments . length - <NUM_LIT:1> ; int i = <NUM_LIT:0> , index = - <NUM_LIT:1> ; Comment comment = null ; while ( bottom <= top ) { i = bottom + ( top - bottom ) / <NUM_LIT:2> ; comment = this . comments [ i ] ; int commentStart = comment . getStartPosition ( ) ; if ( position < commentStart ) { top = i - <NUM_LIT:1> ; } else if ( position >= ( commentStart + comment . getLength ( ) ) ) { bottom = i + <NUM_LIT:1> ; } else { index = i ; break ; } } if ( index < <NUM_LIT:0> && exact != <NUM_LIT:0> ) { comment = this . comments [ i ] ; if ( position < comment . getStartPosition ( ) ) { return exact < <NUM_LIT:0> ? i - <NUM_LIT:1> : i ; } else { return exact < <NUM_LIT:0> ? i : i + <NUM_LIT:1> ; } } return index ; } public int getExtendedStartPosition ( ASTNode node ) { if ( this . leadingPtr >= <NUM_LIT:0> ) { long range = - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; range < <NUM_LIT:0> && i <= this . leadingPtr ; i ++ ) { if ( this . leadingNodes [ i ] == node ) range = this . leadingIndexes [ i ] ; } if ( range >= <NUM_LIT:0> ) { return this . comments [ ( int ) ( range > > <NUM_LIT:32> ) ] . getStartPosition ( ) ; } } return node . getStartPosition ( ) ; } public final int getLineNumber ( int position , int [ ] lineRange ) { int [ ] lineEnds = this . scanner . lineEnds ; int length = lineEnds . length ; return Util . getLineNumber ( position , lineEnds , ( lineRange [ <NUM_LIT:0> ] > length ? length : lineRange [ <NUM_LIT:0> ] ) - <NUM_LIT:1> , ( lineRange [ <NUM_LIT:1> ] > length ? length : lineRange [ <NUM_LIT:1> ] ) - <NUM_LIT:1> ) ; } public int getExtendedEnd ( ASTNode node ) { int end = node . getStartPosition ( ) + node . getLength ( ) ; if ( this . trailingPtr >= <NUM_LIT:0> ) { long range = - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; range < <NUM_LIT:0> && i <= this . trailingPtr ; i ++ ) { if ( this . trailingNodes [ i ] == node ) range = this . trailingIndexes [ i ] ; } if ( range >= <NUM_LIT:0> ) { Comment lastComment = this . comments [ ( int ) range ] ; end = lastComment . getStartPosition ( ) + lastComment . getLength ( ) ; } } return end - <NUM_LIT:1> ; } public int getExtendedLength ( ASTNode node ) { return getExtendedEnd ( node ) - getExtendedStartPosition ( node ) + <NUM_LIT:1> ; } int firstLeadingCommentIndex ( ASTNode node ) { if ( this . leadingPtr >= <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i <= this . leadingPtr ; i ++ ) { if ( this . leadingNodes [ i ] == node ) { return ( int ) ( this . leadingIndexes [ i ] > > <NUM_LIT:32> ) ; } } } return - <NUM_LIT:1> ; } int lastTrailingCommentIndex ( ASTNode node ) { if ( this . trailingPtr >= <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i <= this . trailingPtr ; i ++ ) { if ( this . trailingNodes [ i ] == node ) { return ( int ) this . trailingIndexes [ i ] ; } } } return - <NUM_LIT:1> ; } void initialize ( CompilationUnit unit , Scanner sc ) { this . leadingPtr = - <NUM_LIT:1> ; this . trailingPtr = - <NUM_LIT:1> ; this . comments = unit . optionalCommentTable ; if ( this . comments == null ) { return ; } int size = this . comments . length ; if ( size == <NUM_LIT:0> ) { return ; } this . scanner = sc ; this . scanner . tokenizeWhiteSpace = true ; DefaultASTVisitor commentVisitor = new CommentMapperVisitor ( ) ; unit . accept ( commentVisitor ) ; int leadingCount = this . leadingPtr + <NUM_LIT:1> ; if ( leadingCount > <NUM_LIT:0> && leadingCount < this . leadingIndexes . length ) { System . arraycopy ( this . leadingNodes , <NUM_LIT:0> , this . leadingNodes = new ASTNode [ leadingCount ] , <NUM_LIT:0> , leadingCount ) ; System . arraycopy ( this . leadingIndexes , <NUM_LIT:0> , this . leadingIndexes = new long [ leadingCount ] , <NUM_LIT:0> , leadingCount ) ; } if ( this . trailingPtr >= <NUM_LIT:0> ) { while ( this . trailingIndexes [ this . trailingPtr ] == - <NUM_LIT:1> ) { this . trailingPtr -- ; if ( this . trailingPtr < <NUM_LIT:0> ) { this . trailingIndexes = null ; this . trailingNodes = null ; break ; } } int trailingCount = this . trailingPtr + <NUM_LIT:1> ; if ( trailingCount > <NUM_LIT:0> && trailingCount < this . trailingIndexes . length ) { System . arraycopy ( this . trailingNodes , <NUM_LIT:0> , this . trailingNodes = new ASTNode [ trailingCount ] , <NUM_LIT:0> , trailingCount ) ; System . arraycopy ( this . trailingIndexes , <NUM_LIT:0> , this . trailingIndexes = new long [ trailingCount ] , <NUM_LIT:0> , trailingCount ) ; } } this . scanner = null ; } int storeLeadingComments ( ASTNode node , int previousEnd , int [ ] parentLineRange ) { int nodeStart = node . getStartPosition ( ) ; int extended = nodeStart ; int previousEndLine = getLineNumber ( previousEnd , parentLineRange ) ; int nodeStartLine = getLineNumber ( nodeStart , parentLineRange ) ; int idx = getCommentIndex ( <NUM_LIT:0> , nodeStart , - <NUM_LIT:1> ) ; if ( idx == - <NUM_LIT:1> ) { return nodeStart ; } int startIdx = - <NUM_LIT:1> ; int endIdx = idx ; int previousStart = nodeStart ; while ( idx >= <NUM_LIT:0> && previousStart >= previousEnd ) { Comment comment = this . comments [ idx ] ; int commentStart = comment . getStartPosition ( ) ; int end = commentStart + comment . getLength ( ) - <NUM_LIT:1> ; int commentLine = getLineNumber ( commentStart , parentLineRange ) ; if ( end <= previousEnd || ( commentLine == previousEndLine && commentLine != nodeStartLine ) ) { break ; } else if ( ( end + <NUM_LIT:1> ) < previousStart ) { this . scanner . resetTo ( end + <NUM_LIT:1> , previousStart ) ; try { int token = this . scanner . getNextToken ( ) ; if ( token != TerminalTokens . TokenNameWHITESPACE || this . scanner . currentPosition != previousStart ) { if ( idx == endIdx ) { return nodeStart ; } break ; } } catch ( InvalidInputException e ) { return nodeStart ; } char [ ] gap = this . scanner . getCurrentIdentifierSource ( ) ; int nbrLine = <NUM_LIT:0> ; int pos = - <NUM_LIT:1> ; while ( ( pos = CharOperation . indexOf ( '<STR_LIT:\n>' , gap , pos + <NUM_LIT:1> ) ) >= <NUM_LIT:0> ) { nbrLine ++ ; } if ( nbrLine > <NUM_LIT:1> ) { break ; } } previousStart = commentStart ; startIdx = idx -- ; } if ( startIdx != - <NUM_LIT:1> ) { int commentStart = this . comments [ startIdx ] . getStartPosition ( ) ; if ( previousEnd < commentStart && previousEndLine != nodeStartLine ) { int lastTokenEnd = previousEnd ; this . scanner . resetTo ( previousEnd , commentStart ) ; try { while ( this . scanner . currentPosition < commentStart ) { if ( this . scanner . getNextToken ( ) != TerminalTokens . TokenNameWHITESPACE ) { lastTokenEnd = this . scanner . getCurrentTokenEndPosition ( ) ; } } } catch ( InvalidInputException e ) { } int lastTokenLine = getLineNumber ( lastTokenEnd , parentLineRange ) ; int length = this . comments . length ; while ( startIdx < length && lastTokenLine == getLineNumber ( this . comments [ startIdx ] . getStartPosition ( ) , parentLineRange ) && nodeStartLine != lastTokenLine ) { startIdx ++ ; } } if ( startIdx <= endIdx ) { if ( ++ this . leadingPtr == <NUM_LIT:0> ) { this . leadingNodes = new ASTNode [ STORAGE_INCREMENT ] ; this . leadingIndexes = new long [ STORAGE_INCREMENT ] ; } else if ( this . leadingPtr == this . leadingNodes . length ) { int newLength = ( this . leadingPtr * <NUM_LIT:3> / <NUM_LIT:2> ) + STORAGE_INCREMENT ; System . arraycopy ( this . leadingNodes , <NUM_LIT:0> , this . leadingNodes = new ASTNode [ newLength ] , <NUM_LIT:0> , this . leadingPtr ) ; System . arraycopy ( this . leadingIndexes , <NUM_LIT:0> , this . leadingIndexes = new long [ newLength ] , <NUM_LIT:0> , this . leadingPtr ) ; } this . leadingNodes [ this . leadingPtr ] = node ; this . leadingIndexes [ this . leadingPtr ] = ( ( ( long ) startIdx ) << <NUM_LIT:32> ) + endIdx ; extended = this . comments [ endIdx ] . getStartPosition ( ) ; } } return extended ; } int storeTrailingComments ( ASTNode node , int nextStart , boolean lastChild , int [ ] parentLineRange ) { int nodeEnd = node . getStartPosition ( ) + node . getLength ( ) - <NUM_LIT:1> ; if ( nodeEnd == nextStart ) { if ( ++ this . trailingPtr == <NUM_LIT:0> ) { this . trailingNodes = new ASTNode [ STORAGE_INCREMENT ] ; this . trailingIndexes = new long [ STORAGE_INCREMENT ] ; this . lastTrailingPtr = - <NUM_LIT:1> ; } else if ( this . trailingPtr == this . trailingNodes . length ) { int newLength = ( this . trailingPtr * <NUM_LIT:3> / <NUM_LIT:2> ) + STORAGE_INCREMENT ; System . arraycopy ( this . trailingNodes , <NUM_LIT:0> , this . trailingNodes = new ASTNode [ newLength ] , <NUM_LIT:0> , this . trailingPtr ) ; System . arraycopy ( this . trailingIndexes , <NUM_LIT:0> , this . trailingIndexes = new long [ newLength ] , <NUM_LIT:0> , this . trailingPtr ) ; } this . trailingNodes [ this . trailingPtr ] = node ; this . trailingIndexes [ this . trailingPtr ] = - <NUM_LIT:1> ; return nodeEnd ; } int extended = nodeEnd ; int nodeEndLine = getLineNumber ( nodeEnd , parentLineRange ) ; int idx = getCommentIndex ( <NUM_LIT:0> , nodeEnd , <NUM_LIT:1> ) ; if ( idx == - <NUM_LIT:1> ) { return nodeEnd ; } int startIdx = idx ; int endIdx = - <NUM_LIT:1> ; int length = this . comments . length ; int commentStart = extended + <NUM_LIT:1> ; int previousEnd = nodeEnd + <NUM_LIT:1> ; int sameLineIdx = - <NUM_LIT:1> ; while ( idx < length && commentStart < nextStart ) { Comment comment = this . comments [ idx ] ; commentStart = comment . getStartPosition ( ) ; if ( commentStart >= nextStart ) { break ; } else if ( previousEnd < commentStart ) { this . scanner . resetTo ( previousEnd , commentStart ) ; try { int token = this . scanner . getNextToken ( ) ; if ( token != TerminalTokens . TokenNameWHITESPACE || this . scanner . currentPosition != commentStart ) { if ( idx == startIdx ) { return nodeEnd ; } break ; } } catch ( InvalidInputException e ) { return nodeEnd ; } char [ ] gap = this . scanner . getCurrentIdentifierSource ( ) ; int nbrLine = <NUM_LIT:0> ; int pos = - <NUM_LIT:1> ; while ( ( pos = CharOperation . indexOf ( '<STR_LIT:\n>' , gap , pos + <NUM_LIT:1> ) ) >= <NUM_LIT:0> ) { nbrLine ++ ; } if ( nbrLine > <NUM_LIT:1> ) { break ; } } int commentLine = getLineNumber ( commentStart , parentLineRange ) ; if ( commentLine == nodeEndLine ) { sameLineIdx = idx ; } previousEnd = commentStart + comment . getLength ( ) ; endIdx = idx ++ ; } if ( endIdx != - <NUM_LIT:1> ) { if ( ! lastChild ) { int nextLine = getLineNumber ( nextStart , parentLineRange ) ; int previousLine = getLineNumber ( previousEnd , parentLineRange ) ; if ( ( nextLine - previousLine ) <= <NUM_LIT:1> ) { if ( sameLineIdx == - <NUM_LIT:1> ) return nodeEnd ; endIdx = sameLineIdx ; } } if ( ++ this . trailingPtr == <NUM_LIT:0> ) { this . trailingNodes = new ASTNode [ STORAGE_INCREMENT ] ; this . trailingIndexes = new long [ STORAGE_INCREMENT ] ; this . lastTrailingPtr = - <NUM_LIT:1> ; } else if ( this . trailingPtr == this . trailingNodes . length ) { int newLength = ( this . trailingPtr * <NUM_LIT:3> / <NUM_LIT:2> ) + STORAGE_INCREMENT ; System . arraycopy ( this . trailingNodes , <NUM_LIT:0> , this . trailingNodes = new ASTNode [ newLength ] , <NUM_LIT:0> , this . trailingPtr ) ; System . arraycopy ( this . trailingIndexes , <NUM_LIT:0> , this . trailingIndexes = new long [ newLength ] , <NUM_LIT:0> , this . trailingPtr ) ; } this . trailingNodes [ this . trailingPtr ] = node ; long nodeRange = ( ( ( long ) startIdx ) << <NUM_LIT:32> ) + endIdx ; this . trailingIndexes [ this . trailingPtr ] = nodeRange ; extended = this . comments [ endIdx ] . getStartPosition ( ) + this . comments [ endIdx ] . getLength ( ) - <NUM_LIT:1> ; ASTNode previousNode = node ; int ptr = this . trailingPtr - <NUM_LIT:1> ; while ( ptr >= <NUM_LIT:0> ) { long range = this . trailingIndexes [ ptr ] ; if ( range != - <NUM_LIT:1> ) break ; ASTNode unresolved = this . trailingNodes [ ptr ] ; if ( previousNode != unresolved . getParent ( ) ) break ; this . trailingIndexes [ ptr ] = nodeRange ; previousNode = unresolved ; ptr -- ; } if ( ptr > this . lastTrailingPtr ) { int offset = ptr - this . lastTrailingPtr ; for ( int i = ptr + <NUM_LIT:1> ; i <= this . trailingPtr ; i ++ ) { this . trailingNodes [ i - offset ] = this . trailingNodes [ i ] ; this . trailingIndexes [ i - offset ] = this . trailingIndexes [ i ] ; } this . trailingPtr -= offset ; } this . lastTrailingPtr = this . trailingPtr ; } return extended ; } class CommentMapperVisitor extends DefaultASTVisitor { ASTNode topSiblingParent = null ; ASTNode [ ] siblings = new ASTNode [ <NUM_LIT:10> ] ; int [ ] [ ] parentLineRange = new int [ <NUM_LIT:10> ] [ ] ; int siblingPtr = - <NUM_LIT:1> ; protected boolean visitNode ( ASTNode node ) { ASTNode parent = node . getParent ( ) ; int previousEnd = parent . getStartPosition ( ) ; ASTNode sibling = parent == this . topSiblingParent ? ( ASTNode ) this . siblings [ this . siblingPtr ] : null ; if ( sibling != null ) { try { previousEnd = storeTrailingComments ( sibling , node . getStartPosition ( ) , false , this . parentLineRange [ this . siblingPtr ] ) ; } catch ( Exception ex ) { } } if ( ( node . typeAndFlags & ASTNode . MALFORMED ) != <NUM_LIT:0> ) { return false ; } int [ ] previousLineRange = this . siblingPtr > - <NUM_LIT:1> ? this . parentLineRange [ this . siblingPtr ] : new int [ ] { <NUM_LIT:1> , DefaultCommentMapper . this . scanner . linePtr + <NUM_LIT:1> } ; try { storeLeadingComments ( node , previousEnd , previousLineRange ) ; } catch ( Exception ex ) { } if ( this . topSiblingParent != parent ) { if ( this . siblings . length == ++ this . siblingPtr ) { System . arraycopy ( this . siblings , <NUM_LIT:0> , this . siblings = new ASTNode [ this . siblingPtr * <NUM_LIT:2> ] , <NUM_LIT:0> , this . siblingPtr ) ; System . arraycopy ( this . parentLineRange , <NUM_LIT:0> , this . parentLineRange = new int [ this . siblingPtr * <NUM_LIT:2> ] [ ] , <NUM_LIT:0> , this . siblingPtr ) ; } if ( this . topSiblingParent == null ) { this . parentLineRange [ this . siblingPtr ] = previousLineRange ; } else { int parentStart = parent . getStartPosition ( ) ; int firstLine = getLineNumber ( parentStart , previousLineRange ) ; int lastLine = getLineNumber ( parentStart + parent . getLength ( ) - <NUM_LIT:1> , previousLineRange ) ; if ( this . parentLineRange [ this . siblingPtr ] == null ) { this . parentLineRange [ this . siblingPtr ] = new int [ ] { firstLine , lastLine } ; } else { int [ ] lineRange = this . parentLineRange [ this . siblingPtr ] ; lineRange [ <NUM_LIT:0> ] = firstLine ; lineRange [ <NUM_LIT:1> ] = lastLine ; } } this . topSiblingParent = parent ; } this . siblings [ this . siblingPtr ] = node ; return true ; } protected void endVisitNode ( ASTNode node ) { ASTNode sibling = this . topSiblingParent == node ? ( ASTNode ) this . siblings [ this . siblingPtr ] : null ; if ( sibling != null ) { try { storeTrailingComments ( sibling , node . getStartPosition ( ) + node . getLength ( ) - <NUM_LIT:1> , true , this . parentLineRange [ this . siblingPtr ] ) ; } catch ( Exception ex ) { } } if ( this . topSiblingParent != null && this . topSiblingParent == node ) { this . siblingPtr -- ; this . topSiblingParent = node . getParent ( ) ; } } public boolean visit ( Modifier modifier ) { return false ; } public boolean visit ( CompilationUnit node ) { return true ; } } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class WildcardType extends Type { public static final ChildPropertyDescriptor BOUND_PROPERTY = new ChildPropertyDescriptor ( WildcardType . class , "<STR_LIT>" , Type . class , OPTIONAL , CYCLE_RISK ) ; public static final SimplePropertyDescriptor UPPER_BOUND_PROPERTY = new SimplePropertyDescriptor ( WildcardType . class , "<STR_LIT>" , boolean . class , MANDATORY ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( WildcardType . class , propertyList ) ; addProperty ( BOUND_PROPERTY , propertyList ) ; addProperty ( UPPER_BOUND_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Type optionalBound = null ; private boolean isUpperBound = true ; WildcardType ( AST ast ) { super ( ast ) ; unsupportedIn2 ( ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final boolean internalGetSetBooleanProperty ( SimplePropertyDescriptor property , boolean get , boolean value ) { if ( property == UPPER_BOUND_PROPERTY ) { if ( get ) { return isUpperBound ( ) ; } else { setUpperBound ( value ) ; return false ; } } return super . internalGetSetBooleanProperty ( property , get , value ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == BOUND_PROPERTY ) { if ( get ) { return getBound ( ) ; } else { setBound ( ( Type ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return WILDCARD_TYPE ; } ASTNode clone0 ( AST target ) { WildcardType result = new WildcardType ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setBound ( ( Type ) ASTNode . copySubtree ( target , getBound ( ) ) , isUpperBound ( ) ) ; 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 , getBound ( ) ) ; } visitor . endVisit ( this ) ; } public boolean isUpperBound ( ) { return this . isUpperBound ; } public Type getBound ( ) { return this . optionalBound ; } public void setBound ( Type type , boolean isUpperBound ) { setBound ( type ) ; setUpperBound ( isUpperBound ) ; } public void setBound ( Type type ) { ASTNode oldChild = this . optionalBound ; preReplaceChild ( oldChild , type , BOUND_PROPERTY ) ; this . optionalBound = type ; postReplaceChild ( oldChild , type , BOUND_PROPERTY ) ; } public void setUpperBound ( boolean isUpperBound ) { preValueChange ( UPPER_BOUND_PROPERTY ) ; this . isUpperBound = isUpperBound ; postValueChange ( UPPER_BOUND_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalBound == null ? <NUM_LIT:0> : getBound ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; public class VariableDeclarationStatement extends Statement { public static final SimplePropertyDescriptor MODIFIERS_PROPERTY = new SimplePropertyDescriptor ( VariableDeclarationStatement . class , "<STR_LIT>" , int . class , MANDATORY ) ; public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY = new ChildListPropertyDescriptor ( VariableDeclarationStatement . class , "<STR_LIT>" , IExtendedModifier . class , CYCLE_RISK ) ; public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor ( VariableDeclarationStatement . class , "<STR_LIT:type>" , Type . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor FRAGMENTS_PROPERTY = new ChildListPropertyDescriptor ( VariableDeclarationStatement . class , "<STR_LIT>" , VariableDeclarationFragment . 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 ( VariableDeclarationStatement . class , propertyList ) ; addProperty ( MODIFIERS_PROPERTY , propertyList ) ; addProperty ( TYPE_PROPERTY , propertyList ) ; addProperty ( FRAGMENTS_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( propertyList ) ; propertyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( VariableDeclarationStatement . class , propertyList ) ; addProperty ( MODIFIERS2_PROPERTY , propertyList ) ; addProperty ( TYPE_PROPERTY , propertyList ) ; addProperty ( FRAGMENTS_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 Type baseType = null ; private ASTNode . NodeList variableDeclarationFragments = new ASTNode . NodeList ( FRAGMENTS_PROPERTY ) ; VariableDeclarationStatement ( AST ast ) { super ( ast ) ; if ( ast . apiLevel >= AST . JLS3_INTERNAL ) { this . modifiers = new ASTNode . NodeList ( MODIFIERS2_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> ; } } return super . internalGetSetIntProperty ( property , get , value ) ; } 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 == MODIFIERS2_PROPERTY ) { return modifiers ( ) ; } if ( property == FRAGMENTS_PROPERTY ) { return fragments ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return VARIABLE_DECLARATION_STATEMENT ; } ASTNode clone0 ( AST target ) { VariableDeclarationStatement result = new VariableDeclarationStatement ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { result . setModifiers ( getModifiers ( ) ) ; } if ( this . ast . apiLevel >= AST . JLS3_INTERNAL ) { result . modifiers ( ) . addAll ( ASTNode . copySubtrees ( target , modifiers ( ) ) ) ; } result . setType ( ( Type ) getType ( ) . clone ( target ) ) ; result . fragments ( ) . addAll ( ASTNode . copySubtrees ( target , fragments ( ) ) ) ; 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_INTERNAL ) { acceptChildren ( visitor , this . modifiers ) ; } acceptChild ( visitor , getType ( ) ) ; acceptChildren ( visitor , this . variableDeclarationFragments ) ; } 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 Type getType ( ) { if ( this . baseType == null ) { synchronized ( this ) { if ( this . baseType == null ) { preLazyInit ( ) ; this . baseType = this . ast . newPrimitiveType ( PrimitiveType . INT ) ; postLazyInit ( this . baseType , TYPE_PROPERTY ) ; } } } return this . baseType ; } public void setType ( Type type ) { if ( type == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . baseType ; preReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; this . baseType = type ; postReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; } public List fragments ( ) { return this . variableDeclarationFragments ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:4> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . modifiers == null ? <NUM_LIT:0> : this . modifiers . listSize ( ) ) + ( this . baseType == null ? <NUM_LIT:0> : getType ( ) . treeSize ( ) ) + this . variableDeclarationFragments . listSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class CastExpression extends Expression { public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor ( CastExpression . class , "<STR_LIT:type>" , Type . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( CastExpression . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( CastExpression . class , properyList ) ; addProperty ( TYPE_PROPERTY , properyList ) ; addProperty ( EXPRESSION_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Type type = null ; private Expression expression = null ; CastExpression ( 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 == TYPE_PROPERTY ) { if ( get ) { return getType ( ) ; } else { setType ( ( Type ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return CAST_EXPRESSION ; } ASTNode clone0 ( AST target ) { CastExpression result = new CastExpression ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setType ( ( Type ) getType ( ) . clone ( target ) ) ; 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 , getType ( ) ) ; acceptChild ( visitor , getExpression ( ) ) ; } 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 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 BASE_NODE_SIZE + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . expression == null ? <NUM_LIT:0> : getExpression ( ) . treeSize ( ) ) + ( this . type == null ? <NUM_LIT:0> : getType ( ) . 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 PostfixExpression 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:-->" ) ; private static final Map CODES ; static { CODES = new HashMap ( <NUM_LIT:20> ) ; Operator [ ] ops = { INCREMENT , DECREMENT , } ; 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 ( PostfixExpression . class , "<STR_LIT>" , PostfixExpression . Operator . class , MANDATORY ) ; public static final ChildPropertyDescriptor OPERAND_PROPERTY = new ChildPropertyDescriptor ( PostfixExpression . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( PostfixExpression . class , propertyList ) ; addProperty ( OPERAND_PROPERTY , propertyList ) ; addProperty ( OPERATOR_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private PostfixExpression . Operator operator = PostfixExpression . Operator . INCREMENT ; private Expression operand = null ; PostfixExpression ( 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 POSTFIX_EXPRESSION ; } ASTNode clone0 ( AST target ) { PostfixExpression result = new PostfixExpression ( 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 PostfixExpression . Operator getOperator ( ) { return this . operator ; } public void setOperator ( PostfixExpression . 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 final class LineComment extends Comment { private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:1> ) ; createPropertyList ( LineComment . class , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } LineComment ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final int getNodeType0 ( ) { return LINE_COMMENT ; } ASTNode clone0 ( AST target ) { LineComment result = new LineComment ( 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 super . memSize ( ) ; } int treeSize ( ) { return memSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class UnionType extends Type { public static final ChildListPropertyDescriptor TYPES_PROPERTY = new ChildListPropertyDescriptor ( UnionType . class , "<STR_LIT>" , Type . class , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( UnionType . class , propertyList ) ; addProperty ( TYPES_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private ASTNode . NodeList types = new ASTNode . NodeList ( TYPES_PROPERTY ) ; UnionType ( AST ast ) { super ( ast ) ; unsupportedIn2_3 ( ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == TYPES_PROPERTY ) { return types ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return UNION_TYPE ; } ASTNode clone0 ( AST target ) { UnionType result = new UnionType ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . types ( ) . addAll ( ASTNode . copySubtrees ( target , types ( ) ) ) ; 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 . types ) ; } visitor . endVisit ( this ) ; } public List types ( ) { return this . types ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:1> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + this . types . listSize ( ) ; } } </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 InfixExpression 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 TIMES = new Operator ( "<STR_LIT:*>" ) ; public static final Operator DIVIDE = new Operator ( "<STR_LIT:/>" ) ; public static final Operator REMAINDER = 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 LEFT_SHIFT = new Operator ( "<STR_LIT>" ) ; public static final Operator RIGHT_SHIFT_SIGNED = new Operator ( "<STR_LIT>" ) ; public static final Operator RIGHT_SHIFT_UNSIGNED = new Operator ( "<STR_LIT>" ) ; public static final Operator LESS = new Operator ( "<STR_LIT:<>" ) ; public static final Operator GREATER = new Operator ( "<STR_LIT:>>" ) ; public static final Operator LESS_EQUALS = new Operator ( "<STR_LIT>" ) ; public static final Operator GREATER_EQUALS = new Operator ( "<STR_LIT>" ) ; public static final Operator EQUALS = new Operator ( "<STR_LIT>" ) ; public static final Operator NOT_EQUALS = new Operator ( "<STR_LIT>" ) ; public static final Operator XOR = new Operator ( "<STR_LIT>" ) ; public static final Operator OR = new Operator ( "<STR_LIT:|>" ) ; public static final Operator AND = new Operator ( "<STR_LIT:&>" ) ; public static final Operator CONDITIONAL_OR = new Operator ( "<STR_LIT>" ) ; public static final Operator CONDITIONAL_AND = new Operator ( "<STR_LIT>" ) ; private static final Map CODES ; static { CODES = new HashMap ( <NUM_LIT:20> ) ; Operator [ ] ops = { TIMES , DIVIDE , REMAINDER , PLUS , MINUS , LEFT_SHIFT , RIGHT_SHIFT_SIGNED , RIGHT_SHIFT_UNSIGNED , LESS , GREATER , LESS_EQUALS , GREATER_EQUALS , EQUALS , NOT_EQUALS , XOR , OR , AND , CONDITIONAL_OR , CONDITIONAL_AND , } ; 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 ChildPropertyDescriptor LEFT_OPERAND_PROPERTY = new ChildPropertyDescriptor ( InfixExpression . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; public static final SimplePropertyDescriptor OPERATOR_PROPERTY = new SimplePropertyDescriptor ( InfixExpression . class , "<STR_LIT>" , InfixExpression . Operator . class , MANDATORY ) ; public static final ChildPropertyDescriptor RIGHT_OPERAND_PROPERTY = new ChildPropertyDescriptor ( InfixExpression . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; public static final ChildListPropertyDescriptor EXTENDED_OPERANDS_PROPERTY = new ChildListPropertyDescriptor ( InfixExpression . class , "<STR_LIT>" , Expression . class , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:5> ) ; createPropertyList ( InfixExpression . class , properyList ) ; addProperty ( LEFT_OPERAND_PROPERTY , properyList ) ; addProperty ( OPERATOR_PROPERTY , properyList ) ; addProperty ( RIGHT_OPERAND_PROPERTY , properyList ) ; addProperty ( EXTENDED_OPERANDS_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private InfixExpression . Operator operator = InfixExpression . Operator . PLUS ; private Expression leftOperand = null ; private Expression rightOperand = null ; private ASTNode . NodeList extendedOperands = null ; InfixExpression ( 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_OPERAND_PROPERTY ) { if ( get ) { return getLeftOperand ( ) ; } else { setLeftOperand ( ( Expression ) child ) ; return null ; } } if ( property == RIGHT_OPERAND_PROPERTY ) { if ( get ) { return getRightOperand ( ) ; } else { setRightOperand ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == EXTENDED_OPERANDS_PROPERTY ) { return extendedOperands ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return INFIX_EXPRESSION ; } ASTNode clone0 ( AST target ) { InfixExpression result = new InfixExpression ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setOperator ( getOperator ( ) ) ; result . setLeftOperand ( ( Expression ) getLeftOperand ( ) . clone ( target ) ) ; result . setRightOperand ( ( Expression ) getRightOperand ( ) . clone ( target ) ) ; if ( this . extendedOperands != null ) { result . extendedOperands ( ) . addAll ( ASTNode . copySubtrees ( target , extendedOperands ( ) ) ) ; } 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 ( ) ) ; if ( this . extendedOperands != null ) { acceptChildren ( visitor , this . extendedOperands ) ; } } visitor . endVisit ( this ) ; } public InfixExpression . Operator getOperator ( ) { return this . operator ; } public void setOperator ( InfixExpression . Operator operator ) { if ( operator == null ) { throw new IllegalArgumentException ( ) ; } preValueChange ( OPERATOR_PROPERTY ) ; this . operator = operator ; postValueChange ( OPERATOR_PROPERTY ) ; } 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 Expression getRightOperand ( ) { if ( this . rightOperand == null ) { synchronized ( this ) { if ( this . rightOperand == null ) { preLazyInit ( ) ; this . rightOperand = new SimpleName ( this . ast ) ; postLazyInit ( this . rightOperand , RIGHT_OPERAND_PROPERTY ) ; } } } return this . rightOperand ; } public void setRightOperand ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . rightOperand ; preReplaceChild ( oldChild , expression , RIGHT_OPERAND_PROPERTY ) ; this . rightOperand = expression ; postReplaceChild ( oldChild , expression , RIGHT_OPERAND_PROPERTY ) ; } public boolean hasExtendedOperands ( ) { return ( this . extendedOperands != null ) && this . extendedOperands . size ( ) > <NUM_LIT:0> ; } public List extendedOperands ( ) { if ( this . extendedOperands == null ) { this . extendedOperands = new ASTNode . NodeList ( EXTENDED_OPERANDS_PROPERTY ) ; } return this . extendedOperands ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:4> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . leftOperand == null ? <NUM_LIT:0> : getLeftOperand ( ) . treeSize ( ) ) + ( this . rightOperand == null ? <NUM_LIT:0> : getRightOperand ( ) . treeSize ( ) ) + ( this . extendedOperands == null ? <NUM_LIT:0> : this . extendedOperands . listSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class EmptyStatement extends Statement { private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:1> ) ; createPropertyList ( EmptyStatement . class , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } EmptyStatement ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final int getNodeType0 ( ) { return EMPTY_STATEMENT ; } ASTNode clone0 ( AST target ) { EmptyStatement result = new EmptyStatement ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; 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 treeSize ( ) { return memSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public final class BlockComment extends Comment { private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:1> ) ; createPropertyList ( BlockComment . class , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } BlockComment ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final int getNodeType0 ( ) { return BLOCK_COMMENT ; } ASTNode clone0 ( AST target ) { BlockComment result = new BlockComment ( 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 super . memSize ( ) ; } int treeSize ( ) { return memSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . HashMap ; import java . util . Map ; import org . eclipse . jdt . core . WorkingCopyOwner ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . AbstractVariableDeclaration ; import org . eclipse . jdt . internal . compiler . ast . AllocationExpression ; import org . eclipse . jdt . internal . compiler . ast . ArrayAllocationExpression ; import org . eclipse . jdt . internal . compiler . ast . CompilationUnitDeclaration ; import org . eclipse . jdt . internal . compiler . ast . ExplicitConstructorCall ; import org . eclipse . jdt . internal . compiler . ast . FieldReference ; import org . eclipse . jdt . internal . compiler . ast . JavadocImplicitTypeReference ; import org . eclipse . jdt . internal . compiler . ast . ImportReference ; import org . eclipse . jdt . internal . compiler . ast . JavadocAllocationExpression ; import org . eclipse . jdt . internal . compiler . ast . JavadocFieldReference ; import org . eclipse . jdt . internal . compiler . ast . JavadocMessageSend ; import org . eclipse . jdt . internal . compiler . ast . JavadocQualifiedTypeReference ; import org . eclipse . jdt . internal . compiler . ast . JavadocSingleNameReference ; import org . eclipse . jdt . internal . compiler . ast . JavadocSingleTypeReference ; import org . eclipse . jdt . internal . compiler . ast . Literal ; import org . eclipse . jdt . internal . compiler . ast . LocalDeclaration ; import org . eclipse . jdt . internal . compiler . ast . MemberValuePair ; import org . eclipse . jdt . internal . compiler . ast . MessageSend ; import org . eclipse . jdt . internal . compiler . ast . ParameterizedQualifiedTypeReference ; import org . eclipse . jdt . internal . compiler . ast . QualifiedNameReference ; import org . eclipse . jdt . internal . compiler . ast . QualifiedSuperReference ; import org . eclipse . jdt . internal . compiler . ast . QualifiedTypeReference ; import org . eclipse . jdt . internal . compiler . ast . SingleNameReference ; import org . eclipse . jdt . internal . compiler . ast . SingleTypeReference ; import org . eclipse . jdt . internal . compiler . ast . ThisReference ; import org . eclipse . jdt . internal . compiler . ast . TypeReference ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . ArrayBinding ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; 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 . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . LocalVariableBinding ; import org . eclipse . jdt . internal . compiler . lookup . LookupEnvironment ; import org . eclipse . jdt . internal . compiler . lookup . ParameterizedGenericMethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemFieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReferenceBinding ; 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 . TypeIds ; import org . eclipse . jdt . internal . compiler . problem . AbortCompilation ; import org . eclipse . jdt . internal . core . util . Util ; class DefaultBindingResolver extends BindingResolver { static class BindingTables { Map bindingKeysToBindings ; Map compilerBindingsToASTBindings ; BindingTables ( ) { this . compilerBindingsToASTBindings = new HashMap ( ) ; this . bindingKeysToBindings = new HashMap ( ) ; } } Map astNodesToBlockScope ; Map bindingsToAstNodes ; BindingTables bindingTables ; Map newAstToOldAst ; private CompilationUnitScope scope ; WorkingCopyOwner workingCopyOwner ; boolean isRecoveringBindings ; boolean fromJavaProject ; DefaultBindingResolver ( CompilationUnitScope scope , WorkingCopyOwner workingCopyOwner , BindingTables bindingTables , boolean isRecoveringBindings , boolean fromJavaProject ) { this . newAstToOldAst = new HashMap ( ) ; this . astNodesToBlockScope = new HashMap ( ) ; this . bindingsToAstNodes = new HashMap ( ) ; this . bindingTables = bindingTables ; this . scope = scope ; this . workingCopyOwner = workingCopyOwner ; this . isRecoveringBindings = isRecoveringBindings ; this . fromJavaProject = fromJavaProject ; } DefaultBindingResolver ( LookupEnvironment lookupEnvironment , WorkingCopyOwner workingCopyOwner , BindingTables bindingTables , boolean isRecoveringBindings , boolean fromJavaProject ) { this . newAstToOldAst = new HashMap ( ) ; this . astNodesToBlockScope = new HashMap ( ) ; this . bindingsToAstNodes = new HashMap ( ) ; this . bindingTables = bindingTables ; this . scope = new CompilationUnitScope ( new CompilationUnitDeclaration ( null , null , - <NUM_LIT:1> ) , lookupEnvironment ) ; this . workingCopyOwner = workingCopyOwner ; this . isRecoveringBindings = isRecoveringBindings ; this . fromJavaProject = fromJavaProject ; } synchronized ASTNode findDeclaringNode ( IBinding binding ) { if ( binding == null ) { return null ; } if ( binding instanceof IMethodBinding ) { IMethodBinding methodBinding = ( IMethodBinding ) binding ; return ( ASTNode ) this . bindingsToAstNodes . get ( methodBinding . getMethodDeclaration ( ) ) ; } else if ( binding instanceof ITypeBinding ) { ITypeBinding typeBinding = ( ITypeBinding ) binding ; return ( ASTNode ) this . bindingsToAstNodes . get ( typeBinding . getTypeDeclaration ( ) ) ; } else if ( binding instanceof IVariableBinding ) { IVariableBinding variableBinding = ( IVariableBinding ) binding ; return ( ASTNode ) this . bindingsToAstNodes . get ( variableBinding . getVariableDeclaration ( ) ) ; } return ( ASTNode ) this . bindingsToAstNodes . get ( binding ) ; } synchronized ASTNode findDeclaringNode ( String bindingKey ) { if ( bindingKey == null ) { return null ; } Object binding = this . bindingTables . bindingKeysToBindings . get ( bindingKey ) ; if ( binding == null ) return null ; return ( ASTNode ) this . bindingsToAstNodes . get ( binding ) ; } IBinding getBinding ( org . eclipse . jdt . internal . compiler . lookup . Binding binding ) { switch ( binding . kind ( ) ) { case Binding . PACKAGE : return getPackageBinding ( ( org . eclipse . jdt . internal . compiler . lookup . PackageBinding ) binding ) ; case Binding . TYPE : case Binding . BASE_TYPE : case Binding . GENERIC_TYPE : case Binding . PARAMETERIZED_TYPE : case Binding . RAW_TYPE : return getTypeBinding ( ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) binding ) ; case Binding . ARRAY_TYPE : case Binding . TYPE_PARAMETER : return new TypeBinding ( this , ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) binding ) ; case Binding . METHOD : return getMethodBinding ( ( org . eclipse . jdt . internal . compiler . lookup . MethodBinding ) binding ) ; case Binding . FIELD : case Binding . LOCAL : return getVariableBinding ( ( org . eclipse . jdt . internal . compiler . lookup . VariableBinding ) binding ) ; } return null ; } Util . BindingsToNodesMap getBindingsToNodesMap ( ) { return new Util . BindingsToNodesMap ( ) { public org . eclipse . jdt . internal . compiler . ast . ASTNode get ( Binding binding ) { return ( org . eclipse . jdt . internal . compiler . ast . ASTNode ) DefaultBindingResolver . this . newAstToOldAst . get ( DefaultBindingResolver . this . bindingsToAstNodes . get ( binding ) ) ; } } ; } synchronized org . eclipse . jdt . internal . compiler . ast . ASTNode getCorrespondingNode ( ASTNode currentNode ) { return ( org . eclipse . jdt . internal . compiler . ast . ASTNode ) this . newAstToOldAst . get ( currentNode ) ; } synchronized IMethodBinding getMethodBinding ( org . eclipse . jdt . internal . compiler . lookup . MethodBinding methodBinding ) { if ( methodBinding != null && ! methodBinding . isValidBinding ( ) ) { org . eclipse . jdt . internal . compiler . lookup . ProblemMethodBinding problemMethodBinding = ( org . eclipse . jdt . internal . compiler . lookup . ProblemMethodBinding ) methodBinding ; methodBinding = problemMethodBinding . closestMatch ; } if ( methodBinding != null ) { if ( ! this . isRecoveringBindings && ( ( methodBinding . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) ) { return null ; } IMethodBinding binding = ( IMethodBinding ) this . bindingTables . compilerBindingsToASTBindings . get ( methodBinding ) ; if ( binding != null ) { return binding ; } binding = new MethodBinding ( this , methodBinding ) ; this . bindingTables . compilerBindingsToASTBindings . put ( methodBinding , binding ) ; return binding ; } return null ; } synchronized IMemberValuePairBinding getMemberValuePairBinding ( ElementValuePair valuePair ) { if ( valuePair == null || valuePair . binding == null ) return null ; IMemberValuePairBinding binding = ( IMemberValuePairBinding ) this . bindingTables . compilerBindingsToASTBindings . get ( valuePair ) ; if ( binding != null ) return binding ; binding = new MemberValuePairBinding ( valuePair , this ) ; this . bindingTables . compilerBindingsToASTBindings . put ( valuePair , binding ) ; return binding ; } synchronized IPackageBinding getPackageBinding ( org . eclipse . jdt . internal . compiler . lookup . PackageBinding packageBinding ) { if ( packageBinding == null ) { return null ; } IPackageBinding binding = ( IPackageBinding ) this . bindingTables . compilerBindingsToASTBindings . get ( packageBinding ) ; if ( binding != null ) { return binding ; } binding = new PackageBinding ( packageBinding , this ) ; this . bindingTables . compilerBindingsToASTBindings . put ( packageBinding , binding ) ; return binding ; } private int getTypeArguments ( ParameterizedQualifiedTypeReference typeReference ) { TypeReference [ ] [ ] typeArguments = typeReference . typeArguments ; int value = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , max = typeArguments . length ; i < max ; i ++ ) { if ( ( typeArguments [ i ] != null ) || ( value != <NUM_LIT:0> ) ) { value ++ ; } } return value ; } synchronized ITypeBinding getTypeBinding ( VariableDeclaration variableDeclaration ) { ITypeBinding binding = ( ITypeBinding ) this . bindingTables . compilerBindingsToASTBindings . get ( variableDeclaration ) ; if ( binding != null ) { return binding ; } binding = new RecoveredTypeBinding ( this , variableDeclaration ) ; this . bindingTables . compilerBindingsToASTBindings . put ( variableDeclaration , binding ) ; return binding ; } synchronized ITypeBinding getTypeBinding ( Type type ) { ITypeBinding binding = ( ITypeBinding ) this . bindingTables . compilerBindingsToASTBindings . get ( type ) ; if ( binding != null ) { return binding ; } binding = new RecoveredTypeBinding ( this , type ) ; this . bindingTables . compilerBindingsToASTBindings . put ( type , binding ) ; return binding ; } synchronized ITypeBinding getTypeBinding ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding referenceBinding ) { if ( referenceBinding == null ) { return null ; } else if ( ! referenceBinding . isValidBinding ( ) ) { switch ( referenceBinding . problemId ( ) ) { case ProblemReasons . NotVisible : case ProblemReasons . NonStaticReferenceInStaticContext : if ( referenceBinding instanceof ProblemReferenceBinding ) { ProblemReferenceBinding problemReferenceBinding = ( ProblemReferenceBinding ) referenceBinding ; org . eclipse . jdt . internal . compiler . lookup . TypeBinding binding2 = problemReferenceBinding . closestMatch ( ) ; ITypeBinding binding = ( ITypeBinding ) this . bindingTables . compilerBindingsToASTBindings . get ( binding2 ) ; if ( binding != null ) { return binding ; } binding = new TypeBinding ( this , binding2 ) ; this . bindingTables . compilerBindingsToASTBindings . put ( binding2 , binding ) ; return binding ; } break ; case ProblemReasons . NotFound : if ( ! this . isRecoveringBindings ) { return null ; } ITypeBinding binding = ( ITypeBinding ) this . bindingTables . compilerBindingsToASTBindings . get ( referenceBinding ) ; if ( binding != null ) { return binding ; } if ( ( referenceBinding . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) { binding = new TypeBinding ( this , referenceBinding ) ; } else { binding = new RecoveredTypeBinding ( this , referenceBinding ) ; } this . bindingTables . compilerBindingsToASTBindings . put ( referenceBinding , binding ) ; return binding ; } return null ; } else { if ( ( referenceBinding . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> && ! this . isRecoveringBindings ) { return null ; } ITypeBinding binding = ( ITypeBinding ) this . bindingTables . compilerBindingsToASTBindings . get ( referenceBinding ) ; if ( binding != null ) { return binding ; } binding = new TypeBinding ( this , referenceBinding ) ; this . bindingTables . compilerBindingsToASTBindings . put ( referenceBinding , binding ) ; return binding ; } } synchronized ITypeBinding getTypeBinding ( RecoveredTypeBinding recoveredTypeBinding , int dimensions ) { if ( recoveredTypeBinding == null ) { return null ; } return new RecoveredTypeBinding ( this , recoveredTypeBinding , dimensions ) ; } synchronized IVariableBinding getVariableBinding ( org . eclipse . jdt . internal . compiler . lookup . VariableBinding variableBinding , VariableDeclaration variableDeclaration ) { if ( this . isRecoveringBindings ) { if ( variableBinding != null ) { if ( variableBinding . isValidBinding ( ) ) { IVariableBinding binding = ( IVariableBinding ) this . bindingTables . compilerBindingsToASTBindings . get ( variableBinding ) ; if ( binding != null ) { return binding ; } if ( variableBinding . type != null ) { binding = new VariableBinding ( this , variableBinding ) ; } else { binding = new RecoveredVariableBinding ( this , variableDeclaration ) ; } this . bindingTables . compilerBindingsToASTBindings . put ( variableBinding , binding ) ; return binding ; } else { if ( variableBinding instanceof ProblemFieldBinding ) { ProblemFieldBinding problemFieldBinding = ( ProblemFieldBinding ) variableBinding ; switch ( problemFieldBinding . problemId ( ) ) { case ProblemReasons . NotVisible : case ProblemReasons . NonStaticReferenceInStaticContext : case ProblemReasons . NonStaticReferenceInConstructorInvocation : ReferenceBinding declaringClass = problemFieldBinding . declaringClass ; FieldBinding exactBinding = declaringClass . getField ( problemFieldBinding . name , true ) ; if ( exactBinding != null ) { IVariableBinding variableBinding2 = ( IVariableBinding ) this . bindingTables . compilerBindingsToASTBindings . get ( exactBinding ) ; if ( variableBinding2 != null ) { return variableBinding2 ; } variableBinding2 = new VariableBinding ( this , exactBinding ) ; this . bindingTables . compilerBindingsToASTBindings . put ( exactBinding , variableBinding2 ) ; return variableBinding2 ; } break ; } } } } return null ; } return this . getVariableBinding ( variableBinding ) ; } public WorkingCopyOwner getWorkingCopyOwner ( ) { return this . workingCopyOwner ; } synchronized IVariableBinding getVariableBinding ( org . eclipse . jdt . internal . compiler . lookup . VariableBinding variableBinding ) { if ( variableBinding != null ) { if ( variableBinding . isValidBinding ( ) ) { org . eclipse . jdt . internal . compiler . lookup . TypeBinding variableType = variableBinding . type ; if ( variableType != null ) { if ( ! this . isRecoveringBindings && ( ( variableType . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) ) { return null ; } IVariableBinding binding = ( IVariableBinding ) this . bindingTables . compilerBindingsToASTBindings . get ( variableBinding ) ; if ( binding != null ) { return binding ; } binding = new VariableBinding ( this , variableBinding ) ; this . bindingTables . compilerBindingsToASTBindings . put ( variableBinding , binding ) ; return binding ; } } else { if ( variableBinding instanceof ProblemFieldBinding ) { ProblemFieldBinding problemFieldBinding = ( ProblemFieldBinding ) variableBinding ; switch ( problemFieldBinding . problemId ( ) ) { case ProblemReasons . NotVisible : case ProblemReasons . NonStaticReferenceInStaticContext : case ProblemReasons . NonStaticReferenceInConstructorInvocation : ReferenceBinding declaringClass = problemFieldBinding . declaringClass ; FieldBinding exactBinding = declaringClass . getField ( problemFieldBinding . name , true ) ; if ( exactBinding != null ) { IVariableBinding variableBinding2 = ( IVariableBinding ) this . bindingTables . compilerBindingsToASTBindings . get ( exactBinding ) ; if ( variableBinding2 != null ) { return variableBinding2 ; } variableBinding2 = new VariableBinding ( this , exactBinding ) ; this . bindingTables . compilerBindingsToASTBindings . put ( exactBinding , variableBinding2 ) ; return variableBinding2 ; } break ; } } } } return null ; } synchronized IAnnotationBinding getAnnotationInstance ( org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding internalInstance ) { if ( internalInstance == null ) return null ; ReferenceBinding annotationType = internalInstance . getAnnotationType ( ) ; if ( ! this . isRecoveringBindings ) { if ( annotationType == null || ( ( annotationType . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) ) { return null ; } } IAnnotationBinding domInstance = ( IAnnotationBinding ) this . bindingTables . compilerBindingsToASTBindings . get ( internalInstance ) ; if ( domInstance != null ) return domInstance ; domInstance = new AnnotationBinding ( internalInstance , this ) ; this . bindingTables . compilerBindingsToASTBindings . put ( internalInstance , domInstance ) ; return domInstance ; } boolean isResolvedTypeInferredFromExpectedType ( MethodInvocation methodInvocation ) { Object oldNode = this . newAstToOldAst . get ( methodInvocation ) ; if ( oldNode instanceof MessageSend ) { MessageSend messageSend = ( MessageSend ) oldNode ; org . eclipse . jdt . internal . compiler . lookup . MethodBinding methodBinding = messageSend . binding ; if ( methodBinding instanceof ParameterizedGenericMethodBinding ) { ParameterizedGenericMethodBinding genericMethodBinding = ( ParameterizedGenericMethodBinding ) methodBinding ; return genericMethodBinding . inferredReturnType ; } } return false ; } boolean isResolvedTypeInferredFromExpectedType ( SuperMethodInvocation superMethodInvocation ) { Object oldNode = this . newAstToOldAst . get ( superMethodInvocation ) ; if ( oldNode instanceof MessageSend ) { MessageSend messageSend = ( MessageSend ) oldNode ; org . eclipse . jdt . internal . compiler . lookup . MethodBinding methodBinding = messageSend . binding ; if ( methodBinding instanceof ParameterizedGenericMethodBinding ) { ParameterizedGenericMethodBinding genericMethodBinding = ( ParameterizedGenericMethodBinding ) methodBinding ; return genericMethodBinding . inferredReturnType ; } } return false ; } boolean isResolvedTypeInferredFromExpectedType ( ClassInstanceCreation classInstanceCreation ) { Object oldNode = this . newAstToOldAst . get ( classInstanceCreation ) ; if ( oldNode instanceof AllocationExpression ) { AllocationExpression allocationExpression = ( AllocationExpression ) oldNode ; return allocationExpression . inferredReturnType ; } return false ; } LookupEnvironment lookupEnvironment ( ) { return this . scope . environment ( ) ; } synchronized void recordScope ( ASTNode astNode , BlockScope blockScope ) { this . astNodesToBlockScope . put ( astNode , blockScope ) ; } boolean resolveBoxing ( Expression expression ) { org . eclipse . jdt . internal . compiler . ast . ASTNode node = ( org . eclipse . jdt . internal . compiler . ast . ASTNode ) this . newAstToOldAst . get ( expression ) ; if ( node instanceof org . eclipse . jdt . internal . compiler . ast . Expression ) { org . eclipse . jdt . internal . compiler . ast . Expression compilerExpression = ( org . eclipse . jdt . internal . compiler . ast . Expression ) node ; return ( compilerExpression . implicitConversion & TypeIds . BOXING ) != <NUM_LIT:0> ; } return false ; } boolean resolveUnboxing ( Expression expression ) { org . eclipse . jdt . internal . compiler . ast . ASTNode node = ( org . eclipse . jdt . internal . compiler . ast . ASTNode ) this . newAstToOldAst . get ( expression ) ; if ( node instanceof org . eclipse . jdt . internal . compiler . ast . Expression ) { org . eclipse . jdt . internal . compiler . ast . Expression compilerExpression = ( org . eclipse . jdt . internal . compiler . ast . Expression ) node ; return ( compilerExpression . implicitConversion & TypeIds . UNBOXING ) != <NUM_LIT:0> ; } return false ; } Object resolveConstantExpressionValue ( Expression expression ) { org . eclipse . jdt . internal . compiler . ast . ASTNode node = ( org . eclipse . jdt . internal . compiler . ast . ASTNode ) this . newAstToOldAst . get ( expression ) ; if ( node instanceof org . eclipse . jdt . internal . compiler . ast . Expression ) { org . eclipse . jdt . internal . compiler . ast . Expression compilerExpression = ( org . eclipse . jdt . internal . compiler . ast . Expression ) node ; Constant constant = compilerExpression . constant ; if ( constant != null && constant != Constant . NotAConstant ) { switch ( constant . typeID ( ) ) { case TypeIds . T_int : return new Integer ( constant . intValue ( ) ) ; case TypeIds . T_byte : return new Byte ( constant . byteValue ( ) ) ; case TypeIds . T_short : return new Short ( constant . shortValue ( ) ) ; case TypeIds . T_char : return new Character ( constant . charValue ( ) ) ; case TypeIds . T_float : return new Float ( constant . floatValue ( ) ) ; case TypeIds . T_double : return new Double ( constant . doubleValue ( ) ) ; case TypeIds . T_boolean : return constant . booleanValue ( ) ? Boolean . TRUE : Boolean . FALSE ; case TypeIds . T_long : return new Long ( constant . longValue ( ) ) ; case TypeIds . T_JavaLangString : return constant . stringValue ( ) ; } return null ; } } return null ; } synchronized IMethodBinding resolveConstructor ( ClassInstanceCreation expression ) { org . eclipse . jdt . internal . compiler . ast . ASTNode node = ( org . eclipse . jdt . internal . compiler . ast . ASTNode ) this . newAstToOldAst . get ( expression ) ; if ( node != null && ( node . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . IsAnonymousType ) != <NUM_LIT:0> ) { org . eclipse . jdt . internal . compiler . ast . TypeDeclaration anonymousLocalTypeDeclaration = ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) node ; return getMethodBinding ( anonymousLocalTypeDeclaration . allocation . binding ) ; } else if ( node instanceof AllocationExpression ) { return getMethodBinding ( ( ( AllocationExpression ) node ) . binding ) ; } return null ; } synchronized IMethodBinding resolveConstructor ( ConstructorInvocation expression ) { org . eclipse . jdt . internal . compiler . ast . ASTNode node = ( org . eclipse . jdt . internal . compiler . ast . ASTNode ) this . newAstToOldAst . get ( expression ) ; if ( node instanceof ExplicitConstructorCall ) { ExplicitConstructorCall explicitConstructorCall = ( ExplicitConstructorCall ) node ; return getMethodBinding ( explicitConstructorCall . binding ) ; } return null ; } IMethodBinding resolveConstructor ( EnumConstantDeclaration enumConstantDeclaration ) { org . eclipse . jdt . internal . compiler . ast . ASTNode node = ( org . eclipse . jdt . internal . compiler . ast . ASTNode ) this . newAstToOldAst . get ( enumConstantDeclaration ) ; if ( node instanceof org . eclipse . jdt . internal . compiler . ast . FieldDeclaration ) { org . eclipse . jdt . internal . compiler . ast . FieldDeclaration fieldDeclaration = ( org . eclipse . jdt . internal . compiler . ast . FieldDeclaration ) node ; if ( fieldDeclaration . getKind ( ) == AbstractVariableDeclaration . ENUM_CONSTANT && fieldDeclaration . initialization != null ) { AllocationExpression allocationExpression = ( AllocationExpression ) fieldDeclaration . initialization ; return getMethodBinding ( allocationExpression . binding ) ; } } return null ; } synchronized IMethodBinding resolveConstructor ( SuperConstructorInvocation expression ) { org . eclipse . jdt . internal . compiler . ast . ASTNode node = ( org . eclipse . jdt . internal . compiler . ast . ASTNode ) this . newAstToOldAst . get ( expression ) ; if ( node instanceof ExplicitConstructorCall ) { ExplicitConstructorCall explicitConstructorCall = ( ExplicitConstructorCall ) node ; return getMethodBinding ( explicitConstructorCall . binding ) ; } return null ; } synchronized ITypeBinding resolveExpressionType ( Expression expression ) { try { switch ( expression . getNodeType ( ) ) { case ASTNode . CLASS_INSTANCE_CREATION : org . eclipse . jdt . internal . compiler . ast . ASTNode astNode = ( org . eclipse . jdt . internal . compiler . ast . ASTNode ) this . newAstToOldAst . get ( expression ) ; if ( astNode instanceof org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) { org . eclipse . jdt . internal . compiler . ast . TypeDeclaration typeDeclaration = ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) astNode ; ITypeBinding typeBinding = this . getTypeBinding ( typeDeclaration . binding ) ; if ( typeBinding != null ) { return typeBinding ; } } else if ( astNode instanceof AllocationExpression ) { AllocationExpression allocationExpression = ( AllocationExpression ) astNode ; return this . getTypeBinding ( allocationExpression . resolvedType ) ; } break ; case ASTNode . SIMPLE_NAME : case ASTNode . QUALIFIED_NAME : return resolveTypeBindingForName ( ( Name ) expression ) ; case ASTNode . ARRAY_INITIALIZER : case ASTNode . ARRAY_CREATION : case ASTNode . ASSIGNMENT : case ASTNode . POSTFIX_EXPRESSION : case ASTNode . PREFIX_EXPRESSION : case ASTNode . CAST_EXPRESSION : case ASTNode . TYPE_LITERAL : case ASTNode . INFIX_EXPRESSION : case ASTNode . INSTANCEOF_EXPRESSION : case ASTNode . FIELD_ACCESS : case ASTNode . SUPER_FIELD_ACCESS : case ASTNode . ARRAY_ACCESS : case ASTNode . METHOD_INVOCATION : case ASTNode . SUPER_METHOD_INVOCATION : case ASTNode . CONDITIONAL_EXPRESSION : case ASTNode . MARKER_ANNOTATION : case ASTNode . NORMAL_ANNOTATION : case ASTNode . SINGLE_MEMBER_ANNOTATION : org . eclipse . jdt . internal . compiler . ast . Expression compilerExpression = ( org . eclipse . jdt . internal . compiler . ast . Expression ) this . newAstToOldAst . get ( expression ) ; if ( compilerExpression != null ) { return this . getTypeBinding ( compilerExpression . resolvedType ) ; } break ; case ASTNode . STRING_LITERAL : if ( this . scope != null ) { return this . getTypeBinding ( this . scope . getJavaLangString ( ) ) ; } break ; case ASTNode . BOOLEAN_LITERAL : case ASTNode . NULL_LITERAL : case ASTNode . CHARACTER_LITERAL : case ASTNode . NUMBER_LITERAL : Literal literal = ( Literal ) this . newAstToOldAst . get ( expression ) ; if ( literal != null ) { return this . getTypeBinding ( literal . literalType ( null ) ) ; } break ; case ASTNode . THIS_EXPRESSION : ThisReference thisReference = ( ThisReference ) this . newAstToOldAst . get ( expression ) ; BlockScope blockScope = ( BlockScope ) this . astNodesToBlockScope . get ( expression ) ; if ( blockScope != null ) { return this . getTypeBinding ( thisReference . resolveType ( blockScope ) ) ; } break ; case ASTNode . PARENTHESIZED_EXPRESSION : ParenthesizedExpression parenthesizedExpression = ( ParenthesizedExpression ) expression ; return resolveExpressionType ( parenthesizedExpression . getExpression ( ) ) ; case ASTNode . VARIABLE_DECLARATION_EXPRESSION : VariableDeclarationExpression variableDeclarationExpression = ( VariableDeclarationExpression ) expression ; Type type = variableDeclarationExpression . getType ( ) ; if ( type != null ) { return type . resolveBinding ( ) ; } break ; } } catch ( AbortCompilation e ) { } return null ; } synchronized IVariableBinding resolveField ( FieldAccess fieldAccess ) { Object oldNode = this . newAstToOldAst . get ( fieldAccess ) ; if ( oldNode instanceof FieldReference ) { FieldReference fieldReference = ( FieldReference ) oldNode ; return this . getVariableBinding ( fieldReference . binding ) ; } return null ; } synchronized IVariableBinding resolveField ( SuperFieldAccess fieldAccess ) { Object oldNode = this . newAstToOldAst . get ( fieldAccess ) ; if ( oldNode instanceof FieldReference ) { FieldReference fieldReference = ( FieldReference ) oldNode ; return this . getVariableBinding ( fieldReference . binding ) ; } return null ; } synchronized IBinding resolveImport ( ImportDeclaration importDeclaration ) { if ( this . scope == null ) return null ; try { org . eclipse . jdt . internal . compiler . ast . ASTNode node = ( org . eclipse . jdt . internal . compiler . ast . ASTNode ) this . newAstToOldAst . get ( importDeclaration ) ; if ( node instanceof ImportReference ) { ImportReference importReference = ( ImportReference ) node ; final boolean isStatic = importReference . isStatic ( ) ; if ( ( importReference . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . OnDemand ) != <NUM_LIT:0> ) { Binding binding = this . scope . getImport ( CharOperation . subarray ( importReference . tokens , <NUM_LIT:0> , importReference . tokens . length ) , true , isStatic ) ; if ( binding != null ) { if ( isStatic ) { if ( binding instanceof org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) { ITypeBinding typeBinding = this . getTypeBinding ( ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) binding ) ; return typeBinding == null ? null : typeBinding ; } } else { if ( ( binding . kind ( ) & Binding . PACKAGE ) != <NUM_LIT:0> ) { IPackageBinding packageBinding = getPackageBinding ( ( org . eclipse . jdt . internal . compiler . lookup . PackageBinding ) binding ) ; if ( packageBinding == null ) { return null ; } return packageBinding ; } else { ITypeBinding typeBinding = this . getTypeBinding ( ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) binding ) ; if ( typeBinding == null ) { return null ; } return typeBinding ; } } } } else { Binding binding = this . scope . getImport ( importReference . tokens , false , isStatic ) ; if ( binding != null ) { if ( isStatic ) { if ( binding instanceof org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) { ITypeBinding typeBinding = this . getTypeBinding ( ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) binding ) ; return typeBinding == null ? null : typeBinding ; } else if ( binding instanceof FieldBinding ) { IVariableBinding variableBinding = this . getVariableBinding ( ( FieldBinding ) binding ) ; return variableBinding == null ? null : variableBinding ; } else if ( binding instanceof org . eclipse . jdt . internal . compiler . lookup . MethodBinding ) { return getMethodBinding ( ( org . eclipse . jdt . internal . compiler . lookup . MethodBinding ) binding ) ; } } else { if ( binding instanceof org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) { ITypeBinding typeBinding = this . getTypeBinding ( ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) binding ) ; return typeBinding == null ? null : typeBinding ; } } } } } } catch ( AbortCompilation e ) { } return null ; } IMethodBinding resolveMember ( AnnotationTypeMemberDeclaration declaration ) { Object oldNode = this . newAstToOldAst . get ( declaration ) ; if ( oldNode instanceof AbstractMethodDeclaration ) { AbstractMethodDeclaration methodDeclaration = ( AbstractMethodDeclaration ) oldNode ; IMethodBinding methodBinding = getMethodBinding ( methodDeclaration . binding ) ; if ( methodBinding == null ) { return null ; } this . bindingsToAstNodes . put ( methodBinding , declaration ) ; String key = methodBinding . getKey ( ) ; if ( key != null ) { this . bindingTables . bindingKeysToBindings . put ( key , methodBinding ) ; } return methodBinding ; } return null ; } synchronized IMethodBinding resolveMethod ( MethodDeclaration method ) { Object oldNode = this . newAstToOldAst . get ( method ) ; if ( oldNode instanceof AbstractMethodDeclaration ) { AbstractMethodDeclaration methodDeclaration = ( AbstractMethodDeclaration ) oldNode ; IMethodBinding methodBinding = getMethodBinding ( methodDeclaration . binding ) ; if ( methodBinding == null ) { return null ; } this . bindingsToAstNodes . put ( methodBinding , method ) ; String key = methodBinding . getKey ( ) ; if ( key != null ) { this . bindingTables . bindingKeysToBindings . put ( key , methodBinding ) ; } return methodBinding ; } return null ; } synchronized IMethodBinding resolveMethod ( MethodInvocation method ) { Object oldNode = this . newAstToOldAst . get ( method ) ; if ( oldNode instanceof MessageSend ) { MessageSend messageSend = ( MessageSend ) oldNode ; return getMethodBinding ( messageSend . binding ) ; } return null ; } synchronized IMethodBinding resolveMethod ( SuperMethodInvocation method ) { Object oldNode = this . newAstToOldAst . get ( method ) ; if ( oldNode instanceof MessageSend ) { MessageSend messageSend = ( MessageSend ) oldNode ; return getMethodBinding ( messageSend . binding ) ; } return null ; } synchronized ITypeBinding resolveTypeBindingForName ( Name name ) { org . eclipse . jdt . internal . compiler . ast . ASTNode node = ( org . eclipse . jdt . internal . compiler . ast . ASTNode ) this . newAstToOldAst . get ( name ) ; int index = name . index ; if ( node instanceof QualifiedNameReference ) { QualifiedNameReference qualifiedNameReference = ( QualifiedNameReference ) node ; final char [ ] [ ] tokens = qualifiedNameReference . tokens ; if ( tokens . length == index ) { return this . getTypeBinding ( qualifiedNameReference . resolvedType ) ; } int indexOfFirstFieldBinding = qualifiedNameReference . indexOfFirstFieldBinding ; if ( index < indexOfFirstFieldBinding ) { BlockScope internalScope = ( BlockScope ) this . astNodesToBlockScope . get ( name ) ; Binding binding = null ; try { if ( internalScope == null ) { if ( this . scope == null ) return null ; binding = this . scope . getTypeOrPackage ( CharOperation . subarray ( tokens , <NUM_LIT:0> , index ) ) ; } else { binding = internalScope . getTypeOrPackage ( CharOperation . subarray ( tokens , <NUM_LIT:0> , index ) ) ; } } catch ( AbortCompilation e ) { } if ( binding instanceof org . eclipse . jdt . internal . compiler . lookup . PackageBinding ) { return null ; } else if ( binding instanceof org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) { return this . getTypeBinding ( ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) binding ) ; } } else if ( index == indexOfFirstFieldBinding ) { if ( qualifiedNameReference . isTypeReference ( ) ) { return this . getTypeBinding ( qualifiedNameReference . resolvedType ) ; } else { if ( qualifiedNameReference . otherBindings == null ) { return null ; } FieldBinding fieldBinding = qualifiedNameReference . otherBindings [ <NUM_LIT:0> ] ; if ( fieldBinding == null ) return null ; org . eclipse . jdt . internal . compiler . lookup . TypeBinding type = fieldBinding . declaringClass ; if ( type == null ) { switch ( qualifiedNameReference . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . RestrictiveFlagMASK ) { case Binding . FIELD : type = ( ( FieldBinding ) qualifiedNameReference . binding ) . type ; break ; case Binding . LOCAL : type = ( ( LocalVariableBinding ) qualifiedNameReference . binding ) . type ; break ; } } return this . getTypeBinding ( type ) ; } } else { if ( qualifiedNameReference . otherBindings == null ) return null ; final int otherBindingsLength = qualifiedNameReference . otherBindings . length ; if ( otherBindingsLength == ( index - indexOfFirstFieldBinding ) ) { return this . getTypeBinding ( qualifiedNameReference . resolvedType ) ; } FieldBinding fieldBinding = qualifiedNameReference . otherBindings [ index - indexOfFirstFieldBinding ] ; if ( fieldBinding == null ) return null ; org . eclipse . jdt . internal . compiler . lookup . TypeBinding type = fieldBinding . declaringClass ; if ( type == null ) { fieldBinding = qualifiedNameReference . otherBindings [ index - indexOfFirstFieldBinding - <NUM_LIT:1> ] ; if ( fieldBinding == null ) return null ; type = fieldBinding . type ; } return this . getTypeBinding ( type ) ; } } else if ( node instanceof QualifiedTypeReference ) { QualifiedTypeReference qualifiedTypeReference = ( QualifiedTypeReference ) node ; if ( qualifiedTypeReference . resolvedType == null ) { return null ; } if ( index == qualifiedTypeReference . tokens . length ) { if ( ! qualifiedTypeReference . resolvedType . isValidBinding ( ) && qualifiedTypeReference instanceof JavadocQualifiedTypeReference ) { JavadocQualifiedTypeReference typeRef = ( JavadocQualifiedTypeReference ) node ; if ( typeRef . packageBinding != null ) { return null ; } } return this . getTypeBinding ( qualifiedTypeReference . resolvedType . leafComponentType ( ) ) ; } else { if ( index >= <NUM_LIT:0> ) { BlockScope internalScope = ( BlockScope ) this . astNodesToBlockScope . get ( name ) ; Binding binding = null ; try { if ( internalScope == null ) { if ( this . scope == null ) return null ; binding = this . scope . getTypeOrPackage ( CharOperation . subarray ( qualifiedTypeReference . tokens , <NUM_LIT:0> , index ) ) ; } else { binding = internalScope . getTypeOrPackage ( CharOperation . subarray ( qualifiedTypeReference . tokens , <NUM_LIT:0> , index ) ) ; } } catch ( AbortCompilation e ) { } if ( binding instanceof org . eclipse . jdt . internal . compiler . lookup . PackageBinding ) { return null ; } else if ( binding instanceof org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) { return this . getTypeBinding ( ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) binding ) ; } else { return null ; } } } } else if ( node instanceof ImportReference ) { ImportReference importReference = ( ImportReference ) node ; int importReferenceLength = importReference . tokens . length ; if ( index >= <NUM_LIT:0> ) { Binding binding = null ; if ( this . scope == null ) return null ; if ( importReferenceLength == index ) { try { binding = this . scope . getImport ( CharOperation . subarray ( importReference . tokens , <NUM_LIT:0> , index ) , ( importReference . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . OnDemand ) != <NUM_LIT:0> , importReference . isStatic ( ) ) ; } catch ( AbortCompilation e ) { } } else { try { binding = this . scope . getImport ( CharOperation . subarray ( importReference . tokens , <NUM_LIT:0> , index ) , true , importReference . isStatic ( ) ) ; } catch ( AbortCompilation e ) { } } if ( binding != null ) { if ( binding instanceof org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) { return this . getTypeBinding ( ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) binding ) ; } return null ; } } } else if ( node instanceof AbstractMethodDeclaration ) { AbstractMethodDeclaration methodDeclaration = ( AbstractMethodDeclaration ) node ; IMethodBinding method = getMethodBinding ( methodDeclaration . binding ) ; if ( method == null ) return null ; return method . getReturnType ( ) ; } else if ( node instanceof org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) { org . eclipse . jdt . internal . compiler . ast . TypeDeclaration typeDeclaration = ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) node ; ITypeBinding typeBinding = this . getTypeBinding ( typeDeclaration . binding ) ; if ( typeBinding != null ) { return typeBinding ; } } if ( node instanceof JavadocSingleNameReference ) { JavadocSingleNameReference singleNameReference = ( JavadocSingleNameReference ) node ; LocalVariableBinding localVariable = ( LocalVariableBinding ) singleNameReference . binding ; if ( localVariable != null ) { return this . getTypeBinding ( localVariable . type ) ; } } if ( node instanceof SingleNameReference ) { SingleNameReference singleNameReference = ( SingleNameReference ) node ; return this . getTypeBinding ( singleNameReference . resolvedType ) ; } else if ( node instanceof QualifiedSuperReference ) { QualifiedSuperReference qualifiedSuperReference = ( QualifiedSuperReference ) node ; return this . getTypeBinding ( qualifiedSuperReference . qualification . resolvedType ) ; } else if ( node instanceof LocalDeclaration ) { IVariableBinding variable = this . getVariableBinding ( ( ( LocalDeclaration ) node ) . binding ) ; if ( variable == null ) return null ; return variable . getType ( ) ; } else if ( node instanceof JavadocFieldReference ) { JavadocFieldReference fieldRef = ( JavadocFieldReference ) node ; if ( fieldRef . methodBinding != null ) { return getMethodBinding ( fieldRef . methodBinding ) . getReturnType ( ) ; } return getTypeBinding ( fieldRef . resolvedType ) ; } else if ( node instanceof FieldReference ) { return getTypeBinding ( ( ( FieldReference ) node ) . resolvedType ) ; } else if ( node instanceof SingleTypeReference ) { SingleTypeReference singleTypeReference = ( SingleTypeReference ) node ; org . eclipse . jdt . internal . compiler . lookup . TypeBinding binding = singleTypeReference . resolvedType ; if ( binding != null ) { return this . getTypeBinding ( binding . leafComponentType ( ) ) ; } } else if ( node instanceof org . eclipse . jdt . internal . compiler . ast . FieldDeclaration ) { org . eclipse . jdt . internal . compiler . ast . FieldDeclaration fieldDeclaration = ( org . eclipse . jdt . internal . compiler . ast . FieldDeclaration ) node ; IVariableBinding field = this . getVariableBinding ( fieldDeclaration . binding ) ; if ( field == null ) return null ; return field . getType ( ) ; } else if ( node instanceof MessageSend ) { MessageSend messageSend = ( MessageSend ) node ; IMethodBinding method = getMethodBinding ( messageSend . binding ) ; if ( method == null ) return null ; return method . getReturnType ( ) ; } else if ( node instanceof AllocationExpression ) { AllocationExpression allocation = ( AllocationExpression ) node ; return getTypeBinding ( allocation . resolvedType ) ; } else if ( node instanceof JavadocImplicitTypeReference ) { JavadocImplicitTypeReference implicitRef = ( JavadocImplicitTypeReference ) node ; return getTypeBinding ( implicitRef . resolvedType ) ; } else if ( node instanceof org . eclipse . jdt . internal . compiler . ast . TypeParameter ) { org . eclipse . jdt . internal . compiler . ast . TypeParameter typeParameter = ( org . eclipse . jdt . internal . compiler . ast . TypeParameter ) node ; return this . getTypeBinding ( typeParameter . binding ) ; } else if ( node instanceof org . eclipse . jdt . internal . compiler . ast . MemberValuePair ) { org . eclipse . jdt . internal . compiler . ast . MemberValuePair memberValuePair = ( org . eclipse . jdt . internal . compiler . ast . MemberValuePair ) node ; IMethodBinding method = getMethodBinding ( memberValuePair . binding ) ; if ( method == null ) return null ; return method . getReturnType ( ) ; } return null ; } synchronized IBinding resolveName ( Name name ) { org . eclipse . jdt . internal . compiler . ast . ASTNode node = ( org . eclipse . jdt . internal . compiler . ast . ASTNode ) this . newAstToOldAst . get ( name ) ; int index = name . index ; if ( node instanceof QualifiedNameReference ) { QualifiedNameReference qualifiedNameReference = ( QualifiedNameReference ) node ; final char [ ] [ ] tokens = qualifiedNameReference . tokens ; int indexOfFirstFieldBinding = qualifiedNameReference . indexOfFirstFieldBinding ; if ( index < indexOfFirstFieldBinding ) { BlockScope internalScope = ( BlockScope ) this . astNodesToBlockScope . get ( name ) ; Binding binding = null ; try { if ( internalScope == null ) { if ( this . scope == null ) return null ; binding = this . scope . getTypeOrPackage ( CharOperation . subarray ( tokens , <NUM_LIT:0> , index ) ) ; } else { binding = internalScope . getTypeOrPackage ( CharOperation . subarray ( tokens , <NUM_LIT:0> , index ) ) ; } } catch ( AbortCompilation e ) { } if ( binding instanceof org . eclipse . jdt . internal . compiler . lookup . PackageBinding ) { return getPackageBinding ( ( org . eclipse . jdt . internal . compiler . lookup . PackageBinding ) binding ) ; } else if ( binding instanceof org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) { return this . getTypeBinding ( ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) binding ) ; } } else if ( index == indexOfFirstFieldBinding ) { if ( qualifiedNameReference . isTypeReference ( ) ) { return this . getTypeBinding ( qualifiedNameReference . resolvedType ) ; } else { Binding binding = qualifiedNameReference . binding ; if ( binding != null ) { if ( binding . isValidBinding ( ) ) { return this . getVariableBinding ( ( org . eclipse . jdt . internal . compiler . lookup . VariableBinding ) binding ) ; } else if ( binding instanceof ProblemFieldBinding ) { ProblemFieldBinding problemFieldBinding = ( ProblemFieldBinding ) binding ; switch ( problemFieldBinding . problemId ( ) ) { case ProblemReasons . NotVisible : case ProblemReasons . NonStaticReferenceInStaticContext : ReferenceBinding declaringClass = problemFieldBinding . declaringClass ; if ( declaringClass != null ) { FieldBinding exactBinding = declaringClass . getField ( tokens [ tokens . length - <NUM_LIT:1> ] , true ) ; if ( exactBinding != null ) { if ( exactBinding . type != null ) { IVariableBinding variableBinding = ( IVariableBinding ) this . bindingTables . compilerBindingsToASTBindings . get ( exactBinding ) ; if ( variableBinding != null ) { return variableBinding ; } variableBinding = new VariableBinding ( this , exactBinding ) ; this . bindingTables . compilerBindingsToASTBindings . put ( exactBinding , variableBinding ) ; return variableBinding ; } } } break ; } } } } } else { if ( qualifiedNameReference . otherBindings == null || ( index - indexOfFirstFieldBinding - <NUM_LIT:1> ) < <NUM_LIT:0> ) { return null ; } else { return this . getVariableBinding ( qualifiedNameReference . otherBindings [ index - indexOfFirstFieldBinding - <NUM_LIT:1> ] ) ; } } } else if ( node instanceof QualifiedTypeReference ) { QualifiedTypeReference qualifiedTypeReference = ( QualifiedTypeReference ) node ; if ( qualifiedTypeReference . resolvedType == null ) { return null ; } if ( index == qualifiedTypeReference . tokens . length ) { if ( ! qualifiedTypeReference . resolvedType . isValidBinding ( ) && qualifiedTypeReference instanceof JavadocQualifiedTypeReference ) { JavadocQualifiedTypeReference typeRef = ( JavadocQualifiedTypeReference ) node ; if ( typeRef . packageBinding != null ) { return getPackageBinding ( typeRef . packageBinding ) ; } } return this . getTypeBinding ( qualifiedTypeReference . resolvedType . leafComponentType ( ) ) ; } else { if ( index >= <NUM_LIT:0> ) { BlockScope internalScope = ( BlockScope ) this . astNodesToBlockScope . get ( name ) ; Binding binding = null ; try { if ( internalScope == null ) { if ( this . scope == null ) return null ; binding = this . scope . getTypeOrPackage ( CharOperation . subarray ( qualifiedTypeReference . tokens , <NUM_LIT:0> , index ) ) ; } else { binding = internalScope . getTypeOrPackage ( CharOperation . subarray ( qualifiedTypeReference . tokens , <NUM_LIT:0> , index ) ) ; } } catch ( AbortCompilation e ) { } if ( binding instanceof org . eclipse . jdt . internal . compiler . lookup . PackageBinding ) { return getPackageBinding ( ( org . eclipse . jdt . internal . compiler . lookup . PackageBinding ) binding ) ; } else if ( binding instanceof org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) { return this . getTypeBinding ( ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) binding ) ; } else { return null ; } } } } else if ( node instanceof ImportReference ) { ImportReference importReference = ( ImportReference ) node ; int importReferenceLength = importReference . tokens . length ; if ( index >= <NUM_LIT:0> ) { Binding binding = null ; if ( this . scope == null ) return null ; if ( importReferenceLength == index ) { try { binding = this . scope . getImport ( CharOperation . subarray ( importReference . tokens , <NUM_LIT:0> , index ) , ( importReference . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . OnDemand ) != <NUM_LIT:0> , importReference . isStatic ( ) ) ; } catch ( AbortCompilation e ) { } } else { try { binding = this . scope . getImport ( CharOperation . subarray ( importReference . tokens , <NUM_LIT:0> , index ) , true , importReference . isStatic ( ) ) ; } catch ( AbortCompilation e ) { } } if ( binding != null ) { if ( binding instanceof org . eclipse . jdt . internal . compiler . lookup . PackageBinding ) { return getPackageBinding ( ( org . eclipse . jdt . internal . compiler . lookup . PackageBinding ) binding ) ; } else if ( binding instanceof org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) { return this . getTypeBinding ( ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) binding ) ; } else if ( binding instanceof org . eclipse . jdt . internal . compiler . lookup . FieldBinding ) { return this . getVariableBinding ( ( org . eclipse . jdt . internal . compiler . lookup . FieldBinding ) binding ) ; } else if ( binding instanceof org . eclipse . jdt . internal . compiler . lookup . MethodBinding ) { return getMethodBinding ( ( org . eclipse . jdt . internal . compiler . lookup . MethodBinding ) binding ) ; } else { return null ; } } } } else if ( node instanceof CompilationUnitDeclaration ) { CompilationUnitDeclaration compilationUnitDeclaration = ( CompilationUnitDeclaration ) node ; org . eclipse . jdt . internal . compiler . ast . TypeDeclaration [ ] types = compilationUnitDeclaration . types ; if ( types == null || types . length == <NUM_LIT:0> ) { return null ; } org . eclipse . jdt . internal . compiler . ast . TypeDeclaration type = types [ <NUM_LIT:0> ] ; if ( type != null ) { ITypeBinding typeBinding = this . getTypeBinding ( type . binding ) ; if ( typeBinding != null ) { return typeBinding . getPackage ( ) ; } } } else if ( node instanceof AbstractMethodDeclaration ) { AbstractMethodDeclaration methodDeclaration = ( AbstractMethodDeclaration ) node ; IMethodBinding methodBinding = getMethodBinding ( methodDeclaration . binding ) ; if ( methodBinding != null ) { return methodBinding ; } } else if ( node instanceof org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) { org . eclipse . jdt . internal . compiler . ast . TypeDeclaration typeDeclaration = ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) node ; ITypeBinding typeBinding = this . getTypeBinding ( typeDeclaration . binding ) ; if ( typeBinding != null ) { return typeBinding ; } } if ( node instanceof SingleNameReference ) { SingleNameReference singleNameReference = ( SingleNameReference ) node ; if ( singleNameReference . isTypeReference ( ) ) { return this . getTypeBinding ( singleNameReference . resolvedType ) ; } else { Binding binding = singleNameReference . binding ; if ( binding != null ) { if ( binding . isValidBinding ( ) ) { return this . getVariableBinding ( ( org . eclipse . jdt . internal . compiler . lookup . VariableBinding ) binding ) ; } else { if ( binding instanceof ProblemFieldBinding ) { ProblemFieldBinding problemFieldBinding = ( ProblemFieldBinding ) binding ; switch ( problemFieldBinding . problemId ( ) ) { case ProblemReasons . NotVisible : case ProblemReasons . NonStaticReferenceInStaticContext : case ProblemReasons . NonStaticReferenceInConstructorInvocation : ReferenceBinding declaringClass = problemFieldBinding . declaringClass ; FieldBinding exactBinding = declaringClass . getField ( problemFieldBinding . name , true ) ; if ( exactBinding != null ) { if ( exactBinding . type != null ) { IVariableBinding variableBinding2 = ( IVariableBinding ) this . bindingTables . compilerBindingsToASTBindings . get ( exactBinding ) ; if ( variableBinding2 != null ) { return variableBinding2 ; } variableBinding2 = new VariableBinding ( this , exactBinding ) ; this . bindingTables . compilerBindingsToASTBindings . put ( exactBinding , variableBinding2 ) ; return variableBinding2 ; } } break ; } } } } } } else if ( node instanceof QualifiedSuperReference ) { QualifiedSuperReference qualifiedSuperReference = ( QualifiedSuperReference ) node ; return this . getTypeBinding ( qualifiedSuperReference . qualification . resolvedType ) ; } else if ( node instanceof LocalDeclaration ) { return this . getVariableBinding ( ( ( LocalDeclaration ) node ) . binding ) ; } else if ( node instanceof JavadocFieldReference ) { JavadocFieldReference fieldRef = ( JavadocFieldReference ) node ; if ( fieldRef . methodBinding != null ) { return getMethodBinding ( fieldRef . methodBinding ) ; } return getVariableBinding ( fieldRef . binding ) ; } else if ( node instanceof FieldReference ) { return getVariableBinding ( ( ( FieldReference ) node ) . binding ) ; } else if ( node instanceof SingleTypeReference ) { if ( node instanceof JavadocSingleTypeReference ) { JavadocSingleTypeReference typeRef = ( JavadocSingleTypeReference ) node ; if ( typeRef . packageBinding != null ) { return getPackageBinding ( typeRef . packageBinding ) ; } } SingleTypeReference singleTypeReference = ( SingleTypeReference ) node ; org . eclipse . jdt . internal . compiler . lookup . TypeBinding binding = singleTypeReference . resolvedType ; if ( binding == null ) { return null ; } return this . getTypeBinding ( binding . leafComponentType ( ) ) ; } else if ( node instanceof org . eclipse . jdt . internal . compiler . ast . FieldDeclaration ) { org . eclipse . jdt . internal . compiler . ast . FieldDeclaration fieldDeclaration = ( org . eclipse . jdt . internal . compiler . ast . FieldDeclaration ) node ; return this . getVariableBinding ( fieldDeclaration . binding ) ; } else if ( node instanceof MessageSend ) { MessageSend messageSend = ( MessageSend ) node ; return getMethodBinding ( messageSend . binding ) ; } else if ( node instanceof AllocationExpression ) { AllocationExpression allocation = ( AllocationExpression ) node ; return getMethodBinding ( allocation . binding ) ; } else if ( node instanceof JavadocImplicitTypeReference ) { JavadocImplicitTypeReference implicitRef = ( JavadocImplicitTypeReference ) node ; return getTypeBinding ( implicitRef . resolvedType ) ; } else if ( node instanceof org . eclipse . jdt . internal . compiler . ast . TypeParameter ) { org . eclipse . jdt . internal . compiler . ast . TypeParameter typeParameter = ( org . eclipse . jdt . internal . compiler . ast . TypeParameter ) node ; return this . getTypeBinding ( typeParameter . binding ) ; } else if ( node instanceof org . eclipse . jdt . internal . compiler . ast . MemberValuePair ) { org . eclipse . jdt . internal . compiler . ast . MemberValuePair memberValuePair = ( org . eclipse . jdt . internal . compiler . ast . MemberValuePair ) node ; return getMethodBinding ( memberValuePair . binding ) ; } return null ; } synchronized IPackageBinding resolvePackage ( PackageDeclaration pkg ) { if ( this . scope == null ) return null ; try { org . eclipse . jdt . internal . compiler . ast . ASTNode node = ( org . eclipse . jdt . internal . compiler . ast . ASTNode ) this . newAstToOldAst . get ( pkg ) ; if ( node instanceof ImportReference ) { ImportReference importReference = ( ImportReference ) node ; Binding binding = this . scope . getOnlyPackage ( CharOperation . subarray ( importReference . tokens , <NUM_LIT:0> , importReference . tokens . length ) ) ; if ( ( binding != null ) && ( binding . isValidBinding ( ) ) ) { if ( binding instanceof ReferenceBinding ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) binding ; binding = referenceBinding . fPackage ; } if ( binding instanceof org . eclipse . jdt . internal . compiler . lookup . PackageBinding ) { IPackageBinding packageBinding = getPackageBinding ( ( org . eclipse . jdt . internal . compiler . lookup . PackageBinding ) binding ) ; if ( packageBinding == null ) { return null ; } this . bindingsToAstNodes . put ( packageBinding , pkg ) ; String key = packageBinding . getKey ( ) ; if ( key != null ) { this . bindingTables . bindingKeysToBindings . put ( key , packageBinding ) ; } return packageBinding ; } } } } catch ( AbortCompilation e ) { } return null ; } synchronized IBinding resolveReference ( MemberRef ref ) { org . eclipse . jdt . internal . compiler . ast . Expression expression = ( org . eclipse . jdt . internal . compiler . ast . Expression ) this . newAstToOldAst . get ( ref ) ; if ( expression instanceof TypeReference ) { return getTypeBinding ( expression . resolvedType ) ; } else if ( expression instanceof JavadocFieldReference ) { JavadocFieldReference fieldRef = ( JavadocFieldReference ) expression ; if ( fieldRef . methodBinding != null ) { return getMethodBinding ( fieldRef . methodBinding ) ; } return getVariableBinding ( fieldRef . binding ) ; } return null ; } synchronized IMemberValuePairBinding resolveMemberValuePair ( org . eclipse . jdt . core . dom . MemberValuePair memberValuePair ) { MemberValuePair valuePair = ( MemberValuePair ) this . newAstToOldAst . get ( memberValuePair ) ; if ( valuePair != null ) { return getMemberValuePairBinding ( valuePair . compilerElementPair ) ; } return null ; } synchronized IBinding resolveReference ( MethodRef ref ) { org . eclipse . jdt . internal . compiler . ast . Expression expression = ( org . eclipse . jdt . internal . compiler . ast . Expression ) this . newAstToOldAst . get ( ref ) ; if ( expression instanceof JavadocMessageSend ) { return getMethodBinding ( ( ( JavadocMessageSend ) expression ) . binding ) ; } else if ( expression instanceof JavadocAllocationExpression ) { return getMethodBinding ( ( ( JavadocAllocationExpression ) expression ) . binding ) ; } return null ; } ITypeBinding resolveType ( AnnotationTypeDeclaration type ) { final Object node = this . newAstToOldAst . get ( type ) ; if ( node instanceof org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) { org . eclipse . jdt . internal . compiler . ast . TypeDeclaration typeDeclaration = ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) node ; ITypeBinding typeBinding = this . getTypeBinding ( typeDeclaration . binding ) ; if ( typeBinding == null ) { return null ; } this . bindingsToAstNodes . put ( typeBinding , type ) ; String key = typeBinding . getKey ( ) ; if ( key != null ) { this . bindingTables . bindingKeysToBindings . put ( key , typeBinding ) ; } return typeBinding ; } return null ; } synchronized ITypeBinding resolveType ( AnonymousClassDeclaration type ) { org . eclipse . jdt . internal . compiler . ast . ASTNode node = ( org . eclipse . jdt . internal . compiler . ast . ASTNode ) this . newAstToOldAst . get ( type ) ; if ( node != null && ( node . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . IsAnonymousType ) != <NUM_LIT:0> ) { org . eclipse . jdt . internal . compiler . ast . TypeDeclaration anonymousLocalTypeDeclaration = ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) node ; ITypeBinding typeBinding = this . getTypeBinding ( anonymousLocalTypeDeclaration . binding ) ; if ( typeBinding == null ) { return null ; } this . bindingsToAstNodes . put ( typeBinding , type ) ; String key = typeBinding . getKey ( ) ; if ( key != null ) { this . bindingTables . bindingKeysToBindings . put ( key , typeBinding ) ; } return typeBinding ; } return null ; } ITypeBinding resolveType ( EnumDeclaration type ) { final Object node = this . newAstToOldAst . get ( type ) ; if ( node instanceof org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) { org . eclipse . jdt . internal . compiler . ast . TypeDeclaration typeDeclaration = ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) node ; ITypeBinding typeBinding = this . getTypeBinding ( typeDeclaration . binding ) ; if ( typeBinding == null ) { return null ; } this . bindingsToAstNodes . put ( typeBinding , type ) ; String key = typeBinding . getKey ( ) ; if ( key != null ) { this . bindingTables . bindingKeysToBindings . put ( key , typeBinding ) ; } return typeBinding ; } return null ; } synchronized ITypeBinding resolveType ( Type type ) { org . eclipse . jdt . internal . compiler . ast . ASTNode node = ( org . eclipse . jdt . internal . compiler . ast . ASTNode ) this . newAstToOldAst . get ( type ) ; org . eclipse . jdt . internal . compiler . lookup . TypeBinding binding = null ; if ( node != null ) { if ( node instanceof ParameterizedQualifiedTypeReference ) { ParameterizedQualifiedTypeReference typeReference = ( ParameterizedQualifiedTypeReference ) node ; org . eclipse . jdt . internal . compiler . lookup . TypeBinding typeBinding = typeReference . resolvedType ; if ( type . isArrayType ( ) ) { if ( this . scope == null ) { return null ; } ArrayType arrayType = ( ArrayType ) type ; ArrayBinding arrayBinding = ( ArrayBinding ) typeBinding ; return getTypeBinding ( this . scope . createArrayType ( arrayBinding . leafComponentType , arrayType . getDimensions ( ) ) ) ; } if ( typeBinding . isArrayType ( ) ) { typeBinding = ( ( ArrayBinding ) typeBinding ) . leafComponentType ; } int index ; if ( type . isQualifiedType ( ) ) { index = ( ( QualifiedType ) type ) . index ; } else if ( type . isParameterizedType ( ) ) { index = ( ( ParameterizedType ) type ) . index ; } else { index = <NUM_LIT:1> ; } final int numberOfTypeArgumentsNotNull = getTypeArguments ( typeReference ) ; if ( index != numberOfTypeArgumentsNotNull ) { int i = numberOfTypeArgumentsNotNull ; while ( i != index ) { typeBinding = typeBinding . enclosingType ( ) ; i -- ; } binding = typeBinding ; } else { binding = typeBinding ; } } else if ( node instanceof TypeReference ) { TypeReference typeReference = ( TypeReference ) node ; binding = typeReference . resolvedType ; } else if ( node instanceof SingleNameReference && ( ( SingleNameReference ) node ) . isTypeReference ( ) ) { binding = ( ( ( SingleNameReference ) node ) . resolvedType ) ; } else if ( node instanceof QualifiedNameReference && ( ( QualifiedNameReference ) node ) . isTypeReference ( ) ) { binding = ( ( ( QualifiedNameReference ) node ) . resolvedType ) ; } else if ( node instanceof ArrayAllocationExpression ) { binding = ( ( ArrayAllocationExpression ) node ) . resolvedType ; } if ( binding != null ) { if ( type . isArrayType ( ) ) { ArrayType arrayType = ( ArrayType ) type ; if ( this . scope == null ) { return null ; } ArrayBinding arrayBinding = ( ArrayBinding ) binding ; return getTypeBinding ( this . scope . createArrayType ( arrayBinding . leafComponentType , arrayType . getDimensions ( ) ) ) ; } else if ( binding . isArrayType ( ) ) { ArrayBinding arrayBinding = ( ArrayBinding ) binding ; return getTypeBinding ( arrayBinding . leafComponentType ) ; } return getTypeBinding ( binding ) ; } } else if ( type . isPrimitiveType ( ) ) { if ( ( ( PrimitiveType ) type ) . getPrimitiveTypeCode ( ) == PrimitiveType . VOID ) { return this . getTypeBinding ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding . VOID ) ; } } return null ; } synchronized ITypeBinding resolveType ( TypeDeclaration type ) { final Object node = this . newAstToOldAst . get ( type ) ; if ( node instanceof org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) { org . eclipse . jdt . internal . compiler . ast . TypeDeclaration typeDeclaration = ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) node ; ITypeBinding typeBinding = this . getTypeBinding ( typeDeclaration . binding ) ; if ( typeBinding == null ) { return null ; } this . bindingsToAstNodes . put ( typeBinding , type ) ; String key = typeBinding . getKey ( ) ; if ( key != null ) { this . bindingTables . bindingKeysToBindings . put ( key , typeBinding ) ; } return typeBinding ; } return null ; } synchronized ITypeBinding resolveTypeParameter ( TypeParameter typeParameter ) { final Object node = this . newAstToOldAst . get ( typeParameter ) ; if ( node instanceof org . eclipse . jdt . internal . compiler . ast . TypeParameter ) { org . eclipse . jdt . internal . compiler . ast . TypeParameter typeParameter2 = ( org . eclipse . jdt . internal . compiler . ast . TypeParameter ) node ; ITypeBinding typeBinding = this . getTypeBinding ( typeParameter2 . binding ) ; if ( typeBinding == null ) { return null ; } this . bindingsToAstNodes . put ( typeBinding , typeParameter ) ; String key = typeBinding . getKey ( ) ; if ( key != null ) { this . bindingTables . bindingKeysToBindings . put ( key , typeBinding ) ; } return typeBinding ; } return null ; } synchronized IVariableBinding resolveVariable ( EnumConstantDeclaration enumConstant ) { final Object node = this . newAstToOldAst . get ( enumConstant ) ; if ( node instanceof org . eclipse . jdt . internal . compiler . ast . FieldDeclaration ) { org . eclipse . jdt . internal . compiler . ast . FieldDeclaration fieldDeclaration = ( org . eclipse . jdt . internal . compiler . ast . FieldDeclaration ) node ; IVariableBinding variableBinding = this . getVariableBinding ( fieldDeclaration . binding ) ; if ( variableBinding == null ) { return null ; } this . bindingsToAstNodes . put ( variableBinding , enumConstant ) ; String key = variableBinding . getKey ( ) ; if ( key != null ) { this . bindingTables . bindingKeysToBindings . put ( key , variableBinding ) ; } return variableBinding ; } return null ; } synchronized IVariableBinding resolveVariable ( VariableDeclaration variable ) { final Object node = this . newAstToOldAst . get ( variable ) ; if ( node instanceof AbstractVariableDeclaration ) { AbstractVariableDeclaration abstractVariableDeclaration = ( AbstractVariableDeclaration ) node ; IVariableBinding variableBinding = null ; if ( abstractVariableDeclaration instanceof org . eclipse . jdt . internal . compiler . ast . FieldDeclaration ) { org . eclipse . jdt . internal . compiler . ast . FieldDeclaration fieldDeclaration = ( org . eclipse . jdt . internal . compiler . ast . FieldDeclaration ) abstractVariableDeclaration ; variableBinding = this . getVariableBinding ( fieldDeclaration . binding , variable ) ; } else { variableBinding = this . getVariableBinding ( ( ( LocalDeclaration ) abstractVariableDeclaration ) . binding , variable ) ; } if ( variableBinding == null ) { return null ; } this . bindingsToAstNodes . put ( variableBinding , variable ) ; String key = variableBinding . getKey ( ) ; if ( key != null ) { this . bindingTables . bindingKeysToBindings . put ( key , variableBinding ) ; } return variableBinding ; } return null ; } synchronized ITypeBinding resolveWellKnownType ( String name ) { if ( this . scope == null ) return null ; ITypeBinding typeBinding = null ; try { if ( ( "<STR_LIT:boolean>" . equals ( name ) ) || ( "<STR_LIT>" . equals ( name ) ) || ( "<STR_LIT>" . equals ( name ) ) || ( "<STR_LIT>" . equals ( name ) ) || ( "<STR_LIT:int>" . equals ( name ) ) || ( "<STR_LIT:long>" . equals ( name ) ) || ( "<STR_LIT:float>" . equals ( name ) ) || ( "<STR_LIT:double>" . equals ( name ) ) || ( "<STR_LIT>" . equals ( name ) ) ) { typeBinding = this . getTypeBinding ( Scope . getBaseType ( name . toCharArray ( ) ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getJavaLangObject ( ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getJavaLangString ( ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getType ( TypeConstants . JAVA_LANG_STRINGBUFFER , <NUM_LIT:3> ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getJavaLangThrowable ( ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getType ( TypeConstants . JAVA_LANG_EXCEPTION , <NUM_LIT:3> ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getType ( TypeConstants . JAVA_LANG_RUNTIMEEXCEPTION , <NUM_LIT:3> ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getType ( TypeConstants . JAVA_LANG_ERROR , <NUM_LIT:3> ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getJavaLangClass ( ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getJavaLangCloneable ( ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getJavaIoSerializable ( ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getType ( TypeConstants . JAVA_LANG_BOOLEAN , <NUM_LIT:3> ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getType ( TypeConstants . JAVA_LANG_BYTE , <NUM_LIT:3> ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getType ( TypeConstants . JAVA_LANG_CHARACTER , <NUM_LIT:3> ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getType ( TypeConstants . JAVA_LANG_DOUBLE , <NUM_LIT:3> ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getType ( TypeConstants . JAVA_LANG_FLOAT , <NUM_LIT:3> ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getType ( TypeConstants . JAVA_LANG_INTEGER , <NUM_LIT:3> ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getType ( TypeConstants . JAVA_LANG_LONG , <NUM_LIT:3> ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getType ( TypeConstants . JAVA_LANG_SHORT , <NUM_LIT:3> ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getType ( TypeConstants . JAVA_LANG_VOID , <NUM_LIT:3> ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { typeBinding = this . getTypeBinding ( this . scope . getType ( TypeConstants . JAVA_LANG_ASSERTIONERROR , <NUM_LIT:3> ) ) ; } } catch ( AbortCompilation e ) { } if ( typeBinding != null && ! typeBinding . isRecovered ( ) ) { return typeBinding ; } return null ; } synchronized IAnnotationBinding resolveAnnotation ( final Annotation domASTNode ) { Object oldNode = this . newAstToOldAst . get ( domASTNode ) ; if ( oldNode instanceof org . eclipse . jdt . internal . compiler . ast . Annotation ) { org . eclipse . jdt . internal . compiler . ast . Annotation internalAstNode = ( org . eclipse . jdt . internal . compiler . ast . Annotation ) oldNode ; IAnnotationBinding domAnnotation = getAnnotationInstance ( internalAstNode . getCompilerAnnotation ( ) ) ; if ( domAnnotation == null ) return null ; this . bindingsToAstNodes . put ( domAnnotation , domASTNode ) ; return domAnnotation ; } return null ; } public CompilationUnitScope scope ( ) { return this . scope ; } synchronized void store ( ASTNode node , org . eclipse . jdt . internal . compiler . ast . ASTNode oldASTNode ) { this . newAstToOldAst . put ( node , oldASTNode ) ; } synchronized void updateKey ( ASTNode node , ASTNode newNode ) { Object astNode = this . newAstToOldAst . remove ( node ) ; if ( astNode != null ) { this . newAstToOldAst . put ( newNode , astNode ) ; } } ITypeBinding resolveArrayType ( ITypeBinding typeBinding , int dimensions ) { if ( typeBinding instanceof RecoveredTypeBinding ) throw new IllegalArgumentException ( "<STR_LIT>" ) ; ITypeBinding leafComponentType = typeBinding ; int actualDimensions = dimensions ; if ( typeBinding . isArray ( ) ) { leafComponentType = typeBinding . getElementType ( ) ; actualDimensions += typeBinding . getDimensions ( ) ; } org . eclipse . jdt . internal . compiler . lookup . TypeBinding leafTypeBinding = null ; if ( leafComponentType . isPrimitive ( ) ) { String name = leafComponentType . getBinaryName ( ) ; switch ( name . charAt ( <NUM_LIT:0> ) ) { case '<CHAR_LIT>' : leafTypeBinding = org . eclipse . jdt . internal . compiler . lookup . TypeBinding . INT ; break ; case '<CHAR_LIT>' : leafTypeBinding = org . eclipse . jdt . internal . compiler . lookup . TypeBinding . BYTE ; break ; case '<CHAR_LIT:Z>' : leafTypeBinding = org . eclipse . jdt . internal . compiler . lookup . TypeBinding . BOOLEAN ; break ; case '<CHAR_LIT>' : leafTypeBinding = org . eclipse . jdt . internal . compiler . lookup . TypeBinding . CHAR ; break ; case '<CHAR_LIT>' : leafTypeBinding = org . eclipse . jdt . internal . compiler . lookup . TypeBinding . LONG ; break ; case '<CHAR_LIT>' : leafTypeBinding = org . eclipse . jdt . internal . compiler . lookup . TypeBinding . SHORT ; break ; case '<CHAR_LIT>' : leafTypeBinding = org . eclipse . jdt . internal . compiler . lookup . TypeBinding . DOUBLE ; break ; case '<CHAR_LIT>' : leafTypeBinding = org . eclipse . jdt . internal . compiler . lookup . TypeBinding . FLOAT ; break ; case '<CHAR_LIT>' : throw new IllegalArgumentException ( ) ; } } else { if ( ! ( leafComponentType instanceof TypeBinding ) ) return null ; leafTypeBinding = ( ( TypeBinding ) leafComponentType ) . binding ; } return this . getTypeBinding ( lookupEnvironment ( ) . createArrayType ( leafTypeBinding , actualDimensions ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; public class VariableDeclarationExpression extends Expression { public static final SimplePropertyDescriptor MODIFIERS_PROPERTY = new SimplePropertyDescriptor ( VariableDeclarationExpression . class , "<STR_LIT>" , int . class , MANDATORY ) ; public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY = new ChildListPropertyDescriptor ( VariableDeclarationExpression . class , "<STR_LIT>" , IExtendedModifier . class , CYCLE_RISK ) ; public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor ( VariableDeclarationExpression . class , "<STR_LIT:type>" , Type . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor FRAGMENTS_PROPERTY = new ChildListPropertyDescriptor ( VariableDeclarationExpression . class , "<STR_LIT>" , VariableDeclarationFragment . 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 ( VariableDeclarationExpression . class , propertyList ) ; addProperty ( MODIFIERS_PROPERTY , propertyList ) ; addProperty ( TYPE_PROPERTY , propertyList ) ; addProperty ( FRAGMENTS_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( propertyList ) ; propertyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( VariableDeclarationExpression . class , propertyList ) ; addProperty ( MODIFIERS2_PROPERTY , propertyList ) ; addProperty ( TYPE_PROPERTY , propertyList ) ; addProperty ( FRAGMENTS_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 Type baseType = null ; private ASTNode . NodeList variableDeclarationFragments = new ASTNode . NodeList ( FRAGMENTS_PROPERTY ) ; VariableDeclarationExpression ( AST ast ) { super ( ast ) ; if ( ast . apiLevel >= AST . JLS3_INTERNAL ) { this . modifiers = new ASTNode . NodeList ( MODIFIERS2_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> ; } } return super . internalGetSetIntProperty ( property , get , value ) ; } 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 == MODIFIERS2_PROPERTY ) { return modifiers ( ) ; } if ( property == FRAGMENTS_PROPERTY ) { return fragments ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return VARIABLE_DECLARATION_EXPRESSION ; } ASTNode clone0 ( AST target ) { VariableDeclarationExpression result = new VariableDeclarationExpression ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { result . setModifiers ( getModifiers ( ) ) ; } if ( this . ast . apiLevel >= AST . JLS3_INTERNAL ) { result . modifiers ( ) . addAll ( ASTNode . copySubtrees ( target , modifiers ( ) ) ) ; } result . setType ( ( Type ) getType ( ) . clone ( target ) ) ; result . fragments ( ) . addAll ( ASTNode . copySubtrees ( target , fragments ( ) ) ) ; 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_INTERNAL ) { acceptChildren ( visitor , this . modifiers ) ; } acceptChild ( visitor , getType ( ) ) ; acceptChildren ( visitor , this . variableDeclarationFragments ) ; } 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 Type getType ( ) { if ( this . baseType == null ) { synchronized ( this ) { if ( this . baseType == null ) { preLazyInit ( ) ; this . baseType = this . ast . newPrimitiveType ( PrimitiveType . INT ) ; postLazyInit ( this . baseType , TYPE_PROPERTY ) ; } } } return this . baseType ; } public void setType ( Type type ) { if ( type == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . baseType ; preReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; this . baseType = type ; postReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; } public List fragments ( ) { return this . variableDeclarationFragments ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:4> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . modifiers == null ? <NUM_LIT:0> : this . modifiers . listSize ( ) ) + ( this . baseType == null ? <NUM_LIT:0> : getType ( ) . treeSize ( ) ) + this . variableDeclarationFragments . listSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class AnnotationTypeDeclaration extends AbstractTypeDeclaration { public static final ChildPropertyDescriptor JAVADOC_PROPERTY = internalJavadocPropertyFactory ( AnnotationTypeDeclaration . class ) ; public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY = internalModifiers2PropertyFactory ( AnnotationTypeDeclaration . class ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = internalNamePropertyFactory ( AnnotationTypeDeclaration . class ) ; public static final ChildListPropertyDescriptor BODY_DECLARATIONS_PROPERTY = internalBodyDeclarationPropertyFactory ( AnnotationTypeDeclaration . class ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:5> ) ; createPropertyList ( AnnotationTypeDeclaration . class , properyList ) ; addProperty ( JAVADOC_PROPERTY , properyList ) ; addProperty ( MODIFIERS2_PROPERTY , properyList ) ; addProperty ( NAME_PROPERTY , properyList ) ; addProperty ( BODY_DECLARATIONS_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } AnnotationTypeDeclaration ( 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 == 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 ANNOTATION_TYPE_DECLARATION ; } ASTNode clone0 ( AST target ) { AnnotationTypeDeclaration result = new AnnotationTypeDeclaration ( 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 . 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 . bodyDeclarations ) ; } visitor . endVisit ( this ) ; } ITypeBinding internalResolveBinding ( ) { return this . ast . getBindingResolver ( ) . resolveType ( this ) ; } int memSize ( ) { return super . memSize ( ) ; } int treeSize ( ) { return memSize ( ) + ( this . optionalDocComment == null ? <NUM_LIT:0> : getJavadoc ( ) . treeSize ( ) ) + this . modifiers . listSize ( ) + ( this . typeName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) + this . bodyDeclarations . listSize ( ) ; } } </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 final int UNION_TYPE = <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 UNION_TYPE : return UnionType . 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 unsupportedIn2_3 ( ) { if ( this . ast . apiLevel <= AST . JLS3_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 ) ) { if ( data == null ) { this . property1 = null ; this . property2 = null ; } else { this . property2 = data ; } return ; } if ( data == null ) { return ; } Map m = new HashMap ( <NUM_LIT:3> ) ; m . put ( this . property1 , this . property2 ) ; m . put ( propertyName , data ) ; this . property1 = m ; this . property2 = null ; return ; } Map m = ( Map ) 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 ; class DefaultASTVisitor extends ASTVisitor { public DefaultASTVisitor ( ) { super ( ) ; } public DefaultASTVisitor ( boolean visitDocTags ) { super ( visitDocTags ) ; } public void endVisit ( AnnotationTypeDeclaration node ) { endVisitNode ( node ) ; } public void endVisit ( AnnotationTypeMemberDeclaration node ) { endVisitNode ( node ) ; } public void endVisit ( AnonymousClassDeclaration node ) { endVisitNode ( node ) ; } public void endVisit ( ArrayAccess node ) { endVisitNode ( node ) ; } public void endVisit ( ArrayCreation node ) { endVisitNode ( node ) ; } public void endVisit ( ArrayInitializer node ) { endVisitNode ( node ) ; } public void endVisit ( ArrayType node ) { endVisitNode ( node ) ; } public void endVisit ( AssertStatement node ) { endVisitNode ( node ) ; } public void endVisit ( Assignment node ) { endVisitNode ( node ) ; } public void endVisit ( Block node ) { endVisitNode ( node ) ; } public void endVisit ( BlockComment node ) { endVisitNode ( node ) ; } public void endVisit ( BooleanLiteral node ) { endVisitNode ( node ) ; } public void endVisit ( BreakStatement node ) { endVisitNode ( node ) ; } public void endVisit ( CastExpression node ) { endVisitNode ( node ) ; } public void endVisit ( CatchClause node ) { endVisitNode ( node ) ; } public void endVisit ( CharacterLiteral node ) { endVisitNode ( node ) ; } public void endVisit ( ClassInstanceCreation node ) { endVisitNode ( node ) ; } public void endVisit ( CompilationUnit node ) { endVisitNode ( node ) ; } public void endVisit ( ConditionalExpression node ) { endVisitNode ( node ) ; } public void endVisit ( ConstructorInvocation node ) { endVisitNode ( node ) ; } public void endVisit ( ContinueStatement node ) { endVisitNode ( node ) ; } public void endVisit ( DoStatement node ) { endVisitNode ( node ) ; } public void endVisit ( EmptyStatement node ) { endVisitNode ( node ) ; } public void endVisit ( EnhancedForStatement node ) { endVisitNode ( node ) ; } public void endVisit ( EnumConstantDeclaration node ) { endVisitNode ( node ) ; } public void endVisit ( EnumDeclaration node ) { endVisitNode ( node ) ; } public void endVisit ( ExpressionStatement node ) { endVisitNode ( node ) ; } public void endVisit ( FieldAccess node ) { endVisitNode ( node ) ; } public void endVisit ( FieldDeclaration node ) { endVisitNode ( node ) ; } public void endVisit ( ForStatement node ) { endVisitNode ( node ) ; } public void endVisit ( IfStatement node ) { endVisitNode ( node ) ; } public void endVisit ( ImportDeclaration node ) { endVisitNode ( node ) ; } public void endVisit ( InfixExpression node ) { endVisitNode ( node ) ; } public void endVisit ( Initializer node ) { endVisitNode ( node ) ; } public void endVisit ( InstanceofExpression node ) { endVisitNode ( node ) ; } public void endVisit ( Javadoc node ) { endVisitNode ( node ) ; } public void endVisit ( LabeledStatement node ) { endVisitNode ( node ) ; } public void endVisit ( LineComment node ) { endVisitNode ( node ) ; } public void endVisit ( MarkerAnnotation node ) { endVisitNode ( node ) ; } public void endVisit ( MemberRef node ) { endVisitNode ( node ) ; } public void endVisit ( MemberValuePair node ) { endVisitNode ( node ) ; } public void endVisit ( MethodDeclaration node ) { endVisitNode ( node ) ; } public void endVisit ( MethodInvocation node ) { endVisitNode ( node ) ; } public void endVisit ( MethodRef node ) { endVisitNode ( node ) ; } public void endVisit ( MethodRefParameter node ) { endVisitNode ( node ) ; } public void endVisit ( Modifier node ) { endVisitNode ( node ) ; } public void endVisit ( NormalAnnotation node ) { endVisitNode ( node ) ; } public void endVisit ( NullLiteral node ) { endVisitNode ( node ) ; } public void endVisit ( NumberLiteral node ) { endVisitNode ( node ) ; } public void endVisit ( PackageDeclaration node ) { endVisitNode ( node ) ; } public void endVisit ( ParameterizedType node ) { endVisitNode ( node ) ; } public void endVisit ( ParenthesizedExpression node ) { endVisitNode ( node ) ; } public void endVisit ( PostfixExpression node ) { endVisitNode ( node ) ; } public void endVisit ( PrefixExpression node ) { endVisitNode ( node ) ; } public void endVisit ( PrimitiveType node ) { endVisitNode ( node ) ; } public void endVisit ( QualifiedName node ) { endVisitNode ( node ) ; } public void endVisit ( QualifiedType node ) { endVisitNode ( node ) ; } public void endVisit ( ReturnStatement node ) { endVisitNode ( node ) ; } public void endVisit ( SimpleName node ) { endVisitNode ( node ) ; } public void endVisit ( SimpleType node ) { endVisitNode ( node ) ; } public void endVisit ( SingleMemberAnnotation node ) { endVisitNode ( node ) ; } public void endVisit ( SingleVariableDeclaration node ) { endVisitNode ( node ) ; } public void endVisit ( StringLiteral node ) { endVisitNode ( node ) ; } public void endVisit ( SuperConstructorInvocation node ) { endVisitNode ( node ) ; } public void endVisit ( SuperFieldAccess node ) { endVisitNode ( node ) ; } public void endVisit ( SuperMethodInvocation node ) { endVisitNode ( node ) ; } public void endVisit ( SwitchCase node ) { endVisitNode ( node ) ; } public void endVisit ( SwitchStatement node ) { endVisitNode ( node ) ; } public void endVisit ( SynchronizedStatement node ) { endVisitNode ( node ) ; } public void endVisit ( TagElement node ) { endVisitNode ( node ) ; } public void endVisit ( TextElement node ) { endVisitNode ( node ) ; } public void endVisit ( ThisExpression node ) { endVisitNode ( node ) ; } public void endVisit ( ThrowStatement node ) { endVisitNode ( node ) ; } public void endVisit ( TryStatement node ) { endVisitNode ( node ) ; } public void endVisit ( TypeDeclaration node ) { endVisitNode ( node ) ; } public void endVisit ( TypeDeclarationStatement node ) { endVisitNode ( node ) ; } public void endVisit ( TypeLiteral node ) { endVisitNode ( node ) ; } public void endVisit ( TypeParameter node ) { endVisitNode ( node ) ; } public void endVisit ( UnionType node ) { endVisitNode ( node ) ; } public void endVisit ( VariableDeclarationExpression node ) { endVisitNode ( node ) ; } public void endVisit ( VariableDeclarationFragment node ) { endVisitNode ( node ) ; } public void endVisit ( VariableDeclarationStatement node ) { endVisitNode ( node ) ; } public void endVisit ( WhileStatement node ) { endVisitNode ( node ) ; } public void endVisit ( WildcardType node ) { endVisitNode ( node ) ; } protected void endVisitNode ( ASTNode node ) { } public boolean visit ( AnnotationTypeDeclaration node ) { return visitNode ( node ) ; } public boolean visit ( AnnotationTypeMemberDeclaration node ) { return visitNode ( node ) ; } public boolean visit ( AnonymousClassDeclaration node ) { return visitNode ( node ) ; } public boolean visit ( ArrayAccess node ) { return visitNode ( node ) ; } public boolean visit ( ArrayCreation node ) { return visitNode ( node ) ; } public boolean visit ( ArrayInitializer node ) { return visitNode ( node ) ; } public boolean visit ( ArrayType node ) { visitNode ( node ) ; return false ; } public boolean visit ( AssertStatement node ) { return visitNode ( node ) ; } public boolean visit ( Assignment node ) { return visitNode ( node ) ; } public boolean visit ( Block node ) { return visitNode ( node ) ; } public boolean visit ( BlockComment node ) { return visitNode ( node ) ; } public boolean visit ( BooleanLiteral node ) { return visitNode ( node ) ; } public boolean visit ( BreakStatement node ) { return visitNode ( node ) ; } public boolean visit ( CastExpression node ) { return visitNode ( node ) ; } public boolean visit ( CatchClause node ) { return visitNode ( node ) ; } public boolean visit ( CharacterLiteral node ) { return visitNode ( node ) ; } public boolean visit ( ClassInstanceCreation node ) { return visitNode ( node ) ; } public boolean visit ( CompilationUnit node ) { return visitNode ( node ) ; } public boolean visit ( ConditionalExpression node ) { return visitNode ( node ) ; } public boolean visit ( ConstructorInvocation node ) { return visitNode ( node ) ; } public boolean visit ( ContinueStatement node ) { return visitNode ( node ) ; } public boolean visit ( DoStatement node ) { return visitNode ( node ) ; } public boolean visit ( EmptyStatement node ) { return visitNode ( node ) ; } public boolean visit ( EnhancedForStatement node ) { return visitNode ( node ) ; } public boolean visit ( EnumConstantDeclaration node ) { return visitNode ( node ) ; } public boolean visit ( EnumDeclaration node ) { return visitNode ( node ) ; } public boolean visit ( ExpressionStatement node ) { return visitNode ( node ) ; } public boolean visit ( FieldAccess node ) { return visitNode ( node ) ; } public boolean visit ( FieldDeclaration node ) { return visitNode ( node ) ; } public boolean visit ( ForStatement node ) { return visitNode ( node ) ; } public boolean visit ( IfStatement node ) { return visitNode ( node ) ; } public boolean visit ( ImportDeclaration node ) { return visitNode ( node ) ; } public boolean visit ( InfixExpression node ) { return visitNode ( node ) ; } public boolean visit ( Initializer node ) { return visitNode ( node ) ; } public boolean visit ( InstanceofExpression node ) { return visitNode ( node ) ; } public boolean visit ( Javadoc node ) { if ( super . visit ( node ) ) { return visitNode ( node ) ; } return false ; } public boolean visit ( LabeledStatement node ) { return visitNode ( node ) ; } public boolean visit ( LineComment node ) { return visitNode ( node ) ; } public boolean visit ( MarkerAnnotation node ) { return visitNode ( node ) ; } public boolean visit ( MemberRef node ) { return visitNode ( node ) ; } public boolean visit ( MemberValuePair node ) { return visitNode ( node ) ; } public boolean visit ( MethodDeclaration node ) { return visitNode ( node ) ; } public boolean visit ( MethodInvocation node ) { return visitNode ( node ) ; } public boolean visit ( MethodRef node ) { return visitNode ( node ) ; } public boolean visit ( Modifier node ) { return visitNode ( node ) ; } public boolean visit ( MethodRefParameter node ) { return visitNode ( node ) ; } public boolean visit ( NormalAnnotation node ) { return visitNode ( node ) ; } public boolean visit ( NullLiteral node ) { return visitNode ( node ) ; } public boolean visit ( NumberLiteral node ) { return visitNode ( node ) ; } public boolean visit ( PackageDeclaration node ) { return visitNode ( node ) ; } public boolean visit ( ParameterizedType node ) { return visitNode ( node ) ; } public boolean visit ( ParenthesizedExpression node ) { return visitNode ( node ) ; } public boolean visit ( PostfixExpression node ) { return visitNode ( node ) ; } public boolean visit ( PrefixExpression node ) { return visitNode ( node ) ; } public boolean visit ( PrimitiveType node ) { return visitNode ( node ) ; } public boolean visit ( QualifiedName node ) { return visitNode ( node ) ; } public boolean visit ( QualifiedType node ) { return visitNode ( node ) ; } public boolean visit ( ReturnStatement node ) { return visitNode ( node ) ; } public boolean visit ( SimpleName node ) { return visitNode ( node ) ; } public boolean visit ( SimpleType node ) { return visitNode ( node ) ; } public boolean visit ( SingleMemberAnnotation node ) { return visitNode ( node ) ; } public boolean visit ( SingleVariableDeclaration node ) { return visitNode ( node ) ; } public boolean visit ( StringLiteral node ) { return visitNode ( node ) ; } public boolean visit ( SuperConstructorInvocation node ) { return visitNode ( node ) ; } public boolean visit ( SuperFieldAccess node ) { return visitNode ( node ) ; } public boolean visit ( SuperMethodInvocation node ) { return visitNode ( node ) ; } public boolean visit ( SwitchCase node ) { return visitNode ( node ) ; } public boolean visit ( SwitchStatement node ) { return visitNode ( node ) ; } public boolean visit ( SynchronizedStatement node ) { return visitNode ( node ) ; } public boolean visit ( TagElement node ) { return visitNode ( node ) ; } public boolean visit ( TextElement node ) { return visitNode ( node ) ; } public boolean visit ( ThisExpression node ) { return visitNode ( node ) ; } public boolean visit ( ThrowStatement node ) { return visitNode ( node ) ; } public boolean visit ( TryStatement node ) { return visitNode ( node ) ; } public boolean visit ( TypeDeclaration node ) { return visitNode ( node ) ; } public boolean visit ( TypeDeclarationStatement node ) { return visitNode ( node ) ; } public boolean visit ( TypeLiteral node ) { return visitNode ( node ) ; } public boolean visit ( TypeParameter node ) { return visitNode ( node ) ; } public boolean visit ( UnionType node ) { return visitNode ( node ) ; } public boolean visit ( VariableDeclarationExpression node ) { return visitNode ( node ) ; } public boolean visit ( VariableDeclarationFragment node ) { return visitNode ( node ) ; } public boolean visit ( VariableDeclarationStatement node ) { return visitNode ( node ) ; } public boolean visit ( WhileStatement node ) { return visitNode ( node ) ; } public boolean visit ( WildcardType node ) { return visitNode ( node ) ; } protected boolean visitNode ( ASTNode node ) { return true ; } } </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 ; import java . util . List ; import java . util . Vector ; import org . eclipse . jdt . core . compiler . CategorizedProblem ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . internal . compiler . parser . RecoveryScanner ; import org . eclipse . jdt . internal . compiler . parser . RecoveryScannerData ; import org . eclipse . jdt . internal . compiler . parser . TerminalTokens ; import org . eclipse . jdt . internal . compiler . util . HashtableOfObjectToIntArray ; class ASTRecoveryPropagator extends DefaultASTVisitor { private static final int NOTHING = - <NUM_LIT:1> ; HashtableOfObjectToIntArray endingTokens = new HashtableOfObjectToIntArray ( ) ; { this . endingTokens . put ( AnonymousClassDeclaration . class , new int [ ] { TerminalTokens . TokenNameRBRACE } ) ; this . endingTokens . put ( ArrayAccess . class , new int [ ] { TerminalTokens . TokenNameRBRACKET } ) ; this . endingTokens . put ( ArrayCreation . class , new int [ ] { NOTHING , TerminalTokens . TokenNameRBRACKET } ) ; this . endingTokens . put ( ArrayInitializer . class , new int [ ] { TerminalTokens . TokenNameRBRACE } ) ; this . endingTokens . put ( ArrayType . class , new int [ ] { TerminalTokens . TokenNameRBRACKET } ) ; this . endingTokens . put ( AssertStatement . class , new int [ ] { TerminalTokens . TokenNameSEMICOLON } ) ; this . endingTokens . put ( Block . class , new int [ ] { TerminalTokens . TokenNameRBRACE } ) ; this . endingTokens . put ( BooleanLiteral . class , new int [ ] { TerminalTokens . TokenNamefalse , TerminalTokens . TokenNametrue } ) ; this . endingTokens . put ( BreakStatement . class , new int [ ] { TerminalTokens . TokenNameSEMICOLON } ) ; this . endingTokens . put ( CharacterLiteral . class , new int [ ] { TerminalTokens . TokenNameCharacterLiteral } ) ; this . endingTokens . put ( ClassInstanceCreation . class , new int [ ] { TerminalTokens . TokenNameRBRACE , TerminalTokens . TokenNameRPAREN } ) ; this . endingTokens . put ( ConstructorInvocation . class , new int [ ] { TerminalTokens . TokenNameSEMICOLON } ) ; this . endingTokens . put ( ContinueStatement . class , new int [ ] { TerminalTokens . TokenNameSEMICOLON } ) ; this . endingTokens . put ( DoStatement . class , new int [ ] { TerminalTokens . TokenNameRPAREN } ) ; this . endingTokens . put ( EmptyStatement . class , new int [ ] { TerminalTokens . TokenNameSEMICOLON } ) ; this . endingTokens . put ( ExpressionStatement . class , new int [ ] { TerminalTokens . TokenNameSEMICOLON } ) ; this . endingTokens . put ( FieldDeclaration . class , new int [ ] { TerminalTokens . TokenNameSEMICOLON } ) ; this . endingTokens . put ( ImportDeclaration . class , new int [ ] { TerminalTokens . TokenNameSEMICOLON } ) ; this . endingTokens . put ( Initializer . class , new int [ ] { TerminalTokens . TokenNameRBRACE } ) ; this . endingTokens . put ( MethodDeclaration . class , new int [ ] { NOTHING , TerminalTokens . TokenNameSEMICOLON } ) ; this . endingTokens . put ( MethodInvocation . class , new int [ ] { TerminalTokens . TokenNameRPAREN } ) ; this . endingTokens . put ( NullLiteral . class , new int [ ] { TerminalTokens . TokenNamenull } ) ; this . endingTokens . put ( NumberLiteral . class , new int [ ] { TerminalTokens . TokenNameIntegerLiteral , TerminalTokens . TokenNameLongLiteral , TerminalTokens . TokenNameFloatingPointLiteral , TerminalTokens . TokenNameDoubleLiteral } ) ; this . endingTokens . put ( PackageDeclaration . class , new int [ ] { TerminalTokens . TokenNameSEMICOLON } ) ; this . endingTokens . put ( ParenthesizedExpression . class , new int [ ] { TerminalTokens . TokenNameRPAREN } ) ; this . endingTokens . put ( PostfixExpression . class , new int [ ] { TerminalTokens . TokenNamePLUS_PLUS , TerminalTokens . TokenNameMINUS_MINUS } ) ; this . endingTokens . put ( PrimitiveType . class , new int [ ] { TerminalTokens . TokenNamebyte , TerminalTokens . TokenNameshort , TerminalTokens . TokenNamechar , TerminalTokens . TokenNameint , TerminalTokens . TokenNamelong , TerminalTokens . TokenNamefloat , TerminalTokens . TokenNameboolean , TerminalTokens . TokenNamedouble , TerminalTokens . TokenNamevoid } ) ; this . endingTokens . put ( ReturnStatement . class , new int [ ] { TerminalTokens . TokenNameSEMICOLON } ) ; this . endingTokens . put ( SimpleName . class , new int [ ] { TerminalTokens . TokenNameIdentifier } ) ; this . endingTokens . put ( SingleVariableDeclaration . class , new int [ ] { TerminalTokens . TokenNameSEMICOLON } ) ; this . endingTokens . put ( StringLiteral . class , new int [ ] { TerminalTokens . TokenNameStringLiteral } ) ; this . endingTokens . put ( SuperConstructorInvocation . class , new int [ ] { TerminalTokens . TokenNameSEMICOLON } ) ; this . endingTokens . put ( SuperMethodInvocation . class , new int [ ] { TerminalTokens . TokenNameRPAREN } ) ; this . endingTokens . put ( SwitchCase . class , new int [ ] { TerminalTokens . TokenNameCOLON } ) ; this . endingTokens . put ( SwitchStatement . class , new int [ ] { TerminalTokens . TokenNameRBRACE } ) ; this . endingTokens . put ( SynchronizedStatement . class , new int [ ] { TerminalTokens . TokenNameRBRACE } ) ; this . endingTokens . put ( ThisExpression . class , new int [ ] { TerminalTokens . TokenNamethis } ) ; this . endingTokens . put ( ThrowStatement . class , new int [ ] { TerminalTokens . TokenNameSEMICOLON } ) ; this . endingTokens . put ( TypeDeclaration . class , new int [ ] { TerminalTokens . TokenNameRBRACE } ) ; this . endingTokens . put ( TypeLiteral . class , new int [ ] { TerminalTokens . TokenNameclass } ) ; this . endingTokens . put ( VariableDeclarationStatement . class , new int [ ] { TerminalTokens . TokenNameSEMICOLON } ) ; } private CategorizedProblem [ ] problems ; private boolean [ ] usedOrIrrelevantProblems ; private RecoveryScannerData data ; private int blockDepth = <NUM_LIT:0> ; private int lastEnd ; private int [ ] insertedTokensKind ; private int [ ] insertedTokensPosition ; private boolean [ ] insertedTokensFlagged ; private boolean [ ] removedTokensFlagged ; private boolean [ ] replacedTokensFlagged ; private Vector stack = new Vector ( ) ; ASTRecoveryPropagator ( CategorizedProblem [ ] problems , RecoveryScannerData data ) { this . problems = problems ; this . usedOrIrrelevantProblems = new boolean [ problems . length ] ; this . data = data ; if ( this . data != null ) { int length = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < data . insertedTokensPtr + <NUM_LIT:1> ; i ++ ) { length += data . insertedTokens [ i ] . length ; } this . insertedTokensKind = new int [ length ] ; this . insertedTokensPosition = new int [ length ] ; this . insertedTokensFlagged = new boolean [ length ] ; int tokenCount = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < data . insertedTokensPtr + <NUM_LIT:1> ; i ++ ) { for ( int j = <NUM_LIT:0> ; j < data . insertedTokens [ i ] . length ; j ++ ) { this . insertedTokensKind [ tokenCount ] = data . insertedTokens [ i ] [ j ] ; this . insertedTokensPosition [ tokenCount ] = data . insertedTokensPosition [ i ] ; tokenCount ++ ; } } if ( data . removedTokensPtr != - <NUM_LIT:1> ) { this . removedTokensFlagged = new boolean [ data . removedTokensPtr + <NUM_LIT:1> ] ; } if ( data . replacedTokensPtr != - <NUM_LIT:1> ) { this . replacedTokensFlagged = new boolean [ data . replacedTokensPtr + <NUM_LIT:1> ] ; } } } public void endVisit ( Block node ) { this . blockDepth -- ; if ( this . blockDepth <= <NUM_LIT:0> ) { flagNodeWithInsertedTokens ( ) ; } super . endVisit ( node ) ; } public boolean visit ( Block node ) { boolean visitChildren = super . visit ( node ) ; this . blockDepth ++ ; return visitChildren ; } protected boolean visitNode ( ASTNode node ) { if ( this . blockDepth > <NUM_LIT:0> ) { int start = node . getStartPosition ( ) ; int end = start + node . getLength ( ) - <NUM_LIT:1> ; if ( this . insertedTokensFlagged != null ) { for ( int i = <NUM_LIT:0> ; i < this . insertedTokensFlagged . length ; i ++ ) { if ( this . insertedTokensPosition [ i ] >= start && this . insertedTokensPosition [ i ] <= end ) { return true ; } } } if ( this . removedTokensFlagged != null ) { for ( int i = <NUM_LIT:0> ; i <= this . data . removedTokensPtr ; i ++ ) { if ( this . data . removedTokensStart [ i ] >= start && this . data . removedTokensEnd [ i ] <= end ) { return true ; } } } if ( this . replacedTokensFlagged != null ) { for ( int i = <NUM_LIT:0> ; i <= this . data . replacedTokensPtr ; i ++ ) { if ( this . data . replacedTokensStart [ i ] >= start && this . data . replacedTokensEnd [ i ] <= end ) { return true ; } } } return false ; } return true ; } protected void endVisitNode ( ASTNode node ) { int start = node . getStartPosition ( ) ; int end = start + node . getLength ( ) - <NUM_LIT:1> ; if ( this . blockDepth < <NUM_LIT:1> ) { switch ( node . getNodeType ( ) ) { case ASTNode . ANNOTATION_TYPE_DECLARATION : case ASTNode . COMPILATION_UNIT : case ASTNode . ENUM_DECLARATION : case ASTNode . FIELD_DECLARATION : case ASTNode . IMPORT_DECLARATION : case ASTNode . INITIALIZER : case ASTNode . METHOD_DECLARATION : case ASTNode . PACKAGE_DECLARATION : case ASTNode . TYPE_DECLARATION : case ASTNode . MARKER_ANNOTATION : case ASTNode . NORMAL_ANNOTATION : case ASTNode . SINGLE_MEMBER_ANNOTATION : case ASTNode . BLOCK : if ( markIncludedProblems ( start , end ) ) { node . setFlags ( node . getFlags ( ) | ASTNode . RECOVERED ) ; } break ; } } else { markIncludedProblems ( start , end ) ; if ( this . insertedTokensFlagged != null ) { if ( this . lastEnd != end ) { flagNodeWithInsertedTokens ( ) ; } this . stack . add ( node ) ; } if ( this . removedTokensFlagged != null ) { for ( int i = <NUM_LIT:0> ; i <= this . data . removedTokensPtr ; i ++ ) { if ( ! this . removedTokensFlagged [ i ] && this . data . removedTokensStart [ i ] >= start && this . data . removedTokensEnd [ i ] <= end ) { node . setFlags ( node . getFlags ( ) | ASTNode . RECOVERED ) ; this . removedTokensFlagged [ i ] = true ; } } } if ( this . replacedTokensFlagged != null ) { for ( int i = <NUM_LIT:0> ; i <= this . data . replacedTokensPtr ; i ++ ) { if ( ! this . replacedTokensFlagged [ i ] && this . data . replacedTokensStart [ i ] >= start && this . data . replacedTokensEnd [ i ] <= end ) { node . setFlags ( node . getFlags ( ) | ASTNode . RECOVERED ) ; this . replacedTokensFlagged [ i ] = true ; } } } } this . lastEnd = end ; } private void flagNodeWithInsertedTokens ( ) { if ( this . insertedTokensKind != null && this . insertedTokensKind . length > <NUM_LIT:0> ) { int s = this . stack . size ( ) ; for ( int i = s - <NUM_LIT:1> ; i > - <NUM_LIT:1> ; i -- ) { flagNodesWithInsertedTokensAtEnd ( ( ASTNode ) this . stack . get ( i ) ) ; } for ( int i = <NUM_LIT:0> ; i < s ; i ++ ) { flagNodesWithInsertedTokensInside ( ( ASTNode ) this . stack . get ( i ) ) ; } this . stack = new Vector ( ) ; } } private boolean flagNodesWithInsertedTokensAtEnd ( ASTNode node ) { int [ ] expectedEndingToken = this . endingTokens . get ( node . getClass ( ) ) ; if ( expectedEndingToken != null ) { int start = node . getStartPosition ( ) ; int end = start + node . getLength ( ) - <NUM_LIT:1> ; boolean flagParent = false ; done : for ( int i = this . insertedTokensKind . length - <NUM_LIT:1> ; i > - <NUM_LIT:1> ; i -- ) { if ( ! this . insertedTokensFlagged [ i ] && this . insertedTokensPosition [ i ] == end ) { this . insertedTokensFlagged [ i ] = true ; for ( int j = <NUM_LIT:0> ; j < expectedEndingToken . length ; j ++ ) { if ( expectedEndingToken [ j ] == this . insertedTokensKind [ i ] ) { node . setFlags ( node . getFlags ( ) | ASTNode . RECOVERED ) ; break done ; } } flagParent = true ; } } if ( flagParent ) { ASTNode parent = node . getParent ( ) ; while ( parent != null ) { parent . setFlags ( node . getFlags ( ) | ASTNode . RECOVERED ) ; if ( ( parent . getStartPosition ( ) + parent . getLength ( ) - <NUM_LIT:1> ) != end ) { parent = null ; } else { parent = parent . getParent ( ) ; } } } } return true ; } private boolean flagNodesWithInsertedTokensInside ( ASTNode node ) { int start = node . getStartPosition ( ) ; int end = start + node . getLength ( ) - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < this . insertedTokensKind . length ; i ++ ) { if ( ! this . insertedTokensFlagged [ i ] && start <= this . insertedTokensPosition [ i ] && this . insertedTokensPosition [ i ] < end ) { node . setFlags ( node . getFlags ( ) | ASTNode . RECOVERED ) ; this . insertedTokensFlagged [ i ] = true ; } } return true ; } private boolean markIncludedProblems ( int start , int end ) { boolean foundProblems = false ; next : for ( int i = <NUM_LIT:0> , max = this . problems . length ; i < max ; i ++ ) { CategorizedProblem problem = this . problems [ i ] ; if ( this . usedOrIrrelevantProblems [ i ] ) continue next ; switch ( problem . getID ( ) ) { case IProblem . ParsingErrorOnKeywordNoSuggestion : case IProblem . ParsingErrorOnKeyword : case IProblem . ParsingError : case IProblem . ParsingErrorNoSuggestion : case IProblem . ParsingErrorInsertTokenBefore : case IProblem . ParsingErrorInsertTokenAfter : case IProblem . ParsingErrorDeleteToken : case IProblem . ParsingErrorDeleteTokens : case IProblem . ParsingErrorMergeTokens : case IProblem . ParsingErrorInvalidToken : case IProblem . ParsingErrorMisplacedConstruct : case IProblem . ParsingErrorReplaceTokens : case IProblem . ParsingErrorNoSuggestionForTokens : case IProblem . ParsingErrorUnexpectedEOF : case IProblem . ParsingErrorInsertToComplete : case IProblem . ParsingErrorInsertToCompleteScope : case IProblem . ParsingErrorInsertToCompletePhrase : case IProblem . EndOfSource : case IProblem . InvalidHexa : case IProblem . InvalidOctal : case IProblem . InvalidCharacterConstant : case IProblem . InvalidEscape : case IProblem . InvalidInput : case IProblem . InvalidUnicodeEscape : case IProblem . InvalidFloat : case IProblem . NullSourceString : case IProblem . UnterminatedString : case IProblem . UnterminatedComment : case IProblem . InvalidDigit : break ; default : this . usedOrIrrelevantProblems [ i ] = true ; continue next ; } int problemStart = problem . getSourceStart ( ) ; int problemEnd = problem . getSourceEnd ( ) ; if ( ( start <= problemStart ) && ( problemStart <= end ) || ( start <= problemEnd ) && ( problemEnd <= end ) ) { this . usedOrIrrelevantProblems [ i ] = true ; foundProblems = true ; } } return foundProblems ; } public void endVisit ( ExpressionStatement node ) { endVisitNode ( node ) ; if ( ( node . getFlags ( ) & ASTNode . RECOVERED ) == <NUM_LIT:0> ) return ; Expression expression = node . getExpression ( ) ; if ( expression . getNodeType ( ) == ASTNode . ASSIGNMENT ) { Assignment assignment = ( Assignment ) expression ; Expression rightHandSide = assignment . getRightHandSide ( ) ; if ( rightHandSide . getNodeType ( ) == ASTNode . SIMPLE_NAME ) { SimpleName simpleName = ( SimpleName ) rightHandSide ; if ( CharOperation . equals ( RecoveryScanner . FAKE_IDENTIFIER , simpleName . getIdentifier ( ) . toCharArray ( ) ) ) { Expression expression2 = assignment . getLeftHandSide ( ) ; expression2 . setParent ( null , null ) ; expression2 . setFlags ( expression2 . getFlags ( ) | ASTNode . RECOVERED ) ; node . setExpression ( expression2 ) ; } } } } public void endVisit ( ForStatement node ) { endVisitNode ( node ) ; List initializers = node . initializers ( ) ; if ( initializers . size ( ) == <NUM_LIT:1> ) { Expression expression = ( Expression ) initializers . get ( <NUM_LIT:0> ) ; if ( expression . getNodeType ( ) == ASTNode . VARIABLE_DECLARATION_EXPRESSION ) { VariableDeclarationExpression variableDeclarationExpression = ( VariableDeclarationExpression ) expression ; List fragments = variableDeclarationExpression . fragments ( ) ; for ( int i = <NUM_LIT:0> , max = fragments . size ( ) ; i < max ; i ++ ) { VariableDeclarationFragment fragment = ( VariableDeclarationFragment ) fragments . get ( i ) ; SimpleName simpleName = fragment . getName ( ) ; if ( CharOperation . equals ( RecoveryScanner . FAKE_IDENTIFIER , simpleName . getIdentifier ( ) . toCharArray ( ) ) ) { fragments . remove ( fragment ) ; variableDeclarationExpression . setFlags ( variableDeclarationExpression . getFlags ( ) | ASTNode . RECOVERED ) ; } } } } } public void endVisit ( VariableDeclarationStatement node ) { endVisitNode ( node ) ; List fragments = node . fragments ( ) ; for ( int i = <NUM_LIT:0> , max = fragments . size ( ) ; i < max ; i ++ ) { VariableDeclarationFragment fragment = ( VariableDeclarationFragment ) fragments . get ( i ) ; Expression expression = fragment . getInitializer ( ) ; if ( expression == null ) continue ; if ( ( expression . getFlags ( ) & ASTNode . RECOVERED ) == <NUM_LIT:0> ) continue ; if ( expression . getNodeType ( ) == ASTNode . SIMPLE_NAME ) { SimpleName simpleName = ( SimpleName ) expression ; if ( CharOperation . equals ( RecoveryScanner . FAKE_IDENTIFIER , simpleName . getIdentifier ( ) . toCharArray ( ) ) ) { fragment . setInitializer ( null ) ; fragment . setFlags ( fragment . getFlags ( ) | ASTNode . RECOVERED ) ; } } } } public void endVisit ( NormalAnnotation node ) { endVisitNode ( node ) ; if ( this . blockDepth < <NUM_LIT:1> ) { List values = node . values ( ) ; int size = values . size ( ) ; if ( size > <NUM_LIT:0> ) { MemberValuePair lastMemberValuePair = ( MemberValuePair ) values . get ( size - <NUM_LIT:1> ) ; int annotationEnd = node . getStartPosition ( ) + node . getLength ( ) ; int lastMemberValuePairEnd = lastMemberValuePair . getStartPosition ( ) + lastMemberValuePair . getLength ( ) ; if ( annotationEnd == lastMemberValuePairEnd ) { node . setFlags ( node . getFlags ( ) | ASTNode . RECOVERED ) ; } } } } public void endVisit ( SingleMemberAnnotation node ) { endVisitNode ( node ) ; if ( this . blockDepth < <NUM_LIT:1> ) { Expression value = node . getValue ( ) ; int annotationEnd = node . getStartPosition ( ) + node . getLength ( ) ; int valueEnd = value . getStartPosition ( ) + value . getLength ( ) ; if ( annotationEnd == valueEnd ) { node . setFlags ( node . getFlags ( ) | ASTNode . RECOVERED ) ; } } } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . io . File ; import java . io . IOException ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import org . codehaus . jdt . groovy . integration . LanguageSupportFactory ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaProject ; 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 . core . util . CompilerUtils ; import org . eclipse . jdt . internal . compiler . CompilationResult ; import org . eclipse . jdt . internal . compiler . Compiler ; import org . eclipse . jdt . internal . compiler . DefaultErrorHandlingPolicies ; import org . eclipse . jdt . internal . compiler . ICompilerRequestor ; import org . eclipse . jdt . internal . compiler . IErrorHandlingPolicy ; import org . eclipse . jdt . internal . compiler . IProblemFactory ; import org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . CompilationUnitDeclaration ; import org . eclipse . jdt . internal . compiler . batch . FileSystem . Classpath ; import org . eclipse . jdt . internal . compiler . env . AccessRestriction ; import org . eclipse . jdt . internal . compiler . env . INameEnvironment ; import org . eclipse . jdt . internal . compiler . env . ISourceType ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . ExtraCompilerModifiers ; import org . eclipse . jdt . internal . compiler . lookup . PackageBinding ; import org . eclipse . jdt . internal . compiler . parser . Parser ; import org . eclipse . jdt . internal . compiler . problem . AbortCompilation ; import org . eclipse . jdt . internal . compiler . problem . DefaultProblemFactory ; import org . eclipse . jdt . internal . compiler . problem . ProblemReporter ; import org . eclipse . jdt . internal . compiler . util . HashtableOfObject ; import org . eclipse . jdt . internal . compiler . util . HashtableOfObjectToInt ; import org . eclipse . jdt . internal . compiler . util . Messages ; import org . eclipse . jdt . internal . compiler . util . Util ; import org . eclipse . jdt . internal . core . BinaryMember ; import org . eclipse . jdt . internal . core . CancelableNameEnvironment ; import org . eclipse . jdt . internal . core . CancelableProblemFactory ; import org . eclipse . jdt . internal . core . INameEnvironmentWithProgress ; import org . eclipse . jdt . internal . core . JavaProject ; import org . eclipse . jdt . internal . core . NameLookup ; import org . eclipse . jdt . internal . core . SourceRefElement ; import org . eclipse . jdt . internal . core . SourceTypeElementInfo ; import org . eclipse . jdt . internal . core . util . BindingKeyResolver ; import org . eclipse . jdt . internal . core . util . CommentRecorderParser ; import org . eclipse . jdt . internal . core . util . DOMFinder ; public class CompilationUnitResolver extends Compiler { public static final int RESOLVE_BINDING = <NUM_LIT> ; public static final int PARTIAL = <NUM_LIT> ; public static final int STATEMENT_RECOVERY = <NUM_LIT> ; public static final int IGNORE_METHOD_BODIES = <NUM_LIT> ; public static final int BINDING_RECOVERY = <NUM_LIT> ; public static final int INCLUDE_RUNNING_VM_BOOTCLASSPATH = <NUM_LIT> ; static class IntArrayList { public int [ ] list = new int [ <NUM_LIT:5> ] ; public int length = <NUM_LIT:0> ; public void add ( int i ) { if ( this . list . length == this . length ) { System . arraycopy ( this . list , <NUM_LIT:0> , this . list = new int [ this . length * <NUM_LIT:2> ] , <NUM_LIT:0> , this . length ) ; } this . list [ this . length ++ ] = i ; } } HashtableOfObject requestedSources ; HashtableOfObject requestedKeys ; DefaultBindingResolver . BindingTables bindingTables ; boolean hasCompilationAborted ; CategorizedProblem abortProblem ; private IProgressMonitor monitor ; boolean fromJavaProject ; public CompilationUnitResolver ( INameEnvironment environment , IErrorHandlingPolicy policy , CompilerOptions compilerOptions , ICompilerRequestor requestor , IProblemFactory problemFactory , IProgressMonitor monitor , boolean fromJavaProject ) { super ( environment , policy , compilerOptions , requestor , problemFactory ) ; this . hasCompilationAborted = false ; this . monitor = monitor ; this . fromJavaProject = fromJavaProject ; } public void accept ( ISourceType [ ] sourceTypes , PackageBinding packageBinding , AccessRestriction accessRestriction ) { SourceTypeElementInfo sourceType = ( SourceTypeElementInfo ) sourceTypes [ <NUM_LIT:0> ] ; accept ( ( org . eclipse . jdt . internal . compiler . env . ICompilationUnit ) sourceType . getHandle ( ) . getCompilationUnit ( ) , accessRestriction ) ; } public synchronized void accept ( org . eclipse . jdt . internal . compiler . env . ICompilationUnit sourceUnit , AccessRestriction accessRestriction ) { super . accept ( sourceUnit , accessRestriction ) ; } protected void beginToCompile ( org . eclipse . jdt . internal . compiler . env . ICompilationUnit [ ] sourceUnits , String [ ] bindingKeys ) { int sourceLength = sourceUnits . length ; int keyLength = bindingKeys . length ; int maxUnits = sourceLength + keyLength ; this . totalUnits = <NUM_LIT:0> ; this . unitsToProcess = new CompilationUnitDeclaration [ maxUnits ] ; int index = <NUM_LIT:0> ; this . requestedSources = new HashtableOfObject ( ) ; for ( int i = <NUM_LIT:0> ; i < sourceLength ; i ++ ) { org . eclipse . jdt . internal . compiler . env . ICompilationUnit sourceUnit = sourceUnits [ i ] ; CompilationUnitDeclaration parsedUnit ; CompilationResult unitResult = new CompilationResult ( sourceUnit , index ++ , maxUnits , this . options . maxProblemsPerUnit ) ; try { if ( this . options . verbose ) { this . out . println ( Messages . bind ( Messages . compilation_request , new String [ ] { String . valueOf ( index ++ + <NUM_LIT:1> ) , String . valueOf ( maxUnits ) , new String ( sourceUnit . getFileName ( ) ) } ) ) ; } if ( this . totalUnits < this . parseThreshold ) { parsedUnit = this . parser . parse ( sourceUnit , unitResult ) ; } else { parsedUnit = this . parser . dietParse ( sourceUnit , unitResult ) ; } this . lookupEnvironment . buildTypeBindings ( parsedUnit , null ) ; addCompilationUnit ( sourceUnit , parsedUnit ) ; this . requestedSources . put ( unitResult . getFileName ( ) , sourceUnit ) ; worked ( <NUM_LIT:1> ) ; } finally { sourceUnits [ i ] = null ; } } this . requestedKeys = new HashtableOfObject ( ) ; for ( int i = <NUM_LIT:0> ; i < keyLength ; i ++ ) { BindingKeyResolver resolver = new BindingKeyResolver ( bindingKeys [ i ] , this , this . lookupEnvironment ) ; resolver . parse ( true ) ; CompilationUnitDeclaration parsedUnit = resolver . hasTypeName ( ) ? resolver . getCompilationUnitDeclaration ( ) : null ; if ( parsedUnit != null ) { char [ ] fileName = parsedUnit . compilationResult . getFileName ( ) ; Object existing = this . requestedKeys . get ( fileName ) ; if ( existing == null ) this . requestedKeys . put ( fileName , resolver ) ; else if ( existing instanceof ArrayList ) ( ( ArrayList ) existing ) . add ( resolver ) ; else { ArrayList list = new ArrayList ( ) ; list . add ( existing ) ; list . add ( resolver ) ; this . requestedKeys . put ( fileName , list ) ; } } else { char [ ] key = resolver . hasTypeName ( ) ? resolver . getKey ( ) . toCharArray ( ) : CharOperation . concatWith ( resolver . compoundName ( ) , '<CHAR_LIT:.>' ) ; this . requestedKeys . put ( key , resolver ) ; } worked ( <NUM_LIT:1> ) ; } this . lookupEnvironment . completeTypeBindings ( ) ; } IBinding createBinding ( String key ) { if ( this . bindingTables == null ) throw new RuntimeException ( "<STR_LIT>" ) ; BindingKeyResolver keyResolver = new BindingKeyResolver ( key , this , this . lookupEnvironment ) ; Binding compilerBinding = keyResolver . getCompilerBinding ( ) ; if ( compilerBinding == null ) return null ; DefaultBindingResolver resolver = new DefaultBindingResolver ( this . lookupEnvironment , null , this . bindingTables , false , this . fromJavaProject ) ; return resolver . getBinding ( compilerBinding ) ; } public static CompilationUnit convert ( CompilationUnitDeclaration compilationUnitDeclaration , char [ ] source , int apiLevel , Map options , boolean needToResolveBindings , WorkingCopyOwner owner , DefaultBindingResolver . BindingTables bindingTables , int flags , IProgressMonitor monitor , boolean fromJavaProject ) { BindingResolver resolver = null ; AST ast = AST . newAST ( apiLevel ) ; ast . setDefaultNodeFlag ( ASTNode . ORIGINAL ) ; CompilationUnit compilationUnit = null ; ASTConverter converter = new ASTConverter ( options , needToResolveBindings , monitor ) ; if ( needToResolveBindings ) { resolver = new DefaultBindingResolver ( compilationUnitDeclaration . scope , owner , bindingTables , ( flags & ICompilationUnit . ENABLE_BINDINGS_RECOVERY ) != <NUM_LIT:0> , fromJavaProject ) ; ast . setFlag ( flags | AST . RESOLVED_BINDINGS ) ; } else { resolver = new BindingResolver ( ) ; ast . setFlag ( flags ) ; } ast . setBindingResolver ( resolver ) ; converter . setAST ( ast ) ; compilationUnit = converter . convert ( compilationUnitDeclaration , source ) ; compilationUnit . setLineEndTable ( compilationUnitDeclaration . compilationResult . getLineSeparatorPositions ( ) ) ; ast . setDefaultNodeFlag ( <NUM_LIT:0> ) ; ast . setOriginalModificationCount ( ast . modificationCount ( ) ) ; return compilationUnit ; } protected static CompilerOptions getCompilerOptions ( Map options , boolean statementsRecovery ) { CompilerOptions compilerOptions = new CompilerOptions ( options ) ; compilerOptions . performMethodsFullRecovery = statementsRecovery ; compilerOptions . performStatementsRecovery = statementsRecovery ; compilerOptions . parseLiteralExpressionsAsConstants = false ; compilerOptions . storeAnnotations = true ; compilerOptions . ignoreSourceFolderWarningOption = true ; return compilerOptions ; } protected static IErrorHandlingPolicy getHandlingPolicy ( ) { return new IErrorHandlingPolicy ( ) { public boolean stopOnFirstError ( ) { return false ; } public boolean proceedOnErrors ( ) { return false ; } } ; } protected static ICompilerRequestor getRequestor ( ) { return new ICompilerRequestor ( ) { public void acceptResult ( CompilationResult compilationResult ) { } } ; } public void initializeParser ( ) { this . parser = LanguageSupportFactory . getParser ( this , this . lookupEnvironment == null ? null : this . lookupEnvironment . globalOptions , this . problemReporter , false , LanguageSupportFactory . CommentRecorderParserVariant ) ; } public void process ( CompilationUnitDeclaration unit , int i ) { char [ ] fileName = unit . compilationResult . getFileName ( ) ; if ( this . requestedKeys . get ( fileName ) == null && this . requestedSources . get ( fileName ) == null ) super . process ( unit , i ) ; } protected void handleInternalException ( Throwable internalException , CompilationUnitDeclaration unit , CompilationResult result ) { super . handleInternalException ( internalException , unit , result ) ; if ( unit != null ) { removeUnresolvedBindings ( unit ) ; } } protected void handleInternalException ( AbortCompilation abortException , CompilationUnitDeclaration unit ) { super . handleInternalException ( abortException , unit ) ; if ( unit != null ) { removeUnresolvedBindings ( unit ) ; } this . hasCompilationAborted = true ; this . abortProblem = abortException . problem ; } public static void parse ( ICompilationUnit [ ] compilationUnits , ASTRequestor astRequestor , int apiLevel , Map options , int flags , IProgressMonitor monitor ) { try { CompilerOptions compilerOptions = new CompilerOptions ( options ) ; compilerOptions . ignoreMethodBodies = ( flags & ICompilationUnit . IGNORE_METHOD_BODIES ) != <NUM_LIT:0> ; Parser parser = new CommentRecorderParser ( new ProblemReporter ( DefaultErrorHandlingPolicies . proceedWithAllProblems ( ) , compilerOptions , new DefaultProblemFactory ( ) ) , false ) ; int unitLength = compilationUnits . length ; if ( monitor != null ) monitor . beginTask ( "<STR_LIT>" , unitLength ) ; for ( int i = <NUM_LIT:0> ; i < unitLength ; i ++ ) { org . eclipse . jdt . internal . compiler . env . ICompilationUnit sourceUnit = ( org . eclipse . jdt . internal . compiler . env . ICompilationUnit ) compilationUnits [ i ] ; CompilationResult compilationResult = new CompilationResult ( sourceUnit , <NUM_LIT:0> , <NUM_LIT:0> , compilerOptions . maxProblemsPerUnit ) ; CompilationUnitDeclaration compilationUnitDeclaration = parser . dietParse ( sourceUnit , compilationResult ) ; if ( compilationUnitDeclaration . ignoreMethodBodies ) { compilationUnitDeclaration . ignoreFurtherInvestigation = true ; continue ; } org . eclipse . jdt . internal . compiler . ast . TypeDeclaration [ ] types = compilationUnitDeclaration . types ; if ( types != null ) { for ( int j = <NUM_LIT:0> , typeLength = types . length ; j < typeLength ; j ++ ) { types [ j ] . parseMethods ( parser , compilationUnitDeclaration ) ; } } CompilationUnit node = convert ( compilationUnitDeclaration , parser . scanner . getSource ( ) , apiLevel , options , false , null , null , flags , monitor , true ) ; node . setTypeRoot ( compilationUnits [ i ] ) ; astRequestor . acceptAST ( compilationUnits [ i ] , node ) ; if ( monitor != null ) monitor . worked ( <NUM_LIT:1> ) ; } } finally { if ( monitor != null ) monitor . done ( ) ; } } public static void parse ( String [ ] sourceUnits , String [ ] encodings , FileASTRequestor astRequestor , int apiLevel , Map options , int flags , IProgressMonitor monitor ) { try { CompilerOptions compilerOptions = new CompilerOptions ( options ) ; compilerOptions . ignoreMethodBodies = ( flags & ICompilationUnit . IGNORE_METHOD_BODIES ) != <NUM_LIT:0> ; Parser parser = new CommentRecorderParser ( new ProblemReporter ( DefaultErrorHandlingPolicies . proceedWithAllProblems ( ) , compilerOptions , new DefaultProblemFactory ( ) ) , false ) ; int unitLength = sourceUnits . length ; if ( monitor != null ) monitor . beginTask ( "<STR_LIT>" , unitLength ) ; for ( int i = <NUM_LIT:0> ; i < unitLength ; i ++ ) { char [ ] contents = null ; String encoding = encodings != null ? encodings [ i ] : null ; try { contents = Util . getFileCharContent ( new File ( sourceUnits [ i ] ) , encoding ) ; } catch ( IOException e ) { continue ; } if ( contents == null ) { continue ; } org . eclipse . jdt . internal . compiler . batch . CompilationUnit compilationUnit = new org . eclipse . jdt . internal . compiler . batch . CompilationUnit ( contents , sourceUnits [ i ] , encoding ) ; org . eclipse . jdt . internal . compiler . env . ICompilationUnit sourceUnit = compilationUnit ; CompilationResult compilationResult = new CompilationResult ( sourceUnit , <NUM_LIT:0> , <NUM_LIT:0> , compilerOptions . maxProblemsPerUnit ) ; CompilationUnitDeclaration compilationUnitDeclaration = parser . dietParse ( sourceUnit , compilationResult ) ; if ( compilationUnitDeclaration . ignoreMethodBodies ) { compilationUnitDeclaration . ignoreFurtherInvestigation = true ; continue ; } org . eclipse . jdt . internal . compiler . ast . TypeDeclaration [ ] types = compilationUnitDeclaration . types ; if ( types != null ) { for ( int j = <NUM_LIT:0> , typeLength = types . length ; j < typeLength ; j ++ ) { types [ j ] . parseMethods ( parser , compilationUnitDeclaration ) ; } } CompilationUnit node = convert ( compilationUnitDeclaration , parser . scanner . getSource ( ) , apiLevel , options , false , null , null , flags , monitor , true ) ; node . setTypeRoot ( null ) ; astRequestor . acceptAST ( sourceUnits [ i ] , node ) ; if ( monitor != null ) monitor . worked ( <NUM_LIT:1> ) ; } } finally { if ( monitor != null ) monitor . done ( ) ; } } public static CompilationUnitDeclaration parse ( org . eclipse . jdt . internal . compiler . env . ICompilationUnit sourceUnit , NodeSearcher nodeSearcher , Map settings , int flags ) { if ( sourceUnit == null ) { throw new IllegalStateException ( ) ; } CompilerOptions compilerOptions = new CompilerOptions ( settings ) ; boolean statementsRecovery = ( flags & ICompilationUnit . ENABLE_STATEMENTS_RECOVERY ) != <NUM_LIT:0> ; compilerOptions . performMethodsFullRecovery = statementsRecovery ; compilerOptions . performStatementsRecovery = statementsRecovery ; compilerOptions . ignoreMethodBodies = ( flags & ICompilationUnit . IGNORE_METHOD_BODIES ) != <NUM_LIT:0> ; Parser parser = LanguageSupportFactory . getParser ( null , compilerOptions , new ProblemReporter ( DefaultErrorHandlingPolicies . proceedWithAllProblems ( ) , compilerOptions , new DefaultProblemFactory ( ) ) , false , <NUM_LIT:2> ) ; CompilationResult compilationResult = new CompilationResult ( sourceUnit , <NUM_LIT:0> , <NUM_LIT:0> , compilerOptions . maxProblemsPerUnit ) ; CompilationUnitDeclaration compilationUnitDeclaration = parser . dietParse ( sourceUnit , compilationResult ) ; if ( compilationUnitDeclaration . ignoreMethodBodies ) { compilationUnitDeclaration . ignoreFurtherInvestigation = true ; return compilationUnitDeclaration ; } if ( nodeSearcher != null ) { char [ ] source = parser . scanner . getSource ( ) ; int searchPosition = nodeSearcher . position ; if ( searchPosition < <NUM_LIT:0> || searchPosition > source . length ) { return compilationUnitDeclaration ; } compilationUnitDeclaration . traverse ( nodeSearcher , compilationUnitDeclaration . scope ) ; org . eclipse . jdt . internal . compiler . ast . ASTNode node = nodeSearcher . found ; if ( node == null ) { return compilationUnitDeclaration ; } org . eclipse . jdt . internal . compiler . ast . TypeDeclaration enclosingTypeDeclaration = nodeSearcher . enclosingType ; if ( node instanceof AbstractMethodDeclaration ) { ( ( AbstractMethodDeclaration ) node ) . parseStatements ( parser , compilationUnitDeclaration ) ; } else if ( enclosingTypeDeclaration != null ) { if ( node instanceof org . eclipse . jdt . internal . compiler . ast . Initializer ) { ( ( org . eclipse . jdt . internal . compiler . ast . Initializer ) node ) . parseStatements ( parser , enclosingTypeDeclaration , compilationUnitDeclaration ) ; } else if ( node instanceof org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) { ( ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) node ) . parseMethods ( parser , compilationUnitDeclaration ) ; } } } else { org . eclipse . jdt . internal . compiler . ast . TypeDeclaration [ ] types = compilationUnitDeclaration . types ; if ( types != null ) { for ( int j = <NUM_LIT:0> , typeLength = types . length ; j < typeLength ; j ++ ) { types [ j ] . parseMethods ( parser , compilationUnitDeclaration ) ; } } } return compilationUnitDeclaration ; } public static void resolve ( ICompilationUnit [ ] compilationUnits , String [ ] bindingKeys , ASTRequestor requestor , int apiLevel , Map options , IJavaProject javaProject , WorkingCopyOwner owner , int flags , IProgressMonitor monitor ) { CancelableNameEnvironment environment = null ; CancelableProblemFactory problemFactory = null ; try { if ( monitor != null ) { int amountOfWork = ( compilationUnits . length + bindingKeys . length ) * <NUM_LIT:2> ; monitor . beginTask ( "<STR_LIT>" , amountOfWork ) ; } environment = new CancelableNameEnvironment ( ( ( JavaProject ) javaProject ) , owner , monitor ) ; problemFactory = new CancelableProblemFactory ( monitor ) ; CompilerOptions compilerOptions = getCompilerOptions ( options , ( flags & ICompilationUnit . ENABLE_STATEMENTS_RECOVERY ) != <NUM_LIT:0> ) ; compilerOptions . ignoreMethodBodies = ( flags & ICompilationUnit . IGNORE_METHOD_BODIES ) != <NUM_LIT:0> ; CompilerUtils . configureOptionsBasedOnNature ( compilerOptions , javaProject ) ; CompilationUnitResolver resolver = new CompilationUnitResolver ( environment , getHandlingPolicy ( ) , compilerOptions , getRequestor ( ) , problemFactory , monitor , javaProject != null ) ; resolver . resolve ( compilationUnits , bindingKeys , requestor , apiLevel , options , owner , flags ) ; if ( NameLookup . VERBOSE ) { System . out . println ( Thread . currentThread ( ) + "<STR_LIT>" + environment . nameLookup . timeSpentInSeekTypesInSourcePackage + "<STR_LIT>" ) ; System . out . println ( Thread . currentThread ( ) + "<STR_LIT>" + environment . nameLookup . timeSpentInSeekTypesInBinaryPackage + "<STR_LIT>" ) ; } } catch ( JavaModelException e ) { parse ( compilationUnits , requestor , apiLevel , options , flags , monitor ) ; } finally { if ( monitor != null ) monitor . done ( ) ; if ( environment != null ) { environment . setMonitor ( null ) ; } if ( problemFactory != null ) { problemFactory . monitor = null ; } } } public static void resolve ( String [ ] sourceUnits , String [ ] encodings , String [ ] bindingKeys , FileASTRequestor requestor , int apiLevel , Map options , List classpaths , int flags , IProgressMonitor monitor ) { INameEnvironmentWithProgress environment = null ; CancelableProblemFactory problemFactory = null ; try { if ( monitor != null ) { int amountOfWork = ( sourceUnits . length + bindingKeys . length ) * <NUM_LIT:2> ; monitor . beginTask ( "<STR_LIT>" , amountOfWork ) ; } Classpath [ ] allEntries = new Classpath [ classpaths . size ( ) ] ; classpaths . toArray ( allEntries ) ; environment = new NameEnvironmentWithProgress ( allEntries , null , monitor ) ; problemFactory = new CancelableProblemFactory ( monitor ) ; CompilerOptions compilerOptions = getCompilerOptions ( options , ( flags & ICompilationUnit . ENABLE_STATEMENTS_RECOVERY ) != <NUM_LIT:0> ) ; compilerOptions . ignoreMethodBodies = ( flags & ICompilationUnit . IGNORE_METHOD_BODIES ) != <NUM_LIT:0> ; CompilationUnitResolver resolver = new CompilationUnitResolver ( environment , getHandlingPolicy ( ) , compilerOptions , getRequestor ( ) , problemFactory , monitor , false ) ; resolver . resolve ( sourceUnits , encodings , bindingKeys , requestor , apiLevel , options , flags ) ; if ( NameLookup . VERBOSE && ( environment instanceof CancelableNameEnvironment ) ) { CancelableNameEnvironment cancelableNameEnvironment = ( CancelableNameEnvironment ) environment ; System . out . println ( Thread . currentThread ( ) + "<STR_LIT>" + cancelableNameEnvironment . nameLookup . timeSpentInSeekTypesInSourcePackage + "<STR_LIT>" ) ; System . out . println ( Thread . currentThread ( ) + "<STR_LIT>" + cancelableNameEnvironment . nameLookup . timeSpentInSeekTypesInBinaryPackage + "<STR_LIT>" ) ; } } finally { if ( monitor != null ) monitor . done ( ) ; if ( environment != null ) { environment . setMonitor ( null ) ; } if ( problemFactory != null ) { problemFactory . monitor = null ; } } } public static CompilationUnitDeclaration resolve ( org . eclipse . jdt . internal . compiler . env . ICompilationUnit sourceUnit , IJavaProject javaProject , List classpaths , NodeSearcher nodeSearcher , Map options , WorkingCopyOwner owner , int flags , IProgressMonitor monitor ) throws JavaModelException { CompilationUnitDeclaration unit = null ; INameEnvironmentWithProgress environment = null ; CancelableProblemFactory problemFactory = null ; CompilationUnitResolver resolver = null ; try { if ( javaProject == null ) { Classpath [ ] allEntries = new Classpath [ classpaths . size ( ) ] ; classpaths . toArray ( allEntries ) ; environment = new NameEnvironmentWithProgress ( allEntries , null , monitor ) ; } else { environment = new CancelableNameEnvironment ( ( JavaProject ) javaProject , owner , monitor ) ; } problemFactory = new CancelableProblemFactory ( monitor ) ; CompilerOptions compilerOptions = getCompilerOptions ( options , ( flags & ICompilationUnit . ENABLE_STATEMENTS_RECOVERY ) != <NUM_LIT:0> ) ; boolean ignoreMethodBodies = ( flags & ICompilationUnit . IGNORE_METHOD_BODIES ) != <NUM_LIT:0> ; compilerOptions . ignoreMethodBodies = ignoreMethodBodies ; CompilerUtils . configureOptionsBasedOnNature ( compilerOptions , javaProject ) ; resolver = new CompilationUnitResolver ( environment , getHandlingPolicy ( ) , compilerOptions , getRequestor ( ) , problemFactory , monitor , javaProject != null ) ; boolean analyzeAndGenerateCode = ! ignoreMethodBodies ; unit = resolver . resolve ( null , sourceUnit , nodeSearcher , true , analyzeAndGenerateCode , analyzeAndGenerateCode ) ; if ( resolver . hasCompilationAborted ) { CompilationUnitDeclaration unitDeclaration = parse ( sourceUnit , nodeSearcher , options , flags ) ; if ( unit != null ) { final int problemCount = unit . compilationResult . problemCount ; if ( problemCount != <NUM_LIT:0> ) { unitDeclaration . compilationResult . problems = new CategorizedProblem [ problemCount ] ; System . arraycopy ( unit . compilationResult . problems , <NUM_LIT:0> , unitDeclaration . compilationResult . problems , <NUM_LIT:0> , problemCount ) ; unitDeclaration . compilationResult . problemCount = problemCount ; } } else if ( resolver . abortProblem != null ) { unitDeclaration . compilationResult . problemCount = <NUM_LIT:1> ; unitDeclaration . compilationResult . problems = new CategorizedProblem [ ] { resolver . abortProblem } ; } return unitDeclaration ; } if ( NameLookup . VERBOSE && environment instanceof CancelableNameEnvironment ) { CancelableNameEnvironment cancelableNameEnvironment = ( CancelableNameEnvironment ) environment ; System . out . println ( Thread . currentThread ( ) + "<STR_LIT>" + cancelableNameEnvironment . nameLookup . timeSpentInSeekTypesInSourcePackage + "<STR_LIT>" ) ; System . out . println ( Thread . currentThread ( ) + "<STR_LIT>" + cancelableNameEnvironment . nameLookup . timeSpentInSeekTypesInBinaryPackage + "<STR_LIT>" ) ; } return unit ; } finally { if ( environment != null ) { environment . setMonitor ( null ) ; } if ( problemFactory != null ) { problemFactory . monitor = null ; } } } public static IBinding [ ] resolve ( final IJavaElement [ ] elements , int apiLevel , Map compilerOptions , IJavaProject javaProject , WorkingCopyOwner owner , int flags , IProgressMonitor monitor ) { final int length = elements . length ; final HashMap sourceElementPositions = new HashMap ( ) ; int cuNumber = <NUM_LIT:0> ; final HashtableOfObjectToInt binaryElementPositions = new HashtableOfObjectToInt ( ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IJavaElement element = elements [ i ] ; if ( ! ( element instanceof SourceRefElement ) ) throw new IllegalStateException ( element + "<STR_LIT>" ) ; Object cu = element . getAncestor ( IJavaElement . COMPILATION_UNIT ) ; if ( cu != null ) { IntArrayList intList = ( IntArrayList ) sourceElementPositions . get ( cu ) ; if ( intList == null ) { sourceElementPositions . put ( cu , intList = new IntArrayList ( ) ) ; cuNumber ++ ; } intList . add ( i ) ; } else { try { String key = ( ( BinaryMember ) element ) . getKey ( true ) ; binaryElementPositions . put ( key , i ) ; } catch ( JavaModelException e ) { throw new IllegalArgumentException ( element + "<STR_LIT>" ) ; } } } ICompilationUnit [ ] cus = new ICompilationUnit [ cuNumber ] ; sourceElementPositions . keySet ( ) . toArray ( cus ) ; int bindingKeyNumber = binaryElementPositions . size ( ) ; String [ ] bindingKeys = new String [ bindingKeyNumber ] ; binaryElementPositions . keysToArray ( bindingKeys ) ; class Requestor extends ASTRequestor { IBinding [ ] bindings = new IBinding [ length ] ; public void acceptAST ( ICompilationUnit source , CompilationUnit ast ) { IntArrayList intList = ( IntArrayList ) sourceElementPositions . get ( source ) ; for ( int i = <NUM_LIT:0> ; i < intList . length ; i ++ ) { final int index = intList . list [ i ] ; SourceRefElement element = ( SourceRefElement ) elements [ index ] ; DOMFinder finder = new DOMFinder ( ast , element , true ) ; try { finder . search ( ) ; } catch ( JavaModelException e ) { throw new IllegalArgumentException ( element + "<STR_LIT>" ) ; } this . bindings [ index ] = finder . foundBinding ; } } public void acceptBinding ( String bindingKey , IBinding binding ) { int index = binaryElementPositions . get ( bindingKey ) ; this . bindings [ index ] = binding ; } } Requestor requestor = new Requestor ( ) ; resolve ( cus , bindingKeys , requestor , apiLevel , compilerOptions , javaProject , owner , flags , monitor ) ; return requestor . bindings ; } public void removeUnresolvedBindings ( CompilationUnitDeclaration compilationUnitDeclaration ) { final org . eclipse . jdt . internal . compiler . ast . TypeDeclaration [ ] types = compilationUnitDeclaration . types ; if ( types != null ) { for ( int i = <NUM_LIT:0> , max = types . length ; i < max ; i ++ ) { removeUnresolvedBindings ( types [ i ] ) ; } } } private void removeUnresolvedBindings ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration type ) { final org . eclipse . jdt . internal . compiler . ast . TypeDeclaration [ ] memberTypes = type . memberTypes ; if ( memberTypes != null ) { for ( int i = <NUM_LIT:0> , max = memberTypes . length ; i < max ; i ++ ) { removeUnresolvedBindings ( memberTypes [ i ] ) ; } } if ( type . binding != null && ( type . binding . modifiers & ExtraCompilerModifiers . AccUnresolved ) != <NUM_LIT:0> ) { type . binding = null ; } final org . eclipse . jdt . internal . compiler . ast . FieldDeclaration [ ] fields = type . fields ; if ( fields != null ) { for ( int i = <NUM_LIT:0> , max = fields . length ; i < max ; i ++ ) { if ( fields [ i ] . binding != null && ( fields [ i ] . binding . modifiers & ExtraCompilerModifiers . AccUnresolved ) != <NUM_LIT:0> ) { fields [ i ] . binding = null ; } } } final AbstractMethodDeclaration [ ] methods = type . methods ; if ( methods != null ) { for ( int i = <NUM_LIT:0> , max = methods . length ; i < max ; i ++ ) { if ( methods [ i ] . binding != null && ( methods [ i ] . binding . modifiers & ExtraCompilerModifiers . AccUnresolved ) != <NUM_LIT:0> ) { methods [ i ] . binding = null ; } } } } private void resolve ( ICompilationUnit [ ] compilationUnits , String [ ] bindingKeys , ASTRequestor astRequestor , int apiLevel , Map compilerOptions , WorkingCopyOwner owner , int flags ) { astRequestor . compilationUnitResolver = this ; this . bindingTables = new DefaultBindingResolver . BindingTables ( ) ; CompilationUnitDeclaration unit = null ; try { int length = compilationUnits . length ; org . eclipse . jdt . internal . compiler . env . ICompilationUnit [ ] sourceUnits = new org . eclipse . jdt . internal . compiler . env . ICompilationUnit [ length ] ; System . arraycopy ( compilationUnits , <NUM_LIT:0> , sourceUnits , <NUM_LIT:0> , length ) ; beginToCompile ( sourceUnits , bindingKeys ) ; for ( int i = <NUM_LIT:0> ; i < this . totalUnits ; i ++ ) { if ( resolvedRequestedSourcesAndKeys ( i ) ) { for ( ; i < this . totalUnits ; i ++ ) { this . unitsToProcess [ i ] . cleanUp ( ) ; this . unitsToProcess [ i ] = null ; } break ; } unit = this . unitsToProcess [ i ] ; try { super . process ( unit , i ) ; char [ ] fileName = unit . compilationResult . getFileName ( ) ; ICompilationUnit source = ( ICompilationUnit ) this . requestedSources . get ( fileName ) ; if ( source != null ) { CompilationResult compilationResult = unit . compilationResult ; org . eclipse . jdt . internal . compiler . env . ICompilationUnit sourceUnit = compilationResult . compilationUnit ; char [ ] contents = sourceUnit . getContents ( ) ; AST ast = AST . newAST ( apiLevel ) ; ast . setFlag ( flags | AST . RESOLVED_BINDINGS ) ; ast . setDefaultNodeFlag ( ASTNode . ORIGINAL ) ; ASTConverter converter = new ASTConverter ( compilerOptions , true , this . monitor ) ; BindingResolver resolver = new DefaultBindingResolver ( unit . scope , owner , this . bindingTables , ( flags & ICompilationUnit . ENABLE_BINDINGS_RECOVERY ) != <NUM_LIT:0> , this . fromJavaProject ) ; ast . setBindingResolver ( resolver ) ; converter . setAST ( ast ) ; CompilationUnit compilationUnit = converter . convert ( unit , contents ) ; compilationUnit . setTypeRoot ( source ) ; compilationUnit . setLineEndTable ( compilationResult . getLineSeparatorPositions ( ) ) ; ast . setDefaultNodeFlag ( <NUM_LIT:0> ) ; ast . setOriginalModificationCount ( ast . modificationCount ( ) ) ; astRequestor . acceptAST ( source , compilationUnit ) ; worked ( <NUM_LIT:1> ) ; this . requestedSources . put ( fileName , null ) ; } Object key = this . requestedKeys . get ( fileName ) ; if ( key != null ) { if ( key instanceof BindingKeyResolver ) { reportBinding ( key , astRequestor , owner , unit ) ; worked ( <NUM_LIT:1> ) ; } else if ( key instanceof ArrayList ) { Iterator iterator = ( ( ArrayList ) key ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { reportBinding ( iterator . next ( ) , astRequestor , owner , unit ) ; worked ( <NUM_LIT:1> ) ; } } this . requestedKeys . put ( fileName , null ) ; } } finally { unit . cleanUp ( ) ; } this . unitsToProcess [ i ] = null ; this . requestor . acceptResult ( unit . compilationResult . tagAsAccepted ( ) ) ; } DefaultBindingResolver resolver = new DefaultBindingResolver ( this . lookupEnvironment , owner , this . bindingTables , ( flags & ICompilationUnit . ENABLE_BINDINGS_RECOVERY ) != <NUM_LIT:0> , true ) ; Object [ ] keys = this . requestedKeys . valueTable ; for ( int j = <NUM_LIT:0> , keysLength = keys . length ; j < keysLength ; j ++ ) { BindingKeyResolver keyResolver = ( BindingKeyResolver ) keys [ j ] ; if ( keyResolver == null ) continue ; Binding compilerBinding = keyResolver . getCompilerBinding ( ) ; IBinding binding = compilerBinding == null ? null : resolver . getBinding ( compilerBinding ) ; astRequestor . acceptBinding ( ( ( BindingKeyResolver ) this . requestedKeys . valueTable [ j ] ) . getKey ( ) , binding ) ; worked ( <NUM_LIT:1> ) ; } } catch ( OperationCanceledException e ) { throw e ; } catch ( AbortCompilation e ) { this . handleInternalException ( e , unit ) ; } catch ( Error e ) { this . handleInternalException ( e , unit , null ) ; throw e ; } catch ( RuntimeException e ) { this . handleInternalException ( e , unit , null ) ; throw e ; } finally { astRequestor . compilationUnitResolver = null ; } } private void resolve ( String [ ] sourceCompilationUnits , String [ ] encodings , String [ ] bindingKeys , FileASTRequestor astRequestor , int apiLevel , Map compilerOptions , int flags ) { astRequestor . compilationUnitResolver = this ; this . bindingTables = new DefaultBindingResolver . BindingTables ( ) ; CompilationUnitDeclaration unit = null ; try { int length = sourceCompilationUnits . length ; org . eclipse . jdt . internal . compiler . env . ICompilationUnit [ ] sourceUnits = new org . eclipse . jdt . internal . compiler . env . ICompilationUnit [ length ] ; int count = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { char [ ] contents = null ; String encoding = encodings != null ? encodings [ i ] : null ; String sourceUnitPath = sourceCompilationUnits [ i ] ; try { contents = Util . getFileCharContent ( new File ( sourceUnitPath ) , encoding ) ; } catch ( IOException e ) { continue ; } if ( contents == null ) { continue ; } sourceUnits [ count ++ ] = new org . eclipse . jdt . internal . compiler . batch . CompilationUnit ( contents , sourceUnitPath , encoding ) ; } beginToCompile ( sourceUnits , bindingKeys ) ; for ( int i = <NUM_LIT:0> ; i < this . totalUnits ; i ++ ) { if ( resolvedRequestedSourcesAndKeys ( i ) ) { for ( ; i < this . totalUnits ; i ++ ) { this . unitsToProcess [ i ] . cleanUp ( ) ; this . unitsToProcess [ i ] = null ; } break ; } unit = this . unitsToProcess [ i ] ; try { super . process ( unit , i ) ; char [ ] fileName = unit . compilationResult . getFileName ( ) ; org . eclipse . jdt . internal . compiler . env . ICompilationUnit source = ( org . eclipse . jdt . internal . compiler . env . ICompilationUnit ) this . requestedSources . get ( fileName ) ; if ( source != null ) { CompilationResult compilationResult = unit . compilationResult ; org . eclipse . jdt . internal . compiler . env . ICompilationUnit sourceUnit = compilationResult . compilationUnit ; char [ ] contents = sourceUnit . getContents ( ) ; AST ast = AST . newAST ( apiLevel ) ; ast . setFlag ( flags | AST . RESOLVED_BINDINGS ) ; ast . setDefaultNodeFlag ( ASTNode . ORIGINAL ) ; ASTConverter converter = new ASTConverter ( compilerOptions , true , this . monitor ) ; BindingResolver resolver = new DefaultBindingResolver ( unit . scope , null , this . bindingTables , ( flags & ICompilationUnit . ENABLE_BINDINGS_RECOVERY ) != <NUM_LIT:0> , this . fromJavaProject ) ; ast . setBindingResolver ( resolver ) ; converter . setAST ( ast ) ; CompilationUnit compilationUnit = converter . convert ( unit , contents ) ; compilationUnit . setTypeRoot ( null ) ; compilationUnit . setLineEndTable ( compilationResult . getLineSeparatorPositions ( ) ) ; ast . setDefaultNodeFlag ( <NUM_LIT:0> ) ; ast . setOriginalModificationCount ( ast . modificationCount ( ) ) ; astRequestor . acceptAST ( new String ( source . getFileName ( ) ) , compilationUnit ) ; worked ( <NUM_LIT:1> ) ; this . requestedSources . put ( fileName , null ) ; } Object key = this . requestedKeys . get ( fileName ) ; if ( key != null ) { if ( key instanceof BindingKeyResolver ) { reportBinding ( key , astRequestor , unit ) ; worked ( <NUM_LIT:1> ) ; } else if ( key instanceof ArrayList ) { Iterator iterator = ( ( ArrayList ) key ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { reportBinding ( iterator . next ( ) , astRequestor , unit ) ; worked ( <NUM_LIT:1> ) ; } } this . requestedKeys . put ( fileName , null ) ; } } finally { unit . cleanUp ( ) ; } this . unitsToProcess [ i ] = null ; this . requestor . acceptResult ( unit . compilationResult . tagAsAccepted ( ) ) ; } DefaultBindingResolver resolver = new DefaultBindingResolver ( this . lookupEnvironment , null , this . bindingTables , ( flags & ICompilationUnit . ENABLE_BINDINGS_RECOVERY ) != <NUM_LIT:0> , true ) ; Object [ ] keys = this . requestedKeys . valueTable ; for ( int j = <NUM_LIT:0> , keysLength = keys . length ; j < keysLength ; j ++ ) { BindingKeyResolver keyResolver = ( BindingKeyResolver ) keys [ j ] ; if ( keyResolver == null ) continue ; Binding compilerBinding = keyResolver . getCompilerBinding ( ) ; IBinding binding = compilerBinding == null ? null : resolver . getBinding ( compilerBinding ) ; astRequestor . acceptBinding ( ( ( BindingKeyResolver ) this . requestedKeys . valueTable [ j ] ) . getKey ( ) , binding ) ; worked ( <NUM_LIT:1> ) ; } } catch ( OperationCanceledException e ) { throw e ; } catch ( AbortCompilation e ) { this . handleInternalException ( e , unit ) ; } catch ( Error e ) { this . handleInternalException ( e , unit , null ) ; throw e ; } catch ( RuntimeException e ) { this . handleInternalException ( e , unit , null ) ; throw e ; } finally { astRequestor . compilationUnitResolver = null ; } } private void reportBinding ( Object key , ASTRequestor astRequestor , WorkingCopyOwner owner , CompilationUnitDeclaration unit ) { BindingKeyResolver keyResolver = ( BindingKeyResolver ) key ; Binding compilerBinding = keyResolver . getCompilerBinding ( ) ; if ( compilerBinding != null ) { DefaultBindingResolver resolver = new DefaultBindingResolver ( unit . scope , owner , this . bindingTables , false , this . fromJavaProject ) ; AnnotationBinding annotationBinding = keyResolver . getAnnotationBinding ( ) ; IBinding binding ; if ( annotationBinding != null ) { binding = resolver . getAnnotationInstance ( annotationBinding ) ; } else { binding = resolver . getBinding ( compilerBinding ) ; } if ( binding != null ) astRequestor . acceptBinding ( keyResolver . getKey ( ) , binding ) ; } } private void reportBinding ( Object key , FileASTRequestor astRequestor , CompilationUnitDeclaration unit ) { BindingKeyResolver keyResolver = ( BindingKeyResolver ) key ; Binding compilerBinding = keyResolver . getCompilerBinding ( ) ; if ( compilerBinding != null ) { DefaultBindingResolver resolver = new DefaultBindingResolver ( unit . scope , null , this . bindingTables , false , this . fromJavaProject ) ; AnnotationBinding annotationBinding = keyResolver . getAnnotationBinding ( ) ; IBinding binding ; if ( annotationBinding != null ) { binding = resolver . getAnnotationInstance ( annotationBinding ) ; } else { binding = resolver . getBinding ( compilerBinding ) ; } if ( binding != null ) astRequestor . acceptBinding ( keyResolver . getKey ( ) , binding ) ; } } private CompilationUnitDeclaration resolve ( CompilationUnitDeclaration unit , org . eclipse . jdt . internal . compiler . env . ICompilationUnit sourceUnit , NodeSearcher nodeSearcher , boolean verifyMethods , boolean analyzeCode , boolean generateCode ) { try { if ( unit == null ) { this . parseThreshold = <NUM_LIT:0> ; beginToCompile ( new org . eclipse . jdt . internal . compiler . env . ICompilationUnit [ ] { sourceUnit } ) ; for ( int i = <NUM_LIT:0> , max = this . totalUnits ; i < max ; i ++ ) { CompilationUnitDeclaration currentCompilationUnitDeclaration = this . unitsToProcess [ i ] ; if ( currentCompilationUnitDeclaration != null && currentCompilationUnitDeclaration . compilationResult . compilationUnit == sourceUnit ) { unit = currentCompilationUnitDeclaration ; break ; } } if ( unit == null ) { unit = this . unitsToProcess [ <NUM_LIT:0> ] ; } } else { this . lookupEnvironment . buildTypeBindings ( unit , null ) ; this . lookupEnvironment . completeTypeBindings ( ) ; } if ( nodeSearcher == null ) { this . parser . getMethodBodies ( unit ) ; } else { int searchPosition = nodeSearcher . position ; char [ ] source = sourceUnit . getContents ( ) ; int length = source . length ; if ( searchPosition >= <NUM_LIT:0> && searchPosition <= length ) { unit . traverse ( nodeSearcher , unit . scope ) ; org . eclipse . jdt . internal . compiler . ast . ASTNode node = nodeSearcher . found ; if ( node != null ) { int [ ] oldLineEnds = this . parser . scanner . lineEnds ; int oldLinePtr = this . parser . scanner . linePtr ; this . parser . scanner . setSource ( source , unit . compilationResult ) ; org . eclipse . jdt . internal . compiler . ast . TypeDeclaration enclosingTypeDeclaration = nodeSearcher . enclosingType ; if ( node instanceof AbstractMethodDeclaration ) { ( ( AbstractMethodDeclaration ) node ) . parseStatements ( this . parser , unit ) ; } else if ( enclosingTypeDeclaration != null ) { if ( node instanceof org . eclipse . jdt . internal . compiler . ast . Initializer ) { ( ( org . eclipse . jdt . internal . compiler . ast . Initializer ) node ) . parseStatements ( this . parser , enclosingTypeDeclaration , unit ) ; } else if ( node instanceof org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) { ( ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) node ) . parseMethods ( this . parser , unit ) ; } } this . parser . scanner . lineEnds = oldLineEnds ; this . parser . scanner . linePtr = oldLinePtr ; } } } if ( unit . scope != null ) { unit . scope . faultInTypes ( ) ; if ( unit . scope != null && verifyMethods ) { unit . scope . verifyMethods ( this . lookupEnvironment . methodVerifier ( ) ) ; } unit . resolve ( ) ; if ( analyzeCode ) unit . analyseCode ( ) ; if ( generateCode ) unit . generateCode ( ) ; unit . finalizeProblems ( ) ; } if ( this . unitsToProcess != null ) this . unitsToProcess [ <NUM_LIT:0> ] = null ; this . requestor . acceptResult ( unit . compilationResult . tagAsAccepted ( ) ) ; return unit ; } catch ( AbortCompilation e ) { this . handleInternalException ( e , unit ) ; return unit == null ? this . unitsToProcess [ <NUM_LIT:0> ] : unit ; } catch ( Error e ) { this . handleInternalException ( e , unit , null ) ; throw e ; } catch ( RuntimeException e ) { this . handleInternalException ( e , unit , null ) ; throw e ; } finally { } } public CompilationUnitDeclaration resolve ( org . eclipse . jdt . internal . compiler . env . ICompilationUnit sourceUnit , boolean verifyMethods , boolean analyzeCode , boolean generateCode ) { return resolve ( null , sourceUnit , null , verifyMethods , analyzeCode , generateCode ) ; } boolean resolvedRequestedSourcesAndKeys ( int unitIndexToProcess ) { if ( unitIndexToProcess < this . requestedSources . size ( ) && unitIndexToProcess < this . requestedKeys . size ( ) ) return false ; Object [ ] sources = this . requestedSources . valueTable ; for ( int i = <NUM_LIT:0> , l = sources . length ; i < l ; i ++ ) if ( sources [ i ] != null ) return false ; Object [ ] keys = this . requestedKeys . valueTable ; for ( int i = <NUM_LIT:0> , l = keys . length ; i < l ; i ++ ) if ( keys [ i ] != null ) return false ; return true ; } public CompilationUnitDeclaration resolve ( CompilationUnitDeclaration unit , org . eclipse . jdt . internal . compiler . env . ICompilationUnit sourceUnit , boolean verifyMethods , boolean analyzeCode , boolean generateCode ) { return resolve ( unit , sourceUnit , null , verifyMethods , analyzeCode , generateCode ) ; } private void worked ( int work ) { if ( this . monitor != null ) { if ( this . monitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; this . monitor . worked ( work ) ; } } } </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_INTERNAL ) { 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_INTERNAL ) { 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_INTERNAL ) { 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 ; 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 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 . ScannerHelper ; import org . eclipse . jdt . internal . compiler . parser . TerminalTokens ; public class CharacterLiteral extends Expression { public static final SimplePropertyDescriptor ESCAPED_VALUE_PROPERTY = new SimplePropertyDescriptor ( CharacterLiteral . class , "<STR_LIT>" , String . class , MANDATORY ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( CharacterLiteral . class , properyList ) ; addProperty ( ESCAPED_VALUE_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private String escapedValue = "<STR_LIT>" ; CharacterLiteral ( 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 CHARACTER_LITERAL ; } ASTNode clone0 ( AST target ) { CharacterLiteral result = new CharacterLiteral ( 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 value ) { if ( value == null ) { throw new IllegalArgumentException ( ) ; } Scanner scanner = this . ast . scanner ; char [ ] source = value . toCharArray ( ) ; scanner . setSource ( source ) ; scanner . resetTo ( <NUM_LIT:0> , source . length ) ; try { int tokenType = scanner . getNextToken ( ) ; switch ( tokenType ) { case TerminalTokens . TokenNameCharacterLiteral : break ; default : throw new IllegalArgumentException ( ) ; } } catch ( InvalidInputException e ) { throw new IllegalArgumentException ( ) ; } preValueChange ( ESCAPED_VALUE_PROPERTY ) ; this . escapedValue = value ; postValueChange ( ESCAPED_VALUE_PROPERTY ) ; } void internalSetEscapedValue ( String value ) { preValueChange ( ESCAPED_VALUE_PROPERTY ) ; this . escapedValue = value ; postValueChange ( ESCAPED_VALUE_PROPERTY ) ; } public char charValue ( ) { Scanner scanner = this . ast . scanner ; char [ ] source = this . escapedValue . toCharArray ( ) ; scanner . setSource ( source ) ; scanner . resetTo ( <NUM_LIT:0> , source . length ) ; int firstChar = scanner . getNextChar ( ) ; int secondChar = scanner . getNextChar ( ) ; if ( firstChar == - <NUM_LIT:1> || firstChar != '<STR_LIT>' ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } char value = ( char ) secondChar ; int nextChar = scanner . getNextChar ( ) ; if ( secondChar == '<STR_LIT:\\>' ) { if ( nextChar == - <NUM_LIT:1> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } switch ( nextChar ) { case '<CHAR_LIT:b>' : value = '<STR_LIT>' ; break ; case '<CHAR_LIT>' : value = '<STR_LIT:\t>' ; break ; case '<CHAR_LIT>' : value = '<STR_LIT:\n>' ; break ; case '<CHAR_LIT>' : value = '<STR_LIT>' ; break ; case '<CHAR_LIT>' : value = '<STR_LIT>' ; break ; case '<STR_LIT:\">' : value = '<STR_LIT:\">' ; break ; case '<STR_LIT>' : value = '<STR_LIT>' ; break ; case '<STR_LIT:\\>' : value = '<STR_LIT:\\>' ; break ; default : try { if ( ScannerHelper . isDigit ( ( char ) nextChar ) ) { int number = ScannerHelper . getNumericValue ( ( char ) nextChar ) ; nextChar = scanner . getNextChar ( ) ; if ( nextChar == - <NUM_LIT:1> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } if ( nextChar != '<STR_LIT>' ) { if ( ! ScannerHelper . isDigit ( ( char ) nextChar ) ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } number = ( number * <NUM_LIT:8> ) + ScannerHelper . getNumericValue ( ( char ) nextChar ) ; nextChar = scanner . getNextChar ( ) ; if ( nextChar == - <NUM_LIT:1> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } if ( nextChar != '<STR_LIT>' ) { if ( ! ScannerHelper . isDigit ( ( char ) nextChar ) ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } number = ( number * <NUM_LIT:8> ) + ScannerHelper . getNumericValue ( ( char ) nextChar ) ; } } return ( char ) number ; } else { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } } catch ( InvalidInputException e ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } } nextChar = scanner . getNextChar ( ) ; if ( nextChar == - <NUM_LIT:1> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } } if ( nextChar == - <NUM_LIT:1> || nextChar != '<STR_LIT>' ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } return value ; } public void setCharValue ( char value ) { StringBuffer b = new StringBuffer ( <NUM_LIT:3> ) ; b . append ( '<STR_LIT>' ) ; switch ( value ) { 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 ; case '<STR_LIT>' : b . append ( "<STR_LIT>" ) ; break ; default : b . append ( value ) ; } 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 ; 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 . List ; public class SwitchCase extends Statement { public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( SwitchCase . class , "<STR_LIT>" , Expression . class , OPTIONAL , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( SwitchCase . class , propertyList ) ; addProperty ( EXPRESSION_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Expression optionalExpression = null ; private boolean expressionInitialized = false ; SwitchCase ( 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 SWITCH_CASE ; } ASTNode clone0 ( AST target ) { SwitchCase result = new SwitchCase ( 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 ( ) { if ( ! this . expressionInitialized ) { synchronized ( this ) { if ( ! this . expressionInitialized ) { preLazyInit ( ) ; this . optionalExpression = new SimpleName ( this . ast ) ; this . expressionInitialized = true ; postLazyInit ( this . optionalExpression , EXPRESSION_PROPERTY ) ; } } } return this . optionalExpression ; } public void setExpression ( Expression expression ) { ASTNode oldChild = this . optionalExpression ; preReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; this . optionalExpression = expression ; this . expressionInitialized = true ; postReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; } public boolean isDefault ( ) { return getExpression ( ) == null ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalExpression == null ? <NUM_LIT:0> : this . optionalExpression . treeSize ( ) ) ; } } </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 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 ; import java . util . HashSet ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . CaptureBinding ; import org . eclipse . jdt . internal . compiler . lookup . ExtraCompilerModifiers ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . ImportBinding ; import org . eclipse . jdt . internal . compiler . lookup . ParameterizedTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeVariableBinding ; import org . eclipse . jdt . internal . compiler . lookup . VariableBinding ; import org . eclipse . jdt . internal . compiler . lookup . WildcardBinding ; class BindingComparator { static boolean isEqual ( TypeVariableBinding [ ] bindings , TypeVariableBinding [ ] otherBindings ) { if ( bindings == null ) { return otherBindings == null ; } if ( otherBindings == null ) { return false ; } int length = bindings . length ; int otherLength = otherBindings . length ; if ( length != otherLength ) { return false ; } for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { TypeVariableBinding typeVariableBinding = bindings [ i ] ; TypeVariableBinding typeVariableBinding2 = otherBindings [ i ] ; if ( ! isEqual ( typeVariableBinding , typeVariableBinding2 ) ) { return false ; } } return true ; } static boolean isEqual ( Binding declaringElement , Binding declaringElement2 , HashSet visitedTypes ) { if ( declaringElement instanceof org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) { if ( ! ( declaringElement2 instanceof org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) ) { return false ; } return isEqual ( ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) declaringElement , ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) declaringElement2 , visitedTypes ) ; } else if ( declaringElement instanceof org . eclipse . jdt . internal . compiler . lookup . MethodBinding ) { if ( ! ( declaringElement2 instanceof org . eclipse . jdt . internal . compiler . lookup . MethodBinding ) ) { return false ; } return isEqual ( ( org . eclipse . jdt . internal . compiler . lookup . MethodBinding ) declaringElement , ( org . eclipse . jdt . internal . compiler . lookup . MethodBinding ) declaringElement2 , visitedTypes ) ; } else if ( declaringElement instanceof VariableBinding ) { if ( ! ( declaringElement2 instanceof VariableBinding ) ) { return false ; } return isEqual ( ( VariableBinding ) declaringElement , ( VariableBinding ) declaringElement2 ) ; } else if ( declaringElement instanceof org . eclipse . jdt . internal . compiler . lookup . PackageBinding ) { if ( ! ( declaringElement2 instanceof org . eclipse . jdt . internal . compiler . lookup . PackageBinding ) ) { return false ; } org . eclipse . jdt . internal . compiler . lookup . PackageBinding packageBinding = ( org . eclipse . jdt . internal . compiler . lookup . PackageBinding ) declaringElement ; org . eclipse . jdt . internal . compiler . lookup . PackageBinding packageBinding2 = ( org . eclipse . jdt . internal . compiler . lookup . PackageBinding ) declaringElement2 ; return CharOperation . equals ( packageBinding . compoundName , packageBinding2 . compoundName ) ; } else if ( declaringElement instanceof ImportBinding ) { if ( ! ( declaringElement2 instanceof ImportBinding ) ) { return false ; } ImportBinding importBinding = ( ImportBinding ) declaringElement ; ImportBinding importBinding2 = ( ImportBinding ) declaringElement2 ; return importBinding . isStatic ( ) == importBinding2 . isStatic ( ) && importBinding . onDemand == importBinding2 . onDemand && CharOperation . equals ( importBinding . compoundName , importBinding2 . compoundName ) ; } return false ; } static boolean isEqual ( org . eclipse . jdt . internal . compiler . lookup . MethodBinding methodBinding , org . eclipse . jdt . internal . compiler . lookup . MethodBinding methodBinding2 ) { return isEqual ( methodBinding , methodBinding2 , new HashSet ( ) ) ; } static boolean isEqual ( org . eclipse . jdt . internal . compiler . lookup . MethodBinding methodBinding , org . eclipse . jdt . internal . compiler . lookup . MethodBinding methodBinding2 , HashSet visitedTypes ) { if ( methodBinding == null ) { return methodBinding2 == null ; } if ( methodBinding2 == null ) return false ; return CharOperation . equals ( methodBinding . selector , methodBinding2 . selector ) && isEqual ( methodBinding . returnType , methodBinding2 . returnType , visitedTypes ) && isEqual ( methodBinding . thrownExceptions , methodBinding2 . thrownExceptions , visitedTypes ) && isEqual ( methodBinding . declaringClass , methodBinding2 . declaringClass , visitedTypes ) && isEqual ( methodBinding . typeVariables , methodBinding2 . typeVariables , visitedTypes ) && isEqual ( methodBinding . parameters , methodBinding2 . parameters , visitedTypes ) ; } static boolean isEqual ( VariableBinding variableBinding , VariableBinding variableBinding2 ) { return ( variableBinding . modifiers & ExtraCompilerModifiers . AccJustFlag ) == ( variableBinding2 . modifiers & ExtraCompilerModifiers . AccJustFlag ) && CharOperation . equals ( variableBinding . name , variableBinding2 . name ) && isEqual ( variableBinding . type , variableBinding2 . type ) && ( variableBinding . id == variableBinding2 . id ) ; } static boolean isEqual ( FieldBinding fieldBinding , FieldBinding fieldBinding2 ) { HashSet visitedTypes = new HashSet ( ) ; return ( fieldBinding . modifiers & ExtraCompilerModifiers . AccJustFlag ) == ( fieldBinding2 . modifiers & ExtraCompilerModifiers . AccJustFlag ) && CharOperation . equals ( fieldBinding . name , fieldBinding2 . name ) && isEqual ( fieldBinding . type , fieldBinding2 . type , visitedTypes ) && isEqual ( fieldBinding . declaringClass , fieldBinding2 . declaringClass , visitedTypes ) ; } static boolean isEqual ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding [ ] bindings , org . eclipse . jdt . internal . compiler . lookup . TypeBinding [ ] otherBindings ) { return isEqual ( bindings , otherBindings , new HashSet ( ) ) ; } static boolean isEqual ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding [ ] bindings , org . eclipse . jdt . internal . compiler . lookup . TypeBinding [ ] otherBindings , HashSet visitedTypes ) { if ( bindings == null ) { return otherBindings == null ; } if ( otherBindings == null ) { return false ; } int length = bindings . length ; int otherLength = otherBindings . length ; if ( length != otherLength ) { return false ; } for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( ! isEqual ( bindings [ i ] , otherBindings [ i ] , visitedTypes ) ) { return false ; } } return true ; } static boolean isEqual ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding typeBinding , org . eclipse . jdt . internal . compiler . lookup . TypeBinding typeBinding2 , HashSet visitedTypes ) { if ( typeBinding == typeBinding2 ) return true ; if ( typeBinding == null || typeBinding2 == null ) return false ; switch ( typeBinding . kind ( ) ) { case Binding . BASE_TYPE : if ( ! typeBinding2 . isBaseType ( ) ) { return false ; } return typeBinding . id == typeBinding2 . id ; case Binding . ARRAY_TYPE : if ( ! typeBinding2 . isArrayType ( ) ) { return false ; } return typeBinding . dimensions ( ) == typeBinding2 . dimensions ( ) && isEqual ( typeBinding . leafComponentType ( ) , typeBinding2 . leafComponentType ( ) , visitedTypes ) ; case Binding . PARAMETERIZED_TYPE : if ( ! typeBinding2 . isParameterizedType ( ) ) { return false ; } ParameterizedTypeBinding parameterizedTypeBinding = ( ParameterizedTypeBinding ) typeBinding ; ParameterizedTypeBinding parameterizedTypeBinding2 = ( ParameterizedTypeBinding ) typeBinding2 ; return CharOperation . equals ( parameterizedTypeBinding . compoundName , parameterizedTypeBinding2 . compoundName ) && ( parameterizedTypeBinding . modifiers & ( ExtraCompilerModifiers . AccJustFlag | ClassFileConstants . AccInterface | ClassFileConstants . AccEnum | ClassFileConstants . AccAnnotation ) ) == ( parameterizedTypeBinding2 . modifiers & ( ExtraCompilerModifiers . AccJustFlag | ClassFileConstants . AccInterface | ClassFileConstants . AccEnum | ClassFileConstants . AccAnnotation ) ) && isEqual ( parameterizedTypeBinding . arguments , parameterizedTypeBinding2 . arguments , visitedTypes ) && isEqual ( parameterizedTypeBinding . enclosingType ( ) , parameterizedTypeBinding2 . enclosingType ( ) , visitedTypes ) ; case Binding . WILDCARD_TYPE : if ( typeBinding2 . kind ( ) != Binding . WILDCARD_TYPE ) { return false ; } WildcardBinding wildcardBinding = ( WildcardBinding ) typeBinding ; WildcardBinding wildcardBinding2 = ( WildcardBinding ) typeBinding2 ; return isEqual ( wildcardBinding . bound , wildcardBinding2 . bound , visitedTypes ) && wildcardBinding . boundKind == wildcardBinding2 . boundKind ; case Binding . INTERSECTION_TYPE : if ( typeBinding2 . kind ( ) != Binding . INTERSECTION_TYPE ) { return false ; } WildcardBinding intersectionBinding = ( WildcardBinding ) typeBinding ; WildcardBinding intersectionBinding2 = ( WildcardBinding ) typeBinding2 ; return isEqual ( intersectionBinding . bound , intersectionBinding2 . bound , visitedTypes ) && isEqual ( intersectionBinding . otherBounds , intersectionBinding2 . otherBounds , visitedTypes ) ; case Binding . TYPE_PARAMETER : if ( ! ( typeBinding2 . isTypeVariable ( ) ) ) { return false ; } if ( typeBinding . isCapture ( ) ) { if ( ! ( typeBinding2 . isCapture ( ) ) ) { return false ; } CaptureBinding captureBinding = ( CaptureBinding ) typeBinding ; CaptureBinding captureBinding2 = ( CaptureBinding ) typeBinding2 ; if ( captureBinding . position == captureBinding2 . position ) { if ( visitedTypes . contains ( typeBinding ) ) return true ; visitedTypes . add ( typeBinding ) ; return isEqual ( captureBinding . wildcard , captureBinding2 . wildcard , visitedTypes ) && isEqual ( captureBinding . sourceType , captureBinding2 . sourceType , visitedTypes ) ; } return false ; } TypeVariableBinding typeVariableBinding = ( TypeVariableBinding ) typeBinding ; TypeVariableBinding typeVariableBinding2 = ( TypeVariableBinding ) typeBinding2 ; if ( CharOperation . equals ( typeVariableBinding . sourceName , typeVariableBinding2 . sourceName ) ) { if ( visitedTypes . contains ( typeBinding ) ) return true ; visitedTypes . add ( typeBinding ) ; return isEqual ( typeVariableBinding . declaringElement , typeVariableBinding2 . declaringElement , visitedTypes ) && isEqual ( typeVariableBinding . superclass ( ) , typeVariableBinding2 . superclass ( ) , visitedTypes ) && isEqual ( typeVariableBinding . superInterfaces ( ) , typeVariableBinding2 . superInterfaces ( ) , visitedTypes ) ; } return false ; case Binding . GENERIC_TYPE : if ( ! typeBinding2 . isGenericType ( ) ) { return false ; } ReferenceBinding referenceBinding = ( ReferenceBinding ) typeBinding ; ReferenceBinding referenceBinding2 = ( ReferenceBinding ) typeBinding2 ; return CharOperation . equals ( referenceBinding . compoundName , referenceBinding2 . compoundName ) && ( referenceBinding . modifiers & ( ExtraCompilerModifiers . AccJustFlag | ClassFileConstants . AccInterface | ClassFileConstants . AccEnum | ClassFileConstants . AccAnnotation ) ) == ( referenceBinding2 . modifiers & ( ExtraCompilerModifiers . AccJustFlag | ClassFileConstants . AccInterface | ClassFileConstants . AccEnum | ClassFileConstants . AccAnnotation ) ) && isEqual ( referenceBinding . typeVariables ( ) , referenceBinding2 . typeVariables ( ) , visitedTypes ) && isEqual ( referenceBinding . enclosingType ( ) , referenceBinding2 . enclosingType ( ) , visitedTypes ) ; case Binding . RAW_TYPE : default : if ( ! ( typeBinding2 instanceof ReferenceBinding ) ) { return false ; } referenceBinding = ( ReferenceBinding ) typeBinding ; referenceBinding2 = ( ReferenceBinding ) typeBinding2 ; char [ ] constantPoolName = referenceBinding . constantPoolName ( ) ; char [ ] constantPoolName2 = referenceBinding2 . constantPoolName ( ) ; if ( constantPoolName == null ) { if ( constantPoolName2 != null ) { return false ; } if ( ! CharOperation . equals ( referenceBinding . computeUniqueKey ( ) , referenceBinding2 . computeUniqueKey ( ) ) ) { return false ; } } else { if ( constantPoolName2 == null ) { return false ; } if ( ! CharOperation . equals ( constantPoolName , constantPoolName2 ) ) { return false ; } } return CharOperation . equals ( referenceBinding . compoundName , referenceBinding2 . compoundName ) && ( ! referenceBinding2 . isGenericType ( ) ) && ( referenceBinding . isRawType ( ) == referenceBinding2 . isRawType ( ) ) && ( ( referenceBinding . modifiers & ~ ClassFileConstants . AccSuper ) & ( ExtraCompilerModifiers . AccJustFlag | ClassFileConstants . AccInterface | ClassFileConstants . AccEnum | ClassFileConstants . AccAnnotation ) ) == ( ( referenceBinding2 . modifiers & ~ ClassFileConstants . AccSuper ) & ( ExtraCompilerModifiers . AccJustFlag | ClassFileConstants . AccInterface | ClassFileConstants . AccEnum | ClassFileConstants . AccAnnotation ) ) && isEqual ( referenceBinding . enclosingType ( ) , referenceBinding2 . enclosingType ( ) , visitedTypes ) ; } } static boolean isEqual ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding typeBinding , org . eclipse . jdt . internal . compiler . lookup . TypeBinding typeBinding2 ) { return isEqual ( typeBinding , typeBinding2 , new HashSet ( ) ) ; } } </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 ; } boolean isResolvedTypeInferredFromExpectedType ( ClassInstanceCreation classInstanceCreation ) { 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 ; import java . util . ArrayList ; import java . util . List ; public class EnhancedForStatement extends Statement { public static final ChildPropertyDescriptor PARAMETER_PROPERTY = new ChildPropertyDescriptor ( EnhancedForStatement . class , "<STR_LIT>" , SingleVariableDeclaration . class , MANDATORY , CYCLE_RISK ) ; public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( EnhancedForStatement . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; public static final ChildPropertyDescriptor BODY_PROPERTY = new ChildPropertyDescriptor ( EnhancedForStatement . class , "<STR_LIT:body>" , Statement . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( EnhancedForStatement . class , properyList ) ; addProperty ( PARAMETER_PROPERTY , properyList ) ; addProperty ( EXPRESSION_PROPERTY , properyList ) ; addProperty ( BODY_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private SingleVariableDeclaration parameter = null ; private Expression expression = null ; private Statement body = null ; EnhancedForStatement ( AST ast ) { super ( ast ) ; unsupportedIn2 ( ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == PARAMETER_PROPERTY ) { if ( get ) { return getParameter ( ) ; } else { setParameter ( ( SingleVariableDeclaration ) child ) ; return null ; } } 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 ENHANCED_FOR_STATEMENT ; } ASTNode clone0 ( AST target ) { EnhancedForStatement result = new EnhancedForStatement ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; result . setParameter ( ( SingleVariableDeclaration ) getParameter ( ) . clone ( target ) ) ; result . setExpression ( ( Expression ) getExpression ( ) . clone ( target ) ) ; 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 ) { acceptChild ( visitor , getParameter ( ) ) ; acceptChild ( visitor , getExpression ( ) ) ; acceptChild ( visitor , getBody ( ) ) ; } visitor . endVisit ( this ) ; } public SingleVariableDeclaration getParameter ( ) { if ( this . parameter == null ) { synchronized ( this ) { if ( this . parameter == null ) { preLazyInit ( ) ; this . parameter = this . ast . newSingleVariableDeclaration ( ) ; postLazyInit ( this . parameter , PARAMETER_PROPERTY ) ; } } } return this . parameter ; } public void setParameter ( SingleVariableDeclaration parameter ) { if ( parameter == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . parameter ; preReplaceChild ( oldChild , parameter , PARAMETER_PROPERTY ) ; this . parameter = parameter ; postReplaceChild ( oldChild , parameter , PARAMETER_PROPERTY ) ; } 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:3> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . parameter == null ? <NUM_LIT:0> : getParameter ( ) . treeSize ( ) ) + ( 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 org . eclipse . jdt . core . IJavaElement ; class RecoveredVariableBinding implements IVariableBinding { private VariableDeclaration variableDeclaration ; private BindingResolver resolver ; RecoveredVariableBinding ( BindingResolver resolver , VariableDeclaration variableDeclaration ) { this . resolver = resolver ; this . variableDeclaration = variableDeclaration ; } public Object getConstantValue ( ) { return null ; } public ITypeBinding getDeclaringClass ( ) { ASTNode parent = this . variableDeclaration . getParent ( ) ; while ( parent != null && parent . getNodeType ( ) != ASTNode . TYPE_DECLARATION ) { parent = parent . getParent ( ) ; } if ( parent != null ) { return ( ( TypeDeclaration ) parent ) . resolveBinding ( ) ; } return null ; } public IMethodBinding getDeclaringMethod ( ) { ASTNode parent = this . variableDeclaration . getParent ( ) ; while ( parent != null && parent . getNodeType ( ) != ASTNode . METHOD_DECLARATION ) { parent = parent . getParent ( ) ; } if ( parent != null ) { return ( ( MethodDeclaration ) parent ) . resolveBinding ( ) ; } return null ; } public String getName ( ) { return this . variableDeclaration . getName ( ) . getIdentifier ( ) ; } public ITypeBinding getType ( ) { return this . resolver . getTypeBinding ( this . variableDeclaration ) ; } public IVariableBinding getVariableDeclaration ( ) { return this ; } public int getVariableId ( ) { return <NUM_LIT:0> ; } public boolean isEnumConstant ( ) { return false ; } public boolean isField ( ) { return this . variableDeclaration . getParent ( ) instanceof FieldDeclaration ; } public boolean isParameter ( ) { return this . variableDeclaration instanceof SingleVariableDeclaration ; } public IAnnotationBinding [ ] getAnnotations ( ) { return AnnotationBinding . NoAnnotations ; } public IJavaElement getJavaElement ( ) { return null ; } public String getKey ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) ; if ( this . variableDeclaration != null ) { buffer . append ( "<STR_LIT>" ) . append ( this . variableDeclaration . getClass ( ) ) . append ( this . variableDeclaration . getName ( ) . getIdentifier ( ) ) . append ( this . variableDeclaration . getExtraDimensions ( ) ) ; } return String . valueOf ( buffer ) ; } public int getKind ( ) { return IBinding . VARIABLE ; } public int getModifiers ( ) { return <NUM_LIT:0> ; } public boolean isDeprecated ( ) { return false ; } public boolean isEqualTo ( IBinding binding ) { if ( binding . isRecovered ( ) && binding . getKind ( ) == IBinding . VARIABLE ) { return getKey ( ) . equals ( binding . getKey ( ) ) ; } return false ; } public boolean isRecovered ( ) { return true ; } public boolean isSynthetic ( ) { return false ; } } </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 . util . IModifierConstants ; import org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . Initializer ; import org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . impl . ReferenceContext ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . LocalVariableBinding ; import org . eclipse . jdt . internal . compiler . lookup . TagBits ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; import org . eclipse . jdt . internal . core . JavaElement ; import org . eclipse . jdt . internal . core . LocalVariable ; import org . eclipse . jdt . internal . core . util . Util ; class VariableBinding implements IVariableBinding { private static final int VALID_MODIFIERS = Modifier . PUBLIC | Modifier . PROTECTED | Modifier . PRIVATE | Modifier . STATIC | Modifier . FINAL | Modifier . TRANSIENT | Modifier . VOLATILE ; private org . eclipse . jdt . internal . compiler . lookup . VariableBinding binding ; private ITypeBinding declaringClass ; private String key ; private String name ; private BindingResolver resolver ; private ITypeBinding type ; private IAnnotationBinding [ ] annotations ; VariableBinding ( BindingResolver resolver , org . eclipse . jdt . internal . compiler . lookup . VariableBinding binding ) { this . resolver = resolver ; this . binding = binding ; } 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 Object getConstantValue ( ) { Constant c = this . binding . constant ( ) ; if ( c == null || c == Constant . NotAConstant ) return null ; switch ( c . typeID ( ) ) { case TypeIds . T_boolean : return Boolean . valueOf ( c . booleanValue ( ) ) ; case TypeIds . T_byte : return new Byte ( c . byteValue ( ) ) ; case TypeIds . T_char : return new Character ( c . charValue ( ) ) ; case TypeIds . T_double : return new Double ( c . doubleValue ( ) ) ; case TypeIds . T_float : return new Float ( c . floatValue ( ) ) ; case TypeIds . T_int : return new Integer ( c . intValue ( ) ) ; case TypeIds . T_long : return new Long ( c . longValue ( ) ) ; case TypeIds . T_short : return new Short ( c . shortValue ( ) ) ; case TypeIds . T_JavaLangString : return c . stringValue ( ) ; } return null ; } public ITypeBinding getDeclaringClass ( ) { if ( isField ( ) ) { if ( this . declaringClass == null ) { FieldBinding fieldBinding = ( FieldBinding ) this . binding ; this . declaringClass = this . resolver . getTypeBinding ( fieldBinding . declaringClass ) ; } return this . declaringClass ; } else { return null ; } } public IMethodBinding getDeclaringMethod ( ) { if ( ! isField ( ) ) { ASTNode node = this . resolver . findDeclaringNode ( this ) ; while ( true ) { if ( node == null ) { if ( this . binding instanceof LocalVariableBinding ) { LocalVariableBinding localVariableBinding = ( LocalVariableBinding ) this . binding ; BlockScope blockScope = localVariableBinding . declaringScope ; if ( blockScope != null ) { ReferenceContext referenceContext = blockScope . referenceContext ( ) ; if ( referenceContext instanceof Initializer ) { return null ; } if ( referenceContext instanceof AbstractMethodDeclaration ) { return this . resolver . getMethodBinding ( ( ( AbstractMethodDeclaration ) referenceContext ) . binding ) ; } } } return null ; } switch ( node . getNodeType ( ) ) { case ASTNode . INITIALIZER : return null ; case ASTNode . METHOD_DECLARATION : MethodDeclaration methodDeclaration = ( MethodDeclaration ) node ; return methodDeclaration . resolveBinding ( ) ; default : node = node . getParent ( ) ; } } } return null ; } public IJavaElement getJavaElement ( ) { JavaElement element = getUnresolvedJavaElement ( ) ; if ( element == null ) return null ; return element . resolved ( this . binding ) ; } public String getKey ( ) { if ( this . key == null ) { this . key = new String ( this . binding . computeUniqueKey ( ) ) ; } return this . key ; } public int getKind ( ) { return IBinding . VARIABLE ; } public int getModifiers ( ) { if ( isField ( ) ) { return ( ( FieldBinding ) this . binding ) . getAccessFlags ( ) & VALID_MODIFIERS ; } if ( this . binding . isFinal ( ) ) { return IModifierConstants . ACC_FINAL ; } return Modifier . NONE ; } public String getName ( ) { if ( this . name == null ) { this . name = new String ( this . binding . name ) ; } return this . name ; } public ITypeBinding getType ( ) { if ( this . type == null ) { this . type = this . resolver . getTypeBinding ( this . binding . type ) ; } return this . type ; } private JavaElement getUnresolvedJavaElement ( ) { if ( JavaCore . getPlugin ( ) == null ) { return null ; } if ( isField ( ) ) { if ( this . resolver instanceof DefaultBindingResolver ) { DefaultBindingResolver defaultBindingResolver = ( DefaultBindingResolver ) this . resolver ; if ( ! defaultBindingResolver . fromJavaProject ) return null ; return Util . getUnresolvedJavaElement ( ( FieldBinding ) this . binding , defaultBindingResolver . workingCopyOwner , defaultBindingResolver . getBindingsToNodesMap ( ) ) ; } return null ; } if ( ! ( this . resolver instanceof DefaultBindingResolver ) ) return null ; DefaultBindingResolver defaultBindingResolver = ( DefaultBindingResolver ) this . resolver ; if ( ! defaultBindingResolver . fromJavaProject ) return null ; VariableDeclaration localVar = ( VariableDeclaration ) defaultBindingResolver . bindingsToAstNodes . get ( this ) ; if ( localVar == null ) return null ; SimpleName localName = localVar . getName ( ) ; int nameStart = localName . getStartPosition ( ) ; int nameLength = localName . getLength ( ) ; int sourceStart ; int sourceLength ; int modifiers = <NUM_LIT:0> ; if ( localVar instanceof SingleVariableDeclaration ) { sourceStart = localVar . getStartPosition ( ) ; sourceLength = localVar . getLength ( ) ; final SingleVariableDeclaration singleVariableDeclaration = ( SingleVariableDeclaration ) localVar ; modifiers = singleVariableDeclaration . getModifiers ( ) ; } else { ASTNode node = localVar . getParent ( ) ; sourceStart = node . getStartPosition ( ) ; sourceLength = node . getLength ( ) ; VariableDeclarationFragment fragment = ( VariableDeclarationFragment ) localVar ; final ASTNode parent = fragment . getParent ( ) ; switch ( parent . getNodeType ( ) ) { case ASTNode . VARIABLE_DECLARATION_EXPRESSION : VariableDeclarationExpression expression = ( VariableDeclarationExpression ) parent ; modifiers = expression . getModifiers ( ) ; break ; case ASTNode . VARIABLE_DECLARATION_STATEMENT : VariableDeclarationStatement statement = ( VariableDeclarationStatement ) parent ; modifiers = statement . getModifiers ( ) ; break ; case ASTNode . FIELD_DECLARATION : FieldDeclaration fieldDeclaration = ( FieldDeclaration ) parent ; modifiers = fieldDeclaration . getModifiers ( ) ; break ; } } int sourceEnd = sourceStart + sourceLength - <NUM_LIT:1> ; char [ ] typeSig = this . binding . type . genericTypeSignature ( ) ; JavaElement parent = null ; IMethodBinding declaringMethod = getDeclaringMethod ( ) ; final LocalVariableBinding localVariableBinding = ( LocalVariableBinding ) this . binding ; if ( declaringMethod == null ) { ReferenceContext referenceContext = localVariableBinding . declaringScope . referenceContext ( ) ; if ( referenceContext instanceof TypeDeclaration ) { TypeDeclaration typeDeclaration = ( TypeDeclaration ) referenceContext ; JavaElement typeHandle = null ; typeHandle = Util . getUnresolvedJavaElement ( typeDeclaration . binding , defaultBindingResolver . workingCopyOwner , defaultBindingResolver . getBindingsToNodesMap ( ) ) ; parent = Util . getUnresolvedJavaElement ( sourceStart , sourceEnd , typeHandle ) ; } else { return null ; } } else { parent = ( JavaElement ) declaringMethod . getJavaElement ( ) ; } if ( parent == null ) return null ; return new LocalVariable ( parent , localName . getIdentifier ( ) , sourceStart , sourceEnd , nameStart , nameStart + nameLength - <NUM_LIT:1> , new String ( typeSig ) , localVariableBinding . declaration . annotations , modifiers , ( localVariableBinding . tagBits & TagBits . IsArgument ) != <NUM_LIT:0> ) ; } public IVariableBinding getVariableDeclaration ( ) { if ( isField ( ) ) { FieldBinding fieldBinding = ( FieldBinding ) this . binding ; return this . resolver . getVariableBinding ( fieldBinding . original ( ) ) ; } return this ; } public int getVariableId ( ) { return this . binding . id ; } public boolean isParameter ( ) { return ( this . binding . tagBits & TagBits . IsArgument ) != <NUM_LIT:0> ; } public boolean isDeprecated ( ) { if ( isField ( ) ) { return ( ( FieldBinding ) this . binding ) . isDeprecated ( ) ; } return false ; } public boolean isEnumConstant ( ) { return ( this . binding . modifiers & ClassFileConstants . AccEnum ) != <NUM_LIT:0> ; } public boolean isEqualTo ( IBinding other ) { if ( other == this ) { return true ; } if ( other == null ) { return false ; } if ( ! ( other instanceof VariableBinding ) ) { return false ; } org . eclipse . jdt . internal . compiler . lookup . VariableBinding otherBinding = ( ( VariableBinding ) other ) . binding ; if ( this . binding instanceof FieldBinding ) { if ( otherBinding instanceof FieldBinding ) { return BindingComparator . isEqual ( ( FieldBinding ) this . binding , ( FieldBinding ) otherBinding ) ; } else { return false ; } } else { if ( BindingComparator . isEqual ( this . binding , otherBinding ) ) { IMethodBinding declaringMethod = getDeclaringMethod ( ) ; IMethodBinding otherDeclaringMethod = ( ( VariableBinding ) other ) . getDeclaringMethod ( ) ; if ( declaringMethod == null ) { if ( otherDeclaringMethod != null ) { return false ; } return true ; } return declaringMethod . isEqualTo ( otherDeclaringMethod ) ; } return false ; } } public boolean isField ( ) { return this . binding instanceof FieldBinding ; } public boolean isSynthetic ( ) { if ( isField ( ) ) { return ( ( FieldBinding ) this . binding ) . isSynthetic ( ) ; } return false ; } public boolean isRecovered ( ) { return false ; } 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 SwitchStatement extends Statement { public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( SwitchStatement . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; public static final ChildListPropertyDescriptor STATEMENTS_PROPERTY = new ChildListPropertyDescriptor ( SwitchStatement . class , "<STR_LIT>" , Statement . class , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( SwitchStatement . class , propertyList ) ; addProperty ( EXPRESSION_PROPERTY , propertyList ) ; addProperty ( STATEMENTS_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Expression expression = null ; private ASTNode . NodeList statements = new ASTNode . NodeList ( STATEMENTS_PROPERTY ) ; SwitchStatement ( 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 List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == STATEMENTS_PROPERTY ) { return statements ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return SWITCH_STATEMENT ; } ASTNode clone0 ( AST target ) { SwitchStatement result = new SwitchStatement ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; result . setExpression ( ( Expression ) getExpression ( ) . clone ( target ) ) ; 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 ) { acceptChild ( visitor , getExpression ( ) ) ; acceptChildren ( visitor , this . statements ) ; } 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 List statements ( ) { return this . statements ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . expression == null ? <NUM_LIT:0> : getExpression ( ) . treeSize ( ) ) + this . statements . listSize ( ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import org . eclipse . jdt . core . compiler . InvalidInputException ; import org . eclipse . jdt . internal . compiler . parser . Scanner ; import org . eclipse . jdt . internal . compiler . parser . TerminalTokens ; public abstract class Statement extends ASTNode { private String optionalLeadingComment = null ; Statement ( AST ast ) { super ( ast ) ; } public String getLeadingComment ( ) { return this . optionalLeadingComment ; } public void setLeadingComment ( String comment ) { if ( comment != null ) { char [ ] source = comment . toCharArray ( ) ; Scanner scanner = this . ast . scanner ; scanner . resetTo ( <NUM_LIT:0> , source . length ) ; scanner . setSource ( source ) ; try { int token ; boolean onlyOneComment = false ; while ( ( token = scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameCOMMENT_BLOCK : case TerminalTokens . TokenNameCOMMENT_JAVADOC : case TerminalTokens . TokenNameCOMMENT_LINE : if ( onlyOneComment ) { throw new IllegalArgumentException ( ) ; } onlyOneComment = true ; break ; default : onlyOneComment = false ; } } if ( ! onlyOneComment ) { throw new IllegalArgumentException ( ) ; } } catch ( InvalidInputException e ) { throw new IllegalArgumentException ( ) ; } } checkModifiable ( ) ; this . optionalLeadingComment = comment ; } void copyLeadingComment ( Statement source ) { setLeadingComment ( source . getLeadingComment ( ) ) ; } int memSize ( ) { int size = BASE_NODE_SIZE + <NUM_LIT:1> * <NUM_LIT:4> + stringSize ( getLeadingComment ( ) ) ; return size ; } } </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 ; public interface IPackageBinding extends IBinding { public String getName ( ) ; public boolean isUnnamed ( ) ; public String [ ] getNameComponents ( ) ; } </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 . ArrayList ; import java . util . List ; public class ExpressionStatement extends Statement { public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( ExpressionStatement . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( ExpressionStatement . class , properyList ) ; addProperty ( EXPRESSION_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Expression expression = null ; ExpressionStatement ( 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 EXPRESSION_STATEMENT ; } ASTNode clone0 ( AST target ) { ExpressionStatement result = new ExpressionStatement ( 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 MethodInvocation ( 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 BooleanLiteral extends Expression { public static final SimplePropertyDescriptor BOOLEAN_VALUE_PROPERTY = new SimplePropertyDescriptor ( BooleanLiteral . class , "<STR_LIT>" , boolean . class , MANDATORY ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( BooleanLiteral . class , properyList ) ; addProperty ( BOOLEAN_VALUE_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private boolean value = false ; BooleanLiteral ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final boolean internalGetSetBooleanProperty ( SimplePropertyDescriptor property , boolean get , boolean newValue ) { if ( property == BOOLEAN_VALUE_PROPERTY ) { if ( get ) { return booleanValue ( ) ; } else { setBooleanValue ( newValue ) ; return false ; } } return super . internalGetSetBooleanProperty ( property , get , newValue ) ; } final int getNodeType0 ( ) { return BOOLEAN_LITERAL ; } ASTNode clone0 ( AST target ) { BooleanLiteral result = new BooleanLiteral ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setBooleanValue ( booleanValue ( ) ) ; 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 boolean booleanValue ( ) { return this . value ; } public void setBooleanValue ( boolean value ) { preValueChange ( BOOLEAN_VALUE_PROPERTY ) ; this . value = value ; postValueChange ( BOOLEAN_VALUE_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 . ArrayList ; import java . util . List ; public class MethodDeclaration extends BodyDeclaration { public static final ChildPropertyDescriptor JAVADOC_PROPERTY = internalJavadocPropertyFactory ( MethodDeclaration . class ) ; public static final SimplePropertyDescriptor MODIFIERS_PROPERTY = internalModifiersPropertyFactory ( MethodDeclaration . class ) ; public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY = internalModifiers2PropertyFactory ( MethodDeclaration . class ) ; public static final SimplePropertyDescriptor CONSTRUCTOR_PROPERTY = new SimplePropertyDescriptor ( MethodDeclaration . class , "<STR_LIT>" , boolean . class , MANDATORY ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( MethodDeclaration . class , "<STR_LIT:name>" , SimpleName . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor RETURN_TYPE_PROPERTY = new ChildPropertyDescriptor ( MethodDeclaration . class , "<STR_LIT>" , Type . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor RETURN_TYPE2_PROPERTY = new ChildPropertyDescriptor ( MethodDeclaration . class , "<STR_LIT>" , Type . class , OPTIONAL , NO_CYCLE_RISK ) ; public static final SimplePropertyDescriptor EXTRA_DIMENSIONS_PROPERTY = new SimplePropertyDescriptor ( MethodDeclaration . class , "<STR_LIT>" , int . class , MANDATORY ) ; public static final ChildListPropertyDescriptor TYPE_PARAMETERS_PROPERTY = new ChildListPropertyDescriptor ( MethodDeclaration . class , "<STR_LIT>" , TypeParameter . class , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor PARAMETERS_PROPERTY = new ChildListPropertyDescriptor ( MethodDeclaration . class , "<STR_LIT>" , SingleVariableDeclaration . class , CYCLE_RISK ) ; public static final ChildListPropertyDescriptor THROWN_EXCEPTIONS_PROPERTY = new ChildListPropertyDescriptor ( MethodDeclaration . class , "<STR_LIT>" , Name . class , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor BODY_PROPERTY = new ChildPropertyDescriptor ( MethodDeclaration . class , "<STR_LIT:body>" , Block . 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:10> ) ; createPropertyList ( MethodDeclaration . class , propertyList ) ; addProperty ( JAVADOC_PROPERTY , propertyList ) ; addProperty ( MODIFIERS_PROPERTY , propertyList ) ; addProperty ( CONSTRUCTOR_PROPERTY , propertyList ) ; addProperty ( RETURN_TYPE_PROPERTY , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; addProperty ( PARAMETERS_PROPERTY , propertyList ) ; addProperty ( EXTRA_DIMENSIONS_PROPERTY , propertyList ) ; addProperty ( THROWN_EXCEPTIONS_PROPERTY , propertyList ) ; addProperty ( BODY_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( propertyList ) ; propertyList = new ArrayList ( <NUM_LIT:11> ) ; createPropertyList ( MethodDeclaration . class , propertyList ) ; addProperty ( JAVADOC_PROPERTY , propertyList ) ; addProperty ( MODIFIERS2_PROPERTY , propertyList ) ; addProperty ( CONSTRUCTOR_PROPERTY , propertyList ) ; addProperty ( TYPE_PARAMETERS_PROPERTY , propertyList ) ; addProperty ( RETURN_TYPE2_PROPERTY , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; addProperty ( PARAMETERS_PROPERTY , propertyList ) ; addProperty ( EXTRA_DIMENSIONS_PROPERTY , propertyList ) ; addProperty ( THROWN_EXCEPTIONS_PROPERTY , propertyList ) ; addProperty ( BODY_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 isConstructor = false ; private SimpleName methodName = null ; private ASTNode . NodeList parameters = new ASTNode . NodeList ( PARAMETERS_PROPERTY ) ; private Type returnType = null ; private boolean returnType2Initialized = false ; private ASTNode . NodeList typeParameters = null ; private int extraArrayDimensions = <NUM_LIT:0> ; private ASTNode . NodeList thrownExceptions = new ASTNode . NodeList ( THROWN_EXCEPTIONS_PROPERTY ) ; private Block optionalBody = null ; MethodDeclaration ( AST ast ) { super ( ast ) ; if ( ast . apiLevel >= AST . JLS3_INTERNAL ) { this . typeParameters = new ASTNode . NodeList ( TYPE_PARAMETERS_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> ; } } 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 == CONSTRUCTOR_PROPERTY ) { if ( get ) { return isConstructor ( ) ; } else { setConstructor ( 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 == RETURN_TYPE_PROPERTY ) { if ( get ) { return getReturnType ( ) ; } else { setReturnType ( ( Type ) child ) ; return null ; } } if ( property == RETURN_TYPE2_PROPERTY ) { if ( get ) { return getReturnType2 ( ) ; } else { setReturnType2 ( ( Type ) 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 ( ) ; } if ( property == TYPE_PARAMETERS_PROPERTY ) { return typeParameters ( ) ; } if ( property == PARAMETERS_PROPERTY ) { return parameters ( ) ; } if ( property == THROWN_EXCEPTIONS_PROPERTY ) { return thrownExceptions ( ) ; } 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 METHOD_DECLARATION ; } ASTNode clone0 ( AST target ) { MethodDeclaration result = new MethodDeclaration ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setJavadoc ( ( Javadoc ) ASTNode . copySubtree ( target , getJavadoc ( ) ) ) ; if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { result . internalSetModifiers ( getModifiers ( ) ) ; result . setReturnType ( ( Type ) ASTNode . copySubtree ( target , getReturnType ( ) ) ) ; } if ( this . ast . apiLevel >= AST . JLS3_INTERNAL ) { result . modifiers ( ) . addAll ( ASTNode . copySubtrees ( target , modifiers ( ) ) ) ; result . typeParameters ( ) . addAll ( ASTNode . copySubtrees ( target , typeParameters ( ) ) ) ; result . setReturnType2 ( ( Type ) ASTNode . copySubtree ( target , getReturnType2 ( ) ) ) ; } result . setConstructor ( isConstructor ( ) ) ; result . setExtraDimensions ( getExtraDimensions ( ) ) ; result . setName ( ( SimpleName ) getName ( ) . clone ( target ) ) ; result . parameters ( ) . addAll ( ASTNode . copySubtrees ( target , parameters ( ) ) ) ; result . thrownExceptions ( ) . addAll ( ASTNode . copySubtrees ( target , thrownExceptions ( ) ) ) ; result . setBody ( ( Block ) 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 ) { acceptChild ( visitor , getJavadoc ( ) ) ; if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { acceptChild ( visitor , getReturnType ( ) ) ; } else { acceptChildren ( visitor , this . modifiers ) ; acceptChildren ( visitor , this . typeParameters ) ; acceptChild ( visitor , getReturnType2 ( ) ) ; } acceptChild ( visitor , getName ( ) ) ; acceptChildren ( visitor , this . parameters ) ; acceptChildren ( visitor , this . thrownExceptions ) ; acceptChild ( visitor , getBody ( ) ) ; } visitor . endVisit ( this ) ; } public boolean isConstructor ( ) { return this . isConstructor ; } public void setConstructor ( boolean isConstructor ) { preValueChange ( CONSTRUCTOR_PROPERTY ) ; this . isConstructor = isConstructor ; postValueChange ( CONSTRUCTOR_PROPERTY ) ; } public List typeParameters ( ) { if ( this . typeParameters == null ) { unsupportedIn2 ( ) ; } return this . typeParameters ; } 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 methodName ) { if ( methodName == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . methodName ; preReplaceChild ( oldChild , methodName , NAME_PROPERTY ) ; this . methodName = methodName ; postReplaceChild ( oldChild , methodName , NAME_PROPERTY ) ; } public List parameters ( ) { return this . parameters ; } public boolean isVarargs ( ) { if ( this . modifiers == null ) { unsupportedIn2 ( ) ; } if ( parameters ( ) . isEmpty ( ) ) { return false ; } else { SingleVariableDeclaration v = ( SingleVariableDeclaration ) parameters ( ) . get ( parameters ( ) . size ( ) - <NUM_LIT:1> ) ; return v . isVarargs ( ) ; } } public List thrownExceptions ( ) { return this . thrownExceptions ; } public Type getReturnType ( ) { return internalGetReturnType ( ) ; } final Type internalGetReturnType ( ) { supportedOnlyIn2 ( ) ; if ( this . returnType == null ) { synchronized ( this ) { if ( this . returnType == null ) { preLazyInit ( ) ; this . returnType = this . ast . newPrimitiveType ( PrimitiveType . VOID ) ; postLazyInit ( this . returnType , RETURN_TYPE_PROPERTY ) ; } } } return this . returnType ; } public void setReturnType ( Type type ) { internalSetReturnType ( type ) ; } void internalSetReturnType ( Type type ) { supportedOnlyIn2 ( ) ; if ( type == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . returnType ; preReplaceChild ( oldChild , type , RETURN_TYPE_PROPERTY ) ; this . returnType = type ; postReplaceChild ( oldChild , type , RETURN_TYPE_PROPERTY ) ; } public Type getReturnType2 ( ) { unsupportedIn2 ( ) ; if ( this . returnType == null && ! this . returnType2Initialized ) { synchronized ( this ) { if ( this . returnType == null && ! this . returnType2Initialized ) { preLazyInit ( ) ; this . returnType = this . ast . newPrimitiveType ( PrimitiveType . VOID ) ; this . returnType2Initialized = true ; postLazyInit ( this . returnType , RETURN_TYPE2_PROPERTY ) ; } } } return this . returnType ; } public void setReturnType2 ( Type type ) { unsupportedIn2 ( ) ; this . returnType2Initialized = true ; ASTNode oldChild = this . returnType ; preReplaceChild ( oldChild , type , RETURN_TYPE2_PROPERTY ) ; this . returnType = type ; postReplaceChild ( oldChild , type , RETURN_TYPE2_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 Block getBody ( ) { return this . optionalBody ; } public void setBody ( Block body ) { ASTNode oldChild = this . optionalBody ; preReplaceChild ( oldChild , body , BODY_PROPERTY ) ; this . optionalBody = body ; postReplaceChild ( oldChild , body , BODY_PROPERTY ) ; } public IMethodBinding resolveBinding ( ) { return this . ast . getBindingResolver ( ) . resolveMethod ( this ) ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:9> * <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 . typeParameters == null ? <NUM_LIT:0> : this . typeParameters . listSize ( ) ) + ( this . methodName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) + ( this . returnType == null ? <NUM_LIT:0> : this . returnType . treeSize ( ) ) + this . parameters . listSize ( ) + this . thrownExceptions . listSize ( ) + ( this . optionalBody == null ? <NUM_LIT:0> : getBody ( ) . treeSize ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class MethodInvocation extends Expression { public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( MethodInvocation . class , "<STR_LIT>" , Expression . class , OPTIONAL , CYCLE_RISK ) ; public static final ChildListPropertyDescriptor TYPE_ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor ( MethodInvocation . class , "<STR_LIT>" , Type . class , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( MethodInvocation . class , "<STR_LIT:name>" , SimpleName . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor ( MethodInvocation . 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 properyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( MethodInvocation . class , properyList ) ; addProperty ( EXPRESSION_PROPERTY , properyList ) ; addProperty ( NAME_PROPERTY , properyList ) ; addProperty ( ARGUMENTS_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( properyList ) ; properyList = new ArrayList ( <NUM_LIT:5> ) ; createPropertyList ( MethodInvocation . class , properyList ) ; addProperty ( EXPRESSION_PROPERTY , properyList ) ; addProperty ( TYPE_ARGUMENTS_PROPERTY , properyList ) ; addProperty ( NAME_PROPERTY , properyList ) ; addProperty ( ARGUMENTS_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 SimpleName methodName = null ; private ASTNode . NodeList arguments = new ASTNode . NodeList ( ARGUMENTS_PROPERTY ) ; MethodInvocation ( AST ast ) { super ( ast ) ; if ( ast . apiLevel >= AST . JLS3_INTERNAL ) { 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 == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } 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 METHOD_INVOCATION ; } ASTNode clone0 ( AST target ) { MethodInvocation result = new MethodInvocation ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setName ( ( SimpleName ) getName ( ) . clone ( target ) ) ; result . setExpression ( ( Expression ) ASTNode . copySubtree ( target , getExpression ( ) ) ) ; if ( this . ast . apiLevel >= AST . JLS3_INTERNAL ) { 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_INTERNAL ) { acceptChildren ( visitor , this . typeArguments ) ; } acceptChild ( visitor , getName ( ) ) ; acceptChildren ( visitor , this . arguments ) ; } visitor . endVisit ( this ) ; } public Expression getExpression ( ) { return this . optionalExpression ; } public boolean isResolvedTypeInferredFromExpectedType ( ) { return this . ast . getBindingResolver ( ) . isResolvedTypeInferredFromExpectedType ( this ) ; } 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 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 . optionalExpression == null ? <NUM_LIT:0> : getExpression ( ) . 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 . HashSet ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import java . util . Set ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . compiler . CategorizedProblem ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . core . compiler . InvalidInputException ; import org . eclipse . jdt . core . dom . Modifier . ModifierKeyword ; import org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . AbstractVariableDeclaration ; import org . eclipse . jdt . internal . compiler . ast . Argument ; import org . eclipse . jdt . internal . compiler . ast . ForeachStatement ; import org . eclipse . jdt . internal . compiler . ast . JavadocArgumentExpression ; import org . eclipse . jdt . internal . compiler . ast . JavadocFieldReference ; import org . eclipse . jdt . internal . compiler . ast . JavadocMessageSend ; import org . eclipse . jdt . internal . compiler . ast . LocalDeclaration ; import org . eclipse . jdt . internal . compiler . ast . MessageSend ; import org . eclipse . jdt . internal . compiler . ast . OperatorIds ; import org . eclipse . jdt . internal . compiler . ast . ParameterizedQualifiedTypeReference ; import org . eclipse . jdt . internal . compiler . ast . ParameterizedSingleTypeReference ; import org . eclipse . jdt . internal . compiler . ast . QualifiedAllocationExpression ; import org . eclipse . jdt . internal . compiler . ast . QualifiedTypeReference ; import org . eclipse . jdt . internal . compiler . ast . SingleNameReference ; import org . eclipse . jdt . internal . compiler . ast . SingleTypeReference ; import org . eclipse . jdt . internal . compiler . ast . StringLiteralConcatenation ; import org . eclipse . jdt . internal . compiler . ast . TypeReference ; import org . eclipse . jdt . internal . compiler . ast . Wildcard ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . CompilationUnitScope ; import org . eclipse . jdt . internal . compiler . lookup . ExtraCompilerModifiers ; import org . eclipse . jdt . internal . compiler . lookup . Scope ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . compiler . parser . RecoveryScanner ; import org . eclipse . jdt . internal . compiler . parser . Scanner ; import org . eclipse . jdt . internal . compiler . parser . TerminalTokens ; import org . eclipse . jdt . internal . core . util . Util ; class ASTConverter { protected AST ast ; protected Comment [ ] commentsTable ; char [ ] compilationUnitSource ; int compilationUnitSourceLength ; protected DocCommentParser docParser ; protected boolean insideComments ; protected IProgressMonitor monitor ; protected Set pendingNameScopeResolution ; protected Set pendingThisExpressionScopeResolution ; protected boolean resolveBindings ; Scanner scanner ; private DefaultCommentMapper commentMapper ; private boolean scannerUsable = true ; public ASTConverter ( Map options , boolean resolveBindings , IProgressMonitor monitor ) { this . resolveBindings = resolveBindings ; Object sourceModeSetting = options . get ( JavaCore . COMPILER_SOURCE ) ; long sourceLevel = CompilerOptions . versionToJdkLevel ( sourceModeSetting ) ; if ( sourceLevel == <NUM_LIT:0> ) { sourceLevel = ClassFileConstants . JDK1_3 ; } this . scanner = new Scanner ( true , false , false , sourceLevel , null , null , true ) ; this . monitor = monitor ; this . insideComments = JavaCore . ENABLED . equals ( options . get ( JavaCore . COMPILER_DOC_COMMENT_SUPPORT ) ) ; } protected void adjustSourcePositionsForParent ( org . eclipse . jdt . internal . compiler . ast . Expression expression ) { int start = expression . sourceStart ; int end = expression . sourceEnd ; int leftParentCount = <NUM_LIT:1> ; int rightParentCount = <NUM_LIT:0> ; this . scanner . resetTo ( start , end ) ; try { int token = this . scanner . getNextToken ( ) ; expression . sourceStart = this . scanner . currentPosition ; boolean stop = false ; while ( ! stop && ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) ) { switch ( token ) { case TerminalTokens . TokenNameLPAREN : leftParentCount ++ ; break ; case TerminalTokens . TokenNameRPAREN : rightParentCount ++ ; if ( rightParentCount == leftParentCount ) { stop = true ; } } } expression . sourceEnd = this . scanner . startPosition - <NUM_LIT:1> ; } catch ( InvalidInputException e ) { } } protected void buildBodyDeclarations ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration typeDeclaration , AbstractTypeDeclaration typeDecl , boolean isInterface ) { org . eclipse . jdt . internal . compiler . ast . TypeDeclaration [ ] members = typeDeclaration . memberTypes ; org . eclipse . jdt . internal . compiler . ast . FieldDeclaration [ ] fields = typeDeclaration . fields ; org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration [ ] methods = typeDeclaration . methods ; int fieldsLength = fields == null ? <NUM_LIT:0> : fields . length ; int methodsLength = methods == null ? <NUM_LIT:0> : methods . length ; int membersLength = members == null ? <NUM_LIT:0> : members . length ; int fieldsIndex = <NUM_LIT:0> ; int methodsIndex = <NUM_LIT:0> ; int membersIndex = <NUM_LIT:0> ; while ( ( fieldsIndex < fieldsLength ) || ( membersIndex < membersLength ) || ( methodsIndex < methodsLength ) ) { org . eclipse . jdt . internal . compiler . ast . FieldDeclaration nextFieldDeclaration = null ; org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration nextMethodDeclaration = null ; org . eclipse . jdt . internal . compiler . ast . TypeDeclaration nextMemberDeclaration = null ; int position = Integer . MAX_VALUE ; int nextDeclarationType = - <NUM_LIT:1> ; if ( fieldsIndex < fieldsLength ) { nextFieldDeclaration = fields [ fieldsIndex ] ; if ( nextFieldDeclaration . declarationSourceStart < position ) { position = nextFieldDeclaration . declarationSourceStart ; nextDeclarationType = <NUM_LIT:0> ; } } if ( methodsIndex < methodsLength ) { nextMethodDeclaration = methods [ methodsIndex ] ; if ( nextMethodDeclaration . declarationSourceStart < position ) { position = nextMethodDeclaration . declarationSourceStart ; nextDeclarationType = <NUM_LIT:1> ; } } if ( membersIndex < membersLength ) { nextMemberDeclaration = members [ membersIndex ] ; if ( nextMemberDeclaration . declarationSourceStart < position ) { position = nextMemberDeclaration . declarationSourceStart ; nextDeclarationType = <NUM_LIT:2> ; } } switch ( nextDeclarationType ) { case <NUM_LIT:0> : if ( nextFieldDeclaration . getKind ( ) == AbstractVariableDeclaration . ENUM_CONSTANT ) { typeDecl . bodyDeclarations ( ) . add ( convert ( nextFieldDeclaration ) ) ; } else { checkAndAddMultipleFieldDeclaration ( fields , fieldsIndex , typeDecl . bodyDeclarations ( ) ) ; } fieldsIndex ++ ; break ; case <NUM_LIT:1> : methodsIndex ++ ; if ( ! nextMethodDeclaration . isDefaultConstructor ( ) && ! nextMethodDeclaration . isClinit ( ) ) { boolean originalValue = this . scannerUsable ; try { this . scannerUsable = typeDeclaration . isScannerUsableOnThisDeclaration ( ) ; typeDecl . bodyDeclarations ( ) . add ( convert ( isInterface , nextMethodDeclaration ) ) ; } finally { this . scannerUsable = originalValue ; } } break ; case <NUM_LIT:2> : membersIndex ++ ; ASTNode node = convert ( nextMemberDeclaration ) ; if ( node == null ) { typeDecl . setFlags ( typeDecl . getFlags ( ) | ASTNode . MALFORMED ) ; } else { typeDecl . bodyDeclarations ( ) . add ( node ) ; } } } convert ( typeDeclaration . javadoc , typeDecl ) ; } protected void buildBodyDeclarations ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration enumDeclaration2 , EnumDeclaration enumDeclaration ) { org . eclipse . jdt . internal . compiler . ast . TypeDeclaration [ ] members = enumDeclaration2 . memberTypes ; org . eclipse . jdt . internal . compiler . ast . FieldDeclaration [ ] fields = enumDeclaration2 . fields ; org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration [ ] methods = enumDeclaration2 . methods ; int fieldsLength = fields == null ? <NUM_LIT:0> : fields . length ; int methodsLength = methods == null ? <NUM_LIT:0> : methods . length ; int membersLength = members == null ? <NUM_LIT:0> : members . length ; int fieldsIndex = <NUM_LIT:0> ; int methodsIndex = <NUM_LIT:0> ; int membersIndex = <NUM_LIT:0> ; while ( ( fieldsIndex < fieldsLength ) || ( membersIndex < membersLength ) || ( methodsIndex < methodsLength ) ) { org . eclipse . jdt . internal . compiler . ast . FieldDeclaration nextFieldDeclaration = null ; org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration nextMethodDeclaration = null ; org . eclipse . jdt . internal . compiler . ast . TypeDeclaration nextMemberDeclaration = null ; int position = Integer . MAX_VALUE ; int nextDeclarationType = - <NUM_LIT:1> ; if ( fieldsIndex < fieldsLength ) { nextFieldDeclaration = fields [ fieldsIndex ] ; if ( nextFieldDeclaration . declarationSourceStart < position ) { position = nextFieldDeclaration . declarationSourceStart ; nextDeclarationType = <NUM_LIT:0> ; } } if ( methodsIndex < methodsLength ) { nextMethodDeclaration = methods [ methodsIndex ] ; if ( nextMethodDeclaration . declarationSourceStart < position ) { position = nextMethodDeclaration . declarationSourceStart ; nextDeclarationType = <NUM_LIT:1> ; } } if ( membersIndex < membersLength ) { nextMemberDeclaration = members [ membersIndex ] ; if ( nextMemberDeclaration . declarationSourceStart < position ) { position = nextMemberDeclaration . declarationSourceStart ; nextDeclarationType = <NUM_LIT:2> ; } } switch ( nextDeclarationType ) { case <NUM_LIT:0> : if ( nextFieldDeclaration . getKind ( ) == AbstractVariableDeclaration . ENUM_CONSTANT ) { enumDeclaration . enumConstants ( ) . add ( convert ( nextFieldDeclaration ) ) ; } else { checkAndAddMultipleFieldDeclaration ( fields , fieldsIndex , enumDeclaration . bodyDeclarations ( ) ) ; } fieldsIndex ++ ; break ; case <NUM_LIT:1> : methodsIndex ++ ; if ( ! nextMethodDeclaration . isDefaultConstructor ( ) && ! nextMethodDeclaration . isClinit ( ) ) { enumDeclaration . bodyDeclarations ( ) . add ( convert ( false , nextMethodDeclaration ) ) ; } break ; case <NUM_LIT:2> : membersIndex ++ ; enumDeclaration . bodyDeclarations ( ) . add ( convert ( nextMemberDeclaration ) ) ; break ; } } convert ( enumDeclaration2 . javadoc , enumDeclaration ) ; } protected void buildBodyDeclarations ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration expression , AnonymousClassDeclaration anonymousClassDeclaration ) { org . eclipse . jdt . internal . compiler . ast . TypeDeclaration [ ] members = expression . memberTypes ; org . eclipse . jdt . internal . compiler . ast . FieldDeclaration [ ] fields = expression . fields ; org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration [ ] methods = expression . methods ; int fieldsLength = fields == null ? <NUM_LIT:0> : fields . length ; int methodsLength = methods == null ? <NUM_LIT:0> : methods . length ; int membersLength = members == null ? <NUM_LIT:0> : members . length ; int fieldsIndex = <NUM_LIT:0> ; int methodsIndex = <NUM_LIT:0> ; int membersIndex = <NUM_LIT:0> ; while ( ( fieldsIndex < fieldsLength ) || ( membersIndex < membersLength ) || ( methodsIndex < methodsLength ) ) { org . eclipse . jdt . internal . compiler . ast . FieldDeclaration nextFieldDeclaration = null ; org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration nextMethodDeclaration = null ; org . eclipse . jdt . internal . compiler . ast . TypeDeclaration nextMemberDeclaration = null ; int position = Integer . MAX_VALUE ; int nextDeclarationType = - <NUM_LIT:1> ; if ( fieldsIndex < fieldsLength ) { nextFieldDeclaration = fields [ fieldsIndex ] ; if ( nextFieldDeclaration . declarationSourceStart < position ) { position = nextFieldDeclaration . declarationSourceStart ; nextDeclarationType = <NUM_LIT:0> ; } } if ( methodsIndex < methodsLength ) { nextMethodDeclaration = methods [ methodsIndex ] ; if ( nextMethodDeclaration . declarationSourceStart < position ) { position = nextMethodDeclaration . declarationSourceStart ; nextDeclarationType = <NUM_LIT:1> ; } } if ( membersIndex < membersLength ) { nextMemberDeclaration = members [ membersIndex ] ; if ( nextMemberDeclaration . declarationSourceStart < position ) { position = nextMemberDeclaration . declarationSourceStart ; nextDeclarationType = <NUM_LIT:2> ; } } switch ( nextDeclarationType ) { case <NUM_LIT:0> : if ( nextFieldDeclaration . getKind ( ) == AbstractVariableDeclaration . ENUM_CONSTANT ) { anonymousClassDeclaration . bodyDeclarations ( ) . add ( convert ( nextFieldDeclaration ) ) ; } else { checkAndAddMultipleFieldDeclaration ( fields , fieldsIndex , anonymousClassDeclaration . bodyDeclarations ( ) ) ; } fieldsIndex ++ ; break ; case <NUM_LIT:1> : methodsIndex ++ ; if ( ! nextMethodDeclaration . isDefaultConstructor ( ) && ! nextMethodDeclaration . isClinit ( ) ) { anonymousClassDeclaration . bodyDeclarations ( ) . add ( convert ( false , nextMethodDeclaration ) ) ; } break ; case <NUM_LIT:2> : membersIndex ++ ; ASTNode node = convert ( nextMemberDeclaration ) ; if ( node == null ) { anonymousClassDeclaration . setFlags ( anonymousClassDeclaration . getFlags ( ) | ASTNode . MALFORMED ) ; } else { anonymousClassDeclaration . bodyDeclarations ( ) . add ( node ) ; } } } } void buildCommentsTable ( CompilationUnit compilationUnit , int [ ] [ ] comments ) { this . commentsTable = new Comment [ comments . length ] ; int nbr = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < comments . length ; i ++ ) { Comment comment = createComment ( comments [ i ] ) ; if ( comment != null ) { comment . setAlternateRoot ( compilationUnit ) ; this . commentsTable [ nbr ++ ] = comment ; } } if ( nbr < comments . length ) { Comment [ ] newCommentsTable = new Comment [ nbr ] ; System . arraycopy ( this . commentsTable , <NUM_LIT:0> , newCommentsTable , <NUM_LIT:0> , nbr ) ; this . commentsTable = newCommentsTable ; } compilationUnit . setCommentTable ( this . commentsTable ) ; } protected void checkAndAddMultipleFieldDeclaration ( org . eclipse . jdt . internal . compiler . ast . FieldDeclaration [ ] fields , int index , List bodyDeclarations ) { if ( fields [ index ] instanceof org . eclipse . jdt . internal . compiler . ast . Initializer ) { org . eclipse . jdt . internal . compiler . ast . Initializer oldInitializer = ( org . eclipse . jdt . internal . compiler . ast . Initializer ) fields [ index ] ; Initializer initializer = new Initializer ( this . ast ) ; initializer . setBody ( convert ( oldInitializer . block ) ) ; setModifiers ( initializer , oldInitializer ) ; initializer . setSourceRange ( oldInitializer . declarationSourceStart , oldInitializer . sourceEnd - oldInitializer . declarationSourceStart + <NUM_LIT:1> ) ; convert ( oldInitializer . javadoc , initializer ) ; bodyDeclarations . add ( initializer ) ; return ; } if ( index > <NUM_LIT:0> && fields [ index - <NUM_LIT:1> ] . declarationSourceStart == fields [ index ] . declarationSourceStart ) { FieldDeclaration fieldDeclaration = ( FieldDeclaration ) bodyDeclarations . get ( bodyDeclarations . size ( ) - <NUM_LIT:1> ) ; fieldDeclaration . fragments ( ) . add ( convertToVariableDeclarationFragment ( fields [ index ] ) ) ; } else { bodyDeclarations . add ( convertToFieldDeclaration ( fields [ index ] ) ) ; } } protected void checkAndAddMultipleLocalDeclaration ( org . eclipse . jdt . internal . compiler . ast . Statement [ ] stmts , int index , List blockStatements ) { if ( index > <NUM_LIT:0> && stmts [ index - <NUM_LIT:1> ] instanceof org . eclipse . jdt . internal . compiler . ast . LocalDeclaration ) { org . eclipse . jdt . internal . compiler . ast . LocalDeclaration local1 = ( org . eclipse . jdt . internal . compiler . ast . LocalDeclaration ) stmts [ index - <NUM_LIT:1> ] ; org . eclipse . jdt . internal . compiler . ast . LocalDeclaration local2 = ( org . eclipse . jdt . internal . compiler . ast . LocalDeclaration ) stmts [ index ] ; if ( local1 . declarationSourceStart == local2 . declarationSourceStart ) { VariableDeclarationStatement variableDeclarationStatement = ( VariableDeclarationStatement ) blockStatements . get ( blockStatements . size ( ) - <NUM_LIT:1> ) ; variableDeclarationStatement . fragments ( ) . add ( convertToVariableDeclarationFragment ( ( org . eclipse . jdt . internal . compiler . ast . LocalDeclaration ) stmts [ index ] ) ) ; } else { blockStatements . add ( convertToVariableDeclarationStatement ( ( org . eclipse . jdt . internal . compiler . ast . LocalDeclaration ) stmts [ index ] ) ) ; } } else { blockStatements . add ( convertToVariableDeclarationStatement ( ( org . eclipse . jdt . internal . compiler . ast . LocalDeclaration ) stmts [ index ] ) ) ; } } protected void checkCanceled ( ) { if ( this . monitor != null && this . monitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; } protected void completeRecord ( ArrayType arrayType , org . eclipse . jdt . internal . compiler . ast . ASTNode astNode ) { ArrayType array = arrayType ; int dimensions = array . getDimensions ( ) ; for ( int i = <NUM_LIT:0> ; i < dimensions ; i ++ ) { Type componentType = array . getComponentType ( ) ; this . recordNodes ( componentType , astNode ) ; if ( componentType . isArrayType ( ) ) { array = ( ArrayType ) componentType ; } } } public ASTNode convert ( boolean isInterface , org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration methodDeclaration ) { checkCanceled ( ) ; if ( methodDeclaration instanceof org . eclipse . jdt . internal . compiler . ast . AnnotationMethodDeclaration ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . AnnotationMethodDeclaration ) methodDeclaration ) ; } MethodDeclaration methodDecl = new MethodDeclaration ( this . ast ) ; setModifiers ( methodDecl , methodDeclaration ) ; boolean isConstructor = methodDeclaration . isConstructor ( ) ; methodDecl . setConstructor ( isConstructor ) ; final SimpleName methodName = new SimpleName ( this . ast ) ; methodName . internalSetIdentifier ( new String ( methodDeclaration . selector ) ) ; int start = methodDeclaration . sourceStart ; int end = ( scannerAvailable ( methodDeclaration . scope ) ? retrieveIdentifierEndPosition ( start , methodDeclaration . sourceEnd ) : methodDeclaration . sourceEnd ) ; methodName . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; methodDecl . setName ( methodName ) ; org . eclipse . jdt . internal . compiler . ast . TypeReference [ ] thrownExceptions = methodDeclaration . thrownExceptions ; int methodHeaderEnd = methodDeclaration . sourceEnd ; int thrownExceptionsLength = thrownExceptions == null ? <NUM_LIT:0> : thrownExceptions . length ; if ( thrownExceptionsLength > <NUM_LIT:0> ) { Name thrownException ; int i = <NUM_LIT:0> ; do { thrownException = convert ( thrownExceptions [ i ++ ] ) ; methodDecl . thrownExceptions ( ) . add ( thrownException ) ; } while ( i < thrownExceptionsLength ) ; methodHeaderEnd = thrownException . getStartPosition ( ) + thrownException . getLength ( ) ; } org . eclipse . jdt . internal . compiler . ast . Argument [ ] parameters = methodDeclaration . arguments ; int parametersLength = parameters == null ? <NUM_LIT:0> : parameters . length ; if ( parametersLength > <NUM_LIT:0> ) { SingleVariableDeclaration parameter ; int i = <NUM_LIT:0> ; do { BlockScope origScope = null ; if ( parameters [ i ] . binding != null ) { origScope = parameters [ i ] . binding . declaringScope ; parameters [ i ] . binding . declaringScope = methodDeclaration . scope ; } parameter = convert ( parameters [ i ++ ] ) ; if ( parameters [ i - <NUM_LIT:1> ] . binding != null ) { parameters [ i - <NUM_LIT:1> ] . binding . declaringScope = origScope ; } methodDecl . parameters ( ) . add ( parameter ) ; } while ( i < parametersLength ) ; if ( thrownExceptionsLength == <NUM_LIT:0> ) { methodHeaderEnd = parameter . getStartPosition ( ) + parameter . getLength ( ) ; } } org . eclipse . jdt . internal . compiler . ast . ExplicitConstructorCall explicitConstructorCall = null ; if ( isConstructor ) { if ( isInterface ) { methodDecl . setFlags ( methodDecl . getFlags ( ) | ASTNode . MALFORMED ) ; } org . eclipse . jdt . internal . compiler . ast . ConstructorDeclaration constructorDeclaration = ( org . eclipse . jdt . internal . compiler . ast . ConstructorDeclaration ) methodDeclaration ; explicitConstructorCall = constructorDeclaration . constructorCall ; switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : PrimitiveType returnType = new PrimitiveType ( this . ast ) ; returnType . setPrimitiveTypeCode ( PrimitiveType . VOID ) ; returnType . setSourceRange ( methodDeclaration . sourceStart , <NUM_LIT:0> ) ; methodDecl . internalSetReturnType ( returnType ) ; break ; default : methodDecl . setReturnType2 ( null ) ; } } else if ( methodDeclaration instanceof org . eclipse . jdt . internal . compiler . ast . MethodDeclaration ) { org . eclipse . jdt . internal . compiler . ast . MethodDeclaration method = ( org . eclipse . jdt . internal . compiler . ast . MethodDeclaration ) methodDeclaration ; org . eclipse . jdt . internal . compiler . ast . TypeReference typeReference = method . returnType ; if ( typeReference != null ) { Type returnType = convertType ( typeReference ) ; int rightParenthesisPosition = retrieveEndOfRightParenthesisPosition ( end , method . bodyEnd ) ; int extraDimensions = retrieveExtraDimension ( rightParenthesisPosition , method . bodyEnd ) ; methodDecl . setExtraDimensions ( extraDimensions ) ; setTypeForMethodDeclaration ( methodDecl , returnType , extraDimensions ) ; } else { methodDecl . setFlags ( methodDecl . getFlags ( ) | ASTNode . MALFORMED ) ; switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : break ; default : methodDecl . setReturnType2 ( null ) ; } } } int declarationSourceStart = methodDeclaration . declarationSourceStart ; int bodyEnd = methodDeclaration . bodyEnd ; methodDecl . setSourceRange ( declarationSourceStart , bodyEnd - declarationSourceStart + <NUM_LIT:1> ) ; int declarationSourceEnd = methodDeclaration . declarationSourceEnd ; int rightBraceOrSemiColonPositionStart = bodyEnd == declarationSourceEnd ? bodyEnd : bodyEnd + <NUM_LIT:1> ; int closingPosition = retrieveRightBraceOrSemiColonPosition ( rightBraceOrSemiColonPositionStart , declarationSourceEnd ) ; if ( closingPosition != - <NUM_LIT:1> ) { int startPosition = methodDecl . getStartPosition ( ) ; methodDecl . setSourceRange ( startPosition , closingPosition - startPosition + <NUM_LIT:1> ) ; org . eclipse . jdt . internal . compiler . ast . Statement [ ] statements = methodDeclaration . statements ; start = retrieveStartBlockPosition ( methodHeaderEnd , methodDeclaration . bodyStart ) ; if ( start == - <NUM_LIT:1> ) start = methodDeclaration . bodyStart ; end = retrieveRightBrace ( methodDeclaration . bodyEnd , declarationSourceEnd ) ; Block block = null ; if ( start != - <NUM_LIT:1> && end != - <NUM_LIT:1> ) { block = new Block ( this . ast ) ; block . setSourceRange ( start , closingPosition - start + <NUM_LIT:1> ) ; methodDecl . setBody ( block ) ; } if ( block != null && ( statements != null || explicitConstructorCall != null ) ) { if ( explicitConstructorCall != null && explicitConstructorCall . accessMode != org . eclipse . jdt . internal . compiler . ast . ExplicitConstructorCall . ImplicitSuper ) { block . statements ( ) . add ( convert ( explicitConstructorCall ) ) ; } int statementsLength = statements == null ? <NUM_LIT:0> : statements . length ; for ( int i = <NUM_LIT:0> ; i < statementsLength ; i ++ ) { if ( statements [ i ] instanceof org . eclipse . jdt . internal . compiler . ast . LocalDeclaration ) { checkAndAddMultipleLocalDeclaration ( statements , i , block . statements ( ) ) ; } else { final Statement statement = convert ( statements [ i ] ) ; if ( statement != null ) { block . statements ( ) . add ( statement ) ; } } } } if ( block != null && ( Modifier . isAbstract ( methodDecl . getModifiers ( ) ) || Modifier . isNative ( methodDecl . getModifiers ( ) ) || isInterface ) ) { methodDecl . setFlags ( methodDecl . getFlags ( ) | ASTNode . MALFORMED ) ; } } else { methodDecl . setFlags ( methodDecl . getFlags ( ) | ASTNode . MALFORMED ) ; if ( ! methodDeclaration . isNative ( ) && ! methodDeclaration . isAbstract ( ) ) { start = retrieveStartBlockPosition ( methodHeaderEnd , bodyEnd ) ; if ( start == - <NUM_LIT:1> ) start = methodDeclaration . bodyStart ; end = methodDeclaration . bodyEnd ; CategorizedProblem [ ] problems = methodDeclaration . compilationResult ( ) . problems ; if ( problems != null ) { for ( int i = <NUM_LIT:0> , max = methodDeclaration . compilationResult ( ) . problemCount ; i < max ; i ++ ) { CategorizedProblem currentProblem = problems [ i ] ; if ( currentProblem . getSourceStart ( ) == start && currentProblem . getID ( ) == IProblem . ParsingErrorInsertToComplete ) { end = currentProblem . getSourceEnd ( ) ; break ; } } } int startPosition = methodDecl . getStartPosition ( ) ; methodDecl . setSourceRange ( startPosition , end - startPosition + <NUM_LIT:1> ) ; if ( start != - <NUM_LIT:1> && end != - <NUM_LIT:1> ) { Block block = new Block ( this . ast ) ; block . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; methodDecl . setBody ( block ) ; } } } org . eclipse . jdt . internal . compiler . ast . TypeParameter [ ] typeParameters = methodDeclaration . typeParameters ( ) ; if ( typeParameters != null ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : methodDecl . setFlags ( methodDecl . getFlags ( ) | ASTNode . MALFORMED ) ; break ; default : for ( int i = <NUM_LIT:0> , max = typeParameters . length ; i < max ; i ++ ) { methodDecl . typeParameters ( ) . add ( convert ( typeParameters [ i ] ) ) ; } } } convert ( methodDeclaration . javadoc , methodDecl ) ; if ( this . resolveBindings ) { recordNodes ( methodDecl , methodDeclaration ) ; recordNodes ( methodName , methodDeclaration ) ; methodDecl . resolveBinding ( ) ; } return methodDecl ; } private boolean scannerAvailable ( Scope scope ) { if ( ! this . scannerUsable ) { return false ; } if ( scope != null ) { CompilationUnitScope cuScope = scope . compilationUnitScope ( ) ; if ( cuScope != null ) { return cuScope . scannerAvailable ( ) ; } } return true ; } public ClassInstanceCreation convert ( org . eclipse . jdt . internal . compiler . ast . AllocationExpression expression ) { ClassInstanceCreation classInstanceCreation = new ClassInstanceCreation ( this . ast ) ; if ( this . resolveBindings ) { recordNodes ( classInstanceCreation , expression ) ; } if ( expression . typeArguments != null ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : classInstanceCreation . setFlags ( classInstanceCreation . getFlags ( ) | ASTNode . MALFORMED ) ; break ; default : for ( int i = <NUM_LIT:0> , max = expression . typeArguments . length ; i < max ; i ++ ) { classInstanceCreation . typeArguments ( ) . add ( convertType ( expression . typeArguments [ i ] ) ) ; } } } switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : classInstanceCreation . internalSetName ( convert ( expression . type ) ) ; break ; default : classInstanceCreation . setType ( convertType ( expression . type ) ) ; } classInstanceCreation . setSourceRange ( expression . sourceStart , expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ) ; org . eclipse . jdt . internal . compiler . ast . Expression [ ] arguments = expression . arguments ; if ( arguments != null ) { int length = arguments . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { classInstanceCreation . arguments ( ) . add ( convert ( arguments [ i ] ) ) ; } } return classInstanceCreation ; } public Expression convert ( org . eclipse . jdt . internal . compiler . ast . AND_AND_Expression expression ) { InfixExpression infixExpression = new InfixExpression ( this . ast ) ; infixExpression . setOperator ( InfixExpression . Operator . CONDITIONAL_AND ) ; if ( this . resolveBindings ) { this . recordNodes ( infixExpression , expression ) ; } final int expressionOperatorID = ( expression . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorMASK ) > > org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorSHIFT ; if ( expression . left instanceof org . eclipse . jdt . internal . compiler . ast . BinaryExpression && ( ( expression . left . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . ParenthesizedMASK ) == <NUM_LIT:0> ) ) { infixExpression . extendedOperands ( ) . add ( convert ( expression . right ) ) ; org . eclipse . jdt . internal . compiler . ast . Expression leftOperand = expression . left ; org . eclipse . jdt . internal . compiler . ast . Expression rightOperand = null ; do { rightOperand = ( ( org . eclipse . jdt . internal . compiler . ast . BinaryExpression ) leftOperand ) . right ; if ( ( ( ( leftOperand . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorMASK ) > > org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorSHIFT ) != expressionOperatorID && ( ( leftOperand . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . ParenthesizedMASK ) == <NUM_LIT:0> ) ) || ( ( rightOperand instanceof org . eclipse . jdt . internal . compiler . ast . BinaryExpression && ( ( rightOperand . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorMASK ) > > org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorSHIFT ) != expressionOperatorID ) && ( ( rightOperand . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . ParenthesizedMASK ) == <NUM_LIT:0> ) ) ) { List extendedOperands = infixExpression . extendedOperands ( ) ; InfixExpression temp = new InfixExpression ( this . ast ) ; if ( this . resolveBindings ) { this . recordNodes ( temp , expression ) ; } temp . setOperator ( getOperatorFor ( expressionOperatorID ) ) ; Expression leftSide = convert ( leftOperand ) ; temp . setLeftOperand ( leftSide ) ; temp . setSourceRange ( leftSide . getStartPosition ( ) , leftSide . getLength ( ) ) ; int size = extendedOperands . size ( ) ; for ( int i = <NUM_LIT:0> ; i < size - <NUM_LIT:1> ; i ++ ) { Expression expr = temp ; temp = new InfixExpression ( this . ast ) ; if ( this . resolveBindings ) { this . recordNodes ( temp , expression ) ; } temp . setLeftOperand ( expr ) ; temp . setOperator ( getOperatorFor ( expressionOperatorID ) ) ; temp . setSourceRange ( expr . getStartPosition ( ) , expr . getLength ( ) ) ; } infixExpression = temp ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { Expression extendedOperand = ( Expression ) extendedOperands . remove ( size - <NUM_LIT:1> - i ) ; temp . setRightOperand ( extendedOperand ) ; int startPosition = temp . getLeftOperand ( ) . getStartPosition ( ) ; temp . setSourceRange ( startPosition , extendedOperand . getStartPosition ( ) + extendedOperand . getLength ( ) - startPosition ) ; if ( temp . getLeftOperand ( ) . getNodeType ( ) == ASTNode . INFIX_EXPRESSION ) { temp = ( InfixExpression ) temp . getLeftOperand ( ) ; } } int startPosition = infixExpression . getLeftOperand ( ) . getStartPosition ( ) ; infixExpression . setSourceRange ( startPosition , expression . sourceEnd - startPosition + <NUM_LIT:1> ) ; if ( this . resolveBindings ) { this . recordNodes ( infixExpression , expression ) ; } return infixExpression ; } infixExpression . extendedOperands ( ) . add ( <NUM_LIT:0> , convert ( rightOperand ) ) ; leftOperand = ( ( org . eclipse . jdt . internal . compiler . ast . BinaryExpression ) leftOperand ) . left ; } while ( leftOperand instanceof org . eclipse . jdt . internal . compiler . ast . BinaryExpression && ( ( leftOperand . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . ParenthesizedMASK ) == <NUM_LIT:0> ) ) ; Expression leftExpression = convert ( leftOperand ) ; infixExpression . setLeftOperand ( leftExpression ) ; infixExpression . setRightOperand ( ( Expression ) infixExpression . extendedOperands ( ) . remove ( <NUM_LIT:0> ) ) ; int startPosition = leftExpression . getStartPosition ( ) ; infixExpression . setSourceRange ( startPosition , expression . sourceEnd - startPosition + <NUM_LIT:1> ) ; return infixExpression ; } Expression leftExpression = convert ( expression . left ) ; infixExpression . setLeftOperand ( leftExpression ) ; infixExpression . setRightOperand ( convert ( expression . right ) ) ; infixExpression . setOperator ( InfixExpression . Operator . CONDITIONAL_AND ) ; int startPosition = leftExpression . getStartPosition ( ) ; infixExpression . setSourceRange ( startPosition , expression . sourceEnd - startPosition + <NUM_LIT:1> ) ; return infixExpression ; } private AnnotationTypeDeclaration convertToAnnotationDeclaration ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration typeDeclaration ) { checkCanceled ( ) ; if ( this . scanner . sourceLevel < ClassFileConstants . JDK1_5 ) return null ; AnnotationTypeDeclaration typeDecl = this . ast . newAnnotationTypeDeclaration ( ) ; setModifiers ( typeDecl , typeDeclaration ) ; final SimpleName typeName = new SimpleName ( this . ast ) ; typeName . internalSetIdentifier ( new String ( typeDeclaration . name ) ) ; typeName . setSourceRange ( typeDeclaration . sourceStart , typeDeclaration . sourceEnd - typeDeclaration . sourceStart + <NUM_LIT:1> ) ; typeDecl . setName ( typeName ) ; typeDecl . setSourceRange ( typeDeclaration . declarationSourceStart , typeDeclaration . bodyEnd - typeDeclaration . declarationSourceStart + <NUM_LIT:1> ) ; buildBodyDeclarations ( typeDeclaration , typeDecl , false ) ; if ( this . resolveBindings ) { recordNodes ( typeDecl , typeDeclaration ) ; recordNodes ( typeName , typeDeclaration ) ; typeDecl . resolveBinding ( ) ; } return typeDecl ; } public ASTNode convert ( org . eclipse . jdt . internal . compiler . ast . AnnotationMethodDeclaration annotationTypeMemberDeclaration ) { checkCanceled ( ) ; if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { return null ; } AnnotationTypeMemberDeclaration annotationTypeMemberDeclaration2 = new AnnotationTypeMemberDeclaration ( this . ast ) ; setModifiers ( annotationTypeMemberDeclaration2 , annotationTypeMemberDeclaration ) ; final SimpleName methodName = new SimpleName ( this . ast ) ; methodName . internalSetIdentifier ( new String ( annotationTypeMemberDeclaration . selector ) ) ; int start = annotationTypeMemberDeclaration . sourceStart ; int end = retrieveIdentifierEndPosition ( start , annotationTypeMemberDeclaration . sourceEnd ) ; methodName . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; annotationTypeMemberDeclaration2 . setName ( methodName ) ; org . eclipse . jdt . internal . compiler . ast . TypeReference typeReference = annotationTypeMemberDeclaration . returnType ; if ( typeReference != null ) { Type returnType = convertType ( typeReference ) ; setTypeForMethodDeclaration ( annotationTypeMemberDeclaration2 , returnType , <NUM_LIT:0> ) ; } int declarationSourceStart = annotationTypeMemberDeclaration . declarationSourceStart ; int declarationSourceEnd = annotationTypeMemberDeclaration . bodyEnd ; annotationTypeMemberDeclaration2 . setSourceRange ( declarationSourceStart , declarationSourceEnd - declarationSourceStart + <NUM_LIT:1> ) ; convert ( annotationTypeMemberDeclaration . javadoc , annotationTypeMemberDeclaration2 ) ; org . eclipse . jdt . internal . compiler . ast . Expression memberValue = annotationTypeMemberDeclaration . defaultValue ; if ( memberValue != null ) { annotationTypeMemberDeclaration2 . setDefault ( convert ( memberValue ) ) ; } if ( this . resolveBindings ) { recordNodes ( annotationTypeMemberDeclaration2 , annotationTypeMemberDeclaration ) ; recordNodes ( methodName , annotationTypeMemberDeclaration ) ; annotationTypeMemberDeclaration2 . resolveBinding ( ) ; } return annotationTypeMemberDeclaration2 ; } public SingleVariableDeclaration convert ( org . eclipse . jdt . internal . compiler . ast . Argument argument ) { SingleVariableDeclaration variableDecl = new SingleVariableDeclaration ( this . ast ) ; setModifiers ( variableDecl , argument ) ; final SimpleName name = new SimpleName ( this . ast ) ; name . internalSetIdentifier ( new String ( argument . name ) ) ; int start = argument . sourceStart ; int nameEnd = argument . sourceEnd ; name . setSourceRange ( start , nameEnd - start + <NUM_LIT:1> ) ; variableDecl . setName ( name ) ; final int typeSourceEnd = argument . type . sourceEnd ; final int extraDimensions = retrieveExtraDimension ( nameEnd + <NUM_LIT:1> , typeSourceEnd ) ; variableDecl . setExtraDimensions ( extraDimensions ) ; final boolean isVarArgs = argument . isVarArgs ( ) ; if ( argument . binding != null && scannerAvailable ( argument . binding . declaringScope ) && isVarArgs && extraDimensions == <NUM_LIT:0> ) { argument . type . sourceEnd = retrieveEllipsisStartPosition ( argument . type . sourceStart , typeSourceEnd ) ; } Type type = convertType ( argument . type ) ; int typeEnd = type . getStartPosition ( ) + type . getLength ( ) - <NUM_LIT:1> ; int rightEnd = Math . max ( typeEnd , argument . declarationSourceEnd ) ; if ( isVarArgs ) { setTypeForSingleVariableDeclaration ( variableDecl , type , extraDimensions + <NUM_LIT:1> ) ; if ( extraDimensions != <NUM_LIT:0> ) { variableDecl . setFlags ( variableDecl . getFlags ( ) | ASTNode . MALFORMED ) ; } } else { setTypeForSingleVariableDeclaration ( variableDecl , type , extraDimensions ) ; } variableDecl . setSourceRange ( argument . declarationSourceStart , rightEnd - argument . declarationSourceStart + <NUM_LIT:1> ) ; if ( isVarArgs ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : variableDecl . setFlags ( variableDecl . getFlags ( ) | ASTNode . MALFORMED ) ; break ; default : variableDecl . setVarargs ( true ) ; } } if ( this . resolveBindings ) { recordNodes ( name , argument ) ; recordNodes ( variableDecl , argument ) ; variableDecl . resolveBinding ( ) ; } return variableDecl ; } public Annotation convert ( org . eclipse . jdt . internal . compiler . ast . Annotation annotation ) { if ( annotation instanceof org . eclipse . jdt . internal . compiler . ast . SingleMemberAnnotation ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . SingleMemberAnnotation ) annotation ) ; } else if ( annotation instanceof org . eclipse . jdt . internal . compiler . ast . MarkerAnnotation ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . MarkerAnnotation ) annotation ) ; } else { return convert ( ( org . eclipse . jdt . internal . compiler . ast . NormalAnnotation ) annotation ) ; } } public ArrayCreation convert ( org . eclipse . jdt . internal . compiler . ast . ArrayAllocationExpression expression ) { ArrayCreation arrayCreation = new ArrayCreation ( this . ast ) ; if ( this . resolveBindings ) { recordNodes ( arrayCreation , expression ) ; } arrayCreation . setSourceRange ( expression . sourceStart , expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ) ; org . eclipse . jdt . internal . compiler . ast . Expression [ ] dimensions = expression . dimensions ; int dimensionsLength = dimensions . length ; for ( int i = <NUM_LIT:0> ; i < dimensionsLength ; i ++ ) { if ( dimensions [ i ] != null ) { Expression dimension = convert ( dimensions [ i ] ) ; if ( this . resolveBindings ) { recordNodes ( dimension , dimensions [ i ] ) ; } arrayCreation . dimensions ( ) . add ( dimension ) ; } } Type type = convertType ( expression . type ) ; if ( this . resolveBindings ) { recordNodes ( type , expression . type ) ; } ArrayType arrayType = null ; if ( type . isArrayType ( ) ) { arrayType = ( ArrayType ) type ; } else { arrayType = this . ast . newArrayType ( type , dimensionsLength ) ; if ( this . resolveBindings ) { completeRecord ( arrayType , expression ) ; } int start = type . getStartPosition ( ) ; int end = type . getStartPosition ( ) + type . getLength ( ) ; int previousSearchStart = end - <NUM_LIT:1> ; ArrayType componentType = ( ArrayType ) type . getParent ( ) ; for ( int i = <NUM_LIT:0> ; i < dimensionsLength ; i ++ ) { previousSearchStart = retrieveRightBracketPosition ( previousSearchStart + <NUM_LIT:1> , this . compilationUnitSourceLength ) ; componentType . setSourceRange ( start , previousSearchStart - start + <NUM_LIT:1> ) ; componentType = ( ArrayType ) componentType . getParent ( ) ; } } arrayCreation . setType ( arrayType ) ; if ( this . resolveBindings ) { recordNodes ( arrayType , expression ) ; } if ( expression . initializer != null ) { arrayCreation . setInitializer ( convert ( expression . initializer ) ) ; } return arrayCreation ; } public ArrayInitializer convert ( org . eclipse . jdt . internal . compiler . ast . ArrayInitializer expression ) { ArrayInitializer arrayInitializer = new ArrayInitializer ( this . ast ) ; if ( this . resolveBindings ) { recordNodes ( arrayInitializer , expression ) ; } arrayInitializer . setSourceRange ( expression . sourceStart , expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ) ; org . eclipse . jdt . internal . compiler . ast . Expression [ ] expressions = expression . expressions ; if ( expressions != null ) { int length = expressions . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { Expression expr = convert ( expressions [ i ] ) ; if ( this . resolveBindings ) { recordNodes ( expr , expressions [ i ] ) ; } arrayInitializer . expressions ( ) . add ( expr ) ; } } return arrayInitializer ; } public ArrayAccess convert ( org . eclipse . jdt . internal . compiler . ast . ArrayReference reference ) { ArrayAccess arrayAccess = new ArrayAccess ( this . ast ) ; if ( this . resolveBindings ) { recordNodes ( arrayAccess , reference ) ; } arrayAccess . setSourceRange ( reference . sourceStart , reference . sourceEnd - reference . sourceStart + <NUM_LIT:1> ) ; arrayAccess . setArray ( convert ( reference . receiver ) ) ; arrayAccess . setIndex ( convert ( reference . position ) ) ; return arrayAccess ; } public AssertStatement convert ( org . eclipse . jdt . internal . compiler . ast . AssertStatement statement ) { AssertStatement assertStatement = new AssertStatement ( this . ast ) ; final Expression assertExpression = convert ( statement . assertExpression ) ; Expression searchingNode = assertExpression ; assertStatement . setExpression ( assertExpression ) ; org . eclipse . jdt . internal . compiler . ast . Expression exceptionArgument = statement . exceptionArgument ; if ( exceptionArgument != null ) { final Expression exceptionMessage = convert ( exceptionArgument ) ; assertStatement . setMessage ( exceptionMessage ) ; searchingNode = exceptionMessage ; } int start = statement . sourceStart ; int sourceEnd = retrieveSemiColonPosition ( searchingNode ) ; if ( sourceEnd == - <NUM_LIT:1> ) { sourceEnd = searchingNode . getStartPosition ( ) + searchingNode . getLength ( ) - <NUM_LIT:1> ; assertStatement . setSourceRange ( start , sourceEnd - start + <NUM_LIT:1> ) ; } else { assertStatement . setSourceRange ( start , sourceEnd - start + <NUM_LIT:1> ) ; } return assertStatement ; } public Assignment convert ( org . eclipse . jdt . internal . compiler . ast . Assignment expression ) { Assignment assignment = new Assignment ( this . ast ) ; if ( this . resolveBindings ) { recordNodes ( assignment , expression ) ; } Expression lhs = convert ( expression . lhs ) ; assignment . setLeftHandSide ( lhs ) ; assignment . setOperator ( Assignment . Operator . ASSIGN ) ; Expression rightHandSide = convert ( expression . expression ) ; assignment . setRightHandSide ( rightHandSide ) ; int start = lhs . getStartPosition ( ) ; int end = rightHandSide . getStartPosition ( ) + rightHandSide . getLength ( ) - <NUM_LIT:1> ; assignment . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; return assignment ; } public TypeDeclaration convert ( org . eclipse . jdt . internal . compiler . ast . ASTNode [ ] nodes ) { final TypeDeclaration typeDecl = new TypeDeclaration ( this . ast ) ; typeDecl . setInterface ( false ) ; int nodesLength = nodes . length ; for ( int i = <NUM_LIT:0> ; i < nodesLength ; i ++ ) { org . eclipse . jdt . internal . compiler . ast . ASTNode node = nodes [ i ] ; if ( node instanceof org . eclipse . jdt . internal . compiler . ast . Initializer ) { org . eclipse . jdt . internal . compiler . ast . Initializer oldInitializer = ( org . eclipse . jdt . internal . compiler . ast . Initializer ) node ; Initializer initializer = new Initializer ( this . ast ) ; initializer . setBody ( convert ( oldInitializer . block ) ) ; setModifiers ( initializer , oldInitializer ) ; initializer . setSourceRange ( oldInitializer . declarationSourceStart , oldInitializer . sourceEnd - oldInitializer . declarationSourceStart + <NUM_LIT:1> ) ; convert ( oldInitializer . javadoc , initializer ) ; typeDecl . bodyDeclarations ( ) . add ( initializer ) ; } else if ( node instanceof org . eclipse . jdt . internal . compiler . ast . FieldDeclaration ) { org . eclipse . jdt . internal . compiler . ast . FieldDeclaration fieldDeclaration = ( org . eclipse . jdt . internal . compiler . ast . FieldDeclaration ) node ; if ( i > <NUM_LIT:0> && ( nodes [ i - <NUM_LIT:1> ] instanceof org . eclipse . jdt . internal . compiler . ast . FieldDeclaration ) && ( ( org . eclipse . jdt . internal . compiler . ast . FieldDeclaration ) nodes [ i - <NUM_LIT:1> ] ) . declarationSourceStart == fieldDeclaration . declarationSourceStart ) { FieldDeclaration currentFieldDeclaration = ( FieldDeclaration ) typeDecl . bodyDeclarations ( ) . get ( typeDecl . bodyDeclarations ( ) . size ( ) - <NUM_LIT:1> ) ; currentFieldDeclaration . fragments ( ) . add ( convertToVariableDeclarationFragment ( fieldDeclaration ) ) ; } else { typeDecl . bodyDeclarations ( ) . add ( convertToFieldDeclaration ( fieldDeclaration ) ) ; } } else if ( node instanceof org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration ) { AbstractMethodDeclaration nextMethodDeclaration = ( AbstractMethodDeclaration ) node ; if ( ! nextMethodDeclaration . isDefaultConstructor ( ) && ! nextMethodDeclaration . isClinit ( ) ) { typeDecl . bodyDeclarations ( ) . add ( convert ( false , nextMethodDeclaration ) ) ; } } else if ( node instanceof org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) { org . eclipse . jdt . internal . compiler . ast . TypeDeclaration nextMemberDeclaration = ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) node ; ASTNode nextMemberDeclarationNode = convert ( nextMemberDeclaration ) ; if ( nextMemberDeclarationNode == null ) { typeDecl . setFlags ( typeDecl . getFlags ( ) | ASTNode . MALFORMED ) ; } else { typeDecl . bodyDeclarations ( ) . add ( nextMemberDeclarationNode ) ; } } } return typeDecl ; } public Expression convert ( org . eclipse . jdt . internal . compiler . ast . BinaryExpression expression ) { InfixExpression infixExpression = new InfixExpression ( this . ast ) ; if ( this . resolveBindings ) { this . recordNodes ( infixExpression , expression ) ; } int expressionOperatorID = ( expression . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorMASK ) > > org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorSHIFT ; infixExpression . setOperator ( getOperatorFor ( expressionOperatorID ) ) ; if ( expression . left instanceof org . eclipse . jdt . internal . compiler . ast . BinaryExpression && ( ( expression . left . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . ParenthesizedMASK ) == <NUM_LIT:0> ) ) { infixExpression . extendedOperands ( ) . add ( convert ( expression . right ) ) ; org . eclipse . jdt . internal . compiler . ast . Expression leftOperand = expression . left ; org . eclipse . jdt . internal . compiler . ast . Expression rightOperand = null ; do { rightOperand = ( ( org . eclipse . jdt . internal . compiler . ast . BinaryExpression ) leftOperand ) . right ; if ( ( ( ( leftOperand . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorMASK ) > > org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorSHIFT ) != expressionOperatorID && ( ( leftOperand . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . ParenthesizedMASK ) == <NUM_LIT:0> ) ) || ( ( rightOperand instanceof org . eclipse . jdt . internal . compiler . ast . BinaryExpression && ( ( rightOperand . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorMASK ) > > org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorSHIFT ) != expressionOperatorID ) && ( ( rightOperand . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . ParenthesizedMASK ) == <NUM_LIT:0> ) ) ) { List extendedOperands = infixExpression . extendedOperands ( ) ; InfixExpression temp = new InfixExpression ( this . ast ) ; if ( this . resolveBindings ) { this . recordNodes ( temp , expression ) ; } temp . setOperator ( getOperatorFor ( expressionOperatorID ) ) ; Expression leftSide = convert ( leftOperand ) ; temp . setLeftOperand ( leftSide ) ; temp . setSourceRange ( leftSide . getStartPosition ( ) , leftSide . getLength ( ) ) ; int size = extendedOperands . size ( ) ; for ( int i = <NUM_LIT:0> ; i < size - <NUM_LIT:1> ; i ++ ) { Expression expr = temp ; temp = new InfixExpression ( this . ast ) ; if ( this . resolveBindings ) { this . recordNodes ( temp , expression ) ; } temp . setLeftOperand ( expr ) ; temp . setOperator ( getOperatorFor ( expressionOperatorID ) ) ; temp . setSourceRange ( expr . getStartPosition ( ) , expr . getLength ( ) ) ; } infixExpression = temp ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { Expression extendedOperand = ( Expression ) extendedOperands . remove ( size - <NUM_LIT:1> - i ) ; temp . setRightOperand ( extendedOperand ) ; int startPosition = temp . getLeftOperand ( ) . getStartPosition ( ) ; temp . setSourceRange ( startPosition , extendedOperand . getStartPosition ( ) + extendedOperand . getLength ( ) - startPosition ) ; if ( temp . getLeftOperand ( ) . getNodeType ( ) == ASTNode . INFIX_EXPRESSION ) { temp = ( InfixExpression ) temp . getLeftOperand ( ) ; } } int startPosition = infixExpression . getLeftOperand ( ) . getStartPosition ( ) ; infixExpression . setSourceRange ( startPosition , expression . sourceEnd - startPosition + <NUM_LIT:1> ) ; if ( this . resolveBindings ) { this . recordNodes ( infixExpression , expression ) ; } return infixExpression ; } infixExpression . extendedOperands ( ) . add ( <NUM_LIT:0> , convert ( rightOperand ) ) ; leftOperand = ( ( org . eclipse . jdt . internal . compiler . ast . BinaryExpression ) leftOperand ) . left ; } while ( leftOperand instanceof org . eclipse . jdt . internal . compiler . ast . BinaryExpression && ( ( leftOperand . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . ParenthesizedMASK ) == <NUM_LIT:0> ) ) ; Expression leftExpression = convert ( leftOperand ) ; infixExpression . setLeftOperand ( leftExpression ) ; infixExpression . setRightOperand ( ( Expression ) infixExpression . extendedOperands ( ) . remove ( <NUM_LIT:0> ) ) ; int startPosition = leftExpression . getStartPosition ( ) ; infixExpression . setSourceRange ( startPosition , expression . sourceEnd - startPosition + <NUM_LIT:1> ) ; return infixExpression ; } else if ( expression . left instanceof StringLiteralConcatenation && ( ( expression . left . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . ParenthesizedMASK ) == <NUM_LIT:0> ) && ( OperatorIds . PLUS == expressionOperatorID ) ) { StringLiteralConcatenation literal = ( StringLiteralConcatenation ) expression . left ; final org . eclipse . jdt . internal . compiler . ast . Expression [ ] stringLiterals = literal . literals ; infixExpression . setLeftOperand ( convert ( stringLiterals [ <NUM_LIT:0> ] ) ) ; infixExpression . setRightOperand ( convert ( stringLiterals [ <NUM_LIT:1> ] ) ) ; for ( int i = <NUM_LIT:2> ; i < literal . counter ; i ++ ) { infixExpression . extendedOperands ( ) . add ( convert ( stringLiterals [ i ] ) ) ; } infixExpression . extendedOperands ( ) . add ( convert ( expression . right ) ) ; int startPosition = literal . sourceStart ; infixExpression . setSourceRange ( startPosition , expression . sourceEnd - startPosition + <NUM_LIT:1> ) ; return infixExpression ; } Expression leftExpression = convert ( expression . left ) ; infixExpression . setLeftOperand ( leftExpression ) ; infixExpression . setRightOperand ( convert ( expression . right ) ) ; int startPosition = leftExpression . getStartPosition ( ) ; infixExpression . setSourceRange ( startPosition , expression . sourceEnd - startPosition + <NUM_LIT:1> ) ; return infixExpression ; } public Block convert ( org . eclipse . jdt . internal . compiler . ast . Block statement ) { Block block = new Block ( this . ast ) ; if ( statement . sourceEnd > <NUM_LIT:0> ) { block . setSourceRange ( statement . sourceStart , statement . sourceEnd - statement . sourceStart + <NUM_LIT:1> ) ; } org . eclipse . jdt . internal . compiler . ast . Statement [ ] statements = statement . 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 ) { checkAndAddMultipleLocalDeclaration ( statements , i , block . statements ( ) ) ; } else { Statement statement2 = convert ( statements [ i ] ) ; if ( statement2 != null ) { block . statements ( ) . add ( statement2 ) ; } } } } return block ; } public BreakStatement convert ( org . eclipse . jdt . internal . compiler . ast . BreakStatement statement ) { BreakStatement breakStatement = new BreakStatement ( this . ast ) ; breakStatement . setSourceRange ( statement . sourceStart , statement . sourceEnd - statement . sourceStart + <NUM_LIT:1> ) ; if ( statement . label != null ) { final SimpleName name = new SimpleName ( this . ast ) ; name . internalSetIdentifier ( new String ( statement . label ) ) ; retrieveIdentifierAndSetPositions ( statement . sourceStart , statement . sourceEnd , name ) ; breakStatement . setLabel ( name ) ; } return breakStatement ; } public SwitchCase convert ( org . eclipse . jdt . internal . compiler . ast . CaseStatement statement ) { SwitchCase switchCase = new SwitchCase ( this . ast ) ; org . eclipse . jdt . internal . compiler . ast . Expression constantExpression = statement . constantExpression ; if ( constantExpression == null ) { switchCase . setExpression ( null ) ; } else { switchCase . setExpression ( convert ( constantExpression ) ) ; } switchCase . setSourceRange ( statement . sourceStart , statement . sourceEnd - statement . sourceStart + <NUM_LIT:1> ) ; retrieveColonPosition ( switchCase ) ; return switchCase ; } public CastExpression convert ( org . eclipse . jdt . internal . compiler . ast . CastExpression expression ) { CastExpression castExpression = new CastExpression ( this . ast ) ; castExpression . setSourceRange ( expression . sourceStart , expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ) ; TypeReference type = expression . type ; trimWhiteSpacesAndComments ( type ) ; castExpression . setType ( convertType ( type ) ) ; castExpression . setExpression ( convert ( expression . expression ) ) ; if ( this . resolveBindings ) { recordNodes ( castExpression , expression ) ; } return castExpression ; } public CharacterLiteral convert ( org . eclipse . jdt . internal . compiler . ast . CharLiteral expression ) { int length = expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ; int sourceStart = expression . sourceStart ; CharacterLiteral literal = new CharacterLiteral ( this . ast ) ; if ( this . resolveBindings ) { this . recordNodes ( literal , expression ) ; } literal . internalSetEscapedValue ( new String ( this . compilationUnitSource , sourceStart , length ) ) ; literal . setSourceRange ( sourceStart , length ) ; removeLeadingAndTrailingCommentsFromLiteral ( literal ) ; return literal ; } public Expression convert ( org . eclipse . jdt . internal . compiler . ast . ClassLiteralAccess expression ) { TypeLiteral typeLiteral = new TypeLiteral ( this . ast ) ; if ( this . resolveBindings ) { this . recordNodes ( typeLiteral , expression ) ; } typeLiteral . setSourceRange ( expression . sourceStart , expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ) ; typeLiteral . setType ( convertType ( expression . type ) ) ; return typeLiteral ; } public CompilationUnit convert ( org . eclipse . jdt . internal . compiler . ast . CompilationUnitDeclaration unit , char [ ] source ) { try { if ( unit . compilationResult . recoveryScannerData != null ) { RecoveryScanner recoveryScanner = new RecoveryScanner ( this . scanner , unit . compilationResult . recoveryScannerData . removeUnused ( ) ) ; this . scanner = recoveryScanner ; this . docParser . scanner = this . scanner ; } this . compilationUnitSource = source ; this . compilationUnitSourceLength = source . length ; this . scanner . setSource ( source , unit . compilationResult ) ; CompilationUnit compilationUnit = unit . getSpecialDomCompilationUnit ( this . ast ) ; if ( compilationUnit == null ) { compilationUnit = new CompilationUnit ( this . ast ) ; } compilationUnit . setStatementsRecoveryData ( unit . compilationResult . recoveryScannerData ) ; int [ ] [ ] comments = unit . comments ; if ( comments != null ) { buildCommentsTable ( compilationUnit , comments ) ; } if ( this . resolveBindings ) { recordNodes ( compilationUnit , unit ) ; } if ( unit . currentPackage != null ) { PackageDeclaration packageDeclaration = convertPackage ( unit ) ; compilationUnit . setPackage ( packageDeclaration ) ; } org . eclipse . jdt . internal . compiler . ast . ImportReference [ ] imports = unit . imports ; if ( imports != null ) { int importLength = imports . length ; for ( int i = <NUM_LIT:0> ; i < importLength ; i ++ ) { compilationUnit . imports ( ) . add ( convertImport ( imports [ i ] ) ) ; } } org . eclipse . jdt . internal . compiler . ast . TypeDeclaration [ ] types = unit . types ; if ( types != null ) { int typesLength = types . length ; for ( int i = <NUM_LIT:0> ; i < typesLength ; i ++ ) { org . eclipse . jdt . internal . compiler . ast . TypeDeclaration declaration = types [ i ] ; if ( CharOperation . equals ( declaration . name , TypeConstants . PACKAGE_INFO_NAME ) ) { continue ; } ASTNode type = convert ( declaration ) ; if ( type == null ) { compilationUnit . setFlags ( compilationUnit . getFlags ( ) | ASTNode . MALFORMED ) ; } else { compilationUnit . types ( ) . add ( type ) ; } } } compilationUnit . setSourceRange ( unit . sourceStart , unit . sourceEnd - unit . sourceStart + <NUM_LIT:1> ) ; int problemLength = unit . compilationResult . problemCount ; if ( problemLength != <NUM_LIT:0> ) { CategorizedProblem [ ] resizedProblems = null ; final CategorizedProblem [ ] problems = unit . compilationResult . getProblems ( ) ; final int realProblemLength = problems . length ; if ( realProblemLength == problemLength ) { resizedProblems = problems ; } else { System . arraycopy ( problems , <NUM_LIT:0> , ( resizedProblems = new CategorizedProblem [ realProblemLength ] ) , <NUM_LIT:0> , realProblemLength ) ; } ASTSyntaxErrorPropagator syntaxErrorPropagator = new ASTSyntaxErrorPropagator ( resizedProblems ) ; compilationUnit . accept ( syntaxErrorPropagator ) ; ASTRecoveryPropagator recoveryPropagator = new ASTRecoveryPropagator ( resizedProblems , unit . compilationResult . recoveryScannerData ) ; compilationUnit . accept ( recoveryPropagator ) ; compilationUnit . setProblems ( resizedProblems ) ; } if ( this . resolveBindings ) { lookupForScopes ( ) ; } compilationUnit . initCommentMapper ( this . scanner ) ; return compilationUnit ; } catch ( IllegalArgumentException e ) { StringBuffer message = new StringBuffer ( "<STR_LIT>" ) ; String lineDelimiter = Util . findLineSeparator ( source ) ; if ( lineDelimiter == null ) lineDelimiter = System . getProperty ( "<STR_LIT>" ) ; message . append ( lineDelimiter ) ; message . append ( "<STR_LIT>" ) ; message . append ( lineDelimiter ) ; message . append ( source ) ; message . append ( lineDelimiter ) ; message . append ( "<STR_LIT>" ) ; Util . log ( e , message . toString ( ) ) ; throw e ; } } public Assignment convert ( org . eclipse . jdt . internal . compiler . ast . CompoundAssignment expression ) { Assignment assignment = new Assignment ( this . ast ) ; Expression lhs = convert ( expression . lhs ) ; assignment . setLeftHandSide ( lhs ) ; int start = lhs . getStartPosition ( ) ; assignment . setSourceRange ( start , expression . sourceEnd - start + <NUM_LIT:1> ) ; switch ( expression . operator ) { case org . eclipse . jdt . internal . compiler . ast . OperatorIds . PLUS : assignment . setOperator ( Assignment . Operator . PLUS_ASSIGN ) ; break ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . MINUS : assignment . setOperator ( Assignment . Operator . MINUS_ASSIGN ) ; break ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . MULTIPLY : assignment . setOperator ( Assignment . Operator . TIMES_ASSIGN ) ; break ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . DIVIDE : assignment . setOperator ( Assignment . Operator . DIVIDE_ASSIGN ) ; break ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . AND : assignment . setOperator ( Assignment . Operator . BIT_AND_ASSIGN ) ; break ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . OR : assignment . setOperator ( Assignment . Operator . BIT_OR_ASSIGN ) ; break ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . XOR : assignment . setOperator ( Assignment . Operator . BIT_XOR_ASSIGN ) ; break ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . REMAINDER : assignment . setOperator ( Assignment . Operator . REMAINDER_ASSIGN ) ; break ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . LEFT_SHIFT : assignment . setOperator ( Assignment . Operator . LEFT_SHIFT_ASSIGN ) ; break ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . RIGHT_SHIFT : assignment . setOperator ( Assignment . Operator . RIGHT_SHIFT_SIGNED_ASSIGN ) ; break ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . UNSIGNED_RIGHT_SHIFT : assignment . setOperator ( Assignment . Operator . RIGHT_SHIFT_UNSIGNED_ASSIGN ) ; break ; } assignment . setRightHandSide ( convert ( expression . expression ) ) ; if ( this . resolveBindings ) { recordNodes ( assignment , expression ) ; } return assignment ; } public ConditionalExpression convert ( org . eclipse . jdt . internal . compiler . ast . ConditionalExpression expression ) { ConditionalExpression conditionalExpression = new ConditionalExpression ( this . ast ) ; if ( this . resolveBindings ) { recordNodes ( conditionalExpression , expression ) ; } conditionalExpression . setSourceRange ( expression . sourceStart , expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ) ; conditionalExpression . setExpression ( convert ( expression . condition ) ) ; conditionalExpression . setThenExpression ( convert ( expression . valueIfTrue ) ) ; conditionalExpression . setElseExpression ( convert ( expression . valueIfFalse ) ) ; return conditionalExpression ; } public ContinueStatement convert ( org . eclipse . jdt . internal . compiler . ast . ContinueStatement statement ) { ContinueStatement continueStatement = new ContinueStatement ( this . ast ) ; continueStatement . setSourceRange ( statement . sourceStart , statement . sourceEnd - statement . sourceStart + <NUM_LIT:1> ) ; if ( statement . label != null ) { final SimpleName name = new SimpleName ( this . ast ) ; name . internalSetIdentifier ( new String ( statement . label ) ) ; retrieveIdentifierAndSetPositions ( statement . sourceStart , statement . sourceEnd , name ) ; continueStatement . setLabel ( name ) ; } return continueStatement ; } public DoStatement convert ( org . eclipse . jdt . internal . compiler . ast . DoStatement statement ) { DoStatement doStatement = new DoStatement ( this . ast ) ; doStatement . setSourceRange ( statement . sourceStart , statement . sourceEnd - statement . sourceStart + <NUM_LIT:1> ) ; doStatement . setExpression ( convert ( statement . condition ) ) ; final Statement action = convert ( statement . action ) ; if ( action == null ) return null ; doStatement . setBody ( action ) ; return doStatement ; } public NumberLiteral convert ( org . eclipse . jdt . internal . compiler . ast . DoubleLiteral expression ) { int length = expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ; int sourceStart = expression . sourceStart ; NumberLiteral literal = new NumberLiteral ( this . ast ) ; literal . internalSetToken ( new String ( this . compilationUnitSource , sourceStart , length ) ) ; if ( this . resolveBindings ) { this . recordNodes ( literal , expression ) ; } literal . setSourceRange ( sourceStart , length ) ; removeLeadingAndTrailingCommentsFromLiteral ( literal ) ; return literal ; } public EmptyStatement convert ( org . eclipse . jdt . internal . compiler . ast . EmptyStatement statement ) { EmptyStatement emptyStatement = new EmptyStatement ( this . ast ) ; emptyStatement . setSourceRange ( statement . sourceStart , statement . sourceEnd - statement . sourceStart + <NUM_LIT:1> ) ; return emptyStatement ; } public EnumConstantDeclaration convert ( org . eclipse . jdt . internal . compiler . ast . FieldDeclaration enumConstant ) { checkCanceled ( ) ; EnumConstantDeclaration enumConstantDeclaration = new EnumConstantDeclaration ( this . ast ) ; final SimpleName typeName = new SimpleName ( this . ast ) ; typeName . internalSetIdentifier ( new String ( enumConstant . name ) ) ; typeName . setSourceRange ( enumConstant . sourceStart , enumConstant . sourceEnd - enumConstant . sourceStart + <NUM_LIT:1> ) ; enumConstantDeclaration . setName ( typeName ) ; int declarationSourceStart = enumConstant . declarationSourceStart ; int declarationSourceEnd = enumConstant . declarationSourceEnd ; final org . eclipse . jdt . internal . compiler . ast . Expression initialization = enumConstant . initialization ; if ( initialization != null ) { if ( initialization instanceof QualifiedAllocationExpression ) { org . eclipse . jdt . internal . compiler . ast . TypeDeclaration anonymousType = ( ( QualifiedAllocationExpression ) initialization ) . anonymousType ; if ( anonymousType != null ) { AnonymousClassDeclaration anonymousClassDeclaration = new AnonymousClassDeclaration ( this . ast ) ; int start = retrieveStartBlockPosition ( anonymousType . sourceEnd , anonymousType . bodyEnd ) ; int end = retrieveRightBrace ( anonymousType . bodyEnd , declarationSourceEnd ) ; if ( end == - <NUM_LIT:1> ) end = anonymousType . bodyEnd ; anonymousClassDeclaration . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; enumConstantDeclaration . setAnonymousClassDeclaration ( anonymousClassDeclaration ) ; buildBodyDeclarations ( anonymousType , anonymousClassDeclaration ) ; if ( this . resolveBindings ) { recordNodes ( anonymousClassDeclaration , anonymousType ) ; anonymousClassDeclaration . resolveBinding ( ) ; } enumConstantDeclaration . setSourceRange ( declarationSourceStart , end - declarationSourceStart + <NUM_LIT:1> ) ; } } else { enumConstantDeclaration . setSourceRange ( declarationSourceStart , declarationSourceEnd - declarationSourceStart + <NUM_LIT:1> ) ; } final org . eclipse . jdt . internal . compiler . ast . Expression [ ] arguments = ( ( org . eclipse . jdt . internal . compiler . ast . AllocationExpression ) initialization ) . arguments ; if ( arguments != null ) { for ( int i = <NUM_LIT:0> , max = arguments . length ; i < max ; i ++ ) { enumConstantDeclaration . arguments ( ) . add ( convert ( arguments [ i ] ) ) ; } } } else { enumConstantDeclaration . setSourceRange ( declarationSourceStart , declarationSourceEnd - declarationSourceStart + <NUM_LIT:1> ) ; } setModifiers ( enumConstantDeclaration , enumConstant ) ; if ( this . resolveBindings ) { recordNodes ( enumConstantDeclaration , enumConstant ) ; recordNodes ( typeName , enumConstant ) ; enumConstantDeclaration . resolveVariable ( ) ; } convert ( enumConstant . javadoc , enumConstantDeclaration ) ; return enumConstantDeclaration ; } public Expression convert ( org . eclipse . jdt . internal . compiler . ast . EqualExpression expression ) { InfixExpression infixExpression = new InfixExpression ( this . ast ) ; if ( this . resolveBindings ) { recordNodes ( infixExpression , expression ) ; } Expression leftExpression = convert ( expression . left ) ; infixExpression . setLeftOperand ( leftExpression ) ; infixExpression . setRightOperand ( convert ( expression . right ) ) ; int startPosition = leftExpression . getStartPosition ( ) ; infixExpression . setSourceRange ( startPosition , expression . sourceEnd - startPosition + <NUM_LIT:1> ) ; switch ( ( expression . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorMASK ) > > org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorSHIFT ) { case org . eclipse . jdt . internal . compiler . ast . OperatorIds . EQUAL_EQUAL : infixExpression . setOperator ( InfixExpression . Operator . EQUALS ) ; break ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . NOT_EQUAL : infixExpression . setOperator ( InfixExpression . Operator . NOT_EQUALS ) ; } return infixExpression ; } public Statement convert ( org . eclipse . jdt . internal . compiler . ast . ExplicitConstructorCall statement ) { Statement newStatement ; int sourceStart = statement . sourceStart ; if ( statement . isSuperAccess ( ) || statement . isSuper ( ) ) { SuperConstructorInvocation superConstructorInvocation = new SuperConstructorInvocation ( this . ast ) ; if ( statement . qualification != null ) { superConstructorInvocation . setExpression ( convert ( statement . qualification ) ) ; } org . eclipse . jdt . internal . compiler . ast . Expression [ ] arguments = statement . arguments ; if ( arguments != null ) { int length = arguments . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { superConstructorInvocation . arguments ( ) . add ( convert ( arguments [ i ] ) ) ; } } if ( statement . typeArguments != null ) { if ( sourceStart > statement . typeArgumentsSourceStart ) { sourceStart = statement . typeArgumentsSourceStart ; } switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : superConstructorInvocation . setFlags ( superConstructorInvocation . getFlags ( ) | ASTNode . MALFORMED ) ; break ; default : for ( int i = <NUM_LIT:0> , max = statement . typeArguments . length ; i < max ; i ++ ) { superConstructorInvocation . typeArguments ( ) . add ( convertType ( statement . typeArguments [ i ] ) ) ; } break ; } } newStatement = superConstructorInvocation ; } else { ConstructorInvocation constructorInvocation = new ConstructorInvocation ( this . ast ) ; org . eclipse . jdt . internal . compiler . ast . Expression [ ] arguments = statement . arguments ; if ( arguments != null ) { int length = arguments . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { constructorInvocation . arguments ( ) . add ( convert ( arguments [ i ] ) ) ; } } if ( statement . typeArguments != null ) { if ( sourceStart > statement . typeArgumentsSourceStart ) { sourceStart = statement . typeArgumentsSourceStart ; } switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : constructorInvocation . setFlags ( constructorInvocation . getFlags ( ) | ASTNode . MALFORMED ) ; break ; default : for ( int i = <NUM_LIT:0> , max = statement . typeArguments . length ; i < max ; i ++ ) { constructorInvocation . typeArguments ( ) . add ( convertType ( statement . typeArguments [ i ] ) ) ; } break ; } } if ( statement . qualification != null ) { constructorInvocation . setFlags ( constructorInvocation . getFlags ( ) | ASTNode . MALFORMED ) ; } newStatement = constructorInvocation ; } newStatement . setSourceRange ( sourceStart , statement . sourceEnd - sourceStart + <NUM_LIT:1> ) ; if ( this . resolveBindings ) { recordNodes ( newStatement , statement ) ; } return newStatement ; } public Expression convert ( org . eclipse . jdt . internal . compiler . ast . Expression expression ) { if ( ( expression . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . ParenthesizedMASK ) != <NUM_LIT:0> ) { return convertToParenthesizedExpression ( expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . Annotation ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . Annotation ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . CastExpression ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . CastExpression ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . ArrayAllocationExpression ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . ArrayAllocationExpression ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . QualifiedAllocationExpression ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . QualifiedAllocationExpression ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . AllocationExpression ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . AllocationExpression ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . ArrayInitializer ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . ArrayInitializer ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . PrefixExpression ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . PrefixExpression ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . PostfixExpression ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . PostfixExpression ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . CompoundAssignment ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . CompoundAssignment ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . Assignment ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . Assignment ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . ClassLiteralAccess ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . ClassLiteralAccess ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . FalseLiteral ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . FalseLiteral ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . TrueLiteral ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . TrueLiteral ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . NullLiteral ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . NullLiteral ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . CharLiteral ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . CharLiteral ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . DoubleLiteral ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . DoubleLiteral ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . FloatLiteral ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . FloatLiteral ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . IntLiteralMinValue ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . IntLiteralMinValue ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . IntLiteral ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . IntLiteral ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . LongLiteralMinValue ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . LongLiteralMinValue ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . LongLiteral ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . LongLiteral ) expression ) ; } if ( expression instanceof StringLiteralConcatenation ) { return convert ( ( StringLiteralConcatenation ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . ExtendedStringLiteral ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . ExtendedStringLiteral ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . StringLiteral ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . StringLiteral ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . AND_AND_Expression ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . AND_AND_Expression ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . OR_OR_Expression ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . OR_OR_Expression ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . EqualExpression ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . EqualExpression ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . BinaryExpression ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . BinaryExpression ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . InstanceOfExpression ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . InstanceOfExpression ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . UnaryExpression ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . UnaryExpression ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . ConditionalExpression ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . ConditionalExpression ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . MessageSend ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . MessageSend ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . Reference ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . Reference ) expression ) ; } if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . TypeReference ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . TypeReference ) expression ) ; } return null ; } public StringLiteral convert ( org . eclipse . jdt . internal . compiler . ast . ExtendedStringLiteral expression ) { expression . computeConstant ( ) ; StringLiteral literal = new StringLiteral ( this . ast ) ; if ( this . resolveBindings ) { this . recordNodes ( literal , expression ) ; } literal . setLiteralValue ( expression . constant . stringValue ( ) ) ; literal . setSourceRange ( expression . sourceStart , expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ) ; return literal ; } public BooleanLiteral convert ( org . eclipse . jdt . internal . compiler . ast . FalseLiteral expression ) { final BooleanLiteral literal = new BooleanLiteral ( this . ast ) ; literal . setBooleanValue ( false ) ; if ( this . resolveBindings ) { this . recordNodes ( literal , expression ) ; } literal . setSourceRange ( expression . sourceStart , expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ) ; return literal ; } public Expression convert ( org . eclipse . jdt . internal . compiler . ast . FieldReference reference ) { if ( reference . receiver . isSuper ( ) ) { final SuperFieldAccess superFieldAccess = new SuperFieldAccess ( this . ast ) ; if ( this . resolveBindings ) { recordNodes ( superFieldAccess , reference ) ; } if ( reference . receiver instanceof org . eclipse . jdt . internal . compiler . ast . QualifiedSuperReference ) { Name qualifier = convert ( ( org . eclipse . jdt . internal . compiler . ast . QualifiedSuperReference ) reference . receiver ) ; superFieldAccess . setQualifier ( qualifier ) ; if ( this . resolveBindings ) { recordNodes ( qualifier , reference . receiver ) ; } } final SimpleName simpleName = new SimpleName ( this . ast ) ; simpleName . internalSetIdentifier ( new String ( reference . token ) ) ; int sourceStart = ( int ) ( reference . nameSourcePosition > > > <NUM_LIT:32> ) ; int length = ( int ) ( reference . nameSourcePosition & <NUM_LIT> ) - sourceStart + <NUM_LIT:1> ; simpleName . setSourceRange ( sourceStart , length ) ; superFieldAccess . setName ( simpleName ) ; if ( this . resolveBindings ) { recordNodes ( simpleName , reference ) ; } superFieldAccess . setSourceRange ( reference . receiver . sourceStart , reference . sourceEnd - reference . receiver . sourceStart + <NUM_LIT:1> ) ; return superFieldAccess ; } else { final FieldAccess fieldAccess = new FieldAccess ( this . ast ) ; if ( this . resolveBindings ) { recordNodes ( fieldAccess , reference ) ; } Expression receiver = convert ( reference . receiver ) ; fieldAccess . setExpression ( receiver ) ; final SimpleName simpleName = new SimpleName ( this . ast ) ; simpleName . internalSetIdentifier ( new String ( reference . token ) ) ; int sourceStart = ( int ) ( reference . nameSourcePosition > > > <NUM_LIT:32> ) ; int length = ( int ) ( reference . nameSourcePosition & <NUM_LIT> ) - sourceStart + <NUM_LIT:1> ; simpleName . setSourceRange ( sourceStart , length ) ; fieldAccess . setName ( simpleName ) ; if ( this . resolveBindings ) { recordNodes ( simpleName , reference ) ; } fieldAccess . setSourceRange ( receiver . getStartPosition ( ) , reference . sourceEnd - receiver . getStartPosition ( ) + <NUM_LIT:1> ) ; return fieldAccess ; } } public NumberLiteral convert ( org . eclipse . jdt . internal . compiler . ast . FloatLiteral expression ) { int length = expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ; int sourceStart = expression . sourceStart ; NumberLiteral literal = new NumberLiteral ( this . ast ) ; literal . internalSetToken ( new String ( this . compilationUnitSource , sourceStart , length ) ) ; if ( this . resolveBindings ) { this . recordNodes ( literal , expression ) ; } literal . setSourceRange ( sourceStart , length ) ; removeLeadingAndTrailingCommentsFromLiteral ( literal ) ; return literal ; } public Statement convert ( ForeachStatement statement ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : return createFakeEmptyStatement ( statement ) ; default : EnhancedForStatement enhancedForStatement = new EnhancedForStatement ( this . ast ) ; enhancedForStatement . setParameter ( convertToSingleVariableDeclaration ( statement . elementVariable ) ) ; org . eclipse . jdt . internal . compiler . ast . Expression collection = statement . collection ; if ( collection == null ) return null ; enhancedForStatement . setExpression ( convert ( collection ) ) ; final Statement action = convert ( statement . action ) ; if ( action == null ) return null ; enhancedForStatement . setBody ( action ) ; int start = statement . sourceStart ; int end = statement . sourceEnd ; enhancedForStatement . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; return enhancedForStatement ; } } public ForStatement convert ( org . eclipse . jdt . internal . compiler . ast . ForStatement statement ) { ForStatement forStatement = new ForStatement ( this . ast ) ; forStatement . setSourceRange ( statement . sourceStart , statement . sourceEnd - statement . sourceStart + <NUM_LIT:1> ) ; org . eclipse . jdt . internal . compiler . ast . Statement [ ] initializations = statement . initializations ; if ( initializations != null ) { if ( initializations [ <NUM_LIT:0> ] instanceof org . eclipse . jdt . internal . compiler . ast . LocalDeclaration ) { org . eclipse . jdt . internal . compiler . ast . LocalDeclaration initialization = ( org . eclipse . jdt . internal . compiler . ast . LocalDeclaration ) initializations [ <NUM_LIT:0> ] ; VariableDeclarationExpression variableDeclarationExpression = convertToVariableDeclarationExpression ( initialization ) ; int initializationsLength = initializations . length ; for ( int i = <NUM_LIT:1> ; i < initializationsLength ; i ++ ) { initialization = ( org . eclipse . jdt . internal . compiler . ast . LocalDeclaration ) initializations [ i ] ; variableDeclarationExpression . fragments ( ) . add ( convertToVariableDeclarationFragment ( initialization ) ) ; } if ( initializationsLength != <NUM_LIT:1> ) { int start = variableDeclarationExpression . getStartPosition ( ) ; int end = ( ( org . eclipse . jdt . internal . compiler . ast . LocalDeclaration ) initializations [ initializationsLength - <NUM_LIT:1> ] ) . declarationSourceEnd ; variableDeclarationExpression . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; } forStatement . initializers ( ) . add ( variableDeclarationExpression ) ; } else { int initializationsLength = initializations . length ; for ( int i = <NUM_LIT:0> ; i < initializationsLength ; i ++ ) { Expression initializer = convertToExpression ( initializations [ i ] ) ; if ( initializer != null ) { forStatement . initializers ( ) . add ( initializer ) ; } else { forStatement . setFlags ( forStatement . getFlags ( ) | ASTNode . MALFORMED ) ; } } } } if ( statement . condition != null ) { forStatement . setExpression ( convert ( statement . condition ) ) ; } org . eclipse . jdt . internal . compiler . ast . Statement [ ] increments = statement . increments ; if ( increments != null ) { int incrementsLength = increments . length ; for ( int i = <NUM_LIT:0> ; i < incrementsLength ; i ++ ) { forStatement . updaters ( ) . add ( convertToExpression ( increments [ i ] ) ) ; } } final Statement action = convert ( statement . action ) ; if ( action == null ) return null ; forStatement . setBody ( action ) ; return forStatement ; } public IfStatement convert ( org . eclipse . jdt . internal . compiler . ast . IfStatement statement ) { IfStatement ifStatement = new IfStatement ( this . ast ) ; ifStatement . setSourceRange ( statement . sourceStart , statement . sourceEnd - statement . sourceStart + <NUM_LIT:1> ) ; ifStatement . setExpression ( convert ( statement . condition ) ) ; final Statement thenStatement = convert ( statement . thenStatement ) ; if ( thenStatement == null ) return null ; ifStatement . setThenStatement ( thenStatement ) ; org . eclipse . jdt . internal . compiler . ast . Statement statement2 = statement . elseStatement ; if ( statement2 != null ) { final Statement elseStatement = convert ( statement2 ) ; if ( elseStatement != null ) { ifStatement . setElseStatement ( elseStatement ) ; } } return ifStatement ; } public InstanceofExpression convert ( org . eclipse . jdt . internal . compiler . ast . InstanceOfExpression expression ) { InstanceofExpression instanceOfExpression = new InstanceofExpression ( this . ast ) ; if ( this . resolveBindings ) { recordNodes ( instanceOfExpression , expression ) ; } Expression leftExpression = convert ( expression . expression ) ; instanceOfExpression . setLeftOperand ( leftExpression ) ; final Type convertType = convertType ( expression . type ) ; instanceOfExpression . setRightOperand ( convertType ) ; int startPosition = leftExpression . getStartPosition ( ) ; int sourceEnd = convertType . getStartPosition ( ) + convertType . getLength ( ) - <NUM_LIT:1> ; instanceOfExpression . setSourceRange ( startPosition , sourceEnd - startPosition + <NUM_LIT:1> ) ; return instanceOfExpression ; } public NumberLiteral convert ( org . eclipse . jdt . internal . compiler . ast . IntLiteral expression ) { int length = expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ; int sourceStart = expression . sourceStart ; final NumberLiteral literal = new NumberLiteral ( this . ast ) ; literal . internalSetToken ( new String ( this . compilationUnitSource , sourceStart , length ) ) ; if ( this . resolveBindings ) { this . recordNodes ( literal , expression ) ; } literal . setSourceRange ( sourceStart , length ) ; removeLeadingAndTrailingCommentsFromLiteral ( literal ) ; return literal ; } public NumberLiteral convert ( org . eclipse . jdt . internal . compiler . ast . IntLiteralMinValue expression ) { int length = expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ; int sourceStart = expression . sourceStart ; NumberLiteral literal = new NumberLiteral ( this . ast ) ; literal . internalSetToken ( new String ( this . compilationUnitSource , sourceStart , length ) ) ; if ( this . resolveBindings ) { this . recordNodes ( literal , expression ) ; } literal . setSourceRange ( sourceStart , length ) ; removeLeadingAndTrailingCommentsFromLiteral ( literal ) ; return literal ; } public void convert ( org . eclipse . jdt . internal . compiler . ast . Javadoc javadoc , BodyDeclaration bodyDeclaration ) { if ( bodyDeclaration . getJavadoc ( ) == null ) { if ( javadoc != null ) { if ( this . commentMapper == null || ! this . commentMapper . hasSameTable ( this . commentsTable ) ) { this . commentMapper = new DefaultCommentMapper ( this . commentsTable ) ; } Comment comment = this . commentMapper . getComment ( javadoc . sourceStart ) ; if ( comment != null && comment . isDocComment ( ) && comment . getParent ( ) == null ) { Javadoc docComment = ( Javadoc ) comment ; if ( this . resolveBindings ) { recordNodes ( docComment , javadoc ) ; Iterator tags = docComment . tags ( ) . listIterator ( ) ; while ( tags . hasNext ( ) ) { recordNodes ( javadoc , ( TagElement ) tags . next ( ) ) ; } } bodyDeclaration . setJavadoc ( docComment ) ; } } } } public void convert ( org . eclipse . jdt . internal . compiler . ast . Javadoc javadoc , PackageDeclaration packageDeclaration ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : return ; } if ( packageDeclaration . getJavadoc ( ) == null ) { if ( javadoc != null ) { if ( this . commentMapper == null || ! this . commentMapper . hasSameTable ( this . commentsTable ) ) { this . commentMapper = new DefaultCommentMapper ( this . commentsTable ) ; } Comment comment = this . commentMapper . getComment ( javadoc . sourceStart ) ; if ( comment != null && comment . isDocComment ( ) && comment . getParent ( ) == null ) { Javadoc docComment = ( Javadoc ) comment ; if ( this . resolveBindings ) { recordNodes ( docComment , javadoc ) ; Iterator tags = docComment . tags ( ) . listIterator ( ) ; while ( tags . hasNext ( ) ) { recordNodes ( javadoc , ( TagElement ) tags . next ( ) ) ; } } packageDeclaration . setJavadoc ( docComment ) ; } } } } public LabeledStatement convert ( org . eclipse . jdt . internal . compiler . ast . LabeledStatement statement ) { LabeledStatement labeledStatement = new LabeledStatement ( this . ast ) ; final int sourceStart = statement . sourceStart ; labeledStatement . setSourceRange ( sourceStart , statement . sourceEnd - sourceStart + <NUM_LIT:1> ) ; Statement body = convert ( statement . statement ) ; if ( body == null ) return null ; labeledStatement . setBody ( body ) ; final SimpleName name = new SimpleName ( this . ast ) ; name . internalSetIdentifier ( new String ( statement . label ) ) ; name . setSourceRange ( sourceStart , statement . labelEnd - sourceStart + <NUM_LIT:1> ) ; labeledStatement . setLabel ( name ) ; return labeledStatement ; } public NumberLiteral convert ( org . eclipse . jdt . internal . compiler . ast . LongLiteral expression ) { int length = expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ; int sourceStart = expression . sourceStart ; final NumberLiteral literal = new NumberLiteral ( this . ast ) ; literal . internalSetToken ( new String ( this . compilationUnitSource , sourceStart , length ) ) ; if ( this . resolveBindings ) { this . recordNodes ( literal , expression ) ; } literal . setSourceRange ( sourceStart , length ) ; removeLeadingAndTrailingCommentsFromLiteral ( literal ) ; return literal ; } public NumberLiteral convert ( org . eclipse . jdt . internal . compiler . ast . LongLiteralMinValue expression ) { int length = expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ; int sourceStart = expression . sourceStart ; final NumberLiteral literal = new NumberLiteral ( this . ast ) ; literal . internalSetToken ( new String ( this . compilationUnitSource , sourceStart , length ) ) ; if ( this . resolveBindings ) { this . recordNodes ( literal , expression ) ; } literal . setSourceRange ( sourceStart , length ) ; removeLeadingAndTrailingCommentsFromLiteral ( literal ) ; return literal ; } public Expression convert ( MessageSend expression ) { Expression expr ; int sourceStart = expression . sourceStart ; if ( expression . isSuperAccess ( ) ) { final SuperMethodInvocation superMethodInvocation = new SuperMethodInvocation ( this . ast ) ; if ( this . resolveBindings ) { recordNodes ( superMethodInvocation , expression ) ; } final SimpleName name = new SimpleName ( this . ast ) ; name . internalSetIdentifier ( new String ( expression . selector ) ) ; int nameSourceStart = ( int ) ( expression . nameSourcePosition > > > <NUM_LIT:32> ) ; int nameSourceLength = ( ( int ) expression . nameSourcePosition ) - nameSourceStart + <NUM_LIT:1> ; name . setSourceRange ( nameSourceStart , nameSourceLength ) ; if ( this . resolveBindings ) { recordNodes ( name , expression ) ; } superMethodInvocation . setName ( name ) ; if ( expression . receiver instanceof org . eclipse . jdt . internal . compiler . ast . QualifiedSuperReference ) { Name qualifier = convert ( ( org . eclipse . jdt . internal . compiler . ast . QualifiedSuperReference ) expression . receiver ) ; superMethodInvocation . setQualifier ( qualifier ) ; if ( this . resolveBindings ) { recordNodes ( qualifier , expression . receiver ) ; } if ( qualifier != null ) { sourceStart = qualifier . getStartPosition ( ) ; } } org . eclipse . jdt . internal . compiler . ast . Expression [ ] arguments = expression . arguments ; if ( arguments != null ) { int argumentsLength = arguments . length ; for ( int i = <NUM_LIT:0> ; i < argumentsLength ; i ++ ) { Expression expri = convert ( arguments [ i ] ) ; if ( this . resolveBindings ) { recordNodes ( expri , arguments [ i ] ) ; } superMethodInvocation . arguments ( ) . add ( expri ) ; } } final TypeReference [ ] typeArguments = expression . typeArguments ; if ( typeArguments != null ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : superMethodInvocation . setFlags ( superMethodInvocation . getFlags ( ) | ASTNode . MALFORMED ) ; break ; default : for ( int i = <NUM_LIT:0> , max = typeArguments . length ; i < max ; i ++ ) { superMethodInvocation . typeArguments ( ) . add ( convertType ( typeArguments [ i ] ) ) ; } break ; } } expr = superMethodInvocation ; } else { final MethodInvocation methodInvocation = new MethodInvocation ( this . ast ) ; if ( this . resolveBindings ) { recordNodes ( methodInvocation , expression ) ; } final SimpleName name = new SimpleName ( this . ast ) ; name . internalSetIdentifier ( new String ( expression . selector ) ) ; int nameSourceStart = ( int ) ( expression . nameSourcePosition > > > <NUM_LIT:32> ) ; int nameSourceLength = ( ( int ) expression . nameSourcePosition ) - nameSourceStart + <NUM_LIT:1> ; name . setSourceRange ( nameSourceStart , nameSourceLength ) ; methodInvocation . setName ( name ) ; if ( this . resolveBindings ) { recordNodes ( name , expression ) ; } org . eclipse . jdt . internal . compiler . ast . Expression [ ] arguments = expression . arguments ; if ( arguments != null ) { int argumentsLength = arguments . length ; for ( int i = <NUM_LIT:0> ; i < argumentsLength ; i ++ ) { Expression expri = convert ( arguments [ i ] ) ; if ( this . resolveBindings ) { recordNodes ( expri , arguments [ i ] ) ; } methodInvocation . arguments ( ) . add ( expri ) ; } } Expression qualifier = null ; org . eclipse . jdt . internal . compiler . ast . Expression receiver = expression . receiver ; if ( receiver instanceof MessageSend ) { if ( ( receiver . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . ParenthesizedMASK ) != <NUM_LIT:0> ) { qualifier = convertToParenthesizedExpression ( receiver ) ; } else { qualifier = convert ( ( MessageSend ) receiver ) ; } } else { qualifier = convert ( receiver ) ; } if ( qualifier instanceof Name && this . resolveBindings ) { recordNodes ( qualifier , receiver ) ; } methodInvocation . setExpression ( qualifier ) ; if ( qualifier != null ) { sourceStart = qualifier . getStartPosition ( ) ; } final TypeReference [ ] typeArguments = expression . typeArguments ; if ( typeArguments != null ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : methodInvocation . setFlags ( methodInvocation . getFlags ( ) | ASTNode . MALFORMED ) ; break ; default : for ( int i = <NUM_LIT:0> , max = typeArguments . length ; i < max ; i ++ ) { methodInvocation . typeArguments ( ) . add ( convertType ( typeArguments [ i ] ) ) ; } break ; } } expr = methodInvocation ; } expr . setSourceRange ( sourceStart , expression . sourceEnd - sourceStart + <NUM_LIT:1> ) ; return expr ; } public MarkerAnnotation convert ( org . eclipse . jdt . internal . compiler . ast . MarkerAnnotation annotation ) { final MarkerAnnotation markerAnnotation = new MarkerAnnotation ( this . ast ) ; setTypeNameForAnnotation ( annotation , markerAnnotation ) ; int start = annotation . sourceStart ; int end = annotation . declarationSourceEnd ; markerAnnotation . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; if ( this . resolveBindings ) { recordNodes ( markerAnnotation , annotation ) ; markerAnnotation . resolveAnnotationBinding ( ) ; } return markerAnnotation ; } public MemberValuePair convert ( org . eclipse . jdt . internal . compiler . ast . MemberValuePair memberValuePair ) { final MemberValuePair pair = new MemberValuePair ( this . ast ) ; final SimpleName simpleName = new SimpleName ( this . ast ) ; simpleName . internalSetIdentifier ( new String ( memberValuePair . name ) ) ; int start = memberValuePair . sourceStart ; int end = memberValuePair . sourceEnd ; simpleName . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; pair . setName ( simpleName ) ; final Expression value = convert ( memberValuePair . value ) ; pair . setValue ( value ) ; start = memberValuePair . sourceStart ; end = value . getStartPosition ( ) + value . getLength ( ) - <NUM_LIT:1> ; pair . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; if ( memberValuePair . value instanceof SingleNameReference && ( ( SingleNameReference ) memberValuePair . value ) . token == RecoveryScanner . FAKE_IDENTIFIER ) { pair . setFlags ( pair . getFlags ( ) | ASTNode . RECOVERED ) ; } if ( this . resolveBindings ) { recordNodes ( simpleName , memberValuePair ) ; recordNodes ( pair , memberValuePair ) ; } return pair ; } public Name convert ( org . eclipse . jdt . internal . compiler . ast . NameReference reference ) { if ( reference instanceof org . eclipse . jdt . internal . compiler . ast . QualifiedNameReference ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . QualifiedNameReference ) reference ) ; } else { return convert ( ( org . eclipse . jdt . internal . compiler . ast . SingleNameReference ) reference ) ; } } public InfixExpression convert ( StringLiteralConcatenation expression ) { expression . computeConstant ( ) ; final InfixExpression infixExpression = new InfixExpression ( this . ast ) ; infixExpression . setOperator ( InfixExpression . Operator . PLUS ) ; org . eclipse . jdt . internal . compiler . ast . Expression [ ] stringLiterals = expression . literals ; infixExpression . setLeftOperand ( convert ( stringLiterals [ <NUM_LIT:0> ] ) ) ; infixExpression . setRightOperand ( convert ( stringLiterals [ <NUM_LIT:1> ] ) ) ; for ( int i = <NUM_LIT:2> ; i < expression . counter ; i ++ ) { infixExpression . extendedOperands ( ) . add ( convert ( stringLiterals [ i ] ) ) ; } if ( this . resolveBindings ) { this . recordNodes ( infixExpression , expression ) ; } infixExpression . setSourceRange ( expression . sourceStart , expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ) ; return infixExpression ; } public NormalAnnotation convert ( org . eclipse . jdt . internal . compiler . ast . NormalAnnotation annotation ) { final NormalAnnotation normalAnnotation = new NormalAnnotation ( this . ast ) ; setTypeNameForAnnotation ( annotation , normalAnnotation ) ; int start = annotation . sourceStart ; int end = annotation . declarationSourceEnd ; org . eclipse . jdt . internal . compiler . ast . MemberValuePair [ ] memberValuePairs = annotation . memberValuePairs ; if ( memberValuePairs != null ) { for ( int i = <NUM_LIT:0> , max = memberValuePairs . length ; i < max ; i ++ ) { MemberValuePair memberValuePair = convert ( memberValuePairs [ i ] ) ; int memberValuePairEnd = memberValuePair . getStartPosition ( ) + memberValuePair . getLength ( ) - <NUM_LIT:1> ; if ( end == memberValuePairEnd ) { normalAnnotation . setFlags ( normalAnnotation . getFlags ( ) | ASTNode . RECOVERED ) ; } normalAnnotation . values ( ) . add ( memberValuePair ) ; } } normalAnnotation . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; if ( this . resolveBindings ) { recordNodes ( normalAnnotation , annotation ) ; normalAnnotation . resolveAnnotationBinding ( ) ; } return normalAnnotation ; } public NullLiteral convert ( org . eclipse . jdt . internal . compiler . ast . NullLiteral expression ) { final NullLiteral literal = new NullLiteral ( this . ast ) ; if ( this . resolveBindings ) { this . recordNodes ( literal , expression ) ; } literal . setSourceRange ( expression . sourceStart , expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ) ; return literal ; } public Expression convert ( org . eclipse . jdt . internal . compiler . ast . OR_OR_Expression expression ) { InfixExpression infixExpression = new InfixExpression ( this . ast ) ; infixExpression . setOperator ( InfixExpression . Operator . CONDITIONAL_OR ) ; if ( this . resolveBindings ) { this . recordNodes ( infixExpression , expression ) ; } final int expressionOperatorID = ( expression . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorMASK ) > > org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorSHIFT ; if ( expression . left instanceof org . eclipse . jdt . internal . compiler . ast . BinaryExpression && ( ( expression . left . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . ParenthesizedMASK ) == <NUM_LIT:0> ) ) { infixExpression . extendedOperands ( ) . add ( convert ( expression . right ) ) ; org . eclipse . jdt . internal . compiler . ast . Expression leftOperand = expression . left ; org . eclipse . jdt . internal . compiler . ast . Expression rightOperand = null ; do { rightOperand = ( ( org . eclipse . jdt . internal . compiler . ast . BinaryExpression ) leftOperand ) . right ; if ( ( ( ( leftOperand . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorMASK ) > > org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorSHIFT ) != expressionOperatorID && ( ( leftOperand . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . ParenthesizedMASK ) == <NUM_LIT:0> ) ) || ( ( rightOperand instanceof org . eclipse . jdt . internal . compiler . ast . BinaryExpression && ( ( rightOperand . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorMASK ) > > org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorSHIFT ) != expressionOperatorID ) && ( ( rightOperand . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . ParenthesizedMASK ) == <NUM_LIT:0> ) ) ) { List extendedOperands = infixExpression . extendedOperands ( ) ; InfixExpression temp = new InfixExpression ( this . ast ) ; if ( this . resolveBindings ) { this . recordNodes ( temp , expression ) ; } temp . setOperator ( getOperatorFor ( expressionOperatorID ) ) ; Expression leftSide = convert ( leftOperand ) ; temp . setLeftOperand ( leftSide ) ; temp . setSourceRange ( leftSide . getStartPosition ( ) , leftSide . getLength ( ) ) ; int size = extendedOperands . size ( ) ; for ( int i = <NUM_LIT:0> ; i < size - <NUM_LIT:1> ; i ++ ) { Expression expr = temp ; temp = new InfixExpression ( this . ast ) ; if ( this . resolveBindings ) { this . recordNodes ( temp , expression ) ; } temp . setLeftOperand ( expr ) ; temp . setOperator ( getOperatorFor ( expressionOperatorID ) ) ; temp . setSourceRange ( expr . getStartPosition ( ) , expr . getLength ( ) ) ; } infixExpression = temp ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { Expression extendedOperand = ( Expression ) extendedOperands . remove ( size - <NUM_LIT:1> - i ) ; temp . setRightOperand ( extendedOperand ) ; int startPosition = temp . getLeftOperand ( ) . getStartPosition ( ) ; temp . setSourceRange ( startPosition , extendedOperand . getStartPosition ( ) + extendedOperand . getLength ( ) - startPosition ) ; if ( temp . getLeftOperand ( ) . getNodeType ( ) == ASTNode . INFIX_EXPRESSION ) { temp = ( InfixExpression ) temp . getLeftOperand ( ) ; } } int startPosition = infixExpression . getLeftOperand ( ) . getStartPosition ( ) ; infixExpression . setSourceRange ( startPosition , expression . sourceEnd - startPosition + <NUM_LIT:1> ) ; if ( this . resolveBindings ) { this . recordNodes ( infixExpression , expression ) ; } return infixExpression ; } infixExpression . extendedOperands ( ) . add ( <NUM_LIT:0> , convert ( rightOperand ) ) ; leftOperand = ( ( org . eclipse . jdt . internal . compiler . ast . BinaryExpression ) leftOperand ) . left ; } while ( leftOperand instanceof org . eclipse . jdt . internal . compiler . ast . BinaryExpression && ( ( leftOperand . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . ParenthesizedMASK ) == <NUM_LIT:0> ) ) ; Expression leftExpression = convert ( leftOperand ) ; infixExpression . setLeftOperand ( leftExpression ) ; infixExpression . setRightOperand ( ( Expression ) infixExpression . extendedOperands ( ) . remove ( <NUM_LIT:0> ) ) ; int startPosition = leftExpression . getStartPosition ( ) ; infixExpression . setSourceRange ( startPosition , expression . sourceEnd - startPosition + <NUM_LIT:1> ) ; return infixExpression ; } Expression leftExpression = convert ( expression . left ) ; infixExpression . setLeftOperand ( leftExpression ) ; infixExpression . setRightOperand ( convert ( expression . right ) ) ; infixExpression . setOperator ( InfixExpression . Operator . CONDITIONAL_OR ) ; int startPosition = leftExpression . getStartPosition ( ) ; infixExpression . setSourceRange ( startPosition , expression . sourceEnd - startPosition + <NUM_LIT:1> ) ; return infixExpression ; } public PostfixExpression convert ( org . eclipse . jdt . internal . compiler . ast . PostfixExpression expression ) { final PostfixExpression postfixExpression = new PostfixExpression ( this . ast ) ; if ( this . resolveBindings ) { recordNodes ( postfixExpression , expression ) ; } postfixExpression . setSourceRange ( expression . sourceStart , expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ) ; postfixExpression . setOperand ( convert ( expression . lhs ) ) ; switch ( expression . operator ) { case org . eclipse . jdt . internal . compiler . ast . OperatorIds . PLUS : postfixExpression . setOperator ( PostfixExpression . Operator . INCREMENT ) ; break ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . MINUS : postfixExpression . setOperator ( PostfixExpression . Operator . DECREMENT ) ; break ; } return postfixExpression ; } public PrefixExpression convert ( org . eclipse . jdt . internal . compiler . ast . PrefixExpression expression ) { final PrefixExpression prefixExpression = new PrefixExpression ( this . ast ) ; if ( this . resolveBindings ) { recordNodes ( prefixExpression , expression ) ; } prefixExpression . setSourceRange ( expression . sourceStart , expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ) ; prefixExpression . setOperand ( convert ( expression . lhs ) ) ; switch ( expression . operator ) { case org . eclipse . jdt . internal . compiler . ast . OperatorIds . PLUS : prefixExpression . setOperator ( PrefixExpression . Operator . INCREMENT ) ; break ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . MINUS : prefixExpression . setOperator ( PrefixExpression . Operator . DECREMENT ) ; break ; } return prefixExpression ; } public Expression convert ( org . eclipse . jdt . internal . compiler . ast . QualifiedAllocationExpression allocation ) { final ClassInstanceCreation classInstanceCreation = new ClassInstanceCreation ( this . ast ) ; if ( allocation . enclosingInstance != null ) { classInstanceCreation . setExpression ( convert ( allocation . enclosingInstance ) ) ; } switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : classInstanceCreation . internalSetName ( convert ( allocation . type ) ) ; break ; default : classInstanceCreation . setType ( convertType ( allocation . type ) ) ; } org . eclipse . jdt . internal . compiler . ast . Expression [ ] arguments = allocation . arguments ; if ( arguments != null ) { int length = arguments . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { Expression argument = convert ( arguments [ i ] ) ; if ( this . resolveBindings ) { recordNodes ( argument , arguments [ i ] ) ; } classInstanceCreation . arguments ( ) . add ( argument ) ; } } if ( allocation . typeArguments != null ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : classInstanceCreation . setFlags ( classInstanceCreation . getFlags ( ) | ASTNode . MALFORMED ) ; break ; default : for ( int i = <NUM_LIT:0> , max = allocation . typeArguments . length ; i < max ; i ++ ) { classInstanceCreation . typeArguments ( ) . add ( convertType ( allocation . typeArguments [ i ] ) ) ; } } } if ( allocation . anonymousType != null ) { int declarationSourceStart = allocation . sourceStart ; classInstanceCreation . setSourceRange ( declarationSourceStart , allocation . anonymousType . bodyEnd - declarationSourceStart + <NUM_LIT:1> ) ; final AnonymousClassDeclaration anonymousClassDeclaration = new AnonymousClassDeclaration ( this . ast ) ; int start = retrieveStartBlockPosition ( allocation . anonymousType . sourceEnd , allocation . anonymousType . bodyEnd ) ; anonymousClassDeclaration . setSourceRange ( start , allocation . anonymousType . bodyEnd - start + <NUM_LIT:1> ) ; classInstanceCreation . setAnonymousClassDeclaration ( anonymousClassDeclaration ) ; buildBodyDeclarations ( allocation . anonymousType , anonymousClassDeclaration ) ; if ( this . resolveBindings ) { recordNodes ( classInstanceCreation , allocation . anonymousType ) ; recordNodes ( anonymousClassDeclaration , allocation . anonymousType ) ; anonymousClassDeclaration . resolveBinding ( ) ; } return classInstanceCreation ; } else { final int start = allocation . sourceStart ; classInstanceCreation . setSourceRange ( start , allocation . sourceEnd - start + <NUM_LIT:1> ) ; if ( this . resolveBindings ) { recordNodes ( classInstanceCreation , allocation ) ; } return classInstanceCreation ; } } public Name convert ( org . eclipse . jdt . internal . compiler . ast . QualifiedNameReference nameReference ) { return setQualifiedNameNameAndSourceRanges ( nameReference . tokens , nameReference . sourcePositions , nameReference ) ; } public Name convert ( org . eclipse . jdt . internal . compiler . ast . QualifiedSuperReference reference ) { return convert ( reference . qualification ) ; } public ThisExpression convert ( org . eclipse . jdt . internal . compiler . ast . QualifiedThisReference reference ) { final ThisExpression thisExpression = new ThisExpression ( this . ast ) ; thisExpression . setSourceRange ( reference . sourceStart , reference . sourceEnd - reference . sourceStart + <NUM_LIT:1> ) ; thisExpression . setQualifier ( convert ( reference . qualification ) ) ; if ( this . resolveBindings ) { recordNodes ( thisExpression , reference ) ; recordPendingThisExpressionScopeResolution ( thisExpression ) ; } return thisExpression ; } public Expression convert ( org . eclipse . jdt . internal . compiler . ast . Reference reference ) { if ( reference instanceof org . eclipse . jdt . internal . compiler . ast . NameReference ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . NameReference ) reference ) ; } if ( reference instanceof org . eclipse . jdt . internal . compiler . ast . ThisReference ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . ThisReference ) reference ) ; } if ( reference instanceof org . eclipse . jdt . internal . compiler . ast . ArrayReference ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . ArrayReference ) reference ) ; } if ( reference instanceof org . eclipse . jdt . internal . compiler . ast . FieldReference ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . FieldReference ) reference ) ; } return null ; } public ReturnStatement convert ( org . eclipse . jdt . internal . compiler . ast . ReturnStatement statement ) { final ReturnStatement returnStatement = new ReturnStatement ( this . ast ) ; returnStatement . setSourceRange ( statement . sourceStart , statement . sourceEnd - statement . sourceStart + <NUM_LIT:1> ) ; if ( statement . expression != null ) { returnStatement . setExpression ( convert ( statement . expression ) ) ; } return returnStatement ; } public SingleMemberAnnotation convert ( org . eclipse . jdt . internal . compiler . ast . SingleMemberAnnotation annotation ) { final SingleMemberAnnotation singleMemberAnnotation = new SingleMemberAnnotation ( this . ast ) ; setTypeNameForAnnotation ( annotation , singleMemberAnnotation ) ; singleMemberAnnotation . setValue ( convert ( annotation . memberValue ) ) ; int start = annotation . sourceStart ; int end = annotation . declarationSourceEnd ; singleMemberAnnotation . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; if ( this . resolveBindings ) { recordNodes ( singleMemberAnnotation , annotation ) ; singleMemberAnnotation . resolveAnnotationBinding ( ) ; } return singleMemberAnnotation ; } public SimpleName convert ( org . eclipse . jdt . internal . compiler . ast . SingleNameReference nameReference ) { final SimpleName name = new SimpleName ( this . ast ) ; name . internalSetIdentifier ( new String ( nameReference . token ) ) ; if ( this . resolveBindings ) { recordNodes ( name , nameReference ) ; } name . setSourceRange ( nameReference . sourceStart , nameReference . sourceEnd - nameReference . sourceStart + <NUM_LIT:1> ) ; return name ; } public Statement convert ( org . eclipse . jdt . internal . compiler . ast . Statement statement ) { if ( statement instanceof ForeachStatement ) { return convert ( ( ForeachStatement ) statement ) ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . LocalDeclaration ) { org . eclipse . jdt . internal . compiler . ast . LocalDeclaration localDeclaration = ( org . eclipse . jdt . internal . compiler . ast . LocalDeclaration ) statement ; return convertToVariableDeclarationStatement ( localDeclaration ) ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . AssertStatement ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . AssertStatement ) statement ) ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . Block ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . Block ) statement ) ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . BreakStatement ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . BreakStatement ) statement ) ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . ContinueStatement ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . ContinueStatement ) statement ) ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . CaseStatement ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . CaseStatement ) statement ) ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . DoStatement ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . DoStatement ) statement ) ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . EmptyStatement ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . EmptyStatement ) statement ) ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . ExplicitConstructorCall ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . ExplicitConstructorCall ) statement ) ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . ForStatement ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . ForStatement ) statement ) ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . IfStatement ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . IfStatement ) statement ) ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . LabeledStatement ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . LabeledStatement ) statement ) ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . ReturnStatement ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . ReturnStatement ) statement ) ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . SwitchStatement ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . SwitchStatement ) statement ) ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . SynchronizedStatement ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . SynchronizedStatement ) statement ) ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . ThrowStatement ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . ThrowStatement ) statement ) ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . TryStatement ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . TryStatement ) statement ) ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) { ASTNode result = convert ( ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) statement ) ; if ( result == null ) { return createFakeEmptyStatement ( statement ) ; } TypeDeclaration typeDeclaration = ( TypeDeclaration ) result ; TypeDeclarationStatement typeDeclarationStatement = new TypeDeclarationStatement ( this . ast ) ; typeDeclarationStatement . setDeclaration ( typeDeclaration ) ; switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : TypeDeclaration typeDecl = typeDeclarationStatement . internalGetTypeDeclaration ( ) ; typeDeclarationStatement . setSourceRange ( typeDecl . getStartPosition ( ) , typeDecl . getLength ( ) ) ; break ; default : AbstractTypeDeclaration typeDeclAST3 = typeDeclarationStatement . getDeclaration ( ) ; typeDeclarationStatement . setSourceRange ( typeDeclAST3 . getStartPosition ( ) , typeDeclAST3 . getLength ( ) ) ; break ; } return typeDeclarationStatement ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . WhileStatement ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . WhileStatement ) statement ) ; } if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . Expression ) { org . eclipse . jdt . internal . compiler . ast . Expression statement2 = ( org . eclipse . jdt . internal . compiler . ast . Expression ) statement ; final Expression expr = convert ( statement2 ) ; final ExpressionStatement stmt = new ExpressionStatement ( this . ast ) ; stmt . setExpression ( expr ) ; int sourceStart = expr . getStartPosition ( ) ; int sourceEnd = statement2 . statementEnd ; stmt . setSourceRange ( sourceStart , sourceEnd - sourceStart + <NUM_LIT:1> ) ; return stmt ; } return createFakeEmptyStatement ( statement ) ; } public Expression convert ( org . eclipse . jdt . internal . compiler . ast . StringLiteral expression ) { if ( expression instanceof StringLiteralConcatenation ) { return convert ( ( StringLiteralConcatenation ) expression ) ; } int length = expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ; int sourceStart = expression . sourceStart ; StringLiteral literal = new StringLiteral ( this . ast ) ; if ( this . resolveBindings ) { this . recordNodes ( literal , expression ) ; } literal . internalSetEscapedValue ( new String ( this . compilationUnitSource , sourceStart , length ) ) ; literal . setSourceRange ( expression . sourceStart , expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ) ; return literal ; } public SwitchStatement convert ( org . eclipse . jdt . internal . compiler . ast . SwitchStatement statement ) { SwitchStatement switchStatement = new SwitchStatement ( this . ast ) ; switchStatement . setSourceRange ( statement . sourceStart , statement . sourceEnd - statement . sourceStart + <NUM_LIT:1> ) ; switchStatement . setExpression ( convert ( statement . expression ) ) ; org . eclipse . jdt . internal . compiler . ast . Statement [ ] statements = statement . 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 ) { checkAndAddMultipleLocalDeclaration ( statements , i , switchStatement . statements ( ) ) ; } else { final Statement currentStatement = convert ( statements [ i ] ) ; if ( currentStatement != null ) { switchStatement . statements ( ) . add ( currentStatement ) ; } } } } return switchStatement ; } public SynchronizedStatement convert ( org . eclipse . jdt . internal . compiler . ast . SynchronizedStatement statement ) { SynchronizedStatement synchronizedStatement = new SynchronizedStatement ( this . ast ) ; synchronizedStatement . setSourceRange ( statement . sourceStart , statement . sourceEnd - statement . sourceStart + <NUM_LIT:1> ) ; synchronizedStatement . setBody ( convert ( statement . block ) ) ; synchronizedStatement . setExpression ( convert ( statement . expression ) ) ; return synchronizedStatement ; } public Expression convert ( org . eclipse . jdt . internal . compiler . ast . ThisReference reference ) { if ( reference . isImplicitThis ( ) ) { return null ; } else if ( reference instanceof org . eclipse . jdt . internal . compiler . ast . QualifiedSuperReference ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . QualifiedSuperReference ) reference ) ; } else if ( reference instanceof org . eclipse . jdt . internal . compiler . ast . QualifiedThisReference ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . QualifiedThisReference ) reference ) ; } else { ThisExpression thisExpression = new ThisExpression ( this . ast ) ; thisExpression . setSourceRange ( reference . sourceStart , reference . sourceEnd - reference . sourceStart + <NUM_LIT:1> ) ; if ( this . resolveBindings ) { recordNodes ( thisExpression , reference ) ; recordPendingThisExpressionScopeResolution ( thisExpression ) ; } return thisExpression ; } } public ThrowStatement convert ( org . eclipse . jdt . internal . compiler . ast . ThrowStatement statement ) { final ThrowStatement throwStatement = new ThrowStatement ( this . ast ) ; throwStatement . setSourceRange ( statement . sourceStart , statement . sourceEnd - statement . sourceStart + <NUM_LIT:1> ) ; throwStatement . setExpression ( convert ( statement . exception ) ) ; return throwStatement ; } public BooleanLiteral convert ( org . eclipse . jdt . internal . compiler . ast . TrueLiteral expression ) { final BooleanLiteral literal = new BooleanLiteral ( this . ast ) ; literal . setBooleanValue ( true ) ; if ( this . resolveBindings ) { this . recordNodes ( literal , expression ) ; } literal . setSourceRange ( expression . sourceStart , expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ) ; return literal ; } public TryStatement convert ( org . eclipse . jdt . internal . compiler . ast . TryStatement statement ) { final TryStatement tryStatement = new TryStatement ( this . ast ) ; tryStatement . setSourceRange ( statement . sourceStart , statement . sourceEnd - statement . sourceStart + <NUM_LIT:1> ) ; LocalDeclaration [ ] localDeclarations = statement . resources ; int resourcesLength = localDeclarations . length ; if ( resourcesLength > <NUM_LIT:0> ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : case AST . JLS3_INTERNAL : tryStatement . setFlags ( tryStatement . getFlags ( ) | ASTNode . MALFORMED ) ; break ; default : for ( int i = <NUM_LIT:0> ; i < resourcesLength ; i ++ ) { LocalDeclaration localDeclaration = localDeclarations [ i ] ; VariableDeclarationExpression variableDeclarationExpression = convertToVariableDeclarationExpression ( localDeclaration ) ; int start = variableDeclarationExpression . getStartPosition ( ) ; int end = localDeclaration . declarationEnd ; variableDeclarationExpression . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; tryStatement . resources ( ) . add ( variableDeclarationExpression ) ; } } } tryStatement . setBody ( convert ( statement . tryBlock ) ) ; org . eclipse . jdt . internal . compiler . ast . Argument [ ] catchArguments = statement . catchArguments ; if ( catchArguments != null ) { int catchArgumentsLength = catchArguments . length ; org . eclipse . jdt . internal . compiler . ast . Block [ ] catchBlocks = statement . catchBlocks ; int start = statement . tryBlock . sourceEnd ; for ( int i = <NUM_LIT:0> ; i < catchArgumentsLength ; i ++ ) { CatchClause catchClause = new CatchClause ( this . ast ) ; int catchClauseSourceStart = retrieveStartingCatchPosition ( start , catchArguments [ i ] . sourceStart ) ; catchClause . setSourceRange ( catchClauseSourceStart , catchBlocks [ i ] . sourceEnd - catchClauseSourceStart + <NUM_LIT:1> ) ; catchClause . setBody ( convert ( catchBlocks [ i ] ) ) ; catchClause . setException ( convert ( catchArguments [ i ] ) ) ; tryStatement . catchClauses ( ) . add ( catchClause ) ; start = catchBlocks [ i ] . sourceEnd ; } } if ( statement . finallyBlock != null ) { tryStatement . setFinally ( convert ( statement . finallyBlock ) ) ; } return tryStatement ; } public ASTNode convert ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration typeDeclaration ) { int kind = org . eclipse . jdt . internal . compiler . ast . TypeDeclaration . kind ( typeDeclaration . modifiers ) ; switch ( kind ) { case org . eclipse . jdt . internal . compiler . ast . TypeDeclaration . ENUM_DECL : if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { return null ; } else { return convertToEnumDeclaration ( typeDeclaration ) ; } case org . eclipse . jdt . internal . compiler . ast . TypeDeclaration . ANNOTATION_TYPE_DECL : if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { return null ; } else { return convertToAnnotationDeclaration ( typeDeclaration ) ; } } checkCanceled ( ) ; TypeDeclaration typeDecl = new TypeDeclaration ( this . ast ) ; if ( typeDeclaration . modifiersSourceStart != - <NUM_LIT:1> ) { setModifiers ( typeDecl , typeDeclaration ) ; } boolean isInterface = kind == org . eclipse . jdt . internal . compiler . ast . TypeDeclaration . INTERFACE_DECL ; typeDecl . setInterface ( isInterface ) ; final SimpleName typeName = new SimpleName ( this . ast ) ; typeName . internalSetIdentifier ( new String ( typeDeclaration . name ) ) ; typeName . setSourceRange ( typeDeclaration . sourceStart , typeDeclaration . sourceEnd - typeDeclaration . sourceStart + <NUM_LIT:1> ) ; typeDecl . setName ( typeName ) ; typeDecl . setSourceRange ( typeDeclaration . declarationSourceStart , typeDeclaration . bodyEnd - typeDeclaration . declarationSourceStart + <NUM_LIT:1> ) ; if ( typeDeclaration . superclass != null ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : typeDecl . internalSetSuperclass ( convert ( typeDeclaration . superclass ) ) ; break ; default : typeDecl . setSuperclassType ( convertType ( typeDeclaration . superclass ) ) ; break ; } } org . eclipse . jdt . internal . compiler . ast . TypeReference [ ] superInterfaces = typeDeclaration . superInterfaces ; if ( superInterfaces != null ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : for ( int index = <NUM_LIT:0> , length = superInterfaces . length ; index < length ; index ++ ) { typeDecl . internalSuperInterfaces ( ) . add ( convert ( superInterfaces [ index ] ) ) ; } break ; default : for ( int index = <NUM_LIT:0> , length = superInterfaces . length ; index < length ; index ++ ) { typeDecl . superInterfaceTypes ( ) . add ( convertType ( superInterfaces [ index ] ) ) ; } } } org . eclipse . jdt . internal . compiler . ast . TypeParameter [ ] typeParameters = typeDeclaration . typeParameters ; if ( typeParameters != null ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : typeDecl . setFlags ( typeDecl . getFlags ( ) | ASTNode . MALFORMED ) ; break ; default : for ( int index = <NUM_LIT:0> , length = typeParameters . length ; index < length ; index ++ ) { typeDecl . typeParameters ( ) . add ( convert ( typeParameters [ index ] ) ) ; } } } buildBodyDeclarations ( typeDeclaration , typeDecl , isInterface ) ; if ( this . resolveBindings ) { recordNodes ( typeDecl , typeDeclaration ) ; recordNodes ( typeName , typeDeclaration ) ; typeDecl . resolveBinding ( ) ; } return typeDecl ; } public TypeParameter convert ( org . eclipse . jdt . internal . compiler . ast . TypeParameter typeParameter ) { final TypeParameter typeParameter2 = new TypeParameter ( this . ast ) ; final SimpleName simpleName = new SimpleName ( this . ast ) ; simpleName . internalSetIdentifier ( new String ( typeParameter . name ) ) ; int start = typeParameter . sourceStart ; int end = typeParameter . sourceEnd ; simpleName . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; typeParameter2 . setName ( simpleName ) ; final TypeReference superType = typeParameter . type ; end = typeParameter . declarationSourceEnd ; if ( superType != null ) { Type type = convertType ( superType ) ; typeParameter2 . typeBounds ( ) . add ( type ) ; end = type . getStartPosition ( ) + type . getLength ( ) - <NUM_LIT:1> ; } TypeReference [ ] bounds = typeParameter . bounds ; if ( bounds != null ) { Type type = null ; for ( int index = <NUM_LIT:0> , length = bounds . length ; index < length ; index ++ ) { type = convertType ( bounds [ index ] ) ; typeParameter2 . typeBounds ( ) . add ( type ) ; end = type . getStartPosition ( ) + type . getLength ( ) - <NUM_LIT:1> ; } } start = typeParameter . declarationSourceStart ; end = retrieveClosingAngleBracketPosition ( end ) ; typeParameter2 . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; if ( this . resolveBindings ) { recordName ( simpleName , typeParameter ) ; recordNodes ( typeParameter2 , typeParameter ) ; typeParameter2 . resolveBinding ( ) ; } return typeParameter2 ; } public Name convert ( org . eclipse . jdt . internal . compiler . ast . TypeReference typeReference ) { char [ ] [ ] typeName = typeReference . getTypeName ( ) ; int length = typeName . length ; if ( length > <NUM_LIT:1> ) { org . eclipse . jdt . internal . compiler . ast . QualifiedTypeReference qualifiedTypeReference = ( org . eclipse . jdt . internal . compiler . ast . QualifiedTypeReference ) typeReference ; final long [ ] positions = qualifiedTypeReference . sourcePositions ; return setQualifiedNameNameAndSourceRanges ( typeName , positions , typeReference ) ; } else { final SimpleName name = new SimpleName ( this . ast ) ; name . internalSetIdentifier ( new String ( typeName [ <NUM_LIT:0> ] ) ) ; name . setSourceRange ( typeReference . sourceStart , typeReference . sourceEnd - typeReference . sourceStart + <NUM_LIT:1> ) ; name . index = <NUM_LIT:1> ; if ( this . resolveBindings ) { recordNodes ( name , typeReference ) ; } return name ; } } public PrefixExpression convert ( org . eclipse . jdt . internal . compiler . ast . UnaryExpression expression ) { final PrefixExpression prefixExpression = new PrefixExpression ( this . ast ) ; if ( this . resolveBindings ) { this . recordNodes ( prefixExpression , expression ) ; } prefixExpression . setSourceRange ( expression . sourceStart , expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ) ; prefixExpression . setOperand ( convert ( expression . expression ) ) ; switch ( ( expression . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorMASK ) > > org . eclipse . jdt . internal . compiler . ast . ASTNode . OperatorSHIFT ) { case org . eclipse . jdt . internal . compiler . ast . OperatorIds . PLUS : prefixExpression . setOperator ( PrefixExpression . Operator . PLUS ) ; break ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . MINUS : prefixExpression . setOperator ( PrefixExpression . Operator . MINUS ) ; break ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . NOT : prefixExpression . setOperator ( PrefixExpression . Operator . NOT ) ; break ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . TWIDDLE : prefixExpression . setOperator ( PrefixExpression . Operator . COMPLEMENT ) ; } return prefixExpression ; } public WhileStatement convert ( org . eclipse . jdt . internal . compiler . ast . WhileStatement statement ) { final WhileStatement whileStatement = new WhileStatement ( this . ast ) ; whileStatement . setSourceRange ( statement . sourceStart , statement . sourceEnd - statement . sourceStart + <NUM_LIT:1> ) ; whileStatement . setExpression ( convert ( statement . condition ) ) ; final Statement action = convert ( statement . action ) ; if ( action == null ) return null ; whileStatement . setBody ( action ) ; return whileStatement ; } public ImportDeclaration convertImport ( org . eclipse . jdt . internal . compiler . ast . ImportReference importReference ) { final ImportDeclaration importDeclaration = new ImportDeclaration ( this . ast ) ; final boolean onDemand = ( importReference . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . OnDemand ) != <NUM_LIT:0> ; final char [ ] [ ] tokens = importReference . tokens ; int length = importReference . tokens . length ; final long [ ] positions = importReference . sourcePositions ; if ( length > <NUM_LIT:1> ) { importDeclaration . setName ( setQualifiedNameNameAndSourceRanges ( tokens , positions , importReference ) ) ; } else { final SimpleName name = new SimpleName ( this . ast ) ; name . internalSetIdentifier ( new String ( tokens [ <NUM_LIT:0> ] ) ) ; final int start = ( int ) ( positions [ <NUM_LIT:0> ] > > > <NUM_LIT:32> ) ; final int end = ( int ) ( positions [ <NUM_LIT:0> ] & <NUM_LIT> ) ; name . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; name . index = <NUM_LIT:1> ; importDeclaration . setName ( name ) ; if ( this . resolveBindings ) { recordNodes ( name , importReference ) ; } } importDeclaration . setSourceRange ( importReference . declarationSourceStart , importReference . declarationEnd - importReference . declarationSourceStart + <NUM_LIT:1> ) ; importDeclaration . setOnDemand ( onDemand ) ; int modifiers = importReference . modifiers ; if ( modifiers != ClassFileConstants . AccDefault ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : importDeclaration . setFlags ( importDeclaration . getFlags ( ) | ASTNode . MALFORMED ) ; break ; default : if ( modifiers == ClassFileConstants . AccStatic ) { importDeclaration . setStatic ( true ) ; } else { importDeclaration . setFlags ( importDeclaration . getFlags ( ) | ASTNode . MALFORMED ) ; } } } if ( this . resolveBindings ) { recordNodes ( importDeclaration , importReference ) ; } return importDeclaration ; } public PackageDeclaration convertPackage ( org . eclipse . jdt . internal . compiler . ast . CompilationUnitDeclaration compilationUnitDeclaration ) { org . eclipse . jdt . internal . compiler . ast . ImportReference importReference = compilationUnitDeclaration . currentPackage ; final PackageDeclaration packageDeclaration = new PackageDeclaration ( this . ast ) ; final char [ ] [ ] tokens = importReference . tokens ; final int length = importReference . tokens . length ; long [ ] positions = importReference . sourcePositions ; if ( length > <NUM_LIT:1> ) { packageDeclaration . setName ( setQualifiedNameNameAndSourceRanges ( tokens , positions , importReference ) ) ; } else { final SimpleName name = new SimpleName ( this . ast ) ; name . internalSetIdentifier ( new String ( tokens [ <NUM_LIT:0> ] ) ) ; int start = ( int ) ( positions [ <NUM_LIT:0> ] > > > <NUM_LIT:32> ) ; int end = ( int ) ( positions [ length - <NUM_LIT:1> ] & <NUM_LIT> ) ; name . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; name . index = <NUM_LIT:1> ; packageDeclaration . setName ( name ) ; if ( this . resolveBindings ) { recordNodes ( name , compilationUnitDeclaration ) ; } } packageDeclaration . setSourceRange ( importReference . declarationSourceStart , importReference . declarationEnd - importReference . declarationSourceStart + <NUM_LIT:1> ) ; org . eclipse . jdt . internal . compiler . ast . Annotation [ ] annotations = importReference . annotations ; if ( annotations != null ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : packageDeclaration . setFlags ( packageDeclaration . getFlags ( ) & ASTNode . MALFORMED ) ; break ; default : for ( int i = <NUM_LIT:0> , max = annotations . length ; i < max ; i ++ ) { packageDeclaration . annotations ( ) . add ( convert ( annotations [ i ] ) ) ; } } } if ( this . resolveBindings ) { recordNodes ( packageDeclaration , importReference ) ; } convert ( compilationUnitDeclaration . javadoc , packageDeclaration ) ; return packageDeclaration ; } private EnumDeclaration convertToEnumDeclaration ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration typeDeclaration ) { checkCanceled ( ) ; final EnumDeclaration enumDeclaration2 = new EnumDeclaration ( this . ast ) ; setModifiers ( enumDeclaration2 , typeDeclaration ) ; final SimpleName typeName = new SimpleName ( this . ast ) ; typeName . internalSetIdentifier ( new String ( typeDeclaration . name ) ) ; typeName . setSourceRange ( typeDeclaration . sourceStart , typeDeclaration . sourceEnd - typeDeclaration . sourceStart + <NUM_LIT:1> ) ; enumDeclaration2 . setName ( typeName ) ; enumDeclaration2 . setSourceRange ( typeDeclaration . declarationSourceStart , typeDeclaration . bodyEnd - typeDeclaration . declarationSourceStart + <NUM_LIT:1> ) ; org . eclipse . jdt . internal . compiler . ast . TypeReference [ ] superInterfaces = typeDeclaration . superInterfaces ; if ( superInterfaces != null ) { for ( int index = <NUM_LIT:0> , length = superInterfaces . length ; index < length ; index ++ ) { enumDeclaration2 . superInterfaceTypes ( ) . add ( convertType ( superInterfaces [ index ] ) ) ; } } buildBodyDeclarations ( typeDeclaration , enumDeclaration2 ) ; if ( this . resolveBindings ) { recordNodes ( enumDeclaration2 , typeDeclaration ) ; recordNodes ( typeName , typeDeclaration ) ; enumDeclaration2 . resolveBinding ( ) ; } return enumDeclaration2 ; } public Expression convertToExpression ( org . eclipse . jdt . internal . compiler . ast . Statement statement ) { if ( statement instanceof org . eclipse . jdt . internal . compiler . ast . Expression ) { return convert ( ( org . eclipse . jdt . internal . compiler . ast . Expression ) statement ) ; } else { return null ; } } protected FieldDeclaration convertToFieldDeclaration ( org . eclipse . jdt . internal . compiler . ast . FieldDeclaration fieldDecl ) { VariableDeclarationFragment variableDeclarationFragment = convertToVariableDeclarationFragment ( fieldDecl ) ; final FieldDeclaration fieldDeclaration = new FieldDeclaration ( this . ast ) ; fieldDeclaration . fragments ( ) . add ( variableDeclarationFragment ) ; if ( this . resolveBindings ) { recordNodes ( variableDeclarationFragment , fieldDecl ) ; variableDeclarationFragment . resolveBinding ( ) ; } fieldDeclaration . setSourceRange ( fieldDecl . declarationSourceStart , fieldDecl . declarationEnd - fieldDecl . declarationSourceStart + <NUM_LIT:1> ) ; Type type = convertType ( fieldDecl . type ) ; setTypeForField ( fieldDeclaration , type , variableDeclarationFragment . getExtraDimensions ( ) ) ; setModifiers ( fieldDeclaration , fieldDecl ) ; convert ( fieldDecl . javadoc , fieldDeclaration ) ; return fieldDeclaration ; } public ParenthesizedExpression convertToParenthesizedExpression ( org . eclipse . jdt . internal . compiler . ast . Expression expression ) { final ParenthesizedExpression parenthesizedExpression = new ParenthesizedExpression ( this . ast ) ; if ( this . resolveBindings ) { recordNodes ( parenthesizedExpression , expression ) ; } parenthesizedExpression . setSourceRange ( expression . sourceStart , expression . sourceEnd - expression . sourceStart + <NUM_LIT:1> ) ; adjustSourcePositionsForParent ( expression ) ; trimWhiteSpacesAndComments ( expression ) ; int numberOfParenthesis = ( expression . bits & org . eclipse . jdt . internal . compiler . ast . ASTNode . ParenthesizedMASK ) > > org . eclipse . jdt . internal . compiler . ast . ASTNode . ParenthesizedSHIFT ; expression . bits &= ~ org . eclipse . jdt . internal . compiler . ast . ASTNode . ParenthesizedMASK ; expression . bits |= ( numberOfParenthesis - <NUM_LIT:1> ) << org . eclipse . jdt . internal . compiler . ast . ASTNode . ParenthesizedSHIFT ; parenthesizedExpression . setExpression ( convert ( expression ) ) ; return parenthesizedExpression ; } protected VariableDeclarationExpression convertToVariableDeclarationExpression ( org . eclipse . jdt . internal . compiler . ast . LocalDeclaration localDeclaration ) { final VariableDeclarationFragment variableDeclarationFragment = convertToVariableDeclarationFragment ( localDeclaration ) ; final VariableDeclarationExpression variableDeclarationExpression = new VariableDeclarationExpression ( this . ast ) ; variableDeclarationExpression . fragments ( ) . add ( variableDeclarationFragment ) ; if ( this . resolveBindings ) { recordNodes ( variableDeclarationFragment , localDeclaration ) ; } variableDeclarationExpression . setSourceRange ( localDeclaration . declarationSourceStart , localDeclaration . declarationSourceEnd - localDeclaration . declarationSourceStart + <NUM_LIT:1> ) ; Type type = convertType ( localDeclaration . type ) ; setTypeForVariableDeclarationExpression ( variableDeclarationExpression , type , variableDeclarationFragment . getExtraDimensions ( ) ) ; if ( localDeclaration . modifiersSourceStart != - <NUM_LIT:1> ) { setModifiers ( variableDeclarationExpression , localDeclaration ) ; } return variableDeclarationExpression ; } protected SingleVariableDeclaration convertToSingleVariableDeclaration ( LocalDeclaration localDeclaration ) { final SingleVariableDeclaration variableDecl = new SingleVariableDeclaration ( this . ast ) ; setModifiers ( variableDecl , localDeclaration ) ; final SimpleName name = new SimpleName ( this . ast ) ; name . internalSetIdentifier ( new String ( localDeclaration . name ) ) ; int start = localDeclaration . sourceStart ; int nameEnd = localDeclaration . sourceEnd ; name . setSourceRange ( start , nameEnd - start + <NUM_LIT:1> ) ; variableDecl . setName ( name ) ; final int extraDimensions = retrieveExtraDimension ( nameEnd + <NUM_LIT:1> , localDeclaration . type . sourceEnd ) ; variableDecl . setExtraDimensions ( extraDimensions ) ; Type type = convertType ( localDeclaration . type ) ; int typeEnd = type . getStartPosition ( ) + type . getLength ( ) - <NUM_LIT:1> ; int rightEnd = Math . max ( typeEnd , localDeclaration . declarationSourceEnd ) ; setTypeForSingleVariableDeclaration ( variableDecl , type , extraDimensions ) ; variableDecl . setSourceRange ( localDeclaration . declarationSourceStart , rightEnd - localDeclaration . declarationSourceStart + <NUM_LIT:1> ) ; if ( this . resolveBindings ) { recordNodes ( name , localDeclaration ) ; recordNodes ( variableDecl , localDeclaration ) ; variableDecl . resolveBinding ( ) ; } return variableDecl ; } protected VariableDeclarationFragment convertToVariableDeclarationFragment ( org . eclipse . jdt . internal . compiler . ast . FieldDeclaration fieldDeclaration ) { final VariableDeclarationFragment variableDeclarationFragment = new VariableDeclarationFragment ( this . ast ) ; final SimpleName name = new SimpleName ( this . ast ) ; name . internalSetIdentifier ( new String ( fieldDeclaration . name ) ) ; name . setSourceRange ( fieldDeclaration . sourceStart , fieldDeclaration . sourceEnd - fieldDeclaration . sourceStart + <NUM_LIT:1> ) ; variableDeclarationFragment . setName ( name ) ; int start = fieldDeclaration . sourceEnd ; int end = start ; int extraDimensions = retrieveExtraDimension ( fieldDeclaration . sourceEnd + <NUM_LIT:1> , fieldDeclaration . declarationSourceEnd ) ; variableDeclarationFragment . setExtraDimensions ( extraDimensions ) ; if ( fieldDeclaration . initialization != null ) { final Expression expression = convert ( fieldDeclaration . initialization ) ; variableDeclarationFragment . setInitializer ( expression ) ; start = expression . getStartPosition ( ) + expression . getLength ( ) ; end = start - <NUM_LIT:1> ; } else { int possibleEnd = retrieveEndOfPotentialExtendedDimensions ( start + <NUM_LIT:1> , fieldDeclaration . sourceEnd , fieldDeclaration . declarationSourceEnd ) ; if ( possibleEnd == Integer . MIN_VALUE ) { end = fieldDeclaration . declarationSourceEnd ; variableDeclarationFragment . setFlags ( variableDeclarationFragment . getFlags ( ) | ASTNode . MALFORMED ) ; } if ( possibleEnd < <NUM_LIT:0> ) { end = - possibleEnd ; variableDeclarationFragment . setFlags ( variableDeclarationFragment . getFlags ( ) | ASTNode . MALFORMED ) ; } else { end = possibleEnd ; } } variableDeclarationFragment . setSourceRange ( fieldDeclaration . sourceStart , end - fieldDeclaration . sourceStart + <NUM_LIT:1> ) ; if ( this . resolveBindings ) { recordNodes ( name , fieldDeclaration ) ; recordNodes ( variableDeclarationFragment , fieldDeclaration ) ; variableDeclarationFragment . resolveBinding ( ) ; } return variableDeclarationFragment ; } protected VariableDeclarationFragment convertToVariableDeclarationFragment ( org . eclipse . jdt . internal . compiler . ast . LocalDeclaration localDeclaration ) { final VariableDeclarationFragment variableDeclarationFragment = new VariableDeclarationFragment ( this . ast ) ; final SimpleName name = new SimpleName ( this . ast ) ; name . internalSetIdentifier ( new String ( localDeclaration . name ) ) ; name . setSourceRange ( localDeclaration . sourceStart , localDeclaration . sourceEnd - localDeclaration . sourceStart + <NUM_LIT:1> ) ; variableDeclarationFragment . setName ( name ) ; int start = localDeclaration . sourceEnd ; org . eclipse . jdt . internal . compiler . ast . Expression initialization = localDeclaration . initialization ; int extraDimension = retrieveExtraDimension ( localDeclaration . sourceEnd + <NUM_LIT:1> , this . compilationUnitSourceLength ) ; variableDeclarationFragment . setExtraDimensions ( extraDimension ) ; boolean hasInitialization = initialization != null ; int end ; if ( hasInitialization ) { final Expression expression = convert ( initialization ) ; variableDeclarationFragment . setInitializer ( expression ) ; start = expression . getStartPosition ( ) + expression . getLength ( ) ; end = start - <NUM_LIT:1> ; } else { int possibleEnd = retrieveEndOfPotentialExtendedDimensions ( start + <NUM_LIT:1> , localDeclaration . sourceEnd , localDeclaration . declarationSourceEnd ) ; if ( possibleEnd == Integer . MIN_VALUE ) { end = start ; variableDeclarationFragment . setFlags ( variableDeclarationFragment . getFlags ( ) | ASTNode . MALFORMED ) ; } else if ( possibleEnd < <NUM_LIT:0> ) { end = - possibleEnd ; variableDeclarationFragment . setFlags ( variableDeclarationFragment . getFlags ( ) | ASTNode . MALFORMED ) ; } else { end = possibleEnd ; } } variableDeclarationFragment . setSourceRange ( localDeclaration . sourceStart , end - localDeclaration . sourceStart + <NUM_LIT:1> ) ; if ( this . resolveBindings ) { recordNodes ( variableDeclarationFragment , localDeclaration ) ; recordNodes ( name , localDeclaration ) ; variableDeclarationFragment . resolveBinding ( ) ; } return variableDeclarationFragment ; } protected VariableDeclarationStatement convertToVariableDeclarationStatement ( org . eclipse . jdt . internal . compiler . ast . LocalDeclaration localDeclaration ) { final VariableDeclarationFragment variableDeclarationFragment = convertToVariableDeclarationFragment ( localDeclaration ) ; final VariableDeclarationStatement variableDeclarationStatement = new VariableDeclarationStatement ( this . ast ) ; variableDeclarationStatement . fragments ( ) . add ( variableDeclarationFragment ) ; if ( this . resolveBindings ) { recordNodes ( variableDeclarationFragment , localDeclaration ) ; } variableDeclarationStatement . setSourceRange ( localDeclaration . declarationSourceStart , localDeclaration . declarationSourceEnd - localDeclaration . declarationSourceStart + <NUM_LIT:1> ) ; Type type = convertType ( localDeclaration . type ) ; setTypeForVariableDeclarationStatement ( variableDeclarationStatement , type , variableDeclarationFragment . getExtraDimensions ( ) ) ; if ( localDeclaration . modifiersSourceStart != - <NUM_LIT:1> ) { setModifiers ( variableDeclarationStatement , localDeclaration ) ; } return variableDeclarationStatement ; } public Type convertType ( TypeReference typeReference ) { if ( typeReference instanceof Wildcard ) { final Wildcard wildcard = ( Wildcard ) typeReference ; final WildcardType wildcardType = new WildcardType ( this . ast ) ; if ( wildcard . bound != null ) { final Type bound = convertType ( wildcard . bound ) ; wildcardType . setBound ( bound , wildcard . kind == Wildcard . EXTENDS ) ; int start = wildcard . sourceStart ; wildcardType . setSourceRange ( start , bound . getStartPosition ( ) + bound . getLength ( ) - start ) ; } else { final int start = wildcard . sourceStart ; final int end = wildcard . sourceEnd ; wildcardType . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; } if ( this . resolveBindings ) { recordNodes ( wildcardType , typeReference ) ; } return wildcardType ; } Type type = null ; int sourceStart = - <NUM_LIT:1> ; int length = <NUM_LIT:0> ; int dimensions = typeReference . dimensions ( ) ; if ( typeReference instanceof org . eclipse . jdt . internal . compiler . ast . SingleTypeReference ) { char [ ] name = ( ( org . eclipse . jdt . internal . compiler . ast . SingleTypeReference ) typeReference ) . getTypeName ( ) [ <NUM_LIT:0> ] ; sourceStart = typeReference . sourceStart ; length = typeReference . sourceEnd - typeReference . sourceStart + <NUM_LIT:1> ; if ( isPrimitiveType ( name ) ) { int end = retrieveEndOfElementTypeNamePosition ( sourceStart , sourceStart + length ) ; if ( end == - <NUM_LIT:1> ) { end = sourceStart + length - <NUM_LIT:1> ; } final PrimitiveType primitiveType = new PrimitiveType ( this . ast ) ; primitiveType . setPrimitiveTypeCode ( getPrimitiveTypeCode ( name ) ) ; primitiveType . setSourceRange ( sourceStart , end - sourceStart + <NUM_LIT:1> ) ; type = primitiveType ; } else if ( typeReference instanceof ParameterizedSingleTypeReference ) { ParameterizedSingleTypeReference parameterizedSingleTypeReference = ( ParameterizedSingleTypeReference ) typeReference ; final SimpleName simpleName = new SimpleName ( this . ast ) ; simpleName . internalSetIdentifier ( new String ( name ) ) ; int end = retrieveEndOfElementTypeNamePosition ( sourceStart , sourceStart + length ) ; if ( end == - <NUM_LIT:1> ) { end = sourceStart + length - <NUM_LIT:1> ; } simpleName . setSourceRange ( sourceStart , end - sourceStart + <NUM_LIT:1> ) ; switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : SimpleType simpleType = new SimpleType ( this . ast ) ; simpleType . setName ( simpleName ) ; simpleType . setFlags ( simpleType . getFlags ( ) | ASTNode . MALFORMED ) ; simpleType . setSourceRange ( sourceStart , end - sourceStart + <NUM_LIT:1> ) ; type = simpleType ; if ( this . resolveBindings ) { this . recordNodes ( simpleName , typeReference ) ; } break ; default : simpleType = new SimpleType ( this . ast ) ; simpleType . setName ( simpleName ) ; simpleType . setSourceRange ( simpleName . getStartPosition ( ) , simpleName . getLength ( ) ) ; final ParameterizedType parameterizedType = new ParameterizedType ( this . ast ) ; parameterizedType . setType ( simpleType ) ; type = parameterizedType ; TypeReference [ ] typeArguments = parameterizedSingleTypeReference . typeArguments ; if ( typeArguments != null ) { Type type2 = null ; for ( int i = <NUM_LIT:0> , max = typeArguments . length ; i < max ; i ++ ) { type2 = convertType ( typeArguments [ i ] ) ; ( ( ParameterizedType ) type ) . typeArguments ( ) . add ( type2 ) ; end = type2 . getStartPosition ( ) + type2 . getLength ( ) - <NUM_LIT:1> ; } end = retrieveClosingAngleBracketPosition ( end + <NUM_LIT:1> ) ; type . setSourceRange ( sourceStart , end - sourceStart + <NUM_LIT:1> ) ; } else { type . setSourceRange ( sourceStart , end - sourceStart + <NUM_LIT:1> ) ; } if ( this . resolveBindings ) { this . recordNodes ( simpleName , typeReference ) ; this . recordNodes ( simpleType , typeReference ) ; } } } else { final SimpleName simpleName = new SimpleName ( this . ast ) ; simpleName . internalSetIdentifier ( new String ( name ) ) ; int end = retrieveEndOfElementTypeNamePosition ( sourceStart , sourceStart + length ) ; if ( end == - <NUM_LIT:1> ) { end = sourceStart + length - <NUM_LIT:1> ; } simpleName . setSourceRange ( sourceStart , end - sourceStart + <NUM_LIT:1> ) ; final SimpleType simpleType = new SimpleType ( this . ast ) ; simpleType . setName ( simpleName ) ; type = simpleType ; type . setSourceRange ( sourceStart , end - sourceStart + <NUM_LIT:1> ) ; type = simpleType ; if ( this . resolveBindings ) { this . recordNodes ( simpleName , typeReference ) ; } } if ( dimensions != <NUM_LIT:0> ) { type = this . ast . newArrayType ( type , dimensions ) ; type . setSourceRange ( sourceStart , length ) ; ArrayType subarrayType = ( ArrayType ) type ; int index = dimensions - <NUM_LIT:1> ; while ( index > <NUM_LIT:0> ) { subarrayType = ( ArrayType ) subarrayType . getComponentType ( ) ; int end = retrieveProperRightBracketPosition ( index , sourceStart ) ; subarrayType . setSourceRange ( sourceStart , end - sourceStart + <NUM_LIT:1> ) ; index -- ; } if ( this . resolveBindings ) { completeRecord ( ( ArrayType ) type , typeReference ) ; } } } else { if ( typeReference instanceof ParameterizedQualifiedTypeReference ) { ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference = ( ParameterizedQualifiedTypeReference ) typeReference ; char [ ] [ ] tokens = parameterizedQualifiedTypeReference . tokens ; TypeReference [ ] [ ] typeArguments = parameterizedQualifiedTypeReference . typeArguments ; long [ ] positions = parameterizedQualifiedTypeReference . sourcePositions ; sourceStart = ( int ) ( positions [ <NUM_LIT:0> ] > > > <NUM_LIT:32> ) ; switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : { char [ ] [ ] name = ( ( org . eclipse . jdt . internal . compiler . ast . QualifiedTypeReference ) typeReference ) . getTypeName ( ) ; int nameLength = name . length ; sourceStart = ( int ) ( positions [ <NUM_LIT:0> ] > > > <NUM_LIT:32> ) ; length = ( int ) ( positions [ nameLength - <NUM_LIT:1> ] & <NUM_LIT> ) - sourceStart + <NUM_LIT:1> ; Name qualifiedName = this . setQualifiedNameNameAndSourceRanges ( name , positions , typeReference ) ; final SimpleType simpleType = new SimpleType ( this . ast ) ; simpleType . setName ( qualifiedName ) ; simpleType . setSourceRange ( sourceStart , length ) ; type = simpleType ; } break ; default : if ( typeArguments != null ) { int numberOfEnclosingType = <NUM_LIT:0> ; int startingIndex = <NUM_LIT:0> ; int endingIndex = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , max = typeArguments . length ; i < max ; i ++ ) { if ( typeArguments [ i ] != null ) { numberOfEnclosingType ++ ; } else if ( numberOfEnclosingType == <NUM_LIT:0> ) { endingIndex ++ ; } } Name name = null ; if ( endingIndex - startingIndex == <NUM_LIT:0> ) { final SimpleName simpleName = new SimpleName ( this . ast ) ; simpleName . internalSetIdentifier ( new String ( tokens [ startingIndex ] ) ) ; recordPendingNameScopeResolution ( simpleName ) ; int start = ( int ) ( positions [ startingIndex ] > > > <NUM_LIT:32> ) ; int end = ( int ) positions [ startingIndex ] ; simpleName . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; simpleName . index = <NUM_LIT:1> ; name = simpleName ; if ( this . resolveBindings ) { recordNodes ( simpleName , typeReference ) ; } } else { name = this . setQualifiedNameNameAndSourceRanges ( tokens , positions , endingIndex , typeReference ) ; } SimpleType simpleType = new SimpleType ( this . ast ) ; simpleType . setName ( name ) ; int start = ( int ) ( positions [ startingIndex ] > > > <NUM_LIT:32> ) ; int end = ( int ) positions [ endingIndex ] ; simpleType . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; ParameterizedType parameterizedType = new ParameterizedType ( this . ast ) ; parameterizedType . setType ( simpleType ) ; if ( this . resolveBindings ) { recordNodes ( simpleType , typeReference ) ; recordNodes ( parameterizedType , typeReference ) ; } start = simpleType . getStartPosition ( ) ; end = start + simpleType . getLength ( ) - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> , max = typeArguments [ endingIndex ] . length ; i < max ; i ++ ) { final Type type2 = convertType ( typeArguments [ endingIndex ] [ i ] ) ; parameterizedType . typeArguments ( ) . add ( type2 ) ; end = type2 . getStartPosition ( ) + type2 . getLength ( ) - <NUM_LIT:1> ; } int indexOfEnclosingType = <NUM_LIT:1> ; parameterizedType . index = indexOfEnclosingType ; end = retrieveClosingAngleBracketPosition ( end + <NUM_LIT:1> ) ; length = end + <NUM_LIT:1> ; parameterizedType . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; startingIndex = endingIndex + <NUM_LIT:1> ; Type currentType = parameterizedType ; while ( startingIndex < typeArguments . length ) { SimpleName simpleName = new SimpleName ( this . ast ) ; simpleName . internalSetIdentifier ( new String ( tokens [ startingIndex ] ) ) ; simpleName . index = startingIndex + <NUM_LIT:1> ; start = ( int ) ( positions [ startingIndex ] > > > <NUM_LIT:32> ) ; end = ( int ) positions [ startingIndex ] ; simpleName . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; recordPendingNameScopeResolution ( simpleName ) ; QualifiedType qualifiedType = new QualifiedType ( this . ast ) ; qualifiedType . setQualifier ( currentType ) ; qualifiedType . setName ( simpleName ) ; if ( this . resolveBindings ) { recordNodes ( simpleName , typeReference ) ; recordNodes ( qualifiedType , typeReference ) ; } start = currentType . getStartPosition ( ) ; end = simpleName . getStartPosition ( ) + simpleName . getLength ( ) - <NUM_LIT:1> ; qualifiedType . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; indexOfEnclosingType ++ ; if ( typeArguments [ startingIndex ] != null ) { qualifiedType . index = indexOfEnclosingType ; ParameterizedType parameterizedType2 = new ParameterizedType ( this . ast ) ; parameterizedType2 . setType ( qualifiedType ) ; parameterizedType2 . index = indexOfEnclosingType ; if ( this . resolveBindings ) { recordNodes ( parameterizedType2 , typeReference ) ; } for ( int i = <NUM_LIT:0> , max = typeArguments [ startingIndex ] . length ; i < max ; i ++ ) { final Type type2 = convertType ( typeArguments [ startingIndex ] [ i ] ) ; parameterizedType2 . typeArguments ( ) . add ( type2 ) ; end = type2 . getStartPosition ( ) + type2 . getLength ( ) - <NUM_LIT:1> ; } end = retrieveClosingAngleBracketPosition ( end + <NUM_LIT:1> ) ; length = end + <NUM_LIT:1> ; parameterizedType2 . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; currentType = parameterizedType2 ; } else { currentType = qualifiedType ; qualifiedType . index = indexOfEnclosingType ; } startingIndex ++ ; } if ( this . resolveBindings ) { this . recordNodes ( currentType , typeReference ) ; } type = currentType ; length -= sourceStart ; } } } else if ( typeReference instanceof org . eclipse . jdt . internal . compiler . ast . QualifiedTypeReference ) { char [ ] [ ] name = ( ( org . eclipse . jdt . internal . compiler . ast . QualifiedTypeReference ) typeReference ) . getTypeName ( ) ; int nameLength = name . length ; long [ ] positions = ( ( org . eclipse . jdt . internal . compiler . ast . QualifiedTypeReference ) typeReference ) . sourcePositions ; sourceStart = ( int ) ( positions [ <NUM_LIT:0> ] > > > <NUM_LIT:32> ) ; length = ( int ) ( positions [ nameLength - <NUM_LIT:1> ] & <NUM_LIT> ) - sourceStart + <NUM_LIT:1> ; final Name qualifiedName = this . setQualifiedNameNameAndSourceRanges ( name , positions , typeReference ) ; final SimpleType simpleType = new SimpleType ( this . ast ) ; simpleType . setName ( qualifiedName ) ; type = simpleType ; type . setSourceRange ( sourceStart , length ) ; } else { TypeReference [ ] typeReferences = ( ( org . eclipse . jdt . internal . compiler . ast . UnionTypeReference ) typeReference ) . typeReferences ; switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : case AST . JLS3_INTERNAL : type = this . convertType ( typeReferences [ <NUM_LIT:0> ] ) ; int start = typeReference . sourceStart ; int endPosition = typeReference . sourceEnd ; length = endPosition - start + <NUM_LIT:1> ; type . setSourceRange ( start , length ) ; type . setFlags ( type . getFlags ( ) | ASTNode . MALFORMED ) ; break ; default : final UnionType unionType = new UnionType ( this . ast ) ; for ( int i = <NUM_LIT:0> , max = typeReferences . length ; i < max ; i ++ ) { unionType . types ( ) . add ( this . convertType ( typeReferences [ i ] ) ) ; } type = unionType ; List types = unionType . types ( ) ; int size = types . size ( ) ; start = ( ( Type ) types . get ( <NUM_LIT:0> ) ) . getStartPosition ( ) ; Type lastType = ( Type ) types . get ( size - <NUM_LIT:1> ) ; endPosition = lastType . getStartPosition ( ) + lastType . getLength ( ) ; length = endPosition - start ; type . setSourceRange ( start , length ) ; } } length = typeReference . sourceEnd - sourceStart + <NUM_LIT:1> ; if ( dimensions != <NUM_LIT:0> ) { type = this . ast . newArrayType ( type , dimensions ) ; if ( this . resolveBindings ) { completeRecord ( ( ArrayType ) type , typeReference ) ; } int end = retrieveEndOfDimensionsPosition ( sourceStart + length , this . compilationUnitSourceLength ) ; if ( end != - <NUM_LIT:1> ) { type . setSourceRange ( sourceStart , end - sourceStart + <NUM_LIT:1> ) ; } else { type . setSourceRange ( sourceStart , length ) ; } ArrayType subarrayType = ( ArrayType ) type ; int index = dimensions - <NUM_LIT:1> ; while ( index > <NUM_LIT:0> ) { subarrayType = ( ArrayType ) subarrayType . getComponentType ( ) ; end = retrieveProperRightBracketPosition ( index , sourceStart ) ; subarrayType . setSourceRange ( sourceStart , end - sourceStart + <NUM_LIT:1> ) ; index -- ; } } } if ( this . resolveBindings ) { this . recordNodes ( type , typeReference ) ; } boolean sawDiamond = false ; if ( typeReference instanceof ParameterizedSingleTypeReference ) { ParameterizedSingleTypeReference pstr = ( ParameterizedSingleTypeReference ) typeReference ; if ( pstr . typeArguments == TypeReference . NO_TYPE_ARGUMENTS ) { sawDiamond = true ; } } else if ( typeReference instanceof ParameterizedQualifiedTypeReference ) { ParameterizedQualifiedTypeReference pqtr = ( ParameterizedQualifiedTypeReference ) typeReference ; for ( int i = <NUM_LIT:0> , len = pqtr . typeArguments . length ; i < len ; i ++ ) { if ( pqtr . typeArguments [ i ] == TypeReference . NO_TYPE_ARGUMENTS ) { sawDiamond = true ; break ; } } } if ( sawDiamond ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : case AST . JLS3_INTERNAL : type . setFlags ( type . getFlags ( ) | ASTNode . MALFORMED ) ; } } return type ; } protected Comment createComment ( int [ ] positions ) { Comment comment = null ; int start = positions [ <NUM_LIT:0> ] ; int end = positions [ <NUM_LIT:1> ] ; if ( positions [ <NUM_LIT:1> ] > <NUM_LIT:0> ) { Javadoc docComment = this . docParser . parse ( positions ) ; if ( docComment == null ) return null ; comment = docComment ; } else { end = - end ; if ( positions [ <NUM_LIT:0> ] == <NUM_LIT:0> ) { if ( this . docParser . scanner . source [ <NUM_LIT:1> ] == '<CHAR_LIT:/>' ) { comment = new LineComment ( this . ast ) ; } else { comment = new BlockComment ( this . ast ) ; } } else if ( positions [ <NUM_LIT:0> ] > <NUM_LIT:0> ) { comment = new BlockComment ( this . ast ) ; } else { start = - start ; comment = new LineComment ( this . ast ) ; } comment . setSourceRange ( start , end - start ) ; } return comment ; } protected Statement createFakeEmptyStatement ( org . eclipse . jdt . internal . compiler . ast . Statement statement ) { if ( statement == null ) return null ; EmptyStatement emptyStatement = new EmptyStatement ( this . ast ) ; emptyStatement . setFlags ( emptyStatement . getFlags ( ) | ASTNode . MALFORMED ) ; int start = statement . sourceStart ; int end = statement . sourceEnd ; emptyStatement . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; return emptyStatement ; } private Modifier createModifier ( ModifierKeyword keyword ) { final Modifier modifier = new Modifier ( this . ast ) ; modifier . setKeyword ( keyword ) ; int start = this . scanner . getCurrentTokenStartPosition ( ) ; int end = this . scanner . getCurrentTokenEndPosition ( ) ; modifier . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; return modifier ; } protected InfixExpression . Operator getOperatorFor ( int operatorID ) { switch ( operatorID ) { case org . eclipse . jdt . internal . compiler . ast . OperatorIds . EQUAL_EQUAL : return InfixExpression . Operator . EQUALS ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . LESS_EQUAL : return InfixExpression . Operator . LESS_EQUALS ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . GREATER_EQUAL : return InfixExpression . Operator . GREATER_EQUALS ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . NOT_EQUAL : return InfixExpression . Operator . NOT_EQUALS ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . LEFT_SHIFT : return InfixExpression . Operator . LEFT_SHIFT ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . RIGHT_SHIFT : return InfixExpression . Operator . RIGHT_SHIFT_SIGNED ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . UNSIGNED_RIGHT_SHIFT : return InfixExpression . Operator . RIGHT_SHIFT_UNSIGNED ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . OR_OR : return InfixExpression . Operator . CONDITIONAL_OR ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . AND_AND : return InfixExpression . Operator . CONDITIONAL_AND ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . PLUS : return InfixExpression . Operator . PLUS ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . MINUS : return InfixExpression . Operator . MINUS ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . REMAINDER : return InfixExpression . Operator . REMAINDER ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . XOR : return InfixExpression . Operator . XOR ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . AND : return InfixExpression . Operator . AND ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . MULTIPLY : return InfixExpression . Operator . TIMES ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . OR : return InfixExpression . Operator . OR ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . DIVIDE : return InfixExpression . Operator . DIVIDE ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . GREATER : return InfixExpression . Operator . GREATER ; case org . eclipse . jdt . internal . compiler . ast . OperatorIds . LESS : return InfixExpression . Operator . LESS ; } return null ; } protected PrimitiveType . Code getPrimitiveTypeCode ( char [ ] name ) { switch ( name [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : if ( name . length == <NUM_LIT:3> && name [ <NUM_LIT:1> ] == '<CHAR_LIT>' && name [ <NUM_LIT:2> ] == '<CHAR_LIT>' ) { return PrimitiveType . INT ; } break ; case '<CHAR_LIT>' : if ( name . length == <NUM_LIT:4> && name [ <NUM_LIT:1> ] == '<CHAR_LIT>' && name [ <NUM_LIT:2> ] == '<CHAR_LIT>' && name [ <NUM_LIT:3> ] == '<CHAR_LIT>' ) { return PrimitiveType . LONG ; } break ; case '<CHAR_LIT>' : if ( name . length == <NUM_LIT:6> && name [ <NUM_LIT:1> ] == '<CHAR_LIT>' && name [ <NUM_LIT:2> ] == '<CHAR_LIT>' && name [ <NUM_LIT:3> ] == '<CHAR_LIT:b>' && name [ <NUM_LIT:4> ] == '<CHAR_LIT>' && name [ <NUM_LIT:5> ] == '<CHAR_LIT:e>' ) { return PrimitiveType . DOUBLE ; } break ; case '<CHAR_LIT>' : if ( name . length == <NUM_LIT:5> && name [ <NUM_LIT:1> ] == '<CHAR_LIT>' && name [ <NUM_LIT:2> ] == '<CHAR_LIT>' && name [ <NUM_LIT:3> ] == '<CHAR_LIT:a>' && name [ <NUM_LIT:4> ] == '<CHAR_LIT>' ) { return PrimitiveType . FLOAT ; } break ; case '<CHAR_LIT:b>' : if ( name . length == <NUM_LIT:4> && name [ <NUM_LIT:1> ] == '<CHAR_LIT>' && name [ <NUM_LIT:2> ] == '<CHAR_LIT>' && name [ <NUM_LIT:3> ] == '<CHAR_LIT:e>' ) { return PrimitiveType . BYTE ; } else if ( name . length == <NUM_LIT:7> && name [ <NUM_LIT:1> ] == '<CHAR_LIT>' && name [ <NUM_LIT:2> ] == '<CHAR_LIT>' && name [ <NUM_LIT:3> ] == '<CHAR_LIT>' && name [ <NUM_LIT:4> ] == '<CHAR_LIT:e>' && name [ <NUM_LIT:5> ] == '<CHAR_LIT:a>' && name [ <NUM_LIT:6> ] == '<CHAR_LIT>' ) { return PrimitiveType . BOOLEAN ; } break ; case '<CHAR_LIT:c>' : if ( name . length == <NUM_LIT:4> && name [ <NUM_LIT:1> ] == '<CHAR_LIT>' && name [ <NUM_LIT:2> ] == '<CHAR_LIT:a>' && name [ <NUM_LIT:3> ] == '<CHAR_LIT>' ) { return PrimitiveType . CHAR ; } break ; case '<CHAR_LIT>' : if ( name . length == <NUM_LIT:5> && name [ <NUM_LIT:1> ] == '<CHAR_LIT>' && name [ <NUM_LIT:2> ] == '<CHAR_LIT>' && name [ <NUM_LIT:3> ] == '<CHAR_LIT>' && name [ <NUM_LIT:4> ] == '<CHAR_LIT>' ) { return PrimitiveType . SHORT ; } break ; case '<CHAR_LIT>' : if ( name . length == <NUM_LIT:4> && name [ <NUM_LIT:1> ] == '<CHAR_LIT>' && name [ <NUM_LIT:2> ] == '<CHAR_LIT>' && name [ <NUM_LIT:3> ] == '<CHAR_LIT>' ) { return PrimitiveType . VOID ; } } return null ; } protected boolean isPrimitiveType ( char [ ] name ) { switch ( name [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : if ( name . length == <NUM_LIT:3> && name [ <NUM_LIT:1> ] == '<CHAR_LIT>' && name [ <NUM_LIT:2> ] == '<CHAR_LIT>' ) { return true ; } return false ; case '<CHAR_LIT>' : if ( name . length == <NUM_LIT:4> && name [ <NUM_LIT:1> ] == '<CHAR_LIT>' && name [ <NUM_LIT:2> ] == '<CHAR_LIT>' && name [ <NUM_LIT:3> ] == '<CHAR_LIT>' ) { return true ; } return false ; case '<CHAR_LIT>' : if ( name . length == <NUM_LIT:6> && name [ <NUM_LIT:1> ] == '<CHAR_LIT>' && name [ <NUM_LIT:2> ] == '<CHAR_LIT>' && name [ <NUM_LIT:3> ] == '<CHAR_LIT:b>' && name [ <NUM_LIT:4> ] == '<CHAR_LIT>' && name [ <NUM_LIT:5> ] == '<CHAR_LIT:e>' ) { return true ; } return false ; case '<CHAR_LIT>' : if ( name . length == <NUM_LIT:5> && name [ <NUM_LIT:1> ] == '<CHAR_LIT>' && name [ <NUM_LIT:2> ] == '<CHAR_LIT>' && name [ <NUM_LIT:3> ] == '<CHAR_LIT:a>' && name [ <NUM_LIT:4> ] == '<CHAR_LIT>' ) { return true ; } return false ; case '<CHAR_LIT:b>' : if ( name . length == <NUM_LIT:4> && name [ <NUM_LIT:1> ] == '<CHAR_LIT>' && name [ <NUM_LIT:2> ] == '<CHAR_LIT>' && name [ <NUM_LIT:3> ] == '<CHAR_LIT:e>' ) { return true ; } else if ( name . length == <NUM_LIT:7> && name [ <NUM_LIT:1> ] == '<CHAR_LIT>' && name [ <NUM_LIT:2> ] == '<CHAR_LIT>' && name [ <NUM_LIT:3> ] == '<CHAR_LIT>' && name [ <NUM_LIT:4> ] == '<CHAR_LIT:e>' && name [ <NUM_LIT:5> ] == '<CHAR_LIT:a>' && name [ <NUM_LIT:6> ] == '<CHAR_LIT>' ) { return true ; } return false ; case '<CHAR_LIT:c>' : if ( name . length == <NUM_LIT:4> && name [ <NUM_LIT:1> ] == '<CHAR_LIT>' && name [ <NUM_LIT:2> ] == '<CHAR_LIT:a>' && name [ <NUM_LIT:3> ] == '<CHAR_LIT>' ) { return true ; } return false ; case '<CHAR_LIT>' : if ( name . length == <NUM_LIT:5> && name [ <NUM_LIT:1> ] == '<CHAR_LIT>' && name [ <NUM_LIT:2> ] == '<CHAR_LIT>' && name [ <NUM_LIT:3> ] == '<CHAR_LIT>' && name [ <NUM_LIT:4> ] == '<CHAR_LIT>' ) { return true ; } return false ; case '<CHAR_LIT>' : if ( name . length == <NUM_LIT:4> && name [ <NUM_LIT:1> ] == '<CHAR_LIT>' && name [ <NUM_LIT:2> ] == '<CHAR_LIT>' && name [ <NUM_LIT:3> ] == '<CHAR_LIT>' ) { return true ; } return false ; } return false ; } private void lookupForScopes ( ) { if ( this . pendingNameScopeResolution != null ) { for ( Iterator iterator = this . pendingNameScopeResolution . iterator ( ) ; iterator . hasNext ( ) ; ) { Name name = ( Name ) iterator . next ( ) ; this . ast . getBindingResolver ( ) . recordScope ( name , lookupScope ( name ) ) ; } } if ( this . pendingThisExpressionScopeResolution != null ) { for ( Iterator iterator = this . pendingThisExpressionScopeResolution . iterator ( ) ; iterator . hasNext ( ) ; ) { ThisExpression thisExpression = ( ThisExpression ) iterator . next ( ) ; this . ast . getBindingResolver ( ) . recordScope ( thisExpression , lookupScope ( thisExpression ) ) ; } } } private BlockScope lookupScope ( ASTNode node ) { ASTNode currentNode = node ; while ( currentNode != null && ! ( currentNode instanceof MethodDeclaration ) && ! ( currentNode instanceof Initializer ) && ! ( currentNode instanceof FieldDeclaration ) && ! ( currentNode instanceof AbstractTypeDeclaration ) ) { currentNode = currentNode . getParent ( ) ; } if ( currentNode == null ) { return null ; } if ( currentNode instanceof Initializer ) { Initializer initializer = ( Initializer ) currentNode ; while ( ! ( currentNode instanceof AbstractTypeDeclaration ) ) { currentNode = currentNode . getParent ( ) ; } if ( currentNode instanceof TypeDeclaration || currentNode instanceof EnumDeclaration || currentNode instanceof AnnotationTypeDeclaration ) { org . eclipse . jdt . internal . compiler . ast . TypeDeclaration typeDecl = ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) this . ast . getBindingResolver ( ) . getCorrespondingNode ( currentNode ) ; if ( ( initializer . getModifiers ( ) & Modifier . STATIC ) != <NUM_LIT:0> ) { return typeDecl . staticInitializerScope ; } else { return typeDecl . initializerScope ; } } } else if ( currentNode instanceof FieldDeclaration ) { FieldDeclaration fieldDeclaration = ( FieldDeclaration ) currentNode ; while ( ! ( currentNode instanceof AbstractTypeDeclaration ) ) { currentNode = currentNode . getParent ( ) ; } org . eclipse . jdt . internal . compiler . ast . TypeDeclaration typeDecl = ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) this . ast . getBindingResolver ( ) . getCorrespondingNode ( currentNode ) ; if ( ( fieldDeclaration . getModifiers ( ) & Modifier . STATIC ) != <NUM_LIT:0> ) { return typeDecl . staticInitializerScope ; } else { return typeDecl . initializerScope ; } } else if ( currentNode instanceof AbstractTypeDeclaration ) { org . eclipse . jdt . internal . compiler . ast . TypeDeclaration typeDecl = ( org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ) this . ast . getBindingResolver ( ) . getCorrespondingNode ( currentNode ) ; return typeDecl . initializerScope ; } AbstractMethodDeclaration abstractMethodDeclaration = ( AbstractMethodDeclaration ) this . ast . getBindingResolver ( ) . getCorrespondingNode ( currentNode ) ; return abstractMethodDeclaration . scope ; } protected void recordName ( Name name , org . eclipse . jdt . internal . compiler . ast . ASTNode compilerNode ) { if ( compilerNode != null ) { recordNodes ( name , compilerNode ) ; if ( compilerNode instanceof org . eclipse . jdt . internal . compiler . ast . TypeReference ) { org . eclipse . jdt . internal . compiler . ast . TypeReference typeRef = ( org . eclipse . jdt . internal . compiler . ast . TypeReference ) compilerNode ; if ( name . isQualifiedName ( ) ) { SimpleName simpleName = null ; while ( name . isQualifiedName ( ) ) { simpleName = ( ( QualifiedName ) name ) . getName ( ) ; recordNodes ( simpleName , typeRef ) ; name = ( ( QualifiedName ) name ) . getQualifier ( ) ; recordNodes ( name , typeRef ) ; } } } } } protected void recordNodes ( ASTNode node , org . eclipse . jdt . internal . compiler . ast . ASTNode oldASTNode ) { this . ast . getBindingResolver ( ) . store ( node , oldASTNode ) ; } protected void recordNodes ( org . eclipse . jdt . internal . compiler . ast . Javadoc javadoc , TagElement tagElement ) { Iterator fragments = tagElement . fragments ( ) . listIterator ( ) ; while ( fragments . hasNext ( ) ) { ASTNode node = ( ASTNode ) fragments . next ( ) ; if ( node . getNodeType ( ) == ASTNode . MEMBER_REF ) { MemberRef memberRef = ( MemberRef ) node ; Name name = memberRef . getName ( ) ; int start = name . getStartPosition ( ) ; org . eclipse . jdt . internal . compiler . ast . ASTNode compilerNode = javadoc . getNodeStartingAt ( start ) ; if ( compilerNode != null ) { recordNodes ( name , compilerNode ) ; recordNodes ( node , compilerNode ) ; } if ( memberRef . getQualifier ( ) != null ) { org . eclipse . jdt . internal . compiler . ast . TypeReference typeRef = null ; if ( compilerNode instanceof JavadocFieldReference ) { org . eclipse . jdt . internal . compiler . ast . Expression expression = ( ( JavadocFieldReference ) compilerNode ) . receiver ; if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . TypeReference ) { typeRef = ( org . eclipse . jdt . internal . compiler . ast . TypeReference ) expression ; } } else if ( compilerNode instanceof JavadocMessageSend ) { org . eclipse . jdt . internal . compiler . ast . Expression expression = ( ( JavadocMessageSend ) compilerNode ) . receiver ; if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . TypeReference ) { typeRef = ( org . eclipse . jdt . internal . compiler . ast . TypeReference ) expression ; } } if ( typeRef != null ) { recordName ( memberRef . getQualifier ( ) , typeRef ) ; } } } else if ( node . getNodeType ( ) == ASTNode . METHOD_REF ) { MethodRef methodRef = ( MethodRef ) node ; Name name = methodRef . getName ( ) ; int start = methodRef . getStartPosition ( ) ; this . scanner . resetTo ( start , start + name . getStartPosition ( ) + name . getLength ( ) ) ; int token ; try { nextToken : while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF && token != TerminalTokens . TokenNameLPAREN ) { if ( token == TerminalTokens . TokenNameERROR && this . scanner . currentCharacter == '<CHAR_LIT>' ) { start = this . scanner . getCurrentTokenEndPosition ( ) + <NUM_LIT:1> ; break nextToken ; } } } catch ( InvalidInputException e ) { } org . eclipse . jdt . internal . compiler . ast . ASTNode compilerNode = javadoc . getNodeStartingAt ( start ) ; if ( compilerNode != null ) { recordNodes ( methodRef , compilerNode ) ; org . eclipse . jdt . internal . compiler . ast . TypeReference typeRef = null ; if ( compilerNode instanceof org . eclipse . jdt . internal . compiler . ast . JavadocAllocationExpression ) { typeRef = ( ( org . eclipse . jdt . internal . compiler . ast . JavadocAllocationExpression ) compilerNode ) . type ; if ( typeRef != null ) recordNodes ( name , compilerNode ) ; } else if ( compilerNode instanceof org . eclipse . jdt . internal . compiler . ast . JavadocMessageSend ) { org . eclipse . jdt . internal . compiler . ast . Expression expression = ( ( org . eclipse . jdt . internal . compiler . ast . JavadocMessageSend ) compilerNode ) . receiver ; if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . TypeReference ) { typeRef = ( org . eclipse . jdt . internal . compiler . ast . TypeReference ) expression ; } recordNodes ( name , compilerNode ) ; } if ( typeRef != null && methodRef . getQualifier ( ) != null ) { recordName ( methodRef . getQualifier ( ) , typeRef ) ; } } Iterator parameters = methodRef . parameters ( ) . listIterator ( ) ; while ( parameters . hasNext ( ) ) { MethodRefParameter param = ( MethodRefParameter ) parameters . next ( ) ; org . eclipse . jdt . internal . compiler . ast . Expression expression = ( org . eclipse . jdt . internal . compiler . ast . Expression ) javadoc . getNodeStartingAt ( param . getStartPosition ( ) ) ; if ( expression != null ) { recordNodes ( param , expression ) ; if ( expression instanceof JavadocArgumentExpression ) { JavadocArgumentExpression argExpr = ( JavadocArgumentExpression ) expression ; org . eclipse . jdt . internal . compiler . ast . TypeReference typeRef = argExpr . argument . type ; if ( this . ast . apiLevel >= AST . JLS3_INTERNAL ) { param . setVarargs ( argExpr . argument . isVarArgs ( ) ) ; } recordNodes ( param . getType ( ) , typeRef ) ; if ( param . getType ( ) . isSimpleType ( ) ) { recordName ( ( ( SimpleType ) param . getType ( ) ) . getName ( ) , typeRef ) ; } else if ( param . getType ( ) . isArrayType ( ) ) { Type type = ( ( ArrayType ) param . getType ( ) ) . getElementType ( ) ; recordNodes ( type , typeRef ) ; if ( type . isSimpleType ( ) ) { recordName ( ( ( SimpleType ) type ) . getName ( ) , typeRef ) ; } } } } } } else if ( node . getNodeType ( ) == ASTNode . SIMPLE_NAME || node . getNodeType ( ) == ASTNode . QUALIFIED_NAME ) { org . eclipse . jdt . internal . compiler . ast . ASTNode compilerNode = javadoc . getNodeStartingAt ( node . getStartPosition ( ) ) ; recordName ( ( Name ) node , compilerNode ) ; } else if ( node . getNodeType ( ) == ASTNode . TAG_ELEMENT ) { recordNodes ( javadoc , ( TagElement ) node ) ; } } } protected void recordPendingNameScopeResolution ( Name name ) { if ( this . pendingNameScopeResolution == null ) { this . pendingNameScopeResolution = new HashSet ( ) ; } this . pendingNameScopeResolution . add ( name ) ; } protected void recordPendingThisExpressionScopeResolution ( ThisExpression thisExpression ) { if ( this . pendingThisExpressionScopeResolution == null ) { this . pendingThisExpressionScopeResolution = new HashSet ( ) ; } this . pendingThisExpressionScopeResolution . add ( thisExpression ) ; } private void trimWhiteSpacesAndComments ( org . eclipse . jdt . internal . compiler . ast . Expression expression ) { int start = expression . sourceStart ; int end = expression . sourceEnd ; int token ; int trimLeftPosition = expression . sourceStart ; int trimRightPosition = expression . sourceEnd ; boolean first = true ; Scanner removeBlankScanner = this . ast . scanner ; try { removeBlankScanner . setSource ( this . compilationUnitSource ) ; removeBlankScanner . resetTo ( start , end ) ; while ( true ) { token = removeBlankScanner . getNextToken ( ) ; switch ( token ) { case TerminalTokens . TokenNameCOMMENT_JAVADOC : case TerminalTokens . TokenNameCOMMENT_LINE : case TerminalTokens . TokenNameCOMMENT_BLOCK : if ( first ) { trimLeftPosition = removeBlankScanner . currentPosition ; } break ; case TerminalTokens . TokenNameWHITESPACE : if ( first ) { trimLeftPosition = removeBlankScanner . currentPosition ; } break ; case TerminalTokens . TokenNameEOF : expression . sourceStart = trimLeftPosition ; expression . sourceEnd = trimRightPosition ; return ; default : trimRightPosition = removeBlankScanner . currentPosition - <NUM_LIT:1> ; first = false ; } } } catch ( InvalidInputException e ) { } } protected void removeLeadingAndTrailingCommentsFromLiteral ( ASTNode node ) { int start = node . getStartPosition ( ) ; this . scanner . resetTo ( start , start + node . getLength ( ) ) ; int token ; int startPosition = - <NUM_LIT:1> ; try { while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameIntegerLiteral : case TerminalTokens . TokenNameFloatingPointLiteral : case TerminalTokens . TokenNameLongLiteral : case TerminalTokens . TokenNameDoubleLiteral : case TerminalTokens . TokenNameCharacterLiteral : if ( startPosition == - <NUM_LIT:1> ) { startPosition = this . scanner . startPosition ; } int end = this . scanner . currentPosition ; node . setSourceRange ( startPosition , end - startPosition ) ; return ; case TerminalTokens . TokenNameMINUS : startPosition = this . scanner . startPosition ; break ; } } } catch ( InvalidInputException e ) { } } protected int retrieveClosingAngleBracketPosition ( int start ) { this . scanner . resetTo ( start , this . compilationUnitSourceLength ) ; this . scanner . returnOnlyGreater = true ; try { int token ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameGREATER : return this . scanner . currentPosition - <NUM_LIT:1> ; case TerminalTokens . TokenNameLESS : continue ; default : return start ; } } } catch ( InvalidInputException e ) { } this . scanner . returnOnlyGreater = false ; return start ; } protected void retrieveColonPosition ( ASTNode node ) { int start = node . getStartPosition ( ) ; int length = node . getLength ( ) ; int end = start + length ; this . scanner . resetTo ( end , this . compilationUnitSourceLength ) ; try { int token ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameCOLON : node . setSourceRange ( start , this . scanner . currentPosition - start ) ; return ; } } } catch ( InvalidInputException e ) { } } protected int retrieveEllipsisStartPosition ( int start , int end ) { this . scanner . resetTo ( start , end ) ; try { int token ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameELLIPSIS : return this . scanner . startPosition - <NUM_LIT:1> ; } } } catch ( InvalidInputException e ) { } return - <NUM_LIT:1> ; } protected int retrieveEndBlockPosition ( int start , int end ) { this . scanner . resetTo ( start , end ) ; int count = <NUM_LIT:0> ; try { int token ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameLBRACE : count ++ ; break ; case TerminalTokens . TokenNameRBRACE : count -- ; if ( count == <NUM_LIT:0> ) { return this . scanner . currentPosition - <NUM_LIT:1> ; } } } } catch ( InvalidInputException e ) { } return - <NUM_LIT:1> ; } protected int retrieveSemiColonPosition ( Expression node ) { int start = node . getStartPosition ( ) ; int length = node . getLength ( ) ; int end = start + length ; this . scanner . resetTo ( end , this . compilationUnitSourceLength ) ; try { int token ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameSEMICOLON : return this . scanner . currentPosition - <NUM_LIT:1> ; } } } catch ( InvalidInputException e ) { } return - <NUM_LIT:1> ; } protected int retrieveEndOfDimensionsPosition ( int start , int end ) { this . scanner . resetTo ( start , end ) ; int foundPosition = - <NUM_LIT:1> ; try { int token ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameLBRACKET : case TerminalTokens . TokenNameCOMMENT_BLOCK : case TerminalTokens . TokenNameCOMMENT_JAVADOC : case TerminalTokens . TokenNameCOMMENT_LINE : break ; case TerminalTokens . TokenNameRBRACKET : foundPosition = this . scanner . currentPosition - <NUM_LIT:1> ; break ; default : return foundPosition ; } } } catch ( InvalidInputException e ) { } return foundPosition ; } protected int retrieveEndOfElementTypeNamePosition ( int start , int end ) { this . scanner . resetTo ( start , end ) ; try { int token ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameIdentifier : case TerminalTokens . TokenNamebyte : case TerminalTokens . TokenNamechar : case TerminalTokens . TokenNamedouble : case TerminalTokens . TokenNamefloat : case TerminalTokens . TokenNameint : case TerminalTokens . TokenNamelong : case TerminalTokens . TokenNameshort : case TerminalTokens . TokenNameboolean : return this . scanner . currentPosition - <NUM_LIT:1> ; } } } catch ( InvalidInputException e ) { } return - <NUM_LIT:1> ; } protected int retrieveEndOfRightParenthesisPosition ( int start , int end ) { this . scanner . resetTo ( start , end ) ; try { int token ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameRPAREN : return this . scanner . currentPosition ; } } } catch ( InvalidInputException e ) { } return - <NUM_LIT:1> ; } protected int retrieveExtraDimension ( int start , int end ) { this . scanner . resetTo ( start , end ) ; int dimensions = <NUM_LIT:0> ; try { int token ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameLBRACKET : case TerminalTokens . TokenNameCOMMENT_BLOCK : case TerminalTokens . TokenNameCOMMENT_JAVADOC : case TerminalTokens . TokenNameCOMMENT_LINE : break ; case TerminalTokens . TokenNameRBRACKET : dimensions ++ ; break ; default : return dimensions ; } } } catch ( InvalidInputException e ) { } return dimensions ; } protected void retrieveIdentifierAndSetPositions ( int start , int end , Name name ) { this . scanner . resetTo ( start , end ) ; int token ; try { while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { if ( token == TerminalTokens . TokenNameIdentifier ) { int startName = this . scanner . startPosition ; int endName = this . scanner . currentPosition - <NUM_LIT:1> ; name . setSourceRange ( startName , endName - startName + <NUM_LIT:1> ) ; return ; } } } catch ( InvalidInputException e ) { } } protected int retrieveIdentifierEndPosition ( int start , int end ) { this . scanner . resetTo ( start , end ) ; try { int token ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameIdentifier : return this . scanner . getCurrentTokenEndPosition ( ) ; } } } catch ( InvalidInputException e ) { } return - <NUM_LIT:1> ; } protected int retrieveEndOfPotentialExtendedDimensions ( int initializerEnd , int nameEnd , int end ) { this . scanner . resetTo ( initializerEnd , end ) ; boolean hasTokens = false ; int balance = <NUM_LIT:0> ; int pos = initializerEnd > nameEnd ? initializerEnd - <NUM_LIT:1> : nameEnd ; try { int token ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { hasTokens = true ; switch ( token ) { case TerminalTokens . TokenNameLBRACE : case TerminalTokens . TokenNameLBRACKET : balance ++ ; break ; case TerminalTokens . TokenNameRBRACKET : case TerminalTokens . TokenNameRBRACE : balance -- ; pos = this . scanner . currentPosition - <NUM_LIT:1> ; break ; case TerminalTokens . TokenNameCOMMA : if ( balance == <NUM_LIT:0> ) return pos ; pos = this . scanner . currentPosition - <NUM_LIT:1> ; break ; case TerminalTokens . TokenNameSEMICOLON : if ( balance == <NUM_LIT:0> ) return pos ; return - pos ; } } } catch ( InvalidInputException e ) { } return hasTokens ? Integer . MIN_VALUE : pos ; } protected int retrieveProperRightBracketPosition ( int bracketNumber , int start ) { this . scanner . resetTo ( start , this . compilationUnitSourceLength ) ; try { int token , count = <NUM_LIT:0> ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameRBRACKET : count ++ ; if ( count == bracketNumber ) { return this . scanner . currentPosition - <NUM_LIT:1> ; } } } } catch ( InvalidInputException e ) { } return - <NUM_LIT:1> ; } protected int retrieveRightBraceOrSemiColonPosition ( int start , int end ) { this . scanner . resetTo ( start , end ) ; try { int token ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameRBRACE : return this . scanner . currentPosition - <NUM_LIT:1> ; case TerminalTokens . TokenNameSEMICOLON : return this . scanner . currentPosition - <NUM_LIT:1> ; } } } catch ( InvalidInputException e ) { } return - <NUM_LIT:1> ; } protected int retrieveRightBrace ( int start , int end ) { this . scanner . resetTo ( start , end ) ; try { int token ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameRBRACE : return this . scanner . currentPosition - <NUM_LIT:1> ; } } } catch ( InvalidInputException e ) { } return - <NUM_LIT:1> ; } protected int retrieveRightBracketPosition ( int start , int end ) { this . scanner . resetTo ( start , end ) ; try { int token ; int balance = <NUM_LIT:0> ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameLBRACKET : balance ++ ; break ; case TerminalTokens . TokenNameRBRACKET : balance -- ; if ( balance == <NUM_LIT:0> ) return this . scanner . currentPosition - <NUM_LIT:1> ; break ; } } } catch ( InvalidInputException e ) { } return - <NUM_LIT:1> ; } protected int retrieveStartBlockPosition ( int start , int end ) { this . scanner . resetTo ( start , end ) ; try { int token ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNameLBRACE : return this . scanner . startPosition ; } } } catch ( InvalidInputException e ) { } return - <NUM_LIT:1> ; } protected int retrieveStartingCatchPosition ( int start , int end ) { this . scanner . resetTo ( start , end ) ; try { int token ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { switch ( token ) { case TerminalTokens . TokenNamecatch : return this . scanner . startPosition ; } } } catch ( InvalidInputException e ) { } return - <NUM_LIT:1> ; } public void setAST ( AST ast ) { this . ast = ast ; this . docParser = new DocCommentParser ( this . ast , this . scanner , this . insideComments ) ; } protected void setModifiers ( AnnotationTypeDeclaration typeDecl , org . eclipse . jdt . internal . compiler . ast . TypeDeclaration typeDeclaration ) { this . scanner . resetTo ( typeDeclaration . declarationSourceStart , typeDeclaration . sourceStart ) ; this . setModifiers ( typeDecl , typeDeclaration . annotations , typeDeclaration . sourceStart ) ; } protected void setModifiers ( AnnotationTypeMemberDeclaration annotationTypeMemberDecl , org . eclipse . jdt . internal . compiler . ast . AnnotationMethodDeclaration annotationTypeMemberDeclaration ) { this . scanner . resetTo ( annotationTypeMemberDeclaration . declarationSourceStart , annotationTypeMemberDeclaration . sourceStart ) ; this . setModifiers ( annotationTypeMemberDecl , annotationTypeMemberDeclaration . annotations , annotationTypeMemberDeclaration . sourceStart ) ; } protected void setModifiers ( BodyDeclaration bodyDeclaration , org . eclipse . jdt . internal . compiler . ast . Annotation [ ] annotations , int modifiersEnd ) { this . scanner . tokenizeWhiteSpace = false ; try { int token ; int indexInAnnotations = <NUM_LIT:0> ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { IExtendedModifier modifier = null ; switch ( token ) { case TerminalTokens . TokenNameabstract : modifier = createModifier ( Modifier . ModifierKeyword . ABSTRACT_KEYWORD ) ; break ; case TerminalTokens . TokenNamepublic : modifier = createModifier ( Modifier . ModifierKeyword . PUBLIC_KEYWORD ) ; break ; case TerminalTokens . TokenNamestatic : modifier = createModifier ( Modifier . ModifierKeyword . STATIC_KEYWORD ) ; break ; case TerminalTokens . TokenNameprotected : modifier = createModifier ( Modifier . ModifierKeyword . PROTECTED_KEYWORD ) ; break ; case TerminalTokens . TokenNameprivate : modifier = createModifier ( Modifier . ModifierKeyword . PRIVATE_KEYWORD ) ; break ; case TerminalTokens . TokenNamefinal : modifier = createModifier ( Modifier . ModifierKeyword . FINAL_KEYWORD ) ; break ; case TerminalTokens . TokenNamenative : modifier = createModifier ( Modifier . ModifierKeyword . NATIVE_KEYWORD ) ; break ; case TerminalTokens . TokenNamesynchronized : modifier = createModifier ( Modifier . ModifierKeyword . SYNCHRONIZED_KEYWORD ) ; break ; case TerminalTokens . TokenNametransient : modifier = createModifier ( Modifier . ModifierKeyword . TRANSIENT_KEYWORD ) ; break ; case TerminalTokens . TokenNamevolatile : modifier = createModifier ( Modifier . ModifierKeyword . VOLATILE_KEYWORD ) ; break ; case TerminalTokens . TokenNamestrictfp : modifier = createModifier ( Modifier . ModifierKeyword . STRICTFP_KEYWORD ) ; break ; case TerminalTokens . TokenNameAT : if ( annotations != null && indexInAnnotations < annotations . length ) { org . eclipse . jdt . internal . compiler . ast . Annotation annotation = annotations [ indexInAnnotations ++ ] ; modifier = convert ( annotation ) ; this . scanner . resetTo ( annotation . declarationSourceEnd + <NUM_LIT:1> , modifiersEnd ) ; } break ; case TerminalTokens . TokenNameCOMMENT_BLOCK : case TerminalTokens . TokenNameCOMMENT_LINE : case TerminalTokens . TokenNameCOMMENT_JAVADOC : break ; default : break ; } if ( modifier != null ) { bodyDeclaration . modifiers ( ) . add ( modifier ) ; } } } catch ( InvalidInputException e ) { } } protected void setModifiers ( EnumDeclaration enumDeclaration , org . eclipse . jdt . internal . compiler . ast . TypeDeclaration enumDeclaration2 ) { this . scanner . resetTo ( enumDeclaration2 . declarationSourceStart , enumDeclaration2 . sourceStart ) ; this . setModifiers ( enumDeclaration , enumDeclaration2 . annotations , enumDeclaration2 . sourceStart ) ; } protected void setModifiers ( EnumConstantDeclaration enumConstantDeclaration , org . eclipse . jdt . internal . compiler . ast . FieldDeclaration fieldDeclaration ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : enumConstantDeclaration . internalSetModifiers ( fieldDeclaration . modifiers & ExtraCompilerModifiers . AccJustFlag ) ; if ( fieldDeclaration . annotations != null ) { enumConstantDeclaration . setFlags ( enumConstantDeclaration . getFlags ( ) | ASTNode . MALFORMED ) ; } break ; default : this . scanner . resetTo ( fieldDeclaration . declarationSourceStart , fieldDeclaration . sourceStart ) ; this . setModifiers ( enumConstantDeclaration , fieldDeclaration . annotations , fieldDeclaration . sourceStart ) ; } } protected void setModifiers ( FieldDeclaration fieldDeclaration , org . eclipse . jdt . internal . compiler . ast . FieldDeclaration fieldDecl ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : fieldDeclaration . internalSetModifiers ( fieldDecl . modifiers & ExtraCompilerModifiers . AccJustFlag ) ; if ( fieldDecl . annotations != null ) { fieldDeclaration . setFlags ( fieldDeclaration . getFlags ( ) | ASTNode . MALFORMED ) ; } break ; default : this . scanner . resetTo ( fieldDecl . declarationSourceStart , fieldDecl . sourceStart ) ; this . setModifiers ( fieldDeclaration , fieldDecl . annotations , fieldDecl . sourceStart ) ; } } protected void setModifiers ( Initializer initializer , org . eclipse . jdt . internal . compiler . ast . Initializer oldInitializer ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : initializer . internalSetModifiers ( oldInitializer . modifiers & ExtraCompilerModifiers . AccJustFlag ) ; if ( oldInitializer . annotations != null ) { initializer . setFlags ( initializer . getFlags ( ) | ASTNode . MALFORMED ) ; } break ; default : this . scanner . resetTo ( oldInitializer . declarationSourceStart , oldInitializer . bodyStart ) ; this . setModifiers ( initializer , oldInitializer . annotations , oldInitializer . bodyStart ) ; } } protected void setModifiers ( MethodDeclaration methodDecl , AbstractMethodDeclaration methodDeclaration ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : methodDecl . internalSetModifiers ( methodDeclaration . modifiers & ExtraCompilerModifiers . AccJustFlag ) ; if ( methodDeclaration . annotations != null ) { methodDecl . setFlags ( methodDecl . getFlags ( ) | ASTNode . MALFORMED ) ; } break ; default : this . scanner . resetTo ( methodDeclaration . declarationSourceStart , methodDeclaration . sourceStart ) ; this . setModifiers ( methodDecl , methodDeclaration . annotations , methodDeclaration . sourceStart ) ; } } protected void setModifiers ( SingleVariableDeclaration variableDecl , Argument argument ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : variableDecl . internalSetModifiers ( argument . modifiers & ExtraCompilerModifiers . AccJustFlag ) ; if ( argument . annotations != null ) { variableDecl . setFlags ( variableDecl . getFlags ( ) | ASTNode . MALFORMED ) ; } break ; default : this . scanner . resetTo ( argument . declarationSourceStart , argument . sourceStart ) ; org . eclipse . jdt . internal . compiler . ast . Annotation [ ] annotations = argument . annotations ; int indexInAnnotations = <NUM_LIT:0> ; try { int token ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { IExtendedModifier modifier = null ; switch ( token ) { case TerminalTokens . TokenNameabstract : modifier = createModifier ( Modifier . ModifierKeyword . ABSTRACT_KEYWORD ) ; break ; case TerminalTokens . TokenNamepublic : modifier = createModifier ( Modifier . ModifierKeyword . PUBLIC_KEYWORD ) ; break ; case TerminalTokens . TokenNamestatic : modifier = createModifier ( Modifier . ModifierKeyword . STATIC_KEYWORD ) ; break ; case TerminalTokens . TokenNameprotected : modifier = createModifier ( Modifier . ModifierKeyword . PROTECTED_KEYWORD ) ; break ; case TerminalTokens . TokenNameprivate : modifier = createModifier ( Modifier . ModifierKeyword . PRIVATE_KEYWORD ) ; break ; case TerminalTokens . TokenNamefinal : modifier = createModifier ( Modifier . ModifierKeyword . FINAL_KEYWORD ) ; break ; case TerminalTokens . TokenNamenative : modifier = createModifier ( Modifier . ModifierKeyword . NATIVE_KEYWORD ) ; break ; case TerminalTokens . TokenNamesynchronized : modifier = createModifier ( Modifier . ModifierKeyword . SYNCHRONIZED_KEYWORD ) ; break ; case TerminalTokens . TokenNametransient : modifier = createModifier ( Modifier . ModifierKeyword . TRANSIENT_KEYWORD ) ; break ; case TerminalTokens . TokenNamevolatile : modifier = createModifier ( Modifier . ModifierKeyword . VOLATILE_KEYWORD ) ; break ; case TerminalTokens . TokenNamestrictfp : modifier = createModifier ( Modifier . ModifierKeyword . STRICTFP_KEYWORD ) ; break ; case TerminalTokens . TokenNameAT : if ( annotations != null && indexInAnnotations < annotations . length ) { org . eclipse . jdt . internal . compiler . ast . Annotation annotation = annotations [ indexInAnnotations ++ ] ; modifier = convert ( annotation ) ; this . scanner . resetTo ( annotation . declarationSourceEnd + <NUM_LIT:1> , this . compilationUnitSourceLength ) ; } break ; case TerminalTokens . TokenNameCOMMENT_BLOCK : case TerminalTokens . TokenNameCOMMENT_LINE : case TerminalTokens . TokenNameCOMMENT_JAVADOC : break ; default : return ; } if ( modifier != null ) { variableDecl . modifiers ( ) . add ( modifier ) ; } } } catch ( InvalidInputException e ) { } } } protected void setModifiers ( SingleVariableDeclaration variableDecl , LocalDeclaration localDeclaration ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : variableDecl . internalSetModifiers ( localDeclaration . modifiers & ExtraCompilerModifiers . AccJustFlag ) ; if ( localDeclaration . annotations != null ) { variableDecl . setFlags ( variableDecl . getFlags ( ) | ASTNode . MALFORMED ) ; } break ; default : this . scanner . resetTo ( localDeclaration . declarationSourceStart , localDeclaration . sourceStart ) ; org . eclipse . jdt . internal . compiler . ast . Annotation [ ] annotations = localDeclaration . annotations ; int indexInAnnotations = <NUM_LIT:0> ; try { int token ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { IExtendedModifier modifier = null ; switch ( token ) { case TerminalTokens . TokenNameabstract : modifier = createModifier ( Modifier . ModifierKeyword . ABSTRACT_KEYWORD ) ; break ; case TerminalTokens . TokenNamepublic : modifier = createModifier ( Modifier . ModifierKeyword . PUBLIC_KEYWORD ) ; break ; case TerminalTokens . TokenNamestatic : modifier = createModifier ( Modifier . ModifierKeyword . STATIC_KEYWORD ) ; break ; case TerminalTokens . TokenNameprotected : modifier = createModifier ( Modifier . ModifierKeyword . PROTECTED_KEYWORD ) ; break ; case TerminalTokens . TokenNameprivate : modifier = createModifier ( Modifier . ModifierKeyword . PRIVATE_KEYWORD ) ; break ; case TerminalTokens . TokenNamefinal : modifier = createModifier ( Modifier . ModifierKeyword . FINAL_KEYWORD ) ; break ; case TerminalTokens . TokenNamenative : modifier = createModifier ( Modifier . ModifierKeyword . NATIVE_KEYWORD ) ; break ; case TerminalTokens . TokenNamesynchronized : modifier = createModifier ( Modifier . ModifierKeyword . SYNCHRONIZED_KEYWORD ) ; break ; case TerminalTokens . TokenNametransient : modifier = createModifier ( Modifier . ModifierKeyword . TRANSIENT_KEYWORD ) ; break ; case TerminalTokens . TokenNamevolatile : modifier = createModifier ( Modifier . ModifierKeyword . VOLATILE_KEYWORD ) ; break ; case TerminalTokens . TokenNamestrictfp : modifier = createModifier ( Modifier . ModifierKeyword . STRICTFP_KEYWORD ) ; break ; case TerminalTokens . TokenNameAT : if ( annotations != null && indexInAnnotations < annotations . length ) { org . eclipse . jdt . internal . compiler . ast . Annotation annotation = annotations [ indexInAnnotations ++ ] ; modifier = convert ( annotation ) ; this . scanner . resetTo ( annotation . declarationSourceEnd + <NUM_LIT:1> , this . compilationUnitSourceLength ) ; } break ; case TerminalTokens . TokenNameCOMMENT_BLOCK : case TerminalTokens . TokenNameCOMMENT_LINE : case TerminalTokens . TokenNameCOMMENT_JAVADOC : break ; default : return ; } if ( modifier != null ) { variableDecl . modifiers ( ) . add ( modifier ) ; } } } catch ( InvalidInputException e ) { } } } protected void setModifiers ( TypeDeclaration typeDecl , org . eclipse . jdt . internal . compiler . ast . TypeDeclaration typeDeclaration ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : int modifiers = typeDeclaration . modifiers ; modifiers &= ~ ClassFileConstants . AccInterface ; modifiers &= ExtraCompilerModifiers . AccJustFlag ; typeDecl . internalSetModifiers ( modifiers ) ; if ( typeDeclaration . annotations != null ) { typeDecl . setFlags ( typeDecl . getFlags ( ) | ASTNode . MALFORMED ) ; } break ; default : this . scanner . resetTo ( typeDeclaration . declarationSourceStart , typeDeclaration . sourceStart ) ; this . setModifiers ( typeDecl , typeDeclaration . annotations , typeDeclaration . sourceStart ) ; } } protected void setModifiers ( VariableDeclarationExpression variableDeclarationExpression , LocalDeclaration localDeclaration ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : int modifiers = localDeclaration . modifiers & ExtraCompilerModifiers . AccJustFlag ; modifiers &= ~ ExtraCompilerModifiers . AccBlankFinal ; variableDeclarationExpression . internalSetModifiers ( modifiers ) ; if ( localDeclaration . annotations != null ) { variableDeclarationExpression . setFlags ( variableDeclarationExpression . getFlags ( ) | ASTNode . MALFORMED ) ; } break ; default : this . scanner . resetTo ( localDeclaration . declarationSourceStart , localDeclaration . sourceStart ) ; org . eclipse . jdt . internal . compiler . ast . Annotation [ ] annotations = localDeclaration . annotations ; int indexInAnnotations = <NUM_LIT:0> ; try { int token ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { IExtendedModifier modifier = null ; switch ( token ) { case TerminalTokens . TokenNameabstract : modifier = createModifier ( Modifier . ModifierKeyword . ABSTRACT_KEYWORD ) ; break ; case TerminalTokens . TokenNamepublic : modifier = createModifier ( Modifier . ModifierKeyword . PUBLIC_KEYWORD ) ; break ; case TerminalTokens . TokenNamestatic : modifier = createModifier ( Modifier . ModifierKeyword . STATIC_KEYWORD ) ; break ; case TerminalTokens . TokenNameprotected : modifier = createModifier ( Modifier . ModifierKeyword . PROTECTED_KEYWORD ) ; break ; case TerminalTokens . TokenNameprivate : modifier = createModifier ( Modifier . ModifierKeyword . PRIVATE_KEYWORD ) ; break ; case TerminalTokens . TokenNamefinal : modifier = createModifier ( Modifier . ModifierKeyword . FINAL_KEYWORD ) ; break ; case TerminalTokens . TokenNamenative : modifier = createModifier ( Modifier . ModifierKeyword . NATIVE_KEYWORD ) ; break ; case TerminalTokens . TokenNamesynchronized : modifier = createModifier ( Modifier . ModifierKeyword . SYNCHRONIZED_KEYWORD ) ; break ; case TerminalTokens . TokenNametransient : modifier = createModifier ( Modifier . ModifierKeyword . TRANSIENT_KEYWORD ) ; break ; case TerminalTokens . TokenNamevolatile : modifier = createModifier ( Modifier . ModifierKeyword . VOLATILE_KEYWORD ) ; break ; case TerminalTokens . TokenNamestrictfp : modifier = createModifier ( Modifier . ModifierKeyword . STRICTFP_KEYWORD ) ; break ; case TerminalTokens . TokenNameAT : if ( annotations != null && indexInAnnotations < annotations . length ) { org . eclipse . jdt . internal . compiler . ast . Annotation annotation = annotations [ indexInAnnotations ++ ] ; modifier = convert ( annotation ) ; this . scanner . resetTo ( annotation . declarationSourceEnd + <NUM_LIT:1> , this . compilationUnitSourceLength ) ; } break ; case TerminalTokens . TokenNameCOMMENT_BLOCK : case TerminalTokens . TokenNameCOMMENT_LINE : case TerminalTokens . TokenNameCOMMENT_JAVADOC : break ; default : return ; } if ( modifier != null ) { variableDeclarationExpression . modifiers ( ) . add ( modifier ) ; } } } catch ( InvalidInputException e ) { } } } protected void setModifiers ( VariableDeclarationStatement variableDeclarationStatement , LocalDeclaration localDeclaration ) { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : int modifiers = localDeclaration . modifiers & ExtraCompilerModifiers . AccJustFlag ; modifiers &= ~ ExtraCompilerModifiers . AccBlankFinal ; variableDeclarationStatement . internalSetModifiers ( modifiers ) ; if ( localDeclaration . annotations != null ) { variableDeclarationStatement . setFlags ( variableDeclarationStatement . getFlags ( ) | ASTNode . MALFORMED ) ; } break ; default : this . scanner . resetTo ( localDeclaration . declarationSourceStart , localDeclaration . sourceStart ) ; org . eclipse . jdt . internal . compiler . ast . Annotation [ ] annotations = localDeclaration . annotations ; int indexInAnnotations = <NUM_LIT:0> ; try { int token ; while ( ( token = this . scanner . getNextToken ( ) ) != TerminalTokens . TokenNameEOF ) { IExtendedModifier modifier = null ; switch ( token ) { case TerminalTokens . TokenNameabstract : modifier = createModifier ( Modifier . ModifierKeyword . ABSTRACT_KEYWORD ) ; break ; case TerminalTokens . TokenNamepublic : modifier = createModifier ( Modifier . ModifierKeyword . PUBLIC_KEYWORD ) ; break ; case TerminalTokens . TokenNamestatic : modifier = createModifier ( Modifier . ModifierKeyword . STATIC_KEYWORD ) ; break ; case TerminalTokens . TokenNameprotected : modifier = createModifier ( Modifier . ModifierKeyword . PROTECTED_KEYWORD ) ; break ; case TerminalTokens . TokenNameprivate : modifier = createModifier ( Modifier . ModifierKeyword . PRIVATE_KEYWORD ) ; break ; case TerminalTokens . TokenNamefinal : modifier = createModifier ( Modifier . ModifierKeyword . FINAL_KEYWORD ) ; break ; case TerminalTokens . TokenNamenative : modifier = createModifier ( Modifier . ModifierKeyword . NATIVE_KEYWORD ) ; break ; case TerminalTokens . TokenNamesynchronized : modifier = createModifier ( Modifier . ModifierKeyword . SYNCHRONIZED_KEYWORD ) ; break ; case TerminalTokens . TokenNametransient : modifier = createModifier ( Modifier . ModifierKeyword . TRANSIENT_KEYWORD ) ; break ; case TerminalTokens . TokenNamevolatile : modifier = createModifier ( Modifier . ModifierKeyword . VOLATILE_KEYWORD ) ; break ; case TerminalTokens . TokenNamestrictfp : modifier = createModifier ( Modifier . ModifierKeyword . STRICTFP_KEYWORD ) ; break ; case TerminalTokens . TokenNameAT : if ( annotations != null && indexInAnnotations < annotations . length ) { org . eclipse . jdt . internal . compiler . ast . Annotation annotation = annotations [ indexInAnnotations ++ ] ; modifier = convert ( annotation ) ; this . scanner . resetTo ( annotation . declarationSourceEnd + <NUM_LIT:1> , this . compilationUnitSourceLength ) ; } break ; case TerminalTokens . TokenNameCOMMENT_BLOCK : case TerminalTokens . TokenNameCOMMENT_LINE : case TerminalTokens . TokenNameCOMMENT_JAVADOC : break ; default : return ; } if ( modifier != null ) { variableDeclarationStatement . modifiers ( ) . add ( modifier ) ; } } } catch ( InvalidInputException e ) { } } } protected QualifiedName setQualifiedNameNameAndSourceRanges ( char [ ] [ ] typeName , long [ ] positions , org . eclipse . jdt . internal . compiler . ast . ASTNode node ) { int length = typeName . length ; final SimpleName firstToken = new SimpleName ( this . ast ) ; firstToken . internalSetIdentifier ( new String ( typeName [ <NUM_LIT:0> ] ) ) ; firstToken . index = <NUM_LIT:1> ; int start0 = ( int ) ( positions [ <NUM_LIT:0> ] > > > <NUM_LIT:32> ) ; int start = start0 ; int end = ( int ) ( positions [ <NUM_LIT:0> ] & <NUM_LIT> ) ; firstToken . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; final SimpleName secondToken = new SimpleName ( this . ast ) ; secondToken . internalSetIdentifier ( new String ( typeName [ <NUM_LIT:1> ] ) ) ; secondToken . index = <NUM_LIT:2> ; start = ( int ) ( positions [ <NUM_LIT:1> ] > > > <NUM_LIT:32> ) ; end = ( int ) ( positions [ <NUM_LIT:1> ] & <NUM_LIT> ) ; secondToken . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; QualifiedName qualifiedName = new QualifiedName ( this . ast ) ; qualifiedName . setQualifier ( firstToken ) ; qualifiedName . setName ( secondToken ) ; if ( this . resolveBindings ) { recordNodes ( qualifiedName , node ) ; recordPendingNameScopeResolution ( qualifiedName ) ; recordNodes ( firstToken , node ) ; recordNodes ( secondToken , node ) ; recordPendingNameScopeResolution ( firstToken ) ; recordPendingNameScopeResolution ( secondToken ) ; } qualifiedName . index = <NUM_LIT:2> ; qualifiedName . setSourceRange ( start0 , end - start0 + <NUM_LIT:1> ) ; SimpleName newPart = null ; for ( int i = <NUM_LIT:2> ; i < length ; i ++ ) { newPart = new SimpleName ( this . ast ) ; newPart . internalSetIdentifier ( new String ( typeName [ i ] ) ) ; newPart . index = i + <NUM_LIT:1> ; start = ( int ) ( positions [ i ] > > > <NUM_LIT:32> ) ; end = ( int ) ( positions [ i ] & <NUM_LIT> ) ; newPart . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; QualifiedName qualifiedName2 = new QualifiedName ( this . ast ) ; qualifiedName2 . setQualifier ( qualifiedName ) ; qualifiedName2 . setName ( newPart ) ; qualifiedName = qualifiedName2 ; qualifiedName . index = newPart . index ; qualifiedName . setSourceRange ( start0 , end - start0 + <NUM_LIT:1> ) ; if ( this . resolveBindings ) { recordNodes ( qualifiedName , node ) ; recordNodes ( newPart , node ) ; recordPendingNameScopeResolution ( qualifiedName ) ; recordPendingNameScopeResolution ( newPart ) ; } } QualifiedName name = qualifiedName ; if ( this . resolveBindings ) { recordNodes ( name , node ) ; recordPendingNameScopeResolution ( name ) ; } return name ; } protected QualifiedName setQualifiedNameNameAndSourceRanges ( char [ ] [ ] typeName , long [ ] positions , int endingIndex , org . eclipse . jdt . internal . compiler . ast . ASTNode node ) { int length = endingIndex + <NUM_LIT:1> ; final SimpleName firstToken = new SimpleName ( this . ast ) ; firstToken . internalSetIdentifier ( new String ( typeName [ <NUM_LIT:0> ] ) ) ; firstToken . index = <NUM_LIT:1> ; int start0 = ( int ) ( positions [ <NUM_LIT:0> ] > > > <NUM_LIT:32> ) ; int start = start0 ; int end = ( int ) positions [ <NUM_LIT:0> ] ; firstToken . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; final SimpleName secondToken = new SimpleName ( this . ast ) ; secondToken . internalSetIdentifier ( new String ( typeName [ <NUM_LIT:1> ] ) ) ; secondToken . index = <NUM_LIT:2> ; start = ( int ) ( positions [ <NUM_LIT:1> ] > > > <NUM_LIT:32> ) ; end = ( int ) positions [ <NUM_LIT:1> ] ; secondToken . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; QualifiedName qualifiedName = new QualifiedName ( this . ast ) ; qualifiedName . setQualifier ( firstToken ) ; qualifiedName . setName ( secondToken ) ; if ( this . resolveBindings ) { recordNodes ( qualifiedName , node ) ; recordPendingNameScopeResolution ( qualifiedName ) ; recordNodes ( firstToken , node ) ; recordNodes ( secondToken , node ) ; recordPendingNameScopeResolution ( firstToken ) ; recordPendingNameScopeResolution ( secondToken ) ; } qualifiedName . index = <NUM_LIT:2> ; qualifiedName . setSourceRange ( start0 , end - start0 + <NUM_LIT:1> ) ; SimpleName newPart = null ; for ( int i = <NUM_LIT:2> ; i < length ; i ++ ) { newPart = new SimpleName ( this . ast ) ; newPart . internalSetIdentifier ( new String ( typeName [ i ] ) ) ; newPart . index = i + <NUM_LIT:1> ; start = ( int ) ( positions [ i ] > > > <NUM_LIT:32> ) ; end = ( int ) positions [ i ] ; newPart . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; QualifiedName qualifiedName2 = new QualifiedName ( this . ast ) ; qualifiedName2 . setQualifier ( qualifiedName ) ; qualifiedName2 . setName ( newPart ) ; qualifiedName = qualifiedName2 ; qualifiedName . index = newPart . index ; qualifiedName . setSourceRange ( start0 , end - start0 + <NUM_LIT:1> ) ; if ( this . resolveBindings ) { recordNodes ( qualifiedName , node ) ; recordNodes ( newPart , node ) ; recordPendingNameScopeResolution ( qualifiedName ) ; recordPendingNameScopeResolution ( newPart ) ; } } if ( newPart == null && this . resolveBindings ) { recordNodes ( qualifiedName , node ) ; recordPendingNameScopeResolution ( qualifiedName ) ; } return qualifiedName ; } protected void setTypeNameForAnnotation ( org . eclipse . jdt . internal . compiler . ast . Annotation compilerAnnotation , Annotation annotation ) { TypeReference typeReference = compilerAnnotation . type ; if ( typeReference instanceof QualifiedTypeReference ) { QualifiedTypeReference qualifiedTypeReference = ( QualifiedTypeReference ) typeReference ; char [ ] [ ] tokens = qualifiedTypeReference . tokens ; long [ ] positions = qualifiedTypeReference . sourcePositions ; annotation . setTypeName ( setQualifiedNameNameAndSourceRanges ( tokens , positions , typeReference ) ) ; } else { SingleTypeReference singleTypeReference = ( SingleTypeReference ) typeReference ; final SimpleName name = new SimpleName ( this . ast ) ; name . internalSetIdentifier ( new String ( singleTypeReference . token ) ) ; int start = singleTypeReference . sourceStart ; int end = singleTypeReference . sourceEnd ; name . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; name . index = <NUM_LIT:1> ; annotation . setTypeName ( name ) ; if ( this . resolveBindings ) { recordNodes ( name , typeReference ) ; } } } protected void setTypeForField ( FieldDeclaration fieldDeclaration , Type type , int extraDimension ) { if ( extraDimension != <NUM_LIT:0> ) { if ( type . isArrayType ( ) ) { ArrayType arrayType = ( ArrayType ) type ; int remainingDimensions = arrayType . getDimensions ( ) - extraDimension ; if ( remainingDimensions == <NUM_LIT:0> ) { Type elementType = arrayType . getElementType ( ) ; elementType . setParent ( null , null ) ; this . ast . getBindingResolver ( ) . updateKey ( type , elementType ) ; fieldDeclaration . setType ( elementType ) ; } else { int start = type . getStartPosition ( ) ; ArrayType subarrayType = arrayType ; int index = extraDimension ; while ( index > <NUM_LIT:0> ) { subarrayType = ( ArrayType ) subarrayType . getComponentType ( ) ; index -- ; } int end = retrieveProperRightBracketPosition ( remainingDimensions , start ) ; subarrayType . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; subarrayType . setParent ( null , null ) ; fieldDeclaration . setType ( subarrayType ) ; updateInnerPositions ( subarrayType , remainingDimensions ) ; this . ast . getBindingResolver ( ) . updateKey ( type , subarrayType ) ; } } else { fieldDeclaration . setType ( type ) ; } } else { if ( type . isArrayType ( ) ) { int dimensions = ( ( ArrayType ) type ) . getDimensions ( ) ; updateInnerPositions ( type , dimensions ) ; } fieldDeclaration . setType ( type ) ; } } protected void setTypeForMethodDeclaration ( MethodDeclaration methodDeclaration , Type type , int extraDimension ) { if ( extraDimension != <NUM_LIT:0> ) { if ( type . isArrayType ( ) ) { ArrayType arrayType = ( ArrayType ) type ; int remainingDimensions = arrayType . getDimensions ( ) - extraDimension ; if ( remainingDimensions == <NUM_LIT:0> ) { Type elementType = arrayType . getElementType ( ) ; elementType . setParent ( null , null ) ; this . ast . getBindingResolver ( ) . updateKey ( type , elementType ) ; switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : methodDeclaration . internalSetReturnType ( elementType ) ; break ; default : methodDeclaration . setReturnType2 ( elementType ) ; break ; } } else { int start = type . getStartPosition ( ) ; ArrayType subarrayType = arrayType ; int index = extraDimension ; while ( index > <NUM_LIT:0> ) { subarrayType = ( ArrayType ) subarrayType . getComponentType ( ) ; index -- ; } int end = retrieveProperRightBracketPosition ( remainingDimensions , start ) ; subarrayType . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; subarrayType . setParent ( null , null ) ; updateInnerPositions ( subarrayType , remainingDimensions ) ; switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : methodDeclaration . internalSetReturnType ( subarrayType ) ; break ; default : methodDeclaration . setReturnType2 ( subarrayType ) ; break ; } this . ast . getBindingResolver ( ) . updateKey ( type , subarrayType ) ; } } else { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : methodDeclaration . internalSetReturnType ( type ) ; break ; default : methodDeclaration . setReturnType2 ( type ) ; break ; } } } else { switch ( this . ast . apiLevel ) { case AST . JLS2_INTERNAL : methodDeclaration . internalSetReturnType ( type ) ; break ; default : methodDeclaration . setReturnType2 ( type ) ; break ; } } } protected void setTypeForMethodDeclaration ( AnnotationTypeMemberDeclaration annotationTypeMemberDeclaration , Type type , int extraDimension ) { annotationTypeMemberDeclaration . setType ( type ) ; } protected void setTypeForSingleVariableDeclaration ( SingleVariableDeclaration singleVariableDeclaration , Type type , int extraDimension ) { if ( extraDimension != <NUM_LIT:0> ) { if ( type . isArrayType ( ) ) { ArrayType arrayType = ( ArrayType ) type ; int remainingDimensions = arrayType . getDimensions ( ) - extraDimension ; if ( remainingDimensions == <NUM_LIT:0> ) { Type elementType = arrayType . getElementType ( ) ; elementType . setParent ( null , null ) ; this . ast . getBindingResolver ( ) . updateKey ( type , elementType ) ; singleVariableDeclaration . setType ( elementType ) ; } else { int start = type . getStartPosition ( ) ; ArrayType subarrayType = arrayType ; int index = extraDimension ; while ( index > <NUM_LIT:0> ) { subarrayType = ( ArrayType ) subarrayType . getComponentType ( ) ; index -- ; } int end = retrieveProperRightBracketPosition ( remainingDimensions , start ) ; subarrayType . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; subarrayType . setParent ( null , null ) ; updateInnerPositions ( subarrayType , remainingDimensions ) ; singleVariableDeclaration . setType ( subarrayType ) ; this . ast . getBindingResolver ( ) . updateKey ( type , subarrayType ) ; } } else { singleVariableDeclaration . setType ( type ) ; } } else { singleVariableDeclaration . setType ( type ) ; } } protected void setTypeForVariableDeclarationExpression ( VariableDeclarationExpression variableDeclarationExpression , Type type , int extraDimension ) { if ( extraDimension != <NUM_LIT:0> ) { if ( type . isArrayType ( ) ) { ArrayType arrayType = ( ArrayType ) type ; int remainingDimensions = arrayType . getDimensions ( ) - extraDimension ; if ( remainingDimensions == <NUM_LIT:0> ) { Type elementType = arrayType . getElementType ( ) ; elementType . setParent ( null , null ) ; this . ast . getBindingResolver ( ) . updateKey ( type , elementType ) ; variableDeclarationExpression . setType ( elementType ) ; } else { int start = type . getStartPosition ( ) ; ArrayType subarrayType = arrayType ; int index = extraDimension ; while ( index > <NUM_LIT:0> ) { subarrayType = ( ArrayType ) subarrayType . getComponentType ( ) ; index -- ; } int end = retrieveProperRightBracketPosition ( remainingDimensions , start ) ; subarrayType . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; subarrayType . setParent ( null , null ) ; updateInnerPositions ( subarrayType , remainingDimensions ) ; variableDeclarationExpression . setType ( subarrayType ) ; this . ast . getBindingResolver ( ) . updateKey ( type , subarrayType ) ; } } else { variableDeclarationExpression . setType ( type ) ; } } else { variableDeclarationExpression . setType ( type ) ; } } protected void setTypeForVariableDeclarationStatement ( VariableDeclarationStatement variableDeclarationStatement , Type type , int extraDimension ) { if ( extraDimension != <NUM_LIT:0> ) { if ( type . isArrayType ( ) ) { ArrayType arrayType = ( ArrayType ) type ; int remainingDimensions = arrayType . getDimensions ( ) - extraDimension ; if ( remainingDimensions == <NUM_LIT:0> ) { Type elementType = arrayType . getElementType ( ) ; elementType . setParent ( null , null ) ; this . ast . getBindingResolver ( ) . updateKey ( type , elementType ) ; variableDeclarationStatement . setType ( elementType ) ; } else { int start = type . getStartPosition ( ) ; ArrayType subarrayType = arrayType ; int index = extraDimension ; while ( index > <NUM_LIT:0> ) { subarrayType = ( ArrayType ) subarrayType . getComponentType ( ) ; index -- ; } int end = retrieveProperRightBracketPosition ( remainingDimensions , start ) ; subarrayType . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; subarrayType . setParent ( null , null ) ; updateInnerPositions ( subarrayType , remainingDimensions ) ; variableDeclarationStatement . setType ( subarrayType ) ; this . ast . getBindingResolver ( ) . updateKey ( type , subarrayType ) ; } } else { variableDeclarationStatement . setType ( type ) ; } } else { variableDeclarationStatement . setType ( type ) ; } } protected void updateInnerPositions ( Type type , int dimensions ) { if ( dimensions > <NUM_LIT:1> ) { int start = type . getStartPosition ( ) ; Type currentComponentType = ( ( ArrayType ) type ) . getComponentType ( ) ; int searchedDimension = dimensions - <NUM_LIT:1> ; int rightBracketEndPosition = start ; while ( currentComponentType . isArrayType ( ) ) { rightBracketEndPosition = retrieveProperRightBracketPosition ( searchedDimension , start ) ; currentComponentType . setSourceRange ( start , rightBracketEndPosition - start + <NUM_LIT:1> ) ; currentComponentType = ( ( ArrayType ) currentComponentType ) . getComponentType ( ) ; searchedDimension -- ; } } } } </s>
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class ConstructorInvocation extends Statement { public static final ChildListPropertyDescriptor TYPE_ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor ( ConstructorInvocation . class , "<STR_LIT>" , Type . class , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor ( ConstructorInvocation . 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 properyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( ConstructorInvocation . class , properyList ) ; addProperty ( ARGUMENTS_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( properyList ) ; properyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( ConstructorInvocation . class , properyList ) ; addProperty ( TYPE_ARGUMENTS_PROPERTY , properyList ) ; addProperty ( ARGUMENTS_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 ASTNode . NodeList typeArguments = null ; private ASTNode . NodeList arguments = new ASTNode . NodeList ( ARGUMENTS_PROPERTY ) ; ConstructorInvocation ( AST ast ) { super ( ast ) ; if ( ast . apiLevel >= AST . JLS3_INTERNAL ) { this . typeArguments = new ASTNode . NodeList ( TYPE_ARGUMENTS_PROPERTY ) ; } } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } 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 CONSTRUCTOR_INVOCATION ; } ASTNode clone0 ( AST target ) { ConstructorInvocation result = new ConstructorInvocation ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; if ( this . ast . apiLevel >= AST . JLS3_INTERNAL ) { 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 ) { if ( this . ast . apiLevel >= AST . JLS3_INTERNAL ) { acceptChildren ( visitor , this . typeArguments ) ; } acceptChildren ( visitor , this . arguments ) ; } visitor . endVisit ( this ) ; } 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:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( 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 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_INTERNAL ) { 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_INTERNAL ) { 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 . Iterator ; import java . util . List ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . compiler . InvalidInputException ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . parser . AbstractCommentParser ; import org . eclipse . jdt . internal . compiler . parser . Scanner ; import org . eclipse . jdt . internal . compiler . parser . ScannerHelper ; import org . eclipse . jdt . internal . compiler . parser . TerminalTokens ; class DocCommentParser extends AbstractCommentParser { private Javadoc docComment ; private AST ast ; DocCommentParser ( AST ast , Scanner scanner , boolean check ) { super ( null ) ; this . ast = ast ; this . scanner = scanner ; switch ( this . ast . apiLevel ( ) ) { case AST . JLS2_INTERNAL : this . sourceLevel = ClassFileConstants . JDK1_3 ; break ; case AST . JLS3_INTERNAL : this . sourceLevel = ClassFileConstants . JDK1_5 ; break ; default : this . sourceLevel = ClassFileConstants . JDK1_7 ; } this . checkDocComment = check ; this . kind = DOM_PARSER | TEXT_PARSE ; } public Javadoc parse ( int [ ] positions ) { return parse ( positions [ <NUM_LIT:0> ] , positions [ <NUM_LIT:1> ] - positions [ <NUM_LIT:0> ] ) ; } public Javadoc parse ( int start , int length ) { this . source = this . scanner . source ; this . lineEnds = this . scanner . lineEnds ; this . docComment = new Javadoc ( this . ast ) ; if ( this . checkDocComment ) { this . javadocStart = start ; this . javadocEnd = start + length - <NUM_LIT:1> ; this . firstTagPosition = this . javadocStart ; commentParse ( ) ; } this . docComment . setSourceRange ( start , length ) ; if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { setComment ( start , length ) ; } return this . docComment ; } private void setComment ( int start , int length ) { this . docComment . setComment ( new String ( this . source , start , length ) ) ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) . append ( this . docComment ) . append ( "<STR_LIT:n>" ) ; buffer . append ( super . toString ( ) ) ; return buffer . toString ( ) ; } protected Object createArgumentReference ( char [ ] name , int dim , boolean isVarargs , Object typeRef , long [ ] dimPositions , long argNamePos ) throws InvalidInputException { try { MethodRefParameter argument = this . ast . newMethodRefParameter ( ) ; ASTNode node = ( ASTNode ) typeRef ; int argStart = node . getStartPosition ( ) ; int argEnd = node . getStartPosition ( ) + node . getLength ( ) - <NUM_LIT:1> ; if ( dim > <NUM_LIT:0> ) argEnd = ( int ) dimPositions [ dim - <NUM_LIT:1> ] ; if ( argNamePos >= <NUM_LIT:0> ) argEnd = ( int ) argNamePos ; if ( name . length != <NUM_LIT:0> ) { final SimpleName argName = new SimpleName ( this . ast ) ; argName . internalSetIdentifier ( new String ( name ) ) ; argument . setName ( argName ) ; int argNameStart = ( int ) ( argNamePos > > > <NUM_LIT:32> ) ; argName . setSourceRange ( argNameStart , argEnd - argNameStart + <NUM_LIT:1> ) ; } Type argType = null ; if ( node . getNodeType ( ) == ASTNode . PRIMITIVE_TYPE ) { argType = ( PrimitiveType ) node ; } else { Name argTypeName = ( Name ) node ; argType = this . ast . newSimpleType ( argTypeName ) ; argType . setSourceRange ( argStart , node . getLength ( ) ) ; } if ( dim > <NUM_LIT:0> && ! isVarargs ) { for ( int i = <NUM_LIT:0> ; i < dim ; i ++ ) { argType = this . ast . newArrayType ( argType ) ; argType . setSourceRange ( argStart , ( ( int ) dimPositions [ i ] ) - argStart + <NUM_LIT:1> ) ; } } argument . setType ( argType ) ; argument . setSourceRange ( argStart , argEnd - argStart + <NUM_LIT:1> ) ; return argument ; } catch ( ClassCastException ex ) { throw new InvalidInputException ( ) ; } } protected Object createFieldReference ( Object receiver ) throws InvalidInputException { try { MemberRef fieldRef = this . ast . newMemberRef ( ) ; SimpleName fieldName = new SimpleName ( this . ast ) ; fieldName . internalSetIdentifier ( new String ( this . identifierStack [ <NUM_LIT:0> ] ) ) ; fieldRef . setName ( fieldName ) ; int start = ( int ) ( this . identifierPositionStack [ <NUM_LIT:0> ] > > > <NUM_LIT:32> ) ; int end = ( int ) this . identifierPositionStack [ <NUM_LIT:0> ] ; fieldName . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; if ( receiver == null ) { start = this . memberStart ; fieldRef . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; } else { Name typeRef = ( Name ) receiver ; fieldRef . setQualifier ( typeRef ) ; start = typeRef . getStartPosition ( ) ; end = fieldName . getStartPosition ( ) + fieldName . getLength ( ) - <NUM_LIT:1> ; fieldRef . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; } return fieldRef ; } catch ( ClassCastException ex ) { throw new InvalidInputException ( ) ; } } protected Object createMethodReference ( Object receiver , List arguments ) throws InvalidInputException { try { MethodRef methodRef = this . ast . newMethodRef ( ) ; SimpleName methodName = new SimpleName ( this . ast ) ; int length = this . identifierLengthStack [ <NUM_LIT:0> ] - <NUM_LIT:1> ; methodName . internalSetIdentifier ( new String ( this . identifierStack [ length ] ) ) ; methodRef . setName ( methodName ) ; int start = ( int ) ( this . identifierPositionStack [ length ] > > > <NUM_LIT:32> ) ; int end = ( int ) this . identifierPositionStack [ length ] ; methodName . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; if ( receiver == null ) { start = this . memberStart ; methodRef . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; } else { Name typeRef = ( Name ) receiver ; methodRef . setQualifier ( typeRef ) ; start = typeRef . getStartPosition ( ) ; } if ( arguments != null ) { Iterator parameters = arguments . listIterator ( ) ; while ( parameters . hasNext ( ) ) { MethodRefParameter param = ( MethodRefParameter ) parameters . next ( ) ; methodRef . parameters ( ) . add ( param ) ; } } methodRef . setSourceRange ( start , this . scanner . getCurrentTokenEndPosition ( ) - start + <NUM_LIT:1> ) ; return methodRef ; } catch ( ClassCastException ex ) { throw new InvalidInputException ( ) ; } } protected void createTag ( ) { TagElement tagElement = this . ast . newTagElement ( ) ; int position = this . scanner . currentPosition ; this . scanner . resetTo ( this . tagSourceStart , this . tagSourceEnd ) ; StringBuffer tagName = new StringBuffer ( ) ; int start = this . tagSourceStart ; this . scanner . getNextChar ( ) ; while ( this . scanner . currentPosition <= ( this . tagSourceEnd + <NUM_LIT:1> ) ) { tagName . append ( this . scanner . currentCharacter ) ; this . scanner . getNextChar ( ) ; } tagElement . setTagName ( tagName . toString ( ) ) ; if ( this . inlineTagStarted ) { start = this . inlineTagStart ; TagElement previousTag = null ; if ( this . astPtr == - <NUM_LIT:1> ) { previousTag = this . ast . newTagElement ( ) ; previousTag . setSourceRange ( start , this . tagSourceEnd - start + <NUM_LIT:1> ) ; pushOnAstStack ( previousTag , true ) ; } else { previousTag = ( TagElement ) this . astStack [ this . astPtr ] ; } int previousStart = previousTag . getStartPosition ( ) ; previousTag . fragments ( ) . add ( tagElement ) ; previousTag . setSourceRange ( previousStart , this . tagSourceEnd - previousStart + <NUM_LIT:1> ) ; } else { pushOnAstStack ( tagElement , true ) ; } tagElement . setSourceRange ( start , this . tagSourceEnd - start + <NUM_LIT:1> ) ; this . scanner . resetTo ( position , this . javadocEnd ) ; } protected Object createTypeReference ( int primitiveToken ) { int size = this . identifierLengthStack [ this . identifierLengthPtr ] ; String [ ] identifiers = new String [ size ] ; int pos = this . identifierPtr - size + <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { identifiers [ i ] = new String ( this . identifierStack [ pos + i ] ) ; } ASTNode typeRef = null ; if ( primitiveToken == - <NUM_LIT:1> ) { typeRef = this . ast . internalNewName ( identifiers ) ; } else { switch ( primitiveToken ) { case TerminalTokens . TokenNamevoid : typeRef = this . ast . newPrimitiveType ( PrimitiveType . VOID ) ; break ; case TerminalTokens . TokenNameboolean : typeRef = this . ast . newPrimitiveType ( PrimitiveType . BOOLEAN ) ; break ; case TerminalTokens . TokenNamebyte : typeRef = this . ast . newPrimitiveType ( PrimitiveType . BYTE ) ; break ; case TerminalTokens . TokenNamechar : typeRef = this . ast . newPrimitiveType ( PrimitiveType . CHAR ) ; break ; case TerminalTokens . TokenNamedouble : typeRef = this . ast . newPrimitiveType ( PrimitiveType . DOUBLE ) ; break ; case TerminalTokens . TokenNamefloat : typeRef = this . ast . newPrimitiveType ( PrimitiveType . FLOAT ) ; break ; case TerminalTokens . TokenNameint : typeRef = this . ast . newPrimitiveType ( PrimitiveType . INT ) ; break ; case TerminalTokens . TokenNamelong : typeRef = this . ast . newPrimitiveType ( PrimitiveType . LONG ) ; break ; case TerminalTokens . TokenNameshort : typeRef = this . ast . newPrimitiveType ( PrimitiveType . SHORT ) ; break ; default : return null ; } } int start = ( int ) ( this . identifierPositionStack [ pos ] > > > <NUM_LIT:32> ) ; if ( size > <NUM_LIT:1> ) { Name name = ( Name ) typeRef ; int nameIndex = size ; for ( int i = this . identifierPtr ; i > pos ; i -- , nameIndex -- ) { int s = ( int ) ( this . identifierPositionStack [ i ] > > > <NUM_LIT:32> ) ; int e = ( int ) this . identifierPositionStack [ i ] ; name . index = nameIndex ; SimpleName simpleName = ( ( QualifiedName ) name ) . getName ( ) ; simpleName . index = nameIndex ; simpleName . setSourceRange ( s , e - s + <NUM_LIT:1> ) ; name . setSourceRange ( start , e - start + <NUM_LIT:1> ) ; name = ( ( QualifiedName ) name ) . getQualifier ( ) ; } int end = ( int ) this . identifierPositionStack [ pos ] ; name . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; name . index = nameIndex ; } else { int end = ( int ) this . identifierPositionStack [ pos ] ; typeRef . setSourceRange ( start , end - start + <NUM_LIT:1> ) ; } return typeRef ; } protected boolean parseIdentifierTag ( boolean report ) { if ( super . parseIdentifierTag ( report ) ) { createTag ( ) ; this . index = this . tagSourceEnd + <NUM_LIT:1> ; this . scanner . resetTo ( this . index , this . javadocEnd ) ; return true ; } return false ; } protected boolean parseReturn ( ) { createTag ( ) ; return true ; } protected boolean parseTag ( int previousPosition ) throws InvalidInputException { int currentPosition = this . index ; int token = readTokenAndConsume ( ) ; char [ ] tagName = CharOperation . NO_CHAR ; if ( currentPosition == this . scanner . startPosition ) { this . tagSourceStart = this . scanner . getCurrentTokenStartPosition ( ) ; this . tagSourceEnd = this . scanner . getCurrentTokenEndPosition ( ) ; tagName = this . scanner . getCurrentIdentifierSource ( ) ; } else { this . tagSourceEnd = currentPosition - <NUM_LIT:1> ; } if ( this . scanner . currentCharacter != '<CHAR_LIT:U+0020>' && ! ScannerHelper . isWhitespace ( this . scanner . currentCharacter ) ) { tagNameToken : while ( token != TerminalTokens . TokenNameEOF && this . index < this . scanner . eofPosition ) { int length = tagName . length ; switch ( this . scanner . currentCharacter ) { case '<CHAR_LIT:}>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<STR_LIT>' : case '<CHAR_LIT:">' : case '<CHAR_LIT::>' : case '<CHAR_LIT>' : case '<CHAR_LIT:>>' : break tagNameToken ; case '<CHAR_LIT:->' : System . arraycopy ( tagName , <NUM_LIT:0> , tagName = new char [ length + <NUM_LIT:1> ] , <NUM_LIT:0> , length ) ; tagName [ length ] = this . scanner . currentCharacter ; break ; default : if ( this . scanner . currentCharacter == '<CHAR_LIT:U+0020>' || ScannerHelper . isWhitespace ( this . scanner . currentCharacter ) ) { break tagNameToken ; } token = readTokenAndConsume ( ) ; char [ ] ident = this . scanner . getCurrentIdentifierSource ( ) ; System . arraycopy ( tagName , <NUM_LIT:0> , tagName = new char [ length + ident . length ] , <NUM_LIT:0> , length ) ; System . arraycopy ( ident , <NUM_LIT:0> , tagName , length , ident . length ) ; break ; } this . tagSourceEnd = this . scanner . getCurrentTokenEndPosition ( ) ; this . scanner . getNextChar ( ) ; this . index = this . scanner . currentPosition ; } } int length = tagName . length ; this . index = this . tagSourceEnd + <NUM_LIT:1> ; this . scanner . currentPosition = this . tagSourceEnd + <NUM_LIT:1> ; this . tagSourceStart = previousPosition ; if ( tagName . length == <NUM_LIT:0> ) { return false ; } this . tagValue = NO_TAG_VALUE ; boolean valid = true ; switch ( token ) { case TerminalTokens . TokenNameIdentifier : switch ( tagName [ <NUM_LIT:0> ] ) { case '<CHAR_LIT:c>' : if ( length == TAG_CATEGORY_LENGTH && CharOperation . equals ( TAG_CATEGORY , tagName ) ) { this . tagValue = TAG_CATEGORY_VALUE ; valid = parseIdentifierTag ( false ) ; } else { this . tagValue = TAG_OTHERS_VALUE ; createTag ( ) ; } break ; case '<CHAR_LIT>' : if ( length == TAG_DEPRECATED_LENGTH && CharOperation . equals ( TAG_DEPRECATED , tagName ) ) { this . deprecated = true ; this . tagValue = TAG_DEPRECATED_VALUE ; } else { this . tagValue = TAG_OTHERS_VALUE ; } createTag ( ) ; break ; case '<CHAR_LIT>' : if ( length == TAG_INHERITDOC_LENGTH && CharOperation . equals ( TAG_INHERITDOC , tagName ) ) { if ( this . reportProblems ) { recordInheritedPosition ( ( ( ( long ) this . tagSourceStart ) << <NUM_LIT:32> ) + this . tagSourceEnd ) ; } this . tagValue = TAG_INHERITDOC_VALUE ; } else { this . tagValue = TAG_OTHERS_VALUE ; } createTag ( ) ; break ; case '<CHAR_LIT>' : if ( length == TAG_PARAM_LENGTH && CharOperation . equals ( TAG_PARAM , tagName ) ) { this . tagValue = TAG_PARAM_VALUE ; valid = parseParam ( ) ; } else { this . tagValue = TAG_OTHERS_VALUE ; createTag ( ) ; } break ; case '<CHAR_LIT:e>' : if ( length == TAG_EXCEPTION_LENGTH && CharOperation . equals ( TAG_EXCEPTION , tagName ) ) { this . tagValue = TAG_EXCEPTION_VALUE ; valid = parseThrows ( ) ; } else { this . tagValue = TAG_OTHERS_VALUE ; createTag ( ) ; } break ; case '<CHAR_LIT>' : if ( length == TAG_SEE_LENGTH && CharOperation . equals ( TAG_SEE , tagName ) ) { this . tagValue = TAG_SEE_VALUE ; if ( this . inlineTagStarted ) { valid = false ; } else { valid = parseReference ( ) ; } } else { this . tagValue = TAG_OTHERS_VALUE ; createTag ( ) ; } break ; case '<CHAR_LIT>' : if ( length == TAG_LINK_LENGTH && CharOperation . equals ( TAG_LINK , tagName ) ) { this . tagValue = TAG_LINK_VALUE ; } else if ( length == TAG_LINKPLAIN_LENGTH && CharOperation . equals ( TAG_LINKPLAIN , tagName ) ) { this . tagValue = TAG_LINKPLAIN_VALUE ; } if ( this . tagValue != NO_TAG_VALUE ) { if ( this . inlineTagStarted ) { valid = parseReference ( ) ; } else { valid = false ; } } else { this . tagValue = TAG_OTHERS_VALUE ; createTag ( ) ; } break ; case '<CHAR_LIT>' : if ( this . sourceLevel >= ClassFileConstants . JDK1_5 && length == TAG_VALUE_LENGTH && CharOperation . equals ( TAG_VALUE , tagName ) ) { this . tagValue = TAG_VALUE_VALUE ; if ( this . inlineTagStarted ) { valid = parseReference ( ) ; } else { valid = false ; } } else { this . tagValue = TAG_OTHERS_VALUE ; createTag ( ) ; } break ; default : this . tagValue = TAG_OTHERS_VALUE ; createTag ( ) ; } break ; case TerminalTokens . TokenNamereturn : this . tagValue = TAG_RETURN_VALUE ; valid = parseReturn ( ) ; break ; case TerminalTokens . TokenNamethrows : this . tagValue = TAG_THROWS_VALUE ; valid = parseThrows ( ) ; break ; case TerminalTokens . TokenNameabstract : case TerminalTokens . TokenNameassert : case TerminalTokens . TokenNameboolean : case TerminalTokens . TokenNamebreak : case TerminalTokens . TokenNamebyte : case TerminalTokens . TokenNamecase : case TerminalTokens . TokenNamecatch : case TerminalTokens . TokenNamechar : case TerminalTokens . TokenNameclass : case TerminalTokens . TokenNamecontinue : case TerminalTokens . TokenNamedefault : case TerminalTokens . TokenNamedo : case TerminalTokens . TokenNamedouble : case TerminalTokens . TokenNameelse : case TerminalTokens . TokenNameextends : case TerminalTokens . TokenNamefalse : case TerminalTokens . TokenNamefinal : case TerminalTokens . TokenNamefinally : case TerminalTokens . TokenNamefloat : case TerminalTokens . TokenNamefor : case TerminalTokens . TokenNameif : case TerminalTokens . TokenNameimplements : case TerminalTokens . TokenNameimport : case TerminalTokens . TokenNameinstanceof : case TerminalTokens . TokenNameint : case TerminalTokens . TokenNameinterface : case TerminalTokens . TokenNamelong : case TerminalTokens . TokenNamenative : case TerminalTokens . TokenNamenew : case TerminalTokens . TokenNamenull : case TerminalTokens . TokenNamepackage : case TerminalTokens . TokenNameprivate : case TerminalTokens . TokenNameprotected : case TerminalTokens . TokenNamepublic : case TerminalTokens . TokenNameshort : case TerminalTokens . TokenNamestatic : case TerminalTokens . TokenNamestrictfp : case TerminalTokens . TokenNamesuper : case TerminalTokens . TokenNameswitch : case TerminalTokens . TokenNamesynchronized : case TerminalTokens . TokenNamethis : case TerminalTokens . TokenNamethrow : case TerminalTokens . TokenNametransient : case TerminalTokens . TokenNametrue : case TerminalTokens . TokenNametry : case TerminalTokens . TokenNamevoid : case TerminalTokens . TokenNamevolatile : case TerminalTokens . TokenNamewhile : case TerminalTokens . TokenNameenum : case TerminalTokens . TokenNameconst : case TerminalTokens . TokenNamegoto : this . tagValue = TAG_OTHERS_VALUE ; createTag ( ) ; break ; } this . textStart = this . index ; return valid ; } protected boolean pushParamName ( boolean isTypeParam ) { int idIndex = isTypeParam ? <NUM_LIT:1> : <NUM_LIT:0> ; final SimpleName name = new SimpleName ( this . ast ) ; name . internalSetIdentifier ( new String ( this . identifierStack [ idIndex ] ) ) ; int nameStart = ( int ) ( this . identifierPositionStack [ idIndex ] > > > <NUM_LIT:32> ) ; int nameEnd = ( int ) ( this . identifierPositionStack [ idIndex ] & <NUM_LIT> ) ; name . setSourceRange ( nameStart , nameEnd - nameStart + <NUM_LIT:1> ) ; TagElement paramTag = this . ast . newTagElement ( ) ; paramTag . setTagName ( TagElement . TAG_PARAM ) ; if ( isTypeParam ) { TextElement text = this . ast . newTextElement ( ) ; text . setText ( new String ( this . identifierStack [ <NUM_LIT:0> ] ) ) ; int txtStart = ( int ) ( this . identifierPositionStack [ <NUM_LIT:0> ] > > > <NUM_LIT:32> ) ; int txtEnd = ( int ) ( this . identifierPositionStack [ <NUM_LIT:0> ] & <NUM_LIT> ) ; text . setSourceRange ( txtStart , txtEnd - txtStart + <NUM_LIT:1> ) ; paramTag . fragments ( ) . add ( text ) ; paramTag . fragments ( ) . add ( name ) ; text = this . ast . newTextElement ( ) ; text . setText ( new String ( this . identifierStack [ <NUM_LIT:2> ] ) ) ; txtStart = ( int ) ( this . identifierPositionStack [ <NUM_LIT:2> ] > > > <NUM_LIT:32> ) ; txtEnd = ( int ) ( this . identifierPositionStack [ <NUM_LIT:2> ] & <NUM_LIT> ) ; text . setSourceRange ( txtStart , txtEnd - txtStart + <NUM_LIT:1> ) ; paramTag . fragments ( ) . add ( text ) ; paramTag . setSourceRange ( this . tagSourceStart , txtEnd - this . tagSourceStart + <NUM_LIT:1> ) ; } else { paramTag . setSourceRange ( this . tagSourceStart , nameEnd - this . tagSourceStart + <NUM_LIT:1> ) ; paramTag . fragments ( ) . add ( name ) ; } pushOnAstStack ( paramTag , true ) ; return true ; } protected boolean pushSeeRef ( Object statement ) { TagElement seeTag = this . ast . newTagElement ( ) ; ASTNode node = ( ASTNode ) statement ; seeTag . fragments ( ) . add ( node ) ; int end = node . getStartPosition ( ) + node . getLength ( ) - <NUM_LIT:1> ; if ( this . inlineTagStarted ) { seeTag . setSourceRange ( this . inlineTagStart , end - this . inlineTagStart + <NUM_LIT:1> ) ; switch ( this . tagValue ) { case TAG_LINK_VALUE : seeTag . setTagName ( TagElement . TAG_LINK ) ; break ; case TAG_LINKPLAIN_VALUE : seeTag . setTagName ( TagElement . TAG_LINKPLAIN ) ; break ; case TAG_VALUE_VALUE : seeTag . setTagName ( TagElement . TAG_VALUE ) ; break ; } TagElement previousTag = null ; int previousStart = this . inlineTagStart ; if ( this . astPtr == - <NUM_LIT:1> ) { previousTag = this . ast . newTagElement ( ) ; pushOnAstStack ( previousTag , true ) ; } else { previousTag = ( TagElement ) this . astStack [ this . astPtr ] ; previousStart = previousTag . getStartPosition ( ) ; } previousTag . fragments ( ) . add ( seeTag ) ; previousTag . setSourceRange ( previousStart , end - previousStart + <NUM_LIT:1> ) ; } else { seeTag . setTagName ( TagElement . TAG_SEE ) ; seeTag . setSourceRange ( this . tagSourceStart , end - this . tagSourceStart + <NUM_LIT:1> ) ; pushOnAstStack ( seeTag , true ) ; } return true ; } protected void pushText ( int start , int end ) { TextElement text = this . ast . newTextElement ( ) ; text . setText ( new String ( this . source , start , end - start ) ) ; text . setSourceRange ( start , end - start ) ; TagElement previousTag = null ; int previousStart = start ; if ( this . astPtr == - <NUM_LIT:1> ) { previousTag = this . ast . newTagElement ( ) ; previousTag . setSourceRange ( start , end - start ) ; pushOnAstStack ( previousTag , true ) ; } else { previousTag = ( TagElement ) this . astStack [ this . astPtr ] ; previousStart = previousTag . getStartPosition ( ) ; } List fragments = previousTag . fragments ( ) ; if ( this . inlineTagStarted ) { int size = fragments . size ( ) ; if ( size == <NUM_LIT:0> ) { TagElement inlineTag = this . ast . newTagElement ( ) ; fragments . add ( inlineTag ) ; previousTag = inlineTag ; } else { ASTNode lastFragment = ( ASTNode ) fragments . get ( size - <NUM_LIT:1> ) ; if ( lastFragment . getNodeType ( ) == ASTNode . TAG_ELEMENT ) { previousTag = ( TagElement ) lastFragment ; previousStart = previousTag . getStartPosition ( ) ; } } } previousTag . fragments ( ) . add ( text ) ; previousTag . setSourceRange ( previousStart , end - previousStart ) ; this . textStart = - <NUM_LIT:1> ; } protected boolean pushThrowName ( Object typeRef ) { TagElement throwsTag = this . ast . newTagElement ( ) ; switch ( this . tagValue ) { case TAG_THROWS_VALUE : throwsTag . setTagName ( TagElement . TAG_THROWS ) ; break ; case TAG_EXCEPTION_VALUE : throwsTag . setTagName ( TagElement . TAG_EXCEPTION ) ; break ; } throwsTag . setSourceRange ( this . tagSourceStart , this . scanner . getCurrentTokenEndPosition ( ) - this . tagSourceStart + <NUM_LIT:1> ) ; throwsTag . fragments ( ) . add ( typeRef ) ; pushOnAstStack ( throwsTag , true ) ; return true ; } protected void refreshInlineTagPosition ( int previousPosition ) { if ( this . astPtr != - <NUM_LIT:1> ) { TagElement previousTag = ( TagElement ) this . astStack [ this . astPtr ] ; if ( this . inlineTagStarted ) { int previousStart = previousTag . getStartPosition ( ) ; previousTag . setSourceRange ( previousStart , previousPosition - previousStart + <NUM_LIT:1> ) ; if ( previousTag . fragments ( ) . size ( ) > <NUM_LIT:0> ) { ASTNode inlineTag = ( ASTNode ) previousTag . fragments ( ) . get ( previousTag . fragments ( ) . size ( ) - <NUM_LIT:1> ) ; if ( inlineTag . getNodeType ( ) == ASTNode . TAG_ELEMENT ) { int inlineStart = inlineTag . getStartPosition ( ) ; inlineTag . setSourceRange ( inlineStart , previousPosition - inlineStart + <NUM_LIT:1> ) ; } } } } } protected void updateDocComment ( ) { for ( int idx = <NUM_LIT:0> ; idx <= this . astPtr ; idx ++ ) { this . docComment . tags ( ) . add ( this . astStack [ idx ] ) ; } } } </s>
<s> import java . io . BufferedWriter ; import java . io . File ; import java . io . FileFilter ; import java . io . FileWriter ; import java . io . IOException ; import java . io . Writer ; import java . text . MessageFormat ; import java . util . ArrayList ; public class GenerateBuildScript { private static final String LINE_SEPARATOR = System . getProperty ( "<STR_LIT>" ) ; private static final String HEADER = "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR ; private static final String SOURCE_FILES = "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + LINE_SEPARATOR ; private static final String FOOTER = "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR ; private static void collectAllFiles ( File root , ArrayList collector , FileFilter fileFilter ) { File [ ] files = root . listFiles ( fileFilter ) ; for ( int i = <NUM_LIT:0> ; i < files . length ; i ++ ) { if ( files [ i ] . isDirectory ( ) ) { collectAllFiles ( files [ i ] , collector , fileFilter ) ; } else { String newElement = files [ i ] . getAbsolutePath ( ) ; newElement = newElement . replace ( '<STR_LIT:\\>' , '<CHAR_LIT:/>' ) ; collector . add ( newElement ) ; } } } private static void dumpAllProperties ( Writer writer , File sourceDir , ArrayList collector , String gcj_exe , String dest_dir ) throws IOException { writer . write ( "<STR_LIT>" + LINE_SEPARATOR ) ; for ( int i = <NUM_LIT:0> , max = collector . size ( ) ; i < max ; i ++ ) { String absolutePath = ( String ) collector . get ( i ) ; String fileName = absolutePath . substring ( sourceDir . getAbsolutePath ( ) . length ( ) + <NUM_LIT:1> ) ; writer . write ( MessageFormat . format ( "<STR_LIT>" + LINE_SEPARATOR , new Object [ ] { gcj_exe , dest_dir } ) ) ; writer . write ( "<STR_LIT>" ) ; writer . write ( fileName + "<STR_LIT:U+0020>" + fileName + "<STR_LIT>" + getObjectName ( fileName ) + "<STR_LIT>" + LINE_SEPARATOR ) ; writer . write ( "<STR_LIT>" + LINE_SEPARATOR ) ; } } private static void dumpAllClassFiles ( Writer writer , File sourceDir , ArrayList collector , String gcj_exe , String dest_dir ) throws IOException { writer . write ( "<STR_LIT>" + LINE_SEPARATOR ) ; writer . write ( MessageFormat . format ( "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + "<STR_LIT>" + LINE_SEPARATOR + LINE_SEPARATOR , new Object [ ] { gcj_exe , dest_dir } ) ) ; } private static String getObjectName ( String fileName ) { return fileName . substring ( <NUM_LIT:0> , fileName . lastIndexOf ( '<CHAR_LIT:.>' ) ) + "<STR_LIT>" ; } public static void main ( String [ ] args ) { if ( args . length != <NUM_LIT:5> ) { System . out . println ( "<STR_LIT>" ) ; return ; } try { BufferedWriter writer = new BufferedWriter ( new FileWriter ( new File ( args [ <NUM_LIT:0> ] ) ) ) ; writer . write ( HEADER ) ; File sourceDir = new File ( args [ <NUM_LIT:1> ] ) ; if ( sourceDir . exists ( ) ) { ArrayList collector = new ArrayList ( ) ; collectAllFiles ( sourceDir , collector , new FileFilter ( ) { public boolean accept ( File pathname ) { String fileName = pathname . getAbsolutePath ( ) ; return pathname . isDirectory ( ) || fileName . endsWith ( "<STR_LIT>" ) || fileName . endsWith ( "<STR_LIT>" ) ; } } ) ; dumpAllProperties ( writer , sourceDir , collector , args [ <NUM_LIT:2> ] , args [ <NUM_LIT:3> ] ) ; if ( "<STR_LIT:source>" . equals ( args [ <NUM_LIT:4> ] ) ) { writer . write ( MessageFormat . format ( SOURCE_FILES , new Object [ ] { args [ <NUM_LIT:2> ] , args [ <NUM_LIT:3> ] } ) ) ; } else { collector = new ArrayList ( ) ; collectAllFiles ( sourceDir , collector , new FileFilter ( ) { public boolean accept ( File pathname ) { String fileName = pathname . getAbsolutePath ( ) ; return pathname . isDirectory ( ) || fileName . endsWith ( "<STR_LIT:.class>" ) ; } } ) ; dumpAllClassFiles ( writer , sourceDir , collector , args [ <NUM_LIT:2> ] , args [ <NUM_LIT:3> ] ) ; } } writer . write ( MessageFormat . format ( FOOTER , new Object [ ] { args [ <NUM_LIT:2> ] , args [ <NUM_LIT:3> ] } ) ) ; writer . flush ( ) ; writer . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . * ; import org . eclipse . jdt . internal . core . JavaModel ; import org . eclipse . jdt . internal . core . JavaModelManager ; import org . eclipse . jdt . internal . core . index . FileIndexLocation ; import org . eclipse . jdt . internal . core . index . IndexLocation ; import org . eclipse . jdt . internal . core . search . indexing . IndexManager ; public abstract class SearchParticipant { private IPath lastIndexLocation ; protected SearchParticipant ( ) { } public void beginSearching ( ) { } public void doneSearching ( ) { } public String getDescription ( ) { return "<STR_LIT>" ; } public abstract SearchDocument getDocument ( String documentPath ) ; public abstract void indexDocument ( SearchDocument document , IPath indexLocation ) ; public abstract void locateMatches ( SearchDocument [ ] documents , SearchPattern pattern , IJavaSearchScope scope , SearchRequestor requestor , IProgressMonitor monitor ) throws CoreException ; public void removeIndex ( IPath indexLocation ) { IndexManager manager = JavaModelManager . getIndexManager ( ) ; manager . removeIndexPath ( indexLocation ) ; } public final void scheduleDocumentIndexing ( SearchDocument document , IPath indexPath ) { IPath documentPath = new Path ( document . getPath ( ) ) ; Object file = JavaModel . getTarget ( documentPath , true ) ; IPath containerPath = documentPath ; if ( file instanceof IResource ) { containerPath = ( ( IResource ) file ) . getProject ( ) . getFullPath ( ) ; } else if ( file == null ) { containerPath = documentPath . removeLastSegments ( <NUM_LIT:1> ) ; } IndexManager manager = JavaModelManager . getIndexManager ( ) ; IndexLocation indexLocation ; indexLocation = new FileIndexLocation ( indexPath . toFile ( ) , true ) ; manager . ensureIndexExists ( indexLocation , containerPath ) ; manager . scheduleDocumentIndexing ( document , containerPath , indexLocation , this ) ; if ( ! indexPath . equals ( this . lastIndexLocation ) ) { manager . updateParticipant ( indexPath , containerPath ) ; this . lastIndexLocation = indexPath ; } } public abstract IPath [ ] selectIndexes ( SearchPattern query , IJavaSearchScope scope ) ; } </s>
<s> package org . eclipse . jdt . core . search ; public abstract class TypeNameMatchRequestor { public abstract void acceptTypeNameMatch ( TypeNameMatch match ) ; } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . core . resources . IResource ; import org . eclipse . jdt . core . IJavaElement ; public class PackageReferenceMatch extends ReferenceMatch { public PackageReferenceMatch ( IJavaElement enclosingElement , int accuracy , int offset , int length , boolean insideDocComment , SearchParticipant participant , IResource resource ) { super ( enclosingElement , accuracy , offset , length , insideDocComment , participant , resource ) ; } } </s>
<s> package org . eclipse . jdt . core . search ; import org . codehaus . jdt . groovy . integration . LanguageSupportFactory ; import org . eclipse . core . resources . * ; import org . eclipse . core . runtime . * ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . internal . compiler . env . AccessRestriction ; import org . eclipse . jdt . internal . core . search . * ; import org . eclipse . jdt . internal . core . search . matching . * ; public class SearchEngine { static class SearchPatternAdapter implements ISearchPattern { SearchPattern pattern ; SearchPatternAdapter ( SearchPattern pattern ) { this . pattern = pattern ; } } static class ResultCollectorAdapter extends SearchRequestor { IJavaSearchResultCollector resultCollector ; ResultCollectorAdapter ( IJavaSearchResultCollector resultCollector ) { this . resultCollector = resultCollector ; } public void acceptSearchMatch ( SearchMatch match ) throws CoreException { this . resultCollector . accept ( match . getResource ( ) , match . getOffset ( ) , match . getOffset ( ) + match . getLength ( ) , ( IJavaElement ) match . getElement ( ) , match . getAccuracy ( ) ) ; } public void beginReporting ( ) { this . resultCollector . aboutToStart ( ) ; } public void endReporting ( ) { this . resultCollector . done ( ) ; } } static class TypeNameRequestorAdapter implements IRestrictedAccessTypeRequestor { ITypeNameRequestor nameRequestor ; TypeNameRequestorAdapter ( ITypeNameRequestor requestor ) { this . nameRequestor = requestor ; } public void acceptType ( int modifiers , char [ ] packageName , char [ ] simpleTypeName , char [ ] [ ] enclosingTypeNames , String path , AccessRestriction access ) { if ( Flags . isInterface ( modifiers ) ) { this . nameRequestor . acceptInterface ( packageName , simpleTypeName , enclosingTypeNames , path ) ; } else { this . nameRequestor . acceptClass ( packageName , simpleTypeName , enclosingTypeNames , path ) ; } } } private BasicSearchEngine basicEngine ; public SearchEngine ( ) { this . basicEngine = new BasicSearchEngine ( ) ; } public SearchEngine ( ICompilationUnit [ ] workingCopies ) { this . basicEngine = new BasicSearchEngine ( workingCopies ) ; } public SearchEngine ( IWorkingCopy [ ] workingCopies ) { int length = workingCopies . length ; ICompilationUnit [ ] units = new ICompilationUnit [ length ] ; System . arraycopy ( workingCopies , <NUM_LIT:0> , units , <NUM_LIT:0> , length ) ; this . basicEngine = new BasicSearchEngine ( units ) ; } public SearchEngine ( WorkingCopyOwner workingCopyOwner ) { this . basicEngine = new BasicSearchEngine ( workingCopyOwner ) ; } public static IJavaSearchScope createHierarchyScope ( IType type ) throws JavaModelException { return BasicSearchEngine . createHierarchyScope ( type ) ; } public static IJavaSearchScope createHierarchyScope ( IType type , WorkingCopyOwner owner ) throws JavaModelException { return BasicSearchEngine . createHierarchyScope ( type , owner ) ; } public static IJavaSearchScope createStrictHierarchyScope ( IJavaProject project , IType type , boolean onlySubtypes , boolean includeFocusType , WorkingCopyOwner owner ) throws JavaModelException { return BasicSearchEngine . createStrictHierarchyScope ( project , type , onlySubtypes , includeFocusType , owner ) ; } public static IJavaSearchScope createJavaSearchScope ( IResource [ ] resources ) { int length = resources . length ; IJavaElement [ ] elements = new IJavaElement [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { elements [ i ] = JavaCore . create ( resources [ i ] ) ; } return createJavaSearchScope ( elements ) ; } public static IJavaSearchScope createJavaSearchScope ( IJavaElement [ ] elements ) { return BasicSearchEngine . createJavaSearchScope ( elements ) ; } public static IJavaSearchScope createJavaSearchScope ( IJavaElement [ ] elements , boolean includeReferencedProjects ) { return BasicSearchEngine . createJavaSearchScope ( elements , includeReferencedProjects ) ; } public static IJavaSearchScope createJavaSearchScope ( IJavaElement [ ] elements , int includeMask ) { return BasicSearchEngine . createJavaSearchScope ( elements , includeMask ) ; } public static ISearchPattern createOrSearchPattern ( ISearchPattern leftPattern , ISearchPattern rightPattern ) { SearchPattern left = ( ( SearchPatternAdapter ) leftPattern ) . pattern ; SearchPattern right = ( ( SearchPatternAdapter ) rightPattern ) . pattern ; SearchPattern pattern = SearchPattern . createOrPattern ( left , right ) ; return new SearchPatternAdapter ( pattern ) ; } public static ISearchPattern createSearchPattern ( String stringPattern , int searchFor , int limitTo , boolean isCaseSensitive ) { int matchMode = stringPattern . indexOf ( '<CHAR_LIT>' ) != - <NUM_LIT:1> || stringPattern . indexOf ( '<CHAR_LIT>' ) != - <NUM_LIT:1> ? SearchPattern . R_PATTERN_MATCH : SearchPattern . R_EXACT_MATCH ; int matchRule = isCaseSensitive ? matchMode | SearchPattern . R_CASE_SENSITIVE : matchMode ; return new SearchPatternAdapter ( SearchPattern . createPattern ( stringPattern , searchFor , limitTo , matchRule ) ) ; } public static ISearchPattern createSearchPattern ( IJavaElement element , int limitTo ) { return new SearchPatternAdapter ( SearchPattern . createPattern ( element , limitTo ) ) ; } public static TypeNameMatch createTypeNameMatch ( IType type , int modifiers ) { return BasicSearchEngine . createTypeNameMatch ( type , modifiers ) ; } public static IJavaSearchScope createWorkspaceScope ( ) { return BasicSearchEngine . createWorkspaceScope ( ) ; } public static SearchParticipant getDefaultSearchParticipant ( ) { return BasicSearchEngine . getDefaultSearchParticipant ( ) ; } public void search ( IWorkspace workspace , String patternString , int searchFor , int limitTo , IJavaSearchScope scope , IJavaSearchResultCollector resultCollector ) throws JavaModelException { try { int matchMode = patternString . indexOf ( '<CHAR_LIT>' ) != - <NUM_LIT:1> || patternString . indexOf ( '<CHAR_LIT>' ) != - <NUM_LIT:1> ? SearchPattern . R_PATTERN_MATCH : SearchPattern . R_EXACT_MATCH ; search ( SearchPattern . createPattern ( patternString , searchFor , limitTo , matchMode | SearchPattern . R_CASE_SENSITIVE ) , new SearchParticipant [ ] { getDefaultSearchParticipant ( ) } , scope , new ResultCollectorAdapter ( resultCollector ) , resultCollector . getProgressMonitor ( ) ) ; } catch ( CoreException e ) { if ( e instanceof JavaModelException ) throw ( JavaModelException ) e ; throw new JavaModelException ( e ) ; } } public void search ( IWorkspace workspace , IJavaElement element , int limitTo , IJavaSearchScope scope , IJavaSearchResultCollector resultCollector ) throws JavaModelException { search ( workspace , createSearchPattern ( element , limitTo ) , scope , resultCollector ) ; } public void search ( IWorkspace workspace , ISearchPattern searchPattern , IJavaSearchScope scope , IJavaSearchResultCollector resultCollector ) throws JavaModelException { try { search ( ( ( SearchPatternAdapter ) searchPattern ) . pattern , new SearchParticipant [ ] { getDefaultSearchParticipant ( ) } , scope , new ResultCollectorAdapter ( resultCollector ) , resultCollector . getProgressMonitor ( ) ) ; } catch ( CoreException e ) { if ( e instanceof JavaModelException ) throw ( JavaModelException ) e ; throw new JavaModelException ( e ) ; } } public void search ( SearchPattern pattern , SearchParticipant [ ] participants , IJavaSearchScope scope , SearchRequestor requestor , IProgressMonitor monitor ) throws CoreException { if ( pattern . focus != null && LanguageSupportFactory . isInterestingProject ( pattern . focus . getJavaProject ( ) . getProject ( ) ) ) { scope = LanguageSupportFactory . expandSearchScope ( scope , pattern , requestor ) ; } this . basicEngine . search ( pattern , participants , scope , requestor , monitor ) ; } public void searchAllTypeNames ( final char [ ] packageExactName , final char [ ] typeName , final int matchRule , int searchFor , IJavaSearchScope scope , final TypeNameRequestor nameRequestor , int waitingPolicy , IProgressMonitor progressMonitor ) throws JavaModelException { searchAllTypeNames ( packageExactName , SearchPattern . R_EXACT_MATCH , typeName , matchRule , searchFor , scope , nameRequestor , waitingPolicy , progressMonitor ) ; } public void searchAllTypeNames ( final char [ ] packageName , final int packageMatchRule , final char [ ] typeName , final int typeMatchRule , int searchFor , IJavaSearchScope scope , final TypeNameRequestor nameRequestor , int waitingPolicy , IProgressMonitor progressMonitor ) throws JavaModelException { TypeNameRequestorWrapper requestorWrapper = new TypeNameRequestorWrapper ( nameRequestor ) ; this . basicEngine . searchAllTypeNames ( packageName , packageMatchRule , typeName , typeMatchRule , searchFor , scope , requestorWrapper , waitingPolicy , progressMonitor ) ; } public void searchAllTypeNames ( final char [ ] packageName , final int packageMatchRule , final char [ ] typeName , final int typeMatchRule , int searchFor , IJavaSearchScope scope , final TypeNameMatchRequestor nameMatchRequestor , int waitingPolicy , IProgressMonitor progressMonitor ) throws JavaModelException { TypeNameMatchRequestorWrapper requestorWrapper = new TypeNameMatchRequestorWrapper ( nameMatchRequestor , scope ) ; this . basicEngine . searchAllTypeNames ( packageName , packageMatchRule , typeName , typeMatchRule , searchFor , scope , requestorWrapper , waitingPolicy , progressMonitor ) ; } public void searchAllTypeNames ( final char [ ] [ ] qualifications , final char [ ] [ ] typeNames , IJavaSearchScope scope , final TypeNameRequestor nameRequestor , int waitingPolicy , IProgressMonitor progressMonitor ) throws JavaModelException { TypeNameRequestorWrapper requestorWrapper = new TypeNameRequestorWrapper ( nameRequestor ) ; this . basicEngine . searchAllTypeNames ( qualifications , typeNames , SearchPattern . R_EXACT_MATCH | SearchPattern . R_CASE_SENSITIVE , IJavaSearchConstants . TYPE , scope , requestorWrapper , waitingPolicy , progressMonitor ) ; } public void searchAllTypeNames ( final char [ ] [ ] qualifications , final char [ ] [ ] typeNames , IJavaSearchScope scope , final TypeNameMatchRequestor nameMatchRequestor , int waitingPolicy , IProgressMonitor progressMonitor ) throws JavaModelException { TypeNameMatchRequestorWrapper requestorWrapper = new TypeNameMatchRequestorWrapper ( nameMatchRequestor , scope ) ; this . basicEngine . searchAllTypeNames ( qualifications , typeNames , SearchPattern . R_EXACT_MATCH | SearchPattern . R_CASE_SENSITIVE , IJavaSearchConstants . TYPE , scope , requestorWrapper , waitingPolicy , progressMonitor ) ; } public void searchAllTypeNames ( final char [ ] packageName , final char [ ] typeName , final int matchRule , int searchFor , IJavaSearchScope scope , final ITypeNameRequestor nameRequestor , int waitingPolicy , IProgressMonitor progressMonitor ) throws JavaModelException { TypeNameRequestorAdapter requestorAdapter = new TypeNameRequestorAdapter ( nameRequestor ) ; this . basicEngine . searchAllTypeNames ( packageName , SearchPattern . R_EXACT_MATCH , typeName , matchRule , searchFor , scope , requestorAdapter , waitingPolicy , progressMonitor ) ; } public void searchAllTypeNames ( IWorkspace workspace , final char [ ] packageName , final char [ ] typeName , final int matchMode , final boolean isCaseSensitive , int searchFor , IJavaSearchScope scope , final ITypeNameRequestor nameRequestor , int waitingPolicy , IProgressMonitor progressMonitor ) throws JavaModelException { searchAllTypeNames ( packageName , typeName , isCaseSensitive ? matchMode | SearchPattern . R_CASE_SENSITIVE : matchMode , searchFor , scope , nameRequestor , waitingPolicy , progressMonitor ) ; } public void searchDeclarationsOfAccessedFields ( IJavaElement enclosingElement , SearchRequestor requestor , IProgressMonitor monitor ) throws JavaModelException { this . basicEngine . searchDeclarationsOfAccessedFields ( enclosingElement , requestor , monitor ) ; } public void searchDeclarationsOfAccessedFields ( IWorkspace workspace , IJavaElement enclosingElement , IJavaSearchResultCollector resultCollector ) throws JavaModelException { SearchPattern pattern = new DeclarationOfAccessedFieldsPattern ( enclosingElement ) ; this . basicEngine . searchDeclarations ( enclosingElement , new ResultCollectorAdapter ( resultCollector ) , pattern , resultCollector . getProgressMonitor ( ) ) ; } public void searchDeclarationsOfReferencedTypes ( IJavaElement enclosingElement , SearchRequestor requestor , IProgressMonitor monitor ) throws JavaModelException { this . basicEngine . searchDeclarationsOfReferencedTypes ( enclosingElement , requestor , monitor ) ; } public void searchDeclarationsOfReferencedTypes ( IWorkspace workspace , IJavaElement enclosingElement , IJavaSearchResultCollector resultCollector ) throws JavaModelException { SearchPattern pattern = new DeclarationOfReferencedTypesPattern ( enclosingElement ) ; this . basicEngine . searchDeclarations ( enclosingElement , new ResultCollectorAdapter ( resultCollector ) , pattern , resultCollector . getProgressMonitor ( ) ) ; } public void searchDeclarationsOfSentMessages ( IJavaElement enclosingElement , SearchRequestor requestor , IProgressMonitor monitor ) throws JavaModelException { this . basicEngine . searchDeclarationsOfSentMessages ( enclosingElement , requestor , monitor ) ; } public void searchDeclarationsOfSentMessages ( IWorkspace workspace , IJavaElement enclosingElement , IJavaSearchResultCollector resultCollector ) throws JavaModelException { SearchPattern pattern = new DeclarationOfReferencedMethodsPattern ( enclosingElement ) ; this . basicEngine . searchDeclarations ( enclosingElement , new ResultCollectorAdapter ( resultCollector ) , pattern , resultCollector . getProgressMonitor ( ) ) ; } } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . core . resources . IResource ; import org . eclipse . jdt . core . IJavaElement ; public class FieldReferenceMatch extends ReferenceMatch { private boolean isReadAccess ; private boolean isWriteAccess ; public FieldReferenceMatch ( IJavaElement enclosingElement , int accuracy , int offset , int length , boolean isReadAccess , boolean isWriteAccess , boolean insideDocComment , SearchParticipant participant , IResource resource ) { super ( enclosingElement , accuracy , offset , length , insideDocComment , participant , resource ) ; this . isReadAccess = isReadAccess ; this . isWriteAccess = isWriteAccess ; } public final boolean isReadAccess ( ) { return this . isReadAccess ; } public final boolean isWriteAccess ( ) { return this . isWriteAccess ; } } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . jdt . internal . compiler . SourceElementParser ; import org . eclipse . jdt . internal . core . index . Index ; public abstract class SearchDocument { private Index index ; private String containerRelativePath ; private SourceElementParser parser ; private String documentPath ; private SearchParticipant participant ; protected SearchDocument ( String documentPath , SearchParticipant participant ) { this . documentPath = documentPath ; this . participant = participant ; } public void addIndexEntry ( char [ ] category , char [ ] key ) { if ( this . index != null ) this . index . addIndexEntry ( category , key , getContainerRelativePath ( ) ) ; } public abstract byte [ ] getByteContents ( ) ; public abstract char [ ] getCharContents ( ) ; private String getContainerRelativePath ( ) { if ( this . containerRelativePath == null ) this . containerRelativePath = this . index . containerRelativePath ( getPath ( ) ) ; return this . containerRelativePath ; } public abstract String getEncoding ( ) ; public SourceElementParser getParser ( ) { return this . parser ; } public final SearchParticipant getParticipant ( ) { return this . participant ; } public final String getPath ( ) { return this . documentPath ; } public void removeAllIndexEntries ( ) { if ( this . index != null ) this . index . remove ( getContainerRelativePath ( ) ) ; } public void setIndex ( Index indexToSet ) { this . index = indexToSet ; } public void setParser ( SourceElementParser sourceElementParser ) { this . parser = sourceElementParser ; } } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . core . resources . IResource ; import org . eclipse . jdt . core . * ; public class TypeReferenceMatch extends ReferenceMatch { private IJavaElement [ ] otherElements ; public TypeReferenceMatch ( IJavaElement enclosingElement , int accuracy , int offset , int length , boolean insideDocComment , SearchParticipant participant , IResource resource ) { super ( enclosingElement , accuracy , offset , length , insideDocComment , participant , resource ) ; } public final IJavaElement [ ] getOtherElements ( ) { return this . otherElements ; } public final void setOtherElements ( IJavaElement [ ] otherElements ) { this . otherElements = otherElements ; } } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . core . resources . IResource ; import org . eclipse . jdt . core . IJavaElement ; public class PackageDeclarationMatch extends SearchMatch { public PackageDeclarationMatch ( IJavaElement element , int accuracy , int offset , int length , SearchParticipant participant , IResource resource ) { super ( element , accuracy , offset , length , participant , resource ) ; } } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . core . resources . IResource ; import org . eclipse . jdt . core . IJavaElement ; public class TypeDeclarationMatch extends SearchMatch { public TypeDeclarationMatch ( IJavaElement element , int accuracy , int offset , int length , SearchParticipant participant , IResource resource ) { super ( element , accuracy , offset , length , participant , resource ) ; } } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . core . resources . IResource ; import org . eclipse . jdt . core . IJavaElement ; public class LocalVariableReferenceMatch extends SearchMatch { private boolean isReadAccess ; private boolean isWriteAccess ; public LocalVariableReferenceMatch ( IJavaElement enclosingElement , int accuracy , int offset , int length , boolean isReadAccess , boolean isWriteAccess , boolean insideDocComment , SearchParticipant participant , IResource resource ) { super ( enclosingElement , accuracy , offset , length , participant , resource ) ; this . isReadAccess = isReadAccess ; this . isWriteAccess = isWriteAccess ; setInsideDocComment ( insideDocComment ) ; } public final boolean isReadAccess ( ) { return this . isReadAccess ; } public final boolean isWriteAccess ( ) { return this . isWriteAccess ; } } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jdt . core . IJavaElement ; public interface IJavaSearchResultCollector { int EXACT_MATCH = <NUM_LIT:0> ; int POTENTIAL_MATCH = <NUM_LIT:1> ; public void aboutToStart ( ) ; public void accept ( IResource resource , int start , int end , IJavaElement enclosingElement , int accuracy ) throws CoreException ; public void done ( ) ; public IProgressMonitor getProgressMonitor ( ) ; } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . core . runtime . CoreException ; public abstract class SearchRequestor { public abstract void acceptSearchMatch ( SearchMatch match ) throws CoreException ; public void beginReporting ( ) { } public void endReporting ( ) { } public void enterParticipant ( SearchParticipant participant ) { } public void exitParticipant ( SearchParticipant participant ) { } } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . core . resources . IResource ; import org . eclipse . jdt . core . IJavaElement ; public class TypeParameterReferenceMatch extends SearchMatch { public TypeParameterReferenceMatch ( IJavaElement enclosingElement , int accuracy , int offset , int length , boolean insideDocComment , SearchParticipant participant , IResource resource ) { super ( enclosingElement , accuracy , offset , length , participant , resource ) ; setInsideDocComment ( insideDocComment ) ; } } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . core . resources . IResource ; import org . eclipse . jdt . core . IJavaElement ; public class FieldDeclarationMatch extends SearchMatch { public FieldDeclarationMatch ( IJavaElement element , int accuracy , int offset , int length , SearchParticipant participant , IResource resource ) { super ( element , accuracy , offset , length , participant , resource ) ; } } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . jdt . core . * ; public abstract class TypeNameMatch { public abstract int getAccessibility ( ) ; public String getFullyQualifiedName ( ) { return getType ( ) . getFullyQualifiedName ( '<CHAR_LIT:.>' ) ; } public abstract int getModifiers ( ) ; public IPackageFragmentRoot getPackageFragmentRoot ( ) { return ( IPackageFragmentRoot ) getType ( ) . getAncestor ( IJavaElement . PACKAGE_FRAGMENT_ROOT ) ; } public String getPackageName ( ) { return getType ( ) . getPackageFragment ( ) . getElementName ( ) ; } public String getSimpleTypeName ( ) { return getType ( ) . getElementName ( ) ; } public abstract IType getType ( ) ; public String getTypeContainerName ( ) { IType outerType = getType ( ) . getDeclaringType ( ) ; if ( outerType != null ) { return outerType . getFullyQualifiedName ( '<CHAR_LIT:.>' ) ; } else { return getType ( ) . getPackageFragment ( ) . getElementName ( ) ; } } public String getTypeQualifiedName ( ) { return getType ( ) . getTypeQualifiedName ( '<CHAR_LIT:.>' ) ; } } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . core . resources . IResource ; import org . eclipse . jdt . core . IJavaElement ; public class TypeParameterDeclarationMatch extends SearchMatch { public TypeParameterDeclarationMatch ( IJavaElement element , int accuracy , int offset , int length , SearchParticipant participant , IResource resource ) { super ( element , accuracy , offset , length , participant , resource ) ; } } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . core . resources . IResource ; import org . eclipse . jdt . core . IJavaElement ; public class MethodReferenceMatch extends ReferenceMatch { private boolean constructor ; private boolean synthetic ; private boolean superInvocation ; public MethodReferenceMatch ( IJavaElement enclosingElement , int accuracy , int offset , int length , boolean insideDocComment , SearchParticipant participant , IResource resource ) { super ( enclosingElement , accuracy , offset , length , insideDocComment , participant , resource ) ; } public MethodReferenceMatch ( IJavaElement enclosingElement , int accuracy , int offset , int length , boolean constructor , boolean synthetic , boolean insideDocComment , SearchParticipant participant , IResource resource ) { this ( enclosingElement , accuracy , offset , length , insideDocComment , participant , resource ) ; this . constructor = constructor ; this . synthetic = synthetic ; } public MethodReferenceMatch ( IJavaElement enclosingElement , int accuracy , int offset , int length , boolean constructor , boolean synthetic , boolean superInvocation , boolean insideDocComment , SearchParticipant participant , IResource resource ) { this ( enclosingElement , accuracy , offset , length , constructor , synthetic , insideDocComment , participant , resource ) ; this . superInvocation = superInvocation ; } public final boolean isConstructor ( ) { return this . constructor ; } public final boolean isSynthetic ( ) { return this . synthetic ; } public boolean isSuperInvocation ( ) { return this . superInvocation ; } } </s>
<s> package org . eclipse . jdt . core . search ; import java . io . IOException ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . compiler . * ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . env . AccessRuleSet ; import org . eclipse . jdt . internal . compiler . parser . Scanner ; import org . eclipse . jdt . internal . compiler . parser . ScannerHelper ; import org . eclipse . jdt . internal . compiler . parser . TerminalTokens ; import org . eclipse . jdt . internal . core . LocalVariable ; import org . eclipse . jdt . internal . core . index . EntryResult ; import org . eclipse . jdt . internal . core . index . Index ; import org . eclipse . jdt . internal . core . search . HierarchyScope ; import org . eclipse . jdt . internal . core . search . IndexQueryRequestor ; import org . eclipse . jdt . internal . core . search . JavaSearchScope ; import org . eclipse . jdt . internal . core . search . StringOperation ; import org . eclipse . jdt . internal . core . search . indexing . IIndexConstants ; import org . eclipse . jdt . internal . core . search . matching . * ; public abstract class SearchPattern { public static final int R_EXACT_MATCH = <NUM_LIT:0> ; public static final int R_PREFIX_MATCH = <NUM_LIT> ; public static final int R_PATTERN_MATCH = <NUM_LIT> ; public static final int R_REGEXP_MATCH = <NUM_LIT> ; public static final int R_CASE_SENSITIVE = <NUM_LIT> ; public static final int R_ERASURE_MATCH = <NUM_LIT> ; public static final int R_EQUIVALENT_MATCH = <NUM_LIT> ; public static final int R_FULL_MATCH = <NUM_LIT> ; public static final int R_CAMELCASE_MATCH = <NUM_LIT> ; public static final int R_CAMELCASE_SAME_PART_COUNT_MATCH = <NUM_LIT> ; private static final int MODE_MASK = R_EXACT_MATCH | R_PREFIX_MATCH | R_PATTERN_MATCH | R_REGEXP_MATCH | R_CAMELCASE_MATCH | R_CAMELCASE_SAME_PART_COUNT_MATCH ; private int matchRule ; public IJavaElement focus ; public int kind ; public boolean mustResolve = true ; public SearchPattern ( int matchRule ) { this . matchRule = matchRule ; if ( ( matchRule & ( R_EQUIVALENT_MATCH | R_ERASURE_MATCH ) ) == <NUM_LIT:0> ) { this . matchRule |= R_FULL_MATCH ; } if ( ( matchRule & R_CAMELCASE_MATCH ) != <NUM_LIT:0> ) { this . matchRule &= ~ R_CAMELCASE_SAME_PART_COUNT_MATCH ; this . matchRule &= ~ R_PREFIX_MATCH ; } else if ( ( matchRule & R_CAMELCASE_SAME_PART_COUNT_MATCH ) != <NUM_LIT:0> ) { this . matchRule &= ~ R_PREFIX_MATCH ; } } public void acceptMatch ( String relativePath , String containerPath , char separator , SearchPattern pattern , IndexQueryRequestor requestor , SearchParticipant participant , IJavaSearchScope scope ) { acceptMatch ( relativePath , containerPath , separator , pattern , requestor , participant , scope , null ) ; } public void acceptMatch ( String relativePath , String containerPath , char separator , SearchPattern pattern , IndexQueryRequestor requestor , SearchParticipant participant , IJavaSearchScope scope , IProgressMonitor monitor ) { if ( scope instanceof JavaSearchScope ) { JavaSearchScope javaSearchScope = ( JavaSearchScope ) scope ; AccessRuleSet access = javaSearchScope . getAccessRuleSet ( relativePath , containerPath ) ; if ( access != JavaSearchScope . NOT_ENCLOSED ) { StringBuffer documentPath = new StringBuffer ( containerPath . length ( ) + <NUM_LIT:1> + relativePath . length ( ) ) ; documentPath . append ( containerPath ) ; documentPath . append ( separator ) ; documentPath . append ( relativePath ) ; if ( ! requestor . acceptIndexMatch ( documentPath . toString ( ) , pattern , participant , access ) ) throw new OperationCanceledException ( ) ; } } else { StringBuffer buffer = new StringBuffer ( containerPath . length ( ) + <NUM_LIT:1> + relativePath . length ( ) ) ; buffer . append ( containerPath ) ; buffer . append ( separator ) ; buffer . append ( relativePath ) ; String documentPath = buffer . toString ( ) ; boolean encloses = ( scope instanceof HierarchyScope ) ? ( ( HierarchyScope ) scope ) . encloses ( documentPath , monitor ) : scope . encloses ( documentPath ) ; if ( encloses ) if ( ! requestor . acceptIndexMatch ( documentPath , pattern , participant , null ) ) throw new OperationCanceledException ( ) ; } } public SearchPattern currentPattern ( ) { return this ; } public static final boolean camelCaseMatch ( String pattern , String name ) { if ( pattern == null ) return true ; if ( name == null ) return false ; return camelCaseMatch ( pattern , <NUM_LIT:0> , pattern . length ( ) , name , <NUM_LIT:0> , name . length ( ) , false ) ; } public static final boolean camelCaseMatch ( String pattern , String name , boolean samePartCount ) { if ( pattern == null ) return true ; if ( name == null ) return false ; return camelCaseMatch ( pattern , <NUM_LIT:0> , pattern . length ( ) , name , <NUM_LIT:0> , name . length ( ) , samePartCount ) ; } public static final boolean camelCaseMatch ( String pattern , int patternStart , int patternEnd , String name , int nameStart , int nameEnd ) { return camelCaseMatch ( pattern , patternStart , patternEnd , name , nameStart , nameEnd , false ) ; } public static final boolean camelCaseMatch ( String pattern , int patternStart , int patternEnd , String name , int nameStart , int nameEnd , boolean samePartCount ) { return StringOperation . getCamelCaseMatchingRegions ( pattern , patternStart , patternEnd , name , nameStart , nameEnd , samePartCount ) != null ; } public static final int [ ] getMatchingRegions ( String pattern , String name , int matchRule ) { if ( name == null ) return null ; final int nameLength = name . length ( ) ; if ( pattern == null ) { return new int [ ] { <NUM_LIT:0> , nameLength } ; } final int patternLength = pattern . length ( ) ; boolean countMatch = false ; switch ( matchRule ) { case SearchPattern . R_EXACT_MATCH : if ( patternLength == nameLength && pattern . equalsIgnoreCase ( name ) ) { return new int [ ] { <NUM_LIT:0> , patternLength } ; } break ; case SearchPattern . R_EXACT_MATCH | SearchPattern . R_CASE_SENSITIVE : if ( patternLength == nameLength && pattern . equals ( name ) ) { return new int [ ] { <NUM_LIT:0> , patternLength } ; } break ; case SearchPattern . R_PREFIX_MATCH : if ( patternLength <= nameLength && name . substring ( <NUM_LIT:0> , patternLength ) . equalsIgnoreCase ( pattern ) ) { return new int [ ] { <NUM_LIT:0> , patternLength } ; } break ; case SearchPattern . R_PREFIX_MATCH | SearchPattern . R_CASE_SENSITIVE : if ( name . startsWith ( pattern ) ) { return new int [ ] { <NUM_LIT:0> , patternLength } ; } break ; case SearchPattern . R_CAMELCASE_SAME_PART_COUNT_MATCH : countMatch = true ; case SearchPattern . R_CAMELCASE_MATCH : if ( patternLength <= nameLength ) { int [ ] regions = StringOperation . getCamelCaseMatchingRegions ( pattern , <NUM_LIT:0> , patternLength , name , <NUM_LIT:0> , nameLength , countMatch ) ; if ( regions != null ) return regions ; if ( name . substring ( <NUM_LIT:0> , patternLength ) . equalsIgnoreCase ( pattern ) ) { return new int [ ] { <NUM_LIT:0> , patternLength } ; } } break ; case SearchPattern . R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern . R_CASE_SENSITIVE : countMatch = true ; case SearchPattern . R_CAMELCASE_MATCH | SearchPattern . R_CASE_SENSITIVE : if ( patternLength <= nameLength ) { return StringOperation . getCamelCaseMatchingRegions ( pattern , <NUM_LIT:0> , patternLength , name , <NUM_LIT:0> , nameLength , countMatch ) ; } break ; case SearchPattern . R_PATTERN_MATCH : return StringOperation . getPatternMatchingRegions ( pattern , <NUM_LIT:0> , patternLength , name , <NUM_LIT:0> , nameLength , false ) ; case SearchPattern . R_PATTERN_MATCH | SearchPattern . R_CASE_SENSITIVE : return StringOperation . getPatternMatchingRegions ( pattern , <NUM_LIT:0> , patternLength , name , <NUM_LIT:0> , nameLength , true ) ; } return null ; } public static SearchPattern createAndPattern ( SearchPattern leftPattern , SearchPattern rightPattern ) { return new AndPattern ( leftPattern , rightPattern ) ; } private static SearchPattern createFieldPattern ( String patternString , int limitTo , int matchRule ) { Scanner scanner = new Scanner ( false , true , false , ClassFileConstants . JDK1_7 , null , null , true ) ; scanner . setSource ( patternString . toCharArray ( ) ) ; final int InsideDeclaringPart = <NUM_LIT:1> ; final int InsideType = <NUM_LIT:2> ; int lastToken = - <NUM_LIT:1> ; String declaringType = null , fieldName = null ; String type = null ; int mode = InsideDeclaringPart ; int token ; try { token = scanner . getNextToken ( ) ; } catch ( InvalidInputException e ) { return null ; } while ( token != TerminalTokens . TokenNameEOF ) { switch ( mode ) { case InsideDeclaringPart : switch ( token ) { case TerminalTokens . TokenNameDOT : if ( declaringType == null ) { if ( fieldName == null ) return null ; declaringType = fieldName ; } else { String tokenSource = scanner . getCurrentTokenString ( ) ; declaringType += tokenSource + fieldName ; } fieldName = null ; break ; case TerminalTokens . TokenNameWHITESPACE : if ( ! ( TerminalTokens . TokenNameWHITESPACE == lastToken || TerminalTokens . TokenNameDOT == lastToken ) ) mode = InsideType ; break ; default : if ( fieldName == null ) fieldName = scanner . getCurrentTokenString ( ) ; else fieldName += scanner . getCurrentTokenString ( ) ; } break ; case InsideType : switch ( token ) { case TerminalTokens . TokenNameWHITESPACE : break ; default : if ( type == null ) type = scanner . getCurrentTokenString ( ) ; else type += scanner . getCurrentTokenString ( ) ; } break ; } lastToken = token ; try { token = scanner . getNextToken ( ) ; } catch ( InvalidInputException e ) { return null ; } } if ( fieldName == null ) return null ; char [ ] fieldNameChars = fieldName . toCharArray ( ) ; if ( fieldNameChars . length == <NUM_LIT:1> && fieldNameChars [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) fieldNameChars = null ; char [ ] declaringTypeQualification = null , declaringTypeSimpleName = null ; char [ ] typeQualification = null , typeSimpleName = null ; if ( declaringType != null ) { char [ ] declaringTypePart = declaringType . toCharArray ( ) ; int lastDotPosition = CharOperation . lastIndexOf ( '<CHAR_LIT:.>' , declaringTypePart ) ; if ( lastDotPosition >= <NUM_LIT:0> ) { declaringTypeQualification = CharOperation . subarray ( declaringTypePart , <NUM_LIT:0> , lastDotPosition ) ; if ( declaringTypeQualification . length == <NUM_LIT:1> && declaringTypeQualification [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) declaringTypeQualification = null ; declaringTypeSimpleName = CharOperation . subarray ( declaringTypePart , lastDotPosition + <NUM_LIT:1> , declaringTypePart . length ) ; } else { declaringTypeSimpleName = declaringTypePart ; } if ( declaringTypeSimpleName . length == <NUM_LIT:1> && declaringTypeSimpleName [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) declaringTypeSimpleName = null ; } if ( type != null ) { char [ ] typePart = type . toCharArray ( ) ; int lastDotPosition = CharOperation . lastIndexOf ( '<CHAR_LIT:.>' , typePart ) ; if ( lastDotPosition >= <NUM_LIT:0> ) { typeQualification = CharOperation . subarray ( typePart , <NUM_LIT:0> , lastDotPosition ) ; if ( typeQualification . length == <NUM_LIT:1> && typeQualification [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) { typeQualification = null ; } else { typeQualification = CharOperation . concat ( IIndexConstants . ONE_STAR , typeQualification ) ; } typeSimpleName = CharOperation . subarray ( typePart , lastDotPosition + <NUM_LIT:1> , typePart . length ) ; } else { typeSimpleName = typePart ; } if ( typeSimpleName . length == <NUM_LIT:1> && typeSimpleName [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) typeSimpleName = null ; } return new FieldPattern ( fieldNameChars , declaringTypeQualification , declaringTypeSimpleName , typeQualification , typeSimpleName , limitTo , matchRule ) ; } private static SearchPattern createMethodOrConstructorPattern ( String patternString , int limitTo , int matchRule , boolean isConstructor ) { Scanner scanner = new Scanner ( false , true , false , ClassFileConstants . JDK1_7 , null , null , true ) ; scanner . setSource ( patternString . toCharArray ( ) ) ; final int InsideSelector = <NUM_LIT:1> ; final int InsideTypeArguments = <NUM_LIT:2> ; final int InsideParameter = <NUM_LIT:3> ; final int InsideReturnType = <NUM_LIT:4> ; int lastToken = - <NUM_LIT:1> ; String declaringType = null , selector = null , parameterType = null ; String [ ] parameterTypes = null ; char [ ] [ ] typeArguments = null ; String typeArgumentsString = null ; int parameterCount = - <NUM_LIT:1> ; String returnType = null ; boolean foundClosingParenthesis = false ; int mode = InsideSelector ; int token , argCount = <NUM_LIT:0> ; try { token = scanner . getNextToken ( ) ; } catch ( InvalidInputException e ) { return null ; } while ( token != TerminalTokens . TokenNameEOF ) { switch ( mode ) { case InsideSelector : if ( argCount == <NUM_LIT:0> ) { switch ( token ) { case TerminalTokens . TokenNameLESS : argCount ++ ; if ( selector == null || lastToken == TerminalTokens . TokenNameDOT ) { typeArgumentsString = scanner . getCurrentTokenString ( ) ; mode = InsideTypeArguments ; break ; } if ( declaringType == null ) { declaringType = selector ; } else { declaringType += '<CHAR_LIT:.>' + selector ; } declaringType += scanner . getCurrentTokenString ( ) ; selector = null ; break ; case TerminalTokens . TokenNameDOT : if ( ! isConstructor && typeArgumentsString != null ) return null ; if ( declaringType == null ) { if ( selector == null ) return null ; declaringType = selector ; } else if ( selector != null ) { declaringType += scanner . getCurrentTokenString ( ) + selector ; } selector = null ; break ; case TerminalTokens . TokenNameLPAREN : parameterTypes = new String [ <NUM_LIT:5> ] ; parameterCount = <NUM_LIT:0> ; mode = InsideParameter ; break ; case TerminalTokens . TokenNameWHITESPACE : switch ( lastToken ) { case TerminalTokens . TokenNameWHITESPACE : case TerminalTokens . TokenNameDOT : case TerminalTokens . TokenNameGREATER : case TerminalTokens . TokenNameRIGHT_SHIFT : case TerminalTokens . TokenNameUNSIGNED_RIGHT_SHIFT : break ; default : mode = InsideReturnType ; break ; } break ; default : if ( selector == null ) selector = scanner . getCurrentTokenString ( ) ; else selector += scanner . getCurrentTokenString ( ) ; break ; } } else { if ( declaringType == null ) return null ; switch ( token ) { case TerminalTokens . TokenNameGREATER : case TerminalTokens . TokenNameRIGHT_SHIFT : case TerminalTokens . TokenNameUNSIGNED_RIGHT_SHIFT : argCount -- ; break ; case TerminalTokens . TokenNameLESS : argCount ++ ; break ; } declaringType += scanner . getCurrentTokenString ( ) ; } break ; case InsideTypeArguments : if ( typeArgumentsString == null ) return null ; typeArgumentsString += scanner . getCurrentTokenString ( ) ; switch ( token ) { case TerminalTokens . TokenNameGREATER : case TerminalTokens . TokenNameRIGHT_SHIFT : case TerminalTokens . TokenNameUNSIGNED_RIGHT_SHIFT : argCount -- ; if ( argCount == <NUM_LIT:0> ) { String pseudoType = "<STR_LIT>" + typeArgumentsString ; typeArguments = Signature . getTypeArguments ( Signature . createTypeSignature ( pseudoType , false ) . toCharArray ( ) ) ; mode = InsideSelector ; } break ; case TerminalTokens . TokenNameLESS : argCount ++ ; break ; } break ; case InsideParameter : if ( argCount == <NUM_LIT:0> ) { switch ( token ) { case TerminalTokens . TokenNameWHITESPACE : break ; case TerminalTokens . TokenNameCOMMA : if ( parameterType == null ) return null ; if ( parameterTypes != null ) { if ( parameterTypes . length == parameterCount ) System . arraycopy ( parameterTypes , <NUM_LIT:0> , parameterTypes = new String [ parameterCount * <NUM_LIT:2> ] , <NUM_LIT:0> , parameterCount ) ; parameterTypes [ parameterCount ++ ] = parameterType ; } parameterType = null ; break ; case TerminalTokens . TokenNameRPAREN : foundClosingParenthesis = true ; if ( parameterType != null && parameterTypes != null ) { if ( parameterTypes . length == parameterCount ) System . arraycopy ( parameterTypes , <NUM_LIT:0> , parameterTypes = new String [ parameterCount * <NUM_LIT:2> ] , <NUM_LIT:0> , parameterCount ) ; parameterTypes [ parameterCount ++ ] = parameterType ; } mode = isConstructor ? InsideTypeArguments : InsideReturnType ; break ; case TerminalTokens . TokenNameLESS : argCount ++ ; if ( parameterType == null ) return null ; default : if ( parameterType == null ) parameterType = scanner . getCurrentTokenString ( ) ; else parameterType += scanner . getCurrentTokenString ( ) ; } } else { if ( parameterType == null ) return null ; switch ( token ) { case TerminalTokens . TokenNameGREATER : case TerminalTokens . TokenNameRIGHT_SHIFT : case TerminalTokens . TokenNameUNSIGNED_RIGHT_SHIFT : argCount -- ; break ; case TerminalTokens . TokenNameLESS : argCount ++ ; break ; } parameterType += scanner . getCurrentTokenString ( ) ; } break ; case InsideReturnType : if ( argCount == <NUM_LIT:0> ) { switch ( token ) { case TerminalTokens . TokenNameWHITESPACE : break ; case TerminalTokens . TokenNameLPAREN : parameterTypes = new String [ <NUM_LIT:5> ] ; parameterCount = <NUM_LIT:0> ; mode = InsideParameter ; break ; case TerminalTokens . TokenNameLESS : argCount ++ ; if ( returnType == null ) return null ; default : if ( returnType == null ) returnType = scanner . getCurrentTokenString ( ) ; else returnType += scanner . getCurrentTokenString ( ) ; } } else { if ( returnType == null ) return null ; switch ( token ) { case TerminalTokens . TokenNameGREATER : case TerminalTokens . TokenNameRIGHT_SHIFT : case TerminalTokens . TokenNameUNSIGNED_RIGHT_SHIFT : argCount -- ; break ; case TerminalTokens . TokenNameLESS : argCount ++ ; break ; } returnType += scanner . getCurrentTokenString ( ) ; } break ; } lastToken = token ; try { token = scanner . getNextToken ( ) ; } catch ( InvalidInputException e ) { return null ; } } if ( parameterCount > <NUM_LIT:0> && ! foundClosingParenthesis ) return null ; if ( argCount > <NUM_LIT:0> ) return null ; char [ ] selectorChars = null ; if ( isConstructor ) { if ( declaringType == null ) declaringType = selector ; else if ( selector != null ) declaringType += '<CHAR_LIT:.>' + selector ; } else { if ( selector == null ) return null ; selectorChars = selector . toCharArray ( ) ; if ( selectorChars . length == <NUM_LIT:1> && selectorChars [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) selectorChars = null ; } char [ ] declaringTypeQualification = null , declaringTypeSimpleName = null ; char [ ] returnTypeQualification = null , returnTypeSimpleName = null ; char [ ] [ ] parameterTypeQualifications = null , parameterTypeSimpleNames = null ; String declaringTypeSignature = null ; String returnTypeSignature = null ; String [ ] parameterTypeSignatures = null ; if ( declaringType != null ) { char [ ] declaringTypePart = null ; try { declaringTypeSignature = Signature . createTypeSignature ( declaringType , false ) ; if ( declaringTypeSignature . indexOf ( Signature . C_GENERIC_START ) < <NUM_LIT:0> ) { declaringTypePart = declaringType . toCharArray ( ) ; } else { declaringTypePart = Signature . toCharArray ( Signature . getTypeErasure ( declaringTypeSignature . toCharArray ( ) ) ) ; } } catch ( IllegalArgumentException iae ) { return null ; } int lastDotPosition = CharOperation . lastIndexOf ( '<CHAR_LIT:.>' , declaringTypePart ) ; if ( lastDotPosition >= <NUM_LIT:0> ) { declaringTypeQualification = CharOperation . subarray ( declaringTypePart , <NUM_LIT:0> , lastDotPosition ) ; if ( declaringTypeQualification . length == <NUM_LIT:1> && declaringTypeQualification [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) declaringTypeQualification = null ; declaringTypeSimpleName = CharOperation . subarray ( declaringTypePart , lastDotPosition + <NUM_LIT:1> , declaringTypePart . length ) ; } else { declaringTypeSimpleName = declaringTypePart ; } if ( declaringTypeSimpleName . length == <NUM_LIT:1> && declaringTypeSimpleName [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) declaringTypeSimpleName = null ; } if ( parameterCount >= <NUM_LIT:0> ) { parameterTypeQualifications = new char [ parameterCount ] [ ] ; parameterTypeSimpleNames = new char [ parameterCount ] [ ] ; parameterTypeSignatures = new String [ parameterCount ] ; for ( int i = <NUM_LIT:0> ; i < parameterCount ; i ++ ) { char [ ] parameterTypePart = null ; try { if ( parameterTypes != null ) { parameterTypeSignatures [ i ] = Signature . createTypeSignature ( parameterTypes [ i ] , false ) ; if ( parameterTypeSignatures [ i ] . indexOf ( Signature . C_GENERIC_START ) < <NUM_LIT:0> ) { parameterTypePart = parameterTypes [ i ] . toCharArray ( ) ; } else { parameterTypePart = Signature . toCharArray ( Signature . getTypeErasure ( parameterTypeSignatures [ i ] . toCharArray ( ) ) ) ; } } } catch ( IllegalArgumentException iae ) { return null ; } int lastDotPosition = parameterTypePart == null ? - <NUM_LIT:1> : CharOperation . lastIndexOf ( '<CHAR_LIT:.>' , parameterTypePart ) ; if ( parameterTypePart != null && lastDotPosition >= <NUM_LIT:0> ) { parameterTypeQualifications [ i ] = CharOperation . subarray ( parameterTypePart , <NUM_LIT:0> , lastDotPosition ) ; if ( parameterTypeQualifications [ i ] . length == <NUM_LIT:1> && parameterTypeQualifications [ i ] [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) { parameterTypeQualifications [ i ] = null ; } else { parameterTypeQualifications [ i ] = CharOperation . concat ( IIndexConstants . ONE_STAR , parameterTypeQualifications [ i ] ) ; } parameterTypeSimpleNames [ i ] = CharOperation . subarray ( parameterTypePart , lastDotPosition + <NUM_LIT:1> , parameterTypePart . length ) ; } else { parameterTypeQualifications [ i ] = null ; parameterTypeSimpleNames [ i ] = parameterTypePart ; } if ( parameterTypeSimpleNames [ i ] . length == <NUM_LIT:1> && parameterTypeSimpleNames [ i ] [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) parameterTypeSimpleNames [ i ] = null ; } } if ( returnType != null ) { char [ ] returnTypePart = null ; try { returnTypeSignature = Signature . createTypeSignature ( returnType , false ) ; if ( returnTypeSignature . indexOf ( Signature . C_GENERIC_START ) < <NUM_LIT:0> ) { returnTypePart = returnType . toCharArray ( ) ; } else { returnTypePart = Signature . toCharArray ( Signature . getTypeErasure ( returnTypeSignature . toCharArray ( ) ) ) ; } } catch ( IllegalArgumentException iae ) { return null ; } int lastDotPosition = CharOperation . lastIndexOf ( '<CHAR_LIT:.>' , returnTypePart ) ; if ( lastDotPosition >= <NUM_LIT:0> ) { returnTypeQualification = CharOperation . subarray ( returnTypePart , <NUM_LIT:0> , lastDotPosition ) ; if ( returnTypeQualification . length == <NUM_LIT:1> && returnTypeQualification [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) { returnTypeQualification = null ; } else { returnTypeQualification = CharOperation . concat ( IIndexConstants . ONE_STAR , returnTypeQualification ) ; } returnTypeSimpleName = CharOperation . subarray ( returnTypePart , lastDotPosition + <NUM_LIT:1> , returnTypePart . length ) ; } else { returnTypeSimpleName = returnTypePart ; } if ( returnTypeSimpleName . length == <NUM_LIT:1> && returnTypeSimpleName [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) returnTypeSimpleName = null ; } if ( isConstructor ) { return new ConstructorPattern ( declaringTypeSimpleName , declaringTypeQualification , declaringTypeSignature , parameterTypeQualifications , parameterTypeSimpleNames , parameterTypeSignatures , typeArguments , limitTo , matchRule ) ; } else { return new MethodPattern ( selectorChars , declaringTypeQualification , declaringTypeSimpleName , declaringTypeSignature , returnTypeQualification , returnTypeSimpleName , returnTypeSignature , parameterTypeQualifications , parameterTypeSimpleNames , parameterTypeSignatures , typeArguments , limitTo , matchRule ) ; } } public static SearchPattern createOrPattern ( SearchPattern leftPattern , SearchPattern rightPattern ) { return new OrPattern ( leftPattern , rightPattern ) ; } private static SearchPattern createPackagePattern ( String patternString , int limitTo , int matchRule ) { switch ( limitTo ) { case IJavaSearchConstants . DECLARATIONS : return new PackageDeclarationPattern ( patternString . toCharArray ( ) , matchRule ) ; case IJavaSearchConstants . REFERENCES : return new PackageReferencePattern ( patternString . toCharArray ( ) , matchRule ) ; case IJavaSearchConstants . ALL_OCCURRENCES : return new OrPattern ( new PackageDeclarationPattern ( patternString . toCharArray ( ) , matchRule ) , new PackageReferencePattern ( patternString . toCharArray ( ) , matchRule ) ) ; } return null ; } public static SearchPattern createPattern ( String stringPattern , int searchFor , int limitTo , int matchRule ) { if ( stringPattern == null || stringPattern . length ( ) == <NUM_LIT:0> ) return null ; if ( ( matchRule = validateMatchRule ( stringPattern , matchRule ) ) == - <NUM_LIT:1> ) { return null ; } limitTo &= ~ ( IJavaSearchConstants . IGNORE_DECLARING_TYPE + IJavaSearchConstants . IGNORE_RETURN_TYPE ) ; switch ( searchFor ) { case IJavaSearchConstants . CLASS : return createTypePattern ( stringPattern , limitTo , matchRule , IIndexConstants . CLASS_SUFFIX ) ; case IJavaSearchConstants . CLASS_AND_INTERFACE : return createTypePattern ( stringPattern , limitTo , matchRule , IIndexConstants . CLASS_AND_INTERFACE_SUFFIX ) ; case IJavaSearchConstants . CLASS_AND_ENUM : return createTypePattern ( stringPattern , limitTo , matchRule , IIndexConstants . CLASS_AND_ENUM_SUFFIX ) ; case IJavaSearchConstants . INTERFACE : return createTypePattern ( stringPattern , limitTo , matchRule , IIndexConstants . INTERFACE_SUFFIX ) ; case IJavaSearchConstants . INTERFACE_AND_ANNOTATION : return createTypePattern ( stringPattern , limitTo , matchRule , IIndexConstants . INTERFACE_AND_ANNOTATION_SUFFIX ) ; case IJavaSearchConstants . ENUM : return createTypePattern ( stringPattern , limitTo , matchRule , IIndexConstants . ENUM_SUFFIX ) ; case IJavaSearchConstants . ANNOTATION_TYPE : return createTypePattern ( stringPattern , limitTo , matchRule , IIndexConstants . ANNOTATION_TYPE_SUFFIX ) ; case IJavaSearchConstants . TYPE : return createTypePattern ( stringPattern , limitTo , matchRule , IIndexConstants . TYPE_SUFFIX ) ; case IJavaSearchConstants . METHOD : return createMethodOrConstructorPattern ( stringPattern , limitTo , matchRule , false ) ; case IJavaSearchConstants . CONSTRUCTOR : return createMethodOrConstructorPattern ( stringPattern , limitTo , matchRule , true ) ; case IJavaSearchConstants . FIELD : return createFieldPattern ( stringPattern , limitTo , matchRule ) ; case IJavaSearchConstants . PACKAGE : return createPackagePattern ( stringPattern , limitTo , matchRule ) ; } return null ; } public static SearchPattern createPattern ( IJavaElement element , int limitTo ) { return createPattern ( element , limitTo , R_EXACT_MATCH | R_CASE_SENSITIVE | R_ERASURE_MATCH ) ; } public static SearchPattern createPattern ( IJavaElement element , int limitTo , int matchRule ) { SearchPattern searchPattern = null ; int lastDot ; boolean ignoreDeclaringType = false ; boolean ignoreReturnType = false ; int maskedLimitTo = limitTo & ~ ( IJavaSearchConstants . IGNORE_DECLARING_TYPE + IJavaSearchConstants . IGNORE_RETURN_TYPE ) ; if ( maskedLimitTo == IJavaSearchConstants . DECLARATIONS || maskedLimitTo == IJavaSearchConstants . ALL_OCCURRENCES ) { ignoreDeclaringType = ( limitTo & IJavaSearchConstants . IGNORE_DECLARING_TYPE ) != <NUM_LIT:0> ; ignoreReturnType = ( limitTo & IJavaSearchConstants . IGNORE_RETURN_TYPE ) != <NUM_LIT:0> ; } if ( ( matchRule = validateMatchRule ( null , matchRule ) ) == - <NUM_LIT:1> ) { return null ; } char [ ] declaringSimpleName = null ; char [ ] declaringQualification = null ; switch ( element . getElementType ( ) ) { case IJavaElement . FIELD : IField field = ( IField ) element ; if ( ! ignoreDeclaringType ) { IType declaringClass = field . getDeclaringType ( ) ; declaringSimpleName = declaringClass . getElementName ( ) . toCharArray ( ) ; declaringQualification = declaringClass . getPackageFragment ( ) . getElementName ( ) . toCharArray ( ) ; char [ ] [ ] enclosingNames = enclosingTypeNames ( declaringClass ) ; if ( enclosingNames . length > <NUM_LIT:0> ) { declaringQualification = CharOperation . concat ( declaringQualification , CharOperation . concatWith ( enclosingNames , '<CHAR_LIT:.>' ) , '<CHAR_LIT:.>' ) ; } } char [ ] name = field . getElementName ( ) . toCharArray ( ) ; char [ ] typeSimpleName = null ; char [ ] typeQualification = null ; String typeSignature = null ; if ( ! ignoreReturnType ) { try { typeSignature = field . getTypeSignature ( ) ; char [ ] signature = typeSignature . toCharArray ( ) ; char [ ] typeErasure = Signature . toCharArray ( Signature . getTypeErasure ( signature ) ) ; CharOperation . replace ( typeErasure , '<CHAR_LIT>' , '<CHAR_LIT:.>' ) ; if ( ( lastDot = CharOperation . lastIndexOf ( '<CHAR_LIT:.>' , typeErasure ) ) == - <NUM_LIT:1> ) { typeSimpleName = typeErasure ; } else { typeSimpleName = CharOperation . subarray ( typeErasure , lastDot + <NUM_LIT:1> , typeErasure . length ) ; typeQualification = CharOperation . subarray ( typeErasure , <NUM_LIT:0> , lastDot ) ; if ( ! field . isBinary ( ) ) { typeQualification = CharOperation . concat ( IIndexConstants . ONE_STAR , typeQualification ) ; } } } catch ( JavaModelException e ) { return null ; } } searchPattern = new FieldPattern ( name , declaringQualification , declaringSimpleName , typeQualification , typeSimpleName , typeSignature , limitTo , matchRule ) ; break ; case IJavaElement . IMPORT_DECLARATION : String elementName = element . getElementName ( ) ; lastDot = elementName . lastIndexOf ( '<CHAR_LIT:.>' ) ; if ( lastDot == - <NUM_LIT:1> ) return null ; IImportDeclaration importDecl = ( IImportDeclaration ) element ; if ( importDecl . isOnDemand ( ) ) { searchPattern = createPackagePattern ( elementName . substring ( <NUM_LIT:0> , lastDot ) , maskedLimitTo , matchRule ) ; } else { searchPattern = createTypePattern ( elementName . substring ( lastDot + <NUM_LIT:1> ) . toCharArray ( ) , elementName . substring ( <NUM_LIT:0> , lastDot ) . toCharArray ( ) , null , null , null , maskedLimitTo , matchRule ) ; } break ; case IJavaElement . LOCAL_VARIABLE : LocalVariable localVar = ( LocalVariable ) element ; searchPattern = new LocalVariablePattern ( localVar , limitTo , matchRule ) ; break ; case IJavaElement . TYPE_PARAMETER : ITypeParameter typeParam = ( ITypeParameter ) element ; boolean findParamDeclarations = true ; boolean findParamReferences = true ; switch ( maskedLimitTo ) { case IJavaSearchConstants . DECLARATIONS : findParamReferences = false ; break ; case IJavaSearchConstants . REFERENCES : findParamDeclarations = false ; break ; } searchPattern = new TypeParameterPattern ( findParamDeclarations , findParamReferences , typeParam , matchRule ) ; break ; case IJavaElement . METHOD : IMethod method = ( IMethod ) element ; boolean isConstructor ; try { isConstructor = method . isConstructor ( ) ; } catch ( JavaModelException e ) { return null ; } IType declaringClass = method . getDeclaringType ( ) ; if ( ignoreDeclaringType ) { if ( isConstructor ) declaringSimpleName = declaringClass . getElementName ( ) . toCharArray ( ) ; } else { declaringSimpleName = declaringClass . getElementName ( ) . toCharArray ( ) ; declaringQualification = declaringClass . getPackageFragment ( ) . getElementName ( ) . toCharArray ( ) ; char [ ] [ ] enclosingNames = enclosingTypeNames ( declaringClass ) ; if ( enclosingNames . length > <NUM_LIT:0> ) { declaringQualification = CharOperation . concat ( declaringQualification , CharOperation . concatWith ( enclosingNames , '<CHAR_LIT:.>' ) , '<CHAR_LIT:.>' ) ; } } char [ ] selector = method . getElementName ( ) . toCharArray ( ) ; char [ ] returnSimpleName = null ; char [ ] returnQualification = null ; String returnSignature = null ; if ( ! ignoreReturnType ) { try { returnSignature = method . getReturnType ( ) ; char [ ] signature = returnSignature . toCharArray ( ) ; char [ ] returnErasure = Signature . toCharArray ( Signature . getTypeErasure ( signature ) ) ; CharOperation . replace ( returnErasure , '<CHAR_LIT>' , '<CHAR_LIT:.>' ) ; if ( ( lastDot = CharOperation . lastIndexOf ( '<CHAR_LIT:.>' , returnErasure ) ) == - <NUM_LIT:1> ) { returnSimpleName = returnErasure ; } else { returnSimpleName = CharOperation . subarray ( returnErasure , lastDot + <NUM_LIT:1> , returnErasure . length ) ; returnQualification = CharOperation . subarray ( returnErasure , <NUM_LIT:0> , lastDot ) ; if ( ! method . isBinary ( ) ) { CharOperation . concat ( IIndexConstants . ONE_STAR , returnQualification ) ; } } } catch ( JavaModelException e ) { return null ; } } String [ ] parameterTypes = method . getParameterTypes ( ) ; int paramCount = parameterTypes . length ; char [ ] [ ] parameterSimpleNames = new char [ paramCount ] [ ] ; char [ ] [ ] parameterQualifications = new char [ paramCount ] [ ] ; String [ ] parameterSignatures = new String [ paramCount ] ; for ( int i = <NUM_LIT:0> ; i < paramCount ; i ++ ) { parameterSignatures [ i ] = parameterTypes [ i ] ; char [ ] signature = parameterSignatures [ i ] . toCharArray ( ) ; char [ ] paramErasure = Signature . toCharArray ( Signature . getTypeErasure ( signature ) ) ; CharOperation . replace ( paramErasure , '<CHAR_LIT>' , '<CHAR_LIT:.>' ) ; if ( ( lastDot = CharOperation . lastIndexOf ( '<CHAR_LIT:.>' , paramErasure ) ) == - <NUM_LIT:1> ) { parameterSimpleNames [ i ] = paramErasure ; parameterQualifications [ i ] = null ; } else { parameterSimpleNames [ i ] = CharOperation . subarray ( paramErasure , lastDot + <NUM_LIT:1> , paramErasure . length ) ; parameterQualifications [ i ] = CharOperation . subarray ( paramErasure , <NUM_LIT:0> , lastDot ) ; if ( ! method . isBinary ( ) ) { CharOperation . concat ( IIndexConstants . ONE_STAR , parameterQualifications [ i ] ) ; } } } if ( isConstructor ) { searchPattern = new ConstructorPattern ( declaringSimpleName , declaringQualification , parameterQualifications , parameterSimpleNames , parameterSignatures , method , limitTo , matchRule ) ; } else { searchPattern = new MethodPattern ( selector , declaringQualification , declaringSimpleName , returnQualification , returnSimpleName , returnSignature , parameterQualifications , parameterSimpleNames , parameterSignatures , method , limitTo , matchRule ) ; } break ; case IJavaElement . TYPE : IType type = ( IType ) element ; searchPattern = createTypePattern ( type . getElementName ( ) . toCharArray ( ) , type . getPackageFragment ( ) . getElementName ( ) . toCharArray ( ) , ignoreDeclaringType ? null : enclosingTypeNames ( type ) , null , type , maskedLimitTo , matchRule ) ; break ; case IJavaElement . PACKAGE_DECLARATION : case IJavaElement . PACKAGE_FRAGMENT : searchPattern = createPackagePattern ( element . getElementName ( ) , maskedLimitTo , matchRule ) ; break ; } if ( searchPattern != null ) MatchLocator . setFocus ( searchPattern , element ) ; return searchPattern ; } private static SearchPattern createTypePattern ( char [ ] simpleName , char [ ] packageName , char [ ] [ ] enclosingTypeNames , String typeSignature , IType type , int limitTo , int matchRule ) { switch ( limitTo ) { case IJavaSearchConstants . DECLARATIONS : return new TypeDeclarationPattern ( packageName , enclosingTypeNames , simpleName , IIndexConstants . TYPE_SUFFIX , matchRule ) ; case IJavaSearchConstants . REFERENCES : if ( type != null ) { return new TypeReferencePattern ( CharOperation . concatWith ( packageName , enclosingTypeNames , '<CHAR_LIT:.>' ) , simpleName , type , matchRule ) ; } return new TypeReferencePattern ( CharOperation . concatWith ( packageName , enclosingTypeNames , '<CHAR_LIT:.>' ) , simpleName , typeSignature , matchRule ) ; case IJavaSearchConstants . IMPLEMENTORS : return new SuperTypeReferencePattern ( CharOperation . concatWith ( packageName , enclosingTypeNames , '<CHAR_LIT:.>' ) , simpleName , SuperTypeReferencePattern . ONLY_SUPER_INTERFACES , matchRule ) ; case IJavaSearchConstants . ALL_OCCURRENCES : return new OrPattern ( new TypeDeclarationPattern ( packageName , enclosingTypeNames , simpleName , IIndexConstants . TYPE_SUFFIX , matchRule ) , ( type != null ) ? new TypeReferencePattern ( CharOperation . concatWith ( packageName , enclosingTypeNames , '<CHAR_LIT:.>' ) , simpleName , type , matchRule ) : new TypeReferencePattern ( CharOperation . concatWith ( packageName , enclosingTypeNames , '<CHAR_LIT:.>' ) , simpleName , typeSignature , matchRule ) ) ; default : if ( type != null ) { return new TypeReferencePattern ( CharOperation . concatWith ( packageName , enclosingTypeNames , '<CHAR_LIT:.>' ) , simpleName , type , limitTo , matchRule ) ; } } return null ; } private static SearchPattern createTypePattern ( String patternString , int limitTo , int matchRule , char indexSuffix ) { Scanner scanner = new Scanner ( false , true , false , ClassFileConstants . JDK1_7 , null , null , true ) ; scanner . setSource ( patternString . toCharArray ( ) ) ; String type = null ; int token ; try { token = scanner . getNextToken ( ) ; } catch ( InvalidInputException e ) { return null ; } int argCount = <NUM_LIT:0> ; while ( token != TerminalTokens . TokenNameEOF ) { if ( argCount == <NUM_LIT:0> ) { switch ( token ) { case TerminalTokens . TokenNameWHITESPACE : break ; case TerminalTokens . TokenNameLESS : argCount ++ ; default : if ( type == null ) type = scanner . getCurrentTokenString ( ) ; else type += scanner . getCurrentTokenString ( ) ; } } else { switch ( token ) { case TerminalTokens . TokenNameGREATER : case TerminalTokens . TokenNameRIGHT_SHIFT : case TerminalTokens . TokenNameUNSIGNED_RIGHT_SHIFT : argCount -- ; break ; case TerminalTokens . TokenNameLESS : argCount ++ ; break ; } if ( type == null ) return null ; type += scanner . getCurrentTokenString ( ) ; } try { token = scanner . getNextToken ( ) ; } catch ( InvalidInputException e ) { return null ; } } if ( type == null ) return null ; String typeSignature = null ; char [ ] qualificationChars = null , typeChars = null ; char [ ] typePart = null ; try { typeSignature = Signature . createTypeSignature ( type , false ) ; if ( typeSignature . indexOf ( Signature . C_GENERIC_START ) < <NUM_LIT:0> ) { typePart = type . toCharArray ( ) ; } else { typePart = Signature . toCharArray ( Signature . getTypeErasure ( typeSignature . toCharArray ( ) ) ) ; } } catch ( IllegalArgumentException iae ) { return null ; } int lastDotPosition = CharOperation . lastIndexOf ( '<CHAR_LIT:.>' , typePart ) ; if ( lastDotPosition >= <NUM_LIT:0> ) { qualificationChars = CharOperation . subarray ( typePart , <NUM_LIT:0> , lastDotPosition ) ; if ( qualificationChars . length == <NUM_LIT:1> && qualificationChars [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) qualificationChars = null ; typeChars = CharOperation . subarray ( typePart , lastDotPosition + <NUM_LIT:1> , typePart . length ) ; } else { typeChars = typePart ; } if ( typeChars . length == <NUM_LIT:1> && typeChars [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) { typeChars = null ; } switch ( limitTo ) { case IJavaSearchConstants . DECLARATIONS : return new QualifiedTypeDeclarationPattern ( qualificationChars , typeChars , indexSuffix , matchRule ) ; case IJavaSearchConstants . REFERENCES : return new TypeReferencePattern ( qualificationChars , typeChars , typeSignature , indexSuffix , matchRule ) ; case IJavaSearchConstants . IMPLEMENTORS : return new SuperTypeReferencePattern ( qualificationChars , typeChars , SuperTypeReferencePattern . ONLY_SUPER_INTERFACES , indexSuffix , matchRule ) ; case IJavaSearchConstants . ALL_OCCURRENCES : return new OrPattern ( new QualifiedTypeDeclarationPattern ( qualificationChars , typeChars , indexSuffix , matchRule ) , new TypeReferencePattern ( qualificationChars , typeChars , typeSignature , indexSuffix , matchRule ) ) ; default : return new TypeReferencePattern ( qualificationChars , typeChars , typeSignature , limitTo , indexSuffix , matchRule ) ; } } private static char [ ] [ ] enclosingTypeNames ( IType type ) { IJavaElement parent = type . getParent ( ) ; switch ( parent . getElementType ( ) ) { case IJavaElement . CLASS_FILE : IType declaringType = type . getDeclaringType ( ) ; if ( declaringType == null ) return CharOperation . NO_CHAR_CHAR ; return CharOperation . arrayConcat ( enclosingTypeNames ( declaringType ) , declaringType . getElementName ( ) . toCharArray ( ) ) ; case IJavaElement . COMPILATION_UNIT : return CharOperation . NO_CHAR_CHAR ; case IJavaElement . FIELD : case IJavaElement . INITIALIZER : case IJavaElement . METHOD : IType declaringClass = ( ( IMember ) parent ) . getDeclaringType ( ) ; return CharOperation . arrayConcat ( enclosingTypeNames ( declaringClass ) , new char [ ] [ ] { declaringClass . getElementName ( ) . toCharArray ( ) , IIndexConstants . ONE_STAR } ) ; case IJavaElement . TYPE : return CharOperation . arrayConcat ( enclosingTypeNames ( ( IType ) parent ) , parent . getElementName ( ) . toCharArray ( ) ) ; default : return null ; } } public void decodeIndexKey ( char [ ] key ) { } public void findIndexMatches ( Index index , IndexQueryRequestor requestor , SearchParticipant participant , IJavaSearchScope scope , IProgressMonitor monitor ) throws IOException { if ( monitor != null && monitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; try { index . startQuery ( ) ; SearchPattern pattern = currentPattern ( ) ; EntryResult [ ] entries = pattern . queryIn ( index ) ; if ( entries == null ) return ; SearchPattern decodedResult = pattern . getBlankPattern ( ) ; String containerPath = index . containerPath ; char separator = index . separator ; for ( int i = <NUM_LIT:0> , l = entries . length ; i < l ; i ++ ) { if ( monitor != null && monitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; EntryResult entry = entries [ i ] ; decodedResult . decodeIndexKey ( entry . getWord ( ) ) ; if ( pattern . matchesDecodedKey ( decodedResult ) ) { String [ ] names = entry . getDocumentNames ( index ) ; for ( int j = <NUM_LIT:0> , n = names . length ; j < n ; j ++ ) acceptMatch ( names [ j ] , containerPath , separator , decodedResult , requestor , participant , scope , monitor ) ; } } } finally { index . stopQuery ( ) ; } } public abstract SearchPattern getBlankPattern ( ) ; public char [ ] getIndexKey ( ) { return null ; } public char [ ] [ ] getIndexCategories ( ) { return CharOperation . NO_CHAR_CHAR ; } public final int getMatchRule ( ) { return this . matchRule ; } public boolean isPolymorphicSearch ( ) { return false ; } public boolean matchesDecodedKey ( SearchPattern decodedPattern ) { return true ; } public boolean matchesName ( char [ ] pattern , char [ ] name ) { if ( pattern == null ) return true ; if ( name != null ) { boolean isCaseSensitive = ( this . matchRule & R_CASE_SENSITIVE ) != <NUM_LIT:0> ; int matchMode = this . matchRule & MODE_MASK ; boolean emptyPattern = pattern . length == <NUM_LIT:0> ; if ( emptyPattern && ( this . matchRule & R_PREFIX_MATCH ) != <NUM_LIT:0> ) return true ; boolean sameLength = pattern . length == name . length ; boolean canBePrefix = name . length >= pattern . length ; boolean matchFirstChar = ! isCaseSensitive || emptyPattern || ( name . length > <NUM_LIT:0> && pattern [ <NUM_LIT:0> ] == name [ <NUM_LIT:0> ] ) ; switch ( matchMode ) { case R_EXACT_MATCH : if ( sameLength && matchFirstChar ) { return CharOperation . equals ( pattern , name , isCaseSensitive ) ; } break ; case R_PREFIX_MATCH : if ( canBePrefix && matchFirstChar ) { return CharOperation . prefixEquals ( pattern , name , isCaseSensitive ) ; } break ; case R_PATTERN_MATCH : if ( ! isCaseSensitive ) pattern = CharOperation . toLowerCase ( pattern ) ; return CharOperation . match ( pattern , name , isCaseSensitive ) ; case SearchPattern . R_CAMELCASE_MATCH : if ( matchFirstChar && CharOperation . camelCaseMatch ( pattern , name , false ) ) { return true ; } if ( ! isCaseSensitive && matchFirstChar && CharOperation . prefixEquals ( pattern , name , false ) ) { return true ; } break ; case SearchPattern . R_CAMELCASE_SAME_PART_COUNT_MATCH : return matchFirstChar && CharOperation . camelCaseMatch ( pattern , name , true ) ; case R_REGEXP_MATCH : return true ; } } return false ; } public static int validateMatchRule ( String stringPattern , int matchRule ) { if ( ( matchRule & R_REGEXP_MATCH ) != <NUM_LIT:0> ) { return - <NUM_LIT:1> ; } if ( stringPattern != null ) { int starIndex = stringPattern . indexOf ( '<CHAR_LIT>' ) ; int questionIndex = stringPattern . indexOf ( '<CHAR_LIT>' ) ; if ( starIndex < <NUM_LIT:0> && questionIndex < <NUM_LIT:0> ) { matchRule &= ~ R_PATTERN_MATCH ; } else { matchRule |= R_PATTERN_MATCH ; } } if ( ( matchRule & R_PATTERN_MATCH ) != <NUM_LIT:0> ) { matchRule &= ~ R_CAMELCASE_MATCH ; matchRule &= ~ R_CAMELCASE_SAME_PART_COUNT_MATCH ; matchRule &= ~ R_PREFIX_MATCH ; return matchRule ; } if ( ( matchRule & R_CAMELCASE_MATCH ) != <NUM_LIT:0> ) { matchRule &= ~ R_CAMELCASE_SAME_PART_COUNT_MATCH ; matchRule &= ~ R_PREFIX_MATCH ; boolean validCamelCase = validateCamelCasePattern ( stringPattern ) ; if ( ! validCamelCase ) { matchRule &= ~ R_CAMELCASE_MATCH ; matchRule |= R_PREFIX_MATCH ; } return matchRule ; } if ( ( matchRule & R_CAMELCASE_SAME_PART_COUNT_MATCH ) != <NUM_LIT:0> ) { matchRule &= ~ R_PREFIX_MATCH ; boolean validCamelCase = validateCamelCasePattern ( stringPattern ) ; if ( ! validCamelCase ) { matchRule &= ~ R_CAMELCASE_SAME_PART_COUNT_MATCH ; } return matchRule ; } return matchRule ; } private static boolean validateCamelCasePattern ( String stringPattern ) { if ( stringPattern == null ) return true ; int length = stringPattern . length ( ) ; boolean validCamelCase = true ; boolean lowerCamelCase = false ; int uppercase = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length && validCamelCase ; i ++ ) { char ch = stringPattern . charAt ( i ) ; validCamelCase = i == <NUM_LIT:0> ? ScannerHelper . isJavaIdentifierStart ( ch ) : ScannerHelper . isJavaIdentifierPart ( ch ) ; if ( ScannerHelper . isUpperCase ( ch ) ) uppercase ++ ; if ( i == <NUM_LIT:0> ) lowerCamelCase = uppercase == <NUM_LIT:0> ; } if ( validCamelCase ) { validCamelCase = lowerCamelCase ? uppercase > <NUM_LIT:0> : uppercase > <NUM_LIT:1> ; } return validCamelCase ; } public EntryResult [ ] queryIn ( Index index ) throws IOException { return index . query ( getIndexCategories ( ) , getIndexKey ( ) , getMatchRule ( ) ) ; } public String toString ( ) { return "<STR_LIT>" ; } } </s>
<s> package org . eclipse . jdt . core . search ; public interface ITypeNameRequestor { void acceptClass ( char [ ] packageName , char [ ] simpleTypeName , char [ ] [ ] enclosingTypeNames , String path ) ; void acceptInterface ( char [ ] packageName , char [ ] simpleTypeName , char [ ] [ ] enclosingTypeNames , String path ) ; } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . core . resources . IResource ; import org . eclipse . jdt . core . * ; public abstract class ReferenceMatch extends SearchMatch { IJavaElement localElement ; public ReferenceMatch ( IJavaElement enclosingElement , int accuracy , int offset , int length , boolean insideDocComment , SearchParticipant participant , IResource resource ) { super ( enclosingElement , accuracy , offset , length , participant , resource ) ; setInsideDocComment ( insideDocComment ) ; } final public IJavaElement getLocalElement ( ) { return this . localElement ; } final public void setLocalElement ( IJavaElement element ) { this . localElement = element ; } } </s>
<s> package org . eclipse . jdt . core . search ; public abstract class TypeNameRequestor { public void acceptType ( int modifiers , char [ ] packageName , char [ ] simpleTypeName , char [ ] [ ] enclosingTypeNames , String path ) { } } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . core . resources . IResource ; import org . eclipse . jdt . core . IJavaElement ; public class MethodDeclarationMatch extends SearchMatch { public MethodDeclarationMatch ( IJavaElement element , int accuracy , int offset , int length , SearchParticipant participant , IResource resource ) { super ( element , accuracy , offset , length , participant , resource ) ; } } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . jdt . internal . core . search . processing . * ; public interface IJavaSearchConstants { int UNKNOWN = - <NUM_LIT:1> ; int TYPE = <NUM_LIT:0> ; int METHOD = <NUM_LIT:1> ; int PACKAGE = <NUM_LIT:2> ; int CONSTRUCTOR = <NUM_LIT:3> ; int FIELD = <NUM_LIT:4> ; int CLASS = <NUM_LIT:5> ; int INTERFACE = <NUM_LIT:6> ; int ENUM = <NUM_LIT:7> ; int ANNOTATION_TYPE = <NUM_LIT:8> ; int CLASS_AND_ENUM = <NUM_LIT:9> ; int CLASS_AND_INTERFACE = <NUM_LIT:10> ; int INTERFACE_AND_ANNOTATION = <NUM_LIT:11> ; int DECLARATIONS = <NUM_LIT:0> ; int IMPLEMENTORS = <NUM_LIT:1> ; int REFERENCES = <NUM_LIT:2> ; int ALL_OCCURRENCES = <NUM_LIT:3> ; int READ_ACCESSES = <NUM_LIT:4> ; int WRITE_ACCESSES = <NUM_LIT:5> ; int IGNORE_DECLARING_TYPE = <NUM_LIT> ; int IGNORE_RETURN_TYPE = <NUM_LIT> ; int FIELD_DECLARATION_TYPE_REFERENCE = <NUM_LIT> ; int LOCAL_VARIABLE_DECLARATION_TYPE_REFERENCE = <NUM_LIT> ; int PARAMETER_DECLARATION_TYPE_REFERENCE = <NUM_LIT> ; int SUPERTYPE_TYPE_REFERENCE = <NUM_LIT> ; int THROWS_CLAUSE_TYPE_REFERENCE = <NUM_LIT> ; int CAST_TYPE_REFERENCE = <NUM_LIT> ; int CATCH_TYPE_REFERENCE = <NUM_LIT> ; int CLASS_INSTANCE_CREATION_TYPE_REFERENCE = <NUM_LIT> ; int RETURN_TYPE_REFERENCE = <NUM_LIT> ; int IMPORT_DECLARATION_TYPE_REFERENCE = <NUM_LIT> ; int ANNOTATION_TYPE_REFERENCE = <NUM_LIT> ; int TYPE_ARGUMENT_TYPE_REFERENCE = <NUM_LIT> ; int TYPE_VARIABLE_BOUND_TYPE_REFERENCE = <NUM_LIT> ; int WILDCARD_BOUND_TYPE_REFERENCE = <NUM_LIT> ; int INSTANCEOF_TYPE_REFERENCE = <NUM_LIT> ; int SUPER_REFERENCE = <NUM_LIT> ; int QUALIFIED_REFERENCE = <NUM_LIT> ; int THIS_REFERENCE = <NUM_LIT> ; int IMPLICIT_THIS_REFERENCE = <NUM_LIT> ; int EXACT_MATCH = <NUM_LIT:0> ; int PREFIX_MATCH = <NUM_LIT:1> ; int PATTERN_MATCH = <NUM_LIT:2> ; boolean CASE_SENSITIVE = true ; boolean CASE_INSENSITIVE = false ; int FORCE_IMMEDIATE_SEARCH = IJob . ForceImmediate ; int CANCEL_IF_NOT_READY_TO_SEARCH = IJob . CancelIfNotReady ; int WAIT_UNTIL_READY_TO_SEARCH = IJob . WaitUntilReady ; } </s>
<s> package org . eclipse . jdt . core . search ; public interface ISearchPattern { } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . core . resources . IResource ; import org . eclipse . jdt . core . IJavaElement ; public class LocalVariableDeclarationMatch extends SearchMatch { public LocalVariableDeclarationMatch ( IJavaElement element , int accuracy , int offset , int length , SearchParticipant participant , IResource resource ) { super ( element , accuracy , offset , length , participant , resource ) ; } } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . core . runtime . IPath ; import org . eclipse . jdt . core . IJavaElement ; public interface IJavaSearchScope { String JAR_FILE_ENTRY_SEPARATOR = "<STR_LIT:|>" ; int SOURCES = <NUM_LIT:1> ; int APPLICATION_LIBRARIES = <NUM_LIT:2> ; int SYSTEM_LIBRARIES = <NUM_LIT:4> ; int REFERENCED_PROJECTS = <NUM_LIT:8> ; public boolean encloses ( String resourcePath ) ; public boolean encloses ( IJavaElement element ) ; IPath [ ] enclosingProjectsAndJars ( ) ; boolean includesBinaries ( ) ; boolean includesClasspaths ( ) ; public void setIncludesBinaries ( boolean includesBinaries ) ; public void setIncludesClasspaths ( boolean includesClasspaths ) ; } </s>
<s> package org . eclipse . jdt . core . search ; import org . eclipse . core . resources . IResource ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . internal . core . JavaElement ; public class SearchMatch { public static final int A_ACCURATE = <NUM_LIT:0> ; public static final int A_INACCURATE = <NUM_LIT:1> ; private Object element ; private int length ; private int offset ; private int accuracy ; private SearchParticipant participant ; private IResource resource ; private boolean insideDocComment = false ; private final static int ALL_GENERIC_FLAVORS = SearchPattern . R_FULL_MATCH | SearchPattern . R_EQUIVALENT_MATCH | SearchPattern . R_ERASURE_MATCH ; private int rule = ALL_GENERIC_FLAVORS ; private boolean raw = false ; private boolean implicit = false ; public SearchMatch ( IJavaElement element , int accuracy , int offset , int length , SearchParticipant participant , IResource resource ) { this . element = element ; this . offset = offset ; this . length = length ; this . accuracy = accuracy & A_INACCURATE ; if ( accuracy > A_INACCURATE ) { int genericFlavors = accuracy & ALL_GENERIC_FLAVORS ; if ( genericFlavors > <NUM_LIT:0> ) { this . rule &= ~ ALL_GENERIC_FLAVORS ; } this . rule |= accuracy & ~ A_INACCURATE ; } this . participant = participant ; this . resource = resource ; } public final int getAccuracy ( ) { return this . accuracy ; } public final Object getElement ( ) { return this . element ; } public final int getLength ( ) { return this . length ; } public final int getOffset ( ) { return this . offset ; } public final SearchParticipant getParticipant ( ) { return this . participant ; } public final IResource getResource ( ) { return this . resource ; } public final int getRule ( ) { return this . rule ; } public final boolean isEquivalent ( ) { return isErasure ( ) && ( this . rule & SearchPattern . R_EQUIVALENT_MATCH ) != <NUM_LIT:0> ; } public final boolean isErasure ( ) { return ( this . rule & SearchPattern . R_ERASURE_MATCH ) != <NUM_LIT:0> ; } public final boolean isExact ( ) { return isEquivalent ( ) && ( this . rule & SearchPattern . R_FULL_MATCH ) != <NUM_LIT:0> ; } public final boolean isImplicit ( ) { return this . implicit ; } public final boolean isRaw ( ) { return this . raw ; } public final boolean isInsideDocComment ( ) { return this . insideDocComment ; } public final void setAccuracy ( int accuracy ) { this . accuracy = accuracy ; } public final void setElement ( Object element ) { this . element = element ; } public final void setInsideDocComment ( boolean insideDoc ) { this . insideDocComment = insideDoc ; } public final void setImplicit ( boolean implicit ) { this . implicit = implicit ; } public final void setLength ( int length ) { this . length = length ; } public final void setOffset ( int offset ) { this . offset = offset ; } public final void setParticipant ( SearchParticipant participant ) { this . participant = participant ; } public final void setResource ( IResource resource ) { this . resource = resource ; } public final void setRule ( int rule ) { this . rule = rule ; } public final void setRaw ( boolean raw ) { this . raw = raw ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . accuracy == A_ACCURATE ? "<STR_LIT>" : "<STR_LIT>" ) ; buffer . append ( "<STR_LIT>" ) ; if ( ( this . rule & SearchPattern . R_FULL_MATCH ) != <NUM_LIT:0> ) { buffer . append ( "<STR_LIT>" ) ; } else if ( ( this . rule & SearchPattern . R_EQUIVALENT_MATCH ) != <NUM_LIT:0> ) { buffer . append ( "<STR_LIT>" ) ; } else if ( ( this . rule & SearchPattern . R_ERASURE_MATCH ) != <NUM_LIT:0> ) { buffer . append ( "<STR_LIT>" ) ; } buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . raw ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . offset ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . length ) ; if ( this . element != null ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( ( ( JavaElement ) getElement ( ) ) . toStringWithAncestors ( ) ) ; } buffer . append ( "<STR_LIT:n>" ) ; return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . core . index ; import java . io . File ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . ArrayList ; import org . eclipse . equinox . app . IApplication ; import org . eclipse . equinox . app . IApplicationContext ; import org . eclipse . osgi . util . NLS ; public class JavaIndexerApplication implements IApplication { private final static class Messages extends NLS { private static final String MESSAGES_NAME = "<STR_LIT>" ; public static String CommandLineProcessing ; public static String CommandLineUsage ; public static String CommandLineOnlyOneOutputError ; public static String CommandLineOutputTakesArgs ; public static String CommandLineOnlyOneJarError ; public static String CommandLineJarNotSpecified ; public static String CommandLineIndexFileNotSpecified ; public static String CaughtException ; public static String CommandLineJarFileNotExist ; static { NLS . initializeMessages ( MESSAGES_NAME , Messages . class ) ; } public static String bind ( String message ) { return bind ( message , null ) ; } public static String bind ( String message , Object binding ) { return bind ( message , new Object [ ] { binding } ) ; } public static String bind ( String message , Object binding1 , Object binding2 ) { return bind ( message , new Object [ ] { binding1 , binding2 } ) ; } public static String bind ( String message , Object [ ] bindings ) { return MessageFormat . format ( message , bindings ) ; } } private String jarToIndex ; private String indexFile ; private boolean verbose = false ; private static final String PDE_LAUNCH = "<STR_LIT>" ; private static final String ARG_HELP = "<STR_LIT>" ; private static final String ARG_VERBOSE = "<STR_LIT>" ; private static final String ARG_OUTPUT = "<STR_LIT>" ; private void displayHelp ( ) { System . out . println ( Messages . bind ( Messages . CommandLineUsage ) ) ; } private void displayError ( String message ) { System . out . println ( message ) ; System . out . println ( ) ; displayHelp ( ) ; } private boolean processCommandLine ( String [ ] argsArray ) { ArrayList args = new ArrayList ( ) ; for ( int i = <NUM_LIT:0> , max = argsArray . length ; i < max ; i ++ ) { args . add ( argsArray [ i ] ) ; } int index = <NUM_LIT:0> ; final int argCount = argsArray . length ; loop : while ( index < argCount ) { String currentArg = argsArray [ index ++ ] ; if ( PDE_LAUNCH . equals ( currentArg ) ) { continue loop ; } else if ( ARG_HELP . equals ( currentArg ) ) { displayHelp ( ) ; return false ; } else if ( ARG_VERBOSE . equals ( currentArg ) ) { this . verbose = true ; continue loop ; } else if ( ARG_OUTPUT . equals ( currentArg ) ) { if ( this . indexFile != null ) { displayError ( Messages . bind ( Messages . CommandLineOnlyOneOutputError ) ) ; return false ; } else if ( index == argCount ) { displayError ( Messages . bind ( Messages . CommandLineOutputTakesArgs ) ) ; return false ; } this . indexFile = argsArray [ index ++ ] ; } else { if ( this . jarToIndex != null ) { displayError ( Messages . bind ( Messages . CommandLineOnlyOneJarError ) ) ; return false ; } this . jarToIndex = currentArg ; } } return true ; } public Object start ( IApplicationContext context ) throws Exception { boolean execute = processCommandLine ( ( String [ ] ) context . getArguments ( ) . get ( IApplicationContext . APPLICATION_ARGS ) ) ; if ( execute ) { if ( this . jarToIndex != null && this . indexFile != null ) { File f = new File ( this . jarToIndex ) ; if ( f . exists ( ) ) { if ( this . verbose ) { System . out . println ( Messages . bind ( Messages . CommandLineProcessing , this . indexFile , this . jarToIndex ) ) ; } try { JavaIndexer . generateIndexForJar ( this . jarToIndex , this . indexFile ) ; } catch ( IOException e ) { System . out . println ( Messages . bind ( Messages . CaughtException , "<STR_LIT>" , e . getLocalizedMessage ( ) ) ) ; } } else { System . out . println ( Messages . bind ( Messages . CommandLineJarFileNotExist , this . jarToIndex ) ) ; } } else if ( this . jarToIndex == null ) { System . out . println ( Messages . bind ( Messages . CommandLineJarNotSpecified ) ) ; } else if ( this . indexFile == null ) { System . out . println ( Messages . bind ( Messages . CommandLineIndexFileNotSpecified ) ) ; } } return IApplication . EXIT_OK ; } public void stop ( ) { } } </s>
<s> package org . eclipse . jdt . core . index ; import java . io . IOException ; import org . eclipse . jdt . core . search . SearchEngine ; import org . eclipse . jdt . internal . core . search . indexing . DefaultJavaIndexer ; public final class JavaIndexer { public static void generateIndexForJar ( String pathToJar , String pathToIndexFile ) throws IOException { new DefaultJavaIndexer ( ) . generateIndexForJar ( pathToJar , pathToIndexFile ) ; } } </s>