text
stringlengths 30
1.67M
|
|---|
<s> package org . eclipse . jdt . internal . compiler . classfmt ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . codegen . AttributeNamesConstants ; public class AnnotationMethodInfo extends MethodInfo { protected Object defaultValue = null ; public static MethodInfo createAnnotationMethod ( byte classFileBytes [ ] , int offsets [ ] , int offset ) { MethodInfo methodInfo = new MethodInfo ( classFileBytes , offsets , offset ) ; int attributesCount = methodInfo . u2At ( <NUM_LIT:6> ) ; int readOffset = <NUM_LIT:8> ; AnnotationInfo [ ] annotations = null ; Object defaultValue = null ; for ( int i = <NUM_LIT:0> ; i < attributesCount ; i ++ ) { int utf8Offset = methodInfo . constantPoolOffsets [ methodInfo . u2At ( readOffset ) ] - methodInfo . structOffset ; char [ ] attributeName = methodInfo . utf8At ( utf8Offset + <NUM_LIT:3> , methodInfo . u2At ( utf8Offset + <NUM_LIT:1> ) ) ; if ( attributeName . length > <NUM_LIT:0> ) { switch ( attributeName [ <NUM_LIT:0> ] ) { case '<CHAR_LIT:A>' : if ( CharOperation . equals ( attributeName , AttributeNamesConstants . AnnotationDefaultName ) ) { AnnotationInfo info = new AnnotationInfo ( methodInfo . reference , methodInfo . constantPoolOffsets , readOffset + <NUM_LIT:6> + methodInfo . structOffset ) ; defaultValue = info . decodeDefaultValue ( ) ; } break ; case '<CHAR_LIT>' : if ( CharOperation . equals ( AttributeNamesConstants . SignatureName , attributeName ) ) methodInfo . signatureUtf8Offset = methodInfo . constantPoolOffsets [ methodInfo . u2At ( readOffset + <NUM_LIT:6> ) ] - methodInfo . structOffset ; break ; case '<CHAR_LIT>' : AnnotationInfo [ ] methodAnnotations = null ; if ( CharOperation . equals ( attributeName , AttributeNamesConstants . RuntimeVisibleAnnotationsName ) ) { methodAnnotations = decodeMethodAnnotations ( readOffset , true , methodInfo ) ; } else if ( CharOperation . equals ( attributeName , AttributeNamesConstants . RuntimeInvisibleAnnotationsName ) ) { methodAnnotations = decodeMethodAnnotations ( readOffset , false , methodInfo ) ; } if ( methodAnnotations != null ) { if ( annotations == null ) { annotations = methodAnnotations ; } else { int length = annotations . length ; AnnotationInfo [ ] newAnnotations = new AnnotationInfo [ length + methodAnnotations . length ] ; System . arraycopy ( annotations , <NUM_LIT:0> , newAnnotations , <NUM_LIT:0> , length ) ; System . arraycopy ( methodAnnotations , <NUM_LIT:0> , newAnnotations , length , methodAnnotations . length ) ; annotations = newAnnotations ; } } break ; } } readOffset += ( <NUM_LIT:6> + methodInfo . u4At ( readOffset + <NUM_LIT:2> ) ) ; } methodInfo . attributeBytes = readOffset ; if ( defaultValue != null ) { if ( annotations != null ) { return new AnnotationMethodInfoWithAnnotations ( methodInfo , defaultValue , annotations ) ; } return new AnnotationMethodInfo ( methodInfo , defaultValue ) ; } if ( annotations != null ) return new MethodInfoWithAnnotations ( methodInfo , annotations ) ; return methodInfo ; } AnnotationMethodInfo ( MethodInfo methodInfo , Object defaultValue ) { super ( methodInfo . reference , methodInfo . constantPoolOffsets , methodInfo . structOffset ) ; this . defaultValue = defaultValue ; this . accessFlags = methodInfo . accessFlags ; this . attributeBytes = methodInfo . attributeBytes ; this . descriptor = methodInfo . descriptor ; this . exceptionNames = methodInfo . exceptionNames ; this . name = methodInfo . name ; this . signature = methodInfo . signature ; this . signatureUtf8Offset = methodInfo . signatureUtf8Offset ; this . tagBits = methodInfo . tagBits ; } public Object getDefaultValue ( ) { return this . defaultValue ; } protected void toStringContent ( StringBuffer buffer ) { super . toStringContent ( buffer ) ; if ( this . defaultValue != null ) { buffer . append ( "<STR_LIT>" ) ; if ( this . defaultValue instanceof Object [ ] ) { buffer . append ( '<CHAR_LIT>' ) ; Object [ ] elements = ( Object [ ] ) this . defaultValue ; for ( int i = <NUM_LIT:0> , len = elements . length ; i < len ; i ++ ) { if ( i > <NUM_LIT:0> ) buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; buffer . append ( elements [ i ] ) ; } buffer . append ( '<CHAR_LIT:}>' ) ; } else { buffer . append ( this . defaultValue ) ; } buffer . append ( '<STR_LIT:\n>' ) ; } } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . classfmt ; import java . util . Arrays ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ast . Annotation ; import org . eclipse . jdt . internal . compiler . codegen . ConstantPool ; import org . eclipse . jdt . internal . compiler . env . * ; import org . eclipse . jdt . internal . compiler . impl . * ; import org . eclipse . jdt . internal . compiler . lookup . TagBits ; import org . eclipse . jdt . internal . compiler . util . Util ; public class AnnotationInfo extends ClassFileStruct implements IBinaryAnnotation { private char [ ] typename ; private ElementValuePairInfo [ ] pairs ; long standardAnnotationTagBits = <NUM_LIT:0> ; int readOffset = <NUM_LIT:0> ; static Object [ ] EmptyValueArray = new Object [ <NUM_LIT:0> ] ; AnnotationInfo ( byte [ ] classFileBytes , int [ ] contantPoolOffsets , int offset ) { super ( classFileBytes , contantPoolOffsets , offset ) ; } AnnotationInfo ( byte [ ] classFileBytes , int [ ] contantPoolOffsets , int offset , boolean runtimeVisible , boolean populate ) { this ( classFileBytes , contantPoolOffsets , offset ) ; if ( populate ) decodeAnnotation ( ) ; else this . readOffset = scanAnnotation ( <NUM_LIT:0> , runtimeVisible , true ) ; } private void decodeAnnotation ( ) { this . readOffset = <NUM_LIT:0> ; int utf8Offset = this . constantPoolOffsets [ u2At ( <NUM_LIT:0> ) ] - this . structOffset ; this . typename = utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ; int numberOfPairs = u2At ( <NUM_LIT:2> ) ; this . readOffset += <NUM_LIT:4> ; this . pairs = numberOfPairs == <NUM_LIT:0> ? ElementValuePairInfo . NoMembers : new ElementValuePairInfo [ numberOfPairs ] ; for ( int i = <NUM_LIT:0> ; i < numberOfPairs ; i ++ ) { utf8Offset = this . constantPoolOffsets [ u2At ( this . readOffset ) ] - this . structOffset ; char [ ] membername = utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ; this . readOffset += <NUM_LIT:2> ; Object value = decodeDefaultValue ( ) ; this . pairs [ i ] = new ElementValuePairInfo ( membername , value ) ; } } Object decodeDefaultValue ( ) { Object value = null ; int tag = u1At ( this . readOffset ) ; this . readOffset ++ ; int constValueOffset = - <NUM_LIT:1> ; switch ( tag ) { case '<CHAR_LIT:Z>' : constValueOffset = this . constantPoolOffsets [ u2At ( this . readOffset ) ] - this . structOffset ; value = BooleanConstant . fromValue ( i4At ( constValueOffset + <NUM_LIT:1> ) == <NUM_LIT:1> ) ; this . readOffset += <NUM_LIT:2> ; break ; case '<CHAR_LIT>' : constValueOffset = this . constantPoolOffsets [ u2At ( this . readOffset ) ] - this . structOffset ; value = IntConstant . fromValue ( i4At ( constValueOffset + <NUM_LIT:1> ) ) ; this . readOffset += <NUM_LIT:2> ; break ; case '<CHAR_LIT>' : constValueOffset = this . constantPoolOffsets [ u2At ( this . readOffset ) ] - this . structOffset ; value = CharConstant . fromValue ( ( char ) i4At ( constValueOffset + <NUM_LIT:1> ) ) ; this . readOffset += <NUM_LIT:2> ; break ; case '<CHAR_LIT>' : constValueOffset = this . constantPoolOffsets [ u2At ( this . readOffset ) ] - this . structOffset ; value = ByteConstant . fromValue ( ( byte ) i4At ( constValueOffset + <NUM_LIT:1> ) ) ; this . readOffset += <NUM_LIT:2> ; break ; case '<CHAR_LIT>' : constValueOffset = this . constantPoolOffsets [ u2At ( this . readOffset ) ] - this . structOffset ; value = ShortConstant . fromValue ( ( short ) i4At ( constValueOffset + <NUM_LIT:1> ) ) ; this . readOffset += <NUM_LIT:2> ; break ; case '<CHAR_LIT>' : constValueOffset = this . constantPoolOffsets [ u2At ( this . readOffset ) ] - this . structOffset ; value = DoubleConstant . fromValue ( doubleAt ( constValueOffset + <NUM_LIT:1> ) ) ; this . readOffset += <NUM_LIT:2> ; break ; case '<CHAR_LIT>' : constValueOffset = this . constantPoolOffsets [ u2At ( this . readOffset ) ] - this . structOffset ; value = FloatConstant . fromValue ( floatAt ( constValueOffset + <NUM_LIT:1> ) ) ; this . readOffset += <NUM_LIT:2> ; break ; case '<CHAR_LIT>' : constValueOffset = this . constantPoolOffsets [ u2At ( this . readOffset ) ] - this . structOffset ; value = LongConstant . fromValue ( i8At ( constValueOffset + <NUM_LIT:1> ) ) ; this . readOffset += <NUM_LIT:2> ; break ; case '<CHAR_LIT>' : constValueOffset = this . constantPoolOffsets [ u2At ( this . readOffset ) ] - this . structOffset ; value = StringConstant . fromValue ( String . valueOf ( utf8At ( constValueOffset + <NUM_LIT:3> , u2At ( constValueOffset + <NUM_LIT:1> ) ) ) ) ; this . readOffset += <NUM_LIT:2> ; break ; case '<CHAR_LIT:e>' : constValueOffset = this . constantPoolOffsets [ u2At ( this . readOffset ) ] - this . structOffset ; char [ ] typeName = utf8At ( constValueOffset + <NUM_LIT:3> , u2At ( constValueOffset + <NUM_LIT:1> ) ) ; this . readOffset += <NUM_LIT:2> ; constValueOffset = this . constantPoolOffsets [ u2At ( this . readOffset ) ] - this . structOffset ; char [ ] constName = utf8At ( constValueOffset + <NUM_LIT:3> , u2At ( constValueOffset + <NUM_LIT:1> ) ) ; this . readOffset += <NUM_LIT:2> ; value = new EnumConstantSignature ( typeName , constName ) ; break ; case '<CHAR_LIT:c>' : constValueOffset = this . constantPoolOffsets [ u2At ( this . readOffset ) ] - this . structOffset ; char [ ] className = utf8At ( constValueOffset + <NUM_LIT:3> , u2At ( constValueOffset + <NUM_LIT:1> ) ) ; value = new ClassSignature ( className ) ; this . readOffset += <NUM_LIT:2> ; break ; case '<CHAR_LIT>' : value = new AnnotationInfo ( this . reference , this . constantPoolOffsets , this . readOffset + this . structOffset , false , true ) ; this . readOffset += ( ( AnnotationInfo ) value ) . readOffset ; break ; case '<CHAR_LIT:[>' : int numberOfValues = u2At ( this . readOffset ) ; this . readOffset += <NUM_LIT:2> ; if ( numberOfValues == <NUM_LIT:0> ) { value = EmptyValueArray ; } else { Object [ ] arrayElements = new Object [ numberOfValues ] ; value = arrayElements ; for ( int i = <NUM_LIT:0> ; i < numberOfValues ; i ++ ) arrayElements [ i ] = decodeDefaultValue ( ) ; } break ; default : throw new IllegalStateException ( "<STR_LIT>" + ( char ) tag ) ; } return value ; } public IBinaryElementValuePair [ ] getElementValuePairs ( ) { if ( this . pairs == null ) initialize ( ) ; return this . pairs ; } public char [ ] getTypeName ( ) { return this . typename ; } void initialize ( ) { if ( this . pairs == null ) decodeAnnotation ( ) ; } private int readRetentionPolicy ( int offset ) { int currentOffset = offset ; int tag = u1At ( currentOffset ) ; currentOffset ++ ; switch ( tag ) { case '<CHAR_LIT:e>' : int utf8Offset = this . constantPoolOffsets [ u2At ( currentOffset ) ] - this . structOffset ; char [ ] typeName = utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ; currentOffset += <NUM_LIT:2> ; if ( typeName . length == <NUM_LIT> && CharOperation . equals ( typeName , ConstantPool . JAVA_LANG_ANNOTATION_RETENTIONPOLICY ) ) { utf8Offset = this . constantPoolOffsets [ u2At ( currentOffset ) ] - this . structOffset ; char [ ] constName = utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ; this . standardAnnotationTagBits |= Annotation . getRetentionPolicy ( constName ) ; } currentOffset += <NUM_LIT:2> ; break ; case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT:Z>' : case '<CHAR_LIT>' : case '<CHAR_LIT:c>' : currentOffset += <NUM_LIT:2> ; break ; case '<CHAR_LIT>' : currentOffset = scanAnnotation ( currentOffset , false , false ) ; break ; case '<CHAR_LIT:[>' : int numberOfValues = u2At ( currentOffset ) ; currentOffset += <NUM_LIT:2> ; for ( int i = <NUM_LIT:0> ; i < numberOfValues ; i ++ ) currentOffset = scanElementValue ( currentOffset ) ; break ; default : throw new IllegalStateException ( ) ; } return currentOffset ; } private int readTargetValue ( int offset ) { int currentOffset = offset ; int tag = u1At ( currentOffset ) ; currentOffset ++ ; switch ( tag ) { case '<CHAR_LIT:e>' : int utf8Offset = this . constantPoolOffsets [ u2At ( currentOffset ) ] - this . structOffset ; char [ ] typeName = utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ; currentOffset += <NUM_LIT:2> ; if ( typeName . length == <NUM_LIT> && CharOperation . equals ( typeName , ConstantPool . JAVA_LANG_ANNOTATION_ELEMENTTYPE ) ) { utf8Offset = this . constantPoolOffsets [ u2At ( currentOffset ) ] - this . structOffset ; char [ ] constName = utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ; this . standardAnnotationTagBits |= Annotation . getTargetElementType ( constName ) ; } currentOffset += <NUM_LIT:2> ; break ; case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT:Z>' : case '<CHAR_LIT>' : case '<CHAR_LIT:c>' : currentOffset += <NUM_LIT:2> ; break ; case '<CHAR_LIT>' : currentOffset = scanAnnotation ( currentOffset , false , false ) ; break ; case '<CHAR_LIT:[>' : int numberOfValues = u2At ( currentOffset ) ; currentOffset += <NUM_LIT:2> ; if ( numberOfValues == <NUM_LIT:0> ) { this . standardAnnotationTagBits |= TagBits . AnnotationTarget ; } else { for ( int i = <NUM_LIT:0> ; i < numberOfValues ; i ++ ) currentOffset = readTargetValue ( currentOffset ) ; } break ; default : throw new IllegalStateException ( ) ; } return currentOffset ; } private int scanAnnotation ( int offset , boolean expectRuntimeVisibleAnno , boolean toplevel ) { int currentOffset = offset ; int utf8Offset = this . constantPoolOffsets [ u2At ( offset ) ] - this . structOffset ; char [ ] typeName = utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ; if ( toplevel ) this . typename = typeName ; int numberOfPairs = u2At ( offset + <NUM_LIT:2> ) ; currentOffset += <NUM_LIT:4> ; if ( expectRuntimeVisibleAnno && toplevel ) { switch ( typeName . length ) { case <NUM_LIT> : if ( CharOperation . equals ( typeName , ConstantPool . JAVA_LANG_DEPRECATED ) ) { this . standardAnnotationTagBits |= TagBits . AnnotationDeprecated ; return currentOffset ; } break ; case <NUM_LIT> : if ( CharOperation . equals ( typeName , ConstantPool . JAVA_LANG_SAFEVARARGS ) ) { this . standardAnnotationTagBits |= TagBits . AnnotationSafeVarargs ; return currentOffset ; } break ; case <NUM_LIT> : if ( CharOperation . equals ( typeName , ConstantPool . JAVA_LANG_ANNOTATION_TARGET ) ) { currentOffset += <NUM_LIT:2> ; return readTargetValue ( currentOffset ) ; } break ; case <NUM_LIT:32> : if ( CharOperation . equals ( typeName , ConstantPool . JAVA_LANG_ANNOTATION_RETENTION ) ) { currentOffset += <NUM_LIT:2> ; return readRetentionPolicy ( currentOffset ) ; } if ( CharOperation . equals ( typeName , ConstantPool . JAVA_LANG_ANNOTATION_INHERITED ) ) { this . standardAnnotationTagBits |= TagBits . AnnotationInherited ; return currentOffset ; } break ; case <NUM_LIT> : if ( CharOperation . equals ( typeName , ConstantPool . JAVA_LANG_ANNOTATION_DOCUMENTED ) ) { this . standardAnnotationTagBits |= TagBits . AnnotationDocumented ; return currentOffset ; } break ; case <NUM_LIT> : if ( CharOperation . equals ( typeName , ConstantPool . JAVA_LANG_INVOKE_METHODHANDLE_POLYMORPHICSIGNATURE ) ) { this . standardAnnotationTagBits |= TagBits . AnnotationPolymorphicSignature ; return currentOffset ; } break ; } } for ( int i = <NUM_LIT:0> ; i < numberOfPairs ; i ++ ) { currentOffset += <NUM_LIT:2> ; currentOffset = scanElementValue ( currentOffset ) ; } return currentOffset ; } private int scanElementValue ( int offset ) { int currentOffset = offset ; int tag = u1At ( currentOffset ) ; currentOffset ++ ; switch ( tag ) { case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT:Z>' : case '<CHAR_LIT>' : case '<CHAR_LIT:c>' : currentOffset += <NUM_LIT:2> ; break ; case '<CHAR_LIT:e>' : currentOffset += <NUM_LIT:4> ; break ; case '<CHAR_LIT>' : currentOffset = scanAnnotation ( currentOffset , false , false ) ; break ; case '<CHAR_LIT:[>' : int numberOfValues = u2At ( currentOffset ) ; currentOffset += <NUM_LIT:2> ; for ( int i = <NUM_LIT:0> ; i < numberOfValues ; i ++ ) currentOffset = scanElementValue ( currentOffset ) ; break ; default : throw new IllegalStateException ( ) ; } return currentOffset ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( '<CHAR_LIT>' ) ; buffer . append ( this . typename ) ; if ( this . pairs != null ) { buffer . append ( '<CHAR_LIT:(>' ) ; buffer . append ( "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> , len = this . pairs . length ; i < len ; i ++ ) { if ( i > <NUM_LIT:0> ) buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . pairs [ i ] ) ; } buffer . append ( '<CHAR_LIT:)>' ) ; } return buffer . toString ( ) ; } public int hashCode ( ) { final int prime = <NUM_LIT:31> ; int result = <NUM_LIT:1> ; result = prime * result + Util . hashCode ( this . pairs ) ; result = prime * result + CharOperation . hashCode ( this . typename ) ; return result ; } public boolean equals ( Object obj ) { if ( this == obj ) { return true ; } if ( obj == null ) { return false ; } if ( getClass ( ) != obj . getClass ( ) ) { return false ; } AnnotationInfo other = ( AnnotationInfo ) obj ; if ( ! Arrays . equals ( this . pairs , other . pairs ) ) { return false ; } if ( ! Arrays . equals ( this . typename , other . typename ) ) { return false ; } return true ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . classfmt ; import java . io . File ; import java . io . IOException ; import java . io . InputStream ; import java . util . Arrays ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . codegen . AttributeNamesConstants ; import org . eclipse . jdt . internal . compiler . env . * ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . TagBits ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; import org . eclipse . jdt . internal . compiler . util . Util ; public class ClassFileReader extends ClassFileStruct implements IBinaryType { private int accessFlags ; private char [ ] classFileName ; private char [ ] className ; private int classNameIndex ; private int constantPoolCount ; private AnnotationInfo [ ] annotations ; private FieldInfo [ ] fields ; private int fieldsCount ; private InnerClassInfo innerInfo ; private int innerInfoIndex ; private InnerClassInfo [ ] innerInfos ; private char [ ] [ ] interfaceNames ; private int interfacesCount ; private MethodInfo [ ] methods ; private int methodsCount ; private char [ ] signature ; private char [ ] sourceName ; private char [ ] sourceFileName ; private char [ ] superclassName ; private long tagBits ; private long version ; private char [ ] enclosingTypeName ; private char [ ] [ ] [ ] missingTypeNames ; private int enclosingNameAndTypeIndex ; private char [ ] enclosingMethod ; private static String printTypeModifiers ( int modifiers ) { java . io . ByteArrayOutputStream out = new java . io . ByteArrayOutputStream ( ) ; java . io . PrintWriter print = new java . io . PrintWriter ( out ) ; if ( ( modifiers & ClassFileConstants . AccPublic ) != <NUM_LIT:0> ) print . print ( "<STR_LIT>" ) ; if ( ( modifiers & ClassFileConstants . AccPrivate ) != <NUM_LIT:0> ) print . print ( "<STR_LIT>" ) ; if ( ( modifiers & ClassFileConstants . AccFinal ) != <NUM_LIT:0> ) print . print ( "<STR_LIT>" ) ; if ( ( modifiers & ClassFileConstants . AccSuper ) != <NUM_LIT:0> ) print . print ( "<STR_LIT>" ) ; if ( ( modifiers & ClassFileConstants . AccInterface ) != <NUM_LIT:0> ) print . print ( "<STR_LIT>" ) ; if ( ( modifiers & ClassFileConstants . AccAbstract ) != <NUM_LIT:0> ) print . print ( "<STR_LIT>" ) ; print . flush ( ) ; return out . toString ( ) ; } public static ClassFileReader read ( File file ) throws ClassFormatException , IOException { return read ( file , false ) ; } public static ClassFileReader read ( File file , boolean fullyInitialize ) throws ClassFormatException , IOException { byte classFileBytes [ ] = Util . getFileByteContent ( file ) ; ClassFileReader classFileReader = new ClassFileReader ( classFileBytes , file . getAbsolutePath ( ) . toCharArray ( ) ) ; if ( fullyInitialize ) { classFileReader . initialize ( ) ; } return classFileReader ; } public static ClassFileReader read ( InputStream stream , String fileName ) throws ClassFormatException , IOException { return read ( stream , fileName , false ) ; } public static ClassFileReader read ( InputStream stream , String fileName , boolean fullyInitialize ) throws ClassFormatException , IOException { byte classFileBytes [ ] = Util . getInputStreamAsByteArray ( stream , - <NUM_LIT:1> ) ; ClassFileReader classFileReader = new ClassFileReader ( classFileBytes , fileName . toCharArray ( ) ) ; if ( fullyInitialize ) { classFileReader . initialize ( ) ; } return classFileReader ; } public static ClassFileReader read ( java . util . zip . ZipFile zip , String filename ) throws ClassFormatException , java . io . IOException { return read ( zip , filename , false ) ; } public static ClassFileReader read ( java . util . zip . ZipFile zip , String filename , boolean fullyInitialize ) throws ClassFormatException , java . io . IOException { java . util . zip . ZipEntry ze = zip . getEntry ( filename ) ; if ( ze == null ) return null ; byte classFileBytes [ ] = Util . getZipEntryByteContent ( ze , zip ) ; ClassFileReader classFileReader = new ClassFileReader ( classFileBytes , filename . toCharArray ( ) ) ; if ( fullyInitialize ) { classFileReader . initialize ( ) ; } return classFileReader ; } public static ClassFileReader read ( String fileName ) throws ClassFormatException , java . io . IOException { return read ( fileName , false ) ; } public static ClassFileReader read ( String fileName , boolean fullyInitialize ) throws ClassFormatException , java . io . IOException { return read ( new File ( fileName ) , fullyInitialize ) ; } public ClassFileReader ( byte classFileBytes [ ] , char [ ] fileName ) throws ClassFormatException { this ( classFileBytes , fileName , false ) ; } public ClassFileReader ( byte [ ] classFileBytes , char [ ] fileName , boolean fullyInitialize ) throws ClassFormatException { super ( classFileBytes , null , <NUM_LIT:0> ) ; this . classFileName = fileName ; int readOffset = <NUM_LIT:10> ; try { this . version = ( ( long ) u2At ( <NUM_LIT:6> ) << <NUM_LIT:16> ) + u2At ( <NUM_LIT:4> ) ; this . constantPoolCount = u2At ( <NUM_LIT:8> ) ; this . constantPoolOffsets = new int [ this . constantPoolCount ] ; for ( int i = <NUM_LIT:1> ; i < this . constantPoolCount ; i ++ ) { int tag = u1At ( readOffset ) ; switch ( tag ) { case ClassFileConstants . Utf8Tag : this . constantPoolOffsets [ i ] = readOffset ; readOffset += u2At ( readOffset + <NUM_LIT:1> ) ; readOffset += ClassFileConstants . ConstantUtf8FixedSize ; break ; case ClassFileConstants . IntegerTag : this . constantPoolOffsets [ i ] = readOffset ; readOffset += ClassFileConstants . ConstantIntegerFixedSize ; break ; case ClassFileConstants . FloatTag : this . constantPoolOffsets [ i ] = readOffset ; readOffset += ClassFileConstants . ConstantFloatFixedSize ; break ; case ClassFileConstants . LongTag : this . constantPoolOffsets [ i ] = readOffset ; readOffset += ClassFileConstants . ConstantLongFixedSize ; i ++ ; break ; case ClassFileConstants . DoubleTag : this . constantPoolOffsets [ i ] = readOffset ; readOffset += ClassFileConstants . ConstantDoubleFixedSize ; i ++ ; break ; case ClassFileConstants . ClassTag : this . constantPoolOffsets [ i ] = readOffset ; readOffset += ClassFileConstants . ConstantClassFixedSize ; break ; case ClassFileConstants . StringTag : this . constantPoolOffsets [ i ] = readOffset ; readOffset += ClassFileConstants . ConstantStringFixedSize ; break ; case ClassFileConstants . FieldRefTag : this . constantPoolOffsets [ i ] = readOffset ; readOffset += ClassFileConstants . ConstantFieldRefFixedSize ; break ; case ClassFileConstants . MethodRefTag : this . constantPoolOffsets [ i ] = readOffset ; readOffset += ClassFileConstants . ConstantMethodRefFixedSize ; break ; case ClassFileConstants . InterfaceMethodRefTag : this . constantPoolOffsets [ i ] = readOffset ; readOffset += ClassFileConstants . ConstantInterfaceMethodRefFixedSize ; break ; case ClassFileConstants . NameAndTypeTag : this . constantPoolOffsets [ i ] = readOffset ; readOffset += ClassFileConstants . ConstantNameAndTypeFixedSize ; } } this . accessFlags = u2At ( readOffset ) ; readOffset += <NUM_LIT:2> ; this . classNameIndex = u2At ( readOffset ) ; this . className = getConstantClassNameAt ( this . classNameIndex ) ; readOffset += <NUM_LIT:2> ; int superclassNameIndex = u2At ( readOffset ) ; readOffset += <NUM_LIT:2> ; if ( superclassNameIndex != <NUM_LIT:0> ) { this . superclassName = getConstantClassNameAt ( superclassNameIndex ) ; } this . interfacesCount = u2At ( readOffset ) ; readOffset += <NUM_LIT:2> ; if ( this . interfacesCount != <NUM_LIT:0> ) { this . interfaceNames = new char [ this . interfacesCount ] [ ] ; for ( int i = <NUM_LIT:0> ; i < this . interfacesCount ; i ++ ) { this . interfaceNames [ i ] = getConstantClassNameAt ( u2At ( readOffset ) ) ; readOffset += <NUM_LIT:2> ; } } this . fieldsCount = u2At ( readOffset ) ; readOffset += <NUM_LIT:2> ; if ( this . fieldsCount != <NUM_LIT:0> ) { FieldInfo field ; this . fields = new FieldInfo [ this . fieldsCount ] ; for ( int i = <NUM_LIT:0> ; i < this . fieldsCount ; i ++ ) { field = FieldInfo . createField ( this . reference , this . constantPoolOffsets , readOffset ) ; this . fields [ i ] = field ; readOffset += field . sizeInBytes ( ) ; } } this . methodsCount = u2At ( readOffset ) ; readOffset += <NUM_LIT:2> ; if ( this . methodsCount != <NUM_LIT:0> ) { this . methods = new MethodInfo [ this . methodsCount ] ; boolean isAnnotationType = ( this . accessFlags & ClassFileConstants . AccAnnotation ) != <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < this . methodsCount ; i ++ ) { this . methods [ i ] = isAnnotationType ? AnnotationMethodInfo . createAnnotationMethod ( this . reference , this . constantPoolOffsets , readOffset ) : MethodInfo . createMethod ( this . reference , this . constantPoolOffsets , readOffset ) ; readOffset += this . methods [ i ] . sizeInBytes ( ) ; } } int attributesCount = u2At ( readOffset ) ; readOffset += <NUM_LIT:2> ; for ( int i = <NUM_LIT:0> ; i < attributesCount ; i ++ ) { int utf8Offset = this . constantPoolOffsets [ u2At ( readOffset ) ] ; char [ ] attributeName = utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ; if ( attributeName . length == <NUM_LIT:0> ) { readOffset += ( <NUM_LIT:6> + u4At ( readOffset + <NUM_LIT:2> ) ) ; continue ; } switch ( attributeName [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : if ( CharOperation . equals ( attributeName , AttributeNamesConstants . EnclosingMethodName ) ) { utf8Offset = this . constantPoolOffsets [ u2At ( this . constantPoolOffsets [ u2At ( readOffset + <NUM_LIT:6> ) ] + <NUM_LIT:1> ) ] ; this . enclosingTypeName = utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ; this . enclosingNameAndTypeIndex = u2At ( readOffset + <NUM_LIT:8> ) ; } break ; case '<CHAR_LIT>' : if ( CharOperation . equals ( attributeName , AttributeNamesConstants . DeprecatedName ) ) { this . accessFlags |= ClassFileConstants . AccDeprecated ; } break ; case '<CHAR_LIT>' : if ( CharOperation . equals ( attributeName , AttributeNamesConstants . InnerClassName ) ) { int innerOffset = readOffset + <NUM_LIT:6> ; int number_of_classes = u2At ( innerOffset ) ; if ( number_of_classes != <NUM_LIT:0> ) { innerOffset += <NUM_LIT:2> ; this . innerInfos = new InnerClassInfo [ number_of_classes ] ; for ( int j = <NUM_LIT:0> ; j < number_of_classes ; j ++ ) { this . innerInfos [ j ] = new InnerClassInfo ( this . reference , this . constantPoolOffsets , innerOffset ) ; if ( this . classNameIndex == this . innerInfos [ j ] . innerClassNameIndex ) { this . innerInfo = this . innerInfos [ j ] ; this . innerInfoIndex = j ; } innerOffset += <NUM_LIT:8> ; } if ( this . innerInfo != null ) { char [ ] enclosingType = this . innerInfo . getEnclosingTypeName ( ) ; if ( enclosingType != null ) { this . enclosingTypeName = enclosingType ; } } } } else if ( CharOperation . equals ( attributeName , AttributeNamesConstants . InconsistentHierarchy ) ) { this . tagBits |= TagBits . HierarchyHasProblems ; } break ; case '<CHAR_LIT>' : if ( attributeName . length > <NUM_LIT:2> ) { switch ( attributeName [ <NUM_LIT:1> ] ) { case '<CHAR_LIT>' : if ( CharOperation . equals ( attributeName , AttributeNamesConstants . SourceName ) ) { utf8Offset = this . constantPoolOffsets [ u2At ( readOffset + <NUM_LIT:6> ) ] ; this . sourceFileName = utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ; } break ; case '<CHAR_LIT>' : if ( CharOperation . equals ( attributeName , AttributeNamesConstants . SyntheticName ) ) { this . accessFlags |= ClassFileConstants . AccSynthetic ; } break ; case '<CHAR_LIT>' : if ( CharOperation . equals ( attributeName , AttributeNamesConstants . SignatureName ) ) { utf8Offset = this . constantPoolOffsets [ u2At ( readOffset + <NUM_LIT:6> ) ] ; this . signature = utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ; } } } break ; case '<CHAR_LIT>' : if ( CharOperation . equals ( attributeName , AttributeNamesConstants . RuntimeVisibleAnnotationsName ) ) { decodeAnnotations ( readOffset , true ) ; } else if ( CharOperation . equals ( attributeName , AttributeNamesConstants . RuntimeInvisibleAnnotationsName ) ) { decodeAnnotations ( readOffset , false ) ; } break ; case '<CHAR_LIT>' : if ( CharOperation . equals ( attributeName , AttributeNamesConstants . MissingTypesName ) ) { int missingTypeOffset = readOffset + <NUM_LIT:6> ; int numberOfMissingTypes = u2At ( missingTypeOffset ) ; if ( numberOfMissingTypes != <NUM_LIT:0> ) { this . missingTypeNames = new char [ numberOfMissingTypes ] [ ] [ ] ; missingTypeOffset += <NUM_LIT:2> ; for ( int j = <NUM_LIT:0> ; j < numberOfMissingTypes ; j ++ ) { utf8Offset = this . constantPoolOffsets [ u2At ( this . constantPoolOffsets [ u2At ( missingTypeOffset ) ] + <NUM_LIT:1> ) ] ; char [ ] missingTypeConstantPoolName = utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ; this . missingTypeNames [ j ] = CharOperation . splitOn ( '<CHAR_LIT:/>' , missingTypeConstantPoolName ) ; missingTypeOffset += <NUM_LIT:2> ; } } } } readOffset += ( <NUM_LIT:6> + u4At ( readOffset + <NUM_LIT:2> ) ) ; } if ( fullyInitialize ) { initialize ( ) ; } } catch ( ClassFormatException e ) { throw e ; } catch ( Exception e ) { throw new ClassFormatException ( ClassFormatException . ErrTruncatedInput , readOffset ) ; } } public int accessFlags ( ) { return this . accessFlags ; } private void decodeAnnotations ( int offset , boolean runtimeVisible ) { int numberOfAnnotations = u2At ( offset + <NUM_LIT:6> ) ; if ( numberOfAnnotations > <NUM_LIT:0> ) { int readOffset = offset + <NUM_LIT:8> ; AnnotationInfo [ ] newInfos = null ; int newInfoCount = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < numberOfAnnotations ; i ++ ) { AnnotationInfo newInfo = new AnnotationInfo ( this . reference , this . constantPoolOffsets , readOffset , runtimeVisible , false ) ; readOffset += newInfo . readOffset ; long standardTagBits = newInfo . standardAnnotationTagBits ; if ( standardTagBits != <NUM_LIT:0> ) { this . tagBits |= standardTagBits ; } else { if ( newInfos == null ) newInfos = new AnnotationInfo [ numberOfAnnotations - i ] ; newInfos [ newInfoCount ++ ] = newInfo ; } } if ( newInfos == null ) return ; if ( this . annotations == null ) { if ( newInfoCount != newInfos . length ) System . arraycopy ( newInfos , <NUM_LIT:0> , newInfos = new AnnotationInfo [ newInfoCount ] , <NUM_LIT:0> , newInfoCount ) ; this . annotations = newInfos ; } else { int length = this . annotations . length ; AnnotationInfo [ ] temp = new AnnotationInfo [ length + newInfoCount ] ; System . arraycopy ( this . annotations , <NUM_LIT:0> , temp , <NUM_LIT:0> , length ) ; System . arraycopy ( newInfos , <NUM_LIT:0> , temp , length , newInfoCount ) ; this . annotations = temp ; } } } public IBinaryAnnotation [ ] getAnnotations ( ) { return this . annotations ; } private char [ ] getConstantClassNameAt ( int constantPoolIndex ) { int utf8Offset = this . constantPoolOffsets [ u2At ( this . constantPoolOffsets [ constantPoolIndex ] + <NUM_LIT:1> ) ] ; return utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ; } public int [ ] getConstantPoolOffsets ( ) { return this . constantPoolOffsets ; } public char [ ] getEnclosingMethod ( ) { if ( this . enclosingNameAndTypeIndex <= <NUM_LIT:0> ) { return null ; } if ( this . enclosingMethod == null ) { StringBuffer buffer = new StringBuffer ( ) ; int nameAndTypeOffset = this . constantPoolOffsets [ this . enclosingNameAndTypeIndex ] ; int utf8Offset = this . constantPoolOffsets [ u2At ( nameAndTypeOffset + <NUM_LIT:1> ) ] ; buffer . append ( utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ) ; utf8Offset = this . constantPoolOffsets [ u2At ( nameAndTypeOffset + <NUM_LIT:3> ) ] ; buffer . append ( utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ) ; this . enclosingMethod = String . valueOf ( buffer ) . toCharArray ( ) ; } return this . enclosingMethod ; } public char [ ] getEnclosingTypeName ( ) { return this . enclosingTypeName ; } public IBinaryField [ ] getFields ( ) { return this . fields ; } public char [ ] getFileName ( ) { return this . classFileName ; } public char [ ] getGenericSignature ( ) { return this . signature ; } public char [ ] getInnerSourceName ( ) { if ( this . innerInfo != null ) return this . innerInfo . getSourceName ( ) ; return null ; } public char [ ] [ ] getInterfaceNames ( ) { return this . interfaceNames ; } public IBinaryNestedType [ ] getMemberTypes ( ) { if ( this . innerInfos == null ) return null ; int length = this . innerInfos . length ; int startingIndex = this . innerInfo != null ? this . innerInfoIndex + <NUM_LIT:1> : <NUM_LIT:0> ; if ( length != startingIndex ) { IBinaryNestedType [ ] memberTypes = new IBinaryNestedType [ length - this . innerInfoIndex ] ; int memberTypeIndex = <NUM_LIT:0> ; for ( int i = startingIndex ; i < length ; i ++ ) { InnerClassInfo currentInnerInfo = this . innerInfos [ i ] ; int outerClassNameIdx = currentInnerInfo . outerClassNameIndex ; int innerNameIndex = currentInnerInfo . innerNameIndex ; if ( outerClassNameIdx != <NUM_LIT:0> && innerNameIndex != <NUM_LIT:0> && outerClassNameIdx == this . classNameIndex && currentInnerInfo . getSourceName ( ) . length != <NUM_LIT:0> ) { memberTypes [ memberTypeIndex ++ ] = currentInnerInfo ; } } if ( memberTypeIndex == <NUM_LIT:0> ) return null ; if ( memberTypeIndex != memberTypes . length ) { System . arraycopy ( memberTypes , <NUM_LIT:0> , ( memberTypes = new IBinaryNestedType [ memberTypeIndex ] ) , <NUM_LIT:0> , memberTypeIndex ) ; } return memberTypes ; } return null ; } public IBinaryMethod [ ] getMethods ( ) { return this . methods ; } public char [ ] [ ] [ ] getMissingTypeNames ( ) { return this . missingTypeNames ; } public int getModifiers ( ) { int modifiers ; if ( this . innerInfo != null ) { modifiers = this . innerInfo . getModifiers ( ) | ( this . accessFlags & ClassFileConstants . AccDeprecated ) | ( this . accessFlags & ClassFileConstants . AccSynthetic ) ; } else { modifiers = this . accessFlags ; } return modifiers ; } public char [ ] getName ( ) { return this . className ; } public char [ ] getSourceName ( ) { if ( this . sourceName != null ) return this . sourceName ; char [ ] name = getInnerSourceName ( ) ; if ( name == null ) { name = getName ( ) ; int start ; if ( isAnonymous ( ) ) { start = CharOperation . indexOf ( '<CHAR_LIT>' , name , CharOperation . lastIndexOf ( '<CHAR_LIT:/>' , name ) + <NUM_LIT:1> ) + <NUM_LIT:1> ; } else { start = CharOperation . lastIndexOf ( '<CHAR_LIT:/>' , name ) + <NUM_LIT:1> ; } if ( start > <NUM_LIT:0> ) { char [ ] newName = new char [ name . length - start ] ; System . arraycopy ( name , start , newName , <NUM_LIT:0> , newName . length ) ; name = newName ; } } return this . sourceName = name ; } public char [ ] getSuperclassName ( ) { return this . superclassName ; } public long getTagBits ( ) { return this . tagBits ; } public long getVersion ( ) { return this . version ; } private boolean hasNonSyntheticFieldChanges ( FieldInfo [ ] currentFieldInfos , FieldInfo [ ] otherFieldInfos ) { int length1 = currentFieldInfos == null ? <NUM_LIT:0> : currentFieldInfos . length ; int length2 = otherFieldInfos == null ? <NUM_LIT:0> : otherFieldInfos . length ; int index1 = <NUM_LIT:0> ; int index2 = <NUM_LIT:0> ; end : while ( index1 < length1 && index2 < length2 ) { while ( currentFieldInfos [ index1 ] . isSynthetic ( ) ) { if ( ++ index1 >= length1 ) break end ; } while ( otherFieldInfos [ index2 ] . isSynthetic ( ) ) { if ( ++ index2 >= length2 ) break end ; } if ( hasStructuralFieldChanges ( currentFieldInfos [ index1 ++ ] , otherFieldInfos [ index2 ++ ] ) ) return true ; } while ( index1 < length1 ) { if ( ! currentFieldInfos [ index1 ++ ] . isSynthetic ( ) ) return true ; } while ( index2 < length2 ) { if ( ! otherFieldInfos [ index2 ++ ] . isSynthetic ( ) ) return true ; } return false ; } private boolean hasNonSyntheticMethodChanges ( MethodInfo [ ] currentMethodInfos , MethodInfo [ ] otherMethodInfos ) { int length1 = currentMethodInfos == null ? <NUM_LIT:0> : currentMethodInfos . length ; int length2 = otherMethodInfos == null ? <NUM_LIT:0> : otherMethodInfos . length ; int index1 = <NUM_LIT:0> ; int index2 = <NUM_LIT:0> ; MethodInfo m ; end : while ( index1 < length1 && index2 < length2 ) { while ( ( m = currentMethodInfos [ index1 ] ) . isSynthetic ( ) || m . isClinit ( ) ) { if ( ++ index1 >= length1 ) break end ; } while ( ( m = otherMethodInfos [ index2 ] ) . isSynthetic ( ) || m . isClinit ( ) ) { if ( ++ index2 >= length2 ) break end ; } if ( hasStructuralMethodChanges ( currentMethodInfos [ index1 ++ ] , otherMethodInfos [ index2 ++ ] ) ) return true ; } while ( index1 < length1 ) { if ( ! ( ( m = currentMethodInfos [ index1 ++ ] ) . isSynthetic ( ) || m . isClinit ( ) ) ) return true ; } while ( index2 < length2 ) { if ( ! ( ( m = otherMethodInfos [ index2 ++ ] ) . isSynthetic ( ) || m . isClinit ( ) ) ) return true ; } return false ; } public boolean hasStructuralChanges ( byte [ ] newBytes ) { return hasStructuralChanges ( newBytes , true , true ) ; } public boolean hasStructuralChanges ( byte [ ] newBytes , boolean orderRequired , boolean excludesSynthetic ) { try { ClassFileReader newClassFile = new ClassFileReader ( newBytes , this . classFileName ) ; if ( getModifiers ( ) != newClassFile . getModifiers ( ) ) return true ; long OnlyStructuralTagBits = TagBits . AnnotationTargetMASK | TagBits . AnnotationDeprecated | TagBits . AnnotationRetentionMASK | TagBits . HierarchyHasProblems ; if ( ( getTagBits ( ) & OnlyStructuralTagBits ) != ( newClassFile . getTagBits ( ) & OnlyStructuralTagBits ) ) return true ; if ( hasStructuralAnnotationChanges ( getAnnotations ( ) , newClassFile . getAnnotations ( ) ) ) return true ; if ( ! CharOperation . equals ( getGenericSignature ( ) , newClassFile . getGenericSignature ( ) ) ) return true ; if ( ! CharOperation . equals ( getSuperclassName ( ) , newClassFile . getSuperclassName ( ) ) ) return true ; char [ ] [ ] newInterfacesNames = newClassFile . getInterfaceNames ( ) ; if ( this . interfaceNames != newInterfacesNames ) { int newInterfacesLength = newInterfacesNames == null ? <NUM_LIT:0> : newInterfacesNames . length ; if ( newInterfacesLength != this . interfacesCount ) return true ; for ( int i = <NUM_LIT:0> , max = this . interfacesCount ; i < max ; i ++ ) if ( ! CharOperation . equals ( this . interfaceNames [ i ] , newInterfacesNames [ i ] ) ) return true ; } IBinaryNestedType [ ] currentMemberTypes = getMemberTypes ( ) ; IBinaryNestedType [ ] otherMemberTypes = newClassFile . getMemberTypes ( ) ; if ( currentMemberTypes != otherMemberTypes ) { int currentMemberTypeLength = currentMemberTypes == null ? <NUM_LIT:0> : currentMemberTypes . length ; int otherMemberTypeLength = otherMemberTypes == null ? <NUM_LIT:0> : otherMemberTypes . length ; if ( currentMemberTypeLength != otherMemberTypeLength ) return true ; for ( int i = <NUM_LIT:0> ; i < currentMemberTypeLength ; i ++ ) if ( ! CharOperation . equals ( currentMemberTypes [ i ] . getName ( ) , otherMemberTypes [ i ] . getName ( ) ) || currentMemberTypes [ i ] . getModifiers ( ) != otherMemberTypes [ i ] . getModifiers ( ) ) return true ; } FieldInfo [ ] otherFieldInfos = ( FieldInfo [ ] ) newClassFile . getFields ( ) ; int otherFieldInfosLength = otherFieldInfos == null ? <NUM_LIT:0> : otherFieldInfos . length ; boolean compareFields = true ; if ( this . fieldsCount == otherFieldInfosLength ) { int i = <NUM_LIT:0> ; for ( ; i < this . fieldsCount ; i ++ ) if ( hasStructuralFieldChanges ( this . fields [ i ] , otherFieldInfos [ i ] ) ) break ; if ( ( compareFields = i != this . fieldsCount ) && ! orderRequired && ! excludesSynthetic ) return true ; } if ( compareFields ) { if ( this . fieldsCount != otherFieldInfosLength && ! excludesSynthetic ) return true ; if ( orderRequired ) { if ( this . fieldsCount != <NUM_LIT:0> ) Arrays . sort ( this . fields ) ; if ( otherFieldInfosLength != <NUM_LIT:0> ) Arrays . sort ( otherFieldInfos ) ; } if ( excludesSynthetic ) { if ( hasNonSyntheticFieldChanges ( this . fields , otherFieldInfos ) ) return true ; } else { for ( int i = <NUM_LIT:0> ; i < this . fieldsCount ; i ++ ) if ( hasStructuralFieldChanges ( this . fields [ i ] , otherFieldInfos [ i ] ) ) return true ; } } MethodInfo [ ] otherMethodInfos = ( MethodInfo [ ] ) newClassFile . getMethods ( ) ; int otherMethodInfosLength = otherMethodInfos == null ? <NUM_LIT:0> : otherMethodInfos . length ; boolean compareMethods = true ; if ( this . methodsCount == otherMethodInfosLength ) { int i = <NUM_LIT:0> ; for ( ; i < this . methodsCount ; i ++ ) if ( hasStructuralMethodChanges ( this . methods [ i ] , otherMethodInfos [ i ] ) ) break ; if ( ( compareMethods = i != this . methodsCount ) && ! orderRequired && ! excludesSynthetic ) return true ; } if ( compareMethods ) { if ( this . methodsCount != otherMethodInfosLength && ! excludesSynthetic ) return true ; if ( orderRequired ) { if ( this . methodsCount != <NUM_LIT:0> ) Arrays . sort ( this . methods ) ; if ( otherMethodInfosLength != <NUM_LIT:0> ) Arrays . sort ( otherMethodInfos ) ; } if ( excludesSynthetic ) { if ( hasNonSyntheticMethodChanges ( this . methods , otherMethodInfos ) ) return true ; } else { for ( int i = <NUM_LIT:0> ; i < this . methodsCount ; i ++ ) if ( hasStructuralMethodChanges ( this . methods [ i ] , otherMethodInfos [ i ] ) ) return true ; } } char [ ] [ ] [ ] missingTypes = getMissingTypeNames ( ) ; char [ ] [ ] [ ] newMissingTypes = newClassFile . getMissingTypeNames ( ) ; if ( missingTypes != null ) { if ( newMissingTypes == null ) { return true ; } int length = missingTypes . length ; if ( length != newMissingTypes . length ) { return true ; } for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( ! CharOperation . equals ( missingTypes [ i ] , newMissingTypes [ i ] ) ) { return true ; } } } else if ( newMissingTypes != null ) { return true ; } return false ; } catch ( ClassFormatException e ) { return true ; } } private boolean hasStructuralAnnotationChanges ( IBinaryAnnotation [ ] currentAnnotations , IBinaryAnnotation [ ] otherAnnotations ) { if ( currentAnnotations == otherAnnotations ) return false ; int currentAnnotationsLength = currentAnnotations == null ? <NUM_LIT:0> : currentAnnotations . length ; int otherAnnotationsLength = otherAnnotations == null ? <NUM_LIT:0> : otherAnnotations . length ; if ( currentAnnotationsLength != otherAnnotationsLength ) return true ; for ( int i = <NUM_LIT:0> ; i < currentAnnotationsLength ; i ++ ) { if ( ! CharOperation . equals ( currentAnnotations [ i ] . getTypeName ( ) , otherAnnotations [ i ] . getTypeName ( ) ) ) return true ; IBinaryElementValuePair [ ] currentPairs = currentAnnotations [ i ] . getElementValuePairs ( ) ; IBinaryElementValuePair [ ] otherPairs = otherAnnotations [ i ] . getElementValuePairs ( ) ; int currentPairsLength = currentPairs == null ? <NUM_LIT:0> : currentPairs . length ; int otherPairsLength = otherPairs == null ? <NUM_LIT:0> : otherPairs . length ; if ( currentPairsLength != otherPairsLength ) return true ; for ( int j = <NUM_LIT:0> ; j < currentPairsLength ; j ++ ) { if ( ! CharOperation . equals ( currentPairs [ j ] . getName ( ) , otherPairs [ j ] . getName ( ) ) ) return true ; final Object value = currentPairs [ j ] . getValue ( ) ; final Object value2 = otherPairs [ j ] . getValue ( ) ; if ( value instanceof Object [ ] ) { Object [ ] currentValues = ( Object [ ] ) value ; if ( value2 instanceof Object [ ] ) { Object [ ] currentValues2 = ( Object [ ] ) value2 ; final int length = currentValues . length ; if ( length != currentValues2 . length ) { return true ; } for ( int n = <NUM_LIT:0> ; n < length ; n ++ ) { if ( ! currentValues [ n ] . equals ( currentValues2 [ n ] ) ) { return true ; } } return false ; } return true ; } else if ( ! value . equals ( value2 ) ) { return true ; } } } return false ; } private boolean hasStructuralFieldChanges ( FieldInfo currentFieldInfo , FieldInfo otherFieldInfo ) { if ( ! CharOperation . equals ( currentFieldInfo . getGenericSignature ( ) , otherFieldInfo . getGenericSignature ( ) ) ) return true ; if ( currentFieldInfo . getModifiers ( ) != otherFieldInfo . getModifiers ( ) ) return true ; if ( ( currentFieldInfo . getTagBits ( ) & TagBits . AnnotationDeprecated ) != ( otherFieldInfo . getTagBits ( ) & TagBits . AnnotationDeprecated ) ) return true ; if ( hasStructuralAnnotationChanges ( currentFieldInfo . getAnnotations ( ) , otherFieldInfo . getAnnotations ( ) ) ) return true ; if ( ! CharOperation . equals ( currentFieldInfo . getName ( ) , otherFieldInfo . getName ( ) ) ) return true ; if ( ! CharOperation . equals ( currentFieldInfo . getTypeName ( ) , otherFieldInfo . getTypeName ( ) ) ) return true ; if ( currentFieldInfo . hasConstant ( ) != otherFieldInfo . hasConstant ( ) ) return true ; if ( currentFieldInfo . hasConstant ( ) ) { Constant currentConstant = currentFieldInfo . getConstant ( ) ; Constant otherConstant = otherFieldInfo . getConstant ( ) ; if ( currentConstant . typeID ( ) != otherConstant . typeID ( ) ) return true ; if ( ! currentConstant . getClass ( ) . equals ( otherConstant . getClass ( ) ) ) return true ; switch ( currentConstant . typeID ( ) ) { case TypeIds . T_int : return currentConstant . intValue ( ) != otherConstant . intValue ( ) ; case TypeIds . T_byte : return currentConstant . byteValue ( ) != otherConstant . byteValue ( ) ; case TypeIds . T_short : return currentConstant . shortValue ( ) != otherConstant . shortValue ( ) ; case TypeIds . T_char : return currentConstant . charValue ( ) != otherConstant . charValue ( ) ; case TypeIds . T_long : return currentConstant . longValue ( ) != otherConstant . longValue ( ) ; case TypeIds . T_float : return currentConstant . floatValue ( ) != otherConstant . floatValue ( ) ; case TypeIds . T_double : return currentConstant . doubleValue ( ) != otherConstant . doubleValue ( ) ; case TypeIds . T_boolean : return currentConstant . booleanValue ( ) != otherConstant . booleanValue ( ) ; case TypeIds . T_JavaLangString : return ! currentConstant . stringValue ( ) . equals ( otherConstant . stringValue ( ) ) ; } } return false ; } private boolean hasStructuralMethodChanges ( MethodInfo currentMethodInfo , MethodInfo otherMethodInfo ) { if ( ! CharOperation . equals ( currentMethodInfo . getGenericSignature ( ) , otherMethodInfo . getGenericSignature ( ) ) ) return true ; if ( currentMethodInfo . getModifiers ( ) != otherMethodInfo . getModifiers ( ) ) return true ; if ( ( currentMethodInfo . getTagBits ( ) & TagBits . AnnotationDeprecated ) != ( otherMethodInfo . getTagBits ( ) & TagBits . AnnotationDeprecated ) ) return true ; if ( hasStructuralAnnotationChanges ( currentMethodInfo . getAnnotations ( ) , otherMethodInfo . getAnnotations ( ) ) ) return true ; if ( ! CharOperation . equals ( currentMethodInfo . getSelector ( ) , otherMethodInfo . getSelector ( ) ) ) return true ; if ( ! CharOperation . equals ( currentMethodInfo . getMethodDescriptor ( ) , otherMethodInfo . getMethodDescriptor ( ) ) ) return true ; if ( ! CharOperation . equals ( currentMethodInfo . getGenericSignature ( ) , otherMethodInfo . getGenericSignature ( ) ) ) return true ; char [ ] [ ] currentThrownExceptions = currentMethodInfo . getExceptionTypeNames ( ) ; char [ ] [ ] otherThrownExceptions = otherMethodInfo . getExceptionTypeNames ( ) ; if ( currentThrownExceptions != otherThrownExceptions ) { int currentThrownExceptionsLength = currentThrownExceptions == null ? <NUM_LIT:0> : currentThrownExceptions . length ; int otherThrownExceptionsLength = otherThrownExceptions == null ? <NUM_LIT:0> : otherThrownExceptions . length ; if ( currentThrownExceptionsLength != otherThrownExceptionsLength ) return true ; for ( int k = <NUM_LIT:0> ; k < currentThrownExceptionsLength ; k ++ ) if ( ! CharOperation . equals ( currentThrownExceptions [ k ] , otherThrownExceptions [ k ] ) ) return true ; } return false ; } private void initialize ( ) throws ClassFormatException { try { for ( int i = <NUM_LIT:0> , max = this . fieldsCount ; i < max ; i ++ ) { this . fields [ i ] . initialize ( ) ; } for ( int i = <NUM_LIT:0> , max = this . methodsCount ; i < max ; i ++ ) { this . methods [ i ] . initialize ( ) ; } if ( this . innerInfos != null ) { for ( int i = <NUM_LIT:0> , max = this . innerInfos . length ; i < max ; i ++ ) { this . innerInfos [ i ] . initialize ( ) ; } } if ( this . annotations != null ) { for ( int i = <NUM_LIT:0> , max = this . annotations . length ; i < max ; i ++ ) { this . annotations [ i ] . initialize ( ) ; } } this . getEnclosingMethod ( ) ; reset ( ) ; } catch ( RuntimeException e ) { ClassFormatException exception = new ClassFormatException ( e , this . classFileName ) ; throw exception ; } } public boolean isAnonymous ( ) { if ( this . innerInfo == null ) return false ; char [ ] innerSourceName = this . innerInfo . getSourceName ( ) ; return ( innerSourceName == null || innerSourceName . length == <NUM_LIT:0> ) ; } public boolean isBinaryType ( ) { return true ; } public boolean isLocal ( ) { if ( this . innerInfo == null ) return false ; if ( this . innerInfo . getEnclosingTypeName ( ) != null ) return false ; char [ ] innerSourceName = this . innerInfo . getSourceName ( ) ; return ( innerSourceName != null && innerSourceName . length > <NUM_LIT:0> ) ; } public boolean isMember ( ) { if ( this . innerInfo == null ) return false ; if ( this . innerInfo . getEnclosingTypeName ( ) == null ) return false ; char [ ] innerSourceName = this . innerInfo . getSourceName ( ) ; return ( innerSourceName != null && innerSourceName . length > <NUM_LIT:0> ) ; } public boolean isNestedType ( ) { return this . innerInfo != null ; } public char [ ] sourceFileName ( ) { return this . sourceFileName ; } public String toString ( ) { java . io . ByteArrayOutputStream out = new java . io . ByteArrayOutputStream ( ) ; java . io . PrintWriter print = new java . io . PrintWriter ( out ) ; print . println ( getClass ( ) . getName ( ) + "<STR_LIT:{>" ) ; print . println ( "<STR_LIT>" + new String ( getName ( ) ) ) ; print . println ( "<STR_LIT>" + ( getSuperclassName ( ) == null ? "<STR_LIT:null>" : new String ( getSuperclassName ( ) ) ) ) ; print . println ( "<STR_LIT>" + printTypeModifiers ( accessFlags ( ) ) + "<STR_LIT:(>" + accessFlags ( ) + "<STR_LIT:)>" ) ; print . flush ( ) ; return out . toString ( ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . classfmt ; abstract public class ClassFileStruct { byte [ ] reference ; int [ ] constantPoolOffsets ; int structOffset ; public ClassFileStruct ( byte [ ] classFileBytes , int [ ] offsets , int offset ) { this . reference = classFileBytes ; this . constantPoolOffsets = offsets ; this . structOffset = offset ; } public double doubleAt ( int relativeOffset ) { return ( Double . longBitsToDouble ( i8At ( relativeOffset ) ) ) ; } public float floatAt ( int relativeOffset ) { return ( Float . intBitsToFloat ( i4At ( relativeOffset ) ) ) ; } public int i4At ( int relativeOffset ) { int position = relativeOffset + this . structOffset ; return ( ( this . reference [ position ++ ] & <NUM_LIT> ) << <NUM_LIT:24> ) | ( ( this . reference [ position ++ ] & <NUM_LIT> ) << <NUM_LIT:16> ) | ( ( this . reference [ position ++ ] & <NUM_LIT> ) << <NUM_LIT:8> ) + ( this . reference [ position ] & <NUM_LIT> ) ; } public long i8At ( int relativeOffset ) { int position = relativeOffset + this . structOffset ; return ( ( ( long ) ( this . reference [ position ++ ] & <NUM_LIT> ) ) << <NUM_LIT> ) | ( ( ( long ) ( this . reference [ position ++ ] & <NUM_LIT> ) ) << <NUM_LIT> ) | ( ( ( long ) ( this . reference [ position ++ ] & <NUM_LIT> ) ) << <NUM_LIT> ) | ( ( ( long ) ( this . reference [ position ++ ] & <NUM_LIT> ) ) << <NUM_LIT:32> ) | ( ( ( long ) ( this . reference [ position ++ ] & <NUM_LIT> ) ) << <NUM_LIT:24> ) | ( ( ( long ) ( this . reference [ position ++ ] & <NUM_LIT> ) ) << <NUM_LIT:16> ) | ( ( ( long ) ( this . reference [ position ++ ] & <NUM_LIT> ) ) << <NUM_LIT:8> ) | ( this . reference [ position ++ ] & <NUM_LIT> ) ; } protected void reset ( ) { this . reference = null ; this . constantPoolOffsets = null ; } public int u1At ( int relativeOffset ) { return ( this . reference [ relativeOffset + this . structOffset ] & <NUM_LIT> ) ; } public int u2At ( int relativeOffset ) { int position = relativeOffset + this . structOffset ; return ( ( this . reference [ position ++ ] & <NUM_LIT> ) << <NUM_LIT:8> ) | ( this . reference [ position ] & <NUM_LIT> ) ; } public long u4At ( int relativeOffset ) { int position = relativeOffset + this . structOffset ; return ( ( ( this . reference [ position ++ ] & <NUM_LIT> ) << <NUM_LIT:24> ) | ( ( this . reference [ position ++ ] & <NUM_LIT> ) << <NUM_LIT:16> ) | ( ( this . reference [ position ++ ] & <NUM_LIT> ) << <NUM_LIT:8> ) | ( this . reference [ position ] & <NUM_LIT> ) ) ; } public char [ ] utf8At ( int relativeOffset , int bytesAvailable ) { int length = bytesAvailable ; char outputBuf [ ] = new char [ bytesAvailable ] ; int outputPos = <NUM_LIT:0> ; int readOffset = this . structOffset + relativeOffset ; while ( length != <NUM_LIT:0> ) { int x = this . reference [ readOffset ++ ] & <NUM_LIT> ; length -- ; if ( ( <NUM_LIT> & x ) != <NUM_LIT:0> ) { if ( ( x & <NUM_LIT> ) != <NUM_LIT:0> ) { length -= <NUM_LIT:2> ; x = ( ( x & <NUM_LIT> ) << <NUM_LIT:12> ) | ( ( this . reference [ readOffset ++ ] & <NUM_LIT> ) << <NUM_LIT:6> ) | ( this . reference [ readOffset ++ ] & <NUM_LIT> ) ; } else { length -- ; x = ( ( x & <NUM_LIT> ) << <NUM_LIT:6> ) | ( this . reference [ readOffset ++ ] & <NUM_LIT> ) ; } } outputBuf [ outputPos ++ ] = ( char ) x ; } if ( outputPos != bytesAvailable ) { System . arraycopy ( outputBuf , <NUM_LIT:0> , ( outputBuf = new char [ outputPos ] ) , <NUM_LIT:0> , outputPos ) ; } return outputBuf ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . classfmt ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; public interface ClassFileConstants { int AccDefault = <NUM_LIT:0> ; int AccPublic = <NUM_LIT> ; int AccPrivate = <NUM_LIT> ; int AccProtected = <NUM_LIT> ; int AccStatic = <NUM_LIT> ; int AccFinal = <NUM_LIT> ; int AccSynchronized = <NUM_LIT> ; int AccVolatile = <NUM_LIT> ; int AccBridge = <NUM_LIT> ; int AccTransient = <NUM_LIT> ; int AccVarargs = <NUM_LIT> ; int AccNative = <NUM_LIT> ; int AccInterface = <NUM_LIT> ; int AccAbstract = <NUM_LIT> ; int AccStrictfp = <NUM_LIT> ; int AccSynthetic = <NUM_LIT> ; int AccAnnotation = <NUM_LIT> ; int AccEnum = <NUM_LIT> ; int AccSuper = <NUM_LIT> ; int AccAnnotationDefault = ASTNode . Bit18 ; int AccDeprecated = ASTNode . Bit21 ; int Utf8Tag = <NUM_LIT:1> ; int IntegerTag = <NUM_LIT:3> ; int FloatTag = <NUM_LIT:4> ; int LongTag = <NUM_LIT:5> ; int DoubleTag = <NUM_LIT:6> ; int ClassTag = <NUM_LIT:7> ; int StringTag = <NUM_LIT:8> ; int FieldRefTag = <NUM_LIT:9> ; int MethodRefTag = <NUM_LIT:10> ; int InterfaceMethodRefTag = <NUM_LIT:11> ; int NameAndTypeTag = <NUM_LIT:12> ; int ConstantMethodRefFixedSize = <NUM_LIT:5> ; int ConstantClassFixedSize = <NUM_LIT:3> ; int ConstantDoubleFixedSize = <NUM_LIT:9> ; int ConstantFieldRefFixedSize = <NUM_LIT:5> ; int ConstantFloatFixedSize = <NUM_LIT:5> ; int ConstantIntegerFixedSize = <NUM_LIT:5> ; int ConstantInterfaceMethodRefFixedSize = <NUM_LIT:5> ; int ConstantLongFixedSize = <NUM_LIT:9> ; int ConstantStringFixedSize = <NUM_LIT:3> ; int ConstantUtf8FixedSize = <NUM_LIT:3> ; int ConstantNameAndTypeFixedSize = <NUM_LIT:5> ; int MAJOR_VERSION_1_1 = <NUM_LIT> ; int MAJOR_VERSION_1_2 = <NUM_LIT> ; int MAJOR_VERSION_1_3 = <NUM_LIT> ; int MAJOR_VERSION_1_4 = <NUM_LIT> ; int MAJOR_VERSION_1_5 = <NUM_LIT> ; int MAJOR_VERSION_1_6 = <NUM_LIT> ; int MAJOR_VERSION_1_7 = <NUM_LIT> ; int MINOR_VERSION_0 = <NUM_LIT:0> ; int MINOR_VERSION_1 = <NUM_LIT:1> ; int MINOR_VERSION_2 = <NUM_LIT:2> ; int MINOR_VERSION_3 = <NUM_LIT:3> ; int MINOR_VERSION_4 = <NUM_LIT:4> ; long JDK1_1 = ( ( long ) ClassFileConstants . MAJOR_VERSION_1_1 << <NUM_LIT:16> ) + ClassFileConstants . MINOR_VERSION_3 ; long JDK1_2 = ( ( long ) ClassFileConstants . MAJOR_VERSION_1_2 << <NUM_LIT:16> ) + ClassFileConstants . MINOR_VERSION_0 ; long JDK1_3 = ( ( long ) ClassFileConstants . MAJOR_VERSION_1_3 << <NUM_LIT:16> ) + ClassFileConstants . MINOR_VERSION_0 ; long JDK1_4 = ( ( long ) ClassFileConstants . MAJOR_VERSION_1_4 << <NUM_LIT:16> ) + ClassFileConstants . MINOR_VERSION_0 ; long JDK1_5 = ( ( long ) ClassFileConstants . MAJOR_VERSION_1_5 << <NUM_LIT:16> ) + ClassFileConstants . MINOR_VERSION_0 ; long JDK1_6 = ( ( long ) ClassFileConstants . MAJOR_VERSION_1_6 << <NUM_LIT:16> ) + ClassFileConstants . MINOR_VERSION_0 ; long JDK1_7 = ( ( long ) ClassFileConstants . MAJOR_VERSION_1_7 << <NUM_LIT:16> ) + ClassFileConstants . MINOR_VERSION_0 ; long CLDC_1_1 = ( ( long ) ClassFileConstants . MAJOR_VERSION_1_1 << <NUM_LIT:16> ) + ClassFileConstants . MINOR_VERSION_4 ; long JDK_DEFERRED = Long . MAX_VALUE ; int INT_ARRAY = <NUM_LIT:10> ; int BYTE_ARRAY = <NUM_LIT:8> ; int BOOLEAN_ARRAY = <NUM_LIT:4> ; int SHORT_ARRAY = <NUM_LIT:9> ; int CHAR_ARRAY = <NUM_LIT:5> ; int LONG_ARRAY = <NUM_LIT:11> ; int FLOAT_ARRAY = <NUM_LIT:6> ; int DOUBLE_ARRAY = <NUM_LIT:7> ; int ATTR_SOURCE = <NUM_LIT> ; int ATTR_LINES = <NUM_LIT> ; int ATTR_VARS = <NUM_LIT> ; int ATTR_STACK_MAP_TABLE = <NUM_LIT> ; int ATTR_STACK_MAP = <NUM_LIT> ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . classfmt ; import org . eclipse . jdt . internal . compiler . env . IBinaryAnnotation ; public class MethodInfoWithAnnotations extends MethodInfo { protected AnnotationInfo [ ] annotations ; MethodInfoWithAnnotations ( MethodInfo methodInfo , AnnotationInfo [ ] annotations ) { super ( methodInfo . reference , methodInfo . constantPoolOffsets , methodInfo . structOffset ) ; this . annotations = annotations ; this . accessFlags = methodInfo . accessFlags ; this . attributeBytes = methodInfo . attributeBytes ; this . descriptor = methodInfo . descriptor ; this . exceptionNames = methodInfo . exceptionNames ; this . name = methodInfo . name ; this . signature = methodInfo . signature ; this . signatureUtf8Offset = methodInfo . signatureUtf8Offset ; this . tagBits = methodInfo . tagBits ; } public IBinaryAnnotation [ ] getAnnotations ( ) { return this . annotations ; } protected void initialize ( ) { for ( int i = <NUM_LIT:0> , l = this . annotations == null ? <NUM_LIT:0> : this . annotations . length ; i < l ; i ++ ) if ( this . annotations [ i ] != null ) this . annotations [ i ] . initialize ( ) ; super . initialize ( ) ; } protected void reset ( ) { for ( int i = <NUM_LIT:0> , l = this . annotations == null ? <NUM_LIT:0> : this . annotations . length ; i < l ; i ++ ) if ( this . annotations [ i ] != null ) this . annotations [ i ] . reset ( ) ; super . reset ( ) ; } protected void toStringContent ( StringBuffer buffer ) { super . toStringContent ( buffer ) ; for ( int i = <NUM_LIT:0> , l = this . annotations == null ? <NUM_LIT:0> : this . annotations . length ; i < l ; i ++ ) { buffer . append ( this . annotations [ i ] ) ; buffer . append ( '<STR_LIT:\n>' ) ; } } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . classfmt ; import java . io . PrintStream ; import java . io . PrintWriter ; public class ClassFormatException extends Exception { public static final int ErrBadMagic = <NUM_LIT:1> ; public static final int ErrBadMinorVersion = <NUM_LIT:2> ; public static final int ErrBadMajorVersion = <NUM_LIT:3> ; public static final int ErrBadConstantClass = <NUM_LIT:4> ; public static final int ErrBadConstantString = <NUM_LIT:5> ; public static final int ErrBadConstantNameAndType = <NUM_LIT:6> ; public static final int ErrBadConstantFieldRef = <NUM_LIT:7> ; public static final int ErrBadConstantMethodRef = <NUM_LIT:8> ; public static final int ErrBadConstantInterfaceMethodRef = <NUM_LIT:9> ; public static final int ErrBadConstantPoolIndex = <NUM_LIT:10> ; public static final int ErrBadSuperclassName = <NUM_LIT:11> ; public static final int ErrInterfaceCannotBeFinal = <NUM_LIT:12> ; public static final int ErrInterfaceMustBeAbstract = <NUM_LIT> ; public static final int ErrBadModifiers = <NUM_LIT> ; public static final int ErrClassCannotBeAbstractFinal = <NUM_LIT:15> ; public static final int ErrBadClassname = <NUM_LIT:16> ; public static final int ErrBadFieldInfo = <NUM_LIT> ; public static final int ErrBadMethodInfo = <NUM_LIT> ; public static final int ErrEmptyConstantPool = <NUM_LIT> ; public static final int ErrMalformedUtf8 = <NUM_LIT> ; public static final int ErrUnknownConstantTag = <NUM_LIT:20> ; public static final int ErrTruncatedInput = <NUM_LIT> ; public static final int ErrMethodMustBeAbstract = <NUM_LIT> ; public static final int ErrMalformedAttribute = <NUM_LIT> ; public static final int ErrBadInterface = <NUM_LIT:24> ; public static final int ErrInterfaceMustSubclassObject = <NUM_LIT> ; public static final int ErrIncorrectInterfaceMethods = <NUM_LIT> ; public static final int ErrInvalidMethodName = <NUM_LIT> ; public static final int ErrInvalidMethodSignature = <NUM_LIT> ; private static final long serialVersionUID = <NUM_LIT> ; private int errorCode ; private int bufferPosition ; private RuntimeException nestedException ; private char [ ] fileName ; public ClassFormatException ( RuntimeException e , char [ ] fileName ) { this . nestedException = e ; this . fileName = fileName ; } public ClassFormatException ( int code ) { this . errorCode = code ; } public ClassFormatException ( int code , int bufPos ) { this . errorCode = code ; this . bufferPosition = bufPos ; } public int getErrorCode ( ) { return this . errorCode ; } public int getBufferPosition ( ) { return this . bufferPosition ; } public Throwable getException ( ) { return this . nestedException ; } public void printStackTrace ( ) { printStackTrace ( System . err ) ; } public void printStackTrace ( PrintStream output ) { synchronized ( output ) { super . printStackTrace ( output ) ; Throwable throwable = getException ( ) ; if ( throwable != null ) { if ( this . fileName != null ) { output . print ( "<STR_LIT>" ) ; output . print ( this . fileName ) ; output . print ( "<STR_LIT>" ) ; } else { output . print ( "<STR_LIT>" ) ; } throwable . printStackTrace ( output ) ; } } } public void printStackTrace ( PrintWriter output ) { synchronized ( output ) { super . printStackTrace ( output ) ; Throwable throwable = getException ( ) ; if ( throwable != null ) { if ( this . fileName != null ) { output . print ( "<STR_LIT>" ) ; output . print ( this . fileName ) ; output . print ( "<STR_LIT>" ) ; } else { output . print ( "<STR_LIT>" ) ; } throwable . printStackTrace ( output ) ; } } } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . classfmt ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . codegen . AttributeNamesConstants ; import org . eclipse . jdt . internal . compiler . env . IBinaryAnnotation ; import org . eclipse . jdt . internal . compiler . env . IBinaryField ; import org . eclipse . jdt . internal . compiler . impl . * ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; import org . eclipse . jdt . internal . compiler . util . Util ; public class FieldInfo extends ClassFileStruct implements IBinaryField , Comparable { protected int accessFlags ; protected int attributeBytes ; protected Constant constant ; protected char [ ] descriptor ; protected char [ ] name ; protected char [ ] signature ; protected int signatureUtf8Offset ; protected long tagBits ; protected Object wrappedConstantValue ; public static FieldInfo createField ( byte classFileBytes [ ] , int offsets [ ] , int offset ) { FieldInfo fieldInfo = new FieldInfo ( classFileBytes , offsets , offset ) ; AnnotationInfo [ ] annotations = fieldInfo . readAttributes ( ) ; if ( annotations == null ) return fieldInfo ; return new FieldInfoWithAnnotation ( fieldInfo , annotations ) ; } protected FieldInfo ( byte classFileBytes [ ] , int offsets [ ] , int offset ) { super ( classFileBytes , offsets , offset ) ; this . accessFlags = - <NUM_LIT:1> ; this . signatureUtf8Offset = - <NUM_LIT:1> ; } private AnnotationInfo [ ] decodeAnnotations ( int offset , boolean runtimeVisible ) { int numberOfAnnotations = u2At ( offset + <NUM_LIT:6> ) ; if ( numberOfAnnotations > <NUM_LIT:0> ) { int readOffset = offset + <NUM_LIT:8> ; AnnotationInfo [ ] newInfos = null ; int newInfoCount = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < numberOfAnnotations ; i ++ ) { AnnotationInfo newInfo = new AnnotationInfo ( this . reference , this . constantPoolOffsets , readOffset + this . structOffset , runtimeVisible , false ) ; readOffset += newInfo . readOffset ; long standardTagBits = newInfo . standardAnnotationTagBits ; if ( standardTagBits != <NUM_LIT:0> ) { this . tagBits |= standardTagBits ; } else { if ( newInfos == null ) newInfos = new AnnotationInfo [ numberOfAnnotations - i ] ; newInfos [ newInfoCount ++ ] = newInfo ; } } if ( newInfos != null ) { if ( newInfoCount != newInfos . length ) System . arraycopy ( newInfos , <NUM_LIT:0> , newInfos = new AnnotationInfo [ newInfoCount ] , <NUM_LIT:0> , newInfoCount ) ; return newInfos ; } } return null ; } public int compareTo ( Object o ) { return new String ( getName ( ) ) . compareTo ( new String ( ( ( FieldInfo ) o ) . getName ( ) ) ) ; } public boolean equals ( Object o ) { if ( ! ( o instanceof FieldInfo ) ) { return false ; } return CharOperation . equals ( getName ( ) , ( ( FieldInfo ) o ) . getName ( ) ) ; } public int hashCode ( ) { return CharOperation . hashCode ( getName ( ) ) ; } public Constant getConstant ( ) { if ( this . constant == null ) { readConstantAttribute ( ) ; } return this . constant ; } public char [ ] getGenericSignature ( ) { if ( this . signatureUtf8Offset != - <NUM_LIT:1> ) { if ( this . signature == null ) { this . signature = utf8At ( this . signatureUtf8Offset + <NUM_LIT:3> , u2At ( this . signatureUtf8Offset + <NUM_LIT:1> ) ) ; } return this . signature ; } return null ; } public int getModifiers ( ) { if ( this . accessFlags == - <NUM_LIT:1> ) { this . accessFlags = u2At ( <NUM_LIT:0> ) ; readModifierRelatedAttributes ( ) ; } return this . accessFlags ; } public char [ ] getName ( ) { if ( this . name == null ) { int utf8Offset = this . constantPoolOffsets [ u2At ( <NUM_LIT:2> ) ] - this . structOffset ; this . name = utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ; } return this . name ; } public long getTagBits ( ) { return this . tagBits ; } public char [ ] getTypeName ( ) { if ( this . descriptor == null ) { int utf8Offset = this . constantPoolOffsets [ u2At ( <NUM_LIT:4> ) ] - this . structOffset ; this . descriptor = utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ; } return this . descriptor ; } public IBinaryAnnotation [ ] getAnnotations ( ) { return null ; } public Object getWrappedConstantValue ( ) { if ( this . wrappedConstantValue == null ) { if ( hasConstant ( ) ) { Constant fieldConstant = getConstant ( ) ; switch ( fieldConstant . typeID ( ) ) { case TypeIds . T_int : this . wrappedConstantValue = new Integer ( fieldConstant . intValue ( ) ) ; break ; case TypeIds . T_byte : this . wrappedConstantValue = new Byte ( fieldConstant . byteValue ( ) ) ; break ; case TypeIds . T_short : this . wrappedConstantValue = new Short ( fieldConstant . shortValue ( ) ) ; break ; case TypeIds . T_char : this . wrappedConstantValue = new Character ( fieldConstant . charValue ( ) ) ; break ; case TypeIds . T_float : this . wrappedConstantValue = new Float ( fieldConstant . floatValue ( ) ) ; break ; case TypeIds . T_double : this . wrappedConstantValue = new Double ( fieldConstant . doubleValue ( ) ) ; break ; case TypeIds . T_boolean : this . wrappedConstantValue = Util . toBoolean ( fieldConstant . booleanValue ( ) ) ; break ; case TypeIds . T_long : this . wrappedConstantValue = new Long ( fieldConstant . longValue ( ) ) ; break ; case TypeIds . T_JavaLangString : this . wrappedConstantValue = fieldConstant . stringValue ( ) ; } } } return this . wrappedConstantValue ; } public boolean hasConstant ( ) { return getConstant ( ) != Constant . NotAConstant ; } protected void initialize ( ) { getModifiers ( ) ; getName ( ) ; getConstant ( ) ; getTypeName ( ) ; getGenericSignature ( ) ; reset ( ) ; } public boolean isSynthetic ( ) { return ( getModifiers ( ) & ClassFileConstants . AccSynthetic ) != <NUM_LIT:0> ; } private AnnotationInfo [ ] readAttributes ( ) { int attributesCount = u2At ( <NUM_LIT:6> ) ; int readOffset = <NUM_LIT:8> ; AnnotationInfo [ ] annotations = null ; for ( int i = <NUM_LIT:0> ; i < attributesCount ; i ++ ) { int utf8Offset = this . constantPoolOffsets [ u2At ( readOffset ) ] - this . structOffset ; char [ ] attributeName = utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ; if ( attributeName . length > <NUM_LIT:0> ) { switch ( attributeName [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : if ( CharOperation . equals ( AttributeNamesConstants . SignatureName , attributeName ) ) this . signatureUtf8Offset = this . constantPoolOffsets [ u2At ( readOffset + <NUM_LIT:6> ) ] - this . structOffset ; break ; case '<CHAR_LIT>' : AnnotationInfo [ ] decodedAnnotations = null ; if ( CharOperation . equals ( attributeName , AttributeNamesConstants . RuntimeVisibleAnnotationsName ) ) { decodedAnnotations = decodeAnnotations ( readOffset , true ) ; } else if ( CharOperation . equals ( attributeName , AttributeNamesConstants . RuntimeInvisibleAnnotationsName ) ) { decodedAnnotations = decodeAnnotations ( readOffset , false ) ; } if ( decodedAnnotations != null ) { if ( annotations == null ) { annotations = decodedAnnotations ; } else { int length = annotations . length ; AnnotationInfo [ ] combined = new AnnotationInfo [ length + decodedAnnotations . length ] ; System . arraycopy ( annotations , <NUM_LIT:0> , combined , <NUM_LIT:0> , length ) ; System . arraycopy ( decodedAnnotations , <NUM_LIT:0> , combined , length , decodedAnnotations . length ) ; annotations = combined ; } } } } readOffset += ( <NUM_LIT:6> + u4At ( readOffset + <NUM_LIT:2> ) ) ; } this . attributeBytes = readOffset ; return annotations ; } private void readConstantAttribute ( ) { int attributesCount = u2At ( <NUM_LIT:6> ) ; int readOffset = <NUM_LIT:8> ; boolean isConstant = false ; for ( int i = <NUM_LIT:0> ; i < attributesCount ; i ++ ) { int utf8Offset = this . constantPoolOffsets [ u2At ( readOffset ) ] - this . structOffset ; char [ ] attributeName = utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ; if ( CharOperation . equals ( attributeName , AttributeNamesConstants . ConstantValueName ) ) { isConstant = true ; int relativeOffset = this . constantPoolOffsets [ u2At ( readOffset + <NUM_LIT:6> ) ] - this . structOffset ; switch ( u1At ( relativeOffset ) ) { case ClassFileConstants . IntegerTag : char [ ] sign = getTypeName ( ) ; if ( sign . length == <NUM_LIT:1> ) { switch ( sign [ <NUM_LIT:0> ] ) { case '<CHAR_LIT:Z>' : this . constant = BooleanConstant . fromValue ( i4At ( relativeOffset + <NUM_LIT:1> ) == <NUM_LIT:1> ) ; break ; case '<CHAR_LIT>' : this . constant = IntConstant . fromValue ( i4At ( relativeOffset + <NUM_LIT:1> ) ) ; break ; case '<CHAR_LIT>' : this . constant = CharConstant . fromValue ( ( char ) i4At ( relativeOffset + <NUM_LIT:1> ) ) ; break ; case '<CHAR_LIT>' : this . constant = ByteConstant . fromValue ( ( byte ) i4At ( relativeOffset + <NUM_LIT:1> ) ) ; break ; case '<CHAR_LIT>' : this . constant = ShortConstant . fromValue ( ( short ) i4At ( relativeOffset + <NUM_LIT:1> ) ) ; break ; default : this . constant = Constant . NotAConstant ; } } else { this . constant = Constant . NotAConstant ; } break ; case ClassFileConstants . FloatTag : this . constant = FloatConstant . fromValue ( floatAt ( relativeOffset + <NUM_LIT:1> ) ) ; break ; case ClassFileConstants . DoubleTag : this . constant = DoubleConstant . fromValue ( doubleAt ( relativeOffset + <NUM_LIT:1> ) ) ; break ; case ClassFileConstants . LongTag : this . constant = LongConstant . fromValue ( i8At ( relativeOffset + <NUM_LIT:1> ) ) ; break ; case ClassFileConstants . StringTag : utf8Offset = this . constantPoolOffsets [ u2At ( relativeOffset + <NUM_LIT:1> ) ] - this . structOffset ; this . constant = StringConstant . fromValue ( String . valueOf ( utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ) ) ; break ; } } readOffset += ( <NUM_LIT:6> + u4At ( readOffset + <NUM_LIT:2> ) ) ; } if ( ! isConstant ) { this . constant = Constant . NotAConstant ; } } private void readModifierRelatedAttributes ( ) { int attributesCount = u2At ( <NUM_LIT:6> ) ; int readOffset = <NUM_LIT:8> ; for ( int i = <NUM_LIT:0> ; i < attributesCount ; i ++ ) { int utf8Offset = this . constantPoolOffsets [ u2At ( readOffset ) ] - this . structOffset ; char [ ] attributeName = utf8At ( utf8Offset + <NUM_LIT:3> , u2At ( utf8Offset + <NUM_LIT:1> ) ) ; if ( attributeName . length != <NUM_LIT:0> ) { switch ( attributeName [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : if ( CharOperation . equals ( attributeName , AttributeNamesConstants . DeprecatedName ) ) this . accessFlags |= ClassFileConstants . AccDeprecated ; break ; case '<CHAR_LIT>' : if ( CharOperation . equals ( attributeName , AttributeNamesConstants . SyntheticName ) ) this . accessFlags |= ClassFileConstants . AccSynthetic ; break ; } } readOffset += ( <NUM_LIT:6> + u4At ( readOffset + <NUM_LIT:2> ) ) ; } } public int sizeInBytes ( ) { return this . attributeBytes ; } public void throwFormatException ( ) throws ClassFormatException { throw new ClassFormatException ( ClassFormatException . ErrBadFieldInfo ) ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( getClass ( ) . getName ( ) ) ; toStringContent ( buffer ) ; return buffer . toString ( ) ; } protected void toStringContent ( StringBuffer buffer ) { int modifiers = getModifiers ( ) ; buffer . append ( '<CHAR_LIT>' ) . append ( ( ( modifiers & ClassFileConstants . AccDeprecated ) != <NUM_LIT:0> ? "<STR_LIT>" : Util . EMPTY_STRING ) + ( ( modifiers & <NUM_LIT> ) == <NUM_LIT:1> ? "<STR_LIT>" : Util . EMPTY_STRING ) + ( ( modifiers & <NUM_LIT> ) == <NUM_LIT> ? "<STR_LIT>" : Util . EMPTY_STRING ) + ( ( modifiers & <NUM_LIT> ) == <NUM_LIT> ? "<STR_LIT>" : Util . EMPTY_STRING ) + ( ( modifiers & <NUM_LIT> ) == <NUM_LIT> ? "<STR_LIT>" : Util . EMPTY_STRING ) + ( ( modifiers & <NUM_LIT> ) == <NUM_LIT> ? "<STR_LIT>" : Util . EMPTY_STRING ) + ( ( modifiers & <NUM_LIT> ) == <NUM_LIT> ? "<STR_LIT>" : Util . EMPTY_STRING ) + ( ( modifiers & <NUM_LIT> ) == <NUM_LIT> ? "<STR_LIT>" : Util . EMPTY_STRING ) ) . append ( getTypeName ( ) ) . append ( '<CHAR_LIT:U+0020>' ) . append ( getName ( ) ) . append ( '<CHAR_LIT:U+0020>' ) . append ( getConstant ( ) ) . append ( '<CHAR_LIT:}>' ) . toString ( ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler ; public interface ICompilerRequestor { public void acceptResult ( CompilationResult result ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler ; import org . eclipse . jdt . internal . compiler . ast . CompilationUnitDeclaration ; import org . eclipse . jdt . internal . compiler . util . Messages ; public class ProcessTaskManager implements Runnable { Compiler compiler ; private int unitIndex ; private Thread processingThread ; CompilationUnitDeclaration unitToProcess ; private Throwable caughtException ; volatile int currentIndex , availableIndex , size , sleepCount ; CompilationUnitDeclaration [ ] units ; public static final int PROCESSED_QUEUE_SIZE = <NUM_LIT:12> ; public ProcessTaskManager ( Compiler compiler ) { this . compiler = compiler ; this . unitIndex = <NUM_LIT:0> ; this . currentIndex = <NUM_LIT:0> ; this . availableIndex = <NUM_LIT:0> ; this . size = PROCESSED_QUEUE_SIZE ; this . sleepCount = <NUM_LIT:0> ; this . units = new CompilationUnitDeclaration [ this . size ] ; synchronized ( this ) { this . processingThread = new Thread ( this , "<STR_LIT>" ) ; this . processingThread . setDaemon ( true ) ; this . processingThread . start ( ) ; } } private synchronized void addNextUnit ( CompilationUnitDeclaration newElement ) { while ( this . units [ this . availableIndex ] != null ) { this . sleepCount = <NUM_LIT:1> ; try { wait ( <NUM_LIT> ) ; } catch ( InterruptedException ignore ) { } this . sleepCount = <NUM_LIT:0> ; } this . units [ this . availableIndex ++ ] = newElement ; if ( this . availableIndex >= this . size ) this . availableIndex = <NUM_LIT:0> ; if ( this . sleepCount <= - <NUM_LIT:1> ) notify ( ) ; } public CompilationUnitDeclaration removeNextUnit ( ) throws Error { CompilationUnitDeclaration next = null ; boolean yield = false ; synchronized ( this ) { next = this . units [ this . currentIndex ] ; if ( next == null || this . caughtException != null ) { do { if ( this . processingThread == null ) { if ( this . caughtException != null ) { if ( this . caughtException instanceof Error ) throw ( Error ) this . caughtException ; throw ( RuntimeException ) this . caughtException ; } return null ; } this . sleepCount = - <NUM_LIT:1> ; try { wait ( <NUM_LIT:100> ) ; } catch ( InterruptedException ignore ) { } this . sleepCount = <NUM_LIT:0> ; next = this . units [ this . currentIndex ] ; } while ( next == null ) ; } this . units [ this . currentIndex ++ ] = null ; if ( this . currentIndex >= this . size ) this . currentIndex = <NUM_LIT:0> ; if ( this . sleepCount >= <NUM_LIT:1> && ++ this . sleepCount > <NUM_LIT:4> ) { notify ( ) ; yield = this . sleepCount > <NUM_LIT:8> ; } } if ( yield ) Thread . yield ( ) ; return next ; } public void run ( ) { while ( this . processingThread != null ) { this . unitToProcess = null ; int index = - <NUM_LIT:1> ; try { synchronized ( this ) { if ( this . processingThread == null ) return ; this . unitToProcess = this . compiler . getUnitToProcess ( this . unitIndex ) ; if ( this . unitToProcess == null ) { this . processingThread = null ; return ; } index = this . unitIndex ++ ; } try { this . compiler . reportProgress ( Messages . bind ( Messages . compilation_processing , new String ( this . unitToProcess . getFileName ( ) ) ) ) ; if ( this . compiler . options . verbose ) this . compiler . out . println ( Messages . bind ( Messages . compilation_process , new String [ ] { String . valueOf ( index + <NUM_LIT:1> ) , String . valueOf ( this . compiler . totalUnits ) , new String ( this . unitToProcess . getFileName ( ) ) } ) ) ; this . compiler . process ( this . unitToProcess , index ) ; } finally { if ( this . unitToProcess != null ) this . unitToProcess . cleanUp ( ) ; } addNextUnit ( this . unitToProcess ) ; } catch ( Error e ) { synchronized ( this ) { this . processingThread = null ; this . caughtException = e ; } return ; } catch ( RuntimeException e ) { synchronized ( this ) { this . processingThread = null ; this . caughtException = e ; } return ; } } } public void shutdown ( ) { try { Thread t = null ; synchronized ( this ) { if ( this . processingThread != null ) { t = this . processingThread ; this . processingThread = null ; notifyAll ( ) ; } } if ( t != null ) t . join ( <NUM_LIT> ) ; } catch ( InterruptedException ignored ) { } } } </s>
|
<s> package org . eclipse . jdt . internal . compiler ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashSet ; import java . util . List ; import java . util . Set ; 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 . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . Annotation ; import org . eclipse . jdt . internal . compiler . ast . AnnotationMethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . Argument ; import org . eclipse . jdt . internal . compiler . ast . ArrayInitializer ; import org . eclipse . jdt . internal . compiler . ast . ClassLiteralAccess ; import org . eclipse . jdt . internal . compiler . ast . Expression ; import org . eclipse . jdt . internal . compiler . ast . FieldDeclaration ; import org . eclipse . jdt . internal . compiler . ast . MemberValuePair ; import org . eclipse . jdt . internal . compiler . ast . MethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . NormalAnnotation ; import org . eclipse . jdt . internal . compiler . ast . QualifiedNameReference ; import org . eclipse . jdt . internal . compiler . ast . SingleMemberAnnotation ; import org . eclipse . jdt . internal . compiler . ast . SingleNameReference ; import org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . codegen . AttributeNamesConstants ; import org . eclipse . jdt . internal . compiler . codegen . CodeStream ; import org . eclipse . jdt . internal . compiler . codegen . ConstantPool ; import org . eclipse . jdt . internal . compiler . codegen . ExceptionLabel ; import org . eclipse . jdt . internal . compiler . codegen . Opcodes ; import org . eclipse . jdt . internal . compiler . codegen . StackMapFrame ; import org . eclipse . jdt . internal . compiler . codegen . StackMapFrameCodeStream ; import org . eclipse . jdt . internal . compiler . codegen . StackMapFrameCodeStream . ExceptionMarker ; import org . eclipse . jdt . internal . compiler . codegen . StackMapFrameCodeStream . StackDepthMarker ; import org . eclipse . jdt . internal . compiler . codegen . StackMapFrameCodeStream . StackMarker ; import org . eclipse . jdt . internal . compiler . codegen . VerificationTypeInfo ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . impl . StringConstant ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . LocalTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . LocalVariableBinding ; import org . eclipse . jdt . internal . compiler . lookup . LookupEnvironment ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . SourceTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . SyntheticArgumentBinding ; import org . eclipse . jdt . internal . compiler . lookup . SyntheticMethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . TagBits ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; import org . eclipse . jdt . internal . compiler . lookup . TypeVariableBinding ; import org . eclipse . jdt . internal . compiler . problem . ProblemSeverities ; import org . eclipse . jdt . internal . compiler . problem . ShouldNotImplement ; import org . eclipse . jdt . internal . compiler . util . Messages ; import org . eclipse . jdt . internal . compiler . util . Util ; public class ClassFile implements TypeConstants , TypeIds { private byte [ ] bytes ; public CodeStream codeStream ; public ConstantPool constantPool ; public int constantPoolOffset ; public byte [ ] contents ; public int contentsOffset ; protected boolean creatingProblemType ; public ClassFile enclosingClassFile ; public byte [ ] header ; public int headerOffset ; public Set innerClassesBindings ; public int methodCount ; public int methodCountOffset ; boolean isShared = false ; public int produceAttributes ; public SourceTypeBinding referenceBinding ; public boolean isNestedType ; public long targetJDK ; public List missingTypes = null ; public Set visitedTypes ; public static final int INITIAL_CONTENTS_SIZE = <NUM_LIT> ; public static final int INITIAL_HEADER_SIZE = <NUM_LIT> ; public static final int INNER_CLASSES_SIZE = <NUM_LIT:5> ; public static void createProblemType ( TypeDeclaration typeDeclaration , CompilationResult unitResult ) { SourceTypeBinding typeBinding = typeDeclaration . binding ; ClassFile classFile = ClassFile . getNewInstance ( typeBinding ) ; classFile . initialize ( typeBinding , null , true ) ; if ( typeBinding . hasMemberTypes ( ) ) { ReferenceBinding [ ] members = typeBinding . memberTypes ; for ( int i = <NUM_LIT:0> , l = members . length ; i < l ; i ++ ) classFile . recordInnerClasses ( members [ i ] ) ; } if ( typeBinding . isNestedType ( ) ) { classFile . recordInnerClasses ( typeBinding ) ; } TypeVariableBinding [ ] typeVariables = typeBinding . typeVariables ( ) ; for ( int i = <NUM_LIT:0> , max = typeVariables . length ; i < max ; i ++ ) { TypeVariableBinding typeVariableBinding = typeVariables [ i ] ; if ( ( typeVariableBinding . tagBits & TagBits . ContainsNestedTypeReferences ) != <NUM_LIT:0> ) { Util . recordNestedType ( classFile , typeVariableBinding ) ; } } FieldBinding [ ] fields = typeBinding . fields ( ) ; if ( ( fields != null ) && ( fields != Binding . NO_FIELDS ) ) { classFile . addFieldInfos ( ) ; } else { classFile . contents [ classFile . contentsOffset ++ ] = <NUM_LIT:0> ; classFile . contents [ classFile . contentsOffset ++ ] = <NUM_LIT:0> ; } classFile . setForMethodInfos ( ) ; int problemsLength ; CategorizedProblem [ ] problems = unitResult . getErrors ( ) ; if ( problems == null ) { problems = new CategorizedProblem [ <NUM_LIT:0> ] ; } CategorizedProblem [ ] problemsCopy = new CategorizedProblem [ problemsLength = problems . length ] ; System . arraycopy ( problems , <NUM_LIT:0> , problemsCopy , <NUM_LIT:0> , problemsLength ) ; AbstractMethodDeclaration [ ] methodDecls = typeDeclaration . methods ; if ( methodDecls != null ) { if ( typeBinding . isInterface ( ) ) { classFile . addProblemClinit ( problemsCopy ) ; for ( int i = <NUM_LIT:0> , length = methodDecls . length ; i < length ; i ++ ) { AbstractMethodDeclaration methodDecl = methodDecls [ i ] ; MethodBinding method = methodDecl . binding ; if ( method == null || method . isConstructor ( ) ) continue ; method . modifiers = ClassFileConstants . AccPublic | ClassFileConstants . AccAbstract ; classFile . addAbstractMethod ( methodDecl , method ) ; } } else { for ( int i = <NUM_LIT:0> , length = methodDecls . length ; i < length ; i ++ ) { AbstractMethodDeclaration methodDecl = methodDecls [ i ] ; MethodBinding method = methodDecl . binding ; if ( method == null ) continue ; if ( method . isConstructor ( ) ) { classFile . addProblemConstructor ( methodDecl , method , problemsCopy ) ; } else if ( method . isAbstract ( ) ) { classFile . addAbstractMethod ( methodDecl , method ) ; } else { classFile . addProblemMethod ( methodDecl , method , problemsCopy ) ; } } } classFile . addDefaultAbstractMethods ( ) ; } if ( typeDeclaration . memberTypes != null ) { for ( int i = <NUM_LIT:0> , max = typeDeclaration . memberTypes . length ; i < max ; i ++ ) { TypeDeclaration memberType = typeDeclaration . memberTypes [ i ] ; if ( memberType . binding != null ) { ClassFile . createProblemType ( memberType , unitResult ) ; } } } classFile . addAttributes ( ) ; unitResult . record ( typeBinding . constantPoolName ( ) , classFile ) ; } public static ClassFile getNewInstance ( SourceTypeBinding typeBinding ) { LookupEnvironment env = typeBinding . scope . environment ( ) ; return env . classFilePool . acquire ( typeBinding ) ; } protected ClassFile ( ) { } public ClassFile ( SourceTypeBinding typeBinding ) { this . constantPool = new ConstantPool ( this ) ; final CompilerOptions options = typeBinding . scope . compilerOptions ( ) ; this . targetJDK = options . targetJDK ; this . produceAttributes = options . produceDebugAttributes ; this . referenceBinding = typeBinding ; this . isNestedType = typeBinding . isNestedType ( ) ; if ( this . targetJDK >= ClassFileConstants . JDK1_6 ) { this . produceAttributes |= ClassFileConstants . ATTR_STACK_MAP_TABLE ; this . codeStream = new StackMapFrameCodeStream ( this ) ; } else if ( this . targetJDK == ClassFileConstants . CLDC_1_1 ) { this . targetJDK = ClassFileConstants . JDK1_1 ; this . produceAttributes |= ClassFileConstants . ATTR_STACK_MAP ; this . codeStream = new StackMapFrameCodeStream ( this ) ; } else { this . codeStream = new CodeStream ( this ) ; } initByteArrays ( ) ; } public void addAbstractMethod ( AbstractMethodDeclaration method , MethodBinding methodBinding ) { this . generateMethodInfoHeader ( methodBinding ) ; int methodAttributeOffset = this . contentsOffset ; int attributeNumber = this . generateMethodInfoAttributes ( methodBinding ) ; completeMethodInfo ( methodBinding , methodAttributeOffset , attributeNumber ) ; } public void addAttributes ( ) { this . contents [ this . methodCountOffset ++ ] = ( byte ) ( this . methodCount > > <NUM_LIT:8> ) ; this . contents [ this . methodCountOffset ] = ( byte ) this . methodCount ; int attributesNumber = <NUM_LIT:0> ; int attributeOffset = this . contentsOffset ; this . contentsOffset += <NUM_LIT:2> ; if ( ( this . produceAttributes & ClassFileConstants . ATTR_SOURCE ) != <NUM_LIT:0> ) { String fullFileName = new String ( this . referenceBinding . scope . referenceCompilationUnit ( ) . getFileName ( ) ) ; fullFileName = fullFileName . replace ( '<STR_LIT:\\>' , '<CHAR_LIT:/>' ) ; int lastIndex = fullFileName . lastIndexOf ( '<CHAR_LIT:/>' ) ; if ( lastIndex != - <NUM_LIT:1> ) { fullFileName = fullFileName . substring ( lastIndex + <NUM_LIT:1> , fullFileName . length ( ) ) ; } attributesNumber += generateSourceAttribute ( fullFileName ) ; } if ( this . referenceBinding . isDeprecated ( ) ) { attributesNumber += generateDeprecatedAttribute ( ) ; } char [ ] genericSignature = this . referenceBinding . genericSignature ( ) ; if ( genericSignature != null ) { attributesNumber += generateSignatureAttribute ( genericSignature ) ; } if ( this . targetJDK >= ClassFileConstants . JDK1_5 && this . referenceBinding . isNestedType ( ) && ! this . referenceBinding . isMemberType ( ) ) { attributesNumber += generateEnclosingMethodAttribute ( ) ; } if ( this . targetJDK >= ClassFileConstants . JDK1_4 ) { TypeDeclaration typeDeclaration = this . referenceBinding . scope . referenceContext ; if ( typeDeclaration != null ) { final Annotation [ ] annotations = typeDeclaration . annotations ; if ( annotations != null ) { attributesNumber += generateRuntimeAnnotations ( annotations ) ; } } } if ( this . referenceBinding . isHierarchyInconsistent ( ) ) { ReferenceBinding superclass = this . referenceBinding . superclass ; if ( superclass != null ) { this . missingTypes = superclass . collectMissingTypes ( this . missingTypes ) ; } ReferenceBinding [ ] superInterfaces = this . referenceBinding . superInterfaces ( ) ; for ( int i = <NUM_LIT:0> , max = superInterfaces . length ; i < max ; i ++ ) { this . missingTypes = superInterfaces [ i ] . collectMissingTypes ( this . missingTypes ) ; } attributesNumber += generateHierarchyInconsistentAttribute ( ) ; } int numberOfInnerClasses = this . innerClassesBindings == null ? <NUM_LIT:0> : this . innerClassesBindings . size ( ) ; if ( numberOfInnerClasses != <NUM_LIT:0> ) { ReferenceBinding [ ] innerClasses = new ReferenceBinding [ numberOfInnerClasses ] ; this . innerClassesBindings . toArray ( innerClasses ) ; Arrays . sort ( innerClasses , new Comparator ( ) { public int compare ( Object o1 , Object o2 ) { TypeBinding binding1 = ( TypeBinding ) o1 ; TypeBinding binding2 = ( TypeBinding ) o2 ; return CharOperation . compareTo ( binding1 . constantPoolName ( ) , binding2 . constantPoolName ( ) ) ; } } ) ; attributesNumber += generateInnerClassAttribute ( numberOfInnerClasses , innerClasses ) ; } if ( this . missingTypes != null ) { generateMissingTypesAttribute ( ) ; attributesNumber ++ ; } if ( attributeOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } this . contents [ attributeOffset ++ ] = ( byte ) ( attributesNumber > > <NUM_LIT:8> ) ; this . contents [ attributeOffset ] = ( byte ) attributesNumber ; this . header = this . constantPool . poolContent ; this . headerOffset = this . constantPool . currentOffset ; int constantPoolCount = this . constantPool . currentIndex ; this . header [ this . constantPoolOffset ++ ] = ( byte ) ( constantPoolCount > > <NUM_LIT:8> ) ; this . header [ this . constantPoolOffset ] = ( byte ) constantPoolCount ; } public void addDefaultAbstractMethods ( ) { MethodBinding [ ] defaultAbstractMethods = this . referenceBinding . getDefaultAbstractMethods ( ) ; for ( int i = <NUM_LIT:0> , max = defaultAbstractMethods . length ; i < max ; i ++ ) { MethodBinding methodBinding = defaultAbstractMethods [ i ] ; generateMethodInfoHeader ( methodBinding ) ; int methodAttributeOffset = this . contentsOffset ; int attributeNumber = generateMethodInfoAttributes ( methodBinding ) ; completeMethodInfo ( methodBinding , methodAttributeOffset , attributeNumber ) ; } } private int addFieldAttributes ( FieldBinding fieldBinding , int fieldAttributeOffset ) { int attributesNumber = <NUM_LIT:0> ; Constant fieldConstant = fieldBinding . constant ( ) ; if ( fieldConstant != Constant . NotAConstant ) { attributesNumber += generateConstantValueAttribute ( fieldConstant , fieldBinding , fieldAttributeOffset ) ; } if ( this . targetJDK < ClassFileConstants . JDK1_5 && fieldBinding . isSynthetic ( ) ) { attributesNumber += generateSyntheticAttribute ( ) ; } if ( fieldBinding . isDeprecated ( ) ) { attributesNumber += generateDeprecatedAttribute ( ) ; } char [ ] genericSignature = fieldBinding . genericSignature ( ) ; if ( genericSignature != null ) { attributesNumber += generateSignatureAttribute ( genericSignature ) ; } if ( this . targetJDK >= ClassFileConstants . JDK1_4 ) { FieldDeclaration fieldDeclaration = fieldBinding . sourceField ( ) ; if ( fieldDeclaration != null ) { Annotation [ ] annotations = fieldDeclaration . annotations ; if ( annotations != null ) { attributesNumber += generateRuntimeAnnotations ( annotations ) ; } } } if ( ( fieldBinding . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) { this . missingTypes = fieldBinding . type . collectMissingTypes ( this . missingTypes ) ; } return attributesNumber ; } private void addFieldInfo ( FieldBinding fieldBinding ) { if ( this . contentsOffset + <NUM_LIT:8> >= this . contents . length ) { resizeContents ( <NUM_LIT:8> ) ; } int accessFlags = fieldBinding . getAccessFlags ( ) ; if ( this . targetJDK < ClassFileConstants . JDK1_5 ) { accessFlags &= ~ ClassFileConstants . AccSynthetic ; } this . contents [ this . contentsOffset ++ ] = ( byte ) ( accessFlags > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) accessFlags ; int nameIndex = this . constantPool . literalIndex ( fieldBinding . name ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( nameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) nameIndex ; int descriptorIndex = this . constantPool . literalIndex ( fieldBinding . type ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( descriptorIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) descriptorIndex ; int fieldAttributeOffset = this . contentsOffset ; int attributeNumber = <NUM_LIT:0> ; this . contentsOffset += <NUM_LIT:2> ; attributeNumber += addFieldAttributes ( fieldBinding , fieldAttributeOffset ) ; if ( this . contentsOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } this . contents [ fieldAttributeOffset ++ ] = ( byte ) ( attributeNumber > > <NUM_LIT:8> ) ; this . contents [ fieldAttributeOffset ] = ( byte ) attributeNumber ; } public void addFieldInfos ( ) { SourceTypeBinding currentBinding = this . referenceBinding ; FieldBinding [ ] syntheticFields = currentBinding . syntheticFields ( ) ; int fieldCount = currentBinding . fieldCount ( ) + ( syntheticFields == null ? <NUM_LIT:0> : syntheticFields . length ) ; if ( fieldCount > <NUM_LIT> ) { this . referenceBinding . scope . problemReporter ( ) . tooManyFields ( this . referenceBinding . scope . referenceType ( ) ) ; } this . contents [ this . contentsOffset ++ ] = ( byte ) ( fieldCount > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) fieldCount ; FieldDeclaration [ ] fieldDecls = currentBinding . scope . referenceContext . fields ; for ( int i = <NUM_LIT:0> , max = fieldDecls == null ? <NUM_LIT:0> : fieldDecls . length ; i < max ; i ++ ) { FieldDeclaration fieldDecl = fieldDecls [ i ] ; if ( fieldDecl . binding != null ) { addFieldInfo ( fieldDecl . binding ) ; } } if ( syntheticFields != null ) { for ( int i = <NUM_LIT:0> , max = syntheticFields . length ; i < max ; i ++ ) { addFieldInfo ( syntheticFields [ i ] ) ; } } } private void addMissingAbstractProblemMethod ( MethodDeclaration methodDeclaration , MethodBinding methodBinding , CategorizedProblem problem , CompilationResult compilationResult ) { generateMethodInfoHeader ( methodBinding , methodBinding . modifiers & ~ ( ClassFileConstants . AccStrictfp | ClassFileConstants . AccNative | ClassFileConstants . AccAbstract ) ) ; int methodAttributeOffset = this . contentsOffset ; int attributeNumber = generateMethodInfoAttributes ( methodBinding ) ; attributeNumber ++ ; int codeAttributeOffset = this . contentsOffset ; generateCodeAttributeHeader ( ) ; StringBuffer buffer = new StringBuffer ( <NUM_LIT> ) ; buffer . append ( "<STR_LIT:t>" + problem . getMessage ( ) + "<STR_LIT:n>" ) ; buffer . insert ( <NUM_LIT:0> , Messages . compilation_unresolvedProblem ) ; String problemString = buffer . toString ( ) ; this . codeStream . init ( this ) ; this . codeStream . preserveUnusedLocals = true ; this . codeStream . initializeMaxLocals ( methodBinding ) ; this . codeStream . generateCodeAttributeForProblemMethod ( problemString ) ; completeCodeAttributeForMissingAbstractProblemMethod ( methodBinding , codeAttributeOffset , compilationResult . getLineSeparatorPositions ( ) , problem . getSourceLineNumber ( ) ) ; completeMethodInfo ( methodBinding , methodAttributeOffset , attributeNumber ) ; } public void addProblemClinit ( CategorizedProblem [ ] problems ) { generateMethodInfoHeaderForClinit ( ) ; this . contentsOffset -= <NUM_LIT:2> ; int attributeOffset = this . contentsOffset ; this . contentsOffset += <NUM_LIT:2> ; int attributeNumber = <NUM_LIT:0> ; int codeAttributeOffset = this . contentsOffset ; generateCodeAttributeHeader ( ) ; this . codeStream . resetForProblemClinit ( this ) ; String problemString = "<STR_LIT>" ; int problemLine = <NUM_LIT:0> ; if ( problems != null ) { int max = problems . length ; StringBuffer buffer = new StringBuffer ( <NUM_LIT> ) ; int count = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < max ; i ++ ) { CategorizedProblem problem = problems [ i ] ; if ( ( problem != null ) && ( problem . isError ( ) ) ) { buffer . append ( "<STR_LIT:t>" + problem . getMessage ( ) + "<STR_LIT:n>" ) ; count ++ ; if ( problemLine == <NUM_LIT:0> ) { problemLine = problem . getSourceLineNumber ( ) ; } problems [ i ] = null ; } } if ( count > <NUM_LIT:1> ) { buffer . insert ( <NUM_LIT:0> , Messages . compilation_unresolvedProblems ) ; } else { buffer . insert ( <NUM_LIT:0> , Messages . compilation_unresolvedProblem ) ; } problemString = buffer . toString ( ) ; } this . codeStream . generateCodeAttributeForProblemMethod ( problemString ) ; attributeNumber ++ ; completeCodeAttributeForClinit ( codeAttributeOffset , problemLine ) ; if ( this . contentsOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } this . contents [ attributeOffset ++ ] = ( byte ) ( attributeNumber > > <NUM_LIT:8> ) ; this . contents [ attributeOffset ] = ( byte ) attributeNumber ; } public void addProblemConstructor ( AbstractMethodDeclaration method , MethodBinding methodBinding , CategorizedProblem [ ] problems ) { generateMethodInfoHeader ( methodBinding , methodBinding . modifiers & ~ ( ClassFileConstants . AccStrictfp | ClassFileConstants . AccNative | ClassFileConstants . AccAbstract ) ) ; int methodAttributeOffset = this . contentsOffset ; int attributesNumber = generateMethodInfoAttributes ( methodBinding ) ; attributesNumber ++ ; int codeAttributeOffset = this . contentsOffset ; generateCodeAttributeHeader ( ) ; this . codeStream . reset ( method , this ) ; String problemString = "<STR_LIT>" ; int problemLine = <NUM_LIT:0> ; if ( problems != null ) { int max = problems . length ; StringBuffer buffer = new StringBuffer ( <NUM_LIT> ) ; int count = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < max ; i ++ ) { CategorizedProblem problem = problems [ i ] ; if ( ( problem != null ) && ( problem . isError ( ) ) ) { buffer . append ( "<STR_LIT:t>" + problem . getMessage ( ) + "<STR_LIT:n>" ) ; count ++ ; if ( problemLine == <NUM_LIT:0> ) { problemLine = problem . getSourceLineNumber ( ) ; } } } if ( count > <NUM_LIT:1> ) { buffer . insert ( <NUM_LIT:0> , Messages . compilation_unresolvedProblems ) ; } else { buffer . insert ( <NUM_LIT:0> , Messages . compilation_unresolvedProblem ) ; } problemString = buffer . toString ( ) ; } this . codeStream . generateCodeAttributeForProblemMethod ( problemString ) ; completeCodeAttributeForProblemMethod ( method , methodBinding , codeAttributeOffset , ( ( SourceTypeBinding ) methodBinding . declaringClass ) . scope . referenceCompilationUnit ( ) . compilationResult . getLineSeparatorPositions ( ) , problemLine ) ; completeMethodInfo ( methodBinding , methodAttributeOffset , attributesNumber ) ; } public void addProblemConstructor ( AbstractMethodDeclaration method , MethodBinding methodBinding , CategorizedProblem [ ] problems , int savedOffset ) { this . contentsOffset = savedOffset ; this . methodCount -- ; addProblemConstructor ( method , methodBinding , problems ) ; } public void addProblemMethod ( AbstractMethodDeclaration method , MethodBinding methodBinding , CategorizedProblem [ ] problems ) { if ( methodBinding . isAbstract ( ) && methodBinding . declaringClass . isInterface ( ) ) { method . abort ( ProblemSeverities . AbortType , null ) ; } generateMethodInfoHeader ( methodBinding , methodBinding . modifiers & ~ ( ClassFileConstants . AccStrictfp | ClassFileConstants . AccNative | ClassFileConstants . AccAbstract ) ) ; int methodAttributeOffset = this . contentsOffset ; int attributesNumber = generateMethodInfoAttributes ( methodBinding ) ; attributesNumber ++ ; int codeAttributeOffset = this . contentsOffset ; generateCodeAttributeHeader ( ) ; this . codeStream . reset ( method , this ) ; String problemString = "<STR_LIT>" ; int problemLine = <NUM_LIT:0> ; if ( problems != null ) { int max = problems . length ; StringBuffer buffer = new StringBuffer ( <NUM_LIT> ) ; int count = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < max ; i ++ ) { CategorizedProblem problem = problems [ i ] ; if ( ( problem != null ) && ( problem . isError ( ) ) && ( problem . getSourceStart ( ) >= method . declarationSourceStart ) && ( problem . getSourceEnd ( ) <= method . declarationSourceEnd ) ) { buffer . append ( "<STR_LIT:t>" + problem . getMessage ( ) + "<STR_LIT:n>" ) ; count ++ ; if ( problemLine == <NUM_LIT:0> ) { problemLine = problem . getSourceLineNumber ( ) ; } problems [ i ] = null ; } } if ( count > <NUM_LIT:1> ) { buffer . insert ( <NUM_LIT:0> , Messages . compilation_unresolvedProblems ) ; } else { buffer . insert ( <NUM_LIT:0> , Messages . compilation_unresolvedProblem ) ; } problemString = buffer . toString ( ) ; } this . codeStream . generateCodeAttributeForProblemMethod ( problemString ) ; completeCodeAttributeForProblemMethod ( method , methodBinding , codeAttributeOffset , ( ( SourceTypeBinding ) methodBinding . declaringClass ) . scope . referenceCompilationUnit ( ) . compilationResult . getLineSeparatorPositions ( ) , problemLine ) ; completeMethodInfo ( methodBinding , methodAttributeOffset , attributesNumber ) ; } public void addProblemMethod ( AbstractMethodDeclaration method , MethodBinding methodBinding , CategorizedProblem [ ] problems , int savedOffset ) { this . contentsOffset = savedOffset ; this . methodCount -- ; addProblemMethod ( method , methodBinding , problems ) ; } public void addSpecialMethods ( ) { generateMissingAbstractMethods ( this . referenceBinding . scope . referenceType ( ) . missingAbstractMethods , this . referenceBinding . scope . referenceCompilationUnit ( ) . compilationResult ) ; MethodBinding [ ] defaultAbstractMethods = this . referenceBinding . getDefaultAbstractMethods ( ) ; for ( int i = <NUM_LIT:0> , max = defaultAbstractMethods . length ; i < max ; i ++ ) { MethodBinding methodBinding = defaultAbstractMethods [ i ] ; generateMethodInfoHeader ( methodBinding ) ; int methodAttributeOffset = this . contentsOffset ; int attributeNumber = generateMethodInfoAttributes ( methodBinding ) ; completeMethodInfo ( methodBinding , methodAttributeOffset , attributeNumber ) ; } SyntheticMethodBinding [ ] syntheticMethods = this . referenceBinding . syntheticMethods ( ) ; if ( syntheticMethods != null ) { for ( int i = <NUM_LIT:0> , max = syntheticMethods . length ; i < max ; i ++ ) { SyntheticMethodBinding syntheticMethod = syntheticMethods [ i ] ; switch ( syntheticMethod . purpose ) { case SyntheticMethodBinding . FieldReadAccess : case SyntheticMethodBinding . SuperFieldReadAccess : addSyntheticFieldReadAccessMethod ( syntheticMethod ) ; break ; case SyntheticMethodBinding . FieldWriteAccess : case SyntheticMethodBinding . SuperFieldWriteAccess : addSyntheticFieldWriteAccessMethod ( syntheticMethod ) ; break ; case SyntheticMethodBinding . MethodAccess : case SyntheticMethodBinding . SuperMethodAccess : case SyntheticMethodBinding . BridgeMethod : addSyntheticMethodAccessMethod ( syntheticMethod ) ; break ; case SyntheticMethodBinding . ConstructorAccess : addSyntheticConstructorAccessMethod ( syntheticMethod ) ; break ; case SyntheticMethodBinding . EnumValues : addSyntheticEnumValuesMethod ( syntheticMethod ) ; break ; case SyntheticMethodBinding . EnumValueOf : addSyntheticEnumValueOfMethod ( syntheticMethod ) ; break ; case SyntheticMethodBinding . SwitchTable : addSyntheticSwitchTable ( syntheticMethod ) ; break ; case SyntheticMethodBinding . TooManyEnumsConstants : addSyntheticEnumInitializationMethod ( syntheticMethod ) ; } } } } public void addSyntheticConstructorAccessMethod ( SyntheticMethodBinding methodBinding ) { generateMethodInfoHeader ( methodBinding ) ; int methodAttributeOffset = this . contentsOffset ; int attributeNumber = generateMethodInfoAttributes ( methodBinding ) ; int codeAttributeOffset = this . contentsOffset ; attributeNumber ++ ; generateCodeAttributeHeader ( ) ; this . codeStream . init ( this ) ; this . codeStream . generateSyntheticBodyForConstructorAccess ( methodBinding ) ; completeCodeAttributeForSyntheticMethod ( methodBinding , codeAttributeOffset , ( ( SourceTypeBinding ) methodBinding . declaringClass ) . scope . referenceCompilationUnit ( ) . compilationResult . getLineSeparatorPositions ( ) ) ; this . contents [ methodAttributeOffset ++ ] = ( byte ) ( attributeNumber > > <NUM_LIT:8> ) ; this . contents [ methodAttributeOffset ] = ( byte ) attributeNumber ; } public void addSyntheticEnumValueOfMethod ( SyntheticMethodBinding methodBinding ) { generateMethodInfoHeader ( methodBinding ) ; int methodAttributeOffset = this . contentsOffset ; int attributeNumber = generateMethodInfoAttributes ( methodBinding ) ; int codeAttributeOffset = this . contentsOffset ; attributeNumber ++ ; generateCodeAttributeHeader ( ) ; this . codeStream . init ( this ) ; this . codeStream . generateSyntheticBodyForEnumValueOf ( methodBinding ) ; completeCodeAttributeForSyntheticMethod ( methodBinding , codeAttributeOffset , ( ( SourceTypeBinding ) methodBinding . declaringClass ) . scope . referenceCompilationUnit ( ) . compilationResult . getLineSeparatorPositions ( ) ) ; this . contents [ methodAttributeOffset ++ ] = ( byte ) ( attributeNumber > > <NUM_LIT:8> ) ; this . contents [ methodAttributeOffset ] = ( byte ) attributeNumber ; } public void addSyntheticEnumValuesMethod ( SyntheticMethodBinding methodBinding ) { generateMethodInfoHeader ( methodBinding ) ; int methodAttributeOffset = this . contentsOffset ; int attributeNumber = generateMethodInfoAttributes ( methodBinding ) ; int codeAttributeOffset = this . contentsOffset ; attributeNumber ++ ; generateCodeAttributeHeader ( ) ; this . codeStream . init ( this ) ; this . codeStream . generateSyntheticBodyForEnumValues ( methodBinding ) ; completeCodeAttributeForSyntheticMethod ( methodBinding , codeAttributeOffset , ( ( SourceTypeBinding ) methodBinding . declaringClass ) . scope . referenceCompilationUnit ( ) . compilationResult . getLineSeparatorPositions ( ) ) ; this . contents [ methodAttributeOffset ++ ] = ( byte ) ( attributeNumber > > <NUM_LIT:8> ) ; this . contents [ methodAttributeOffset ] = ( byte ) attributeNumber ; } public void addSyntheticEnumInitializationMethod ( SyntheticMethodBinding methodBinding ) { generateMethodInfoHeader ( methodBinding ) ; int methodAttributeOffset = this . contentsOffset ; int attributeNumber = generateMethodInfoAttributes ( methodBinding ) ; int codeAttributeOffset = this . contentsOffset ; attributeNumber ++ ; generateCodeAttributeHeader ( ) ; this . codeStream . init ( this ) ; this . codeStream . generateSyntheticBodyForEnumInitializationMethod ( methodBinding ) ; completeCodeAttributeForSyntheticMethod ( methodBinding , codeAttributeOffset , ( ( SourceTypeBinding ) methodBinding . declaringClass ) . scope . referenceCompilationUnit ( ) . compilationResult . getLineSeparatorPositions ( ) ) ; this . contents [ methodAttributeOffset ++ ] = ( byte ) ( attributeNumber > > <NUM_LIT:8> ) ; this . contents [ methodAttributeOffset ] = ( byte ) attributeNumber ; } public void addSyntheticFieldReadAccessMethod ( SyntheticMethodBinding methodBinding ) { generateMethodInfoHeader ( methodBinding ) ; int methodAttributeOffset = this . contentsOffset ; int attributeNumber = generateMethodInfoAttributes ( methodBinding ) ; int codeAttributeOffset = this . contentsOffset ; attributeNumber ++ ; generateCodeAttributeHeader ( ) ; this . codeStream . init ( this ) ; this . codeStream . generateSyntheticBodyForFieldReadAccess ( methodBinding ) ; completeCodeAttributeForSyntheticMethod ( methodBinding , codeAttributeOffset , ( ( SourceTypeBinding ) methodBinding . declaringClass ) . scope . referenceCompilationUnit ( ) . compilationResult . getLineSeparatorPositions ( ) ) ; this . contents [ methodAttributeOffset ++ ] = ( byte ) ( attributeNumber > > <NUM_LIT:8> ) ; this . contents [ methodAttributeOffset ] = ( byte ) attributeNumber ; } public void addSyntheticFieldWriteAccessMethod ( SyntheticMethodBinding methodBinding ) { generateMethodInfoHeader ( methodBinding ) ; int methodAttributeOffset = this . contentsOffset ; int attributeNumber = generateMethodInfoAttributes ( methodBinding ) ; int codeAttributeOffset = this . contentsOffset ; attributeNumber ++ ; generateCodeAttributeHeader ( ) ; this . codeStream . init ( this ) ; this . codeStream . generateSyntheticBodyForFieldWriteAccess ( methodBinding ) ; completeCodeAttributeForSyntheticMethod ( methodBinding , codeAttributeOffset , ( ( SourceTypeBinding ) methodBinding . declaringClass ) . scope . referenceCompilationUnit ( ) . compilationResult . getLineSeparatorPositions ( ) ) ; this . contents [ methodAttributeOffset ++ ] = ( byte ) ( attributeNumber > > <NUM_LIT:8> ) ; this . contents [ methodAttributeOffset ] = ( byte ) attributeNumber ; } public void addSyntheticMethodAccessMethod ( SyntheticMethodBinding methodBinding ) { generateMethodInfoHeader ( methodBinding ) ; int methodAttributeOffset = this . contentsOffset ; int attributeNumber = generateMethodInfoAttributes ( methodBinding ) ; int codeAttributeOffset = this . contentsOffset ; attributeNumber ++ ; generateCodeAttributeHeader ( ) ; this . codeStream . init ( this ) ; this . codeStream . generateSyntheticBodyForMethodAccess ( methodBinding ) ; completeCodeAttributeForSyntheticMethod ( methodBinding , codeAttributeOffset , ( ( SourceTypeBinding ) methodBinding . declaringClass ) . scope . referenceCompilationUnit ( ) . compilationResult . getLineSeparatorPositions ( ) ) ; this . contents [ methodAttributeOffset ++ ] = ( byte ) ( attributeNumber > > <NUM_LIT:8> ) ; this . contents [ methodAttributeOffset ] = ( byte ) attributeNumber ; } public void addSyntheticSwitchTable ( SyntheticMethodBinding methodBinding ) { generateMethodInfoHeader ( methodBinding ) ; int methodAttributeOffset = this . contentsOffset ; int attributeNumber = generateMethodInfoAttributes ( methodBinding ) ; int codeAttributeOffset = this . contentsOffset ; attributeNumber ++ ; generateCodeAttributeHeader ( ) ; this . codeStream . init ( this ) ; this . codeStream . generateSyntheticBodyForSwitchTable ( methodBinding ) ; completeCodeAttributeForSyntheticMethod ( true , methodBinding , codeAttributeOffset , ( ( SourceTypeBinding ) methodBinding . declaringClass ) . scope . referenceCompilationUnit ( ) . compilationResult . getLineSeparatorPositions ( ) ) ; this . contents [ methodAttributeOffset ++ ] = ( byte ) ( attributeNumber > > <NUM_LIT:8> ) ; this . contents [ methodAttributeOffset ] = ( byte ) attributeNumber ; } public void completeCodeAttribute ( int codeAttributeOffset ) { this . contents = this . codeStream . bCodeStream ; int localContentsOffset = this . codeStream . classFileOffset ; int code_length = this . codeStream . position ; if ( code_length > <NUM_LIT> ) { this . codeStream . methodDeclaration . scope . problemReporter ( ) . bytecodeExceeds64KLimit ( this . codeStream . methodDeclaration ) ; } if ( localContentsOffset + <NUM_LIT:20> >= this . contents . length ) { resizeContents ( <NUM_LIT:20> ) ; } int max_stack = this . codeStream . stackMax ; this . contents [ codeAttributeOffset + <NUM_LIT:6> ] = ( byte ) ( max_stack > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:7> ] = ( byte ) max_stack ; int max_locals = this . codeStream . maxLocals ; this . contents [ codeAttributeOffset + <NUM_LIT:8> ] = ( byte ) ( max_locals > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:9> ] = ( byte ) max_locals ; this . contents [ codeAttributeOffset + <NUM_LIT:10> ] = ( byte ) ( code_length > > <NUM_LIT:24> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:11> ] = ( byte ) ( code_length > > <NUM_LIT:16> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:12> ] = ( byte ) ( code_length > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT> ] = ( byte ) code_length ; boolean addStackMaps = ( this . produceAttributes & ClassFileConstants . ATTR_STACK_MAP_TABLE ) != <NUM_LIT:0> ; ExceptionLabel [ ] exceptionLabels = this . codeStream . exceptionLabels ; int exceptionHandlersCount = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , length = this . codeStream . exceptionLabelsCounter ; i < length ; i ++ ) { exceptionHandlersCount += this . codeStream . exceptionLabels [ i ] . getCount ( ) / <NUM_LIT:2> ; } int exSize = exceptionHandlersCount * <NUM_LIT:8> + <NUM_LIT:2> ; if ( exSize + localContentsOffset >= this . contents . length ) { resizeContents ( exSize ) ; } this . contents [ localContentsOffset ++ ] = ( byte ) ( exceptionHandlersCount > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) exceptionHandlersCount ; for ( int i = <NUM_LIT:0> , max = this . codeStream . exceptionLabelsCounter ; i < max ; i ++ ) { ExceptionLabel exceptionLabel = exceptionLabels [ i ] ; if ( exceptionLabel != null ) { int iRange = <NUM_LIT:0> , maxRange = exceptionLabel . getCount ( ) ; if ( ( maxRange & <NUM_LIT:1> ) != <NUM_LIT:0> ) { this . codeStream . methodDeclaration . scope . problemReporter ( ) . abortDueToInternalError ( Messages . bind ( Messages . abort_invalidExceptionAttribute , new String ( this . codeStream . methodDeclaration . selector ) ) , this . codeStream . methodDeclaration ) ; } while ( iRange < maxRange ) { int start = exceptionLabel . ranges [ iRange ++ ] ; this . contents [ localContentsOffset ++ ] = ( byte ) ( start > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) start ; int end = exceptionLabel . ranges [ iRange ++ ] ; this . contents [ localContentsOffset ++ ] = ( byte ) ( end > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) end ; int handlerPC = exceptionLabel . position ; if ( addStackMaps ) { StackMapFrameCodeStream stackMapFrameCodeStream = ( StackMapFrameCodeStream ) this . codeStream ; stackMapFrameCodeStream . addFramePosition ( handlerPC ) ; } this . contents [ localContentsOffset ++ ] = ( byte ) ( handlerPC > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) handlerPC ; if ( exceptionLabel . exceptionType == null ) { this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; } else { int nameIndex ; if ( exceptionLabel . exceptionType == TypeBinding . NULL ) { nameIndex = this . constantPool . literalIndexForType ( ConstantPool . JavaLangClassNotFoundExceptionConstantPoolName ) ; } else { nameIndex = this . constantPool . literalIndexForType ( exceptionLabel . exceptionType ) ; } this . contents [ localContentsOffset ++ ] = ( byte ) ( nameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) nameIndex ; } } } } int codeAttributeAttributeOffset = localContentsOffset ; int attributesNumber = <NUM_LIT:0> ; localContentsOffset += <NUM_LIT:2> ; if ( localContentsOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } this . contentsOffset = localContentsOffset ; if ( ( this . produceAttributes & ClassFileConstants . ATTR_LINES ) != <NUM_LIT:0> ) { attributesNumber += generateLineNumberAttribute ( ) ; } if ( ( this . produceAttributes & ClassFileConstants . ATTR_VARS ) != <NUM_LIT:0> ) { final boolean methodDeclarationIsStatic = this . codeStream . methodDeclaration . isStatic ( ) ; attributesNumber += generateLocalVariableTableAttribute ( code_length , methodDeclarationIsStatic , false ) ; } if ( addStackMaps ) { attributesNumber += generateStackMapTableAttribute ( this . codeStream . methodDeclaration . binding , code_length , codeAttributeOffset , max_locals , false ) ; } if ( ( this . produceAttributes & ClassFileConstants . ATTR_STACK_MAP ) != <NUM_LIT:0> ) { attributesNumber += generateStackMapAttribute ( this . codeStream . methodDeclaration . binding , code_length , codeAttributeOffset , max_locals , false ) ; } this . contents [ codeAttributeAttributeOffset ++ ] = ( byte ) ( attributesNumber > > <NUM_LIT:8> ) ; this . contents [ codeAttributeAttributeOffset ] = ( byte ) attributesNumber ; int codeAttributeLength = this . contentsOffset - ( codeAttributeOffset + <NUM_LIT:6> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:2> ] = ( byte ) ( codeAttributeLength > > <NUM_LIT:24> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:3> ] = ( byte ) ( codeAttributeLength > > <NUM_LIT:16> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:4> ] = ( byte ) ( codeAttributeLength > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:5> ] = ( byte ) codeAttributeLength ; } public void completeCodeAttributeForClinit ( int codeAttributeOffset ) { this . contents = this . codeStream . bCodeStream ; int localContentsOffset = this . codeStream . classFileOffset ; int code_length = this . codeStream . position ; if ( code_length > <NUM_LIT> ) { this . codeStream . methodDeclaration . scope . problemReporter ( ) . bytecodeExceeds64KLimit ( this . codeStream . methodDeclaration . scope . referenceType ( ) ) ; } if ( localContentsOffset + <NUM_LIT:20> >= this . contents . length ) { resizeContents ( <NUM_LIT:20> ) ; } int max_stack = this . codeStream . stackMax ; this . contents [ codeAttributeOffset + <NUM_LIT:6> ] = ( byte ) ( max_stack > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:7> ] = ( byte ) max_stack ; int max_locals = this . codeStream . maxLocals ; this . contents [ codeAttributeOffset + <NUM_LIT:8> ] = ( byte ) ( max_locals > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:9> ] = ( byte ) max_locals ; this . contents [ codeAttributeOffset + <NUM_LIT:10> ] = ( byte ) ( code_length > > <NUM_LIT:24> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:11> ] = ( byte ) ( code_length > > <NUM_LIT:16> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:12> ] = ( byte ) ( code_length > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT> ] = ( byte ) code_length ; boolean addStackMaps = ( this . produceAttributes & ClassFileConstants . ATTR_STACK_MAP_TABLE ) != <NUM_LIT:0> ; ExceptionLabel [ ] exceptionLabels = this . codeStream . exceptionLabels ; int exceptionHandlersCount = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , length = this . codeStream . exceptionLabelsCounter ; i < length ; i ++ ) { exceptionHandlersCount += this . codeStream . exceptionLabels [ i ] . getCount ( ) / <NUM_LIT:2> ; } int exSize = exceptionHandlersCount * <NUM_LIT:8> + <NUM_LIT:2> ; if ( exSize + localContentsOffset >= this . contents . length ) { resizeContents ( exSize ) ; } this . contents [ localContentsOffset ++ ] = ( byte ) ( exceptionHandlersCount > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) exceptionHandlersCount ; for ( int i = <NUM_LIT:0> , max = this . codeStream . exceptionLabelsCounter ; i < max ; i ++ ) { ExceptionLabel exceptionLabel = exceptionLabels [ i ] ; if ( exceptionLabel != null ) { int iRange = <NUM_LIT:0> , maxRange = exceptionLabel . getCount ( ) ; if ( ( maxRange & <NUM_LIT:1> ) != <NUM_LIT:0> ) { this . codeStream . methodDeclaration . scope . problemReporter ( ) . abortDueToInternalError ( Messages . bind ( Messages . abort_invalidExceptionAttribute , new String ( this . codeStream . methodDeclaration . selector ) ) , this . codeStream . methodDeclaration ) ; } while ( iRange < maxRange ) { int start = exceptionLabel . ranges [ iRange ++ ] ; this . contents [ localContentsOffset ++ ] = ( byte ) ( start > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) start ; int end = exceptionLabel . ranges [ iRange ++ ] ; this . contents [ localContentsOffset ++ ] = ( byte ) ( end > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) end ; int handlerPC = exceptionLabel . position ; this . contents [ localContentsOffset ++ ] = ( byte ) ( handlerPC > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) handlerPC ; if ( addStackMaps ) { StackMapFrameCodeStream stackMapFrameCodeStream = ( StackMapFrameCodeStream ) this . codeStream ; stackMapFrameCodeStream . addFramePosition ( handlerPC ) ; } if ( exceptionLabel . exceptionType == null ) { this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; } else { int nameIndex ; if ( exceptionLabel . exceptionType == TypeBinding . NULL ) { nameIndex = this . constantPool . literalIndexForType ( ConstantPool . JavaLangClassNotFoundExceptionConstantPoolName ) ; } else { nameIndex = this . constantPool . literalIndexForType ( exceptionLabel . exceptionType ) ; } this . contents [ localContentsOffset ++ ] = ( byte ) ( nameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) nameIndex ; } } } } int codeAttributeAttributeOffset = localContentsOffset ; int attributesNumber = <NUM_LIT:0> ; localContentsOffset += <NUM_LIT:2> ; if ( localContentsOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } this . contentsOffset = localContentsOffset ; if ( ( this . produceAttributes & ClassFileConstants . ATTR_LINES ) != <NUM_LIT:0> ) { attributesNumber += generateLineNumberAttribute ( ) ; } if ( ( this . produceAttributes & ClassFileConstants . ATTR_VARS ) != <NUM_LIT:0> ) { attributesNumber += generateLocalVariableTableAttribute ( code_length , true , false ) ; } if ( ( this . produceAttributes & ClassFileConstants . ATTR_STACK_MAP_TABLE ) != <NUM_LIT:0> ) { attributesNumber += generateStackMapTableAttribute ( null , code_length , codeAttributeOffset , max_locals , true ) ; } if ( ( this . produceAttributes & ClassFileConstants . ATTR_STACK_MAP ) != <NUM_LIT:0> ) { attributesNumber += generateStackMapAttribute ( null , code_length , codeAttributeOffset , max_locals , true ) ; } if ( codeAttributeAttributeOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } this . contents [ codeAttributeAttributeOffset ++ ] = ( byte ) ( attributesNumber > > <NUM_LIT:8> ) ; this . contents [ codeAttributeAttributeOffset ] = ( byte ) attributesNumber ; int codeAttributeLength = this . contentsOffset - ( codeAttributeOffset + <NUM_LIT:6> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:2> ] = ( byte ) ( codeAttributeLength > > <NUM_LIT:24> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:3> ] = ( byte ) ( codeAttributeLength > > <NUM_LIT:16> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:4> ] = ( byte ) ( codeAttributeLength > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:5> ] = ( byte ) codeAttributeLength ; } public void completeCodeAttributeForClinit ( int codeAttributeOffset , int problemLine ) { this . contents = this . codeStream . bCodeStream ; int localContentsOffset = this . codeStream . classFileOffset ; int code_length = this . codeStream . position ; if ( code_length > <NUM_LIT> ) { this . codeStream . methodDeclaration . scope . problemReporter ( ) . bytecodeExceeds64KLimit ( this . codeStream . methodDeclaration . scope . referenceType ( ) ) ; } if ( localContentsOffset + <NUM_LIT:20> >= this . contents . length ) { resizeContents ( <NUM_LIT:20> ) ; } int max_stack = this . codeStream . stackMax ; this . contents [ codeAttributeOffset + <NUM_LIT:6> ] = ( byte ) ( max_stack > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:7> ] = ( byte ) max_stack ; int max_locals = this . codeStream . maxLocals ; this . contents [ codeAttributeOffset + <NUM_LIT:8> ] = ( byte ) ( max_locals > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:9> ] = ( byte ) max_locals ; this . contents [ codeAttributeOffset + <NUM_LIT:10> ] = ( byte ) ( code_length > > <NUM_LIT:24> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:11> ] = ( byte ) ( code_length > > <NUM_LIT:16> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:12> ] = ( byte ) ( code_length > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT> ] = ( byte ) code_length ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; int codeAttributeAttributeOffset = localContentsOffset ; int attributesNumber = <NUM_LIT:0> ; localContentsOffset += <NUM_LIT:2> ; if ( localContentsOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } this . contentsOffset = localContentsOffset ; if ( ( this . produceAttributes & ClassFileConstants . ATTR_LINES ) != <NUM_LIT:0> ) { attributesNumber += generateLineNumberAttribute ( problemLine ) ; } localContentsOffset = this . contentsOffset ; if ( ( this . produceAttributes & ClassFileConstants . ATTR_VARS ) != <NUM_LIT:0> ) { int localVariableNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . LocalVariableTableName ) ; if ( localContentsOffset + <NUM_LIT:8> >= this . contents . length ) { resizeContents ( <NUM_LIT:8> ) ; } this . contents [ localContentsOffset ++ ] = ( byte ) ( localVariableNameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) localVariableNameIndex ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:2> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; attributesNumber ++ ; } this . contentsOffset = localContentsOffset ; if ( ( this . produceAttributes & ClassFileConstants . ATTR_STACK_MAP_TABLE ) != <NUM_LIT:0> ) { attributesNumber += generateStackMapTableAttribute ( null , code_length , codeAttributeOffset , max_locals , true ) ; } if ( ( this . produceAttributes & ClassFileConstants . ATTR_STACK_MAP ) != <NUM_LIT:0> ) { attributesNumber += generateStackMapAttribute ( null , code_length , codeAttributeOffset , max_locals , true ) ; } if ( codeAttributeAttributeOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } this . contents [ codeAttributeAttributeOffset ++ ] = ( byte ) ( attributesNumber > > <NUM_LIT:8> ) ; this . contents [ codeAttributeAttributeOffset ] = ( byte ) attributesNumber ; int codeAttributeLength = this . contentsOffset - ( codeAttributeOffset + <NUM_LIT:6> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:2> ] = ( byte ) ( codeAttributeLength > > <NUM_LIT:24> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:3> ] = ( byte ) ( codeAttributeLength > > <NUM_LIT:16> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:4> ] = ( byte ) ( codeAttributeLength > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:5> ] = ( byte ) codeAttributeLength ; } public void completeCodeAttributeForMissingAbstractProblemMethod ( MethodBinding binding , int codeAttributeOffset , int [ ] startLineIndexes , int problemLine ) { this . contents = this . codeStream . bCodeStream ; int localContentsOffset = this . codeStream . classFileOffset ; int max_stack = this . codeStream . stackMax ; this . contents [ codeAttributeOffset + <NUM_LIT:6> ] = ( byte ) ( max_stack > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:7> ] = ( byte ) max_stack ; int max_locals = this . codeStream . maxLocals ; this . contents [ codeAttributeOffset + <NUM_LIT:8> ] = ( byte ) ( max_locals > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:9> ] = ( byte ) max_locals ; int code_length = this . codeStream . position ; this . contents [ codeAttributeOffset + <NUM_LIT:10> ] = ( byte ) ( code_length > > <NUM_LIT:24> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:11> ] = ( byte ) ( code_length > > <NUM_LIT:16> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:12> ] = ( byte ) ( code_length > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT> ] = ( byte ) code_length ; if ( localContentsOffset + <NUM_LIT> >= this . contents . length ) { resizeContents ( <NUM_LIT> ) ; } this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; int codeAttributeAttributeOffset = localContentsOffset ; int attributesNumber = <NUM_LIT:0> ; localContentsOffset += <NUM_LIT:2> ; if ( localContentsOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } this . contentsOffset = localContentsOffset ; if ( ( this . produceAttributes & ClassFileConstants . ATTR_LINES ) != <NUM_LIT:0> ) { if ( problemLine == <NUM_LIT:0> ) { problemLine = Util . getLineNumber ( binding . sourceStart ( ) , startLineIndexes , <NUM_LIT:0> , startLineIndexes . length - <NUM_LIT:1> ) ; } attributesNumber += generateLineNumberAttribute ( problemLine ) ; } if ( ( this . produceAttributes & ClassFileConstants . ATTR_STACK_MAP_TABLE ) != <NUM_LIT:0> ) { attributesNumber += generateStackMapTableAttribute ( binding , code_length , codeAttributeOffset , max_locals , false ) ; } if ( ( this . produceAttributes & ClassFileConstants . ATTR_STACK_MAP ) != <NUM_LIT:0> ) { attributesNumber += generateStackMapAttribute ( binding , code_length , codeAttributeOffset , max_locals , false ) ; } if ( codeAttributeAttributeOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } this . contents [ codeAttributeAttributeOffset ++ ] = ( byte ) ( attributesNumber > > <NUM_LIT:8> ) ; this . contents [ codeAttributeAttributeOffset ] = ( byte ) attributesNumber ; int codeAttributeLength = this . contentsOffset - ( codeAttributeOffset + <NUM_LIT:6> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:2> ] = ( byte ) ( codeAttributeLength > > <NUM_LIT:24> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:3> ] = ( byte ) ( codeAttributeLength > > <NUM_LIT:16> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:4> ] = ( byte ) ( codeAttributeLength > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:5> ] = ( byte ) codeAttributeLength ; } public void completeCodeAttributeForProblemMethod ( AbstractMethodDeclaration method , MethodBinding binding , int codeAttributeOffset , int [ ] startLineIndexes , int problemLine ) { this . contents = this . codeStream . bCodeStream ; int localContentsOffset = this . codeStream . classFileOffset ; int max_stack = this . codeStream . stackMax ; this . contents [ codeAttributeOffset + <NUM_LIT:6> ] = ( byte ) ( max_stack > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:7> ] = ( byte ) max_stack ; int max_locals = this . codeStream . maxLocals ; this . contents [ codeAttributeOffset + <NUM_LIT:8> ] = ( byte ) ( max_locals > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:9> ] = ( byte ) max_locals ; int code_length = this . codeStream . position ; this . contents [ codeAttributeOffset + <NUM_LIT:10> ] = ( byte ) ( code_length > > <NUM_LIT:24> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:11> ] = ( byte ) ( code_length > > <NUM_LIT:16> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:12> ] = ( byte ) ( code_length > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT> ] = ( byte ) code_length ; if ( localContentsOffset + <NUM_LIT> >= this . contents . length ) { resizeContents ( <NUM_LIT> ) ; } this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; int codeAttributeAttributeOffset = localContentsOffset ; int attributesNumber = <NUM_LIT:0> ; localContentsOffset += <NUM_LIT:2> ; if ( localContentsOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } this . contentsOffset = localContentsOffset ; if ( ( this . produceAttributes & ClassFileConstants . ATTR_LINES ) != <NUM_LIT:0> ) { if ( problemLine == <NUM_LIT:0> ) { problemLine = Util . getLineNumber ( binding . sourceStart ( ) , startLineIndexes , <NUM_LIT:0> , startLineIndexes . length - <NUM_LIT:1> ) ; } attributesNumber += generateLineNumberAttribute ( problemLine ) ; } if ( ( this . produceAttributes & ClassFileConstants . ATTR_VARS ) != <NUM_LIT:0> ) { final boolean methodDeclarationIsStatic = this . codeStream . methodDeclaration . isStatic ( ) ; attributesNumber += generateLocalVariableTableAttribute ( code_length , methodDeclarationIsStatic , false ) ; } if ( ( this . produceAttributes & ClassFileConstants . ATTR_STACK_MAP_TABLE ) != <NUM_LIT:0> ) { attributesNumber += generateStackMapTableAttribute ( binding , code_length , codeAttributeOffset , max_locals , false ) ; } if ( ( this . produceAttributes & ClassFileConstants . ATTR_STACK_MAP ) != <NUM_LIT:0> ) { attributesNumber += generateStackMapAttribute ( binding , code_length , codeAttributeOffset , max_locals , false ) ; } if ( codeAttributeAttributeOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } this . contents [ codeAttributeAttributeOffset ++ ] = ( byte ) ( attributesNumber > > <NUM_LIT:8> ) ; this . contents [ codeAttributeAttributeOffset ] = ( byte ) attributesNumber ; int codeAttributeLength = this . contentsOffset - ( codeAttributeOffset + <NUM_LIT:6> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:2> ] = ( byte ) ( codeAttributeLength > > <NUM_LIT:24> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:3> ] = ( byte ) ( codeAttributeLength > > <NUM_LIT:16> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:4> ] = ( byte ) ( codeAttributeLength > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:5> ] = ( byte ) codeAttributeLength ; } public void completeCodeAttributeForSyntheticMethod ( boolean hasExceptionHandlers , SyntheticMethodBinding binding , int codeAttributeOffset , int [ ] startLineIndexes ) { this . contents = this . codeStream . bCodeStream ; int localContentsOffset = this . codeStream . classFileOffset ; int max_stack = this . codeStream . stackMax ; this . contents [ codeAttributeOffset + <NUM_LIT:6> ] = ( byte ) ( max_stack > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:7> ] = ( byte ) max_stack ; int max_locals = this . codeStream . maxLocals ; this . contents [ codeAttributeOffset + <NUM_LIT:8> ] = ( byte ) ( max_locals > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:9> ] = ( byte ) max_locals ; int code_length = this . codeStream . position ; this . contents [ codeAttributeOffset + <NUM_LIT:10> ] = ( byte ) ( code_length > > <NUM_LIT:24> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:11> ] = ( byte ) ( code_length > > <NUM_LIT:16> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:12> ] = ( byte ) ( code_length > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT> ] = ( byte ) code_length ; if ( ( localContentsOffset + <NUM_LIT> ) >= this . contents . length ) { resizeContents ( <NUM_LIT> ) ; } boolean addStackMaps = ( this . produceAttributes & ClassFileConstants . ATTR_STACK_MAP_TABLE ) != <NUM_LIT:0> ; if ( hasExceptionHandlers ) { ExceptionLabel [ ] exceptionLabels = this . codeStream . exceptionLabels ; int exceptionHandlersCount = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , length = this . codeStream . exceptionLabelsCounter ; i < length ; i ++ ) { exceptionHandlersCount += this . codeStream . exceptionLabels [ i ] . getCount ( ) / <NUM_LIT:2> ; } int exSize = exceptionHandlersCount * <NUM_LIT:8> + <NUM_LIT:2> ; if ( exSize + localContentsOffset >= this . contents . length ) { resizeContents ( exSize ) ; } this . contents [ localContentsOffset ++ ] = ( byte ) ( exceptionHandlersCount > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) exceptionHandlersCount ; for ( int i = <NUM_LIT:0> , max = this . codeStream . exceptionLabelsCounter ; i < max ; i ++ ) { ExceptionLabel exceptionLabel = exceptionLabels [ i ] ; if ( exceptionLabel != null ) { int iRange = <NUM_LIT:0> , maxRange = exceptionLabel . getCount ( ) ; if ( ( maxRange & <NUM_LIT:1> ) != <NUM_LIT:0> ) { this . referenceBinding . scope . problemReporter ( ) . abortDueToInternalError ( Messages . bind ( Messages . abort_invalidExceptionAttribute , new String ( binding . selector ) , this . referenceBinding . scope . problemReporter ( ) . referenceContext ) ) ; } while ( iRange < maxRange ) { int start = exceptionLabel . ranges [ iRange ++ ] ; this . contents [ localContentsOffset ++ ] = ( byte ) ( start > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) start ; int end = exceptionLabel . ranges [ iRange ++ ] ; this . contents [ localContentsOffset ++ ] = ( byte ) ( end > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) end ; int handlerPC = exceptionLabel . position ; if ( addStackMaps ) { StackMapFrameCodeStream stackMapFrameCodeStream = ( StackMapFrameCodeStream ) this . codeStream ; stackMapFrameCodeStream . addFramePosition ( handlerPC ) ; } this . contents [ localContentsOffset ++ ] = ( byte ) ( handlerPC > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) handlerPC ; if ( exceptionLabel . exceptionType == null ) { this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; } else { int nameIndex ; switch ( exceptionLabel . exceptionType . id ) { case T_null : nameIndex = this . constantPool . literalIndexForType ( ConstantPool . JavaLangClassNotFoundExceptionConstantPoolName ) ; break ; case T_long : nameIndex = this . constantPool . literalIndexForType ( ConstantPool . JavaLangNoSuchFieldErrorConstantPoolName ) ; break ; default : nameIndex = this . constantPool . literalIndexForType ( exceptionLabel . exceptionType ) ; } this . contents [ localContentsOffset ++ ] = ( byte ) ( nameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) nameIndex ; } } } } } else { this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; } int codeAttributeAttributeOffset = localContentsOffset ; int attributesNumber = <NUM_LIT:0> ; localContentsOffset += <NUM_LIT:2> ; if ( localContentsOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } this . contentsOffset = localContentsOffset ; if ( ( this . produceAttributes & ClassFileConstants . ATTR_LINES ) != <NUM_LIT:0> ) { int lineNumber = Util . getLineNumber ( binding . sourceStart , startLineIndexes , <NUM_LIT:0> , startLineIndexes . length - <NUM_LIT:1> ) ; attributesNumber += generateLineNumberAttribute ( lineNumber ) ; } if ( ( this . produceAttributes & ClassFileConstants . ATTR_VARS ) != <NUM_LIT:0> ) { final boolean methodDeclarationIsStatic = binding . isStatic ( ) ; attributesNumber += generateLocalVariableTableAttribute ( code_length , methodDeclarationIsStatic , true ) ; } if ( addStackMaps ) { attributesNumber += generateStackMapTableAttribute ( binding , code_length , codeAttributeOffset , max_locals , false ) ; } if ( ( this . produceAttributes & ClassFileConstants . ATTR_STACK_MAP ) != <NUM_LIT:0> ) { attributesNumber += generateStackMapAttribute ( binding , code_length , codeAttributeOffset , max_locals , false ) ; } if ( codeAttributeAttributeOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } this . contents [ codeAttributeAttributeOffset ++ ] = ( byte ) ( attributesNumber > > <NUM_LIT:8> ) ; this . contents [ codeAttributeAttributeOffset ] = ( byte ) attributesNumber ; int codeAttributeLength = this . contentsOffset - ( codeAttributeOffset + <NUM_LIT:6> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:2> ] = ( byte ) ( codeAttributeLength > > <NUM_LIT:24> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:3> ] = ( byte ) ( codeAttributeLength > > <NUM_LIT:16> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:4> ] = ( byte ) ( codeAttributeLength > > <NUM_LIT:8> ) ; this . contents [ codeAttributeOffset + <NUM_LIT:5> ] = ( byte ) codeAttributeLength ; } public void completeCodeAttributeForSyntheticMethod ( SyntheticMethodBinding binding , int codeAttributeOffset , int [ ] startLineIndexes ) { this . completeCodeAttributeForSyntheticMethod ( false , binding , codeAttributeOffset , startLineIndexes ) ; } public void completeMethodInfo ( MethodBinding binding , int methodAttributeOffset , int attributesNumber ) { this . contents [ methodAttributeOffset ++ ] = ( byte ) ( attributesNumber > > <NUM_LIT:8> ) ; this . contents [ methodAttributeOffset ] = ( byte ) attributesNumber ; } public char [ ] fileName ( ) { return this . constantPool . UTF8Cache . returnKeyFor ( <NUM_LIT:2> ) ; } private void generateAnnotation ( Annotation annotation , int currentOffset ) { int startingContentsOffset = currentOffset ; if ( this . contentsOffset + <NUM_LIT:4> >= this . contents . length ) { resizeContents ( <NUM_LIT:4> ) ; } TypeBinding annotationTypeBinding = annotation . resolvedType ; if ( annotationTypeBinding == null ) { this . contentsOffset = startingContentsOffset ; return ; } final int typeIndex = this . constantPool . literalIndex ( annotationTypeBinding . signature ( ) ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( typeIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) typeIndex ; if ( annotation instanceof NormalAnnotation ) { NormalAnnotation normalAnnotation = ( NormalAnnotation ) annotation ; MemberValuePair [ ] memberValuePairs = normalAnnotation . memberValuePairs ; if ( memberValuePairs != null ) { final int memberValuePairsLength = memberValuePairs . length ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( memberValuePairsLength > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) memberValuePairsLength ; for ( int i = <NUM_LIT:0> ; i < memberValuePairsLength ; i ++ ) { MemberValuePair memberValuePair = memberValuePairs [ i ] ; if ( this . contentsOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } final int elementNameIndex = this . constantPool . literalIndex ( memberValuePair . name ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( elementNameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) elementNameIndex ; MethodBinding methodBinding = memberValuePair . binding ; if ( methodBinding == null ) { this . contentsOffset = startingContentsOffset ; } else { try { generateElementValue ( memberValuePair . value , methodBinding . returnType , startingContentsOffset ) ; } catch ( ClassCastException e ) { this . contentsOffset = startingContentsOffset ; } catch ( ShouldNotImplement e ) { this . contentsOffset = startingContentsOffset ; } } } } else { this . contents [ this . contentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ this . contentsOffset ++ ] = <NUM_LIT:0> ; } } else if ( annotation instanceof SingleMemberAnnotation ) { SingleMemberAnnotation singleMemberAnnotation = ( SingleMemberAnnotation ) annotation ; this . contents [ this . contentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ this . contentsOffset ++ ] = <NUM_LIT:1> ; if ( this . contentsOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } final int elementNameIndex = this . constantPool . literalIndex ( VALUE ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( elementNameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) elementNameIndex ; MethodBinding methodBinding = singleMemberAnnotation . memberValuePairs ( ) [ <NUM_LIT:0> ] . binding ; if ( methodBinding == null ) { this . contentsOffset = startingContentsOffset ; } else { try { generateElementValue ( singleMemberAnnotation . memberValue , methodBinding . returnType , startingContentsOffset ) ; } catch ( ClassCastException e ) { this . contentsOffset = startingContentsOffset ; } catch ( ShouldNotImplement e ) { this . contentsOffset = startingContentsOffset ; } } } else { this . contents [ this . contentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ this . contentsOffset ++ ] = <NUM_LIT:0> ; } } private int generateAnnotationDefaultAttribute ( AnnotationMethodDeclaration declaration , int attributeOffset ) { int attributesNumber = <NUM_LIT:0> ; int annotationDefaultNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . AnnotationDefaultName ) ; if ( this . contentsOffset + <NUM_LIT:6> >= this . contents . length ) { resizeContents ( <NUM_LIT:6> ) ; } this . contents [ this . contentsOffset ++ ] = ( byte ) ( annotationDefaultNameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) annotationDefaultNameIndex ; int attributeLengthOffset = this . contentsOffset ; this . contentsOffset += <NUM_LIT:4> ; generateElementValue ( declaration . defaultValue , declaration . binding . returnType , attributeOffset ) ; if ( this . contentsOffset != attributeOffset ) { int attributeLength = this . contentsOffset - attributeLengthOffset - <NUM_LIT:4> ; this . contents [ attributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:24> ) ; this . contents [ attributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:16> ) ; this . contents [ attributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:8> ) ; this . contents [ attributeLengthOffset ++ ] = ( byte ) attributeLength ; attributesNumber ++ ; } return attributesNumber ; } public void generateCodeAttributeHeader ( ) { if ( this . contentsOffset + <NUM_LIT:20> >= this . contents . length ) { resizeContents ( <NUM_LIT:20> ) ; } int constantValueNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . CodeName ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( constantValueNameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) constantValueNameIndex ; this . contentsOffset += <NUM_LIT:12> ; } private int generateConstantValueAttribute ( Constant fieldConstant , FieldBinding fieldBinding , int fieldAttributeOffset ) { int localContentsOffset = this . contentsOffset ; int attributesNumber = <NUM_LIT:1> ; if ( localContentsOffset + <NUM_LIT:8> >= this . contents . length ) { resizeContents ( <NUM_LIT:8> ) ; } int constantValueNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . ConstantValueName ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( constantValueNameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) constantValueNameIndex ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:2> ; switch ( fieldConstant . typeID ( ) ) { case T_boolean : int booleanValueIndex = this . constantPool . literalIndex ( fieldConstant . booleanValue ( ) ? <NUM_LIT:1> : <NUM_LIT:0> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( booleanValueIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) booleanValueIndex ; break ; case T_byte : case T_char : case T_int : case T_short : int integerValueIndex = this . constantPool . literalIndex ( fieldConstant . intValue ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( integerValueIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) integerValueIndex ; break ; case T_float : int floatValueIndex = this . constantPool . literalIndex ( fieldConstant . floatValue ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( floatValueIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) floatValueIndex ; break ; case T_double : int doubleValueIndex = this . constantPool . literalIndex ( fieldConstant . doubleValue ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( doubleValueIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) doubleValueIndex ; break ; case T_long : int longValueIndex = this . constantPool . literalIndex ( fieldConstant . longValue ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( longValueIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) longValueIndex ; break ; case T_JavaLangString : int stringValueIndex = this . constantPool . literalIndex ( ( ( StringConstant ) fieldConstant ) . stringValue ( ) ) ; if ( stringValueIndex == - <NUM_LIT:1> ) { if ( ! this . creatingProblemType ) { TypeDeclaration typeDeclaration = this . referenceBinding . scope . referenceContext ; FieldDeclaration [ ] fieldDecls = typeDeclaration . fields ; int max = fieldDecls == null ? <NUM_LIT:0> : fieldDecls . length ; for ( int i = <NUM_LIT:0> ; i < max ; i ++ ) { if ( fieldDecls [ i ] . binding == fieldBinding ) { typeDeclaration . scope . problemReporter ( ) . stringConstantIsExceedingUtf8Limit ( fieldDecls [ i ] ) ; } } } else { this . contentsOffset = fieldAttributeOffset ; attributesNumber = <NUM_LIT:0> ; } } else { this . contents [ localContentsOffset ++ ] = ( byte ) ( stringValueIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) stringValueIndex ; } } this . contentsOffset = localContentsOffset ; return attributesNumber ; } private int generateDeprecatedAttribute ( ) { int localContentsOffset = this . contentsOffset ; if ( localContentsOffset + <NUM_LIT:6> >= this . contents . length ) { resizeContents ( <NUM_LIT:6> ) ; } int deprecatedAttributeNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . DeprecatedName ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( deprecatedAttributeNameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) deprecatedAttributeNameIndex ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contentsOffset = localContentsOffset ; return <NUM_LIT:1> ; } private void generateElementValue ( Expression defaultValue , TypeBinding memberValuePairReturnType , int attributeOffset ) { Constant constant = defaultValue . constant ; TypeBinding defaultValueBinding = defaultValue . resolvedType ; if ( defaultValueBinding == null ) { this . contentsOffset = attributeOffset ; } else { if ( memberValuePairReturnType . isArrayType ( ) && ! defaultValueBinding . isArrayType ( ) ) { if ( this . contentsOffset + <NUM_LIT:3> >= this . contents . length ) { resizeContents ( <NUM_LIT:3> ) ; } this . contents [ this . contentsOffset ++ ] = ( byte ) '<CHAR_LIT:[>' ; this . contents [ this . contentsOffset ++ ] = ( byte ) <NUM_LIT:0> ; this . contents [ this . contentsOffset ++ ] = ( byte ) <NUM_LIT:1> ; } if ( constant != null && constant != Constant . NotAConstant ) { generateElementValue ( attributeOffset , defaultValue , constant , memberValuePairReturnType . leafComponentType ( ) ) ; } else { generateElementValueForNonConstantExpression ( defaultValue , attributeOffset , defaultValueBinding ) ; } } } private void generateElementValue ( int attributeOffset , Expression defaultValue , Constant constant , TypeBinding binding ) { if ( this . contentsOffset + <NUM_LIT:3> >= this . contents . length ) { resizeContents ( <NUM_LIT:3> ) ; } switch ( binding . id ) { case T_boolean : this . contents [ this . contentsOffset ++ ] = ( byte ) '<CHAR_LIT:Z>' ; int booleanValueIndex = this . constantPool . literalIndex ( constant . booleanValue ( ) ? <NUM_LIT:1> : <NUM_LIT:0> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( booleanValueIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) booleanValueIndex ; break ; case T_byte : this . contents [ this . contentsOffset ++ ] = ( byte ) '<CHAR_LIT>' ; int integerValueIndex = this . constantPool . literalIndex ( constant . intValue ( ) ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( integerValueIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) integerValueIndex ; break ; case T_char : this . contents [ this . contentsOffset ++ ] = ( byte ) '<CHAR_LIT>' ; integerValueIndex = this . constantPool . literalIndex ( constant . intValue ( ) ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( integerValueIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) integerValueIndex ; break ; case T_int : this . contents [ this . contentsOffset ++ ] = ( byte ) '<CHAR_LIT>' ; integerValueIndex = this . constantPool . literalIndex ( constant . intValue ( ) ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( integerValueIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) integerValueIndex ; break ; case T_short : this . contents [ this . contentsOffset ++ ] = ( byte ) '<CHAR_LIT>' ; integerValueIndex = this . constantPool . literalIndex ( constant . intValue ( ) ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( integerValueIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) integerValueIndex ; break ; case T_float : this . contents [ this . contentsOffset ++ ] = ( byte ) '<CHAR_LIT>' ; int floatValueIndex = this . constantPool . literalIndex ( constant . floatValue ( ) ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( floatValueIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) floatValueIndex ; break ; case T_double : this . contents [ this . contentsOffset ++ ] = ( byte ) '<CHAR_LIT>' ; int doubleValueIndex = this . constantPool . literalIndex ( constant . doubleValue ( ) ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( doubleValueIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) doubleValueIndex ; break ; case T_long : this . contents [ this . contentsOffset ++ ] = ( byte ) '<CHAR_LIT>' ; int longValueIndex = this . constantPool . literalIndex ( constant . longValue ( ) ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( longValueIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) longValueIndex ; break ; case T_JavaLangString : this . contents [ this . contentsOffset ++ ] = ( byte ) '<CHAR_LIT>' ; int stringValueIndex = this . constantPool . literalIndex ( ( ( StringConstant ) constant ) . stringValue ( ) . toCharArray ( ) ) ; if ( stringValueIndex == - <NUM_LIT:1> ) { if ( ! this . creatingProblemType ) { TypeDeclaration typeDeclaration = this . referenceBinding . scope . referenceContext ; typeDeclaration . scope . problemReporter ( ) . stringConstantIsExceedingUtf8Limit ( defaultValue ) ; } else { this . contentsOffset = attributeOffset ; } } else { this . contents [ this . contentsOffset ++ ] = ( byte ) ( stringValueIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) stringValueIndex ; } } } private void generateElementValueForNonConstantExpression ( Expression defaultValue , int attributeOffset , TypeBinding defaultValueBinding ) { if ( defaultValueBinding != null ) { if ( defaultValueBinding . isEnum ( ) ) { if ( this . contentsOffset + <NUM_LIT:5> >= this . contents . length ) { resizeContents ( <NUM_LIT:5> ) ; } this . contents [ this . contentsOffset ++ ] = ( byte ) '<CHAR_LIT:e>' ; FieldBinding fieldBinding = null ; if ( defaultValue instanceof QualifiedNameReference ) { QualifiedNameReference nameReference = ( QualifiedNameReference ) defaultValue ; fieldBinding = ( FieldBinding ) nameReference . binding ; } else if ( defaultValue instanceof SingleNameReference ) { SingleNameReference nameReference = ( SingleNameReference ) defaultValue ; fieldBinding = ( FieldBinding ) nameReference . binding ; } else { this . contentsOffset = attributeOffset ; } if ( fieldBinding != null ) { final int enumConstantTypeNameIndex = this . constantPool . literalIndex ( fieldBinding . type . signature ( ) ) ; final int enumConstantNameIndex = this . constantPool . literalIndex ( fieldBinding . name ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( enumConstantTypeNameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) enumConstantTypeNameIndex ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( enumConstantNameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) enumConstantNameIndex ; } } else if ( defaultValueBinding . isAnnotationType ( ) ) { if ( this . contentsOffset + <NUM_LIT:1> >= this . contents . length ) { resizeContents ( <NUM_LIT:1> ) ; } this . contents [ this . contentsOffset ++ ] = ( byte ) '<CHAR_LIT>' ; generateAnnotation ( ( Annotation ) defaultValue , attributeOffset ) ; } else if ( defaultValueBinding . isArrayType ( ) ) { if ( this . contentsOffset + <NUM_LIT:3> >= this . contents . length ) { resizeContents ( <NUM_LIT:3> ) ; } this . contents [ this . contentsOffset ++ ] = ( byte ) '<CHAR_LIT:[>' ; if ( defaultValue instanceof ArrayInitializer ) { ArrayInitializer arrayInitializer = ( ArrayInitializer ) defaultValue ; int arrayLength = arrayInitializer . expressions != null ? arrayInitializer . expressions . length : <NUM_LIT:0> ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( arrayLength > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) arrayLength ; for ( int i = <NUM_LIT:0> ; i < arrayLength ; i ++ ) { generateElementValue ( arrayInitializer . expressions [ i ] , defaultValueBinding . leafComponentType ( ) , attributeOffset ) ; } } else { this . contentsOffset = attributeOffset ; } } else { if ( this . contentsOffset + <NUM_LIT:3> >= this . contents . length ) { resizeContents ( <NUM_LIT:3> ) ; } this . contents [ this . contentsOffset ++ ] = ( byte ) '<CHAR_LIT:c>' ; if ( defaultValue instanceof ClassLiteralAccess ) { ClassLiteralAccess classLiteralAccess = ( ClassLiteralAccess ) defaultValue ; final int classInfoIndex = this . constantPool . literalIndex ( classLiteralAccess . targetType . signature ( ) ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( classInfoIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) classInfoIndex ; } else { this . contentsOffset = attributeOffset ; } } } else { this . contentsOffset = attributeOffset ; } } private int generateEnclosingMethodAttribute ( ) { int localContentsOffset = this . contentsOffset ; if ( localContentsOffset + <NUM_LIT:10> >= this . contents . length ) { resizeContents ( <NUM_LIT:10> ) ; } int enclosingMethodAttributeNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . EnclosingMethodName ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( enclosingMethodAttributeNameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) enclosingMethodAttributeNameIndex ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:4> ; int enclosingTypeIndex = this . constantPool . literalIndexForType ( this . referenceBinding . enclosingType ( ) . constantPoolName ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( enclosingTypeIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) enclosingTypeIndex ; byte methodIndexByte1 = <NUM_LIT:0> ; byte methodIndexByte2 = <NUM_LIT:0> ; if ( this . referenceBinding instanceof LocalTypeBinding ) { MethodBinding methodBinding = ( ( LocalTypeBinding ) this . referenceBinding ) . enclosingMethod ; if ( methodBinding != null ) { int enclosingMethodIndex = this . constantPool . literalIndexForNameAndType ( methodBinding . selector , methodBinding . signature ( this ) ) ; methodIndexByte1 = ( byte ) ( enclosingMethodIndex > > <NUM_LIT:8> ) ; methodIndexByte2 = ( byte ) enclosingMethodIndex ; } } this . contents [ localContentsOffset ++ ] = methodIndexByte1 ; this . contents [ localContentsOffset ++ ] = methodIndexByte2 ; this . contentsOffset = localContentsOffset ; return <NUM_LIT:1> ; } private int generateExceptionsAttribute ( ReferenceBinding [ ] thrownsExceptions ) { int localContentsOffset = this . contentsOffset ; int length = thrownsExceptions . length ; int exSize = <NUM_LIT:8> + length * <NUM_LIT:2> ; if ( exSize + this . contentsOffset >= this . contents . length ) { resizeContents ( exSize ) ; } int exceptionNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . ExceptionsName ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( exceptionNameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) exceptionNameIndex ; int attributeLength = length * <NUM_LIT:2> + <NUM_LIT:2> ; this . contents [ localContentsOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:24> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:16> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) attributeLength ; this . contents [ localContentsOffset ++ ] = ( byte ) ( length > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { int exceptionIndex = this . constantPool . literalIndexForType ( thrownsExceptions [ i ] ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( exceptionIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) exceptionIndex ; } this . contentsOffset = localContentsOffset ; return <NUM_LIT:1> ; } private int generateHierarchyInconsistentAttribute ( ) { int localContentsOffset = this . contentsOffset ; if ( localContentsOffset + <NUM_LIT:6> >= this . contents . length ) { resizeContents ( <NUM_LIT:6> ) ; } int inconsistentHierarchyNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . InconsistentHierarchy ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( inconsistentHierarchyNameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) inconsistentHierarchyNameIndex ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contentsOffset = localContentsOffset ; return <NUM_LIT:1> ; } private int generateInnerClassAttribute ( int numberOfInnerClasses , ReferenceBinding [ ] innerClasses ) { int localContentsOffset = this . contentsOffset ; int exSize = <NUM_LIT:8> * numberOfInnerClasses + <NUM_LIT:8> ; if ( exSize + localContentsOffset >= this . contents . length ) { resizeContents ( exSize ) ; } int attributeNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . InnerClassName ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( attributeNameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) attributeNameIndex ; int value = ( numberOfInnerClasses << <NUM_LIT:3> ) + <NUM_LIT:2> ; this . contents [ localContentsOffset ++ ] = ( byte ) ( value > > <NUM_LIT:24> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( value > > <NUM_LIT:16> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( value > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) value ; this . contents [ localContentsOffset ++ ] = ( byte ) ( numberOfInnerClasses > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) numberOfInnerClasses ; for ( int i = <NUM_LIT:0> ; i < numberOfInnerClasses ; i ++ ) { ReferenceBinding innerClass = innerClasses [ i ] ; int accessFlags = innerClass . getAccessFlags ( ) ; int innerClassIndex = this . constantPool . literalIndexForType ( innerClass . constantPoolName ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( innerClassIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) innerClassIndex ; if ( innerClass . isMemberType ( ) ) { int outerClassIndex = this . constantPool . literalIndexForType ( innerClass . enclosingType ( ) . constantPoolName ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( outerClassIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) outerClassIndex ; } else { this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; } if ( ! innerClass . isAnonymousType ( ) ) { int nameIndex = this . constantPool . literalIndex ( innerClass . sourceName ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( nameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) nameIndex ; } else { this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; } if ( innerClass . isAnonymousType ( ) ) { accessFlags &= ~ ClassFileConstants . AccFinal ; } else if ( innerClass . isMemberType ( ) && innerClass . isInterface ( ) ) { accessFlags |= ClassFileConstants . AccStatic ; } this . contents [ localContentsOffset ++ ] = ( byte ) ( accessFlags > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) accessFlags ; } this . contentsOffset = localContentsOffset ; return <NUM_LIT:1> ; } private int generateLineNumberAttribute ( ) { int localContentsOffset = this . contentsOffset ; int attributesNumber = <NUM_LIT:0> ; int [ ] pcToSourceMapTable ; if ( ( ( pcToSourceMapTable = this . codeStream . pcToSourceMap ) != null ) && ( this . codeStream . pcToSourceMapSize != <NUM_LIT:0> ) ) { int lineNumberNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . LineNumberTableName ) ; if ( localContentsOffset + <NUM_LIT:8> >= this . contents . length ) { resizeContents ( <NUM_LIT:8> ) ; } this . contents [ localContentsOffset ++ ] = ( byte ) ( lineNumberNameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) lineNumberNameIndex ; int lineNumberTableOffset = localContentsOffset ; localContentsOffset += <NUM_LIT:6> ; int numberOfEntries = <NUM_LIT:0> ; int length = this . codeStream . pcToSourceMapSize ; for ( int i = <NUM_LIT:0> ; i < length ; ) { if ( localContentsOffset + <NUM_LIT:4> >= this . contents . length ) { resizeContents ( <NUM_LIT:4> ) ; } int pc = pcToSourceMapTable [ i ++ ] ; this . contents [ localContentsOffset ++ ] = ( byte ) ( pc > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) pc ; int lineNumber = pcToSourceMapTable [ i ++ ] ; this . contents [ localContentsOffset ++ ] = ( byte ) ( lineNumber > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) lineNumber ; numberOfEntries ++ ; } int lineNumberAttr_length = numberOfEntries * <NUM_LIT:4> + <NUM_LIT:2> ; this . contents [ lineNumberTableOffset ++ ] = ( byte ) ( lineNumberAttr_length > > <NUM_LIT:24> ) ; this . contents [ lineNumberTableOffset ++ ] = ( byte ) ( lineNumberAttr_length > > <NUM_LIT:16> ) ; this . contents [ lineNumberTableOffset ++ ] = ( byte ) ( lineNumberAttr_length > > <NUM_LIT:8> ) ; this . contents [ lineNumberTableOffset ++ ] = ( byte ) lineNumberAttr_length ; this . contents [ lineNumberTableOffset ++ ] = ( byte ) ( numberOfEntries > > <NUM_LIT:8> ) ; this . contents [ lineNumberTableOffset ++ ] = ( byte ) numberOfEntries ; attributesNumber = <NUM_LIT:1> ; } this . contentsOffset = localContentsOffset ; return attributesNumber ; } private int generateLineNumberAttribute ( int problemLine ) { int localContentsOffset = this . contentsOffset ; if ( localContentsOffset + <NUM_LIT:12> >= this . contents . length ) { resizeContents ( <NUM_LIT:12> ) ; } int lineNumberNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . LineNumberTableName ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( lineNumberNameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) lineNumberNameIndex ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:6> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:1> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = ( byte ) ( problemLine > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) problemLine ; this . contentsOffset = localContentsOffset ; return <NUM_LIT:1> ; } private int generateLocalVariableTableAttribute ( int code_length , boolean methodDeclarationIsStatic , boolean isSynthetic ) { int attributesNumber = <NUM_LIT:0> ; int localContentsOffset = this . contentsOffset ; int numberOfEntries = <NUM_LIT:0> ; int localVariableNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . LocalVariableTableName ) ; int maxOfEntries = <NUM_LIT:8> + <NUM_LIT:10> * ( methodDeclarationIsStatic ? <NUM_LIT:0> : <NUM_LIT:1> ) ; for ( int i = <NUM_LIT:0> ; i < this . codeStream . allLocalsCounter ; i ++ ) { LocalVariableBinding localVariableBinding = this . codeStream . locals [ i ] ; maxOfEntries += <NUM_LIT:10> * localVariableBinding . initializationCount ; } if ( localContentsOffset + maxOfEntries >= this . contents . length ) { resizeContents ( maxOfEntries ) ; } this . contents [ localContentsOffset ++ ] = ( byte ) ( localVariableNameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) localVariableNameIndex ; int localVariableTableOffset = localContentsOffset ; localContentsOffset += <NUM_LIT:6> ; int nameIndex ; int descriptorIndex ; SourceTypeBinding declaringClassBinding = null ; if ( ! methodDeclarationIsStatic && ! isSynthetic ) { numberOfEntries ++ ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = ( byte ) ( code_length > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) code_length ; nameIndex = this . constantPool . literalIndex ( ConstantPool . This ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( nameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) nameIndex ; declaringClassBinding = ( SourceTypeBinding ) this . codeStream . methodDeclaration . binding . declaringClass ; descriptorIndex = this . constantPool . literalIndex ( declaringClassBinding . signature ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( descriptorIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) descriptorIndex ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; } int genericLocalVariablesCounter = <NUM_LIT:0> ; LocalVariableBinding [ ] genericLocalVariables = null ; int numberOfGenericEntries = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , max = this . codeStream . allLocalsCounter ; i < max ; i ++ ) { LocalVariableBinding localVariable = this . codeStream . locals [ i ] ; int initializationCount = localVariable . initializationCount ; if ( initializationCount == <NUM_LIT:0> ) continue ; if ( localVariable . declaration == null ) continue ; final TypeBinding localVariableTypeBinding = localVariable . type ; boolean isParameterizedType = localVariableTypeBinding . isParameterizedType ( ) || localVariableTypeBinding . isTypeVariable ( ) ; if ( isParameterizedType ) { if ( genericLocalVariables == null ) { genericLocalVariables = new LocalVariableBinding [ max ] ; } genericLocalVariables [ genericLocalVariablesCounter ++ ] = localVariable ; } for ( int j = <NUM_LIT:0> ; j < initializationCount ; j ++ ) { int startPC = localVariable . initializationPCs [ j << <NUM_LIT:1> ] ; int endPC = localVariable . initializationPCs [ ( j << <NUM_LIT:1> ) + <NUM_LIT:1> ] ; if ( startPC != endPC ) { if ( endPC == - <NUM_LIT:1> ) { localVariable . declaringScope . problemReporter ( ) . abortDueToInternalError ( Messages . bind ( Messages . abort_invalidAttribute , new String ( localVariable . name ) ) , ( ASTNode ) localVariable . declaringScope . methodScope ( ) . referenceContext ) ; } if ( isParameterizedType ) { numberOfGenericEntries ++ ; } numberOfEntries ++ ; this . contents [ localContentsOffset ++ ] = ( byte ) ( startPC > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) startPC ; int length = endPC - startPC ; this . contents [ localContentsOffset ++ ] = ( byte ) ( length > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) length ; nameIndex = this . constantPool . literalIndex ( localVariable . name ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( nameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) nameIndex ; descriptorIndex = this . constantPool . literalIndex ( localVariableTypeBinding . signature ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( descriptorIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) descriptorIndex ; int resolvedPosition = localVariable . resolvedPosition ; this . contents [ localContentsOffset ++ ] = ( byte ) ( resolvedPosition > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) resolvedPosition ; } } } int value = numberOfEntries * <NUM_LIT:10> + <NUM_LIT:2> ; this . contents [ localVariableTableOffset ++ ] = ( byte ) ( value > > <NUM_LIT:24> ) ; this . contents [ localVariableTableOffset ++ ] = ( byte ) ( value > > <NUM_LIT:16> ) ; this . contents [ localVariableTableOffset ++ ] = ( byte ) ( value > > <NUM_LIT:8> ) ; this . contents [ localVariableTableOffset ++ ] = ( byte ) value ; this . contents [ localVariableTableOffset ++ ] = ( byte ) ( numberOfEntries > > <NUM_LIT:8> ) ; this . contents [ localVariableTableOffset ] = ( byte ) numberOfEntries ; attributesNumber ++ ; final boolean currentInstanceIsGeneric = ! methodDeclarationIsStatic && declaringClassBinding != null && declaringClassBinding . typeVariables != Binding . NO_TYPE_VARIABLES ; if ( genericLocalVariablesCounter != <NUM_LIT:0> || currentInstanceIsGeneric ) { numberOfGenericEntries += ( currentInstanceIsGeneric ? <NUM_LIT:1> : <NUM_LIT:0> ) ; maxOfEntries = <NUM_LIT:8> + numberOfGenericEntries * <NUM_LIT:10> ; if ( localContentsOffset + maxOfEntries >= this . contents . length ) { resizeContents ( maxOfEntries ) ; } int localVariableTypeNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . LocalVariableTypeTableName ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( localVariableTypeNameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) localVariableTypeNameIndex ; value = numberOfGenericEntries * <NUM_LIT:10> + <NUM_LIT:2> ; this . contents [ localContentsOffset ++ ] = ( byte ) ( value > > <NUM_LIT:24> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( value > > <NUM_LIT:16> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( value > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) value ; this . contents [ localContentsOffset ++ ] = ( byte ) ( numberOfGenericEntries > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) numberOfGenericEntries ; if ( currentInstanceIsGeneric ) { this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = ( byte ) ( code_length > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) code_length ; nameIndex = this . constantPool . literalIndex ( ConstantPool . This ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( nameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) nameIndex ; descriptorIndex = this . constantPool . literalIndex ( declaringClassBinding . genericTypeSignature ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( descriptorIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) descriptorIndex ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; } for ( int i = <NUM_LIT:0> ; i < genericLocalVariablesCounter ; i ++ ) { LocalVariableBinding localVariable = genericLocalVariables [ i ] ; for ( int j = <NUM_LIT:0> ; j < localVariable . initializationCount ; j ++ ) { int startPC = localVariable . initializationPCs [ j << <NUM_LIT:1> ] ; int endPC = localVariable . initializationPCs [ ( j << <NUM_LIT:1> ) + <NUM_LIT:1> ] ; if ( startPC != endPC ) { this . contents [ localContentsOffset ++ ] = ( byte ) ( startPC > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) startPC ; int length = endPC - startPC ; this . contents [ localContentsOffset ++ ] = ( byte ) ( length > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) length ; nameIndex = this . constantPool . literalIndex ( localVariable . name ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( nameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) nameIndex ; descriptorIndex = this . constantPool . literalIndex ( localVariable . type . genericTypeSignature ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( descriptorIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) descriptorIndex ; int resolvedPosition = localVariable . resolvedPosition ; this . contents [ localContentsOffset ++ ] = ( byte ) ( resolvedPosition > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) resolvedPosition ; } } } attributesNumber ++ ; } this . contentsOffset = localContentsOffset ; return attributesNumber ; } public int generateMethodInfoAttributes ( MethodBinding methodBinding ) { this . contentsOffset += <NUM_LIT:2> ; if ( this . contentsOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } ReferenceBinding [ ] thrownsExceptions ; int attributesNumber = <NUM_LIT:0> ; if ( ( thrownsExceptions = methodBinding . thrownExceptions ) != Binding . NO_EXCEPTIONS ) { attributesNumber += generateExceptionsAttribute ( thrownsExceptions ) ; } if ( methodBinding . isDeprecated ( ) ) { attributesNumber += generateDeprecatedAttribute ( ) ; } if ( this . targetJDK < ClassFileConstants . JDK1_5 ) { if ( methodBinding . isSynthetic ( ) ) { attributesNumber += generateSyntheticAttribute ( ) ; } if ( methodBinding . isVarargs ( ) ) { attributesNumber += generateVarargsAttribute ( ) ; } } char [ ] genericSignature = methodBinding . genericSignature ( ) ; if ( genericSignature != null ) { attributesNumber += generateSignatureAttribute ( genericSignature ) ; } if ( this . targetJDK >= ClassFileConstants . JDK1_4 ) { AbstractMethodDeclaration methodDeclaration = methodBinding . sourceMethod ( ) ; if ( methodDeclaration != null ) { Annotation [ ] annotations = methodDeclaration . annotations ; if ( annotations != null ) { attributesNumber += generateRuntimeAnnotations ( annotations ) ; } if ( ( methodBinding . tagBits & TagBits . HasParameterAnnotations ) != <NUM_LIT:0> ) { Argument [ ] arguments = methodDeclaration . arguments ; if ( arguments != null ) { attributesNumber += generateRuntimeAnnotationsForParameters ( arguments ) ; } } } } if ( ( methodBinding . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) { this . missingTypes = methodBinding . collectMissingTypes ( this . missingTypes ) ; } return attributesNumber ; } public int generateMethodInfoAttributes ( MethodBinding methodBinding , AnnotationMethodDeclaration declaration ) { int attributesNumber = generateMethodInfoAttributes ( methodBinding ) ; int attributeOffset = this . contentsOffset ; if ( ( declaration . modifiers & ClassFileConstants . AccAnnotationDefault ) != <NUM_LIT:0> ) { attributesNumber += generateAnnotationDefaultAttribute ( declaration , attributeOffset ) ; } return attributesNumber ; } public void generateMethodInfoHeader ( MethodBinding methodBinding ) { generateMethodInfoHeader ( methodBinding , methodBinding . modifiers ) ; } public void generateMethodInfoHeader ( MethodBinding methodBinding , int accessFlags ) { this . methodCount ++ ; if ( this . contentsOffset + <NUM_LIT:10> >= this . contents . length ) { resizeContents ( <NUM_LIT:10> ) ; } if ( this . targetJDK < ClassFileConstants . JDK1_5 ) { accessFlags &= ~ ( ClassFileConstants . AccSynthetic | ClassFileConstants . AccVarargs ) ; } if ( ( methodBinding . tagBits & TagBits . ClearPrivateModifier ) != <NUM_LIT:0> ) { accessFlags &= ~ ClassFileConstants . AccPrivate ; } this . contents [ this . contentsOffset ++ ] = ( byte ) ( accessFlags > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) accessFlags ; int nameIndex = this . constantPool . literalIndex ( methodBinding . selector ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( nameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) nameIndex ; int descriptorIndex = this . constantPool . literalIndex ( methodBinding . signature ( this ) ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( descriptorIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) descriptorIndex ; } public void generateMethodInfoHeaderForClinit ( ) { this . methodCount ++ ; if ( this . contentsOffset + <NUM_LIT:10> >= this . contents . length ) { resizeContents ( <NUM_LIT:10> ) ; } this . contents [ this . contentsOffset ++ ] = ( byte ) ( ( ClassFileConstants . AccDefault | ClassFileConstants . AccStatic ) > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( ClassFileConstants . AccDefault | ClassFileConstants . AccStatic ) ; int nameIndex = this . constantPool . literalIndex ( ConstantPool . Clinit ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( nameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) nameIndex ; int descriptorIndex = this . constantPool . literalIndex ( ConstantPool . ClinitSignature ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( descriptorIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) descriptorIndex ; this . contents [ this . contentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ this . contentsOffset ++ ] = <NUM_LIT:1> ; } public void generateMissingAbstractMethods ( MethodDeclaration [ ] methodDeclarations , CompilationResult compilationResult ) { if ( methodDeclarations != null ) { TypeDeclaration currentDeclaration = this . referenceBinding . scope . referenceContext ; int typeDeclarationSourceStart = currentDeclaration . sourceStart ( ) ; int typeDeclarationSourceEnd = currentDeclaration . sourceEnd ( ) ; for ( int i = <NUM_LIT:0> , max = methodDeclarations . length ; i < max ; i ++ ) { MethodDeclaration methodDeclaration = methodDeclarations [ i ] ; MethodBinding methodBinding = methodDeclaration . binding ; String readableName = new String ( methodBinding . readableName ( ) ) ; CategorizedProblem [ ] problems = compilationResult . problems ; int problemsCount = compilationResult . problemCount ; for ( int j = <NUM_LIT:0> ; j < problemsCount ; j ++ ) { CategorizedProblem problem = problems [ j ] ; if ( problem != null && problem . getID ( ) == IProblem . AbstractMethodMustBeImplemented && problem . getMessage ( ) . indexOf ( readableName ) != - <NUM_LIT:1> && problem . getSourceStart ( ) >= typeDeclarationSourceStart && problem . getSourceEnd ( ) <= typeDeclarationSourceEnd ) { addMissingAbstractProblemMethod ( methodDeclaration , methodBinding , problem , compilationResult ) ; } } } } } private void generateMissingTypesAttribute ( ) { int initialSize = this . missingTypes . size ( ) ; int [ ] missingTypesIndexes = new int [ initialSize ] ; int numberOfMissingTypes = <NUM_LIT:0> ; if ( initialSize > <NUM_LIT:1> ) { Collections . sort ( this . missingTypes , new Comparator ( ) { public int compare ( Object o1 , Object o2 ) { TypeBinding typeBinding1 = ( TypeBinding ) o1 ; TypeBinding typeBinding2 = ( TypeBinding ) o2 ; return CharOperation . compareTo ( typeBinding1 . constantPoolName ( ) , typeBinding2 . constantPoolName ( ) ) ; } } ) ; } int previousIndex = <NUM_LIT:0> ; next : for ( int i = <NUM_LIT:0> ; i < initialSize ; i ++ ) { int missingTypeIndex = this . constantPool . literalIndexForType ( ( TypeBinding ) this . missingTypes . get ( i ) ) ; if ( previousIndex == missingTypeIndex ) { continue next ; } previousIndex = missingTypeIndex ; missingTypesIndexes [ numberOfMissingTypes ++ ] = missingTypeIndex ; } int attributeLength = numberOfMissingTypes * <NUM_LIT:2> + <NUM_LIT:2> ; if ( this . contentsOffset + attributeLength + <NUM_LIT:6> >= this . contents . length ) { resizeContents ( attributeLength + <NUM_LIT:6> ) ; } int missingTypesNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . MissingTypesName ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( missingTypesNameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) missingTypesNameIndex ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:24> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:16> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) attributeLength ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( numberOfMissingTypes > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) numberOfMissingTypes ; for ( int i = <NUM_LIT:0> ; i < numberOfMissingTypes ; i ++ ) { int missingTypeIndex = missingTypesIndexes [ i ] ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( missingTypeIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) missingTypeIndex ; } } private int generateRuntimeAnnotations ( final Annotation [ ] annotations ) { int attributesNumber = <NUM_LIT:0> ; final int length = annotations . length ; int visibleAnnotationsCounter = <NUM_LIT:0> ; int invisibleAnnotationsCounter = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { Annotation annotation = annotations [ i ] ; if ( annotation . isRuntimeInvisible ( ) ) { invisibleAnnotationsCounter ++ ; } else if ( annotation . isRuntimeVisible ( ) ) { visibleAnnotationsCounter ++ ; } } int annotationAttributeOffset = this . contentsOffset ; int constantPOffset = this . constantPool . currentOffset ; int constantPoolIndex = this . constantPool . currentIndex ; if ( invisibleAnnotationsCounter != <NUM_LIT:0> ) { if ( this . contentsOffset + <NUM_LIT:10> >= this . contents . length ) { resizeContents ( <NUM_LIT:10> ) ; } int runtimeInvisibleAnnotationsAttributeNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . RuntimeInvisibleAnnotationsName ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( runtimeInvisibleAnnotationsAttributeNameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) runtimeInvisibleAnnotationsAttributeNameIndex ; int attributeLengthOffset = this . contentsOffset ; this . contentsOffset += <NUM_LIT:4> ; int annotationsLengthOffset = this . contentsOffset ; this . contentsOffset += <NUM_LIT:2> ; int counter = <NUM_LIT:0> ; loop : for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( invisibleAnnotationsCounter == <NUM_LIT:0> ) break loop ; Annotation annotation = annotations [ i ] ; if ( annotation . isRuntimeInvisible ( ) ) { int currentAnnotationOffset = this . contentsOffset ; generateAnnotation ( annotation , currentAnnotationOffset ) ; invisibleAnnotationsCounter -- ; if ( this . contentsOffset != currentAnnotationOffset ) { counter ++ ; } } } if ( counter != <NUM_LIT:0> ) { this . contents [ annotationsLengthOffset ++ ] = ( byte ) ( counter > > <NUM_LIT:8> ) ; this . contents [ annotationsLengthOffset ++ ] = ( byte ) counter ; int attributeLength = this . contentsOffset - attributeLengthOffset - <NUM_LIT:4> ; this . contents [ attributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:24> ) ; this . contents [ attributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:16> ) ; this . contents [ attributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:8> ) ; this . contents [ attributeLengthOffset ++ ] = ( byte ) attributeLength ; attributesNumber ++ ; } else { this . contentsOffset = annotationAttributeOffset ; this . constantPool . resetForAttributeName ( AttributeNamesConstants . RuntimeInvisibleAnnotationsName , constantPoolIndex , constantPOffset ) ; } } annotationAttributeOffset = this . contentsOffset ; constantPOffset = this . constantPool . currentOffset ; constantPoolIndex = this . constantPool . currentIndex ; if ( visibleAnnotationsCounter != <NUM_LIT:0> ) { if ( this . contentsOffset + <NUM_LIT:10> >= this . contents . length ) { resizeContents ( <NUM_LIT:10> ) ; } int runtimeVisibleAnnotationsAttributeNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . RuntimeVisibleAnnotationsName ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( runtimeVisibleAnnotationsAttributeNameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) runtimeVisibleAnnotationsAttributeNameIndex ; int attributeLengthOffset = this . contentsOffset ; this . contentsOffset += <NUM_LIT:4> ; int annotationsLengthOffset = this . contentsOffset ; this . contentsOffset += <NUM_LIT:2> ; int counter = <NUM_LIT:0> ; loop : for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( visibleAnnotationsCounter == <NUM_LIT:0> ) break loop ; Annotation annotation = annotations [ i ] ; if ( annotation . isRuntimeVisible ( ) ) { visibleAnnotationsCounter -- ; int currentAnnotationOffset = this . contentsOffset ; generateAnnotation ( annotation , currentAnnotationOffset ) ; if ( this . contentsOffset != currentAnnotationOffset ) { counter ++ ; } } } if ( counter != <NUM_LIT:0> ) { this . contents [ annotationsLengthOffset ++ ] = ( byte ) ( counter > > <NUM_LIT:8> ) ; this . contents [ annotationsLengthOffset ++ ] = ( byte ) counter ; int attributeLength = this . contentsOffset - attributeLengthOffset - <NUM_LIT:4> ; this . contents [ attributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:24> ) ; this . contents [ attributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:16> ) ; this . contents [ attributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:8> ) ; this . contents [ attributeLengthOffset ++ ] = ( byte ) attributeLength ; attributesNumber ++ ; } else { this . contentsOffset = annotationAttributeOffset ; this . constantPool . resetForAttributeName ( AttributeNamesConstants . RuntimeVisibleAnnotationsName , constantPoolIndex , constantPOffset ) ; } } return attributesNumber ; } private int generateRuntimeAnnotationsForParameters ( Argument [ ] arguments ) { final int argumentsLength = arguments . length ; final int VISIBLE_INDEX = <NUM_LIT:0> ; final int INVISIBLE_INDEX = <NUM_LIT:1> ; int invisibleParametersAnnotationsCounter = <NUM_LIT:0> ; int visibleParametersAnnotationsCounter = <NUM_LIT:0> ; int [ ] [ ] annotationsCounters = new int [ argumentsLength ] [ <NUM_LIT:2> ] ; for ( int i = <NUM_LIT:0> ; i < argumentsLength ; i ++ ) { Argument argument = arguments [ i ] ; Annotation [ ] annotations = argument . annotations ; if ( annotations != null ) { for ( int j = <NUM_LIT:0> , max2 = annotations . length ; j < max2 ; j ++ ) { Annotation annotation = annotations [ j ] ; if ( annotation . isRuntimeInvisible ( ) ) { annotationsCounters [ i ] [ INVISIBLE_INDEX ] ++ ; invisibleParametersAnnotationsCounter ++ ; } else if ( annotation . isRuntimeVisible ( ) ) { annotationsCounters [ i ] [ VISIBLE_INDEX ] ++ ; visibleParametersAnnotationsCounter ++ ; } } } } int attributesNumber = <NUM_LIT:0> ; int annotationAttributeOffset = this . contentsOffset ; if ( invisibleParametersAnnotationsCounter != <NUM_LIT:0> ) { int globalCounter = <NUM_LIT:0> ; if ( this . contentsOffset + <NUM_LIT:7> >= this . contents . length ) { resizeContents ( <NUM_LIT:7> ) ; } int attributeNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . RuntimeInvisibleParameterAnnotationsName ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( attributeNameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) attributeNameIndex ; int attributeLengthOffset = this . contentsOffset ; this . contentsOffset += <NUM_LIT:4> ; this . contents [ this . contentsOffset ++ ] = ( byte ) argumentsLength ; for ( int i = <NUM_LIT:0> ; i < argumentsLength ; i ++ ) { if ( this . contentsOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } if ( invisibleParametersAnnotationsCounter == <NUM_LIT:0> ) { this . contents [ this . contentsOffset ++ ] = ( byte ) <NUM_LIT:0> ; this . contents [ this . contentsOffset ++ ] = ( byte ) <NUM_LIT:0> ; } else { final int numberOfInvisibleAnnotations = annotationsCounters [ i ] [ INVISIBLE_INDEX ] ; int invisibleAnnotationsOffset = this . contentsOffset ; this . contentsOffset += <NUM_LIT:2> ; int counter = <NUM_LIT:0> ; if ( numberOfInvisibleAnnotations != <NUM_LIT:0> ) { Argument argument = arguments [ i ] ; Annotation [ ] annotations = argument . annotations ; for ( int j = <NUM_LIT:0> , max = annotations . length ; j < max ; j ++ ) { Annotation annotation = annotations [ j ] ; if ( annotation . isRuntimeInvisible ( ) ) { int currentAnnotationOffset = this . contentsOffset ; generateAnnotation ( annotation , currentAnnotationOffset ) ; if ( this . contentsOffset != currentAnnotationOffset ) { counter ++ ; globalCounter ++ ; } invisibleParametersAnnotationsCounter -- ; } } } this . contents [ invisibleAnnotationsOffset ++ ] = ( byte ) ( counter > > <NUM_LIT:8> ) ; this . contents [ invisibleAnnotationsOffset ] = ( byte ) counter ; } } if ( globalCounter != <NUM_LIT:0> ) { int attributeLength = this . contentsOffset - attributeLengthOffset - <NUM_LIT:4> ; this . contents [ attributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:24> ) ; this . contents [ attributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:16> ) ; this . contents [ attributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:8> ) ; this . contents [ attributeLengthOffset ++ ] = ( byte ) attributeLength ; attributesNumber ++ ; } else { this . contentsOffset = annotationAttributeOffset ; } } if ( visibleParametersAnnotationsCounter != <NUM_LIT:0> ) { int globalCounter = <NUM_LIT:0> ; if ( this . contentsOffset + <NUM_LIT:7> >= this . contents . length ) { resizeContents ( <NUM_LIT:7> ) ; } int attributeNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . RuntimeVisibleParameterAnnotationsName ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( attributeNameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) attributeNameIndex ; int attributeLengthOffset = this . contentsOffset ; this . contentsOffset += <NUM_LIT:4> ; this . contents [ this . contentsOffset ++ ] = ( byte ) argumentsLength ; for ( int i = <NUM_LIT:0> ; i < argumentsLength ; i ++ ) { if ( this . contentsOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } if ( visibleParametersAnnotationsCounter == <NUM_LIT:0> ) { this . contents [ this . contentsOffset ++ ] = ( byte ) <NUM_LIT:0> ; this . contents [ this . contentsOffset ++ ] = ( byte ) <NUM_LIT:0> ; } else { final int numberOfVisibleAnnotations = annotationsCounters [ i ] [ VISIBLE_INDEX ] ; int visibleAnnotationsOffset = this . contentsOffset ; this . contentsOffset += <NUM_LIT:2> ; int counter = <NUM_LIT:0> ; if ( numberOfVisibleAnnotations != <NUM_LIT:0> ) { Argument argument = arguments [ i ] ; Annotation [ ] annotations = argument . annotations ; for ( int j = <NUM_LIT:0> , max = annotations . length ; j < max ; j ++ ) { Annotation annotation = annotations [ j ] ; if ( annotation . isRuntimeVisible ( ) ) { int currentAnnotationOffset = this . contentsOffset ; generateAnnotation ( annotation , currentAnnotationOffset ) ; if ( this . contentsOffset != currentAnnotationOffset ) { counter ++ ; globalCounter ++ ; } visibleParametersAnnotationsCounter -- ; } } } this . contents [ visibleAnnotationsOffset ++ ] = ( byte ) ( counter > > <NUM_LIT:8> ) ; this . contents [ visibleAnnotationsOffset ] = ( byte ) counter ; } } if ( globalCounter != <NUM_LIT:0> ) { int attributeLength = this . contentsOffset - attributeLengthOffset - <NUM_LIT:4> ; this . contents [ attributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:24> ) ; this . contents [ attributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:16> ) ; this . contents [ attributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:8> ) ; this . contents [ attributeLengthOffset ++ ] = ( byte ) attributeLength ; attributesNumber ++ ; } else { this . contentsOffset = annotationAttributeOffset ; } } return attributesNumber ; } private int generateSignatureAttribute ( char [ ] genericSignature ) { int localContentsOffset = this . contentsOffset ; if ( localContentsOffset + <NUM_LIT:8> >= this . contents . length ) { resizeContents ( <NUM_LIT:8> ) ; } int signatureAttributeNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . SignatureName ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( signatureAttributeNameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) signatureAttributeNameIndex ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:2> ; int signatureIndex = this . constantPool . literalIndex ( genericSignature ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( signatureIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) signatureIndex ; this . contentsOffset = localContentsOffset ; return <NUM_LIT:1> ; } private int generateSourceAttribute ( String fullFileName ) { int localContentsOffset = this . contentsOffset ; if ( localContentsOffset + <NUM_LIT:8> >= this . contents . length ) { resizeContents ( <NUM_LIT:8> ) ; } int sourceAttributeNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . SourceName ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( sourceAttributeNameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) sourceAttributeNameIndex ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:2> ; int fileNameIndex = this . constantPool . literalIndex ( fullFileName . toCharArray ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( fileNameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) fileNameIndex ; this . contentsOffset = localContentsOffset ; return <NUM_LIT:1> ; } private int generateStackMapAttribute ( MethodBinding methodBinding , int code_length , int codeAttributeOffset , int max_locals , boolean isClinit ) { int attributesNumber = <NUM_LIT:0> ; int localContentsOffset = this . contentsOffset ; StackMapFrameCodeStream stackMapFrameCodeStream = ( StackMapFrameCodeStream ) this . codeStream ; stackMapFrameCodeStream . removeFramePosition ( code_length ) ; if ( stackMapFrameCodeStream . hasFramePositions ( ) ) { ArrayList frames = new ArrayList ( ) ; traverse ( isClinit ? null : methodBinding , max_locals , this . contents , codeAttributeOffset + <NUM_LIT> , code_length , frames , isClinit ) ; int numberOfFrames = frames . size ( ) ; if ( numberOfFrames > <NUM_LIT:1> ) { int stackMapTableAttributeOffset = localContentsOffset ; if ( localContentsOffset + <NUM_LIT:8> >= this . contents . length ) { resizeContents ( <NUM_LIT:8> ) ; } int stackMapAttributeNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . StackMapName ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( stackMapAttributeNameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) stackMapAttributeNameIndex ; int stackMapAttributeLengthOffset = localContentsOffset ; localContentsOffset += <NUM_LIT:4> ; if ( localContentsOffset + <NUM_LIT:4> >= this . contents . length ) { resizeContents ( <NUM_LIT:4> ) ; } int numberOfFramesOffset = localContentsOffset ; localContentsOffset += <NUM_LIT:2> ; if ( localContentsOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } StackMapFrame currentFrame = ( StackMapFrame ) frames . get ( <NUM_LIT:0> ) ; for ( int j = <NUM_LIT:1> ; j < numberOfFrames ; j ++ ) { currentFrame = ( StackMapFrame ) frames . get ( j ) ; int frameOffset = currentFrame . pc ; if ( localContentsOffset + <NUM_LIT:5> >= this . contents . length ) { resizeContents ( <NUM_LIT:5> ) ; } this . contents [ localContentsOffset ++ ] = ( byte ) ( frameOffset > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) frameOffset ; int numberOfLocalOffset = localContentsOffset ; localContentsOffset += <NUM_LIT:2> ; int numberOfLocalEntries = <NUM_LIT:0> ; int numberOfLocals = currentFrame . getNumberOfLocals ( ) ; int numberOfEntries = <NUM_LIT:0> ; int localsLength = currentFrame . locals == null ? <NUM_LIT:0> : currentFrame . locals . length ; for ( int i = <NUM_LIT:0> ; i < localsLength && numberOfLocalEntries < numberOfLocals ; i ++ ) { if ( localContentsOffset + <NUM_LIT:3> >= this . contents . length ) { resizeContents ( <NUM_LIT:3> ) ; } VerificationTypeInfo info = currentFrame . locals [ i ] ; if ( info == null ) { this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_TOP ; } else { switch ( info . id ( ) ) { case T_boolean : case T_byte : case T_char : case T_int : case T_short : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_INTEGER ; break ; case T_float : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_FLOAT ; break ; case T_long : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_LONG ; i ++ ; break ; case T_double : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_DOUBLE ; i ++ ; break ; case T_null : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_NULL ; break ; default : this . contents [ localContentsOffset ++ ] = ( byte ) info . tag ; switch ( info . tag ) { case VerificationTypeInfo . ITEM_UNINITIALIZED : int offset = info . offset ; this . contents [ localContentsOffset ++ ] = ( byte ) ( offset > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) offset ; break ; case VerificationTypeInfo . ITEM_OBJECT : int indexForType = this . constantPool . literalIndexForType ( info . constantPoolName ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( indexForType > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) indexForType ; } } numberOfLocalEntries ++ ; } numberOfEntries ++ ; } if ( localContentsOffset + <NUM_LIT:4> >= this . contents . length ) { resizeContents ( <NUM_LIT:4> ) ; } this . contents [ numberOfLocalOffset ++ ] = ( byte ) ( numberOfEntries > > <NUM_LIT:8> ) ; this . contents [ numberOfLocalOffset ] = ( byte ) numberOfEntries ; int numberOfStackItems = currentFrame . numberOfStackItems ; this . contents [ localContentsOffset ++ ] = ( byte ) ( numberOfStackItems > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) numberOfStackItems ; for ( int i = <NUM_LIT:0> ; i < numberOfStackItems ; i ++ ) { if ( localContentsOffset + <NUM_LIT:3> >= this . contents . length ) { resizeContents ( <NUM_LIT:3> ) ; } VerificationTypeInfo info = currentFrame . stackItems [ i ] ; if ( info == null ) { this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_TOP ; } else { switch ( info . id ( ) ) { case T_boolean : case T_byte : case T_char : case T_int : case T_short : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_INTEGER ; break ; case T_float : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_FLOAT ; break ; case T_long : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_LONG ; break ; case T_double : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_DOUBLE ; break ; case T_null : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_NULL ; break ; default : this . contents [ localContentsOffset ++ ] = ( byte ) info . tag ; switch ( info . tag ) { case VerificationTypeInfo . ITEM_UNINITIALIZED : int offset = info . offset ; this . contents [ localContentsOffset ++ ] = ( byte ) ( offset > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) offset ; break ; case VerificationTypeInfo . ITEM_OBJECT : int indexForType = this . constantPool . literalIndexForType ( info . constantPoolName ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( indexForType > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) indexForType ; } } } } } numberOfFrames -- ; if ( numberOfFrames != <NUM_LIT:0> ) { this . contents [ numberOfFramesOffset ++ ] = ( byte ) ( numberOfFrames > > <NUM_LIT:8> ) ; this . contents [ numberOfFramesOffset ] = ( byte ) numberOfFrames ; int attributeLength = localContentsOffset - stackMapAttributeLengthOffset - <NUM_LIT:4> ; this . contents [ stackMapAttributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:24> ) ; this . contents [ stackMapAttributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:16> ) ; this . contents [ stackMapAttributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:8> ) ; this . contents [ stackMapAttributeLengthOffset ] = ( byte ) attributeLength ; attributesNumber ++ ; } else { localContentsOffset = stackMapTableAttributeOffset ; } } } this . contentsOffset = localContentsOffset ; return attributesNumber ; } private int generateStackMapTableAttribute ( MethodBinding methodBinding , int code_length , int codeAttributeOffset , int max_locals , boolean isClinit ) { int attributesNumber = <NUM_LIT:0> ; int localContentsOffset = this . contentsOffset ; StackMapFrameCodeStream stackMapFrameCodeStream = ( StackMapFrameCodeStream ) this . codeStream ; stackMapFrameCodeStream . removeFramePosition ( code_length ) ; if ( stackMapFrameCodeStream . hasFramePositions ( ) ) { ArrayList frames = new ArrayList ( ) ; traverse ( isClinit ? null : methodBinding , max_locals , this . contents , codeAttributeOffset + <NUM_LIT> , code_length , frames , isClinit ) ; int numberOfFrames = frames . size ( ) ; if ( numberOfFrames > <NUM_LIT:1> ) { int stackMapTableAttributeOffset = localContentsOffset ; if ( localContentsOffset + <NUM_LIT:8> >= this . contents . length ) { resizeContents ( <NUM_LIT:8> ) ; } int stackMapTableAttributeNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . StackMapTableName ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( stackMapTableAttributeNameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) stackMapTableAttributeNameIndex ; int stackMapTableAttributeLengthOffset = localContentsOffset ; localContentsOffset += <NUM_LIT:4> ; if ( localContentsOffset + <NUM_LIT:4> >= this . contents . length ) { resizeContents ( <NUM_LIT:4> ) ; } int numberOfFramesOffset = localContentsOffset ; localContentsOffset += <NUM_LIT:2> ; if ( localContentsOffset + <NUM_LIT:2> >= this . contents . length ) { resizeContents ( <NUM_LIT:2> ) ; } StackMapFrame currentFrame = ( StackMapFrame ) frames . get ( <NUM_LIT:0> ) ; StackMapFrame prevFrame = null ; for ( int j = <NUM_LIT:1> ; j < numberOfFrames ; j ++ ) { prevFrame = currentFrame ; currentFrame = ( StackMapFrame ) frames . get ( j ) ; int offsetDelta = currentFrame . getOffsetDelta ( prevFrame ) ; switch ( currentFrame . getFrameType ( prevFrame ) ) { case StackMapFrame . APPEND_FRAME : if ( localContentsOffset + <NUM_LIT:3> >= this . contents . length ) { resizeContents ( <NUM_LIT:3> ) ; } int numberOfDifferentLocals = currentFrame . numberOfDifferentLocals ( prevFrame ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( <NUM_LIT> + numberOfDifferentLocals ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( offsetDelta > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) offsetDelta ; int index = currentFrame . getIndexOfDifferentLocals ( numberOfDifferentLocals ) ; int numberOfLocals = currentFrame . getNumberOfLocals ( ) ; for ( int i = index ; i < currentFrame . locals . length && numberOfDifferentLocals > <NUM_LIT:0> ; i ++ ) { if ( localContentsOffset + <NUM_LIT:6> >= this . contents . length ) { resizeContents ( <NUM_LIT:6> ) ; } VerificationTypeInfo info = currentFrame . locals [ i ] ; if ( info == null ) { this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_TOP ; } else { switch ( info . id ( ) ) { case T_boolean : case T_byte : case T_char : case T_int : case T_short : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_INTEGER ; break ; case T_float : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_FLOAT ; break ; case T_long : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_LONG ; i ++ ; break ; case T_double : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_DOUBLE ; i ++ ; break ; case T_null : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_NULL ; break ; default : this . contents [ localContentsOffset ++ ] = ( byte ) info . tag ; switch ( info . tag ) { case VerificationTypeInfo . ITEM_UNINITIALIZED : int offset = info . offset ; this . contents [ localContentsOffset ++ ] = ( byte ) ( offset > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) offset ; break ; case VerificationTypeInfo . ITEM_OBJECT : int indexForType = this . constantPool . literalIndexForType ( info . constantPoolName ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( indexForType > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) indexForType ; } } numberOfDifferentLocals -- ; } } break ; case StackMapFrame . SAME_FRAME : if ( localContentsOffset + <NUM_LIT:1> >= this . contents . length ) { resizeContents ( <NUM_LIT:1> ) ; } this . contents [ localContentsOffset ++ ] = ( byte ) offsetDelta ; break ; case StackMapFrame . SAME_FRAME_EXTENDED : if ( localContentsOffset + <NUM_LIT:3> >= this . contents . length ) { resizeContents ( <NUM_LIT:3> ) ; } this . contents [ localContentsOffset ++ ] = ( byte ) <NUM_LIT> ; this . contents [ localContentsOffset ++ ] = ( byte ) ( offsetDelta > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) offsetDelta ; break ; case StackMapFrame . CHOP_FRAME : if ( localContentsOffset + <NUM_LIT:3> >= this . contents . length ) { resizeContents ( <NUM_LIT:3> ) ; } numberOfDifferentLocals = - currentFrame . numberOfDifferentLocals ( prevFrame ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( <NUM_LIT> - numberOfDifferentLocals ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( offsetDelta > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) offsetDelta ; break ; case StackMapFrame . SAME_LOCALS_1_STACK_ITEMS : if ( localContentsOffset + <NUM_LIT:4> >= this . contents . length ) { resizeContents ( <NUM_LIT:4> ) ; } this . contents [ localContentsOffset ++ ] = ( byte ) ( offsetDelta + <NUM_LIT> ) ; if ( currentFrame . stackItems [ <NUM_LIT:0> ] == null ) { this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_TOP ; } else { switch ( currentFrame . stackItems [ <NUM_LIT:0> ] . id ( ) ) { case T_boolean : case T_byte : case T_char : case T_int : case T_short : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_INTEGER ; break ; case T_float : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_FLOAT ; break ; case T_long : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_LONG ; break ; case T_double : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_DOUBLE ; break ; case T_null : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_NULL ; break ; default : VerificationTypeInfo info = currentFrame . stackItems [ <NUM_LIT:0> ] ; byte tag = ( byte ) info . tag ; this . contents [ localContentsOffset ++ ] = tag ; switch ( tag ) { case VerificationTypeInfo . ITEM_UNINITIALIZED : int offset = info . offset ; this . contents [ localContentsOffset ++ ] = ( byte ) ( offset > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) offset ; break ; case VerificationTypeInfo . ITEM_OBJECT : int indexForType = this . constantPool . literalIndexForType ( info . constantPoolName ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( indexForType > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) indexForType ; } } } break ; case StackMapFrame . SAME_LOCALS_1_STACK_ITEMS_EXTENDED : if ( localContentsOffset + <NUM_LIT:6> >= this . contents . length ) { resizeContents ( <NUM_LIT:6> ) ; } this . contents [ localContentsOffset ++ ] = ( byte ) <NUM_LIT> ; this . contents [ localContentsOffset ++ ] = ( byte ) ( offsetDelta > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) offsetDelta ; if ( currentFrame . stackItems [ <NUM_LIT:0> ] == null ) { this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_TOP ; } else { switch ( currentFrame . stackItems [ <NUM_LIT:0> ] . id ( ) ) { case T_boolean : case T_byte : case T_char : case T_int : case T_short : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_INTEGER ; break ; case T_float : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_FLOAT ; break ; case T_long : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_LONG ; break ; case T_double : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_DOUBLE ; break ; case T_null : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_NULL ; break ; default : VerificationTypeInfo info = currentFrame . stackItems [ <NUM_LIT:0> ] ; byte tag = ( byte ) info . tag ; this . contents [ localContentsOffset ++ ] = tag ; switch ( tag ) { case VerificationTypeInfo . ITEM_UNINITIALIZED : int offset = info . offset ; this . contents [ localContentsOffset ++ ] = ( byte ) ( offset > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) offset ; break ; case VerificationTypeInfo . ITEM_OBJECT : int indexForType = this . constantPool . literalIndexForType ( info . constantPoolName ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( indexForType > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) indexForType ; } } } break ; default : if ( localContentsOffset + <NUM_LIT:5> >= this . contents . length ) { resizeContents ( <NUM_LIT:5> ) ; } this . contents [ localContentsOffset ++ ] = ( byte ) <NUM_LIT:255> ; this . contents [ localContentsOffset ++ ] = ( byte ) ( offsetDelta > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) offsetDelta ; int numberOfLocalOffset = localContentsOffset ; localContentsOffset += <NUM_LIT:2> ; int numberOfLocalEntries = <NUM_LIT:0> ; numberOfLocals = currentFrame . getNumberOfLocals ( ) ; int numberOfEntries = <NUM_LIT:0> ; int localsLength = currentFrame . locals == null ? <NUM_LIT:0> : currentFrame . locals . length ; for ( int i = <NUM_LIT:0> ; i < localsLength && numberOfLocalEntries < numberOfLocals ; i ++ ) { if ( localContentsOffset + <NUM_LIT:3> >= this . contents . length ) { resizeContents ( <NUM_LIT:3> ) ; } VerificationTypeInfo info = currentFrame . locals [ i ] ; if ( info == null ) { this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_TOP ; } else { switch ( info . id ( ) ) { case T_boolean : case T_byte : case T_char : case T_int : case T_short : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_INTEGER ; break ; case T_float : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_FLOAT ; break ; case T_long : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_LONG ; i ++ ; break ; case T_double : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_DOUBLE ; i ++ ; break ; case T_null : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_NULL ; break ; default : this . contents [ localContentsOffset ++ ] = ( byte ) info . tag ; switch ( info . tag ) { case VerificationTypeInfo . ITEM_UNINITIALIZED : int offset = info . offset ; this . contents [ localContentsOffset ++ ] = ( byte ) ( offset > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) offset ; break ; case VerificationTypeInfo . ITEM_OBJECT : int indexForType = this . constantPool . literalIndexForType ( info . constantPoolName ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( indexForType > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) indexForType ; } } numberOfLocalEntries ++ ; } numberOfEntries ++ ; } if ( localContentsOffset + <NUM_LIT:4> >= this . contents . length ) { resizeContents ( <NUM_LIT:4> ) ; } this . contents [ numberOfLocalOffset ++ ] = ( byte ) ( numberOfEntries > > <NUM_LIT:8> ) ; this . contents [ numberOfLocalOffset ] = ( byte ) numberOfEntries ; int numberOfStackItems = currentFrame . numberOfStackItems ; this . contents [ localContentsOffset ++ ] = ( byte ) ( numberOfStackItems > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) numberOfStackItems ; for ( int i = <NUM_LIT:0> ; i < numberOfStackItems ; i ++ ) { if ( localContentsOffset + <NUM_LIT:3> >= this . contents . length ) { resizeContents ( <NUM_LIT:3> ) ; } VerificationTypeInfo info = currentFrame . stackItems [ i ] ; if ( info == null ) { this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_TOP ; } else { switch ( info . id ( ) ) { case T_boolean : case T_byte : case T_char : case T_int : case T_short : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_INTEGER ; break ; case T_float : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_FLOAT ; break ; case T_long : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_LONG ; break ; case T_double : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_DOUBLE ; break ; case T_null : this . contents [ localContentsOffset ++ ] = ( byte ) VerificationTypeInfo . ITEM_NULL ; break ; default : this . contents [ localContentsOffset ++ ] = ( byte ) info . tag ; switch ( info . tag ) { case VerificationTypeInfo . ITEM_UNINITIALIZED : int offset = info . offset ; this . contents [ localContentsOffset ++ ] = ( byte ) ( offset > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) offset ; break ; case VerificationTypeInfo . ITEM_OBJECT : int indexForType = this . constantPool . literalIndexForType ( info . constantPoolName ( ) ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( indexForType > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) indexForType ; } } } } } } numberOfFrames -- ; if ( numberOfFrames != <NUM_LIT:0> ) { this . contents [ numberOfFramesOffset ++ ] = ( byte ) ( numberOfFrames > > <NUM_LIT:8> ) ; this . contents [ numberOfFramesOffset ] = ( byte ) numberOfFrames ; int attributeLength = localContentsOffset - stackMapTableAttributeLengthOffset - <NUM_LIT:4> ; this . contents [ stackMapTableAttributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:24> ) ; this . contents [ stackMapTableAttributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:16> ) ; this . contents [ stackMapTableAttributeLengthOffset ++ ] = ( byte ) ( attributeLength > > <NUM_LIT:8> ) ; this . contents [ stackMapTableAttributeLengthOffset ] = ( byte ) attributeLength ; attributesNumber ++ ; } else { localContentsOffset = stackMapTableAttributeOffset ; } } } this . contentsOffset = localContentsOffset ; return attributesNumber ; } private int generateSyntheticAttribute ( ) { int localContentsOffset = this . contentsOffset ; if ( localContentsOffset + <NUM_LIT:6> >= this . contents . length ) { resizeContents ( <NUM_LIT:6> ) ; } int syntheticAttributeNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . SyntheticName ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( syntheticAttributeNameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) syntheticAttributeNameIndex ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contentsOffset = localContentsOffset ; return <NUM_LIT:1> ; } private int generateVarargsAttribute ( ) { int localContentsOffset = this . contentsOffset ; if ( localContentsOffset + <NUM_LIT:6> >= this . contents . length ) { resizeContents ( <NUM_LIT:6> ) ; } int varargsAttributeNameIndex = this . constantPool . literalIndex ( AttributeNamesConstants . VarargsName ) ; this . contents [ localContentsOffset ++ ] = ( byte ) ( varargsAttributeNameIndex > > <NUM_LIT:8> ) ; this . contents [ localContentsOffset ++ ] = ( byte ) varargsAttributeNameIndex ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contents [ localContentsOffset ++ ] = <NUM_LIT:0> ; this . contentsOffset = localContentsOffset ; return <NUM_LIT:1> ; } public byte [ ] getBytes ( ) { if ( this . bytes == null ) { this . bytes = new byte [ this . headerOffset + this . contentsOffset ] ; System . arraycopy ( this . header , <NUM_LIT:0> , this . bytes , <NUM_LIT:0> , this . headerOffset ) ; System . arraycopy ( this . contents , <NUM_LIT:0> , this . bytes , this . headerOffset , this . contentsOffset ) ; } return this . bytes ; } public char [ ] [ ] getCompoundName ( ) { return CharOperation . splitOn ( '<CHAR_LIT:/>' , fileName ( ) ) ; } private int getParametersCount ( char [ ] methodSignature ) { int i = CharOperation . indexOf ( '<CHAR_LIT:(>' , methodSignature ) ; i ++ ; char currentCharacter = methodSignature [ i ] ; if ( currentCharacter == '<CHAR_LIT:)>' ) { return <NUM_LIT:0> ; } int result = <NUM_LIT:0> ; while ( true ) { currentCharacter = methodSignature [ i ] ; if ( currentCharacter == '<CHAR_LIT:)>' ) { return result ; } switch ( currentCharacter ) { case '<CHAR_LIT:[>' : int scanType = scanType ( methodSignature , i + <NUM_LIT:1> ) ; result ++ ; i = scanType + <NUM_LIT:1> ; break ; case '<CHAR_LIT>' : scanType = CharOperation . indexOf ( '<CHAR_LIT:;>' , methodSignature , i + <NUM_LIT:1> ) ; result ++ ; i = scanType + <NUM_LIT:1> ; break ; case '<CHAR_LIT:Z>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : result ++ ; i ++ ; break ; default : throw new IllegalArgumentException ( "<STR_LIT>" + currentCharacter ) ; } } } private char [ ] getReturnType ( char [ ] methodSignature ) { int paren = CharOperation . lastIndexOf ( '<CHAR_LIT:)>' , methodSignature ) ; return CharOperation . subarray ( methodSignature , paren + <NUM_LIT:1> , methodSignature . length ) ; } private final int i4At ( byte [ ] reference , int relativeOffset , int structOffset ) { int position = relativeOffset + structOffset ; return ( ( reference [ position ++ ] & <NUM_LIT> ) << <NUM_LIT:24> ) + ( ( reference [ position ++ ] & <NUM_LIT> ) << <NUM_LIT:16> ) + ( ( reference [ position ++ ] & <NUM_LIT> ) << <NUM_LIT:8> ) + ( reference [ position ] & <NUM_LIT> ) ; } protected void initByteArrays ( ) { int members = this . referenceBinding . methods ( ) . length + this . referenceBinding . fields ( ) . length ; this . header = new byte [ INITIAL_HEADER_SIZE ] ; this . contents = new byte [ members < <NUM_LIT:15> ? INITIAL_CONTENTS_SIZE : INITIAL_HEADER_SIZE ] ; } public void initialize ( SourceTypeBinding aType , ClassFile parentClassFile , boolean createProblemType ) { this . header [ this . headerOffset ++ ] = ( byte ) ( <NUM_LIT> > > <NUM_LIT:24> ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( <NUM_LIT> > > <NUM_LIT:16> ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( <NUM_LIT> > > <NUM_LIT:8> ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( <NUM_LIT> > > <NUM_LIT:0> ) ; long targetVersion = this . targetJDK ; this . header [ this . headerOffset ++ ] = ( byte ) ( targetVersion > > <NUM_LIT:8> ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( targetVersion > > <NUM_LIT:0> ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( targetVersion > > <NUM_LIT:24> ) ; this . header [ this . headerOffset ++ ] = ( byte ) ( targetVersion > > <NUM_LIT:16> ) ; this . constantPoolOffset = this . headerOffset ; this . headerOffset += <NUM_LIT:2> ; this . constantPool . initialize ( this ) ; int accessFlags = aType . getAccessFlags ( ) ; if ( aType . isPrivate ( ) ) { accessFlags &= ~ ClassFileConstants . AccPublic ; } if ( aType . isProtected ( ) ) { accessFlags |= ClassFileConstants . AccPublic ; } accessFlags &= ~ ( ClassFileConstants . AccStrictfp | ClassFileConstants . AccProtected | ClassFileConstants . AccPrivate | ClassFileConstants . AccStatic | ClassFileConstants . AccSynchronized | ClassFileConstants . AccNative ) ; if ( ! aType . isInterface ( ) ) { accessFlags |= ClassFileConstants . AccSuper ; } if ( aType . isAnonymousType ( ) ) { accessFlags &= ~ ClassFileConstants . AccFinal ; } int finalAbstract = ClassFileConstants . AccFinal | ClassFileConstants . AccAbstract ; if ( ( accessFlags & finalAbstract ) == finalAbstract ) { accessFlags &= ~ finalAbstract ; } this . enclosingClassFile = parentClassFile ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( accessFlags > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) accessFlags ; int classNameIndex = this . constantPool . literalIndexForType ( aType ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( classNameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) classNameIndex ; int superclassNameIndex ; if ( aType . isInterface ( ) ) { superclassNameIndex = this . constantPool . literalIndexForType ( ConstantPool . JavaLangObjectConstantPoolName ) ; } else { if ( aType . superclass != null ) { if ( ( aType . superclass . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) { superclassNameIndex = this . constantPool . literalIndexForType ( ConstantPool . JavaLangObjectConstantPoolName ) ; } else { superclassNameIndex = this . constantPool . literalIndexForType ( aType . superclass ) ; } } else { superclassNameIndex = <NUM_LIT:0> ; } } this . contents [ this . contentsOffset ++ ] = ( byte ) ( superclassNameIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) superclassNameIndex ; ReferenceBinding [ ] superInterfacesBinding = aType . superInterfaces ( ) ; int interfacesCount = superInterfacesBinding . length ; int interfacesCountPosition = this . contentsOffset ; this . contentsOffset += <NUM_LIT:2> ; int interfaceCounter = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < interfacesCount ; i ++ ) { ReferenceBinding binding = superInterfacesBinding [ i ] ; if ( ( binding . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ) { continue ; } interfaceCounter ++ ; int interfaceIndex = this . constantPool . literalIndexForType ( binding ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) ( interfaceIndex > > <NUM_LIT:8> ) ; this . contents [ this . contentsOffset ++ ] = ( byte ) interfaceIndex ; } this . contents [ interfacesCountPosition ++ ] = ( byte ) ( interfaceCounter > > <NUM_LIT:8> ) ; this . contents [ interfacesCountPosition ] = ( byte ) interfaceCounter ; this . creatingProblemType = createProblemType ; this . codeStream . maxFieldCount = aType . scope . outerMostClassScope ( ) . referenceType ( ) . maxFieldCount ; } private void initializeDefaultLocals ( StackMapFrame frame , MethodBinding methodBinding , int maxLocals , int codeLength ) { if ( maxLocals != <NUM_LIT:0> ) { int resolvedPosition = <NUM_LIT:0> ; final boolean isConstructor = methodBinding . isConstructor ( ) ; if ( isConstructor || ! methodBinding . isStatic ( ) ) { LocalVariableBinding localVariableBinding = new LocalVariableBinding ( ConstantPool . This , methodBinding . declaringClass , <NUM_LIT:0> , false ) ; localVariableBinding . resolvedPosition = <NUM_LIT:0> ; this . codeStream . record ( localVariableBinding ) ; localVariableBinding . recordInitializationStartPC ( <NUM_LIT:0> ) ; localVariableBinding . recordInitializationEndPC ( codeLength ) ; frame . putLocal ( resolvedPosition , new VerificationTypeInfo ( isConstructor ? VerificationTypeInfo . ITEM_UNINITIALIZED_THIS : VerificationTypeInfo . ITEM_OBJECT , methodBinding . declaringClass ) ) ; resolvedPosition ++ ; } if ( isConstructor ) { if ( methodBinding . declaringClass . isEnum ( ) ) { LocalVariableBinding localVariableBinding = new LocalVariableBinding ( "<STR_LIT>" . toCharArray ( ) , this . referenceBinding . scope . getJavaLangString ( ) , <NUM_LIT:0> , false ) ; localVariableBinding . resolvedPosition = resolvedPosition ; this . codeStream . record ( localVariableBinding ) ; localVariableBinding . recordInitializationStartPC ( <NUM_LIT:0> ) ; localVariableBinding . recordInitializationEndPC ( codeLength ) ; frame . putLocal ( resolvedPosition , new VerificationTypeInfo ( TypeIds . T_JavaLangString , ConstantPool . JavaLangStringConstantPoolName ) ) ; resolvedPosition ++ ; localVariableBinding = new LocalVariableBinding ( "<STR_LIT>" . toCharArray ( ) , TypeBinding . INT , <NUM_LIT:0> , false ) ; localVariableBinding . resolvedPosition = resolvedPosition ; this . codeStream . record ( localVariableBinding ) ; localVariableBinding . recordInitializationStartPC ( <NUM_LIT:0> ) ; localVariableBinding . recordInitializationEndPC ( codeLength ) ; frame . putLocal ( resolvedPosition , new VerificationTypeInfo ( TypeBinding . INT ) ) ; resolvedPosition ++ ; } if ( methodBinding . declaringClass . isNestedType ( ) ) { ReferenceBinding enclosingInstanceTypes [ ] ; if ( ( enclosingInstanceTypes = methodBinding . declaringClass . syntheticEnclosingInstanceTypes ( ) ) != null ) { for ( int i = <NUM_LIT:0> , max = enclosingInstanceTypes . length ; i < max ; i ++ ) { LocalVariableBinding localVariableBinding = new LocalVariableBinding ( ( "<STR_LIT>" + i ) . toCharArray ( ) , enclosingInstanceTypes [ i ] , <NUM_LIT:0> , false ) ; localVariableBinding . resolvedPosition = resolvedPosition ; this . codeStream . record ( localVariableBinding ) ; localVariableBinding . recordInitializationStartPC ( <NUM_LIT:0> ) ; localVariableBinding . recordInitializationEndPC ( codeLength ) ; frame . putLocal ( resolvedPosition , new VerificationTypeInfo ( enclosingInstanceTypes [ i ] ) ) ; resolvedPosition ++ ; } } TypeBinding [ ] arguments ; if ( ( arguments = methodBinding . parameters ) != null ) { for ( int i = <NUM_LIT:0> , max = arguments . length ; i < max ; i ++ ) { final TypeBinding typeBinding = arguments [ i ] ; frame . putLocal ( resolvedPosition , new VerificationTypeInfo ( typeBinding ) ) ; switch ( typeBinding . id ) { case TypeIds . T_double : case TypeIds . T_long : resolvedPosition += <NUM_LIT:2> ; break ; default : resolvedPosition ++ ; } } } SyntheticArgumentBinding syntheticArguments [ ] ; if ( ( syntheticArguments = methodBinding . declaringClass . syntheticOuterLocalVariables ( ) ) != null ) { for ( int i = <NUM_LIT:0> , max = syntheticArguments . length ; i < max ; i ++ ) { final TypeBinding typeBinding = syntheticArguments [ i ] . type ; LocalVariableBinding localVariableBinding = new LocalVariableBinding ( ( "<STR_LIT>" + i ) . toCharArray ( ) , typeBinding , <NUM_LIT:0> , false ) ; localVariableBinding . resolvedPosition = resolvedPosition ; this . codeStream . record ( localVariableBinding ) ; localVariableBinding . recordInitializationStartPC ( <NUM_LIT:0> ) ; localVariableBinding . recordInitializationEndPC ( codeLength ) ; frame . putLocal ( resolvedPosition , new VerificationTypeInfo ( typeBinding ) ) ; switch ( typeBinding . id ) { case TypeIds . T_double : case TypeIds . T_long : resolvedPosition += <NUM_LIT:2> ; break ; default : resolvedPosition ++ ; } } } } else { TypeBinding [ ] arguments ; if ( ( arguments = methodBinding . parameters ) != null ) { for ( int i = <NUM_LIT:0> , max = arguments . length ; i < max ; i ++ ) { final TypeBinding typeBinding = arguments [ i ] ; frame . putLocal ( resolvedPosition , new VerificationTypeInfo ( typeBinding ) ) ; switch ( typeBinding . id ) { case TypeIds . T_double : case TypeIds . T_long : resolvedPosition += <NUM_LIT:2> ; break ; default : resolvedPosition ++ ; } } } } } else { TypeBinding [ ] arguments ; if ( ( arguments = methodBinding . parameters ) != null ) { for ( int i = <NUM_LIT:0> , max = arguments . length ; i < max ; i ++ ) { final TypeBinding typeBinding = arguments [ i ] ; frame . putLocal ( resolvedPosition , new VerificationTypeInfo ( typeBinding ) ) ; switch ( typeBinding . id ) { case TypeIds . T_double : case TypeIds . T_long : resolvedPosition += <NUM_LIT:2> ; break ; default : resolvedPosition ++ ; } } } } } } private void initializeLocals ( boolean isStatic , int currentPC , StackMapFrame currentFrame ) { VerificationTypeInfo [ ] locals = currentFrame . locals ; int localsLength = locals . length ; int i = <NUM_LIT:0> ; if ( ! isStatic ) { i = <NUM_LIT:1> ; } for ( ; i < localsLength ; i ++ ) { locals [ i ] = null ; } i = <NUM_LIT:0> ; locals : for ( int max = this . codeStream . allLocalsCounter ; i < max ; i ++ ) { LocalVariableBinding localVariable = this . codeStream . locals [ i ] ; if ( localVariable == null ) continue ; int resolvedPosition = localVariable . resolvedPosition ; final TypeBinding localVariableTypeBinding = localVariable . type ; inits : for ( int j = <NUM_LIT:0> ; j < localVariable . initializationCount ; j ++ ) { int startPC = localVariable . initializationPCs [ j << <NUM_LIT:1> ] ; int endPC = localVariable . initializationPCs [ ( j << <NUM_LIT:1> ) + <NUM_LIT:1> ] ; if ( currentPC < startPC ) { continue inits ; } else if ( currentPC < endPC ) { if ( currentFrame . locals [ resolvedPosition ] == null ) { currentFrame . locals [ resolvedPosition ] = new VerificationTypeInfo ( localVariableTypeBinding ) ; } continue locals ; } } } } public ClassFile outerMostEnclosingClassFile ( ) { ClassFile current = this ; while ( current . enclosingClassFile != null ) current = current . enclosingClassFile ; return current ; } public void recordInnerClasses ( TypeBinding binding ) { if ( this . innerClassesBindings == null ) { this . innerClassesBindings = new HashSet ( INNER_CLASSES_SIZE ) ; } ReferenceBinding innerClass = ( ReferenceBinding ) binding ; this . innerClassesBindings . add ( innerClass . erasure ( ) ) ; ReferenceBinding enclosingType = innerClass . enclosingType ( ) ; while ( enclosingType != null && enclosingType . isNestedType ( ) ) { this . innerClassesBindings . add ( enclosingType . erasure ( ) ) ; enclosingType = enclosingType . enclosingType ( ) ; } } public void reset ( SourceTypeBinding typeBinding ) { final CompilerOptions options = typeBinding . scope . compilerOptions ( ) ; this . referenceBinding = typeBinding ; this . isNestedType = typeBinding . isNestedType ( ) ; this . targetJDK = options . targetJDK ; this . produceAttributes = options . produceDebugAttributes ; if ( this . targetJDK >= ClassFileConstants . JDK1_6 ) { this . produceAttributes |= ClassFileConstants . ATTR_STACK_MAP_TABLE ; } else if ( this . targetJDK == ClassFileConstants . CLDC_1_1 ) { this . targetJDK = ClassFileConstants . JDK1_1 ; this . produceAttributes |= ClassFileConstants . ATTR_STACK_MAP ; } this . bytes = null ; this . constantPool . reset ( ) ; this . codeStream . reset ( this ) ; this . constantPoolOffset = <NUM_LIT:0> ; this . contentsOffset = <NUM_LIT:0> ; this . creatingProblemType = false ; this . enclosingClassFile = null ; this . headerOffset = <NUM_LIT:0> ; this . methodCount = <NUM_LIT:0> ; this . methodCountOffset = <NUM_LIT:0> ; if ( this . innerClassesBindings != null ) { this . innerClassesBindings . clear ( ) ; } this . missingTypes = null ; this . visitedTypes = null ; } private final void resizeContents ( int minimalSize ) { int length = this . contents . length ; int toAdd = length ; if ( toAdd < minimalSize ) toAdd = minimalSize ; System . arraycopy ( this . contents , <NUM_LIT:0> , this . contents = new byte [ length + toAdd ] , <NUM_LIT:0> , length ) ; } private VerificationTypeInfo retrieveLocal ( int currentPC , int resolvedPosition ) { for ( int i = <NUM_LIT:0> , max = this . codeStream . allLocalsCounter ; i < max ; i ++ ) { LocalVariableBinding localVariable = this . codeStream . locals [ i ] ; if ( localVariable == null ) continue ; if ( resolvedPosition == localVariable . resolvedPosition ) { inits : for ( int j = <NUM_LIT:0> ; j < localVariable . initializationCount ; j ++ ) { int startPC = localVariable . initializationPCs [ j << <NUM_LIT:1> ] ; int endPC = localVariable . initializationPCs [ ( j << <NUM_LIT:1> ) + <NUM_LIT:1> ] ; if ( currentPC < startPC ) { continue inits ; } else if ( currentPC < endPC ) { return new VerificationTypeInfo ( localVariable . type ) ; } } } } return null ; } private int scanType ( char [ ] methodSignature , int index ) { switch ( methodSignature [ index ] ) { case '<CHAR_LIT:[>' : return scanType ( methodSignature , index + <NUM_LIT:1> ) ; case '<CHAR_LIT>' : return CharOperation . indexOf ( '<CHAR_LIT:;>' , methodSignature , index + <NUM_LIT:1> ) ; case '<CHAR_LIT:Z>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : return index ; default : throw new IllegalArgumentException ( ) ; } } public void setForMethodInfos ( ) { this . methodCountOffset = this . contentsOffset ; this . contentsOffset += <NUM_LIT:2> ; } public void traverse ( MethodBinding methodBinding , int maxLocals , byte [ ] bytecodes , int codeOffset , int codeLength , ArrayList frames , boolean isClinit ) { StackMapFrameCodeStream stackMapFrameCodeStream = ( StackMapFrameCodeStream ) this . codeStream ; int [ ] framePositions = stackMapFrameCodeStream . getFramePositions ( ) ; int pc = codeOffset ; int index ; int [ ] constantPoolOffsets = this . constantPool . offsets ; byte [ ] poolContents = this . constantPool . poolContent ; int indexInFramePositions = <NUM_LIT:0> ; int framePositionsLength = framePositions . length ; int currentFramePosition = framePositions [ <NUM_LIT:0> ] ; int indexInStackDepthMarkers = <NUM_LIT:0> ; StackDepthMarker [ ] stackDepthMarkers = stackMapFrameCodeStream . getStackDepthMarkers ( ) ; int stackDepthMarkersLength = stackDepthMarkers == null ? <NUM_LIT:0> : stackDepthMarkers . length ; boolean hasStackDepthMarkers = stackDepthMarkersLength != <NUM_LIT:0> ; StackDepthMarker stackDepthMarker = null ; if ( hasStackDepthMarkers ) { stackDepthMarker = stackDepthMarkers [ <NUM_LIT:0> ] ; } int indexInStackMarkers = <NUM_LIT:0> ; StackMarker [ ] stackMarkers = stackMapFrameCodeStream . getStackMarkers ( ) ; int stackMarkersLength = stackMarkers == null ? <NUM_LIT:0> : stackMarkers . length ; boolean hasStackMarkers = stackMarkersLength != <NUM_LIT:0> ; StackMarker stackMarker = null ; if ( hasStackMarkers ) { stackMarker = stackMarkers [ <NUM_LIT:0> ] ; } int indexInExceptionMarkers = <NUM_LIT:0> ; ExceptionMarker [ ] exceptionMarkers = stackMapFrameCodeStream . getExceptionMarkers ( ) ; int exceptionsMarkersLength = exceptionMarkers == null ? <NUM_LIT:0> : exceptionMarkers . length ; boolean hasExceptionMarkers = exceptionsMarkersLength != <NUM_LIT:0> ; ExceptionMarker exceptionMarker = null ; if ( hasExceptionMarkers ) { exceptionMarker = exceptionMarkers [ <NUM_LIT:0> ] ; } StackMapFrame frame = new StackMapFrame ( maxLocals ) ; if ( ! isClinit ) { initializeDefaultLocals ( frame , methodBinding , maxLocals , codeLength ) ; } frame . pc = - <NUM_LIT:1> ; frames . add ( frame . duplicate ( ) ) ; while ( true ) { int currentPC = pc - codeOffset ; if ( hasStackMarkers && stackMarker . pc == currentPC ) { VerificationTypeInfo [ ] infos = frame . stackItems ; VerificationTypeInfo [ ] tempInfos = new VerificationTypeInfo [ frame . numberOfStackItems ] ; System . arraycopy ( infos , <NUM_LIT:0> , tempInfos , <NUM_LIT:0> , frame . numberOfStackItems ) ; stackMarker . setInfos ( tempInfos ) ; } else if ( hasStackMarkers && stackMarker . destinationPC == currentPC ) { VerificationTypeInfo [ ] infos = stackMarker . infos ; frame . stackItems = infos ; frame . numberOfStackItems = infos . length ; indexInStackMarkers ++ ; if ( indexInStackMarkers < stackMarkersLength ) { stackMarker = stackMarkers [ indexInStackMarkers ] ; } else { hasStackMarkers = false ; } } if ( hasStackDepthMarkers && stackDepthMarker . pc == currentPC ) { TypeBinding typeBinding = stackDepthMarker . typeBinding ; if ( typeBinding != null ) { if ( stackDepthMarker . delta > <NUM_LIT:0> ) { frame . addStackItem ( new VerificationTypeInfo ( typeBinding ) ) ; } else { frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( typeBinding ) ; } } else { frame . numberOfStackItems -- ; } indexInStackDepthMarkers ++ ; if ( indexInStackDepthMarkers < stackDepthMarkersLength ) { stackDepthMarker = stackDepthMarkers [ indexInStackDepthMarkers ] ; } else { hasStackDepthMarkers = false ; } } if ( hasExceptionMarkers && exceptionMarker . pc == currentPC ) { frame . numberOfStackItems = <NUM_LIT:0> ; frame . addStackItem ( new VerificationTypeInfo ( <NUM_LIT:0> , VerificationTypeInfo . ITEM_OBJECT , exceptionMarker . constantPoolName ) ) ; indexInExceptionMarkers ++ ; if ( indexInExceptionMarkers < exceptionsMarkersLength ) { exceptionMarker = exceptionMarkers [ indexInExceptionMarkers ] ; } else { hasExceptionMarkers = false ; } } if ( currentFramePosition < currentPC ) { do { indexInFramePositions ++ ; if ( indexInFramePositions < framePositionsLength ) { currentFramePosition = framePositions [ indexInFramePositions ] ; } else { return ; } } while ( currentFramePosition < currentPC ) ; } if ( currentFramePosition == currentPC ) { StackMapFrame currentFrame = frame . duplicate ( ) ; currentFrame . pc = currentPC ; initializeLocals ( isClinit ? true : methodBinding . isStatic ( ) , currentPC , currentFrame ) ; frames . add ( currentFrame ) ; indexInFramePositions ++ ; if ( indexInFramePositions < framePositionsLength ) { currentFramePosition = framePositions [ indexInFramePositions ] ; } else { return ; } } byte opcode = ( byte ) u1At ( bytecodes , <NUM_LIT:0> , pc ) ; switch ( opcode ) { case Opcodes . OPC_nop : pc ++ ; break ; case Opcodes . OPC_aconst_null : frame . addStackItem ( TypeBinding . NULL ) ; pc ++ ; break ; case Opcodes . OPC_iconst_m1 : case Opcodes . OPC_iconst_0 : case Opcodes . OPC_iconst_1 : case Opcodes . OPC_iconst_2 : case Opcodes . OPC_iconst_3 : case Opcodes . OPC_iconst_4 : case Opcodes . OPC_iconst_5 : frame . addStackItem ( TypeBinding . INT ) ; pc ++ ; break ; case Opcodes . OPC_lconst_0 : case Opcodes . OPC_lconst_1 : frame . addStackItem ( TypeBinding . LONG ) ; pc ++ ; break ; case Opcodes . OPC_fconst_0 : case Opcodes . OPC_fconst_1 : case Opcodes . OPC_fconst_2 : frame . addStackItem ( TypeBinding . FLOAT ) ; pc ++ ; break ; case Opcodes . OPC_dconst_0 : case Opcodes . OPC_dconst_1 : frame . addStackItem ( TypeBinding . DOUBLE ) ; pc ++ ; break ; case Opcodes . OPC_bipush : frame . addStackItem ( TypeBinding . BYTE ) ; pc += <NUM_LIT:2> ; break ; case Opcodes . OPC_sipush : frame . addStackItem ( TypeBinding . SHORT ) ; pc += <NUM_LIT:3> ; break ; case Opcodes . OPC_ldc : index = u1At ( bytecodes , <NUM_LIT:1> , pc ) ; switch ( u1At ( poolContents , <NUM_LIT:0> , constantPoolOffsets [ index ] ) ) { case ClassFileConstants . StringTag : frame . addStackItem ( new VerificationTypeInfo ( TypeIds . T_JavaLangString , ConstantPool . JavaLangStringConstantPoolName ) ) ; break ; case ClassFileConstants . IntegerTag : frame . addStackItem ( TypeBinding . INT ) ; break ; case ClassFileConstants . FloatTag : frame . addStackItem ( TypeBinding . FLOAT ) ; break ; case ClassFileConstants . ClassTag : frame . addStackItem ( new VerificationTypeInfo ( TypeIds . T_JavaLangClass , ConstantPool . JavaLangClassConstantPoolName ) ) ; } pc += <NUM_LIT:2> ; break ; case Opcodes . OPC_ldc_w : index = u2At ( bytecodes , <NUM_LIT:1> , pc ) ; switch ( u1At ( poolContents , <NUM_LIT:0> , constantPoolOffsets [ index ] ) ) { case ClassFileConstants . StringTag : frame . addStackItem ( new VerificationTypeInfo ( TypeIds . T_JavaLangString , ConstantPool . JavaLangStringConstantPoolName ) ) ; break ; case ClassFileConstants . IntegerTag : frame . addStackItem ( TypeBinding . INT ) ; break ; case ClassFileConstants . FloatTag : frame . addStackItem ( TypeBinding . FLOAT ) ; break ; case ClassFileConstants . ClassTag : frame . addStackItem ( new VerificationTypeInfo ( TypeIds . T_JavaLangClass , ConstantPool . JavaLangClassConstantPoolName ) ) ; } pc += <NUM_LIT:3> ; break ; case Opcodes . OPC_ldc2_w : index = u2At ( bytecodes , <NUM_LIT:1> , pc ) ; switch ( u1At ( poolContents , <NUM_LIT:0> , constantPoolOffsets [ index ] ) ) { case ClassFileConstants . DoubleTag : frame . addStackItem ( TypeBinding . DOUBLE ) ; break ; case ClassFileConstants . LongTag : frame . addStackItem ( TypeBinding . LONG ) ; break ; } pc += <NUM_LIT:3> ; break ; case Opcodes . OPC_iload : frame . addStackItem ( TypeBinding . INT ) ; pc += <NUM_LIT:2> ; break ; case Opcodes . OPC_lload : frame . addStackItem ( TypeBinding . LONG ) ; pc += <NUM_LIT:2> ; break ; case Opcodes . OPC_fload : frame . addStackItem ( TypeBinding . FLOAT ) ; pc += <NUM_LIT:2> ; break ; case Opcodes . OPC_dload : frame . addStackItem ( TypeBinding . DOUBLE ) ; pc += <NUM_LIT:2> ; break ; case Opcodes . OPC_aload : index = u1At ( bytecodes , <NUM_LIT:1> , pc ) ; VerificationTypeInfo localsN = retrieveLocal ( currentPC , index ) ; frame . addStackItem ( localsN ) ; pc += <NUM_LIT:2> ; break ; case Opcodes . OPC_iload_0 : case Opcodes . OPC_iload_1 : case Opcodes . OPC_iload_2 : case Opcodes . OPC_iload_3 : frame . addStackItem ( TypeBinding . INT ) ; pc ++ ; break ; case Opcodes . OPC_lload_0 : case Opcodes . OPC_lload_1 : case Opcodes . OPC_lload_2 : case Opcodes . OPC_lload_3 : frame . addStackItem ( TypeBinding . LONG ) ; pc ++ ; break ; case Opcodes . OPC_fload_0 : case Opcodes . OPC_fload_1 : case Opcodes . OPC_fload_2 : case Opcodes . OPC_fload_3 : frame . addStackItem ( TypeBinding . FLOAT ) ; pc ++ ; break ; case Opcodes . OPC_dload_0 : case Opcodes . OPC_dload_1 : case Opcodes . OPC_dload_2 : case Opcodes . OPC_dload_3 : frame . addStackItem ( TypeBinding . DOUBLE ) ; pc ++ ; break ; case Opcodes . OPC_aload_0 : VerificationTypeInfo locals0 = frame . locals [ <NUM_LIT:0> ] ; if ( locals0 == null || locals0 . tag != VerificationTypeInfo . ITEM_UNINITIALIZED_THIS ) { locals0 = retrieveLocal ( currentPC , <NUM_LIT:0> ) ; } frame . addStackItem ( locals0 ) ; pc ++ ; break ; case Opcodes . OPC_aload_1 : VerificationTypeInfo locals1 = retrieveLocal ( currentPC , <NUM_LIT:1> ) ; frame . addStackItem ( locals1 ) ; pc ++ ; break ; case Opcodes . OPC_aload_2 : VerificationTypeInfo locals2 = retrieveLocal ( currentPC , <NUM_LIT:2> ) ; frame . addStackItem ( locals2 ) ; pc ++ ; break ; case Opcodes . OPC_aload_3 : VerificationTypeInfo locals3 = retrieveLocal ( currentPC , <NUM_LIT:3> ) ; frame . addStackItem ( locals3 ) ; pc ++ ; break ; case Opcodes . OPC_iaload : frame . numberOfStackItems -= <NUM_LIT:2> ; frame . addStackItem ( TypeBinding . INT ) ; pc ++ ; break ; case Opcodes . OPC_laload : frame . numberOfStackItems -= <NUM_LIT:2> ; frame . addStackItem ( TypeBinding . LONG ) ; pc ++ ; break ; case Opcodes . OPC_faload : frame . numberOfStackItems -= <NUM_LIT:2> ; frame . addStackItem ( TypeBinding . FLOAT ) ; pc ++ ; break ; case Opcodes . OPC_daload : frame . numberOfStackItems -= <NUM_LIT:2> ; frame . addStackItem ( TypeBinding . DOUBLE ) ; pc ++ ; break ; case Opcodes . OPC_aaload : frame . numberOfStackItems -- ; frame . replaceWithElementType ( ) ; pc ++ ; break ; case Opcodes . OPC_baload : frame . numberOfStackItems -= <NUM_LIT:2> ; frame . addStackItem ( TypeBinding . BYTE ) ; pc ++ ; break ; case Opcodes . OPC_caload : frame . numberOfStackItems -= <NUM_LIT:2> ; frame . addStackItem ( TypeBinding . CHAR ) ; pc ++ ; break ; case Opcodes . OPC_saload : frame . numberOfStackItems -= <NUM_LIT:2> ; frame . addStackItem ( TypeBinding . SHORT ) ; pc ++ ; break ; case Opcodes . OPC_istore : case Opcodes . OPC_lstore : case Opcodes . OPC_fstore : case Opcodes . OPC_dstore : frame . numberOfStackItems -- ; pc += <NUM_LIT:2> ; break ; case Opcodes . OPC_astore : index = u1At ( bytecodes , <NUM_LIT:1> , pc ) ; frame . numberOfStackItems -- ; pc += <NUM_LIT:2> ; break ; case Opcodes . OPC_astore_0 : frame . locals [ <NUM_LIT:0> ] = frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] ; frame . numberOfStackItems -- ; pc ++ ; break ; case Opcodes . OPC_astore_1 : case Opcodes . OPC_astore_2 : case Opcodes . OPC_astore_3 : case Opcodes . OPC_istore_0 : case Opcodes . OPC_istore_1 : case Opcodes . OPC_istore_2 : case Opcodes . OPC_istore_3 : case Opcodes . OPC_lstore_0 : case Opcodes . OPC_lstore_1 : case Opcodes . OPC_lstore_2 : case Opcodes . OPC_lstore_3 : case Opcodes . OPC_fstore_0 : case Opcodes . OPC_fstore_1 : case Opcodes . OPC_fstore_2 : case Opcodes . OPC_fstore_3 : case Opcodes . OPC_dstore_0 : case Opcodes . OPC_dstore_1 : case Opcodes . OPC_dstore_2 : case Opcodes . OPC_dstore_3 : frame . numberOfStackItems -- ; pc ++ ; break ; case Opcodes . OPC_iastore : case Opcodes . OPC_lastore : case Opcodes . OPC_fastore : case Opcodes . OPC_dastore : case Opcodes . OPC_aastore : case Opcodes . OPC_bastore : case Opcodes . OPC_castore : case Opcodes . OPC_sastore : frame . numberOfStackItems -= <NUM_LIT:3> ; pc ++ ; break ; case Opcodes . OPC_pop : frame . numberOfStackItems -- ; pc ++ ; break ; case Opcodes . OPC_pop2 : int numberOfStackItems = frame . numberOfStackItems ; switch ( frame . stackItems [ numberOfStackItems - <NUM_LIT:1> ] . id ( ) ) { case TypeIds . T_long : case TypeIds . T_double : frame . numberOfStackItems -- ; break ; default : frame . numberOfStackItems -= <NUM_LIT:2> ; } pc ++ ; break ; case Opcodes . OPC_dup : frame . addStackItem ( frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] ) ; pc ++ ; break ; case Opcodes . OPC_dup_x1 : VerificationTypeInfo info = frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] ; frame . numberOfStackItems -- ; VerificationTypeInfo info2 = frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] ; frame . numberOfStackItems -- ; frame . addStackItem ( info ) ; frame . addStackItem ( info2 ) ; frame . addStackItem ( info ) ; pc ++ ; break ; case Opcodes . OPC_dup_x2 : info = frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] ; frame . numberOfStackItems -- ; info2 = frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] ; frame . numberOfStackItems -- ; switch ( info2 . id ( ) ) { case TypeIds . T_long : case TypeIds . T_double : frame . addStackItem ( info ) ; frame . addStackItem ( info2 ) ; frame . addStackItem ( info ) ; break ; default : numberOfStackItems = frame . numberOfStackItems ; VerificationTypeInfo info3 = frame . stackItems [ numberOfStackItems - <NUM_LIT:1> ] ; frame . numberOfStackItems -- ; frame . addStackItem ( info ) ; frame . addStackItem ( info3 ) ; frame . addStackItem ( info2 ) ; frame . addStackItem ( info ) ; } pc ++ ; break ; case Opcodes . OPC_dup2 : info = frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] ; frame . numberOfStackItems -- ; switch ( info . id ( ) ) { case TypeIds . T_double : case TypeIds . T_long : frame . addStackItem ( info ) ; frame . addStackItem ( info ) ; break ; default : info2 = frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] ; frame . numberOfStackItems -- ; frame . addStackItem ( info2 ) ; frame . addStackItem ( info ) ; frame . addStackItem ( info2 ) ; frame . addStackItem ( info ) ; } pc ++ ; break ; case Opcodes . OPC_dup2_x1 : info = frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] ; frame . numberOfStackItems -- ; info2 = frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] ; frame . numberOfStackItems -- ; switch ( info . id ( ) ) { case TypeIds . T_double : case TypeIds . T_long : frame . addStackItem ( info ) ; frame . addStackItem ( info2 ) ; frame . addStackItem ( info ) ; break ; default : VerificationTypeInfo info3 = frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] ; frame . numberOfStackItems -- ; frame . addStackItem ( info2 ) ; frame . addStackItem ( info ) ; frame . addStackItem ( info3 ) ; frame . addStackItem ( info2 ) ; frame . addStackItem ( info ) ; } pc ++ ; break ; case Opcodes . OPC_dup2_x2 : numberOfStackItems = frame . numberOfStackItems ; info = frame . stackItems [ numberOfStackItems - <NUM_LIT:1> ] ; frame . numberOfStackItems -- ; info2 = frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] ; frame . numberOfStackItems -- ; switch ( info . id ( ) ) { case TypeIds . T_long : case TypeIds . T_double : switch ( info2 . id ( ) ) { case TypeIds . T_long : case TypeIds . T_double : frame . addStackItem ( info ) ; frame . addStackItem ( info2 ) ; frame . addStackItem ( info ) ; break ; default : numberOfStackItems = frame . numberOfStackItems ; VerificationTypeInfo info3 = frame . stackItems [ numberOfStackItems - <NUM_LIT:1> ] ; frame . numberOfStackItems -- ; frame . addStackItem ( info ) ; frame . addStackItem ( info3 ) ; frame . addStackItem ( info2 ) ; frame . addStackItem ( info ) ; } break ; default : numberOfStackItems = frame . numberOfStackItems ; VerificationTypeInfo info3 = frame . stackItems [ numberOfStackItems - <NUM_LIT:1> ] ; frame . numberOfStackItems -- ; switch ( info3 . id ( ) ) { case TypeIds . T_long : case TypeIds . T_double : frame . addStackItem ( info2 ) ; frame . addStackItem ( info ) ; frame . addStackItem ( info3 ) ; frame . addStackItem ( info2 ) ; frame . addStackItem ( info ) ; break ; default : numberOfStackItems = frame . numberOfStackItems ; VerificationTypeInfo info4 = frame . stackItems [ numberOfStackItems - <NUM_LIT:1> ] ; frame . numberOfStackItems -- ; frame . addStackItem ( info2 ) ; frame . addStackItem ( info ) ; frame . addStackItem ( info4 ) ; frame . addStackItem ( info3 ) ; frame . addStackItem ( info2 ) ; frame . addStackItem ( info ) ; } } pc ++ ; break ; case Opcodes . OPC_swap : numberOfStackItems = frame . numberOfStackItems ; info = frame . stackItems [ numberOfStackItems - <NUM_LIT:1> ] ; info2 = frame . stackItems [ numberOfStackItems - <NUM_LIT:2> ] ; frame . stackItems [ numberOfStackItems - <NUM_LIT:1> ] = info2 ; frame . stackItems [ numberOfStackItems - <NUM_LIT:2> ] = info ; pc ++ ; break ; case Opcodes . OPC_iadd : case Opcodes . OPC_ladd : case Opcodes . OPC_fadd : case Opcodes . OPC_dadd : case Opcodes . OPC_isub : case Opcodes . OPC_lsub : case Opcodes . OPC_fsub : case Opcodes . OPC_dsub : case Opcodes . OPC_imul : case Opcodes . OPC_lmul : case Opcodes . OPC_fmul : case Opcodes . OPC_dmul : case Opcodes . OPC_idiv : case Opcodes . OPC_ldiv : case Opcodes . OPC_fdiv : case Opcodes . OPC_ddiv : case Opcodes . OPC_irem : case Opcodes . OPC_lrem : case Opcodes . OPC_frem : case Opcodes . OPC_drem : case Opcodes . OPC_ishl : case Opcodes . OPC_lshl : case Opcodes . OPC_ishr : case Opcodes . OPC_lshr : case Opcodes . OPC_iushr : case Opcodes . OPC_lushr : case Opcodes . OPC_iand : case Opcodes . OPC_land : case Opcodes . OPC_ior : case Opcodes . OPC_lor : case Opcodes . OPC_ixor : case Opcodes . OPC_lxor : frame . numberOfStackItems -- ; pc ++ ; break ; case Opcodes . OPC_ineg : case Opcodes . OPC_lneg : case Opcodes . OPC_fneg : case Opcodes . OPC_dneg : pc ++ ; break ; case Opcodes . OPC_iinc : pc += <NUM_LIT:3> ; break ; case Opcodes . OPC_i2l : frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( TypeBinding . LONG ) ; pc ++ ; break ; case Opcodes . OPC_i2f : frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( TypeBinding . FLOAT ) ; pc ++ ; break ; case Opcodes . OPC_i2d : frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( TypeBinding . DOUBLE ) ; pc ++ ; break ; case Opcodes . OPC_l2i : frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( TypeBinding . INT ) ; pc ++ ; break ; case Opcodes . OPC_l2f : frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( TypeBinding . FLOAT ) ; pc ++ ; break ; case Opcodes . OPC_l2d : frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( TypeBinding . DOUBLE ) ; pc ++ ; break ; case Opcodes . OPC_f2i : frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( TypeBinding . INT ) ; pc ++ ; break ; case Opcodes . OPC_f2l : frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( TypeBinding . LONG ) ; pc ++ ; break ; case Opcodes . OPC_f2d : frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( TypeBinding . DOUBLE ) ; pc ++ ; break ; case Opcodes . OPC_d2i : frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( TypeBinding . INT ) ; pc ++ ; break ; case Opcodes . OPC_d2l : frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( TypeBinding . LONG ) ; pc ++ ; break ; case Opcodes . OPC_d2f : frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( TypeBinding . FLOAT ) ; pc ++ ; break ; case Opcodes . OPC_i2b : frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( TypeBinding . BYTE ) ; pc ++ ; break ; case Opcodes . OPC_i2c : frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( TypeBinding . CHAR ) ; pc ++ ; break ; case Opcodes . OPC_i2s : frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( TypeBinding . SHORT ) ; pc ++ ; break ; case Opcodes . OPC_lcmp : case Opcodes . OPC_fcmpl : case Opcodes . OPC_fcmpg : case Opcodes . OPC_dcmpl : case Opcodes . OPC_dcmpg : frame . numberOfStackItems -= <NUM_LIT:2> ; frame . addStackItem ( TypeBinding . INT ) ; pc ++ ; break ; case Opcodes . OPC_ifeq : case Opcodes . OPC_ifne : case Opcodes . OPC_iflt : case Opcodes . OPC_ifge : case Opcodes . OPC_ifgt : case Opcodes . OPC_ifle : frame . numberOfStackItems -- ; pc += <NUM_LIT:3> ; break ; case Opcodes . OPC_if_icmpeq : case Opcodes . OPC_if_icmpne : case Opcodes . OPC_if_icmplt : case Opcodes . OPC_if_icmpge : case Opcodes . OPC_if_icmpgt : case Opcodes . OPC_if_icmple : case Opcodes . OPC_if_acmpeq : case Opcodes . OPC_if_acmpne : frame . numberOfStackItems -= <NUM_LIT:2> ; pc += <NUM_LIT:3> ; break ; case Opcodes . OPC_goto : pc += <NUM_LIT:3> ; break ; case Opcodes . OPC_tableswitch : pc ++ ; while ( ( ( pc - codeOffset ) & <NUM_LIT> ) != <NUM_LIT:0> ) { pc ++ ; } pc += <NUM_LIT:4> ; int low = i4At ( bytecodes , <NUM_LIT:0> , pc ) ; pc += <NUM_LIT:4> ; int high = i4At ( bytecodes , <NUM_LIT:0> , pc ) ; pc += <NUM_LIT:4> ; int length = high - low + <NUM_LIT:1> ; pc += ( length * <NUM_LIT:4> ) ; frame . numberOfStackItems -- ; break ; case Opcodes . OPC_lookupswitch : pc ++ ; while ( ( ( pc - codeOffset ) & <NUM_LIT> ) != <NUM_LIT:0> ) { pc ++ ; } pc += <NUM_LIT:4> ; int npairs = ( int ) u4At ( bytecodes , <NUM_LIT:0> , pc ) ; pc += ( <NUM_LIT:4> + npairs * <NUM_LIT:8> ) ; frame . numberOfStackItems -- ; break ; case Opcodes . OPC_ireturn : case Opcodes . OPC_lreturn : case Opcodes . OPC_freturn : case Opcodes . OPC_dreturn : case Opcodes . OPC_areturn : frame . numberOfStackItems -- ; pc ++ ; break ; case Opcodes . OPC_return : pc ++ ; break ; case Opcodes . OPC_getstatic : index = u2At ( bytecodes , <NUM_LIT:1> , pc ) ; int nameAndTypeIndex = u2At ( poolContents , <NUM_LIT:3> , constantPoolOffsets [ index ] ) ; int utf8index = u2At ( poolContents , <NUM_LIT:3> , constantPoolOffsets [ nameAndTypeIndex ] ) ; char [ ] descriptor = utf8At ( poolContents , constantPoolOffsets [ utf8index ] + <NUM_LIT:3> , u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ utf8index ] ) ) ; if ( descriptor . length == <NUM_LIT:1> ) { switch ( descriptor [ <NUM_LIT:0> ] ) { case '<CHAR_LIT:Z>' : frame . addStackItem ( TypeBinding . BOOLEAN ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . BYTE ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . CHAR ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . DOUBLE ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . FLOAT ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . INT ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . LONG ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . SHORT ) ; break ; } } else if ( descriptor [ <NUM_LIT:0> ] == '<CHAR_LIT:[>' ) { frame . addStackItem ( new VerificationTypeInfo ( <NUM_LIT:0> , descriptor ) ) ; } else { frame . addStackItem ( new VerificationTypeInfo ( <NUM_LIT:0> , CharOperation . subarray ( descriptor , <NUM_LIT:1> , descriptor . length - <NUM_LIT:1> ) ) ) ; } pc += <NUM_LIT:3> ; break ; case Opcodes . OPC_putstatic : frame . numberOfStackItems -- ; pc += <NUM_LIT:3> ; break ; case Opcodes . OPC_getfield : index = u2At ( bytecodes , <NUM_LIT:1> , pc ) ; nameAndTypeIndex = u2At ( poolContents , <NUM_LIT:3> , constantPoolOffsets [ index ] ) ; utf8index = u2At ( poolContents , <NUM_LIT:3> , constantPoolOffsets [ nameAndTypeIndex ] ) ; descriptor = utf8At ( poolContents , constantPoolOffsets [ utf8index ] + <NUM_LIT:3> , u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ utf8index ] ) ) ; frame . numberOfStackItems -- ; if ( descriptor . length == <NUM_LIT:1> ) { switch ( descriptor [ <NUM_LIT:0> ] ) { case '<CHAR_LIT:Z>' : frame . addStackItem ( TypeBinding . BOOLEAN ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . BYTE ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . CHAR ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . DOUBLE ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . FLOAT ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . INT ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . LONG ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . SHORT ) ; break ; } } else if ( descriptor [ <NUM_LIT:0> ] == '<CHAR_LIT:[>' ) { frame . addStackItem ( new VerificationTypeInfo ( <NUM_LIT:0> , descriptor ) ) ; } else { frame . addStackItem ( new VerificationTypeInfo ( <NUM_LIT:0> , CharOperation . subarray ( descriptor , <NUM_LIT:1> , descriptor . length - <NUM_LIT:1> ) ) ) ; } pc += <NUM_LIT:3> ; break ; case Opcodes . OPC_putfield : frame . numberOfStackItems -= <NUM_LIT:2> ; pc += <NUM_LIT:3> ; break ; case Opcodes . OPC_invokevirtual : index = u2At ( bytecodes , <NUM_LIT:1> , pc ) ; nameAndTypeIndex = u2At ( poolContents , <NUM_LIT:3> , constantPoolOffsets [ index ] ) ; utf8index = u2At ( poolContents , <NUM_LIT:3> , constantPoolOffsets [ nameAndTypeIndex ] ) ; descriptor = utf8At ( poolContents , constantPoolOffsets [ utf8index ] + <NUM_LIT:3> , u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ utf8index ] ) ) ; utf8index = u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ nameAndTypeIndex ] ) ; char [ ] name = utf8At ( poolContents , constantPoolOffsets [ utf8index ] + <NUM_LIT:3> , u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ utf8index ] ) ) ; frame . numberOfStackItems -= ( getParametersCount ( descriptor ) + <NUM_LIT:1> ) ; char [ ] returnType = getReturnType ( descriptor ) ; if ( returnType . length == <NUM_LIT:1> ) { switch ( returnType [ <NUM_LIT:0> ] ) { case '<CHAR_LIT:Z>' : frame . addStackItem ( TypeBinding . BOOLEAN ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . BYTE ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . CHAR ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . DOUBLE ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . FLOAT ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . INT ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . LONG ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . SHORT ) ; break ; } } else { if ( returnType [ <NUM_LIT:0> ] == '<CHAR_LIT:[>' ) { frame . addStackItem ( new VerificationTypeInfo ( <NUM_LIT:0> , returnType ) ) ; } else { frame . addStackItem ( new VerificationTypeInfo ( <NUM_LIT:0> , CharOperation . subarray ( returnType , <NUM_LIT:1> , returnType . length - <NUM_LIT:1> ) ) ) ; } } pc += <NUM_LIT:3> ; break ; case Opcodes . OPC_invokespecial : index = u2At ( bytecodes , <NUM_LIT:1> , pc ) ; nameAndTypeIndex = u2At ( poolContents , <NUM_LIT:3> , constantPoolOffsets [ index ] ) ; utf8index = u2At ( poolContents , <NUM_LIT:3> , constantPoolOffsets [ nameAndTypeIndex ] ) ; descriptor = utf8At ( poolContents , constantPoolOffsets [ utf8index ] + <NUM_LIT:3> , u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ utf8index ] ) ) ; utf8index = u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ nameAndTypeIndex ] ) ; name = utf8At ( poolContents , constantPoolOffsets [ utf8index ] + <NUM_LIT:3> , u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ utf8index ] ) ) ; frame . numberOfStackItems -= getParametersCount ( descriptor ) ; if ( CharOperation . equals ( ConstantPool . Init , name ) ) { frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] . tag = VerificationTypeInfo . ITEM_OBJECT ; } frame . numberOfStackItems -- ; returnType = getReturnType ( descriptor ) ; if ( returnType . length == <NUM_LIT:1> ) { switch ( returnType [ <NUM_LIT:0> ] ) { case '<CHAR_LIT:Z>' : frame . addStackItem ( TypeBinding . BOOLEAN ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . BYTE ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . CHAR ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . DOUBLE ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . FLOAT ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . INT ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . LONG ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . SHORT ) ; break ; } } else { if ( returnType [ <NUM_LIT:0> ] == '<CHAR_LIT:[>' ) { frame . addStackItem ( new VerificationTypeInfo ( <NUM_LIT:0> , returnType ) ) ; } else { frame . addStackItem ( new VerificationTypeInfo ( <NUM_LIT:0> , CharOperation . subarray ( returnType , <NUM_LIT:1> , returnType . length - <NUM_LIT:1> ) ) ) ; } } pc += <NUM_LIT:3> ; break ; case Opcodes . OPC_invokestatic : index = u2At ( bytecodes , <NUM_LIT:1> , pc ) ; nameAndTypeIndex = u2At ( poolContents , <NUM_LIT:3> , constantPoolOffsets [ index ] ) ; utf8index = u2At ( poolContents , <NUM_LIT:3> , constantPoolOffsets [ nameAndTypeIndex ] ) ; descriptor = utf8At ( poolContents , constantPoolOffsets [ utf8index ] + <NUM_LIT:3> , u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ utf8index ] ) ) ; utf8index = u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ nameAndTypeIndex ] ) ; name = utf8At ( poolContents , constantPoolOffsets [ utf8index ] + <NUM_LIT:3> , u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ utf8index ] ) ) ; frame . numberOfStackItems -= getParametersCount ( descriptor ) ; returnType = getReturnType ( descriptor ) ; if ( returnType . length == <NUM_LIT:1> ) { switch ( returnType [ <NUM_LIT:0> ] ) { case '<CHAR_LIT:Z>' : frame . addStackItem ( TypeBinding . BOOLEAN ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . BYTE ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . CHAR ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . DOUBLE ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . FLOAT ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . INT ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . LONG ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . SHORT ) ; break ; } } else { if ( returnType [ <NUM_LIT:0> ] == '<CHAR_LIT:[>' ) { frame . addStackItem ( new VerificationTypeInfo ( <NUM_LIT:0> , returnType ) ) ; } else { frame . addStackItem ( new VerificationTypeInfo ( <NUM_LIT:0> , CharOperation . subarray ( returnType , <NUM_LIT:1> , returnType . length - <NUM_LIT:1> ) ) ) ; } } pc += <NUM_LIT:3> ; break ; case Opcodes . OPC_invokeinterface : index = u2At ( bytecodes , <NUM_LIT:1> , pc ) ; nameAndTypeIndex = u2At ( poolContents , <NUM_LIT:3> , constantPoolOffsets [ index ] ) ; utf8index = u2At ( poolContents , <NUM_LIT:3> , constantPoolOffsets [ nameAndTypeIndex ] ) ; descriptor = utf8At ( poolContents , constantPoolOffsets [ utf8index ] + <NUM_LIT:3> , u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ utf8index ] ) ) ; utf8index = u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ nameAndTypeIndex ] ) ; name = utf8At ( poolContents , constantPoolOffsets [ utf8index ] + <NUM_LIT:3> , u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ utf8index ] ) ) ; frame . numberOfStackItems -= ( getParametersCount ( descriptor ) + <NUM_LIT:1> ) ; returnType = getReturnType ( descriptor ) ; if ( returnType . length == <NUM_LIT:1> ) { switch ( returnType [ <NUM_LIT:0> ] ) { case '<CHAR_LIT:Z>' : frame . addStackItem ( TypeBinding . BOOLEAN ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . BYTE ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . CHAR ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . DOUBLE ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . FLOAT ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . INT ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . LONG ) ; break ; case '<CHAR_LIT>' : frame . addStackItem ( TypeBinding . SHORT ) ; break ; } } else { if ( returnType [ <NUM_LIT:0> ] == '<CHAR_LIT:[>' ) { frame . addStackItem ( new VerificationTypeInfo ( <NUM_LIT:0> , returnType ) ) ; } else { frame . addStackItem ( new VerificationTypeInfo ( <NUM_LIT:0> , CharOperation . subarray ( returnType , <NUM_LIT:1> , returnType . length - <NUM_LIT:1> ) ) ) ; } } pc += <NUM_LIT:5> ; break ; case Opcodes . OPC_new : index = u2At ( bytecodes , <NUM_LIT:1> , pc ) ; utf8index = u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ index ] ) ; char [ ] className = utf8At ( poolContents , constantPoolOffsets [ utf8index ] + <NUM_LIT:3> , u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ utf8index ] ) ) ; VerificationTypeInfo verificationTypeInfo = new VerificationTypeInfo ( <NUM_LIT:0> , VerificationTypeInfo . ITEM_UNINITIALIZED , className ) ; verificationTypeInfo . offset = currentPC ; frame . addStackItem ( verificationTypeInfo ) ; pc += <NUM_LIT:3> ; break ; case Opcodes . OPC_newarray : char [ ] constantPoolName = null ; switch ( u1At ( bytecodes , <NUM_LIT:1> , pc ) ) { case ClassFileConstants . INT_ARRAY : constantPoolName = new char [ ] { '<CHAR_LIT:[>' , '<CHAR_LIT>' } ; break ; case ClassFileConstants . BYTE_ARRAY : constantPoolName = new char [ ] { '<CHAR_LIT:[>' , '<CHAR_LIT>' } ; break ; case ClassFileConstants . BOOLEAN_ARRAY : constantPoolName = new char [ ] { '<CHAR_LIT:[>' , '<CHAR_LIT:Z>' } ; break ; case ClassFileConstants . SHORT_ARRAY : constantPoolName = new char [ ] { '<CHAR_LIT:[>' , '<CHAR_LIT>' } ; break ; case ClassFileConstants . CHAR_ARRAY : constantPoolName = new char [ ] { '<CHAR_LIT:[>' , '<CHAR_LIT>' } ; break ; case ClassFileConstants . LONG_ARRAY : constantPoolName = new char [ ] { '<CHAR_LIT:[>' , '<CHAR_LIT>' } ; break ; case ClassFileConstants . FLOAT_ARRAY : constantPoolName = new char [ ] { '<CHAR_LIT:[>' , '<CHAR_LIT>' } ; break ; case ClassFileConstants . DOUBLE_ARRAY : constantPoolName = new char [ ] { '<CHAR_LIT:[>' , '<CHAR_LIT>' } ; break ; } frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( TypeIds . T_JavaLangObject , constantPoolName ) ; pc += <NUM_LIT:2> ; break ; case Opcodes . OPC_anewarray : index = u2At ( bytecodes , <NUM_LIT:1> , pc ) ; utf8index = u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ index ] ) ; className = utf8At ( poolContents , constantPoolOffsets [ utf8index ] + <NUM_LIT:3> , u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ utf8index ] ) ) ; int classNameLength = className . length ; if ( className [ <NUM_LIT:0> ] != '<CHAR_LIT:[>' ) { System . arraycopy ( className , <NUM_LIT:0> , ( constantPoolName = new char [ classNameLength + <NUM_LIT:3> ] ) , <NUM_LIT:2> , classNameLength ) ; constantPoolName [ <NUM_LIT:0> ] = '<CHAR_LIT:[>' ; constantPoolName [ <NUM_LIT:1> ] = '<CHAR_LIT>' ; constantPoolName [ classNameLength + <NUM_LIT:2> ] = '<CHAR_LIT:;>' ; } else { System . arraycopy ( className , <NUM_LIT:0> , ( constantPoolName = new char [ classNameLength + <NUM_LIT:1> ] ) , <NUM_LIT:1> , classNameLength ) ; constantPoolName [ <NUM_LIT:0> ] = '<CHAR_LIT:[>' ; } frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( <NUM_LIT:0> , constantPoolName ) ; pc += <NUM_LIT:3> ; break ; case Opcodes . OPC_arraylength : frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( TypeBinding . INT ) ; pc ++ ; break ; case Opcodes . OPC_athrow : frame . numberOfStackItems -- ; pc ++ ; break ; case Opcodes . OPC_checkcast : index = u2At ( bytecodes , <NUM_LIT:1> , pc ) ; utf8index = u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ index ] ) ; className = utf8At ( poolContents , constantPoolOffsets [ utf8index ] + <NUM_LIT:3> , u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ utf8index ] ) ) ; frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( <NUM_LIT:0> , className ) ; pc += <NUM_LIT:3> ; break ; case Opcodes . OPC_instanceof : frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] = new VerificationTypeInfo ( TypeBinding . INT ) ; pc += <NUM_LIT:3> ; break ; case Opcodes . OPC_monitorenter : case Opcodes . OPC_monitorexit : frame . numberOfStackItems -- ; pc ++ ; break ; case Opcodes . OPC_wide : opcode = ( byte ) u1At ( bytecodes , <NUM_LIT:1> , pc ) ; if ( opcode == Opcodes . OPC_iinc ) { pc += <NUM_LIT:6> ; } else { index = u2At ( bytecodes , <NUM_LIT:2> , pc ) ; switch ( opcode ) { case Opcodes . OPC_iload : frame . addStackItem ( TypeBinding . INT ) ; break ; case Opcodes . OPC_fload : frame . addStackItem ( TypeBinding . FLOAT ) ; break ; case Opcodes . OPC_aload : localsN = frame . locals [ index ] ; if ( localsN == null ) { localsN = retrieveLocal ( currentPC , index ) ; } frame . addStackItem ( localsN ) ; break ; case Opcodes . OPC_lload : frame . addStackItem ( TypeBinding . LONG ) ; break ; case Opcodes . OPC_dload : frame . addStackItem ( TypeBinding . DOUBLE ) ; break ; case Opcodes . OPC_istore : frame . numberOfStackItems -- ; break ; case Opcodes . OPC_fstore : frame . numberOfStackItems -- ; break ; case Opcodes . OPC_astore : frame . locals [ index ] = frame . stackItems [ frame . numberOfStackItems - <NUM_LIT:1> ] ; frame . numberOfStackItems -- ; break ; case Opcodes . OPC_lstore : frame . numberOfStackItems -- ; break ; case Opcodes . OPC_dstore : frame . numberOfStackItems -- ; break ; } pc += <NUM_LIT:4> ; } break ; case Opcodes . OPC_multianewarray : index = u2At ( bytecodes , <NUM_LIT:1> , pc ) ; utf8index = u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ index ] ) ; className = utf8At ( poolContents , constantPoolOffsets [ utf8index ] + <NUM_LIT:3> , u2At ( poolContents , <NUM_LIT:1> , constantPoolOffsets [ utf8index ] ) ) ; int dimensions = u1At ( bytecodes , <NUM_LIT:3> , pc ) ; frame . numberOfStackItems -= dimensions ; classNameLength = className . length ; constantPoolName = new char [ classNameLength + dimensions ] ; for ( int i = <NUM_LIT:0> ; i < dimensions ; i ++ ) { constantPoolName [ i ] = '<CHAR_LIT:[>' ; } System . arraycopy ( className , <NUM_LIT:0> , constantPoolName , dimensions , classNameLength ) ; frame . addStackItem ( new VerificationTypeInfo ( <NUM_LIT:0> , constantPoolName ) ) ; pc += <NUM_LIT:4> ; break ; case Opcodes . OPC_ifnull : case Opcodes . OPC_ifnonnull : frame . numberOfStackItems -- ; pc += <NUM_LIT:3> ; break ; case Opcodes . OPC_goto_w : pc += <NUM_LIT:5> ; break ; default : this . codeStream . methodDeclaration . scope . problemReporter ( ) . abortDueToInternalError ( Messages . bind ( Messages . abort_invalidOpcode , new Object [ ] { new Byte ( opcode ) , new Integer ( pc ) , new String ( methodBinding . shortReadableName ( ) ) , } ) , this . codeStream . methodDeclaration ) ; break ; } if ( pc >= ( codeLength + codeOffset ) ) { break ; } } } private final int u1At ( byte [ ] reference , int relativeOffset , int structOffset ) { return ( reference [ relativeOffset + structOffset ] & <NUM_LIT> ) ; } private final int u2At ( byte [ ] reference , int relativeOffset , int structOffset ) { int position = relativeOffset + structOffset ; return ( ( reference [ position ++ ] & <NUM_LIT> ) << <NUM_LIT:8> ) + ( reference [ position ] & <NUM_LIT> ) ; } private final long u4At ( byte [ ] reference , int relativeOffset , int structOffset ) { int position = relativeOffset + structOffset ; return ( ( ( reference [ position ++ ] & <NUM_LIT> ) << <NUM_LIT:24> ) + ( ( reference [ position ++ ] & <NUM_LIT> ) << <NUM_LIT:16> ) + ( ( reference [ position ++ ] & <NUM_LIT> ) << <NUM_LIT:8> ) + ( reference [ position ] & <NUM_LIT> ) ) ; } public char [ ] utf8At ( byte [ ] reference , int absoluteOffset , int bytesAvailable ) { int length = bytesAvailable ; char outputBuf [ ] = new char [ bytesAvailable ] ; int outputPos = <NUM_LIT:0> ; int readOffset = absoluteOffset ; while ( length != <NUM_LIT:0> ) { int x = reference [ readOffset ++ ] & <NUM_LIT> ; length -- ; if ( ( <NUM_LIT> & x ) != <NUM_LIT:0> ) { if ( ( x & <NUM_LIT> ) != <NUM_LIT:0> ) { length -= <NUM_LIT:2> ; x = ( ( x & <NUM_LIT> ) << <NUM_LIT:12> ) | ( ( reference [ readOffset ++ ] & <NUM_LIT> ) << <NUM_LIT:6> ) | ( reference [ readOffset ++ ] & <NUM_LIT> ) ; } else { length -- ; x = ( ( x & <NUM_LIT> ) << <NUM_LIT:6> ) | ( reference [ readOffset ++ ] & <NUM_LIT> ) ; } } outputBuf [ outputPos ++ ] = ( char ) x ; } if ( outputPos != bytesAvailable ) { System . arraycopy ( outputBuf , <NUM_LIT:0> , ( outputBuf = new char [ outputPos ] ) , <NUM_LIT:0> , outputPos ) ; } return outputBuf ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler ; import java . util . Arrays ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Hashtable ; import java . util . Iterator ; import java . util . Map ; import java . util . Set ; import org . eclipse . jdt . core . compiler . CategorizedProblem ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration ; import org . eclipse . jdt . internal . compiler . env . ICompilationUnit ; import org . eclipse . jdt . internal . compiler . impl . ReferenceContext ; import org . eclipse . jdt . internal . compiler . lookup . SourceTypeBinding ; import org . eclipse . jdt . internal . compiler . parser . RecoveryScannerData ; import org . eclipse . jdt . internal . compiler . util . Util ; public class CompilationResult { public CategorizedProblem problems [ ] ; public CategorizedProblem tasks [ ] ; public int problemCount ; public int taskCount ; public ICompilationUnit compilationUnit ; private Map problemsMap ; private Set firstErrors ; private int maxProblemPerUnit ; public char [ ] [ ] [ ] qualifiedReferences ; public char [ ] [ ] simpleNameReferences ; public char [ ] [ ] rootReferences ; public boolean hasAnnotations = false ; public int lineSeparatorPositions [ ] ; public RecoveryScannerData recoveryScannerData ; public Map compiledTypes = new Hashtable ( <NUM_LIT:11> ) ; public int unitIndex , totalUnitsKnown ; public boolean hasBeenAccepted = false ; public char [ ] fileName ; public boolean hasInconsistentToplevelHierarchies = false ; public boolean hasSyntaxError = false ; public char [ ] [ ] packageName ; public boolean checkSecondaryTypes = false ; private int numberOfErrors ; private static final int [ ] EMPTY_LINE_ENDS = Util . EMPTY_INT_ARRAY ; private static final Comparator PROBLEM_COMPARATOR = new Comparator ( ) { public int compare ( Object o1 , Object o2 ) { return ( ( CategorizedProblem ) o1 ) . getSourceStart ( ) - ( ( CategorizedProblem ) o2 ) . getSourceStart ( ) ; } } ; public CompilationResult ( char [ ] fileName , int unitIndex , int totalUnitsKnown , int maxProblemPerUnit ) { this . fileName = fileName ; this . unitIndex = unitIndex ; this . totalUnitsKnown = totalUnitsKnown ; this . maxProblemPerUnit = maxProblemPerUnit ; } public CompilationResult ( ICompilationUnit compilationUnit , int unitIndex , int totalUnitsKnown , int maxProblemPerUnit ) { this . fileName = compilationUnit . getFileName ( ) ; this . compilationUnit = compilationUnit ; this . unitIndex = unitIndex ; this . totalUnitsKnown = totalUnitsKnown ; this . maxProblemPerUnit = maxProblemPerUnit ; } private int computePriority ( CategorizedProblem problem ) { final int P_STATIC = <NUM_LIT> ; final int P_OUTSIDE_METHOD = <NUM_LIT> ; final int P_FIRST_ERROR = <NUM_LIT> ; final int P_ERROR = <NUM_LIT> ; int priority = <NUM_LIT> - problem . getSourceLineNumber ( ) ; if ( priority < <NUM_LIT:0> ) priority = <NUM_LIT:0> ; if ( problem . isError ( ) ) { priority += P_ERROR ; } ReferenceContext context = this . problemsMap == null ? null : ( ReferenceContext ) this . problemsMap . get ( problem ) ; if ( context != null ) { if ( context instanceof AbstractMethodDeclaration ) { AbstractMethodDeclaration method = ( AbstractMethodDeclaration ) context ; if ( method . isStatic ( ) ) { priority += P_STATIC ; } } else { priority += P_OUTSIDE_METHOD ; } if ( this . firstErrors . contains ( problem ) ) { priority += P_FIRST_ERROR ; } } else { priority += P_OUTSIDE_METHOD ; } return priority ; } public CategorizedProblem [ ] getAllProblems ( ) { CategorizedProblem [ ] onlyProblems = getProblems ( ) ; int onlyProblemCount = onlyProblems != null ? onlyProblems . length : <NUM_LIT:0> ; CategorizedProblem [ ] onlyTasks = getTasks ( ) ; int onlyTaskCount = onlyTasks != null ? onlyTasks . length : <NUM_LIT:0> ; if ( onlyTaskCount == <NUM_LIT:0> ) { return onlyProblems ; } if ( onlyProblemCount == <NUM_LIT:0> ) { return onlyTasks ; } int totalNumberOfProblem = onlyProblemCount + onlyTaskCount ; CategorizedProblem [ ] allProblems = new CategorizedProblem [ totalNumberOfProblem ] ; int allProblemIndex = <NUM_LIT:0> ; int taskIndex = <NUM_LIT:0> ; int problemIndex = <NUM_LIT:0> ; while ( taskIndex + problemIndex < totalNumberOfProblem ) { CategorizedProblem nextTask = null ; CategorizedProblem nextProblem = null ; if ( taskIndex < onlyTaskCount ) { nextTask = onlyTasks [ taskIndex ] ; } if ( problemIndex < onlyProblemCount ) { nextProblem = onlyProblems [ problemIndex ] ; } CategorizedProblem currentProblem = null ; if ( nextProblem != null ) { if ( nextTask != null ) { if ( nextProblem . getSourceStart ( ) < nextTask . getSourceStart ( ) ) { currentProblem = nextProblem ; problemIndex ++ ; } else { currentProblem = nextTask ; taskIndex ++ ; } } else { currentProblem = nextProblem ; problemIndex ++ ; } } else { if ( nextTask != null ) { currentProblem = nextTask ; taskIndex ++ ; } } allProblems [ allProblemIndex ++ ] = currentProblem ; } return allProblems ; } public ClassFile [ ] getClassFiles ( ) { ClassFile [ ] classFiles = new ClassFile [ this . compiledTypes . size ( ) ] ; this . compiledTypes . values ( ) . toArray ( classFiles ) ; return classFiles ; } public ICompilationUnit getCompilationUnit ( ) { return this . compilationUnit ; } public CategorizedProblem [ ] getErrors ( ) { CategorizedProblem [ ] reportedProblems = getProblems ( ) ; int errorCount = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < this . problemCount ; i ++ ) { if ( reportedProblems [ i ] . isError ( ) ) errorCount ++ ; } if ( errorCount == this . problemCount ) return reportedProblems ; CategorizedProblem [ ] errors = new CategorizedProblem [ errorCount ] ; int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < this . problemCount ; i ++ ) { if ( reportedProblems [ i ] . isError ( ) ) errors [ index ++ ] = reportedProblems [ i ] ; } return errors ; } public char [ ] getFileName ( ) { return this . fileName ; } public int [ ] getLineSeparatorPositions ( ) { return this . lineSeparatorPositions == null ? CompilationResult . EMPTY_LINE_ENDS : this . lineSeparatorPositions ; } public CategorizedProblem [ ] getProblems ( ) { if ( this . problems != null ) { if ( this . problemCount != this . problems . length ) { System . arraycopy ( this . problems , <NUM_LIT:0> , ( this . problems = new CategorizedProblem [ this . problemCount ] ) , <NUM_LIT:0> , this . problemCount ) ; } if ( this . maxProblemPerUnit > <NUM_LIT:0> && this . problemCount > this . maxProblemPerUnit ) { quickPrioritize ( this . problems , <NUM_LIT:0> , this . problemCount - <NUM_LIT:1> ) ; this . problemCount = this . maxProblemPerUnit ; System . arraycopy ( this . problems , <NUM_LIT:0> , ( this . problems = new CategorizedProblem [ this . problemCount ] ) , <NUM_LIT:0> , this . problemCount ) ; } Arrays . sort ( this . problems , <NUM_LIT:0> , this . problems . length , CompilationResult . PROBLEM_COMPARATOR ) ; } return this . problems ; } public CategorizedProblem [ ] getTasks ( ) { if ( this . tasks != null ) { if ( this . taskCount != this . tasks . length ) { System . arraycopy ( this . tasks , <NUM_LIT:0> , ( this . tasks = new CategorizedProblem [ this . taskCount ] ) , <NUM_LIT:0> , this . taskCount ) ; } Arrays . sort ( this . tasks , <NUM_LIT:0> , this . tasks . length , CompilationResult . PROBLEM_COMPARATOR ) ; } return this . tasks ; } public boolean hasErrors ( ) { return this . numberOfErrors != <NUM_LIT:0> ; } public boolean hasProblems ( ) { return this . problemCount != <NUM_LIT:0> ; } public boolean hasTasks ( ) { return this . taskCount != <NUM_LIT:0> ; } public boolean hasWarnings ( ) { if ( this . problems != null ) for ( int i = <NUM_LIT:0> ; i < this . problemCount ; i ++ ) { if ( this . problems [ i ] . isWarning ( ) ) return true ; } return false ; } private void quickPrioritize ( CategorizedProblem [ ] problemList , int left , int right ) { if ( left >= right ) return ; int original_left = left ; int original_right = right ; int mid = computePriority ( problemList [ left + ( right - left ) / <NUM_LIT:2> ] ) ; do { while ( computePriority ( problemList [ right ] ) < mid ) right -- ; while ( mid < computePriority ( problemList [ left ] ) ) left ++ ; if ( left <= right ) { CategorizedProblem tmp = problemList [ left ] ; problemList [ left ] = problemList [ right ] ; problemList [ right ] = tmp ; left ++ ; right -- ; } } while ( left <= right ) ; if ( original_left < right ) quickPrioritize ( problemList , original_left , right ) ; if ( left < original_right ) quickPrioritize ( problemList , left , original_right ) ; } public void recordPackageName ( char [ ] [ ] packName ) { this . packageName = packName ; } public void record ( CategorizedProblem newProblem , ReferenceContext referenceContext ) { if ( newProblem . getID ( ) == IProblem . Task ) { recordTask ( newProblem ) ; return ; } if ( this . problemCount == <NUM_LIT:0> ) { this . problems = new CategorizedProblem [ <NUM_LIT:5> ] ; } else if ( this . problemCount == this . problems . length ) { System . arraycopy ( this . problems , <NUM_LIT:0> , ( this . problems = new CategorizedProblem [ this . problemCount * <NUM_LIT:2> ] ) , <NUM_LIT:0> , this . problemCount ) ; } this . problems [ this . problemCount ++ ] = newProblem ; if ( referenceContext != null ) { if ( this . problemsMap == null ) this . problemsMap = new HashMap ( <NUM_LIT:5> ) ; if ( this . firstErrors == null ) this . firstErrors = new HashSet ( <NUM_LIT:5> ) ; if ( newProblem . isError ( ) && ! referenceContext . hasErrors ( ) ) this . firstErrors . add ( newProblem ) ; this . problemsMap . put ( newProblem , referenceContext ) ; } if ( newProblem . isError ( ) ) { this . numberOfErrors ++ ; if ( ( newProblem . getID ( ) & IProblem . Syntax ) != <NUM_LIT:0> ) { this . hasSyntaxError = true ; } } } public void record ( char [ ] typeName , ClassFile classFile ) { SourceTypeBinding sourceType = classFile . referenceBinding ; if ( ! sourceType . isLocalType ( ) && sourceType . isHierarchyInconsistent ( ) ) { this . hasInconsistentToplevelHierarchies = true ; } this . compiledTypes . put ( typeName , classFile ) ; } private void recordTask ( CategorizedProblem newProblem ) { if ( this . taskCount == <NUM_LIT:0> ) { this . tasks = new CategorizedProblem [ <NUM_LIT:5> ] ; } else if ( this . taskCount == this . tasks . length ) { System . arraycopy ( this . tasks , <NUM_LIT:0> , ( this . tasks = new CategorizedProblem [ this . taskCount * <NUM_LIT:2> ] ) , <NUM_LIT:0> , this . taskCount ) ; } this . tasks [ this . taskCount ++ ] = newProblem ; } public void removeProblem ( CategorizedProblem problem ) { if ( this . problemsMap != null ) this . problemsMap . remove ( problem ) ; if ( this . firstErrors != null ) this . firstErrors . remove ( problem ) ; if ( problem . isError ( ) ) { this . numberOfErrors -- ; } this . problemCount -- ; } public CompilationResult tagAsAccepted ( ) { this . hasBeenAccepted = true ; this . problemsMap = null ; this . firstErrors = null ; return this ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; if ( this . fileName != null ) { buffer . append ( "<STR_LIT>" ) . append ( this . fileName ) . append ( '<STR_LIT:\n>' ) ; } if ( this . compiledTypes != null ) { buffer . append ( "<STR_LIT>" ) ; Iterator keys = this . compiledTypes . keySet ( ) . iterator ( ) ; while ( keys . hasNext ( ) ) { char [ ] typeName = ( char [ ] ) keys . next ( ) ; buffer . append ( "<STR_LIT>" ) . append ( typeName ) . append ( '<STR_LIT:\n>' ) ; } } else { buffer . append ( "<STR_LIT>" ) ; } if ( this . problems != null ) { buffer . append ( this . problemCount ) . append ( "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> ; i < this . problemCount ; i ++ ) { buffer . append ( "<STR_LIT>" ) . append ( this . problems [ i ] ) . append ( '<STR_LIT:\n>' ) ; } } else { buffer . append ( "<STR_LIT>" ) ; } return buffer . toString ( ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; public interface IGenericType extends IDependent { int getModifiers ( ) ; boolean isBinaryType ( ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; public interface ISourceType extends IGenericType { int getDeclarationSourceEnd ( ) ; int getDeclarationSourceStart ( ) ; ISourceType getEnclosingType ( ) ; ISourceField [ ] getFields ( ) ; char [ ] [ ] getInterfaceNames ( ) ; ISourceType [ ] getMemberTypes ( ) ; ISourceMethod [ ] getMethods ( ) ; char [ ] getName ( ) ; int getNameSourceEnd ( ) ; int getNameSourceStart ( ) ; char [ ] getSuperclassName ( ) ; char [ ] [ ] [ ] getTypeParameterBounds ( ) ; char [ ] [ ] getTypeParameterNames ( ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . compiler . IProblem ; public class AccessRule { public static final int IgnoreIfBetter = <NUM_LIT> ; public char [ ] pattern ; public int problemId ; public AccessRule ( char [ ] pattern , int problemId ) { this ( pattern , problemId , false ) ; } public AccessRule ( char [ ] pattern , int problemId , boolean keepLooking ) { this . pattern = pattern ; this . problemId = keepLooking ? problemId | IgnoreIfBetter : problemId ; } public int hashCode ( ) { return this . problemId * <NUM_LIT> + CharOperation . hashCode ( this . pattern ) ; } public boolean equals ( Object obj ) { if ( ! ( obj instanceof AccessRule ) ) return false ; AccessRule other = ( AccessRule ) obj ; if ( this . problemId != other . problemId ) return false ; return CharOperation . equals ( this . pattern , other . pattern ) ; } public int getProblemId ( ) { return this . problemId & ~ IgnoreIfBetter ; } public boolean ignoreIfBetter ( ) { return ( this . problemId & IgnoreIfBetter ) != <NUM_LIT:0> ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . pattern ) ; switch ( getProblemId ( ) ) { case IProblem . ForbiddenReference : buffer . append ( "<STR_LIT>" ) ; break ; case IProblem . DiscouragedReference : buffer . append ( "<STR_LIT>" ) ; break ; default : buffer . append ( "<STR_LIT>" ) ; break ; } if ( ignoreIfBetter ( ) ) buffer . append ( "<STR_LIT>" ) ; buffer . append ( '<CHAR_LIT:)>' ) ; return buffer . toString ( ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; public interface IBinaryAnnotation { char [ ] getTypeName ( ) ; IBinaryElementValuePair [ ] getElementValuePairs ( ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; public interface IDependent { char JAR_FILE_ENTRY_SEPARATOR = '<CHAR_LIT>' ; char [ ] getFileName ( ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; import java . util . Arrays ; import org . eclipse . jdt . core . compiler . CharOperation ; public class ClassSignature { char [ ] className ; public ClassSignature ( final char [ ] className ) { this . className = className ; } public char [ ] getTypeName ( ) { return this . className ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( this . className ) ; buffer . append ( "<STR_LIT:.class>" ) ; return buffer . toString ( ) ; } public int hashCode ( ) { final int prime = <NUM_LIT:31> ; int result = <NUM_LIT:1> ; result = prime * result + CharOperation . hashCode ( this . className ) ; return result ; } public boolean equals ( Object obj ) { if ( this == obj ) { return true ; } if ( obj == null ) { return false ; } if ( getClass ( ) != obj . getClass ( ) ) { return false ; } ClassSignature other = ( ClassSignature ) obj ; return Arrays . equals ( this . className , other . className ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; import java . util . Arrays ; import org . eclipse . jdt . core . compiler . CharOperation ; public class EnumConstantSignature { char [ ] typeName ; char [ ] constName ; public EnumConstantSignature ( char [ ] typeName , char [ ] constName ) { this . typeName = typeName ; this . constName = constName ; } public char [ ] getTypeName ( ) { return this . typeName ; } public char [ ] getEnumConstantName ( ) { return this . constName ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( this . typeName ) ; buffer . append ( '<CHAR_LIT:.>' ) ; buffer . append ( this . constName ) ; return buffer . toString ( ) ; } public int hashCode ( ) { final int prime = <NUM_LIT:31> ; int result = <NUM_LIT:1> ; result = prime * result + CharOperation . hashCode ( this . constName ) ; result = prime * result + CharOperation . hashCode ( this . typeName ) ; return result ; } public boolean equals ( Object obj ) { if ( this == obj ) { return true ; } if ( obj == null ) { return false ; } if ( getClass ( ) != obj . getClass ( ) ) { return false ; } EnumConstantSignature other = ( EnumConstantSignature ) obj ; if ( ! Arrays . equals ( this . constName , other . constName ) ) { return false ; } return Arrays . equals ( this . typeName , other . typeName ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; import org . eclipse . jdt . internal . compiler . impl . Constant ; public interface IBinaryField extends IGenericField { IBinaryAnnotation [ ] getAnnotations ( ) ; Constant getConstant ( ) ; char [ ] getGenericSignature ( ) ; char [ ] getName ( ) ; long getTagBits ( ) ; char [ ] getTypeName ( ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; public interface ISourceMethod extends IGenericMethod { int getDeclarationSourceEnd ( ) ; int getDeclarationSourceStart ( ) ; char [ ] [ ] getExceptionTypeNames ( ) ; int getNameSourceEnd ( ) ; int getNameSourceStart ( ) ; char [ ] getReturnTypeName ( ) ; char [ ] [ ] getTypeParameterNames ( ) ; char [ ] [ ] [ ] getTypeParameterBounds ( ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; public interface IBinaryMethod extends IGenericMethod { IBinaryAnnotation [ ] getAnnotations ( ) ; Object getDefaultValue ( ) ; char [ ] [ ] getExceptionTypeNames ( ) ; char [ ] getGenericSignature ( ) ; char [ ] getMethodDescriptor ( ) ; IBinaryAnnotation [ ] getParameterAnnotations ( int index ) ; char [ ] getSelector ( ) ; long getTagBits ( ) ; boolean isClinit ( ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; public interface ISourceField extends IGenericField { int getDeclarationSourceEnd ( ) ; int getDeclarationSourceStart ( ) ; char [ ] getInitializationSource ( ) ; int getNameSourceEnd ( ) ; int getNameSourceStart ( ) ; char [ ] getTypeName ( ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; public interface IBinaryNestedType { char [ ] getEnclosingTypeName ( ) ; int getModifiers ( ) ; char [ ] getName ( ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; public interface INameEnvironment { NameEnvironmentAnswer findType ( char [ ] [ ] compoundTypeName ) ; NameEnvironmentAnswer findType ( char [ ] typeName , char [ ] [ ] packageName ) ; boolean isPackage ( char [ ] [ ] parentPackageName , char [ ] packageName ) ; void cleanup ( ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; public interface IGenericField { int getModifiers ( ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; import org . eclipse . jdt . core . compiler . CharOperation ; public interface IBinaryType extends IGenericType { char [ ] [ ] NoInterface = CharOperation . NO_CHAR_CHAR ; IBinaryNestedType [ ] NoNestedType = new IBinaryNestedType [ <NUM_LIT:0> ] ; IBinaryField [ ] NoField = new IBinaryField [ <NUM_LIT:0> ] ; IBinaryMethod [ ] NoMethod = new IBinaryMethod [ <NUM_LIT:0> ] ; IBinaryAnnotation [ ] getAnnotations ( ) ; char [ ] getEnclosingMethod ( ) ; char [ ] getEnclosingTypeName ( ) ; IBinaryField [ ] getFields ( ) ; char [ ] getGenericSignature ( ) ; char [ ] [ ] getInterfaceNames ( ) ; IBinaryNestedType [ ] getMemberTypes ( ) ; IBinaryMethod [ ] getMethods ( ) ; char [ ] [ ] [ ] getMissingTypeNames ( ) ; char [ ] getName ( ) ; char [ ] getSourceName ( ) ; char [ ] getSuperclassName ( ) ; long getTagBits ( ) ; boolean isAnonymous ( ) ; boolean isLocal ( ) ; boolean isMember ( ) ; char [ ] sourceFileName ( ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; public interface ICompilationUnit extends IDependent { char [ ] getContents ( ) ; char [ ] getMainTypeName ( ) ; char [ ] [ ] getPackageName ( ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; public class AccessRestriction { private AccessRule accessRule ; public byte classpathEntryType ; public static final byte COMMAND_LINE = <NUM_LIT:0> , PROJECT = <NUM_LIT:1> , LIBRARY = <NUM_LIT:2> ; public String classpathEntryName ; public AccessRestriction ( AccessRule accessRule , byte classpathEntryType , String classpathEntryName ) { this . accessRule = accessRule ; this . classpathEntryName = classpathEntryName ; this . classpathEntryType = classpathEntryType ; } public int getProblemId ( ) { return this . accessRule . getProblemId ( ) ; } public boolean ignoreIfBetter ( ) { return this . accessRule . ignoreIfBetter ( ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; public interface ISourceImport { int getDeclarationSourceEnd ( ) ; int getDeclarationSourceStart ( ) ; int getModifiers ( ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; public interface IBinaryElementValuePair { char [ ] getName ( ) ; Object getValue ( ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; public interface IGenericMethod { int getModifiers ( ) ; boolean isConstructor ( ) ; char [ ] [ ] getArgumentNames ( ) ; } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; public class NameEnvironmentAnswer { IBinaryType binaryType ; ICompilationUnit compilationUnit ; ISourceType [ ] sourceTypes ; AccessRestriction accessRestriction ; public NameEnvironmentAnswer ( IBinaryType binaryType , AccessRestriction accessRestriction ) { this . binaryType = binaryType ; this . accessRestriction = accessRestriction ; } public NameEnvironmentAnswer ( ICompilationUnit compilationUnit , AccessRestriction accessRestriction ) { this . compilationUnit = compilationUnit ; this . accessRestriction = accessRestriction ; } public NameEnvironmentAnswer ( ISourceType [ ] sourceTypes , AccessRestriction accessRestriction ) { this . sourceTypes = sourceTypes ; this . accessRestriction = accessRestriction ; } public AccessRestriction getAccessRestriction ( ) { return this . accessRestriction ; } public IBinaryType getBinaryType ( ) { return this . binaryType ; } public ICompilationUnit getCompilationUnit ( ) { return this . compilationUnit ; } public ISourceType [ ] getSourceTypes ( ) { return this . sourceTypes ; } public boolean isBinaryType ( ) { return this . binaryType != null ; } public boolean isCompilationUnit ( ) { return this . compilationUnit != null ; } public boolean isSourceType ( ) { return this . sourceTypes != null ; } public boolean ignoreIfBetter ( ) { return this . accessRestriction != null && this . accessRestriction . ignoreIfBetter ( ) ; } public boolean isBetter ( NameEnvironmentAnswer otherAnswer ) { if ( otherAnswer == null ) return true ; if ( this . accessRestriction == null ) return true ; return otherAnswer . accessRestriction != null && this . accessRestriction . getProblemId ( ) < otherAnswer . accessRestriction . getProblemId ( ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . compiler . env ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . compiler . IProblem ; public class AccessRuleSet { private AccessRule [ ] accessRules ; public byte classpathEntryType ; public String classpathEntryName ; public AccessRuleSet ( AccessRule [ ] accessRules , byte classpathEntryType , String classpathEntryName ) { this . accessRules = accessRules ; this . classpathEntryType = classpathEntryType ; this . classpathEntryName = classpathEntryName ; } public boolean equals ( Object object ) { if ( this == object ) return true ; if ( ! ( object instanceof AccessRuleSet ) ) return false ; AccessRuleSet otherRuleSet = ( AccessRuleSet ) object ; if ( this . classpathEntryType != otherRuleSet . classpathEntryType || this . classpathEntryName == null && otherRuleSet . classpathEntryName != null || ! this . classpathEntryName . equals ( otherRuleSet . classpathEntryName ) ) { return false ; } int rulesLength = this . accessRules . length ; if ( rulesLength != otherRuleSet . accessRules . length ) return false ; for ( int i = <NUM_LIT:0> ; i < rulesLength ; i ++ ) if ( ! this . accessRules [ i ] . equals ( otherRuleSet . accessRules [ i ] ) ) return false ; return true ; } public AccessRule [ ] getAccessRules ( ) { return this . accessRules ; } public AccessRestriction getViolatedRestriction ( char [ ] targetTypeFilePath ) { for ( int i = <NUM_LIT:0> , length = this . accessRules . length ; i < length ; i ++ ) { AccessRule accessRule = this . accessRules [ i ] ; if ( CharOperation . pathMatch ( accessRule . pattern , targetTypeFilePath , true , '<CHAR_LIT:/>' ) ) { switch ( accessRule . getProblemId ( ) ) { case IProblem . ForbiddenReference : case IProblem . DiscouragedReference : return new AccessRestriction ( accessRule , this . classpathEntryType , this . classpathEntryName ) ; default : return null ; } } } return null ; } public int hashCode ( ) { final int prime = <NUM_LIT:31> ; int result = <NUM_LIT:1> ; result = prime * result + hashCode ( this . accessRules ) ; result = prime * result + ( ( this . classpathEntryName == null ) ? <NUM_LIT:0> : this . classpathEntryName . hashCode ( ) ) ; result = prime * result + this . classpathEntryType ; return result ; } private int hashCode ( AccessRule [ ] rules ) { final int prime = <NUM_LIT:31> ; if ( rules == null ) return <NUM_LIT:0> ; int result = <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> , length = rules . length ; i < length ; i ++ ) { result = prime * result + ( rules [ i ] == null ? <NUM_LIT:0> : rules [ i ] . hashCode ( ) ) ; } return result ; } public String toString ( ) { return toString ( true ) ; } public String toString ( boolean wrap ) { StringBuffer buffer = new StringBuffer ( <NUM_LIT> ) ; buffer . append ( "<STR_LIT>" ) ; if ( wrap ) buffer . append ( '<STR_LIT:\n>' ) ; for ( int i = <NUM_LIT:0> , length = this . accessRules . length ; i < length ; i ++ ) { if ( wrap ) buffer . append ( '<STR_LIT:\t>' ) ; AccessRule accessRule = this . accessRules [ i ] ; buffer . append ( accessRule ) ; if ( wrap ) buffer . append ( '<STR_LIT:\n>' ) ; else if ( i < length - <NUM_LIT:1> ) buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . classpathEntryName ) ; buffer . append ( "<STR_LIT:]>" ) ; return buffer . toString ( ) ; } } </s>
|
<s> package org . eclipse . jdt . core . compiler ; import org . eclipse . jdt . internal . compiler . problem . DefaultProblem ; public abstract class CategorizedProblem implements IProblem { public static final int CAT_UNSPECIFIED = <NUM_LIT:0> ; public static final int CAT_BUILDPATH = <NUM_LIT:10> ; public static final int CAT_SYNTAX = <NUM_LIT:20> ; public static final int CAT_IMPORT = <NUM_LIT:30> ; public static final int CAT_TYPE = <NUM_LIT> ; public static final int CAT_MEMBER = <NUM_LIT> ; public static final int CAT_INTERNAL = <NUM_LIT> ; public static final int CAT_JAVADOC = <NUM_LIT> ; public static final int CAT_CODE_STYLE = <NUM_LIT> ; public static final int CAT_POTENTIAL_PROGRAMMING_PROBLEM = <NUM_LIT> ; public static final int CAT_NAME_SHADOWING_CONFLICT = <NUM_LIT:100> ; public static final int CAT_DEPRECATION = <NUM_LIT> ; public static final int CAT_UNNECESSARY_CODE = <NUM_LIT> ; public static final int CAT_UNCHECKED_RAW = <NUM_LIT> ; public static final int CAT_NLS = <NUM_LIT> ; public static final int CAT_RESTRICTION = <NUM_LIT> ; public abstract int getCategoryID ( ) ; public abstract String getMarkerType ( ) ; public String [ ] getExtraMarkerAttributeNames ( ) { return CharOperation . NO_STRINGS ; } public Object [ ] getExtraMarkerAttributeValues ( ) { return DefaultProblem . EMPTY_VALUES ; } } </s>
|
<s> package org . eclipse . jdt . core . compiler ; import org . eclipse . jdt . core . compiler . batch . BatchCompiler ; public abstract class CompilationProgress { public abstract void begin ( int remainingWork ) ; public abstract void done ( ) ; public abstract boolean isCanceled ( ) ; public abstract void setTaskName ( String name ) ; public abstract void worked ( int workIncrement , int remainingWork ) ; } </s>
|
<s> package org . eclipse . jdt . core . compiler ; import org . eclipse . jdt . internal . compiler . parser . ScannerHelper ; public final class CharOperation { public static final char [ ] NO_CHAR = new char [ <NUM_LIT:0> ] ; public static final char [ ] [ ] NO_CHAR_CHAR = new char [ <NUM_LIT:0> ] [ ] ; public static final String [ ] NO_STRINGS = new String [ <NUM_LIT:0> ] ; public static final char [ ] append ( char [ ] array , char suffix ) { if ( array == null ) return new char [ ] { suffix } ; int length = array . length ; System . arraycopy ( array , <NUM_LIT:0> , array = new char [ length + <NUM_LIT:1> ] , <NUM_LIT:0> , length ) ; array [ length ] = suffix ; return array ; } public static final char [ ] append ( char [ ] target , int index , char [ ] array , int start , int end ) { int targetLength = target . length ; int subLength = end - start ; int newTargetLength = subLength + index ; if ( newTargetLength > targetLength ) { System . arraycopy ( target , <NUM_LIT:0> , target = new char [ newTargetLength * <NUM_LIT:2> ] , <NUM_LIT:0> , index ) ; } System . arraycopy ( array , start , target , index , subLength ) ; return target ; } public static final char [ ] [ ] arrayConcat ( char [ ] [ ] first , char [ ] [ ] second ) { if ( first == null ) return second ; if ( second == null ) return first ; int length1 = first . length ; int length2 = second . length ; char [ ] [ ] result = new char [ length1 + length2 ] [ ] ; System . arraycopy ( first , <NUM_LIT:0> , result , <NUM_LIT:0> , length1 ) ; System . arraycopy ( second , <NUM_LIT:0> , result , length1 , length2 ) ; return result ; } public static final boolean camelCaseMatch ( char [ ] pattern , char [ ] 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 ( char [ ] pattern , char [ ] 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 ( char [ ] pattern , int patternStart , int patternEnd , char [ ] name , int nameStart , int nameEnd ) { return camelCaseMatch ( pattern , patternStart , patternEnd , name , nameStart , nameEnd , false ) ; } public static final boolean camelCaseMatch ( char [ ] pattern , int patternStart , int patternEnd , char [ ] name , int nameStart , int nameEnd , boolean samePartCount ) { if ( name == null ) return false ; if ( pattern == null ) return true ; if ( patternEnd < <NUM_LIT:0> ) patternEnd = pattern . length ; if ( nameEnd < <NUM_LIT:0> ) nameEnd = name . length ; if ( patternEnd <= patternStart ) return nameEnd <= nameStart ; if ( nameEnd <= nameStart ) return false ; if ( name [ nameStart ] != pattern [ patternStart ] ) { return false ; } char patternChar , nameChar ; int iPattern = patternStart ; int iName = nameStart ; while ( true ) { iPattern ++ ; iName ++ ; if ( iPattern == patternEnd ) { if ( ! samePartCount || iName == nameEnd ) return true ; while ( true ) { if ( iName == nameEnd ) { return true ; } nameChar = name [ iName ] ; if ( nameChar < ScannerHelper . MAX_OBVIOUS ) { if ( ( ScannerHelper . OBVIOUS_IDENT_CHAR_NATURES [ nameChar ] & ScannerHelper . C_UPPER_LETTER ) != <NUM_LIT:0> ) { return false ; } } else if ( ! Character . isJavaIdentifierPart ( nameChar ) || Character . isUpperCase ( nameChar ) ) { return false ; } iName ++ ; } } if ( iName == nameEnd ) { return false ; } if ( ( patternChar = pattern [ iPattern ] ) == name [ iName ] ) { continue ; } if ( patternChar < ScannerHelper . MAX_OBVIOUS ) { if ( ( ScannerHelper . OBVIOUS_IDENT_CHAR_NATURES [ patternChar ] & ( ScannerHelper . C_UPPER_LETTER | ScannerHelper . C_DIGIT ) ) == <NUM_LIT:0> ) { return false ; } } else if ( Character . isJavaIdentifierPart ( patternChar ) && ! Character . isUpperCase ( patternChar ) && ! Character . isDigit ( patternChar ) ) { return false ; } while ( true ) { if ( iName == nameEnd ) { return false ; } nameChar = name [ iName ] ; if ( nameChar < ScannerHelper . MAX_OBVIOUS ) { int charNature = ScannerHelper . OBVIOUS_IDENT_CHAR_NATURES [ nameChar ] ; if ( ( charNature & ( ScannerHelper . C_LOWER_LETTER | ScannerHelper . C_SPECIAL ) ) != <NUM_LIT:0> ) { iName ++ ; } else if ( ( charNature & ScannerHelper . C_DIGIT ) != <NUM_LIT:0> ) { if ( patternChar == nameChar ) break ; iName ++ ; } else if ( patternChar != nameChar ) { return false ; } else { break ; } } else if ( Character . isJavaIdentifierPart ( nameChar ) && ! Character . isUpperCase ( nameChar ) ) { iName ++ ; } else if ( Character . isDigit ( nameChar ) ) { if ( patternChar == nameChar ) break ; iName ++ ; } else if ( patternChar != nameChar ) { return false ; } else { break ; } } } } public static String [ ] charArrayToStringArray ( char [ ] [ ] charArrays ) { if ( charArrays == null ) return null ; int length = charArrays . length ; if ( length == <NUM_LIT:0> ) return NO_STRINGS ; String [ ] strings = new String [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) strings [ i ] = new String ( charArrays [ i ] ) ; return strings ; } public static String charToString ( char [ ] charArray ) { if ( charArray == null ) return null ; return new String ( charArray ) ; } public static final char [ ] [ ] arrayConcat ( char [ ] [ ] first , char [ ] second ) { if ( second == null ) return first ; if ( first == null ) return new char [ ] [ ] { second } ; int length = first . length ; char [ ] [ ] result = new char [ length + <NUM_LIT:1> ] [ ] ; System . arraycopy ( first , <NUM_LIT:0> , result , <NUM_LIT:0> , length ) ; result [ length ] = second ; return result ; } public static final int compareTo ( char [ ] array1 , char [ ] array2 ) { int length1 = array1 . length ; int length2 = array2 . length ; int min = Math . min ( length1 , length2 ) ; for ( int i = <NUM_LIT:0> ; i < min ; i ++ ) { if ( array1 [ i ] != array2 [ i ] ) { return array1 [ i ] - array2 [ i ] ; } } return length1 - length2 ; } public static final int compareTo ( char [ ] array1 , char [ ] array2 , int start , int end ) { int length1 = array1 . length ; int length2 = array2 . length ; int min = Math . min ( length1 , length2 ) ; min = Math . min ( min , end ) ; for ( int i = start ; i < min ; i ++ ) { if ( array1 [ i ] != array2 [ i ] ) { return array1 [ i ] - array2 [ i ] ; } } return length1 - length2 ; } public static final int compareWith ( char [ ] array , char [ ] prefix ) { int arrayLength = array . length ; int prefixLength = prefix . length ; int min = Math . min ( arrayLength , prefixLength ) ; int i = <NUM_LIT:0> ; while ( min -- != <NUM_LIT:0> ) { char c1 = array [ i ] ; char c2 = prefix [ i ++ ] ; if ( c1 != c2 ) return c1 - c2 ; } if ( prefixLength == i ) return <NUM_LIT:0> ; return - <NUM_LIT:1> ; } public static final char [ ] concat ( char [ ] first , char [ ] second ) { if ( first == null ) return second ; if ( second == null ) return first ; int length1 = first . length ; int length2 = second . length ; char [ ] result = new char [ length1 + length2 ] ; System . arraycopy ( first , <NUM_LIT:0> , result , <NUM_LIT:0> , length1 ) ; System . arraycopy ( second , <NUM_LIT:0> , result , length1 , length2 ) ; return result ; } public static final char [ ] concat ( char [ ] first , char [ ] second , char [ ] third ) { if ( first == null ) return concat ( second , third ) ; if ( second == null ) return concat ( first , third ) ; if ( third == null ) return concat ( first , second ) ; int length1 = first . length ; int length2 = second . length ; int length3 = third . length ; char [ ] result = new char [ length1 + length2 + length3 ] ; System . arraycopy ( first , <NUM_LIT:0> , result , <NUM_LIT:0> , length1 ) ; System . arraycopy ( second , <NUM_LIT:0> , result , length1 , length2 ) ; System . arraycopy ( third , <NUM_LIT:0> , result , length1 + length2 , length3 ) ; return result ; } public static final char [ ] concat ( char [ ] first , char [ ] second , char separator ) { if ( first == null ) return second ; if ( second == null ) return first ; int length1 = first . length ; if ( length1 == <NUM_LIT:0> ) return second ; int length2 = second . length ; if ( length2 == <NUM_LIT:0> ) return first ; char [ ] result = new char [ length1 + length2 + <NUM_LIT:1> ] ; System . arraycopy ( first , <NUM_LIT:0> , result , <NUM_LIT:0> , length1 ) ; result [ length1 ] = separator ; System . arraycopy ( second , <NUM_LIT:0> , result , length1 + <NUM_LIT:1> , length2 ) ; return result ; } public static final char [ ] concat ( char [ ] first , char sep1 , char [ ] second , char sep2 , char [ ] third ) { if ( first == null ) return concat ( second , third , sep2 ) ; if ( second == null ) return concat ( first , third , sep1 ) ; if ( third == null ) return concat ( first , second , sep1 ) ; int length1 = first . length ; int length2 = second . length ; int length3 = third . length ; char [ ] result = new char [ length1 + length2 + length3 + <NUM_LIT:2> ] ; System . arraycopy ( first , <NUM_LIT:0> , result , <NUM_LIT:0> , length1 ) ; result [ length1 ] = sep1 ; System . arraycopy ( second , <NUM_LIT:0> , result , length1 + <NUM_LIT:1> , length2 ) ; result [ length1 + length2 + <NUM_LIT:1> ] = sep2 ; System . arraycopy ( third , <NUM_LIT:0> , result , length1 + length2 + <NUM_LIT:2> , length3 ) ; return result ; } public static final char [ ] concat ( char prefix , char [ ] array , char suffix ) { if ( array == null ) return new char [ ] { prefix , suffix } ; int length = array . length ; char [ ] result = new char [ length + <NUM_LIT:2> ] ; result [ <NUM_LIT:0> ] = prefix ; System . arraycopy ( array , <NUM_LIT:0> , result , <NUM_LIT:1> , length ) ; result [ length + <NUM_LIT:1> ] = suffix ; return result ; } public static final char [ ] concatWith ( char [ ] name , char [ ] [ ] array , char separator ) { int nameLength = name == null ? <NUM_LIT:0> : name . length ; if ( nameLength == <NUM_LIT:0> ) return concatWith ( array , separator ) ; int length = array == null ? <NUM_LIT:0> : array . length ; if ( length == <NUM_LIT:0> ) return name ; int size = nameLength ; int index = length ; while ( -- index >= <NUM_LIT:0> ) if ( array [ index ] . length > <NUM_LIT:0> ) size += array [ index ] . length + <NUM_LIT:1> ; char [ ] result = new char [ size ] ; index = size ; for ( int i = length - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { int subLength = array [ i ] . length ; if ( subLength > <NUM_LIT:0> ) { index -= subLength ; System . arraycopy ( array [ i ] , <NUM_LIT:0> , result , index , subLength ) ; result [ -- index ] = separator ; } } System . arraycopy ( name , <NUM_LIT:0> , result , <NUM_LIT:0> , nameLength ) ; return result ; } public static final char [ ] concatWith ( char [ ] [ ] array , char [ ] name , char separator ) { int nameLength = name == null ? <NUM_LIT:0> : name . length ; if ( nameLength == <NUM_LIT:0> ) return concatWith ( array , separator ) ; int length = array == null ? <NUM_LIT:0> : array . length ; if ( length == <NUM_LIT:0> ) return name ; int size = nameLength ; int index = length ; while ( -- index >= <NUM_LIT:0> ) if ( array [ index ] . length > <NUM_LIT:0> ) size += array [ index ] . length + <NUM_LIT:1> ; char [ ] result = new char [ size ] ; index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { int subLength = array [ i ] . length ; if ( subLength > <NUM_LIT:0> ) { System . arraycopy ( array [ i ] , <NUM_LIT:0> , result , index , subLength ) ; index += subLength ; result [ index ++ ] = separator ; } } System . arraycopy ( name , <NUM_LIT:0> , result , index , nameLength ) ; return result ; } public static final char [ ] concatWith ( char [ ] [ ] array , char separator ) { int length = array == null ? <NUM_LIT:0> : array . length ; if ( length == <NUM_LIT:0> ) return CharOperation . NO_CHAR ; int size = length - <NUM_LIT:1> ; int index = length ; while ( -- index >= <NUM_LIT:0> ) { if ( array [ index ] . length == <NUM_LIT:0> ) size -- ; else size += array [ index ] . length ; } if ( size <= <NUM_LIT:0> ) return CharOperation . NO_CHAR ; char [ ] result = new char [ size ] ; index = length ; while ( -- index >= <NUM_LIT:0> ) { length = array [ index ] . length ; if ( length > <NUM_LIT:0> ) { System . arraycopy ( array [ index ] , <NUM_LIT:0> , result , ( size -= length ) , length ) ; if ( -- size >= <NUM_LIT:0> ) result [ size ] = separator ; } } return result ; } public static final boolean contains ( char character , char [ ] [ ] array ) { for ( int i = array . length ; -- i >= <NUM_LIT:0> ; ) { char [ ] subarray = array [ i ] ; for ( int j = subarray . length ; -- j >= <NUM_LIT:0> ; ) if ( subarray [ j ] == character ) return true ; } return false ; } public static final boolean contains ( char character , char [ ] array ) { for ( int i = array . length ; -- i >= <NUM_LIT:0> ; ) if ( array [ i ] == character ) return true ; return false ; } public static final boolean contains ( char [ ] characters , char [ ] array ) { for ( int i = array . length ; -- i >= <NUM_LIT:0> ; ) for ( int j = characters . length ; -- j >= <NUM_LIT:0> ; ) if ( array [ i ] == characters [ j ] ) return true ; return false ; } public static final char [ ] [ ] deepCopy ( char [ ] [ ] toCopy ) { int toCopyLength = toCopy . length ; char [ ] [ ] result = new char [ toCopyLength ] [ ] ; for ( int i = <NUM_LIT:0> ; i < toCopyLength ; i ++ ) { char [ ] toElement = toCopy [ i ] ; int toElementLength = toElement . length ; char [ ] resultElement = new char [ toElementLength ] ; System . arraycopy ( toElement , <NUM_LIT:0> , resultElement , <NUM_LIT:0> , toElementLength ) ; result [ i ] = resultElement ; } return result ; } public static final boolean endsWith ( char [ ] array , char [ ] toBeFound ) { int i = toBeFound . length ; int j = array . length - i ; if ( j < <NUM_LIT:0> ) return false ; while ( -- i >= <NUM_LIT:0> ) if ( toBeFound [ i ] != array [ i + j ] ) return false ; return true ; } public static final boolean equals ( char [ ] [ ] first , char [ ] [ ] second ) { if ( first == second ) return true ; if ( first == null || second == null ) return false ; if ( first . length != second . length ) return false ; for ( int i = first . length ; -- i >= <NUM_LIT:0> ; ) if ( ! equals ( first [ i ] , second [ i ] ) ) return false ; return true ; } public static final boolean equals ( char [ ] [ ] first , char [ ] [ ] second , boolean isCaseSensitive ) { if ( isCaseSensitive ) { return equals ( first , second ) ; } if ( first == second ) return true ; if ( first == null || second == null ) return false ; if ( first . length != second . length ) return false ; for ( int i = first . length ; -- i >= <NUM_LIT:0> ; ) if ( ! equals ( first [ i ] , second [ i ] , false ) ) return false ; return true ; } public static final boolean equals ( char [ ] first , char [ ] second ) { if ( first == second ) return true ; if ( first == null || second == null ) return false ; if ( first . length != second . length ) return false ; for ( int i = first . length ; -- i >= <NUM_LIT:0> ; ) if ( first [ i ] != second [ i ] ) return false ; return true ; } public static final boolean equals ( char [ ] first , char [ ] second , int secondStart , int secondEnd ) { return equals ( first , second , secondStart , secondEnd , true ) ; } public static final boolean equals ( char [ ] first , char [ ] second , int secondStart , int secondEnd , boolean isCaseSensitive ) { if ( first == second ) return true ; if ( first == null || second == null ) return false ; if ( first . length != secondEnd - secondStart ) return false ; if ( isCaseSensitive ) { for ( int i = first . length ; -- i >= <NUM_LIT:0> ; ) if ( first [ i ] != second [ i + secondStart ] ) return false ; } else { for ( int i = first . length ; -- i >= <NUM_LIT:0> ; ) if ( ScannerHelper . toLowerCase ( first [ i ] ) != ScannerHelper . toLowerCase ( second [ i + secondStart ] ) ) return false ; } return true ; } public static final boolean equals ( char [ ] first , char [ ] second , boolean isCaseSensitive ) { if ( isCaseSensitive ) { return equals ( first , second ) ; } if ( first == second ) return true ; if ( first == null || second == null ) return false ; if ( first . length != second . length ) return false ; for ( int i = first . length ; -- i >= <NUM_LIT:0> ; ) if ( ScannerHelper . toLowerCase ( first [ i ] ) != ScannerHelper . toLowerCase ( second [ i ] ) ) return false ; return true ; } public static final boolean fragmentEquals ( char [ ] fragment , char [ ] name , int startIndex , boolean isCaseSensitive ) { int max = fragment . length ; if ( name . length < max + startIndex ) return false ; if ( isCaseSensitive ) { for ( int i = max ; -- i >= <NUM_LIT:0> ; ) if ( fragment [ i ] != name [ i + startIndex ] ) return false ; return true ; } for ( int i = max ; -- i >= <NUM_LIT:0> ; ) if ( ScannerHelper . toLowerCase ( fragment [ i ] ) != ScannerHelper . toLowerCase ( name [ i + startIndex ] ) ) return false ; return true ; } public static final int hashCode ( char [ ] array ) { int length = array . length ; int hash = length == <NUM_LIT:0> ? <NUM_LIT:31> : array [ <NUM_LIT:0> ] ; if ( length < <NUM_LIT:8> ) { for ( int i = length ; -- i > <NUM_LIT:0> ; ) hash = ( hash * <NUM_LIT:31> ) + array [ i ] ; } else { for ( int i = length - <NUM_LIT:1> , last = i > <NUM_LIT:16> ? i - <NUM_LIT:16> : <NUM_LIT:0> ; i > last ; i -= <NUM_LIT:2> ) hash = ( hash * <NUM_LIT:31> ) + array [ i ] ; } return hash & <NUM_LIT> ; } public static boolean isWhitespace ( char c ) { return c < ScannerHelper . MAX_OBVIOUS && ( ( ScannerHelper . OBVIOUS_IDENT_CHAR_NATURES [ c ] & ScannerHelper . C_JLS_SPACE ) != <NUM_LIT:0> ) ; } public static final int indexOf ( char toBeFound , char [ ] array ) { return indexOf ( toBeFound , array , <NUM_LIT:0> ) ; } public static final int indexOf ( char [ ] toBeFound , char [ ] array , boolean isCaseSensitive ) { return indexOf ( toBeFound , array , isCaseSensitive , <NUM_LIT:0> ) ; } public static final int indexOf ( final char [ ] toBeFound , final char [ ] array , final boolean isCaseSensitive , final int start ) { return indexOf ( toBeFound , array , isCaseSensitive , start , array . length ) ; } public static final int indexOf ( final char [ ] toBeFound , final char [ ] array , final boolean isCaseSensitive , final int start , final int end ) { final int arrayLength = end ; final int toBeFoundLength = toBeFound . length ; if ( toBeFoundLength > arrayLength || start < <NUM_LIT:0> ) return - <NUM_LIT:1> ; if ( toBeFoundLength == <NUM_LIT:0> ) return <NUM_LIT:0> ; if ( toBeFoundLength == arrayLength ) { if ( isCaseSensitive ) { for ( int i = start ; i < arrayLength ; i ++ ) { if ( array [ i ] != toBeFound [ i ] ) return - <NUM_LIT:1> ; } return <NUM_LIT:0> ; } else { for ( int i = start ; i < arrayLength ; i ++ ) { if ( ScannerHelper . toLowerCase ( array [ i ] ) != ScannerHelper . toLowerCase ( toBeFound [ i ] ) ) return - <NUM_LIT:1> ; } return <NUM_LIT:0> ; } } if ( isCaseSensitive ) { arrayLoop : for ( int i = start , max = arrayLength - toBeFoundLength + <NUM_LIT:1> ; i < max ; i ++ ) { if ( array [ i ] == toBeFound [ <NUM_LIT:0> ] ) { for ( int j = <NUM_LIT:1> ; j < toBeFoundLength ; j ++ ) { if ( array [ i + j ] != toBeFound [ j ] ) continue arrayLoop ; } return i ; } } } else { arrayLoop : for ( int i = start , max = arrayLength - toBeFoundLength + <NUM_LIT:1> ; i < max ; i ++ ) { if ( ScannerHelper . toLowerCase ( array [ i ] ) == ScannerHelper . toLowerCase ( toBeFound [ <NUM_LIT:0> ] ) ) { for ( int j = <NUM_LIT:1> ; j < toBeFoundLength ; j ++ ) { if ( ScannerHelper . toLowerCase ( array [ i + j ] ) != ScannerHelper . toLowerCase ( toBeFound [ j ] ) ) continue arrayLoop ; } return i ; } } } return - <NUM_LIT:1> ; } public static final int indexOf ( char toBeFound , char [ ] array , int start ) { for ( int i = start ; i < array . length ; i ++ ) if ( toBeFound == array [ i ] ) return i ; return - <NUM_LIT:1> ; } public static final int indexOf ( char toBeFound , char [ ] array , int start , int end ) { for ( int i = start ; i < end ; i ++ ) if ( toBeFound == array [ i ] ) return i ; return - <NUM_LIT:1> ; } public static final int lastIndexOf ( char toBeFound , char [ ] array ) { for ( int i = array . length ; -- i >= <NUM_LIT:0> ; ) if ( toBeFound == array [ i ] ) return i ; return - <NUM_LIT:1> ; } public static final int lastIndexOf ( char toBeFound , char [ ] array , int startIndex ) { for ( int i = array . length ; -- i >= startIndex ; ) if ( toBeFound == array [ i ] ) return i ; return - <NUM_LIT:1> ; } public static final int lastIndexOf ( char toBeFound , char [ ] array , int startIndex , int endIndex ) { for ( int i = endIndex ; -- i >= startIndex ; ) if ( toBeFound == array [ i ] ) return i ; return - <NUM_LIT:1> ; } final static public char [ ] lastSegment ( char [ ] array , char separator ) { int pos = lastIndexOf ( separator , array ) ; if ( pos < <NUM_LIT:0> ) return array ; return subarray ( array , pos + <NUM_LIT:1> , array . length ) ; } public static final boolean match ( char [ ] pattern , char [ ] name , boolean isCaseSensitive ) { if ( name == null ) return false ; if ( pattern == null ) return true ; return match ( pattern , <NUM_LIT:0> , pattern . length , name , <NUM_LIT:0> , name . length , isCaseSensitive ) ; } public static final boolean match ( char [ ] pattern , int patternStart , int patternEnd , char [ ] name , int nameStart , int nameEnd , boolean isCaseSensitive ) { if ( name == null ) return false ; if ( pattern == null ) return true ; int iPattern = patternStart ; int iName = nameStart ; if ( patternEnd < <NUM_LIT:0> ) patternEnd = pattern . length ; if ( nameEnd < <NUM_LIT:0> ) nameEnd = name . length ; char patternChar = <NUM_LIT:0> ; while ( true ) { if ( iPattern == patternEnd ) { if ( iName == nameEnd ) return true ; return false ; } if ( ( patternChar = pattern [ iPattern ] ) == '<CHAR_LIT>' ) { break ; } if ( iName == nameEnd ) { return false ; } if ( patternChar != ( isCaseSensitive ? name [ iName ] : ScannerHelper . toLowerCase ( name [ iName ] ) ) && patternChar != '<CHAR_LIT>' ) { return false ; } iName ++ ; iPattern ++ ; } int segmentStart ; if ( patternChar == '<CHAR_LIT>' ) { segmentStart = ++ iPattern ; } else { segmentStart = <NUM_LIT:0> ; } int prefixStart = iName ; checkSegment : while ( iName < nameEnd ) { if ( iPattern == patternEnd ) { iPattern = segmentStart ; iName = ++ prefixStart ; continue checkSegment ; } if ( ( patternChar = pattern [ iPattern ] ) == '<CHAR_LIT>' ) { segmentStart = ++ iPattern ; if ( segmentStart == patternEnd ) { return true ; } prefixStart = iName ; continue checkSegment ; } if ( ( isCaseSensitive ? name [ iName ] : ScannerHelper . toLowerCase ( name [ iName ] ) ) != patternChar && patternChar != '<CHAR_LIT>' ) { iPattern = segmentStart ; iName = ++ prefixStart ; continue checkSegment ; } iName ++ ; iPattern ++ ; } return ( segmentStart == patternEnd ) || ( iName == nameEnd && iPattern == patternEnd ) || ( iPattern == patternEnd - <NUM_LIT:1> && pattern [ iPattern ] == '<CHAR_LIT>' ) ; } public static final boolean pathMatch ( char [ ] pattern , char [ ] filepath , boolean isCaseSensitive , char pathSeparator ) { if ( filepath == null ) return false ; if ( pattern == null ) return true ; int pSegmentStart = pattern [ <NUM_LIT:0> ] == pathSeparator ? <NUM_LIT:1> : <NUM_LIT:0> ; int pLength = pattern . length ; int pSegmentEnd = CharOperation . indexOf ( pathSeparator , pattern , pSegmentStart + <NUM_LIT:1> ) ; if ( pSegmentEnd < <NUM_LIT:0> ) pSegmentEnd = pLength ; boolean freeTrailingDoubleStar = pattern [ pLength - <NUM_LIT:1> ] == pathSeparator ; int fSegmentStart , fLength = filepath . length ; if ( filepath [ <NUM_LIT:0> ] != pathSeparator ) { fSegmentStart = <NUM_LIT:0> ; } else { fSegmentStart = <NUM_LIT:1> ; } if ( fSegmentStart != pSegmentStart ) { return false ; } int fSegmentEnd = CharOperation . indexOf ( pathSeparator , filepath , fSegmentStart + <NUM_LIT:1> ) ; if ( fSegmentEnd < <NUM_LIT:0> ) fSegmentEnd = fLength ; while ( pSegmentStart < pLength && ! ( pSegmentEnd == pLength && freeTrailingDoubleStar || ( pSegmentEnd == pSegmentStart + <NUM_LIT:2> && pattern [ pSegmentStart ] == '<CHAR_LIT>' && pattern [ pSegmentStart + <NUM_LIT:1> ] == '<CHAR_LIT>' ) ) ) { if ( fSegmentStart >= fLength ) return false ; if ( ! CharOperation . match ( pattern , pSegmentStart , pSegmentEnd , filepath , fSegmentStart , fSegmentEnd , isCaseSensitive ) ) { return false ; } pSegmentEnd = CharOperation . indexOf ( pathSeparator , pattern , pSegmentStart = pSegmentEnd + <NUM_LIT:1> ) ; if ( pSegmentEnd < <NUM_LIT:0> ) pSegmentEnd = pLength ; fSegmentEnd = CharOperation . indexOf ( pathSeparator , filepath , fSegmentStart = fSegmentEnd + <NUM_LIT:1> ) ; if ( fSegmentEnd < <NUM_LIT:0> ) fSegmentEnd = fLength ; } int pSegmentRestart ; if ( ( pSegmentStart >= pLength && freeTrailingDoubleStar ) || ( pSegmentEnd == pSegmentStart + <NUM_LIT:2> && pattern [ pSegmentStart ] == '<CHAR_LIT>' && pattern [ pSegmentStart + <NUM_LIT:1> ] == '<CHAR_LIT>' ) ) { pSegmentEnd = CharOperation . indexOf ( pathSeparator , pattern , pSegmentStart = pSegmentEnd + <NUM_LIT:1> ) ; if ( pSegmentEnd < <NUM_LIT:0> ) pSegmentEnd = pLength ; pSegmentRestart = pSegmentStart ; } else { if ( pSegmentStart >= pLength ) return fSegmentStart >= fLength ; pSegmentRestart = <NUM_LIT:0> ; } int fSegmentRestart = fSegmentStart ; checkSegment : while ( fSegmentStart < fLength ) { if ( pSegmentStart >= pLength ) { if ( freeTrailingDoubleStar ) return true ; pSegmentEnd = CharOperation . indexOf ( pathSeparator , pattern , pSegmentStart = pSegmentRestart ) ; if ( pSegmentEnd < <NUM_LIT:0> ) pSegmentEnd = pLength ; fSegmentRestart = CharOperation . indexOf ( pathSeparator , filepath , fSegmentRestart + <NUM_LIT:1> ) ; if ( fSegmentRestart < <NUM_LIT:0> ) { fSegmentRestart = fLength ; } else { fSegmentRestart ++ ; } fSegmentEnd = CharOperation . indexOf ( pathSeparator , filepath , fSegmentStart = fSegmentRestart ) ; if ( fSegmentEnd < <NUM_LIT:0> ) fSegmentEnd = fLength ; continue checkSegment ; } if ( pSegmentEnd == pSegmentStart + <NUM_LIT:2> && pattern [ pSegmentStart ] == '<CHAR_LIT>' && pattern [ pSegmentStart + <NUM_LIT:1> ] == '<CHAR_LIT>' ) { pSegmentEnd = CharOperation . indexOf ( pathSeparator , pattern , pSegmentStart = pSegmentEnd + <NUM_LIT:1> ) ; if ( pSegmentEnd < <NUM_LIT:0> ) pSegmentEnd = pLength ; pSegmentRestart = pSegmentStart ; fSegmentRestart = fSegmentStart ; if ( pSegmentStart >= pLength ) return true ; continue checkSegment ; } if ( ! CharOperation . match ( pattern , pSegmentStart , pSegmentEnd , filepath , fSegmentStart , fSegmentEnd , isCaseSensitive ) ) { pSegmentEnd = CharOperation . indexOf ( pathSeparator , pattern , pSegmentStart = pSegmentRestart ) ; if ( pSegmentEnd < <NUM_LIT:0> ) pSegmentEnd = pLength ; fSegmentRestart = CharOperation . indexOf ( pathSeparator , filepath , fSegmentRestart + <NUM_LIT:1> ) ; if ( fSegmentRestart < <NUM_LIT:0> ) { fSegmentRestart = fLength ; } else { fSegmentRestart ++ ; } fSegmentEnd = CharOperation . indexOf ( pathSeparator , filepath , fSegmentStart = fSegmentRestart ) ; if ( fSegmentEnd < <NUM_LIT:0> ) fSegmentEnd = fLength ; continue checkSegment ; } pSegmentEnd = CharOperation . indexOf ( pathSeparator , pattern , pSegmentStart = pSegmentEnd + <NUM_LIT:1> ) ; if ( pSegmentEnd < <NUM_LIT:0> ) pSegmentEnd = pLength ; fSegmentEnd = CharOperation . indexOf ( pathSeparator , filepath , fSegmentStart = fSegmentEnd + <NUM_LIT:1> ) ; if ( fSegmentEnd < <NUM_LIT:0> ) fSegmentEnd = fLength ; } return ( pSegmentRestart >= pSegmentEnd ) || ( fSegmentStart >= fLength && pSegmentStart >= pLength ) || ( pSegmentStart == pLength - <NUM_LIT:2> && pattern [ pSegmentStart ] == '<CHAR_LIT>' && pattern [ pSegmentStart + <NUM_LIT:1> ] == '<CHAR_LIT>' ) || ( pSegmentStart == pLength && freeTrailingDoubleStar ) ; } public static final int occurencesOf ( char toBeFound , char [ ] array ) { int count = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < array . length ; i ++ ) if ( toBeFound == array [ i ] ) count ++ ; return count ; } public static final int occurencesOf ( char toBeFound , char [ ] array , int start ) { int count = <NUM_LIT:0> ; for ( int i = start ; i < array . length ; i ++ ) if ( toBeFound == array [ i ] ) count ++ ; return count ; } public static final int parseInt ( char [ ] array , int start , int length ) throws NumberFormatException { if ( length == <NUM_LIT:1> ) { int result = array [ start ] - '<CHAR_LIT:0>' ; if ( result < <NUM_LIT:0> || result > <NUM_LIT:9> ) { throw new NumberFormatException ( "<STR_LIT>" ) ; } return result ; } else { return Integer . parseInt ( new String ( array , start , length ) ) ; } } public static final boolean prefixEquals ( char [ ] prefix , char [ ] name ) { int max = prefix . length ; if ( name . length < max ) return false ; for ( int i = max ; -- i >= <NUM_LIT:0> ; ) if ( prefix [ i ] != name [ i ] ) return false ; return true ; } public static final boolean prefixEquals ( char [ ] prefix , char [ ] name , boolean isCaseSensitive ) { return prefixEquals ( prefix , name , isCaseSensitive , <NUM_LIT:0> ) ; } public static final boolean prefixEquals ( char [ ] prefix , char [ ] name , boolean isCaseSensitive , int startIndex ) { int max = prefix . length ; if ( name . length - startIndex < max ) return false ; if ( isCaseSensitive ) { for ( int i = max ; -- i >= <NUM_LIT:0> ; ) if ( prefix [ i ] != name [ startIndex + i ] ) return false ; return true ; } for ( int i = max ; -- i >= <NUM_LIT:0> ; ) if ( ScannerHelper . toLowerCase ( prefix [ i ] ) != ScannerHelper . toLowerCase ( name [ startIndex + i ] ) ) return false ; return true ; } public static final char [ ] remove ( char [ ] array , char toBeRemoved ) { if ( array == null ) return null ; int length = array . length ; if ( length == <NUM_LIT:0> ) return array ; char [ ] result = null ; int count = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { char c = array [ i ] ; if ( c == toBeRemoved ) { if ( result == null ) { result = new char [ length ] ; System . arraycopy ( array , <NUM_LIT:0> , result , <NUM_LIT:0> , i ) ; count = i ; } } else if ( result != null ) { result [ count ++ ] = c ; } } if ( result == null ) return array ; System . arraycopy ( result , <NUM_LIT:0> , result = new char [ count ] , <NUM_LIT:0> , count ) ; return result ; } public static final void replace ( char [ ] array , char toBeReplaced , char replacementChar ) { if ( toBeReplaced != replacementChar ) { for ( int i = <NUM_LIT:0> , max = array . length ; i < max ; i ++ ) { if ( array [ i ] == toBeReplaced ) array [ i ] = replacementChar ; } } } public static final void replace ( char [ ] array , char [ ] toBeReplaced , char replacementChar ) { replace ( array , toBeReplaced , replacementChar , <NUM_LIT:0> , array . length ) ; } public static final void replace ( char [ ] array , char [ ] toBeReplaced , char replacementChar , int start , int end ) { for ( int i = end ; -- i >= start ; ) for ( int j = toBeReplaced . length ; -- j >= <NUM_LIT:0> ; ) if ( array [ i ] == toBeReplaced [ j ] ) array [ i ] = replacementChar ; } public static final char [ ] replace ( char [ ] array , char [ ] toBeReplaced , char [ ] replacementChars ) { int max = array . length ; int replacedLength = toBeReplaced . length ; int replacementLength = replacementChars . length ; int [ ] starts = new int [ <NUM_LIT:5> ] ; int occurrenceCount = <NUM_LIT:0> ; if ( ! equals ( toBeReplaced , replacementChars ) ) { next : for ( int i = <NUM_LIT:0> ; i < max ; ) { int index = indexOf ( toBeReplaced , array , true , i ) ; if ( index == - <NUM_LIT:1> ) { i ++ ; continue next ; } if ( occurrenceCount == starts . length ) { System . arraycopy ( starts , <NUM_LIT:0> , starts = new int [ occurrenceCount * <NUM_LIT:2> ] , <NUM_LIT:0> , occurrenceCount ) ; } starts [ occurrenceCount ++ ] = index ; i = index + replacedLength ; } } if ( occurrenceCount == <NUM_LIT:0> ) return array ; char [ ] result = new char [ max + occurrenceCount * ( replacementLength - replacedLength ) ] ; int inStart = <NUM_LIT:0> , outStart = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < occurrenceCount ; i ++ ) { int offset = starts [ i ] - inStart ; System . arraycopy ( array , inStart , result , outStart , offset ) ; inStart += offset ; outStart += offset ; System . arraycopy ( replacementChars , <NUM_LIT:0> , result , outStart , replacementLength ) ; inStart += replacedLength ; outStart += replacementLength ; } System . arraycopy ( array , inStart , result , outStart , max - inStart ) ; return result ; } public static final char [ ] replaceOnCopy ( char [ ] array , char toBeReplaced , char replacementChar ) { char [ ] result = null ; for ( int i = <NUM_LIT:0> , length = array . length ; i < length ; i ++ ) { char c = array [ i ] ; if ( c == toBeReplaced ) { if ( result == null ) { result = new char [ length ] ; System . arraycopy ( array , <NUM_LIT:0> , result , <NUM_LIT:0> , i ) ; } result [ i ] = replacementChar ; } else if ( result != null ) { result [ i ] = c ; } } if ( result == null ) return array ; return result ; } public static final char [ ] [ ] splitAndTrimOn ( char divider , char [ ] array ) { int length = array == null ? <NUM_LIT:0> : array . length ; if ( length == <NUM_LIT:0> ) return NO_CHAR_CHAR ; int wordCount = <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) if ( array [ i ] == divider ) wordCount ++ ; char [ ] [ ] split = new char [ wordCount ] [ ] ; int last = <NUM_LIT:0> , currentWord = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( array [ i ] == divider ) { int start = last , end = i - <NUM_LIT:1> ; while ( start < i && array [ start ] == '<CHAR_LIT:U+0020>' ) start ++ ; while ( end > start && array [ end ] == '<CHAR_LIT:U+0020>' ) end -- ; split [ currentWord ] = new char [ end - start + <NUM_LIT:1> ] ; System . arraycopy ( array , start , split [ currentWord ++ ] , <NUM_LIT:0> , end - start + <NUM_LIT:1> ) ; last = i + <NUM_LIT:1> ; } } int start = last , end = length - <NUM_LIT:1> ; while ( start < length && array [ start ] == '<CHAR_LIT:U+0020>' ) start ++ ; while ( end > start && array [ end ] == '<CHAR_LIT:U+0020>' ) end -- ; split [ currentWord ] = new char [ end - start + <NUM_LIT:1> ] ; System . arraycopy ( array , start , split [ currentWord ++ ] , <NUM_LIT:0> , end - start + <NUM_LIT:1> ) ; return split ; } public static final char [ ] [ ] splitOn ( char divider , char [ ] array ) { int length = array == null ? <NUM_LIT:0> : array . length ; if ( length == <NUM_LIT:0> ) return NO_CHAR_CHAR ; int wordCount = <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) if ( array [ i ] == divider ) wordCount ++ ; char [ ] [ ] split = new char [ wordCount ] [ ] ; int last = <NUM_LIT:0> , currentWord = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( array [ i ] == divider ) { split [ currentWord ] = new char [ i - last ] ; System . arraycopy ( array , last , split [ currentWord ++ ] , <NUM_LIT:0> , i - last ) ; last = i + <NUM_LIT:1> ; } } split [ currentWord ] = new char [ length - last ] ; System . arraycopy ( array , last , split [ currentWord ] , <NUM_LIT:0> , length - last ) ; return split ; } public static final char [ ] [ ] splitOn ( char divider , char [ ] array , int start , int end ) { int length = array == null ? <NUM_LIT:0> : array . length ; if ( length == <NUM_LIT:0> || start > end ) return NO_CHAR_CHAR ; int wordCount = <NUM_LIT:1> ; for ( int i = start ; i < end ; i ++ ) if ( array [ i ] == divider ) wordCount ++ ; char [ ] [ ] split = new char [ wordCount ] [ ] ; int last = start , currentWord = <NUM_LIT:0> ; for ( int i = start ; i < end ; i ++ ) { if ( array [ i ] == divider ) { split [ currentWord ] = new char [ i - last ] ; System . arraycopy ( array , last , split [ currentWord ++ ] , <NUM_LIT:0> , i - last ) ; last = i + <NUM_LIT:1> ; } } split [ currentWord ] = new char [ end - last ] ; System . arraycopy ( array , last , split [ currentWord ] , <NUM_LIT:0> , end - last ) ; return split ; } public static final char [ ] [ ] subarray ( char [ ] [ ] array , int start , int end ) { if ( end == - <NUM_LIT:1> ) end = array . length ; if ( start > end ) return null ; if ( start < <NUM_LIT:0> ) return null ; if ( end > array . length ) return null ; char [ ] [ ] result = new char [ end - start ] [ ] ; System . arraycopy ( array , start , result , <NUM_LIT:0> , end - start ) ; return result ; } public static final char [ ] subarray ( char [ ] array , int start , int end ) { if ( end == - <NUM_LIT:1> ) end = array . length ; if ( start > end ) return null ; if ( start < <NUM_LIT:0> ) return null ; if ( end > array . length ) return null ; char [ ] result = new char [ end - start ] ; System . arraycopy ( array , start , result , <NUM_LIT:0> , end - start ) ; return result ; } final static public char [ ] toLowerCase ( char [ ] chars ) { if ( chars == null ) return null ; int length = chars . length ; char [ ] lowerChars = null ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { char c = chars [ i ] ; char lc = ScannerHelper . toLowerCase ( c ) ; if ( ( c != lc ) || ( lowerChars != null ) ) { if ( lowerChars == null ) { System . arraycopy ( chars , <NUM_LIT:0> , lowerChars = new char [ length ] , <NUM_LIT:0> , i ) ; } lowerChars [ i ] = lc ; } } return lowerChars == null ? chars : lowerChars ; } final static public char [ ] toUpperCase ( char [ ] chars ) { if ( chars == null ) return null ; int length = chars . length ; char [ ] upperChars = null ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { char c = chars [ i ] ; char lc = ScannerHelper . toUpperCase ( c ) ; if ( ( c != lc ) || ( upperChars != null ) ) { if ( upperChars == null ) { System . arraycopy ( chars , <NUM_LIT:0> , upperChars = new char [ length ] , <NUM_LIT:0> , i ) ; } upperChars [ i ] = lc ; } } return upperChars == null ? chars : upperChars ; } final static public char [ ] trim ( char [ ] chars ) { if ( chars == null ) return null ; int start = <NUM_LIT:0> , length = chars . length , end = length - <NUM_LIT:1> ; while ( start < length && chars [ start ] == '<CHAR_LIT:U+0020>' ) { start ++ ; } while ( end > start && chars [ end ] == '<CHAR_LIT:U+0020>' ) { end -- ; } if ( start != <NUM_LIT:0> || end != length - <NUM_LIT:1> ) { return subarray ( chars , start , end + <NUM_LIT:1> ) ; } return chars ; } final static public String toString ( char [ ] [ ] array ) { char [ ] result = concatWith ( array , '<CHAR_LIT:.>' ) ; return new String ( result ) ; } final static public String [ ] toStrings ( char [ ] [ ] array ) { if ( array == null ) return NO_STRINGS ; int length = array . length ; if ( length == <NUM_LIT:0> ) return NO_STRINGS ; String [ ] result = new String [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) result [ i ] = new String ( array [ i ] ) ; return result ; } } </s>
|
<s> package org . eclipse . jdt . core . compiler ; import org . eclipse . jdt . internal . compiler . lookup . ProblemReasons ; public interface IProblem { String [ ] getArguments ( ) ; int getID ( ) ; String getMessage ( ) ; char [ ] getOriginatingFileName ( ) ; int getSourceEnd ( ) ; int getSourceLineNumber ( ) ; int getSourceStart ( ) ; boolean isError ( ) ; boolean isWarning ( ) ; void setSourceEnd ( int sourceEnd ) ; void setSourceLineNumber ( int lineNumber ) ; void setSourceStart ( int sourceStart ) ; int TypeRelated = <NUM_LIT> ; int FieldRelated = <NUM_LIT> ; int MethodRelated = <NUM_LIT> ; int ConstructorRelated = <NUM_LIT> ; int ImportRelated = <NUM_LIT> ; int Internal = <NUM_LIT> ; int Syntax = <NUM_LIT> ; int Javadoc = <NUM_LIT> ; int IgnoreCategoriesMask = <NUM_LIT> ; int Unclassified = <NUM_LIT:0> ; int ObjectHasNoSuperclass = TypeRelated + <NUM_LIT:1> ; int UndefinedType = TypeRelated + <NUM_LIT:2> ; int NotVisibleType = TypeRelated + <NUM_LIT:3> ; int AmbiguousType = TypeRelated + <NUM_LIT:4> ; int UsingDeprecatedType = TypeRelated + <NUM_LIT:5> ; int InternalTypeNameProvided = TypeRelated + <NUM_LIT:6> ; int UnusedPrivateType = Internal + TypeRelated + <NUM_LIT:7> ; int IncompatibleTypesInEqualityOperator = TypeRelated + <NUM_LIT:15> ; int IncompatibleTypesInConditionalOperator = TypeRelated + <NUM_LIT:16> ; int TypeMismatch = TypeRelated + <NUM_LIT> ; int IndirectAccessToStaticType = Internal + TypeRelated + <NUM_LIT> ; int MissingEnclosingInstanceForConstructorCall = TypeRelated + <NUM_LIT:20> ; int MissingEnclosingInstance = TypeRelated + <NUM_LIT> ; int IncorrectEnclosingInstanceReference = TypeRelated + <NUM_LIT> ; int IllegalEnclosingInstanceSpecification = TypeRelated + <NUM_LIT> ; int CannotDefineStaticInitializerInLocalType = Internal + <NUM_LIT:24> ; int OuterLocalMustBeFinal = Internal + <NUM_LIT> ; int CannotDefineInterfaceInLocalType = Internal + <NUM_LIT> ; int IllegalPrimitiveOrArrayTypeForEnclosingInstance = TypeRelated + <NUM_LIT> ; int EnclosingInstanceInConstructorCall = Internal + <NUM_LIT> ; int AnonymousClassCannotExtendFinalClass = TypeRelated + <NUM_LIT> ; int CannotDefineAnnotationInLocalType = Internal + <NUM_LIT:30> ; int CannotDefineEnumInLocalType = Internal + <NUM_LIT:31> ; int NonStaticContextForEnumMemberType = Internal + <NUM_LIT:32> ; int TypeHidingType = TypeRelated + <NUM_LIT> ; int UndefinedName = Internal + FieldRelated + <NUM_LIT> ; int UninitializedLocalVariable = Internal + <NUM_LIT> ; int VariableTypeCannotBeVoid = Internal + <NUM_LIT> ; int VariableTypeCannotBeVoidArray = Internal + <NUM_LIT> ; int CannotAllocateVoidArray = Internal + <NUM_LIT> ; int RedefinedLocal = Internal + <NUM_LIT> ; int RedefinedArgument = Internal + <NUM_LIT> ; int DuplicateFinalLocalInitialization = Internal + <NUM_LIT> ; int NonBlankFinalLocalAssignment = Internal + <NUM_LIT> ; int ParameterAssignment = Internal + <NUM_LIT> ; int FinalOuterLocalAssignment = Internal + <NUM_LIT> ; int LocalVariableIsNeverUsed = Internal + <NUM_LIT> ; int ArgumentIsNeverUsed = Internal + <NUM_LIT> ; int BytecodeExceeds64KLimit = Internal + <NUM_LIT> ; int BytecodeExceeds64KLimitForClinit = Internal + <NUM_LIT> ; int TooManyArgumentSlots = Internal + <NUM_LIT> ; int TooManyLocalVariableSlots = Internal + <NUM_LIT> ; int TooManySyntheticArgumentSlots = Internal + <NUM_LIT> ; int TooManyArrayDimensions = Internal + <NUM_LIT> ; int BytecodeExceeds64KLimitForConstructor = Internal + <NUM_LIT> ; int UndefinedField = FieldRelated + <NUM_LIT> ; int NotVisibleField = FieldRelated + <NUM_LIT> ; int AmbiguousField = FieldRelated + <NUM_LIT> ; int UsingDeprecatedField = FieldRelated + <NUM_LIT> ; int NonStaticFieldFromStaticInvocation = FieldRelated + <NUM_LIT> ; int ReferenceToForwardField = FieldRelated + Internal + <NUM_LIT> ; int NonStaticAccessToStaticField = Internal + FieldRelated + <NUM_LIT> ; int UnusedPrivateField = Internal + FieldRelated + <NUM_LIT> ; int IndirectAccessToStaticField = Internal + FieldRelated + <NUM_LIT> ; int UnqualifiedFieldAccess = Internal + FieldRelated + <NUM_LIT> ; int FinalFieldAssignment = FieldRelated + <NUM_LIT> ; int UninitializedBlankFinalField = FieldRelated + <NUM_LIT> ; int DuplicateBlankFinalFieldInitialization = FieldRelated + <NUM_LIT> ; int UnresolvedVariable = FieldRelated + <NUM_LIT> ; int LocalVariableHidingLocalVariable = Internal + <NUM_LIT> ; int LocalVariableHidingField = Internal + FieldRelated + <NUM_LIT> ; int FieldHidingLocalVariable = Internal + FieldRelated + <NUM_LIT> ; int FieldHidingField = Internal + FieldRelated + <NUM_LIT> ; int ArgumentHidingLocalVariable = Internal + <NUM_LIT> ; int ArgumentHidingField = Internal + <NUM_LIT> ; int MissingSerialVersion = Internal + <NUM_LIT> ; int UndefinedMethod = MethodRelated + <NUM_LIT:100> ; int NotVisibleMethod = MethodRelated + <NUM_LIT> ; int AmbiguousMethod = MethodRelated + <NUM_LIT> ; int UsingDeprecatedMethod = MethodRelated + <NUM_LIT> ; int DirectInvocationOfAbstractMethod = MethodRelated + <NUM_LIT> ; int VoidMethodReturnsValue = MethodRelated + <NUM_LIT> ; int MethodReturnsVoid = MethodRelated + <NUM_LIT> ; int MethodRequiresBody = Internal + MethodRelated + <NUM_LIT> ; int ShouldReturnValue = Internal + MethodRelated + <NUM_LIT> ; int MethodButWithConstructorName = MethodRelated + <NUM_LIT> ; int MissingReturnType = TypeRelated + <NUM_LIT> ; int BodyForNativeMethod = Internal + MethodRelated + <NUM_LIT> ; int BodyForAbstractMethod = Internal + MethodRelated + <NUM_LIT> ; int NoMessageSendOnBaseType = MethodRelated + <NUM_LIT> ; int ParameterMismatch = MethodRelated + <NUM_LIT> ; int NoMessageSendOnArrayType = MethodRelated + <NUM_LIT> ; int NonStaticAccessToStaticMethod = Internal + MethodRelated + <NUM_LIT> ; int UnusedPrivateMethod = Internal + MethodRelated + <NUM_LIT> ; int IndirectAccessToStaticMethod = Internal + MethodRelated + <NUM_LIT> ; int MissingTypeInMethod = MethodRelated + <NUM_LIT> ; int MethodCanBeStatic = Internal + MethodRelated + <NUM_LIT> ; int MethodCanBePotentiallyStatic = Internal + MethodRelated + <NUM_LIT> ; int MissingTypeInConstructor = ConstructorRelated + <NUM_LIT> ; int UndefinedConstructor = ConstructorRelated + <NUM_LIT> ; int NotVisibleConstructor = ConstructorRelated + <NUM_LIT> ; int AmbiguousConstructor = ConstructorRelated + <NUM_LIT> ; int UsingDeprecatedConstructor = ConstructorRelated + <NUM_LIT> ; int UnusedPrivateConstructor = Internal + MethodRelated + <NUM_LIT> ; int InstanceFieldDuringConstructorInvocation = ConstructorRelated + <NUM_LIT> ; int InstanceMethodDuringConstructorInvocation = ConstructorRelated + <NUM_LIT> ; int RecursiveConstructorInvocation = ConstructorRelated + <NUM_LIT> ; int ThisSuperDuringConstructorInvocation = ConstructorRelated + <NUM_LIT> ; int InvalidExplicitConstructorCall = ConstructorRelated + Syntax + <NUM_LIT> ; int UndefinedConstructorInDefaultConstructor = ConstructorRelated + <NUM_LIT> ; int NotVisibleConstructorInDefaultConstructor = ConstructorRelated + <NUM_LIT> ; int AmbiguousConstructorInDefaultConstructor = ConstructorRelated + <NUM_LIT> ; int UndefinedConstructorInImplicitConstructorCall = ConstructorRelated + <NUM_LIT> ; int NotVisibleConstructorInImplicitConstructorCall = ConstructorRelated + <NUM_LIT> ; int AmbiguousConstructorInImplicitConstructorCall = ConstructorRelated + <NUM_LIT> ; int UnhandledExceptionInDefaultConstructor = TypeRelated + <NUM_LIT> ; int UnhandledExceptionInImplicitConstructorCall = TypeRelated + <NUM_LIT> ; int UnusedObjectAllocation = Internal + <NUM_LIT> ; int DeadCode = Internal + <NUM_LIT> ; int ArrayReferenceRequired = Internal + <NUM_LIT> ; int NoImplicitStringConversionForCharArrayExpression = Internal + <NUM_LIT> ; int StringConstantIsExceedingUtf8Limit = Internal + <NUM_LIT> ; int NonConstantExpression = Internal + <NUM_LIT> ; int NumericValueOutOfRange = Internal + <NUM_LIT> ; int IllegalCast = TypeRelated + <NUM_LIT> ; int InvalidClassInstantiation = TypeRelated + <NUM_LIT> ; int CannotDefineDimensionExpressionsWithInit = Internal + <NUM_LIT> ; int MustDefineEitherDimensionExpressionsOrInitializer = Internal + <NUM_LIT> ; int InvalidOperator = Internal + <NUM_LIT> ; int CodeCannotBeReached = Internal + <NUM_LIT> ; int CannotReturnInInitializer = Internal + <NUM_LIT> ; int InitializerMustCompleteNormally = Internal + <NUM_LIT> ; int InvalidVoidExpression = Internal + <NUM_LIT> ; int MaskedCatch = TypeRelated + <NUM_LIT> ; int DuplicateDefaultCase = Internal + <NUM_LIT> ; int UnreachableCatch = TypeRelated + MethodRelated + <NUM_LIT> ; int UnhandledException = TypeRelated + <NUM_LIT> ; int IncorrectSwitchType = TypeRelated + <NUM_LIT> ; int DuplicateCase = FieldRelated + <NUM_LIT> ; int DuplicateLabel = Internal + <NUM_LIT> ; int InvalidBreak = Internal + <NUM_LIT> ; int InvalidContinue = Internal + <NUM_LIT> ; int UndefinedLabel = Internal + <NUM_LIT> ; int InvalidTypeToSynchronized = Internal + <NUM_LIT> ; int InvalidNullToSynchronized = Internal + <NUM_LIT> ; int CannotThrowNull = Internal + <NUM_LIT> ; int AssignmentHasNoEffect = Internal + <NUM_LIT> ; int PossibleAccidentalBooleanAssignment = Internal + <NUM_LIT> ; int SuperfluousSemicolon = Internal + <NUM_LIT> ; int UnnecessaryCast = Internal + TypeRelated + <NUM_LIT> ; int UnnecessaryArgumentCast = Internal + TypeRelated + <NUM_LIT> ; int UnnecessaryInstanceof = Internal + TypeRelated + <NUM_LIT> ; int FinallyMustCompleteNormally = Internal + <NUM_LIT> ; int UnusedMethodDeclaredThrownException = Internal + <NUM_LIT> ; int UnusedConstructorDeclaredThrownException = Internal + <NUM_LIT> ; int InvalidCatchBlockSequence = Internal + TypeRelated + <NUM_LIT> ; int EmptyControlFlowStatement = Internal + TypeRelated + <NUM_LIT> ; int UnnecessaryElse = Internal + <NUM_LIT> ; int NeedToEmulateFieldReadAccess = FieldRelated + <NUM_LIT> ; int NeedToEmulateFieldWriteAccess = FieldRelated + <NUM_LIT> ; int NeedToEmulateMethodAccess = MethodRelated + <NUM_LIT> ; int NeedToEmulateConstructorAccess = MethodRelated + <NUM_LIT> ; int FallthroughCase = Internal + <NUM_LIT> ; int InheritedMethodHidesEnclosingName = MethodRelated + <NUM_LIT> ; int InheritedFieldHidesEnclosingName = FieldRelated + <NUM_LIT> ; int InheritedTypeHidesEnclosingName = TypeRelated + <NUM_LIT> ; int IllegalUsageOfQualifiedTypeReference = Internal + Syntax + <NUM_LIT> ; int UnusedLabel = Internal + <NUM_LIT> ; int ThisInStaticContext = Internal + <NUM_LIT> ; int StaticMethodRequested = Internal + MethodRelated + <NUM_LIT> ; int IllegalDimension = Internal + <NUM_LIT> ; int InvalidTypeExpression = Internal + <NUM_LIT> ; int ParsingError = Syntax + Internal + <NUM_LIT> ; int ParsingErrorNoSuggestion = Syntax + Internal + <NUM_LIT> ; int InvalidUnaryExpression = Syntax + Internal + <NUM_LIT> ; int InterfaceCannotHaveConstructors = Syntax + Internal + <NUM_LIT> ; int ArrayConstantsOnlyInArrayInitializers = Syntax + Internal + <NUM_LIT> ; int ParsingErrorOnKeyword = Syntax + Internal + <NUM_LIT> ; int ParsingErrorOnKeywordNoSuggestion = Syntax + Internal + <NUM_LIT> ; int ComparingIdentical = Internal + <NUM_LIT> ; int UnmatchedBracket = Syntax + Internal + <NUM_LIT> ; int NoFieldOnBaseType = FieldRelated + <NUM_LIT> ; int InvalidExpressionAsStatement = Syntax + Internal + <NUM_LIT> ; int ExpressionShouldBeAVariable = Syntax + Internal + <NUM_LIT> ; int MissingSemiColon = Syntax + Internal + <NUM_LIT> ; int InvalidParenthesizedExpression = Syntax + Internal + <NUM_LIT> ; int ParsingErrorInsertTokenBefore = Syntax + Internal + <NUM_LIT> ; int ParsingErrorInsertTokenAfter = Syntax + Internal + <NUM_LIT> ; int ParsingErrorDeleteToken = Syntax + Internal + <NUM_LIT> ; int ParsingErrorDeleteTokens = Syntax + Internal + <NUM_LIT> ; int ParsingErrorMergeTokens = Syntax + Internal + <NUM_LIT> ; int ParsingErrorInvalidToken = Syntax + Internal + <NUM_LIT> ; int ParsingErrorMisplacedConstruct = Syntax + Internal + <NUM_LIT> ; int ParsingErrorReplaceTokens = Syntax + Internal + <NUM_LIT> ; int ParsingErrorNoSuggestionForTokens = Syntax + Internal + <NUM_LIT> ; int ParsingErrorUnexpectedEOF = Syntax + Internal + <NUM_LIT> ; int ParsingErrorInsertToComplete = Syntax + Internal + <NUM_LIT> ; int ParsingErrorInsertToCompleteScope = Syntax + Internal + <NUM_LIT> ; int ParsingErrorInsertToCompletePhrase = Syntax + Internal + <NUM_LIT> ; int EndOfSource = Syntax + Internal + <NUM_LIT> ; int InvalidHexa = Syntax + Internal + <NUM_LIT> ; int InvalidOctal = Syntax + Internal + <NUM_LIT> ; int InvalidCharacterConstant = Syntax + Internal + <NUM_LIT> ; int InvalidEscape = Syntax + Internal + <NUM_LIT> ; int InvalidInput = Syntax + Internal + <NUM_LIT:255> ; int InvalidUnicodeEscape = Syntax + Internal + <NUM_LIT> ; int InvalidFloat = Syntax + Internal + <NUM_LIT> ; int NullSourceString = Syntax + Internal + <NUM_LIT> ; int UnterminatedString = Syntax + Internal + <NUM_LIT> ; int UnterminatedComment = Syntax + Internal + <NUM_LIT> ; int NonExternalizedStringLiteral = Internal + <NUM_LIT> ; int InvalidDigit = Syntax + Internal + <NUM_LIT> ; int InvalidLowSurrogate = Syntax + Internal + <NUM_LIT> ; int InvalidHighSurrogate = Syntax + Internal + <NUM_LIT> ; int UnnecessaryNLSTag = Internal + <NUM_LIT> ; int InvalidBinary = Syntax + Internal + <NUM_LIT> ; int BinaryLiteralNotBelow17 = Syntax + Internal + <NUM_LIT> ; int IllegalUnderscorePosition = Syntax + Internal + <NUM_LIT> ; int UnderscoresInLiteralsNotBelow17 = Syntax + Internal + <NUM_LIT> ; int IllegalHexaLiteral = Syntax + Internal + <NUM_LIT> ; int DiscouragedReference = TypeRelated + <NUM_LIT> ; int InterfaceCannotHaveInitializers = TypeRelated + <NUM_LIT> ; int DuplicateModifierForType = TypeRelated + <NUM_LIT> ; int IllegalModifierForClass = TypeRelated + <NUM_LIT> ; int IllegalModifierForInterface = TypeRelated + <NUM_LIT> ; int IllegalModifierForMemberClass = TypeRelated + <NUM_LIT> ; int IllegalModifierForMemberInterface = TypeRelated + <NUM_LIT> ; int IllegalModifierForLocalClass = TypeRelated + <NUM_LIT> ; int ForbiddenReference = TypeRelated + <NUM_LIT> ; int IllegalModifierCombinationFinalAbstractForClass = TypeRelated + <NUM_LIT> ; int IllegalVisibilityModifierForInterfaceMemberType = TypeRelated + <NUM_LIT> ; int IllegalVisibilityModifierCombinationForMemberType = TypeRelated + <NUM_LIT> ; int IllegalStaticModifierForMemberType = TypeRelated + <NUM_LIT> ; int SuperclassMustBeAClass = TypeRelated + <NUM_LIT> ; int ClassExtendFinalClass = TypeRelated + <NUM_LIT> ; int DuplicateSuperInterface = TypeRelated + <NUM_LIT> ; int SuperInterfaceMustBeAnInterface = TypeRelated + <NUM_LIT> ; int HierarchyCircularitySelfReference = TypeRelated + <NUM_LIT> ; int HierarchyCircularity = TypeRelated + <NUM_LIT> ; int HidingEnclosingType = TypeRelated + <NUM_LIT> ; int DuplicateNestedType = TypeRelated + <NUM_LIT> ; int CannotThrowType = TypeRelated + <NUM_LIT> ; int PackageCollidesWithType = TypeRelated + <NUM_LIT> ; int TypeCollidesWithPackage = TypeRelated + <NUM_LIT> ; int DuplicateTypes = TypeRelated + <NUM_LIT> ; int IsClassPathCorrect = TypeRelated + <NUM_LIT> ; int PublicClassMustMatchFileName = TypeRelated + <NUM_LIT> ; int MustSpecifyPackage = Internal + <NUM_LIT> ; int HierarchyHasProblems = TypeRelated + <NUM_LIT> ; int PackageIsNotExpectedPackage = Internal + <NUM_LIT> ; int ObjectCannotHaveSuperTypes = Internal + <NUM_LIT> ; int ObjectMustBeClass = Internal + <NUM_LIT> ; int RedundantSuperinterface = TypeRelated + <NUM_LIT> ; int ShouldImplementHashcode = TypeRelated + <NUM_LIT> ; int AbstractMethodsInConcreteClass = TypeRelated + <NUM_LIT> ; int SuperclassNotFound = TypeRelated + <NUM_LIT> + ProblemReasons . NotFound ; int SuperclassNotVisible = TypeRelated + <NUM_LIT> + ProblemReasons . NotVisible ; int SuperclassAmbiguous = TypeRelated + <NUM_LIT> + ProblemReasons . Ambiguous ; int SuperclassInternalNameProvided = TypeRelated + <NUM_LIT> + ProblemReasons . InternalNameProvided ; int SuperclassInheritedNameHidesEnclosingName = TypeRelated + <NUM_LIT> + ProblemReasons . InheritedNameHidesEnclosingName ; int InterfaceNotFound = TypeRelated + <NUM_LIT> + ProblemReasons . NotFound ; int InterfaceNotVisible = TypeRelated + <NUM_LIT> + ProblemReasons . NotVisible ; int InterfaceAmbiguous = TypeRelated + <NUM_LIT> + ProblemReasons . Ambiguous ; int InterfaceInternalNameProvided = TypeRelated + <NUM_LIT> + ProblemReasons . InternalNameProvided ; int InterfaceInheritedNameHidesEnclosingName = TypeRelated + <NUM_LIT> + ProblemReasons . InheritedNameHidesEnclosingName ; int DuplicateField = FieldRelated + <NUM_LIT> ; int DuplicateModifierForField = FieldRelated + <NUM_LIT> ; int IllegalModifierForField = FieldRelated + <NUM_LIT> ; int IllegalModifierForInterfaceField = FieldRelated + <NUM_LIT> ; int IllegalVisibilityModifierCombinationForField = FieldRelated + <NUM_LIT> ; int IllegalModifierCombinationFinalVolatileForField = FieldRelated + <NUM_LIT> ; int UnexpectedStaticModifierForField = FieldRelated + <NUM_LIT> ; int FieldTypeNotFound = FieldRelated + <NUM_LIT> + ProblemReasons . NotFound ; int FieldTypeNotVisible = FieldRelated + <NUM_LIT> + ProblemReasons . NotVisible ; int FieldTypeAmbiguous = FieldRelated + <NUM_LIT> + ProblemReasons . Ambiguous ; int FieldTypeInternalNameProvided = FieldRelated + <NUM_LIT> + ProblemReasons . InternalNameProvided ; int FieldTypeInheritedNameHidesEnclosingName = FieldRelated + <NUM_LIT> + ProblemReasons . InheritedNameHidesEnclosingName ; int DuplicateMethod = MethodRelated + <NUM_LIT> ; int IllegalModifierForArgument = MethodRelated + <NUM_LIT> ; int DuplicateModifierForMethod = MethodRelated + <NUM_LIT> ; int IllegalModifierForMethod = MethodRelated + <NUM_LIT> ; int IllegalModifierForInterfaceMethod = MethodRelated + <NUM_LIT> ; int IllegalVisibilityModifierCombinationForMethod = MethodRelated + <NUM_LIT> ; int UnexpectedStaticModifierForMethod = MethodRelated + <NUM_LIT> ; int IllegalAbstractModifierCombinationForMethod = MethodRelated + <NUM_LIT> ; int AbstractMethodInAbstractClass = MethodRelated + <NUM_LIT> ; int ArgumentTypeCannotBeVoid = MethodRelated + <NUM_LIT> ; int ArgumentTypeCannotBeVoidArray = MethodRelated + <NUM_LIT> ; int ReturnTypeCannotBeVoidArray = MethodRelated + <NUM_LIT> ; int NativeMethodsCannotBeStrictfp = MethodRelated + <NUM_LIT> ; int DuplicateModifierForArgument = MethodRelated + <NUM_LIT> ; int IllegalModifierForConstructor = MethodRelated + <NUM_LIT> ; int ArgumentTypeNotFound = MethodRelated + <NUM_LIT> + ProblemReasons . NotFound ; int ArgumentTypeNotVisible = MethodRelated + <NUM_LIT> + ProblemReasons . NotVisible ; int ArgumentTypeAmbiguous = MethodRelated + <NUM_LIT> + ProblemReasons . Ambiguous ; int ArgumentTypeInternalNameProvided = MethodRelated + <NUM_LIT> + ProblemReasons . InternalNameProvided ; int ArgumentTypeInheritedNameHidesEnclosingName = MethodRelated + <NUM_LIT> + ProblemReasons . InheritedNameHidesEnclosingName ; int ExceptionTypeNotFound = MethodRelated + <NUM_LIT> + ProblemReasons . NotFound ; int ExceptionTypeNotVisible = MethodRelated + <NUM_LIT> + ProblemReasons . NotVisible ; int ExceptionTypeAmbiguous = MethodRelated + <NUM_LIT> + ProblemReasons . Ambiguous ; int ExceptionTypeInternalNameProvided = MethodRelated + <NUM_LIT> + ProblemReasons . InternalNameProvided ; int ExceptionTypeInheritedNameHidesEnclosingName = MethodRelated + <NUM_LIT> + ProblemReasons . InheritedNameHidesEnclosingName ; int ReturnTypeNotFound = MethodRelated + <NUM_LIT> + ProblemReasons . NotFound ; int ReturnTypeNotVisible = MethodRelated + <NUM_LIT> + ProblemReasons . NotVisible ; int ReturnTypeAmbiguous = MethodRelated + <NUM_LIT> + ProblemReasons . Ambiguous ; int ReturnTypeInternalNameProvided = MethodRelated + <NUM_LIT> + ProblemReasons . InternalNameProvided ; int ReturnTypeInheritedNameHidesEnclosingName = MethodRelated + <NUM_LIT> + ProblemReasons . InheritedNameHidesEnclosingName ; int ConflictingImport = ImportRelated + <NUM_LIT> ; int DuplicateImport = ImportRelated + <NUM_LIT> ; int CannotImportPackage = ImportRelated + <NUM_LIT> ; int UnusedImport = ImportRelated + <NUM_LIT> ; int ImportNotFound = ImportRelated + <NUM_LIT> + ProblemReasons . NotFound ; int ImportNotVisible = ImportRelated + <NUM_LIT> + ProblemReasons . NotVisible ; int ImportAmbiguous = ImportRelated + <NUM_LIT> + ProblemReasons . Ambiguous ; int ImportInternalNameProvided = ImportRelated + <NUM_LIT> + ProblemReasons . InternalNameProvided ; int ImportInheritedNameHidesEnclosingName = ImportRelated + <NUM_LIT> + ProblemReasons . InheritedNameHidesEnclosingName ; int InvalidTypeForStaticImport = ImportRelated + <NUM_LIT> ; int DuplicateModifierForVariable = MethodRelated + <NUM_LIT> ; int IllegalModifierForVariable = MethodRelated + <NUM_LIT> ; int LocalVariableCannotBeNull = Internal + <NUM_LIT> ; int LocalVariableCanOnlyBeNull = Internal + <NUM_LIT> ; int LocalVariableMayBeNull = Internal + <NUM_LIT> ; int AbstractMethodMustBeImplemented = MethodRelated + <NUM_LIT> ; int FinalMethodCannotBeOverridden = MethodRelated + <NUM_LIT> ; int IncompatibleExceptionInThrowsClause = MethodRelated + <NUM_LIT> ; int IncompatibleExceptionInInheritedMethodThrowsClause = MethodRelated + <NUM_LIT> ; int IncompatibleReturnType = MethodRelated + <NUM_LIT> ; int InheritedMethodReducesVisibility = MethodRelated + <NUM_LIT> ; int CannotOverrideAStaticMethodWithAnInstanceMethod = MethodRelated + <NUM_LIT> ; int CannotHideAnInstanceMethodWithAStaticMethod = MethodRelated + <NUM_LIT> ; int StaticInheritedMethodConflicts = MethodRelated + <NUM_LIT> ; int MethodReducesVisibility = MethodRelated + <NUM_LIT> ; int OverridingNonVisibleMethod = MethodRelated + <NUM_LIT> ; int AbstractMethodCannotBeOverridden = MethodRelated + <NUM_LIT> ; int OverridingDeprecatedMethod = MethodRelated + <NUM_LIT> ; int IncompatibleReturnTypeForNonInheritedInterfaceMethod = MethodRelated + <NUM_LIT> ; int IncompatibleExceptionInThrowsClauseForNonInheritedInterfaceMethod = MethodRelated + <NUM_LIT> ; int IllegalVararg = MethodRelated + <NUM_LIT> ; int OverridingMethodWithoutSuperInvocation = MethodRelated + <NUM_LIT> ; int MissingSynchronizedModifierInInheritedMethod = MethodRelated + <NUM_LIT> ; int AbstractMethodMustBeImplementedOverConcreteMethod = MethodRelated + <NUM_LIT> ; int InheritedIncompatibleReturnType = MethodRelated + <NUM_LIT> ; int CodeSnippetMissingClass = Internal + <NUM_LIT> ; int CodeSnippetMissingMethod = Internal + <NUM_LIT> ; int CannotUseSuperInCodeSnippet = Internal + <NUM_LIT> ; int TooManyConstantsInConstantPool = Internal + <NUM_LIT> ; int TooManyBytesForStringConstant = Internal + <NUM_LIT> ; int TooManyFields = Internal + <NUM_LIT> ; int TooManyMethods = Internal + <NUM_LIT> ; int TooManyParametersForSyntheticMethod = Internal + <NUM_LIT> ; int UseAssertAsAnIdentifier = Internal + <NUM_LIT> ; int UseEnumAsAnIdentifier = Internal + <NUM_LIT> ; int EnumConstantsCannotBeSurroundedByParenthesis = Syntax + Internal + <NUM_LIT> ; int Task = Internal + <NUM_LIT> ; int NullLocalVariableReference = Internal + <NUM_LIT> ; int PotentialNullLocalVariableReference = Internal + <NUM_LIT> ; int RedundantNullCheckOnNullLocalVariable = Internal + <NUM_LIT> ; int NullLocalVariableComparisonYieldsFalse = Internal + <NUM_LIT> ; int RedundantLocalVariableNullAssignment = Internal + <NUM_LIT> ; int NullLocalVariableInstanceofYieldsFalse = Internal + <NUM_LIT> ; int RedundantNullCheckOnNonNullLocalVariable = Internal + <NUM_LIT> ; int NonNullLocalVariableComparisonYieldsFalse = Internal + <NUM_LIT> ; int UndocumentedEmptyBlock = Internal + <NUM_LIT> ; int JavadocInvalidSeeUrlReference = Javadoc + Internal + <NUM_LIT> ; int JavadocMissingTagDescription = Javadoc + Internal + <NUM_LIT> ; int JavadocDuplicateTag = Javadoc + Internal + <NUM_LIT> ; int JavadocHiddenReference = Javadoc + Internal + <NUM_LIT> ; int JavadocInvalidMemberTypeQualification = Javadoc + Internal + <NUM_LIT> ; int JavadocMissingIdentifier = Javadoc + Internal + <NUM_LIT> ; int JavadocNonStaticTypeFromStaticInvocation = Javadoc + Internal + <NUM_LIT> ; int JavadocInvalidParamTagTypeParameter = Javadoc + Internal + <NUM_LIT> ; int JavadocUnexpectedTag = Javadoc + Internal + <NUM_LIT> ; int JavadocMissingParamTag = Javadoc + Internal + <NUM_LIT> ; int JavadocMissingParamName = Javadoc + Internal + <NUM_LIT> ; int JavadocDuplicateParamName = Javadoc + Internal + <NUM_LIT> ; int JavadocInvalidParamName = Javadoc + Internal + <NUM_LIT> ; int JavadocMissingReturnTag = Javadoc + Internal + <NUM_LIT> ; int JavadocDuplicateReturnTag = Javadoc + Internal + <NUM_LIT> ; int JavadocMissingThrowsTag = Javadoc + Internal + <NUM_LIT> ; int JavadocMissingThrowsClassName = Javadoc + Internal + <NUM_LIT> ; int JavadocInvalidThrowsClass = Javadoc + Internal + <NUM_LIT> ; int JavadocDuplicateThrowsClassName = Javadoc + Internal + <NUM_LIT> ; int JavadocInvalidThrowsClassName = Javadoc + Internal + <NUM_LIT> ; int JavadocMissingSeeReference = Javadoc + Internal + <NUM_LIT> ; int JavadocInvalidSeeReference = Javadoc + Internal + <NUM_LIT> ; int JavadocInvalidSeeHref = Javadoc + Internal + <NUM_LIT> ; int JavadocInvalidSeeArgs = Javadoc + Internal + <NUM_LIT> ; int JavadocMissing = Javadoc + Internal + <NUM_LIT> ; int JavadocInvalidTag = Javadoc + Internal + <NUM_LIT> ; int JavadocUndefinedField = Javadoc + Internal + <NUM_LIT> ; int JavadocNotVisibleField = Javadoc + Internal + <NUM_LIT> ; int JavadocAmbiguousField = Javadoc + Internal + <NUM_LIT> ; int JavadocUsingDeprecatedField = Javadoc + Internal + <NUM_LIT> ; int JavadocUndefinedConstructor = Javadoc + Internal + <NUM_LIT> ; int JavadocNotVisibleConstructor = Javadoc + Internal + <NUM_LIT> ; int JavadocAmbiguousConstructor = Javadoc + Internal + <NUM_LIT> ; int JavadocUsingDeprecatedConstructor = Javadoc + Internal + <NUM_LIT> ; int JavadocUndefinedMethod = Javadoc + Internal + <NUM_LIT> ; int JavadocNotVisibleMethod = Javadoc + Internal + <NUM_LIT> ; int JavadocAmbiguousMethod = Javadoc + Internal + <NUM_LIT> ; int JavadocUsingDeprecatedMethod = Javadoc + Internal + <NUM_LIT> ; int JavadocNoMessageSendOnBaseType = Javadoc + Internal + <NUM_LIT> ; int JavadocParameterMismatch = Javadoc + Internal + <NUM_LIT> ; int JavadocNoMessageSendOnArrayType = Javadoc + Internal + <NUM_LIT> ; int JavadocUndefinedType = Javadoc + Internal + <NUM_LIT> ; int JavadocNotVisibleType = Javadoc + Internal + <NUM_LIT> ; int JavadocAmbiguousType = Javadoc + Internal + <NUM_LIT> ; int JavadocUsingDeprecatedType = Javadoc + Internal + <NUM_LIT> ; int JavadocInternalTypeNameProvided = Javadoc + Internal + <NUM_LIT> ; int JavadocInheritedMethodHidesEnclosingName = Javadoc + Internal + <NUM_LIT> ; int JavadocInheritedFieldHidesEnclosingName = Javadoc + Internal + <NUM_LIT> ; int JavadocInheritedNameHidesEnclosingTypeName = Javadoc + Internal + <NUM_LIT> ; int JavadocAmbiguousMethodReference = Javadoc + Internal + <NUM_LIT> ; int JavadocUnterminatedInlineTag = Javadoc + Internal + <NUM_LIT> ; int JavadocMalformedSeeReference = Javadoc + Internal + <NUM_LIT> ; int JavadocMessagePrefix = Internal + <NUM_LIT> ; int JavadocMissingHashCharacter = Javadoc + Internal + <NUM_LIT> ; int JavadocEmptyReturnTag = Javadoc + Internal + <NUM_LIT> ; int JavadocInvalidValueReference = Javadoc + Internal + <NUM_LIT> ; int JavadocUnexpectedText = Javadoc + Internal + <NUM_LIT> ; int JavadocInvalidParamTagName = Javadoc + Internal + <NUM_LIT> ; int DuplicateTypeVariable = Internal + <NUM_LIT> ; int IllegalTypeVariableSuperReference = Internal + <NUM_LIT> ; int NonStaticTypeFromStaticInvocation = Internal + <NUM_LIT> ; int ObjectCannotBeGeneric = Internal + <NUM_LIT> ; int NonGenericType = TypeRelated + <NUM_LIT> ; int IncorrectArityForParameterizedType = TypeRelated + <NUM_LIT> ; int TypeArgumentMismatch = TypeRelated + <NUM_LIT> ; int DuplicateMethodErasure = TypeRelated + <NUM_LIT> ; int ReferenceToForwardTypeVariable = TypeRelated + <NUM_LIT> ; int BoundMustBeAnInterface = TypeRelated + <NUM_LIT> ; int UnsafeRawConstructorInvocation = TypeRelated + <NUM_LIT> ; int UnsafeRawMethodInvocation = TypeRelated + <NUM_LIT> ; int UnsafeTypeConversion = TypeRelated + <NUM_LIT> ; int InvalidTypeVariableExceptionType = TypeRelated + <NUM_LIT> ; int InvalidParameterizedExceptionType = TypeRelated + <NUM_LIT> ; int IllegalGenericArray = TypeRelated + <NUM_LIT> ; int UnsafeRawFieldAssignment = TypeRelated + <NUM_LIT> ; int FinalBoundForTypeVariable = TypeRelated + <NUM_LIT> ; int UndefinedTypeVariable = Internal + <NUM_LIT> ; int SuperInterfacesCollide = TypeRelated + <NUM_LIT> ; int WildcardConstructorInvocation = TypeRelated + <NUM_LIT> ; int WildcardMethodInvocation = TypeRelated + <NUM_LIT> ; int WildcardFieldAssignment = TypeRelated + <NUM_LIT> ; int GenericMethodTypeArgumentMismatch = TypeRelated + <NUM_LIT> ; int GenericConstructorTypeArgumentMismatch = TypeRelated + <NUM_LIT> ; int UnsafeGenericCast = TypeRelated + <NUM_LIT> ; int IllegalInstanceofParameterizedType = Internal + <NUM_LIT> ; int IllegalInstanceofTypeParameter = Internal + <NUM_LIT> ; int NonGenericMethod = TypeRelated + <NUM_LIT> ; int IncorrectArityForParameterizedMethod = TypeRelated + <NUM_LIT> ; int ParameterizedMethodArgumentTypeMismatch = TypeRelated + <NUM_LIT> ; int NonGenericConstructor = TypeRelated + <NUM_LIT> ; int IncorrectArityForParameterizedConstructor = TypeRelated + <NUM_LIT> ; int ParameterizedConstructorArgumentTypeMismatch = TypeRelated + <NUM_LIT> ; int TypeArgumentsForRawGenericMethod = TypeRelated + <NUM_LIT> ; int TypeArgumentsForRawGenericConstructor = TypeRelated + <NUM_LIT> ; int SuperTypeUsingWildcard = TypeRelated + <NUM_LIT> ; int GenericTypeCannotExtendThrowable = TypeRelated + <NUM_LIT> ; int IllegalClassLiteralForTypeVariable = TypeRelated + <NUM_LIT> ; int UnsafeReturnTypeOverride = MethodRelated + <NUM_LIT> ; int MethodNameClash = MethodRelated + <NUM_LIT> ; int RawMemberTypeCannotBeParameterized = TypeRelated + <NUM_LIT> ; int MissingArgumentsForParameterizedMemberType = TypeRelated + <NUM_LIT> ; int StaticMemberOfParameterizedType = TypeRelated + <NUM_LIT> ; int BoundHasConflictingArguments = TypeRelated + <NUM_LIT> ; int DuplicateParameterizedMethods = MethodRelated + <NUM_LIT> ; int IllegalQualifiedParameterizedTypeAllocation = TypeRelated + <NUM_LIT> ; int DuplicateBounds = TypeRelated + <NUM_LIT> ; int BoundCannotBeArray = TypeRelated + <NUM_LIT> ; int UnsafeRawGenericConstructorInvocation = TypeRelated + <NUM_LIT> ; int UnsafeRawGenericMethodInvocation = TypeRelated + <NUM_LIT> ; int TypeParameterHidingType = TypeRelated + <NUM_LIT> ; int RawTypeReference = TypeRelated + <NUM_LIT> ; int NoAdditionalBoundAfterTypeVariable = TypeRelated + <NUM_LIT> ; int UnsafeGenericArrayForVarargs = MethodRelated + <NUM_LIT> ; int IllegalAccessFromTypeVariable = TypeRelated + <NUM_LIT> ; int TypeHidingTypeParameterFromType = TypeRelated + <NUM_LIT> ; int TypeHidingTypeParameterFromMethod = TypeRelated + <NUM_LIT> ; int InvalidUsageOfWildcard = Syntax + Internal + <NUM_LIT> ; int UnusedTypeArgumentsForMethodInvocation = MethodRelated + <NUM_LIT> ; int IncompatibleTypesInForeach = TypeRelated + <NUM_LIT> ; int InvalidTypeForCollection = Internal + <NUM_LIT> ; int InvalidTypeForCollectionTarget14 = Internal + <NUM_LIT> ; int DuplicateInheritedMethods = MethodRelated + <NUM_LIT> ; int InvalidUsageOfTypeParameters = Syntax + Internal + <NUM_LIT> ; int InvalidUsageOfStaticImports = Syntax + Internal + <NUM_LIT> ; int InvalidUsageOfForeachStatements = Syntax + Internal + <NUM_LIT> ; int InvalidUsageOfTypeArguments = Syntax + Internal + <NUM_LIT> ; int InvalidUsageOfEnumDeclarations = Syntax + Internal + <NUM_LIT> ; int InvalidUsageOfVarargs = Syntax + Internal + <NUM_LIT> ; int InvalidUsageOfAnnotations = Syntax + Internal + <NUM_LIT> ; int InvalidUsageOfAnnotationDeclarations = Syntax + Internal + <NUM_LIT> ; int InvalidUsageOfTypeParametersForAnnotationDeclaration = Syntax + Internal + <NUM_LIT> ; int InvalidUsageOfTypeParametersForEnumDeclaration = Syntax + Internal + <NUM_LIT> ; int IllegalModifierForAnnotationMethod = MethodRelated + <NUM_LIT> ; int IllegalExtendedDimensions = MethodRelated + <NUM_LIT> ; int InvalidFileNameForPackageAnnotations = Syntax + Internal + <NUM_LIT> ; int IllegalModifierForAnnotationType = TypeRelated + <NUM_LIT> ; int IllegalModifierForAnnotationMemberType = TypeRelated + <NUM_LIT> ; int InvalidAnnotationMemberType = TypeRelated + <NUM_LIT> ; int AnnotationCircularitySelfReference = TypeRelated + <NUM_LIT> ; int AnnotationCircularity = TypeRelated + <NUM_LIT> ; int DuplicateAnnotation = TypeRelated + <NUM_LIT> ; int MissingValueForAnnotationMember = TypeRelated + <NUM_LIT> ; int DuplicateAnnotationMember = Internal + <NUM_LIT> ; int UndefinedAnnotationMember = MethodRelated + <NUM_LIT> ; int AnnotationValueMustBeClassLiteral = Internal + <NUM_LIT> ; int AnnotationValueMustBeConstant = Internal + <NUM_LIT> ; int AnnotationFieldNeedConstantInitialization = Internal + <NUM_LIT> ; int IllegalModifierForAnnotationField = Internal + <NUM_LIT> ; int AnnotationCannotOverrideMethod = MethodRelated + <NUM_LIT> ; int AnnotationMembersCannotHaveParameters = Syntax + Internal + <NUM_LIT> ; int AnnotationMembersCannotHaveTypeParameters = Syntax + Internal + <NUM_LIT> ; int AnnotationTypeDeclarationCannotHaveSuperclass = Syntax + Internal + <NUM_LIT> ; int AnnotationTypeDeclarationCannotHaveSuperinterfaces = Syntax + Internal + <NUM_LIT> ; int DuplicateTargetInTargetAnnotation = Internal + <NUM_LIT> ; int DisallowedTargetForAnnotation = TypeRelated + <NUM_LIT> ; int MethodMustOverride = MethodRelated + <NUM_LIT> ; int AnnotationTypeDeclarationCannotHaveConstructor = Syntax + Internal + <NUM_LIT> ; int AnnotationValueMustBeAnnotation = Internal + <NUM_LIT> ; int AnnotationTypeUsedAsSuperInterface = TypeRelated + <NUM_LIT> ; int MissingOverrideAnnotation = MethodRelated + <NUM_LIT> ; int FieldMissingDeprecatedAnnotation = Internal + <NUM_LIT> ; int MethodMissingDeprecatedAnnotation = Internal + <NUM_LIT> ; int TypeMissingDeprecatedAnnotation = Internal + <NUM_LIT> ; int UnhandledWarningToken = Internal + <NUM_LIT> ; int AnnotationValueMustBeArrayInitializer = Internal + <NUM_LIT> ; int AnnotationValueMustBeAnEnumConstant = Internal + <NUM_LIT> ; int MethodMustOverrideOrImplement = MethodRelated + <NUM_LIT> ; int UnusedWarningToken = Internal + <NUM_LIT> ; int MissingOverrideAnnotationForInterfaceMethodImplementation = MethodRelated + <NUM_LIT> ; int UnusedTypeArgumentsForConstructorInvocation = MethodRelated + <NUM_LIT> ; int CorruptedSignature = Internal + <NUM_LIT> ; int InvalidEncoding = Internal + <NUM_LIT> ; int CannotReadSource = Internal + <NUM_LIT> ; int BoxingConversion = Internal + <NUM_LIT> ; int UnboxingConversion = Internal + <NUM_LIT> ; int IllegalModifierForEnum = TypeRelated + <NUM_LIT> ; int IllegalModifierForEnumConstant = FieldRelated + <NUM_LIT> ; int IllegalModifierForLocalEnum = TypeRelated + <NUM_LIT> ; int IllegalModifierForMemberEnum = TypeRelated + <NUM_LIT> ; int CannotDeclareEnumSpecialMethod = MethodRelated + <NUM_LIT> ; int IllegalQualifiedEnumConstantLabel = FieldRelated + <NUM_LIT> ; int CannotExtendEnum = TypeRelated + <NUM_LIT> ; int CannotInvokeSuperConstructorInEnum = MethodRelated + <NUM_LIT> ; int EnumAbstractMethodMustBeImplemented = MethodRelated + <NUM_LIT> ; int EnumSwitchCannotTargetField = FieldRelated + <NUM_LIT> ; int IllegalModifierForEnumConstructor = MethodRelated + <NUM_LIT> ; int MissingEnumConstantCase = FieldRelated + <NUM_LIT> ; int EnumStaticFieldInInInitializerContext = FieldRelated + <NUM_LIT> ; int EnumConstantMustImplementAbstractMethod = MethodRelated + <NUM_LIT> ; int EnumConstantCannotDefineAbstractMethod = MethodRelated + <NUM_LIT> ; int AbstractMethodInEnum = MethodRelated + <NUM_LIT> ; int IllegalExtendedDimensionsForVarArgs = Syntax + Internal + <NUM_LIT> ; int MethodVarargsArgumentNeedCast = MethodRelated + <NUM_LIT> ; int ConstructorVarargsArgumentNeedCast = ConstructorRelated + <NUM_LIT> ; int VarargsConflict = MethodRelated + <NUM_LIT> ; int SafeVarargsOnFixedArityMethod = MethodRelated + <NUM_LIT> ; int SafeVarargsOnNonFinalInstanceMethod = MethodRelated + <NUM_LIT> ; int PotentialHeapPollutionFromVararg = MethodRelated + <NUM_LIT> ; int JavadocGenericMethodTypeArgumentMismatch = Javadoc + Internal + <NUM_LIT> ; int JavadocNonGenericMethod = Javadoc + Internal + <NUM_LIT> ; int JavadocIncorrectArityForParameterizedMethod = Javadoc + Internal + <NUM_LIT> ; int JavadocParameterizedMethodArgumentTypeMismatch = Javadoc + Internal + <NUM_LIT> ; int JavadocTypeArgumentsForRawGenericMethod = Javadoc + Internal + <NUM_LIT> ; int JavadocGenericConstructorTypeArgumentMismatch = Javadoc + Internal + <NUM_LIT> ; int JavadocNonGenericConstructor = Javadoc + Internal + <NUM_LIT> ; int JavadocIncorrectArityForParameterizedConstructor = Javadoc + Internal + <NUM_LIT> ; int JavadocParameterizedConstructorArgumentTypeMismatch = Javadoc + Internal + <NUM_LIT> ; int JavadocTypeArgumentsForRawGenericConstructor = Javadoc + Internal + <NUM_LIT> ; int AssignmentToMultiCatchParameter = Internal + <NUM_LIT> ; int ResourceHasToImplementAutoCloseable = TypeRelated + <NUM_LIT> ; int AssignmentToResource = Internal + <NUM_LIT> ; int InvalidUnionTypeReferenceSequence = Internal + TypeRelated + <NUM_LIT> ; int AutoManagedResourceNotBelow17 = Syntax + Internal + <NUM_LIT> ; int MultiCatchNotBelow17 = Syntax + Internal + <NUM_LIT> ; int PolymorphicMethodNotBelow17 = MethodRelated + <NUM_LIT> ; int IncorrectSwitchType17 = TypeRelated + <NUM_LIT> ; int CannotInferElidedTypes = TypeRelated + <NUM_LIT> ; int CannotUseDiamondWithExplicitTypeArguments = TypeRelated + <NUM_LIT> ; int CannotUseDiamondWithAnonymousClasses = TypeRelated + <NUM_LIT> ; int SwitchOnStringsNotBelow17 = TypeRelated + <NUM_LIT> ; int UnhandledExceptionOnAutoClose = TypeRelated + <NUM_LIT> ; int DiamondNotBelow17 = TypeRelated + <NUM_LIT> ; int RedundantSpecificationOfTypeArguments = TypeRelated + <NUM_LIT> ; int ExternalProblemNotFixable = <NUM_LIT> ; int ExternalProblemFixable = <NUM_LIT> ; } </s>
|
<s> package org . eclipse . jdt . core . compiler ; public class InvalidInputException extends Exception { private static final long serialVersionUID = <NUM_LIT> ; public InvalidInputException ( ) { super ( ) ; } public InvalidInputException ( String message ) { super ( message ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . antadapter ; import java . text . MessageFormat ; import java . util . Locale ; import java . util . MissingResourceException ; import java . util . ResourceBundle ; public class AntAdapterMessages { private static final String BUNDLE_NAME = "<STR_LIT>" ; private static ResourceBundle RESOURCE_BUNDLE ; static { try { RESOURCE_BUNDLE = ResourceBundle . getBundle ( BUNDLE_NAME , Locale . getDefault ( ) ) ; } catch ( MissingResourceException e ) { System . out . println ( "<STR_LIT>" + BUNDLE_NAME . replace ( '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) + "<STR_LIT>" + Locale . getDefault ( ) ) ; throw e ; } } private AntAdapterMessages ( ) { } public static String getString ( String key ) { try { return RESOURCE_BUNDLE . getString ( key ) ; } catch ( MissingResourceException e ) { return '<CHAR_LIT>' + key + '<CHAR_LIT>' ; } } public static String getString ( String key , String argument ) { try { String message = RESOURCE_BUNDLE . getString ( key ) ; MessageFormat messageFormat = new MessageFormat ( message ) ; return messageFormat . format ( new String [ ] { argument } ) ; } catch ( MissingResourceException e ) { return '<CHAR_LIT>' + key + '<CHAR_LIT>' ; } } } </s>
|
<s> package org . eclipse . jdt . core ; import java . io . File ; import java . io . IOException ; import java . io . PrintWriter ; import java . lang . reflect . Constructor ; import java . lang . reflect . InvocationTargetException ; import java . lang . reflect . Method ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Comparator ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import org . apache . tools . ant . BuildException ; import org . apache . tools . ant . Project ; import org . apache . tools . ant . taskdefs . Javac ; import org . apache . tools . ant . taskdefs . compilers . DefaultCompilerAdapter ; import org . apache . tools . ant . types . Commandline ; import org . apache . tools . ant . types . Path ; import org . apache . tools . ant . types . Commandline . Argument ; import org . apache . tools . ant . util . JavaEnvUtils ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . antadapter . AntAdapterMessages ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . compiler . util . Util ; public class JDTCompilerAdapter extends DefaultCompilerAdapter { private static final char [ ] SEPARATOR_CHARS = new char [ ] { '<CHAR_LIT:/>' , '<STR_LIT:\\>' } ; private static final char [ ] ADAPTER_PREFIX = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] ADAPTER_ENCODING = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] ADAPTER_ACCESS = "<STR_LIT>" . toCharArray ( ) ; private static String compilerClass = "<STR_LIT>" ; String logFileName ; Map customDefaultOptions ; private Map fileEncodings = null ; private Map dirEncodings = null ; private List accessRules = null ; public boolean execute ( ) throws BuildException { this . attributes . log ( AntAdapterMessages . getString ( "<STR_LIT>" ) , Project . MSG_VERBOSE ) ; Commandline cmd = setupJavacCommand ( ) ; try { Class c = Class . forName ( compilerClass ) ; Constructor batchCompilerConstructor = c . getConstructor ( new Class [ ] { PrintWriter . class , PrintWriter . class , Boolean . TYPE , Map . class } ) ; Object batchCompilerInstance = batchCompilerConstructor . newInstance ( new Object [ ] { new PrintWriter ( System . out ) , new PrintWriter ( System . err ) , Boolean . TRUE , this . customDefaultOptions } ) ; Method compile = c . getMethod ( "<STR_LIT>" , new Class [ ] { String [ ] . class } ) ; Object result = compile . invoke ( batchCompilerInstance , new Object [ ] { cmd . getArguments ( ) } ) ; final boolean resultValue = ( ( Boolean ) result ) . booleanValue ( ) ; if ( ! resultValue && this . logFileName != null ) { this . attributes . log ( AntAdapterMessages . getString ( "<STR_LIT>" , this . logFileName ) ) ; } return resultValue ; } catch ( ClassNotFoundException cnfe ) { throw new BuildException ( AntAdapterMessages . getString ( "<STR_LIT>" ) ) ; } catch ( Exception ex ) { throw new BuildException ( ex ) ; } } protected Commandline setupJavacCommand ( ) throws BuildException { Commandline cmd = new Commandline ( ) ; this . customDefaultOptions = new CompilerOptions ( ) . getMap ( ) ; Class javacClass = Javac . class ; String [ ] compilerArgs = processCompilerArguments ( javacClass ) ; cmd . createArgument ( ) . setValue ( "<STR_LIT>" ) ; if ( this . bootclasspath != null ) { cmd . createArgument ( ) . setValue ( "<STR_LIT>" ) ; if ( this . bootclasspath . size ( ) != <NUM_LIT:0> ) { cmd . createArgument ( ) . setPath ( this . bootclasspath ) ; } else { cmd . createArgument ( ) . setValue ( Util . EMPTY_STRING ) ; } } if ( this . extdirs != null ) { cmd . createArgument ( ) . setValue ( "<STR_LIT>" ) ; cmd . createArgument ( ) . setPath ( this . extdirs ) ; } Path classpath = new Path ( this . project ) ; classpath . append ( getCompileClasspath ( ) ) ; cmd . createArgument ( ) . setValue ( "<STR_LIT>" ) ; createClasspathArgument ( cmd , classpath ) ; Path sourcepath = null ; Method getSourcepathMethod = null ; try { getSourcepathMethod = javacClass . getMethod ( "<STR_LIT>" , null ) ; } catch ( NoSuchMethodException e ) { } Path compileSourcePath = null ; if ( getSourcepathMethod != null ) { try { compileSourcePath = ( Path ) getSourcepathMethod . invoke ( this . attributes , null ) ; } catch ( IllegalAccessException e ) { } catch ( InvocationTargetException e ) { } } if ( compileSourcePath != null ) { sourcepath = compileSourcePath ; } else { sourcepath = this . src ; } cmd . createArgument ( ) . setValue ( "<STR_LIT>" ) ; createClasspathArgument ( cmd , sourcepath ) ; final String javaVersion = JavaEnvUtils . getJavaVersion ( ) ; String memoryParameterPrefix = javaVersion . equals ( JavaEnvUtils . JAVA_1_1 ) ? "<STR_LIT>" : "<STR_LIT>" ; if ( this . memoryInitialSize != null ) { if ( ! this . attributes . isForkedJavac ( ) ) { this . attributes . log ( AntAdapterMessages . getString ( "<STR_LIT>" ) , Project . MSG_WARN ) ; } else { cmd . createArgument ( ) . setValue ( memoryParameterPrefix + "<STR_LIT>" + this . memoryInitialSize ) ; } } if ( this . memoryMaximumSize != null ) { if ( ! this . attributes . isForkedJavac ( ) ) { this . attributes . log ( AntAdapterMessages . getString ( "<STR_LIT>" ) , Project . MSG_WARN ) ; } else { cmd . createArgument ( ) . setValue ( memoryParameterPrefix + "<STR_LIT>" + this . memoryMaximumSize ) ; } } if ( this . debug ) { Method getDebugLevelMethod = null ; try { getDebugLevelMethod = javacClass . getMethod ( "<STR_LIT>" , null ) ; } catch ( NoSuchMethodException e ) { } String debugLevel = null ; if ( getDebugLevelMethod != null ) { try { debugLevel = ( String ) getDebugLevelMethod . invoke ( this . attributes , null ) ; } catch ( IllegalAccessException e ) { } catch ( InvocationTargetException e ) { } } if ( debugLevel != null ) { this . customDefaultOptions . put ( CompilerOptions . OPTION_LocalVariableAttribute , CompilerOptions . DO_NOT_GENERATE ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_LineNumberAttribute , CompilerOptions . DO_NOT_GENERATE ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_SourceFileAttribute , CompilerOptions . DO_NOT_GENERATE ) ; if ( debugLevel . length ( ) != <NUM_LIT:0> ) { if ( debugLevel . indexOf ( "<STR_LIT>" ) != - <NUM_LIT:1> ) { this . customDefaultOptions . put ( CompilerOptions . OPTION_LocalVariableAttribute , CompilerOptions . GENERATE ) ; } if ( debugLevel . indexOf ( "<STR_LIT>" ) != - <NUM_LIT:1> ) { this . customDefaultOptions . put ( CompilerOptions . OPTION_LineNumberAttribute , CompilerOptions . GENERATE ) ; } if ( debugLevel . indexOf ( "<STR_LIT:source>" ) != - <NUM_LIT:1> ) { this . customDefaultOptions . put ( CompilerOptions . OPTION_SourceFileAttribute , CompilerOptions . GENERATE ) ; } } } else { this . customDefaultOptions . put ( CompilerOptions . OPTION_LocalVariableAttribute , CompilerOptions . GENERATE ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_LineNumberAttribute , CompilerOptions . GENERATE ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_SourceFileAttribute , CompilerOptions . GENERATE ) ; } } else { this . customDefaultOptions . put ( CompilerOptions . OPTION_LocalVariableAttribute , CompilerOptions . DO_NOT_GENERATE ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_LineNumberAttribute , CompilerOptions . DO_NOT_GENERATE ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_SourceFileAttribute , CompilerOptions . DO_NOT_GENERATE ) ; } if ( this . attributes . getNowarn ( ) ) { Object [ ] entries = this . customDefaultOptions . entrySet ( ) . toArray ( ) ; for ( int i = <NUM_LIT:0> , max = entries . length ; i < max ; i ++ ) { Map . Entry entry = ( Map . Entry ) entries [ i ] ; if ( ! ( entry . getKey ( ) instanceof String ) ) continue ; if ( ! ( entry . getValue ( ) instanceof String ) ) continue ; if ( ( ( String ) entry . getValue ( ) ) . equals ( CompilerOptions . WARNING ) ) { this . customDefaultOptions . put ( entry . getKey ( ) , CompilerOptions . IGNORE ) ; } } this . customDefaultOptions . put ( CompilerOptions . OPTION_TaskTags , Util . EMPTY_STRING ) ; if ( this . deprecation ) { this . customDefaultOptions . put ( CompilerOptions . OPTION_ReportDeprecation , CompilerOptions . WARNING ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_ReportDeprecationInDeprecatedCode , CompilerOptions . ENABLED ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_ReportDeprecationWhenOverridingDeprecatedMethod , CompilerOptions . ENABLED ) ; } } else if ( this . deprecation ) { this . customDefaultOptions . put ( CompilerOptions . OPTION_ReportDeprecation , CompilerOptions . WARNING ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_ReportDeprecationInDeprecatedCode , CompilerOptions . ENABLED ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_ReportDeprecationWhenOverridingDeprecatedMethod , CompilerOptions . ENABLED ) ; } else { this . customDefaultOptions . put ( CompilerOptions . OPTION_ReportDeprecation , CompilerOptions . IGNORE ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_ReportDeprecationInDeprecatedCode , CompilerOptions . DISABLED ) ; this . customDefaultOptions . put ( CompilerOptions . OPTION_ReportDeprecationWhenOverridingDeprecatedMethod , CompilerOptions . DISABLED ) ; } if ( this . destDir != null ) { cmd . createArgument ( ) . setValue ( "<STR_LIT>" ) ; cmd . createArgument ( ) . setFile ( this . destDir . getAbsoluteFile ( ) ) ; } if ( this . verbose ) { cmd . createArgument ( ) . setValue ( "<STR_LIT>" ) ; } if ( ! this . attributes . getFailonerror ( ) ) { cmd . createArgument ( ) . setValue ( "<STR_LIT>" ) ; } if ( this . target != null ) { this . customDefaultOptions . put ( CompilerOptions . OPTION_TargetPlatform , this . target ) ; } String source = this . attributes . getSource ( ) ; if ( source != null ) { this . customDefaultOptions . put ( CompilerOptions . OPTION_Source , source ) ; } if ( compilerArgs != null ) { final int length = compilerArgs . length ; if ( length != <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> , max = length ; i < max ; i ++ ) { String arg = compilerArgs [ i ] ; if ( this . logFileName == null && "<STR_LIT>" . equals ( arg ) && ( ( i + <NUM_LIT:1> ) < max ) ) { this . logFileName = compilerArgs [ i + <NUM_LIT:1> ] ; } cmd . createArgument ( ) . setValue ( arg ) ; } } } if ( this . encoding != null ) { cmd . createArgument ( ) . setValue ( "<STR_LIT>" ) ; cmd . createArgument ( ) . setValue ( this . encoding ) ; } logAndAddFilesToCompile ( cmd ) ; return cmd ; } private String [ ] processCompilerArguments ( Class javacClass ) { Method getCurrentCompilerArgsMethod = null ; try { getCurrentCompilerArgsMethod = javacClass . getMethod ( "<STR_LIT>" , null ) ; } catch ( NoSuchMethodException e ) { } String [ ] compilerArgs = null ; if ( getCurrentCompilerArgsMethod != null ) { try { compilerArgs = ( String [ ] ) getCurrentCompilerArgsMethod . invoke ( this . attributes , null ) ; } catch ( IllegalAccessException e ) { } catch ( InvocationTargetException e ) { } } if ( compilerArgs != null ) checkCompilerArgs ( compilerArgs ) ; return compilerArgs ; } private void checkCompilerArgs ( String [ ] args ) { for ( int i = <NUM_LIT:0> ; i < args . length ; i ++ ) { if ( args [ i ] . charAt ( <NUM_LIT:0> ) == '<CHAR_LIT>' ) { try { char [ ] content = Util . getFileCharContent ( new File ( args [ i ] . substring ( <NUM_LIT:1> ) ) , null ) ; int offset = <NUM_LIT:0> ; int prefixLength = ADAPTER_PREFIX . length ; while ( ( offset = CharOperation . indexOf ( ADAPTER_PREFIX , content , true , offset ) ) > - <NUM_LIT:1> ) { int start = offset + prefixLength ; int end = CharOperation . indexOf ( '<STR_LIT:\n>' , content , start ) ; if ( end == - <NUM_LIT:1> ) end = content . length ; while ( CharOperation . isWhitespace ( content [ end ] ) ) { end -- ; } if ( CharOperation . equals ( ADAPTER_ENCODING , content , start , start + ADAPTER_ENCODING . length ) ) { CharOperation . replace ( content , SEPARATOR_CHARS , File . separatorChar , start , end + <NUM_LIT:1> ) ; start += ADAPTER_ENCODING . length ; int encodeStart = CharOperation . lastIndexOf ( '<CHAR_LIT:[>' , content , start , end ) ; if ( start < encodeStart && encodeStart < end ) { boolean isFile = CharOperation . equals ( SuffixConstants . SUFFIX_java , content , encodeStart - <NUM_LIT:5> , encodeStart , false ) ; String str = String . valueOf ( content , start , encodeStart - start ) ; String enc = String . valueOf ( content , encodeStart , end - encodeStart + <NUM_LIT:1> ) ; if ( isFile ) { if ( this . fileEncodings == null ) this . fileEncodings = new HashMap ( ) ; this . fileEncodings . put ( str , enc ) ; } else { if ( this . dirEncodings == null ) this . dirEncodings = new HashMap ( ) ; this . dirEncodings . put ( str , enc ) ; } } } else if ( CharOperation . equals ( ADAPTER_ACCESS , content , start , start + ADAPTER_ACCESS . length ) ) { start += ADAPTER_ACCESS . length ; int accessStart = CharOperation . indexOf ( '<CHAR_LIT:[>' , content , start , end ) ; CharOperation . replace ( content , SEPARATOR_CHARS , File . separatorChar , start , accessStart ) ; if ( start < accessStart && accessStart < end ) { String path = String . valueOf ( content , start , accessStart - start ) ; String access = String . valueOf ( content , accessStart , end - accessStart + <NUM_LIT:1> ) ; if ( this . accessRules == null ) this . accessRules = new ArrayList ( ) ; this . accessRules . add ( path ) ; this . accessRules . add ( access ) ; } } offset = end ; } } catch ( IOException e ) { } } } } private void createClasspathArgument ( Commandline cmd , Path classpath ) { Argument arg = cmd . createArgument ( ) ; final String [ ] pathElements = classpath . list ( ) ; if ( pathElements . length == <NUM_LIT:0> ) { arg . setValue ( Util . EMPTY_STRING ) ; return ; } if ( this . accessRules == null ) { arg . setPath ( classpath ) ; return ; } int rulesLength = this . accessRules . size ( ) ; String [ ] rules = ( String [ ] ) this . accessRules . toArray ( new String [ rulesLength ] ) ; int nextRule = <NUM_LIT:0> ; final StringBuffer result = new StringBuffer ( ) ; for ( int i = <NUM_LIT:0> , max = pathElements . length ; i < max ; i ++ ) { if ( i > <NUM_LIT:0> ) result . append ( File . pathSeparatorChar ) ; String pathElement = pathElements [ i ] ; result . append ( pathElement ) ; for ( int j = nextRule ; j < rulesLength ; j += <NUM_LIT:2> ) { String rule = rules [ j ] ; if ( pathElement . endsWith ( rule ) ) { result . append ( rules [ j + <NUM_LIT:1> ] ) ; nextRule = j + <NUM_LIT:2> ; break ; } if ( rule . endsWith ( File . separator ) ) { int ruleLength = rule . length ( ) ; if ( pathElement . regionMatches ( false , pathElement . length ( ) - ruleLength + <NUM_LIT:1> , rule , <NUM_LIT:0> , ruleLength - <NUM_LIT:1> ) ) { result . append ( rules [ j + <NUM_LIT:1> ] ) ; nextRule = j + <NUM_LIT:2> ; break ; } } else if ( pathElement . endsWith ( File . separator ) ) { int ruleLength = rule . length ( ) ; if ( pathElement . regionMatches ( false , pathElement . length ( ) - ruleLength - <NUM_LIT:1> , rule , <NUM_LIT:0> , ruleLength ) ) { result . append ( rules [ j + <NUM_LIT:1> ] ) ; nextRule = j + <NUM_LIT:2> ; break ; } } } } arg . setValue ( result . toString ( ) ) ; } protected void logAndAddFilesToCompile ( Commandline cmd ) { this . attributes . log ( "<STR_LIT>" + cmd . describeArguments ( ) , Project . MSG_VERBOSE ) ; StringBuffer niceSourceList = new StringBuffer ( "<STR_LIT>" ) ; if ( this . compileList . length != <NUM_LIT:1> ) { niceSourceList . append ( "<STR_LIT:s>" ) ; } niceSourceList . append ( "<STR_LIT>" ) ; niceSourceList . append ( lSep ) ; String [ ] encodedFiles = null , encodedDirs = null ; int encodedFilesLength = <NUM_LIT:0> , encodedDirsLength = <NUM_LIT:0> ; if ( this . fileEncodings != null ) { encodedFilesLength = this . fileEncodings . size ( ) ; encodedFiles = new String [ encodedFilesLength ] ; this . fileEncodings . keySet ( ) . toArray ( encodedFiles ) ; } if ( this . dirEncodings != null ) { encodedDirsLength = this . dirEncodings . size ( ) ; encodedDirs = new String [ encodedDirsLength ] ; this . dirEncodings . keySet ( ) . toArray ( encodedDirs ) ; Comparator comparator = new Comparator ( ) { public int compare ( Object o1 , Object o2 ) { return ( ( String ) o2 ) . length ( ) - ( ( String ) o1 ) . length ( ) ; } } ; Arrays . sort ( encodedDirs , comparator ) ; } for ( int i = <NUM_LIT:0> ; i < this . compileList . length ; i ++ ) { String arg = this . compileList [ i ] . getAbsolutePath ( ) ; boolean encoded = false ; if ( encodedFiles != null ) { for ( int j = <NUM_LIT:0> ; j < encodedFilesLength ; j ++ ) { if ( arg . endsWith ( encodedFiles [ j ] ) ) { arg = arg + ( String ) this . fileEncodings . get ( encodedFiles [ j ] ) ; if ( j < encodedFilesLength - <NUM_LIT:1> ) { System . arraycopy ( encodedFiles , j + <NUM_LIT:1> , encodedFiles , j , encodedFilesLength - j - <NUM_LIT:1> ) ; } encodedFiles [ -- encodedFilesLength ] = null ; encoded = true ; break ; } } } if ( ! encoded && encodedDirs != null ) { for ( int j = <NUM_LIT:0> ; j < encodedDirsLength ; j ++ ) { if ( arg . lastIndexOf ( encodedDirs [ j ] ) != - <NUM_LIT:1> ) { arg = arg + ( String ) this . dirEncodings . get ( encodedDirs [ j ] ) ; break ; } } } cmd . createArgument ( ) . setValue ( arg ) ; niceSourceList . append ( "<STR_LIT:U+0020U+0020U+0020U+0020>" + arg + lSep ) ; } this . attributes . log ( niceSourceList . toString ( ) , Project . MSG_VERBOSE ) ; } } </s>
|
<s> package org . eclipse . jdt . core ; import java . io . IOException ; import java . util . Enumeration ; import java . util . zip . ZipEntry ; import java . util . zip . ZipException ; import java . util . zip . ZipFile ; import org . apache . tools . ant . BuildException ; import org . apache . tools . ant . Task ; import org . eclipse . jdt . core . util . IClassFileReader ; import org . eclipse . jdt . core . util . ICodeAttribute ; import org . eclipse . jdt . core . util . IMethodInfo ; import org . eclipse . jdt . internal . antadapter . AntAdapterMessages ; public final class CheckDebugAttributes extends Task { private String file ; private String property ; public void execute ( ) throws BuildException { if ( this . file == null ) { throw new BuildException ( AntAdapterMessages . getString ( "<STR_LIT>" ) ) ; } if ( this . property == null ) { throw new BuildException ( AntAdapterMessages . getString ( "<STR_LIT>" ) ) ; } try { boolean hasDebugAttributes = false ; if ( org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( this . file ) ) { IClassFileReader classFileReader = ToolFactory . createDefaultClassFileReader ( this . file , IClassFileReader . ALL ) ; hasDebugAttributes = checkClassFile ( classFileReader ) ; } else { ZipFile jarFile = null ; try { jarFile = new ZipFile ( this . file ) ; } catch ( ZipException e ) { throw new BuildException ( AntAdapterMessages . getString ( "<STR_LIT>" ) ) ; } for ( Enumeration entries = jarFile . entries ( ) ; ! hasDebugAttributes && entries . hasMoreElements ( ) ; ) { ZipEntry entry = ( ZipEntry ) entries . nextElement ( ) ; if ( org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( entry . getName ( ) ) ) { IClassFileReader classFileReader = ToolFactory . createDefaultClassFileReader ( this . file , entry . getName ( ) , IClassFileReader . ALL ) ; hasDebugAttributes = checkClassFile ( classFileReader ) ; } } } if ( hasDebugAttributes ) { getProject ( ) . setUserProperty ( this . property , "<STR_LIT>" ) ; } } catch ( IOException e ) { throw new BuildException ( AntAdapterMessages . getString ( "<STR_LIT>" ) + this . file ) ; } } private boolean checkClassFile ( IClassFileReader classFileReader ) { IMethodInfo [ ] methodInfos = classFileReader . getMethodInfos ( ) ; for ( int i = <NUM_LIT:0> , max = methodInfos . length ; i < max ; i ++ ) { ICodeAttribute codeAttribute = methodInfos [ i ] . getCodeAttribute ( ) ; if ( codeAttribute != null && codeAttribute . getLineNumberAttribute ( ) != null ) { return true ; } } return false ; } public void setFile ( String value ) { this . file = value ; } public void setProperty ( String value ) { this . property = value ; } } </s>
|
<s> 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 . internal . core . dom . rewrite ; import java . util . * ; import org . eclipse . jdt . core . Signature ; import org . eclipse . jdt . core . dom . ASTNode ; import org . eclipse . jdt . core . dom . Block ; import org . eclipse . jdt . core . dom . StructuralPropertyDescriptor ; import org . eclipse . jdt . core . dom . rewrite . TargetSourceRangeComputer ; import org . eclipse . text . edits . TextEditGroup ; public final class RewriteEventStore { public static final class PropertyLocation { private final ASTNode parent ; private final StructuralPropertyDescriptor property ; public PropertyLocation ( ASTNode parent , StructuralPropertyDescriptor property ) { this . parent = parent ; this . property = property ; } public ASTNode getParent ( ) { return this . parent ; } public StructuralPropertyDescriptor getProperty ( ) { return this . property ; } public boolean equals ( Object obj ) { if ( obj != null && obj . getClass ( ) . equals ( getClass ( ) ) ) { PropertyLocation other = ( PropertyLocation ) obj ; return other . getParent ( ) . equals ( getParent ( ) ) && other . getProperty ( ) . equals ( getProperty ( ) ) ; } return false ; } public int hashCode ( ) { return getParent ( ) . hashCode ( ) + getProperty ( ) . hashCode ( ) ; } } public static interface INodePropertyMapper { Object getOriginalValue ( ASTNode parent , StructuralPropertyDescriptor childProperty ) ; } private static class EventHolder { public final ASTNode parent ; public final StructuralPropertyDescriptor childProperty ; public final RewriteEvent event ; public EventHolder ( ASTNode parent , StructuralPropertyDescriptor childProperty , RewriteEvent change ) { this . parent = parent ; this . childProperty = childProperty ; this . event = change ; } public String toString ( ) { StringBuffer buf = new StringBuffer ( ) ; buf . append ( this . parent ) . append ( "<STR_LIT:U+0020-U+0020>" ) ; buf . append ( this . childProperty . getId ( ) ) . append ( "<STR_LIT::U+0020>" ) ; buf . append ( this . event ) . append ( '<STR_LIT:\n>' ) ; return buf . toString ( ) ; } } public static class CopySourceInfo implements Comparable { public final PropertyLocation location ; private final ASTNode node ; public final boolean isMove ; public CopySourceInfo ( PropertyLocation location , ASTNode node , boolean isMove ) { this . location = location ; this . node = node ; this . isMove = isMove ; } public ASTNode getNode ( ) { return this . node ; } public int compareTo ( Object o2 ) { CopySourceInfo r2 = ( CopySourceInfo ) o2 ; int startDiff = getNode ( ) . getStartPosition ( ) - r2 . getNode ( ) . getStartPosition ( ) ; if ( startDiff != <NUM_LIT:0> ) { return startDiff ; } if ( r2 . isMove != this . isMove ) { return this . isMove ? - <NUM_LIT:1> : <NUM_LIT:1> ; } return <NUM_LIT:0> ; } public String toString ( ) { StringBuffer buf = new StringBuffer ( ) ; if ( this . isMove ) { buf . append ( "<STR_LIT>" ) ; } else { buf . append ( "<STR_LIT>" ) ; } buf . append ( this . node ) ; return buf . toString ( ) ; } } private static class NodeRangeInfo implements Comparable { private final ASTNode first ; private final ASTNode last ; public final CopySourceInfo copyInfo ; public final ASTNode replacingNode ; public final TextEditGroup editGroup ; public NodeRangeInfo ( ASTNode parent , StructuralPropertyDescriptor childProperty , ASTNode first , ASTNode last , CopySourceInfo copyInfo , ASTNode replacingNode , TextEditGroup editGroup ) { this . first = first ; this . last = last ; this . copyInfo = copyInfo ; this . replacingNode = replacingNode ; this . editGroup = editGroup ; } public ASTNode getStartNode ( ) { return this . first ; } public ASTNode getEndNode ( ) { return this . last ; } public boolean isMove ( ) { return this . copyInfo . isMove ; } public Block getInternalPlaceholder ( ) { return ( Block ) this . copyInfo . getNode ( ) ; } public int compareTo ( Object o2 ) { NodeRangeInfo r2 = ( NodeRangeInfo ) o2 ; int startDiff = getStartNode ( ) . getStartPosition ( ) - r2 . getStartNode ( ) . getStartPosition ( ) ; if ( startDiff != <NUM_LIT:0> ) { return startDiff ; } int endDiff = getEndNode ( ) . getStartPosition ( ) - r2 . getEndNode ( ) . getStartPosition ( ) ; if ( endDiff != <NUM_LIT:0> ) { return - endDiff ; } if ( r2 . isMove ( ) != isMove ( ) ) { return isMove ( ) ? - <NUM_LIT:1> : <NUM_LIT:1> ; } return <NUM_LIT:0> ; } public void updatePlaceholderSourceRanges ( TargetSourceRangeComputer sourceRangeComputer ) { TargetSourceRangeComputer . SourceRange startRange = sourceRangeComputer . computeSourceRange ( getStartNode ( ) ) ; TargetSourceRangeComputer . SourceRange endRange = sourceRangeComputer . computeSourceRange ( getEndNode ( ) ) ; int startPos = startRange . getStartPosition ( ) ; int endPos = endRange . getStartPosition ( ) + endRange . getLength ( ) ; Block internalPlaceholder = getInternalPlaceholder ( ) ; internalPlaceholder . setSourceRange ( startPos , endPos - startPos ) ; } public String toString ( ) { StringBuffer buf = new StringBuffer ( ) ; if ( this . first != this . last ) { buf . append ( "<STR_LIT>" ) ; } if ( isMove ( ) ) { buf . append ( "<STR_LIT>" ) ; } else { buf . append ( "<STR_LIT>" ) ; } buf . append ( this . first ) ; buf . append ( "<STR_LIT:U+0020-U+0020>" ) ; buf . append ( this . last ) ; return buf . toString ( ) ; } } private class ParentIterator implements Iterator { private Iterator eventIter ; private Iterator sourceNodeIter ; private Iterator rangeNodeIter ; private Iterator trackedNodeIter ; public ParentIterator ( ) { this . eventIter = RewriteEventStore . this . eventLookup . keySet ( ) . iterator ( ) ; if ( RewriteEventStore . this . nodeCopySources != null ) { this . sourceNodeIter = RewriteEventStore . this . nodeCopySources . iterator ( ) ; } else { this . sourceNodeIter = Collections . EMPTY_LIST . iterator ( ) ; } if ( RewriteEventStore . this . nodeRangeInfos != null ) { this . rangeNodeIter = RewriteEventStore . this . nodeRangeInfos . keySet ( ) . iterator ( ) ; } else { this . rangeNodeIter = Collections . EMPTY_LIST . iterator ( ) ; } if ( RewriteEventStore . this . trackedNodes != null ) { this . trackedNodeIter = RewriteEventStore . this . trackedNodes . keySet ( ) . iterator ( ) ; } else { this . trackedNodeIter = Collections . EMPTY_LIST . iterator ( ) ; } } public boolean hasNext ( ) { return this . eventIter . hasNext ( ) || this . sourceNodeIter . hasNext ( ) || this . rangeNodeIter . hasNext ( ) || this . trackedNodeIter . hasNext ( ) ; } public Object next ( ) { if ( this . eventIter . hasNext ( ) ) { return this . eventIter . next ( ) ; } if ( this . sourceNodeIter . hasNext ( ) ) { return ( ( CopySourceInfo ) this . sourceNodeIter . next ( ) ) . getNode ( ) ; } if ( this . rangeNodeIter . hasNext ( ) ) { return ( ( PropertyLocation ) this . rangeNodeIter . next ( ) ) . getParent ( ) ; } return this . trackedNodeIter . next ( ) ; } public void remove ( ) { throw new UnsupportedOperationException ( ) ; } } public final static int NEW = <NUM_LIT:1> ; public final static int ORIGINAL = <NUM_LIT:2> ; public final static int BOTH = NEW | ORIGINAL ; final Map eventLookup ; private EventHolder lastEvent ; private Map editGroups ; List nodeCopySources ; Map nodeRangeInfos ; Map trackedNodes ; private Set insertBoundToPrevious ; private INodePropertyMapper nodePropertyMapper ; private static final String INTERNAL_PLACEHOLDER_PROPERTY = "<STR_LIT>" ; public RewriteEventStore ( ) { this . eventLookup = new HashMap ( ) ; this . lastEvent = null ; this . editGroups = null ; this . trackedNodes = null ; this . insertBoundToPrevious = null ; this . nodePropertyMapper = null ; this . nodeCopySources = null ; this . nodeRangeInfos = null ; } public void setNodePropertyMapper ( INodePropertyMapper nodePropertyMapper ) { this . nodePropertyMapper = nodePropertyMapper ; } public void clear ( ) { this . eventLookup . clear ( ) ; this . lastEvent = null ; this . trackedNodes = null ; this . editGroups = null ; this . insertBoundToPrevious = null ; this . nodeCopySources = null ; } public void addEvent ( ASTNode parent , StructuralPropertyDescriptor childProperty , RewriteEvent event ) { validateHasChildProperty ( parent , childProperty ) ; if ( event . isListRewrite ( ) ) { validateIsListProperty ( childProperty ) ; } EventHolder holder = new EventHolder ( parent , childProperty , event ) ; List entriesList = ( List ) this . eventLookup . get ( parent ) ; if ( entriesList != null ) { for ( int i = <NUM_LIT:0> ; i < entriesList . size ( ) ; i ++ ) { EventHolder curr = ( EventHolder ) entriesList . get ( i ) ; if ( curr . childProperty == childProperty ) { entriesList . set ( i , holder ) ; this . lastEvent = null ; return ; } } } else { entriesList = new ArrayList ( <NUM_LIT:3> ) ; this . eventLookup . put ( parent , entriesList ) ; } entriesList . add ( holder ) ; } public RewriteEvent getEvent ( ASTNode parent , StructuralPropertyDescriptor property ) { validateHasChildProperty ( parent , property ) ; if ( this . lastEvent != null && this . lastEvent . parent == parent && this . lastEvent . childProperty == property ) { return this . lastEvent . event ; } List entriesList = ( List ) this . eventLookup . get ( parent ) ; if ( entriesList != null ) { for ( int i = <NUM_LIT:0> ; i < entriesList . size ( ) ; i ++ ) { EventHolder holder = ( EventHolder ) entriesList . get ( i ) ; if ( holder . childProperty == property ) { this . lastEvent = holder ; return holder . event ; } } } return null ; } public NodeRewriteEvent getNodeEvent ( ASTNode parent , StructuralPropertyDescriptor childProperty , boolean forceCreation ) { validateIsNodeProperty ( childProperty ) ; NodeRewriteEvent event = ( NodeRewriteEvent ) getEvent ( parent , childProperty ) ; if ( event == null && forceCreation ) { Object originalValue = accessOriginalValue ( parent , childProperty ) ; event = new NodeRewriteEvent ( originalValue , originalValue ) ; addEvent ( parent , childProperty , event ) ; } return event ; } public ListRewriteEvent getListEvent ( ASTNode parent , StructuralPropertyDescriptor childProperty , boolean forceCreation ) { validateIsListProperty ( childProperty ) ; ListRewriteEvent event = ( ListRewriteEvent ) getEvent ( parent , childProperty ) ; if ( event == null && forceCreation ) { List originalValue = ( List ) accessOriginalValue ( parent , childProperty ) ; event = new ListRewriteEvent ( originalValue ) ; addEvent ( parent , childProperty , event ) ; } return event ; } public Iterator getChangeRootIterator ( ) { return new ParentIterator ( ) ; } public boolean hasChangedProperties ( ASTNode parent ) { List entriesList = ( List ) this . eventLookup . get ( parent ) ; if ( entriesList != null ) { for ( int i = <NUM_LIT:0> ; i < entriesList . size ( ) ; i ++ ) { EventHolder holder = ( EventHolder ) entriesList . get ( i ) ; if ( holder . event . getChangeKind ( ) != RewriteEvent . UNCHANGED ) { return true ; } } } return false ; } public PropertyLocation getPropertyLocation ( Object value , int kind ) { for ( Iterator iter = this . eventLookup . values ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { List events = ( List ) iter . next ( ) ; for ( int i = <NUM_LIT:0> ; i < events . size ( ) ; i ++ ) { EventHolder holder = ( EventHolder ) events . get ( i ) ; RewriteEvent event = holder . event ; if ( isNodeInEvent ( event , value , kind ) ) { return new PropertyLocation ( holder . parent , holder . childProperty ) ; } if ( event . isListRewrite ( ) ) { RewriteEvent [ ] children = event . getChildren ( ) ; for ( int k = <NUM_LIT:0> ; k < children . length ; k ++ ) { if ( isNodeInEvent ( children [ k ] , value , kind ) ) { return new PropertyLocation ( holder . parent , holder . childProperty ) ; } } } } } if ( value instanceof ASTNode ) { ASTNode node = ( ASTNode ) value ; return new PropertyLocation ( node . getParent ( ) , node . getLocationInParent ( ) ) ; } return null ; } public RewriteEvent findEvent ( Object value , int kind ) { for ( Iterator iter = this . eventLookup . values ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { List events = ( List ) iter . next ( ) ; for ( int i = <NUM_LIT:0> ; i < events . size ( ) ; i ++ ) { RewriteEvent event = ( ( EventHolder ) events . get ( i ) ) . event ; if ( isNodeInEvent ( event , value , kind ) ) { return event ; } if ( event . isListRewrite ( ) ) { RewriteEvent [ ] children = event . getChildren ( ) ; for ( int k = <NUM_LIT:0> ; k < children . length ; k ++ ) { if ( isNodeInEvent ( children [ k ] , value , kind ) ) { return children [ k ] ; } } } } } return null ; } private boolean isNodeInEvent ( RewriteEvent event , Object value , int kind ) { if ( ( ( kind & NEW ) != <NUM_LIT:0> ) && event . getNewValue ( ) == value ) { return true ; } if ( ( ( kind & ORIGINAL ) != <NUM_LIT:0> ) && event . getOriginalValue ( ) == value ) { return true ; } return false ; } public Object getOriginalValue ( ASTNode parent , StructuralPropertyDescriptor property ) { RewriteEvent event = getEvent ( parent , property ) ; if ( event != null ) { return event . getOriginalValue ( ) ; } return accessOriginalValue ( parent , property ) ; } public Object getNewValue ( ASTNode parent , StructuralPropertyDescriptor property ) { RewriteEvent event = getEvent ( parent , property ) ; if ( event != null ) { return event . getNewValue ( ) ; } return accessOriginalValue ( parent , property ) ; } public List getChangedPropertieEvents ( ASTNode parent ) { List changedPropertiesEvent = new ArrayList ( ) ; List entriesList = ( List ) this . eventLookup . get ( parent ) ; if ( entriesList != null ) { for ( int i = <NUM_LIT:0> ; i < entriesList . size ( ) ; i ++ ) { EventHolder holder = ( EventHolder ) entriesList . get ( i ) ; if ( holder . event . getChangeKind ( ) != RewriteEvent . UNCHANGED ) { changedPropertiesEvent . add ( holder . event ) ; } } } return changedPropertiesEvent ; } public int getChangeKind ( ASTNode node ) { RewriteEvent event = findEvent ( node , ORIGINAL ) ; if ( event != null ) { return event . getChangeKind ( ) ; } return RewriteEvent . UNCHANGED ; } private Object accessOriginalValue ( ASTNode parent , StructuralPropertyDescriptor childProperty ) { if ( this . nodePropertyMapper != null ) { return this . nodePropertyMapper . getOriginalValue ( parent , childProperty ) ; } return parent . getStructuralProperty ( childProperty ) ; } public TextEditGroup getEventEditGroup ( RewriteEvent event ) { if ( this . editGroups == null ) { return null ; } return ( TextEditGroup ) this . editGroups . get ( event ) ; } public void setEventEditGroup ( RewriteEvent event , TextEditGroup editGroup ) { if ( this . editGroups == null ) { this . editGroups = new IdentityHashMap ( <NUM_LIT:5> ) ; } this . editGroups . put ( event , editGroup ) ; } public final TextEditGroup getTrackedNodeData ( ASTNode node ) { if ( this . trackedNodes != null ) { return ( TextEditGroup ) this . trackedNodes . get ( node ) ; } return null ; } public void setTrackedNodeData ( ASTNode node , TextEditGroup editGroup ) { if ( this . trackedNodes == null ) { this . trackedNodes = new IdentityHashMap ( ) ; } this . trackedNodes . put ( node , editGroup ) ; } public final void markAsTracked ( ASTNode node , TextEditGroup editGroup ) { if ( getTrackedNodeData ( node ) != null ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } setTrackedNodeData ( node , editGroup ) ; } private final CopySourceInfo createCopySourceInfo ( PropertyLocation location , ASTNode node , boolean isMove ) { CopySourceInfo copySource = new CopySourceInfo ( location , node , isMove ) ; if ( this . nodeCopySources == null ) { this . nodeCopySources = new ArrayList ( ) ; } this . nodeCopySources . add ( copySource ) ; return copySource ; } public final CopySourceInfo markAsCopySource ( ASTNode parent , StructuralPropertyDescriptor property , ASTNode node , boolean isMove ) { return createCopySourceInfo ( new PropertyLocation ( parent , property ) , node , isMove ) ; } public final boolean isRangeCopyPlaceholder ( ASTNode node ) { return node . getProperty ( INTERNAL_PLACEHOLDER_PROPERTY ) != null ; } public final CopySourceInfo createRangeCopy ( ASTNode parent , StructuralPropertyDescriptor childProperty , ASTNode first , ASTNode last , boolean isMove , ASTNode internalPlaceholder , ASTNode replacingNode , TextEditGroup editGroup ) { CopySourceInfo copyInfo = createCopySourceInfo ( null , internalPlaceholder , isMove ) ; internalPlaceholder . setProperty ( INTERNAL_PLACEHOLDER_PROPERTY , internalPlaceholder ) ; NodeRangeInfo copyRangeInfo = new NodeRangeInfo ( parent , childProperty , first , last , copyInfo , replacingNode , editGroup ) ; ListRewriteEvent listEvent = getListEvent ( parent , childProperty , true ) ; int indexFirst = listEvent . getIndex ( first , ListRewriteEvent . OLD ) ; if ( indexFirst == - <NUM_LIT:1> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } int indexLast = listEvent . getIndex ( last , ListRewriteEvent . OLD ) ; if ( indexLast == - <NUM_LIT:1> ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } if ( indexFirst > indexLast ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } if ( this . nodeRangeInfos == null ) { this . nodeRangeInfos = new HashMap ( ) ; } PropertyLocation loc = new PropertyLocation ( parent , childProperty ) ; List innerList = ( List ) this . nodeRangeInfos . get ( loc ) ; if ( innerList == null ) { innerList = new ArrayList ( <NUM_LIT:2> ) ; this . nodeRangeInfos . put ( loc , innerList ) ; } else { assertNoOverlap ( listEvent , indexFirst , indexLast , innerList ) ; } innerList . add ( copyRangeInfo ) ; return copyInfo ; } public CopySourceInfo [ ] getNodeCopySources ( ASTNode node ) { if ( this . nodeCopySources == null ) { return null ; } return internalGetCopySources ( this . nodeCopySources , node ) ; } public CopySourceInfo [ ] internalGetCopySources ( List copySources , ASTNode node ) { ArrayList res = new ArrayList ( <NUM_LIT:3> ) ; for ( int i = <NUM_LIT:0> ; i < copySources . size ( ) ; i ++ ) { CopySourceInfo curr = ( CopySourceInfo ) copySources . get ( i ) ; if ( curr . getNode ( ) == node ) { res . add ( curr ) ; } } if ( res . isEmpty ( ) ) { return null ; } CopySourceInfo [ ] arr = ( CopySourceInfo [ ] ) res . toArray ( new CopySourceInfo [ res . size ( ) ] ) ; Arrays . sort ( arr ) ; return arr ; } private void assertNoOverlap ( ListRewriteEvent listEvent , int indexFirst , int indexLast , List innerList ) { for ( Iterator iter = innerList . iterator ( ) ; iter . hasNext ( ) ; ) { NodeRangeInfo curr = ( NodeRangeInfo ) iter . next ( ) ; int currStart = listEvent . getIndex ( curr . getStartNode ( ) , ListRewriteEvent . BOTH ) ; int currEnd = listEvent . getIndex ( curr . getEndNode ( ) , ListRewriteEvent . BOTH ) ; if ( currStart < indexFirst && currEnd < indexLast && currEnd >= indexFirst || currStart > indexFirst && currStart <= currEnd && currEnd > indexLast ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } } } public void prepareMovedNodes ( TargetSourceRangeComputer sourceRangeComputer ) { if ( this . nodeCopySources != null ) { prepareSingleNodeCopies ( ) ; } if ( this . nodeRangeInfos != null ) { prepareNodeRangeCopies ( sourceRangeComputer ) ; } } public void revertMovedNodes ( ) { if ( this . nodeRangeInfos != null ) { removeMoveRangePlaceholders ( ) ; } } private void removeMoveRangePlaceholders ( ) { for ( Iterator iter = this . nodeRangeInfos . entrySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) iter . next ( ) ; Set placeholders = new HashSet ( ) ; List rangeInfos = ( List ) entry . getValue ( ) ; for ( int i = <NUM_LIT:0> ; i < rangeInfos . size ( ) ; i ++ ) { placeholders . add ( ( ( NodeRangeInfo ) rangeInfos . get ( i ) ) . getInternalPlaceholder ( ) ) ; } PropertyLocation loc = ( PropertyLocation ) entry . getKey ( ) ; RewriteEvent [ ] children = getListEvent ( loc . getParent ( ) , loc . getProperty ( ) , true ) . getChildren ( ) ; List revertedChildren = new ArrayList ( ) ; revertListWithRanges ( children , placeholders , revertedChildren ) ; RewriteEvent [ ] revertedChildrenArr = ( RewriteEvent [ ] ) revertedChildren . toArray ( new RewriteEvent [ revertedChildren . size ( ) ] ) ; addEvent ( loc . getParent ( ) , loc . getProperty ( ) , new ListRewriteEvent ( revertedChildrenArr ) ) ; } } private void revertListWithRanges ( RewriteEvent [ ] childEvents , Set placeholders , List revertedChildren ) { for ( int i = <NUM_LIT:0> ; i < childEvents . length ; i ++ ) { RewriteEvent event = childEvents [ i ] ; ASTNode node = ( ASTNode ) event . getOriginalValue ( ) ; if ( placeholders . contains ( node ) ) { RewriteEvent [ ] placeholderChildren = getListEvent ( node , Block . STATEMENTS_PROPERTY , false ) . getChildren ( ) ; revertListWithRanges ( placeholderChildren , placeholders , revertedChildren ) ; } else { revertedChildren . add ( event ) ; } } } private void prepareNodeRangeCopies ( TargetSourceRangeComputer sourceRangeComputer ) { for ( Iterator iter = this . nodeRangeInfos . entrySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) iter . next ( ) ; List rangeInfos = ( List ) entry . getValue ( ) ; Collections . sort ( rangeInfos ) ; PropertyLocation loc = ( PropertyLocation ) entry . getKey ( ) ; RewriteEvent [ ] children = getListEvent ( loc . getParent ( ) , loc . getProperty ( ) , true ) . getChildren ( ) ; RewriteEvent [ ] newChildren = processListWithRanges ( rangeInfos , children , sourceRangeComputer ) ; addEvent ( loc . getParent ( ) , loc . getProperty ( ) , new ListRewriteEvent ( newChildren ) ) ; } } private RewriteEvent [ ] processListWithRanges ( List rangeInfos , RewriteEvent [ ] childEvents , TargetSourceRangeComputer sourceRangeComputer ) { List newChildEvents = new ArrayList ( childEvents . length ) ; NodeRangeInfo topInfo = null ; Stack newChildrenStack = new Stack ( ) ; Stack topInfoStack = new Stack ( ) ; Iterator rangeInfoIterator = rangeInfos . iterator ( ) ; NodeRangeInfo nextInfo = ( NodeRangeInfo ) rangeInfoIterator . next ( ) ; for ( int k = <NUM_LIT:0> ; k < childEvents . length ; k ++ ) { RewriteEvent event = childEvents [ k ] ; ASTNode node = ( ASTNode ) event . getOriginalValue ( ) ; while ( nextInfo != null && node == nextInfo . getStartNode ( ) ) { nextInfo . updatePlaceholderSourceRanges ( sourceRangeComputer ) ; Block internalPlaceholder = nextInfo . getInternalPlaceholder ( ) ; RewriteEvent newEvent ; if ( nextInfo . isMove ( ) ) { newEvent = new NodeRewriteEvent ( internalPlaceholder , nextInfo . replacingNode ) ; } else { newEvent = new NodeRewriteEvent ( internalPlaceholder , internalPlaceholder ) ; } newChildEvents . add ( newEvent ) ; if ( nextInfo . editGroup != null ) { setEventEditGroup ( newEvent , nextInfo . editGroup ) ; } newChildrenStack . push ( newChildEvents ) ; topInfoStack . push ( topInfo ) ; newChildEvents = new ArrayList ( childEvents . length ) ; topInfo = nextInfo ; nextInfo = rangeInfoIterator . hasNext ( ) ? ( NodeRangeInfo ) rangeInfoIterator . next ( ) : null ; } newChildEvents . add ( event ) ; while ( topInfo != null && node == topInfo . getEndNode ( ) ) { RewriteEvent [ ] placeholderChildEvents = ( RewriteEvent [ ] ) newChildEvents . toArray ( new RewriteEvent [ newChildEvents . size ( ) ] ) ; Block internalPlaceholder = topInfo . getInternalPlaceholder ( ) ; addEvent ( internalPlaceholder , Block . STATEMENTS_PROPERTY , new ListRewriteEvent ( placeholderChildEvents ) ) ; newChildEvents = ( List ) newChildrenStack . pop ( ) ; topInfo = ( NodeRangeInfo ) topInfoStack . pop ( ) ; } } return ( RewriteEvent [ ] ) newChildEvents . toArray ( new RewriteEvent [ newChildEvents . size ( ) ] ) ; } private void prepareSingleNodeCopies ( ) { for ( int i = <NUM_LIT:0> ; i < this . nodeCopySources . size ( ) ; i ++ ) { CopySourceInfo curr = ( CopySourceInfo ) this . nodeCopySources . get ( i ) ; if ( curr . isMove && curr . location != null ) { doMarkMovedAsRemoved ( curr , curr . location . getParent ( ) , curr . location . getProperty ( ) ) ; } } } private void doMarkMovedAsRemoved ( CopySourceInfo curr , ASTNode parent , StructuralPropertyDescriptor childProperty ) { if ( childProperty . isChildListProperty ( ) ) { ListRewriteEvent event = getListEvent ( parent , childProperty , true ) ; int index = event . getIndex ( curr . getNode ( ) , ListRewriteEvent . OLD ) ; if ( index != - <NUM_LIT:1> && event . getChangeKind ( index ) == RewriteEvent . UNCHANGED ) { event . setNewValue ( null , index ) ; } } else { NodeRewriteEvent event = getNodeEvent ( parent , childProperty , true ) ; if ( event . getChangeKind ( ) == RewriteEvent . UNCHANGED ) { event . setNewValue ( null ) ; } } } public boolean isInsertBoundToPrevious ( ASTNode node ) { if ( this . insertBoundToPrevious != null ) { return this . insertBoundToPrevious . contains ( node ) ; } return false ; } public void setInsertBoundToPrevious ( ASTNode node ) { if ( this . insertBoundToPrevious == null ) { this . insertBoundToPrevious = new HashSet ( ) ; } this . insertBoundToPrevious . add ( node ) ; } private void validateIsListProperty ( StructuralPropertyDescriptor property ) { if ( ! property . isChildListProperty ( ) ) { String message = property . getId ( ) + "<STR_LIT>" ; throw new IllegalArgumentException ( message ) ; } } private void validateHasChildProperty ( ASTNode parent , StructuralPropertyDescriptor property ) { if ( ! parent . structuralPropertiesForType ( ) . contains ( property ) ) { String message = Signature . getSimpleName ( parent . getClass ( ) . getName ( ) ) + "<STR_LIT>" + property . getId ( ) ; throw new IllegalArgumentException ( message ) ; } } private void validateIsNodeProperty ( StructuralPropertyDescriptor property ) { if ( property . isChildListProperty ( ) ) { String message = property . getId ( ) + "<STR_LIT>" ; throw new IllegalArgumentException ( message ) ; } } public String toString ( ) { StringBuffer buf = new StringBuffer ( ) ; for ( Iterator iter = this . eventLookup . values ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { List events = ( List ) iter . next ( ) ; for ( int i = <NUM_LIT:0> ; i < events . size ( ) ; i ++ ) { buf . append ( events . get ( i ) . toString ( ) ) . append ( '<STR_LIT:\n>' ) ; } } return buf . toString ( ) ; } public static boolean isNewNode ( ASTNode node ) { return ( node . getFlags ( ) & ASTNode . ORIGINAL ) == <NUM_LIT:0> ; } } </s>
|
<s> package org . eclipse . jdt . internal . core . dom . rewrite ; import org . eclipse . jdt . core . dom . CompilationUnit ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . IDocument ; public abstract class LineInformation { public static LineInformation create ( final IDocument doc ) { return new LineInformation ( ) { public int getLineOfOffset ( int offset ) { try { return doc . getLineOfOffset ( offset ) ; } catch ( BadLocationException e ) { return - <NUM_LIT:1> ; } } public int getLineOffset ( int line ) { try { return doc . getLineOffset ( line ) ; } catch ( BadLocationException e ) { return - <NUM_LIT:1> ; } } } ; } public static LineInformation create ( final CompilationUnit astRoot ) { return new LineInformation ( ) { public int getLineOfOffset ( int offset ) { return astRoot . getLineNumber ( offset ) - <NUM_LIT:1> ; } public int getLineOffset ( int line ) { return astRoot . getPosition ( line + <NUM_LIT:1> , <NUM_LIT:0> ) ; } } ; } public abstract int getLineOfOffset ( int offset ) ; public abstract int getLineOffset ( int line ) ; } </s>
|
<s> package org . eclipse . jdt . internal . core . dom . rewrite ; public class NodeRewriteEvent extends RewriteEvent { private Object originalValue ; private Object newValue ; public NodeRewriteEvent ( Object originalValue , Object newValue ) { this . originalValue = originalValue ; this . newValue = newValue ; } public Object getNewValue ( ) { return this . newValue ; } public Object getOriginalValue ( ) { return this . originalValue ; } public int getChangeKind ( ) { if ( this . originalValue == this . newValue ) { return UNCHANGED ; } if ( this . originalValue == null ) { return INSERTED ; } if ( this . newValue == null ) { return REMOVED ; } if ( this . originalValue . equals ( this . newValue ) ) { return UNCHANGED ; } return REPLACED ; } public boolean isListRewrite ( ) { return false ; } public void setNewValue ( Object newValue ) { this . newValue = newValue ; } public RewriteEvent [ ] getChildren ( ) { return null ; } public String toString ( ) { StringBuffer buf = new StringBuffer ( ) ; switch ( getChangeKind ( ) ) { case INSERTED : buf . append ( "<STR_LIT>" ) ; buf . append ( getNewValue ( ) ) ; buf . append ( '<CHAR_LIT:]>' ) ; break ; case REPLACED : buf . append ( "<STR_LIT>" ) ; buf . append ( getOriginalValue ( ) ) ; buf . append ( "<STR_LIT>" ) ; buf . append ( getNewValue ( ) ) ; buf . append ( '<CHAR_LIT:]>' ) ; break ; case REMOVED : buf . append ( "<STR_LIT>" ) ; buf . append ( getOriginalValue ( ) ) ; buf . append ( '<CHAR_LIT:]>' ) ; break ; default : buf . append ( "<STR_LIT>" ) ; } return buf . toString ( ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . core . dom . rewrite ; import java . util . ArrayList ; import java . util . IdentityHashMap ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import java . util . Stack ; import org . eclipse . core . runtime . Assert ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . jdt . core . dom . * ; import org . eclipse . jdt . core . dom . rewrite . TargetSourceRangeComputer ; import org . eclipse . jdt . core . dom . rewrite . TargetSourceRangeComputer . SourceRange ; import org . eclipse . jdt . core . formatter . DefaultCodeFormatterConstants ; import org . eclipse . jdt . core . formatter . IndentManipulation ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; 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 . parser . ScannerHelper ; import org . eclipse . jdt . internal . compiler . parser . TerminalTokens ; import org . eclipse . jdt . internal . compiler . util . Util ; import org . eclipse . jdt . internal . core . dom . rewrite . ASTRewriteFormatter . BlockContext ; import org . eclipse . jdt . internal . core . dom . rewrite . ASTRewriteFormatter . NodeMarker ; import org . eclipse . jdt . internal . core . dom . rewrite . ASTRewriteFormatter . Prefix ; import org . eclipse . jdt . internal . core . dom . rewrite . NodeInfoStore . CopyPlaceholderData ; import org . eclipse . jdt . internal . core . dom . rewrite . NodeInfoStore . StringPlaceholderData ; import org . eclipse . jdt . internal . core . dom . rewrite . RewriteEventStore . CopySourceInfo ; import org . eclipse . text . edits . CopySourceEdit ; import org . eclipse . text . edits . CopyTargetEdit ; import org . eclipse . text . edits . DeleteEdit ; import org . eclipse . text . edits . InsertEdit ; import org . eclipse . text . edits . MoveSourceEdit ; import org . eclipse . text . edits . MoveTargetEdit ; import org . eclipse . text . edits . RangeMarker ; import org . eclipse . text . edits . ReplaceEdit ; import org . eclipse . text . edits . TextEdit ; import org . eclipse . text . edits . TextEditGroup ; public final class ASTRewriteAnalyzer extends ASTVisitor { static final int JLS2_INTERNAL = AST . JLS2 ; TextEdit currentEdit ; final RewriteEventStore eventStore ; private TokenScanner tokenScanner ; private final Map sourceCopyInfoToEdit ; private final Stack sourceCopyEndNodes ; private final char [ ] content ; private final LineInformation lineInfo ; private final ASTRewriteFormatter formatter ; private final NodeInfoStore nodeInfos ; private final TargetSourceRangeComputer extendedSourceRangeComputer ; private final LineCommentEndOffsets lineCommentEndOffsets ; private int beforeRequiredSpaceIndex = - <NUM_LIT:1> ; Map options ; private RecoveryScannerData recoveryScannerData ; public ASTRewriteAnalyzer ( char [ ] content , LineInformation lineInfo , String lineDelim , TextEdit rootEdit , RewriteEventStore eventStore , NodeInfoStore nodeInfos , List comments , Map options , TargetSourceRangeComputer extendedSourceRangeComputer , RecoveryScannerData recoveryScannerData ) { this . eventStore = eventStore ; this . content = content ; this . lineInfo = lineInfo ; this . nodeInfos = nodeInfos ; this . tokenScanner = null ; this . currentEdit = rootEdit ; this . sourceCopyInfoToEdit = new IdentityHashMap ( ) ; this . sourceCopyEndNodes = new Stack ( ) ; this . formatter = new ASTRewriteFormatter ( nodeInfos , eventStore , options , lineDelim ) ; this . extendedSourceRangeComputer = extendedSourceRangeComputer ; this . lineCommentEndOffsets = new LineCommentEndOffsets ( comments ) ; this . options = options ; this . recoveryScannerData = recoveryScannerData ; } final TokenScanner getScanner ( ) { if ( this . tokenScanner == null ) { CompilerOptions compilerOptions = new CompilerOptions ( this . options ) ; Scanner scanner ; if ( this . recoveryScannerData == null ) { scanner = new Scanner ( true , false , false , compilerOptions . sourceLevel , compilerOptions . complianceLevel , null , null , true ) ; } else { scanner = new RecoveryScanner ( false , false , compilerOptions . sourceLevel , compilerOptions . complianceLevel , null , null , true , this . recoveryScannerData ) ; } scanner . setSource ( this . content ) ; this . tokenScanner = new TokenScanner ( scanner ) ; } return this . tokenScanner ; } final char [ ] getContent ( ) { return this . content ; } final LineInformation getLineInformation ( ) { return this . lineInfo ; } final SourceRange getExtendedRange ( ASTNode node ) { if ( this . eventStore . isRangeCopyPlaceholder ( node ) ) { return new SourceRange ( node . getStartPosition ( ) , node . getLength ( ) ) ; } return this . extendedSourceRangeComputer . computeSourceRange ( node ) ; } final int getExtendedOffset ( ASTNode node ) { return getExtendedRange ( node ) . getStartPosition ( ) ; } final int getExtendedEnd ( ASTNode node ) { TargetSourceRangeComputer . SourceRange range = getExtendedRange ( node ) ; return range . getStartPosition ( ) + range . getLength ( ) ; } final TextEdit getCopySourceEdit ( CopySourceInfo info ) { TextEdit edit = ( TextEdit ) this . sourceCopyInfoToEdit . get ( info ) ; if ( edit == null ) { SourceRange range = getExtendedRange ( info . getNode ( ) ) ; int start = range . getStartPosition ( ) ; int end = start + range . getLength ( ) ; if ( info . isMove ) { MoveSourceEdit moveSourceEdit = new MoveSourceEdit ( start , end - start ) ; moveSourceEdit . setTargetEdit ( new MoveTargetEdit ( <NUM_LIT:0> ) ) ; edit = moveSourceEdit ; } else { CopySourceEdit copySourceEdit = new CopySourceEdit ( start , end - start ) ; copySourceEdit . setTargetEdit ( new CopyTargetEdit ( <NUM_LIT:0> ) ) ; edit = copySourceEdit ; } this . sourceCopyInfoToEdit . put ( info , edit ) ; } return edit ; } private final int getChangeKind ( ASTNode node , StructuralPropertyDescriptor property ) { RewriteEvent event = getEvent ( node , property ) ; if ( event != null ) { return event . getChangeKind ( ) ; } return RewriteEvent . UNCHANGED ; } private final boolean hasChildrenChanges ( ASTNode node ) { return this . eventStore . hasChangedProperties ( node ) ; } private final boolean isChanged ( ASTNode node , StructuralPropertyDescriptor property ) { RewriteEvent event = getEvent ( node , property ) ; if ( event != null ) { return event . getChangeKind ( ) != RewriteEvent . UNCHANGED ; } return false ; } private final boolean isCollapsed ( ASTNode node ) { return this . nodeInfos . isCollapsed ( node ) ; } final boolean isInsertBoundToPrevious ( ASTNode node ) { return this . eventStore . isInsertBoundToPrevious ( node ) ; } private final TextEditGroup getEditGroup ( ASTNode parent , StructuralPropertyDescriptor property ) { RewriteEvent event = getEvent ( parent , property ) ; if ( event != null ) { return getEditGroup ( event ) ; } return null ; } final RewriteEvent getEvent ( ASTNode parent , StructuralPropertyDescriptor property ) { return this . eventStore . getEvent ( parent , property ) ; } final TextEditGroup getEditGroup ( RewriteEvent change ) { return this . eventStore . getEventEditGroup ( change ) ; } private final Object getOriginalValue ( ASTNode parent , StructuralPropertyDescriptor property ) { return this . eventStore . getOriginalValue ( parent , property ) ; } private final Object getNewValue ( ASTNode parent , StructuralPropertyDescriptor property ) { return this . eventStore . getNewValue ( parent , property ) ; } final void addEdit ( TextEdit edit ) { this . currentEdit . addChild ( edit ) ; } final String getLineDelimiter ( ) { return this . formatter . getLineDelimiter ( ) ; } final String createIndentString ( int indent ) { return this . formatter . createIndentString ( indent ) ; } final private String getIndentOfLine ( int pos ) { int line = getLineInformation ( ) . getLineOfOffset ( pos ) ; if ( line >= <NUM_LIT:0> ) { char [ ] cont = getContent ( ) ; int lineStart = getLineInformation ( ) . getLineOffset ( line ) ; int i = lineStart ; while ( i < cont . length && IndentManipulation . isIndentChar ( this . content [ i ] ) ) { i ++ ; } return new String ( cont , lineStart , i - lineStart ) ; } return Util . EMPTY_STRING ; } final String getIndentAtOffset ( int pos ) { return this . formatter . getIndentString ( getIndentOfLine ( pos ) ) ; } final void doTextInsert ( int offset , String insertString , TextEditGroup editGroup ) { if ( insertString . length ( ) > <NUM_LIT:0> ) { if ( this . lineCommentEndOffsets . isEndOfLineComment ( offset , this . content ) ) { if ( ! insertString . startsWith ( getLineDelimiter ( ) ) ) { TextEdit edit = new InsertEdit ( offset , getLineDelimiter ( ) ) ; addEdit ( edit ) ; if ( editGroup != null ) { addEditGroup ( editGroup , edit ) ; } } this . lineCommentEndOffsets . remove ( offset ) ; } TextEdit edit = new InsertEdit ( offset , insertString ) ; addEdit ( edit ) ; if ( editGroup != null ) { addEditGroup ( editGroup , edit ) ; } } } final void addEditGroup ( TextEditGroup editGroup , TextEdit edit ) { editGroup . addTextEdit ( edit ) ; } final TextEdit doTextRemove ( int offset , int len , TextEditGroup editGroup ) { if ( len == <NUM_LIT:0> ) { return null ; } TextEdit edit = new DeleteEdit ( offset , len ) ; addEdit ( edit ) ; if ( editGroup != null ) { addEditGroup ( editGroup , edit ) ; } return edit ; } final void doTextRemoveAndVisit ( int offset , int len , ASTNode node , TextEditGroup editGroup ) { TextEdit edit = doTextRemove ( offset , len , editGroup ) ; if ( edit != null ) { this . currentEdit = edit ; voidVisit ( node ) ; this . currentEdit = edit . getParent ( ) ; } else { voidVisit ( node ) ; } } final int doVisit ( ASTNode node ) { node . accept ( this ) ; return getExtendedEnd ( node ) ; } private final int doVisit ( ASTNode parent , StructuralPropertyDescriptor property , int offset ) { Object node = getOriginalValue ( parent , property ) ; if ( property . isChildProperty ( ) && node != null ) { return doVisit ( ( ASTNode ) node ) ; } else if ( property . isChildListProperty ( ) ) { return doVisitList ( ( List ) node , offset ) ; } return offset ; } private int doVisitList ( List list , int offset ) { int endPos = offset ; for ( Iterator iter = list . iterator ( ) ; iter . hasNext ( ) ; ) { ASTNode curr = ( ( ASTNode ) iter . next ( ) ) ; endPos = doVisit ( curr ) ; } return endPos ; } final void voidVisit ( ASTNode node ) { node . accept ( this ) ; } private final void voidVisit ( ASTNode parent , StructuralPropertyDescriptor property ) { Object node = getOriginalValue ( parent , property ) ; if ( property . isChildProperty ( ) && node != null ) { voidVisit ( ( ASTNode ) node ) ; } else if ( property . isChildListProperty ( ) ) { voidVisitList ( ( List ) node ) ; } } private void voidVisitList ( List list ) { for ( Iterator iter = list . iterator ( ) ; iter . hasNext ( ) ; ) { doVisit ( ( ( ASTNode ) iter . next ( ) ) ) ; } } private final boolean doVisitUnchangedChildren ( ASTNode parent ) { List properties = parent . structuralPropertiesForType ( ) ; for ( int i = <NUM_LIT:0> ; i < properties . size ( ) ; i ++ ) { voidVisit ( parent , ( StructuralPropertyDescriptor ) properties . get ( i ) ) ; } return false ; } private final void doTextReplace ( int offset , int len , String insertString , TextEditGroup editGroup ) { if ( len > <NUM_LIT:0> || insertString . length ( ) > <NUM_LIT:0> ) { TextEdit edit = new ReplaceEdit ( offset , len , insertString ) ; addEdit ( edit ) ; if ( editGroup != null ) { addEditGroup ( editGroup , edit ) ; } } } private final TextEdit doTextCopy ( TextEdit sourceEdit , int destOffset , int sourceIndentLevel , String destIndentString , TextEditGroup editGroup ) { TextEdit targetEdit ; SourceModifier modifier = new SourceModifier ( sourceIndentLevel , destIndentString , this . formatter . getTabWidth ( ) , this . formatter . getIndentWidth ( ) ) ; if ( sourceEdit instanceof MoveSourceEdit ) { MoveSourceEdit moveEdit = ( MoveSourceEdit ) sourceEdit ; moveEdit . setSourceModifier ( modifier ) ; targetEdit = new MoveTargetEdit ( destOffset , moveEdit ) ; addEdit ( targetEdit ) ; } else { CopySourceEdit copyEdit = ( CopySourceEdit ) sourceEdit ; copyEdit . setSourceModifier ( modifier ) ; targetEdit = new CopyTargetEdit ( destOffset , copyEdit ) ; addEdit ( targetEdit ) ; } if ( editGroup != null ) { addEditGroup ( editGroup , sourceEdit ) ; addEditGroup ( editGroup , targetEdit ) ; } return targetEdit ; } private void changeNotSupported ( ASTNode node ) { Assert . isTrue ( false , "<STR_LIT>" + node . getClass ( ) . getName ( ) ) ; } class ListRewriter { protected String constantSeparator ; protected int startPos ; protected RewriteEvent [ ] list ; protected final ASTNode getOriginalNode ( int index ) { return ( ASTNode ) this . list [ index ] . getOriginalValue ( ) ; } protected final ASTNode getNewNode ( int index ) { return ( ASTNode ) this . list [ index ] . getNewValue ( ) ; } protected String getSeparatorString ( int nodeIndex ) { return this . constantSeparator ; } protected int getInitialIndent ( ) { return getIndent ( this . startPos ) ; } protected int getNodeIndent ( int nodeIndex ) { ASTNode node = getOriginalNode ( nodeIndex ) ; if ( node == null ) { for ( int i = nodeIndex - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { ASTNode curr = getOriginalNode ( i ) ; if ( curr != null ) { return getIndent ( curr . getStartPosition ( ) ) ; } } return getInitialIndent ( ) ; } return getIndent ( node . getStartPosition ( ) ) ; } protected int getStartOfNextNode ( int nextIndex , int defaultPos ) { for ( int i = nextIndex ; i < this . list . length ; i ++ ) { RewriteEvent elem = this . list [ i ] ; if ( elem . getChangeKind ( ) != RewriteEvent . INSERTED ) { ASTNode node = ( ASTNode ) elem . getOriginalValue ( ) ; return getExtendedOffset ( node ) ; } } return defaultPos ; } protected int getEndOfNode ( ASTNode node ) { return getExtendedEnd ( node ) ; } public final int rewriteList ( ASTNode parent , StructuralPropertyDescriptor property , int offset , String keyword , String separator ) { this . constantSeparator = separator ; return rewriteList ( parent , property , keyword , null , offset ) ; } private boolean insertAfterSeparator ( ASTNode node ) { return ! isInsertBoundToPrevious ( node ) ; } protected boolean mustRemoveSeparator ( int originalOffset , int nodeIndex ) { return true ; } private int rewriteList ( ASTNode parent , StructuralPropertyDescriptor property , String keyword , String endKeyword , int offset ) { this . startPos = offset ; this . list = getEvent ( parent , property ) . getChildren ( ) ; int total = this . list . length ; if ( total == <NUM_LIT:0> ) { return this . startPos ; } int currPos = - <NUM_LIT:1> ; int lastNonInsert = - <NUM_LIT:1> ; int lastNonDelete = - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < total ; i ++ ) { int currMark = this . list [ i ] . getChangeKind ( ) ; if ( currMark != RewriteEvent . INSERTED ) { lastNonInsert = i ; if ( currPos == - <NUM_LIT:1> ) { ASTNode elem = ( ASTNode ) this . list [ i ] . getOriginalValue ( ) ; currPos = getExtendedOffset ( elem ) ; } } if ( currMark != RewriteEvent . REMOVED ) { lastNonDelete = i ; } } boolean insertNew = currPos == - <NUM_LIT:1> ; if ( insertNew ) { if ( keyword . length ( ) > <NUM_LIT:0> ) { TextEditGroup editGroup = getEditGroup ( this . list [ <NUM_LIT:0> ] ) ; doTextInsert ( offset , keyword , editGroup ) ; } currPos = offset ; } if ( lastNonDelete == - <NUM_LIT:1> ) { currPos = offset ; } int prevEnd = currPos ; int prevMark = RewriteEvent . UNCHANGED ; final int NONE = <NUM_LIT:0> , NEW = <NUM_LIT:1> , EXISTING = <NUM_LIT:2> ; int separatorState = NEW ; for ( int i = <NUM_LIT:0> ; i < total ; i ++ ) { RewriteEvent currEvent = this . list [ i ] ; int currMark = currEvent . getChangeKind ( ) ; int nextIndex = i + <NUM_LIT:1> ; if ( currMark == RewriteEvent . INSERTED ) { TextEditGroup editGroup = getEditGroup ( currEvent ) ; ASTNode node = ( ASTNode ) currEvent . getNewValue ( ) ; if ( separatorState == NONE ) { doTextInsert ( currPos , getSeparatorString ( i - <NUM_LIT:1> ) , editGroup ) ; separatorState = NEW ; } if ( separatorState == NEW || insertAfterSeparator ( node ) ) { if ( separatorState == EXISTING ) { updateIndent ( prevMark , currPos , i , editGroup ) ; } doTextInsert ( currPos , node , getNodeIndent ( i ) , true , editGroup ) ; separatorState = NEW ; if ( i != lastNonDelete ) { if ( this . list [ nextIndex ] . getChangeKind ( ) != RewriteEvent . INSERTED ) { doTextInsert ( currPos , getSeparatorString ( i ) , editGroup ) ; } else { separatorState = NONE ; } } } else { doTextInsert ( prevEnd , getSeparatorString ( i - <NUM_LIT:1> ) , editGroup ) ; doTextInsert ( prevEnd , node , getNodeIndent ( i ) , true , editGroup ) ; } if ( insertNew ) { if ( endKeyword != null && endKeyword . length ( ) > <NUM_LIT:0> ) { doTextInsert ( currPos , endKeyword , editGroup ) ; } } } else if ( currMark == RewriteEvent . REMOVED ) { ASTNode node = ( ASTNode ) currEvent . getOriginalValue ( ) ; TextEditGroup editGroup = getEditGroup ( currEvent ) ; int currEnd = getEndOfNode ( node ) ; try { TokenScanner scanner = getScanner ( ) ; int newOffset = prevEnd ; int extendedOffset = getExtendedOffset ( node ) ; while ( TokenScanner . isComment ( scanner . readNext ( newOffset , false ) ) ) { int tempOffset = scanner . getNextEndOffset ( newOffset , false ) ; if ( tempOffset < extendedOffset ) { newOffset = tempOffset ; } else { break ; } } if ( currPos < newOffset ) { currPos = extendedOffset ; } prevEnd = newOffset ; } catch ( CoreException e ) { } if ( i > lastNonDelete && separatorState == EXISTING ) { doTextRemove ( prevEnd , currPos - prevEnd , editGroup ) ; doTextRemoveAndVisit ( currPos , currEnd - currPos , node , editGroup ) ; currPos = currEnd ; prevEnd = currEnd ; } else { if ( i < lastNonDelete ) { updateIndent ( prevMark , currPos , i , editGroup ) ; } int end = getStartOfNextNode ( nextIndex , currEnd ) ; try { TokenScanner scanner = getScanner ( ) ; int nextToken = scanner . readNext ( currEnd , false ) ; if ( TokenScanner . isComment ( nextToken ) ) { if ( end != scanner . getNextStartOffset ( currEnd , false ) ) { end = currEnd ; } } } catch ( CoreException e ) { } doTextRemoveAndVisit ( currPos , currEnd - currPos , node , getEditGroup ( currEvent ) ) ; if ( mustRemoveSeparator ( currPos , i ) ) { doTextRemove ( currEnd , end - currEnd , editGroup ) ; } currPos = end ; prevEnd = currEnd ; separatorState = NEW ; } } else { if ( currMark == RewriteEvent . REPLACED ) { ASTNode node = ( ASTNode ) currEvent . getOriginalValue ( ) ; int currEnd = getEndOfNode ( node ) ; TextEditGroup editGroup = getEditGroup ( currEvent ) ; ASTNode changed = ( ASTNode ) currEvent . getNewValue ( ) ; updateIndent ( prevMark , currPos , i , editGroup ) ; try { TokenScanner scanner = getScanner ( ) ; int newOffset = prevEnd ; int extendedOffset = getExtendedOffset ( node ) ; while ( TokenScanner . isComment ( scanner . readNext ( newOffset , false ) ) ) { int tempOffset = scanner . getNextEndOffset ( newOffset , false ) ; if ( tempOffset < extendedOffset ) { newOffset = tempOffset ; } else { break ; } } if ( currPos < newOffset ) { currPos = extendedOffset ; } } catch ( CoreException e ) { } doTextRemoveAndVisit ( currPos , currEnd - currPos , node , editGroup ) ; doTextInsert ( currPos , changed , getNodeIndent ( i ) , true , editGroup ) ; prevEnd = currEnd ; } else { ASTNode node = ( ASTNode ) currEvent . getOriginalValue ( ) ; voidVisit ( node ) ; } if ( i == lastNonInsert ) { separatorState = NONE ; if ( currMark == RewriteEvent . UNCHANGED ) { ASTNode node = ( ASTNode ) currEvent . getOriginalValue ( ) ; prevEnd = getEndOfNode ( node ) ; } currPos = prevEnd ; } else if ( this . list [ nextIndex ] . getChangeKind ( ) != RewriteEvent . UNCHANGED ) { if ( currMark == RewriteEvent . UNCHANGED ) { ASTNode node = ( ASTNode ) currEvent . getOriginalValue ( ) ; prevEnd = getEndOfNode ( node ) ; } currPos = getStartOfNextNode ( nextIndex , prevEnd ) ; separatorState = EXISTING ; } } prevMark = currMark ; } return currPos ; } public final int rewriteList ( ASTNode parent , StructuralPropertyDescriptor property , int offset , String keyword ) { return rewriteList ( parent , property , keyword , null , offset ) ; } protected void updateIndent ( int prevMark , int originalOffset , int nodeIndex , TextEditGroup editGroup ) { } public final int rewriteList ( ASTNode parent , StructuralPropertyDescriptor property , int offset , String keyword , String endKeyword , String separator ) { this . constantSeparator = separator ; return rewriteList ( parent , property , keyword , endKeyword , offset ) ; } } private int rewriteRequiredNode ( ASTNode parent , StructuralPropertyDescriptor property ) { RewriteEvent event = getEvent ( parent , property ) ; if ( event != null && event . getChangeKind ( ) == RewriteEvent . REPLACED ) { ASTNode node = ( ASTNode ) event . getOriginalValue ( ) ; TextEditGroup editGroup = getEditGroup ( event ) ; SourceRange range = getExtendedRange ( node ) ; int offset = range . getStartPosition ( ) ; int length = range . getLength ( ) ; doTextRemoveAndVisit ( offset , length , node , editGroup ) ; doTextInsert ( offset , ( ASTNode ) event . getNewValue ( ) , getIndent ( offset ) , true , editGroup ) ; return offset + length ; } return doVisit ( parent , property , <NUM_LIT:0> ) ; } private int rewriteNode ( ASTNode parent , StructuralPropertyDescriptor property , int offset , Prefix prefix ) { RewriteEvent event = getEvent ( parent , property ) ; if ( event != null ) { switch ( event . getChangeKind ( ) ) { case RewriteEvent . INSERTED : { ASTNode node = ( ASTNode ) event . getNewValue ( ) ; TextEditGroup editGroup = getEditGroup ( event ) ; int indent = getIndent ( offset ) ; doTextInsert ( offset , prefix . getPrefix ( indent ) , editGroup ) ; doTextInsert ( offset , node , indent , true , editGroup ) ; return offset ; } case RewriteEvent . REMOVED : { ASTNode node = ( ASTNode ) event . getOriginalValue ( ) ; TextEditGroup editGroup = getEditGroup ( event ) ; int nodeEnd ; int len ; if ( offset == <NUM_LIT:0> ) { SourceRange range = getExtendedRange ( node ) ; offset = range . getStartPosition ( ) ; len = range . getLength ( ) ; nodeEnd = offset + len ; } else { nodeEnd = getExtendedEnd ( node ) ; len = nodeEnd - offset ; } doTextRemoveAndVisit ( offset , len , node , editGroup ) ; return nodeEnd ; } case RewriteEvent . REPLACED : { ASTNode node = ( ASTNode ) event . getOriginalValue ( ) ; TextEditGroup editGroup = getEditGroup ( event ) ; SourceRange range = getExtendedRange ( node ) ; int nodeOffset = range . getStartPosition ( ) ; int nodeLen = range . getLength ( ) ; doTextRemoveAndVisit ( nodeOffset , nodeLen , node , editGroup ) ; doTextInsert ( nodeOffset , ( ASTNode ) event . getNewValue ( ) , getIndent ( offset ) , true , editGroup ) ; return nodeOffset + nodeLen ; } } } return doVisit ( parent , property , offset ) ; } private int rewriteJavadoc ( ASTNode node , StructuralPropertyDescriptor property ) { int pos = rewriteNode ( node , property , node . getStartPosition ( ) , ASTRewriteFormatter . NONE ) ; int changeKind = getChangeKind ( node , property ) ; if ( changeKind == RewriteEvent . INSERTED ) { String indent = getLineDelimiter ( ) + getIndentAtOffset ( pos ) ; doTextInsert ( pos , indent , getEditGroup ( node , property ) ) ; } else if ( changeKind == RewriteEvent . REMOVED ) { try { getScanner ( ) . readNext ( pos , false ) ; doTextRemove ( pos , getScanner ( ) . getCurrentStartOffset ( ) - pos , getEditGroup ( node , property ) ) ; pos = getScanner ( ) . getCurrentStartOffset ( ) ; } catch ( CoreException e ) { handleException ( e ) ; } } return pos ; } private int rewriteBodyNode ( ASTNode parent , StructuralPropertyDescriptor property , int offset , int endPos , int indent , BlockContext context ) { RewriteEvent event = getEvent ( parent , property ) ; if ( event != null ) { switch ( event . getChangeKind ( ) ) { case RewriteEvent . INSERTED : { ASTNode node = ( ASTNode ) event . getNewValue ( ) ; TextEditGroup editGroup = getEditGroup ( event ) ; String [ ] strings = context . getPrefixAndSuffix ( indent , node , this . eventStore ) ; doTextInsert ( offset , strings [ <NUM_LIT:0> ] , editGroup ) ; doTextInsert ( offset , node , indent , true , editGroup ) ; doTextInsert ( offset , strings [ <NUM_LIT:1> ] , editGroup ) ; return offset ; } case RewriteEvent . REMOVED : { ASTNode node = ( ASTNode ) event . getOriginalValue ( ) ; if ( endPos == - <NUM_LIT:1> ) { endPos = getExtendedEnd ( node ) ; } TextEditGroup editGroup = getEditGroup ( event ) ; int len = endPos - offset ; doTextRemoveAndVisit ( offset , len , node , editGroup ) ; return endPos ; } case RewriteEvent . REPLACED : { ASTNode node = ( ASTNode ) event . getOriginalValue ( ) ; boolean insertNewLine = false ; if ( endPos == - <NUM_LIT:1> ) { int previousEnd = node . getStartPosition ( ) + node . getLength ( ) ; endPos = getExtendedEnd ( node ) ; if ( endPos != previousEnd ) { int token = TokenScanner . END_OF_FILE ; try { token = getScanner ( ) . readNext ( previousEnd , false ) ; } catch ( CoreException e ) { } if ( token == TerminalTokens . TokenNameCOMMENT_LINE ) { insertNewLine = true ; } } } TextEditGroup editGroup = getEditGroup ( event ) ; int nodeLen = endPos - offset ; ASTNode replacingNode = ( ASTNode ) event . getNewValue ( ) ; String [ ] strings = context . getPrefixAndSuffix ( indent , replacingNode , this . eventStore ) ; doTextRemoveAndVisit ( offset , nodeLen , node , editGroup ) ; String prefix = strings [ <NUM_LIT:0> ] ; String insertedPrefix = prefix ; if ( insertNewLine ) { insertedPrefix = getLineDelimiter ( ) + this . formatter . createIndentString ( indent ) + insertedPrefix . trim ( ) + '<CHAR_LIT:U+0020>' ; } doTextInsert ( offset , insertedPrefix , editGroup ) ; String lineInPrefix = getCurrentLine ( prefix , prefix . length ( ) ) ; if ( prefix . length ( ) != lineInPrefix . length ( ) ) { indent = this . formatter . computeIndentUnits ( lineInPrefix ) ; } doTextInsert ( offset , replacingNode , indent , true , editGroup ) ; doTextInsert ( offset , strings [ <NUM_LIT:1> ] , editGroup ) ; return endPos ; } } } int pos = doVisit ( parent , property , offset ) ; if ( endPos != - <NUM_LIT:1> ) { return endPos ; } return pos ; } private int rewriteOptionalQualifier ( ASTNode parent , StructuralPropertyDescriptor property , int startPos ) { RewriteEvent event = getEvent ( parent , property ) ; if ( event != null ) { switch ( event . getChangeKind ( ) ) { case RewriteEvent . INSERTED : { ASTNode node = ( ASTNode ) event . getNewValue ( ) ; TextEditGroup editGroup = getEditGroup ( event ) ; doTextInsert ( startPos , node , getIndent ( startPos ) , true , editGroup ) ; doTextInsert ( startPos , "<STR_LIT:.>" , editGroup ) ; return startPos ; } case RewriteEvent . REMOVED : { try { ASTNode node = ( ASTNode ) event . getOriginalValue ( ) ; TextEditGroup editGroup = getEditGroup ( event ) ; int dotEnd = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameDOT , node . getStartPosition ( ) + node . getLength ( ) ) ; doTextRemoveAndVisit ( startPos , dotEnd - startPos , node , editGroup ) ; return dotEnd ; } catch ( CoreException e ) { handleException ( e ) ; } break ; } case RewriteEvent . REPLACED : { ASTNode node = ( ASTNode ) event . getOriginalValue ( ) ; TextEditGroup editGroup = getEditGroup ( event ) ; SourceRange range = getExtendedRange ( node ) ; int offset = range . getStartPosition ( ) ; int length = range . getLength ( ) ; doTextRemoveAndVisit ( offset , length , node , editGroup ) ; doTextInsert ( offset , ( ASTNode ) event . getNewValue ( ) , getIndent ( startPos ) , true , editGroup ) ; try { return getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameDOT , offset + length ) ; } catch ( CoreException e ) { handleException ( e ) ; } break ; } } } Object node = getOriginalValue ( parent , property ) ; if ( node == null ) { return startPos ; } int pos = doVisit ( ( ASTNode ) node ) ; try { return getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameDOT , pos ) ; } catch ( CoreException e ) { handleException ( e ) ; } return pos ; } class ParagraphListRewriter extends ListRewriter { public final static int DEFAULT_SPACING = <NUM_LIT:1> ; private int initialIndent ; private int separatorLines ; public ParagraphListRewriter ( int initialIndent , int separator ) { this . initialIndent = initialIndent ; this . separatorLines = separator ; } protected int getInitialIndent ( ) { return this . initialIndent ; } protected String getSeparatorString ( int nodeIndex ) { return getSeparatorString ( nodeIndex , nodeIndex + <NUM_LIT:1> ) ; } protected String getSeparatorString ( int nodeIndex , int nextNodeIndex ) { int newLines = this . separatorLines == - <NUM_LIT:1> ? getNewLines ( nodeIndex ) : this . separatorLines ; String lineDelim = getLineDelimiter ( ) ; StringBuffer buf = new StringBuffer ( lineDelim ) ; for ( int i = <NUM_LIT:0> ; i < newLines ; i ++ ) { buf . append ( lineDelim ) ; } buf . append ( createIndentString ( getNodeIndent ( nextNodeIndex ) ) ) ; return buf . toString ( ) ; } private ASTNode getNode ( int nodeIndex ) { ASTNode elem = ( ASTNode ) this . list [ nodeIndex ] . getOriginalValue ( ) ; if ( elem == null ) { elem = ( ASTNode ) this . list [ nodeIndex ] . getNewValue ( ) ; } return elem ; } private int getNewLines ( int nodeIndex ) { ASTNode curr = getNode ( nodeIndex ) ; ASTNode next = getNode ( nodeIndex + <NUM_LIT:1> ) ; int currKind = curr . getNodeType ( ) ; int nextKind = next . getNodeType ( ) ; ASTNode last = null ; ASTNode secondLast = null ; for ( int i = <NUM_LIT:0> ; i < this . list . length ; i ++ ) { ASTNode elem = ( ASTNode ) this . list [ i ] . getOriginalValue ( ) ; if ( elem != null ) { if ( last != null ) { if ( elem . getNodeType ( ) == nextKind && last . getNodeType ( ) == currKind ) { return countEmptyLines ( last ) ; } secondLast = last ; } last = elem ; } } if ( currKind == ASTNode . FIELD_DECLARATION && nextKind == ASTNode . FIELD_DECLARATION ) { return <NUM_LIT:0> ; } if ( secondLast != null ) { return countEmptyLines ( secondLast ) ; } return DEFAULT_SPACING ; } private int countEmptyLines ( ASTNode last ) { LineInformation lineInformation = getLineInformation ( ) ; int lastLine = lineInformation . getLineOfOffset ( getExtendedEnd ( last ) ) ; if ( lastLine >= <NUM_LIT:0> ) { int startLine = lastLine + <NUM_LIT:1> ; int start = lineInformation . getLineOffset ( startLine ) ; if ( start < <NUM_LIT:0> ) { return <NUM_LIT:0> ; } char [ ] cont = getContent ( ) ; int i = start ; while ( i < cont . length && ScannerHelper . isWhitespace ( cont [ i ] ) ) { i ++ ; } if ( i > start ) { lastLine = lineInformation . getLineOfOffset ( i ) ; if ( lastLine > startLine ) { return lastLine - startLine ; } } } return <NUM_LIT:0> ; } protected boolean mustRemoveSeparator ( int originalOffset , int nodeIndex ) { int previousNonRemovedNodeIndex = nodeIndex - <NUM_LIT:1> ; while ( previousNonRemovedNodeIndex >= <NUM_LIT:0> && this . list [ previousNonRemovedNodeIndex ] . getChangeKind ( ) == RewriteEvent . REMOVED ) { previousNonRemovedNodeIndex -- ; } if ( previousNonRemovedNodeIndex > - <NUM_LIT:1> ) { LineInformation lineInformation = getLineInformation ( ) ; RewriteEvent prevEvent = this . list [ previousNonRemovedNodeIndex ] ; int prevKind = prevEvent . getChangeKind ( ) ; if ( prevKind == RewriteEvent . UNCHANGED || prevKind == RewriteEvent . REPLACED ) { ASTNode prevNode = ( ASTNode ) this . list [ previousNonRemovedNodeIndex ] . getOriginalValue ( ) ; int prevEndPosition = prevNode . getStartPosition ( ) + prevNode . getLength ( ) ; int prevLine = lineInformation . getLineOfOffset ( prevEndPosition ) ; int line = lineInformation . getLineOfOffset ( originalOffset ) ; if ( prevLine == line && nodeIndex + <NUM_LIT:1> < this . list . length ) { RewriteEvent nextEvent = this . list [ nodeIndex + <NUM_LIT:1> ] ; int nextKind = nextEvent . getChangeKind ( ) ; if ( nextKind == RewriteEvent . UNCHANGED || prevKind == RewriteEvent . REPLACED ) { ASTNode nextNode = ( ASTNode ) nextEvent . getOriginalValue ( ) ; int nextStartPosition = nextNode . getStartPosition ( ) ; int nextLine = lineInformation . getLineOfOffset ( nextStartPosition ) ; return nextLine == line ; } return false ; } } } return true ; } } private int rewriteParagraphList ( ASTNode parent , StructuralPropertyDescriptor property , int insertPos , int insertIndent , int separator , int lead ) { RewriteEvent event = getEvent ( parent , property ) ; if ( event == null || event . getChangeKind ( ) == RewriteEvent . UNCHANGED ) { return doVisit ( parent , property , insertPos ) ; } RewriteEvent [ ] events = event . getChildren ( ) ; ParagraphListRewriter listRewriter = new ParagraphListRewriter ( insertIndent , separator ) ; StringBuffer leadString = new StringBuffer ( ) ; if ( isAllOfKind ( events , RewriteEvent . INSERTED ) ) { for ( int i = <NUM_LIT:0> ; i < lead ; i ++ ) { leadString . append ( getLineDelimiter ( ) ) ; } leadString . append ( createIndentString ( insertIndent ) ) ; } return listRewriter . rewriteList ( parent , property , insertPos , leadString . toString ( ) ) ; } private int rewriteOptionalTypeParameters ( ASTNode parent , StructuralPropertyDescriptor property , int offset , String keyword , boolean adjustOnNext , boolean needsSpaceOnRemoveAll ) { int pos = offset ; RewriteEvent event = getEvent ( parent , property ) ; if ( event != null && event . getChangeKind ( ) != RewriteEvent . UNCHANGED ) { RewriteEvent [ ] children = event . getChildren ( ) ; try { boolean isAllInserted = isAllOfKind ( children , RewriteEvent . INSERTED ) ; if ( isAllInserted && adjustOnNext ) { pos = getScanner ( ) . getNextStartOffset ( pos , false ) ; } boolean isAllRemoved = ! isAllInserted && isAllOfKind ( children , RewriteEvent . REMOVED ) ; if ( isAllRemoved ) { int posBeforeOpenBracket = getScanner ( ) . getTokenStartOffset ( TerminalTokens . TokenNameLESS , pos ) ; if ( posBeforeOpenBracket != pos ) { needsSpaceOnRemoveAll = false ; } pos = posBeforeOpenBracket ; } pos = new ListRewriter ( ) . rewriteList ( parent , property , pos , String . valueOf ( '<CHAR_LIT>' ) , "<STR_LIT:U+002CU+0020>" ) ; if ( isAllRemoved ) { int endPos = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameGREATER , pos ) ; endPos = getScanner ( ) . getNextStartOffset ( endPos , false ) ; String replacement = needsSpaceOnRemoveAll ? String . valueOf ( '<CHAR_LIT:U+0020>' ) : Util . EMPTY_STRING ; doTextReplace ( pos , endPos - pos , replacement , getEditGroup ( children [ children . length - <NUM_LIT:1> ] ) ) ; return endPos ; } else if ( isAllInserted ) { doTextInsert ( pos , String . valueOf ( '<CHAR_LIT:>>' + keyword ) , getEditGroup ( children [ children . length - <NUM_LIT:1> ] ) ) ; return pos ; } } catch ( CoreException e ) { handleException ( e ) ; } } else { pos = doVisit ( parent , property , pos ) ; } if ( pos != offset ) { try { return getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameGREATER , pos ) ; } catch ( CoreException e ) { handleException ( e ) ; } } return pos ; } private boolean isAllOfKind ( RewriteEvent [ ] children , int kind ) { for ( int i = <NUM_LIT:0> ; i < children . length ; i ++ ) { if ( children [ i ] . getChangeKind ( ) != kind ) { return false ; } } return true ; } private int rewriteNodeList ( ASTNode parent , StructuralPropertyDescriptor property , int pos , String keyword , String endKeyword , String separator ) { RewriteEvent event = getEvent ( parent , property ) ; if ( event != null && event . getChangeKind ( ) != RewriteEvent . UNCHANGED ) { return new ListRewriter ( ) . rewriteList ( parent , property , pos , keyword , endKeyword , separator ) ; } return doVisit ( parent , property , pos ) ; } private int rewriteNodeList ( ASTNode parent , StructuralPropertyDescriptor property , int pos , String keyword , String separator ) { RewriteEvent event = getEvent ( parent , property ) ; if ( event != null && event . getChangeKind ( ) != RewriteEvent . UNCHANGED ) { return new ListRewriter ( ) . rewriteList ( parent , property , pos , keyword , separator ) ; } return doVisit ( parent , property , pos ) ; } private void rewriteMethodBody ( MethodDeclaration parent , int startPos ) { RewriteEvent event = getEvent ( parent , MethodDeclaration . BODY_PROPERTY ) ; if ( event != null ) { switch ( event . getChangeKind ( ) ) { case RewriteEvent . INSERTED : { int endPos = parent . getStartPosition ( ) + parent . getLength ( ) ; TextEditGroup editGroup = getEditGroup ( event ) ; ASTNode body = ( ASTNode ) event . getNewValue ( ) ; doTextRemove ( startPos , endPos - startPos , editGroup ) ; int indent = getIndent ( parent . getStartPosition ( ) ) ; String prefix = this . formatter . METHOD_BODY . getPrefix ( indent ) ; doTextInsert ( startPos , prefix , editGroup ) ; doTextInsert ( startPos , body , indent , true , editGroup ) ; return ; } case RewriteEvent . REMOVED : { TextEditGroup editGroup = getEditGroup ( event ) ; ASTNode body = ( ASTNode ) event . getOriginalValue ( ) ; int endPos = parent . getStartPosition ( ) + parent . getLength ( ) ; doTextRemoveAndVisit ( startPos , endPos - startPos , body , editGroup ) ; doTextInsert ( startPos , "<STR_LIT:;>" , editGroup ) ; return ; } case RewriteEvent . REPLACED : { TextEditGroup editGroup = getEditGroup ( event ) ; ASTNode body = ( ASTNode ) event . getOriginalValue ( ) ; doTextRemoveAndVisit ( body . getStartPosition ( ) , body . getLength ( ) , body , editGroup ) ; doTextInsert ( body . getStartPosition ( ) , ( ASTNode ) event . getNewValue ( ) , getIndent ( body . getStartPosition ( ) ) , true , editGroup ) ; return ; } } } voidVisit ( parent , MethodDeclaration . BODY_PROPERTY ) ; } private int rewriteExtraDimensions ( ASTNode parent , StructuralPropertyDescriptor property , int pos ) { RewriteEvent event = getEvent ( parent , property ) ; if ( event == null || event . getChangeKind ( ) == RewriteEvent . UNCHANGED ) { return ( ( Integer ) getOriginalValue ( parent , property ) ) . intValue ( ) ; } int oldDim = ( ( Integer ) event . getOriginalValue ( ) ) . intValue ( ) ; int newDim = ( ( Integer ) event . getNewValue ( ) ) . intValue ( ) ; if ( oldDim != newDim ) { TextEditGroup editGroup = getEditGroup ( event ) ; rewriteExtraDimensions ( oldDim , newDim , pos , editGroup ) ; } return oldDim ; } private void rewriteExtraDimensions ( int oldDim , int newDim , int pos , TextEditGroup editGroup ) { if ( oldDim < newDim ) { for ( int i = oldDim ; i < newDim ; i ++ ) { doTextInsert ( pos , "<STR_LIT:[]>" , editGroup ) ; } } else if ( newDim < oldDim ) { try { getScanner ( ) . setOffset ( pos ) ; for ( int i = newDim ; i < oldDim ; i ++ ) { getScanner ( ) . readToToken ( TerminalTokens . TokenNameRBRACKET ) ; } doTextRemove ( pos , getScanner ( ) . getCurrentEndOffset ( ) - pos , editGroup ) ; } catch ( CoreException e ) { handleException ( e ) ; } } } private int getPosAfterLeftBrace ( int pos ) { try { int nextToken = getScanner ( ) . readNext ( pos , true ) ; if ( nextToken == TerminalTokens . TokenNameLBRACE ) { return getScanner ( ) . getCurrentEndOffset ( ) ; } } catch ( CoreException e ) { handleException ( e ) ; } return pos ; } private int getPosAfterTry ( int pos ) { try { int nextToken = getScanner ( ) . readNext ( pos , true ) ; if ( nextToken == TerminalTokens . TokenNametry ) { return getScanner ( ) . getCurrentEndOffset ( ) ; } } catch ( CoreException e ) { handleException ( e ) ; } return pos ; } final int getIndent ( int offset ) { return this . formatter . computeIndentUnits ( getIndentOfLine ( offset ) ) ; } final void doTextInsert ( int insertOffset , ASTNode node , int initialIndentLevel , boolean removeLeadingIndent , TextEditGroup editGroup ) { ArrayList markers = new ArrayList ( ) ; String formatted = this . formatter . getFormattedResult ( node , initialIndentLevel , markers ) ; int currPos = <NUM_LIT:0> ; if ( removeLeadingIndent ) { while ( currPos < formatted . length ( ) && ScannerHelper . isWhitespace ( formatted . charAt ( currPos ) ) ) { currPos ++ ; } } for ( int i = <NUM_LIT:0> ; i < markers . size ( ) ; i ++ ) { NodeMarker curr = ( NodeMarker ) markers . get ( i ) ; int offset = curr . offset ; if ( offset >= currPos ) { String insertStr = formatted . substring ( currPos , offset ) ; doTextInsert ( insertOffset , insertStr , editGroup ) ; } else { continue ; } Object data = curr . data ; if ( data instanceof TextEditGroup ) { TextEdit edit = new RangeMarker ( insertOffset , <NUM_LIT:0> ) ; addEditGroup ( ( TextEditGroup ) data , edit ) ; addEdit ( edit ) ; if ( curr . length != <NUM_LIT:0> ) { int end = offset + curr . length ; int k = i + <NUM_LIT:1> ; while ( k < markers . size ( ) && ( ( NodeMarker ) markers . get ( k ) ) . offset < end ) { k ++ ; } curr . offset = end ; curr . length = <NUM_LIT:0> ; markers . add ( k , curr ) ; } currPos = offset ; } else { String destIndentString = this . formatter . getIndentString ( getCurrentLine ( formatted , offset ) ) ; if ( data instanceof CopyPlaceholderData ) { CopySourceInfo copySource = ( ( CopyPlaceholderData ) data ) . copySource ; int srcIndentLevel = getIndent ( copySource . getNode ( ) . getStartPosition ( ) ) ; TextEdit sourceEdit = getCopySourceEdit ( copySource ) ; doTextCopy ( sourceEdit , insertOffset , srcIndentLevel , destIndentString , editGroup ) ; currPos = offset + curr . length ; if ( needsNewLineForLineComment ( copySource . getNode ( ) , formatted , currPos ) ) { doTextInsert ( insertOffset , getLineDelimiter ( ) , editGroup ) ; } } else if ( data instanceof StringPlaceholderData ) { String code = ( ( StringPlaceholderData ) data ) . code ; String str = this . formatter . changeIndent ( code , <NUM_LIT:0> , destIndentString ) ; doTextInsert ( insertOffset , str , editGroup ) ; currPos = offset + curr . length ; } } } if ( currPos < formatted . length ( ) ) { String insertStr = formatted . substring ( currPos ) ; doTextInsert ( insertOffset , insertStr , editGroup ) ; } } private boolean needsNewLineForLineComment ( ASTNode node , String formatted , int offset ) { if ( ! this . lineCommentEndOffsets . isEndOfLineComment ( getExtendedEnd ( node ) , this . content ) ) { return false ; } return offset < formatted . length ( ) && ! IndentManipulation . isLineDelimiterChar ( formatted . charAt ( offset ) ) ; } private String getCurrentLine ( String str , int pos ) { for ( int i = pos - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { char ch = str . charAt ( i ) ; if ( IndentManipulation . isLineDelimiterChar ( ch ) ) { return str . substring ( i + <NUM_LIT:1> , pos ) ; } } return str . substring ( <NUM_LIT:0> , pos ) ; } private void rewriteModifiers ( ASTNode parent , StructuralPropertyDescriptor property , int offset ) { RewriteEvent event = getEvent ( parent , property ) ; if ( event == null || event . getChangeKind ( ) != RewriteEvent . REPLACED ) { return ; } try { int oldModifiers = ( ( Integer ) event . getOriginalValue ( ) ) . intValue ( ) ; int newModifiers = ( ( Integer ) event . getNewValue ( ) ) . intValue ( ) ; TextEditGroup editGroup = getEditGroup ( event ) ; TokenScanner scanner = getScanner ( ) ; int tok = scanner . readNext ( offset , false ) ; int startPos = scanner . getCurrentStartOffset ( ) ; int nextStart = startPos ; loop : while ( true ) { if ( TokenScanner . isComment ( tok ) ) { tok = scanner . readNext ( true ) ; } boolean keep = true ; switch ( tok ) { case TerminalTokens . TokenNamepublic : keep = Modifier . isPublic ( newModifiers ) ; break ; case TerminalTokens . TokenNameprotected : keep = Modifier . isProtected ( newModifiers ) ; break ; case TerminalTokens . TokenNameprivate : keep = Modifier . isPrivate ( newModifiers ) ; break ; case TerminalTokens . TokenNamestatic : keep = Modifier . isStatic ( newModifiers ) ; break ; case TerminalTokens . TokenNamefinal : keep = Modifier . isFinal ( newModifiers ) ; break ; case TerminalTokens . TokenNameabstract : keep = Modifier . isAbstract ( newModifiers ) ; break ; case TerminalTokens . TokenNamenative : keep = Modifier . isNative ( newModifiers ) ; break ; case TerminalTokens . TokenNamevolatile : keep = Modifier . isVolatile ( newModifiers ) ; break ; case TerminalTokens . TokenNamestrictfp : keep = Modifier . isStrictfp ( newModifiers ) ; break ; case TerminalTokens . TokenNametransient : keep = Modifier . isTransient ( newModifiers ) ; break ; case TerminalTokens . TokenNamesynchronized : keep = Modifier . isSynchronized ( newModifiers ) ; break ; default : break loop ; } tok = getScanner ( ) . readNext ( false ) ; int currPos = nextStart ; nextStart = getScanner ( ) . getCurrentStartOffset ( ) ; if ( ! keep ) { doTextRemove ( currPos , nextStart - currPos , editGroup ) ; } } int addedModifiers = newModifiers & ~ oldModifiers ; if ( addedModifiers != <NUM_LIT:0> ) { if ( startPos != nextStart ) { int visibilityModifiers = addedModifiers & ( Modifier . PUBLIC | Modifier . PRIVATE | Modifier . PROTECTED ) ; if ( visibilityModifiers != <NUM_LIT:0> ) { StringBuffer buf = new StringBuffer ( ) ; ASTRewriteFlattener . printModifiers ( visibilityModifiers , buf ) ; doTextInsert ( startPos , buf . toString ( ) , editGroup ) ; addedModifiers &= ~ visibilityModifiers ; } } StringBuffer buf = new StringBuffer ( ) ; ASTRewriteFlattener . printModifiers ( addedModifiers , buf ) ; doTextInsert ( nextStart , buf . toString ( ) , editGroup ) ; } } catch ( CoreException e ) { handleException ( e ) ; } } class ModifierRewriter extends ListRewriter { private final Prefix annotationSeparation ; public ModifierRewriter ( Prefix annotationSeparation ) { this . annotationSeparation = annotationSeparation ; } protected String getSeparatorString ( int nodeIndex ) { ASTNode curr = getNewNode ( nodeIndex ) ; if ( curr instanceof Annotation ) { return this . annotationSeparation . getPrefix ( getNodeIndent ( nodeIndex + <NUM_LIT:1> ) ) ; } return super . getSeparatorString ( nodeIndex ) ; } } private int rewriteModifiers2 ( ASTNode node , ChildListPropertyDescriptor property , int pos ) { RewriteEvent event = getEvent ( node , property ) ; if ( event == null || event . getChangeKind ( ) == RewriteEvent . UNCHANGED ) { return doVisit ( node , property , pos ) ; } RewriteEvent [ ] children = event . getChildren ( ) ; boolean isAllInsert = isAllOfKind ( children , RewriteEvent . INSERTED ) ; boolean isAllRemove = isAllOfKind ( children , RewriteEvent . REMOVED ) ; if ( isAllInsert || isAllRemove ) { try { pos = getScanner ( ) . getNextStartOffset ( pos , false ) ; } catch ( CoreException e ) { handleException ( e ) ; } } Prefix formatterPrefix ; if ( property == SingleVariableDeclaration . MODIFIERS2_PROPERTY ) formatterPrefix = this . formatter . PARAM_ANNOTATION_SEPARATION ; else formatterPrefix = this . formatter . ANNOTATION_SEPARATION ; int endPos = new ModifierRewriter ( formatterPrefix ) . rewriteList ( node , property , pos , Util . EMPTY_STRING , "<STR_LIT:U+0020>" ) ; try { int nextPos = getScanner ( ) . getNextStartOffset ( endPos , false ) ; boolean lastUnchanged = children [ children . length - <NUM_LIT:1> ] . getChangeKind ( ) != RewriteEvent . UNCHANGED ; if ( isAllRemove ) { doTextRemove ( endPos , nextPos - endPos , getEditGroup ( children [ children . length - <NUM_LIT:1> ] ) ) ; return nextPos ; } else if ( isAllInsert || ( nextPos == endPos && lastUnchanged ) ) { RewriteEvent lastChild = children [ children . length - <NUM_LIT:1> ] ; String separator ; if ( lastChild . getNewValue ( ) instanceof Annotation ) { separator = formatterPrefix . getPrefix ( getIndent ( pos ) ) ; } else { separator = String . valueOf ( '<CHAR_LIT:U+0020>' ) ; } doTextInsert ( endPos , separator , getEditGroup ( lastChild ) ) ; } } catch ( CoreException e ) { handleException ( e ) ; } return endPos ; } private void replaceOperation ( int posBeforeOperation , String newOperation , TextEditGroup editGroup ) { try { getScanner ( ) . readNext ( posBeforeOperation , true ) ; doTextReplace ( getScanner ( ) . getCurrentStartOffset ( ) , getScanner ( ) . getCurrentLength ( ) , newOperation , editGroup ) ; } catch ( CoreException e ) { handleException ( e ) ; } } private void rewriteOperation ( ASTNode parent , StructuralPropertyDescriptor property , int posBeforeOperation ) { RewriteEvent event = getEvent ( parent , property ) ; if ( event != null && event . getChangeKind ( ) != RewriteEvent . UNCHANGED ) { try { String newOperation = event . getNewValue ( ) . toString ( ) ; TextEditGroup editGroup = getEditGroup ( event ) ; getScanner ( ) . readNext ( posBeforeOperation , true ) ; doTextReplace ( getScanner ( ) . getCurrentStartOffset ( ) , getScanner ( ) . getCurrentLength ( ) , newOperation , editGroup ) ; } catch ( CoreException e ) { handleException ( e ) ; } } } public void postVisit ( ASTNode node ) { TextEditGroup editGroup = this . eventStore . getTrackedNodeData ( node ) ; if ( editGroup != null ) { this . currentEdit = this . currentEdit . getParent ( ) ; } doCopySourcePostVisit ( node , this . sourceCopyEndNodes ) ; } public void preVisit ( ASTNode node ) { CopySourceInfo [ ] infos = this . eventStore . getNodeCopySources ( node ) ; doCopySourcePreVisit ( infos , this . sourceCopyEndNodes ) ; TextEditGroup editGroup = this . eventStore . getTrackedNodeData ( node ) ; if ( editGroup != null ) { SourceRange range = getExtendedRange ( node ) ; int offset = range . getStartPosition ( ) ; int length = range . getLength ( ) ; TextEdit edit = new RangeMarker ( offset , length ) ; addEditGroup ( editGroup , edit ) ; addEdit ( edit ) ; this . currentEdit = edit ; } ensureSpaceBeforeReplace ( node ) ; } final void doCopySourcePreVisit ( CopySourceInfo [ ] infos , Stack nodeEndStack ) { if ( infos != null ) { for ( int i = <NUM_LIT:0> ; i < infos . length ; i ++ ) { CopySourceInfo curr = infos [ i ] ; TextEdit edit = getCopySourceEdit ( curr ) ; addEdit ( edit ) ; this . currentEdit = edit ; nodeEndStack . push ( curr . getNode ( ) ) ; } } } final void doCopySourcePostVisit ( ASTNode node , Stack nodeEndStack ) { while ( ! nodeEndStack . isEmpty ( ) && nodeEndStack . peek ( ) == node ) { nodeEndStack . pop ( ) ; this . currentEdit = this . currentEdit . getParent ( ) ; } } public boolean visit ( CompilationUnit node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int startPos = rewriteNode ( node , CompilationUnit . PACKAGE_PROPERTY , <NUM_LIT:0> , ASTRewriteFormatter . NONE ) ; if ( getChangeKind ( node , CompilationUnit . PACKAGE_PROPERTY ) == RewriteEvent . INSERTED ) { doTextInsert ( <NUM_LIT:0> , getLineDelimiter ( ) , getEditGroup ( node , CompilationUnit . PACKAGE_PROPERTY ) ) ; } startPos = rewriteParagraphList ( node , CompilationUnit . IMPORTS_PROPERTY , startPos , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:2> ) ; rewriteParagraphList ( node , CompilationUnit . TYPES_PROPERTY , startPos , <NUM_LIT:0> , - <NUM_LIT:1> , <NUM_LIT:2> ) ; return false ; } public boolean visit ( TypeDeclaration node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int apiLevel = node . getAST ( ) . apiLevel ( ) ; int pos = rewriteJavadoc ( node , TypeDeclaration . JAVADOC_PROPERTY ) ; boolean isJLS2 = apiLevel == JLS2_INTERNAL ; if ( isJLS2 ) { rewriteModifiers ( node , TypeDeclaration . MODIFIERS_PROPERTY , pos ) ; } else { rewriteModifiers2 ( node , TypeDeclaration . MODIFIERS2_PROPERTY , pos ) ; } boolean isInterface = ( ( Boolean ) getOriginalValue ( node , TypeDeclaration . INTERFACE_PROPERTY ) ) . booleanValue ( ) ; boolean invertType = isChanged ( node , TypeDeclaration . INTERFACE_PROPERTY ) ; if ( invertType ) { try { int typeToken = isInterface ? TerminalTokens . TokenNameinterface : TerminalTokens . TokenNameclass ; int startPosition = node . getStartPosition ( ) ; if ( ! isJLS2 ) { List modifiers = node . modifiers ( ) ; final int size = modifiers . size ( ) ; if ( size != <NUM_LIT:0> ) { ASTNode modifierNode = ( ASTNode ) modifiers . get ( size - <NUM_LIT:1> ) ; startPosition = modifierNode . getStartPosition ( ) + modifierNode . getLength ( ) ; } } getScanner ( ) . readToToken ( typeToken , startPosition ) ; String str = isInterface ? "<STR_LIT:class>" : "<STR_LIT>" ; int start = getScanner ( ) . getCurrentStartOffset ( ) ; int end = getScanner ( ) . getCurrentEndOffset ( ) ; doTextReplace ( start , end - start , str , getEditGroup ( node , TypeDeclaration . INTERFACE_PROPERTY ) ) ; } catch ( CoreException e ) { } } pos = rewriteRequiredNode ( node , TypeDeclaration . NAME_PROPERTY ) ; if ( ! isJLS2 ) { pos = rewriteOptionalTypeParameters ( node , TypeDeclaration . TYPE_PARAMETERS_PROPERTY , pos , Util . EMPTY_STRING , false , true ) ; } if ( ! isInterface || invertType ) { ChildPropertyDescriptor superClassProperty = isJLS2 ? TypeDeclaration . SUPERCLASS_PROPERTY : TypeDeclaration . SUPERCLASS_TYPE_PROPERTY ; RewriteEvent superClassEvent = getEvent ( node , superClassProperty ) ; int changeKind = superClassEvent != null ? superClassEvent . getChangeKind ( ) : RewriteEvent . UNCHANGED ; switch ( changeKind ) { case RewriteEvent . INSERTED : { doTextInsert ( pos , "<STR_LIT>" , getEditGroup ( superClassEvent ) ) ; doTextInsert ( pos , ( ASTNode ) superClassEvent . getNewValue ( ) , <NUM_LIT:0> , false , getEditGroup ( superClassEvent ) ) ; break ; } case RewriteEvent . REMOVED : { ASTNode superClass = ( ASTNode ) superClassEvent . getOriginalValue ( ) ; int endPos = getExtendedEnd ( superClass ) ; doTextRemoveAndVisit ( pos , endPos - pos , superClass , getEditGroup ( superClassEvent ) ) ; pos = endPos ; break ; } case RewriteEvent . REPLACED : { ASTNode superClass = ( ASTNode ) superClassEvent . getOriginalValue ( ) ; SourceRange range = getExtendedRange ( superClass ) ; int offset = range . getStartPosition ( ) ; int length = range . getLength ( ) ; doTextRemoveAndVisit ( offset , length , superClass , getEditGroup ( superClassEvent ) ) ; doTextInsert ( offset , ( ASTNode ) superClassEvent . getNewValue ( ) , <NUM_LIT:0> , false , getEditGroup ( superClassEvent ) ) ; pos = offset + length ; break ; } case RewriteEvent . UNCHANGED : { pos = doVisit ( node , superClassProperty , pos ) ; } } } ChildListPropertyDescriptor superInterfaceProperty = isJLS2 ? TypeDeclaration . SUPER_INTERFACES_PROPERTY : TypeDeclaration . SUPER_INTERFACE_TYPES_PROPERTY ; RewriteEvent interfaceEvent = getEvent ( node , superInterfaceProperty ) ; if ( interfaceEvent == null || interfaceEvent . getChangeKind ( ) == RewriteEvent . UNCHANGED ) { if ( invertType ) { List originalNodes = ( List ) getOriginalValue ( node , superInterfaceProperty ) ; if ( ! originalNodes . isEmpty ( ) ) { String keyword = isInterface ? "<STR_LIT>" : "<STR_LIT>" ; ASTNode firstNode = ( ASTNode ) originalNodes . get ( <NUM_LIT:0> ) ; doTextReplace ( pos , firstNode . getStartPosition ( ) - pos , keyword , getEditGroup ( node , TypeDeclaration . INTERFACE_PROPERTY ) ) ; } } pos = doVisit ( node , superInterfaceProperty , pos ) ; } else { String keyword = ( isInterface == invertType ) ? "<STR_LIT>" : "<STR_LIT>" ; if ( invertType ) { List newNodes = ( List ) interfaceEvent . getNewValue ( ) ; if ( ! newNodes . isEmpty ( ) ) { List origNodes = ( List ) interfaceEvent . getOriginalValue ( ) ; int firstStart = pos ; if ( ! origNodes . isEmpty ( ) ) { firstStart = ( ( ASTNode ) origNodes . get ( <NUM_LIT:0> ) ) . getStartPosition ( ) ; } doTextReplace ( pos , firstStart - pos , keyword , getEditGroup ( node , TypeDeclaration . INTERFACE_PROPERTY ) ) ; keyword = Util . EMPTY_STRING ; pos = firstStart ; } } pos = rewriteNodeList ( node , superInterfaceProperty , pos , keyword , "<STR_LIT:U+002CU+0020>" ) ; } int startIndent = getIndent ( node . getStartPosition ( ) ) + <NUM_LIT:1> ; int startPos = getPosAfterLeftBrace ( pos ) ; rewriteParagraphList ( node , TypeDeclaration . BODY_DECLARATIONS_PROPERTY , startPos , startIndent , - <NUM_LIT:1> , <NUM_LIT:2> ) ; return false ; } private void rewriteReturnType ( MethodDeclaration node , boolean isConstructor , boolean isConstructorChange ) { ChildPropertyDescriptor property = ( node . getAST ( ) . apiLevel ( ) == JLS2_INTERNAL ) ? MethodDeclaration . RETURN_TYPE_PROPERTY : MethodDeclaration . RETURN_TYPE2_PROPERTY ; ASTNode originalReturnType = ( ASTNode ) getOriginalValue ( node , property ) ; boolean returnTypeExists = originalReturnType != null && originalReturnType . getStartPosition ( ) != - <NUM_LIT:1> ; if ( ! isConstructorChange && returnTypeExists ) { rewriteRequiredNode ( node , property ) ; ensureSpaceAfterReplace ( node , property ) ; return ; } ASTNode newReturnType = ( ASTNode ) getNewValue ( node , property ) ; if ( isConstructorChange || ! returnTypeExists && newReturnType != originalReturnType ) { ASTNode originalMethodName = ( ASTNode ) getOriginalValue ( node , MethodDeclaration . NAME_PROPERTY ) ; int nextStart = originalMethodName . getStartPosition ( ) ; TextEditGroup editGroup = getEditGroup ( node , property ) ; if ( isConstructor || ! returnTypeExists ) { doTextInsert ( nextStart , newReturnType , getIndent ( nextStart ) , true , editGroup ) ; doTextInsert ( nextStart , "<STR_LIT:U+0020>" , editGroup ) ; } else { int offset = getExtendedOffset ( originalReturnType ) ; doTextRemoveAndVisit ( offset , nextStart - offset , originalReturnType , editGroup ) ; } } } public boolean visit ( MethodDeclaration node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteJavadoc ( node , MethodDeclaration . JAVADOC_PROPERTY ) ; if ( node . getAST ( ) . apiLevel ( ) == JLS2_INTERNAL ) { rewriteModifiers ( node , MethodDeclaration . MODIFIERS_PROPERTY , pos ) ; } else { pos = rewriteModifiers2 ( node , MethodDeclaration . MODIFIERS2_PROPERTY , pos ) ; pos = rewriteOptionalTypeParameters ( node , MethodDeclaration . TYPE_PARAMETERS_PROPERTY , pos , "<STR_LIT:U+0020>" , true , pos != node . getStartPosition ( ) ) ; } boolean isConstructorChange = isChanged ( node , MethodDeclaration . CONSTRUCTOR_PROPERTY ) ; boolean isConstructor = ( ( Boolean ) getOriginalValue ( node , MethodDeclaration . CONSTRUCTOR_PROPERTY ) ) . booleanValue ( ) ; if ( ! isConstructor || isConstructorChange ) { rewriteReturnType ( node , isConstructor , isConstructorChange ) ; } pos = rewriteRequiredNode ( node , MethodDeclaration . NAME_PROPERTY ) ; try { if ( isChanged ( node , MethodDeclaration . PARAMETERS_PROPERTY ) ) { pos = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameLPAREN , pos ) ; pos = rewriteNodeList ( node , MethodDeclaration . PARAMETERS_PROPERTY , pos , Util . EMPTY_STRING , "<STR_LIT:U+002CU+0020>" ) ; } else { pos = doVisit ( node , MethodDeclaration . PARAMETERS_PROPERTY , pos ) ; } pos = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameRPAREN , pos ) ; int extraDims = rewriteExtraDimensions ( node , MethodDeclaration . EXTRA_DIMENSIONS_PROPERTY , pos ) ; boolean hasExceptionChanges = isChanged ( node , MethodDeclaration . THROWN_EXCEPTIONS_PROPERTY ) ; int bodyChangeKind = getChangeKind ( node , MethodDeclaration . BODY_PROPERTY ) ; if ( ( extraDims > <NUM_LIT:0> ) && ( hasExceptionChanges || bodyChangeKind == RewriteEvent . INSERTED || bodyChangeKind == RewriteEvent . REMOVED ) ) { int dim = ( ( Integer ) getOriginalValue ( node , MethodDeclaration . EXTRA_DIMENSIONS_PROPERTY ) ) . intValue ( ) ; while ( dim > <NUM_LIT:0> ) { pos = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameRBRACKET , pos ) ; dim -- ; } } pos = rewriteNodeList ( node , MethodDeclaration . THROWN_EXCEPTIONS_PROPERTY , pos , "<STR_LIT>" , "<STR_LIT:U+002CU+0020>" ) ; rewriteMethodBody ( node , pos ) ; } catch ( CoreException e ) { } return false ; } public boolean visit ( Block node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int startPos ; if ( isCollapsed ( node ) ) { startPos = node . getStartPosition ( ) ; } else { startPos = getPosAfterLeftBrace ( node . getStartPosition ( ) ) ; } int startIndent = getIndent ( node . getStartPosition ( ) ) + <NUM_LIT:1> ; rewriteParagraphList ( node , Block . STATEMENTS_PROPERTY , startPos , startIndent , <NUM_LIT:0> , <NUM_LIT:1> ) ; return false ; } public boolean visit ( ReturnStatement node ) { try { this . beforeRequiredSpaceIndex = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNamereturn , node . getStartPosition ( ) ) ; if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } ensureSpaceBeforeReplace ( node ) ; rewriteNode ( node , ReturnStatement . EXPRESSION_PROPERTY , this . beforeRequiredSpaceIndex , ASTRewriteFormatter . SPACE ) ; } catch ( CoreException e ) { handleException ( e ) ; } return false ; } public boolean visit ( AnonymousClassDeclaration node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int startPos = getPosAfterLeftBrace ( node . getStartPosition ( ) ) ; int startIndent = getIndent ( node . getStartPosition ( ) ) + <NUM_LIT:1> ; rewriteParagraphList ( node , AnonymousClassDeclaration . BODY_DECLARATIONS_PROPERTY , startPos , startIndent , - <NUM_LIT:1> , <NUM_LIT:2> ) ; return false ; } public boolean visit ( ArrayAccess node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , ArrayAccess . ARRAY_PROPERTY ) ; rewriteRequiredNode ( node , ArrayAccess . INDEX_PROPERTY ) ; return false ; } public boolean visit ( ArrayCreation node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } ArrayType arrayType = ( ArrayType ) getOriginalValue ( node , ArrayCreation . TYPE_PROPERTY ) ; int nOldBrackets = getDimensions ( arrayType ) ; int nNewBrackets = nOldBrackets ; TextEditGroup editGroup = null ; RewriteEvent typeEvent = getEvent ( node , ArrayCreation . TYPE_PROPERTY ) ; if ( typeEvent != null && typeEvent . getChangeKind ( ) == RewriteEvent . REPLACED ) { ArrayType replacingType = ( ArrayType ) typeEvent . getNewValue ( ) ; editGroup = getEditGroup ( typeEvent ) ; Type newType = replacingType . getElementType ( ) ; Type oldType = getElementType ( arrayType ) ; if ( ! newType . equals ( oldType ) ) { SourceRange range = getExtendedRange ( oldType ) ; int offset = range . getStartPosition ( ) ; int length = range . getLength ( ) ; doTextRemove ( offset , length , editGroup ) ; doTextInsert ( offset , newType , <NUM_LIT:0> , false , editGroup ) ; } nNewBrackets = replacingType . getDimensions ( ) ; } voidVisit ( arrayType ) ; try { int offset = getScanner ( ) . getTokenStartOffset ( TerminalTokens . TokenNameLBRACKET , arrayType . getStartPosition ( ) ) ; RewriteEvent dimEvent = getEvent ( node , ArrayCreation . DIMENSIONS_PROPERTY ) ; boolean hasDimensionChanges = ( dimEvent != null && dimEvent . getChangeKind ( ) != RewriteEvent . UNCHANGED ) ; if ( hasDimensionChanges ) { RewriteEvent [ ] events = dimEvent . getChildren ( ) ; for ( int i = <NUM_LIT:0> ; i < events . length ; i ++ ) { RewriteEvent event = events [ i ] ; int changeKind = event . getChangeKind ( ) ; if ( changeKind == RewriteEvent . INSERTED ) { editGroup = getEditGroup ( event ) ; doTextInsert ( offset , "<STR_LIT:[>" , editGroup ) ; doTextInsert ( offset , ( ASTNode ) event . getNewValue ( ) , <NUM_LIT:0> , false , editGroup ) ; doTextInsert ( offset , "<STR_LIT:]>" , editGroup ) ; nNewBrackets -- ; } else { ASTNode elem = ( ASTNode ) event . getOriginalValue ( ) ; int elemEnd = elem . getStartPosition ( ) + elem . getLength ( ) ; int endPos = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameRBRACKET , elemEnd ) ; if ( changeKind == RewriteEvent . REMOVED ) { editGroup = getEditGroup ( event ) ; doTextRemoveAndVisit ( offset , endPos - offset , elem , editGroup ) ; } else if ( changeKind == RewriteEvent . REPLACED ) { editGroup = getEditGroup ( event ) ; SourceRange range = getExtendedRange ( elem ) ; int elemOffset = range . getStartPosition ( ) ; int elemLength = range . getLength ( ) ; doTextRemoveAndVisit ( elemOffset , elemLength , elem , editGroup ) ; doTextInsert ( elemOffset , ( ASTNode ) event . getNewValue ( ) , <NUM_LIT:0> , false , editGroup ) ; nNewBrackets -- ; } else { voidVisit ( elem ) ; nNewBrackets -- ; } offset = endPos ; nOldBrackets -- ; } } } else { offset = doVisit ( node , ArrayCreation . DIMENSIONS_PROPERTY , offset ) ; } if ( nOldBrackets != nNewBrackets ) { if ( ! hasDimensionChanges ) { offset = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameRBRACKET , offset ) ; } rewriteExtraDimensions ( nOldBrackets , nNewBrackets , offset , editGroup ) ; } int kind = getChangeKind ( node , ArrayCreation . INITIALIZER_PROPERTY ) ; if ( kind == RewriteEvent . REMOVED ) { offset = getScanner ( ) . getPreviousTokenEndOffset ( TerminalTokens . TokenNameLBRACE , offset ) ; } else { offset = node . getStartPosition ( ) + node . getLength ( ) ; } rewriteNode ( node , ArrayCreation . INITIALIZER_PROPERTY , offset , ASTRewriteFormatter . SPACE ) ; } catch ( CoreException e ) { handleException ( e ) ; } return false ; } private Type getElementType ( ArrayType parent ) { Type t = ( Type ) getOriginalValue ( parent , ArrayType . COMPONENT_TYPE_PROPERTY ) ; while ( t . isArrayType ( ) ) { t = ( Type ) getOriginalValue ( t , ArrayType . COMPONENT_TYPE_PROPERTY ) ; } return t ; } private int getDimensions ( ArrayType parent ) { Type t = ( Type ) getOriginalValue ( parent , ArrayType . COMPONENT_TYPE_PROPERTY ) ; int dimensions = <NUM_LIT:1> ; while ( t . isArrayType ( ) ) { dimensions ++ ; t = ( Type ) getOriginalValue ( t , ArrayType . COMPONENT_TYPE_PROPERTY ) ; } return dimensions ; } public boolean visit ( ArrayInitializer node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int startPos = getPosAfterLeftBrace ( node . getStartPosition ( ) ) ; rewriteNodeList ( node , ArrayInitializer . EXPRESSIONS_PROPERTY , startPos , Util . EMPTY_STRING , "<STR_LIT:U+002CU+0020>" ) ; return false ; } public boolean visit ( ArrayType node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , ArrayType . COMPONENT_TYPE_PROPERTY ) ; return false ; } public boolean visit ( AssertStatement node ) { try { this . beforeRequiredSpaceIndex = getScanner ( ) . getNextEndOffset ( node . getStartPosition ( ) , true ) ; if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } ensureSpaceBeforeReplace ( node ) ; int offset = rewriteRequiredNode ( node , AssertStatement . EXPRESSION_PROPERTY ) ; rewriteNode ( node , AssertStatement . MESSAGE_PROPERTY , offset , ASTRewriteFormatter . ASSERT_COMMENT ) ; } catch ( CoreException e ) { handleException ( e ) ; } return false ; } public boolean visit ( Assignment node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteRequiredNode ( node , Assignment . LEFT_HAND_SIDE_PROPERTY ) ; rewriteOperation ( node , Assignment . OPERATOR_PROPERTY , pos ) ; rewriteRequiredNode ( node , Assignment . RIGHT_HAND_SIDE_PROPERTY ) ; return false ; } public boolean visit ( BooleanLiteral node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } Boolean newLiteral = ( Boolean ) getNewValue ( node , BooleanLiteral . BOOLEAN_VALUE_PROPERTY ) ; TextEditGroup group = getEditGroup ( node , BooleanLiteral . BOOLEAN_VALUE_PROPERTY ) ; doTextReplace ( node . getStartPosition ( ) , node . getLength ( ) , newLiteral . toString ( ) , group ) ; return false ; } public boolean visit ( BreakStatement node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } try { int offset = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNamebreak , node . getStartPosition ( ) ) ; rewriteNode ( node , BreakStatement . LABEL_PROPERTY , offset , ASTRewriteFormatter . SPACE ) ; } catch ( CoreException e ) { handleException ( e ) ; } return false ; } public boolean visit ( CastExpression node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , CastExpression . TYPE_PROPERTY ) ; rewriteRequiredNode ( node , CastExpression . EXPRESSION_PROPERTY ) ; return false ; } public boolean visit ( CatchClause node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , CatchClause . EXCEPTION_PROPERTY ) ; rewriteRequiredNode ( node , CatchClause . BODY_PROPERTY ) ; return false ; } public boolean visit ( CharacterLiteral node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } String escapedSeq = ( String ) getNewValue ( node , CharacterLiteral . ESCAPED_VALUE_PROPERTY ) ; TextEditGroup group = getEditGroup ( node , CharacterLiteral . ESCAPED_VALUE_PROPERTY ) ; doTextReplace ( node . getStartPosition ( ) , node . getLength ( ) , escapedSeq , group ) ; return false ; } public boolean visit ( ClassInstanceCreation node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteOptionalQualifier ( node , ClassInstanceCreation . EXPRESSION_PROPERTY , node . getStartPosition ( ) ) ; if ( node . getAST ( ) . apiLevel ( ) == JLS2_INTERNAL ) { pos = rewriteRequiredNode ( node , ClassInstanceCreation . NAME_PROPERTY ) ; } else { if ( isChanged ( node , ClassInstanceCreation . TYPE_ARGUMENTS_PROPERTY ) ) { try { pos = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNamenew , pos ) ; rewriteOptionalTypeParameters ( node , ClassInstanceCreation . TYPE_ARGUMENTS_PROPERTY , pos , "<STR_LIT:U+0020>" , true , true ) ; } catch ( CoreException e ) { handleException ( e ) ; } } else { voidVisit ( node , ClassInstanceCreation . TYPE_ARGUMENTS_PROPERTY ) ; } pos = rewriteRequiredNode ( node , ClassInstanceCreation . TYPE_PROPERTY ) ; } if ( isChanged ( node , ClassInstanceCreation . ARGUMENTS_PROPERTY ) ) { try { int startpos = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameLPAREN , pos ) ; rewriteNodeList ( node , ClassInstanceCreation . ARGUMENTS_PROPERTY , startpos , Util . EMPTY_STRING , "<STR_LIT:U+002CU+0020>" ) ; } catch ( CoreException e ) { handleException ( e ) ; } } else { voidVisit ( node , ClassInstanceCreation . ARGUMENTS_PROPERTY ) ; } int kind = getChangeKind ( node , ClassInstanceCreation . ANONYMOUS_CLASS_DECLARATION_PROPERTY ) ; if ( kind == RewriteEvent . REMOVED ) { try { pos = getScanner ( ) . getPreviousTokenEndOffset ( TerminalTokens . TokenNameLBRACE , pos ) ; } catch ( CoreException e ) { handleException ( e ) ; } } else { pos = node . getStartPosition ( ) + node . getLength ( ) ; } rewriteNode ( node , ClassInstanceCreation . ANONYMOUS_CLASS_DECLARATION_PROPERTY , pos , ASTRewriteFormatter . SPACE ) ; return false ; } public boolean visit ( ConditionalExpression node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , ConditionalExpression . EXPRESSION_PROPERTY ) ; rewriteRequiredNode ( node , ConditionalExpression . THEN_EXPRESSION_PROPERTY ) ; rewriteRequiredNode ( node , ConditionalExpression . ELSE_EXPRESSION_PROPERTY ) ; return false ; } public boolean visit ( ConstructorInvocation node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = node . getStartPosition ( ) ; if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { pos = rewriteOptionalTypeParameters ( node , ConstructorInvocation . TYPE_ARGUMENTS_PROPERTY , pos , Util . EMPTY_STRING , false , false ) ; } try { pos = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameLPAREN , pos ) ; rewriteNodeList ( node , ConstructorInvocation . ARGUMENTS_PROPERTY , pos , Util . EMPTY_STRING , "<STR_LIT:U+002CU+0020>" ) ; } catch ( CoreException e ) { handleException ( e ) ; } return false ; } public boolean visit ( ContinueStatement node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } try { int offset = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNamecontinue , node . getStartPosition ( ) ) ; rewriteNode ( node , ContinueStatement . LABEL_PROPERTY , offset , ASTRewriteFormatter . SPACE ) ; } catch ( CoreException e ) { handleException ( e ) ; } return false ; } public boolean visit ( DoStatement node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = node . getStartPosition ( ) ; try { RewriteEvent event = getEvent ( node , DoStatement . BODY_PROPERTY ) ; if ( event != null && event . getChangeKind ( ) == RewriteEvent . REPLACED ) { int startOffset = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNamedo , pos ) ; ASTNode body = ( ASTNode ) event . getOriginalValue ( ) ; int bodyEnd = body . getStartPosition ( ) + body . getLength ( ) ; int endPos = getScanner ( ) . getTokenStartOffset ( TerminalTokens . TokenNamewhile , bodyEnd ) ; rewriteBodyNode ( node , DoStatement . BODY_PROPERTY , startOffset , endPos , getIndent ( node . getStartPosition ( ) ) , this . formatter . DO_BLOCK ) ; } else { voidVisit ( node , DoStatement . BODY_PROPERTY ) ; } } catch ( CoreException e ) { handleException ( e ) ; } rewriteRequiredNode ( node , DoStatement . EXPRESSION_PROPERTY ) ; return false ; } public boolean visit ( EmptyStatement node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } changeNotSupported ( node ) ; return false ; } public boolean visit ( ExpressionStatement node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , ExpressionStatement . EXPRESSION_PROPERTY ) ; return false ; } public boolean visit ( FieldAccess node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , FieldAccess . EXPRESSION_PROPERTY ) ; rewriteRequiredNode ( node , FieldAccess . NAME_PROPERTY ) ; return false ; } public boolean visit ( FieldDeclaration node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteJavadoc ( node , FieldDeclaration . JAVADOC_PROPERTY ) ; if ( node . getAST ( ) . apiLevel ( ) == JLS2_INTERNAL ) { rewriteModifiers ( node , FieldDeclaration . MODIFIERS_PROPERTY , pos ) ; } else { rewriteModifiers2 ( node , FieldDeclaration . MODIFIERS2_PROPERTY , pos ) ; } pos = rewriteRequiredNode ( node , FieldDeclaration . TYPE_PROPERTY ) ; ensureSpaceAfterReplace ( node , FieldDeclaration . TYPE_PROPERTY ) ; rewriteNodeList ( node , FieldDeclaration . FRAGMENTS_PROPERTY , pos , Util . EMPTY_STRING , "<STR_LIT:U+002CU+0020>" ) ; return false ; } public boolean visit ( ForStatement node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } try { int pos = node . getStartPosition ( ) ; if ( isChanged ( node , ForStatement . INITIALIZERS_PROPERTY ) ) { int startOffset = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameLPAREN , pos ) ; pos = rewriteNodeList ( node , ForStatement . INITIALIZERS_PROPERTY , startOffset , Util . EMPTY_STRING , "<STR_LIT:U+002CU+0020>" ) ; } else { pos = doVisit ( node , ForStatement . INITIALIZERS_PROPERTY , pos ) ; } pos = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameSEMICOLON , pos ) ; pos = rewriteNode ( node , ForStatement . EXPRESSION_PROPERTY , pos , ASTRewriteFormatter . NONE ) ; if ( isChanged ( node , ForStatement . UPDATERS_PROPERTY ) ) { int startOffset = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameSEMICOLON , pos ) ; pos = rewriteNodeList ( node , ForStatement . UPDATERS_PROPERTY , startOffset , Util . EMPTY_STRING , "<STR_LIT:U+002CU+0020>" ) ; } else { pos = doVisit ( node , ForStatement . UPDATERS_PROPERTY , pos ) ; } RewriteEvent bodyEvent = getEvent ( node , ForStatement . BODY_PROPERTY ) ; if ( bodyEvent != null && bodyEvent . getChangeKind ( ) == RewriteEvent . REPLACED ) { int startOffset = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameRPAREN , pos ) ; rewriteBodyNode ( node , ForStatement . BODY_PROPERTY , startOffset , - <NUM_LIT:1> , getIndent ( node . getStartPosition ( ) ) , this . formatter . FOR_BLOCK ) ; } else { voidVisit ( node , ForStatement . BODY_PROPERTY ) ; } } catch ( CoreException e ) { handleException ( e ) ; } return false ; } public boolean visit ( IfStatement node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteRequiredNode ( node , IfStatement . EXPRESSION_PROPERTY ) ; RewriteEvent thenEvent = getEvent ( node , IfStatement . THEN_STATEMENT_PROPERTY ) ; int elseChange = getChangeKind ( node , IfStatement . ELSE_STATEMENT_PROPERTY ) ; if ( thenEvent != null && thenEvent . getChangeKind ( ) != RewriteEvent . UNCHANGED ) { try { int tok = getScanner ( ) . readNext ( pos , true ) ; pos = ( tok == TerminalTokens . TokenNameRPAREN ) ? getScanner ( ) . getCurrentEndOffset ( ) : getScanner ( ) . getCurrentStartOffset ( ) ; int indent = getIndent ( node . getStartPosition ( ) ) ; int endPos = - <NUM_LIT:1> ; Object elseStatement = getOriginalValue ( node , IfStatement . ELSE_STATEMENT_PROPERTY ) ; if ( elseStatement != null ) { ASTNode thenStatement = ( ASTNode ) thenEvent . getOriginalValue ( ) ; endPos = getScanner ( ) . getTokenStartOffset ( TerminalTokens . TokenNameelse , thenStatement . getStartPosition ( ) + thenStatement . getLength ( ) ) ; } if ( elseStatement == null || elseChange != RewriteEvent . UNCHANGED ) { pos = rewriteBodyNode ( node , IfStatement . THEN_STATEMENT_PROPERTY , pos , endPos , indent , this . formatter . IF_BLOCK_NO_ELSE ) ; } else { pos = rewriteBodyNode ( node , IfStatement . THEN_STATEMENT_PROPERTY , pos , endPos , indent , this . formatter . IF_BLOCK_WITH_ELSE ) ; } } catch ( CoreException e ) { handleException ( e ) ; } } else { pos = doVisit ( node , IfStatement . THEN_STATEMENT_PROPERTY , pos ) ; } if ( elseChange != RewriteEvent . UNCHANGED ) { int indent = getIndent ( node . getStartPosition ( ) ) ; Object newThen = getNewValue ( node , IfStatement . THEN_STATEMENT_PROPERTY ) ; if ( newThen instanceof Block ) { rewriteBodyNode ( node , IfStatement . ELSE_STATEMENT_PROPERTY , pos , - <NUM_LIT:1> , indent , this . formatter . ELSE_AFTER_BLOCK ) ; } else { rewriteBodyNode ( node , IfStatement . ELSE_STATEMENT_PROPERTY , pos , - <NUM_LIT:1> , indent , this . formatter . ELSE_AFTER_STATEMENT ) ; } } else { pos = doVisit ( node , IfStatement . ELSE_STATEMENT_PROPERTY , pos ) ; } return false ; } public boolean visit ( ImportDeclaration node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { RewriteEvent event = getEvent ( node , ImportDeclaration . STATIC_PROPERTY ) ; if ( event != null && event . getChangeKind ( ) != RewriteEvent . UNCHANGED ) { try { int pos = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameimport , node . getStartPosition ( ) ) ; boolean wasStatic = ( ( Boolean ) event . getOriginalValue ( ) ) . booleanValue ( ) ; if ( wasStatic ) { int endPos = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNamestatic , pos ) ; doTextRemove ( pos , endPos - pos , getEditGroup ( event ) ) ; } else { doTextInsert ( pos , "<STR_LIT>" , getEditGroup ( event ) ) ; } } catch ( CoreException e ) { handleException ( e ) ; } } } int pos = rewriteRequiredNode ( node , ImportDeclaration . NAME_PROPERTY ) ; RewriteEvent event = getEvent ( node , ImportDeclaration . ON_DEMAND_PROPERTY ) ; if ( event != null && event . getChangeKind ( ) != RewriteEvent . UNCHANGED ) { boolean isOnDemand = ( ( Boolean ) event . getOriginalValue ( ) ) . booleanValue ( ) ; if ( ! isOnDemand ) { doTextInsert ( pos , "<STR_LIT>" , getEditGroup ( event ) ) ; } else { try { int endPos = getScanner ( ) . getTokenStartOffset ( TerminalTokens . TokenNameSEMICOLON , pos ) ; doTextRemove ( pos , endPos - pos , getEditGroup ( event ) ) ; } catch ( CoreException e ) { handleException ( e ) ; } } } return false ; } public boolean visit ( InfixExpression node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteRequiredNode ( node , InfixExpression . LEFT_OPERAND_PROPERTY ) ; boolean needsNewOperation = isChanged ( node , InfixExpression . OPERATOR_PROPERTY ) ; String operation = getNewValue ( node , InfixExpression . OPERATOR_PROPERTY ) . toString ( ) ; if ( needsNewOperation ) { replaceOperation ( pos , operation , getEditGroup ( node , InfixExpression . OPERATOR_PROPERTY ) ) ; } pos = rewriteRequiredNode ( node , InfixExpression . RIGHT_OPERAND_PROPERTY ) ; RewriteEvent event = getEvent ( node , InfixExpression . EXTENDED_OPERANDS_PROPERTY ) ; String prefixString = '<CHAR_LIT:U+0020>' + operation + '<CHAR_LIT:U+0020>' ; if ( needsNewOperation ) { int startPos = pos ; TextEditGroup editGroup = getEditGroup ( node , InfixExpression . OPERATOR_PROPERTY ) ; if ( event != null && event . getChangeKind ( ) != RewriteEvent . UNCHANGED ) { RewriteEvent [ ] extendedOperands = event . getChildren ( ) ; for ( int i = <NUM_LIT:0> ; i < extendedOperands . length ; i ++ ) { RewriteEvent curr = extendedOperands [ i ] ; ASTNode elem = ( ASTNode ) curr . getOriginalValue ( ) ; if ( elem != null ) { if ( curr . getChangeKind ( ) != RewriteEvent . REPLACED ) { replaceOperation ( startPos , operation , editGroup ) ; } startPos = elem . getStartPosition ( ) + elem . getLength ( ) ; } } } else { List extendedOperands = ( List ) getOriginalValue ( node , InfixExpression . EXTENDED_OPERANDS_PROPERTY ) ; for ( int i = <NUM_LIT:0> ; i < extendedOperands . size ( ) ; i ++ ) { ASTNode elem = ( ASTNode ) extendedOperands . get ( i ) ; replaceOperation ( startPos , operation , editGroup ) ; startPos = elem . getStartPosition ( ) + elem . getLength ( ) ; } } } rewriteNodeList ( node , InfixExpression . EXTENDED_OPERANDS_PROPERTY , pos , prefixString , prefixString ) ; return false ; } public boolean visit ( Initializer node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteJavadoc ( node , Initializer . JAVADOC_PROPERTY ) ; if ( node . getAST ( ) . apiLevel ( ) == JLS2_INTERNAL ) { rewriteModifiers ( node , Initializer . MODIFIERS_PROPERTY , pos ) ; } else { rewriteModifiers2 ( node , Initializer . MODIFIERS2_PROPERTY , pos ) ; } rewriteRequiredNode ( node , Initializer . BODY_PROPERTY ) ; return false ; } public boolean visit ( InstanceofExpression node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , InstanceofExpression . LEFT_OPERAND_PROPERTY ) ; ensureSpaceAfterReplace ( node , InstanceofExpression . LEFT_OPERAND_PROPERTY ) ; rewriteRequiredNode ( node , InstanceofExpression . RIGHT_OPERAND_PROPERTY ) ; return false ; } public void ensureSpaceAfterReplace ( ASTNode node , ChildPropertyDescriptor desc ) { if ( getChangeKind ( node , desc ) == RewriteEvent . REPLACED ) { int leftOperandEnd = getExtendedEnd ( ( ASTNode ) getOriginalValue ( node , desc ) ) ; try { int offset = getScanner ( ) . getNextStartOffset ( leftOperandEnd , true ) ; if ( offset == leftOperandEnd ) { doTextInsert ( offset , String . valueOf ( '<CHAR_LIT:U+0020>' ) , getEditGroup ( node , desc ) ) ; } } catch ( CoreException e ) { handleException ( e ) ; } } } public void ensureSpaceBeforeReplace ( ASTNode node ) { if ( this . beforeRequiredSpaceIndex == - <NUM_LIT:1> ) return ; List events = this . eventStore . getChangedPropertieEvents ( node ) ; for ( Iterator iterator = events . iterator ( ) ; iterator . hasNext ( ) ; ) { RewriteEvent event = ( RewriteEvent ) iterator . next ( ) ; if ( event . getChangeKind ( ) == RewriteEvent . REPLACED && event . getOriginalValue ( ) instanceof ASTNode ) { if ( this . beforeRequiredSpaceIndex == getExtendedOffset ( ( ASTNode ) event . getOriginalValue ( ) ) ) { doTextInsert ( this . beforeRequiredSpaceIndex , String . valueOf ( '<CHAR_LIT:U+0020>' ) , getEditGroup ( event ) ) ; this . beforeRequiredSpaceIndex = - <NUM_LIT:1> ; return ; } } } if ( this . beforeRequiredSpaceIndex < getExtendedOffset ( node ) ) { this . beforeRequiredSpaceIndex = - <NUM_LIT:1> ; } } public boolean visit ( Javadoc node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int startPos = node . getStartPosition ( ) + <NUM_LIT:3> ; String separator = getLineDelimiter ( ) + getIndentAtOffset ( node . getStartPosition ( ) ) + "<STR_LIT>" ; rewriteNodeList ( node , Javadoc . TAGS_PROPERTY , startPos , separator , separator ) ; return false ; } public boolean visit ( LabeledStatement node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , LabeledStatement . LABEL_PROPERTY ) ; rewriteRequiredNode ( node , LabeledStatement . BODY_PROPERTY ) ; return false ; } public boolean visit ( MethodInvocation node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteOptionalQualifier ( node , MethodInvocation . EXPRESSION_PROPERTY , node . getStartPosition ( ) ) ; if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { pos = rewriteOptionalTypeParameters ( node , MethodInvocation . TYPE_ARGUMENTS_PROPERTY , pos , Util . EMPTY_STRING , false , false ) ; } pos = rewriteRequiredNode ( node , MethodInvocation . NAME_PROPERTY ) ; if ( isChanged ( node , MethodInvocation . ARGUMENTS_PROPERTY ) ) { try { int startOffset = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameLPAREN , pos ) ; rewriteNodeList ( node , MethodInvocation . ARGUMENTS_PROPERTY , startOffset , Util . EMPTY_STRING , "<STR_LIT:U+002CU+0020>" ) ; } catch ( CoreException e ) { handleException ( e ) ; } } else { voidVisit ( node , MethodInvocation . ARGUMENTS_PROPERTY ) ; } return false ; } public boolean visit ( NullLiteral node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } changeNotSupported ( node ) ; return false ; } public boolean visit ( NumberLiteral node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } String newLiteral = ( String ) getNewValue ( node , NumberLiteral . TOKEN_PROPERTY ) ; TextEditGroup group = getEditGroup ( node , NumberLiteral . TOKEN_PROPERTY ) ; doTextReplace ( node . getStartPosition ( ) , node . getLength ( ) , newLiteral , group ) ; return false ; } public boolean visit ( PackageDeclaration node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { int pos = rewriteJavadoc ( node , PackageDeclaration . JAVADOC_PROPERTY ) ; rewriteModifiers2 ( node , PackageDeclaration . ANNOTATIONS_PROPERTY , pos ) ; } rewriteRequiredNode ( node , PackageDeclaration . NAME_PROPERTY ) ; return false ; } public boolean visit ( ParenthesizedExpression node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , ParenthesizedExpression . EXPRESSION_PROPERTY ) ; return false ; } public boolean visit ( PostfixExpression node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteRequiredNode ( node , PostfixExpression . OPERAND_PROPERTY ) ; rewriteOperation ( node , PostfixExpression . OPERATOR_PROPERTY , pos ) ; return false ; } public boolean visit ( PrefixExpression node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteOperation ( node , PrefixExpression . OPERATOR_PROPERTY , node . getStartPosition ( ) ) ; rewriteRequiredNode ( node , PrefixExpression . OPERAND_PROPERTY ) ; return false ; } public boolean visit ( PrimitiveType node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } PrimitiveType . Code newCode = ( PrimitiveType . Code ) getNewValue ( node , PrimitiveType . PRIMITIVE_TYPE_CODE_PROPERTY ) ; TextEditGroup group = getEditGroup ( node , PrimitiveType . PRIMITIVE_TYPE_CODE_PROPERTY ) ; doTextReplace ( node . getStartPosition ( ) , node . getLength ( ) , newCode . toString ( ) , group ) ; return false ; } public boolean visit ( QualifiedName node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , QualifiedName . QUALIFIER_PROPERTY ) ; rewriteRequiredNode ( node , QualifiedName . NAME_PROPERTY ) ; return false ; } public boolean visit ( SimpleName node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } String newString = ( String ) getNewValue ( node , SimpleName . IDENTIFIER_PROPERTY ) ; TextEditGroup group = getEditGroup ( node , SimpleName . IDENTIFIER_PROPERTY ) ; doTextReplace ( node . getStartPosition ( ) , node . getLength ( ) , newString , group ) ; return false ; } public boolean visit ( SimpleType node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , SimpleType . NAME_PROPERTY ) ; return false ; } public boolean visit ( SingleVariableDeclaration node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = node . getStartPosition ( ) ; if ( node . getAST ( ) . apiLevel ( ) == JLS2_INTERNAL ) { rewriteModifiers ( node , SingleVariableDeclaration . MODIFIERS_PROPERTY , pos ) ; } else { rewriteModifiers2 ( node , SingleVariableDeclaration . MODIFIERS2_PROPERTY , pos ) ; } pos = rewriteRequiredNode ( node , SingleVariableDeclaration . TYPE_PROPERTY ) ; if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { if ( isChanged ( node , SingleVariableDeclaration . VARARGS_PROPERTY ) ) { if ( getNewValue ( node , SingleVariableDeclaration . VARARGS_PROPERTY ) . equals ( Boolean . TRUE ) ) { doTextInsert ( pos , "<STR_LIT:...>" , getEditGroup ( node , SingleVariableDeclaration . VARARGS_PROPERTY ) ) ; } else { try { int ellipsisEnd = getScanner ( ) . getNextEndOffset ( pos , true ) ; doTextRemove ( pos , ellipsisEnd - pos , getEditGroup ( node , SingleVariableDeclaration . VARARGS_PROPERTY ) ) ; } catch ( CoreException e ) { handleException ( e ) ; } } } if ( ! node . isVarargs ( ) ) { ensureSpaceAfterReplace ( node , SingleVariableDeclaration . TYPE_PROPERTY ) ; } } else { ensureSpaceAfterReplace ( node , SingleVariableDeclaration . TYPE_PROPERTY ) ; } pos = rewriteRequiredNode ( node , SingleVariableDeclaration . NAME_PROPERTY ) ; int extraDims = rewriteExtraDimensions ( node , SingleVariableDeclaration . EXTRA_DIMENSIONS_PROPERTY , pos ) ; if ( extraDims > <NUM_LIT:0> ) { int kind = getChangeKind ( node , SingleVariableDeclaration . INITIALIZER_PROPERTY ) ; if ( kind == RewriteEvent . REMOVED ) { try { pos = getScanner ( ) . getPreviousTokenEndOffset ( TerminalTokens . TokenNameEQUAL , pos ) ; } catch ( CoreException e ) { handleException ( e ) ; } } else { pos = node . getStartPosition ( ) + node . getLength ( ) ; } } rewriteNode ( node , SingleVariableDeclaration . INITIALIZER_PROPERTY , pos , this . formatter . VAR_INITIALIZER ) ; return false ; } public boolean visit ( StringLiteral node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } String escapedSeq = ( String ) getNewValue ( node , StringLiteral . ESCAPED_VALUE_PROPERTY ) ; TextEditGroup group = getEditGroup ( node , StringLiteral . ESCAPED_VALUE_PROPERTY ) ; doTextReplace ( node . getStartPosition ( ) , node . getLength ( ) , escapedSeq , group ) ; return false ; } public boolean visit ( SuperConstructorInvocation node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteOptionalQualifier ( node , SuperConstructorInvocation . EXPRESSION_PROPERTY , node . getStartPosition ( ) ) ; if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { pos = rewriteOptionalTypeParameters ( node , SuperConstructorInvocation . TYPE_ARGUMENTS_PROPERTY , pos , Util . EMPTY_STRING , false , false ) ; } if ( isChanged ( node , SuperConstructorInvocation . ARGUMENTS_PROPERTY ) ) { try { pos = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameLPAREN , pos ) ; rewriteNodeList ( node , SuperConstructorInvocation . ARGUMENTS_PROPERTY , pos , Util . EMPTY_STRING , "<STR_LIT:U+002CU+0020>" ) ; } catch ( CoreException e ) { handleException ( e ) ; } } else { voidVisit ( node , SuperConstructorInvocation . ARGUMENTS_PROPERTY ) ; } return false ; } public boolean visit ( SuperFieldAccess node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteOptionalQualifier ( node , SuperFieldAccess . QUALIFIER_PROPERTY , node . getStartPosition ( ) ) ; rewriteRequiredNode ( node , SuperFieldAccess . NAME_PROPERTY ) ; return false ; } public boolean visit ( SuperMethodInvocation node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteOptionalQualifier ( node , SuperMethodInvocation . QUALIFIER_PROPERTY , node . getStartPosition ( ) ) ; if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { if ( isChanged ( node , SuperMethodInvocation . TYPE_ARGUMENTS_PROPERTY ) ) { try { pos = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameDOT , pos ) ; rewriteOptionalTypeParameters ( node , SuperMethodInvocation . TYPE_ARGUMENTS_PROPERTY , pos , Util . EMPTY_STRING , false , false ) ; } catch ( CoreException e ) { handleException ( e ) ; } } } pos = rewriteRequiredNode ( node , SuperMethodInvocation . NAME_PROPERTY ) ; if ( isChanged ( node , SuperMethodInvocation . ARGUMENTS_PROPERTY ) ) { try { pos = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameLPAREN , pos ) ; rewriteNodeList ( node , SuperMethodInvocation . ARGUMENTS_PROPERTY , pos , Util . EMPTY_STRING , "<STR_LIT:U+002CU+0020>" ) ; } catch ( CoreException e ) { handleException ( e ) ; } } else { voidVisit ( node , SuperMethodInvocation . ARGUMENTS_PROPERTY ) ; } return false ; } public boolean visit ( SwitchCase node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , SwitchCase . EXPRESSION_PROPERTY ) ; return false ; } class SwitchListRewriter extends ParagraphListRewriter { private boolean indentSwitchStatementsCompareToCases ; public SwitchListRewriter ( int initialIndent ) { super ( initialIndent , <NUM_LIT:0> ) ; this . indentSwitchStatementsCompareToCases = DefaultCodeFormatterConstants . TRUE . equals ( ASTRewriteAnalyzer . this . options . get ( DefaultCodeFormatterConstants . FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES ) ) ; } protected int getNodeIndent ( int nodeIndex ) { int indent = getInitialIndent ( ) ; if ( this . indentSwitchStatementsCompareToCases ) { RewriteEvent event = this . list [ nodeIndex ] ; int changeKind = event . getChangeKind ( ) ; ASTNode node ; if ( changeKind == RewriteEvent . INSERTED || changeKind == RewriteEvent . REPLACED ) { node = ( ASTNode ) event . getNewValue ( ) ; } else { node = ( ASTNode ) event . getOriginalValue ( ) ; } if ( node . getNodeType ( ) != ASTNode . SWITCH_CASE ) { indent ++ ; } } return indent ; } protected String getSeparatorString ( int nodeIndex ) { int total = this . list . length ; int nextNodeIndex = nodeIndex + <NUM_LIT:1> ; while ( nextNodeIndex < total && this . list [ nextNodeIndex ] . getChangeKind ( ) == RewriteEvent . REMOVED ) { nextNodeIndex ++ ; } if ( nextNodeIndex == total ) { return super . getSeparatorString ( nodeIndex ) ; } return getSeparatorString ( nodeIndex , nextNodeIndex ) ; } protected void updateIndent ( int prevMark , int originalOffset , int nodeIndex , TextEditGroup editGroup ) { if ( prevMark != RewriteEvent . UNCHANGED && prevMark != RewriteEvent . REPLACED ) return ; int previousNonRemovedNodeIndex = nodeIndex - <NUM_LIT:1> ; while ( previousNonRemovedNodeIndex >= <NUM_LIT:0> && this . list [ previousNonRemovedNodeIndex ] . getChangeKind ( ) == RewriteEvent . REMOVED ) { previousNonRemovedNodeIndex -- ; } if ( previousNonRemovedNodeIndex > - <NUM_LIT:1> ) { LineInformation lineInformation = getLineInformation ( ) ; RewriteEvent prevEvent = this . list [ previousNonRemovedNodeIndex ] ; int prevKind = prevEvent . getChangeKind ( ) ; if ( prevKind == RewriteEvent . UNCHANGED || prevKind == RewriteEvent . REPLACED ) { ASTNode prevNode = ( ASTNode ) this . list [ previousNonRemovedNodeIndex ] . getOriginalValue ( ) ; int prevEndPosition = prevNode . getStartPosition ( ) + prevNode . getLength ( ) ; int prevLine = lineInformation . getLineOfOffset ( prevEndPosition ) ; int line = lineInformation . getLineOfOffset ( originalOffset ) ; if ( prevLine == line ) { return ; } } } int total = this . list . length ; while ( nodeIndex < total && this . list [ nodeIndex ] . getChangeKind ( ) == RewriteEvent . REMOVED ) { nodeIndex ++ ; } int originalIndent = getIndent ( originalOffset ) ; int newIndent = getNodeIndent ( nodeIndex ) ; if ( originalIndent != newIndent ) { int line = getLineInformation ( ) . getLineOfOffset ( originalOffset ) ; if ( line >= <NUM_LIT:0> ) { int lineStart = getLineInformation ( ) . getLineOffset ( line ) ; doTextRemove ( lineStart , originalOffset - lineStart , editGroup ) ; doTextInsert ( lineStart , createIndentString ( newIndent ) , editGroup ) ; } } } } public boolean visit ( SwitchStatement node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteRequiredNode ( node , SwitchStatement . EXPRESSION_PROPERTY ) ; ChildListPropertyDescriptor property = SwitchStatement . STATEMENTS_PROPERTY ; if ( getChangeKind ( node , property ) != RewriteEvent . UNCHANGED ) { try { pos = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameLBRACE , pos ) ; int insertIndent = getIndent ( node . getStartPosition ( ) ) ; if ( DefaultCodeFormatterConstants . TRUE . equals ( this . options . get ( DefaultCodeFormatterConstants . FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH ) ) ) { insertIndent ++ ; } ParagraphListRewriter listRewriter = new SwitchListRewriter ( insertIndent ) ; StringBuffer leadString = new StringBuffer ( ) ; leadString . append ( getLineDelimiter ( ) ) ; leadString . append ( createIndentString ( insertIndent ) ) ; listRewriter . rewriteList ( node , property , pos , leadString . toString ( ) ) ; } catch ( CoreException e ) { handleException ( e ) ; } } else { voidVisit ( node , SwitchStatement . STATEMENTS_PROPERTY ) ; } return false ; } public boolean visit ( SynchronizedStatement node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , SynchronizedStatement . EXPRESSION_PROPERTY ) ; rewriteRequiredNode ( node , SynchronizedStatement . BODY_PROPERTY ) ; return false ; } public boolean visit ( ThisExpression node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteOptionalQualifier ( node , ThisExpression . QUALIFIER_PROPERTY , node . getStartPosition ( ) ) ; return false ; } public boolean visit ( ThrowStatement node ) { try { this . beforeRequiredSpaceIndex = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNamethrow , node . getStartPosition ( ) ) ; if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } ensureSpaceBeforeReplace ( node ) ; rewriteRequiredNode ( node , ThrowStatement . EXPRESSION_PROPERTY ) ; } catch ( CoreException e ) { handleException ( e ) ; } return false ; } public boolean visit ( TryStatement node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = node . getStartPosition ( ) ; if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS4 ) { if ( isChanged ( node , TryStatement . RESOURCES_PROPERTY ) ) { int indent = getIndent ( node . getStartPosition ( ) ) ; String prefix = this . formatter . TRY_RESOURCES . getPrefix ( indent ) ; String newParen = this . formatter . TRY_RESOURCES_PAREN . getPrefix ( indent ) + "<STR_LIT:(>" ; pos = rewriteNodeList ( node , TryStatement . RESOURCES_PROPERTY , getPosAfterTry ( pos ) , newParen , "<STR_LIT:)>" , "<STR_LIT:;>" + prefix ) ; } else { pos = doVisit ( node , TryStatement . RESOURCES_PROPERTY , pos ) ; } } pos = rewriteRequiredNode ( node , TryStatement . BODY_PROPERTY ) ; if ( isChanged ( node , TryStatement . CATCH_CLAUSES_PROPERTY ) ) { int indent = getIndent ( node . getStartPosition ( ) ) ; String prefix = this . formatter . CATCH_BLOCK . getPrefix ( indent ) ; pos = rewriteNodeList ( node , TryStatement . CATCH_CLAUSES_PROPERTY , pos , prefix , prefix ) ; } else { pos = doVisit ( node , TryStatement . CATCH_CLAUSES_PROPERTY , pos ) ; } rewriteNode ( node , TryStatement . FINALLY_PROPERTY , pos , this . formatter . FINALLY_BLOCK ) ; return false ; } public boolean visit ( TypeDeclarationStatement node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } if ( node . getAST ( ) . apiLevel ( ) == JLS2_INTERNAL ) { rewriteRequiredNode ( node , TypeDeclarationStatement . TYPE_DECLARATION_PROPERTY ) ; } else { rewriteRequiredNode ( node , TypeDeclarationStatement . DECLARATION_PROPERTY ) ; } return false ; } public boolean visit ( TypeLiteral node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , TypeLiteral . TYPE_PROPERTY ) ; return false ; } public boolean visit ( UnionType node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = node . getStartPosition ( ) ; if ( isChanged ( node , UnionType . TYPES_PROPERTY ) ) { pos = rewriteNodeList ( node , UnionType . TYPES_PROPERTY , pos , Util . EMPTY_STRING , "<STR_LIT>" ) ; } else { pos = doVisit ( node , UnionType . TYPES_PROPERTY , pos ) ; } return false ; } public boolean visit ( VariableDeclarationExpression node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = node . getStartPosition ( ) ; if ( node . getAST ( ) . apiLevel ( ) == JLS2_INTERNAL ) { rewriteModifiers ( node , VariableDeclarationExpression . MODIFIERS_PROPERTY , pos ) ; } else { rewriteModifiers2 ( node , VariableDeclarationExpression . MODIFIERS2_PROPERTY , pos ) ; } pos = rewriteRequiredNode ( node , VariableDeclarationExpression . TYPE_PROPERTY ) ; rewriteNodeList ( node , VariableDeclarationExpression . FRAGMENTS_PROPERTY , pos , Util . EMPTY_STRING , "<STR_LIT:U+002CU+0020>" ) ; return false ; } public boolean visit ( VariableDeclarationFragment node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteRequiredNode ( node , VariableDeclarationFragment . NAME_PROPERTY ) ; int extraDims = rewriteExtraDimensions ( node , VariableDeclarationFragment . EXTRA_DIMENSIONS_PROPERTY , pos ) ; if ( extraDims > <NUM_LIT:0> ) { int kind = getChangeKind ( node , VariableDeclarationFragment . INITIALIZER_PROPERTY ) ; if ( kind == RewriteEvent . REMOVED ) { try { pos = getScanner ( ) . getPreviousTokenEndOffset ( TerminalTokens . TokenNameEQUAL , pos ) ; } catch ( CoreException e ) { handleException ( e ) ; } } else { pos = node . getStartPosition ( ) + node . getLength ( ) ; } } rewriteNode ( node , VariableDeclarationFragment . INITIALIZER_PROPERTY , pos , this . formatter . VAR_INITIALIZER ) ; return false ; } public boolean visit ( VariableDeclarationStatement node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = node . getStartPosition ( ) ; if ( node . getAST ( ) . apiLevel ( ) == JLS2_INTERNAL ) { rewriteModifiers ( node , VariableDeclarationStatement . MODIFIERS_PROPERTY , pos ) ; } else { rewriteModifiers2 ( node , VariableDeclarationStatement . MODIFIERS2_PROPERTY , pos ) ; } pos = rewriteRequiredNode ( node , VariableDeclarationStatement . TYPE_PROPERTY ) ; rewriteNodeList ( node , VariableDeclarationStatement . FRAGMENTS_PROPERTY , pos , Util . EMPTY_STRING , "<STR_LIT:U+002CU+0020>" ) ; return false ; } public boolean visit ( WhileStatement node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteRequiredNode ( node , WhileStatement . EXPRESSION_PROPERTY ) ; try { if ( isChanged ( node , WhileStatement . BODY_PROPERTY ) ) { int startOffset = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameRPAREN , pos ) ; rewriteBodyNode ( node , WhileStatement . BODY_PROPERTY , startOffset , - <NUM_LIT:1> , getIndent ( node . getStartPosition ( ) ) , this . formatter . WHILE_BLOCK ) ; } else { voidVisit ( node , WhileStatement . BODY_PROPERTY ) ; } } catch ( CoreException e ) { handleException ( e ) ; } return false ; } public boolean visit ( MemberRef node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteNode ( node , MemberRef . QUALIFIER_PROPERTY , node . getStartPosition ( ) , ASTRewriteFormatter . NONE ) ; rewriteRequiredNode ( node , MemberRef . NAME_PROPERTY ) ; return false ; } public boolean visit ( MethodRef node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteNode ( node , MethodRef . QUALIFIER_PROPERTY , node . getStartPosition ( ) , ASTRewriteFormatter . NONE ) ; int pos = rewriteRequiredNode ( node , MethodRef . NAME_PROPERTY ) ; if ( isChanged ( node , MethodRef . PARAMETERS_PROPERTY ) ) { try { int startOffset = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameLPAREN , pos ) ; rewriteNodeList ( node , MethodRef . PARAMETERS_PROPERTY , startOffset , Util . EMPTY_STRING , "<STR_LIT:U+002CU+0020>" ) ; } catch ( CoreException e ) { handleException ( e ) ; } } else { voidVisit ( node , MethodRef . PARAMETERS_PROPERTY ) ; } return false ; } public boolean visit ( MethodRefParameter node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteRequiredNode ( node , MethodRefParameter . TYPE_PROPERTY ) ; if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { if ( isChanged ( node , MethodRefParameter . VARARGS_PROPERTY ) ) { if ( getNewValue ( node , MethodRefParameter . VARARGS_PROPERTY ) . equals ( Boolean . TRUE ) ) { doTextInsert ( pos , "<STR_LIT:...>" , getEditGroup ( node , MethodRefParameter . VARARGS_PROPERTY ) ) ; } else { try { int ellipsisEnd = getScanner ( ) . getNextEndOffset ( pos , true ) ; doTextRemove ( pos , ellipsisEnd - pos , getEditGroup ( node , MethodRefParameter . VARARGS_PROPERTY ) ) ; } catch ( CoreException e ) { handleException ( e ) ; } } } } rewriteNode ( node , MethodRefParameter . NAME_PROPERTY , pos , ASTRewriteFormatter . SPACE ) ; return false ; } public boolean visit ( TagElement node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int changeKind = getChangeKind ( node , TagElement . TAG_NAME_PROPERTY ) ; switch ( changeKind ) { case RewriteEvent . INSERTED : { String newTagName = ( String ) getNewValue ( node , TagElement . TAG_NAME_PROPERTY ) ; doTextInsert ( node . getStartPosition ( ) , newTagName , getEditGroup ( node , TagElement . TAG_NAME_PROPERTY ) ) ; break ; } case RewriteEvent . REMOVED : { doTextRemove ( node . getStartPosition ( ) , findTagNameEnd ( node ) - node . getStartPosition ( ) , getEditGroup ( node , TagElement . TAG_NAME_PROPERTY ) ) ; break ; } case RewriteEvent . REPLACED : { String newTagName = ( String ) getNewValue ( node , TagElement . TAG_NAME_PROPERTY ) ; doTextReplace ( node . getStartPosition ( ) , findTagNameEnd ( node ) - node . getStartPosition ( ) , newTagName , getEditGroup ( node , TagElement . TAG_NAME_PROPERTY ) ) ; break ; } } if ( isChanged ( node , TagElement . FRAGMENTS_PROPERTY ) ) { int endOffset = findTagNameEnd ( node ) ; rewriteNodeList ( node , TagElement . FRAGMENTS_PROPERTY , endOffset , "<STR_LIT:U+0020>" , "<STR_LIT:U+0020>" ) ; } else { voidVisit ( node , TagElement . FRAGMENTS_PROPERTY ) ; } return false ; } private int findTagNameEnd ( TagElement tagNode ) { if ( tagNode . getTagName ( ) != null ) { char [ ] cont = getContent ( ) ; int len = cont . length ; int i = tagNode . getStartPosition ( ) ; while ( i < len && ! IndentManipulation . isIndentChar ( cont [ i ] ) ) { i ++ ; } return i ; } return tagNode . getStartPosition ( ) ; } public boolean visit ( TextElement node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } String newText = ( String ) getNewValue ( node , TextElement . TEXT_PROPERTY ) ; TextEditGroup group = getEditGroup ( node , TextElement . TEXT_PROPERTY ) ; doTextReplace ( node . getStartPosition ( ) , node . getLength ( ) , newText , group ) ; return false ; } public boolean visit ( AnnotationTypeDeclaration node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteJavadoc ( node , AnnotationTypeDeclaration . JAVADOC_PROPERTY ) ; rewriteModifiers2 ( node , AnnotationTypeDeclaration . MODIFIERS2_PROPERTY , pos ) ; pos = rewriteRequiredNode ( node , AnnotationTypeDeclaration . NAME_PROPERTY ) ; int startIndent = getIndent ( node . getStartPosition ( ) ) + <NUM_LIT:1> ; int startPos = getPosAfterLeftBrace ( pos ) ; rewriteParagraphList ( node , AnnotationTypeDeclaration . BODY_DECLARATIONS_PROPERTY , startPos , startIndent , - <NUM_LIT:1> , <NUM_LIT:2> ) ; return false ; } public boolean visit ( AnnotationTypeMemberDeclaration node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteJavadoc ( node , AnnotationTypeMemberDeclaration . JAVADOC_PROPERTY ) ; rewriteModifiers2 ( node , AnnotationTypeMemberDeclaration . MODIFIERS2_PROPERTY , pos ) ; rewriteRequiredNode ( node , AnnotationTypeMemberDeclaration . TYPE_PROPERTY ) ; pos = rewriteRequiredNode ( node , AnnotationTypeMemberDeclaration . NAME_PROPERTY ) ; try { int changeKind = getChangeKind ( node , AnnotationTypeMemberDeclaration . DEFAULT_PROPERTY ) ; if ( changeKind == RewriteEvent . INSERTED || changeKind == RewriteEvent . REMOVED ) { pos = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameRPAREN , pos ) ; } rewriteNode ( node , AnnotationTypeMemberDeclaration . DEFAULT_PROPERTY , pos , this . formatter . ANNOT_MEMBER_DEFAULT ) ; } catch ( CoreException e ) { handleException ( e ) ; } return false ; } public boolean visit ( EnhancedForStatement node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , EnhancedForStatement . PARAMETER_PROPERTY ) ; int pos = rewriteRequiredNode ( node , EnhancedForStatement . EXPRESSION_PROPERTY ) ; RewriteEvent bodyEvent = getEvent ( node , EnhancedForStatement . BODY_PROPERTY ) ; if ( bodyEvent != null && bodyEvent . getChangeKind ( ) == RewriteEvent . REPLACED ) { int startOffset ; try { startOffset = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameRPAREN , pos ) ; rewriteBodyNode ( node , EnhancedForStatement . BODY_PROPERTY , startOffset , - <NUM_LIT:1> , getIndent ( node . getStartPosition ( ) ) , this . formatter . FOR_BLOCK ) ; } catch ( CoreException e ) { handleException ( e ) ; } } else { voidVisit ( node , EnhancedForStatement . BODY_PROPERTY ) ; } return false ; } public boolean visit ( EnumConstantDeclaration node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteJavadoc ( node , EnumConstantDeclaration . JAVADOC_PROPERTY ) ; rewriteModifiers2 ( node , EnumConstantDeclaration . MODIFIERS2_PROPERTY , pos ) ; pos = rewriteRequiredNode ( node , EnumConstantDeclaration . NAME_PROPERTY ) ; RewriteEvent argsEvent = getEvent ( node , EnumConstantDeclaration . ARGUMENTS_PROPERTY ) ; if ( argsEvent != null && argsEvent . getChangeKind ( ) != RewriteEvent . UNCHANGED ) { RewriteEvent [ ] children = argsEvent . getChildren ( ) ; try { int nextTok = getScanner ( ) . readNext ( pos , true ) ; boolean hasParents = ( nextTok == TerminalTokens . TokenNameLPAREN ) ; boolean isAllRemoved = hasParents && isAllOfKind ( children , RewriteEvent . REMOVED ) ; String prefix = Util . EMPTY_STRING ; if ( ! hasParents ) { prefix = "<STR_LIT:(>" ; } else if ( ! isAllRemoved ) { pos = getScanner ( ) . getCurrentEndOffset ( ) ; } pos = rewriteNodeList ( node , EnumConstantDeclaration . ARGUMENTS_PROPERTY , pos , prefix , "<STR_LIT:U+002CU+0020>" ) ; if ( ! hasParents ) { doTextInsert ( pos , "<STR_LIT:)>" , getEditGroup ( children [ children . length - <NUM_LIT:1> ] ) ) ; } else if ( isAllRemoved ) { int afterClosing = getScanner ( ) . getNextEndOffset ( pos , true ) ; doTextRemove ( pos , afterClosing - pos , getEditGroup ( children [ children . length - <NUM_LIT:1> ] ) ) ; pos = afterClosing ; } } catch ( CoreException e ) { handleException ( e ) ; } } else { pos = doVisit ( node , EnumConstantDeclaration . ARGUMENTS_PROPERTY , pos ) ; } if ( isChanged ( node , EnumConstantDeclaration . ANONYMOUS_CLASS_DECLARATION_PROPERTY ) ) { int kind = getChangeKind ( node , EnumConstantDeclaration . ANONYMOUS_CLASS_DECLARATION_PROPERTY ) ; if ( kind == RewriteEvent . REMOVED ) { try { pos = getScanner ( ) . getPreviousTokenEndOffset ( TerminalTokens . TokenNameLBRACE , pos ) ; } catch ( CoreException e ) { handleException ( e ) ; } } else { pos = node . getStartPosition ( ) + node . getLength ( ) ; } rewriteNode ( node , EnumConstantDeclaration . ANONYMOUS_CLASS_DECLARATION_PROPERTY , pos , ASTRewriteFormatter . SPACE ) ; } return false ; } public boolean visit ( EnumDeclaration node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteJavadoc ( node , EnumDeclaration . JAVADOC_PROPERTY ) ; rewriteModifiers2 ( node , EnumDeclaration . MODIFIERS2_PROPERTY , pos ) ; pos = rewriteRequiredNode ( node , EnumDeclaration . NAME_PROPERTY ) ; pos = rewriteNodeList ( node , EnumDeclaration . SUPER_INTERFACE_TYPES_PROPERTY , pos , "<STR_LIT>" , "<STR_LIT:U+002CU+0020>" ) ; pos = getPosAfterLeftBrace ( pos ) ; String leadString = Util . EMPTY_STRING ; RewriteEvent constEvent = getEvent ( node , EnumDeclaration . ENUM_CONSTANTS_PROPERTY ) ; if ( constEvent != null && constEvent . getChangeKind ( ) != RewriteEvent . UNCHANGED ) { RewriteEvent [ ] events = constEvent . getChildren ( ) ; if ( isAllOfKind ( events , RewriteEvent . INSERTED ) ) { leadString = this . formatter . FIRST_ENUM_CONST . getPrefix ( getIndent ( node . getStartPosition ( ) ) ) ; } } pos = rewriteNodeList ( node , EnumDeclaration . ENUM_CONSTANTS_PROPERTY , pos , leadString , "<STR_LIT:U+002CU+0020>" ) ; RewriteEvent bodyEvent = getEvent ( node , EnumDeclaration . BODY_DECLARATIONS_PROPERTY ) ; int indent = <NUM_LIT:0> ; if ( bodyEvent != null && bodyEvent . getChangeKind ( ) != RewriteEvent . UNCHANGED ) { boolean hasConstants = ! ( ( List ) getNewValue ( node , EnumDeclaration . ENUM_CONSTANTS_PROPERTY ) ) . isEmpty ( ) ; RewriteEvent [ ] children = bodyEvent . getChildren ( ) ; try { if ( hasConstants ) { indent = getIndent ( pos ) ; } else { indent = getIndent ( node . getStartPosition ( ) ) + <NUM_LIT:1> ; } int token = getScanner ( ) . readNext ( pos , true ) ; boolean hasSemicolon = token == TerminalTokens . TokenNameSEMICOLON ; if ( ! hasSemicolon && isAllOfKind ( children , RewriteEvent . INSERTED ) ) { if ( ! hasConstants ) { String str = this . formatter . FIRST_ENUM_CONST . getPrefix ( indent - <NUM_LIT:1> ) ; doTextInsert ( pos , str , getEditGroup ( children [ <NUM_LIT:0> ] ) ) ; } if ( token == TerminalTokens . TokenNameCOMMA ) { int endPos = getScanner ( ) . getCurrentEndOffset ( ) ; int nextToken = getScanner ( ) . readNext ( endPos , true ) ; if ( nextToken != TerminalTokens . TokenNameSEMICOLON ) { doTextInsert ( endPos , "<STR_LIT:;>" , getEditGroup ( children [ <NUM_LIT:0> ] ) ) ; } else { endPos = getScanner ( ) . getCurrentEndOffset ( ) ; if ( isAllOfKind ( children , RewriteEvent . REMOVED ) ) { doTextRemove ( pos , endPos - pos , getEditGroup ( children [ <NUM_LIT:0> ] ) ) ; } } pos = endPos ; } else { doTextInsert ( pos , "<STR_LIT:;>" , getEditGroup ( children [ <NUM_LIT:0> ] ) ) ; } } else if ( hasSemicolon ) { int endPos = getScanner ( ) . getCurrentEndOffset ( ) ; if ( isAllOfKind ( children , RewriteEvent . REMOVED ) ) { doTextRemove ( pos , endPos - pos , getEditGroup ( children [ <NUM_LIT:0> ] ) ) ; } pos = endPos ; } } catch ( CoreException e ) { handleException ( e ) ; } } rewriteParagraphList ( node , EnumDeclaration . BODY_DECLARATIONS_PROPERTY , pos , indent , - <NUM_LIT:1> , <NUM_LIT:2> ) ; return false ; } public boolean visit ( MarkerAnnotation node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , MarkerAnnotation . TYPE_NAME_PROPERTY ) ; return false ; } public boolean visit ( MemberValuePair node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , MemberValuePair . NAME_PROPERTY ) ; rewriteRequiredNode ( node , MemberValuePair . VALUE_PROPERTY ) ; return false ; } public boolean visit ( Modifier node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } String newText = getNewValue ( node , Modifier . KEYWORD_PROPERTY ) . toString ( ) ; TextEditGroup group = getEditGroup ( node , Modifier . KEYWORD_PROPERTY ) ; doTextReplace ( node . getStartPosition ( ) , node . getLength ( ) , newText , group ) ; return false ; } public boolean visit ( NormalAnnotation node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteRequiredNode ( node , NormalAnnotation . TYPE_NAME_PROPERTY ) ; if ( isChanged ( node , NormalAnnotation . VALUES_PROPERTY ) ) { try { int startOffset = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameLPAREN , pos ) ; rewriteNodeList ( node , NormalAnnotation . VALUES_PROPERTY , startOffset , Util . EMPTY_STRING , "<STR_LIT:U+002CU+0020>" ) ; } catch ( CoreException e ) { handleException ( e ) ; } } else { voidVisit ( node , NormalAnnotation . VALUES_PROPERTY ) ; } return false ; } public boolean visit ( ParameterizedType node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteRequiredNode ( node , ParameterizedType . TYPE_PROPERTY ) ; if ( isChanged ( node , ParameterizedType . TYPE_ARGUMENTS_PROPERTY ) ) { try { int startOffset = getScanner ( ) . getTokenEndOffset ( TerminalTokens . TokenNameLESS , pos ) ; rewriteNodeList ( node , ParameterizedType . TYPE_ARGUMENTS_PROPERTY , startOffset , Util . EMPTY_STRING , "<STR_LIT:U+002CU+0020>" ) ; } catch ( CoreException e ) { handleException ( e ) ; } } else { voidVisit ( node , ParameterizedType . TYPE_ARGUMENTS_PROPERTY ) ; } return false ; } public boolean visit ( QualifiedType node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , QualifiedType . QUALIFIER_PROPERTY ) ; rewriteRequiredNode ( node , QualifiedType . NAME_PROPERTY ) ; return false ; } public boolean visit ( SingleMemberAnnotation node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } rewriteRequiredNode ( node , SingleMemberAnnotation . TYPE_NAME_PROPERTY ) ; rewriteRequiredNode ( node , SingleMemberAnnotation . VALUE_PROPERTY ) ; return false ; } public boolean visit ( TypeParameter node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } int pos = rewriteRequiredNode ( node , TypeParameter . NAME_PROPERTY ) ; if ( isChanged ( node , TypeParameter . TYPE_BOUNDS_PROPERTY ) ) { rewriteNodeList ( node , TypeParameter . TYPE_BOUNDS_PROPERTY , pos , "<STR_LIT>" , "<STR_LIT>" ) ; } else { voidVisit ( node , TypeParameter . TYPE_BOUNDS_PROPERTY ) ; } return false ; } public boolean visit ( WildcardType node ) { if ( ! hasChildrenChanges ( node ) ) { return doVisitUnchangedChildren ( node ) ; } try { int pos = getScanner ( ) . getNextEndOffset ( node . getStartPosition ( ) , true ) ; Prefix prefix ; if ( Boolean . TRUE . equals ( getNewValue ( node , WildcardType . UPPER_BOUND_PROPERTY ) ) ) { prefix = this . formatter . WILDCARD_EXTENDS ; } else { prefix = this . formatter . WILDCARD_SUPER ; } int boundKindChange = getChangeKind ( node , WildcardType . UPPER_BOUND_PROPERTY ) ; if ( boundKindChange != RewriteEvent . UNCHANGED ) { int boundTypeChange = getChangeKind ( node , WildcardType . BOUND_PROPERTY ) ; if ( boundTypeChange != RewriteEvent . INSERTED && boundTypeChange != RewriteEvent . REMOVED ) { ASTNode type = ( ASTNode ) getOriginalValue ( node , WildcardType . BOUND_PROPERTY ) ; String str = prefix . getPrefix ( <NUM_LIT:0> ) ; doTextReplace ( pos , type . getStartPosition ( ) - pos , str , getEditGroup ( node , WildcardType . BOUND_PROPERTY ) ) ; } } rewriteNode ( node , WildcardType . BOUND_PROPERTY , pos , prefix ) ; } catch ( CoreException e ) { handleException ( e ) ; } return false ; } final void handleException ( Throwable e ) { IllegalArgumentException runtimeException = new IllegalArgumentException ( "<STR_LIT>" ) ; runtimeException . initCause ( e ) ; throw runtimeException ; } } </s>
|
<s> package org . eclipse . jdt . internal . core . dom . rewrite ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Status ; import org . eclipse . jdt . core . JavaCore ; 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 TokenScanner { public static final int END_OF_FILE = <NUM_LIT> ; public static final int LEXICAL_ERROR = <NUM_LIT> ; public static final int DOCUMENT_ERROR = <NUM_LIT> ; private final Scanner scanner ; private final int endPosition ; public TokenScanner ( Scanner scanner ) { this . scanner = scanner ; this . endPosition = this . scanner . getSource ( ) . length - <NUM_LIT:1> ; } public Scanner getScanner ( ) { return this . scanner ; } public void setOffset ( int offset ) { this . scanner . resetTo ( offset , this . endPosition ) ; } public int getCurrentEndOffset ( ) { return this . scanner . getCurrentTokenEndPosition ( ) + <NUM_LIT:1> ; } public int getCurrentStartOffset ( ) { return this . scanner . getCurrentTokenStartPosition ( ) ; } public int getCurrentLength ( ) { return getCurrentEndOffset ( ) - getCurrentStartOffset ( ) ; } public int readNext ( boolean ignoreComments ) throws CoreException { int curr = <NUM_LIT:0> ; do { try { curr = this . scanner . getNextToken ( ) ; if ( curr == TerminalTokens . TokenNameEOF ) { throw new CoreException ( createError ( END_OF_FILE , "<STR_LIT>" , null ) ) ; } } catch ( InvalidInputException e ) { throw new CoreException ( createError ( LEXICAL_ERROR , e . getMessage ( ) , e ) ) ; } } while ( ignoreComments && isComment ( curr ) ) ; return curr ; } public int readNext ( int offset , boolean ignoreComments ) throws CoreException { setOffset ( offset ) ; return readNext ( ignoreComments ) ; } public int getNextStartOffset ( int offset , boolean ignoreComments ) throws CoreException { readNext ( offset , ignoreComments ) ; return getCurrentStartOffset ( ) ; } public int getNextEndOffset ( int offset , boolean ignoreComments ) throws CoreException { readNext ( offset , ignoreComments ) ; return getCurrentEndOffset ( ) ; } public void readToToken ( int tok ) throws CoreException { int curr = <NUM_LIT:0> ; do { curr = readNext ( false ) ; } while ( curr != tok ) ; } public void readToToken ( int tok , int offset ) throws CoreException { setOffset ( offset ) ; readToToken ( tok ) ; } public int getTokenStartOffset ( int token , int startOffset ) throws CoreException { readToToken ( token , startOffset ) ; return getCurrentStartOffset ( ) ; } public int getTokenEndOffset ( int token , int startOffset ) throws CoreException { readToToken ( token , startOffset ) ; return getCurrentEndOffset ( ) ; } public int getPreviousTokenEndOffset ( int token , int startOffset ) throws CoreException { setOffset ( startOffset ) ; int res = startOffset ; int curr = readNext ( false ) ; while ( curr != token ) { res = getCurrentEndOffset ( ) ; curr = readNext ( false ) ; } return res ; } public static boolean isComment ( int token ) { return token == TerminalTokens . TokenNameCOMMENT_BLOCK || token == TerminalTokens . TokenNameCOMMENT_JAVADOC || token == TerminalTokens . TokenNameCOMMENT_LINE ; } public static boolean isModifier ( int token ) { switch ( token ) { case TerminalTokens . TokenNamepublic : case TerminalTokens . TokenNameprotected : case TerminalTokens . TokenNameprivate : case TerminalTokens . TokenNamestatic : case TerminalTokens . TokenNamefinal : case TerminalTokens . TokenNameabstract : case TerminalTokens . TokenNamenative : case TerminalTokens . TokenNamevolatile : case TerminalTokens . TokenNamestrictfp : case TerminalTokens . TokenNametransient : case TerminalTokens . TokenNamesynchronized : return true ; default : return false ; } } public static IStatus createError ( int code , String message , Throwable throwable ) { return new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , code , message , throwable ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . core . dom . rewrite ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . jdt . core . dom . ASTNode ; public class ListRewriteEvent extends RewriteEvent { public final static int NEW = <NUM_LIT:1> ; public final static int OLD = <NUM_LIT:2> ; public final static int BOTH = NEW | OLD ; private List originalNodes ; private List listEntries ; public ListRewriteEvent ( List originalNodes ) { this . originalNodes = new ArrayList ( originalNodes ) ; } public ListRewriteEvent ( RewriteEvent [ ] children ) { this . listEntries = new ArrayList ( children . length * <NUM_LIT:2> ) ; this . originalNodes = new ArrayList ( children . length * <NUM_LIT:2> ) ; for ( int i = <NUM_LIT:0> ; i < children . length ; i ++ ) { RewriteEvent curr = children [ i ] ; this . listEntries . add ( curr ) ; if ( curr . getOriginalValue ( ) != null ) { this . originalNodes . add ( curr . getOriginalValue ( ) ) ; } } } private List getEntries ( ) { if ( this . listEntries == null ) { int nNodes = this . originalNodes . size ( ) ; this . listEntries = new ArrayList ( nNodes * <NUM_LIT:2> ) ; for ( int i = <NUM_LIT:0> ; i < nNodes ; i ++ ) { ASTNode node = ( ASTNode ) this . originalNodes . get ( i ) ; this . listEntries . add ( new NodeRewriteEvent ( node , node ) ) ; } } return this . listEntries ; } public int getChangeKind ( ) { if ( this . listEntries != null ) { for ( int i = <NUM_LIT:0> ; i < this . listEntries . size ( ) ; i ++ ) { RewriteEvent curr = ( RewriteEvent ) this . listEntries . get ( i ) ; if ( curr . getChangeKind ( ) != UNCHANGED ) { return CHILDREN_CHANGED ; } } } return UNCHANGED ; } public boolean isListRewrite ( ) { return true ; } public RewriteEvent [ ] getChildren ( ) { List entries = getEntries ( ) ; return ( RewriteEvent [ ] ) entries . toArray ( new RewriteEvent [ entries . size ( ) ] ) ; } public Object getOriginalValue ( ) { return this . originalNodes ; } public Object getNewValue ( ) { List entries = getEntries ( ) ; ArrayList res = new ArrayList ( entries . size ( ) ) ; for ( int i = <NUM_LIT:0> ; i < entries . size ( ) ; i ++ ) { RewriteEvent curr = ( RewriteEvent ) entries . get ( i ) ; Object newVal = curr . getNewValue ( ) ; if ( newVal != null ) { res . add ( newVal ) ; } } return res ; } public RewriteEvent removeEntry ( ASTNode originalEntry ) { return replaceEntry ( originalEntry , null ) ; } public RewriteEvent replaceEntry ( ASTNode entry , ASTNode newEntry ) { if ( entry == null ) { throw new IllegalArgumentException ( ) ; } List entries = getEntries ( ) ; int nEntries = entries . size ( ) ; for ( int i = <NUM_LIT:0> ; i < nEntries ; i ++ ) { NodeRewriteEvent curr = ( NodeRewriteEvent ) entries . get ( i ) ; if ( curr . getOriginalValue ( ) == entry || curr . getNewValue ( ) == entry ) { curr . setNewValue ( newEntry ) ; if ( curr . getNewValue ( ) == null && curr . getOriginalValue ( ) == null ) { entries . remove ( i ) ; return null ; } return curr ; } } return null ; } public void revertChange ( NodeRewriteEvent event ) { Object originalValue = event . getOriginalValue ( ) ; if ( originalValue == null ) { List entries = getEntries ( ) ; entries . remove ( event ) ; } else { event . setNewValue ( originalValue ) ; } } public int getIndex ( ASTNode node , int kind ) { List entries = getEntries ( ) ; for ( int i = entries . size ( ) - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { RewriteEvent curr = ( RewriteEvent ) entries . get ( i ) ; if ( ( ( kind & OLD ) != <NUM_LIT:0> ) && ( curr . getOriginalValue ( ) == node ) ) { return i ; } if ( ( ( kind & NEW ) != <NUM_LIT:0> ) && ( curr . getNewValue ( ) == node ) ) { return i ; } } return - <NUM_LIT:1> ; } public RewriteEvent insert ( ASTNode insertedNode , int insertIndex ) { NodeRewriteEvent change = new NodeRewriteEvent ( null , insertedNode ) ; if ( insertIndex != - <NUM_LIT:1> ) { getEntries ( ) . add ( insertIndex , change ) ; } else { getEntries ( ) . add ( change ) ; } return change ; } public void setNewValue ( ASTNode newValue , int insertIndex ) { NodeRewriteEvent curr = ( NodeRewriteEvent ) getEntries ( ) . get ( insertIndex ) ; curr . setNewValue ( newValue ) ; } public int getChangeKind ( int index ) { return ( ( NodeRewriteEvent ) getEntries ( ) . get ( index ) ) . getChangeKind ( ) ; } public String toString ( ) { StringBuffer buf = new StringBuffer ( ) ; buf . append ( "<STR_LIT>" ) ; RewriteEvent [ ] events = getChildren ( ) ; for ( int i = <NUM_LIT:0> ; i < events . length ; i ++ ) { if ( i != <NUM_LIT:0> ) { buf . append ( "<STR_LIT>" ) ; } buf . append ( events [ i ] ) ; } buf . append ( "<STR_LIT>" ) ; return buf . toString ( ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . core . dom . rewrite ; import java . util . HashSet ; import java . util . IdentityHashMap ; import java . util . Map ; import java . util . Set ; import org . eclipse . jdt . core . dom . AST ; import org . eclipse . jdt . core . dom . ASTNode ; import org . eclipse . jdt . core . dom . Block ; import org . eclipse . jdt . core . dom . FieldDeclaration ; import org . eclipse . jdt . core . dom . Modifier ; import org . eclipse . jdt . core . dom . ParameterizedType ; import org . eclipse . jdt . core . dom . TryStatement ; import org . eclipse . jdt . core . dom . VariableDeclarationExpression ; import org . eclipse . jdt . core . dom . VariableDeclarationStatement ; import org . eclipse . jdt . internal . core . dom . rewrite . RewriteEventStore . CopySourceInfo ; public final class NodeInfoStore { private AST ast ; private Map placeholderNodes ; private Set collapsedNodes ; public NodeInfoStore ( AST ast ) { super ( ) ; this . ast = ast ; this . placeholderNodes = null ; this . collapsedNodes = null ; } public final void markAsStringPlaceholder ( ASTNode placeholder , String code ) { StringPlaceholderData data = new StringPlaceholderData ( ) ; data . code = code ; setPlaceholderData ( placeholder , data ) ; } public final void markAsCopyTarget ( ASTNode target , CopySourceInfo copySource ) { CopyPlaceholderData data = new CopyPlaceholderData ( ) ; data . copySource = copySource ; setPlaceholderData ( target , data ) ; } public final ASTNode newPlaceholderNode ( int nodeType ) { try { ASTNode node = this . ast . createInstance ( nodeType ) ; switch ( node . getNodeType ( ) ) { case ASTNode . FIELD_DECLARATION : ( ( FieldDeclaration ) node ) . fragments ( ) . add ( this . ast . newVariableDeclarationFragment ( ) ) ; break ; case ASTNode . MODIFIER : ( ( Modifier ) node ) . setKeyword ( Modifier . ModifierKeyword . ABSTRACT_KEYWORD ) ; break ; case ASTNode . TRY_STATEMENT : ( ( TryStatement ) node ) . setFinally ( this . ast . newBlock ( ) ) ; break ; case ASTNode . VARIABLE_DECLARATION_EXPRESSION : ( ( VariableDeclarationExpression ) node ) . fragments ( ) . add ( this . ast . newVariableDeclarationFragment ( ) ) ; break ; case ASTNode . VARIABLE_DECLARATION_STATEMENT : ( ( VariableDeclarationStatement ) node ) . fragments ( ) . add ( this . ast . newVariableDeclarationFragment ( ) ) ; break ; case ASTNode . PARAMETERIZED_TYPE : ( ( ParameterizedType ) node ) . typeArguments ( ) . add ( this . ast . newWildcardType ( ) ) ; break ; } return node ; } catch ( IllegalArgumentException e ) { return null ; } } public Block createCollapsePlaceholder ( ) { Block placeHolder = this . ast . newBlock ( ) ; if ( this . collapsedNodes == null ) { this . collapsedNodes = new HashSet ( ) ; } this . collapsedNodes . add ( placeHolder ) ; return placeHolder ; } public boolean isCollapsed ( ASTNode node ) { if ( this . collapsedNodes != null ) { return this . collapsedNodes . contains ( node ) ; } return false ; } public Object getPlaceholderData ( ASTNode node ) { if ( this . placeholderNodes != null ) { return this . placeholderNodes . get ( node ) ; } return null ; } private void setPlaceholderData ( ASTNode node , PlaceholderData data ) { if ( this . placeholderNodes == null ) { this . placeholderNodes = new IdentityHashMap ( ) ; } this . placeholderNodes . put ( node , data ) ; } static class PlaceholderData { } protected static final class CopyPlaceholderData extends PlaceholderData { public CopySourceInfo copySource ; public String toString ( ) { return "<STR_LIT>" + this . copySource + "<STR_LIT:]>" ; } } protected static final class StringPlaceholderData extends PlaceholderData { public String code ; public String toString ( ) { return "<STR_LIT>" + this . code + "<STR_LIT:]>" ; } } public void clear ( ) { this . placeholderNodes = null ; this . collapsedNodes = null ; } } </s>
|
<s> package org . eclipse . jdt . internal . core . dom . rewrite ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . jdt . core . formatter . IndentManipulation ; import org . eclipse . text . edits . ISourceModifier ; import org . eclipse . text . edits . ReplaceEdit ; public class SourceModifier implements ISourceModifier { private final String destinationIndent ; private final int sourceIndentLevel ; private final int tabWidth ; private final int indentWidth ; public SourceModifier ( int sourceIndentLevel , String destinationIndent , int tabWidth , int indentWidth ) { this . destinationIndent = destinationIndent ; this . sourceIndentLevel = sourceIndentLevel ; this . tabWidth = tabWidth ; this . indentWidth = indentWidth ; } public ISourceModifier copy ( ) { return this ; } public ReplaceEdit [ ] getModifications ( String source ) { List result = new ArrayList ( ) ; int destIndentLevel = IndentManipulation . measureIndentUnits ( this . destinationIndent , this . tabWidth , this . indentWidth ) ; if ( destIndentLevel == this . sourceIndentLevel ) { return ( ReplaceEdit [ ] ) result . toArray ( new ReplaceEdit [ result . size ( ) ] ) ; } return IndentManipulation . getChangeIndentEdits ( source , this . sourceIndentLevel , this . tabWidth , this . indentWidth , this . destinationIndent ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . core . dom . rewrite ; public abstract class RewriteEvent { public static final int INSERTED = <NUM_LIT:1> ; public static final int REMOVED = <NUM_LIT:2> ; public static final int REPLACED = <NUM_LIT:4> ; public static final int CHILDREN_CHANGED = <NUM_LIT:8> ; public static final int UNCHANGED = <NUM_LIT:0> ; public abstract int getChangeKind ( ) ; public abstract boolean isListRewrite ( ) ; public abstract Object getOriginalValue ( ) ; public abstract Object getNewValue ( ) ; public abstract RewriteEvent [ ] getChildren ( ) ; } </s>
|
<s> package org . eclipse . jdt . internal . core . dom . rewrite ; import org . eclipse . text . edits . TextEdit ; import org . eclipse . text . edits . TextEditGroup ; import org . eclipse . jdt . core . dom . ASTNode ; import org . eclipse . jdt . core . dom . rewrite . ITrackedNodePosition ; import org . eclipse . jface . text . IRegion ; public class TrackedNodePosition implements ITrackedNodePosition { private final TextEditGroup group ; private final ASTNode node ; public TrackedNodePosition ( TextEditGroup group , ASTNode node ) { this . group = group ; this . node = node ; } public int getStartPosition ( ) { if ( this . group . isEmpty ( ) ) { return this . node . getStartPosition ( ) ; } IRegion coverage = TextEdit . getCoverage ( this . group . getTextEdits ( ) ) ; if ( coverage == null ) { return this . node . getStartPosition ( ) ; } return coverage . getOffset ( ) ; } public int getLength ( ) { if ( this . group . isEmpty ( ) ) { return this . node . getLength ( ) ; } IRegion coverage = TextEdit . getCoverage ( this . group . getTextEdits ( ) ) ; if ( coverage == null ) { return this . node . getLength ( ) ; } return coverage . getLength ( ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . core . dom . rewrite ; import java . util . ArrayList ; import java . util . Collection ; import java . util . HashMap ; import java . util . Map ; import org . eclipse . core . runtime . Assert ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . ToolFactory ; import org . eclipse . jdt . core . dom . ASTNode ; import org . eclipse . jdt . core . dom . Annotation ; import org . eclipse . jdt . core . dom . Block ; import org . eclipse . jdt . core . dom . BodyDeclaration ; import org . eclipse . jdt . core . dom . Expression ; import org . eclipse . jdt . core . dom . Statement ; import org . eclipse . jdt . core . formatter . CodeFormatter ; import org . eclipse . jdt . core . formatter . DefaultCodeFormatterConstants ; import org . eclipse . jdt . core . formatter . IndentManipulation ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . BadPositionCategoryException ; import org . eclipse . jface . text . DefaultPositionUpdater ; import org . eclipse . jface . text . Document ; import org . eclipse . jface . text . Position ; import org . eclipse . text . edits . DeleteEdit ; import org . eclipse . text . edits . InsertEdit ; import org . eclipse . text . edits . MultiTextEdit ; import org . eclipse . text . edits . ReplaceEdit ; import org . eclipse . text . edits . TextEdit ; final class ASTRewriteFormatter { public static class NodeMarker extends Position { public Object data ; } private class ExtendedFlattener extends ASTRewriteFlattener { private ArrayList positions ; public ExtendedFlattener ( RewriteEventStore store ) { super ( store ) ; this . positions = new ArrayList ( ) ; } public void preVisit ( ASTNode node ) { Object trackData = getEventStore ( ) . getTrackedNodeData ( node ) ; if ( trackData != null ) { addMarker ( trackData , this . result . length ( ) , <NUM_LIT:0> ) ; } Object placeholderData = getPlaceholders ( ) . getPlaceholderData ( node ) ; if ( placeholderData != null ) { addMarker ( placeholderData , this . result . length ( ) , <NUM_LIT:0> ) ; } } public void postVisit ( ASTNode node ) { Object placeholderData = getPlaceholders ( ) . getPlaceholderData ( node ) ; if ( placeholderData != null ) { fixupLength ( placeholderData , this . result . length ( ) ) ; } Object trackData = getEventStore ( ) . getTrackedNodeData ( node ) ; if ( trackData != null ) { fixupLength ( trackData , this . result . length ( ) ) ; } } public boolean visit ( Block node ) { if ( getPlaceholders ( ) . isCollapsed ( node ) ) { visitList ( node , Block . STATEMENTS_PROPERTY , null ) ; return false ; } return super . visit ( node ) ; } private NodeMarker addMarker ( Object annotation , int startOffset , int length ) { NodeMarker marker = new NodeMarker ( ) ; marker . offset = startOffset ; marker . length = length ; marker . data = annotation ; this . positions . add ( marker ) ; return marker ; } private void fixupLength ( Object data , int endOffset ) { for ( int i = this . positions . size ( ) - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { NodeMarker marker = ( NodeMarker ) this . positions . get ( i ) ; if ( marker . data == data ) { marker . length = endOffset - marker . offset ; return ; } } } public NodeMarker [ ] getMarkers ( ) { return ( NodeMarker [ ] ) this . positions . toArray ( new NodeMarker [ this . positions . size ( ) ] ) ; } } private final String lineDelimiter ; private final int tabWidth ; private final int indentWidth ; private final NodeInfoStore placeholders ; private final RewriteEventStore eventStore ; private final Map options ; public ASTRewriteFormatter ( NodeInfoStore placeholders , RewriteEventStore eventStore , Map options , String lineDelimiter ) { this . placeholders = placeholders ; this . eventStore = eventStore ; this . options = options == null ? JavaCore . getOptions ( ) : ( Map ) new HashMap ( options ) ; this . options . put ( DefaultCodeFormatterConstants . FORMATTER_ALIGNMENT_FOR_RESOURCES_IN_TRY , DefaultCodeFormatterConstants . createAlignmentValue ( true , DefaultCodeFormatterConstants . WRAP_NEXT_PER_LINE , DefaultCodeFormatterConstants . INDENT_DEFAULT ) ) ; this . lineDelimiter = lineDelimiter ; this . tabWidth = IndentManipulation . getTabWidth ( options ) ; this . indentWidth = IndentManipulation . getIndentWidth ( options ) ; } public NodeInfoStore getPlaceholders ( ) { return this . placeholders ; } public RewriteEventStore getEventStore ( ) { return this . eventStore ; } public int getTabWidth ( ) { return this . tabWidth ; } public int getIndentWidth ( ) { return this . indentWidth ; } public String getLineDelimiter ( ) { return this . lineDelimiter ; } public String getFormattedResult ( ASTNode node , int initialIndentationLevel , Collection resultingMarkers ) { ExtendedFlattener flattener = new ExtendedFlattener ( this . eventStore ) ; node . accept ( flattener ) ; NodeMarker [ ] markers = flattener . getMarkers ( ) ; for ( int i = <NUM_LIT:0> ; i < markers . length ; i ++ ) { resultingMarkers . add ( markers [ i ] ) ; } String unformatted = flattener . getResult ( ) ; TextEdit edit = formatNode ( node , unformatted , initialIndentationLevel ) ; if ( edit == null ) { if ( initialIndentationLevel > <NUM_LIT:0> ) { String indentString = createIndentString ( initialIndentationLevel ) ; ReplaceEdit [ ] edits = IndentManipulation . getChangeIndentEdits ( unformatted , <NUM_LIT:0> , this . tabWidth , this . indentWidth , indentString ) ; edit = new MultiTextEdit ( ) ; edit . addChild ( new InsertEdit ( <NUM_LIT:0> , indentString ) ) ; edit . addChildren ( edits ) ; } else { return unformatted ; } } return evaluateFormatterEdit ( unformatted , edit , markers ) ; } public String createIndentString ( int indentationUnits ) { return ToolFactory . createCodeFormatter ( this . options ) . createIndentationString ( indentationUnits ) ; } public String getIndentString ( String currentLine ) { return IndentManipulation . extractIndentString ( currentLine , this . tabWidth , this . indentWidth ) ; } public String changeIndent ( String code , int codeIndentLevel , String newIndent ) { return IndentManipulation . changeIndent ( code , codeIndentLevel , this . tabWidth , this . indentWidth , newIndent , this . lineDelimiter ) ; } public int computeIndentUnits ( String line ) { return IndentManipulation . measureIndentUnits ( line , this . tabWidth , this . indentWidth ) ; } public static String evaluateFormatterEdit ( String string , TextEdit edit , Position [ ] positions ) { try { Document doc = createDocument ( string , positions ) ; edit . apply ( doc , <NUM_LIT:0> ) ; if ( positions != null ) { for ( int i = <NUM_LIT:0> ; i < positions . length ; i ++ ) { Assert . isTrue ( ! positions [ i ] . isDeleted , "<STR_LIT>" ) ; } } return doc . get ( ) ; } catch ( BadLocationException e ) { Assert . isTrue ( false , "<STR_LIT>" + e . getMessage ( ) ) ; } return null ; } public TextEdit formatString ( int kind , String string , int offset , int length , int indentationLevel ) { return ToolFactory . createCodeFormatter ( this . options ) . format ( kind , string , offset , length , indentationLevel , this . lineDelimiter ) ; } private TextEdit formatNode ( ASTNode node , String str , int indentationLevel ) { int code ; String prefix = "<STR_LIT>" ; String suffix = "<STR_LIT>" ; if ( node instanceof Statement ) { code = CodeFormatter . K_STATEMENTS ; if ( node . getNodeType ( ) == ASTNode . SWITCH_CASE ) { prefix = "<STR_LIT>" ; suffix = "<STR_LIT:}>" ; code = CodeFormatter . K_STATEMENTS ; } } else if ( node instanceof Expression && node . getNodeType ( ) != ASTNode . VARIABLE_DECLARATION_EXPRESSION ) { if ( node instanceof Annotation ) { suffix = "<STR_LIT>" ; code = CodeFormatter . K_COMPILATION_UNIT ; } else { code = CodeFormatter . K_EXPRESSION ; } } else if ( node instanceof BodyDeclaration ) { code = CodeFormatter . K_CLASS_BODY_DECLARATIONS ; } else { switch ( node . getNodeType ( ) ) { case ASTNode . ARRAY_TYPE : case ASTNode . PARAMETERIZED_TYPE : case ASTNode . PRIMITIVE_TYPE : case ASTNode . QUALIFIED_TYPE : case ASTNode . SIMPLE_TYPE : suffix = "<STR_LIT>" ; code = CodeFormatter . K_CLASS_BODY_DECLARATIONS ; break ; case ASTNode . WILDCARD_TYPE : prefix = "<STR_LIT>" ; suffix = "<STR_LIT>" ; code = CodeFormatter . K_CLASS_BODY_DECLARATIONS ; break ; case ASTNode . COMPILATION_UNIT : code = CodeFormatter . K_COMPILATION_UNIT ; break ; case ASTNode . VARIABLE_DECLARATION_EXPRESSION : case ASTNode . SINGLE_VARIABLE_DECLARATION : suffix = "<STR_LIT:;>" ; code = CodeFormatter . K_STATEMENTS ; break ; case ASTNode . VARIABLE_DECLARATION_FRAGMENT : prefix = "<STR_LIT>" ; suffix = "<STR_LIT:;>" ; code = CodeFormatter . K_STATEMENTS ; break ; case ASTNode . PACKAGE_DECLARATION : case ASTNode . IMPORT_DECLARATION : suffix = "<STR_LIT>" ; code = CodeFormatter . K_COMPILATION_UNIT ; break ; case ASTNode . JAVADOC : suffix = "<STR_LIT>" ; code = CodeFormatter . K_COMPILATION_UNIT ; break ; case ASTNode . CATCH_CLAUSE : prefix = "<STR_LIT>" ; code = CodeFormatter . K_STATEMENTS ; break ; case ASTNode . ANONYMOUS_CLASS_DECLARATION : prefix = "<STR_LIT>" ; suffix = "<STR_LIT:;>" ; code = CodeFormatter . K_STATEMENTS ; break ; case ASTNode . MEMBER_VALUE_PAIR : prefix = "<STR_LIT>" ; suffix = "<STR_LIT>" ; code = CodeFormatter . K_COMPILATION_UNIT ; break ; case ASTNode . MODIFIER : suffix = "<STR_LIT>" ; code = CodeFormatter . K_COMPILATION_UNIT ; break ; case ASTNode . TYPE_PARAMETER : prefix = "<STR_LIT>" ; suffix = "<STR_LIT>" ; code = CodeFormatter . K_COMPILATION_UNIT ; break ; case ASTNode . MEMBER_REF : case ASTNode . METHOD_REF : case ASTNode . METHOD_REF_PARAMETER : case ASTNode . TAG_ELEMENT : case ASTNode . TEXT_ELEMENT : return null ; default : return null ; } } String concatStr = prefix + str + suffix ; TextEdit edit = formatString ( code , concatStr , prefix . length ( ) , str . length ( ) , indentationLevel ) ; if ( prefix . length ( ) > <NUM_LIT:0> ) { edit = shifEdit ( edit , prefix . length ( ) ) ; } return edit ; } private static TextEdit shifEdit ( TextEdit oldEdit , int diff ) { TextEdit newEdit ; if ( oldEdit instanceof ReplaceEdit ) { ReplaceEdit edit = ( ReplaceEdit ) oldEdit ; newEdit = new ReplaceEdit ( edit . getOffset ( ) - diff , edit . getLength ( ) , edit . getText ( ) ) ; } else if ( oldEdit instanceof InsertEdit ) { InsertEdit edit = ( InsertEdit ) oldEdit ; newEdit = new InsertEdit ( edit . getOffset ( ) - diff , edit . getText ( ) ) ; } else if ( oldEdit instanceof DeleteEdit ) { DeleteEdit edit = ( DeleteEdit ) oldEdit ; newEdit = new DeleteEdit ( edit . getOffset ( ) - diff , edit . getLength ( ) ) ; } else if ( oldEdit instanceof MultiTextEdit ) { newEdit = new MultiTextEdit ( ) ; } else { return null ; } TextEdit [ ] children = oldEdit . getChildren ( ) ; for ( int i = <NUM_LIT:0> ; i < children . length ; i ++ ) { TextEdit shifted = shifEdit ( children [ i ] , diff ) ; if ( shifted != null ) { newEdit . addChild ( shifted ) ; } } return newEdit ; } private static Document createDocument ( String string , Position [ ] positions ) throws IllegalArgumentException { Document doc = new Document ( string ) ; try { if ( positions != null ) { final String POS_CATEGORY = "<STR_LIT>" ; doc . addPositionCategory ( POS_CATEGORY ) ; doc . addPositionUpdater ( new DefaultPositionUpdater ( POS_CATEGORY ) { protected boolean notDeleted ( ) { int start = this . fOffset ; int end = start + this . fLength ; if ( start < this . fPosition . offset && ( this . fPosition . offset + this . fPosition . length < end ) ) { this . fPosition . offset = end ; return false ; } return true ; } } ) ; for ( int i = <NUM_LIT:0> ; i < positions . length ; i ++ ) { try { doc . addPosition ( POS_CATEGORY , positions [ i ] ) ; } catch ( BadLocationException e ) { throw new IllegalArgumentException ( "<STR_LIT>" + positions [ i ] . offset + "<STR_LIT>" + positions [ i ] . length + "<STR_LIT>" + string . length ( ) ) ; } } } } catch ( BadPositionCategoryException cannotHappen ) { } return doc ; } public static interface Prefix { String getPrefix ( int indent ) ; } public static interface BlockContext { String [ ] getPrefixAndSuffix ( int indent , ASTNode node , RewriteEventStore events ) ; } public static class ConstPrefix implements Prefix { private String prefix ; public ConstPrefix ( String prefix ) { this . prefix = prefix ; } public String getPrefix ( int indent ) { return this . prefix ; } } private class FormattingPrefix implements Prefix { private int kind ; private String string ; private int start ; private int length ; public FormattingPrefix ( String string , String sub , int kind ) { this . start = string . indexOf ( sub ) ; this . length = sub . length ( ) ; this . string = string ; this . kind = kind ; } public String getPrefix ( int indent ) { Position pos = new Position ( this . start , this . length ) ; String str = this . string ; TextEdit res = formatString ( this . kind , str , <NUM_LIT:0> , str . length ( ) , indent ) ; if ( res != null ) { str = evaluateFormatterEdit ( str , res , new Position [ ] { pos } ) ; } return str . substring ( pos . offset + <NUM_LIT:1> , pos . offset + pos . length - <NUM_LIT:1> ) ; } } private class BlockFormattingPrefix implements BlockContext { private String prefix ; private int start ; public BlockFormattingPrefix ( String prefix , int start ) { this . start = start ; this . prefix = prefix ; } public String [ ] getPrefixAndSuffix ( int indent , ASTNode node , RewriteEventStore events ) { String nodeString = ASTRewriteFlattener . asString ( node , events ) ; String str = this . prefix + nodeString ; Position pos = new Position ( this . start , this . prefix . length ( ) + <NUM_LIT:1> - this . start ) ; TextEdit res = formatString ( CodeFormatter . K_STATEMENTS , str , <NUM_LIT:0> , str . length ( ) , indent ) ; if ( res != null ) { str = evaluateFormatterEdit ( str , res , new Position [ ] { pos } ) ; } return new String [ ] { str . substring ( pos . offset + <NUM_LIT:1> , pos . offset + pos . length - <NUM_LIT:1> ) , "<STR_LIT>" } ; } } private class BlockFormattingPrefixSuffix implements BlockContext { private String prefix ; private String suffix ; private int start ; public BlockFormattingPrefixSuffix ( String prefix , String suffix , int start ) { this . start = start ; this . suffix = suffix ; this . prefix = prefix ; } public String [ ] getPrefixAndSuffix ( int indent , ASTNode node , RewriteEventStore events ) { String nodeString = ASTRewriteFlattener . asString ( node , events ) ; int nodeStart = this . prefix . length ( ) ; int nodeEnd = nodeStart + nodeString . length ( ) - <NUM_LIT:1> ; String str = this . prefix + nodeString + this . suffix ; Position pos1 = new Position ( this . start , nodeStart + <NUM_LIT:1> - this . start ) ; Position pos2 = new Position ( nodeEnd , <NUM_LIT:2> ) ; TextEdit res = formatString ( CodeFormatter . K_STATEMENTS , str , <NUM_LIT:0> , str . length ( ) , indent ) ; if ( res != null ) { str = evaluateFormatterEdit ( str , res , new Position [ ] { pos1 , pos2 } ) ; } return new String [ ] { str . substring ( pos1 . offset + <NUM_LIT:1> , pos1 . offset + pos1 . length - <NUM_LIT:1> ) , str . substring ( pos2 . offset + <NUM_LIT:1> , pos2 . offset + pos2 . length - <NUM_LIT:1> ) } ; } } public final static Prefix NONE = new ConstPrefix ( "<STR_LIT>" ) ; public final static Prefix SPACE = new ConstPrefix ( "<STR_LIT:U+0020>" ) ; public final static Prefix ASSERT_COMMENT = new ConstPrefix ( "<STR_LIT:U+0020:U+0020>" ) ; public final Prefix VAR_INITIALIZER = new FormattingPrefix ( "<STR_LIT>" , "<STR_LIT>" , CodeFormatter . K_STATEMENTS ) ; public final Prefix METHOD_BODY = new FormattingPrefix ( "<STR_LIT>" , "<STR_LIT>" , CodeFormatter . K_CLASS_BODY_DECLARATIONS ) ; public final Prefix FINALLY_BLOCK = new FormattingPrefix ( "<STR_LIT>" , "<STR_LIT>" , CodeFormatter . K_STATEMENTS ) ; public final Prefix CATCH_BLOCK = new FormattingPrefix ( "<STR_LIT>" , "<STR_LIT>" , CodeFormatter . K_STATEMENTS ) ; public final Prefix ANNOT_MEMBER_DEFAULT = new FormattingPrefix ( "<STR_LIT>" , "<STR_LIT>" , CodeFormatter . K_CLASS_BODY_DECLARATIONS ) ; public final Prefix ENUM_BODY_START = new FormattingPrefix ( "<STR_LIT>" , "<STR_LIT>" , CodeFormatter . K_COMPILATION_UNIT ) ; public final Prefix ENUM_BODY_END = new FormattingPrefix ( "<STR_LIT>" , "<STR_LIT>" , CodeFormatter . K_COMPILATION_UNIT ) ; public final Prefix WILDCARD_EXTENDS = new FormattingPrefix ( "<STR_LIT>" , "<STR_LIT>" , CodeFormatter . K_CLASS_BODY_DECLARATIONS ) ; public final Prefix WILDCARD_SUPER = new FormattingPrefix ( "<STR_LIT>" , "<STR_LIT>" , CodeFormatter . K_CLASS_BODY_DECLARATIONS ) ; public final Prefix FIRST_ENUM_CONST = new FormattingPrefix ( "<STR_LIT>" , "<STR_LIT>" , CodeFormatter . K_COMPILATION_UNIT ) ; public final Prefix ANNOTATION_SEPARATION = new FormattingPrefix ( "<STR_LIT>" , "<STR_LIT>" , CodeFormatter . K_COMPILATION_UNIT ) ; public final Prefix PARAM_ANNOTATION_SEPARATION = new FormattingPrefix ( "<STR_LIT>" , "<STR_LIT>" , CodeFormatter . K_CLASS_BODY_DECLARATIONS ) ; public final Prefix TRY_RESOURCES = new FormattingPrefix ( "<STR_LIT>" , "<STR_LIT>" , CodeFormatter . K_STATEMENTS ) ; public final Prefix TRY_RESOURCES_PAREN = new FormattingPrefix ( "<STR_LIT>" , "<STR_LIT>" , CodeFormatter . K_STATEMENTS ) ; public final BlockContext IF_BLOCK_WITH_ELSE = new BlockFormattingPrefixSuffix ( "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT:8> ) ; public final BlockContext IF_BLOCK_NO_ELSE = new BlockFormattingPrefix ( "<STR_LIT>" , <NUM_LIT:8> ) ; public final BlockContext ELSE_AFTER_STATEMENT = new BlockFormattingPrefix ( "<STR_LIT>" , <NUM_LIT:15> ) ; public final BlockContext ELSE_AFTER_BLOCK = new BlockFormattingPrefix ( "<STR_LIT>" , <NUM_LIT:11> ) ; public final BlockContext FOR_BLOCK = new BlockFormattingPrefix ( "<STR_LIT>" , <NUM_LIT:7> ) ; public final BlockContext WHILE_BLOCK = new BlockFormattingPrefix ( "<STR_LIT>" , <NUM_LIT:11> ) ; public final BlockContext DO_BLOCK = new BlockFormattingPrefixSuffix ( "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT:1> ) ; } </s>
|
<s> package org . eclipse . jdt . internal . core . dom . rewrite ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Set ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . eclipse . jdt . core . IBuffer ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . Signature ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . dom . ASTNode ; import org . eclipse . jdt . core . dom . CompilationUnit ; import org . eclipse . jdt . core . dom . ImportDeclaration ; import org . eclipse . jdt . core . dom . PackageDeclaration ; import org . eclipse . jdt . core . formatter . DefaultCodeFormatterConstants ; import org . eclipse . jdt . core . search . IJavaSearchConstants ; import org . eclipse . jdt . core . search . IJavaSearchScope ; import org . eclipse . jdt . core . search . SearchEngine ; import org . eclipse . jdt . core . search . TypeNameRequestor ; import org . eclipse . jdt . internal . core . JavaProject ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . Region ; import org . eclipse . text . edits . DeleteEdit ; import org . eclipse . text . edits . InsertEdit ; import org . eclipse . text . edits . MultiTextEdit ; public final class ImportRewriteAnalyzer { private final ICompilationUnit compilationUnit ; private final ArrayList packageEntries ; private final List importsCreated ; private final List staticImportsCreated ; private final IRegion replaceRange ; private final int importOnDemandThreshold ; private final int staticImportOnDemandThreshold ; private boolean filterImplicitImports ; private boolean useContextToFilterImplicitImports ; private boolean findAmbiguousImports ; private int flags = <NUM_LIT:0> ; private static final int F_NEEDS_LEADING_DELIM = <NUM_LIT:2> ; private static final int F_NEEDS_TRAILING_DELIM = <NUM_LIT:4> ; private static final String JAVA_LANG = "<STR_LIT>" ; public ImportRewriteAnalyzer ( ICompilationUnit cu , CompilationUnit root , String [ ] importOrder , int threshold , int staticThreshold , boolean restoreExistingImports , boolean useContextToFilterImplicitImports ) { this . compilationUnit = cu ; this . importOnDemandThreshold = threshold ; this . staticImportOnDemandThreshold = staticThreshold ; this . useContextToFilterImplicitImports = useContextToFilterImplicitImports ; this . filterImplicitImports = true ; this . findAmbiguousImports = true ; this . packageEntries = new ArrayList ( <NUM_LIT:20> ) ; this . importsCreated = new ArrayList ( ) ; this . staticImportsCreated = new ArrayList ( ) ; this . flags = <NUM_LIT:0> ; this . replaceRange = evaluateReplaceRange ( root ) ; if ( restoreExistingImports ) { addExistingImports ( root ) ; } PackageEntry [ ] order = new PackageEntry [ importOrder . length ] ; for ( int i = <NUM_LIT:0> ; i < order . length ; i ++ ) { String curr = importOrder [ i ] ; if ( curr . length ( ) > <NUM_LIT:0> && curr . charAt ( <NUM_LIT:0> ) == '<CHAR_LIT>' ) { curr = curr . substring ( <NUM_LIT:1> ) ; order [ i ] = new PackageEntry ( curr , curr , true ) ; } else { order [ i ] = new PackageEntry ( curr , curr , false ) ; } } addPreferenceOrderHolders ( order ) ; } private int getSpacesBetweenImportGroups ( ) { try { int num = Integer . parseInt ( this . compilationUnit . getJavaProject ( ) . getOption ( DefaultCodeFormatterConstants . FORMATTER_BLANK_LINES_BETWEEN_IMPORT_GROUPS , true ) ) ; if ( num >= <NUM_LIT:0> ) return num ; } catch ( NumberFormatException e ) { } return <NUM_LIT:1> ; } private boolean insertSpaceBeforeSemicolon ( ) { return JavaCore . INSERT . equals ( this . compilationUnit . getJavaProject ( ) . getOption ( DefaultCodeFormatterConstants . FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON , true ) ) ; } private void addPreferenceOrderHolders ( PackageEntry [ ] preferenceOrder ) { if ( this . packageEntries . isEmpty ( ) ) { for ( int i = <NUM_LIT:0> ; i < preferenceOrder . length ; i ++ ) { this . packageEntries . add ( preferenceOrder [ i ] ) ; } } else { PackageEntry [ ] lastAssigned = new PackageEntry [ preferenceOrder . length ] ; for ( int k = <NUM_LIT:0> ; k < this . packageEntries . size ( ) ; k ++ ) { PackageEntry entry = ( PackageEntry ) this . packageEntries . get ( k ) ; if ( ! entry . isComment ( ) ) { String currName = entry . getName ( ) ; int currNameLen = currName . length ( ) ; int bestGroupIndex = - <NUM_LIT:1> ; int bestGroupLen = - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < preferenceOrder . length ; i ++ ) { boolean currPrevStatic = preferenceOrder [ i ] . isStatic ( ) ; if ( currPrevStatic == entry . isStatic ( ) ) { String currPrefEntry = preferenceOrder [ i ] . getName ( ) ; int currPrefLen = currPrefEntry . length ( ) ; if ( currName . startsWith ( currPrefEntry ) && currPrefLen >= bestGroupLen ) { if ( currPrefLen == currNameLen || currName . charAt ( currPrefLen ) == '<CHAR_LIT:.>' ) { if ( bestGroupIndex == - <NUM_LIT:1> || currPrefLen > bestGroupLen ) { bestGroupLen = currPrefLen ; bestGroupIndex = i ; } } } } } if ( bestGroupIndex != - <NUM_LIT:1> ) { entry . setGroupID ( preferenceOrder [ bestGroupIndex ] . getName ( ) ) ; lastAssigned [ bestGroupIndex ] = entry ; } } } int currAppendIndex = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < lastAssigned . length ; i ++ ) { PackageEntry entry = lastAssigned [ i ] ; if ( entry == null ) { PackageEntry newEntry = preferenceOrder [ i ] ; if ( currAppendIndex == <NUM_LIT:0> && ! newEntry . isStatic ( ) ) { currAppendIndex = getIndexAfterStatics ( ) ; } this . packageEntries . add ( currAppendIndex , newEntry ) ; currAppendIndex ++ ; } else { currAppendIndex = this . packageEntries . indexOf ( entry ) + <NUM_LIT:1> ; } } } } private String getQualifier ( ImportDeclaration decl ) { String name = decl . getName ( ) . getFullyQualifiedName ( ) ; if ( decl . isOnDemand ( ) ) { return name ; } return getQualifier ( name , decl . isStatic ( ) ) ; } private String getQualifier ( String name , boolean isStatic ) { if ( isStatic || ! this . useContextToFilterImplicitImports ) { return Signature . getQualifier ( name ) ; } char [ ] searchedName = name . toCharArray ( ) ; int index = name . length ( ) ; JavaProject project = ( JavaProject ) this . compilationUnit . getJavaProject ( ) ; do { String testedName = new String ( searchedName , <NUM_LIT:0> , index ) ; IJavaElement fragment = null ; try { fragment = project . findPackageFragment ( testedName ) ; } catch ( JavaModelException e ) { return name ; } if ( fragment != null ) { return testedName ; } try { fragment = project . findType ( testedName ) ; } catch ( JavaModelException e ) { return name ; } if ( fragment != null ) { index = CharOperation . lastIndexOf ( Signature . C_DOT , searchedName , <NUM_LIT:0> , index - <NUM_LIT:1> ) ; } else { index = CharOperation . lastIndexOf ( Signature . C_DOT , searchedName , <NUM_LIT:0> , index - <NUM_LIT:1> ) ; if ( Character . isLowerCase ( searchedName [ index + <NUM_LIT:1> ] ) ) { return testedName ; } } } while ( index >= <NUM_LIT:0> ) ; return name ; } private static String getFullName ( ImportDeclaration decl ) { String name = decl . getName ( ) . getFullyQualifiedName ( ) ; return decl . isOnDemand ( ) ? name + "<STR_LIT>" : name ; } private void addExistingImports ( CompilationUnit root ) { List decls = root . imports ( ) ; if ( decls . isEmpty ( ) ) { return ; } PackageEntry currPackage = null ; ImportDeclaration curr = ( ImportDeclaration ) decls . get ( <NUM_LIT:0> ) ; int currOffset = curr . getStartPosition ( ) ; int currLength = curr . getLength ( ) ; int currEndLine = root . getLineNumber ( currOffset + currLength ) ; for ( int i = <NUM_LIT:1> ; i < decls . size ( ) ; i ++ ) { boolean isStatic = curr . isStatic ( ) ; String name = getFullName ( curr ) ; String packName = getQualifier ( curr ) ; if ( currPackage == null || currPackage . compareTo ( packName , isStatic ) != <NUM_LIT:0> ) { currPackage = new PackageEntry ( packName , null , isStatic ) ; this . packageEntries . add ( currPackage ) ; } ImportDeclaration next = ( ImportDeclaration ) decls . get ( i ) ; int nextOffset = next . getStartPosition ( ) ; int nextLength = next . getLength ( ) ; int nextOffsetLine = root . getLineNumber ( nextOffset ) ; if ( currEndLine < nextOffsetLine ) { currEndLine ++ ; nextOffset = root . getPosition ( currEndLine , <NUM_LIT:0> ) ; } currPackage . add ( new ImportDeclEntry ( packName . length ( ) , name , isStatic , new Region ( currOffset , nextOffset - currOffset ) ) ) ; currOffset = nextOffset ; curr = next ; if ( currEndLine < nextOffsetLine ) { nextOffset = root . getPosition ( nextOffsetLine , <NUM_LIT:0> ) ; currPackage = new PackageEntry ( ) ; this . packageEntries . add ( currPackage ) ; currPackage . add ( new ImportDeclEntry ( packName . length ( ) , null , false , new Region ( currOffset , nextOffset - currOffset ) ) ) ; currOffset = nextOffset ; } currEndLine = root . getLineNumber ( nextOffset + nextLength ) ; } boolean isStatic = curr . isStatic ( ) ; String name = getFullName ( curr ) ; String packName = getQualifier ( curr ) ; if ( currPackage == null || currPackage . compareTo ( packName , isStatic ) != <NUM_LIT:0> ) { currPackage = new PackageEntry ( packName , null , isStatic ) ; this . packageEntries . add ( currPackage ) ; } int length = this . replaceRange . getOffset ( ) + this . replaceRange . getLength ( ) - curr . getStartPosition ( ) ; currPackage . add ( new ImportDeclEntry ( packName . length ( ) , name , isStatic , new Region ( curr . getStartPosition ( ) , length ) ) ) ; } public void setFilterImplicitImports ( boolean filterImplicitImports ) { this . filterImplicitImports = filterImplicitImports ; } public void setFindAmbiguousImports ( boolean findAmbiguousImports ) { this . findAmbiguousImports = findAmbiguousImports ; } private static class PackageMatcher { private String newName ; private String bestName ; private int bestMatchLen ; public PackageMatcher ( ) { } public void initialize ( String newImportName , String bestImportName ) { this . newName = newImportName ; this . bestName = bestImportName ; this . bestMatchLen = getCommonPrefixLength ( bestImportName , newImportName ) ; } public boolean isBetterMatch ( String currName , boolean preferCurr ) { boolean isBetter ; int currMatchLen = getCommonPrefixLength ( currName , this . newName ) ; int matchDiff = currMatchLen - this . bestMatchLen ; if ( matchDiff == <NUM_LIT:0> ) { if ( currMatchLen == this . newName . length ( ) && currMatchLen == currName . length ( ) && currMatchLen == this . bestName . length ( ) ) { isBetter = preferCurr ; } else { isBetter = sameMatchLenTest ( currName ) ; } } else { isBetter = ( matchDiff > <NUM_LIT:0> ) ; } if ( isBetter ) { this . bestName = currName ; this . bestMatchLen = currMatchLen ; } return isBetter ; } private boolean sameMatchLenTest ( String currName ) { int matchLen = this . bestMatchLen ; char newChar = getCharAt ( this . newName , matchLen ) ; char currChar = getCharAt ( currName , matchLen ) ; char bestChar = getCharAt ( this . bestName , matchLen ) ; if ( newChar < currChar ) { if ( bestChar < newChar ) { return ( currChar - newChar ) < ( newChar - bestChar ) ; } else { if ( currChar == bestChar ) { return false ; } else { return currChar < bestChar ; } } } else { if ( bestChar > newChar ) { return ( newChar - currChar ) < ( bestChar - newChar ) ; } else { if ( currChar == bestChar ) { return true ; } else { return currChar > bestChar ; } } } } } static int getCommonPrefixLength ( String s , String t ) { int len = Math . min ( s . length ( ) , t . length ( ) ) ; for ( int i = <NUM_LIT:0> ; i < len ; i ++ ) { if ( s . charAt ( i ) != t . charAt ( i ) ) { return i ; } } return len ; } static char getCharAt ( String str , int index ) { if ( str . length ( ) > index ) { return str . charAt ( index ) ; } return <NUM_LIT:0> ; } private PackageEntry findBestMatch ( String newName , boolean isStatic ) { if ( this . packageEntries . isEmpty ( ) ) { return null ; } String groupId = null ; int longestPrefix = - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < this . packageEntries . size ( ) ; i ++ ) { PackageEntry curr = ( PackageEntry ) this . packageEntries . get ( i ) ; if ( isStatic == curr . isStatic ( ) ) { String currGroup = curr . getGroupID ( ) ; if ( currGroup != null && newName . startsWith ( currGroup ) ) { int prefixLen = currGroup . length ( ) ; if ( prefixLen == newName . length ( ) ) { return curr ; } if ( ( newName . charAt ( prefixLen ) == '<CHAR_LIT:.>' || prefixLen == <NUM_LIT:0> ) && prefixLen > longestPrefix ) { longestPrefix = prefixLen ; groupId = currGroup ; } } } } PackageEntry bestMatch = null ; PackageMatcher matcher = new PackageMatcher ( ) ; matcher . initialize ( newName , "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> ; i < this . packageEntries . size ( ) ; i ++ ) { PackageEntry curr = ( PackageEntry ) this . packageEntries . get ( i ) ; if ( ! curr . isComment ( ) && curr . isStatic ( ) == isStatic ) { if ( groupId == null || groupId . equals ( curr . getGroupID ( ) ) ) { boolean preferrCurr = ( bestMatch == null ) || ( curr . getNumberOfImports ( ) > bestMatch . getNumberOfImports ( ) ) ; if ( matcher . isBetterMatch ( curr . getName ( ) , preferrCurr ) ) { bestMatch = curr ; } } } } return bestMatch ; } private boolean isImplicitImport ( String qualifier ) { if ( JAVA_LANG . equals ( qualifier ) ) { return true ; } ICompilationUnit cu = this . compilationUnit ; String packageName = cu . getParent ( ) . getElementName ( ) ; if ( qualifier . equals ( packageName ) ) { return true ; } String mainTypeName = JavaCore . removeJavaLikeExtension ( cu . getElementName ( ) ) ; if ( packageName . length ( ) == <NUM_LIT:0> ) { return qualifier . equals ( mainTypeName ) ; } return qualifier . equals ( packageName + '<CHAR_LIT:.>' + mainTypeName ) ; } public void addImport ( String fullTypeName , boolean isStatic ) { String typeContainerName = getQualifier ( fullTypeName , isStatic ) ; ImportDeclEntry decl = new ImportDeclEntry ( typeContainerName . length ( ) , fullTypeName , isStatic , null ) ; sortIn ( typeContainerName , decl , isStatic ) ; } public boolean removeImport ( String qualifiedName , boolean isStatic ) { String containerName = getQualifier ( qualifiedName , isStatic ) ; int nPackages = this . packageEntries . size ( ) ; for ( int i = <NUM_LIT:0> ; i < nPackages ; i ++ ) { PackageEntry entry = ( PackageEntry ) this . packageEntries . get ( i ) ; if ( entry . compareTo ( containerName , isStatic ) == <NUM_LIT:0> ) { if ( entry . remove ( qualifiedName , isStatic ) ) { return true ; } } } return false ; } private int getIndexAfterStatics ( ) { for ( int i = <NUM_LIT:0> ; i < this . packageEntries . size ( ) ; i ++ ) { if ( ! ( ( PackageEntry ) this . packageEntries . get ( i ) ) . isStatic ( ) ) { return i ; } } return this . packageEntries . size ( ) ; } private void sortIn ( String typeContainerName , ImportDeclEntry decl , boolean isStatic ) { PackageEntry bestMatch = findBestMatch ( typeContainerName , isStatic ) ; if ( bestMatch == null ) { PackageEntry packEntry = new PackageEntry ( typeContainerName , null , isStatic ) ; packEntry . add ( decl ) ; int insertPos = packEntry . isStatic ( ) ? <NUM_LIT:0> : getIndexAfterStatics ( ) ; this . packageEntries . add ( insertPos , packEntry ) ; } else { int cmp = typeContainerName . compareTo ( bestMatch . getName ( ) ) ; if ( cmp == <NUM_LIT:0> ) { bestMatch . sortIn ( decl ) ; } else { String group = bestMatch . getGroupID ( ) ; if ( group != null ) { if ( ! typeContainerName . startsWith ( group ) ) { group = null ; } } PackageEntry packEntry = new PackageEntry ( typeContainerName , group , isStatic ) ; packEntry . add ( decl ) ; int index = this . packageEntries . indexOf ( bestMatch ) ; if ( cmp < <NUM_LIT:0> ) { this . packageEntries . add ( index , packEntry ) ; } else { this . packageEntries . add ( index + <NUM_LIT:1> , packEntry ) ; } } } } private IRegion evaluateReplaceRange ( CompilationUnit root ) { List imports = root . imports ( ) ; if ( ! imports . isEmpty ( ) ) { ImportDeclaration first = ( ImportDeclaration ) imports . get ( <NUM_LIT:0> ) ; ImportDeclaration last = ( ImportDeclaration ) imports . get ( imports . size ( ) - <NUM_LIT:1> ) ; int startPos = first . getStartPosition ( ) ; int endPos = root . getExtendedStartPosition ( last ) + root . getExtendedLength ( last ) ; int endLine = root . getLineNumber ( endPos ) ; if ( endLine > <NUM_LIT:0> ) { int nextLinePos = root . getPosition ( endLine + <NUM_LIT:1> , <NUM_LIT:0> ) ; if ( nextLinePos >= <NUM_LIT:0> ) { int firstTypePos = getFirstTypeBeginPos ( root ) ; if ( firstTypePos != - <NUM_LIT:1> && firstTypePos < nextLinePos ) { endPos = firstTypePos ; } else { endPos = nextLinePos ; } } } return new Region ( startPos , endPos - startPos ) ; } else { int start = getPackageStatementEndPos ( root ) ; return new Region ( start , <NUM_LIT:0> ) ; } } public MultiTextEdit getResultingEdits ( IProgressMonitor monitor ) throws JavaModelException { if ( monitor == null ) { monitor = new NullProgressMonitor ( ) ; } try { int importsStart = this . replaceRange . getOffset ( ) ; int importsLen = this . replaceRange . getLength ( ) ; String lineDelim = this . compilationUnit . findRecommendedLineSeparator ( ) ; IBuffer buffer = this . compilationUnit . getBuffer ( ) ; int currPos = importsStart ; MultiTextEdit resEdit = new MultiTextEdit ( ) ; if ( ( this . flags & F_NEEDS_LEADING_DELIM ) != <NUM_LIT:0> ) { resEdit . addChild ( new InsertEdit ( currPos , lineDelim ) ) ; } PackageEntry lastPackage = null ; Set onDemandConflicts = null ; if ( this . findAmbiguousImports ) { onDemandConflicts = evaluateStarImportConflicts ( monitor ) ; } int spacesBetweenGroups = getSpacesBetweenImportGroups ( ) ; ArrayList stringsToInsert = new ArrayList ( ) ; int nPackageEntries = this . packageEntries . size ( ) ; for ( int i = <NUM_LIT:0> ; i < nPackageEntries ; i ++ ) { PackageEntry pack = ( PackageEntry ) this . packageEntries . get ( i ) ; if ( this . filterImplicitImports && ! pack . isStatic ( ) && isImplicitImport ( pack . getName ( ) ) ) { pack . filterImplicitImports ( this . useContextToFilterImplicitImports ) ; } int nImports = pack . getNumberOfImports ( ) ; if ( nImports == <NUM_LIT:0> ) { continue ; } if ( spacesBetweenGroups > <NUM_LIT:0> ) { if ( lastPackage != null && ! pack . isComment ( ) && ! pack . isSameGroup ( lastPackage ) ) { ImportDeclEntry last = lastPackage . getImportAt ( lastPackage . getNumberOfImports ( ) - <NUM_LIT:1> ) ; ImportDeclEntry first = pack . getImportAt ( <NUM_LIT:0> ) ; if ( ! lastPackage . isComment ( ) && ( last . isNew ( ) || first . isNew ( ) ) ) { for ( int k = spacesBetweenGroups ; k > <NUM_LIT:0> ; k -- ) { stringsToInsert . add ( lineDelim ) ; } } } } lastPackage = pack ; boolean isStatic = pack . isStatic ( ) ; int threshold = isStatic ? this . staticImportOnDemandThreshold : this . importOnDemandThreshold ; boolean doStarImport = pack . hasStarImport ( threshold , onDemandConflicts ) ; if ( doStarImport && ( pack . find ( "<STR_LIT:*>" ) == null ) ) { String [ ] imports = getNewImportStrings ( pack , isStatic , lineDelim ) ; for ( int j = <NUM_LIT:0> , max = imports . length ; j < max ; j ++ ) { stringsToInsert . add ( imports [ j ] ) ; } } for ( int k = <NUM_LIT:0> ; k < nImports ; k ++ ) { ImportDeclEntry currDecl = pack . getImportAt ( k ) ; IRegion region = currDecl . getSourceRange ( ) ; if ( region == null ) { if ( ! doStarImport || currDecl . isOnDemand ( ) || ( onDemandConflicts != null && onDemandConflicts . contains ( currDecl . getSimpleName ( ) ) ) ) { String str = getNewImportString ( currDecl . getElementName ( ) , isStatic , lineDelim ) ; stringsToInsert . add ( str ) ; } else if ( doStarImport && ! currDecl . isOnDemand ( ) ) { String simpleName = currDecl . getTypeQualifiedName ( ) ; if ( simpleName . indexOf ( '<CHAR_LIT:.>' ) != - <NUM_LIT:1> ) { String str = getNewImportString ( currDecl . getElementName ( ) , isStatic , lineDelim ) ; if ( stringsToInsert . indexOf ( str ) == - <NUM_LIT:1> ) { stringsToInsert . add ( str ) ; } } } } else if ( ! doStarImport || currDecl . isOnDemand ( ) || onDemandConflicts == null || onDemandConflicts . contains ( currDecl . getSimpleName ( ) ) ) { int offset = region . getOffset ( ) ; removeAndInsertNew ( buffer , currPos , offset , stringsToInsert , resEdit ) ; stringsToInsert . clear ( ) ; currPos = offset + region . getLength ( ) ; } else if ( doStarImport && ! currDecl . isOnDemand ( ) ) { String simpleName = currDecl . getTypeQualifiedName ( ) ; if ( simpleName . indexOf ( '<CHAR_LIT:.>' ) != - <NUM_LIT:1> ) { String str = getNewImportString ( currDecl . getElementName ( ) , isStatic , lineDelim ) ; if ( stringsToInsert . indexOf ( str ) == - <NUM_LIT:1> ) { stringsToInsert . add ( str ) ; } } } } } int end = importsStart + importsLen ; removeAndInsertNew ( buffer , currPos , end , stringsToInsert , resEdit ) ; if ( importsLen == <NUM_LIT:0> ) { if ( ! this . importsCreated . isEmpty ( ) || ! this . staticImportsCreated . isEmpty ( ) ) { if ( ( this . flags & F_NEEDS_TRAILING_DELIM ) != <NUM_LIT:0> ) { resEdit . addChild ( new InsertEdit ( currPos , lineDelim ) ) ; } } else { return new MultiTextEdit ( ) ; } } return resEdit ; } finally { monitor . done ( ) ; } } private void removeAndInsertNew ( IBuffer buffer , int contentOffset , int contentEnd , ArrayList stringsToInsert , MultiTextEdit resEdit ) { int pos = contentOffset ; for ( int i = <NUM_LIT:0> ; i < stringsToInsert . size ( ) ; i ++ ) { String curr = ( String ) stringsToInsert . get ( i ) ; int idx = findInBuffer ( buffer , curr , pos , contentEnd ) ; if ( idx != - <NUM_LIT:1> ) { if ( idx != pos ) { resEdit . addChild ( new DeleteEdit ( pos , idx - pos ) ) ; } pos = idx + curr . length ( ) ; } else { resEdit . addChild ( new InsertEdit ( pos , curr ) ) ; } } if ( pos < contentEnd ) { resEdit . addChild ( new DeleteEdit ( pos , contentEnd - pos ) ) ; } } private int findInBuffer ( IBuffer buffer , String str , int start , int end ) { int pos = start ; int len = str . length ( ) ; if ( pos + len > end || str . length ( ) == <NUM_LIT:0> ) { return - <NUM_LIT:1> ; } char first = str . charAt ( <NUM_LIT:0> ) ; int step = str . indexOf ( first , <NUM_LIT:1> ) ; if ( step == - <NUM_LIT:1> ) { step = len ; } while ( pos + len <= end ) { if ( buffer . getChar ( pos ) == first ) { int k = <NUM_LIT:1> ; while ( k < len && buffer . getChar ( pos + k ) == str . charAt ( k ) ) { k ++ ; } if ( k == len ) { return pos ; } if ( k < step ) { pos += k ; } else { pos += step ; } } else { pos ++ ; } } return - <NUM_LIT:1> ; } private Set evaluateStarImportConflicts ( IProgressMonitor monitor ) throws JavaModelException { final HashSet onDemandConflicts = new HashSet ( ) ; IJavaSearchScope scope = SearchEngine . createJavaSearchScope ( new IJavaElement [ ] { this . compilationUnit . getJavaProject ( ) } ) ; ArrayList starImportPackages = new ArrayList ( ) ; ArrayList simpleTypeNames = new ArrayList ( ) ; int nPackageEntries = this . packageEntries . size ( ) ; for ( int i = <NUM_LIT:0> ; i < nPackageEntries ; i ++ ) { PackageEntry pack = ( PackageEntry ) this . packageEntries . get ( i ) ; if ( ! pack . isStatic ( ) && pack . hasStarImport ( this . importOnDemandThreshold , null ) ) { starImportPackages . add ( pack . getName ( ) . toCharArray ( ) ) ; for ( int k = <NUM_LIT:0> ; k < pack . getNumberOfImports ( ) ; k ++ ) { ImportDeclEntry curr = pack . getImportAt ( k ) ; if ( ! curr . isOnDemand ( ) && ! curr . isComment ( ) ) { simpleTypeNames . add ( curr . getSimpleName ( ) . toCharArray ( ) ) ; } } } } if ( starImportPackages . isEmpty ( ) ) { return null ; } starImportPackages . add ( this . compilationUnit . getParent ( ) . getElementName ( ) . toCharArray ( ) ) ; starImportPackages . add ( JAVA_LANG . toCharArray ( ) ) ; char [ ] [ ] allPackages = ( char [ ] [ ] ) starImportPackages . toArray ( new char [ starImportPackages . size ( ) ] [ ] ) ; char [ ] [ ] allTypes = ( char [ ] [ ] ) simpleTypeNames . toArray ( new char [ simpleTypeNames . size ( ) ] [ ] ) ; TypeNameRequestor requestor = new TypeNameRequestor ( ) { HashMap foundTypes = new HashMap ( ) ; private String getTypeContainerName ( char [ ] packageName , char [ ] [ ] enclosingTypeNames ) { StringBuffer buf = new StringBuffer ( ) ; buf . append ( packageName ) ; for ( int i = <NUM_LIT:0> ; i < enclosingTypeNames . length ; i ++ ) { if ( buf . length ( ) > <NUM_LIT:0> ) buf . append ( '<CHAR_LIT:.>' ) ; buf . append ( enclosingTypeNames [ i ] ) ; } return buf . toString ( ) ; } public void acceptType ( int modifiers , char [ ] packageName , char [ ] simpleTypeName , char [ ] [ ] enclosingTypeNames , String path ) { String name = new String ( simpleTypeName ) ; String containerName = getTypeContainerName ( packageName , enclosingTypeNames ) ; String oldContainer = ( String ) this . foundTypes . put ( name , containerName ) ; if ( oldContainer != null && ! oldContainer . equals ( containerName ) ) { onDemandConflicts . add ( name ) ; } } } ; new SearchEngine ( ) . searchAllTypeNames ( allPackages , allTypes , scope , requestor , IJavaSearchConstants . WAIT_UNTIL_READY_TO_SEARCH , monitor ) ; return onDemandConflicts ; } private String getNewImportString ( String importName , boolean isStatic , String lineDelim ) { StringBuffer buf = new StringBuffer ( ) ; buf . append ( "<STR_LIT>" ) ; if ( isStatic ) { buf . append ( "<STR_LIT>" ) ; } buf . append ( importName ) ; if ( insertSpaceBeforeSemicolon ( ) ) buf . append ( '<CHAR_LIT:U+0020>' ) ; buf . append ( '<CHAR_LIT:;>' ) ; buf . append ( lineDelim ) ; if ( isStatic ) { this . staticImportsCreated . add ( importName ) ; } else { this . importsCreated . add ( importName ) ; } return buf . toString ( ) ; } private String [ ] getNewImportStrings ( PackageEntry packageEntry , boolean isStatic , String lineDelim ) { boolean isStarImportAdded = false ; List allImports = new ArrayList ( ) ; int nImports = packageEntry . getNumberOfImports ( ) ; for ( int i = <NUM_LIT:0> ; i < nImports ; i ++ ) { ImportDeclEntry curr = packageEntry . getImportAt ( i ) ; String simpleName = curr . getTypeQualifiedName ( ) ; if ( simpleName . indexOf ( '<CHAR_LIT:.>' ) != - <NUM_LIT:1> ) { allImports . add ( getNewImportString ( curr . getElementName ( ) , isStatic , lineDelim ) ) ; } else if ( ! isStarImportAdded ) { String starImportString = packageEntry . getName ( ) + "<STR_LIT>" ; allImports . add ( getNewImportString ( starImportString , isStatic , lineDelim ) ) ; isStarImportAdded = true ; } } return ( String [ ] ) allImports . toArray ( new String [ allImports . size ( ) ] ) ; } private static int getFirstTypeBeginPos ( CompilationUnit root ) { List types = root . types ( ) ; if ( ! types . isEmpty ( ) ) { return root . getExtendedStartPosition ( ( ( ASTNode ) types . get ( <NUM_LIT:0> ) ) ) ; } return - <NUM_LIT:1> ; } private int getPackageStatementEndPos ( CompilationUnit root ) { PackageDeclaration packDecl = root . getPackage ( ) ; if ( packDecl != null ) { int afterPackageStatementPos = - <NUM_LIT:1> ; int lineNumber = root . getLineNumber ( packDecl . getStartPosition ( ) + packDecl . getLength ( ) ) ; if ( lineNumber >= <NUM_LIT:0> ) { int lineAfterPackage = lineNumber + <NUM_LIT:1> ; afterPackageStatementPos = root . getPosition ( lineAfterPackage , <NUM_LIT:0> ) ; } if ( afterPackageStatementPos < <NUM_LIT:0> ) { this . flags |= F_NEEDS_LEADING_DELIM ; return packDecl . getStartPosition ( ) + packDecl . getLength ( ) ; } int firstTypePos = getFirstTypeBeginPos ( root ) ; if ( firstTypePos != - <NUM_LIT:1> && firstTypePos <= afterPackageStatementPos ) { this . flags |= F_NEEDS_TRAILING_DELIM ; if ( firstTypePos == afterPackageStatementPos ) { this . flags |= F_NEEDS_LEADING_DELIM ; } return firstTypePos ; } this . flags |= F_NEEDS_LEADING_DELIM ; return afterPackageStatementPos ; } this . flags |= F_NEEDS_TRAILING_DELIM ; return <NUM_LIT:0> ; } public String toString ( ) { int nPackages = this . packageEntries . size ( ) ; StringBuffer buf = new StringBuffer ( "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> ; i < nPackages ; i ++ ) { PackageEntry entry = ( PackageEntry ) this . packageEntries . get ( i ) ; if ( entry . isStatic ( ) ) { buf . append ( "<STR_LIT>" ) ; } buf . append ( entry . toString ( ) ) ; } return buf . toString ( ) ; } private static final class ImportDeclEntry { private String elementName ; private IRegion sourceRange ; private final boolean isStatic ; private int containerNameLength ; public ImportDeclEntry ( int containerNameLength , String elementName , boolean isStatic , IRegion sourceRange ) { this . elementName = elementName ; this . sourceRange = sourceRange ; this . isStatic = isStatic ; this . containerNameLength = containerNameLength ; } public String getElementName ( ) { return this . elementName ; } public int compareTo ( String fullName , boolean isStaticImport ) { int cmp = this . elementName . compareTo ( fullName ) ; if ( cmp == <NUM_LIT:0> ) { if ( this . isStatic == isStaticImport ) { return <NUM_LIT:0> ; } return this . isStatic ? - <NUM_LIT:1> : <NUM_LIT:1> ; } return cmp ; } public String getSimpleName ( ) { return Signature . getSimpleName ( this . elementName ) ; } public String getTypeQualifiedName ( ) { return this . elementName . substring ( this . containerNameLength + <NUM_LIT:1> ) ; } public boolean isOnDemand ( ) { return this . elementName != null && this . elementName . endsWith ( "<STR_LIT>" ) ; } public boolean isStatic ( ) { return this . isStatic ; } public boolean isNew ( ) { return this . sourceRange == null ; } public boolean isComment ( ) { return this . elementName == null ; } public IRegion getSourceRange ( ) { return this . sourceRange ; } } private final static class PackageEntry { private String name ; private ArrayList importEntries ; private String group ; private boolean isStatic ; public PackageEntry ( ) { this ( "<STR_LIT:!>" , null , false ) ; } public PackageEntry ( String name , String group , boolean isStatic ) { this . name = name ; this . importEntries = new ArrayList ( <NUM_LIT:5> ) ; this . group = group ; this . isStatic = isStatic ; } public boolean isStatic ( ) { return this . isStatic ; } public int compareTo ( String otherName , boolean isOtherStatic ) { int cmp = this . name . compareTo ( otherName ) ; if ( cmp == <NUM_LIT:0> ) { if ( this . isStatic == isOtherStatic ) { return <NUM_LIT:0> ; } return this . isStatic ? - <NUM_LIT:1> : <NUM_LIT:1> ; } return cmp ; } public void sortIn ( ImportDeclEntry imp ) { String fullImportName = imp . getElementName ( ) ; int insertPosition = - <NUM_LIT:1> ; int nInports = this . importEntries . size ( ) ; for ( int i = <NUM_LIT:0> ; i < nInports ; i ++ ) { ImportDeclEntry curr = getImportAt ( i ) ; if ( ! curr . isComment ( ) ) { int cmp = curr . compareTo ( fullImportName , imp . isStatic ( ) ) ; if ( cmp == <NUM_LIT:0> ) { return ; } else if ( cmp > <NUM_LIT:0> && insertPosition == - <NUM_LIT:1> ) { insertPosition = i ; } } } if ( insertPosition == - <NUM_LIT:1> ) { this . importEntries . add ( imp ) ; } else { this . importEntries . add ( insertPosition , imp ) ; } } public void add ( ImportDeclEntry imp ) { this . importEntries . add ( imp ) ; } public ImportDeclEntry find ( String simpleName ) { int nInports = this . importEntries . size ( ) ; for ( int i = <NUM_LIT:0> ; i < nInports ; i ++ ) { ImportDeclEntry curr = getImportAt ( i ) ; if ( ! curr . isComment ( ) ) { String currName = curr . getElementName ( ) ; if ( currName . endsWith ( simpleName ) ) { int dotPos = currName . length ( ) - simpleName . length ( ) - <NUM_LIT:1> ; if ( ( dotPos == - <NUM_LIT:1> ) || ( dotPos > <NUM_LIT:0> && currName . charAt ( dotPos ) == '<CHAR_LIT:.>' ) ) { return curr ; } } } } return null ; } public boolean remove ( String fullName , boolean isStaticImport ) { int nInports = this . importEntries . size ( ) ; for ( int i = <NUM_LIT:0> ; i < nInports ; i ++ ) { ImportDeclEntry curr = getImportAt ( i ) ; if ( ! curr . isComment ( ) && curr . compareTo ( fullName , isStaticImport ) == <NUM_LIT:0> ) { this . importEntries . remove ( i ) ; return true ; } } return false ; } public void filterImplicitImports ( boolean useContextToFilterImplicitImports ) { int nInports = this . importEntries . size ( ) ; for ( int i = nInports - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { ImportDeclEntry curr = getImportAt ( i ) ; if ( curr . isNew ( ) ) { if ( ! useContextToFilterImplicitImports ) { this . importEntries . remove ( i ) ; } else { String elementName = curr . getElementName ( ) ; int lastIndexOf = elementName . lastIndexOf ( '<CHAR_LIT:.>' ) ; boolean internalClassImport = lastIndexOf > getName ( ) . length ( ) ; if ( ! internalClassImport ) { this . importEntries . remove ( i ) ; } } } } } public ImportDeclEntry getImportAt ( int index ) { return ( ImportDeclEntry ) this . importEntries . get ( index ) ; } public boolean hasStarImport ( int threshold , Set explicitImports ) { if ( isComment ( ) || isDefaultPackage ( ) ) { return false ; } int nImports = getNumberOfImports ( ) ; int count = <NUM_LIT:0> ; boolean containsNew = false ; for ( int i = <NUM_LIT:0> ; i < nImports ; i ++ ) { ImportDeclEntry curr = getImportAt ( i ) ; if ( curr . isOnDemand ( ) ) { return true ; } if ( ! curr . isComment ( ) ) { count ++ ; boolean isExplicit = ! curr . isStatic ( ) && ( explicitImports != null ) && explicitImports . contains ( curr . getSimpleName ( ) ) ; containsNew |= curr . isNew ( ) && ! isExplicit ; } } return ( count >= threshold ) && containsNew ; } public int getNumberOfImports ( ) { return this . importEntries . size ( ) ; } public String getName ( ) { return this . name ; } public String getGroupID ( ) { return this . group ; } public void setGroupID ( String groupID ) { this . group = groupID ; } public boolean isSameGroup ( PackageEntry other ) { if ( this . group == null ) { return other . getGroupID ( ) == null ; } else { return this . group . equals ( other . getGroupID ( ) ) && ( this . isStatic == other . isStatic ( ) ) ; } } public boolean isComment ( ) { return "<STR_LIT:!>" . equals ( this . name ) ; } public boolean isDefaultPackage ( ) { return this . name . length ( ) == <NUM_LIT:0> ; } public String toString ( ) { StringBuffer buf = new StringBuffer ( ) ; if ( isComment ( ) ) { buf . append ( "<STR_LIT>" ) ; } else { buf . append ( this . name ) ; buf . append ( "<STR_LIT>" ) ; buf . append ( this . group ) ; buf . append ( "<STR_LIT:n>" ) ; int nImports = getNumberOfImports ( ) ; for ( int i = <NUM_LIT:0> ; i < nImports ; i ++ ) { ImportDeclEntry curr = getImportAt ( i ) ; buf . append ( "<STR_LIT:U+0020>" ) ; if ( curr . isStatic ( ) ) { buf . append ( "<STR_LIT>" ) ; } buf . append ( curr . getTypeQualifiedName ( ) ) ; if ( curr . isNew ( ) ) { buf . append ( "<STR_LIT>" ) ; } buf . append ( "<STR_LIT:n>" ) ; } } return buf . toString ( ) ; } } public String [ ] getCreatedImports ( ) { return ( String [ ] ) this . importsCreated . toArray ( new String [ this . importsCreated . size ( ) ] ) ; } public String [ ] getCreatedStaticImports ( ) { return ( String [ ] ) this . staticImportsCreated . toArray ( new String [ this . staticImportsCreated . size ( ) ] ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . core . dom . rewrite ; import java . util . Arrays ; import java . util . List ; import org . eclipse . jdt . core . dom . LineComment ; import org . eclipse . jdt . core . formatter . IndentManipulation ; import org . eclipse . jdt . internal . compiler . util . Util ; public class LineCommentEndOffsets { private int [ ] offsets ; private final List commentList ; public LineCommentEndOffsets ( List commentList ) { this . commentList = commentList ; this . offsets = null ; } private int [ ] getOffsets ( ) { if ( this . offsets == null ) { if ( this . commentList != null ) { int nComments = this . commentList . size ( ) ; int count = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < nComments ; i ++ ) { Object curr = this . commentList . get ( i ) ; if ( curr instanceof LineComment ) { count ++ ; } } this . offsets = new int [ count ] ; for ( int i = <NUM_LIT:0> , k = <NUM_LIT:0> ; i < nComments ; i ++ ) { Object curr = this . commentList . get ( i ) ; if ( curr instanceof LineComment ) { LineComment comment = ( LineComment ) curr ; this . offsets [ k ++ ] = comment . getStartPosition ( ) + comment . getLength ( ) ; } } } else { this . offsets = Util . EMPTY_INT_ARRAY ; } } return this . offsets ; } public boolean isEndOfLineComment ( int offset ) { return offset >= <NUM_LIT:0> && Arrays . binarySearch ( getOffsets ( ) , offset ) >= <NUM_LIT:0> ; } public boolean isEndOfLineComment ( int offset , char [ ] content ) { if ( offset < <NUM_LIT:0> || ( offset < content . length && ! IndentManipulation . isLineDelimiterChar ( content [ offset ] ) ) ) { return false ; } return Arrays . binarySearch ( getOffsets ( ) , offset ) >= <NUM_LIT:0> ; } public boolean remove ( int offset ) { int [ ] offsetArray = getOffsets ( ) ; int index = Arrays . binarySearch ( offsetArray , offset ) ; if ( index >= <NUM_LIT:0> ) { if ( index > <NUM_LIT:0> ) { System . arraycopy ( offsetArray , <NUM_LIT:0> , offsetArray , <NUM_LIT:1> , index ) ; } offsetArray [ <NUM_LIT:0> ] = - <NUM_LIT:1> ; return true ; } return false ; } } </s>
|
<s> package org . eclipse . jdt . internal . core . dom . rewrite ; import java . util . List ; import org . eclipse . jdt . core . dom . * ; import org . eclipse . jdt . internal . compiler . util . Util ; public class ASTRewriteFlattener extends ASTVisitor { static final int JLS2_INTERNAL = AST . JLS2 ; public static String asString ( ASTNode node , RewriteEventStore store ) { ASTRewriteFlattener flattener = new ASTRewriteFlattener ( store ) ; node . accept ( flattener ) ; return flattener . getResult ( ) ; } protected StringBuffer result ; private RewriteEventStore store ; public ASTRewriteFlattener ( RewriteEventStore store ) { this . store = store ; this . result = new StringBuffer ( ) ; } public String getResult ( ) { return new String ( this . result . toString ( ) ) ; } public void reset ( ) { this . result . setLength ( <NUM_LIT:0> ) ; } public static void printModifiers ( int modifiers , StringBuffer buf ) { if ( Modifier . isPublic ( modifiers ) ) { buf . append ( "<STR_LIT>" ) ; } if ( Modifier . isProtected ( modifiers ) ) { buf . append ( "<STR_LIT>" ) ; } if ( Modifier . isPrivate ( modifiers ) ) { buf . append ( "<STR_LIT>" ) ; } if ( Modifier . isStatic ( modifiers ) ) { buf . append ( "<STR_LIT>" ) ; } if ( Modifier . isAbstract ( modifiers ) ) { buf . append ( "<STR_LIT>" ) ; } if ( Modifier . isFinal ( modifiers ) ) { buf . append ( "<STR_LIT>" ) ; } if ( Modifier . isSynchronized ( modifiers ) ) { buf . append ( "<STR_LIT>" ) ; } if ( Modifier . isVolatile ( modifiers ) ) { buf . append ( "<STR_LIT>" ) ; } if ( Modifier . isNative ( modifiers ) ) { buf . append ( "<STR_LIT>" ) ; } if ( Modifier . isStrictfp ( modifiers ) ) { buf . append ( "<STR_LIT>" ) ; } if ( Modifier . isTransient ( modifiers ) ) { buf . append ( "<STR_LIT>" ) ; } } protected List getChildList ( ASTNode parent , StructuralPropertyDescriptor childProperty ) { return ( List ) getAttribute ( parent , childProperty ) ; } protected ASTNode getChildNode ( ASTNode parent , StructuralPropertyDescriptor childProperty ) { return ( ASTNode ) getAttribute ( parent , childProperty ) ; } protected int getIntAttribute ( ASTNode parent , StructuralPropertyDescriptor childProperty ) { return ( ( Integer ) getAttribute ( parent , childProperty ) ) . intValue ( ) ; } protected boolean getBooleanAttribute ( ASTNode parent , StructuralPropertyDescriptor childProperty ) { return ( ( Boolean ) getAttribute ( parent , childProperty ) ) . booleanValue ( ) ; } protected Object getAttribute ( ASTNode parent , StructuralPropertyDescriptor childProperty ) { return this . store . getNewValue ( parent , childProperty ) ; } protected void visitList ( ASTNode parent , StructuralPropertyDescriptor childProperty , String separator ) { List list = getChildList ( parent , childProperty ) ; for ( int i = <NUM_LIT:0> ; i < list . size ( ) ; i ++ ) { if ( separator != null && i > <NUM_LIT:0> ) { this . result . append ( separator ) ; } ( ( ASTNode ) list . get ( i ) ) . accept ( this ) ; } } protected void visitList ( ASTNode parent , StructuralPropertyDescriptor childProperty , String separator , String lead , String post ) { List list = getChildList ( parent , childProperty ) ; if ( ! list . isEmpty ( ) ) { this . result . append ( lead ) ; for ( int i = <NUM_LIT:0> ; i < list . size ( ) ; i ++ ) { if ( separator != null && i > <NUM_LIT:0> ) { this . result . append ( separator ) ; } ( ( ASTNode ) list . get ( i ) ) . accept ( this ) ; } this . result . append ( post ) ; } } public boolean visit ( AnonymousClassDeclaration node ) { this . result . append ( '<CHAR_LIT>' ) ; visitList ( node , AnonymousClassDeclaration . BODY_DECLARATIONS_PROPERTY , null ) ; this . result . append ( '<CHAR_LIT:}>' ) ; return false ; } public boolean visit ( ArrayAccess node ) { getChildNode ( node , ArrayAccess . ARRAY_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:[>' ) ; getChildNode ( node , ArrayAccess . INDEX_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:]>' ) ; return false ; } public boolean visit ( ArrayCreation node ) { this . result . append ( "<STR_LIT>" ) ; ArrayType arrayType = ( ArrayType ) getChildNode ( node , ArrayCreation . TYPE_PROPERTY ) ; Type elementType = ( Type ) getChildNode ( arrayType , ArrayType . COMPONENT_TYPE_PROPERTY ) ; int dimensions = <NUM_LIT:1> ; while ( elementType . isArrayType ( ) ) { dimensions ++ ; elementType = ( Type ) getChildNode ( elementType , ArrayType . COMPONENT_TYPE_PROPERTY ) ; } elementType . accept ( this ) ; List list = getChildList ( node , ArrayCreation . DIMENSIONS_PROPERTY ) ; for ( int i = <NUM_LIT:0> ; i < list . size ( ) ; i ++ ) { this . result . append ( '<CHAR_LIT:[>' ) ; ( ( ASTNode ) list . get ( i ) ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:]>' ) ; dimensions -- ; } for ( int i = <NUM_LIT:0> ; i < dimensions ; i ++ ) { this . result . append ( "<STR_LIT:[]>" ) ; } ASTNode initializer = getChildNode ( node , ArrayCreation . INITIALIZER_PROPERTY ) ; if ( initializer != null ) { getChildNode ( node , ArrayCreation . INITIALIZER_PROPERTY ) . accept ( this ) ; } return false ; } public boolean visit ( ArrayInitializer node ) { this . result . append ( '<CHAR_LIT>' ) ; visitList ( node , ArrayInitializer . EXPRESSIONS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) ) ; this . result . append ( '<CHAR_LIT:}>' ) ; return false ; } public boolean visit ( ArrayType node ) { getChildNode ( node , ArrayType . COMPONENT_TYPE_PROPERTY ) . accept ( this ) ; this . result . append ( "<STR_LIT:[]>" ) ; return false ; } public boolean visit ( AssertStatement node ) { this . result . append ( "<STR_LIT>" ) ; getChildNode ( node , AssertStatement . EXPRESSION_PROPERTY ) . accept ( this ) ; ASTNode message = getChildNode ( node , AssertStatement . MESSAGE_PROPERTY ) ; if ( message != null ) { this . result . append ( '<CHAR_LIT::>' ) ; message . accept ( this ) ; } this . result . append ( '<CHAR_LIT:;>' ) ; return false ; } public boolean visit ( Assignment node ) { getChildNode ( node , Assignment . LEFT_HAND_SIDE_PROPERTY ) . accept ( this ) ; this . result . append ( getAttribute ( node , Assignment . OPERATOR_PROPERTY ) . toString ( ) ) ; getChildNode ( node , Assignment . RIGHT_HAND_SIDE_PROPERTY ) . accept ( this ) ; return false ; } public boolean visit ( Block node ) { this . result . append ( '<CHAR_LIT>' ) ; visitList ( node , Block . STATEMENTS_PROPERTY , null ) ; this . result . append ( '<CHAR_LIT:}>' ) ; return false ; } public boolean visit ( BooleanLiteral node ) { if ( node . booleanValue ( ) == true ) { this . result . append ( "<STR_LIT:true>" ) ; } else { this . result . append ( "<STR_LIT:false>" ) ; } return false ; } public boolean visit ( BreakStatement node ) { this . result . append ( "<STR_LIT>" ) ; ASTNode label = getChildNode ( node , BreakStatement . LABEL_PROPERTY ) ; if ( label != null ) { this . result . append ( '<CHAR_LIT:U+0020>' ) ; label . accept ( this ) ; } this . result . append ( '<CHAR_LIT:;>' ) ; return false ; } public boolean visit ( CastExpression node ) { this . result . append ( '<CHAR_LIT:(>' ) ; getChildNode ( node , CastExpression . TYPE_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:)>' ) ; getChildNode ( node , CastExpression . EXPRESSION_PROPERTY ) . accept ( this ) ; return false ; } public boolean visit ( CatchClause node ) { this . result . append ( "<STR_LIT>" ) ; getChildNode ( node , CatchClause . EXCEPTION_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:)>' ) ; getChildNode ( node , CatchClause . BODY_PROPERTY ) . accept ( this ) ; return false ; } public boolean visit ( CharacterLiteral node ) { this . result . append ( getAttribute ( node , CharacterLiteral . ESCAPED_VALUE_PROPERTY ) ) ; return false ; } public boolean visit ( ClassInstanceCreation node ) { ASTNode expression = getChildNode ( node , ClassInstanceCreation . EXPRESSION_PROPERTY ) ; if ( expression != null ) { expression . accept ( this ) ; this . result . append ( '<CHAR_LIT:.>' ) ; } this . result . append ( "<STR_LIT>" ) ; if ( node . getAST ( ) . apiLevel ( ) == JLS2_INTERNAL ) { getChildNode ( node , ClassInstanceCreation . NAME_PROPERTY ) . accept ( this ) ; } else { visitList ( node , ClassInstanceCreation . TYPE_ARGUMENTS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) , String . valueOf ( '<CHAR_LIT>' ) , String . valueOf ( '<CHAR_LIT:>>' ) ) ; getChildNode ( node , ClassInstanceCreation . TYPE_PROPERTY ) . accept ( this ) ; } this . result . append ( '<CHAR_LIT:(>' ) ; visitList ( node , ClassInstanceCreation . ARGUMENTS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) ) ; this . result . append ( '<CHAR_LIT:)>' ) ; ASTNode decl = getChildNode ( node , ClassInstanceCreation . ANONYMOUS_CLASS_DECLARATION_PROPERTY ) ; if ( decl != null ) { decl . accept ( this ) ; } return false ; } public boolean visit ( CompilationUnit node ) { ASTNode pack = getChildNode ( node , CompilationUnit . PACKAGE_PROPERTY ) ; if ( pack != null ) { pack . accept ( this ) ; } visitList ( node , CompilationUnit . IMPORTS_PROPERTY , null ) ; visitList ( node , CompilationUnit . TYPES_PROPERTY , null ) ; return false ; } public boolean visit ( ConditionalExpression node ) { getChildNode ( node , ConditionalExpression . EXPRESSION_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT>' ) ; getChildNode ( node , ConditionalExpression . THEN_EXPRESSION_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT::>' ) ; getChildNode ( node , ConditionalExpression . ELSE_EXPRESSION_PROPERTY ) . accept ( this ) ; return false ; } public boolean visit ( ConstructorInvocation node ) { if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { visitList ( node , ConstructorInvocation . TYPE_ARGUMENTS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) , String . valueOf ( '<CHAR_LIT>' ) , String . valueOf ( '<CHAR_LIT:>>' ) ) ; } this . result . append ( "<STR_LIT>" ) ; visitList ( node , ConstructorInvocation . ARGUMENTS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) ) ; this . result . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( ContinueStatement node ) { this . result . append ( "<STR_LIT>" ) ; ASTNode label = getChildNode ( node , ContinueStatement . LABEL_PROPERTY ) ; if ( label != null ) { this . result . append ( '<CHAR_LIT:U+0020>' ) ; label . accept ( this ) ; } this . result . append ( '<CHAR_LIT:;>' ) ; return false ; } public boolean visit ( DoStatement node ) { this . result . append ( "<STR_LIT>" ) ; getChildNode ( node , DoStatement . BODY_PROPERTY ) . accept ( this ) ; this . result . append ( "<STR_LIT>" ) ; getChildNode ( node , DoStatement . EXPRESSION_PROPERTY ) . accept ( this ) ; this . result . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( EmptyStatement node ) { this . result . append ( '<CHAR_LIT:;>' ) ; return false ; } public boolean visit ( ExpressionStatement node ) { getChildNode ( node , ExpressionStatement . EXPRESSION_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:;>' ) ; return false ; } public boolean visit ( FieldAccess node ) { getChildNode ( node , FieldAccess . EXPRESSION_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:.>' ) ; getChildNode ( node , FieldAccess . NAME_PROPERTY ) . accept ( this ) ; return false ; } public boolean visit ( FieldDeclaration node ) { ASTNode javadoc = getChildNode ( node , FieldDeclaration . JAVADOC_PROPERTY ) ; if ( javadoc != null ) { javadoc . accept ( this ) ; } if ( node . getAST ( ) . apiLevel ( ) == JLS2_INTERNAL ) { printModifiers ( getIntAttribute ( node , FieldDeclaration . MODIFIERS_PROPERTY ) , this . result ) ; } else { visitList ( node , FieldDeclaration . MODIFIERS2_PROPERTY , String . valueOf ( '<CHAR_LIT:U+0020>' ) , Util . EMPTY_STRING , String . valueOf ( '<CHAR_LIT:U+0020>' ) ) ; } getChildNode ( node , FieldDeclaration . TYPE_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:U+0020>' ) ; visitList ( node , FieldDeclaration . FRAGMENTS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) ) ; this . result . append ( '<CHAR_LIT:;>' ) ; return false ; } public boolean visit ( ForStatement node ) { this . result . append ( "<STR_LIT>" ) ; visitList ( node , ForStatement . INITIALIZERS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) ) ; this . result . append ( '<CHAR_LIT:;>' ) ; ASTNode expression = getChildNode ( node , ForStatement . EXPRESSION_PROPERTY ) ; if ( expression != null ) { expression . accept ( this ) ; } this . result . append ( '<CHAR_LIT:;>' ) ; visitList ( node , ForStatement . UPDATERS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) ) ; this . result . append ( '<CHAR_LIT:)>' ) ; getChildNode ( node , ForStatement . BODY_PROPERTY ) . accept ( this ) ; return false ; } public boolean visit ( IfStatement node ) { this . result . append ( "<STR_LIT>" ) ; getChildNode ( node , IfStatement . EXPRESSION_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:)>' ) ; getChildNode ( node , IfStatement . THEN_STATEMENT_PROPERTY ) . accept ( this ) ; ASTNode elseStatement = getChildNode ( node , IfStatement . ELSE_STATEMENT_PROPERTY ) ; if ( elseStatement != null ) { this . result . append ( "<STR_LIT>" ) ; elseStatement . accept ( this ) ; } return false ; } public boolean visit ( ImportDeclaration node ) { this . result . append ( "<STR_LIT>" ) ; if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { if ( getBooleanAttribute ( node , ImportDeclaration . STATIC_PROPERTY ) ) { this . result . append ( "<STR_LIT>" ) ; } } getChildNode ( node , ImportDeclaration . NAME_PROPERTY ) . accept ( this ) ; if ( getBooleanAttribute ( node , ImportDeclaration . ON_DEMAND_PROPERTY ) ) { this . result . append ( "<STR_LIT>" ) ; } this . result . append ( '<CHAR_LIT:;>' ) ; return false ; } public boolean visit ( InfixExpression node ) { getChildNode ( node , InfixExpression . LEFT_OPERAND_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:U+0020>' ) ; String operator = getAttribute ( node , InfixExpression . OPERATOR_PROPERTY ) . toString ( ) ; this . result . append ( operator ) ; this . result . append ( '<CHAR_LIT:U+0020>' ) ; getChildNode ( node , InfixExpression . RIGHT_OPERAND_PROPERTY ) . accept ( this ) ; List list = getChildList ( node , InfixExpression . EXTENDED_OPERANDS_PROPERTY ) ; for ( int i = <NUM_LIT:0> ; i < list . size ( ) ; i ++ ) { this . result . append ( operator ) ; ( ( ASTNode ) list . get ( i ) ) . accept ( this ) ; } return false ; } public boolean visit ( InstanceofExpression node ) { getChildNode ( node , InstanceofExpression . LEFT_OPERAND_PROPERTY ) . accept ( this ) ; this . result . append ( "<STR_LIT>" ) ; getChildNode ( node , InstanceofExpression . RIGHT_OPERAND_PROPERTY ) . accept ( this ) ; return false ; } public boolean visit ( Initializer node ) { ASTNode javadoc = getChildNode ( node , Initializer . JAVADOC_PROPERTY ) ; if ( javadoc != null ) { javadoc . accept ( this ) ; } if ( node . getAST ( ) . apiLevel ( ) == JLS2_INTERNAL ) { printModifiers ( getIntAttribute ( node , Initializer . MODIFIERS_PROPERTY ) , this . result ) ; } else { visitList ( node , Initializer . MODIFIERS2_PROPERTY , String . valueOf ( '<CHAR_LIT:U+0020>' ) , Util . EMPTY_STRING , String . valueOf ( '<CHAR_LIT:U+0020>' ) ) ; } getChildNode ( node , Initializer . BODY_PROPERTY ) . accept ( this ) ; return false ; } public boolean visit ( Javadoc node ) { this . result . append ( "<STR_LIT>" ) ; List list = getChildList ( node , Javadoc . TAGS_PROPERTY ) ; for ( int i = <NUM_LIT:0> ; i < list . size ( ) ; i ++ ) { this . result . append ( "<STR_LIT>" ) ; ( ( ASTNode ) list . get ( i ) ) . accept ( this ) ; } this . result . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( LabeledStatement node ) { getChildNode ( node , LabeledStatement . LABEL_PROPERTY ) . accept ( this ) ; this . result . append ( "<STR_LIT::U+0020>" ) ; getChildNode ( node , LabeledStatement . BODY_PROPERTY ) . accept ( this ) ; return false ; } public boolean visit ( MethodDeclaration node ) { ASTNode javadoc = getChildNode ( node , MethodDeclaration . JAVADOC_PROPERTY ) ; if ( javadoc != null ) { javadoc . accept ( this ) ; } if ( node . getAST ( ) . apiLevel ( ) == JLS2_INTERNAL ) { printModifiers ( getIntAttribute ( node , MethodDeclaration . MODIFIERS_PROPERTY ) , this . result ) ; } else { visitList ( node , MethodDeclaration . MODIFIERS2_PROPERTY , String . valueOf ( '<CHAR_LIT:U+0020>' ) , Util . EMPTY_STRING , String . valueOf ( '<CHAR_LIT:U+0020>' ) ) ; visitList ( node , MethodDeclaration . TYPE_PARAMETERS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) , String . valueOf ( '<CHAR_LIT>' ) , String . valueOf ( '<CHAR_LIT:>>' ) ) ; } if ( ! getBooleanAttribute ( node , MethodDeclaration . CONSTRUCTOR_PROPERTY ) ) { if ( node . getAST ( ) . apiLevel ( ) == JLS2_INTERNAL ) { getChildNode ( node , MethodDeclaration . RETURN_TYPE_PROPERTY ) . accept ( this ) ; } else { ASTNode returnType = getChildNode ( node , MethodDeclaration . RETURN_TYPE2_PROPERTY ) ; if ( returnType != null ) { returnType . accept ( this ) ; } else { this . result . append ( "<STR_LIT>" ) ; } } this . result . append ( '<CHAR_LIT:U+0020>' ) ; } getChildNode ( node , MethodDeclaration . NAME_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:(>' ) ; visitList ( node , MethodDeclaration . PARAMETERS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) ) ; this . result . append ( '<CHAR_LIT:)>' ) ; int extraDims = getIntAttribute ( node , MethodDeclaration . EXTRA_DIMENSIONS_PROPERTY ) ; for ( int i = <NUM_LIT:0> ; i < extraDims ; i ++ ) { this . result . append ( "<STR_LIT:[]>" ) ; } visitList ( node , MethodDeclaration . THROWN_EXCEPTIONS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) , "<STR_LIT>" , Util . EMPTY_STRING ) ; ASTNode body = getChildNode ( node , MethodDeclaration . BODY_PROPERTY ) ; if ( body == null ) { this . result . append ( '<CHAR_LIT:;>' ) ; } else { body . accept ( this ) ; } return false ; } public boolean visit ( MethodInvocation node ) { ASTNode expression = getChildNode ( node , MethodInvocation . EXPRESSION_PROPERTY ) ; if ( expression != null ) { expression . accept ( this ) ; this . result . append ( '<CHAR_LIT:.>' ) ; } if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { visitList ( node , MethodInvocation . TYPE_ARGUMENTS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) , String . valueOf ( '<CHAR_LIT>' ) , String . valueOf ( '<CHAR_LIT:>>' ) ) ; } getChildNode ( node , MethodInvocation . NAME_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:(>' ) ; visitList ( node , MethodInvocation . ARGUMENTS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) ) ; this . result . append ( '<CHAR_LIT:)>' ) ; return false ; } public boolean visit ( NullLiteral node ) { this . result . append ( "<STR_LIT:null>" ) ; return false ; } public boolean visit ( NumberLiteral node ) { this . result . append ( getAttribute ( node , NumberLiteral . TOKEN_PROPERTY ) . toString ( ) ) ; return false ; } public boolean visit ( PackageDeclaration node ) { if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { ASTNode javadoc = getChildNode ( node , PackageDeclaration . JAVADOC_PROPERTY ) ; if ( javadoc != null ) { javadoc . accept ( this ) ; } visitList ( node , PackageDeclaration . ANNOTATIONS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+0020>' ) ) ; } this . result . append ( "<STR_LIT>" ) ; getChildNode ( node , PackageDeclaration . NAME_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:;>' ) ; return false ; } public boolean visit ( ParenthesizedExpression node ) { this . result . append ( '<CHAR_LIT:(>' ) ; getChildNode ( node , ParenthesizedExpression . EXPRESSION_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:)>' ) ; return false ; } public boolean visit ( PostfixExpression node ) { getChildNode ( node , PostfixExpression . OPERAND_PROPERTY ) . accept ( this ) ; this . result . append ( getAttribute ( node , PostfixExpression . OPERATOR_PROPERTY ) . toString ( ) ) ; return false ; } public boolean visit ( PrefixExpression node ) { this . result . append ( getAttribute ( node , PrefixExpression . OPERATOR_PROPERTY ) . toString ( ) ) ; getChildNode ( node , PrefixExpression . OPERAND_PROPERTY ) . accept ( this ) ; return false ; } public boolean visit ( PrimitiveType node ) { this . result . append ( getAttribute ( node , PrimitiveType . PRIMITIVE_TYPE_CODE_PROPERTY ) . toString ( ) ) ; return false ; } public boolean visit ( QualifiedName node ) { getChildNode ( node , QualifiedName . QUALIFIER_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:.>' ) ; getChildNode ( node , QualifiedName . NAME_PROPERTY ) . accept ( this ) ; return false ; } public boolean visit ( ReturnStatement node ) { this . result . append ( "<STR_LIT>" ) ; ASTNode expression = getChildNode ( node , ReturnStatement . EXPRESSION_PROPERTY ) ; if ( expression != null ) { this . result . append ( '<CHAR_LIT:U+0020>' ) ; expression . accept ( this ) ; } this . result . append ( '<CHAR_LIT:;>' ) ; return false ; } public boolean visit ( SimpleName node ) { this . result . append ( getAttribute ( node , SimpleName . IDENTIFIER_PROPERTY ) ) ; return false ; } public boolean visit ( SimpleType node ) { return true ; } public boolean visit ( SingleVariableDeclaration node ) { if ( node . getAST ( ) . apiLevel ( ) == JLS2_INTERNAL ) { printModifiers ( getIntAttribute ( node , SingleVariableDeclaration . MODIFIERS_PROPERTY ) , this . result ) ; } else { visitList ( node , SingleVariableDeclaration . MODIFIERS2_PROPERTY , String . valueOf ( '<CHAR_LIT:U+0020>' ) , Util . EMPTY_STRING , String . valueOf ( '<CHAR_LIT:U+0020>' ) ) ; } getChildNode ( node , SingleVariableDeclaration . TYPE_PROPERTY ) . accept ( this ) ; if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { if ( getBooleanAttribute ( node , SingleVariableDeclaration . VARARGS_PROPERTY ) ) { this . result . append ( "<STR_LIT:...>" ) ; } } this . result . append ( '<CHAR_LIT:U+0020>' ) ; getChildNode ( node , SingleVariableDeclaration . NAME_PROPERTY ) . accept ( this ) ; int extraDimensions = getIntAttribute ( node , SingleVariableDeclaration . EXTRA_DIMENSIONS_PROPERTY ) ; for ( int i = <NUM_LIT:0> ; i < extraDimensions ; i ++ ) { this . result . append ( "<STR_LIT:[]>" ) ; } ASTNode initializer = getChildNode ( node , SingleVariableDeclaration . INITIALIZER_PROPERTY ) ; if ( initializer != null ) { this . result . append ( '<CHAR_LIT:=>' ) ; initializer . accept ( this ) ; } return false ; } public boolean visit ( StringLiteral node ) { this . result . append ( getAttribute ( node , StringLiteral . ESCAPED_VALUE_PROPERTY ) ) ; return false ; } public boolean visit ( SuperConstructorInvocation node ) { ASTNode expression = getChildNode ( node , SuperConstructorInvocation . EXPRESSION_PROPERTY ) ; if ( expression != null ) { expression . accept ( this ) ; this . result . append ( '<CHAR_LIT:.>' ) ; } if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { visitList ( node , SuperConstructorInvocation . TYPE_ARGUMENTS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) , String . valueOf ( '<CHAR_LIT>' ) , String . valueOf ( '<CHAR_LIT:>>' ) ) ; } this . result . append ( "<STR_LIT>" ) ; visitList ( node , SuperConstructorInvocation . ARGUMENTS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) ) ; this . result . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( SuperFieldAccess node ) { ASTNode qualifier = getChildNode ( node , SuperFieldAccess . QUALIFIER_PROPERTY ) ; if ( qualifier != null ) { qualifier . accept ( this ) ; this . result . append ( '<CHAR_LIT:.>' ) ; } this . result . append ( "<STR_LIT>" ) ; getChildNode ( node , SuperFieldAccess . NAME_PROPERTY ) . accept ( this ) ; return false ; } public boolean visit ( SuperMethodInvocation node ) { ASTNode qualifier = getChildNode ( node , SuperMethodInvocation . QUALIFIER_PROPERTY ) ; if ( qualifier != null ) { qualifier . accept ( this ) ; this . result . append ( '<CHAR_LIT:.>' ) ; } this . result . append ( "<STR_LIT>" ) ; if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { visitList ( node , SuperMethodInvocation . TYPE_ARGUMENTS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) , String . valueOf ( '<CHAR_LIT>' ) , String . valueOf ( '<CHAR_LIT:>>' ) ) ; } getChildNode ( node , SuperMethodInvocation . NAME_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:(>' ) ; visitList ( node , SuperMethodInvocation . ARGUMENTS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) ) ; this . result . append ( '<CHAR_LIT:)>' ) ; return false ; } public boolean visit ( SwitchCase node ) { ASTNode expression = getChildNode ( node , SwitchCase . EXPRESSION_PROPERTY ) ; if ( expression == null ) { this . result . append ( "<STR_LIT:default>" ) ; } else { this . result . append ( "<STR_LIT>" ) ; expression . accept ( this ) ; } this . result . append ( '<CHAR_LIT::>' ) ; return false ; } public boolean visit ( SwitchStatement node ) { this . result . append ( "<STR_LIT>" ) ; getChildNode ( node , SwitchStatement . EXPRESSION_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:)>' ) ; this . result . append ( '<CHAR_LIT>' ) ; visitList ( node , SwitchStatement . STATEMENTS_PROPERTY , null ) ; this . result . append ( '<CHAR_LIT:}>' ) ; return false ; } public boolean visit ( SynchronizedStatement node ) { this . result . append ( "<STR_LIT>" ) ; getChildNode ( node , SynchronizedStatement . EXPRESSION_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:)>' ) ; getChildNode ( node , SynchronizedStatement . BODY_PROPERTY ) . accept ( this ) ; return false ; } public boolean visit ( ThisExpression node ) { ASTNode qualifier = getChildNode ( node , ThisExpression . QUALIFIER_PROPERTY ) ; if ( qualifier != null ) { qualifier . accept ( this ) ; this . result . append ( '<CHAR_LIT:.>' ) ; } this . result . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( ThrowStatement node ) { this . result . append ( "<STR_LIT>" ) ; getChildNode ( node , ThrowStatement . EXPRESSION_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:;>' ) ; return false ; } public boolean visit ( TryStatement node ) { this . result . append ( "<STR_LIT>" ) ; if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS4 ) { visitList ( node , TryStatement . RESOURCES_PROPERTY , String . valueOf ( '<CHAR_LIT:;>' ) , String . valueOf ( '<CHAR_LIT:(>' ) , String . valueOf ( '<CHAR_LIT:)>' ) ) ; } getChildNode ( node , TryStatement . BODY_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:U+0020>' ) ; visitList ( node , TryStatement . CATCH_CLAUSES_PROPERTY , null ) ; ASTNode finallyClause = getChildNode ( node , TryStatement . FINALLY_PROPERTY ) ; if ( finallyClause != null ) { this . result . append ( "<STR_LIT>" ) ; finallyClause . accept ( this ) ; } return false ; } public boolean visit ( TypeDeclaration node ) { int apiLevel = node . getAST ( ) . apiLevel ( ) ; ASTNode javadoc = getChildNode ( node , TypeDeclaration . JAVADOC_PROPERTY ) ; if ( javadoc != null ) { javadoc . accept ( this ) ; } if ( apiLevel == JLS2_INTERNAL ) { printModifiers ( getIntAttribute ( node , TypeDeclaration . MODIFIERS_PROPERTY ) , this . result ) ; } else { visitList ( node , TypeDeclaration . MODIFIERS2_PROPERTY , String . valueOf ( '<CHAR_LIT:U+0020>' ) , Util . EMPTY_STRING , String . valueOf ( '<CHAR_LIT:U+0020>' ) ) ; } boolean isInterface = getBooleanAttribute ( node , TypeDeclaration . INTERFACE_PROPERTY ) ; this . result . append ( isInterface ? "<STR_LIT>" : "<STR_LIT>" ) ; getChildNode ( node , TypeDeclaration . NAME_PROPERTY ) . accept ( this ) ; if ( apiLevel >= AST . JLS3 ) { visitList ( node , TypeDeclaration . TYPE_PARAMETERS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) , String . valueOf ( '<CHAR_LIT>' ) , String . valueOf ( '<CHAR_LIT:>>' ) ) ; } this . result . append ( '<CHAR_LIT:U+0020>' ) ; ChildPropertyDescriptor superClassProperty = ( apiLevel == JLS2_INTERNAL ) ? TypeDeclaration . SUPERCLASS_PROPERTY : TypeDeclaration . SUPERCLASS_TYPE_PROPERTY ; ASTNode superclass = getChildNode ( node , superClassProperty ) ; if ( superclass != null ) { this . result . append ( "<STR_LIT>" ) ; superclass . accept ( this ) ; this . result . append ( '<CHAR_LIT:U+0020>' ) ; } ChildListPropertyDescriptor superInterfaceProperty = ( apiLevel == JLS2_INTERNAL ) ? TypeDeclaration . SUPER_INTERFACES_PROPERTY : TypeDeclaration . SUPER_INTERFACE_TYPES_PROPERTY ; String lead = isInterface ? "<STR_LIT>" : "<STR_LIT>" ; visitList ( node , superInterfaceProperty , String . valueOf ( '<CHAR_LIT:U+002C>' ) , lead , Util . EMPTY_STRING ) ; this . result . append ( '<CHAR_LIT>' ) ; visitList ( node , TypeDeclaration . BODY_DECLARATIONS_PROPERTY , null ) ; this . result . append ( '<CHAR_LIT:}>' ) ; return false ; } public boolean visit ( TypeDeclarationStatement node ) { if ( node . getAST ( ) . apiLevel ( ) == JLS2_INTERNAL ) { getChildNode ( node , TypeDeclarationStatement . TYPE_DECLARATION_PROPERTY ) . accept ( this ) ; } else { getChildNode ( node , TypeDeclarationStatement . DECLARATION_PROPERTY ) . accept ( this ) ; } return false ; } public boolean visit ( TypeLiteral node ) { getChildNode ( node , TypeLiteral . TYPE_PROPERTY ) . accept ( this ) ; this . result . append ( "<STR_LIT:.class>" ) ; return false ; } public boolean visit ( UnionType node ) { visitList ( node , UnionType . TYPES_PROPERTY , "<STR_LIT>" , Util . EMPTY_STRING , Util . EMPTY_STRING ) ; return false ; } public boolean visit ( VariableDeclarationExpression node ) { if ( node . getAST ( ) . apiLevel ( ) == JLS2_INTERNAL ) { printModifiers ( getIntAttribute ( node , VariableDeclarationExpression . MODIFIERS_PROPERTY ) , this . result ) ; } else { visitList ( node , VariableDeclarationExpression . MODIFIERS2_PROPERTY , String . valueOf ( '<CHAR_LIT:U+0020>' ) , Util . EMPTY_STRING , String . valueOf ( '<CHAR_LIT:U+0020>' ) ) ; } getChildNode ( node , VariableDeclarationExpression . TYPE_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:U+0020>' ) ; visitList ( node , VariableDeclarationExpression . FRAGMENTS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) ) ; return false ; } public boolean visit ( VariableDeclarationFragment node ) { getChildNode ( node , VariableDeclarationFragment . NAME_PROPERTY ) . accept ( this ) ; int extraDimensions = getIntAttribute ( node , VariableDeclarationFragment . EXTRA_DIMENSIONS_PROPERTY ) ; for ( int i = <NUM_LIT:0> ; i < extraDimensions ; i ++ ) { this . result . append ( "<STR_LIT:[]>" ) ; } ASTNode initializer = getChildNode ( node , VariableDeclarationFragment . INITIALIZER_PROPERTY ) ; if ( initializer != null ) { this . result . append ( '<CHAR_LIT:=>' ) ; initializer . accept ( this ) ; } return false ; } public boolean visit ( VariableDeclarationStatement node ) { if ( node . getAST ( ) . apiLevel ( ) == JLS2_INTERNAL ) { printModifiers ( getIntAttribute ( node , VariableDeclarationStatement . MODIFIERS_PROPERTY ) , this . result ) ; } else { visitList ( node , VariableDeclarationStatement . MODIFIERS2_PROPERTY , String . valueOf ( '<CHAR_LIT:U+0020>' ) , Util . EMPTY_STRING , String . valueOf ( '<CHAR_LIT:U+0020>' ) ) ; } getChildNode ( node , VariableDeclarationStatement . TYPE_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:U+0020>' ) ; visitList ( node , VariableDeclarationStatement . FRAGMENTS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) ) ; this . result . append ( '<CHAR_LIT:;>' ) ; return false ; } public boolean visit ( WhileStatement node ) { this . result . append ( "<STR_LIT>" ) ; getChildNode ( node , WhileStatement . EXPRESSION_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:)>' ) ; getChildNode ( node , WhileStatement . BODY_PROPERTY ) . accept ( this ) ; return false ; } public boolean visit ( BlockComment node ) { return false ; } public boolean visit ( LineComment node ) { return false ; } public boolean visit ( MemberRef node ) { ASTNode qualifier = getChildNode ( node , MemberRef . QUALIFIER_PROPERTY ) ; if ( qualifier != null ) { qualifier . accept ( this ) ; } this . result . append ( '<CHAR_LIT>' ) ; getChildNode ( node , MemberRef . NAME_PROPERTY ) . accept ( this ) ; return false ; } public boolean visit ( MethodRef node ) { ASTNode qualifier = getChildNode ( node , MethodRef . QUALIFIER_PROPERTY ) ; if ( qualifier != null ) { qualifier . accept ( this ) ; } this . result . append ( '<CHAR_LIT>' ) ; getChildNode ( node , MethodRef . NAME_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:(>' ) ; visitList ( node , MethodRef . PARAMETERS_PROPERTY , "<STR_LIT:U+002C>" ) ; this . result . append ( '<CHAR_LIT:)>' ) ; return false ; } public boolean visit ( MethodRefParameter node ) { getChildNode ( node , MethodRefParameter . TYPE_PROPERTY ) . accept ( this ) ; if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { if ( getBooleanAttribute ( node , MethodRefParameter . VARARGS_PROPERTY ) ) { this . result . append ( "<STR_LIT:...>" ) ; } } ASTNode name = getChildNode ( node , MethodRefParameter . NAME_PROPERTY ) ; if ( name != null ) { this . result . append ( '<CHAR_LIT:U+0020>' ) ; name . accept ( this ) ; } return false ; } public boolean visit ( TagElement node ) { Object tagName = getAttribute ( node , TagElement . TAG_NAME_PROPERTY ) ; if ( tagName != null ) { this . result . append ( ( String ) tagName ) ; } List list = getChildList ( node , TagElement . FRAGMENTS_PROPERTY ) ; for ( int i = <NUM_LIT:0> ; i < list . size ( ) ; i ++ ) { if ( i > <NUM_LIT:0> || tagName != null ) { this . result . append ( '<CHAR_LIT:U+0020>' ) ; } ASTNode curr = ( ASTNode ) list . get ( i ) ; if ( curr instanceof TagElement ) { this . result . append ( '<CHAR_LIT>' ) ; curr . accept ( this ) ; this . result . append ( '<CHAR_LIT:}>' ) ; } else { curr . accept ( this ) ; } } return false ; } public boolean visit ( TextElement node ) { this . result . append ( getAttribute ( node , TextElement . TEXT_PROPERTY ) ) ; return false ; } public boolean visit ( AnnotationTypeDeclaration node ) { ASTNode javadoc = getChildNode ( node , AnnotationTypeDeclaration . JAVADOC_PROPERTY ) ; if ( javadoc != null ) { javadoc . accept ( this ) ; } visitList ( node , AnnotationTypeDeclaration . MODIFIERS2_PROPERTY , String . valueOf ( '<CHAR_LIT:U+0020>' ) , Util . EMPTY_STRING , String . valueOf ( '<CHAR_LIT:U+0020>' ) ) ; this . result . append ( "<STR_LIT>" ) ; getChildNode ( node , AnnotationTypeDeclaration . NAME_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT>' ) ; visitList ( node , AnnotationTypeDeclaration . BODY_DECLARATIONS_PROPERTY , Util . EMPTY_STRING ) ; this . result . append ( '<CHAR_LIT:}>' ) ; return false ; } public boolean visit ( AnnotationTypeMemberDeclaration node ) { ASTNode javadoc = getChildNode ( node , AnnotationTypeMemberDeclaration . JAVADOC_PROPERTY ) ; if ( javadoc != null ) { javadoc . accept ( this ) ; } visitList ( node , AnnotationTypeMemberDeclaration . MODIFIERS2_PROPERTY , String . valueOf ( '<CHAR_LIT:U+0020>' ) , Util . EMPTY_STRING , String . valueOf ( '<CHAR_LIT:U+0020>' ) ) ; getChildNode ( node , AnnotationTypeMemberDeclaration . TYPE_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:U+0020>' ) ; getChildNode ( node , AnnotationTypeMemberDeclaration . NAME_PROPERTY ) . accept ( this ) ; this . result . append ( "<STR_LIT>" ) ; ASTNode def = getChildNode ( node , AnnotationTypeMemberDeclaration . DEFAULT_PROPERTY ) ; if ( def != null ) { this . result . append ( "<STR_LIT>" ) ; def . accept ( this ) ; } this . result . append ( '<CHAR_LIT:;>' ) ; return false ; } public boolean visit ( EnhancedForStatement node ) { this . result . append ( "<STR_LIT>" ) ; getChildNode ( node , EnhancedForStatement . PARAMETER_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT::>' ) ; getChildNode ( node , EnhancedForStatement . EXPRESSION_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:)>' ) ; getChildNode ( node , EnhancedForStatement . BODY_PROPERTY ) . accept ( this ) ; return false ; } public boolean visit ( EnumConstantDeclaration node ) { ASTNode javadoc = getChildNode ( node , EnumConstantDeclaration . JAVADOC_PROPERTY ) ; if ( javadoc != null ) { javadoc . accept ( this ) ; } visitList ( node , EnumConstantDeclaration . MODIFIERS2_PROPERTY , String . valueOf ( '<CHAR_LIT:U+0020>' ) , Util . EMPTY_STRING , String . valueOf ( '<CHAR_LIT:U+0020>' ) ) ; getChildNode ( node , EnumConstantDeclaration . NAME_PROPERTY ) . accept ( this ) ; visitList ( node , EnumConstantDeclaration . ARGUMENTS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) , String . valueOf ( '<CHAR_LIT:(>' ) , String . valueOf ( '<CHAR_LIT:)>' ) ) ; ASTNode classDecl = getChildNode ( node , EnumConstantDeclaration . ANONYMOUS_CLASS_DECLARATION_PROPERTY ) ; if ( classDecl != null ) { classDecl . accept ( this ) ; } return false ; } public boolean visit ( EnumDeclaration node ) { ASTNode javadoc = getChildNode ( node , EnumDeclaration . JAVADOC_PROPERTY ) ; if ( javadoc != null ) { javadoc . accept ( this ) ; } visitList ( node , EnumDeclaration . MODIFIERS2_PROPERTY , String . valueOf ( '<CHAR_LIT:U+0020>' ) , Util . EMPTY_STRING , String . valueOf ( '<CHAR_LIT:U+0020>' ) ) ; this . result . append ( "<STR_LIT>" ) ; getChildNode ( node , EnumDeclaration . NAME_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:U+0020>' ) ; visitList ( node , EnumDeclaration . SUPER_INTERFACE_TYPES_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) , "<STR_LIT>" , Util . EMPTY_STRING ) ; this . result . append ( '<CHAR_LIT>' ) ; visitList ( node , EnumDeclaration . ENUM_CONSTANTS_PROPERTY , String . valueOf ( '<CHAR_LIT:U+002C>' ) , Util . EMPTY_STRING , Util . EMPTY_STRING ) ; visitList ( node , EnumDeclaration . BODY_DECLARATIONS_PROPERTY , Util . EMPTY_STRING , String . valueOf ( '<CHAR_LIT:;>' ) , Util . EMPTY_STRING ) ; this . result . append ( '<CHAR_LIT:}>' ) ; return false ; } public boolean visit ( MarkerAnnotation node ) { this . result . append ( '<CHAR_LIT>' ) ; getChildNode ( node , MarkerAnnotation . TYPE_NAME_PROPERTY ) . accept ( this ) ; return false ; } public boolean visit ( MemberValuePair node ) { getChildNode ( node , MemberValuePair . NAME_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:=>' ) ; getChildNode ( node , MemberValuePair . VALUE_PROPERTY ) . accept ( this ) ; return false ; } public boolean visit ( Modifier node ) { this . result . append ( getAttribute ( node , Modifier . KEYWORD_PROPERTY ) . toString ( ) ) ; return false ; } public boolean visit ( NormalAnnotation node ) { this . result . append ( '<CHAR_LIT>' ) ; getChildNode ( node , NormalAnnotation . TYPE_NAME_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:(>' ) ; visitList ( node , NormalAnnotation . VALUES_PROPERTY , "<STR_LIT:U+002CU+0020>" ) ; this . result . append ( '<CHAR_LIT:)>' ) ; return false ; } public boolean visit ( ParameterizedType node ) { getChildNode ( node , ParameterizedType . TYPE_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT>' ) ; visitList ( node , ParameterizedType . TYPE_ARGUMENTS_PROPERTY , "<STR_LIT:U+002CU+0020>" ) ; this . result . append ( '<CHAR_LIT:>>' ) ; return false ; } public boolean visit ( QualifiedType node ) { getChildNode ( node , QualifiedType . QUALIFIER_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:.>' ) ; getChildNode ( node , QualifiedType . NAME_PROPERTY ) . accept ( this ) ; return false ; } public boolean visit ( SingleMemberAnnotation node ) { this . result . append ( '<CHAR_LIT>' ) ; getChildNode ( node , SingleMemberAnnotation . TYPE_NAME_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:(>' ) ; getChildNode ( node , SingleMemberAnnotation . VALUE_PROPERTY ) . accept ( this ) ; this . result . append ( '<CHAR_LIT:)>' ) ; return false ; } public boolean visit ( TypeParameter node ) { getChildNode ( node , TypeParameter . NAME_PROPERTY ) . accept ( this ) ; visitList ( node , TypeParameter . TYPE_BOUNDS_PROPERTY , "<STR_LIT>" , "<STR_LIT>" , Util . EMPTY_STRING ) ; return false ; } public boolean visit ( WildcardType node ) { this . result . append ( '<CHAR_LIT>' ) ; ASTNode bound = getChildNode ( node , WildcardType . BOUND_PROPERTY ) ; if ( bound != null ) { if ( getBooleanAttribute ( node , WildcardType . UPPER_BOUND_PROPERTY ) ) { this . result . append ( "<STR_LIT>" ) ; } else { this . result . append ( "<STR_LIT>" ) ; } bound . accept ( this ) ; } return false ; } } </s>
|
<s> package org . eclipse . jdt . internal . core . dom ; import java . util . Iterator ; import java . util . List ; import org . eclipse . jdt . core . dom . AST ; import org . eclipse . jdt . core . dom . ASTNode ; import org . eclipse . jdt . core . dom . ASTVisitor ; import org . eclipse . jdt . core . dom . AbstractTypeDeclaration ; import org . eclipse . jdt . core . dom . Annotation ; import org . eclipse . jdt . core . dom . AnnotationTypeDeclaration ; import org . eclipse . jdt . core . dom . AnnotationTypeMemberDeclaration ; import org . eclipse . jdt . core . dom . AnonymousClassDeclaration ; import org . eclipse . jdt . core . dom . ArrayAccess ; import org . eclipse . jdt . core . dom . ArrayCreation ; import org . eclipse . jdt . core . dom . ArrayInitializer ; import org . eclipse . jdt . core . dom . ArrayType ; import org . eclipse . jdt . core . dom . AssertStatement ; import org . eclipse . jdt . core . dom . Assignment ; import org . eclipse . jdt . core . dom . Block ; import org . eclipse . jdt . core . dom . BlockComment ; import org . eclipse . jdt . core . dom . BodyDeclaration ; import org . eclipse . jdt . core . dom . BooleanLiteral ; import org . eclipse . jdt . core . dom . BreakStatement ; import org . eclipse . jdt . core . dom . CastExpression ; import org . eclipse . jdt . core . dom . CatchClause ; import org . eclipse . jdt . core . dom . CharacterLiteral ; import org . eclipse . jdt . core . dom . ClassInstanceCreation ; import org . eclipse . jdt . core . dom . CompilationUnit ; import org . eclipse . jdt . core . dom . ConditionalExpression ; import org . eclipse . jdt . core . dom . ConstructorInvocation ; import org . eclipse . jdt . core . dom . ContinueStatement ; import org . eclipse . jdt . core . dom . UnionType ; import org . eclipse . jdt . core . dom . DoStatement ; import org . eclipse . jdt . core . dom . EmptyStatement ; import org . eclipse . jdt . core . dom . EnhancedForStatement ; import org . eclipse . jdt . core . dom . EnumConstantDeclaration ; import org . eclipse . jdt . core . dom . EnumDeclaration ; import org . eclipse . jdt . core . dom . Expression ; import org . eclipse . jdt . core . dom . ExpressionStatement ; import org . eclipse . jdt . core . dom . FieldAccess ; import org . eclipse . jdt . core . dom . FieldDeclaration ; import org . eclipse . jdt . core . dom . ForStatement ; import org . eclipse . jdt . core . dom . IfStatement ; import org . eclipse . jdt . core . dom . ImportDeclaration ; import org . eclipse . jdt . core . dom . InfixExpression ; import org . eclipse . jdt . core . dom . Initializer ; import org . eclipse . jdt . core . dom . InstanceofExpression ; import org . eclipse . jdt . core . dom . Javadoc ; import org . eclipse . jdt . core . dom . LabeledStatement ; import org . eclipse . jdt . core . dom . LineComment ; import org . eclipse . jdt . core . dom . MarkerAnnotation ; import org . eclipse . jdt . core . dom . MemberRef ; import org . eclipse . jdt . core . dom . MemberValuePair ; import org . eclipse . jdt . core . dom . MethodDeclaration ; import org . eclipse . jdt . core . dom . MethodInvocation ; import org . eclipse . jdt . core . dom . MethodRef ; import org . eclipse . jdt . core . dom . MethodRefParameter ; import org . eclipse . jdt . core . dom . Modifier ; import org . eclipse . jdt . core . dom . Name ; import org . eclipse . jdt . core . dom . NormalAnnotation ; import org . eclipse . jdt . core . dom . NullLiteral ; import org . eclipse . jdt . core . dom . NumberLiteral ; import org . eclipse . jdt . core . dom . PackageDeclaration ; import org . eclipse . jdt . core . dom . ParameterizedType ; import org . eclipse . jdt . core . dom . ParenthesizedExpression ; import org . eclipse . jdt . core . dom . PostfixExpression ; import org . eclipse . jdt . core . dom . PrefixExpression ; import org . eclipse . jdt . core . dom . PrimitiveType ; import org . eclipse . jdt . core . dom . QualifiedName ; import org . eclipse . jdt . core . dom . QualifiedType ; import org . eclipse . jdt . core . dom . ReturnStatement ; import org . eclipse . jdt . core . dom . SimpleName ; import org . eclipse . jdt . core . dom . SimpleType ; import org . eclipse . jdt . core . dom . SingleMemberAnnotation ; import org . eclipse . jdt . core . dom . SingleVariableDeclaration ; import org . eclipse . jdt . core . dom . Statement ; import org . eclipse . jdt . core . dom . StringLiteral ; import org . eclipse . jdt . core . dom . SuperConstructorInvocation ; import org . eclipse . jdt . core . dom . SuperFieldAccess ; import org . eclipse . jdt . core . dom . SuperMethodInvocation ; import org . eclipse . jdt . core . dom . SwitchCase ; import org . eclipse . jdt . core . dom . SwitchStatement ; import org . eclipse . jdt . core . dom . SynchronizedStatement ; import org . eclipse . jdt . core . dom . TagElement ; import org . eclipse . jdt . core . dom . TextElement ; import org . eclipse . jdt . core . dom . ThisExpression ; import org . eclipse . jdt . core . dom . ThrowStatement ; import org . eclipse . jdt . core . dom . TryStatement ; import org . eclipse . jdt . core . dom . Type ; import org . eclipse . jdt . core . dom . TypeDeclaration ; import org . eclipse . jdt . core . dom . TypeDeclarationStatement ; import org . eclipse . jdt . core . dom . TypeLiteral ; import org . eclipse . jdt . core . dom . TypeParameter ; import org . eclipse . jdt . core . dom . VariableDeclarationExpression ; import org . eclipse . jdt . core . dom . VariableDeclarationFragment ; import org . eclipse . jdt . core . dom . VariableDeclarationStatement ; import org . eclipse . jdt . core . dom . WhileStatement ; import org . eclipse . jdt . core . dom . WildcardType ; public class NaiveASTFlattener extends ASTVisitor { private static final int JLS2 = AST . JLS2 ; protected StringBuffer buffer ; private int indent = <NUM_LIT:0> ; public NaiveASTFlattener ( ) { this . buffer = new StringBuffer ( ) ; } private Name getName ( ClassInstanceCreation node ) { return node . getName ( ) ; } public String getResult ( ) { return this . buffer . toString ( ) ; } private Type getReturnType ( MethodDeclaration node ) { return node . getReturnType ( ) ; } private Name getSuperclass ( TypeDeclaration node ) { return node . getSuperclass ( ) ; } private TypeDeclaration getTypeDeclaration ( TypeDeclarationStatement node ) { return node . getTypeDeclaration ( ) ; } void printIndent ( ) { for ( int i = <NUM_LIT:0> ; i < this . indent ; i ++ ) this . buffer . append ( "<STR_LIT:U+0020U+0020>" ) ; } void printModifiers ( int modifiers ) { if ( Modifier . isPublic ( modifiers ) ) { this . buffer . append ( "<STR_LIT>" ) ; } if ( Modifier . isProtected ( modifiers ) ) { this . buffer . append ( "<STR_LIT>" ) ; } if ( Modifier . isPrivate ( modifiers ) ) { this . buffer . append ( "<STR_LIT>" ) ; } if ( Modifier . isStatic ( modifiers ) ) { this . buffer . append ( "<STR_LIT>" ) ; } if ( Modifier . isAbstract ( modifiers ) ) { this . buffer . append ( "<STR_LIT>" ) ; } if ( Modifier . isFinal ( modifiers ) ) { this . buffer . append ( "<STR_LIT>" ) ; } if ( Modifier . isSynchronized ( modifiers ) ) { this . buffer . append ( "<STR_LIT>" ) ; } if ( Modifier . isVolatile ( modifiers ) ) { this . buffer . append ( "<STR_LIT>" ) ; } if ( Modifier . isNative ( modifiers ) ) { this . buffer . append ( "<STR_LIT>" ) ; } if ( Modifier . isStrictfp ( modifiers ) ) { this . buffer . append ( "<STR_LIT>" ) ; } if ( Modifier . isTransient ( modifiers ) ) { this . buffer . append ( "<STR_LIT>" ) ; } } void printModifiers ( List ext ) { for ( Iterator it = ext . iterator ( ) ; it . hasNext ( ) ; ) { ASTNode p = ( ASTNode ) it . next ( ) ; p . accept ( this ) ; this . buffer . append ( "<STR_LIT:U+0020>" ) ; } } public void reset ( ) { this . buffer . setLength ( <NUM_LIT:0> ) ; } private List superInterfaces ( TypeDeclaration node ) { return node . superInterfaces ( ) ; } public boolean visit ( AnnotationTypeDeclaration node ) { if ( node . getJavadoc ( ) != null ) { node . getJavadoc ( ) . accept ( this ) ; } printIndent ( ) ; printModifiers ( node . modifiers ( ) ) ; this . buffer . append ( "<STR_LIT>" ) ; node . getName ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT>" ) ; for ( Iterator it = node . bodyDeclarations ( ) . iterator ( ) ; it . hasNext ( ) ; ) { BodyDeclaration d = ( BodyDeclaration ) it . next ( ) ; d . accept ( this ) ; } this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( AnnotationTypeMemberDeclaration node ) { if ( node . getJavadoc ( ) != null ) { node . getJavadoc ( ) . accept ( this ) ; } printIndent ( ) ; printModifiers ( node . modifiers ( ) ) ; node . getType ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:U+0020>" ) ; node . getName ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT>" ) ; if ( node . getDefault ( ) != null ) { this . buffer . append ( "<STR_LIT>" ) ; node . getDefault ( ) . accept ( this ) ; } this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( AnonymousClassDeclaration node ) { this . buffer . append ( "<STR_LIT>" ) ; this . indent ++ ; for ( Iterator it = node . bodyDeclarations ( ) . iterator ( ) ; it . hasNext ( ) ; ) { BodyDeclaration b = ( BodyDeclaration ) it . next ( ) ; b . accept ( this ) ; } this . indent -- ; printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( ArrayAccess node ) { node . getArray ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:[>" ) ; node . getIndex ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:]>" ) ; return false ; } public boolean visit ( ArrayCreation node ) { this . buffer . append ( "<STR_LIT>" ) ; ArrayType at = node . getType ( ) ; int dims = at . getDimensions ( ) ; Type elementType = at . getElementType ( ) ; elementType . accept ( this ) ; for ( Iterator it = node . dimensions ( ) . iterator ( ) ; it . hasNext ( ) ; ) { this . buffer . append ( "<STR_LIT:[>" ) ; Expression e = ( Expression ) it . next ( ) ; e . accept ( this ) ; this . buffer . append ( "<STR_LIT:]>" ) ; dims -- ; } for ( int i = <NUM_LIT:0> ; i < dims ; i ++ ) { this . buffer . append ( "<STR_LIT:[]>" ) ; } if ( node . getInitializer ( ) != null ) { node . getInitializer ( ) . accept ( this ) ; } return false ; } public boolean visit ( ArrayInitializer node ) { this . buffer . append ( "<STR_LIT:{>" ) ; for ( Iterator it = node . expressions ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Expression e = ( Expression ) it . next ( ) ; e . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002C>" ) ; } } this . buffer . append ( "<STR_LIT:}>" ) ; return false ; } public boolean visit ( ArrayType node ) { node . getComponentType ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:[]>" ) ; return false ; } public boolean visit ( AssertStatement node ) { printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; node . getExpression ( ) . accept ( this ) ; if ( node . getMessage ( ) != null ) { this . buffer . append ( "<STR_LIT:U+0020:U+0020>" ) ; node . getMessage ( ) . accept ( this ) ; } this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( Assignment node ) { node . getLeftHandSide ( ) . accept ( this ) ; this . buffer . append ( node . getOperator ( ) . toString ( ) ) ; node . getRightHandSide ( ) . accept ( this ) ; return false ; } public boolean visit ( Block node ) { this . buffer . append ( "<STR_LIT>" ) ; this . indent ++ ; for ( Iterator it = node . statements ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Statement s = ( Statement ) it . next ( ) ; s . accept ( this ) ; } this . indent -- ; printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( BlockComment node ) { printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( BooleanLiteral node ) { if ( node . booleanValue ( ) == true ) { this . buffer . append ( "<STR_LIT:true>" ) ; } else { this . buffer . append ( "<STR_LIT:false>" ) ; } return false ; } public boolean visit ( BreakStatement node ) { printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; if ( node . getLabel ( ) != null ) { this . buffer . append ( "<STR_LIT:U+0020>" ) ; node . getLabel ( ) . accept ( this ) ; } this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( CastExpression node ) { this . buffer . append ( "<STR_LIT:(>" ) ; node . getType ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:)>" ) ; node . getExpression ( ) . accept ( this ) ; return false ; } public boolean visit ( CatchClause node ) { this . buffer . append ( "<STR_LIT>" ) ; node . getException ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT>" ) ; node . getBody ( ) . accept ( this ) ; return false ; } public boolean visit ( CharacterLiteral node ) { this . buffer . append ( node . getEscapedValue ( ) ) ; return false ; } public boolean visit ( ClassInstanceCreation node ) { if ( node . getExpression ( ) != null ) { node . getExpression ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:.>" ) ; } this . buffer . append ( "<STR_LIT>" ) ; if ( node . getAST ( ) . apiLevel ( ) == JLS2 ) { getName ( node ) . accept ( this ) ; } if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { if ( ! node . typeArguments ( ) . isEmpty ( ) ) { this . buffer . append ( "<STR_LIT:<>" ) ; for ( Iterator it = node . typeArguments ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Type t = ( Type ) it . next ( ) ; t . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002C>" ) ; } } this . buffer . append ( "<STR_LIT:>>" ) ; } node . getType ( ) . accept ( this ) ; } this . buffer . append ( "<STR_LIT:(>" ) ; for ( Iterator it = node . arguments ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Expression e = ( Expression ) it . next ( ) ; e . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002C>" ) ; } } this . buffer . append ( "<STR_LIT:)>" ) ; if ( node . getAnonymousClassDeclaration ( ) != null ) { node . getAnonymousClassDeclaration ( ) . accept ( this ) ; } return false ; } public boolean visit ( CompilationUnit node ) { if ( node . getPackage ( ) != null ) { node . getPackage ( ) . accept ( this ) ; } for ( Iterator it = node . imports ( ) . iterator ( ) ; it . hasNext ( ) ; ) { ImportDeclaration d = ( ImportDeclaration ) it . next ( ) ; d . accept ( this ) ; } for ( Iterator it = node . types ( ) . iterator ( ) ; it . hasNext ( ) ; ) { AbstractTypeDeclaration d = ( AbstractTypeDeclaration ) it . next ( ) ; d . accept ( this ) ; } return false ; } public boolean visit ( ConditionalExpression node ) { node . getExpression ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT>" ) ; node . getThenExpression ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:U+0020:U+0020>" ) ; node . getElseExpression ( ) . accept ( this ) ; return false ; } public boolean visit ( ConstructorInvocation node ) { printIndent ( ) ; if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { if ( ! node . typeArguments ( ) . isEmpty ( ) ) { this . buffer . append ( "<STR_LIT:<>" ) ; for ( Iterator it = node . typeArguments ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Type t = ( Type ) it . next ( ) ; t . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002C>" ) ; } } this . buffer . append ( "<STR_LIT:>>" ) ; } } this . buffer . append ( "<STR_LIT>" ) ; for ( Iterator it = node . arguments ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Expression e = ( Expression ) it . next ( ) ; e . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002C>" ) ; } } this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( ContinueStatement node ) { printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; if ( node . getLabel ( ) != null ) { this . buffer . append ( "<STR_LIT:U+0020>" ) ; node . getLabel ( ) . accept ( this ) ; } this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( DoStatement node ) { printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; node . getBody ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT>" ) ; node . getExpression ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( EmptyStatement node ) { printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( EnhancedForStatement node ) { printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; node . getParameter ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:U+0020:U+0020>" ) ; node . getExpression ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT>" ) ; node . getBody ( ) . accept ( this ) ; return false ; } public boolean visit ( EnumConstantDeclaration node ) { if ( node . getJavadoc ( ) != null ) { node . getJavadoc ( ) . accept ( this ) ; } printIndent ( ) ; printModifiers ( node . modifiers ( ) ) ; node . getName ( ) . accept ( this ) ; if ( ! node . arguments ( ) . isEmpty ( ) ) { this . buffer . append ( "<STR_LIT:(>" ) ; for ( Iterator it = node . arguments ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Expression e = ( Expression ) it . next ( ) ; e . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002C>" ) ; } } this . buffer . append ( "<STR_LIT:)>" ) ; } if ( node . getAnonymousClassDeclaration ( ) != null ) { node . getAnonymousClassDeclaration ( ) . accept ( this ) ; } return false ; } public boolean visit ( EnumDeclaration node ) { if ( node . getJavadoc ( ) != null ) { node . getJavadoc ( ) . accept ( this ) ; } printIndent ( ) ; printModifiers ( node . modifiers ( ) ) ; this . buffer . append ( "<STR_LIT>" ) ; node . getName ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:U+0020>" ) ; if ( ! node . superInterfaceTypes ( ) . isEmpty ( ) ) { this . buffer . append ( "<STR_LIT>" ) ; for ( Iterator it = node . superInterfaceTypes ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Type t = ( Type ) it . next ( ) ; t . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } } this . buffer . append ( "<STR_LIT:U+0020>" ) ; } this . buffer . append ( "<STR_LIT:{>" ) ; for ( Iterator it = node . enumConstants ( ) . iterator ( ) ; it . hasNext ( ) ; ) { EnumConstantDeclaration d = ( EnumConstantDeclaration ) it . next ( ) ; d . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } } if ( ! node . bodyDeclarations ( ) . isEmpty ( ) ) { this . buffer . append ( "<STR_LIT:;U+0020>" ) ; for ( Iterator it = node . bodyDeclarations ( ) . iterator ( ) ; it . hasNext ( ) ; ) { BodyDeclaration d = ( BodyDeclaration ) it . next ( ) ; d . accept ( this ) ; } } this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( ExpressionStatement node ) { printIndent ( ) ; node . getExpression ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( FieldAccess node ) { node . getExpression ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:.>" ) ; node . getName ( ) . accept ( this ) ; return false ; } public boolean visit ( FieldDeclaration node ) { if ( node . getJavadoc ( ) != null ) { node . getJavadoc ( ) . accept ( this ) ; } printIndent ( ) ; if ( node . getAST ( ) . apiLevel ( ) == JLS2 ) { printModifiers ( node . getModifiers ( ) ) ; } if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { printModifiers ( node . modifiers ( ) ) ; } node . getType ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:U+0020>" ) ; for ( Iterator it = node . fragments ( ) . iterator ( ) ; it . hasNext ( ) ; ) { VariableDeclarationFragment f = ( VariableDeclarationFragment ) it . next ( ) ; f . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } } this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( ForStatement node ) { printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; for ( Iterator it = node . initializers ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Expression e = ( Expression ) it . next ( ) ; e . accept ( this ) ; if ( it . hasNext ( ) ) this . buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } this . buffer . append ( "<STR_LIT:;U+0020>" ) ; if ( node . getExpression ( ) != null ) { node . getExpression ( ) . accept ( this ) ; } this . buffer . append ( "<STR_LIT:;U+0020>" ) ; for ( Iterator it = node . updaters ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Expression e = ( Expression ) it . next ( ) ; e . accept ( this ) ; if ( it . hasNext ( ) ) this . buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } this . buffer . append ( "<STR_LIT>" ) ; node . getBody ( ) . accept ( this ) ; return false ; } public boolean visit ( IfStatement node ) { printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; node . getExpression ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT>" ) ; node . getThenStatement ( ) . accept ( this ) ; if ( node . getElseStatement ( ) != null ) { this . buffer . append ( "<STR_LIT>" ) ; node . getElseStatement ( ) . accept ( this ) ; } return false ; } public boolean visit ( ImportDeclaration node ) { printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { if ( node . isStatic ( ) ) { this . buffer . append ( "<STR_LIT>" ) ; } } node . getName ( ) . accept ( this ) ; if ( node . isOnDemand ( ) ) { this . buffer . append ( "<STR_LIT>" ) ; } this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( InfixExpression node ) { node . getLeftOperand ( ) . accept ( this ) ; this . buffer . append ( '<CHAR_LIT:U+0020>' ) ; this . buffer . append ( node . getOperator ( ) . toString ( ) ) ; this . buffer . append ( '<CHAR_LIT:U+0020>' ) ; node . getRightOperand ( ) . accept ( this ) ; final List extendedOperands = node . extendedOperands ( ) ; if ( extendedOperands . size ( ) != <NUM_LIT:0> ) { this . buffer . append ( '<CHAR_LIT:U+0020>' ) ; for ( Iterator it = extendedOperands . iterator ( ) ; it . hasNext ( ) ; ) { this . buffer . append ( node . getOperator ( ) . toString ( ) ) . append ( '<CHAR_LIT:U+0020>' ) ; Expression e = ( Expression ) it . next ( ) ; e . accept ( this ) ; } } return false ; } public boolean visit ( Initializer node ) { if ( node . getJavadoc ( ) != null ) { node . getJavadoc ( ) . accept ( this ) ; } if ( node . getAST ( ) . apiLevel ( ) == JLS2 ) { printModifiers ( node . getModifiers ( ) ) ; } if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { printModifiers ( node . modifiers ( ) ) ; } node . getBody ( ) . accept ( this ) ; return false ; } public boolean visit ( InstanceofExpression node ) { node . getLeftOperand ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT>" ) ; node . getRightOperand ( ) . accept ( this ) ; return false ; } public boolean visit ( Javadoc node ) { printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; for ( Iterator it = node . tags ( ) . iterator ( ) ; it . hasNext ( ) ; ) { ASTNode e = ( ASTNode ) it . next ( ) ; e . accept ( this ) ; } this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( LabeledStatement node ) { printIndent ( ) ; node . getLabel ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT::U+0020>" ) ; node . getBody ( ) . accept ( this ) ; return false ; } public boolean visit ( LineComment node ) { this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( MarkerAnnotation node ) { this . buffer . append ( "<STR_LIT:@>" ) ; node . getTypeName ( ) . accept ( this ) ; return false ; } public boolean visit ( MemberRef node ) { if ( node . getQualifier ( ) != null ) { node . getQualifier ( ) . accept ( this ) ; } this . buffer . append ( "<STR_LIT:#>" ) ; node . getName ( ) . accept ( this ) ; return false ; } public boolean visit ( MemberValuePair node ) { node . getName ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:=>" ) ; node . getValue ( ) . accept ( this ) ; return false ; } public boolean visit ( MethodDeclaration node ) { if ( node . getJavadoc ( ) != null ) { node . getJavadoc ( ) . accept ( this ) ; } printIndent ( ) ; if ( node . getAST ( ) . apiLevel ( ) == JLS2 ) { printModifiers ( node . getModifiers ( ) ) ; } if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { printModifiers ( node . modifiers ( ) ) ; if ( ! node . typeParameters ( ) . isEmpty ( ) ) { this . buffer . append ( "<STR_LIT:<>" ) ; for ( Iterator it = node . typeParameters ( ) . iterator ( ) ; it . hasNext ( ) ; ) { TypeParameter t = ( TypeParameter ) it . next ( ) ; t . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002C>" ) ; } } this . buffer . append ( "<STR_LIT:>>" ) ; } } if ( ! node . isConstructor ( ) ) { if ( node . getAST ( ) . apiLevel ( ) == JLS2 ) { getReturnType ( node ) . accept ( this ) ; } else { if ( node . getReturnType2 ( ) != null ) { node . getReturnType2 ( ) . accept ( this ) ; } else { this . buffer . append ( "<STR_LIT>" ) ; } } this . buffer . append ( "<STR_LIT:U+0020>" ) ; } node . getName ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:(>" ) ; for ( Iterator it = node . parameters ( ) . iterator ( ) ; it . hasNext ( ) ; ) { SingleVariableDeclaration v = ( SingleVariableDeclaration ) it . next ( ) ; v . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002C>" ) ; } } this . buffer . append ( "<STR_LIT:)>" ) ; for ( int i = <NUM_LIT:0> ; i < node . getExtraDimensions ( ) ; i ++ ) { this . buffer . append ( "<STR_LIT:[]>" ) ; } if ( ! node . thrownExceptions ( ) . isEmpty ( ) ) { this . buffer . append ( "<STR_LIT>" ) ; for ( Iterator it = node . thrownExceptions ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Name n = ( Name ) it . next ( ) ; n . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } } this . buffer . append ( "<STR_LIT:U+0020>" ) ; } if ( node . getBody ( ) == null ) { this . buffer . append ( "<STR_LIT>" ) ; } else { node . getBody ( ) . accept ( this ) ; } return false ; } public boolean visit ( MethodInvocation node ) { if ( node . getExpression ( ) != null ) { node . getExpression ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:.>" ) ; } if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { if ( ! node . typeArguments ( ) . isEmpty ( ) ) { this . buffer . append ( "<STR_LIT:<>" ) ; for ( Iterator it = node . typeArguments ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Type t = ( Type ) it . next ( ) ; t . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002C>" ) ; } } this . buffer . append ( "<STR_LIT:>>" ) ; } } node . getName ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:(>" ) ; for ( Iterator it = node . arguments ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Expression e = ( Expression ) it . next ( ) ; e . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002C>" ) ; } } this . buffer . append ( "<STR_LIT:)>" ) ; return false ; } public boolean visit ( MethodRef node ) { if ( node . getQualifier ( ) != null ) { node . getQualifier ( ) . accept ( this ) ; } this . buffer . append ( "<STR_LIT:#>" ) ; node . getName ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:(>" ) ; for ( Iterator it = node . parameters ( ) . iterator ( ) ; it . hasNext ( ) ; ) { MethodRefParameter e = ( MethodRefParameter ) it . next ( ) ; e . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002C>" ) ; } } this . buffer . append ( "<STR_LIT:)>" ) ; return false ; } public boolean visit ( MethodRefParameter node ) { node . getType ( ) . accept ( this ) ; if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { if ( node . isVarargs ( ) ) { this . buffer . append ( "<STR_LIT:...>" ) ; } } if ( node . getName ( ) != null ) { this . buffer . append ( "<STR_LIT:U+0020>" ) ; node . getName ( ) . accept ( this ) ; } return false ; } public boolean visit ( Modifier node ) { this . buffer . append ( node . getKeyword ( ) . toString ( ) ) ; return false ; } public boolean visit ( NormalAnnotation node ) { this . buffer . append ( "<STR_LIT:@>" ) ; node . getTypeName ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:(>" ) ; for ( Iterator it = node . values ( ) . iterator ( ) ; it . hasNext ( ) ; ) { MemberValuePair p = ( MemberValuePair ) it . next ( ) ; p . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002C>" ) ; } } this . buffer . append ( "<STR_LIT:)>" ) ; return false ; } public boolean visit ( NullLiteral node ) { this . buffer . append ( "<STR_LIT:null>" ) ; return false ; } public boolean visit ( NumberLiteral node ) { this . buffer . append ( node . getToken ( ) ) ; return false ; } public boolean visit ( PackageDeclaration node ) { if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { if ( node . getJavadoc ( ) != null ) { node . getJavadoc ( ) . accept ( this ) ; } for ( Iterator it = node . annotations ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Annotation p = ( Annotation ) it . next ( ) ; p . accept ( this ) ; this . buffer . append ( "<STR_LIT:U+0020>" ) ; } } printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; node . getName ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( ParameterizedType node ) { node . getType ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:<>" ) ; for ( Iterator it = node . typeArguments ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Type t = ( Type ) it . next ( ) ; t . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002C>" ) ; } } this . buffer . append ( "<STR_LIT:>>" ) ; return false ; } public boolean visit ( ParenthesizedExpression node ) { this . buffer . append ( "<STR_LIT:(>" ) ; node . getExpression ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:)>" ) ; return false ; } public boolean visit ( PostfixExpression node ) { node . getOperand ( ) . accept ( this ) ; this . buffer . append ( node . getOperator ( ) . toString ( ) ) ; return false ; } public boolean visit ( PrefixExpression node ) { this . buffer . append ( node . getOperator ( ) . toString ( ) ) ; node . getOperand ( ) . accept ( this ) ; return false ; } public boolean visit ( PrimitiveType node ) { this . buffer . append ( node . getPrimitiveTypeCode ( ) . toString ( ) ) ; return false ; } public boolean visit ( QualifiedName node ) { node . getQualifier ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:.>" ) ; node . getName ( ) . accept ( this ) ; return false ; } public boolean visit ( QualifiedType node ) { node . getQualifier ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:.>" ) ; node . getName ( ) . accept ( this ) ; return false ; } public boolean visit ( ReturnStatement node ) { printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; if ( node . getExpression ( ) != null ) { this . buffer . append ( "<STR_LIT:U+0020>" ) ; node . getExpression ( ) . accept ( this ) ; } this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( SimpleName node ) { this . buffer . append ( node . getIdentifier ( ) ) ; return false ; } public boolean visit ( SimpleType node ) { return true ; } public boolean visit ( SingleMemberAnnotation node ) { this . buffer . append ( "<STR_LIT:@>" ) ; node . getTypeName ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:(>" ) ; node . getValue ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:)>" ) ; return false ; } public boolean visit ( SingleVariableDeclaration node ) { printIndent ( ) ; if ( node . getAST ( ) . apiLevel ( ) == JLS2 ) { printModifiers ( node . getModifiers ( ) ) ; } if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { printModifiers ( node . modifiers ( ) ) ; } node . getType ( ) . accept ( this ) ; if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { if ( node . isVarargs ( ) ) { this . buffer . append ( "<STR_LIT:...>" ) ; } } this . buffer . append ( "<STR_LIT:U+0020>" ) ; node . getName ( ) . accept ( this ) ; for ( int i = <NUM_LIT:0> ; i < node . getExtraDimensions ( ) ; i ++ ) { this . buffer . append ( "<STR_LIT:[]>" ) ; } if ( node . getInitializer ( ) != null ) { this . buffer . append ( "<STR_LIT:=>" ) ; node . getInitializer ( ) . accept ( this ) ; } return false ; } public boolean visit ( StringLiteral node ) { this . buffer . append ( node . getEscapedValue ( ) ) ; return false ; } public boolean visit ( SuperConstructorInvocation node ) { printIndent ( ) ; if ( node . getExpression ( ) != null ) { node . getExpression ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:.>" ) ; } if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { if ( ! node . typeArguments ( ) . isEmpty ( ) ) { this . buffer . append ( "<STR_LIT:<>" ) ; for ( Iterator it = node . typeArguments ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Type t = ( Type ) it . next ( ) ; t . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002C>" ) ; } } this . buffer . append ( "<STR_LIT:>>" ) ; } } this . buffer . append ( "<STR_LIT>" ) ; for ( Iterator it = node . arguments ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Expression e = ( Expression ) it . next ( ) ; e . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002C>" ) ; } } this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( SuperFieldAccess node ) { if ( node . getQualifier ( ) != null ) { node . getQualifier ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:.>" ) ; } this . buffer . append ( "<STR_LIT>" ) ; node . getName ( ) . accept ( this ) ; return false ; } public boolean visit ( SuperMethodInvocation node ) { if ( node . getQualifier ( ) != null ) { node . getQualifier ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:.>" ) ; } this . buffer . append ( "<STR_LIT>" ) ; if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { if ( ! node . typeArguments ( ) . isEmpty ( ) ) { this . buffer . append ( "<STR_LIT:<>" ) ; for ( Iterator it = node . typeArguments ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Type t = ( Type ) it . next ( ) ; t . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002C>" ) ; } } this . buffer . append ( "<STR_LIT:>>" ) ; } } node . getName ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:(>" ) ; for ( Iterator it = node . arguments ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Expression e = ( Expression ) it . next ( ) ; e . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002C>" ) ; } } this . buffer . append ( "<STR_LIT:)>" ) ; return false ; } public boolean visit ( SwitchCase node ) { if ( node . isDefault ( ) ) { this . buffer . append ( "<STR_LIT>" ) ; } else { this . buffer . append ( "<STR_LIT>" ) ; node . getExpression ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT>" ) ; } this . indent ++ ; return false ; } public boolean visit ( SwitchStatement node ) { this . buffer . append ( "<STR_LIT>" ) ; node . getExpression ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT>" ) ; this . buffer . append ( "<STR_LIT>" ) ; this . indent ++ ; for ( Iterator it = node . statements ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Statement s = ( Statement ) it . next ( ) ; s . accept ( this ) ; this . indent -- ; } this . indent -- ; printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( SynchronizedStatement node ) { this . buffer . append ( "<STR_LIT>" ) ; node . getExpression ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT>" ) ; node . getBody ( ) . accept ( this ) ; return false ; } public boolean visit ( TagElement node ) { if ( node . isNested ( ) ) { this . buffer . append ( "<STR_LIT:{>" ) ; } else { this . buffer . append ( "<STR_LIT>" ) ; } boolean previousRequiresWhiteSpace = false ; if ( node . getTagName ( ) != null ) { this . buffer . append ( node . getTagName ( ) ) ; previousRequiresWhiteSpace = true ; } boolean previousRequiresNewLine = false ; for ( Iterator it = node . fragments ( ) . iterator ( ) ; it . hasNext ( ) ; ) { ASTNode e = ( ASTNode ) it . next ( ) ; boolean currentIncludesWhiteSpace = ( e instanceof TextElement ) ; if ( previousRequiresNewLine && currentIncludesWhiteSpace ) { this . buffer . append ( "<STR_LIT>" ) ; } previousRequiresNewLine = currentIncludesWhiteSpace ; if ( previousRequiresWhiteSpace && ! currentIncludesWhiteSpace ) { this . buffer . append ( "<STR_LIT:U+0020>" ) ; } e . accept ( this ) ; previousRequiresWhiteSpace = ! currentIncludesWhiteSpace && ! ( e instanceof TagElement ) ; } if ( node . isNested ( ) ) { this . buffer . append ( "<STR_LIT:}>" ) ; } return false ; } public boolean visit ( TextElement node ) { this . buffer . append ( node . getText ( ) ) ; return false ; } public boolean visit ( ThisExpression node ) { if ( node . getQualifier ( ) != null ) { node . getQualifier ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:.>" ) ; } this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( ThrowStatement node ) { printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; node . getExpression ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( TryStatement node ) { printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; List resources = node . resources ( ) ; if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS4 ) { if ( ! node . resources ( ) . isEmpty ( ) ) { this . buffer . append ( '<CHAR_LIT:(>' ) ; for ( Iterator it = resources . iterator ( ) ; it . hasNext ( ) ; ) { VariableDeclarationExpression variable = ( VariableDeclarationExpression ) it . next ( ) ; variable . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( '<CHAR_LIT:;>' ) ; } } this . buffer . append ( '<CHAR_LIT:)>' ) ; } } node . getBody ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:U+0020>" ) ; for ( Iterator it = node . catchClauses ( ) . iterator ( ) ; it . hasNext ( ) ; ) { CatchClause cc = ( CatchClause ) it . next ( ) ; cc . accept ( this ) ; } if ( node . getFinally ( ) != null ) { this . buffer . append ( "<STR_LIT>" ) ; node . getFinally ( ) . accept ( this ) ; } return false ; } public boolean visit ( TypeDeclaration node ) { if ( node . getJavadoc ( ) != null ) { node . getJavadoc ( ) . accept ( this ) ; } if ( node . getAST ( ) . apiLevel ( ) == JLS2 ) { printModifiers ( node . getModifiers ( ) ) ; } if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { printModifiers ( node . modifiers ( ) ) ; } this . buffer . append ( node . isInterface ( ) ? "<STR_LIT>" : "<STR_LIT>" ) ; node . getName ( ) . accept ( this ) ; if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { if ( ! node . typeParameters ( ) . isEmpty ( ) ) { this . buffer . append ( "<STR_LIT:<>" ) ; for ( Iterator it = node . typeParameters ( ) . iterator ( ) ; it . hasNext ( ) ; ) { TypeParameter t = ( TypeParameter ) it . next ( ) ; t . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002C>" ) ; } } this . buffer . append ( "<STR_LIT:>>" ) ; } } this . buffer . append ( "<STR_LIT:U+0020>" ) ; if ( node . getAST ( ) . apiLevel ( ) == JLS2 ) { if ( getSuperclass ( node ) != null ) { this . buffer . append ( "<STR_LIT>" ) ; getSuperclass ( node ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:U+0020>" ) ; } if ( ! superInterfaces ( node ) . isEmpty ( ) ) { this . buffer . append ( node . isInterface ( ) ? "<STR_LIT>" : "<STR_LIT>" ) ; for ( Iterator it = superInterfaces ( node ) . iterator ( ) ; it . hasNext ( ) ; ) { Name n = ( Name ) it . next ( ) ; n . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } } this . buffer . append ( "<STR_LIT:U+0020>" ) ; } } if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { if ( node . getSuperclassType ( ) != null ) { this . buffer . append ( "<STR_LIT>" ) ; node . getSuperclassType ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:U+0020>" ) ; } if ( ! node . superInterfaceTypes ( ) . isEmpty ( ) ) { this . buffer . append ( node . isInterface ( ) ? "<STR_LIT>" : "<STR_LIT>" ) ; for ( Iterator it = node . superInterfaceTypes ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Type t = ( Type ) it . next ( ) ; t . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } } this . buffer . append ( "<STR_LIT:U+0020>" ) ; } } this . buffer . append ( "<STR_LIT>" ) ; this . indent ++ ; for ( Iterator it = node . bodyDeclarations ( ) . iterator ( ) ; it . hasNext ( ) ; ) { BodyDeclaration d = ( BodyDeclaration ) it . next ( ) ; d . accept ( this ) ; } this . indent -- ; printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( TypeDeclarationStatement node ) { if ( node . getAST ( ) . apiLevel ( ) == JLS2 ) { getTypeDeclaration ( node ) . accept ( this ) ; } if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { node . getDeclaration ( ) . accept ( this ) ; } return false ; } public boolean visit ( TypeLiteral node ) { node . getType ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:.class>" ) ; return false ; } public boolean visit ( TypeParameter node ) { node . getName ( ) . accept ( this ) ; if ( ! node . typeBounds ( ) . isEmpty ( ) ) { this . buffer . append ( "<STR_LIT>" ) ; for ( Iterator it = node . typeBounds ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Type t = ( Type ) it . next ( ) ; t . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT>" ) ; } } } return false ; } public boolean visit ( UnionType node ) { for ( Iterator it = node . types ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Type t = ( Type ) it . next ( ) ; t . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( '<CHAR_LIT>' ) ; } } return false ; } public boolean visit ( VariableDeclarationExpression node ) { if ( node . getAST ( ) . apiLevel ( ) == JLS2 ) { printModifiers ( node . getModifiers ( ) ) ; } if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { printModifiers ( node . modifiers ( ) ) ; } node . getType ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:U+0020>" ) ; for ( Iterator it = node . fragments ( ) . iterator ( ) ; it . hasNext ( ) ; ) { VariableDeclarationFragment f = ( VariableDeclarationFragment ) it . next ( ) ; f . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } } return false ; } public boolean visit ( VariableDeclarationFragment node ) { node . getName ( ) . accept ( this ) ; for ( int i = <NUM_LIT:0> ; i < node . getExtraDimensions ( ) ; i ++ ) { this . buffer . append ( "<STR_LIT:[]>" ) ; } if ( node . getInitializer ( ) != null ) { this . buffer . append ( "<STR_LIT:=>" ) ; node . getInitializer ( ) . accept ( this ) ; } return false ; } public boolean visit ( VariableDeclarationStatement node ) { printIndent ( ) ; if ( node . getAST ( ) . apiLevel ( ) == JLS2 ) { printModifiers ( node . getModifiers ( ) ) ; } if ( node . getAST ( ) . apiLevel ( ) >= AST . JLS3 ) { printModifiers ( node . modifiers ( ) ) ; } node . getType ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT:U+0020>" ) ; for ( Iterator it = node . fragments ( ) . iterator ( ) ; it . hasNext ( ) ; ) { VariableDeclarationFragment f = ( VariableDeclarationFragment ) it . next ( ) ; f . accept ( this ) ; if ( it . hasNext ( ) ) { this . buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } } this . buffer . append ( "<STR_LIT>" ) ; return false ; } public boolean visit ( WhileStatement node ) { printIndent ( ) ; this . buffer . append ( "<STR_LIT>" ) ; node . getExpression ( ) . accept ( this ) ; this . buffer . append ( "<STR_LIT>" ) ; node . getBody ( ) . accept ( this ) ; return false ; } public boolean visit ( WildcardType node ) { this . buffer . append ( "<STR_LIT:?>" ) ; Type bound = node . getBound ( ) ; if ( bound != null ) { if ( node . isUpperBound ( ) ) { this . buffer . append ( "<STR_LIT>" ) ; } else { this . buffer . append ( "<STR_LIT>" ) ; } bound . accept ( this ) ; } return false ; } } </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 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 ; public final class SimplePropertyDescriptor extends StructuralPropertyDescriptor { private final Class valueType ; private final boolean mandatory ; SimplePropertyDescriptor ( Class nodeClass , String propertyId , Class valueType , boolean mandatory ) { super ( nodeClass , propertyId ) ; if ( valueType == null || ASTNode . class . isAssignableFrom ( valueType ) ) { throw new IllegalArgumentException ( ) ; } this . valueType = valueType ; this . mandatory = mandatory ; } public Class getValueType ( ) { return this . valueType ; } public boolean isMandatory ( ) { return this . mandatory ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; public class SingleVariableDeclaration extends VariableDeclaration { public static final SimplePropertyDescriptor MODIFIERS_PROPERTY = new SimplePropertyDescriptor ( SingleVariableDeclaration . class , "<STR_LIT>" , int . class , MANDATORY ) ; public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY = new ChildListPropertyDescriptor ( SingleVariableDeclaration . class , "<STR_LIT>" , IExtendedModifier . class , CYCLE_RISK ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( SingleVariableDeclaration . class , "<STR_LIT:name>" , SimpleName . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor ( SingleVariableDeclaration . class , "<STR_LIT:type>" , Type . class , MANDATORY , NO_CYCLE_RISK ) ; public static final SimplePropertyDescriptor VARARGS_PROPERTY = new SimplePropertyDescriptor ( SingleVariableDeclaration . class , "<STR_LIT>" , boolean . class , MANDATORY ) ; public static final SimplePropertyDescriptor EXTRA_DIMENSIONS_PROPERTY = new SimplePropertyDescriptor ( SingleVariableDeclaration . class , "<STR_LIT>" , int . class , MANDATORY ) ; public static final ChildPropertyDescriptor INITIALIZER_PROPERTY = new ChildPropertyDescriptor ( SingleVariableDeclaration . class , "<STR_LIT>" , Expression . class , OPTIONAL , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS_2_0 ; private static final List PROPERTY_DESCRIPTORS_3_0 ; static { List propertyList = new ArrayList ( <NUM_LIT:6> ) ; createPropertyList ( SingleVariableDeclaration . class , propertyList ) ; addProperty ( MODIFIERS_PROPERTY , propertyList ) ; addProperty ( TYPE_PROPERTY , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; addProperty ( EXTRA_DIMENSIONS_PROPERTY , propertyList ) ; addProperty ( INITIALIZER_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( propertyList ) ; propertyList = new ArrayList ( <NUM_LIT:7> ) ; createPropertyList ( SingleVariableDeclaration . class , propertyList ) ; addProperty ( MODIFIERS2_PROPERTY , propertyList ) ; addProperty ( TYPE_PROPERTY , propertyList ) ; addProperty ( VARARGS_PROPERTY , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; addProperty ( EXTRA_DIMENSIONS_PROPERTY , propertyList ) ; addProperty ( INITIALIZER_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_3_0 = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { if ( apiLevel == AST . JLS2_INTERNAL ) { return PROPERTY_DESCRIPTORS_2_0 ; } else { return PROPERTY_DESCRIPTORS_3_0 ; } } private ASTNode . NodeList modifiers = null ; private int modifierFlags = Modifier . NONE ; private SimpleName variableName = null ; private Type type = null ; private boolean variableArity = false ; private int extraArrayDimensions = <NUM_LIT:0> ; private Expression optionalInitializer = null ; SingleVariableDeclaration ( AST ast ) { super ( ast ) ; if ( ast . apiLevel >= AST . JLS3 ) { this . modifiers = new ASTNode . NodeList ( MODIFIERS2_PROPERTY ) ; } } final SimplePropertyDescriptor internalExtraDimensionsProperty ( ) { return EXTRA_DIMENSIONS_PROPERTY ; } final ChildPropertyDescriptor internalInitializerProperty ( ) { return INITIALIZER_PROPERTY ; } final ChildPropertyDescriptor internalNameProperty ( ) { return NAME_PROPERTY ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final int internalGetSetIntProperty ( SimplePropertyDescriptor property , boolean get , int value ) { if ( property == MODIFIERS_PROPERTY ) { if ( get ) { return getModifiers ( ) ; } else { setModifiers ( value ) ; return <NUM_LIT:0> ; } } if ( property == EXTRA_DIMENSIONS_PROPERTY ) { if ( get ) { return getExtraDimensions ( ) ; } else { setExtraDimensions ( value ) ; return <NUM_LIT:0> ; } } return super . internalGetSetIntProperty ( property , get , value ) ; } final boolean internalGetSetBooleanProperty ( SimplePropertyDescriptor property , boolean get , boolean value ) { if ( property == VARARGS_PROPERTY ) { if ( get ) { return isVarargs ( ) ; } else { setVarargs ( value ) ; return false ; } } return super . internalGetSetBooleanProperty ( property , get , value ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } if ( property == TYPE_PROPERTY ) { if ( get ) { return getType ( ) ; } else { setType ( ( Type ) child ) ; return null ; } } if ( property == INITIALIZER_PROPERTY ) { if ( get ) { return getInitializer ( ) ; } else { setInitializer ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == MODIFIERS2_PROPERTY ) { return modifiers ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return SINGLE_VARIABLE_DECLARATION ; } ASTNode clone0 ( AST target ) { SingleVariableDeclaration result = new SingleVariableDeclaration ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; if ( this . ast . apiLevel == AST . JLS2_INTERNAL ) { result . setModifiers ( getModifiers ( ) ) ; } else { result . modifiers ( ) . addAll ( ASTNode . copySubtrees ( target , modifiers ( ) ) ) ; result . setVarargs ( isVarargs ( ) ) ; } result . setType ( ( Type ) getType ( ) . clone ( target ) ) ; result . setExtraDimensions ( getExtraDimensions ( ) ) ; result . setName ( ( SimpleName ) getName ( ) . clone ( target ) ) ; result . setInitializer ( ( Expression ) ASTNode . copySubtree ( target , getInitializer ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { if ( this . ast . apiLevel >= AST . JLS3 ) { acceptChildren ( visitor , this . modifiers ) ; } acceptChild ( visitor , getType ( ) ) ; acceptChild ( visitor , getName ( ) ) ; acceptChild ( visitor , getInitializer ( ) ) ; } visitor . endVisit ( this ) ; } public List modifiers ( ) { if ( this . modifiers == null ) { unsupportedIn2 ( ) ; } return this . modifiers ; } public int getModifiers ( ) { if ( this . modifiers == null ) { return this . modifierFlags ; } else { int computedModifierFlags = Modifier . NONE ; for ( Iterator it = modifiers ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Object x = it . next ( ) ; if ( x instanceof Modifier ) { computedModifierFlags |= ( ( Modifier ) x ) . getKeyword ( ) . toFlagValue ( ) ; } } return computedModifierFlags ; } } public void setModifiers ( int modifiers ) { internalSetModifiers ( modifiers ) ; } final void internalSetModifiers ( int pmodifiers ) { supportedOnlyIn2 ( ) ; preValueChange ( MODIFIERS_PROPERTY ) ; this . modifierFlags = pmodifiers ; postValueChange ( MODIFIERS_PROPERTY ) ; } public SimpleName getName ( ) { if ( this . variableName == null ) { synchronized ( this ) { if ( this . variableName == null ) { preLazyInit ( ) ; this . variableName = new SimpleName ( this . ast ) ; postLazyInit ( this . variableName , NAME_PROPERTY ) ; } } } return this . variableName ; } public void setName ( SimpleName variableName ) { if ( variableName == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . variableName ; preReplaceChild ( oldChild , variableName , NAME_PROPERTY ) ; this . variableName = variableName ; postReplaceChild ( oldChild , variableName , NAME_PROPERTY ) ; } public Type getType ( ) { if ( this . type == null ) { synchronized ( this ) { if ( this . type == null ) { preLazyInit ( ) ; this . type = this . ast . newPrimitiveType ( PrimitiveType . INT ) ; postLazyInit ( this . type , TYPE_PROPERTY ) ; } } } return this . type ; } public void setType ( Type type ) { if ( type == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . type ; preReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; this . type = type ; postReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; } public boolean isVarargs ( ) { if ( this . modifiers == null ) { unsupportedIn2 ( ) ; } return this . variableArity ; } public void setVarargs ( boolean variableArity ) { if ( this . modifiers == null ) { unsupportedIn2 ( ) ; } preValueChange ( VARARGS_PROPERTY ) ; this . variableArity = variableArity ; postValueChange ( VARARGS_PROPERTY ) ; } public int getExtraDimensions ( ) { return this . extraArrayDimensions ; } public void setExtraDimensions ( int dimensions ) { if ( dimensions < <NUM_LIT:0> ) { throw new IllegalArgumentException ( ) ; } preValueChange ( EXTRA_DIMENSIONS_PROPERTY ) ; this . extraArrayDimensions = dimensions ; postValueChange ( EXTRA_DIMENSIONS_PROPERTY ) ; } public Expression getInitializer ( ) { return this . optionalInitializer ; } public void setInitializer ( Expression initializer ) { ASTNode oldChild = this . optionalInitializer ; preReplaceChild ( oldChild , initializer , INITIALIZER_PROPERTY ) ; this . optionalInitializer = initializer ; postReplaceChild ( oldChild , initializer , INITIALIZER_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:7> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . modifiers == null ? <NUM_LIT:0> : this . modifiers . listSize ( ) ) + ( this . type == null ? <NUM_LIT:0> : getType ( ) . treeSize ( ) ) + ( this . variableName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) + ( this . optionalInitializer == null ? <NUM_LIT:0> : getInitializer ( ) . treeSize ( ) ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class SuperConstructorInvocation extends Statement { public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( SuperConstructorInvocation . class , "<STR_LIT>" , Expression . class , OPTIONAL , CYCLE_RISK ) ; public static final ChildListPropertyDescriptor TYPE_ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor ( SuperConstructorInvocation . class , "<STR_LIT>" , Type . class , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor ( SuperConstructorInvocation . class , "<STR_LIT>" , Expression . class , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS_2_0 ; private static final List PROPERTY_DESCRIPTORS_3_0 ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( SuperConstructorInvocation . class , propertyList ) ; addProperty ( EXPRESSION_PROPERTY , propertyList ) ; addProperty ( ARGUMENTS_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_2_0 = reapPropertyList ( propertyList ) ; propertyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( SuperConstructorInvocation . class , propertyList ) ; addProperty ( EXPRESSION_PROPERTY , propertyList ) ; addProperty ( TYPE_ARGUMENTS_PROPERTY , propertyList ) ; addProperty ( ARGUMENTS_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS_3_0 = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { if ( apiLevel == AST . JLS2_INTERNAL ) { return PROPERTY_DESCRIPTORS_2_0 ; } else { return PROPERTY_DESCRIPTORS_3_0 ; } } private Expression optionalExpression = null ; private ASTNode . NodeList typeArguments = null ; private ASTNode . NodeList arguments = new ASTNode . NodeList ( ARGUMENTS_PROPERTY ) ; SuperConstructorInvocation ( AST ast ) { super ( ast ) ; if ( ast . apiLevel >= AST . JLS3 ) { this . typeArguments = new ASTNode . NodeList ( TYPE_ARGUMENTS_PROPERTY ) ; } } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == EXPRESSION_PROPERTY ) { if ( get ) { return getExpression ( ) ; } else { setExpression ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == ARGUMENTS_PROPERTY ) { return arguments ( ) ; } if ( property == TYPE_ARGUMENTS_PROPERTY ) { return typeArguments ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return SUPER_CONSTRUCTOR_INVOCATION ; } ASTNode clone0 ( AST target ) { SuperConstructorInvocation result = new SuperConstructorInvocation ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; result . setExpression ( ( Expression ) ASTNode . copySubtree ( target , getExpression ( ) ) ) ; if ( this . ast . apiLevel >= AST . JLS3 ) { result . typeArguments ( ) . addAll ( ASTNode . copySubtrees ( target , typeArguments ( ) ) ) ; } result . arguments ( ) . addAll ( ASTNode . copySubtrees ( target , arguments ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getExpression ( ) ) ; if ( this . ast . apiLevel >= AST . JLS3 ) { acceptChildren ( visitor , this . typeArguments ) ; } acceptChildren ( visitor , this . arguments ) ; } visitor . endVisit ( this ) ; } public Expression getExpression ( ) { return this . optionalExpression ; } public void setExpression ( Expression expression ) { ASTNode oldChild = this . optionalExpression ; preReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; this . optionalExpression = expression ; postReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; } public List typeArguments ( ) { if ( this . typeArguments == null ) { unsupportedIn2 ( ) ; } return this . typeArguments ; } public List arguments ( ) { return this . arguments ; } public IMethodBinding resolveConstructorBinding ( ) { return this . ast . getBindingResolver ( ) . resolveConstructor ( this ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:3> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalExpression == null ? <NUM_LIT:0> : getExpression ( ) . treeSize ( ) ) + ( this . typeArguments == null ? <NUM_LIT:0> : this . typeArguments . listSize ( ) ) + ( this . arguments == null ? <NUM_LIT:0> : this . arguments . listSize ( ) ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import org . eclipse . jdt . core . IAnnotation ; import org . eclipse . jdt . core . IJavaElement ; public interface IBinding { public static final int PACKAGE = <NUM_LIT:1> ; public static final int TYPE = <NUM_LIT:2> ; public static final int VARIABLE = <NUM_LIT:3> ; public static final int METHOD = <NUM_LIT:4> ; public static final int ANNOTATION = <NUM_LIT:5> ; public static final int MEMBER_VALUE_PAIR = <NUM_LIT:6> ; public IAnnotationBinding [ ] getAnnotations ( ) ; public int getKind ( ) ; public String getName ( ) ; public int getModifiers ( ) ; public boolean isDeprecated ( ) ; public boolean isRecovered ( ) ; public boolean isSynthetic ( ) ; public IJavaElement getJavaElement ( ) ; public String getKey ( ) ; public boolean equals ( Object obj ) ; public boolean isEqualTo ( IBinding binding ) ; public String toString ( ) ; } </s>
|
<s> package org . eclipse . jdt . core . dom ; public final class ChildListPropertyDescriptor extends StructuralPropertyDescriptor { final Class elementType ; final boolean cycleRisk ; ChildListPropertyDescriptor ( Class nodeClass , String propertyId , Class elementType , boolean cycleRisk ) { super ( nodeClass , propertyId ) ; if ( elementType == null ) { throw new IllegalArgumentException ( ) ; } this . elementType = elementType ; this . cycleRisk = cycleRisk ; } public final Class getElementType ( ) { return this . elementType ; } public final boolean cycleRisk ( ) { return this . cycleRisk ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . jdt . internal . compiler . batch . FileSystem ; import org . eclipse . jdt . internal . compiler . env . NameEnvironmentAnswer ; import org . eclipse . jdt . internal . compiler . problem . AbortCompilation ; import org . eclipse . jdt . internal . core . INameEnvironmentWithProgress ; import org . eclipse . jdt . internal . core . NameLookup ; class NameEnvironmentWithProgress extends FileSystem implements INameEnvironmentWithProgress { IProgressMonitor monitor ; public NameEnvironmentWithProgress ( Classpath [ ] paths , String [ ] initialFileNames , IProgressMonitor monitor ) { super ( paths , initialFileNames ) ; setMonitor ( monitor ) ; } private void checkCanceled ( ) { if ( this . monitor != null && this . monitor . isCanceled ( ) ) { if ( NameLookup . VERBOSE ) { System . out . println ( Thread . currentThread ( ) + "<STR_LIT>" ) ; } throw new AbortCompilation ( true , new OperationCanceledException ( ) ) ; } } public NameEnvironmentAnswer findType ( char [ ] typeName , char [ ] [ ] packageName ) { checkCanceled ( ) ; return super . findType ( typeName , packageName ) ; } public NameEnvironmentAnswer findType ( char [ ] [ ] compoundName ) { checkCanceled ( ) ; return super . findType ( compoundName ) ; } public boolean isPackage ( char [ ] [ ] compoundName , char [ ] packageName ) { checkCanceled ( ) ; return super . isPackage ( compoundName , packageName ) ; } public void setMonitor ( IProgressMonitor monitor ) { this . monitor = monitor ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import org . eclipse . jdt . core . dom . BindingResolver ; import org . eclipse . jdt . core . dom . IMethodBinding ; class DefaultValuePairBinding extends MemberValuePairBinding { private org . eclipse . jdt . internal . compiler . lookup . MethodBinding method ; DefaultValuePairBinding ( org . eclipse . jdt . internal . compiler . lookup . MethodBinding binding , BindingResolver resolver ) { super ( null , resolver ) ; this . method = binding ; this . value = MemberValuePairBinding . buildDOMValue ( binding . getDefaultValue ( ) , resolver ) ; if ( binding . returnType != null && binding . returnType . isArrayType ( ) ) { if ( ! this . value . getClass ( ) . isArray ( ) ) { this . value = new Object [ ] { this . value } ; } } } public IMethodBinding getMethodBinding ( ) { return this . bindingResolver . getMethodBinding ( this . method ) ; } public String getName ( ) { return new String ( this . method . selector ) ; } public Object getValue ( ) { return this . value ; } public boolean isDefault ( ) { return true ; } public boolean isDeprecated ( ) { return this . method . isDeprecated ( ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class InstanceofExpression extends Expression { public static final ChildPropertyDescriptor LEFT_OPERAND_PROPERTY = new ChildPropertyDescriptor ( InstanceofExpression . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; public static final ChildPropertyDescriptor RIGHT_OPERAND_PROPERTY = new ChildPropertyDescriptor ( InstanceofExpression . class , "<STR_LIT>" , Type . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( InstanceofExpression . class , properyList ) ; addProperty ( LEFT_OPERAND_PROPERTY , properyList ) ; addProperty ( RIGHT_OPERAND_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Expression leftOperand = null ; private Type rightOperand = null ; InstanceofExpression ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == LEFT_OPERAND_PROPERTY ) { if ( get ) { return getLeftOperand ( ) ; } else { setLeftOperand ( ( Expression ) child ) ; return null ; } } if ( property == RIGHT_OPERAND_PROPERTY ) { if ( get ) { return getRightOperand ( ) ; } else { setRightOperand ( ( Type ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return INSTANCEOF_EXPRESSION ; } ASTNode clone0 ( AST target ) { InstanceofExpression result = new InstanceofExpression ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setLeftOperand ( ( Expression ) getLeftOperand ( ) . clone ( target ) ) ; result . setRightOperand ( ( Type ) getRightOperand ( ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getLeftOperand ( ) ) ; acceptChild ( visitor , getRightOperand ( ) ) ; } visitor . endVisit ( this ) ; } public Expression getLeftOperand ( ) { if ( this . leftOperand == null ) { synchronized ( this ) { if ( this . leftOperand == null ) { preLazyInit ( ) ; this . leftOperand = new SimpleName ( this . ast ) ; postLazyInit ( this . leftOperand , LEFT_OPERAND_PROPERTY ) ; } } } return this . leftOperand ; } public void setLeftOperand ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . leftOperand ; preReplaceChild ( oldChild , expression , LEFT_OPERAND_PROPERTY ) ; this . leftOperand = expression ; postReplaceChild ( oldChild , expression , LEFT_OPERAND_PROPERTY ) ; } public Type getRightOperand ( ) { if ( this . rightOperand == null ) { synchronized ( this ) { if ( this . rightOperand == null ) { preLazyInit ( ) ; this . rightOperand = new SimpleType ( this . ast ) ; postLazyInit ( this . rightOperand , RIGHT_OPERAND_PROPERTY ) ; } } } return this . rightOperand ; } public void setRightOperand ( Type referenceType ) { if ( referenceType == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . rightOperand ; preReplaceChild ( oldChild , referenceType , RIGHT_OPERAND_PROPERTY ) ; this . rightOperand = referenceType ; postReplaceChild ( oldChild , referenceType , RIGHT_OPERAND_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . leftOperand == null ? <NUM_LIT:0> : getLeftOperand ( ) . treeSize ( ) ) + ( this . rightOperand == null ? <NUM_LIT:0> : getRightOperand ( ) . treeSize ( ) ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class ForStatement extends Statement { public static final ChildListPropertyDescriptor INITIALIZERS_PROPERTY = new ChildListPropertyDescriptor ( ForStatement . class , "<STR_LIT>" , Expression . class , CYCLE_RISK ) ; public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( ForStatement . class , "<STR_LIT>" , Expression . class , OPTIONAL , CYCLE_RISK ) ; public static final ChildListPropertyDescriptor UPDATERS_PROPERTY = new ChildListPropertyDescriptor ( ForStatement . class , "<STR_LIT>" , Expression . class , CYCLE_RISK ) ; public static final ChildPropertyDescriptor BODY_PROPERTY = new ChildPropertyDescriptor ( ForStatement . class , "<STR_LIT:body>" , Statement . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:5> ) ; createPropertyList ( ForStatement . class , properyList ) ; addProperty ( INITIALIZERS_PROPERTY , properyList ) ; addProperty ( EXPRESSION_PROPERTY , properyList ) ; addProperty ( UPDATERS_PROPERTY , properyList ) ; addProperty ( BODY_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private ASTNode . NodeList initializers = new ASTNode . NodeList ( INITIALIZERS_PROPERTY ) ; private Expression optionalConditionExpression = null ; private ASTNode . NodeList updaters = new ASTNode . NodeList ( UPDATERS_PROPERTY ) ; private Statement body = null ; ForStatement ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == EXPRESSION_PROPERTY ) { if ( get ) { return getExpression ( ) ; } else { setExpression ( ( Expression ) child ) ; return null ; } } if ( property == BODY_PROPERTY ) { if ( get ) { return getBody ( ) ; } else { setBody ( ( Statement ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == INITIALIZERS_PROPERTY ) { return initializers ( ) ; } if ( property == UPDATERS_PROPERTY ) { return updaters ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return FOR_STATEMENT ; } ASTNode clone0 ( AST target ) { ForStatement result = new ForStatement ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; result . initializers ( ) . addAll ( ASTNode . copySubtrees ( target , initializers ( ) ) ) ; result . setExpression ( ( Expression ) ASTNode . copySubtree ( target , getExpression ( ) ) ) ; result . updaters ( ) . addAll ( ASTNode . copySubtrees ( target , updaters ( ) ) ) ; result . setBody ( ( Statement ) ASTNode . copySubtree ( target , getBody ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChildren ( visitor , this . initializers ) ; acceptChild ( visitor , getExpression ( ) ) ; acceptChildren ( visitor , this . updaters ) ; acceptChild ( visitor , getBody ( ) ) ; } visitor . endVisit ( this ) ; } public List initializers ( ) { return this . initializers ; } public Expression getExpression ( ) { return this . optionalConditionExpression ; } public void setExpression ( Expression expression ) { ASTNode oldChild = this . optionalConditionExpression ; preReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; this . optionalConditionExpression = expression ; postReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; } public List updaters ( ) { return this . updaters ; } public Statement getBody ( ) { if ( this . body == null ) { synchronized ( this ) { if ( this . body == null ) { preLazyInit ( ) ; this . body = new Block ( this . ast ) ; postLazyInit ( this . body , BODY_PROPERTY ) ; } } } return this . body ; } public void setBody ( Statement statement ) { if ( statement == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . body ; preReplaceChild ( oldChild , statement , BODY_PROPERTY ) ; this . body = statement ; postReplaceChild ( oldChild , statement , BODY_PROPERTY ) ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:4> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + this . initializers . listSize ( ) + this . updaters . listSize ( ) + ( this . optionalConditionExpression == null ? <NUM_LIT:0> : getExpression ( ) . treeSize ( ) ) + ( this . body == null ? <NUM_LIT:0> : getBody ( ) . treeSize ( ) ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class ArrayCreation extends Expression { public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor ( ArrayCreation . class , "<STR_LIT:type>" , ArrayType . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor DIMENSIONS_PROPERTY = new ChildListPropertyDescriptor ( ArrayCreation . class , "<STR_LIT>" , Expression . class , CYCLE_RISK ) ; public static final ChildPropertyDescriptor INITIALIZER_PROPERTY = new ChildPropertyDescriptor ( ArrayCreation . class , "<STR_LIT>" , ArrayInitializer . class , OPTIONAL , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( ArrayCreation . class , properyList ) ; addProperty ( TYPE_PROPERTY , properyList ) ; addProperty ( DIMENSIONS_PROPERTY , properyList ) ; addProperty ( INITIALIZER_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private ArrayType arrayType = null ; private ASTNode . NodeList dimensions = new ASTNode . NodeList ( DIMENSIONS_PROPERTY ) ; private ArrayInitializer optionalInitializer = null ; ArrayCreation ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == INITIALIZER_PROPERTY ) { if ( get ) { return getInitializer ( ) ; } else { setInitializer ( ( ArrayInitializer ) child ) ; return null ; } } if ( property == TYPE_PROPERTY ) { if ( get ) { return getType ( ) ; } else { setType ( ( ArrayType ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == DIMENSIONS_PROPERTY ) { return dimensions ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return ARRAY_CREATION ; } ASTNode clone0 ( AST target ) { ArrayCreation result = new ArrayCreation ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setType ( ( ArrayType ) getType ( ) . clone ( target ) ) ; result . dimensions ( ) . addAll ( ASTNode . copySubtrees ( target , dimensions ( ) ) ) ; result . setInitializer ( ( ArrayInitializer ) ASTNode . copySubtree ( target , getInitializer ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getType ( ) ) ; acceptChildren ( visitor , this . dimensions ) ; acceptChild ( visitor , getInitializer ( ) ) ; } visitor . endVisit ( this ) ; } public ArrayType getType ( ) { if ( this . arrayType == null ) { synchronized ( this ) { if ( this . arrayType == null ) { preLazyInit ( ) ; this . arrayType = this . ast . newArrayType ( this . ast . newPrimitiveType ( PrimitiveType . INT ) ) ; postLazyInit ( this . arrayType , TYPE_PROPERTY ) ; } } } return this . arrayType ; } public void setType ( ArrayType type ) { if ( type == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . arrayType ; preReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; this . arrayType = type ; postReplaceChild ( oldChild , type , TYPE_PROPERTY ) ; } public List dimensions ( ) { return this . dimensions ; } public ArrayInitializer getInitializer ( ) { return this . optionalInitializer ; } public void setInitializer ( ArrayInitializer initializer ) { ASTNode oldChild = this . optionalInitializer ; preReplaceChild ( oldChild , initializer , INITIALIZER_PROPERTY ) ; this . optionalInitializer = initializer ; postReplaceChild ( oldChild , initializer , INITIALIZER_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:3> * <NUM_LIT:4> ; } int treeSize ( ) { int size = memSize ( ) + ( this . arrayType == null ? <NUM_LIT:0> : getType ( ) . treeSize ( ) ) + ( this . optionalInitializer == null ? <NUM_LIT:0> : getInitializer ( ) . treeSize ( ) ) + this . dimensions . listSize ( ) ; return size ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . internal . compiler . lookup . ExtraCompilerModifiers ; import org . eclipse . jdt . internal . compiler . lookup . LookupEnvironment ; import org . eclipse . jdt . internal . compiler . lookup . ParameterizedGenericMethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . RawTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeVariableBinding ; import org . eclipse . jdt . internal . compiler . problem . AbortCompilation ; import org . eclipse . jdt . internal . core . JavaElement ; import org . eclipse . jdt . internal . core . util . Util ; class MethodBinding implements IMethodBinding { private static final int VALID_MODIFIERS = Modifier . PUBLIC | Modifier . PROTECTED | Modifier . PRIVATE | Modifier . ABSTRACT | Modifier . STATIC | Modifier . FINAL | Modifier . SYNCHRONIZED | Modifier . NATIVE | Modifier . STRICTFP ; private static final ITypeBinding [ ] NO_TYPE_BINDINGS = new ITypeBinding [ <NUM_LIT:0> ] ; private org . eclipse . jdt . internal . compiler . lookup . MethodBinding binding ; private BindingResolver resolver ; private ITypeBinding [ ] parameterTypes ; private ITypeBinding [ ] exceptionTypes ; private String name ; private ITypeBinding declaringClass ; private ITypeBinding returnType ; private String key ; private ITypeBinding [ ] typeParameters ; private ITypeBinding [ ] typeArguments ; private IAnnotationBinding [ ] annotations ; private IAnnotationBinding [ ] [ ] parameterAnnotations ; MethodBinding ( BindingResolver resolver , org . eclipse . jdt . internal . compiler . lookup . MethodBinding binding ) { this . resolver = resolver ; this . binding = binding ; } public boolean isAnnotationMember ( ) { return getDeclaringClass ( ) . isAnnotation ( ) ; } public boolean isConstructor ( ) { return this . binding . isConstructor ( ) ; } public boolean isDefaultConstructor ( ) { final ReferenceBinding declaringClassBinding = this . binding . declaringClass ; if ( declaringClassBinding . isRawType ( ) ) { RawTypeBinding rawTypeBinding = ( RawTypeBinding ) declaringClassBinding ; if ( rawTypeBinding . genericType ( ) . isBinaryBinding ( ) ) { return false ; } return ( this . binding . modifiers & ExtraCompilerModifiers . AccIsDefaultConstructor ) != <NUM_LIT:0> ; } if ( declaringClassBinding . isBinaryBinding ( ) ) { return false ; } return ( this . binding . modifiers & ExtraCompilerModifiers . AccIsDefaultConstructor ) != <NUM_LIT:0> ; } public String getName ( ) { if ( this . name == null ) { if ( this . binding . isConstructor ( ) ) { this . name = getDeclaringClass ( ) . getName ( ) ; } else { this . name = new String ( this . binding . selector ) ; } } return this . name ; } public IAnnotationBinding [ ] getAnnotations ( ) { if ( this . annotations != null ) { return this . annotations ; } org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding [ ] internalAnnotations = this . binding . getAnnotations ( ) ; int length = internalAnnotations == null ? <NUM_LIT:0> : internalAnnotations . length ; if ( length != <NUM_LIT:0> ) { IAnnotationBinding [ ] tempAnnotations = new IAnnotationBinding [ length ] ; int convertedAnnotationCount = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding internalAnnotation = internalAnnotations [ i ] ; final IAnnotationBinding annotationInstance = this . resolver . getAnnotationInstance ( internalAnnotation ) ; if ( annotationInstance == null ) { continue ; } tempAnnotations [ convertedAnnotationCount ++ ] = annotationInstance ; } if ( convertedAnnotationCount != length ) { if ( convertedAnnotationCount == <NUM_LIT:0> ) { return this . annotations = AnnotationBinding . NoAnnotations ; } System . arraycopy ( tempAnnotations , <NUM_LIT:0> , ( tempAnnotations = new IAnnotationBinding [ convertedAnnotationCount ] ) , <NUM_LIT:0> , convertedAnnotationCount ) ; } return this . annotations = tempAnnotations ; } return this . annotations = AnnotationBinding . NoAnnotations ; } public ITypeBinding getDeclaringClass ( ) { if ( this . declaringClass == null ) { this . declaringClass = this . resolver . getTypeBinding ( this . binding . declaringClass ) ; } return this . declaringClass ; } public IAnnotationBinding [ ] getParameterAnnotations ( int index ) { if ( getParameterTypes ( ) == NO_TYPE_BINDINGS ) { return AnnotationBinding . NoAnnotations ; } if ( this . parameterAnnotations != null ) { return this . parameterAnnotations [ index ] ; } org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding [ ] [ ] bindingAnnotations = this . binding . getParameterAnnotations ( ) ; if ( bindingAnnotations == null ) return AnnotationBinding . NoAnnotations ; int length = bindingAnnotations . length ; IAnnotationBinding [ ] [ ] domAnnotations = new IAnnotationBinding [ length ] [ ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding [ ] paramBindingAnnotations = bindingAnnotations [ i ] ; int pLength = paramBindingAnnotations . length ; domAnnotations [ i ] = new AnnotationBinding [ pLength ] ; for ( int j = <NUM_LIT:0> ; j < pLength ; j ++ ) { IAnnotationBinding domAnnotation = this . resolver . getAnnotationInstance ( paramBindingAnnotations [ j ] ) ; if ( domAnnotation == null ) { domAnnotations [ i ] = AnnotationBinding . NoAnnotations ; break ; } domAnnotations [ i ] [ j ] = domAnnotation ; } } this . parameterAnnotations = domAnnotations ; return this . parameterAnnotations [ index ] ; } public ITypeBinding [ ] getParameterTypes ( ) { if ( this . parameterTypes != null ) { return this . parameterTypes ; } org . eclipse . jdt . internal . compiler . lookup . TypeBinding [ ] parameters = this . binding . parameters ; int length = parameters == null ? <NUM_LIT:0> : parameters . length ; if ( length == <NUM_LIT:0> ) { return this . parameterTypes = NO_TYPE_BINDINGS ; } else { ITypeBinding [ ] paramTypes = new ITypeBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { final TypeBinding parameterBinding = parameters [ i ] ; if ( parameterBinding != null ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( parameterBinding ) ; if ( typeBinding == null ) { return this . parameterTypes = NO_TYPE_BINDINGS ; } paramTypes [ i ] = typeBinding ; } else { StringBuffer message = new StringBuffer ( "<STR_LIT>" ) ; message . append ( toString ( ) ) ; Util . log ( new IllegalArgumentException ( ) , message . toString ( ) ) ; return this . parameterTypes = NO_TYPE_BINDINGS ; } } return this . parameterTypes = paramTypes ; } } public ITypeBinding getReturnType ( ) { if ( this . returnType == null ) { this . returnType = this . resolver . getTypeBinding ( this . binding . returnType ) ; } return this . returnType ; } public Object getDefaultValue ( ) { if ( isAnnotationMember ( ) ) return MemberValuePairBinding . buildDOMValue ( this . binding . getDefaultValue ( ) , this . resolver ) ; return null ; } public ITypeBinding [ ] getExceptionTypes ( ) { if ( this . exceptionTypes != null ) { return this . exceptionTypes ; } org . eclipse . jdt . internal . compiler . lookup . TypeBinding [ ] exceptions = this . binding . thrownExceptions ; int length = exceptions == null ? <NUM_LIT:0> : exceptions . length ; if ( length == <NUM_LIT:0> ) { return this . exceptionTypes = NO_TYPE_BINDINGS ; } ITypeBinding [ ] exTypes = new ITypeBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( exceptions [ i ] ) ; if ( typeBinding == null ) { return this . exceptionTypes = NO_TYPE_BINDINGS ; } exTypes [ i ] = typeBinding ; } return this . exceptionTypes = exTypes ; } public IJavaElement getJavaElement ( ) { JavaElement element = getUnresolvedJavaElement ( ) ; if ( element == null ) return null ; return element . resolved ( this . binding ) ; } private JavaElement getUnresolvedJavaElement ( ) { if ( JavaCore . getPlugin ( ) == null ) { return null ; } if ( ! ( this . resolver instanceof DefaultBindingResolver ) ) return null ; DefaultBindingResolver defaultBindingResolver = ( DefaultBindingResolver ) this . resolver ; if ( ! defaultBindingResolver . fromJavaProject ) return null ; return Util . getUnresolvedJavaElement ( this . binding , defaultBindingResolver . workingCopyOwner , defaultBindingResolver . getBindingsToNodesMap ( ) ) ; } public int getKind ( ) { return IBinding . METHOD ; } public int getModifiers ( ) { return this . binding . getAccessFlags ( ) & VALID_MODIFIERS ; } public boolean isDeprecated ( ) { return this . binding . isDeprecated ( ) ; } public boolean isRecovered ( ) { return false ; } public boolean isSynthetic ( ) { return this . binding . isSynthetic ( ) ; } public boolean isVarargs ( ) { return this . binding . isVarargs ( ) ; } public String getKey ( ) { if ( this . key == null ) { this . key = new String ( this . binding . computeUniqueKey ( ) ) ; } return this . key ; } public boolean isEqualTo ( IBinding other ) { if ( other == this ) { return true ; } if ( other == null ) { return false ; } if ( ! ( other instanceof MethodBinding ) ) { return false ; } org . eclipse . jdt . internal . compiler . lookup . MethodBinding otherBinding = ( ( MethodBinding ) other ) . binding ; return BindingComparator . isEqual ( this . binding , otherBinding ) ; } public ITypeBinding [ ] getTypeParameters ( ) { if ( this . typeParameters != null ) { return this . typeParameters ; } TypeVariableBinding [ ] typeVariableBindings = this . binding . typeVariables ( ) ; int typeVariableBindingsLength = typeVariableBindings == null ? <NUM_LIT:0> : typeVariableBindings . length ; if ( typeVariableBindingsLength == <NUM_LIT:0> ) { return this . typeParameters = NO_TYPE_BINDINGS ; } ITypeBinding [ ] tParameters = new ITypeBinding [ typeVariableBindingsLength ] ; for ( int i = <NUM_LIT:0> ; i < typeVariableBindingsLength ; i ++ ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( typeVariableBindings [ i ] ) ; if ( typeBinding == null ) { return this . typeParameters = NO_TYPE_BINDINGS ; } tParameters [ i ] = typeBinding ; } return this . typeParameters = tParameters ; } public boolean isGenericMethod ( ) { if ( this . typeParameters != null ) { return this . typeParameters . length > <NUM_LIT:0> ; } TypeVariableBinding [ ] typeVariableBindings = this . binding . typeVariables ( ) ; return ( typeVariableBindings != null && typeVariableBindings . length > <NUM_LIT:0> ) ; } public ITypeBinding [ ] getTypeArguments ( ) { if ( this . typeArguments != null ) { return this . typeArguments ; } if ( this . binding instanceof ParameterizedGenericMethodBinding ) { ParameterizedGenericMethodBinding genericMethodBinding = ( ParameterizedGenericMethodBinding ) this . binding ; org . eclipse . jdt . internal . compiler . lookup . TypeBinding [ ] typeArgumentsBindings = genericMethodBinding . typeArguments ; int typeArgumentsLength = typeArgumentsBindings == null ? <NUM_LIT:0> : typeArgumentsBindings . length ; if ( typeArgumentsLength != <NUM_LIT:0> ) { ITypeBinding [ ] tArguments = new ITypeBinding [ typeArgumentsLength ] ; for ( int i = <NUM_LIT:0> ; i < typeArgumentsLength ; i ++ ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( typeArgumentsBindings [ i ] ) ; if ( typeBinding == null ) { return this . typeArguments = NO_TYPE_BINDINGS ; } tArguments [ i ] = typeBinding ; } return this . typeArguments = tArguments ; } } return this . typeArguments = NO_TYPE_BINDINGS ; } public boolean isParameterizedMethod ( ) { return ( this . binding instanceof ParameterizedGenericMethodBinding ) && ! ( ( ParameterizedGenericMethodBinding ) this . binding ) . isRaw ; } public boolean isRawMethod ( ) { return ( this . binding instanceof ParameterizedGenericMethodBinding ) && ( ( ParameterizedGenericMethodBinding ) this . binding ) . isRaw ; } public boolean isSubsignature ( IMethodBinding otherMethod ) { try { LookupEnvironment lookupEnvironment = this . resolver . lookupEnvironment ( ) ; return lookupEnvironment != null && lookupEnvironment . methodVerifier ( ) . isMethodSubsignature ( this . binding , ( ( MethodBinding ) otherMethod ) . binding ) ; } catch ( AbortCompilation e ) { return false ; } } public IMethodBinding getMethodDeclaration ( ) { return this . resolver . getMethodBinding ( this . binding . original ( ) ) ; } public boolean overrides ( IMethodBinding otherMethod ) { LookupEnvironment lookupEnvironment = this . resolver . lookupEnvironment ( ) ; return lookupEnvironment != null && lookupEnvironment . methodVerifier ( ) . doesMethodOverride ( this . binding , ( ( MethodBinding ) otherMethod ) . binding ) ; } public String toString ( ) { return this . binding . toString ( ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; public class Assignment extends Expression { public static class Operator { private String op ; private Operator ( String op ) { this . op = op ; } public String toString ( ) { return this . op ; } public static final Operator ASSIGN = new Operator ( "<STR_LIT:=>" ) ; public static final Operator PLUS_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator MINUS_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator TIMES_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator DIVIDE_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator BIT_AND_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator BIT_OR_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator BIT_XOR_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator REMAINDER_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator LEFT_SHIFT_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator RIGHT_SHIFT_SIGNED_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static final Operator RIGHT_SHIFT_UNSIGNED_ASSIGN = new Operator ( "<STR_LIT>" ) ; public static Operator toOperator ( String token ) { return ( Operator ) CODES . get ( token ) ; } private static final Map CODES ; static { CODES = new HashMap ( <NUM_LIT:20> ) ; Operator [ ] ops = { ASSIGN , PLUS_ASSIGN , MINUS_ASSIGN , TIMES_ASSIGN , DIVIDE_ASSIGN , BIT_AND_ASSIGN , BIT_OR_ASSIGN , BIT_XOR_ASSIGN , REMAINDER_ASSIGN , LEFT_SHIFT_ASSIGN , RIGHT_SHIFT_SIGNED_ASSIGN , RIGHT_SHIFT_UNSIGNED_ASSIGN } ; for ( int i = <NUM_LIT:0> ; i < ops . length ; i ++ ) { CODES . put ( ops [ i ] . toString ( ) , ops [ i ] ) ; } } } public static final ChildPropertyDescriptor LEFT_HAND_SIDE_PROPERTY = new ChildPropertyDescriptor ( Assignment . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; public static final SimplePropertyDescriptor OPERATOR_PROPERTY = new SimplePropertyDescriptor ( Assignment . class , "<STR_LIT>" , Assignment . Operator . class , MANDATORY ) ; public static final ChildPropertyDescriptor RIGHT_HAND_SIDE_PROPERTY = new ChildPropertyDescriptor ( Assignment . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( Assignment . class , properyList ) ; addProperty ( LEFT_HAND_SIDE_PROPERTY , properyList ) ; addProperty ( OPERATOR_PROPERTY , properyList ) ; addProperty ( RIGHT_HAND_SIDE_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Assignment . Operator assignmentOperator = Assignment . Operator . ASSIGN ; private Expression leftHandSide = null ; private Expression rightHandSide = null ; Assignment ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final Object internalGetSetObjectProperty ( SimplePropertyDescriptor property , boolean get , Object value ) { if ( property == OPERATOR_PROPERTY ) { if ( get ) { return getOperator ( ) ; } else { setOperator ( ( Operator ) value ) ; return null ; } } return super . internalGetSetObjectProperty ( property , get , value ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == LEFT_HAND_SIDE_PROPERTY ) { if ( get ) { return getLeftHandSide ( ) ; } else { setLeftHandSide ( ( Expression ) child ) ; return null ; } } if ( property == RIGHT_HAND_SIDE_PROPERTY ) { if ( get ) { return getRightHandSide ( ) ; } else { setRightHandSide ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return ASSIGNMENT ; } ASTNode clone0 ( AST target ) { Assignment result = new Assignment ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setOperator ( getOperator ( ) ) ; result . setLeftHandSide ( ( Expression ) getLeftHandSide ( ) . clone ( target ) ) ; result . setRightHandSide ( ( Expression ) getRightHandSide ( ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getLeftHandSide ( ) ) ; acceptChild ( visitor , getRightHandSide ( ) ) ; } visitor . endVisit ( this ) ; } public Assignment . Operator getOperator ( ) { return this . assignmentOperator ; } public void setOperator ( Assignment . Operator assignmentOperator ) { if ( assignmentOperator == null ) { throw new IllegalArgumentException ( ) ; } preValueChange ( OPERATOR_PROPERTY ) ; this . assignmentOperator = assignmentOperator ; postValueChange ( OPERATOR_PROPERTY ) ; } public Expression getLeftHandSide ( ) { if ( this . leftHandSide == null ) { synchronized ( this ) { if ( this . leftHandSide == null ) { preLazyInit ( ) ; this . leftHandSide = new SimpleName ( this . ast ) ; postLazyInit ( this . leftHandSide , LEFT_HAND_SIDE_PROPERTY ) ; } } } return this . leftHandSide ; } public void setLeftHandSide ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . leftHandSide ; preReplaceChild ( oldChild , expression , LEFT_HAND_SIDE_PROPERTY ) ; this . leftHandSide = expression ; postReplaceChild ( oldChild , expression , LEFT_HAND_SIDE_PROPERTY ) ; } public Expression getRightHandSide ( ) { if ( this . rightHandSide == null ) { synchronized ( this ) { if ( this . rightHandSide == null ) { preLazyInit ( ) ; this . rightHandSide = new SimpleName ( this . ast ) ; postLazyInit ( this . rightHandSide , RIGHT_HAND_SIDE_PROPERTY ) ; } } } return this . rightHandSide ; } public void setRightHandSide ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . rightHandSide ; preReplaceChild ( oldChild , expression , RIGHT_HAND_SIDE_PROPERTY ) ; this . rightHandSide = expression ; postReplaceChild ( oldChild , expression , RIGHT_HAND_SIDE_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:3> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . leftHandSide == null ? <NUM_LIT:0> : getLeftHandSide ( ) . treeSize ( ) ) + ( this . rightHandSide == null ? <NUM_LIT:0> : getRightHandSide ( ) . treeSize ( ) ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class 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 ; public abstract class StructuralPropertyDescriptor { private final String propertyId ; private final Class nodeClass ; StructuralPropertyDescriptor ( Class nodeClass , String propertyId ) { if ( nodeClass == null || propertyId == null ) { throw new IllegalArgumentException ( ) ; } this . propertyId = propertyId ; this . nodeClass = nodeClass ; } public final String getId ( ) { return this . propertyId ; } public final Class getNodeClass ( ) { return this . nodeClass ; } public final boolean isSimpleProperty ( ) { return ( this instanceof SimplePropertyDescriptor ) ; } public final boolean isChildProperty ( ) { return ( this instanceof ChildPropertyDescriptor ) ; } public final boolean isChildListProperty ( ) { return ( this instanceof ChildListPropertyDescriptor ) ; } public String toString ( ) { StringBuffer b = new StringBuffer ( ) ; if ( isChildListProperty ( ) ) { b . append ( "<STR_LIT>" ) ; } if ( isChildProperty ( ) ) { b . append ( "<STR_LIT>" ) ; } if ( isSimpleProperty ( ) ) { b . append ( "<STR_LIT>" ) ; } b . append ( "<STR_LIT>" ) ; if ( this . nodeClass != null ) { b . append ( this . nodeClass . getName ( ) ) ; } b . append ( "<STR_LIT:U+002C>" ) ; if ( this . propertyId != null ) { b . append ( this . propertyId ) ; } b . append ( "<STR_LIT:]>" ) ; return b . toString ( ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import 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 ; public abstract class Expression extends ASTNode { Expression ( AST ast ) { super ( ast ) ; } public final Object resolveConstantExpressionValue ( ) { return this . ast . getBindingResolver ( ) . resolveConstantExpressionValue ( this ) ; } public final ITypeBinding resolveTypeBinding ( ) { return this . ast . getBindingResolver ( ) . resolveExpressionType ( this ) ; } public final boolean resolveBoxing ( ) { return this . ast . getBindingResolver ( ) . resolveBoxing ( this ) ; } public final boolean resolveUnboxing ( ) { return this . ast . getBindingResolver ( ) . resolveUnboxing ( this ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class 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 . 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 ) { 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 ; public interface IExtendedModifier { public boolean isModifier ( ) ; public boolean isAnnotation ( ) ; } </s>
|
<s> package org . eclipse . jdt . core . dom ; import org . eclipse . jdt . core . ICompilationUnit ; public abstract class ASTRequestor { CompilationUnitResolver compilationUnitResolver = null ; protected ASTRequestor ( ) { } public void acceptAST ( ICompilationUnit source , CompilationUnit ast ) { } public void acceptBinding ( String bindingKey , IBinding binding ) { } public final IBinding [ ] createBindings ( String [ ] bindingKeys ) { int length = bindingKeys . length ; IBinding [ ] result = new IBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { result [ i ] = null ; if ( this . compilationUnitResolver != null ) { result [ i ] = this . compilationUnitResolver . createBinding ( bindingKeys [ i ] ) ; } } return result ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; public interface IAnnotationBinding extends IBinding { IMemberValuePairBinding [ ] getAllMemberValuePairs ( ) ; ITypeBinding getAnnotationType ( ) ; IMemberValuePairBinding [ ] getDeclaredMemberValuePairs ( ) ; public String getName ( ) ; } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class ConditionalExpression extends Expression { public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( ConditionalExpression . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; public static final ChildPropertyDescriptor THEN_EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( ConditionalExpression . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; public static final ChildPropertyDescriptor ELSE_EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( ConditionalExpression . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( ConditionalExpression . class , properyList ) ; addProperty ( EXPRESSION_PROPERTY , properyList ) ; addProperty ( THEN_EXPRESSION_PROPERTY , properyList ) ; addProperty ( ELSE_EXPRESSION_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Expression conditionExpression = null ; private Expression thenExpression = null ; private Expression elseExpression = null ; ConditionalExpression ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == EXPRESSION_PROPERTY ) { if ( get ) { return getExpression ( ) ; } else { setExpression ( ( Expression ) child ) ; return null ; } } if ( property == THEN_EXPRESSION_PROPERTY ) { if ( get ) { return getThenExpression ( ) ; } else { setThenExpression ( ( Expression ) child ) ; return null ; } } if ( property == ELSE_EXPRESSION_PROPERTY ) { if ( get ) { return getElseExpression ( ) ; } else { setElseExpression ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return CONDITIONAL_EXPRESSION ; } ASTNode clone0 ( AST target ) { ConditionalExpression result = new ConditionalExpression ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setExpression ( ( Expression ) getExpression ( ) . clone ( target ) ) ; result . setThenExpression ( ( Expression ) getThenExpression ( ) . clone ( target ) ) ; result . setElseExpression ( ( Expression ) getElseExpression ( ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getExpression ( ) ) ; acceptChild ( visitor , getThenExpression ( ) ) ; acceptChild ( visitor , getElseExpression ( ) ) ; } visitor . endVisit ( this ) ; } public Expression getExpression ( ) { if ( this . conditionExpression == null ) { synchronized ( this ) { if ( this . conditionExpression == null ) { preLazyInit ( ) ; this . conditionExpression = new SimpleName ( this . ast ) ; postLazyInit ( this . conditionExpression , EXPRESSION_PROPERTY ) ; } } } return this . conditionExpression ; } public void setExpression ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . conditionExpression ; preReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; this . conditionExpression = expression ; postReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; } public Expression getThenExpression ( ) { if ( this . thenExpression == null ) { synchronized ( this ) { if ( this . thenExpression == null ) { preLazyInit ( ) ; this . thenExpression = new SimpleName ( this . ast ) ; postLazyInit ( this . thenExpression , THEN_EXPRESSION_PROPERTY ) ; } } } return this . thenExpression ; } public void setThenExpression ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . thenExpression ; preReplaceChild ( oldChild , expression , THEN_EXPRESSION_PROPERTY ) ; this . thenExpression = expression ; postReplaceChild ( oldChild , expression , THEN_EXPRESSION_PROPERTY ) ; } public Expression getElseExpression ( ) { if ( this . elseExpression == null ) { synchronized ( this ) { if ( this . elseExpression == null ) { preLazyInit ( ) ; this . elseExpression = new SimpleName ( this . ast ) ; postLazyInit ( this . elseExpression , ELSE_EXPRESSION_PROPERTY ) ; } } } return this . elseExpression ; } public void setElseExpression ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . elseExpression ; preReplaceChild ( oldChild , expression , ELSE_EXPRESSION_PROPERTY ) ; this . elseExpression = expression ; postReplaceChild ( oldChild , expression , ELSE_EXPRESSION_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:3> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . conditionExpression == null ? <NUM_LIT:0> : getExpression ( ) . treeSize ( ) ) + ( this . thenExpression == null ? <NUM_LIT:0> : getThenExpression ( ) . treeSize ( ) ) + ( this . elseExpression == null ? <NUM_LIT:0> : getElseExpression ( ) . treeSize ( ) ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class MemberRef extends ASTNode implements IDocElement { public static final ChildPropertyDescriptor QUALIFIER_PROPERTY = new ChildPropertyDescriptor ( MemberRef . class , "<STR_LIT>" , Name . class , OPTIONAL , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( MemberRef . class , "<STR_LIT:name>" , SimpleName . class , MANDATORY , NO_CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( MemberRef . class , propertyList ) ; addProperty ( QUALIFIER_PROPERTY , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Name optionalQualifier = null ; private SimpleName memberName = null ; MemberRef ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == QUALIFIER_PROPERTY ) { if ( get ) { return getQualifier ( ) ; } else { setQualifier ( ( Name ) child ) ; return null ; } } if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return MEMBER_REF ; } ASTNode clone0 ( AST target ) { MemberRef result = new MemberRef ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setQualifier ( ( Name ) ASTNode . copySubtree ( target , getQualifier ( ) ) ) ; result . setName ( ( SimpleName ) ASTNode . copySubtree ( target , getName ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getQualifier ( ) ) ; acceptChild ( visitor , getName ( ) ) ; } visitor . endVisit ( this ) ; } public Name getQualifier ( ) { return this . optionalQualifier ; } public void setQualifier ( Name name ) { ASTNode oldChild = this . optionalQualifier ; preReplaceChild ( oldChild , name , QUALIFIER_PROPERTY ) ; this . optionalQualifier = name ; postReplaceChild ( oldChild , name , QUALIFIER_PROPERTY ) ; } public SimpleName getName ( ) { if ( this . memberName == null ) { synchronized ( this ) { if ( this . memberName == null ) { preLazyInit ( ) ; this . memberName = new SimpleName ( this . ast ) ; postLazyInit ( this . memberName , NAME_PROPERTY ) ; } } } return this . memberName ; } public void setName ( SimpleName name ) { if ( name == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . memberName ; preReplaceChild ( oldChild , name , NAME_PROPERTY ) ; this . memberName = name ; postReplaceChild ( oldChild , name , NAME_PROPERTY ) ; } public final IBinding resolveBinding ( ) { return this . ast . getBindingResolver ( ) . resolveReference ( this ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalQualifier == null ? <NUM_LIT:0> : getQualifier ( ) . treeSize ( ) ) + ( this . memberName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public final class NormalAnnotation extends Annotation { public static final ChildPropertyDescriptor TYPE_NAME_PROPERTY = internalTypeNamePropertyFactory ( NormalAnnotation . class ) ; public static final ChildListPropertyDescriptor VALUES_PROPERTY = new ChildListPropertyDescriptor ( NormalAnnotation . class , "<STR_LIT>" , MemberValuePair . class , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( NormalAnnotation . class , propertyList ) ; addProperty ( TYPE_NAME_PROPERTY , propertyList ) ; addProperty ( VALUES_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private ASTNode . NodeList values = new ASTNode . NodeList ( VALUES_PROPERTY ) ; NormalAnnotation ( AST ast ) { super ( ast ) ; unsupportedIn2 ( ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == TYPE_NAME_PROPERTY ) { if ( get ) { return getTypeName ( ) ; } else { setTypeName ( ( Name ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == VALUES_PROPERTY ) { return values ( ) ; } return super . internalGetChildListProperty ( property ) ; } final ChildPropertyDescriptor internalTypeNameProperty ( ) { return TYPE_NAME_PROPERTY ; } final int getNodeType0 ( ) { return NORMAL_ANNOTATION ; } ASTNode clone0 ( AST target ) { NormalAnnotation result = new NormalAnnotation ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setTypeName ( ( Name ) ASTNode . copySubtree ( target , getTypeName ( ) ) ) ; result . values ( ) . addAll ( ASTNode . copySubtrees ( target , values ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getTypeName ( ) ) ; acceptChildren ( visitor , this . values ) ; } visitor . endVisit ( this ) ; } public List values ( ) { return this . values ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:1> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . typeName == null ? <NUM_LIT:0> : getTypeName ( ) . treeSize ( ) ) + this . values . listSize ( ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class Block extends Statement { public static final ChildListPropertyDescriptor STATEMENTS_PROPERTY = new ChildListPropertyDescriptor ( Block . class , "<STR_LIT>" , Statement . class , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( Block . class , properyList ) ; addProperty ( STATEMENTS_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private ASTNode . NodeList statements = new ASTNode . NodeList ( STATEMENTS_PROPERTY ) ; Block ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == STATEMENTS_PROPERTY ) { return statements ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return BLOCK ; } ASTNode clone0 ( AST target ) { Block result = new Block ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; result . statements ( ) . addAll ( ASTNode . copySubtrees ( target , statements ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChildren ( visitor , this . statements ) ; } visitor . endVisit ( this ) ; } public List statements ( ) { return this . statements ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:1> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + this . statements . listSize ( ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . ast . ConstructorDeclaration ; import org . eclipse . jdt . internal . compiler . ast . FieldDeclaration ; import org . eclipse . jdt . internal . compiler . ast . Initializer ; import org . eclipse . jdt . internal . compiler . ast . MethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ; import org . eclipse . jdt . internal . compiler . lookup . ClassScope ; import org . eclipse . jdt . internal . compiler . lookup . CompilationUnitScope ; import org . eclipse . jdt . internal . compiler . lookup . MethodScope ; class NodeSearcher extends ASTVisitor { public org . eclipse . jdt . internal . compiler . ast . ASTNode found ; public TypeDeclaration enclosingType ; public int position ; NodeSearcher ( int position ) { this . position = position ; } public boolean visit ( ConstructorDeclaration constructorDeclaration , ClassScope scope ) { if ( constructorDeclaration . declarationSourceStart <= this . position && this . position <= constructorDeclaration . declarationSourceEnd ) { this . found = constructorDeclaration ; return false ; } return true ; } public boolean visit ( FieldDeclaration fieldDeclaration , MethodScope scope ) { if ( fieldDeclaration . declarationSourceStart <= this . position && this . position <= fieldDeclaration . declarationSourceEnd ) { this . found = fieldDeclaration ; return false ; } return true ; } public boolean visit ( Initializer initializer , MethodScope scope ) { if ( initializer . declarationSourceStart <= this . position && this . position <= initializer . declarationSourceEnd ) { this . found = initializer ; return false ; } return true ; } public boolean visit ( TypeDeclaration memberTypeDeclaration , ClassScope scope ) { if ( memberTypeDeclaration . declarationSourceStart <= this . position && this . position <= memberTypeDeclaration . declarationSourceEnd ) { this . enclosingType = memberTypeDeclaration ; return true ; } return false ; } public boolean visit ( MethodDeclaration methodDeclaration , ClassScope scope ) { if ( methodDeclaration . declarationSourceStart <= this . position && this . position <= methodDeclaration . declarationSourceEnd ) { this . found = methodDeclaration ; return false ; } return true ; } public boolean visit ( TypeDeclaration typeDeclaration , CompilationUnitScope scope ) { if ( typeDeclaration . declarationSourceStart <= this . position && this . position <= typeDeclaration . declarationSourceEnd ) { this . enclosingType = typeDeclaration ; return true ; } return false ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ast . StringLiteral ; import org . eclipse . jdt . internal . compiler . ast . Wildcard ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . lookup . ArrayBinding ; import org . eclipse . jdt . internal . compiler . lookup . BaseTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . CaptureBinding ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . LocalTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . PackageBinding ; import org . eclipse . jdt . internal . compiler . lookup . ParameterizedTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . RawTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . Scope ; import org . eclipse . jdt . internal . compiler . lookup . TagBits ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . compiler . lookup . TypeVariableBinding ; import org . eclipse . jdt . internal . compiler . lookup . WildcardBinding ; import org . eclipse . jdt . internal . compiler . problem . AbortCompilation ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . core . JavaElement ; import org . eclipse . jdt . internal . core . PackageFragment ; class TypeBinding implements ITypeBinding { private static final StringLiteral EXPRESSION = new org . eclipse . jdt . internal . compiler . ast . StringLiteral ( <NUM_LIT:0> , <NUM_LIT:0> ) ; protected static final IMethodBinding [ ] NO_METHOD_BINDINGS = new IMethodBinding [ <NUM_LIT:0> ] ; private static final String NO_NAME = "<STR_LIT>" ; protected static final ITypeBinding [ ] NO_TYPE_BINDINGS = new ITypeBinding [ <NUM_LIT:0> ] ; protected static final IVariableBinding [ ] NO_VARIABLE_BINDINGS = new IVariableBinding [ <NUM_LIT:0> ] ; private static final int VALID_MODIFIERS = Modifier . PUBLIC | Modifier . PROTECTED | Modifier . PRIVATE | Modifier . ABSTRACT | Modifier . STATIC | Modifier . FINAL | Modifier . STRICTFP ; org . eclipse . jdt . internal . compiler . lookup . TypeBinding binding ; private String key ; private BindingResolver resolver ; private IVariableBinding [ ] fields ; private IAnnotationBinding [ ] annotations ; private IMethodBinding [ ] methods ; private ITypeBinding [ ] members ; private ITypeBinding [ ] interfaces ; private ITypeBinding [ ] typeArguments ; private ITypeBinding [ ] bounds ; private ITypeBinding [ ] typeParameters ; public TypeBinding ( BindingResolver resolver , org . eclipse . jdt . internal . compiler . lookup . TypeBinding binding ) { this . binding = binding ; this . resolver = resolver ; } public ITypeBinding createArrayType ( int dimension ) { int realDimensions = dimension ; realDimensions += getDimensions ( ) ; if ( realDimensions < <NUM_LIT:1> || realDimensions > <NUM_LIT:255> ) { throw new IllegalArgumentException ( ) ; } return this . resolver . resolveArrayType ( this , dimension ) ; } public IAnnotationBinding [ ] getAnnotations ( ) { if ( this . annotations != null ) { return this . annotations ; } org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding refType = null ; if ( this . binding instanceof ParameterizedTypeBinding ) { refType = ( ( ParameterizedTypeBinding ) this . binding ) . genericType ( ) ; } else if ( this . binding . isAnnotationType ( ) || this . binding . isClass ( ) || this . binding . isEnum ( ) || this . binding . isInterface ( ) ) { refType = ( org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ) this . binding ; } if ( refType != null ) { org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding [ ] internalAnnotations = refType . getAnnotations ( ) ; int length = internalAnnotations == null ? <NUM_LIT:0> : internalAnnotations . length ; if ( length != <NUM_LIT:0> ) { IAnnotationBinding [ ] tempAnnotations = new IAnnotationBinding [ length ] ; int convertedAnnotationCount = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding internalAnnotation = internalAnnotations [ i ] ; IAnnotationBinding annotationInstance = this . resolver . getAnnotationInstance ( internalAnnotation ) ; if ( annotationInstance == null ) { continue ; } tempAnnotations [ convertedAnnotationCount ++ ] = annotationInstance ; } if ( convertedAnnotationCount != length ) { if ( convertedAnnotationCount == <NUM_LIT:0> ) { return this . annotations = AnnotationBinding . NoAnnotations ; } System . arraycopy ( tempAnnotations , <NUM_LIT:0> , ( tempAnnotations = new IAnnotationBinding [ convertedAnnotationCount ] ) , <NUM_LIT:0> , convertedAnnotationCount ) ; } return this . annotations = tempAnnotations ; } } return this . annotations = AnnotationBinding . NoAnnotations ; } public String getBinaryName ( ) { if ( this . binding . isCapture ( ) ) { return null ; } else if ( this . binding . isTypeVariable ( ) ) { TypeVariableBinding typeVariableBinding = ( TypeVariableBinding ) this . binding ; org . eclipse . jdt . internal . compiler . lookup . Binding declaring = typeVariableBinding . declaringElement ; StringBuffer binaryName = new StringBuffer ( ) ; switch ( declaring . kind ( ) ) { case org . eclipse . jdt . internal . compiler . lookup . Binding . METHOD : MethodBinding methodBinding = ( MethodBinding ) declaring ; char [ ] constantPoolName = methodBinding . declaringClass . constantPoolName ( ) ; if ( constantPoolName == null ) return null ; binaryName . append ( CharOperation . replaceOnCopy ( constantPoolName , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ) . append ( '<CHAR_LIT>' ) . append ( methodBinding . signature ( ) ) . append ( '<CHAR_LIT>' ) . append ( typeVariableBinding . sourceName ) ; break ; default : org . eclipse . jdt . internal . compiler . lookup . TypeBinding typeBinding = ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) declaring ; constantPoolName = typeBinding . constantPoolName ( ) ; if ( constantPoolName == null ) return null ; binaryName . append ( CharOperation . replaceOnCopy ( constantPoolName , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ) . append ( '<CHAR_LIT>' ) . append ( typeVariableBinding . sourceName ) ; } return String . valueOf ( binaryName ) ; } char [ ] constantPoolName = this . binding . constantPoolName ( ) ; if ( constantPoolName == null ) return null ; char [ ] dotSeparated = CharOperation . replaceOnCopy ( constantPoolName , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; return new String ( dotSeparated ) ; } public ITypeBinding getBound ( ) { switch ( this . binding . kind ( ) ) { case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : WildcardBinding wildcardBinding = ( WildcardBinding ) this . binding ; if ( wildcardBinding . bound != null ) { return this . resolver . getTypeBinding ( wildcardBinding . bound ) ; } break ; } return null ; } public ITypeBinding getGenericTypeOfWildcardType ( ) { switch ( this . binding . kind ( ) ) { case Binding . WILDCARD_TYPE : WildcardBinding wildcardBinding = ( WildcardBinding ) this . binding ; if ( wildcardBinding . genericType != null ) { return this . resolver . getTypeBinding ( wildcardBinding . genericType ) ; } break ; } return null ; } public int getRank ( ) { switch ( this . binding . kind ( ) ) { case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : WildcardBinding wildcardBinding = ( WildcardBinding ) this . binding ; return wildcardBinding . rank ; default : return - <NUM_LIT:1> ; } } public ITypeBinding getComponentType ( ) { if ( ! isArray ( ) ) { return null ; } ArrayBinding arrayBinding = ( ArrayBinding ) this . binding ; return this . resolver . getTypeBinding ( arrayBinding . elementsType ( ) ) ; } public synchronized IVariableBinding [ ] getDeclaredFields ( ) { if ( this . fields != null ) { return this . fields ; } try { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; FieldBinding [ ] fieldBindings = referenceBinding . availableFields ( ) ; int length = fieldBindings . length ; if ( length != <NUM_LIT:0> ) { int convertedFieldCount = <NUM_LIT:0> ; IVariableBinding [ ] newFields = new IVariableBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { FieldBinding fieldBinding = fieldBindings [ i ] ; IVariableBinding variableBinding = this . resolver . getVariableBinding ( fieldBinding ) ; if ( variableBinding != null ) { newFields [ convertedFieldCount ++ ] = variableBinding ; } } if ( convertedFieldCount != length ) { if ( convertedFieldCount == <NUM_LIT:0> ) { return this . fields = NO_VARIABLE_BINDINGS ; } System . arraycopy ( newFields , <NUM_LIT:0> , ( newFields = new IVariableBinding [ convertedFieldCount ] ) , <NUM_LIT:0> , convertedFieldCount ) ; } return this . fields = newFields ; } } } catch ( RuntimeException e ) { org . eclipse . jdt . internal . core . util . Util . log ( e , "<STR_LIT>" ) ; } return this . fields = NO_VARIABLE_BINDINGS ; } public synchronized IMethodBinding [ ] getDeclaredMethods ( ) { if ( this . methods != null ) { return this . methods ; } try { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; org . eclipse . jdt . internal . compiler . lookup . MethodBinding [ ] internalMethods = referenceBinding . availableMethods ( ) ; int length = internalMethods . length ; if ( length != <NUM_LIT:0> ) { int convertedMethodCount = <NUM_LIT:0> ; IMethodBinding [ ] newMethods = new IMethodBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { org . eclipse . jdt . internal . compiler . lookup . MethodBinding methodBinding = internalMethods [ i ] ; if ( methodBinding . isDefaultAbstract ( ) || methodBinding . isSynthetic ( ) || ( methodBinding . isConstructor ( ) && isInterface ( ) ) ) { continue ; } IMethodBinding methodBinding2 = this . resolver . getMethodBinding ( methodBinding ) ; if ( methodBinding2 != null ) { newMethods [ convertedMethodCount ++ ] = methodBinding2 ; } } if ( convertedMethodCount != length ) { if ( convertedMethodCount == <NUM_LIT:0> ) { return this . methods = NO_METHOD_BINDINGS ; } System . arraycopy ( newMethods , <NUM_LIT:0> , ( newMethods = new IMethodBinding [ convertedMethodCount ] ) , <NUM_LIT:0> , convertedMethodCount ) ; } return this . methods = newMethods ; } } } catch ( RuntimeException e ) { org . eclipse . jdt . internal . core . util . Util . log ( e , "<STR_LIT>" ) ; } return this . methods = NO_METHOD_BINDINGS ; } public int getDeclaredModifiers ( ) { return getModifiers ( ) ; } public synchronized ITypeBinding [ ] getDeclaredTypes ( ) { if ( this . members != null ) { return this . members ; } try { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; ReferenceBinding [ ] internalMembers = referenceBinding . memberTypes ( ) ; int length = internalMembers . length ; if ( length != <NUM_LIT:0> ) { ITypeBinding [ ] newMembers = new ITypeBinding [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( internalMembers [ i ] ) ; if ( typeBinding == null ) { return this . members = NO_TYPE_BINDINGS ; } newMembers [ i ] = typeBinding ; } return this . members = newMembers ; } } } catch ( RuntimeException e ) { org . eclipse . jdt . internal . core . util . Util . log ( e , "<STR_LIT>" ) ; } return this . members = NO_TYPE_BINDINGS ; } public synchronized IMethodBinding getDeclaringMethod ( ) { if ( this . binding instanceof LocalTypeBinding ) { LocalTypeBinding localTypeBinding = ( LocalTypeBinding ) this . binding ; MethodBinding methodBinding = localTypeBinding . enclosingMethod ; if ( methodBinding != null ) { try { return this . resolver . getMethodBinding ( localTypeBinding . enclosingMethod ) ; } catch ( RuntimeException e ) { org . eclipse . jdt . internal . core . util . Util . log ( e , "<STR_LIT>" ) ; } } } else if ( this . binding . isTypeVariable ( ) ) { TypeVariableBinding typeVariableBinding = ( TypeVariableBinding ) this . binding ; Binding declaringElement = typeVariableBinding . declaringElement ; if ( declaringElement instanceof MethodBinding ) { try { return this . resolver . getMethodBinding ( ( MethodBinding ) declaringElement ) ; } catch ( RuntimeException e ) { org . eclipse . jdt . internal . core . util . Util . log ( e , "<STR_LIT>" ) ; } } } return null ; } public synchronized ITypeBinding getDeclaringClass ( ) { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; if ( referenceBinding . isNestedType ( ) ) { try { return this . resolver . getTypeBinding ( referenceBinding . enclosingType ( ) ) ; } catch ( RuntimeException e ) { org . eclipse . jdt . internal . core . util . Util . log ( e , "<STR_LIT>" ) ; } } } else if ( this . binding . isTypeVariable ( ) ) { TypeVariableBinding typeVariableBinding = ( TypeVariableBinding ) this . binding ; Binding declaringElement = typeVariableBinding . isCapture ( ) ? ( ( CaptureBinding ) typeVariableBinding ) . sourceType : typeVariableBinding . declaringElement ; if ( declaringElement instanceof ReferenceBinding ) { try { return this . resolver . getTypeBinding ( ( ReferenceBinding ) declaringElement ) ; } catch ( RuntimeException e ) { org . eclipse . jdt . internal . core . util . Util . log ( e , "<STR_LIT>" ) ; } } } return null ; } public int getDimensions ( ) { if ( ! isArray ( ) ) { return <NUM_LIT:0> ; } ArrayBinding arrayBinding = ( ArrayBinding ) this . binding ; return arrayBinding . dimensions ; } public ITypeBinding getElementType ( ) { if ( ! isArray ( ) ) { return null ; } ArrayBinding arrayBinding = ( ArrayBinding ) this . binding ; return this . resolver . getTypeBinding ( arrayBinding . leafComponentType ) ; } public ITypeBinding getTypeDeclaration ( ) { if ( this . binding instanceof ParameterizedTypeBinding ) return this . resolver . getTypeBinding ( ( ( ParameterizedTypeBinding ) this . binding ) . genericType ( ) ) ; return this ; } public ITypeBinding getErasure ( ) { return this . resolver . getTypeBinding ( this . binding . erasure ( ) ) ; } public synchronized ITypeBinding [ ] getInterfaces ( ) { if ( this . interfaces != null ) { return this . interfaces ; } if ( this . binding == null ) return this . interfaces = NO_TYPE_BINDINGS ; switch ( this . binding . kind ( ) ) { case Binding . ARRAY_TYPE : case Binding . BASE_TYPE : return this . interfaces = NO_TYPE_BINDINGS ; } ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; ReferenceBinding [ ] internalInterfaces = null ; try { internalInterfaces = referenceBinding . superInterfaces ( ) ; } catch ( RuntimeException e ) { org . eclipse . jdt . internal . core . util . Util . log ( e , "<STR_LIT>" ) ; } int length = internalInterfaces == null ? <NUM_LIT:0> : internalInterfaces . length ; if ( length != <NUM_LIT:0> ) { ITypeBinding [ ] newInterfaces = new ITypeBinding [ length ] ; int interfacesCounter = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( internalInterfaces [ i ] ) ; if ( typeBinding == null ) { continue ; } newInterfaces [ interfacesCounter ++ ] = typeBinding ; } if ( length != interfacesCounter ) { System . arraycopy ( newInterfaces , <NUM_LIT:0> , ( newInterfaces = new ITypeBinding [ interfacesCounter ] ) , <NUM_LIT:0> , interfacesCounter ) ; } return this . interfaces = newInterfaces ; } return this . interfaces = NO_TYPE_BINDINGS ; } public IJavaElement getJavaElement ( ) { JavaElement element = getUnresolvedJavaElement ( ) ; if ( element != null ) return element . resolved ( this . binding ) ; if ( isRecovered ( ) ) { IPackageBinding packageBinding = getPackage ( ) ; if ( packageBinding != null ) { final IJavaElement javaElement = packageBinding . getJavaElement ( ) ; if ( javaElement != null && javaElement . getElementType ( ) == IJavaElement . PACKAGE_FRAGMENT ) { return ( ( PackageFragment ) javaElement ) . getCompilationUnit ( new String ( this . binding . sourceName ( ) ) + SuffixConstants . SUFFIX_STRING_java ) . getType ( this . getName ( ) ) ; } } return null ; } return null ; } private JavaElement getUnresolvedJavaElement ( ) { return getUnresolvedJavaElement ( this . binding ) ; } private JavaElement getUnresolvedJavaElement ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding typeBinding ) { if ( JavaCore . getPlugin ( ) == null ) { return null ; } if ( this . resolver instanceof DefaultBindingResolver ) { DefaultBindingResolver defaultBindingResolver = ( DefaultBindingResolver ) this . resolver ; if ( ! defaultBindingResolver . fromJavaProject ) return null ; return org . eclipse . jdt . internal . core . util . Util . getUnresolvedJavaElement ( typeBinding , defaultBindingResolver . workingCopyOwner , defaultBindingResolver . getBindingsToNodesMap ( ) ) ; } return null ; } public String getKey ( ) { if ( this . key == null ) { this . key = new String ( this . binding . computeUniqueKey ( ) ) ; } return this . key ; } public int getKind ( ) { return IBinding . TYPE ; } public int getModifiers ( ) { if ( isClass ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; final int accessFlags = referenceBinding . getAccessFlags ( ) & VALID_MODIFIERS ; if ( referenceBinding . isAnonymousType ( ) ) { return accessFlags & ~ Modifier . FINAL ; } return accessFlags ; } else if ( isAnnotation ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; final int accessFlags = referenceBinding . getAccessFlags ( ) & VALID_MODIFIERS ; return accessFlags & ~ ( ClassFileConstants . AccAbstract | ClassFileConstants . AccInterface | ClassFileConstants . AccAnnotation ) ; } else if ( isInterface ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; final int accessFlags = referenceBinding . getAccessFlags ( ) & VALID_MODIFIERS ; return accessFlags & ~ ( ClassFileConstants . AccAbstract | ClassFileConstants . AccInterface ) ; } else if ( isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; final int accessFlags = referenceBinding . getAccessFlags ( ) & VALID_MODIFIERS ; return accessFlags & ~ ClassFileConstants . AccEnum ; } else { return Modifier . NONE ; } } public String getName ( ) { StringBuffer buffer ; switch ( this . binding . kind ( ) ) { case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : WildcardBinding wildcardBinding = ( WildcardBinding ) this . binding ; buffer = new StringBuffer ( ) ; buffer . append ( TypeConstants . WILDCARD_NAME ) ; if ( wildcardBinding . bound != null ) { switch ( wildcardBinding . boundKind ) { case Wildcard . SUPER : buffer . append ( TypeConstants . WILDCARD_SUPER ) ; break ; case Wildcard . EXTENDS : buffer . append ( TypeConstants . WILDCARD_EXTENDS ) ; } buffer . append ( getBound ( ) . getName ( ) ) ; } return String . valueOf ( buffer ) ; case Binding . TYPE_PARAMETER : if ( isCapture ( ) ) { return NO_NAME ; } TypeVariableBinding typeVariableBinding = ( TypeVariableBinding ) this . binding ; return new String ( typeVariableBinding . sourceName ) ; case Binding . PARAMETERIZED_TYPE : ParameterizedTypeBinding parameterizedTypeBinding = ( ParameterizedTypeBinding ) this . binding ; buffer = new StringBuffer ( ) ; buffer . append ( parameterizedTypeBinding . sourceName ( ) ) ; ITypeBinding [ ] tArguments = getTypeArguments ( ) ; final int typeArgumentsLength = tArguments . length ; if ( typeArgumentsLength != <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> ; i < typeArgumentsLength ; i ++ ) { if ( i > <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT:U+002C>' ) ; } buffer . append ( tArguments [ i ] . getName ( ) ) ; } buffer . append ( '<CHAR_LIT:>>' ) ; } return String . valueOf ( buffer ) ; case Binding . RAW_TYPE : return getTypeDeclaration ( ) . getName ( ) ; case Binding . ARRAY_TYPE : ITypeBinding elementType = getElementType ( ) ; if ( elementType . isLocal ( ) || elementType . isAnonymous ( ) || elementType . isCapture ( ) ) { return NO_NAME ; } int dimensions = getDimensions ( ) ; char [ ] brackets = new char [ dimensions * <NUM_LIT:2> ] ; for ( int i = dimensions * <NUM_LIT:2> - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -= <NUM_LIT:2> ) { brackets [ i ] = '<CHAR_LIT:]>' ; brackets [ i - <NUM_LIT:1> ] = '<CHAR_LIT:[>' ; } buffer = new StringBuffer ( elementType . getName ( ) ) ; buffer . append ( brackets ) ; return String . valueOf ( buffer ) ; default : if ( isPrimitive ( ) || isNullType ( ) ) { BaseTypeBinding baseTypeBinding = ( BaseTypeBinding ) this . binding ; return new String ( baseTypeBinding . simpleName ) ; } if ( isAnonymous ( ) ) { return NO_NAME ; } return new String ( this . binding . sourceName ( ) ) ; } } public IPackageBinding getPackage ( ) { switch ( this . binding . kind ( ) ) { case Binding . BASE_TYPE : case Binding . ARRAY_TYPE : case Binding . TYPE_PARAMETER : case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : return null ; } ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; return this . resolver . getPackageBinding ( referenceBinding . getPackage ( ) ) ; } public String getQualifiedName ( ) { StringBuffer buffer ; switch ( this . binding . kind ( ) ) { case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : WildcardBinding wildcardBinding = ( WildcardBinding ) this . binding ; buffer = new StringBuffer ( ) ; buffer . append ( TypeConstants . WILDCARD_NAME ) ; final ITypeBinding bound = getBound ( ) ; if ( bound != null ) { switch ( wildcardBinding . boundKind ) { case Wildcard . SUPER : buffer . append ( TypeConstants . WILDCARD_SUPER ) ; break ; case Wildcard . EXTENDS : buffer . append ( TypeConstants . WILDCARD_EXTENDS ) ; } buffer . append ( bound . getQualifiedName ( ) ) ; } return String . valueOf ( buffer ) ; case Binding . RAW_TYPE : return getTypeDeclaration ( ) . getQualifiedName ( ) ; case Binding . ARRAY_TYPE : ITypeBinding elementType = getElementType ( ) ; if ( elementType . isLocal ( ) || elementType . isAnonymous ( ) || elementType . isCapture ( ) ) { return elementType . getQualifiedName ( ) ; } final int dimensions = getDimensions ( ) ; char [ ] brackets = new char [ dimensions * <NUM_LIT:2> ] ; for ( int i = dimensions * <NUM_LIT:2> - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -= <NUM_LIT:2> ) { brackets [ i ] = '<CHAR_LIT:]>' ; brackets [ i - <NUM_LIT:1> ] = '<CHAR_LIT:[>' ; } buffer = new StringBuffer ( elementType . getQualifiedName ( ) ) ; buffer . append ( brackets ) ; return String . valueOf ( buffer ) ; case Binding . TYPE_PARAMETER : if ( isCapture ( ) ) { return NO_NAME ; } TypeVariableBinding typeVariableBinding = ( TypeVariableBinding ) this . binding ; return new String ( typeVariableBinding . sourceName ) ; case Binding . PARAMETERIZED_TYPE : if ( this . binding . isLocalType ( ) ) { return NO_NAME ; } buffer = new StringBuffer ( ) ; if ( isMember ( ) ) { buffer . append ( getDeclaringClass ( ) . getQualifiedName ( ) ) . append ( '<CHAR_LIT:.>' ) ; ParameterizedTypeBinding parameterizedTypeBinding = ( ParameterizedTypeBinding ) this . binding ; buffer . append ( parameterizedTypeBinding . sourceName ( ) ) ; ITypeBinding [ ] tArguments = getTypeArguments ( ) ; final int typeArgumentsLength = tArguments . length ; if ( typeArgumentsLength != <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> ; i < typeArgumentsLength ; i ++ ) { if ( i > <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT:U+002C>' ) ; } buffer . append ( tArguments [ i ] . getQualifiedName ( ) ) ; } buffer . append ( '<CHAR_LIT:>>' ) ; } return String . valueOf ( buffer ) ; } buffer . append ( getTypeDeclaration ( ) . getQualifiedName ( ) ) ; ITypeBinding [ ] tArguments = getTypeArguments ( ) ; final int typeArgumentsLength = tArguments . length ; if ( typeArgumentsLength != <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> ; i < typeArgumentsLength ; i ++ ) { if ( i > <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT:U+002C>' ) ; } buffer . append ( tArguments [ i ] . getQualifiedName ( ) ) ; } buffer . append ( '<CHAR_LIT:>>' ) ; } return String . valueOf ( buffer ) ; default : if ( isAnonymous ( ) || this . binding . isLocalType ( ) ) { return NO_NAME ; } if ( isPrimitive ( ) || isNullType ( ) ) { BaseTypeBinding baseTypeBinding = ( BaseTypeBinding ) this . binding ; return new String ( baseTypeBinding . simpleName ) ; } if ( isMember ( ) ) { buffer = new StringBuffer ( ) ; buffer . append ( getDeclaringClass ( ) . getQualifiedName ( ) ) . append ( '<CHAR_LIT:.>' ) ; buffer . append ( getName ( ) ) ; return String . valueOf ( buffer ) ; } PackageBinding packageBinding = this . binding . getPackage ( ) ; buffer = new StringBuffer ( ) ; if ( packageBinding != null && packageBinding . compoundName != CharOperation . NO_CHAR_CHAR ) { buffer . append ( CharOperation . concatWith ( packageBinding . compoundName , '<CHAR_LIT:.>' ) ) . append ( '<CHAR_LIT:.>' ) ; } buffer . append ( getName ( ) ) ; return String . valueOf ( buffer ) ; } } public synchronized ITypeBinding getSuperclass ( ) { if ( this . binding == null ) return null ; switch ( this . binding . kind ( ) ) { case Binding . ARRAY_TYPE : case Binding . BASE_TYPE : return null ; default : if ( this . binding . isInterface ( ) ) return null ; } ReferenceBinding superclass = null ; try { superclass = ( ( ReferenceBinding ) this . binding ) . superclass ( ) ; } catch ( RuntimeException e ) { org . eclipse . jdt . internal . core . util . Util . log ( e , "<STR_LIT>" ) ; return this . resolver . resolveWellKnownType ( "<STR_LIT>" ) ; } if ( superclass == null ) { return null ; } return this . resolver . getTypeBinding ( superclass ) ; } public ITypeBinding [ ] getTypeArguments ( ) { if ( this . typeArguments != null ) { return this . typeArguments ; } if ( this . binding . isParameterizedTypeWithActualArguments ( ) ) { ParameterizedTypeBinding parameterizedTypeBinding = ( ParameterizedTypeBinding ) this . binding ; final org . eclipse . jdt . internal . compiler . lookup . TypeBinding [ ] arguments = parameterizedTypeBinding . arguments ; int argumentsLength = arguments . length ; ITypeBinding [ ] newTypeArguments = new ITypeBinding [ argumentsLength ] ; for ( int i = <NUM_LIT:0> ; i < argumentsLength ; i ++ ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( arguments [ i ] ) ; if ( typeBinding == null ) { return this . typeArguments = NO_TYPE_BINDINGS ; } newTypeArguments [ i ] = typeBinding ; } return this . typeArguments = newTypeArguments ; } return this . typeArguments = NO_TYPE_BINDINGS ; } public ITypeBinding [ ] getTypeBounds ( ) { if ( this . bounds != null ) { return this . bounds ; } if ( this . binding instanceof TypeVariableBinding ) { TypeVariableBinding typeVariableBinding = ( TypeVariableBinding ) this . binding ; ReferenceBinding varSuperclass = typeVariableBinding . superclass ( ) ; org . eclipse . jdt . internal . compiler . lookup . TypeBinding firstClassOrArrayBound = typeVariableBinding . firstBound ; int boundsLength = <NUM_LIT:0> ; if ( firstClassOrArrayBound != null ) { if ( firstClassOrArrayBound == varSuperclass ) { boundsLength ++ ; } else if ( firstClassOrArrayBound . isArrayType ( ) ) { boundsLength ++ ; } else { firstClassOrArrayBound = null ; } } ReferenceBinding [ ] superinterfaces = typeVariableBinding . superInterfaces ( ) ; int superinterfacesLength = <NUM_LIT:0> ; if ( superinterfaces != null ) { superinterfacesLength = superinterfaces . length ; boundsLength += superinterfacesLength ; } if ( boundsLength != <NUM_LIT:0> ) { ITypeBinding [ ] typeBounds = new ITypeBinding [ boundsLength ] ; int boundsIndex = <NUM_LIT:0> ; if ( firstClassOrArrayBound != null ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( firstClassOrArrayBound ) ; if ( typeBinding == null ) { return this . bounds = NO_TYPE_BINDINGS ; } typeBounds [ boundsIndex ++ ] = typeBinding ; } if ( superinterfaces != null ) { for ( int i = <NUM_LIT:0> ; i < superinterfacesLength ; i ++ , boundsIndex ++ ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( superinterfaces [ i ] ) ; if ( typeBinding == null ) { return this . bounds = NO_TYPE_BINDINGS ; } typeBounds [ boundsIndex ] = typeBinding ; } } return this . bounds = typeBounds ; } } return this . bounds = NO_TYPE_BINDINGS ; } public ITypeBinding [ ] getTypeParameters ( ) { if ( this . typeParameters != null ) { return this . typeParameters ; } switch ( this . binding . kind ( ) ) { case Binding . RAW_TYPE : case Binding . PARAMETERIZED_TYPE : return this . typeParameters = NO_TYPE_BINDINGS ; } TypeVariableBinding [ ] typeVariableBindings = this . binding . typeVariables ( ) ; int typeVariableBindingsLength = typeVariableBindings == null ? <NUM_LIT:0> : typeVariableBindings . length ; if ( typeVariableBindingsLength != <NUM_LIT:0> ) { ITypeBinding [ ] newTypeParameters = new ITypeBinding [ typeVariableBindingsLength ] ; for ( int i = <NUM_LIT:0> ; i < typeVariableBindingsLength ; i ++ ) { ITypeBinding typeBinding = this . resolver . getTypeBinding ( typeVariableBindings [ i ] ) ; if ( typeBinding == null ) { return this . typeParameters = NO_TYPE_BINDINGS ; } newTypeParameters [ i ] = typeBinding ; } return this . typeParameters = newTypeParameters ; } return this . typeParameters = NO_TYPE_BINDINGS ; } public ITypeBinding getWildcard ( ) { if ( this . binding instanceof CaptureBinding ) { CaptureBinding captureBinding = ( CaptureBinding ) this . binding ; return this . resolver . getTypeBinding ( captureBinding . wildcard ) ; } return null ; } public boolean isGenericType ( ) { if ( isRawType ( ) ) { return false ; } TypeVariableBinding [ ] typeVariableBindings = this . binding . typeVariables ( ) ; return ( typeVariableBindings != null && typeVariableBindings . length > <NUM_LIT:0> ) ; } public boolean isAnnotation ( ) { return this . binding . isAnnotationType ( ) ; } public boolean isAnonymous ( ) { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; return referenceBinding . isAnonymousType ( ) ; } return false ; } public boolean isArray ( ) { return this . binding . isArrayType ( ) ; } public boolean isAssignmentCompatible ( ITypeBinding type ) { try { if ( this == type ) return true ; if ( ! ( type instanceof TypeBinding ) ) return false ; TypeBinding other = ( TypeBinding ) type ; Scope scope = this . resolver . scope ( ) ; if ( scope == null ) return false ; return this . binding . isCompatibleWith ( other . binding ) || scope . isBoxingCompatibleWith ( this . binding , other . binding ) ; } catch ( AbortCompilation e ) { return false ; } } public boolean isCapture ( ) { return this . binding . isCapture ( ) ; } public boolean isCastCompatible ( ITypeBinding type ) { try { Scope scope = this . resolver . scope ( ) ; if ( scope == null ) return false ; if ( ! ( type instanceof TypeBinding ) ) return false ; org . eclipse . jdt . internal . compiler . lookup . TypeBinding expressionType = ( ( TypeBinding ) type ) . binding ; expressionType = expressionType . capture ( scope , <NUM_LIT:0> ) ; return TypeBinding . EXPRESSION . checkCastTypesCompatibility ( scope , this . binding , expressionType , null ) ; } catch ( AbortCompilation e ) { return false ; } } public boolean isClass ( ) { switch ( this . binding . kind ( ) ) { case Binding . TYPE_PARAMETER : case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : return false ; } return this . binding . isClass ( ) ; } public boolean isDeprecated ( ) { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; return referenceBinding . isDeprecated ( ) ; } return false ; } public boolean isEnum ( ) { return this . binding . isEnum ( ) ; } public boolean isEqualTo ( IBinding other ) { if ( other == this ) { return true ; } if ( other == null ) { return false ; } if ( ! ( other instanceof TypeBinding ) ) { return false ; } org . eclipse . jdt . internal . compiler . lookup . TypeBinding otherBinding = ( ( TypeBinding ) other ) . binding ; return BindingComparator . isEqual ( this . binding , otherBinding ) ; } public boolean isFromSource ( ) { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; if ( referenceBinding . isRawType ( ) ) { return ! ( ( RawTypeBinding ) referenceBinding ) . genericType ( ) . isBinaryBinding ( ) ; } else if ( referenceBinding . isParameterizedType ( ) ) { ParameterizedTypeBinding parameterizedTypeBinding = ( ParameterizedTypeBinding ) referenceBinding ; org . eclipse . jdt . internal . compiler . lookup . TypeBinding erasure = parameterizedTypeBinding . erasure ( ) ; if ( erasure instanceof ReferenceBinding ) { return ! ( ( ReferenceBinding ) erasure ) . isBinaryBinding ( ) ; } return false ; } else { return ! referenceBinding . isBinaryBinding ( ) ; } } else if ( isTypeVariable ( ) ) { final TypeVariableBinding typeVariableBinding = ( TypeVariableBinding ) this . binding ; final Binding declaringElement = typeVariableBinding . declaringElement ; if ( declaringElement instanceof MethodBinding ) { MethodBinding methodBinding = ( MethodBinding ) declaringElement ; return ! methodBinding . declaringClass . isBinaryBinding ( ) ; } else { final org . eclipse . jdt . internal . compiler . lookup . TypeBinding typeBinding = ( org . eclipse . jdt . internal . compiler . lookup . TypeBinding ) declaringElement ; if ( typeBinding instanceof ReferenceBinding ) { return ! ( ( ReferenceBinding ) typeBinding ) . isBinaryBinding ( ) ; } else if ( typeBinding instanceof ArrayBinding ) { final ArrayBinding arrayBinding = ( ArrayBinding ) typeBinding ; final org . eclipse . jdt . internal . compiler . lookup . TypeBinding leafComponentType = arrayBinding . leafComponentType ; if ( leafComponentType instanceof ReferenceBinding ) { return ! ( ( ReferenceBinding ) leafComponentType ) . isBinaryBinding ( ) ; } } } } else if ( isCapture ( ) ) { CaptureBinding captureBinding = ( CaptureBinding ) this . binding ; return ! captureBinding . sourceType . isBinaryBinding ( ) ; } return false ; } public boolean isInterface ( ) { switch ( this . binding . kind ( ) ) { case Binding . TYPE_PARAMETER : case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : return false ; } return this . binding . isInterface ( ) ; } public boolean isLocal ( ) { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; return referenceBinding . isLocalType ( ) && ! referenceBinding . isMemberType ( ) ; } return false ; } public boolean isMember ( ) { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; return referenceBinding . isMemberType ( ) ; } return false ; } public boolean isNested ( ) { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; return referenceBinding . isNestedType ( ) ; } return false ; } public boolean isNullType ( ) { return this . binding == org . eclipse . jdt . internal . compiler . lookup . TypeBinding . NULL ; } public boolean isParameterizedType ( ) { return this . binding . isParameterizedTypeWithActualArguments ( ) ; } public boolean isPrimitive ( ) { return ! isNullType ( ) && this . binding . isBaseType ( ) ; } public boolean isRawType ( ) { return this . binding . isRawType ( ) ; } public boolean isRecovered ( ) { return ( this . binding . tagBits & TagBits . HasMissingType ) != <NUM_LIT:0> ; } public boolean isSubTypeCompatible ( ITypeBinding type ) { try { if ( this == type ) return true ; if ( this . binding . isBaseType ( ) ) return false ; if ( ! ( type instanceof TypeBinding ) ) return false ; TypeBinding other = ( TypeBinding ) type ; if ( other . binding . isBaseType ( ) ) return false ; return this . binding . isCompatibleWith ( other . binding ) ; } catch ( AbortCompilation e ) { return false ; } } public boolean isSynthetic ( ) { return false ; } public boolean isTopLevel ( ) { if ( isClass ( ) || isInterface ( ) || isEnum ( ) ) { ReferenceBinding referenceBinding = ( ReferenceBinding ) this . binding ; return ! referenceBinding . isNestedType ( ) ; } return false ; } public boolean isTypeVariable ( ) { return this . binding . isTypeVariable ( ) && ! this . binding . isCapture ( ) ; } public boolean isUpperbound ( ) { switch ( this . binding . kind ( ) ) { case Binding . WILDCARD_TYPE : return ( ( WildcardBinding ) this . binding ) . boundKind == Wildcard . EXTENDS ; case Binding . INTERSECTION_TYPE : return true ; } return false ; } public boolean isWildcardType ( ) { return this . binding . isWildcard ( ) ; } public String toString ( ) { return this . binding . toString ( ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import java . util . Map ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . ITypeRoot ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . internal . compiler . parser . Scanner ; import org . eclipse . jdt . internal . compiler . util . Util ; import org . eclipse . jface . text . IDocument ; import org . eclipse . text . edits . TextEdit ; public class CompilationUnit extends ASTNode { private static final Message [ ] EMPTY_MESSAGES = new Message [ <NUM_LIT:0> ] ; private static final IProblem [ ] EMPTY_PROBLEMS = new IProblem [ <NUM_LIT:0> ] ; public static final ChildListPropertyDescriptor IMPORTS_PROPERTY = new ChildListPropertyDescriptor ( CompilationUnit . class , "<STR_LIT>" , ImportDeclaration . class , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor PACKAGE_PROPERTY = new ChildPropertyDescriptor ( CompilationUnit . class , "<STR_LIT>" , PackageDeclaration . class , OPTIONAL , NO_CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; public static final ChildListPropertyDescriptor TYPES_PROPERTY = new ChildListPropertyDescriptor ( CompilationUnit . class , "<STR_LIT>" , AbstractTypeDeclaration . class , CYCLE_RISK ) ; static { List properyList = new ArrayList ( <NUM_LIT:4> ) ; createPropertyList ( CompilationUnit . class , properyList ) ; addProperty ( PACKAGE_PROPERTY , properyList ) ; addProperty ( IMPORTS_PROPERTY , properyList ) ; addProperty ( TYPES_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private DefaultCommentMapper commentMapper = null ; private ITypeRoot typeRoot = null ; private ASTNode . NodeList imports = new ASTNode . NodeList ( IMPORTS_PROPERTY ) ; private int [ ] lineEndTable = Util . EMPTY_INT_ARRAY ; private Message [ ] messages ; private List optionalCommentList = null ; Comment [ ] optionalCommentTable = null ; private PackageDeclaration optionalPackageDeclaration = null ; private IProblem [ ] problems = EMPTY_PROBLEMS ; private Object statementsRecoveryData ; private ASTNode . NodeList types = new ASTNode . NodeList ( TYPES_PROPERTY ) ; protected CompilationUnit ( AST ast ) { super ( ast ) ; } protected void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getPackage ( ) ) ; acceptChildren ( visitor , this . imports ) ; acceptChildren ( visitor , this . types ) ; } visitor . endVisit ( this ) ; } ASTNode clone0 ( AST target ) { CompilationUnit result = new CompilationUnit ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setPackage ( ( PackageDeclaration ) ASTNode . copySubtree ( target , getPackage ( ) ) ) ; result . imports ( ) . addAll ( ASTNode . copySubtrees ( target , imports ( ) ) ) ; result . types ( ) . addAll ( ASTNode . copySubtrees ( target , types ( ) ) ) ; return result ; } public int getColumnNumber ( final int position ) { if ( this . lineEndTable == null ) return - <NUM_LIT:2> ; final int line = getLineNumber ( position ) ; if ( line == - <NUM_LIT:1> ) { return - <NUM_LIT:1> ; } if ( line == <NUM_LIT:1> ) { if ( position >= getStartPosition ( ) + getLength ( ) ) return - <NUM_LIT:1> ; return position ; } int length = this . lineEndTable . length ; final int previousLineOffset = this . lineEndTable [ line - <NUM_LIT:2> ] ; final int offsetForLine = previousLineOffset + <NUM_LIT:1> ; final int currentLineEnd = line == length + <NUM_LIT:1> ? getStartPosition ( ) + getLength ( ) - <NUM_LIT:1> : this . lineEndTable [ line - <NUM_LIT:1> ] ; if ( offsetForLine > currentLineEnd ) { return - <NUM_LIT:1> ; } else { return position - offsetForLine ; } } public ASTNode findDeclaringNode ( IBinding binding ) { return this . ast . getBindingResolver ( ) . findDeclaringNode ( binding ) ; } public ASTNode findDeclaringNode ( String key ) { return this . ast . getBindingResolver ( ) . findDeclaringNode ( key ) ; } public List getCommentList ( ) { return this . optionalCommentList ; } DefaultCommentMapper getCommentMapper ( ) { return this . commentMapper ; } public int getExtendedLength ( ASTNode node ) { if ( node == null ) { throw new IllegalArgumentException ( ) ; } if ( this . commentMapper == null || node . getAST ( ) != getAST ( ) ) { return node . getLength ( ) ; } else { return this . commentMapper . getExtendedLength ( node ) ; } } public int getExtendedStartPosition ( ASTNode node ) { if ( node == null ) { throw new IllegalArgumentException ( ) ; } if ( this . commentMapper == null || node . getAST ( ) != getAST ( ) ) { return node . getStartPosition ( ) ; } else { return this . commentMapper . getExtendedStartPosition ( node ) ; } } public IJavaElement getJavaElement ( ) { return this . typeRoot ; } public Message [ ] getMessages ( ) { if ( this . messages == null ) { int problemLength = this . problems . length ; if ( problemLength == <NUM_LIT:0> ) { this . messages = EMPTY_MESSAGES ; } else { this . messages = new Message [ problemLength ] ; for ( int i = <NUM_LIT:0> ; i < problemLength ; i ++ ) { IProblem problem = this . problems [ i ] ; int start = problem . getSourceStart ( ) ; int end = problem . getSourceEnd ( ) ; this . messages [ i ] = new Message ( problem . getMessage ( ) , start , end - start + <NUM_LIT:1> ) ; } } } return this . messages ; } final int getNodeType0 ( ) { return COMPILATION_UNIT ; } public PackageDeclaration getPackage ( ) { return this . optionalPackageDeclaration ; } public int getPosition ( int line , int column ) { if ( this . lineEndTable == null ) return - <NUM_LIT:2> ; if ( line < <NUM_LIT:1> || column < <NUM_LIT:0> ) return - <NUM_LIT:1> ; int length ; if ( ( length = this . lineEndTable . length ) == <NUM_LIT:0> ) { if ( line != <NUM_LIT:1> ) return - <NUM_LIT:1> ; return column >= getStartPosition ( ) + getLength ( ) ? - <NUM_LIT:1> : column ; } if ( line == <NUM_LIT:1> ) { final int endOfLine = this . lineEndTable [ <NUM_LIT:0> ] ; return column > endOfLine ? - <NUM_LIT:1> : column ; } else if ( line > length + <NUM_LIT:1> ) { return - <NUM_LIT:1> ; } final int previousLineOffset = this . lineEndTable [ line - <NUM_LIT:2> ] ; final int offsetForLine = previousLineOffset + <NUM_LIT:1> ; final int currentLineEnd = line == length + <NUM_LIT:1> ? getStartPosition ( ) + getLength ( ) - <NUM_LIT:1> : this . lineEndTable [ line - <NUM_LIT:1> ] ; if ( ( offsetForLine + column ) > currentLineEnd ) { return - <NUM_LIT:1> ; } else { return offsetForLine + column ; } } public IProblem [ ] getProblems ( ) { return this . problems ; } public Object getStatementsRecoveryData ( ) { return this . statementsRecoveryData ; } public ITypeRoot getTypeRoot ( ) { return this . typeRoot ; } public List imports ( ) { return this . imports ; } public int firstLeadingCommentIndex ( ASTNode node ) { if ( node == null ) { throw new IllegalArgumentException ( ) ; } if ( this . commentMapper == null || node . getAST ( ) != getAST ( ) ) { return - <NUM_LIT:1> ; } return this . commentMapper . firstLeadingCommentIndex ( node ) ; } public int lastTrailingCommentIndex ( ASTNode node ) { if ( node == null ) { throw new IllegalArgumentException ( ) ; } if ( this . commentMapper == null || node . getAST ( ) != getAST ( ) ) { return - <NUM_LIT:1> ; } return this . commentMapper . lastTrailingCommentIndex ( node ) ; } void initCommentMapper ( Scanner scanner ) { this . commentMapper = new DefaultCommentMapper ( this . optionalCommentTable ) ; this . commentMapper . initialize ( this , scanner ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == IMPORTS_PROPERTY ) { return imports ( ) ; } if ( property == TYPES_PROPERTY ) { return types ( ) ; } return super . internalGetChildListProperty ( property ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == PACKAGE_PROPERTY ) { if ( get ) { return getPackage ( ) ; } else { setPackage ( ( PackageDeclaration ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } public int lineNumber ( int position ) { int lineNumber = getLineNumber ( position ) ; return lineNumber < <NUM_LIT:1> ? <NUM_LIT:1> : lineNumber ; } public int getLineNumber ( int position ) { if ( this . lineEndTable == null ) return - <NUM_LIT:2> ; int length ; if ( ( length = this . lineEndTable . length ) == <NUM_LIT:0> ) { if ( position >= getStartPosition ( ) + getLength ( ) ) { return - <NUM_LIT:1> ; } return <NUM_LIT:1> ; } int low = <NUM_LIT:0> ; if ( position < <NUM_LIT:0> ) { return - <NUM_LIT:1> ; } if ( position <= this . lineEndTable [ low ] ) { return <NUM_LIT:1> ; } int hi = length - <NUM_LIT:1> ; if ( position > this . lineEndTable [ hi ] ) { if ( position >= getStartPosition ( ) + getLength ( ) ) { return - <NUM_LIT:1> ; } else { return length + <NUM_LIT:1> ; } } while ( true ) { if ( low + <NUM_LIT:1> == hi ) { return low + <NUM_LIT:2> ; } int mid = low + ( hi - low ) / <NUM_LIT:2> ; if ( position <= this . lineEndTable [ mid ] ) { hi = mid ; } else { low = mid ; } } } int memSize ( ) { int size = BASE_NODE_SIZE + <NUM_LIT:8> * <NUM_LIT:4> ; if ( this . lineEndTable != null ) { size += HEADERS + <NUM_LIT:4> * this . lineEndTable . length ; } if ( this . optionalCommentTable != null ) { size += HEADERS + <NUM_LIT:4> * this . optionalCommentTable . length ; } return size ; } public void recordModifications ( ) { getAST ( ) . recordModifications ( this ) ; } public TextEdit rewrite ( IDocument document , Map options ) { return getAST ( ) . rewrite ( document , options ) ; } void setCommentTable ( Comment [ ] commentTable ) { if ( commentTable == null ) { this . optionalCommentList = null ; this . optionalCommentTable = null ; } else { int nextAvailablePosition = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < commentTable . length ; i ++ ) { Comment comment = commentTable [ i ] ; if ( comment == null ) { throw new IllegalArgumentException ( ) ; } int start = comment . getStartPosition ( ) ; int length = comment . getLength ( ) ; if ( start < <NUM_LIT:0> || length < <NUM_LIT:0> || start < nextAvailablePosition ) { throw new IllegalArgumentException ( ) ; } nextAvailablePosition = comment . getStartPosition ( ) + comment . getLength ( ) ; } this . optionalCommentTable = commentTable ; List commentList = Arrays . asList ( commentTable ) ; this . optionalCommentList = Collections . unmodifiableList ( commentList ) ; } } void setTypeRoot ( ITypeRoot typeRoot ) { this . typeRoot = typeRoot ; } void setLineEndTable ( int [ ] lineEndTable ) { if ( lineEndTable == null ) { throw new NullPointerException ( ) ; } checkModifiable ( ) ; this . lineEndTable = lineEndTable ; } public void setPackage ( PackageDeclaration pkgDecl ) { ASTNode oldChild = this . optionalPackageDeclaration ; preReplaceChild ( oldChild , pkgDecl , PACKAGE_PROPERTY ) ; this . optionalPackageDeclaration = pkgDecl ; postReplaceChild ( oldChild , pkgDecl , PACKAGE_PROPERTY ) ; } void setProblems ( IProblem [ ] problems ) { if ( problems == null ) { throw new IllegalArgumentException ( ) ; } this . problems = problems ; } void setStatementsRecoveryData ( Object data ) { this . statementsRecoveryData = data ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } int treeSize ( ) { int size = memSize ( ) ; if ( this . optionalPackageDeclaration != null ) { size += getPackage ( ) . treeSize ( ) ; } size += this . imports . listSize ( ) ; size += this . types . listSize ( ) ; if ( this . optionalCommentList != null ) { for ( int i = <NUM_LIT:0> ; i < this . optionalCommentList . size ( ) ; i ++ ) { Comment comment = ( Comment ) this . optionalCommentList . get ( i ) ; if ( comment != null && comment . getParent ( ) == null ) { size += comment . treeSize ( ) ; } } } return size ; } public List types ( ) { return this . types ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class MemberValuePair extends ASTNode { public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( MemberValuePair . class , "<STR_LIT:name>" , SimpleName . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor VALUE_PROPERTY = new ChildPropertyDescriptor ( MemberValuePair . class , "<STR_LIT:value>" , Expression . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( MemberValuePair . class , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; addProperty ( VALUE_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private SimpleName name = null ; private Expression value = null ; MemberValuePair ( AST ast ) { super ( ast ) ; unsupportedIn2 ( ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } if ( property == VALUE_PROPERTY ) { if ( get ) { return getValue ( ) ; } else { setValue ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return MEMBER_VALUE_PAIR ; } ASTNode clone0 ( AST target ) { MemberValuePair result = new MemberValuePair ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setName ( ( SimpleName ) ASTNode . copySubtree ( target , getName ( ) ) ) ; result . setValue ( ( Expression ) ASTNode . copySubtree ( target , getValue ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getName ( ) ) ; acceptChild ( visitor , getValue ( ) ) ; } visitor . endVisit ( this ) ; } public SimpleName getName ( ) { if ( this . name == null ) { synchronized ( this ) { if ( this . name == null ) { preLazyInit ( ) ; this . name = new SimpleName ( this . ast ) ; postLazyInit ( this . name , NAME_PROPERTY ) ; } } } return this . name ; } public final IMemberValuePairBinding resolveMemberValuePairBinding ( ) { return this . ast . getBindingResolver ( ) . resolveMemberValuePair ( this ) ; } public void setName ( SimpleName name ) { if ( name == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . name ; preReplaceChild ( oldChild , name , NAME_PROPERTY ) ; this . name = name ; postReplaceChild ( oldChild , name , NAME_PROPERTY ) ; } public Expression getValue ( ) { if ( this . value == null ) { synchronized ( this ) { if ( this . value == null ) { preLazyInit ( ) ; this . value = new SimpleName ( this . ast ) ; postLazyInit ( this . value , VALUE_PROPERTY ) ; } } } return this . value ; } public void setValue ( Expression value ) { if ( value == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . value ; preReplaceChild ( oldChild , value , VALUE_PROPERTY ) ; this . value = value ; postReplaceChild ( oldChild , value , VALUE_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . name == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) + ( this . value == null ? <NUM_LIT:0> : getValue ( ) . treeSize ( ) ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . Iterator ; import java . util . List ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Status ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IPackageFragment ; import org . eclipse . jdt . core . IPackageFragmentRoot ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . env . IBinaryAnnotation ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . compiler . env . INameEnvironment ; import org . eclipse . jdt . internal . compiler . env . NameEnvironmentAnswer ; import org . eclipse . jdt . internal . compiler . lookup . BinaryTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . compiler . util . Util ; import org . eclipse . jdt . internal . core . NameLookup ; import org . eclipse . jdt . internal . core . SearchableEnvironment ; class PackageBinding implements IPackageBinding { private static final String [ ] NO_NAME_COMPONENTS = CharOperation . NO_STRINGS ; private static final String UNNAMED = Util . EMPTY_STRING ; private static final char PACKAGE_NAME_SEPARATOR = '<CHAR_LIT:.>' ; private org . eclipse . jdt . internal . compiler . lookup . PackageBinding binding ; private String name ; private BindingResolver resolver ; private String [ ] components ; PackageBinding ( org . eclipse . jdt . internal . compiler . lookup . PackageBinding binding , BindingResolver resolver ) { this . binding = binding ; this . resolver = resolver ; } public IAnnotationBinding [ ] getAnnotations ( ) { try { INameEnvironment nameEnvironment = this . binding . environment . nameEnvironment ; if ( ! ( nameEnvironment instanceof SearchableEnvironment ) ) return AnnotationBinding . NoAnnotations ; NameLookup nameLookup = ( ( SearchableEnvironment ) nameEnvironment ) . nameLookup ; if ( nameLookup == null ) return AnnotationBinding . NoAnnotations ; final String pkgName = getName ( ) ; IPackageFragment [ ] pkgs = nameLookup . findPackageFragments ( pkgName , false ) ; if ( pkgs == null ) return AnnotationBinding . NoAnnotations ; for ( int i = <NUM_LIT:0> , len = pkgs . length ; i < len ; i ++ ) { int fragType = pkgs [ i ] . getKind ( ) ; switch ( fragType ) { case IPackageFragmentRoot . K_SOURCE : String unitName = "<STR_LIT>" ; ICompilationUnit unit = pkgs [ i ] . getCompilationUnit ( unitName ) ; if ( unit != null && unit . exists ( ) ) { ASTParser p = ASTParser . newParser ( AST . JLS3 ) ; p . setSource ( unit ) ; p . setResolveBindings ( true ) ; p . setUnitName ( unitName ) ; p . setFocalPosition ( <NUM_LIT:0> ) ; p . setKind ( ASTParser . K_COMPILATION_UNIT ) ; CompilationUnit domUnit = ( CompilationUnit ) p . createAST ( null ) ; PackageDeclaration pkgDecl = domUnit . getPackage ( ) ; if ( pkgDecl != null ) { List annos = pkgDecl . annotations ( ) ; if ( annos == null || annos . isEmpty ( ) ) return AnnotationBinding . NoAnnotations ; IAnnotationBinding [ ] result = new IAnnotationBinding [ annos . size ( ) ] ; int index = <NUM_LIT:0> ; for ( Iterator it = annos . iterator ( ) ; it . hasNext ( ) ; index ++ ) { result [ index ] = ( ( Annotation ) it . next ( ) ) . resolveAnnotationBinding ( ) ; if ( result [ index ] == null ) return AnnotationBinding . NoAnnotations ; } return result ; } } break ; case IPackageFragmentRoot . K_BINARY : NameEnvironmentAnswer answer = nameEnvironment . findType ( TypeConstants . PACKAGE_INFO_NAME , this . binding . compoundName ) ; if ( answer != null && answer . isBinaryType ( ) ) { IBinaryType type = answer . getBinaryType ( ) ; char [ ] [ ] [ ] missingTypeNames = type . getMissingTypeNames ( ) ; IBinaryAnnotation [ ] binaryAnnotations = type . getAnnotations ( ) ; org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding [ ] binaryInstances = BinaryTypeBinding . createAnnotations ( binaryAnnotations , this . binding . environment , missingTypeNames ) ; org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding [ ] allInstances = org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding . addStandardAnnotations ( binaryInstances , type . getTagBits ( ) , this . binding . environment ) ; int total = allInstances . length ; IAnnotationBinding [ ] domInstances = new AnnotationBinding [ total ] ; for ( int a = <NUM_LIT:0> ; a < total ; a ++ ) { final IAnnotationBinding annotationInstance = this . resolver . getAnnotationInstance ( allInstances [ a ] ) ; if ( annotationInstance == null ) { return AnnotationBinding . NoAnnotations ; } domInstances [ a ] = annotationInstance ; } return domInstances ; } } } } catch ( JavaModelException e ) { return AnnotationBinding . NoAnnotations ; } return AnnotationBinding . NoAnnotations ; } public String getName ( ) { if ( this . name == null ) { computeNameAndComponents ( ) ; } return this . name ; } public boolean isUnnamed ( ) { return getName ( ) . equals ( UNNAMED ) ; } public String [ ] getNameComponents ( ) { if ( this . components == null ) { computeNameAndComponents ( ) ; } return this . components ; } public int getKind ( ) { return IBinding . PACKAGE ; } public int getModifiers ( ) { return Modifier . NONE ; } public boolean isDeprecated ( ) { return false ; } public boolean isRecovered ( ) { return false ; } public boolean isSynthetic ( ) { return false ; } public IJavaElement getJavaElement ( ) { INameEnvironment nameEnvironment = this . binding . environment . nameEnvironment ; if ( ! ( nameEnvironment instanceof SearchableEnvironment ) ) return null ; NameLookup nameLookup = ( ( SearchableEnvironment ) nameEnvironment ) . nameLookup ; if ( nameLookup == null ) return null ; IJavaElement [ ] pkgs = nameLookup . findPackageFragments ( getName ( ) , false ) ; if ( pkgs == null ) return null ; if ( pkgs . length == <NUM_LIT:0> ) { org . eclipse . jdt . internal . core . util . Util . log ( new Status ( IStatus . WARNING , JavaCore . PLUGIN_ID , "<STR_LIT>" + getName ( ) + "<STR_LIT>" ) ) ; return null ; } return pkgs [ <NUM_LIT:0> ] ; } public String getKey ( ) { return new String ( this . binding . computeUniqueKey ( ) ) ; } public boolean isEqualTo ( IBinding other ) { if ( other == this ) { return true ; } if ( other == null ) { return false ; } if ( ! ( other instanceof PackageBinding ) ) { return false ; } org . eclipse . jdt . internal . compiler . lookup . PackageBinding packageBinding2 = ( ( PackageBinding ) other ) . binding ; return CharOperation . equals ( this . binding . compoundName , packageBinding2 . compoundName ) ; } private void computeNameAndComponents ( ) { char [ ] [ ] compoundName = this . binding . compoundName ; if ( compoundName == CharOperation . NO_CHAR_CHAR || compoundName == null ) { this . name = UNNAMED ; this . components = NO_NAME_COMPONENTS ; } else { int length = compoundName . length ; this . components = new String [ length ] ; StringBuffer buffer = new StringBuffer ( ) ; for ( int i = <NUM_LIT:0> ; i < length - <NUM_LIT:1> ; i ++ ) { this . components [ i ] = new String ( compoundName [ i ] ) ; buffer . append ( compoundName [ i ] ) . append ( PACKAGE_NAME_SEPARATOR ) ; } this . components [ length - <NUM_LIT:1> ] = new String ( compoundName [ length - <NUM_LIT:1> ] ) ; buffer . append ( compoundName [ length - <NUM_LIT:1> ] ) ; this . name = buffer . toString ( ) ; } } public String toString ( ) { return this . binding . toString ( ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class AssertStatement extends Statement { public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor ( AssertStatement . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; public static final ChildPropertyDescriptor MESSAGE_PROPERTY = new ChildPropertyDescriptor ( AssertStatement . class , "<STR_LIT:message>" , Expression . class , OPTIONAL , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( AssertStatement . class , properyList ) ; addProperty ( EXPRESSION_PROPERTY , properyList ) ; addProperty ( MESSAGE_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Expression expression = null ; private Expression optionalMessageExpression = null ; AssertStatement ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == EXPRESSION_PROPERTY ) { if ( get ) { return getExpression ( ) ; } else { setExpression ( ( Expression ) child ) ; return null ; } } if ( property == MESSAGE_PROPERTY ) { if ( get ) { return getMessage ( ) ; } else { setMessage ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return ASSERT_STATEMENT ; } ASTNode clone0 ( AST target ) { AssertStatement result = new AssertStatement ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; result . setExpression ( ( Expression ) ASTNode . copySubtree ( target , getExpression ( ) ) ) ; result . setMessage ( ( Expression ) ASTNode . copySubtree ( target , getMessage ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getExpression ( ) ) ; acceptChild ( visitor , getMessage ( ) ) ; } visitor . endVisit ( this ) ; } public Expression getExpression ( ) { if ( this . expression == null ) { synchronized ( this ) { if ( this . expression == null ) { preLazyInit ( ) ; this . expression = new SimpleName ( this . ast ) ; postLazyInit ( this . expression , EXPRESSION_PROPERTY ) ; } } } return this . expression ; } public void setExpression ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . expression ; preReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; this . expression = expression ; postReplaceChild ( oldChild , expression , EXPRESSION_PROPERTY ) ; } public Expression getMessage ( ) { return this . optionalMessageExpression ; } public void setMessage ( Expression expression ) { ASTNode oldChild = this . optionalMessageExpression ; preReplaceChild ( oldChild , expression , MESSAGE_PROPERTY ) ; this . optionalMessageExpression = expression ; postReplaceChild ( oldChild , expression , MESSAGE_PROPERTY ) ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . expression == null ? <NUM_LIT:0> : getExpression ( ) . treeSize ( ) ) + ( this . optionalMessageExpression == null ? <NUM_LIT:0> : getMessage ( ) . treeSize ( ) ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class EnumDeclaration extends AbstractTypeDeclaration { public static final ChildPropertyDescriptor JAVADOC_PROPERTY = internalJavadocPropertyFactory ( EnumDeclaration . class ) ; public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY = internalModifiers2PropertyFactory ( EnumDeclaration . class ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = internalNamePropertyFactory ( EnumDeclaration . class ) ; public static final ChildListPropertyDescriptor SUPER_INTERFACE_TYPES_PROPERTY = new ChildListPropertyDescriptor ( EnumDeclaration . class , "<STR_LIT>" , Type . class , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor ENUM_CONSTANTS_PROPERTY = new ChildListPropertyDescriptor ( EnumDeclaration . class , "<STR_LIT>" , EnumConstantDeclaration . class , CYCLE_RISK ) ; public static final ChildListPropertyDescriptor BODY_DECLARATIONS_PROPERTY = internalBodyDeclarationPropertyFactory ( EnumDeclaration . class ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:6> ) ; createPropertyList ( EnumDeclaration . class , properyList ) ; addProperty ( JAVADOC_PROPERTY , properyList ) ; addProperty ( MODIFIERS2_PROPERTY , properyList ) ; addProperty ( NAME_PROPERTY , properyList ) ; addProperty ( SUPER_INTERFACE_TYPES_PROPERTY , properyList ) ; addProperty ( ENUM_CONSTANTS_PROPERTY , properyList ) ; addProperty ( BODY_DECLARATIONS_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private ASTNode . NodeList superInterfaceTypes = new ASTNode . NodeList ( SUPER_INTERFACE_TYPES_PROPERTY ) ; private ASTNode . NodeList enumConstants = new ASTNode . NodeList ( ENUM_CONSTANTS_PROPERTY ) ; EnumDeclaration ( AST ast ) { super ( ast ) ; unsupportedIn2 ( ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == JAVADOC_PROPERTY ) { if ( get ) { return getJavadoc ( ) ; } else { setJavadoc ( ( Javadoc ) child ) ; return null ; } } if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == MODIFIERS2_PROPERTY ) { return modifiers ( ) ; } if ( property == SUPER_INTERFACE_TYPES_PROPERTY ) { return superInterfaceTypes ( ) ; } if ( property == ENUM_CONSTANTS_PROPERTY ) { return enumConstants ( ) ; } if ( property == BODY_DECLARATIONS_PROPERTY ) { return bodyDeclarations ( ) ; } return super . internalGetChildListProperty ( property ) ; } final ChildPropertyDescriptor internalJavadocProperty ( ) { return JAVADOC_PROPERTY ; } final ChildListPropertyDescriptor internalModifiers2Property ( ) { return MODIFIERS2_PROPERTY ; } final SimplePropertyDescriptor internalModifiersProperty ( ) { return null ; } final ChildPropertyDescriptor internalNameProperty ( ) { return NAME_PROPERTY ; } final ChildListPropertyDescriptor internalBodyDeclarationsProperty ( ) { return BODY_DECLARATIONS_PROPERTY ; } final int getNodeType0 ( ) { return ENUM_DECLARATION ; } ASTNode clone0 ( AST target ) { EnumDeclaration result = new EnumDeclaration ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setJavadoc ( ( Javadoc ) ASTNode . copySubtree ( target , getJavadoc ( ) ) ) ; result . modifiers ( ) . addAll ( ASTNode . copySubtrees ( target , modifiers ( ) ) ) ; result . setName ( ( SimpleName ) getName ( ) . clone ( target ) ) ; result . superInterfaceTypes ( ) . addAll ( ASTNode . copySubtrees ( target , superInterfaceTypes ( ) ) ) ; result . enumConstants ( ) . addAll ( ASTNode . copySubtrees ( target , enumConstants ( ) ) ) ; result . bodyDeclarations ( ) . addAll ( ASTNode . copySubtrees ( target , bodyDeclarations ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getJavadoc ( ) ) ; acceptChildren ( visitor , this . modifiers ) ; acceptChild ( visitor , getName ( ) ) ; acceptChildren ( visitor , this . superInterfaceTypes ) ; acceptChildren ( visitor , this . enumConstants ) ; acceptChildren ( visitor , this . bodyDeclarations ) ; } visitor . endVisit ( this ) ; } public List superInterfaceTypes ( ) { return this . superInterfaceTypes ; } public List enumConstants ( ) { return this . enumConstants ; } ITypeBinding internalResolveBinding ( ) { return this . ast . getBindingResolver ( ) . resolveType ( this ) ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalDocComment == null ? <NUM_LIT:0> : getJavadoc ( ) . treeSize ( ) ) + this . modifiers . listSize ( ) + ( this . typeName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) + this . superInterfaceTypes . listSize ( ) + this . enumConstants . listSize ( ) + this . bodyDeclarations . listSize ( ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; public abstract class Type extends ASTNode { Type ( AST ast ) { super ( ast ) ; } public final boolean isPrimitiveType ( ) { return ( this instanceof PrimitiveType ) ; } public final boolean isSimpleType ( ) { return ( this instanceof SimpleType ) ; } public final boolean isArrayType ( ) { return ( this instanceof ArrayType ) ; } public final boolean isParameterizedType ( ) { return ( this instanceof ParameterizedType ) ; } public final boolean isQualifiedType ( ) { return ( this instanceof QualifiedType ) ; } public final boolean isUnionType ( ) { return ( this instanceof UnionType ) ; } public final boolean isWildcardType ( ) { return ( this instanceof WildcardType ) ; } public final ITypeBinding resolveBinding ( ) { return this . ast . getBindingResolver ( ) . resolveType ( this ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; public interface IMethodBinding extends IBinding { public boolean isConstructor ( ) ; public boolean isDefaultConstructor ( ) ; public String getName ( ) ; public ITypeBinding getDeclaringClass ( ) ; public Object getDefaultValue ( ) ; public IAnnotationBinding [ ] getParameterAnnotations ( int paramIndex ) ; public ITypeBinding [ ] getParameterTypes ( ) ; public ITypeBinding getReturnType ( ) ; public ITypeBinding [ ] getExceptionTypes ( ) ; public ITypeBinding [ ] getTypeParameters ( ) ; public boolean isAnnotationMember ( ) ; public boolean isGenericMethod ( ) ; public boolean isParameterizedMethod ( ) ; public ITypeBinding [ ] getTypeArguments ( ) ; public IMethodBinding getMethodDeclaration ( ) ; public boolean isRawMethod ( ) ; public boolean isSubsignature ( IMethodBinding otherMethod ) ; public boolean isVarargs ( ) ; public boolean overrides ( IMethodBinding method ) ; } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class TypeParameter extends ASTNode { public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( TypeParameter . class , "<STR_LIT:name>" , SimpleName . class , MANDATORY , NO_CYCLE_RISK ) ; public static final ChildListPropertyDescriptor TYPE_BOUNDS_PROPERTY = new ChildListPropertyDescriptor ( TypeParameter . class , "<STR_LIT>" , Type . class , NO_CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( TypeParameter . class , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; addProperty ( TYPE_BOUNDS_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private SimpleName typeVariableName = null ; private ASTNode . NodeList typeBounds = new ASTNode . NodeList ( TYPE_BOUNDS_PROPERTY ) ; TypeParameter ( AST ast ) { super ( ast ) ; unsupportedIn2 ( ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { if ( property == TYPE_BOUNDS_PROPERTY ) { return typeBounds ( ) ; } return super . internalGetChildListProperty ( property ) ; } final int getNodeType0 ( ) { return TYPE_PARAMETER ; } ASTNode clone0 ( AST target ) { TypeParameter result = new TypeParameter ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setName ( ( SimpleName ) ( ( ASTNode ) getName ( ) ) . clone ( target ) ) ; result . typeBounds ( ) . addAll ( ASTNode . copySubtrees ( target , typeBounds ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getName ( ) ) ; acceptChildren ( visitor , this . typeBounds ) ; } visitor . endVisit ( this ) ; } public SimpleName getName ( ) { if ( this . typeVariableName == null ) { synchronized ( this ) { if ( this . typeVariableName == null ) { preLazyInit ( ) ; this . typeVariableName = new SimpleName ( this . ast ) ; postLazyInit ( this . typeVariableName , NAME_PROPERTY ) ; } } } return this . typeVariableName ; } public final ITypeBinding resolveBinding ( ) { return this . ast . getBindingResolver ( ) . resolveTypeParameter ( this ) ; } public void setName ( SimpleName typeName ) { if ( typeName == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . typeVariableName ; preReplaceChild ( oldChild , typeName , NAME_PROPERTY ) ; this . typeVariableName = typeName ; postReplaceChild ( oldChild , typeName , NAME_PROPERTY ) ; } public List typeBounds ( ) { return this . typeBounds ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . typeVariableName == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) + this . typeBounds . listSize ( ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class QualifiedType extends Type { int index ; public static final ChildPropertyDescriptor QUALIFIER_PROPERTY = new ChildPropertyDescriptor ( QualifiedType . class , "<STR_LIT>" , Type . class , MANDATORY , CYCLE_RISK ) ; public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor ( QualifiedType . class , "<STR_LIT:name>" , SimpleName . class , MANDATORY , NO_CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( QualifiedType . class , propertyList ) ; addProperty ( QUALIFIER_PROPERTY , propertyList ) ; addProperty ( NAME_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private Type qualifier = null ; private SimpleName name = null ; QualifiedType ( AST ast ) { super ( ast ) ; unsupportedIn2 ( ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == QUALIFIER_PROPERTY ) { if ( get ) { return getQualifier ( ) ; } else { setQualifier ( ( Type ) child ) ; return null ; } } if ( property == NAME_PROPERTY ) { if ( get ) { return getName ( ) ; } else { setName ( ( SimpleName ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return QUALIFIED_TYPE ; } ASTNode clone0 ( AST target ) { QualifiedType result = new QualifiedType ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setQualifier ( ( Type ) ( ( ASTNode ) getQualifier ( ) ) . clone ( target ) ) ; result . setName ( ( SimpleName ) ( ( ASTNode ) getName ( ) ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getQualifier ( ) ) ; acceptChild ( visitor , getName ( ) ) ; } visitor . endVisit ( this ) ; } public Type getQualifier ( ) { if ( this . qualifier == null ) { synchronized ( this ) { if ( this . qualifier == null ) { preLazyInit ( ) ; this . qualifier = new SimpleType ( this . ast ) ; postLazyInit ( this . qualifier , QUALIFIER_PROPERTY ) ; } } } return this . qualifier ; } public void setQualifier ( Type type ) { if ( type == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . qualifier ; preReplaceChild ( oldChild , type , QUALIFIER_PROPERTY ) ; this . qualifier = type ; postReplaceChild ( oldChild , type , QUALIFIER_PROPERTY ) ; } public SimpleName getName ( ) { if ( this . name == null ) { synchronized ( this ) { if ( this . name == null ) { preLazyInit ( ) ; this . name = new SimpleName ( this . ast ) ; postLazyInit ( this . name , NAME_PROPERTY ) ; } } } return this . name ; } public void setName ( SimpleName name ) { if ( name == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . name ; preReplaceChild ( oldChild , name , NAME_PROPERTY ) ; this . name = name ; postReplaceChild ( oldChild , name , NAME_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:3> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . qualifier == null ? <NUM_LIT:0> : getQualifier ( ) . treeSize ( ) ) + ( this . name == null ? <NUM_LIT:0> : getName ( ) . treeSize ( ) ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; public abstract class Comment extends ASTNode { private ASTNode alternateRoot = null ; Comment ( AST ast ) { super ( ast ) ; } public final boolean isBlockComment ( ) { return ( this instanceof BlockComment ) ; } public final boolean isLineComment ( ) { return ( this instanceof LineComment ) ; } public final boolean isDocComment ( ) { return ( this instanceof Javadoc ) ; } public final ASTNode getAlternateRoot ( ) { return this . alternateRoot ; } public final void setAlternateRoot ( ASTNode root ) { checkModifiable ( ) ; this . alternateRoot = root ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:1> * <NUM_LIT:4> ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; public class PrefixExpression extends Expression { public static class Operator { private String token ; private Operator ( String token ) { this . token = token ; } public String toString ( ) { return this . token ; } public static final Operator INCREMENT = new Operator ( "<STR_LIT>" ) ; public static final Operator DECREMENT = new Operator ( "<STR_LIT:-->" ) ; public static final Operator PLUS = new Operator ( "<STR_LIT:+>" ) ; public static final Operator MINUS = new Operator ( "<STR_LIT:->" ) ; public static final Operator COMPLEMENT = new Operator ( "<STR_LIT>" ) ; public static final Operator NOT = new Operator ( "<STR_LIT:!>" ) ; private static final Map CODES ; static { CODES = new HashMap ( <NUM_LIT:20> ) ; Operator [ ] ops = { INCREMENT , DECREMENT , PLUS , MINUS , COMPLEMENT , NOT , } ; for ( int i = <NUM_LIT:0> ; i < ops . length ; i ++ ) { CODES . put ( ops [ i ] . toString ( ) , ops [ i ] ) ; } } public static Operator toOperator ( String token ) { return ( Operator ) CODES . get ( token ) ; } } public static final SimplePropertyDescriptor OPERATOR_PROPERTY = new SimplePropertyDescriptor ( PrefixExpression . class , "<STR_LIT>" , PrefixExpression . Operator . class , MANDATORY ) ; public static final ChildPropertyDescriptor OPERAND_PROPERTY = new ChildPropertyDescriptor ( PrefixExpression . class , "<STR_LIT>" , Expression . class , MANDATORY , CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List propertyList = new ArrayList ( <NUM_LIT:3> ) ; createPropertyList ( PrefixExpression . class , propertyList ) ; addProperty ( OPERATOR_PROPERTY , propertyList ) ; addProperty ( OPERAND_PROPERTY , propertyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( propertyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private PrefixExpression . Operator operator = PrefixExpression . Operator . PLUS ; private Expression operand = null ; PrefixExpression ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final Object internalGetSetObjectProperty ( SimplePropertyDescriptor property , boolean get , Object value ) { if ( property == OPERATOR_PROPERTY ) { if ( get ) { return getOperator ( ) ; } else { setOperator ( ( Operator ) value ) ; return null ; } } return super . internalGetSetObjectProperty ( property , get , value ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == OPERAND_PROPERTY ) { if ( get ) { return getOperand ( ) ; } else { setOperand ( ( Expression ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return PREFIX_EXPRESSION ; } ASTNode clone0 ( AST target ) { PrefixExpression result = new PrefixExpression ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . setOperator ( getOperator ( ) ) ; result . setOperand ( ( Expression ) getOperand ( ) . clone ( target ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getOperand ( ) ) ; } visitor . endVisit ( this ) ; } public PrefixExpression . Operator getOperator ( ) { return this . operator ; } public void setOperator ( PrefixExpression . Operator operator ) { if ( operator == null ) { throw new IllegalArgumentException ( ) ; } preValueChange ( OPERATOR_PROPERTY ) ; this . operator = operator ; postValueChange ( OPERATOR_PROPERTY ) ; } public Expression getOperand ( ) { if ( this . operand == null ) { synchronized ( this ) { if ( this . operand == null ) { preLazyInit ( ) ; this . operand = new SimpleName ( this . ast ) ; postLazyInit ( this . operand , OPERAND_PROPERTY ) ; } } } return this . operand ; } public void setOperand ( Expression expression ) { if ( expression == null ) { throw new IllegalArgumentException ( ) ; } ASTNode oldChild = this . operand ; preReplaceChild ( oldChild , expression , OPERAND_PROPERTY ) ; this . operand = expression ; postReplaceChild ( oldChild , expression , OPERAND_PROPERTY ) ; } int memSize ( ) { return BASE_NODE_SIZE + <NUM_LIT:2> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . operand == null ? <NUM_LIT:0> : getOperand ( ) . treeSize ( ) ) ; } } </s>
|
<s> package org . eclipse . jdt . core . dom ; interface IDocElement { } </s>
|
<s> package org . eclipse . jdt . core . dom ; import java . util . ArrayList ; import java . util . List ; public class ContinueStatement extends Statement { public static final ChildPropertyDescriptor LABEL_PROPERTY = new ChildPropertyDescriptor ( ContinueStatement . class , "<STR_LIT:label>" , SimpleName . class , OPTIONAL , NO_CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; static { List properyList = new ArrayList ( <NUM_LIT:2> ) ; createPropertyList ( ContinueStatement . class , properyList ) ; addProperty ( LABEL_PROPERTY , properyList ) ; PROPERTY_DESCRIPTORS = reapPropertyList ( properyList ) ; } public static List propertyDescriptors ( int apiLevel ) { return PROPERTY_DESCRIPTORS ; } private SimpleName optionalLabel = null ; ContinueStatement ( AST ast ) { super ( ast ) ; } final List internalStructuralPropertiesForType ( int apiLevel ) { return propertyDescriptors ( apiLevel ) ; } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { if ( property == LABEL_PROPERTY ) { if ( get ) { return getLabel ( ) ; } else { setLabel ( ( SimpleName ) child ) ; return null ; } } return super . internalGetSetChildProperty ( property , get , child ) ; } final int getNodeType0 ( ) { return CONTINUE_STATEMENT ; } ASTNode clone0 ( AST target ) { ContinueStatement result = new ContinueStatement ( target ) ; result . setSourceRange ( getStartPosition ( ) , getLength ( ) ) ; result . copyLeadingComment ( this ) ; result . setLabel ( ( SimpleName ) ASTNode . copySubtree ( target , getLabel ( ) ) ) ; return result ; } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { return matcher . match ( this , other ) ; } void accept0 ( ASTVisitor visitor ) { boolean visitChildren = visitor . visit ( this ) ; if ( visitChildren ) { acceptChild ( visitor , getLabel ( ) ) ; } visitor . endVisit ( this ) ; } public SimpleName getLabel ( ) { return this . optionalLabel ; } public void setLabel ( SimpleName label ) { ASTNode oldChild = this . optionalLabel ; preReplaceChild ( oldChild , label , LABEL_PROPERTY ) ; this . optionalLabel = label ; postReplaceChild ( oldChild , label , LABEL_PROPERTY ) ; } int memSize ( ) { return super . memSize ( ) + <NUM_LIT:1> * <NUM_LIT:4> ; } int treeSize ( ) { return memSize ( ) + ( this . optionalLabel == null ? <NUM_LIT:0> : getLabel ( ) . treeSize ( ) ) ; } } </s>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.