text
stringlengths
30
1.67M
<s> package org . eclipse . jdt . internal . core . builder ; import org . eclipse . core . resources . IFile ; import org . eclipse . jdt . core . compiler . * ; public class CompilationParticipantResult extends BuildContext { protected SourceFile sourceFile ; protected boolean hasAnnotations ; protected IFile [ ] addedFiles ; protected IFile [ ] deletedFiles ; protected CategorizedProblem [ ] problems ; protected String [ ] dependencies ; protected CompilationParticipantResult ( SourceFile sourceFile ) { this . sourceFile = sourceFile ; this . hasAnnotations = false ; this . addedFiles = null ; this . deletedFiles = null ; this . problems = null ; this . dependencies = null ; } public char [ ] getContents ( ) { return this . sourceFile . getContents ( ) ; } public IFile getFile ( ) { return this . sourceFile . resource ; } public boolean hasAnnotations ( ) { return this . hasAnnotations ; } public void recordAddedGeneratedFiles ( IFile [ ] addedGeneratedFiles ) { int length2 = addedGeneratedFiles . length ; if ( length2 == <NUM_LIT:0> ) return ; int length1 = this . addedFiles == null ? <NUM_LIT:0> : this . addedFiles . length ; IFile [ ] merged = new IFile [ length1 + length2 ] ; if ( length1 > <NUM_LIT:0> ) System . arraycopy ( this . addedFiles , <NUM_LIT:0> , merged , <NUM_LIT:0> , length1 ) ; System . arraycopy ( addedGeneratedFiles , <NUM_LIT:0> , merged , length1 , length2 ) ; this . addedFiles = merged ; } public void recordDeletedGeneratedFiles ( IFile [ ] deletedGeneratedFiles ) { int length2 = deletedGeneratedFiles . length ; if ( length2 == <NUM_LIT:0> ) return ; int length1 = this . deletedFiles == null ? <NUM_LIT:0> : this . deletedFiles . length ; IFile [ ] merged = new IFile [ length1 + length2 ] ; if ( length1 > <NUM_LIT:0> ) System . arraycopy ( this . deletedFiles , <NUM_LIT:0> , merged , <NUM_LIT:0> , length1 ) ; System . arraycopy ( deletedGeneratedFiles , <NUM_LIT:0> , merged , length1 , length2 ) ; this . deletedFiles = merged ; } public void recordDependencies ( String [ ] typeNameDependencies ) { int length2 = typeNameDependencies . length ; if ( length2 == <NUM_LIT:0> ) return ; int length1 = this . dependencies == null ? <NUM_LIT:0> : this . dependencies . length ; String [ ] merged = new String [ length1 + length2 ] ; if ( length1 > <NUM_LIT:0> ) System . arraycopy ( this . dependencies , <NUM_LIT:0> , merged , <NUM_LIT:0> , length1 ) ; System . arraycopy ( typeNameDependencies , <NUM_LIT:0> , merged , length1 , length2 ) ; this . dependencies = merged ; } public void recordNewProblems ( CategorizedProblem [ ] newProblems ) { int length2 = newProblems . length ; if ( length2 == <NUM_LIT:0> ) return ; int length1 = this . problems == null ? <NUM_LIT:0> : this . problems . length ; CategorizedProblem [ ] merged = new CategorizedProblem [ length1 + length2 ] ; if ( length1 > <NUM_LIT:0> ) System . arraycopy ( this . problems , <NUM_LIT:0> , merged , <NUM_LIT:0> , length1 ) ; System . arraycopy ( newProblems , <NUM_LIT:0> , merged , length1 , length2 ) ; this . problems = merged ; } void reset ( boolean detectedAnnotations ) { this . hasAnnotations = detectedAnnotations ; this . addedFiles = null ; this . deletedFiles = null ; this . problems = null ; this . dependencies = null ; } public String toString ( ) { return this . sourceFile . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . builder ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; public class ReferenceCollection { char [ ] [ ] [ ] qualifiedNameReferences ; char [ ] [ ] simpleNameReferences ; char [ ] [ ] rootReferences ; protected ReferenceCollection ( char [ ] [ ] [ ] qualifiedNameReferences , char [ ] [ ] simpleNameReferences , char [ ] [ ] rootReferences ) { this . qualifiedNameReferences = internQualifiedNames ( qualifiedNameReferences , false ) ; this . simpleNameReferences = internSimpleNames ( simpleNameReferences , true ) ; this . rootReferences = internSimpleNames ( rootReferences , false ) ; } public void addDependencies ( String [ ] typeNameDependencies ) { char [ ] [ ] [ ] qNames = new char [ typeNameDependencies . length ] [ ] [ ] ; for ( int i = typeNameDependencies . length ; -- i >= <NUM_LIT:0> ; ) qNames [ i ] = CharOperation . splitOn ( '<CHAR_LIT:.>' , typeNameDependencies [ i ] . toCharArray ( ) ) ; qNames = internQualifiedNames ( qNames , false ) ; next : for ( int i = qNames . length ; -- i >= <NUM_LIT:0> ; ) { char [ ] [ ] qualifiedTypeName = qNames [ i ] ; while ( ! includes ( qualifiedTypeName ) ) { if ( ! includes ( qualifiedTypeName [ qualifiedTypeName . length - <NUM_LIT:1> ] ) ) { int length = this . simpleNameReferences . length ; System . arraycopy ( this . simpleNameReferences , <NUM_LIT:0> , this . simpleNameReferences = new char [ length + <NUM_LIT:1> ] [ ] , <NUM_LIT:0> , length ) ; this . simpleNameReferences [ length ] = qualifiedTypeName [ qualifiedTypeName . length - <NUM_LIT:1> ] ; } if ( ! insideRoot ( qualifiedTypeName [ <NUM_LIT:0> ] ) ) { int length = this . rootReferences . length ; System . arraycopy ( this . rootReferences , <NUM_LIT:0> , this . rootReferences = new char [ length + <NUM_LIT:1> ] [ ] , <NUM_LIT:0> , length ) ; this . rootReferences [ length ] = qualifiedTypeName [ <NUM_LIT:0> ] ; } int length = this . qualifiedNameReferences . length ; System . arraycopy ( this . qualifiedNameReferences , <NUM_LIT:0> , this . qualifiedNameReferences = new char [ length + <NUM_LIT:1> ] [ ] [ ] , <NUM_LIT:0> , length ) ; this . qualifiedNameReferences [ length ] = qualifiedTypeName ; qualifiedTypeName = CharOperation . subarray ( qualifiedTypeName , <NUM_LIT:0> , qualifiedTypeName . length - <NUM_LIT:1> ) ; char [ ] [ ] [ ] temp = internQualifiedNames ( new char [ ] [ ] [ ] { qualifiedTypeName } , false ) ; if ( temp == EmptyQualifiedNames ) continue next ; qualifiedTypeName = temp [ <NUM_LIT:0> ] ; } } } public boolean includes ( char [ ] simpleName ) { for ( int i = <NUM_LIT:0> , l = this . simpleNameReferences . length ; i < l ; i ++ ) if ( simpleName == this . simpleNameReferences [ i ] ) return true ; return false ; } public boolean includes ( char [ ] [ ] qualifiedName ) { for ( int i = <NUM_LIT:0> , l = this . qualifiedNameReferences . length ; i < l ; i ++ ) if ( qualifiedName == this . qualifiedNameReferences [ i ] ) return true ; return false ; } public boolean includes ( char [ ] [ ] [ ] qualifiedNames , char [ ] [ ] simpleNames ) { return includes ( qualifiedNames , simpleNames , null ) ; } public boolean includes ( char [ ] [ ] [ ] qualifiedNames , char [ ] [ ] simpleNames , char [ ] [ ] rootNames ) { if ( rootNames != null ) { boolean foundRoot = false ; for ( int i = <NUM_LIT:0> , l = rootNames . length ; ! foundRoot && i < l ; i ++ ) foundRoot = insideRoot ( rootNames [ i ] ) ; if ( ! foundRoot ) return false ; } if ( simpleNames == null || qualifiedNames == null ) { if ( simpleNames == null && qualifiedNames == null ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" ) ; return true ; } else if ( qualifiedNames == null ) { for ( int i = <NUM_LIT:0> , l = simpleNames . length ; i < l ; i ++ ) { if ( includes ( simpleNames [ i ] ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + new String ( simpleNames [ i ] ) ) ; return true ; } } } else { for ( int i = <NUM_LIT:0> , l = qualifiedNames . length ; i < l ; i ++ ) { char [ ] [ ] qualifiedName = qualifiedNames [ i ] ; if ( qualifiedName . length == <NUM_LIT:1> ? includes ( qualifiedName [ <NUM_LIT:0> ] ) : includes ( qualifiedName ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + CharOperation . toString ( qualifiedName ) ) ; return true ; } } } return false ; } int sLength = simpleNames . length ; int qLength = qualifiedNames . length ; if ( sLength <= qLength ) { for ( int i = <NUM_LIT:0> ; i < sLength ; i ++ ) { if ( includes ( simpleNames [ i ] ) ) { for ( int j = <NUM_LIT:0> ; j < qLength ; j ++ ) { char [ ] [ ] qualifiedName = qualifiedNames [ j ] ; if ( qualifiedName . length == <NUM_LIT:1> ? includes ( qualifiedName [ <NUM_LIT:0> ] ) : includes ( qualifiedName ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + CharOperation . toString ( qualifiedName ) + "<STR_LIT:U+0020toU+0020>" + new String ( simpleNames [ i ] ) ) ; return true ; } } return false ; } } } else { for ( int i = <NUM_LIT:0> ; i < qLength ; i ++ ) { char [ ] [ ] qualifiedName = qualifiedNames [ i ] ; if ( qualifiedName . length == <NUM_LIT:1> ? includes ( qualifiedName [ <NUM_LIT:0> ] ) : includes ( qualifiedName ) ) { for ( int j = <NUM_LIT:0> ; j < sLength ; j ++ ) { if ( includes ( simpleNames [ j ] ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + CharOperation . toString ( qualifiedName ) + "<STR_LIT:U+0020toU+0020>" + new String ( simpleNames [ j ] ) ) ; return true ; } } return false ; } } } return false ; } public boolean insideRoot ( char [ ] rootName ) { for ( int i = <NUM_LIT:0> , l = this . rootReferences . length ; i < l ; i ++ ) if ( rootName == this . rootReferences [ i ] ) return true ; return false ; } static final char [ ] [ ] [ ] WellKnownQualifiedNames = new char [ ] [ ] [ ] { TypeConstants . JAVA_LANG_RUNTIMEEXCEPTION , TypeConstants . JAVA_LANG_THROWABLE , TypeConstants . JAVA_LANG_OBJECT , TypeConstants . JAVA_LANG , new char [ ] [ ] { TypeConstants . JAVA } , new char [ ] [ ] { new char [ ] { '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT>' } } , new char [ ] [ ] { new char [ ] { '<CHAR_LIT:c>' , '<CHAR_LIT>' , '<CHAR_LIT>' } } , CharOperation . NO_CHAR_CHAR } ; static final char [ ] [ ] WellKnownSimpleNames = new char [ ] [ ] { TypeConstants . JAVA_LANG_RUNTIMEEXCEPTION [ <NUM_LIT:2> ] , TypeConstants . JAVA_LANG_THROWABLE [ <NUM_LIT:2> ] , TypeConstants . JAVA_LANG_OBJECT [ <NUM_LIT:2> ] , TypeConstants . JAVA , TypeConstants . LANG , new char [ ] { '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT>' } , new char [ ] { '<CHAR_LIT:c>' , '<CHAR_LIT>' , '<CHAR_LIT>' } } ; static final char [ ] [ ] [ ] EmptyQualifiedNames = new char [ <NUM_LIT:0> ] [ ] [ ] ; static final char [ ] [ ] EmptySimpleNames = CharOperation . NO_CHAR_CHAR ; static final int MaxQualifiedNames = <NUM_LIT:7> ; static QualifiedNameSet [ ] InternedQualifiedNames = new QualifiedNameSet [ MaxQualifiedNames ] ; static final int MaxSimpleNames = <NUM_LIT:30> ; static NameSet [ ] InternedSimpleNames = new NameSet [ MaxSimpleNames ] ; static { for ( int i = <NUM_LIT:0> ; i < MaxQualifiedNames ; i ++ ) InternedQualifiedNames [ i ] = new QualifiedNameSet ( <NUM_LIT> ) ; for ( int i = <NUM_LIT:0> ; i < MaxSimpleNames ; i ++ ) InternedSimpleNames [ i ] = new NameSet ( <NUM_LIT> ) ; } public static char [ ] [ ] [ ] internQualifiedNames ( StringSet qualifiedStrings ) { if ( qualifiedStrings == null ) return EmptyQualifiedNames ; int length = qualifiedStrings . elementSize ; if ( length == <NUM_LIT:0> ) return EmptyQualifiedNames ; char [ ] [ ] [ ] result = new char [ length ] [ ] [ ] ; String [ ] strings = qualifiedStrings . values ; for ( int i = <NUM_LIT:0> , l = strings . length ; i < l ; i ++ ) if ( strings [ i ] != null ) result [ -- length ] = CharOperation . splitOn ( '<CHAR_LIT:/>' , strings [ i ] . toCharArray ( ) ) ; return internQualifiedNames ( result , false ) ; } public static char [ ] [ ] [ ] internQualifiedNames ( char [ ] [ ] [ ] qualifiedNames ) { return internQualifiedNames ( qualifiedNames , false ) ; } public static char [ ] [ ] [ ] internQualifiedNames ( char [ ] [ ] [ ] qualifiedNames , boolean keepWellKnown ) { if ( qualifiedNames == null ) return EmptyQualifiedNames ; int length = qualifiedNames . length ; if ( length == <NUM_LIT:0> ) return EmptyQualifiedNames ; char [ ] [ ] [ ] keepers = new char [ length ] [ ] [ ] ; int index = <NUM_LIT:0> ; next : for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { char [ ] [ ] qualifiedName = qualifiedNames [ i ] ; int qLength = qualifiedName . length ; for ( int j = <NUM_LIT:0> , m = WellKnownQualifiedNames . length ; j < m ; j ++ ) { char [ ] [ ] wellKnownName = WellKnownQualifiedNames [ j ] ; if ( qLength > wellKnownName . length ) break ; if ( CharOperation . equals ( qualifiedName , wellKnownName ) ) { if ( keepWellKnown ) { keepers [ index ++ ] = wellKnownName ; } continue next ; } } QualifiedNameSet internedNames = InternedQualifiedNames [ qLength <= MaxQualifiedNames ? qLength - <NUM_LIT:1> : <NUM_LIT:0> ] ; qualifiedName = internSimpleNames ( qualifiedName , false ) ; keepers [ index ++ ] = internedNames . add ( qualifiedName ) ; } if ( length > index ) { if ( index == <NUM_LIT:0> ) return EmptyQualifiedNames ; System . arraycopy ( keepers , <NUM_LIT:0> , keepers = new char [ index ] [ ] [ ] , <NUM_LIT:0> , index ) ; } return keepers ; } public static char [ ] [ ] internSimpleNames ( StringSet simpleStrings ) { return internSimpleNames ( simpleStrings , true ) ; } public static char [ ] [ ] internSimpleNames ( StringSet simpleStrings , boolean removeWellKnown ) { if ( simpleStrings == null ) return EmptySimpleNames ; int length = simpleStrings . elementSize ; if ( length == <NUM_LIT:0> ) return EmptySimpleNames ; char [ ] [ ] result = new char [ length ] [ ] ; String [ ] strings = simpleStrings . values ; for ( int i = <NUM_LIT:0> , l = strings . length ; i < l ; i ++ ) if ( strings [ i ] != null ) result [ -- length ] = strings [ i ] . toCharArray ( ) ; return internSimpleNames ( result , removeWellKnown ) ; } public static char [ ] [ ] internSimpleNames ( char [ ] [ ] simpleNames , boolean removeWellKnown ) { if ( simpleNames == null ) return EmptySimpleNames ; int length = simpleNames . length ; if ( length == <NUM_LIT:0> ) return EmptySimpleNames ; char [ ] [ ] keepers = new char [ length ] [ ] ; int index = <NUM_LIT:0> ; next : for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { char [ ] name = simpleNames [ i ] ; int sLength = name . length ; for ( int j = <NUM_LIT:0> , m = WellKnownSimpleNames . length ; j < m ; j ++ ) { char [ ] wellKnownName = WellKnownSimpleNames [ j ] ; if ( sLength > wellKnownName . length ) break ; if ( CharOperation . equals ( name , wellKnownName ) ) { if ( ! removeWellKnown ) keepers [ index ++ ] = WellKnownSimpleNames [ j ] ; continue next ; } } NameSet internedNames = InternedSimpleNames [ sLength < MaxSimpleNames ? sLength : <NUM_LIT:0> ] ; keepers [ index ++ ] = internedNames . add ( name ) ; } if ( length > index ) { if ( index == <NUM_LIT:0> ) return EmptySimpleNames ; System . arraycopy ( keepers , <NUM_LIT:0> , keepers = new char [ index ] [ ] , <NUM_LIT:0> , index ) ; } return keepers ; } } </s>
<s> package org . eclipse . jdt . internal . core . builder ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . runtime . * ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileReader ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFormatException ; import org . eclipse . jdt . internal . compiler . env . AccessRuleSet ; import org . eclipse . jdt . internal . compiler . env . NameEnvironmentAnswer ; import org . eclipse . jdt . internal . compiler . util . SimpleLookupTable ; import org . eclipse . jdt . internal . compiler . util . SimpleSet ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . core . util . Util ; import java . io . * ; import java . util . * ; import java . util . zip . * ; public class ClasspathJar extends ClasspathLocation { static class PackageCacheEntry { long lastModified ; long fileSize ; SimpleSet packageSet ; PackageCacheEntry ( long lastModified , long fileSize , SimpleSet packageSet ) { this . lastModified = lastModified ; this . fileSize = fileSize ; this . packageSet = packageSet ; } } static SimpleLookupTable PackageCache = new SimpleLookupTable ( ) ; static SimpleSet findPackageSet ( ClasspathJar jar ) { String zipFileName = jar . zipFilename ; long lastModified = jar . lastModified ( ) ; long fileSize = new File ( zipFileName ) . length ( ) ; PackageCacheEntry cacheEntry = ( PackageCacheEntry ) PackageCache . get ( zipFileName ) ; if ( cacheEntry != null && cacheEntry . lastModified == lastModified && cacheEntry . fileSize == fileSize ) return cacheEntry . packageSet ; SimpleSet packageSet = new SimpleSet ( <NUM_LIT> ) ; packageSet . add ( "<STR_LIT>" ) ; nextEntry : for ( Enumeration e = jar . zipFile . entries ( ) ; e . hasMoreElements ( ) ; ) { String fileName = ( ( ZipEntry ) e . nextElement ( ) ) . getName ( ) ; int last = fileName . lastIndexOf ( '<CHAR_LIT:/>' ) ; while ( last > <NUM_LIT:0> ) { String packageName = fileName . substring ( <NUM_LIT:0> , last ) ; if ( packageSet . addIfNotIncluded ( packageName ) == null ) continue nextEntry ; last = packageName . lastIndexOf ( '<CHAR_LIT:/>' ) ; } } PackageCache . put ( zipFileName , new PackageCacheEntry ( lastModified , fileSize , packageSet ) ) ; return packageSet ; } String zipFilename ; IFile resource ; ZipFile zipFile ; long lastModified ; boolean closeZipFileAtEnd ; SimpleSet knownPackageNames ; AccessRuleSet accessRuleSet ; ClasspathJar ( IFile resource , AccessRuleSet accessRuleSet ) { this . resource = resource ; try { java . net . URI location = resource . getLocationURI ( ) ; if ( location == null ) { this . zipFilename = "<STR_LIT>" ; } else { File localFile = Util . toLocalFile ( location , null ) ; this . zipFilename = localFile . getPath ( ) ; } } catch ( CoreException e ) { } this . zipFile = null ; this . knownPackageNames = null ; this . accessRuleSet = accessRuleSet ; } ClasspathJar ( String zipFilename , long lastModified , AccessRuleSet accessRuleSet ) { this . zipFilename = zipFilename ; this . lastModified = lastModified ; this . zipFile = null ; this . knownPackageNames = null ; this . accessRuleSet = accessRuleSet ; } public ClasspathJar ( ZipFile zipFile , AccessRuleSet accessRuleSet ) { this . zipFilename = zipFile . getName ( ) ; this . zipFile = zipFile ; this . closeZipFileAtEnd = false ; this . knownPackageNames = null ; this . accessRuleSet = accessRuleSet ; } public void cleanup ( ) { if ( this . zipFile != null && this . closeZipFileAtEnd ) { try { this . zipFile . close ( ) ; } catch ( IOException e ) { } this . zipFile = null ; } this . knownPackageNames = null ; } public boolean equals ( Object o ) { if ( this == o ) return true ; if ( ! ( o instanceof ClasspathJar ) ) return false ; ClasspathJar jar = ( ClasspathJar ) o ; if ( this . accessRuleSet != jar . accessRuleSet ) if ( this . accessRuleSet == null || ! this . accessRuleSet . equals ( jar . accessRuleSet ) ) return false ; return this . zipFilename . equals ( jar . zipFilename ) && lastModified ( ) == jar . lastModified ( ) ; } public NameEnvironmentAnswer findClass ( String binaryFileName , String qualifiedPackageName , String qualifiedBinaryFileName ) { if ( ! isPackage ( qualifiedPackageName ) ) return null ; try { ClassFileReader reader = ClassFileReader . read ( this . zipFile , qualifiedBinaryFileName ) ; if ( reader != null ) { if ( this . accessRuleSet == null ) return new NameEnvironmentAnswer ( reader , null ) ; String fileNameWithoutExtension = qualifiedBinaryFileName . substring ( <NUM_LIT:0> , qualifiedBinaryFileName . length ( ) - SuffixConstants . SUFFIX_CLASS . length ) ; return new NameEnvironmentAnswer ( reader , this . accessRuleSet . getViolatedRestriction ( fileNameWithoutExtension . toCharArray ( ) ) ) ; } } catch ( IOException e ) { } catch ( ClassFormatException e ) { } return null ; } public IPath getProjectRelativePath ( ) { if ( this . resource == null ) return null ; return this . resource . getProjectRelativePath ( ) ; } public int hashCode ( ) { return this . zipFilename == null ? super . hashCode ( ) : this . zipFilename . hashCode ( ) ; } public boolean isPackage ( String qualifiedPackageName ) { if ( this . knownPackageNames != null ) return this . knownPackageNames . includes ( qualifiedPackageName ) ; try { if ( this . zipFile == null ) { if ( org . eclipse . jdt . internal . core . JavaModelManager . ZIP_ACCESS_VERBOSE ) { System . out . println ( "<STR_LIT:(>" + Thread . currentThread ( ) + "<STR_LIT>" + this . zipFilename ) ; } this . zipFile = new ZipFile ( this . zipFilename ) ; this . closeZipFileAtEnd = true ; } this . knownPackageNames = findPackageSet ( this ) ; } catch ( Exception e ) { this . knownPackageNames = new SimpleSet ( ) ; } return this . knownPackageNames . includes ( qualifiedPackageName ) ; } public long lastModified ( ) { if ( this . lastModified == <NUM_LIT:0> ) this . lastModified = new File ( this . zipFilename ) . lastModified ( ) ; return this . lastModified ; } public String toString ( ) { String start = "<STR_LIT>" + this . zipFilename ; if ( this . accessRuleSet == null ) return start ; return start + "<STR_LIT>" + this . accessRuleSet ; } public String debugPathString ( ) { long time = lastModified ( ) ; if ( time == <NUM_LIT:0> ) return this . zipFilename ; return this . zipFilename + '<CHAR_LIT:(>' + ( new Date ( time ) ) + "<STR_LIT:U+0020:U+0020>" + time + '<CHAR_LIT:)>' ; } } </s>
<s> package org . eclipse . jdt . internal . core . builder ; import org . eclipse . core . runtime . * ; public class ImageBuilderInternalException extends RuntimeException { private static final long serialVersionUID = <NUM_LIT> ; protected CoreException coreException ; public ImageBuilderInternalException ( CoreException e ) { this . coreException = e ; } public CoreException getThrowable ( ) { return this . coreException ; } public void printStackTrace ( ) { if ( this . coreException != null ) { System . err . println ( this ) ; System . err . println ( "<STR_LIT>" ) ; this . coreException . printStackTrace ( ) ; } else { super . printStackTrace ( ) ; } } } </s>
<s> package org . eclipse . jdt . internal . core . builder ; import org . eclipse . jdt . core . compiler . CharOperation ; public final class NameSet { public char [ ] [ ] names ; public int elementSize ; public int threshold ; public NameSet ( int size ) { this . elementSize = <NUM_LIT:0> ; this . threshold = size ; int extraRoom = ( int ) ( size * <NUM_LIT> ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . names = new char [ extraRoom ] [ ] ; } public char [ ] add ( char [ ] name ) { int length = this . names . length ; int index = CharOperation . hashCode ( name ) % length ; char [ ] current ; while ( ( current = this . names [ index ] ) != null ) { if ( CharOperation . equals ( current , name ) ) return current ; if ( ++ index == length ) index = <NUM_LIT:0> ; } this . names [ index ] = name ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return name ; } private void rehash ( ) { NameSet newSet = new NameSet ( this . elementSize * <NUM_LIT:2> ) ; char [ ] current ; for ( int i = this . names . length ; -- i >= <NUM_LIT:0> ; ) if ( ( current = this . names [ i ] ) != null ) newSet . add ( current ) ; this . names = newSet . names ; this . elementSize = newSet . elementSize ; this . threshold = newSet . threshold ; } public String toString ( ) { String s = "<STR_LIT>" ; char [ ] name ; for ( int i = <NUM_LIT:0> , l = this . names . length ; i < l ; i ++ ) if ( ( name = this . names [ i ] ) != null ) s += new String ( name ) + "<STR_LIT:n>" ; return s ; } } </s>
<s> package org . eclipse . jdt . internal . core . builder ; import org . eclipse . core . resources . * ; import org . eclipse . core . runtime . * ; import org . eclipse . jdt . internal . compiler . env . AccessRuleSet ; import org . eclipse . jdt . internal . compiler . env . NameEnvironmentAnswer ; public abstract class ClasspathLocation { static ClasspathLocation forSourceFolder ( IContainer sourceFolder , IContainer outputFolder , char [ ] [ ] inclusionPatterns , char [ ] [ ] exclusionPatterns ) { return new ClasspathMultiDirectory ( sourceFolder , outputFolder , inclusionPatterns , exclusionPatterns ) ; } public static ClasspathLocation forBinaryFolder ( IContainer binaryFolder , boolean isOutputFolder , AccessRuleSet accessRuleSet ) { return new ClasspathDirectory ( binaryFolder , isOutputFolder , accessRuleSet ) ; } static ClasspathLocation forLibrary ( String libraryPathname , long lastModified , AccessRuleSet accessRuleSet ) { return new ClasspathJar ( libraryPathname , lastModified , accessRuleSet ) ; } static ClasspathLocation forLibrary ( String libraryPathname , AccessRuleSet accessRuleSet ) { return forLibrary ( libraryPathname , <NUM_LIT:0> , accessRuleSet ) ; } static ClasspathLocation forLibrary ( IFile library , AccessRuleSet accessRuleSet ) { return new ClasspathJar ( library , accessRuleSet ) ; } public abstract NameEnvironmentAnswer findClass ( String binaryFileName , String qualifiedPackageName , String qualifiedBinaryFileName ) ; public abstract IPath getProjectRelativePath ( ) ; public boolean isOutputFolder ( ) { return false ; } public abstract boolean isPackage ( String qualifiedPackageName ) ; public void cleanup ( ) { } public void reset ( ) { } public abstract String debugPathString ( ) ; } </s>
<s> package org . eclipse . jdt . internal . core . builder ; import org . eclipse . core . resources . * ; import org . eclipse . core . runtime . * ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . env . * ; import org . eclipse . jdt . internal . compiler . problem . AbortCompilation ; import org . eclipse . jdt . internal . compiler . util . SimpleLookupTable ; import org . eclipse . jdt . internal . compiler . util . SimpleSet ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . core . * ; import java . io . * ; import java . util . * ; public class NameEnvironment implements INameEnvironment , SuffixConstants { boolean isIncrementalBuild ; ClasspathMultiDirectory [ ] sourceLocations ; ClasspathLocation [ ] binaryLocations ; BuildNotifier notifier ; SimpleSet initialTypeNames ; SimpleLookupTable additionalUnits ; NameEnvironment ( IWorkspaceRoot root , JavaProject javaProject , SimpleLookupTable binaryLocationsPerProject , BuildNotifier notifier ) throws CoreException { this . isIncrementalBuild = false ; this . notifier = notifier ; computeClasspathLocations ( root , javaProject , binaryLocationsPerProject ) ; setNames ( null , null ) ; } public NameEnvironment ( IJavaProject javaProject ) { this . isIncrementalBuild = false ; try { computeClasspathLocations ( javaProject . getProject ( ) . getWorkspace ( ) . getRoot ( ) , ( JavaProject ) javaProject , null ) ; } catch ( CoreException e ) { this . sourceLocations = new ClasspathMultiDirectory [ <NUM_LIT:0> ] ; this . binaryLocations = new ClasspathLocation [ <NUM_LIT:0> ] ; } setNames ( null , null ) ; } private void computeClasspathLocations ( IWorkspaceRoot root , JavaProject javaProject , SimpleLookupTable binaryLocationsPerProject ) throws CoreException { IMarker cycleMarker = javaProject . getCycleMarker ( ) ; if ( cycleMarker != null ) { int severity = JavaCore . ERROR . equals ( javaProject . getOption ( JavaCore . CORE_CIRCULAR_CLASSPATH , true ) ) ? IMarker . SEVERITY_ERROR : IMarker . SEVERITY_WARNING ; if ( severity != cycleMarker . getAttribute ( IMarker . SEVERITY , severity ) ) cycleMarker . setAttribute ( IMarker . SEVERITY , severity ) ; } IClasspathEntry [ ] classpathEntries = javaProject . getExpandedClasspath ( ) ; ArrayList sLocations = new ArrayList ( classpathEntries . length ) ; ArrayList bLocations = new ArrayList ( classpathEntries . length ) ; nextEntry : for ( int i = <NUM_LIT:0> , l = classpathEntries . length ; i < l ; i ++ ) { ClasspathEntry entry = ( ClasspathEntry ) classpathEntries [ i ] ; IPath path = entry . getPath ( ) ; Object target = JavaModel . getTarget ( path , true ) ; if ( target == null ) continue nextEntry ; switch ( entry . getEntryKind ( ) ) { case IClasspathEntry . CPE_SOURCE : if ( ! ( target instanceof IContainer ) ) continue nextEntry ; IPath outputPath = entry . getOutputLocation ( ) != null ? entry . getOutputLocation ( ) : javaProject . getOutputLocation ( ) ; IContainer outputFolder ; if ( outputPath . segmentCount ( ) == <NUM_LIT:1> ) { outputFolder = javaProject . getProject ( ) ; } else { outputFolder = root . getFolder ( outputPath ) ; if ( ! outputFolder . exists ( ) ) createOutputFolder ( outputFolder ) ; } sLocations . add ( ClasspathLocation . forSourceFolder ( ( IContainer ) target , outputFolder , entry . fullInclusionPatternChars ( ) , entry . fullExclusionPatternChars ( ) ) ) ; continue nextEntry ; case IClasspathEntry . CPE_PROJECT : if ( ! ( target instanceof IProject ) ) continue nextEntry ; IProject prereqProject = ( IProject ) target ; if ( ! JavaProject . hasJavaNature ( prereqProject ) ) continue nextEntry ; JavaProject prereqJavaProject = ( JavaProject ) JavaCore . create ( prereqProject ) ; IClasspathEntry [ ] prereqClasspathEntries = prereqJavaProject . getRawClasspath ( ) ; ArrayList seen = new ArrayList ( ) ; nextPrereqEntry : for ( int j = <NUM_LIT:0> , m = prereqClasspathEntries . length ; j < m ; j ++ ) { IClasspathEntry prereqEntry = prereqClasspathEntries [ j ] ; if ( prereqEntry . getEntryKind ( ) == IClasspathEntry . CPE_SOURCE ) { Object prereqTarget = JavaModel . getTarget ( prereqEntry . getPath ( ) , true ) ; if ( ! ( prereqTarget instanceof IContainer ) ) continue nextPrereqEntry ; IPath prereqOutputPath = prereqEntry . getOutputLocation ( ) != null ? prereqEntry . getOutputLocation ( ) : prereqJavaProject . getOutputLocation ( ) ; IContainer binaryFolder = prereqOutputPath . segmentCount ( ) == <NUM_LIT:1> ? ( IContainer ) prereqProject : ( IContainer ) root . getFolder ( prereqOutputPath ) ; if ( binaryFolder . exists ( ) && ! seen . contains ( binaryFolder ) ) { seen . add ( binaryFolder ) ; ClasspathLocation bLocation = ClasspathLocation . forBinaryFolder ( binaryFolder , true , entry . getAccessRuleSet ( ) ) ; bLocations . add ( bLocation ) ; if ( binaryLocationsPerProject != null ) { ClasspathLocation [ ] existingLocations = ( ClasspathLocation [ ] ) binaryLocationsPerProject . get ( prereqProject ) ; if ( existingLocations == null ) { existingLocations = new ClasspathLocation [ ] { bLocation } ; } else { int size = existingLocations . length ; System . arraycopy ( existingLocations , <NUM_LIT:0> , existingLocations = new ClasspathLocation [ size + <NUM_LIT:1> ] , <NUM_LIT:0> , size ) ; existingLocations [ size ] = bLocation ; } binaryLocationsPerProject . put ( prereqProject , existingLocations ) ; } } } } continue nextEntry ; case IClasspathEntry . CPE_LIBRARY : if ( target instanceof IResource ) { IResource resource = ( IResource ) target ; ClasspathLocation bLocation = null ; if ( resource instanceof IFile ) { AccessRuleSet accessRuleSet = ( JavaCore . IGNORE . equals ( javaProject . getOption ( JavaCore . COMPILER_PB_FORBIDDEN_REFERENCE , true ) ) && JavaCore . IGNORE . equals ( javaProject . getOption ( JavaCore . COMPILER_PB_DISCOURAGED_REFERENCE , true ) ) ) ? null : entry . getAccessRuleSet ( ) ; bLocation = ClasspathLocation . forLibrary ( ( IFile ) resource , accessRuleSet ) ; } else if ( resource instanceof IContainer ) { AccessRuleSet accessRuleSet = ( JavaCore . IGNORE . equals ( javaProject . getOption ( JavaCore . COMPILER_PB_FORBIDDEN_REFERENCE , true ) ) && JavaCore . IGNORE . equals ( javaProject . getOption ( JavaCore . COMPILER_PB_DISCOURAGED_REFERENCE , true ) ) ) ? null : entry . getAccessRuleSet ( ) ; bLocation = ClasspathLocation . forBinaryFolder ( ( IContainer ) target , false , accessRuleSet ) ; } bLocations . add ( bLocation ) ; if ( binaryLocationsPerProject != null ) { IProject p = resource . getProject ( ) ; ClasspathLocation [ ] existingLocations = ( ClasspathLocation [ ] ) binaryLocationsPerProject . get ( p ) ; if ( existingLocations == null ) { existingLocations = new ClasspathLocation [ ] { bLocation } ; } else { int size = existingLocations . length ; System . arraycopy ( existingLocations , <NUM_LIT:0> , existingLocations = new ClasspathLocation [ size + <NUM_LIT:1> ] , <NUM_LIT:0> , size ) ; existingLocations [ size ] = bLocation ; } binaryLocationsPerProject . put ( p , existingLocations ) ; } } else if ( target instanceof File ) { AccessRuleSet accessRuleSet = ( JavaCore . IGNORE . equals ( javaProject . getOption ( JavaCore . COMPILER_PB_FORBIDDEN_REFERENCE , true ) ) && JavaCore . IGNORE . equals ( javaProject . getOption ( JavaCore . COMPILER_PB_DISCOURAGED_REFERENCE , true ) ) ) ? null : entry . getAccessRuleSet ( ) ; bLocations . add ( ClasspathLocation . forLibrary ( path . toString ( ) , accessRuleSet ) ) ; } continue nextEntry ; } } ArrayList outputFolders = new ArrayList ( <NUM_LIT:1> ) ; this . sourceLocations = new ClasspathMultiDirectory [ sLocations . size ( ) ] ; if ( ! sLocations . isEmpty ( ) ) { sLocations . toArray ( this . sourceLocations ) ; next : for ( int i = <NUM_LIT:0> , l = this . sourceLocations . length ; i < l ; i ++ ) { ClasspathMultiDirectory md = this . sourceLocations [ i ] ; IPath outputPath = md . binaryFolder . getFullPath ( ) ; for ( int j = <NUM_LIT:0> ; j < i ; j ++ ) { if ( outputPath . equals ( this . sourceLocations [ j ] . binaryFolder . getFullPath ( ) ) ) { md . hasIndependentOutputFolder = this . sourceLocations [ j ] . hasIndependentOutputFolder ; continue next ; } } outputFolders . add ( md ) ; for ( int j = <NUM_LIT:0> , m = this . sourceLocations . length ; j < m ; j ++ ) if ( outputPath . equals ( this . sourceLocations [ j ] . sourceFolder . getFullPath ( ) ) ) continue next ; md . hasIndependentOutputFolder = true ; } } this . binaryLocations = new ClasspathLocation [ outputFolders . size ( ) + bLocations . size ( ) ] ; int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , l = outputFolders . size ( ) ; i < l ; i ++ ) this . binaryLocations [ index ++ ] = ( ClasspathLocation ) outputFolders . get ( i ) ; for ( int i = <NUM_LIT:0> , l = bLocations . size ( ) ; i < l ; i ++ ) this . binaryLocations [ index ++ ] = ( ClasspathLocation ) bLocations . get ( i ) ; } public void cleanup ( ) { this . initialTypeNames = null ; this . additionalUnits = null ; for ( int i = <NUM_LIT:0> , l = this . sourceLocations . length ; i < l ; i ++ ) this . sourceLocations [ i ] . cleanup ( ) ; for ( int i = <NUM_LIT:0> , l = this . binaryLocations . length ; i < l ; i ++ ) this . binaryLocations [ i ] . cleanup ( ) ; } private void createOutputFolder ( IContainer outputFolder ) throws CoreException { createParentFolder ( outputFolder . getParent ( ) ) ; ( ( IFolder ) outputFolder ) . create ( IResource . FORCE | IResource . DERIVED , true , null ) ; } private void createParentFolder ( IContainer parent ) throws CoreException { if ( ! parent . exists ( ) ) { createParentFolder ( parent . getParent ( ) ) ; ( ( IFolder ) parent ) . create ( true , true , null ) ; } } private NameEnvironmentAnswer findClass ( String qualifiedTypeName , char [ ] typeName ) { if ( this . notifier != null ) this . notifier . checkCancelWithinCompiler ( ) ; if ( this . initialTypeNames != null && this . initialTypeNames . includes ( qualifiedTypeName ) ) { if ( this . isIncrementalBuild ) throw new AbortCompilation ( true , new AbortIncrementalBuildException ( qualifiedTypeName ) ) ; return null ; } if ( this . additionalUnits != null && this . sourceLocations . length > <NUM_LIT:0> ) { SourceFile unit = ( SourceFile ) this . additionalUnits . get ( qualifiedTypeName ) ; if ( unit != null ) return new NameEnvironmentAnswer ( unit , null ) ; } String qBinaryFileName = qualifiedTypeName + SUFFIX_STRING_class ; String binaryFileName = qBinaryFileName ; String qPackageName = "<STR_LIT>" ; if ( qualifiedTypeName . length ( ) > typeName . length ) { int typeNameStart = qBinaryFileName . length ( ) - typeName . length - <NUM_LIT:6> ; qPackageName = qBinaryFileName . substring ( <NUM_LIT:0> , typeNameStart - <NUM_LIT:1> ) ; binaryFileName = qBinaryFileName . substring ( typeNameStart ) ; } NameEnvironmentAnswer suggestedAnswer = null ; for ( int i = <NUM_LIT:0> , l = this . binaryLocations . length ; i < l ; i ++ ) { NameEnvironmentAnswer answer = this . binaryLocations [ i ] . findClass ( binaryFileName , qPackageName , qBinaryFileName ) ; if ( answer != null ) { if ( ! answer . ignoreIfBetter ( ) ) { if ( answer . isBetter ( suggestedAnswer ) ) return answer ; } else if ( answer . isBetter ( suggestedAnswer ) ) suggestedAnswer = answer ; } } if ( suggestedAnswer != null ) return suggestedAnswer ; return null ; } public NameEnvironmentAnswer findType ( char [ ] [ ] compoundName ) { if ( compoundName != null ) return findClass ( new String ( CharOperation . concatWith ( compoundName , '<CHAR_LIT:/>' ) ) , compoundName [ compoundName . length - <NUM_LIT:1> ] ) ; return null ; } public NameEnvironmentAnswer findType ( char [ ] typeName , char [ ] [ ] packageName ) { if ( typeName != null ) return findClass ( new String ( CharOperation . concatWith ( packageName , typeName , '<CHAR_LIT:/>' ) ) , typeName ) ; return null ; } public boolean isPackage ( char [ ] [ ] compoundName , char [ ] packageName ) { return isPackage ( new String ( CharOperation . concatWith ( compoundName , packageName , '<CHAR_LIT:/>' ) ) ) ; } public boolean isPackage ( String qualifiedPackageName ) { for ( int i = <NUM_LIT:0> , l = this . binaryLocations . length ; i < l ; i ++ ) if ( this . binaryLocations [ i ] . isPackage ( qualifiedPackageName ) ) return true ; return false ; } void setNames ( String [ ] typeNames , SourceFile [ ] additionalFiles ) { if ( typeNames == null ) { this . initialTypeNames = null ; } else { this . initialTypeNames = new SimpleSet ( typeNames . length ) ; for ( int i = <NUM_LIT:0> , l = typeNames . length ; i < l ; i ++ ) this . initialTypeNames . add ( typeNames [ i ] ) ; } if ( additionalFiles == null ) { this . additionalUnits = null ; } else { this . additionalUnits = new SimpleLookupTable ( additionalFiles . length ) ; for ( int i = <NUM_LIT:0> , l = additionalFiles . length ; i < l ; i ++ ) { SourceFile additionalUnit = additionalFiles [ i ] ; if ( additionalUnit != null ) this . additionalUnits . put ( additionalUnit . initialTypeName , additionalFiles [ i ] ) ; } } for ( int i = <NUM_LIT:0> , l = this . sourceLocations . length ; i < l ; i ++ ) this . sourceLocations [ i ] . reset ( ) ; for ( int i = <NUM_LIT:0> , l = this . binaryLocations . length ; i < l ; i ++ ) this . binaryLocations [ i ] . reset ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . builder ; import org . eclipse . core . resources . * ; import org . eclipse . core . runtime . * ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . env . AccessRuleSet ; import org . eclipse . jdt . internal . compiler . env . AccessRule ; import org . eclipse . jdt . internal . compiler . util . SimpleLookupTable ; import org . eclipse . jdt . internal . core . ClasspathAccessRule ; import org . eclipse . jdt . internal . core . JavaModelManager ; import java . io . * ; import java . util . * ; public class State { String javaProjectName ; ClasspathMultiDirectory [ ] sourceLocations ; ClasspathLocation [ ] binaryLocations ; SimpleLookupTable references ; public SimpleLookupTable typeLocators ; int buildNumber ; long lastStructuralBuildTime ; SimpleLookupTable structuralBuildTimes ; private String [ ] knownPackageNames ; private long previousStructuralBuildTime ; private StringSet structurallyChangedTypes ; public static int MaxStructurallyChangedTypes = <NUM_LIT:100> ; public static final byte VERSION = <NUM_LIT> ; static final byte SOURCE_FOLDER = <NUM_LIT:1> ; static final byte BINARY_FOLDER = <NUM_LIT:2> ; static final byte EXTERNAL_JAR = <NUM_LIT:3> ; static final byte INTERNAL_JAR = <NUM_LIT:4> ; State ( ) { } protected State ( JavaBuilder javaBuilder ) { this . knownPackageNames = null ; this . previousStructuralBuildTime = - <NUM_LIT:1> ; this . structurallyChangedTypes = null ; this . javaProjectName = javaBuilder . currentProject . getName ( ) ; this . sourceLocations = javaBuilder . nameEnvironment . sourceLocations ; this . binaryLocations = javaBuilder . nameEnvironment . binaryLocations ; this . references = new SimpleLookupTable ( <NUM_LIT:7> ) ; this . typeLocators = new SimpleLookupTable ( <NUM_LIT:7> ) ; this . buildNumber = <NUM_LIT:0> ; this . lastStructuralBuildTime = computeStructuralBuildTime ( javaBuilder . lastState == null ? <NUM_LIT:0> : javaBuilder . lastState . lastStructuralBuildTime ) ; this . structuralBuildTimes = new SimpleLookupTable ( <NUM_LIT:3> ) ; } long computeStructuralBuildTime ( long previousTime ) { long newTime = System . currentTimeMillis ( ) ; if ( newTime <= previousTime ) newTime = previousTime + <NUM_LIT:1> ; return newTime ; } void copyFrom ( State lastState ) { this . knownPackageNames = null ; this . previousStructuralBuildTime = lastState . previousStructuralBuildTime ; this . structurallyChangedTypes = lastState . structurallyChangedTypes ; this . buildNumber = lastState . buildNumber + <NUM_LIT:1> ; this . lastStructuralBuildTime = lastState . lastStructuralBuildTime ; this . structuralBuildTimes = lastState . structuralBuildTimes ; try { this . references = ( SimpleLookupTable ) lastState . references . clone ( ) ; this . typeLocators = ( SimpleLookupTable ) lastState . typeLocators . clone ( ) ; } catch ( CloneNotSupportedException e ) { this . references = new SimpleLookupTable ( lastState . references . elementSize ) ; Object [ ] keyTable = lastState . references . keyTable ; Object [ ] valueTable = lastState . references . valueTable ; for ( int i = <NUM_LIT:0> , l = keyTable . length ; i < l ; i ++ ) if ( keyTable [ i ] != null ) this . references . put ( keyTable [ i ] , valueTable [ i ] ) ; this . typeLocators = new SimpleLookupTable ( lastState . typeLocators . elementSize ) ; keyTable = lastState . typeLocators . keyTable ; valueTable = lastState . typeLocators . valueTable ; for ( int i = <NUM_LIT:0> , l = keyTable . length ; i < l ; i ++ ) if ( keyTable [ i ] != null ) this . typeLocators . put ( keyTable [ i ] , valueTable [ i ] ) ; } } public char [ ] [ ] getDefinedTypeNamesFor ( String typeLocator ) { Object c = this . references . get ( typeLocator ) ; if ( c instanceof AdditionalTypeCollection ) return ( ( AdditionalTypeCollection ) c ) . definedTypeNames ; return null ; } public SimpleLookupTable getReferences ( ) { return this . references ; } StringSet getStructurallyChangedTypes ( State prereqState ) { if ( prereqState != null && prereqState . previousStructuralBuildTime > <NUM_LIT:0> ) { Object o = this . structuralBuildTimes . get ( prereqState . javaProjectName ) ; long previous = o == null ? <NUM_LIT:0> : ( ( Long ) o ) . longValue ( ) ; if ( previous == prereqState . previousStructuralBuildTime ) return prereqState . structurallyChangedTypes ; } return null ; } public boolean isDuplicateLocator ( String qualifiedTypeName , String typeLocator ) { String existing = ( String ) this . typeLocators . get ( qualifiedTypeName ) ; return existing != null && ! existing . equals ( typeLocator ) ; } public boolean isKnownPackage ( String qualifiedPackageName ) { if ( this . knownPackageNames == null ) { ArrayList names = new ArrayList ( this . typeLocators . elementSize ) ; Object [ ] keyTable = this . typeLocators . keyTable ; for ( int i = <NUM_LIT:0> , l = keyTable . length ; i < l ; i ++ ) { if ( keyTable [ i ] != null ) { String packageName = ( String ) keyTable [ i ] ; int last = packageName . lastIndexOf ( '<CHAR_LIT:/>' ) ; packageName = last == - <NUM_LIT:1> ? null : packageName . substring ( <NUM_LIT:0> , last ) ; while ( packageName != null && ! names . contains ( packageName ) ) { names . add ( packageName ) ; last = packageName . lastIndexOf ( '<CHAR_LIT:/>' ) ; packageName = last == - <NUM_LIT:1> ? null : packageName . substring ( <NUM_LIT:0> , last ) ; } } } this . knownPackageNames = new String [ names . size ( ) ] ; names . toArray ( this . knownPackageNames ) ; } for ( int i = <NUM_LIT:0> , l = this . knownPackageNames . length ; i < l ; i ++ ) if ( this . knownPackageNames [ i ] . equals ( qualifiedPackageName ) ) return true ; return false ; } public boolean isKnownType ( String qualifiedTypeName ) { return this . typeLocators . containsKey ( qualifiedTypeName ) ; } boolean isSourceFolderEmpty ( IContainer sourceFolder ) { String sourceFolderName = sourceFolder . getProjectRelativePath ( ) . addTrailingSeparator ( ) . toString ( ) ; Object [ ] table = this . typeLocators . valueTable ; for ( int i = <NUM_LIT:0> , l = table . length ; i < l ; i ++ ) if ( table [ i ] != null && ( ( String ) table [ i ] ) . startsWith ( sourceFolderName ) ) return false ; return true ; } void record ( String typeLocator , char [ ] [ ] [ ] qualifiedRefs , char [ ] [ ] simpleRefs , char [ ] [ ] rootRefs , char [ ] mainTypeName , ArrayList typeNames ) { if ( typeNames . size ( ) == <NUM_LIT:1> && CharOperation . equals ( mainTypeName , ( char [ ] ) typeNames . get ( <NUM_LIT:0> ) ) ) { this . references . put ( typeLocator , new ReferenceCollection ( qualifiedRefs , simpleRefs , rootRefs ) ) ; } else { char [ ] [ ] definedTypeNames = new char [ typeNames . size ( ) ] [ ] ; typeNames . toArray ( definedTypeNames ) ; this . references . put ( typeLocator , new AdditionalTypeCollection ( definedTypeNames , qualifiedRefs , simpleRefs , rootRefs ) ) ; } } void recordLocatorForType ( String qualifiedTypeName , String typeLocator ) { this . knownPackageNames = null ; int start = typeLocator . indexOf ( qualifiedTypeName , <NUM_LIT:0> ) ; if ( start > <NUM_LIT:0> ) qualifiedTypeName = typeLocator . substring ( start , start + qualifiedTypeName . length ( ) ) ; this . typeLocators . put ( qualifiedTypeName , typeLocator ) ; } void recordStructuralDependency ( IProject prereqProject , State prereqState ) { if ( prereqState != null ) if ( prereqState . lastStructuralBuildTime > <NUM_LIT:0> ) this . structuralBuildTimes . put ( prereqProject . getName ( ) , new Long ( prereqState . lastStructuralBuildTime ) ) ; } void removeLocator ( String typeLocatorToRemove ) { this . knownPackageNames = null ; this . references . removeKey ( typeLocatorToRemove ) ; this . typeLocators . removeValue ( typeLocatorToRemove ) ; } void removePackage ( IResourceDelta sourceDelta ) { IResource resource = sourceDelta . getResource ( ) ; switch ( resource . getType ( ) ) { case IResource . FOLDER : IResourceDelta [ ] children = sourceDelta . getAffectedChildren ( ) ; for ( int i = <NUM_LIT:0> , l = children . length ; i < l ; i ++ ) removePackage ( children [ i ] ) ; return ; case IResource . FILE : IPath typeLocatorPath = resource . getProjectRelativePath ( ) ; if ( org . eclipse . jdt . internal . core . util . Util . isJavaLikeFileName ( typeLocatorPath . lastSegment ( ) ) ) removeLocator ( typeLocatorPath . toString ( ) ) ; } } void removeQualifiedTypeName ( String qualifiedTypeNameToRemove ) { this . knownPackageNames = null ; this . typeLocators . removeKey ( qualifiedTypeNameToRemove ) ; } static State read ( IProject project , DataInputStream in ) throws IOException { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + project . getName ( ) ) ; if ( VERSION != in . readByte ( ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + project . getName ( ) ) ; return null ; } State newState = new State ( ) ; newState . javaProjectName = in . readUTF ( ) ; if ( ! project . getName ( ) . equals ( newState . javaProjectName ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" ) ; return null ; } newState . buildNumber = in . readInt ( ) ; newState . lastStructuralBuildTime = in . readLong ( ) ; int length = in . readInt ( ) ; newState . sourceLocations = new ClasspathMultiDirectory [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IContainer sourceFolder = project , outputFolder = project ; String folderName ; if ( ( folderName = in . readUTF ( ) ) . length ( ) > <NUM_LIT:0> ) sourceFolder = project . getFolder ( folderName ) ; if ( ( folderName = in . readUTF ( ) ) . length ( ) > <NUM_LIT:0> ) outputFolder = project . getFolder ( folderName ) ; ClasspathMultiDirectory md = ( ClasspathMultiDirectory ) ClasspathLocation . forSourceFolder ( sourceFolder , outputFolder , readNames ( in ) , readNames ( in ) ) ; if ( in . readBoolean ( ) ) md . hasIndependentOutputFolder = true ; newState . sourceLocations [ i ] = md ; } length = in . readInt ( ) ; newState . binaryLocations = new ClasspathLocation [ length ] ; IWorkspaceRoot root = project . getWorkspace ( ) . getRoot ( ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { switch ( in . readByte ( ) ) { case SOURCE_FOLDER : newState . binaryLocations [ i ] = newState . sourceLocations [ in . readInt ( ) ] ; break ; case BINARY_FOLDER : IPath path = new Path ( in . readUTF ( ) ) ; IContainer outputFolder = path . segmentCount ( ) == <NUM_LIT:1> ? ( IContainer ) root . getProject ( path . toString ( ) ) : ( IContainer ) root . getFolder ( path ) ; newState . binaryLocations [ i ] = ClasspathLocation . forBinaryFolder ( outputFolder , in . readBoolean ( ) , readRestriction ( in ) ) ; break ; case EXTERNAL_JAR : newState . binaryLocations [ i ] = ClasspathLocation . forLibrary ( in . readUTF ( ) , in . readLong ( ) , readRestriction ( in ) ) ; break ; case INTERNAL_JAR : newState . binaryLocations [ i ] = ClasspathLocation . forLibrary ( root . getFile ( new Path ( in . readUTF ( ) ) ) , readRestriction ( in ) ) ; } } newState . structuralBuildTimes = new SimpleLookupTable ( length = in . readInt ( ) ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) newState . structuralBuildTimes . put ( in . readUTF ( ) , new Long ( in . readLong ( ) ) ) ; String [ ] internedTypeLocators = new String [ length = in . readInt ( ) ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) internedTypeLocators [ i ] = in . readUTF ( ) ; newState . typeLocators = new SimpleLookupTable ( length = in . readInt ( ) ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) newState . recordLocatorForType ( in . readUTF ( ) , internedTypeLocators [ in . readInt ( ) ] ) ; char [ ] [ ] internedRootNames = ReferenceCollection . internSimpleNames ( readNames ( in ) , false ) ; char [ ] [ ] internedSimpleNames = ReferenceCollection . internSimpleNames ( readNames ( in ) , false ) ; char [ ] [ ] [ ] internedQualifiedNames = new char [ length = in . readInt ( ) ] [ ] [ ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { int qLength = in . readInt ( ) ; char [ ] [ ] qName = new char [ qLength ] [ ] ; for ( int j = <NUM_LIT:0> ; j < qLength ; j ++ ) qName [ j ] = internedSimpleNames [ in . readInt ( ) ] ; internedQualifiedNames [ i ] = qName ; } internedQualifiedNames = ReferenceCollection . internQualifiedNames ( internedQualifiedNames , false ) ; newState . references = new SimpleLookupTable ( length = in . readInt ( ) ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { String typeLocator = internedTypeLocators [ in . readInt ( ) ] ; ReferenceCollection collection = null ; switch ( in . readByte ( ) ) { case <NUM_LIT:1> : char [ ] [ ] additionalTypeNames = readNames ( in ) ; char [ ] [ ] [ ] qualifiedNames = new char [ in . readInt ( ) ] [ ] [ ] ; for ( int j = <NUM_LIT:0> , m = qualifiedNames . length ; j < m ; j ++ ) qualifiedNames [ j ] = internedQualifiedNames [ in . readInt ( ) ] ; char [ ] [ ] simpleNames = new char [ in . readInt ( ) ] [ ] ; for ( int j = <NUM_LIT:0> , m = simpleNames . length ; j < m ; j ++ ) simpleNames [ j ] = internedSimpleNames [ in . readInt ( ) ] ; char [ ] [ ] rootNames = new char [ in . readInt ( ) ] [ ] ; for ( int j = <NUM_LIT:0> , m = rootNames . length ; j < m ; j ++ ) rootNames [ j ] = internedRootNames [ in . readInt ( ) ] ; collection = new AdditionalTypeCollection ( additionalTypeNames , qualifiedNames , simpleNames , rootNames ) ; break ; case <NUM_LIT:2> : char [ ] [ ] [ ] qNames = new char [ in . readInt ( ) ] [ ] [ ] ; for ( int j = <NUM_LIT:0> , m = qNames . length ; j < m ; j ++ ) qNames [ j ] = internedQualifiedNames [ in . readInt ( ) ] ; char [ ] [ ] sNames = new char [ in . readInt ( ) ] [ ] ; for ( int j = <NUM_LIT:0> , m = sNames . length ; j < m ; j ++ ) sNames [ j ] = internedSimpleNames [ in . readInt ( ) ] ; char [ ] [ ] rNames = new char [ in . readInt ( ) ] [ ] ; for ( int j = <NUM_LIT:0> , m = rNames . length ; j < m ; j ++ ) rNames [ j ] = internedRootNames [ in . readInt ( ) ] ; collection = new ReferenceCollection ( qNames , sNames , rNames ) ; } newState . references . put ( typeLocator , collection ) ; } if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + newState . javaProjectName ) ; return newState ; } private static char [ ] readName ( DataInputStream in ) throws IOException { int nLength = in . readInt ( ) ; char [ ] name = new char [ nLength ] ; for ( int j = <NUM_LIT:0> ; j < nLength ; j ++ ) name [ j ] = in . readChar ( ) ; return name ; } private static char [ ] [ ] readNames ( DataInputStream in ) throws IOException { int length = in . readInt ( ) ; char [ ] [ ] names = new char [ length ] [ ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) names [ i ] = readName ( in ) ; return names ; } private static AccessRuleSet readRestriction ( DataInputStream in ) throws IOException { int length = in . readInt ( ) ; if ( length == <NUM_LIT:0> ) return null ; AccessRule [ ] accessRules = new AccessRule [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { char [ ] pattern = readName ( in ) ; int problemId = in . readInt ( ) ; accessRules [ i ] = new ClasspathAccessRule ( pattern , problemId ) ; } JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; return new AccessRuleSet ( accessRules , in . readByte ( ) , manager . intern ( in . readUTF ( ) ) ) ; } void tagAsNoopBuild ( ) { this . buildNumber = - <NUM_LIT:1> ; } boolean wasNoopBuild ( ) { return this . buildNumber == - <NUM_LIT:1> ; } void tagAsStructurallyChanged ( ) { this . previousStructuralBuildTime = this . lastStructuralBuildTime ; this . structurallyChangedTypes = new StringSet ( <NUM_LIT:7> ) ; this . lastStructuralBuildTime = computeStructuralBuildTime ( this . previousStructuralBuildTime ) ; } boolean wasStructurallyChanged ( IProject prereqProject , State prereqState ) { if ( prereqState != null ) { Object o = this . structuralBuildTimes . get ( prereqProject . getName ( ) ) ; long previous = o == null ? <NUM_LIT:0> : ( ( Long ) o ) . longValue ( ) ; if ( previous == prereqState . lastStructuralBuildTime ) return false ; } return true ; } void wasStructurallyChanged ( String typeName ) { if ( this . structurallyChangedTypes != null ) { if ( this . structurallyChangedTypes . elementSize > MaxStructurallyChangedTypes ) this . structurallyChangedTypes = null ; else this . structurallyChangedTypes . add ( typeName ) ; } } void write ( DataOutputStream out ) throws IOException { int length ; Object [ ] keyTable ; Object [ ] valueTable ; out . writeByte ( VERSION ) ; out . writeUTF ( this . javaProjectName ) ; out . writeInt ( this . buildNumber ) ; out . writeLong ( this . lastStructuralBuildTime ) ; out . writeInt ( length = this . sourceLocations . length ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { ClasspathMultiDirectory md = this . sourceLocations [ i ] ; out . writeUTF ( md . sourceFolder . getProjectRelativePath ( ) . toString ( ) ) ; out . writeUTF ( md . binaryFolder . getProjectRelativePath ( ) . toString ( ) ) ; writeNames ( md . inclusionPatterns , out ) ; writeNames ( md . exclusionPatterns , out ) ; out . writeBoolean ( md . hasIndependentOutputFolder ) ; } out . writeInt ( length = this . binaryLocations . length ) ; next : for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { ClasspathLocation c = this . binaryLocations [ i ] ; if ( c instanceof ClasspathMultiDirectory ) { out . writeByte ( SOURCE_FOLDER ) ; for ( int j = <NUM_LIT:0> , m = this . sourceLocations . length ; j < m ; j ++ ) { if ( this . sourceLocations [ j ] == c ) { out . writeInt ( j ) ; continue next ; } } } else if ( c instanceof ClasspathDirectory ) { out . writeByte ( BINARY_FOLDER ) ; ClasspathDirectory cd = ( ClasspathDirectory ) c ; out . writeUTF ( cd . binaryFolder . getFullPath ( ) . toString ( ) ) ; out . writeBoolean ( cd . isOutputFolder ) ; writeRestriction ( cd . accessRuleSet , out ) ; } else { ClasspathJar jar = ( ClasspathJar ) c ; if ( jar . resource == null ) { out . writeByte ( EXTERNAL_JAR ) ; out . writeUTF ( jar . zipFilename ) ; out . writeLong ( jar . lastModified ( ) ) ; } else { out . writeByte ( INTERNAL_JAR ) ; out . writeUTF ( jar . resource . getFullPath ( ) . toString ( ) ) ; } writeRestriction ( jar . accessRuleSet , out ) ; } } out . writeInt ( length = this . structuralBuildTimes . elementSize ) ; if ( length > <NUM_LIT:0> ) { keyTable = this . structuralBuildTimes . keyTable ; valueTable = this . structuralBuildTimes . valueTable ; for ( int i = <NUM_LIT:0> , l = keyTable . length ; i < l ; i ++ ) { if ( keyTable [ i ] != null ) { length -- ; out . writeUTF ( ( String ) keyTable [ i ] ) ; out . writeLong ( ( ( Long ) valueTable [ i ] ) . longValue ( ) ) ; } } if ( JavaBuilder . DEBUG && length != <NUM_LIT:0> ) System . out . println ( "<STR_LIT>" ) ; } out . writeInt ( length = this . references . elementSize ) ; SimpleLookupTable internedTypeLocators = new SimpleLookupTable ( length ) ; if ( length > <NUM_LIT:0> ) { keyTable = this . references . keyTable ; for ( int i = <NUM_LIT:0> , l = keyTable . length ; i < l ; i ++ ) { if ( keyTable [ i ] != null ) { length -- ; String key = ( String ) keyTable [ i ] ; out . writeUTF ( key ) ; internedTypeLocators . put ( key , new Integer ( internedTypeLocators . elementSize ) ) ; } } if ( JavaBuilder . DEBUG && length != <NUM_LIT:0> ) System . out . println ( "<STR_LIT>" ) ; } out . writeInt ( length = this . typeLocators . elementSize ) ; if ( length > <NUM_LIT:0> ) { keyTable = this . typeLocators . keyTable ; valueTable = this . typeLocators . valueTable ; for ( int i = <NUM_LIT:0> , l = keyTable . length ; i < l ; i ++ ) { if ( keyTable [ i ] != null ) { length -- ; out . writeUTF ( ( String ) keyTable [ i ] ) ; Integer index = ( Integer ) internedTypeLocators . get ( valueTable [ i ] ) ; out . writeInt ( index . intValue ( ) ) ; } } if ( JavaBuilder . DEBUG && length != <NUM_LIT:0> ) System . out . println ( "<STR_LIT>" ) ; } SimpleLookupTable internedRootNames = new SimpleLookupTable ( <NUM_LIT:3> ) ; SimpleLookupTable internedQualifiedNames = new SimpleLookupTable ( <NUM_LIT:31> ) ; SimpleLookupTable internedSimpleNames = new SimpleLookupTable ( <NUM_LIT:31> ) ; valueTable = this . references . valueTable ; for ( int i = <NUM_LIT:0> , l = valueTable . length ; i < l ; i ++ ) { if ( valueTable [ i ] != null ) { ReferenceCollection collection = ( ReferenceCollection ) valueTable [ i ] ; char [ ] [ ] rNames = collection . rootReferences ; for ( int j = <NUM_LIT:0> , m = rNames . length ; j < m ; j ++ ) { char [ ] rName = rNames [ j ] ; if ( ! internedRootNames . containsKey ( rName ) ) internedRootNames . put ( rName , new Integer ( internedRootNames . elementSize ) ) ; } char [ ] [ ] [ ] qNames = collection . qualifiedNameReferences ; for ( int j = <NUM_LIT:0> , m = qNames . length ; j < m ; j ++ ) { char [ ] [ ] qName = qNames [ j ] ; if ( ! internedQualifiedNames . containsKey ( qName ) ) { internedQualifiedNames . put ( qName , new Integer ( internedQualifiedNames . elementSize ) ) ; for ( int k = <NUM_LIT:0> , n = qName . length ; k < n ; k ++ ) { char [ ] sName = qName [ k ] ; if ( ! internedSimpleNames . containsKey ( sName ) ) internedSimpleNames . put ( sName , new Integer ( internedSimpleNames . elementSize ) ) ; } } } char [ ] [ ] sNames = collection . simpleNameReferences ; for ( int j = <NUM_LIT:0> , m = sNames . length ; j < m ; j ++ ) { char [ ] sName = sNames [ j ] ; if ( ! internedSimpleNames . containsKey ( sName ) ) internedSimpleNames . put ( sName , new Integer ( internedSimpleNames . elementSize ) ) ; } } } char [ ] [ ] internedArray = new char [ internedRootNames . elementSize ] [ ] ; Object [ ] rootNames = internedRootNames . keyTable ; Object [ ] positions = internedRootNames . valueTable ; for ( int i = positions . length ; -- i >= <NUM_LIT:0> ; ) { if ( positions [ i ] != null ) { int index = ( ( Integer ) positions [ i ] ) . intValue ( ) ; internedArray [ index ] = ( char [ ] ) rootNames [ i ] ; } } writeNames ( internedArray , out ) ; internedArray = new char [ internedSimpleNames . elementSize ] [ ] ; Object [ ] simpleNames = internedSimpleNames . keyTable ; positions = internedSimpleNames . valueTable ; for ( int i = positions . length ; -- i >= <NUM_LIT:0> ; ) { if ( positions [ i ] != null ) { int index = ( ( Integer ) positions [ i ] ) . intValue ( ) ; internedArray [ index ] = ( char [ ] ) simpleNames [ i ] ; } } writeNames ( internedArray , out ) ; char [ ] [ ] [ ] internedQArray = new char [ internedQualifiedNames . elementSize ] [ ] [ ] ; Object [ ] qualifiedNames = internedQualifiedNames . keyTable ; positions = internedQualifiedNames . valueTable ; for ( int i = positions . length ; -- i >= <NUM_LIT:0> ; ) { if ( positions [ i ] != null ) { int index = ( ( Integer ) positions [ i ] ) . intValue ( ) ; internedQArray [ index ] = ( char [ ] [ ] ) qualifiedNames [ i ] ; } } out . writeInt ( length = internedQArray . length ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { char [ ] [ ] qName = internedQArray [ i ] ; int qLength = qName . length ; out . writeInt ( qLength ) ; for ( int j = <NUM_LIT:0> ; j < qLength ; j ++ ) { Integer index = ( Integer ) internedSimpleNames . get ( qName [ j ] ) ; out . writeInt ( index . intValue ( ) ) ; } } out . writeInt ( length = this . references . elementSize ) ; if ( length > <NUM_LIT:0> ) { keyTable = this . references . keyTable ; for ( int i = <NUM_LIT:0> , l = keyTable . length ; i < l ; i ++ ) { if ( keyTable [ i ] != null ) { length -- ; Integer index = ( Integer ) internedTypeLocators . get ( keyTable [ i ] ) ; out . writeInt ( index . intValue ( ) ) ; ReferenceCollection collection = ( ReferenceCollection ) valueTable [ i ] ; if ( collection instanceof AdditionalTypeCollection ) { out . writeByte ( <NUM_LIT:1> ) ; AdditionalTypeCollection atc = ( AdditionalTypeCollection ) collection ; writeNames ( atc . definedTypeNames , out ) ; } else { out . writeByte ( <NUM_LIT:2> ) ; } char [ ] [ ] [ ] qNames = collection . qualifiedNameReferences ; int qLength = qNames . length ; out . writeInt ( qLength ) ; for ( int j = <NUM_LIT:0> ; j < qLength ; j ++ ) { index = ( Integer ) internedQualifiedNames . get ( qNames [ j ] ) ; out . writeInt ( index . intValue ( ) ) ; } char [ ] [ ] sNames = collection . simpleNameReferences ; int sLength = sNames . length ; out . writeInt ( sLength ) ; for ( int j = <NUM_LIT:0> ; j < sLength ; j ++ ) { index = ( Integer ) internedSimpleNames . get ( sNames [ j ] ) ; out . writeInt ( index . intValue ( ) ) ; } char [ ] [ ] rNames = collection . rootReferences ; int rLength = rNames . length ; out . writeInt ( rLength ) ; for ( int j = <NUM_LIT:0> ; j < rLength ; j ++ ) { index = ( Integer ) internedRootNames . get ( rNames [ j ] ) ; out . writeInt ( index . intValue ( ) ) ; } } } if ( JavaBuilder . DEBUG && length != <NUM_LIT:0> ) System . out . println ( "<STR_LIT>" ) ; } } private void writeName ( char [ ] name , DataOutputStream out ) throws IOException { int nLength = name . length ; out . writeInt ( nLength ) ; for ( int j = <NUM_LIT:0> ; j < nLength ; j ++ ) out . writeChar ( name [ j ] ) ; } private void writeNames ( char [ ] [ ] names , DataOutputStream out ) throws IOException { int length = names == null ? <NUM_LIT:0> : names . length ; out . writeInt ( length ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) writeName ( names [ i ] , out ) ; } private void writeRestriction ( AccessRuleSet accessRuleSet , DataOutputStream out ) throws IOException { if ( accessRuleSet == null ) { out . writeInt ( <NUM_LIT:0> ) ; } else { AccessRule [ ] accessRules = accessRuleSet . getAccessRules ( ) ; int length = accessRules . length ; out . writeInt ( length ) ; if ( length != <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { AccessRule accessRule = accessRules [ i ] ; writeName ( accessRule . pattern , out ) ; out . writeInt ( accessRule . problemId ) ; } out . writeByte ( accessRuleSet . classpathEntryType ) ; out . writeUTF ( accessRuleSet . classpathEntryName ) ; } } } public String toString ( ) { return "<STR_LIT>" + this . javaProjectName + "<STR_LIT>" + this . buildNumber + "<STR_LIT>" + new Date ( this . lastStructuralBuildTime ) + "<STR_LIT:)>" ; } } </s>
<s> package org . eclipse . jdt . internal . core . builder ; import org . eclipse . jdt . core . compiler . CharOperation ; public class QualifiedNameSet { public char [ ] [ ] [ ] qualifiedNames ; public int elementSize ; public int threshold ; public QualifiedNameSet ( int size ) { this . elementSize = <NUM_LIT:0> ; this . threshold = size ; int extraRoom = ( int ) ( size * <NUM_LIT> ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . qualifiedNames = new char [ extraRoom ] [ ] [ ] ; } public char [ ] [ ] add ( char [ ] [ ] qualifiedName ) { int qLength = qualifiedName . length ; if ( qLength == <NUM_LIT:0> ) return CharOperation . NO_CHAR_CHAR ; int length = this . qualifiedNames . length ; int index = CharOperation . hashCode ( qualifiedName [ qLength - <NUM_LIT:1> ] ) % length ; char [ ] [ ] current ; while ( ( current = this . qualifiedNames [ index ] ) != null ) { if ( CharOperation . equals ( current , qualifiedName ) ) return current ; if ( ++ index == length ) index = <NUM_LIT:0> ; } this . qualifiedNames [ index ] = qualifiedName ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return qualifiedName ; } private void rehash ( ) { QualifiedNameSet newSet = new QualifiedNameSet ( this . elementSize * <NUM_LIT:2> ) ; char [ ] [ ] current ; for ( int i = this . qualifiedNames . length ; -- i >= <NUM_LIT:0> ; ) if ( ( current = this . qualifiedNames [ i ] ) != null ) newSet . add ( current ) ; this . qualifiedNames = newSet . qualifiedNames ; this . elementSize = newSet . elementSize ; this . threshold = newSet . threshold ; } public String toString ( ) { String s = "<STR_LIT>" ; char [ ] [ ] qualifiedName ; for ( int i = <NUM_LIT:0> , l = this . qualifiedNames . length ; i < l ; i ++ ) if ( ( qualifiedName = this . qualifiedNames [ i ] ) != null ) s += CharOperation . toString ( qualifiedName ) + "<STR_LIT:n>" ; return s ; } } </s>
<s> package org . eclipse . jdt . internal . core . builder ; import org . eclipse . jdt . internal . compiler . util . SimpleSet ; public class WorkQueue { private SimpleSet needsCompileList ; private SimpleSet compiledList ; public WorkQueue ( ) { this . needsCompileList = new SimpleSet ( ) ; this . compiledList = new SimpleSet ( ) ; } public void add ( SourceFile element ) { this . needsCompileList . add ( element ) ; } public void addAll ( SourceFile [ ] elements ) { for ( int i = <NUM_LIT:0> , l = elements . length ; i < l ; i ++ ) add ( elements [ i ] ) ; } public void clear ( ) { this . needsCompileList . clear ( ) ; this . compiledList . clear ( ) ; } public void finished ( SourceFile element ) { this . needsCompileList . remove ( element ) ; this . compiledList . add ( element ) ; } public boolean isCompiled ( SourceFile element ) { return this . compiledList . includes ( element ) ; } public boolean isWaiting ( SourceFile element ) { return this . needsCompileList . includes ( element ) ; } public String toString ( ) { return "<STR_LIT>" + this . needsCompileList ; } } </s>
<s> package org . eclipse . jdt . internal . core . builder ; import org . eclipse . core . resources . * ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . core . util . Util ; class ClasspathMultiDirectory extends ClasspathDirectory { IContainer sourceFolder ; char [ ] [ ] inclusionPatterns ; char [ ] [ ] exclusionPatterns ; boolean hasIndependentOutputFolder ; ClasspathMultiDirectory ( IContainer sourceFolder , IContainer binaryFolder , char [ ] [ ] inclusionPatterns , char [ ] [ ] exclusionPatterns ) { super ( binaryFolder , true , null ) ; this . sourceFolder = sourceFolder ; this . inclusionPatterns = inclusionPatterns ; this . exclusionPatterns = exclusionPatterns ; this . hasIndependentOutputFolder = false ; if ( this . inclusionPatterns != null && this . inclusionPatterns . length == <NUM_LIT:0> ) this . inclusionPatterns = null ; if ( this . exclusionPatterns != null && this . exclusionPatterns . length == <NUM_LIT:0> ) this . exclusionPatterns = null ; } public boolean equals ( Object o ) { if ( this == o ) return true ; if ( ! ( o instanceof ClasspathMultiDirectory ) ) return false ; ClasspathMultiDirectory md = ( ClasspathMultiDirectory ) o ; return this . sourceFolder . equals ( md . sourceFolder ) && this . binaryFolder . equals ( md . binaryFolder ) && CharOperation . equals ( this . inclusionPatterns , md . inclusionPatterns ) && CharOperation . equals ( this . exclusionPatterns , md . exclusionPatterns ) ; } protected boolean isExcluded ( IResource resource ) { if ( this . exclusionPatterns != null || this . inclusionPatterns != null ) if ( this . sourceFolder . equals ( this . binaryFolder ) ) return Util . isExcluded ( resource , this . inclusionPatterns , this . exclusionPatterns ) ; return false ; } public String toString ( ) { return "<STR_LIT>" + this . sourceFolder . getFullPath ( ) . toString ( ) + "<STR_LIT>" + super . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . builder ; import java . io . IOException ; import org . eclipse . core . resources . * ; import org . eclipse . core . runtime . * ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileReader ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFormatException ; import org . eclipse . jdt . internal . compiler . env . AccessRuleSet ; import org . eclipse . jdt . internal . compiler . env . NameEnvironmentAnswer ; import org . eclipse . jdt . internal . compiler . util . SimpleLookupTable ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . core . util . Util ; public class ClasspathDirectory extends ClasspathLocation { IContainer binaryFolder ; boolean isOutputFolder ; SimpleLookupTable directoryCache ; String [ ] missingPackageHolder = new String [ <NUM_LIT:1> ] ; AccessRuleSet accessRuleSet ; ClasspathDirectory ( IContainer binaryFolder , boolean isOutputFolder , AccessRuleSet accessRuleSet ) { this . binaryFolder = binaryFolder ; this . isOutputFolder = isOutputFolder || binaryFolder . getProjectRelativePath ( ) . isEmpty ( ) ; this . directoryCache = new SimpleLookupTable ( <NUM_LIT:5> ) ; this . accessRuleSet = accessRuleSet ; } public void cleanup ( ) { this . directoryCache = null ; } String [ ] directoryList ( String qualifiedPackageName ) { String [ ] dirList = ( String [ ] ) this . directoryCache . get ( qualifiedPackageName ) ; if ( dirList == this . missingPackageHolder ) return null ; if ( dirList != null ) return dirList ; try { IResource container = this . binaryFolder . findMember ( qualifiedPackageName ) ; if ( container instanceof IContainer ) { IResource [ ] members = ( ( IContainer ) container ) . members ( ) ; dirList = new String [ members . length ] ; int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , l = members . length ; i < l ; i ++ ) { IResource m = members [ i ] ; if ( m . getType ( ) == IResource . FILE && org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( m . getName ( ) ) ) dirList [ index ++ ] = m . getName ( ) ; } if ( index < dirList . length ) System . arraycopy ( dirList , <NUM_LIT:0> , dirList = new String [ index ] , <NUM_LIT:0> , index ) ; this . directoryCache . put ( qualifiedPackageName , dirList ) ; return dirList ; } } catch ( CoreException ignored ) { } this . directoryCache . put ( qualifiedPackageName , this . missingPackageHolder ) ; return null ; } boolean doesFileExist ( String fileName , String qualifiedPackageName , String qualifiedFullName ) { String [ ] dirList = directoryList ( qualifiedPackageName ) ; if ( dirList == null ) return false ; for ( int i = dirList . length ; -- i >= <NUM_LIT:0> ; ) if ( fileName . equals ( dirList [ i ] ) ) return true ; return false ; } public boolean equals ( Object o ) { if ( this == o ) return true ; if ( ! ( o instanceof ClasspathDirectory ) ) return false ; ClasspathDirectory dir = ( ClasspathDirectory ) o ; if ( this . accessRuleSet != dir . accessRuleSet ) if ( this . accessRuleSet == null || ! this . accessRuleSet . equals ( dir . accessRuleSet ) ) return false ; return this . binaryFolder . equals ( dir . binaryFolder ) ; } public NameEnvironmentAnswer findClass ( String binaryFileName , String qualifiedPackageName , String qualifiedBinaryFileName ) { if ( ! doesFileExist ( binaryFileName , qualifiedPackageName , qualifiedBinaryFileName ) ) return null ; ClassFileReader reader = null ; try { reader = Util . newClassFileReader ( this . binaryFolder . getFile ( new Path ( qualifiedBinaryFileName ) ) ) ; } catch ( CoreException e ) { return null ; } catch ( ClassFormatException e ) { return null ; } catch ( IOException e ) { return null ; } if ( reader != null ) { if ( this . accessRuleSet == null ) return new NameEnvironmentAnswer ( reader , null ) ; String fileNameWithoutExtension = qualifiedBinaryFileName . substring ( <NUM_LIT:0> , qualifiedBinaryFileName . length ( ) - SuffixConstants . SUFFIX_CLASS . length ) ; return new NameEnvironmentAnswer ( reader , this . accessRuleSet . getViolatedRestriction ( fileNameWithoutExtension . toCharArray ( ) ) ) ; } return null ; } public IPath getProjectRelativePath ( ) { return this . binaryFolder . getProjectRelativePath ( ) ; } public int hashCode ( ) { return this . binaryFolder == null ? super . hashCode ( ) : this . binaryFolder . hashCode ( ) ; } protected boolean isExcluded ( IResource resource ) { return false ; } public boolean isOutputFolder ( ) { return this . isOutputFolder ; } public boolean isPackage ( String qualifiedPackageName ) { return directoryList ( qualifiedPackageName ) != null ; } public void reset ( ) { this . directoryCache = new SimpleLookupTable ( <NUM_LIT:5> ) ; } public String toString ( ) { String start = "<STR_LIT>" + this . binaryFolder . getFullPath ( ) . toString ( ) ; if ( this . accessRuleSet == null ) return start ; return start + "<STR_LIT>" + this . accessRuleSet ; } public String debugPathString ( ) { return this . binaryFolder . getFullPath ( ) . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . builder ; import org . eclipse . jdt . internal . compiler . problem . DefaultProblemFactory ; import org . eclipse . jdt . internal . compiler . util . SimpleLookupTable ; import java . util . * ; public class ProblemFactory extends DefaultProblemFactory { static SimpleLookupTable factories = new SimpleLookupTable ( <NUM_LIT:5> ) ; private ProblemFactory ( Locale locale ) { super ( locale ) ; } public static ProblemFactory getProblemFactory ( Locale locale ) { ProblemFactory factory = ( ProblemFactory ) factories . get ( locale ) ; if ( factory == null ) factories . put ( locale , factory = new ProblemFactory ( locale ) ) ; return factory ; } } </s>
<s> package org . eclipse . jdt . internal . core . builder ; import org . codehaus . jdt . groovy . integration . LanguageSupportFactory ; import org . eclipse . core . resources . * ; import org . eclipse . core . runtime . * ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . compiler . * ; import org . eclipse . jdt . internal . compiler . * ; import org . eclipse . jdt . internal . compiler . classfmt . * ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; import org . eclipse . jdt . internal . compiler . problem . * ; import org . eclipse . jdt . internal . compiler . util . SimpleLookupTable ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . core . util . Messages ; import org . eclipse . jdt . internal . core . util . Util ; import java . io . * ; import java . net . URI ; import java . util . * ; public class IncrementalImageBuilder extends AbstractImageBuilder { protected ArrayList sourceFiles ; protected ArrayList previousSourceFiles ; protected StringSet qualifiedStrings ; protected StringSet simpleStrings ; protected StringSet rootStrings ; protected SimpleLookupTable secondaryTypesToRemove ; protected boolean hasStructuralChanges ; protected int compileLoop ; protected boolean makeOutputFolderConsistent ; public static int MaxCompileLoop = <NUM_LIT:5> ; protected IncrementalImageBuilder ( JavaBuilder javaBuilder , State buildState ) { super ( javaBuilder , true , buildState ) ; this . nameEnvironment . isIncrementalBuild = true ; this . makeOutputFolderConsistent = JavaCore . ENABLED . equals ( javaBuilder . javaProject . getOption ( JavaCore . CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER , true ) ) ; } protected IncrementalImageBuilder ( JavaBuilder javaBuilder ) { this ( javaBuilder , null ) ; this . newState . copyFrom ( javaBuilder . lastState ) ; } protected IncrementalImageBuilder ( BatchImageBuilder batchBuilder ) { this ( batchBuilder . javaBuilder , batchBuilder . newState ) ; resetCollections ( ) ; } public boolean build ( SimpleLookupTable deltas ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" ) ; try { resetCollections ( ) ; this . notifier . subTask ( Messages . build_analyzingDeltas ) ; if ( this . javaBuilder . hasBuildpathErrors ( ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" ) ; this . javaBuilder . currentProject . deleteMarkers ( IJavaModelMarker . JAVA_MODEL_PROBLEM_MARKER , false , IResource . DEPTH_ZERO ) ; addAllSourceFiles ( this . sourceFiles ) ; this . notifier . updateProgressDelta ( <NUM_LIT> ) ; } else { IResourceDelta sourceDelta = ( IResourceDelta ) deltas . get ( this . javaBuilder . currentProject ) ; if ( sourceDelta != null ) if ( ! findSourceFiles ( sourceDelta ) ) return false ; this . notifier . updateProgressDelta ( <NUM_LIT> ) ; Object [ ] keyTable = deltas . keyTable ; Object [ ] valueTable = deltas . valueTable ; for ( int i = <NUM_LIT:0> , l = valueTable . length ; i < l ; i ++ ) { IResourceDelta delta = ( IResourceDelta ) valueTable [ i ] ; if ( delta != null ) { IProject p = ( IProject ) keyTable [ i ] ; ClasspathLocation [ ] classFoldersAndJars = ( ClasspathLocation [ ] ) this . javaBuilder . binaryLocationsPerProject . get ( p ) ; if ( classFoldersAndJars != null ) if ( ! findAffectedSourceFiles ( delta , classFoldersAndJars , p ) ) return false ; } } this . notifier . updateProgressDelta ( <NUM_LIT> ) ; this . notifier . subTask ( Messages . build_analyzingSources ) ; addAffectedSourceFiles ( ) ; this . notifier . updateProgressDelta ( <NUM_LIT> ) ; } this . compileLoop = <NUM_LIT:0> ; float increment = <NUM_LIT> ; while ( this . sourceFiles . size ( ) > <NUM_LIT:0> ) { if ( ++ this . compileLoop > MaxCompileLoop ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" ) ; return false ; } this . notifier . checkCancel ( ) ; SourceFile [ ] allSourceFiles = new SourceFile [ this . sourceFiles . size ( ) ] ; this . sourceFiles . toArray ( allSourceFiles ) ; resetCollections ( ) ; this . workQueue . addAll ( allSourceFiles ) ; this . notifier . setProgressPerCompilationUnit ( increment / allSourceFiles . length ) ; increment = increment / <NUM_LIT:2> ; compile ( allSourceFiles ) ; removeSecondaryTypes ( ) ; addAffectedSourceFiles ( ) ; } if ( this . hasStructuralChanges && this . javaBuilder . javaProject . hasCycleMarker ( ) ) this . javaBuilder . mustPropagateStructuralChanges ( ) ; } catch ( AbortIncrementalBuildException e ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + e . qualifiedTypeName + "<STR_LIT>" ) ; return false ; } catch ( CoreException e ) { throw internalException ( e ) ; } finally { cleanUp ( ) ; } return true ; } protected void buildAfterBatchBuild ( ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + new Date ( System . currentTimeMillis ( ) ) ) ; try { addAffectedSourceFiles ( ) ; while ( this . sourceFiles . size ( ) > <NUM_LIT:0> ) { this . notifier . checkCancel ( ) ; SourceFile [ ] allSourceFiles = new SourceFile [ this . sourceFiles . size ( ) ] ; this . sourceFiles . toArray ( allSourceFiles ) ; resetCollections ( ) ; this . notifier . setProgressPerCompilationUnit ( <NUM_LIT> / allSourceFiles . length ) ; this . workQueue . addAll ( allSourceFiles ) ; compile ( allSourceFiles ) ; removeSecondaryTypes ( ) ; addAffectedSourceFiles ( ) ; } } catch ( CoreException e ) { throw internalException ( e ) ; } finally { cleanUp ( ) ; } } protected void addAffectedSourceFiles ( ) { if ( this . qualifiedStrings . elementSize == <NUM_LIT:0> && this . simpleStrings . elementSize == <NUM_LIT:0> ) return ; addAffectedSourceFiles ( this . qualifiedStrings , this . simpleStrings , this . rootStrings , null ) ; } protected void addAffectedSourceFiles ( StringSet qualifiedSet , StringSet simpleSet , StringSet rootSet , StringSet affectedTypes ) { char [ ] [ ] [ ] internedQualifiedNames = ReferenceCollection . internQualifiedNames ( qualifiedSet ) ; if ( internedQualifiedNames . length < qualifiedSet . elementSize ) internedQualifiedNames = null ; char [ ] [ ] internedSimpleNames = ReferenceCollection . internSimpleNames ( simpleSet , true ) ; if ( internedSimpleNames . length < simpleSet . elementSize ) internedSimpleNames = null ; char [ ] [ ] internedRootNames = ReferenceCollection . internSimpleNames ( rootSet , false ) ; Object [ ] keyTable = this . newState . references . keyTable ; Object [ ] valueTable = this . newState . references . valueTable ; next : for ( int i = <NUM_LIT:0> , l = valueTable . length ; i < l ; i ++ ) { String typeLocator = ( String ) keyTable [ i ] ; if ( typeLocator != null ) { if ( affectedTypes != null && ! affectedTypes . includes ( typeLocator ) ) continue next ; ReferenceCollection refs = ( ReferenceCollection ) valueTable [ i ] ; if ( refs . includes ( internedQualifiedNames , internedSimpleNames , internedRootNames ) ) { IFile file = this . javaBuilder . currentProject . getFile ( typeLocator ) ; SourceFile sourceFile = findSourceFile ( file , true ) ; if ( sourceFile == null ) continue next ; if ( this . sourceFiles . contains ( sourceFile ) ) continue next ; if ( this . compiledAllAtOnce && this . previousSourceFiles != null && this . previousSourceFiles . contains ( sourceFile ) ) continue next ; if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + typeLocator ) ; this . sourceFiles . add ( sourceFile ) ; } } } } protected void addDependentsOf ( IPath path , boolean isStructuralChange ) { addDependentsOf ( path , isStructuralChange , this . qualifiedStrings , this . simpleStrings , this . rootStrings ) ; } protected void addDependentsOf ( IPath path , boolean isStructuralChange , StringSet qualifiedNames , StringSet simpleNames , StringSet rootNames ) { path = path . setDevice ( null ) ; if ( isStructuralChange ) { String last = path . lastSegment ( ) ; if ( last . length ( ) == TypeConstants . PACKAGE_INFO_NAME . length ) if ( CharOperation . equals ( last . toCharArray ( ) , TypeConstants . PACKAGE_INFO_NAME ) ) path = path . removeLastSegments ( <NUM_LIT:1> ) ; } if ( isStructuralChange && ! this . hasStructuralChanges ) { this . newState . tagAsStructurallyChanged ( ) ; this . hasStructuralChanges = true ; } rootNames . add ( path . segment ( <NUM_LIT:0> ) ) ; String packageName = path . removeLastSegments ( <NUM_LIT:1> ) . toString ( ) ; boolean wasNew = qualifiedNames . add ( packageName ) ; String typeName = path . lastSegment ( ) ; int memberIndex = typeName . indexOf ( '<CHAR_LIT>' ) ; if ( memberIndex > <NUM_LIT:0> ) typeName = typeName . substring ( <NUM_LIT:0> , memberIndex ) ; wasNew = simpleNames . add ( typeName ) | wasNew ; if ( wasNew && JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + typeName + "<STR_LIT>" + packageName ) ; } protected boolean checkForClassFileChanges ( IResourceDelta binaryDelta , ClasspathMultiDirectory md , int segmentCount ) throws CoreException { IResource resource = binaryDelta . getResource ( ) ; boolean isExcluded = ( md . exclusionPatterns != null || md . inclusionPatterns != null ) && Util . isExcluded ( resource , md . inclusionPatterns , md . exclusionPatterns ) ; switch ( resource . getType ( ) ) { case IResource . FOLDER : if ( isExcluded && md . inclusionPatterns == null ) return true ; IResourceDelta [ ] children = binaryDelta . getAffectedChildren ( ) ; for ( int i = <NUM_LIT:0> , l = children . length ; i < l ; i ++ ) if ( ! checkForClassFileChanges ( children [ i ] , md , segmentCount ) ) return false ; return true ; case IResource . FILE : if ( ! isExcluded && org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( resource . getName ( ) ) ) { IPath typePath = resource . getFullPath ( ) . removeFirstSegments ( segmentCount ) . removeFileExtension ( ) ; if ( this . newState . isKnownType ( typePath . toString ( ) ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + typePath ) ; return false ; } return true ; } } return true ; } protected void cleanUp ( ) { super . cleanUp ( ) ; this . sourceFiles = null ; this . previousSourceFiles = null ; this . qualifiedStrings = null ; this . simpleStrings = null ; this . rootStrings = null ; this . secondaryTypesToRemove = null ; this . hasStructuralChanges = false ; this . compileLoop = <NUM_LIT:0> ; } protected void compile ( SourceFile [ ] units , SourceFile [ ] additionalUnits , boolean compilingFirstGroup ) { if ( compilingFirstGroup && additionalUnits != null ) { ArrayList extras = null ; for ( int i = <NUM_LIT:0> , l = additionalUnits . length ; i < l ; i ++ ) { SourceFile unit = additionalUnits [ i ] ; if ( unit != null && this . newState . getDefinedTypeNamesFor ( unit . typeLocator ( ) ) != null ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + unit . typeLocator ( ) ) ; if ( extras == null ) extras = new ArrayList ( <NUM_LIT:3> ) ; extras . add ( unit ) ; } } if ( extras != null ) { int oldLength = units . length ; int toAdd = extras . size ( ) ; System . arraycopy ( units , <NUM_LIT:0> , units = new SourceFile [ oldLength + toAdd ] , <NUM_LIT:0> , oldLength ) ; for ( int i = <NUM_LIT:0> ; i < toAdd ; i ++ ) units [ oldLength ++ ] = ( SourceFile ) extras . get ( i ) ; } } super . compile ( units , additionalUnits , compilingFirstGroup ) ; } protected void deleteGeneratedFiles ( IFile [ ] deletedGeneratedFiles ) { try { for ( int j = deletedGeneratedFiles . length ; -- j >= <NUM_LIT:0> ; ) { IFile deletedFile = deletedGeneratedFiles [ j ] ; if ( deletedFile . exists ( ) ) continue ; SourceFile sourceFile = findSourceFile ( deletedFile , false ) ; String typeLocator = sourceFile . typeLocator ( ) ; int mdSegmentCount = sourceFile . sourceLocation . sourceFolder . getFullPath ( ) . segmentCount ( ) ; IPath typePath = sourceFile . resource . getFullPath ( ) . removeFirstSegments ( mdSegmentCount ) . removeFileExtension ( ) ; addDependentsOf ( typePath , true ) ; this . previousSourceFiles = null ; char [ ] [ ] definedTypeNames = this . newState . getDefinedTypeNamesFor ( typeLocator ) ; if ( definedTypeNames == null ) { removeClassFile ( typePath , sourceFile . sourceLocation . binaryFolder ) ; } else { if ( definedTypeNames . length > <NUM_LIT:0> ) { IPath packagePath = typePath . removeLastSegments ( <NUM_LIT:1> ) ; for ( int d = <NUM_LIT:0> , l = definedTypeNames . length ; d < l ; d ++ ) removeClassFile ( packagePath . append ( new String ( definedTypeNames [ d ] ) ) , sourceFile . sourceLocation . binaryFolder ) ; } } this . newState . removeLocator ( typeLocator ) ; } } catch ( CoreException e ) { Util . log ( e , "<STR_LIT>" ) ; } } protected boolean findAffectedSourceFiles ( IResourceDelta delta , ClasspathLocation [ ] classFoldersAndJars , IProject prereqProject ) { for ( int i = <NUM_LIT:0> , l = classFoldersAndJars . length ; i < l ; i ++ ) { ClasspathLocation bLocation = classFoldersAndJars [ i ] ; if ( bLocation != null ) { IPath p = bLocation . getProjectRelativePath ( ) ; if ( p != null ) { IResourceDelta binaryDelta = delta . findMember ( p ) ; if ( binaryDelta != null ) { if ( bLocation instanceof ClasspathJar ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" ) ; return false ; } if ( binaryDelta . getKind ( ) == IResourceDelta . ADDED || binaryDelta . getKind ( ) == IResourceDelta . REMOVED ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" ) ; return false ; } int segmentCount = binaryDelta . getFullPath ( ) . segmentCount ( ) ; IResourceDelta [ ] children = binaryDelta . getAffectedChildren ( ) ; StringSet structurallyChangedTypes = null ; if ( bLocation . isOutputFolder ( ) ) structurallyChangedTypes = this . newState . getStructurallyChangedTypes ( this . javaBuilder . getLastState ( prereqProject ) ) ; for ( int j = <NUM_LIT:0> , m = children . length ; j < m ; j ++ ) findAffectedSourceFiles ( children [ j ] , segmentCount , structurallyChangedTypes ) ; this . notifier . checkCancel ( ) ; } } } } return true ; } protected void findAffectedSourceFiles ( IResourceDelta binaryDelta , int segmentCount , StringSet structurallyChangedTypes ) { IResource resource = binaryDelta . getResource ( ) ; switch ( resource . getType ( ) ) { case IResource . FOLDER : switch ( binaryDelta . getKind ( ) ) { case IResourceDelta . ADDED : case IResourceDelta . REMOVED : IPath packagePath = resource . getFullPath ( ) . removeFirstSegments ( segmentCount ) ; String packageName = packagePath . toString ( ) ; if ( binaryDelta . getKind ( ) == IResourceDelta . ADDED ) { if ( ! this . newState . isKnownPackage ( packageName ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + packageName ) ; addDependentsOf ( packagePath , false ) ; return ; } if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + packageName ) ; } else { if ( ! this . nameEnvironment . isPackage ( packageName ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + packageName ) ; addDependentsOf ( packagePath , false ) ; return ; } if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + packageName ) ; } case IResourceDelta . CHANGED : IResourceDelta [ ] children = binaryDelta . getAffectedChildren ( ) ; for ( int i = <NUM_LIT:0> , l = children . length ; i < l ; i ++ ) findAffectedSourceFiles ( children [ i ] , segmentCount , structurallyChangedTypes ) ; } return ; case IResource . FILE : if ( org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( resource . getName ( ) ) ) { IPath typePath = resource . getFullPath ( ) . removeFirstSegments ( segmentCount ) . removeFileExtension ( ) ; switch ( binaryDelta . getKind ( ) ) { case IResourceDelta . ADDED : case IResourceDelta . REMOVED : if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + typePath ) ; addDependentsOf ( typePath , false ) ; return ; case IResourceDelta . CHANGED : if ( ( binaryDelta . getFlags ( ) & IResourceDelta . CONTENT ) == <NUM_LIT:0> ) return ; if ( structurallyChangedTypes != null && ! structurallyChangedTypes . includes ( typePath . toString ( ) ) ) return ; if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + typePath ) ; addDependentsOf ( typePath , false ) ; } return ; } } } protected boolean findSourceFiles ( IResourceDelta delta ) throws CoreException { ArrayList visited = this . makeOutputFolderConsistent ? new ArrayList ( this . sourceLocations . length ) : null ; for ( int i = <NUM_LIT:0> , l = this . sourceLocations . length ; i < l ; i ++ ) { ClasspathMultiDirectory md = this . sourceLocations [ i ] ; if ( this . makeOutputFolderConsistent && md . hasIndependentOutputFolder && ! visited . contains ( md . binaryFolder ) ) { visited . add ( md . binaryFolder ) ; IResourceDelta binaryDelta = delta . findMember ( md . binaryFolder . getProjectRelativePath ( ) ) ; if ( binaryDelta != null ) { int segmentCount = binaryDelta . getFullPath ( ) . segmentCount ( ) ; IResourceDelta [ ] children = binaryDelta . getAffectedChildren ( ) ; for ( int j = <NUM_LIT:0> , m = children . length ; j < m ; j ++ ) if ( ! checkForClassFileChanges ( children [ j ] , md , segmentCount ) ) return false ; } } if ( md . sourceFolder . equals ( this . javaBuilder . currentProject ) ) { int segmentCount = delta . getFullPath ( ) . segmentCount ( ) ; IResourceDelta [ ] children = delta . getAffectedChildren ( ) ; for ( int j = <NUM_LIT:0> , m = children . length ; j < m ; j ++ ) if ( ! isExcludedFromProject ( children [ j ] . getFullPath ( ) ) ) if ( ! findSourceFiles ( children [ j ] , md , segmentCount ) ) return false ; } else { IResourceDelta sourceDelta = delta . findMember ( md . sourceFolder . getProjectRelativePath ( ) ) ; if ( sourceDelta != null ) { if ( sourceDelta . getKind ( ) == IResourceDelta . REMOVED ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" ) ; return false ; } int segmentCount = sourceDelta . getFullPath ( ) . segmentCount ( ) ; IResourceDelta [ ] children = sourceDelta . getAffectedChildren ( ) ; try { for ( int j = <NUM_LIT:0> , m = children . length ; j < m ; j ++ ) if ( ! findSourceFiles ( children [ j ] , md , segmentCount ) ) return false ; } catch ( CoreException e ) { if ( e . getStatus ( ) . getCode ( ) == IResourceStatus . CASE_VARIANT_EXISTS ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" ) ; return false ; } throw e ; } } } this . notifier . checkCancel ( ) ; } return true ; } protected boolean findSourceFiles ( IResourceDelta sourceDelta , ClasspathMultiDirectory md , int segmentCount ) throws CoreException { IResource resource = sourceDelta . getResource ( ) ; boolean isExcluded = ( md . exclusionPatterns != null || md . inclusionPatterns != null ) && Util . isExcluded ( resource , md . inclusionPatterns , md . exclusionPatterns ) ; switch ( resource . getType ( ) ) { case IResource . FOLDER : if ( isExcluded && md . inclusionPatterns == null ) return true ; switch ( sourceDelta . getKind ( ) ) { case IResourceDelta . ADDED : if ( ! isExcluded ) { IPath addedPackagePath = resource . getFullPath ( ) . removeFirstSegments ( segmentCount ) ; createFolder ( addedPackagePath , md . binaryFolder ) ; if ( this . sourceLocations . length > <NUM_LIT:1> && this . newState . isKnownPackage ( addedPackagePath . toString ( ) ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + addedPackagePath ) ; } else { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + addedPackagePath ) ; addDependentsOf ( addedPackagePath , true ) ; } } case IResourceDelta . CHANGED : IResourceDelta [ ] children = sourceDelta . getAffectedChildren ( ) ; for ( int i = <NUM_LIT:0> , l = children . length ; i < l ; i ++ ) if ( ! findSourceFiles ( children [ i ] , md , segmentCount ) ) return false ; return true ; case IResourceDelta . REMOVED : if ( isExcluded ) { children = sourceDelta . getAffectedChildren ( ) ; for ( int i = <NUM_LIT:0> , l = children . length ; i < l ; i ++ ) if ( ! findSourceFiles ( children [ i ] , md , segmentCount ) ) return false ; return true ; } IPath removedPackagePath = resource . getFullPath ( ) . removeFirstSegments ( segmentCount ) ; if ( this . sourceLocations . length > <NUM_LIT:1> ) { for ( int i = <NUM_LIT:0> , l = this . sourceLocations . length ; i < l ; i ++ ) { if ( this . sourceLocations [ i ] . sourceFolder . getFolder ( removedPackagePath ) . exists ( ) ) { createFolder ( removedPackagePath , md . binaryFolder ) ; IResourceDelta [ ] removedChildren = sourceDelta . getAffectedChildren ( ) ; for ( int j = <NUM_LIT:0> , m = removedChildren . length ; j < m ; j ++ ) if ( ! findSourceFiles ( removedChildren [ j ] , md , segmentCount ) ) return false ; return true ; } } } if ( ( sourceDelta . getFlags ( ) & IResourceDelta . MOVED_TO ) != <NUM_LIT:0> ) { IResource movedFolder = this . javaBuilder . workspaceRoot . getFolder ( sourceDelta . getMovedToPath ( ) ) ; JavaBuilder . removeProblemsAndTasksFor ( movedFolder ) ; } IFolder removedPackageFolder = md . binaryFolder . getFolder ( removedPackagePath ) ; if ( removedPackageFolder . exists ( ) ) removedPackageFolder . delete ( IResource . FORCE , null ) ; if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + removedPackagePath ) ; addDependentsOf ( removedPackagePath , true ) ; this . newState . removePackage ( sourceDelta ) ; } return true ; case IResource . FILE : if ( isExcluded ) return true ; String resourceName = resource . getName ( ) ; final boolean isInterestingProject = LanguageSupportFactory . isInterestingProject ( javaBuilder . getProject ( ) ) ; if ( ( ! isInterestingProject && org . eclipse . jdt . internal . core . util . Util . isJavaLikeFileName ( resourceName ) && ! LanguageSupportFactory . isInterestingSourceFile ( resourceName ) ) || ( isInterestingProject && LanguageSupportFactory . isSourceFile ( resourceName , isInterestingProject ) ) ) { IPath typePath = resource . getFullPath ( ) . removeFirstSegments ( segmentCount ) . removeFileExtension ( ) ; String typeLocator = resource . getProjectRelativePath ( ) . toString ( ) ; switch ( sourceDelta . getKind ( ) ) { case IResourceDelta . ADDED : if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + typeLocator ) ; this . sourceFiles . add ( new SourceFile ( ( IFile ) resource , md , true ) ) ; String typeName = typePath . toString ( ) ; if ( ! this . newState . isDuplicateLocator ( typeName , typeLocator ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + typeName ) ; addDependentsOf ( typePath , true ) ; } return true ; case IResourceDelta . REMOVED : char [ ] [ ] definedTypeNames = this . newState . getDefinedTypeNamesFor ( typeLocator ) ; if ( definedTypeNames == null ) { removeClassFile ( typePath , md . binaryFolder ) ; if ( ( sourceDelta . getFlags ( ) & IResourceDelta . MOVED_TO ) != <NUM_LIT:0> ) { IResource movedFile = this . javaBuilder . workspaceRoot . getFile ( sourceDelta . getMovedToPath ( ) ) ; JavaBuilder . removeProblemsAndTasksFor ( movedFile ) ; } } else { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + typePath . toString ( ) ) ; addDependentsOf ( typePath , true ) ; if ( definedTypeNames . length > <NUM_LIT:0> ) { IPath packagePath = typePath . removeLastSegments ( <NUM_LIT:1> ) ; for ( int i = <NUM_LIT:0> , l = definedTypeNames . length ; i < l ; i ++ ) removeClassFile ( packagePath . append ( new String ( definedTypeNames [ i ] ) ) , md . binaryFolder ) ; } } this . newState . removeLocator ( typeLocator ) ; return true ; case IResourceDelta . CHANGED : if ( ( sourceDelta . getFlags ( ) & IResourceDelta . CONTENT ) == <NUM_LIT:0> && ( sourceDelta . getFlags ( ) & IResourceDelta . ENCODING ) == <NUM_LIT:0> ) return true ; if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + typeLocator ) ; this . sourceFiles . add ( new SourceFile ( ( IFile ) resource , md , true ) ) ; } return true ; } else if ( org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( resourceName ) ) { if ( this . makeOutputFolderConsistent ) { IPath typePath = resource . getFullPath ( ) . removeFirstSegments ( segmentCount ) . removeFileExtension ( ) ; if ( this . newState . isKnownType ( typePath . toString ( ) ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + typePath ) ; return false ; } } return true ; } else if ( md . hasIndependentOutputFolder ) { if ( this . javaBuilder . filterExtraResource ( resource ) ) return true ; IPath resourcePath = resource . getFullPath ( ) . removeFirstSegments ( segmentCount ) ; IResource outputFile = md . binaryFolder . getFile ( resourcePath ) ; switch ( sourceDelta . getKind ( ) ) { case IResourceDelta . ADDED : if ( outputFile . exists ( ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + resourcePath ) ; outputFile . delete ( IResource . FORCE , null ) ; } if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + resourcePath ) ; createFolder ( resourcePath . removeLastSegments ( <NUM_LIT:1> ) , md . binaryFolder ) ; copyResource ( resource , outputFile ) ; return true ; case IResourceDelta . REMOVED : if ( outputFile . exists ( ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + resourcePath ) ; outputFile . delete ( IResource . FORCE , null ) ; } return true ; case IResourceDelta . CHANGED : if ( ( sourceDelta . getFlags ( ) & IResourceDelta . CONTENT ) == <NUM_LIT:0> && ( sourceDelta . getFlags ( ) & IResourceDelta . ENCODING ) == <NUM_LIT:0> ) return true ; if ( outputFile . exists ( ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + resourcePath ) ; outputFile . delete ( IResource . FORCE , null ) ; } if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + resourcePath ) ; createFolder ( resourcePath . removeLastSegments ( <NUM_LIT:1> ) , md . binaryFolder ) ; copyResource ( resource , outputFile ) ; } return true ; } } return true ; } protected void finishedWith ( String sourceLocator , CompilationResult result , char [ ] mainTypeName , ArrayList definedTypeNames , ArrayList duplicateTypeNames ) { char [ ] [ ] previousTypeNames = this . newState . getDefinedTypeNamesFor ( sourceLocator ) ; if ( previousTypeNames == null ) previousTypeNames = new char [ ] [ ] { mainTypeName } ; IPath packagePath = null ; next : for ( int i = <NUM_LIT:0> , l = previousTypeNames . length ; i < l ; i ++ ) { char [ ] previous = previousTypeNames [ i ] ; for ( int j = <NUM_LIT:0> , m = definedTypeNames . size ( ) ; j < m ; j ++ ) if ( CharOperation . equals ( previous , ( char [ ] ) definedTypeNames . get ( j ) ) ) continue next ; SourceFile sourceFile = ( SourceFile ) result . getCompilationUnit ( ) ; if ( packagePath == null ) { int count = sourceFile . sourceLocation . sourceFolder . getFullPath ( ) . segmentCount ( ) ; packagePath = sourceFile . resource . getFullPath ( ) . removeFirstSegments ( count ) . removeLastSegments ( <NUM_LIT:1> ) ; } if ( this . secondaryTypesToRemove == null ) this . secondaryTypesToRemove = new SimpleLookupTable ( ) ; ArrayList types = ( ArrayList ) this . secondaryTypesToRemove . get ( sourceFile . sourceLocation . binaryFolder ) ; if ( types == null ) types = new ArrayList ( definedTypeNames . size ( ) ) ; types . add ( packagePath . append ( new String ( previous ) ) ) ; this . secondaryTypesToRemove . put ( sourceFile . sourceLocation . binaryFolder , types ) ; } super . finishedWith ( sourceLocator , result , mainTypeName , definedTypeNames , duplicateTypeNames ) ; } protected void processAnnotationResults ( CompilationParticipantResult [ ] results ) { for ( int i = results . length ; -- i >= <NUM_LIT:0> ; ) { CompilationParticipantResult result = results [ i ] ; if ( result == null ) continue ; IFile [ ] deletedGeneratedFiles = result . deletedFiles ; if ( deletedGeneratedFiles != null ) deleteGeneratedFiles ( deletedGeneratedFiles ) ; IFile [ ] addedGeneratedFiles = result . addedFiles ; if ( addedGeneratedFiles != null ) { for ( int j = addedGeneratedFiles . length ; -- j >= <NUM_LIT:0> ; ) { SourceFile sourceFile = findSourceFile ( addedGeneratedFiles [ j ] , true ) ; if ( sourceFile != null && ! this . sourceFiles . contains ( sourceFile ) ) this . sourceFiles . add ( sourceFile ) ; } } recordParticipantResult ( result ) ; } } protected void removeClassFile ( IPath typePath , IContainer outputFolder ) throws CoreException { if ( typePath . lastSegment ( ) . indexOf ( '<CHAR_LIT>' ) == - <NUM_LIT:1> ) { this . newState . removeQualifiedTypeName ( typePath . toString ( ) ) ; if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + typePath ) ; addDependentsOf ( typePath , true ) ; } IFile classFile = outputFolder . getFile ( typePath . addFileExtension ( SuffixConstants . EXTENSION_class ) ) ; if ( classFile . exists ( ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + typePath ) ; classFile . delete ( IResource . FORCE , null ) ; } } protected void removeSecondaryTypes ( ) throws CoreException { if ( this . secondaryTypesToRemove != null ) { Object [ ] keyTable = this . secondaryTypesToRemove . keyTable ; Object [ ] valueTable = this . secondaryTypesToRemove . valueTable ; for ( int i = <NUM_LIT:0> , l = keyTable . length ; i < l ; i ++ ) { IContainer outputFolder = ( IContainer ) keyTable [ i ] ; if ( outputFolder != null ) { ArrayList paths = ( ArrayList ) valueTable [ i ] ; for ( int j = <NUM_LIT:0> , m = paths . size ( ) ; j < m ; j ++ ) removeClassFile ( ( IPath ) paths . get ( j ) , outputFolder ) ; } } this . secondaryTypesToRemove = null ; if ( this . previousSourceFiles != null ) this . previousSourceFiles = null ; } } protected void resetCollections ( ) { if ( this . sourceFiles == null ) { this . sourceFiles = new ArrayList ( <NUM_LIT> ) ; this . previousSourceFiles = null ; this . qualifiedStrings = new StringSet ( <NUM_LIT:3> ) ; this . simpleStrings = new StringSet ( <NUM_LIT:3> ) ; this . rootStrings = new StringSet ( <NUM_LIT:3> ) ; this . hasStructuralChanges = false ; this . compileLoop = <NUM_LIT:0> ; } else { this . previousSourceFiles = this . sourceFiles . isEmpty ( ) ? null : ( ArrayList ) this . sourceFiles . clone ( ) ; this . sourceFiles . clear ( ) ; this . qualifiedStrings . clear ( ) ; this . simpleStrings . clear ( ) ; this . rootStrings . clear ( ) ; this . workQueue . clear ( ) ; } } protected void updateProblemsFor ( SourceFile sourceFile , CompilationResult result ) throws CoreException { IMarker [ ] markers = JavaBuilder . getProblemsFor ( sourceFile . resource ) ; CategorizedProblem [ ] problems = result . getProblems ( ) ; if ( problems == null && markers . length == <NUM_LIT:0> ) return ; this . notifier . updateProblemCounts ( markers , problems ) ; JavaBuilder . removeProblemsFor ( sourceFile . resource ) ; storeProblemsFor ( sourceFile , problems ) ; } protected void updateTasksFor ( SourceFile sourceFile , CompilationResult result ) throws CoreException { IMarker [ ] markers = JavaBuilder . getTasksFor ( sourceFile . resource ) ; CategorizedProblem [ ] tasks = result . getTasks ( ) ; if ( tasks == null && markers . length == <NUM_LIT:0> ) return ; JavaBuilder . removeTasksFor ( sourceFile . resource ) ; storeTasksFor ( sourceFile , tasks ) ; } protected void writeClassFileContents ( ClassFile classfile , IFile file , String qualifiedFileName , boolean isTopLevelType , SourceFile compilationUnit ) throws CoreException { byte [ ] bytes = classfile . getBytes ( ) ; if ( file . exists ( ) ) { if ( writeClassFileCheck ( file , qualifiedFileName , bytes ) || compilationUnit . updateClassFile ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + file . getName ( ) ) ; if ( ! file . isDerived ( ) ) file . setDerived ( true , null ) ; file . setContents ( new ByteArrayInputStream ( bytes ) , true , false , null ) ; } else if ( JavaBuilder . DEBUG ) { System . out . println ( "<STR_LIT>" + file . getName ( ) ) ; } } else { if ( isTopLevelType ) addDependentsOf ( new Path ( qualifiedFileName ) , true ) ; if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + file . getName ( ) ) ; try { file . create ( new ByteArrayInputStream ( bytes ) , IResource . FORCE | IResource . DERIVED , null ) ; } catch ( CoreException e ) { if ( e . getStatus ( ) . getCode ( ) == IResourceStatus . CASE_VARIANT_EXISTS ) { IStatus status = e . getStatus ( ) ; if ( status instanceof IResourceStatus ) { IPath oldFilePath = ( ( IResourceStatus ) status ) . getPath ( ) ; char [ ] oldTypeName = oldFilePath . removeFileExtension ( ) . lastSegment ( ) . toCharArray ( ) ; char [ ] [ ] previousTypeNames = this . newState . getDefinedTypeNamesFor ( compilationUnit . typeLocator ( ) ) ; boolean fromSameFile = false ; if ( previousTypeNames == null ) { fromSameFile = CharOperation . equals ( compilationUnit . getMainTypeName ( ) , oldTypeName ) ; } else { for ( int i = <NUM_LIT:0> , l = previousTypeNames . length ; i < l ; i ++ ) { if ( CharOperation . equals ( previousTypeNames [ i ] , oldTypeName ) ) { fromSameFile = true ; break ; } } } if ( fromSameFile ) { IFile collision = file . getParent ( ) . getFile ( new Path ( oldFilePath . lastSegment ( ) ) ) ; collision . delete ( true , false , null ) ; boolean success = false ; try { file . create ( new ByteArrayInputStream ( bytes ) , IResource . FORCE | IResource . DERIVED , null ) ; success = true ; } catch ( CoreException ignored ) { } if ( success ) return ; } } throw new AbortCompilation ( true , new AbortIncrementalBuildException ( qualifiedFileName ) ) ; } throw e ; } } } protected boolean writeClassFileCheck ( IFile file , String fileName , byte [ ] newBytes ) throws CoreException { try { byte [ ] oldBytes = Util . getResourceContentsAsByteArray ( file ) ; notEqual : if ( newBytes . length == oldBytes . length ) { for ( int i = newBytes . length ; -- i >= <NUM_LIT:0> ; ) if ( newBytes [ i ] != oldBytes [ i ] ) break notEqual ; return false ; } URI location = file . getLocationURI ( ) ; if ( location == null ) return false ; String filePath = location . getSchemeSpecificPart ( ) ; ClassFileReader reader = new ClassFileReader ( oldBytes , filePath . toCharArray ( ) ) ; if ( ! ( reader . isLocal ( ) || reader . isAnonymous ( ) ) && reader . hasStructuralChanges ( newBytes ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + fileName ) ; addDependentsOf ( new Path ( fileName ) , true ) ; this . newState . wasStructurallyChanged ( fileName ) ; } } catch ( ClassFormatException e ) { addDependentsOf ( new Path ( fileName ) , true ) ; this . newState . wasStructurallyChanged ( fileName ) ; } return true ; } public String toString ( ) { return "<STR_LIT>" + this . newState ; } } </s>
<s> package org . eclipse . jdt . internal . core . builder ; import org . eclipse . core . resources . * ; import org . eclipse . core . runtime . * ; import org . eclipse . jdt . core . compiler . CategorizedProblem ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . internal . compiler . problem . AbortCompilation ; import org . eclipse . jdt . internal . core . util . Messages ; public class BuildNotifier { protected IProgressMonitor monitor ; protected boolean cancelling ; protected float percentComplete ; protected float progressPerCompilationUnit ; protected int newErrorCount ; protected int fixedErrorCount ; protected int newWarningCount ; protected int fixedWarningCount ; protected int workDone ; protected int totalWork ; protected String previousSubtask ; public static int NewErrorCount = <NUM_LIT:0> ; public static int FixedErrorCount = <NUM_LIT:0> ; public static int NewWarningCount = <NUM_LIT:0> ; public static int FixedWarningCount = <NUM_LIT:0> ; public static void resetProblemCounters ( ) { NewErrorCount = <NUM_LIT:0> ; FixedErrorCount = <NUM_LIT:0> ; NewWarningCount = <NUM_LIT:0> ; FixedWarningCount = <NUM_LIT:0> ; } public BuildNotifier ( IProgressMonitor monitor , IProject project ) { this . monitor = monitor ; this . cancelling = false ; this . newErrorCount = NewErrorCount ; this . fixedErrorCount = FixedErrorCount ; this . newWarningCount = NewWarningCount ; this . fixedWarningCount = FixedWarningCount ; this . workDone = <NUM_LIT:0> ; this . totalWork = <NUM_LIT> ; } public void aboutToCompile ( SourceFile unit ) { String message = Messages . bind ( Messages . build_compiling , unit . resource . getFullPath ( ) . removeLastSegments ( <NUM_LIT:1> ) . makeRelative ( ) . toString ( ) ) ; subTask ( message ) ; } public void begin ( ) { if ( this . monitor != null ) this . monitor . beginTask ( "<STR_LIT>" , this . totalWork ) ; this . previousSubtask = null ; } public void checkCancel ( ) { if ( this . monitor != null && this . monitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; } public void checkCancelWithinCompiler ( ) { if ( this . monitor != null && this . monitor . isCanceled ( ) && ! this . cancelling ) { setCancelling ( true ) ; throw new AbortCompilation ( true , null ) ; } } public void compiled ( SourceFile unit ) { String message = Messages . bind ( Messages . build_compiling , unit . resource . getFullPath ( ) . removeLastSegments ( <NUM_LIT:1> ) . makeRelative ( ) . toString ( ) ) ; subTask ( message ) ; updateProgressDelta ( this . progressPerCompilationUnit ) ; checkCancelWithinCompiler ( ) ; } public void done ( ) { NewErrorCount = this . newErrorCount ; FixedErrorCount = this . fixedErrorCount ; NewWarningCount = this . newWarningCount ; FixedWarningCount = this . fixedWarningCount ; updateProgress ( <NUM_LIT:1.0f> ) ; subTask ( Messages . build_done ) ; if ( this . monitor != null ) this . monitor . done ( ) ; this . previousSubtask = null ; } protected String problemsMessage ( ) { int numNew = this . newErrorCount + this . newWarningCount ; int numFixed = this . fixedErrorCount + this . fixedWarningCount ; if ( numNew == <NUM_LIT:0> && numFixed == <NUM_LIT:0> ) return "<STR_LIT>" ; boolean displayBoth = numNew > <NUM_LIT:0> && numFixed > <NUM_LIT:0> ; StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( '<CHAR_LIT:(>' ) ; if ( numNew > <NUM_LIT:0> ) { buffer . append ( Messages . build_foundHeader ) ; buffer . append ( '<CHAR_LIT:U+0020>' ) ; if ( displayBoth || this . newErrorCount > <NUM_LIT:0> ) { if ( this . newErrorCount == <NUM_LIT:1> ) buffer . append ( Messages . build_oneError ) ; else buffer . append ( Messages . bind ( Messages . build_multipleErrors , String . valueOf ( this . newErrorCount ) ) ) ; if ( displayBoth || this . newWarningCount > <NUM_LIT:0> ) buffer . append ( "<STR_LIT>" ) ; } if ( displayBoth || this . newWarningCount > <NUM_LIT:0> ) { if ( this . newWarningCount == <NUM_LIT:1> ) buffer . append ( Messages . build_oneWarning ) ; else buffer . append ( Messages . bind ( Messages . build_multipleWarnings , String . valueOf ( this . newWarningCount ) ) ) ; } if ( numFixed > <NUM_LIT:0> ) buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } if ( numFixed > <NUM_LIT:0> ) { buffer . append ( Messages . build_fixedHeader ) ; buffer . append ( '<CHAR_LIT:U+0020>' ) ; if ( displayBoth ) { buffer . append ( String . valueOf ( this . fixedErrorCount ) ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( String . valueOf ( this . fixedWarningCount ) ) ; } else { if ( this . fixedErrorCount > <NUM_LIT:0> ) { if ( this . fixedErrorCount == <NUM_LIT:1> ) buffer . append ( Messages . build_oneError ) ; else buffer . append ( Messages . bind ( Messages . build_multipleErrors , String . valueOf ( this . fixedErrorCount ) ) ) ; if ( this . fixedWarningCount > <NUM_LIT:0> ) buffer . append ( "<STR_LIT>" ) ; } if ( this . fixedWarningCount > <NUM_LIT:0> ) { if ( this . fixedWarningCount == <NUM_LIT:1> ) buffer . append ( Messages . build_oneWarning ) ; else buffer . append ( Messages . bind ( Messages . build_multipleWarnings , String . valueOf ( this . fixedWarningCount ) ) ) ; } } } buffer . append ( '<CHAR_LIT:)>' ) ; return buffer . toString ( ) ; } public void setCancelling ( boolean cancelling ) { this . cancelling = cancelling ; } public void setProgressPerCompilationUnit ( float progress ) { this . progressPerCompilationUnit = progress ; } public void subTask ( String message ) { String pm = problemsMessage ( ) ; String msg = pm . length ( ) == <NUM_LIT:0> ? message : pm + "<STR_LIT:U+0020>" + message ; if ( msg . equals ( this . previousSubtask ) ) return ; if ( this . monitor != null ) this . monitor . subTask ( msg ) ; this . previousSubtask = msg ; } protected void updateProblemCounts ( CategorizedProblem [ ] newProblems ) { for ( int i = <NUM_LIT:0> , l = newProblems . length ; i < l ; i ++ ) if ( newProblems [ i ] . isError ( ) ) this . newErrorCount ++ ; else this . newWarningCount ++ ; } protected void updateProblemCounts ( IMarker [ ] oldProblems , CategorizedProblem [ ] newProblems ) { if ( newProblems != null ) { next : for ( int i = <NUM_LIT:0> , l = newProblems . length ; i < l ; i ++ ) { CategorizedProblem newProblem = newProblems [ i ] ; if ( newProblem . getID ( ) == IProblem . Task ) continue ; boolean isError = newProblem . isError ( ) ; String message = newProblem . getMessage ( ) ; if ( oldProblems != null ) { for ( int j = <NUM_LIT:0> , m = oldProblems . length ; j < m ; j ++ ) { IMarker pb = oldProblems [ j ] ; if ( pb == null ) continue ; boolean wasError = IMarker . SEVERITY_ERROR == pb . getAttribute ( IMarker . SEVERITY , IMarker . SEVERITY_ERROR ) ; if ( isError == wasError && message . equals ( pb . getAttribute ( IMarker . MESSAGE , "<STR_LIT>" ) ) ) { oldProblems [ j ] = null ; continue next ; } } } if ( isError ) this . newErrorCount ++ ; else this . newWarningCount ++ ; } } if ( oldProblems != null ) { next : for ( int i = <NUM_LIT:0> , l = oldProblems . length ; i < l ; i ++ ) { IMarker oldProblem = oldProblems [ i ] ; if ( oldProblem == null ) continue next ; boolean wasError = IMarker . SEVERITY_ERROR == oldProblem . getAttribute ( IMarker . SEVERITY , IMarker . SEVERITY_ERROR ) ; String message = oldProblem . getAttribute ( IMarker . MESSAGE , "<STR_LIT>" ) ; if ( newProblems != null ) { for ( int j = <NUM_LIT:0> , m = newProblems . length ; j < m ; j ++ ) { CategorizedProblem pb = newProblems [ j ] ; if ( pb . getID ( ) == IProblem . Task ) continue ; if ( wasError == pb . isError ( ) && message . equals ( pb . getMessage ( ) ) ) continue next ; } } if ( wasError ) this . fixedErrorCount ++ ; else this . fixedWarningCount ++ ; } } } public void updateProgress ( float newPercentComplete ) { if ( newPercentComplete > this . percentComplete ) { this . percentComplete = Math . min ( newPercentComplete , <NUM_LIT:1.0f> ) ; int work = Math . round ( this . percentComplete * this . totalWork ) ; if ( work > this . workDone ) { if ( this . monitor != null ) this . monitor . worked ( work - this . workDone ) ; this . workDone = work ; } } } public void updateProgressDelta ( float percentWorked ) { updateProgress ( this . percentComplete + percentWorked ) ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IResource ; import org . eclipse . jdt . core . JavaModelException ; class PackageFragmentInfo extends OpenableElementInfo { protected Object [ ] nonJavaResources ; public PackageFragmentInfo ( ) { this . nonJavaResources = null ; } boolean containsJavaResources ( ) { return this . children . length != <NUM_LIT:0> ; } Object [ ] getNonJavaResources ( IResource underlyingResource , PackageFragmentRoot rootHandle ) { if ( this . nonJavaResources == null ) { try { this . nonJavaResources = PackageFragmentRootInfo . computeFolderNonJavaResources ( rootHandle , ( IContainer ) underlyingResource , rootHandle . fullInclusionPatternChars ( ) , rootHandle . fullExclusionPatternChars ( ) ) ; } catch ( JavaModelException e ) { this . nonJavaResources = NO_NON_JAVA_RESOURCES ; } } return this . nonJavaResources ; } void setNonJavaResources ( Object [ ] resources ) { this . nonJavaResources = resources ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IMethod ; import org . eclipse . jdt . core . IType ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . ast . * ; import org . eclipse . jdt . internal . compiler . ast . CompilationUnitDeclaration ; import org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . ClassScope ; import org . eclipse . jdt . internal . core . SourceRefElement ; import org . eclipse . jdt . internal . core . SourceType ; public class ASTNodeFinder { private CompilationUnitDeclaration unit ; public ASTNodeFinder ( CompilationUnitDeclaration unit ) { this . unit = unit ; } public FieldDeclaration findField ( IField fieldHandle ) { TypeDeclaration typeDecl = findType ( ( IType ) fieldHandle . getParent ( ) ) ; if ( typeDecl == null ) return null ; FieldDeclaration [ ] fields = typeDecl . fields ; if ( fields != null ) { char [ ] fieldName = fieldHandle . getElementName ( ) . toCharArray ( ) ; for ( int i = <NUM_LIT:0> , length = fields . length ; i < length ; i ++ ) { FieldDeclaration field = fields [ i ] ; if ( CharOperation . equals ( fieldName , field . name ) ) { return field ; } } } return null ; } public Initializer findInitializer ( IInitializer initializerHandle ) { TypeDeclaration typeDecl = findType ( ( IType ) initializerHandle . getParent ( ) ) ; if ( typeDecl == null ) return null ; FieldDeclaration [ ] fields = typeDecl . fields ; if ( fields != null ) { int occurenceCount = ( ( SourceRefElement ) initializerHandle ) . occurrenceCount ; for ( int i = <NUM_LIT:0> , length = fields . length ; i < length ; i ++ ) { FieldDeclaration field = fields [ i ] ; if ( field instanceof Initializer && -- occurenceCount == <NUM_LIT:0> ) { return ( Initializer ) field ; } } } return null ; } public AbstractMethodDeclaration findMethod ( IMethod methodHandle ) { TypeDeclaration typeDecl = findType ( ( IType ) methodHandle . getParent ( ) ) ; if ( typeDecl == null ) return null ; AbstractMethodDeclaration [ ] methods = typeDecl . methods ; if ( methods != null ) { char [ ] selector = methodHandle . getElementName ( ) . toCharArray ( ) ; String [ ] parameterTypeSignatures = methodHandle . getParameterTypes ( ) ; int parameterCount = parameterTypeSignatures . length ; nextMethod : for ( int i = <NUM_LIT:0> , length = methods . length ; i < length ; i ++ ) { AbstractMethodDeclaration method = methods [ i ] ; if ( CharOperation . equals ( selector , method . selector ) ) { Argument [ ] args = method . arguments ; int argsLength = args == null ? <NUM_LIT:0> : args . length ; if ( argsLength == parameterCount ) { for ( int j = <NUM_LIT:0> ; j < parameterCount ; j ++ ) { TypeReference type = args [ j ] . type ; String signature = Util . typeSignature ( type ) ; if ( ! signature . equals ( parameterTypeSignatures [ j ] ) ) { continue nextMethod ; } } return method ; } } } } return null ; } public TypeDeclaration findType ( IType typeHandle ) { IJavaElement parent = typeHandle . getParent ( ) ; final char [ ] typeName = typeHandle . getElementName ( ) . toCharArray ( ) ; final int occurenceCount = ( ( SourceType ) typeHandle ) . occurrenceCount ; final boolean findAnonymous = typeName . length == <NUM_LIT:0> ; class Visitor extends ASTVisitor { TypeDeclaration result ; int count = <NUM_LIT:0> ; public boolean visit ( TypeDeclaration typeDeclaration , BlockScope scope ) { if ( this . result != null ) return false ; if ( ( typeDeclaration . bits & ASTNode . IsAnonymousType ) != <NUM_LIT:0> ) { if ( findAnonymous && ++ this . count == occurenceCount ) { this . result = typeDeclaration ; } } else { if ( ! findAnonymous && CharOperation . equals ( typeName , typeDeclaration . name ) ) { this . result = typeDeclaration ; } } return false ; } } switch ( parent . getElementType ( ) ) { case IJavaElement . COMPILATION_UNIT : TypeDeclaration [ ] types = this . unit . types ; if ( types != null ) { for ( int i = <NUM_LIT:0> , length = types . length ; i < length ; i ++ ) { TypeDeclaration type = types [ i ] ; if ( CharOperation . equals ( typeName , type . name ) ) { return type ; } } } break ; case IJavaElement . TYPE : TypeDeclaration parentDecl = findType ( ( IType ) parent ) ; if ( parentDecl == null ) return null ; types = parentDecl . memberTypes ; if ( types != null ) { for ( int i = <NUM_LIT:0> , length = types . length ; i < length ; i ++ ) { TypeDeclaration type = types [ i ] ; if ( CharOperation . equals ( typeName , type . name ) ) { return type ; } } } break ; case IJavaElement . FIELD : FieldDeclaration fieldDecl = findField ( ( IField ) parent ) ; if ( fieldDecl == null ) return null ; Visitor visitor = new Visitor ( ) ; fieldDecl . traverse ( visitor , null ) ; return visitor . result ; case IJavaElement . INITIALIZER : Initializer initializer = findInitializer ( ( IInitializer ) parent ) ; if ( initializer == null ) return null ; visitor = new Visitor ( ) ; initializer . traverse ( visitor , null ) ; return visitor . result ; case IJavaElement . METHOD : AbstractMethodDeclaration methodDecl = findMethod ( ( IMethod ) parent ) ; if ( methodDecl == null ) return null ; visitor = new Visitor ( ) ; methodDecl . traverse ( visitor , ( ClassScope ) null ) ; return visitor . result ; } return null ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IConstantPoolConstant ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; public class ConstantPool extends ClassFileStruct implements IConstantPool { private int constantPoolCount ; private int [ ] constantPoolOffset ; private byte [ ] classFileBytes ; ConstantPool ( byte [ ] reference , int [ ] constantPoolOffset ) { this . constantPoolCount = constantPoolOffset . length ; this . constantPoolOffset = constantPoolOffset ; this . classFileBytes = reference ; } public IConstantPoolEntry decodeEntry ( int index ) { ConstantPoolEntry constantPoolEntry = new ConstantPoolEntry ( ) ; constantPoolEntry . reset ( ) ; int kind = getEntryKind ( index ) ; constantPoolEntry . setKind ( kind ) ; switch ( kind ) { case IConstantPoolConstant . CONSTANT_Class : constantPoolEntry . setClassInfoNameIndex ( u2At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ) ; constantPoolEntry . setClassInfoName ( getUtf8ValueAt ( constantPoolEntry . getClassInfoNameIndex ( ) ) ) ; break ; case IConstantPoolConstant . CONSTANT_Double : constantPoolEntry . setDoubleValue ( doubleAt ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ) ; break ; case IConstantPoolConstant . CONSTANT_Fieldref : constantPoolEntry . setClassIndex ( u2At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ) ; int declaringClassIndex = u2At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ constantPoolEntry . getClassIndex ( ) ] ) ; constantPoolEntry . setClassName ( getUtf8ValueAt ( declaringClassIndex ) ) ; constantPoolEntry . setNameAndTypeIndex ( u2At ( this . classFileBytes , <NUM_LIT:3> , this . constantPoolOffset [ index ] ) ) ; int fieldNameIndex = u2At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ constantPoolEntry . getNameAndTypeIndex ( ) ] ) ; int fieldDescriptorIndex = u2At ( this . classFileBytes , <NUM_LIT:3> , this . constantPoolOffset [ constantPoolEntry . getNameAndTypeIndex ( ) ] ) ; constantPoolEntry . setFieldName ( getUtf8ValueAt ( fieldNameIndex ) ) ; constantPoolEntry . setFieldDescriptor ( getUtf8ValueAt ( fieldDescriptorIndex ) ) ; break ; case IConstantPoolConstant . CONSTANT_Methodref : case IConstantPoolConstant . CONSTANT_InterfaceMethodref : constantPoolEntry . setClassIndex ( u2At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ) ; declaringClassIndex = u2At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ constantPoolEntry . getClassIndex ( ) ] ) ; constantPoolEntry . setClassName ( getUtf8ValueAt ( declaringClassIndex ) ) ; constantPoolEntry . setNameAndTypeIndex ( u2At ( this . classFileBytes , <NUM_LIT:3> , this . constantPoolOffset [ index ] ) ) ; int methodNameIndex = u2At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ constantPoolEntry . getNameAndTypeIndex ( ) ] ) ; int methodDescriptorIndex = u2At ( this . classFileBytes , <NUM_LIT:3> , this . constantPoolOffset [ constantPoolEntry . getNameAndTypeIndex ( ) ] ) ; constantPoolEntry . setMethodName ( getUtf8ValueAt ( methodNameIndex ) ) ; constantPoolEntry . setMethodDescriptor ( getUtf8ValueAt ( methodDescriptorIndex ) ) ; break ; case IConstantPoolConstant . CONSTANT_Float : constantPoolEntry . setFloatValue ( floatAt ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ) ; break ; case IConstantPoolConstant . CONSTANT_Integer : constantPoolEntry . setIntegerValue ( i4At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ) ; break ; case IConstantPoolConstant . CONSTANT_Long : constantPoolEntry . setLongValue ( i8At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ) ; break ; case IConstantPoolConstant . CONSTANT_NameAndType : constantPoolEntry . setNameAndTypeNameIndex ( u2At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ) ; constantPoolEntry . setNameAndTypeDescriptorIndex ( u2At ( this . classFileBytes , <NUM_LIT:3> , this . constantPoolOffset [ index ] ) ) ; break ; case IConstantPoolConstant . CONSTANT_String : constantPoolEntry . setStringIndex ( u2At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ) ; constantPoolEntry . setStringValue ( getUtf8ValueAt ( constantPoolEntry . getStringIndex ( ) ) ) ; break ; case IConstantPoolConstant . CONSTANT_Utf8 : constantPoolEntry . setUtf8Length ( u2At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ) ; constantPoolEntry . setUtf8Value ( getUtf8ValueAt ( index ) ) ; } return constantPoolEntry ; } public int getConstantPoolCount ( ) { return this . constantPoolCount ; } public int getEntryKind ( int index ) { return u1At ( this . classFileBytes , <NUM_LIT:0> , this . constantPoolOffset [ index ] ) ; } private char [ ] getUtf8ValueAt ( int utf8Index ) { int utf8Offset = this . constantPoolOffset [ utf8Index ] ; return utf8At ( this . classFileBytes , <NUM_LIT:0> , utf8Offset + <NUM_LIT:3> , u2At ( this . classFileBytes , <NUM_LIT:0> , utf8Offset + <NUM_LIT:1> ) ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IConstantPoolConstant ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; import org . eclipse . jdt . core . util . IInnerClassesAttributeEntry ; public class InnerClassesAttributeEntry extends ClassFileStruct implements IInnerClassesAttributeEntry { private int innerClassNameIndex ; private int outerClassNameIndex ; private int innerNameIndex ; private char [ ] innerClassName ; private char [ ] outerClassName ; private char [ ] innerName ; private int accessFlags ; public InnerClassesAttributeEntry ( byte classFileBytes [ ] , IConstantPool constantPool , int offset ) throws ClassFormatException { this . innerClassNameIndex = u2At ( classFileBytes , <NUM_LIT:0> , offset ) ; this . outerClassNameIndex = u2At ( classFileBytes , <NUM_LIT:2> , offset ) ; this . innerNameIndex = u2At ( classFileBytes , <NUM_LIT:4> , offset ) ; this . accessFlags = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; IConstantPoolEntry constantPoolEntry ; if ( this . innerClassNameIndex != <NUM_LIT:0> ) { constantPoolEntry = constantPool . decodeEntry ( this . innerClassNameIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Class ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . innerClassName = constantPoolEntry . getClassInfoName ( ) ; } if ( this . outerClassNameIndex != <NUM_LIT:0> ) { constantPoolEntry = constantPool . decodeEntry ( this . outerClassNameIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Class ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . outerClassName = constantPoolEntry . getClassInfoName ( ) ; } if ( this . innerNameIndex != <NUM_LIT:0> ) { constantPoolEntry = constantPool . decodeEntry ( this . innerNameIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . innerName = constantPoolEntry . getUtf8Value ( ) ; } } public int getAccessFlags ( ) { return this . accessFlags ; } public char [ ] getInnerClassName ( ) { return this . innerClassName ; } public int getInnerClassNameIndex ( ) { return this . innerClassNameIndex ; } public char [ ] getInnerName ( ) { return this . innerName ; } public int getInnerNameIndex ( ) { return this . innerNameIndex ; } public char [ ] getOuterClassName ( ) { return this . outerClassName ; } public int getOuterClassNameIndex ( ) { return this . outerClassNameIndex ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IAnnotation ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IRuntimeVisibleAnnotationsAttribute ; public class RuntimeVisibleAnnotationsAttribute extends ClassFileAttribute implements IRuntimeVisibleAnnotationsAttribute { private static final IAnnotation [ ] NO_ENTRIES = new IAnnotation [ <NUM_LIT:0> ] ; private int annotationsNumber ; private IAnnotation [ ] annotations ; public RuntimeVisibleAnnotationsAttribute ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { super ( classFileBytes , constantPool , offset ) ; final int length = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; this . annotationsNumber = length ; if ( length != <NUM_LIT:0> ) { int readOffset = <NUM_LIT:8> ; this . annotations = new IAnnotation [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { Annotation annotation = new Annotation ( classFileBytes , constantPool , offset + readOffset ) ; this . annotations [ i ] = annotation ; readOffset += annotation . sizeInBytes ( ) ; } } else { this . annotations = NO_ENTRIES ; } } public IAnnotation [ ] getAnnotations ( ) { return this . annotations ; } public int getAnnotationsNumber ( ) { return this . annotationsNumber ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IAttributeNamesConstants ; import org . eclipse . jdt . core . util . IClassFileAttribute ; import org . eclipse . jdt . core . util . IClassFileReader ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IConstantPoolConstant ; import org . eclipse . jdt . core . util . IFieldInfo ; import org . eclipse . jdt . core . util . IInnerClassesAttribute ; import org . eclipse . jdt . core . util . IMethodInfo ; import org . eclipse . jdt . core . util . IModifierConstants ; import org . eclipse . jdt . core . util . ISourceAttribute ; import org . eclipse . jdt . internal . compiler . util . Util ; public class ClassFileReader extends ClassFileStruct implements IClassFileReader { private static final IFieldInfo [ ] NO_FIELD_INFOS = new IFieldInfo [ <NUM_LIT:0> ] ; private static final char [ ] [ ] NO_INTERFACES_NAMES = CharOperation . NO_CHAR_CHAR ; private static final IMethodInfo [ ] NO_METHOD_INFOS = new IMethodInfo [ <NUM_LIT:0> ] ; private int accessFlags ; private IClassFileAttribute [ ] attributes ; private int attributesCount ; private char [ ] className ; private int classNameIndex ; private IConstantPool constantPool ; private IFieldInfo [ ] fields ; private int fieldsCount ; private IInnerClassesAttribute innerClassesAttribute ; private int [ ] interfaceIndexes ; private char [ ] [ ] interfaceNames ; private int interfacesCount ; private int magicNumber ; private int majorVersion ; private IMethodInfo [ ] methods ; private int methodsCount ; private int minorVersion ; private ISourceAttribute sourceFileAttribute ; private char [ ] superclassName ; private int superclassNameIndex ; public ClassFileReader ( byte [ ] classFileBytes , int decodingFlags ) throws ClassFormatException { int constantPoolCount ; int [ ] constantPoolOffsets ; try { this . magicNumber = ( int ) u4At ( classFileBytes , <NUM_LIT:0> , <NUM_LIT:0> ) ; if ( this . magicNumber != <NUM_LIT> ) { throw new ClassFormatException ( ClassFormatException . INVALID_MAGIC_NUMBER ) ; } int readOffset = <NUM_LIT:10> ; this . minorVersion = u2At ( classFileBytes , <NUM_LIT:4> , <NUM_LIT:0> ) ; this . majorVersion = u2At ( classFileBytes , <NUM_LIT:6> , <NUM_LIT:0> ) ; if ( ( decodingFlags & IClassFileReader . CONSTANT_POOL ) == <NUM_LIT:0> ) { return ; } constantPoolCount = u2At ( classFileBytes , <NUM_LIT:8> , <NUM_LIT:0> ) ; constantPoolOffsets = new int [ constantPoolCount ] ; for ( int i = <NUM_LIT:1> ; i < constantPoolCount ; i ++ ) { int tag = u1At ( classFileBytes , readOffset , <NUM_LIT:0> ) ; switch ( tag ) { case IConstantPoolConstant . CONSTANT_Utf8 : constantPoolOffsets [ i ] = readOffset ; readOffset += u2At ( classFileBytes , readOffset + <NUM_LIT:1> , <NUM_LIT:0> ) ; readOffset += IConstantPoolConstant . CONSTANT_Utf8_SIZE ; break ; case IConstantPoolConstant . CONSTANT_Integer : constantPoolOffsets [ i ] = readOffset ; readOffset += IConstantPoolConstant . CONSTANT_Integer_SIZE ; break ; case IConstantPoolConstant . CONSTANT_Float : constantPoolOffsets [ i ] = readOffset ; readOffset += IConstantPoolConstant . CONSTANT_Float_SIZE ; break ; case IConstantPoolConstant . CONSTANT_Long : constantPoolOffsets [ i ] = readOffset ; readOffset += IConstantPoolConstant . CONSTANT_Long_SIZE ; i ++ ; break ; case IConstantPoolConstant . CONSTANT_Double : constantPoolOffsets [ i ] = readOffset ; readOffset += IConstantPoolConstant . CONSTANT_Double_SIZE ; i ++ ; break ; case IConstantPoolConstant . CONSTANT_Class : constantPoolOffsets [ i ] = readOffset ; readOffset += IConstantPoolConstant . CONSTANT_Class_SIZE ; break ; case IConstantPoolConstant . CONSTANT_String : constantPoolOffsets [ i ] = readOffset ; readOffset += IConstantPoolConstant . CONSTANT_String_SIZE ; break ; case IConstantPoolConstant . CONSTANT_Fieldref : constantPoolOffsets [ i ] = readOffset ; readOffset += IConstantPoolConstant . CONSTANT_Fieldref_SIZE ; break ; case IConstantPoolConstant . CONSTANT_Methodref : constantPoolOffsets [ i ] = readOffset ; readOffset += IConstantPoolConstant . CONSTANT_Methodref_SIZE ; break ; case IConstantPoolConstant . CONSTANT_InterfaceMethodref : constantPoolOffsets [ i ] = readOffset ; readOffset += IConstantPoolConstant . CONSTANT_InterfaceMethodref_SIZE ; break ; case IConstantPoolConstant . CONSTANT_NameAndType : constantPoolOffsets [ i ] = readOffset ; readOffset += IConstantPoolConstant . CONSTANT_NameAndType_SIZE ; break ; default : throw new ClassFormatException ( ClassFormatException . INVALID_TAG_CONSTANT ) ; } } this . constantPool = new ConstantPool ( classFileBytes , constantPoolOffsets ) ; this . accessFlags = u2At ( classFileBytes , readOffset , <NUM_LIT:0> ) ; readOffset += <NUM_LIT:2> ; this . classNameIndex = u2At ( classFileBytes , readOffset , <NUM_LIT:0> ) ; this . className = getConstantClassNameAt ( classFileBytes , constantPoolOffsets , this . classNameIndex ) ; readOffset += <NUM_LIT:2> ; this . superclassNameIndex = u2At ( classFileBytes , readOffset , <NUM_LIT:0> ) ; readOffset += <NUM_LIT:2> ; if ( this . superclassNameIndex != <NUM_LIT:0> ) { this . superclassName = getConstantClassNameAt ( classFileBytes , constantPoolOffsets , this . superclassNameIndex ) ; } this . interfacesCount = u2At ( classFileBytes , readOffset , <NUM_LIT:0> ) ; readOffset += <NUM_LIT:2> ; this . interfaceNames = NO_INTERFACES_NAMES ; this . interfaceIndexes = Util . EMPTY_INT_ARRAY ; if ( this . interfacesCount != <NUM_LIT:0> ) { if ( ( decodingFlags & IClassFileReader . SUPER_INTERFACES ) != IClassFileReader . CONSTANT_POOL ) { this . interfaceNames = new char [ this . interfacesCount ] [ ] ; this . interfaceIndexes = new int [ this . interfacesCount ] ; for ( int i = <NUM_LIT:0> ; i < this . interfacesCount ; i ++ ) { this . interfaceIndexes [ i ] = u2At ( classFileBytes , readOffset , <NUM_LIT:0> ) ; this . interfaceNames [ i ] = getConstantClassNameAt ( classFileBytes , constantPoolOffsets , this . interfaceIndexes [ i ] ) ; readOffset += <NUM_LIT:2> ; } } else { readOffset += ( <NUM_LIT:2> * this . interfacesCount ) ; } } this . fieldsCount = u2At ( classFileBytes , readOffset , <NUM_LIT:0> ) ; readOffset += <NUM_LIT:2> ; this . fields = NO_FIELD_INFOS ; if ( this . fieldsCount != <NUM_LIT:0> ) { if ( ( decodingFlags & IClassFileReader . FIELD_INFOS ) != IClassFileReader . CONSTANT_POOL ) { FieldInfo field ; this . fields = new FieldInfo [ this . fieldsCount ] ; for ( int i = <NUM_LIT:0> ; i < this . fieldsCount ; i ++ ) { field = new FieldInfo ( classFileBytes , this . constantPool , readOffset ) ; this . fields [ i ] = field ; readOffset += field . sizeInBytes ( ) ; } } else { for ( int i = <NUM_LIT:0> ; i < this . fieldsCount ; i ++ ) { int attributeCountForField = u2At ( classFileBytes , <NUM_LIT:6> , readOffset ) ; readOffset += <NUM_LIT:8> ; if ( attributeCountForField != <NUM_LIT:0> ) { for ( int j = <NUM_LIT:0> ; j < attributeCountForField ; j ++ ) { int attributeLength = ( int ) u4At ( classFileBytes , <NUM_LIT:2> , readOffset ) ; readOffset += ( <NUM_LIT:6> + attributeLength ) ; } } } } } this . methodsCount = u2At ( classFileBytes , readOffset , <NUM_LIT:0> ) ; readOffset += <NUM_LIT:2> ; this . methods = NO_METHOD_INFOS ; if ( this . methodsCount != <NUM_LIT:0> ) { if ( ( decodingFlags & IClassFileReader . METHOD_INFOS ) != IClassFileReader . CONSTANT_POOL ) { this . methods = new MethodInfo [ this . methodsCount ] ; MethodInfo method ; for ( int i = <NUM_LIT:0> ; i < this . methodsCount ; i ++ ) { method = new MethodInfo ( classFileBytes , this . constantPool , readOffset , decodingFlags ) ; this . methods [ i ] = method ; readOffset += method . sizeInBytes ( ) ; } } else { for ( int i = <NUM_LIT:0> ; i < this . methodsCount ; i ++ ) { int attributeCountForMethod = u2At ( classFileBytes , <NUM_LIT:6> , readOffset ) ; readOffset += <NUM_LIT:8> ; if ( attributeCountForMethod != <NUM_LIT:0> ) { for ( int j = <NUM_LIT:0> ; j < attributeCountForMethod ; j ++ ) { int attributeLength = ( int ) u4At ( classFileBytes , <NUM_LIT:2> , readOffset ) ; readOffset += ( <NUM_LIT:6> + attributeLength ) ; } } } } } this . attributesCount = u2At ( classFileBytes , readOffset , <NUM_LIT:0> ) ; readOffset += <NUM_LIT:2> ; int attributesIndex = <NUM_LIT:0> ; this . attributes = ClassFileAttribute . NO_ATTRIBUTES ; if ( this . attributesCount != <NUM_LIT:0> ) { if ( ( decodingFlags & IClassFileReader . CLASSFILE_ATTRIBUTES ) != IClassFileReader . CONSTANT_POOL ) { this . attributes = new IClassFileAttribute [ this . attributesCount ] ; for ( int i = <NUM_LIT:0> ; i < this . attributesCount ; i ++ ) { int utf8Offset = constantPoolOffsets [ u2At ( classFileBytes , readOffset , <NUM_LIT:0> ) ] ; char [ ] attributeName = utf8At ( classFileBytes , utf8Offset + <NUM_LIT:3> , <NUM_LIT:0> , u2At ( classFileBytes , utf8Offset + <NUM_LIT:1> , <NUM_LIT:0> ) ) ; if ( equals ( attributeName , IAttributeNamesConstants . INNER_CLASSES ) ) { this . innerClassesAttribute = new InnerClassesAttribute ( classFileBytes , this . constantPool , readOffset ) ; this . attributes [ attributesIndex ++ ] = this . innerClassesAttribute ; } else if ( equals ( attributeName , IAttributeNamesConstants . SOURCE ) ) { this . sourceFileAttribute = new SourceFileAttribute ( classFileBytes , this . constantPool , readOffset ) ; this . attributes [ attributesIndex ++ ] = this . sourceFileAttribute ; } else if ( equals ( attributeName , IAttributeNamesConstants . ENCLOSING_METHOD ) ) { this . attributes [ attributesIndex ++ ] = new EnclosingMethodAttribute ( classFileBytes , this . constantPool , readOffset ) ; } else if ( equals ( attributeName , IAttributeNamesConstants . SIGNATURE ) ) { this . attributes [ attributesIndex ++ ] = new SignatureAttribute ( classFileBytes , this . constantPool , readOffset ) ; } else if ( equals ( attributeName , IAttributeNamesConstants . RUNTIME_VISIBLE_ANNOTATIONS ) ) { this . attributes [ attributesIndex ++ ] = new RuntimeVisibleAnnotationsAttribute ( classFileBytes , this . constantPool , readOffset ) ; } else if ( equals ( attributeName , IAttributeNamesConstants . RUNTIME_INVISIBLE_ANNOTATIONS ) ) { this . attributes [ attributesIndex ++ ] = new RuntimeInvisibleAnnotationsAttribute ( classFileBytes , this . constantPool , readOffset ) ; } else { this . attributes [ attributesIndex ++ ] = new ClassFileAttribute ( classFileBytes , this . constantPool , readOffset ) ; } readOffset += ( <NUM_LIT:6> + u4At ( classFileBytes , readOffset + <NUM_LIT:2> , <NUM_LIT:0> ) ) ; } } else { for ( int i = <NUM_LIT:0> ; i < this . attributesCount ; i ++ ) { readOffset += ( <NUM_LIT:6> + u4At ( classFileBytes , readOffset + <NUM_LIT:2> , <NUM_LIT:0> ) ) ; } } } if ( readOffset != classFileBytes . length ) { throw new ClassFormatException ( ClassFormatException . TOO_MANY_BYTES ) ; } } catch ( ClassFormatException e ) { throw e ; } catch ( Exception e ) { e . printStackTrace ( ) ; throw new ClassFormatException ( ClassFormatException . ERROR_TRUNCATED_INPUT ) ; } } public int getAccessFlags ( ) { return this . accessFlags ; } public int getAttributeCount ( ) { return this . attributesCount ; } public IClassFileAttribute [ ] getAttributes ( ) { return this . attributes ; } public int getClassIndex ( ) { return this . classNameIndex ; } public char [ ] getClassName ( ) { return this . className ; } private char [ ] getConstantClassNameAt ( byte [ ] classFileBytes , int [ ] constantPoolOffsets , int constantPoolIndex ) { int utf8Offset = constantPoolOffsets [ u2At ( classFileBytes , constantPoolOffsets [ constantPoolIndex ] + <NUM_LIT:1> , <NUM_LIT:0> ) ] ; return utf8At ( classFileBytes , utf8Offset + <NUM_LIT:3> , <NUM_LIT:0> , u2At ( classFileBytes , utf8Offset + <NUM_LIT:1> , <NUM_LIT:0> ) ) ; } public IConstantPool getConstantPool ( ) { return this . constantPool ; } public IFieldInfo [ ] getFieldInfos ( ) { return this . fields ; } public int getFieldsCount ( ) { return this . fieldsCount ; } public IInnerClassesAttribute getInnerClassesAttribute ( ) { return this . innerClassesAttribute ; } public int [ ] getInterfaceIndexes ( ) { return this . interfaceIndexes ; } public char [ ] [ ] getInterfaceNames ( ) { return this . interfaceNames ; } public int getMagic ( ) { return this . magicNumber ; } public int getMajorVersion ( ) { return this . majorVersion ; } public IMethodInfo [ ] getMethodInfos ( ) { return this . methods ; } public int getMethodsCount ( ) { return this . methodsCount ; } public int getMinorVersion ( ) { return this . minorVersion ; } public ISourceAttribute getSourceFileAttribute ( ) { return this . sourceFileAttribute ; } public int getSuperclassIndex ( ) { return this . superclassNameIndex ; } public char [ ] getSuperclassName ( ) { return this . superclassName ; } public boolean isClass ( ) { return ! isInterface ( ) ; } public boolean isInterface ( ) { return ( getAccessFlags ( ) & IModifierConstants . ACC_INTERFACE ) != <NUM_LIT:0> ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IStackMapFrame ; import org . eclipse . jdt . core . util . IVerificationTypeInfo ; public class StackMapFrame extends ClassFileStruct implements IStackMapFrame { private static final IVerificationTypeInfo [ ] EMPTY_LOCALS_OR_STACK_ITEMS = new IVerificationTypeInfo [ <NUM_LIT:0> ] ; private int readOffset ; private int frameType ; private int numberOfLocals ; private int numberOfStackItems ; private IVerificationTypeInfo [ ] locals ; private IVerificationTypeInfo [ ] stackItems ; private int offsetDelta ; public StackMapFrame ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { final int type = u1At ( classFileBytes , <NUM_LIT:0> , offset ) ; this . frameType = type ; switch ( type ) { case <NUM_LIT> : this . offsetDelta = u2At ( classFileBytes , <NUM_LIT:1> , offset ) ; this . numberOfStackItems = <NUM_LIT:1> ; this . stackItems = new VerificationInfo [ <NUM_LIT:1> ] ; this . readOffset = <NUM_LIT:3> ; VerificationInfo info = new VerificationInfo ( classFileBytes , constantPool , offset + this . readOffset ) ; this . stackItems [ <NUM_LIT:0> ] = info ; this . readOffset += info . sizeInBytes ( ) ; this . locals = EMPTY_LOCALS_OR_STACK_ITEMS ; this . numberOfLocals = <NUM_LIT:0> ; break ; case <NUM_LIT> : case <NUM_LIT> : case <NUM_LIT> : this . offsetDelta = u2At ( classFileBytes , <NUM_LIT:1> , offset ) ; this . numberOfStackItems = <NUM_LIT:0> ; this . stackItems = EMPTY_LOCALS_OR_STACK_ITEMS ; this . readOffset = <NUM_LIT:3> ; this . locals = EMPTY_LOCALS_OR_STACK_ITEMS ; this . numberOfLocals = <NUM_LIT:0> ; break ; case <NUM_LIT> : this . offsetDelta = u2At ( classFileBytes , <NUM_LIT:1> , offset ) ; this . numberOfStackItems = <NUM_LIT:0> ; this . stackItems = EMPTY_LOCALS_OR_STACK_ITEMS ; this . readOffset = <NUM_LIT:3> ; this . locals = EMPTY_LOCALS_OR_STACK_ITEMS ; this . numberOfLocals = <NUM_LIT:0> ; break ; case <NUM_LIT> : case <NUM_LIT> : case <NUM_LIT> : this . offsetDelta = u2At ( classFileBytes , <NUM_LIT:1> , offset ) ; this . numberOfStackItems = <NUM_LIT:0> ; this . stackItems = EMPTY_LOCALS_OR_STACK_ITEMS ; this . readOffset = <NUM_LIT:3> ; int diffLocals = type - <NUM_LIT> ; this . numberOfLocals = diffLocals ; this . locals = new IVerificationTypeInfo [ diffLocals ] ; for ( int i = <NUM_LIT:0> ; i < diffLocals ; i ++ ) { VerificationInfo verificationInfo = new VerificationInfo ( classFileBytes , constantPool , offset + this . readOffset ) ; this . locals [ i ] = verificationInfo ; this . readOffset += verificationInfo . sizeInBytes ( ) ; } break ; case <NUM_LIT:255> : this . offsetDelta = u2At ( classFileBytes , <NUM_LIT:1> , offset ) ; int tempLocals = u2At ( classFileBytes , <NUM_LIT:3> , offset ) ; this . numberOfLocals = tempLocals ; this . readOffset = <NUM_LIT:5> ; if ( tempLocals != <NUM_LIT:0> ) { this . locals = new IVerificationTypeInfo [ tempLocals ] ; for ( int i = <NUM_LIT:0> ; i < tempLocals ; i ++ ) { VerificationInfo verificationInfo = new VerificationInfo ( classFileBytes , constantPool , offset + this . readOffset ) ; this . locals [ i ] = verificationInfo ; this . readOffset += verificationInfo . sizeInBytes ( ) ; } } else { this . locals = EMPTY_LOCALS_OR_STACK_ITEMS ; } int tempStackItems = u2At ( classFileBytes , this . readOffset , offset ) ; this . readOffset += <NUM_LIT:2> ; this . numberOfStackItems = tempStackItems ; if ( tempStackItems != <NUM_LIT:0> ) { this . stackItems = new IVerificationTypeInfo [ tempStackItems ] ; for ( int i = <NUM_LIT:0> ; i < tempStackItems ; i ++ ) { VerificationInfo verificationInfo = new VerificationInfo ( classFileBytes , constantPool , offset + this . readOffset ) ; this . stackItems [ i ] = verificationInfo ; this . readOffset += verificationInfo . sizeInBytes ( ) ; } } else { this . stackItems = EMPTY_LOCALS_OR_STACK_ITEMS ; } break ; default : if ( type <= <NUM_LIT> ) { this . offsetDelta = type ; this . numberOfStackItems = <NUM_LIT:0> ; this . stackItems = EMPTY_LOCALS_OR_STACK_ITEMS ; this . locals = EMPTY_LOCALS_OR_STACK_ITEMS ; this . numberOfLocals = <NUM_LIT:0> ; this . readOffset = <NUM_LIT:1> ; } else if ( type <= <NUM_LIT> ) { this . offsetDelta = type - <NUM_LIT> ; this . numberOfStackItems = <NUM_LIT:1> ; this . stackItems = new VerificationInfo [ <NUM_LIT:1> ] ; this . readOffset = <NUM_LIT:1> ; info = new VerificationInfo ( classFileBytes , constantPool , offset + this . readOffset ) ; this . stackItems [ <NUM_LIT:0> ] = info ; this . readOffset += info . sizeInBytes ( ) ; this . locals = EMPTY_LOCALS_OR_STACK_ITEMS ; this . numberOfLocals = <NUM_LIT:0> ; } } } int sizeInBytes ( ) { return this . readOffset ; } public int getFrameType ( ) { return this . frameType ; } public IVerificationTypeInfo [ ] getLocals ( ) { return this . locals ; } public int getNumberOfLocals ( ) { return this . numberOfLocals ; } public int getNumberOfStackItems ( ) { return this . numberOfStackItems ; } public int getOffsetDelta ( ) { return this . offsetDelta ; } public IVerificationTypeInfo [ ] getStackItems ( ) { return this . stackItems ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . internal . core . JavaElement ; public class MementoTokenizer { private static final String COUNT = Character . toString ( JavaElement . JEM_COUNT ) ; private static final String JAVAPROJECT = Character . toString ( JavaElement . JEM_JAVAPROJECT ) ; private static final String PACKAGEFRAGMENTROOT = Character . toString ( JavaElement . JEM_PACKAGEFRAGMENTROOT ) ; private static final String PACKAGEFRAGMENT = Character . toString ( JavaElement . JEM_PACKAGEFRAGMENT ) ; private static final String FIELD = Character . toString ( JavaElement . JEM_FIELD ) ; private static final String METHOD = Character . toString ( JavaElement . JEM_METHOD ) ; private static final String INITIALIZER = Character . toString ( JavaElement . JEM_INITIALIZER ) ; private static final String COMPILATIONUNIT = Character . toString ( JavaElement . JEM_COMPILATIONUNIT ) ; private static final String CLASSFILE = Character . toString ( JavaElement . JEM_CLASSFILE ) ; private static final String TYPE = Character . toString ( JavaElement . JEM_TYPE ) ; private static final String PACKAGEDECLARATION = Character . toString ( JavaElement . JEM_PACKAGEDECLARATION ) ; private static final String IMPORTDECLARATION = Character . toString ( JavaElement . JEM_IMPORTDECLARATION ) ; private static final String LOCALVARIABLE = Character . toString ( JavaElement . JEM_LOCALVARIABLE ) ; private static final String TYPE_PARAMETER = Character . toString ( JavaElement . JEM_TYPE_PARAMETER ) ; private static final String ANNOTATION = Character . toString ( JavaElement . JEM_ANNOTATION ) ; private final char [ ] memento ; private final int length ; private int index = <NUM_LIT:0> ; public MementoTokenizer ( String memento ) { this . memento = memento . toCharArray ( ) ; this . length = this . memento . length ; } public boolean hasMoreTokens ( ) { return this . index < this . length ; } public String nextToken ( ) { int start = this . index ; StringBuffer buffer = null ; switch ( this . memento [ this . index ++ ] ) { case JavaElement . JEM_ESCAPE : buffer = new StringBuffer ( ) ; buffer . append ( this . memento [ this . index ] ) ; start = ++ this . index ; break ; case JavaElement . JEM_COUNT : return COUNT ; case JavaElement . JEM_JAVAPROJECT : return JAVAPROJECT ; case JavaElement . JEM_PACKAGEFRAGMENTROOT : return PACKAGEFRAGMENTROOT ; case JavaElement . JEM_PACKAGEFRAGMENT : return PACKAGEFRAGMENT ; case JavaElement . JEM_FIELD : return FIELD ; case JavaElement . JEM_METHOD : return METHOD ; case JavaElement . JEM_INITIALIZER : return INITIALIZER ; case JavaElement . JEM_COMPILATIONUNIT : return COMPILATIONUNIT ; case JavaElement . JEM_CLASSFILE : return CLASSFILE ; case JavaElement . JEM_TYPE : return TYPE ; case JavaElement . JEM_PACKAGEDECLARATION : return PACKAGEDECLARATION ; case JavaElement . JEM_IMPORTDECLARATION : return IMPORTDECLARATION ; case JavaElement . JEM_LOCALVARIABLE : return LOCALVARIABLE ; case JavaElement . JEM_TYPE_PARAMETER : return TYPE_PARAMETER ; case JavaElement . JEM_ANNOTATION : return ANNOTATION ; } loop : while ( this . index < this . length ) { switch ( this . memento [ this . index ] ) { case JavaElement . JEM_ESCAPE : if ( buffer == null ) buffer = new StringBuffer ( ) ; buffer . append ( this . memento , start , this . index - start ) ; start = ++ this . index ; break ; case JavaElement . JEM_COUNT : case JavaElement . JEM_JAVAPROJECT : case JavaElement . JEM_PACKAGEFRAGMENTROOT : case JavaElement . JEM_PACKAGEFRAGMENT : case JavaElement . JEM_FIELD : case JavaElement . JEM_METHOD : case JavaElement . JEM_INITIALIZER : case JavaElement . JEM_COMPILATIONUNIT : case JavaElement . JEM_CLASSFILE : case JavaElement . JEM_TYPE : case JavaElement . JEM_PACKAGEDECLARATION : case JavaElement . JEM_IMPORTDECLARATION : case JavaElement . JEM_LOCALVARIABLE : case JavaElement . JEM_TYPE_PARAMETER : case JavaElement . JEM_ANNOTATION : break loop ; } this . index ++ ; } if ( buffer != null ) { buffer . append ( this . memento , start , this . index - start ) ; return buffer . toString ( ) ; } else { return new String ( this . memento , start , this . index - start ) ; } } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . compiler . IScanner ; import org . eclipse . jdt . core . compiler . ITerminalSymbols ; import org . eclipse . jdt . core . compiler . InvalidInputException ; import org . eclipse . jdt . internal . compiler . CompilationResult ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . parser . NLSTag ; import org . eclipse . jdt . internal . compiler . parser . ScannerHelper ; import org . eclipse . jdt . internal . compiler . util . Util ; public class PublicScanner implements IScanner , ITerminalSymbols { public long sourceLevel ; public long complianceLevel ; public boolean useAssertAsAnIndentifier = false ; public boolean containsAssertKeyword = false ; public boolean useEnumAsAnIndentifier = false ; public boolean recordLineSeparator = false ; public char currentCharacter ; public int startPosition ; public int currentPosition ; public int initialPosition , eofPosition ; public boolean skipComments = false ; public boolean tokenizeComments = false ; public boolean tokenizeWhiteSpace = false ; public char source [ ] ; public char [ ] withoutUnicodeBuffer ; public int withoutUnicodePtr ; public boolean unicodeAsBackSlash = false ; public boolean scanningFloatLiteral = false ; public final static int COMMENT_ARRAYS_SIZE = <NUM_LIT:30> ; public int [ ] commentStops = new int [ COMMENT_ARRAYS_SIZE ] ; public int [ ] commentStarts = new int [ COMMENT_ARRAYS_SIZE ] ; public int [ ] commentTagStarts = new int [ COMMENT_ARRAYS_SIZE ] ; public int commentPtr = - <NUM_LIT:1> ; protected int lastCommentLinePosition = - <NUM_LIT:1> ; public char [ ] [ ] foundTaskTags = null ; public char [ ] [ ] foundTaskMessages ; public char [ ] [ ] foundTaskPriorities = null ; public int [ ] [ ] foundTaskPositions ; public int foundTaskCount = <NUM_LIT:0> ; public char [ ] [ ] taskTags = null ; public char [ ] [ ] taskPriorities = null ; public boolean isTaskCaseSensitive = true ; public boolean diet = false ; public int [ ] lineEnds = new int [ <NUM_LIT> ] ; public int linePtr = - <NUM_LIT:1> ; public boolean wasAcr = false ; public static final String END_OF_SOURCE = "<STR_LIT>" ; public static final String INVALID_HEXA = "<STR_LIT>" ; public static final String INVALID_OCTAL = "<STR_LIT>" ; public static final String INVALID_CHARACTER_CONSTANT = "<STR_LIT>" ; public static final String INVALID_ESCAPE = "<STR_LIT>" ; public static final String INVALID_INPUT = "<STR_LIT>" ; public static final String INVALID_UNICODE_ESCAPE = "<STR_LIT>" ; public static final String INVALID_FLOAT = "<STR_LIT>" ; public static final String INVALID_LOW_SURROGATE = "<STR_LIT>" ; public static final String INVALID_HIGH_SURROGATE = "<STR_LIT>" ; public static final String NULL_SOURCE_STRING = "<STR_LIT>" ; public static final String UNTERMINATED_STRING = "<STR_LIT>" ; public static final String UNTERMINATED_COMMENT = "<STR_LIT>" ; public static final String INVALID_CHAR_IN_STRING = "<STR_LIT>" ; public static final String INVALID_DIGIT = "<STR_LIT>" ; private static final int [ ] EMPTY_LINE_ENDS = Util . EMPTY_INT_ARRAY ; static final char [ ] charArray_a = new char [ ] { '<CHAR_LIT:a>' } , charArray_b = new char [ ] { '<CHAR_LIT:b>' } , charArray_c = new char [ ] { '<CHAR_LIT:c>' } , charArray_d = new char [ ] { '<CHAR_LIT>' } , charArray_e = new char [ ] { '<CHAR_LIT:e>' } , charArray_f = new char [ ] { '<CHAR_LIT>' } , charArray_g = new char [ ] { '<CHAR_LIT>' } , charArray_h = new char [ ] { '<CHAR_LIT>' } , charArray_i = new char [ ] { '<CHAR_LIT>' } , charArray_j = new char [ ] { '<CHAR_LIT>' } , charArray_k = new char [ ] { '<CHAR_LIT>' } , charArray_l = new char [ ] { '<CHAR_LIT>' } , charArray_m = new char [ ] { '<CHAR_LIT>' } , charArray_n = new char [ ] { '<CHAR_LIT>' } , charArray_o = new char [ ] { '<CHAR_LIT>' } , charArray_p = new char [ ] { '<CHAR_LIT>' } , charArray_q = new char [ ] { '<CHAR_LIT>' } , charArray_r = new char [ ] { '<CHAR_LIT>' } , charArray_s = new char [ ] { '<CHAR_LIT>' } , charArray_t = new char [ ] { '<CHAR_LIT>' } , charArray_u = new char [ ] { '<CHAR_LIT>' } , charArray_v = new char [ ] { '<CHAR_LIT>' } , charArray_w = new char [ ] { '<CHAR_LIT>' } , charArray_x = new char [ ] { '<CHAR_LIT>' } , charArray_y = new char [ ] { '<CHAR_LIT>' } , charArray_z = new char [ ] { '<CHAR_LIT>' } ; static final char [ ] initCharArray = new char [ ] { '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT>' , '<CHAR_LIT>' } ; static final int TableSize = <NUM_LIT:30> , InternalTableSize = <NUM_LIT:6> ; public static final int OptimizedLength = <NUM_LIT:7> ; public final char [ ] [ ] [ ] [ ] charArray_length = new char [ OptimizedLength ] [ TableSize ] [ InternalTableSize ] [ ] ; public static final char [ ] TAG_PREFIX = "<STR_LIT>" . toCharArray ( ) ; public static final int TAG_PREFIX_LENGTH = TAG_PREFIX . length ; public static final char TAG_POSTFIX = '<CHAR_LIT>' ; public static final int TAG_POSTFIX_LENGTH = <NUM_LIT:1> ; private NLSTag [ ] nlsTags = null ; protected int nlsTagsPtr ; public boolean checkNonExternalizedStringLiterals ; protected int lastPosition ; public boolean returnOnlyGreater = false ; { for ( int i = <NUM_LIT:0> ; i < <NUM_LIT:6> ; i ++ ) { for ( int j = <NUM_LIT:0> ; j < TableSize ; j ++ ) { for ( int k = <NUM_LIT:0> ; k < InternalTableSize ; k ++ ) { this . charArray_length [ i ] [ j ] [ k ] = initCharArray ; } } } } int newEntry2 = <NUM_LIT:0> , newEntry3 = <NUM_LIT:0> , newEntry4 = <NUM_LIT:0> , newEntry5 = <NUM_LIT:0> , newEntry6 = <NUM_LIT:0> ; public boolean insideRecovery = false ; public static final int RoundBracket = <NUM_LIT:0> ; public static final int SquareBracket = <NUM_LIT:1> ; public static final int CurlyBracket = <NUM_LIT:2> ; public static final int BracketKinds = <NUM_LIT:3> ; public static final int LOW_SURROGATE_MIN_VALUE = <NUM_LIT> ; public static final int HIGH_SURROGATE_MIN_VALUE = <NUM_LIT> ; public static final int HIGH_SURROGATE_MAX_VALUE = <NUM_LIT> ; public static final int LOW_SURROGATE_MAX_VALUE = <NUM_LIT> ; public PublicScanner ( ) { this ( false , false , false , ClassFileConstants . JDK1_3 , null , null , true ) ; } public PublicScanner ( boolean tokenizeComments , boolean tokenizeWhiteSpace , boolean checkNonExternalizedStringLiterals , long sourceLevel , long complianceLevel , char [ ] [ ] taskTags , char [ ] [ ] taskPriorities , boolean isTaskCaseSensitive ) { this . eofPosition = Integer . MAX_VALUE ; this . tokenizeComments = tokenizeComments ; this . tokenizeWhiteSpace = tokenizeWhiteSpace ; this . sourceLevel = sourceLevel ; this . complianceLevel = complianceLevel ; this . checkNonExternalizedStringLiterals = checkNonExternalizedStringLiterals ; if ( taskTags != null ) { int length = taskTags . length ; if ( taskPriorities != null ) { int [ ] initialIndexes = new int [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { initialIndexes [ i ] = i ; } Util . reverseQuickSort ( taskTags , <NUM_LIT:0> , taskTags . length - <NUM_LIT:1> , initialIndexes ) ; char [ ] [ ] temp = new char [ length ] [ ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { temp [ i ] = taskPriorities [ initialIndexes [ i ] ] ; } this . taskPriorities = temp ; } else { Util . reverseQuickSort ( taskTags , <NUM_LIT:0> , taskTags . length - <NUM_LIT:1> ) ; } this . taskTags = taskTags ; this . isTaskCaseSensitive = isTaskCaseSensitive ; } } public PublicScanner ( boolean tokenizeComments , boolean tokenizeWhiteSpace , boolean checkNonExternalizedStringLiterals , long sourceLevel , char [ ] [ ] taskTags , char [ ] [ ] taskPriorities , boolean isTaskCaseSensitive ) { this ( tokenizeComments , tokenizeWhiteSpace , checkNonExternalizedStringLiterals , sourceLevel , sourceLevel , taskTags , taskPriorities , isTaskCaseSensitive ) ; } public final boolean atEnd ( ) { return this . eofPosition <= this . currentPosition ; } public void checkTaskTag ( int commentStart , int commentEnd ) throws InvalidInputException { char [ ] src = this . source ; if ( this . foundTaskCount > <NUM_LIT:0> && this . foundTaskPositions [ this . foundTaskCount - <NUM_LIT:1> ] [ <NUM_LIT:0> ] >= commentStart ) { return ; } int foundTaskIndex = this . foundTaskCount ; char previous = src [ commentStart + <NUM_LIT:1> ] ; for ( int i = commentStart + <NUM_LIT:2> ; i < commentEnd && i < this . eofPosition ; i ++ ) { char [ ] tag = null ; char [ ] priority = null ; if ( previous != '<CHAR_LIT>' ) { nextTag : for ( int itag = <NUM_LIT:0> ; itag < this . taskTags . length ; itag ++ ) { tag = this . taskTags [ itag ] ; int tagLength = tag . length ; if ( tagLength == <NUM_LIT:0> ) continue nextTag ; if ( ScannerHelper . isJavaIdentifierStart ( tag [ <NUM_LIT:0> ] ) ) { if ( ScannerHelper . isJavaIdentifierPart ( previous ) ) { continue nextTag ; } } for ( int t = <NUM_LIT:0> ; t < tagLength ; t ++ ) { char sc , tc ; int x = i + t ; if ( x >= this . eofPosition || x >= commentEnd ) continue nextTag ; if ( ( sc = src [ i + t ] ) != ( tc = tag [ t ] ) ) { if ( this . isTaskCaseSensitive || ( ScannerHelper . toLowerCase ( sc ) != ScannerHelper . toLowerCase ( tc ) ) ) { continue nextTag ; } } } if ( i + tagLength < commentEnd && ScannerHelper . isJavaIdentifierPart ( src [ i + tagLength - <NUM_LIT:1> ] ) ) { if ( ScannerHelper . isJavaIdentifierPart ( src [ i + tagLength ] ) ) continue nextTag ; } if ( this . foundTaskTags == null ) { this . foundTaskTags = new char [ <NUM_LIT:5> ] [ ] ; this . foundTaskMessages = new char [ <NUM_LIT:5> ] [ ] ; this . foundTaskPriorities = new char [ <NUM_LIT:5> ] [ ] ; this . foundTaskPositions = new int [ <NUM_LIT:5> ] [ ] ; } else if ( this . foundTaskCount == this . foundTaskTags . length ) { System . arraycopy ( this . foundTaskTags , <NUM_LIT:0> , this . foundTaskTags = new char [ this . foundTaskCount * <NUM_LIT:2> ] [ ] , <NUM_LIT:0> , this . foundTaskCount ) ; System . arraycopy ( this . foundTaskMessages , <NUM_LIT:0> , this . foundTaskMessages = new char [ this . foundTaskCount * <NUM_LIT:2> ] [ ] , <NUM_LIT:0> , this . foundTaskCount ) ; System . arraycopy ( this . foundTaskPriorities , <NUM_LIT:0> , this . foundTaskPriorities = new char [ this . foundTaskCount * <NUM_LIT:2> ] [ ] , <NUM_LIT:0> , this . foundTaskCount ) ; System . arraycopy ( this . foundTaskPositions , <NUM_LIT:0> , this . foundTaskPositions = new int [ this . foundTaskCount * <NUM_LIT:2> ] [ ] , <NUM_LIT:0> , this . foundTaskCount ) ; } priority = this . taskPriorities != null && itag < this . taskPriorities . length ? this . taskPriorities [ itag ] : null ; this . foundTaskTags [ this . foundTaskCount ] = tag ; this . foundTaskPriorities [ this . foundTaskCount ] = priority ; this . foundTaskPositions [ this . foundTaskCount ] = new int [ ] { i , i + tagLength - <NUM_LIT:1> } ; this . foundTaskMessages [ this . foundTaskCount ] = CharOperation . NO_CHAR ; this . foundTaskCount ++ ; i += tagLength - <NUM_LIT:1> ; break nextTag ; } } previous = src [ i ] ; } boolean containsEmptyTask = false ; for ( int i = foundTaskIndex ; i < this . foundTaskCount ; i ++ ) { int msgStart = this . foundTaskPositions [ i ] [ <NUM_LIT:0> ] + this . foundTaskTags [ i ] . length ; int max_value = i + <NUM_LIT:1> < this . foundTaskCount ? this . foundTaskPositions [ i + <NUM_LIT:1> ] [ <NUM_LIT:0> ] - <NUM_LIT:1> : commentEnd - <NUM_LIT:1> ; if ( max_value < msgStart ) { max_value = msgStart ; } int end = - <NUM_LIT:1> ; char c ; for ( int j = msgStart ; j < max_value ; j ++ ) { if ( ( c = src [ j ] ) == '<STR_LIT:\n>' || c == '<STR_LIT>' ) { end = j - <NUM_LIT:1> ; break ; } } if ( end == - <NUM_LIT:1> ) { for ( int j = max_value ; j > msgStart ; j -- ) { if ( ( c = src [ j ] ) == '<CHAR_LIT>' ) { end = j - <NUM_LIT:1> ; break ; } } if ( end == - <NUM_LIT:1> ) end = max_value ; } if ( msgStart == end ) { containsEmptyTask = true ; continue ; } while ( CharOperation . isWhitespace ( src [ end ] ) && msgStart <= end ) end -- ; this . foundTaskPositions [ i ] [ <NUM_LIT:1> ] = end ; final int messageLength = end - msgStart + <NUM_LIT:1> ; char [ ] message = new char [ messageLength ] ; System . arraycopy ( src , msgStart , message , <NUM_LIT:0> , messageLength ) ; this . foundTaskMessages [ i ] = message ; } if ( containsEmptyTask ) { for ( int i = foundTaskIndex , max = this . foundTaskCount ; i < max ; i ++ ) { if ( this . foundTaskMessages [ i ] . length == <NUM_LIT:0> ) { loop : for ( int j = i + <NUM_LIT:1> ; j < max ; j ++ ) { if ( this . foundTaskMessages [ j ] . length != <NUM_LIT:0> ) { this . foundTaskMessages [ i ] = this . foundTaskMessages [ j ] ; this . foundTaskPositions [ i ] [ <NUM_LIT:1> ] = this . foundTaskPositions [ j ] [ <NUM_LIT:1> ] ; break loop ; } } } } } } public char [ ] getCurrentIdentifierSource ( ) { char [ ] result ; if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { System . arraycopy ( this . withoutUnicodeBuffer , <NUM_LIT:1> , result = new char [ this . withoutUnicodePtr ] , <NUM_LIT:0> , this . withoutUnicodePtr ) ; } else { int length = this . currentPosition - this . startPosition ; if ( length == this . eofPosition ) return this . source ; switch ( length ) { case <NUM_LIT:1> : return optimizedCurrentTokenSource1 ( ) ; case <NUM_LIT:2> : return optimizedCurrentTokenSource2 ( ) ; case <NUM_LIT:3> : return optimizedCurrentTokenSource3 ( ) ; case <NUM_LIT:4> : return optimizedCurrentTokenSource4 ( ) ; case <NUM_LIT:5> : return optimizedCurrentTokenSource5 ( ) ; case <NUM_LIT:6> : return optimizedCurrentTokenSource6 ( ) ; } System . arraycopy ( this . source , this . startPosition , result = new char [ length ] , <NUM_LIT:0> , length ) ; } return result ; } public int getCurrentTokenEndPosition ( ) { return this . currentPosition - <NUM_LIT:1> ; } public char [ ] getCurrentTokenSource ( ) { char [ ] result ; if ( this . withoutUnicodePtr != <NUM_LIT:0> ) System . arraycopy ( this . withoutUnicodeBuffer , <NUM_LIT:1> , result = new char [ this . withoutUnicodePtr ] , <NUM_LIT:0> , this . withoutUnicodePtr ) ; else { int length ; System . arraycopy ( this . source , this . startPosition , result = new char [ length = this . currentPosition - this . startPosition ] , <NUM_LIT:0> , length ) ; } return result ; } public final String getCurrentTokenString ( ) { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { return new String ( this . withoutUnicodeBuffer , <NUM_LIT:1> , this . withoutUnicodePtr ) ; } return new String ( this . source , this . startPosition , this . currentPosition - this . startPosition ) ; } public char [ ] getCurrentTokenSourceString ( ) { char [ ] result ; if ( this . withoutUnicodePtr != <NUM_LIT:0> ) System . arraycopy ( this . withoutUnicodeBuffer , <NUM_LIT:2> , result = new char [ this . withoutUnicodePtr - <NUM_LIT:2> ] , <NUM_LIT:0> , this . withoutUnicodePtr - <NUM_LIT:2> ) ; else { int length ; System . arraycopy ( this . source , this . startPosition + <NUM_LIT:1> , result = new char [ length = this . currentPosition - this . startPosition - <NUM_LIT:2> ] , <NUM_LIT:0> , length ) ; } return result ; } public final String getCurrentStringLiteral ( ) { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) return new String ( this . withoutUnicodeBuffer , <NUM_LIT:2> , this . withoutUnicodePtr - <NUM_LIT:2> ) ; else { return new String ( this . source , this . startPosition + <NUM_LIT:1> , this . currentPosition - this . startPosition - <NUM_LIT:2> ) ; } } public final char [ ] getRawTokenSource ( ) { int length = this . currentPosition - this . startPosition ; char [ ] tokenSource = new char [ length ] ; System . arraycopy ( this . source , this . startPosition , tokenSource , <NUM_LIT:0> , length ) ; return tokenSource ; } public final char [ ] getRawTokenSourceEnd ( ) { int length = this . eofPosition - this . currentPosition - <NUM_LIT:1> ; char [ ] sourceEnd = new char [ length ] ; System . arraycopy ( this . source , this . currentPosition , sourceEnd , <NUM_LIT:0> , length ) ; return sourceEnd ; } public int getCurrentTokenStartPosition ( ) { return this . startPosition ; } public final int getLineEnd ( int lineNumber ) { if ( this . lineEnds == null || this . linePtr == - <NUM_LIT:1> ) return - <NUM_LIT:1> ; if ( lineNumber > this . lineEnds . length + <NUM_LIT:1> ) return - <NUM_LIT:1> ; if ( lineNumber <= <NUM_LIT:0> ) return - <NUM_LIT:1> ; if ( lineNumber == this . lineEnds . length + <NUM_LIT:1> ) return this . eofPosition ; return this . lineEnds [ lineNumber - <NUM_LIT:1> ] ; } public final int [ ] getLineEnds ( ) { if ( this . linePtr == - <NUM_LIT:1> ) { return EMPTY_LINE_ENDS ; } int [ ] copy ; System . arraycopy ( this . lineEnds , <NUM_LIT:0> , copy = new int [ this . linePtr + <NUM_LIT:1> ] , <NUM_LIT:0> , this . linePtr + <NUM_LIT:1> ) ; return copy ; } public final int getLineStart ( int lineNumber ) { if ( this . lineEnds == null || this . linePtr == - <NUM_LIT:1> ) return - <NUM_LIT:1> ; if ( lineNumber > this . lineEnds . length + <NUM_LIT:1> ) return - <NUM_LIT:1> ; if ( lineNumber <= <NUM_LIT:0> ) return - <NUM_LIT:1> ; if ( lineNumber == <NUM_LIT:1> ) return this . initialPosition ; return this . lineEnds [ lineNumber - <NUM_LIT:2> ] + <NUM_LIT:1> ; } public final int getNextChar ( ) { try { if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; } else { this . unicodeAsBackSlash = false ; if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } return this . currentCharacter ; } catch ( IndexOutOfBoundsException e ) { return - <NUM_LIT:1> ; } catch ( InvalidInputException e ) { return - <NUM_LIT:1> ; } } public final int getNextCharWithBoundChecks ( ) { if ( this . currentPosition >= this . eofPosition ) { return - <NUM_LIT:1> ; } this . currentCharacter = this . source [ this . currentPosition ++ ] ; if ( this . currentPosition >= this . eofPosition ) { this . unicodeAsBackSlash = false ; if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } return this . currentCharacter ; } if ( this . currentCharacter == '<STR_LIT:\\>' && this . source [ this . currentPosition ] == '<CHAR_LIT>' ) { try { getNextUnicodeChar ( ) ; } catch ( InvalidInputException e ) { return - <NUM_LIT:1> ; } } else { this . unicodeAsBackSlash = false ; if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } return this . currentCharacter ; } public final boolean getNextChar ( char testedChar ) { if ( this . currentPosition >= this . eofPosition ) { this . unicodeAsBackSlash = false ; return false ; } int temp = this . currentPosition ; try { if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; if ( this . currentCharacter != testedChar ) { this . currentPosition = temp ; this . withoutUnicodePtr -- ; return false ; } return true ; } else { if ( this . currentCharacter != testedChar ) { this . currentPosition = temp ; return false ; } this . unicodeAsBackSlash = false ; if ( this . withoutUnicodePtr != <NUM_LIT:0> ) unicodeStore ( ) ; return true ; } } catch ( IndexOutOfBoundsException e ) { this . unicodeAsBackSlash = false ; this . currentPosition = temp ; return false ; } catch ( InvalidInputException e ) { this . unicodeAsBackSlash = false ; this . currentPosition = temp ; return false ; } } public final int getNextChar ( char testedChar1 , char testedChar2 ) { if ( this . currentPosition >= this . eofPosition ) return - <NUM_LIT:1> ; int temp = this . currentPosition ; try { int result ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; if ( this . currentCharacter == testedChar1 ) { result = <NUM_LIT:0> ; } else if ( this . currentCharacter == testedChar2 ) { result = <NUM_LIT:1> ; } else { this . currentPosition = temp ; this . withoutUnicodePtr -- ; result = - <NUM_LIT:1> ; } return result ; } else { if ( this . currentCharacter == testedChar1 ) { result = <NUM_LIT:0> ; } else if ( this . currentCharacter == testedChar2 ) { result = <NUM_LIT:1> ; } else { this . currentPosition = temp ; return - <NUM_LIT:1> ; } if ( this . withoutUnicodePtr != <NUM_LIT:0> ) unicodeStore ( ) ; return result ; } } catch ( IndexOutOfBoundsException e ) { this . currentPosition = temp ; return - <NUM_LIT:1> ; } catch ( InvalidInputException e ) { this . currentPosition = temp ; return - <NUM_LIT:1> ; } } public final boolean getNextCharAsDigit ( ) throws InvalidInputException { if ( this . currentPosition >= this . eofPosition ) return false ; int temp = this . currentPosition ; try { if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; if ( ! ScannerHelper . isDigit ( this . currentCharacter ) ) { this . currentPosition = temp ; this . withoutUnicodePtr -- ; return false ; } return true ; } else { if ( ! ScannerHelper . isDigit ( this . currentCharacter ) ) { this . currentPosition = temp ; return false ; } if ( this . withoutUnicodePtr != <NUM_LIT:0> ) unicodeStore ( ) ; return true ; } } catch ( IndexOutOfBoundsException e ) { this . currentPosition = temp ; return false ; } catch ( InvalidInputException e ) { this . currentPosition = temp ; return false ; } } public final boolean getNextCharAsDigit ( int radix ) { if ( this . currentPosition >= this . eofPosition ) return false ; int temp = this . currentPosition ; try { if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; if ( ScannerHelper . digit ( this . currentCharacter , radix ) == - <NUM_LIT:1> ) { this . currentPosition = temp ; this . withoutUnicodePtr -- ; return false ; } return true ; } else { if ( ScannerHelper . digit ( this . currentCharacter , radix ) == - <NUM_LIT:1> ) { this . currentPosition = temp ; return false ; } if ( this . withoutUnicodePtr != <NUM_LIT:0> ) unicodeStore ( ) ; return true ; } } catch ( IndexOutOfBoundsException e ) { this . currentPosition = temp ; return false ; } catch ( InvalidInputException e ) { this . currentPosition = temp ; return false ; } } public boolean getNextCharAsJavaIdentifierPartWithBoundCheck ( ) { int pos = this . currentPosition ; if ( pos >= this . eofPosition ) return false ; int temp2 = this . withoutUnicodePtr ; try { boolean unicode = false ; this . currentCharacter = this . source [ this . currentPosition ++ ] ; if ( this . currentPosition < this . eofPosition ) { if ( this . currentCharacter == '<STR_LIT:\\>' && this . source [ this . currentPosition ] == '<CHAR_LIT>' ) { getNextUnicodeChar ( ) ; unicode = true ; } } char c = this . currentCharacter ; boolean isJavaIdentifierPart = false ; if ( c >= HIGH_SURROGATE_MIN_VALUE && c <= HIGH_SURROGATE_MAX_VALUE ) { if ( this . complianceLevel < ClassFileConstants . JDK1_5 ) { this . currentPosition = pos ; this . withoutUnicodePtr = temp2 ; return false ; } char low = ( char ) getNextCharWithBoundChecks ( ) ; if ( low < LOW_SURROGATE_MIN_VALUE || low > LOW_SURROGATE_MAX_VALUE ) { this . currentPosition = pos ; this . withoutUnicodePtr = temp2 ; return false ; } isJavaIdentifierPart = ScannerHelper . isJavaIdentifierPart ( c , low ) ; } else if ( c >= LOW_SURROGATE_MIN_VALUE && c <= LOW_SURROGATE_MAX_VALUE ) { this . currentPosition = pos ; this . withoutUnicodePtr = temp2 ; return false ; } else { isJavaIdentifierPart = ScannerHelper . isJavaIdentifierPart ( c ) ; } if ( unicode ) { if ( ! isJavaIdentifierPart ) { this . currentPosition = pos ; this . withoutUnicodePtr = temp2 ; return false ; } return true ; } else { if ( ! isJavaIdentifierPart ) { this . currentPosition = pos ; return false ; } if ( this . withoutUnicodePtr != <NUM_LIT:0> ) unicodeStore ( ) ; return true ; } } catch ( InvalidInputException e ) { this . currentPosition = pos ; this . withoutUnicodePtr = temp2 ; return false ; } } public boolean getNextCharAsJavaIdentifierPart ( ) { int pos ; if ( ( pos = this . currentPosition ) >= this . eofPosition ) return false ; int temp2 = this . withoutUnicodePtr ; try { boolean unicode = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; unicode = true ; } char c = this . currentCharacter ; boolean isJavaIdentifierPart = false ; if ( c >= HIGH_SURROGATE_MIN_VALUE && c <= HIGH_SURROGATE_MAX_VALUE ) { if ( this . complianceLevel < ClassFileConstants . JDK1_5 ) { this . currentPosition = pos ; this . withoutUnicodePtr = temp2 ; return false ; } char low = ( char ) getNextChar ( ) ; if ( low < LOW_SURROGATE_MIN_VALUE || low > LOW_SURROGATE_MAX_VALUE ) { this . currentPosition = pos ; this . withoutUnicodePtr = temp2 ; return false ; } isJavaIdentifierPart = ScannerHelper . isJavaIdentifierPart ( c , low ) ; } else if ( c >= LOW_SURROGATE_MIN_VALUE && c <= LOW_SURROGATE_MAX_VALUE ) { this . currentPosition = pos ; this . withoutUnicodePtr = temp2 ; return false ; } else { isJavaIdentifierPart = ScannerHelper . isJavaIdentifierPart ( c ) ; } if ( unicode ) { if ( ! isJavaIdentifierPart ) { this . currentPosition = pos ; this . withoutUnicodePtr = temp2 ; return false ; } return true ; } else { if ( ! isJavaIdentifierPart ) { this . currentPosition = pos ; return false ; } if ( this . withoutUnicodePtr != <NUM_LIT:0> ) unicodeStore ( ) ; return true ; } } catch ( IndexOutOfBoundsException e ) { this . currentPosition = pos ; this . withoutUnicodePtr = temp2 ; return false ; } catch ( InvalidInputException e ) { this . currentPosition = pos ; this . withoutUnicodePtr = temp2 ; return false ; } } public int scanIdentifier ( ) throws InvalidInputException { int whiteStart = <NUM_LIT:0> ; while ( true ) { this . withoutUnicodePtr = <NUM_LIT:0> ; whiteStart = this . currentPosition ; boolean isWhiteSpace , hasWhiteSpaces = false ; int offset ; int unicodePtr ; boolean checkIfUnicode = false ; do { unicodePtr = this . withoutUnicodePtr ; offset = this . currentPosition ; this . startPosition = this . currentPosition ; if ( this . currentPosition < this . eofPosition ) { this . currentCharacter = this . source [ this . currentPosition ++ ] ; checkIfUnicode = this . currentPosition < this . eofPosition && this . currentCharacter == '<STR_LIT:\\>' && this . source [ this . currentPosition ] == '<CHAR_LIT>' ; } else if ( this . tokenizeWhiteSpace && ( whiteStart != this . currentPosition - <NUM_LIT:1> ) ) { this . currentPosition -- ; this . startPosition = whiteStart ; return TokenNameWHITESPACE ; } else { return TokenNameEOF ; } if ( checkIfUnicode ) { isWhiteSpace = jumpOverUnicodeWhiteSpace ( ) ; offset = this . currentPosition - offset ; } else { offset = this . currentPosition - offset ; switch ( this . currentCharacter ) { case <NUM_LIT:10> : case <NUM_LIT:12> : case <NUM_LIT> : case <NUM_LIT:32> : case <NUM_LIT:9> : isWhiteSpace = true ; break ; default : isWhiteSpace = false ; } } if ( isWhiteSpace ) { hasWhiteSpaces = true ; } } while ( isWhiteSpace ) ; if ( hasWhiteSpaces ) { if ( this . tokenizeWhiteSpace ) { this . currentPosition -= offset ; this . startPosition = whiteStart ; if ( checkIfUnicode ) { this . withoutUnicodePtr = unicodePtr ; } return TokenNameWHITESPACE ; } else if ( checkIfUnicode ) { this . withoutUnicodePtr = <NUM_LIT:0> ; unicodeStore ( ) ; } else { this . withoutUnicodePtr = <NUM_LIT:0> ; } } char c = this . currentCharacter ; if ( c < ScannerHelper . MAX_OBVIOUS ) { if ( ( ScannerHelper . OBVIOUS_IDENT_CHAR_NATURES [ c ] & ScannerHelper . C_IDENT_START ) != <NUM_LIT:0> ) { return scanIdentifierOrKeywordWithBoundCheck ( ) ; } return TokenNameERROR ; } boolean isJavaIdStart ; if ( c >= HIGH_SURROGATE_MIN_VALUE && c <= HIGH_SURROGATE_MAX_VALUE ) { if ( this . complianceLevel < ClassFileConstants . JDK1_5 ) { throw new InvalidInputException ( INVALID_UNICODE_ESCAPE ) ; } char low = ( char ) getNextCharWithBoundChecks ( ) ; if ( low < LOW_SURROGATE_MIN_VALUE || low > LOW_SURROGATE_MAX_VALUE ) { throw new InvalidInputException ( INVALID_LOW_SURROGATE ) ; } isJavaIdStart = ScannerHelper . isJavaIdentifierStart ( c , low ) ; } else if ( c >= LOW_SURROGATE_MIN_VALUE && c <= LOW_SURROGATE_MAX_VALUE ) { if ( this . complianceLevel < ClassFileConstants . JDK1_5 ) { throw new InvalidInputException ( INVALID_UNICODE_ESCAPE ) ; } throw new InvalidInputException ( INVALID_HIGH_SURROGATE ) ; } else { isJavaIdStart = Character . isJavaIdentifierStart ( c ) ; } if ( isJavaIdStart ) return scanIdentifierOrKeywordWithBoundCheck ( ) ; return TokenNameERROR ; } } public int getNextToken ( ) throws InvalidInputException { this . wasAcr = false ; if ( this . diet ) { jumpOverMethodBody ( ) ; this . diet = false ; return this . currentPosition > this . eofPosition ? TokenNameEOF : TokenNameRBRACE ; } int whiteStart = <NUM_LIT:0> ; try { while ( true ) { this . withoutUnicodePtr = <NUM_LIT:0> ; whiteStart = this . currentPosition ; boolean isWhiteSpace , hasWhiteSpaces = false ; int offset ; int unicodePtr ; boolean checkIfUnicode = false ; do { unicodePtr = this . withoutUnicodePtr ; offset = this . currentPosition ; this . startPosition = this . currentPosition ; try { checkIfUnicode = ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ; } catch ( IndexOutOfBoundsException e ) { if ( this . tokenizeWhiteSpace && ( whiteStart != this . currentPosition - <NUM_LIT:1> ) ) { this . currentPosition -- ; this . startPosition = whiteStart ; return TokenNameWHITESPACE ; } if ( this . currentPosition > this . eofPosition ) return TokenNameEOF ; } if ( this . currentPosition > this . eofPosition ) { if ( this . tokenizeWhiteSpace && ( whiteStart != this . currentPosition - <NUM_LIT:1> ) ) { this . currentPosition -- ; this . startPosition = whiteStart ; return TokenNameWHITESPACE ; } return TokenNameEOF ; } if ( checkIfUnicode ) { isWhiteSpace = jumpOverUnicodeWhiteSpace ( ) ; offset = this . currentPosition - offset ; } else { offset = this . currentPosition - offset ; if ( ( this . currentCharacter == '<STR_LIT>' ) || ( this . currentCharacter == '<STR_LIT:\n>' ) ) { if ( this . recordLineSeparator ) { pushLineSeparator ( ) ; } } switch ( this . currentCharacter ) { case <NUM_LIT:10> : case <NUM_LIT:12> : case <NUM_LIT> : case <NUM_LIT:32> : case <NUM_LIT:9> : isWhiteSpace = true ; break ; default : isWhiteSpace = false ; } } if ( isWhiteSpace ) { hasWhiteSpaces = true ; } } while ( isWhiteSpace ) ; if ( hasWhiteSpaces ) { if ( this . tokenizeWhiteSpace ) { this . currentPosition -= offset ; this . startPosition = whiteStart ; if ( checkIfUnicode ) { this . withoutUnicodePtr = unicodePtr ; } return TokenNameWHITESPACE ; } else if ( checkIfUnicode ) { this . withoutUnicodePtr = <NUM_LIT:0> ; unicodeStore ( ) ; } else { this . withoutUnicodePtr = <NUM_LIT:0> ; } } switch ( this . currentCharacter ) { case '<CHAR_LIT>' : return TokenNameAT ; case '<CHAR_LIT:(>' : return TokenNameLPAREN ; case '<CHAR_LIT:)>' : return TokenNameRPAREN ; case '<CHAR_LIT>' : return TokenNameLBRACE ; case '<CHAR_LIT:}>' : return TokenNameRBRACE ; case '<CHAR_LIT:[>' : return TokenNameLBRACKET ; case '<CHAR_LIT:]>' : return TokenNameRBRACKET ; case '<CHAR_LIT:;>' : return TokenNameSEMICOLON ; case '<CHAR_LIT:U+002C>' : return TokenNameCOMMA ; case '<CHAR_LIT:.>' : if ( getNextCharAsDigit ( ) ) { return scanNumber ( true ) ; } int temp = this . currentPosition ; if ( getNextChar ( '<CHAR_LIT:.>' ) ) { if ( getNextChar ( '<CHAR_LIT:.>' ) ) { return TokenNameELLIPSIS ; } else { this . currentPosition = temp ; return TokenNameDOT ; } } else { this . currentPosition = temp ; return TokenNameDOT ; } case '<CHAR_LIT>' : { int test ; if ( ( test = getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT:=>' ) ) == <NUM_LIT:0> ) return TokenNamePLUS_PLUS ; if ( test > <NUM_LIT:0> ) return TokenNamePLUS_EQUAL ; return TokenNamePLUS ; } case '<CHAR_LIT:->' : { int test ; if ( ( test = getNextChar ( '<CHAR_LIT:->' , '<CHAR_LIT:=>' ) ) == <NUM_LIT:0> ) return TokenNameMINUS_MINUS ; if ( test > <NUM_LIT:0> ) return TokenNameMINUS_EQUAL ; return TokenNameMINUS ; } case '<CHAR_LIT>' : return TokenNameTWIDDLE ; case '<CHAR_LIT>' : if ( getNextChar ( '<CHAR_LIT:=>' ) ) return TokenNameNOT_EQUAL ; return TokenNameNOT ; case '<CHAR_LIT>' : if ( getNextChar ( '<CHAR_LIT:=>' ) ) return TokenNameMULTIPLY_EQUAL ; return TokenNameMULTIPLY ; case '<CHAR_LIT>' : if ( getNextChar ( '<CHAR_LIT:=>' ) ) return TokenNameREMAINDER_EQUAL ; return TokenNameREMAINDER ; case '<CHAR_LIT>' : { int test ; if ( ( test = getNextChar ( '<CHAR_LIT:=>' , '<CHAR_LIT>' ) ) == <NUM_LIT:0> ) return TokenNameLESS_EQUAL ; if ( test > <NUM_LIT:0> ) { if ( getNextChar ( '<CHAR_LIT:=>' ) ) return TokenNameLEFT_SHIFT_EQUAL ; return TokenNameLEFT_SHIFT ; } return TokenNameLESS ; } case '<CHAR_LIT:>>' : { int test ; if ( this . returnOnlyGreater ) { return TokenNameGREATER ; } if ( ( test = getNextChar ( '<CHAR_LIT:=>' , '<CHAR_LIT:>>' ) ) == <NUM_LIT:0> ) return TokenNameGREATER_EQUAL ; if ( test > <NUM_LIT:0> ) { if ( ( test = getNextChar ( '<CHAR_LIT:=>' , '<CHAR_LIT:>>' ) ) == <NUM_LIT:0> ) return TokenNameRIGHT_SHIFT_EQUAL ; if ( test > <NUM_LIT:0> ) { if ( getNextChar ( '<CHAR_LIT:=>' ) ) return TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL ; return TokenNameUNSIGNED_RIGHT_SHIFT ; } return TokenNameRIGHT_SHIFT ; } return TokenNameGREATER ; } case '<CHAR_LIT:=>' : if ( getNextChar ( '<CHAR_LIT:=>' ) ) return TokenNameEQUAL_EQUAL ; return TokenNameEQUAL ; case '<CHAR_LIT>' : { int test ; if ( ( test = getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT:=>' ) ) == <NUM_LIT:0> ) return TokenNameAND_AND ; if ( test > <NUM_LIT:0> ) return TokenNameAND_EQUAL ; return TokenNameAND ; } case '<CHAR_LIT>' : { int test ; if ( ( test = getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT:=>' ) ) == <NUM_LIT:0> ) return TokenNameOR_OR ; if ( test > <NUM_LIT:0> ) return TokenNameOR_EQUAL ; return TokenNameOR ; } case '<CHAR_LIT>' : if ( getNextChar ( '<CHAR_LIT:=>' ) ) return TokenNameXOR_EQUAL ; return TokenNameXOR ; case '<CHAR_LIT>' : return TokenNameQUESTION ; case '<CHAR_LIT::>' : return TokenNameCOLON ; case '<STR_LIT>' : { int test ; if ( ( test = getNextChar ( '<STR_LIT:\n>' , '<STR_LIT>' ) ) == <NUM_LIT:0> ) { throw new InvalidInputException ( INVALID_CHARACTER_CONSTANT ) ; } if ( test > <NUM_LIT:0> ) { for ( int lookAhead = <NUM_LIT:0> ; lookAhead < <NUM_LIT:3> ; lookAhead ++ ) { if ( this . currentPosition + lookAhead == this . eofPosition ) break ; if ( this . source [ this . currentPosition + lookAhead ] == '<STR_LIT:\n>' ) break ; if ( this . source [ this . currentPosition + lookAhead ] == '<STR_LIT>' ) { this . currentPosition += lookAhead + <NUM_LIT:1> ; break ; } } throw new InvalidInputException ( INVALID_CHARACTER_CONSTANT ) ; } } if ( getNextChar ( '<STR_LIT>' ) ) { for ( int lookAhead = <NUM_LIT:0> ; lookAhead < <NUM_LIT:3> ; lookAhead ++ ) { if ( this . currentPosition + lookAhead == this . eofPosition ) break ; if ( this . source [ this . currentPosition + lookAhead ] == '<STR_LIT:\n>' ) break ; if ( this . source [ this . currentPosition + lookAhead ] == '<STR_LIT>' ) { this . currentPosition += lookAhead + <NUM_LIT:1> ; break ; } } throw new InvalidInputException ( INVALID_CHARACTER_CONSTANT ) ; } if ( getNextChar ( '<STR_LIT:\\>' ) ) { if ( this . unicodeAsBackSlash ) { this . unicodeAsBackSlash = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; } else { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } } else { this . currentCharacter = this . source [ this . currentPosition ++ ] ; } scanEscapeCharacter ( ) ; } else { this . unicodeAsBackSlash = false ; checkIfUnicode = false ; try { checkIfUnicode = ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ; } catch ( IndexOutOfBoundsException e ) { this . currentPosition -- ; throw new InvalidInputException ( INVALID_CHARACTER_CONSTANT ) ; } if ( checkIfUnicode ) { getNextUnicodeChar ( ) ; } else { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } } if ( getNextChar ( '<STR_LIT>' ) ) return TokenNameCharacterLiteral ; for ( int lookAhead = <NUM_LIT:0> ; lookAhead < <NUM_LIT:20> ; lookAhead ++ ) { if ( this . currentPosition + lookAhead == this . eofPosition ) break ; if ( this . source [ this . currentPosition + lookAhead ] == '<STR_LIT:\n>' ) break ; if ( this . source [ this . currentPosition + lookAhead ] == '<STR_LIT>' ) { this . currentPosition += lookAhead + <NUM_LIT:1> ; break ; } } throw new InvalidInputException ( INVALID_CHARACTER_CONSTANT ) ; case '<CHAR_LIT:">' : try { this . unicodeAsBackSlash = false ; boolean isUnicode = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; isUnicode = true ; } else { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } while ( this . currentCharacter != '<CHAR_LIT:">' ) { if ( this . currentPosition >= this . eofPosition ) { throw new InvalidInputException ( UNTERMINATED_STRING ) ; } if ( ( this . currentCharacter == '<STR_LIT:\n>' ) || ( this . currentCharacter == '<STR_LIT>' ) ) { if ( isUnicode ) { int start = this . currentPosition ; for ( int lookAhead = <NUM_LIT:0> ; lookAhead < <NUM_LIT> ; lookAhead ++ ) { if ( this . currentPosition >= this . eofPosition ) { this . currentPosition = start ; break ; } if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { isUnicode = true ; getNextUnicodeChar ( ) ; } else { isUnicode = false ; } if ( ! isUnicode && this . currentCharacter == '<STR_LIT:\n>' ) { this . currentPosition -- ; break ; } if ( this . currentCharacter == '<STR_LIT:\">' ) { throw new InvalidInputException ( INVALID_CHAR_IN_STRING ) ; } } } else { this . currentPosition -- ; } throw new InvalidInputException ( INVALID_CHAR_IN_STRING ) ; } if ( this . currentCharacter == '<STR_LIT:\\>' ) { if ( this . unicodeAsBackSlash ) { this . withoutUnicodePtr -- ; this . unicodeAsBackSlash = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; isUnicode = true ; this . withoutUnicodePtr -- ; } else { isUnicode = false ; } } else { if ( this . withoutUnicodePtr == <NUM_LIT:0> ) { unicodeInitializeBuffer ( this . currentPosition - this . startPosition ) ; } this . withoutUnicodePtr -- ; this . currentCharacter = this . source [ this . currentPosition ++ ] ; } scanEscapeCharacter ( ) ; if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } this . unicodeAsBackSlash = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; isUnicode = true ; } else { isUnicode = false ; if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } } } catch ( IndexOutOfBoundsException e ) { this . currentPosition -- ; throw new InvalidInputException ( UNTERMINATED_STRING ) ; } catch ( InvalidInputException e ) { if ( e . getMessage ( ) . equals ( INVALID_ESCAPE ) ) { for ( int lookAhead = <NUM_LIT:0> ; lookAhead < <NUM_LIT> ; lookAhead ++ ) { if ( this . currentPosition + lookAhead == this . eofPosition ) break ; if ( this . source [ this . currentPosition + lookAhead ] == '<STR_LIT:\n>' ) break ; if ( this . source [ this . currentPosition + lookAhead ] == '<STR_LIT:\">' ) { this . currentPosition += lookAhead + <NUM_LIT:1> ; break ; } } } throw e ; } return TokenNameStringLiteral ; case '<CHAR_LIT:/>' : if ( ! this . skipComments ) { int test = getNextChar ( '<CHAR_LIT:/>' , '<CHAR_LIT>' ) ; if ( test == <NUM_LIT:0> ) { this . lastCommentLinePosition = this . currentPosition ; try { if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; } if ( this . currentCharacter == '<STR_LIT:\\>' ) { if ( this . source [ this . currentPosition ] == '<STR_LIT:\\>' ) this . currentPosition ++ ; } boolean isUnicode = false ; while ( this . currentCharacter != '<STR_LIT>' && this . currentCharacter != '<STR_LIT:\n>' ) { if ( this . currentPosition >= this . eofPosition ) { this . lastCommentLinePosition = this . currentPosition ; this . currentPosition ++ ; throw new IndexOutOfBoundsException ( ) ; } this . lastCommentLinePosition = this . currentPosition ; isUnicode = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; isUnicode = true ; } if ( this . currentCharacter == '<STR_LIT:\\>' ) { if ( this . source [ this . currentPosition ] == '<STR_LIT:\\>' ) this . currentPosition ++ ; } } if ( this . currentCharacter == '<STR_LIT>' && this . eofPosition > this . currentPosition ) { if ( this . source [ this . currentPosition ] == '<STR_LIT:\n>' ) { this . currentPosition ++ ; this . currentCharacter = '<STR_LIT:\n>' ; } else if ( ( this . source [ this . currentPosition ] == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition + <NUM_LIT:1> ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; isUnicode = true ; } } recordComment ( TokenNameCOMMENT_LINE ) ; if ( this . taskTags != null ) checkTaskTag ( this . startPosition , this . currentPosition ) ; if ( ( this . currentCharacter == '<STR_LIT>' ) || ( this . currentCharacter == '<STR_LIT:\n>' ) ) { if ( this . checkNonExternalizedStringLiterals && this . lastPosition < this . currentPosition ) { parseTags ( ) ; } if ( this . recordLineSeparator ) { if ( isUnicode ) { pushUnicodeLineSeparator ( ) ; } else { pushLineSeparator ( ) ; } } } if ( this . tokenizeComments ) { return TokenNameCOMMENT_LINE ; } } catch ( IndexOutOfBoundsException e ) { this . currentPosition -- ; recordComment ( TokenNameCOMMENT_LINE ) ; if ( this . taskTags != null ) checkTaskTag ( this . startPosition , this . currentPosition ) ; if ( this . checkNonExternalizedStringLiterals && this . lastPosition < this . currentPosition ) { parseTags ( ) ; } if ( this . tokenizeComments ) { return TokenNameCOMMENT_LINE ; } else { this . currentPosition ++ ; } } break ; } if ( test > <NUM_LIT:0> ) { try { boolean isJavadoc = false , star = false ; boolean isUnicode = false ; int previous ; this . unicodeAsBackSlash = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; isUnicode = true ; } else { isUnicode = false ; if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } if ( this . currentCharacter == '<CHAR_LIT>' ) { isJavadoc = true ; star = true ; } if ( ( this . currentCharacter == '<STR_LIT>' ) || ( this . currentCharacter == '<STR_LIT:\n>' ) ) { if ( this . recordLineSeparator ) { if ( isUnicode ) { pushUnicodeLineSeparator ( ) ; } else { pushLineSeparator ( ) ; } } } isUnicode = false ; previous = this . currentPosition ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; isUnicode = true ; } else { isUnicode = false ; } if ( this . currentCharacter == '<STR_LIT:\\>' ) { if ( this . source [ this . currentPosition ] == '<STR_LIT:\\>' ) this . currentPosition ++ ; } if ( this . currentCharacter == '<CHAR_LIT:/>' ) { isJavadoc = false ; } int firstTag = <NUM_LIT:0> ; while ( ( this . currentCharacter != '<CHAR_LIT:/>' ) || ( ! star ) ) { if ( this . currentPosition >= this . eofPosition ) { throw new InvalidInputException ( UNTERMINATED_COMMENT ) ; } if ( ( this . currentCharacter == '<STR_LIT>' ) || ( this . currentCharacter == '<STR_LIT:\n>' ) ) { if ( this . recordLineSeparator ) { if ( isUnicode ) { pushUnicodeLineSeparator ( ) ; } else { pushLineSeparator ( ) ; } } } switch ( this . currentCharacter ) { case '<CHAR_LIT>' : star = true ; break ; case '<CHAR_LIT>' : if ( firstTag == <NUM_LIT:0> && this . isFirstTag ( ) ) { firstTag = previous ; } default : star = false ; } previous = this . currentPosition ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; isUnicode = true ; } else { isUnicode = false ; } if ( this . currentCharacter == '<STR_LIT:\\>' ) { if ( this . source [ this . currentPosition ] == '<STR_LIT:\\>' ) this . currentPosition ++ ; } } int token = isJavadoc ? TokenNameCOMMENT_JAVADOC : TokenNameCOMMENT_BLOCK ; recordComment ( token ) ; this . commentTagStarts [ this . commentPtr ] = firstTag ; if ( this . taskTags != null ) checkTaskTag ( this . startPosition , this . currentPosition ) ; if ( this . tokenizeComments ) { return token ; } } catch ( IndexOutOfBoundsException e ) { this . currentPosition -- ; throw new InvalidInputException ( UNTERMINATED_COMMENT ) ; } break ; } } if ( getNextChar ( '<CHAR_LIT:=>' ) ) return TokenNameDIVIDE_EQUAL ; return TokenNameDIVIDE ; case '<CHAR_LIT>' : if ( atEnd ( ) ) return TokenNameEOF ; throw new InvalidInputException ( "<STR_LIT>" ) ; default : char c = this . currentCharacter ; if ( c < ScannerHelper . MAX_OBVIOUS ) { if ( ( ScannerHelper . OBVIOUS_IDENT_CHAR_NATURES [ c ] & ScannerHelper . C_IDENT_START ) != <NUM_LIT:0> ) { return scanIdentifierOrKeyword ( ) ; } else if ( ( ScannerHelper . OBVIOUS_IDENT_CHAR_NATURES [ c ] & ScannerHelper . C_DIGIT ) != <NUM_LIT:0> ) { return scanNumber ( false ) ; } else { return TokenNameERROR ; } } boolean isJavaIdStart ; if ( c >= HIGH_SURROGATE_MIN_VALUE && c <= HIGH_SURROGATE_MAX_VALUE ) { if ( this . complianceLevel < ClassFileConstants . JDK1_5 ) { throw new InvalidInputException ( INVALID_UNICODE_ESCAPE ) ; } char low = ( char ) getNextChar ( ) ; if ( low < LOW_SURROGATE_MIN_VALUE || low > LOW_SURROGATE_MAX_VALUE ) { throw new InvalidInputException ( INVALID_LOW_SURROGATE ) ; } isJavaIdStart = ScannerHelper . isJavaIdentifierStart ( c , low ) ; } else if ( c >= LOW_SURROGATE_MIN_VALUE && c <= LOW_SURROGATE_MAX_VALUE ) { if ( this . complianceLevel < ClassFileConstants . JDK1_5 ) { throw new InvalidInputException ( INVALID_UNICODE_ESCAPE ) ; } throw new InvalidInputException ( INVALID_HIGH_SURROGATE ) ; } else { isJavaIdStart = Character . isJavaIdentifierStart ( c ) ; } if ( isJavaIdStart ) return scanIdentifierOrKeyword ( ) ; if ( ScannerHelper . isDigit ( this . currentCharacter ) ) { return scanNumber ( false ) ; } return TokenNameERROR ; } } } catch ( IndexOutOfBoundsException e ) { if ( this . tokenizeWhiteSpace && ( whiteStart != this . currentPosition - <NUM_LIT:1> ) ) { this . currentPosition -- ; this . startPosition = whiteStart ; return TokenNameWHITESPACE ; } } return TokenNameEOF ; } public void getNextUnicodeChar ( ) throws InvalidInputException { int c1 = <NUM_LIT:0> , c2 = <NUM_LIT:0> , c3 = <NUM_LIT:0> , c4 = <NUM_LIT:0> , unicodeSize = <NUM_LIT:6> ; this . currentPosition ++ ; if ( this . currentPosition < this . eofPosition ) { while ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) { this . currentPosition ++ ; if ( this . currentPosition >= this . eofPosition ) { this . currentPosition -- ; throw new InvalidInputException ( INVALID_UNICODE_ESCAPE ) ; } unicodeSize ++ ; } } else { this . currentPosition -- ; throw new InvalidInputException ( INVALID_UNICODE_ESCAPE ) ; } if ( ( this . currentPosition + <NUM_LIT:4> ) > this . eofPosition ) { this . currentPosition += ( this . eofPosition - this . currentPosition ) ; throw new InvalidInputException ( INVALID_UNICODE_ESCAPE ) ; } if ( ( c1 = ScannerHelper . getNumericValue ( this . source [ this . currentPosition ++ ] ) ) > <NUM_LIT:15> || c1 < <NUM_LIT:0> || ( c2 = ScannerHelper . getNumericValue ( this . source [ this . currentPosition ++ ] ) ) > <NUM_LIT:15> || c2 < <NUM_LIT:0> || ( c3 = ScannerHelper . getNumericValue ( this . source [ this . currentPosition ++ ] ) ) > <NUM_LIT:15> || c3 < <NUM_LIT:0> || ( c4 = ScannerHelper . getNumericValue ( this . source [ this . currentPosition ++ ] ) ) > <NUM_LIT:15> || c4 < <NUM_LIT:0> ) { throw new InvalidInputException ( INVALID_UNICODE_ESCAPE ) ; } this . currentCharacter = ( char ) ( ( ( c1 * <NUM_LIT:16> + c2 ) * <NUM_LIT:16> + c3 ) * <NUM_LIT:16> + c4 ) ; if ( this . withoutUnicodePtr == <NUM_LIT:0> ) { unicodeInitializeBuffer ( this . currentPosition - unicodeSize - this . startPosition ) ; } unicodeStore ( ) ; this . unicodeAsBackSlash = this . currentCharacter == '<STR_LIT:\\>' ; } public NLSTag [ ] getNLSTags ( ) { final int length = this . nlsTagsPtr ; if ( length != <NUM_LIT:0> ) { NLSTag [ ] result = new NLSTag [ length ] ; System . arraycopy ( this . nlsTags , <NUM_LIT:0> , result , <NUM_LIT:0> , length ) ; this . nlsTagsPtr = <NUM_LIT:0> ; return result ; } return null ; } public char [ ] getSource ( ) { return this . source ; } protected boolean isFirstTag ( ) { return true ; } public final void jumpOverMethodBody ( ) { this . wasAcr = false ; int found = <NUM_LIT:1> ; try { while ( true ) { this . withoutUnicodePtr = <NUM_LIT:0> ; boolean isWhiteSpace ; do { this . startPosition = this . currentPosition ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { isWhiteSpace = jumpOverUnicodeWhiteSpace ( ) ; } else { if ( this . recordLineSeparator && ( ( this . currentCharacter == '<STR_LIT>' ) || ( this . currentCharacter == '<STR_LIT:\n>' ) ) ) { pushLineSeparator ( ) ; } isWhiteSpace = CharOperation . isWhitespace ( this . currentCharacter ) ; } } while ( isWhiteSpace ) ; NextToken : switch ( this . currentCharacter ) { case '<CHAR_LIT>' : found ++ ; break NextToken ; case '<CHAR_LIT:}>' : found -- ; if ( found == <NUM_LIT:0> ) return ; break NextToken ; case '<STR_LIT>' : { boolean test ; test = getNextChar ( '<STR_LIT:\\>' ) ; if ( test ) { try { if ( this . unicodeAsBackSlash ) { this . unicodeAsBackSlash = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; } else { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } } else { this . currentCharacter = this . source [ this . currentPosition ++ ] ; } scanEscapeCharacter ( ) ; } catch ( InvalidInputException ex ) { } } else { try { this . unicodeAsBackSlash = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; } else { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } } catch ( InvalidInputException ex ) { } } getNextChar ( '<STR_LIT>' ) ; break NextToken ; } case '<CHAR_LIT:">' : try { try { this . unicodeAsBackSlash = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; } else { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } } catch ( InvalidInputException ex ) { } while ( this . currentCharacter != '<CHAR_LIT:">' ) { if ( this . currentPosition >= this . eofPosition ) { return ; } if ( this . currentCharacter == '<STR_LIT>' ) { if ( this . source [ this . currentPosition ] == '<STR_LIT:\n>' ) this . currentPosition ++ ; break NextToken ; } if ( this . currentCharacter == '<STR_LIT:\n>' ) { break ; } if ( this . currentCharacter == '<STR_LIT:\\>' ) { try { if ( this . unicodeAsBackSlash ) { this . unicodeAsBackSlash = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; } else { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } } else { this . currentCharacter = this . source [ this . currentPosition ++ ] ; } scanEscapeCharacter ( ) ; } catch ( InvalidInputException ex ) { } } try { this . unicodeAsBackSlash = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; } else { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } } catch ( InvalidInputException ex ) { } } } catch ( IndexOutOfBoundsException e ) { return ; } break NextToken ; case '<CHAR_LIT:/>' : { int test ; if ( ( test = getNextChar ( '<CHAR_LIT:/>' , '<CHAR_LIT>' ) ) == <NUM_LIT:0> ) { try { this . lastCommentLinePosition = this . currentPosition ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; } if ( this . currentCharacter == '<STR_LIT:\\>' ) { if ( this . source [ this . currentPosition ] == '<STR_LIT:\\>' ) this . currentPosition ++ ; } boolean isUnicode = false ; while ( this . currentCharacter != '<STR_LIT>' && this . currentCharacter != '<STR_LIT:\n>' ) { if ( this . currentPosition >= this . eofPosition ) { this . lastCommentLinePosition = this . currentPosition ; this . currentPosition ++ ; throw new IndexOutOfBoundsException ( ) ; } this . lastCommentLinePosition = this . currentPosition ; isUnicode = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { isUnicode = true ; getNextUnicodeChar ( ) ; } if ( this . currentCharacter == '<STR_LIT:\\>' ) { if ( this . source [ this . currentPosition ] == '<STR_LIT:\\>' ) this . currentPosition ++ ; } } if ( this . currentCharacter == '<STR_LIT>' && this . eofPosition > this . currentPosition ) { if ( this . source [ this . currentPosition ] == '<STR_LIT:\n>' ) { this . currentPosition ++ ; this . currentCharacter = '<STR_LIT:\n>' ; } else if ( ( this . source [ this . currentPosition ] == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition + <NUM_LIT:1> ] == '<CHAR_LIT>' ) ) { isUnicode = true ; getNextUnicodeChar ( ) ; } } recordComment ( TokenNameCOMMENT_LINE ) ; if ( this . recordLineSeparator && ( ( this . currentCharacter == '<STR_LIT>' ) || ( this . currentCharacter == '<STR_LIT:\n>' ) ) ) { if ( this . checkNonExternalizedStringLiterals && this . lastPosition < this . currentPosition ) { parseTags ( ) ; } if ( this . recordLineSeparator ) { if ( isUnicode ) { pushUnicodeLineSeparator ( ) ; } else { pushLineSeparator ( ) ; } } } } catch ( IndexOutOfBoundsException e ) { this . currentPosition -- ; recordComment ( TokenNameCOMMENT_LINE ) ; if ( this . checkNonExternalizedStringLiterals && this . lastPosition < this . currentPosition ) { parseTags ( ) ; } if ( ! this . tokenizeComments ) { this . currentPosition ++ ; } } break NextToken ; } if ( test > <NUM_LIT:0> ) { boolean isJavadoc = false ; try { boolean star = false ; int previous ; boolean isUnicode = false ; this . unicodeAsBackSlash = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; isUnicode = true ; } else { isUnicode = false ; if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } if ( this . currentCharacter == '<CHAR_LIT>' ) { isJavadoc = true ; star = true ; } if ( ( this . currentCharacter == '<STR_LIT>' ) || ( this . currentCharacter == '<STR_LIT:\n>' ) ) { if ( this . recordLineSeparator ) { if ( isUnicode ) { pushUnicodeLineSeparator ( ) ; } else { pushLineSeparator ( ) ; } } } isUnicode = false ; previous = this . currentPosition ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; isUnicode = true ; } else { isUnicode = false ; } if ( this . currentCharacter == '<STR_LIT:\\>' ) { if ( this . source [ this . currentPosition ] == '<STR_LIT:\\>' ) this . currentPosition ++ ; } if ( this . currentCharacter == '<CHAR_LIT:/>' ) { isJavadoc = false ; } int firstTag = <NUM_LIT:0> ; while ( ( this . currentCharacter != '<CHAR_LIT:/>' ) || ( ! star ) ) { if ( this . currentPosition >= this . eofPosition ) { return ; } if ( ( this . currentCharacter == '<STR_LIT>' ) || ( this . currentCharacter == '<STR_LIT:\n>' ) ) { if ( this . recordLineSeparator ) { if ( isUnicode ) { pushUnicodeLineSeparator ( ) ; } else { pushLineSeparator ( ) ; } } } switch ( this . currentCharacter ) { case '<CHAR_LIT>' : star = true ; break ; case '<CHAR_LIT>' : if ( firstTag == <NUM_LIT:0> && this . isFirstTag ( ) ) { firstTag = previous ; } default : star = false ; } previous = this . currentPosition ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; isUnicode = true ; } else { isUnicode = false ; } if ( this . currentCharacter == '<STR_LIT:\\>' ) { if ( this . source [ this . currentPosition ] == '<STR_LIT:\\>' ) this . currentPosition ++ ; } } recordComment ( isJavadoc ? TokenNameCOMMENT_JAVADOC : TokenNameCOMMENT_BLOCK ) ; this . commentTagStarts [ this . commentPtr ] = firstTag ; } catch ( IndexOutOfBoundsException e ) { return ; } break NextToken ; } break NextToken ; } default : try { char c = this . currentCharacter ; if ( c < ScannerHelper . MAX_OBVIOUS ) { if ( ( ScannerHelper . OBVIOUS_IDENT_CHAR_NATURES [ c ] & ScannerHelper . C_IDENT_START ) != <NUM_LIT:0> ) { scanIdentifierOrKeyword ( ) ; break NextToken ; } else if ( ( ScannerHelper . OBVIOUS_IDENT_CHAR_NATURES [ c ] & ScannerHelper . C_DIGIT ) != <NUM_LIT:0> ) { scanNumber ( false ) ; break NextToken ; } else { break NextToken ; } } boolean isJavaIdStart ; if ( c >= HIGH_SURROGATE_MIN_VALUE && c <= HIGH_SURROGATE_MAX_VALUE ) { if ( this . complianceLevel < ClassFileConstants . JDK1_5 ) { throw new InvalidInputException ( INVALID_UNICODE_ESCAPE ) ; } char low = ( char ) getNextChar ( ) ; if ( low < LOW_SURROGATE_MIN_VALUE || low > LOW_SURROGATE_MAX_VALUE ) { break NextToken ; } isJavaIdStart = ScannerHelper . isJavaIdentifierStart ( c , low ) ; } else if ( c >= LOW_SURROGATE_MIN_VALUE && c <= LOW_SURROGATE_MAX_VALUE ) { break NextToken ; } else { isJavaIdStart = Character . isJavaIdentifierStart ( c ) ; } if ( isJavaIdStart ) { scanIdentifierOrKeyword ( ) ; break NextToken ; } } catch ( InvalidInputException ex ) { } } } } catch ( IndexOutOfBoundsException e ) { } catch ( InvalidInputException e ) { } return ; } public final boolean jumpOverUnicodeWhiteSpace ( ) throws InvalidInputException { this . wasAcr = false ; getNextUnicodeChar ( ) ; return CharOperation . isWhitespace ( this . currentCharacter ) ; } final char [ ] optimizedCurrentTokenSource1 ( ) { char charOne = this . source [ this . startPosition ] ; switch ( charOne ) { case '<CHAR_LIT:a>' : return charArray_a ; case '<CHAR_LIT:b>' : return charArray_b ; case '<CHAR_LIT:c>' : return charArray_c ; case '<CHAR_LIT>' : return charArray_d ; case '<CHAR_LIT:e>' : return charArray_e ; case '<CHAR_LIT>' : return charArray_f ; case '<CHAR_LIT>' : return charArray_g ; case '<CHAR_LIT>' : return charArray_h ; case '<CHAR_LIT>' : return charArray_i ; case '<CHAR_LIT>' : return charArray_j ; case '<CHAR_LIT>' : return charArray_k ; case '<CHAR_LIT>' : return charArray_l ; case '<CHAR_LIT>' : return charArray_m ; case '<CHAR_LIT>' : return charArray_n ; case '<CHAR_LIT>' : return charArray_o ; case '<CHAR_LIT>' : return charArray_p ; case '<CHAR_LIT>' : return charArray_q ; case '<CHAR_LIT>' : return charArray_r ; case '<CHAR_LIT>' : return charArray_s ; case '<CHAR_LIT>' : return charArray_t ; case '<CHAR_LIT>' : return charArray_u ; case '<CHAR_LIT>' : return charArray_v ; case '<CHAR_LIT>' : return charArray_w ; case '<CHAR_LIT>' : return charArray_x ; case '<CHAR_LIT>' : return charArray_y ; case '<CHAR_LIT>' : return charArray_z ; default : return new char [ ] { charOne } ; } } final char [ ] optimizedCurrentTokenSource2 ( ) { char [ ] src = this . source ; int start = this . startPosition ; char c0 , c1 ; int hash = ( ( ( c0 = src [ start ] ) << <NUM_LIT:6> ) + ( c1 = src [ start + <NUM_LIT:1> ] ) ) % TableSize ; char [ ] [ ] table = this . charArray_length [ <NUM_LIT:0> ] [ hash ] ; int i = this . newEntry2 ; while ( ++ i < InternalTableSize ) { char [ ] charArray = table [ i ] ; if ( ( c0 == charArray [ <NUM_LIT:0> ] ) && ( c1 == charArray [ <NUM_LIT:1> ] ) ) return charArray ; } i = - <NUM_LIT:1> ; int max = this . newEntry2 ; while ( ++ i <= max ) { char [ ] charArray = table [ i ] ; if ( ( c0 == charArray [ <NUM_LIT:0> ] ) && ( c1 == charArray [ <NUM_LIT:1> ] ) ) return charArray ; } if ( ++ max >= InternalTableSize ) max = <NUM_LIT:0> ; char [ ] r ; System . arraycopy ( src , start , r = new char [ <NUM_LIT:2> ] , <NUM_LIT:0> , <NUM_LIT:2> ) ; return table [ this . newEntry2 = max ] = r ; } final char [ ] optimizedCurrentTokenSource3 ( ) { char [ ] src = this . source ; int start = this . startPosition ; char c0 , c1 = src [ start + <NUM_LIT:1> ] , c2 ; int hash = ( ( ( c0 = src [ start ] ) << <NUM_LIT:6> ) + ( c2 = src [ start + <NUM_LIT:2> ] ) ) % TableSize ; char [ ] [ ] table = this . charArray_length [ <NUM_LIT:1> ] [ hash ] ; int i = this . newEntry3 ; while ( ++ i < InternalTableSize ) { char [ ] charArray = table [ i ] ; if ( ( c0 == charArray [ <NUM_LIT:0> ] ) && ( c1 == charArray [ <NUM_LIT:1> ] ) && ( c2 == charArray [ <NUM_LIT:2> ] ) ) return charArray ; } i = - <NUM_LIT:1> ; int max = this . newEntry3 ; while ( ++ i <= max ) { char [ ] charArray = table [ i ] ; if ( ( c0 == charArray [ <NUM_LIT:0> ] ) && ( c1 == charArray [ <NUM_LIT:1> ] ) && ( c2 == charArray [ <NUM_LIT:2> ] ) ) return charArray ; } if ( ++ max >= InternalTableSize ) max = <NUM_LIT:0> ; char [ ] r ; System . arraycopy ( src , start , r = new char [ <NUM_LIT:3> ] , <NUM_LIT:0> , <NUM_LIT:3> ) ; return table [ this . newEntry3 = max ] = r ; } final char [ ] optimizedCurrentTokenSource4 ( ) { char [ ] src = this . source ; int start = this . startPosition ; char c0 , c1 = src [ start + <NUM_LIT:1> ] , c2 , c3 = src [ start + <NUM_LIT:3> ] ; int hash = ( ( ( c0 = src [ start ] ) << <NUM_LIT:6> ) + ( c2 = src [ start + <NUM_LIT:2> ] ) ) % TableSize ; char [ ] [ ] table = this . charArray_length [ <NUM_LIT:2> ] [ hash ] ; int i = this . newEntry4 ; while ( ++ i < InternalTableSize ) { char [ ] charArray = table [ i ] ; if ( ( c0 == charArray [ <NUM_LIT:0> ] ) && ( c1 == charArray [ <NUM_LIT:1> ] ) && ( c2 == charArray [ <NUM_LIT:2> ] ) && ( c3 == charArray [ <NUM_LIT:3> ] ) ) return charArray ; } i = - <NUM_LIT:1> ; int max = this . newEntry4 ; while ( ++ i <= max ) { char [ ] charArray = table [ i ] ; if ( ( c0 == charArray [ <NUM_LIT:0> ] ) && ( c1 == charArray [ <NUM_LIT:1> ] ) && ( c2 == charArray [ <NUM_LIT:2> ] ) && ( c3 == charArray [ <NUM_LIT:3> ] ) ) return charArray ; } if ( ++ max >= InternalTableSize ) max = <NUM_LIT:0> ; char [ ] r ; System . arraycopy ( src , start , r = new char [ <NUM_LIT:4> ] , <NUM_LIT:0> , <NUM_LIT:4> ) ; return table [ this . newEntry4 = max ] = r ; } final char [ ] optimizedCurrentTokenSource5 ( ) { char [ ] src = this . source ; int start = this . startPosition ; char c0 , c1 = src [ start + <NUM_LIT:1> ] , c2 , c3 = src [ start + <NUM_LIT:3> ] , c4 ; int hash = ( ( ( c0 = src [ start ] ) << <NUM_LIT:12> ) + ( ( c2 = src [ start + <NUM_LIT:2> ] ) << <NUM_LIT:6> ) + ( c4 = src [ start + <NUM_LIT:4> ] ) ) % TableSize ; char [ ] [ ] table = this . charArray_length [ <NUM_LIT:3> ] [ hash ] ; int i = this . newEntry5 ; while ( ++ i < InternalTableSize ) { char [ ] charArray = table [ i ] ; if ( ( c0 == charArray [ <NUM_LIT:0> ] ) && ( c1 == charArray [ <NUM_LIT:1> ] ) && ( c2 == charArray [ <NUM_LIT:2> ] ) && ( c3 == charArray [ <NUM_LIT:3> ] ) && ( c4 == charArray [ <NUM_LIT:4> ] ) ) return charArray ; } i = - <NUM_LIT:1> ; int max = this . newEntry5 ; while ( ++ i <= max ) { char [ ] charArray = table [ i ] ; if ( ( c0 == charArray [ <NUM_LIT:0> ] ) && ( c1 == charArray [ <NUM_LIT:1> ] ) && ( c2 == charArray [ <NUM_LIT:2> ] ) && ( c3 == charArray [ <NUM_LIT:3> ] ) && ( c4 == charArray [ <NUM_LIT:4> ] ) ) return charArray ; } if ( ++ max >= InternalTableSize ) max = <NUM_LIT:0> ; char [ ] r ; System . arraycopy ( src , start , r = new char [ <NUM_LIT:5> ] , <NUM_LIT:0> , <NUM_LIT:5> ) ; return table [ this . newEntry5 = max ] = r ; } final char [ ] optimizedCurrentTokenSource6 ( ) { char [ ] src = this . source ; int start = this . startPosition ; char c0 , c1 = src [ start + <NUM_LIT:1> ] , c2 , c3 = src [ start + <NUM_LIT:3> ] , c4 , c5 = src [ start + <NUM_LIT:5> ] ; int hash = ( ( ( c0 = src [ start ] ) << <NUM_LIT:12> ) + ( ( c2 = src [ start + <NUM_LIT:2> ] ) << <NUM_LIT:6> ) + ( c4 = src [ start + <NUM_LIT:4> ] ) ) % TableSize ; char [ ] [ ] table = this . charArray_length [ <NUM_LIT:4> ] [ hash ] ; int i = this . newEntry6 ; while ( ++ i < InternalTableSize ) { char [ ] charArray = table [ i ] ; if ( ( c0 == charArray [ <NUM_LIT:0> ] ) && ( c1 == charArray [ <NUM_LIT:1> ] ) && ( c2 == charArray [ <NUM_LIT:2> ] ) && ( c3 == charArray [ <NUM_LIT:3> ] ) && ( c4 == charArray [ <NUM_LIT:4> ] ) && ( c5 == charArray [ <NUM_LIT:5> ] ) ) return charArray ; } i = - <NUM_LIT:1> ; int max = this . newEntry6 ; while ( ++ i <= max ) { char [ ] charArray = table [ i ] ; if ( ( c0 == charArray [ <NUM_LIT:0> ] ) && ( c1 == charArray [ <NUM_LIT:1> ] ) && ( c2 == charArray [ <NUM_LIT:2> ] ) && ( c3 == charArray [ <NUM_LIT:3> ] ) && ( c4 == charArray [ <NUM_LIT:4> ] ) && ( c5 == charArray [ <NUM_LIT:5> ] ) ) return charArray ; } if ( ++ max >= InternalTableSize ) max = <NUM_LIT:0> ; char [ ] r ; System . arraycopy ( src , start , r = new char [ <NUM_LIT:6> ] , <NUM_LIT:0> , <NUM_LIT:6> ) ; return table [ this . newEntry6 = max ] = r ; } private void parseTags ( ) { int position = <NUM_LIT:0> ; final int currentStartPosition = this . startPosition ; final int currentLinePtr = this . linePtr ; if ( currentLinePtr >= <NUM_LIT:0> ) { position = this . lineEnds [ currentLinePtr ] + <NUM_LIT:1> ; } while ( ScannerHelper . isWhitespace ( this . source [ position ] ) ) { position ++ ; } if ( currentStartPosition == position ) { return ; } char [ ] s = null ; int sourceEnd = this . currentPosition ; int sourceStart = currentStartPosition ; int sourceDelta = <NUM_LIT:0> ; if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { System . arraycopy ( this . withoutUnicodeBuffer , <NUM_LIT:1> , s = new char [ this . withoutUnicodePtr ] , <NUM_LIT:0> , this . withoutUnicodePtr ) ; sourceEnd = this . withoutUnicodePtr ; sourceStart = <NUM_LIT:1> ; sourceDelta = currentStartPosition ; } else { s = this . source ; } int pos = CharOperation . indexOf ( TAG_PREFIX , s , true , sourceStart , sourceEnd ) ; if ( pos != - <NUM_LIT:1> ) { if ( this . nlsTags == null ) { this . nlsTags = new NLSTag [ <NUM_LIT:10> ] ; this . nlsTagsPtr = <NUM_LIT:0> ; } while ( pos != - <NUM_LIT:1> ) { int start = pos + TAG_PREFIX_LENGTH ; int end = CharOperation . indexOf ( TAG_POSTFIX , s , start , sourceEnd ) ; if ( end != - <NUM_LIT:1> ) { NLSTag currentTag = null ; final int currentLine = currentLinePtr + <NUM_LIT:1> ; try { currentTag = new NLSTag ( pos + sourceDelta , end + sourceDelta , currentLine , extractInt ( s , start , end ) ) ; } catch ( NumberFormatException e ) { currentTag = new NLSTag ( pos + sourceDelta , end + sourceDelta , currentLine , - <NUM_LIT:1> ) ; } if ( this . nlsTagsPtr == this . nlsTags . length ) { System . arraycopy ( this . nlsTags , <NUM_LIT:0> , ( this . nlsTags = new NLSTag [ this . nlsTagsPtr + <NUM_LIT:10> ] ) , <NUM_LIT:0> , this . nlsTagsPtr ) ; } this . nlsTags [ this . nlsTagsPtr ++ ] = currentTag ; } else { end = start ; } pos = CharOperation . indexOf ( TAG_PREFIX , s , true , end , sourceEnd ) ; } } } private int extractInt ( char [ ] array , int start , int end ) { int value = <NUM_LIT:0> ; for ( int i = start ; i < end ; i ++ ) { final char currentChar = array [ i ] ; int digit = <NUM_LIT:0> ; switch ( currentChar ) { case '<CHAR_LIT:0>' : digit = <NUM_LIT:0> ; break ; case '<CHAR_LIT:1>' : digit = <NUM_LIT:1> ; break ; case '<CHAR_LIT>' : digit = <NUM_LIT:2> ; break ; case '<CHAR_LIT>' : digit = <NUM_LIT:3> ; break ; case '<CHAR_LIT>' : digit = <NUM_LIT:4> ; break ; case '<CHAR_LIT>' : digit = <NUM_LIT:5> ; break ; case '<CHAR_LIT>' : digit = <NUM_LIT:6> ; break ; case '<CHAR_LIT>' : digit = <NUM_LIT:7> ; break ; case '<CHAR_LIT>' : digit = <NUM_LIT:8> ; break ; case '<CHAR_LIT:9>' : digit = <NUM_LIT:9> ; break ; default : throw new NumberFormatException ( ) ; } value *= <NUM_LIT:10> ; if ( digit < <NUM_LIT:0> ) throw new NumberFormatException ( ) ; value += digit ; } return value ; } public final void pushLineSeparator ( ) { final int INCREMENT = <NUM_LIT> ; if ( this . currentCharacter == '<STR_LIT>' ) { int separatorPos = this . currentPosition - <NUM_LIT:1> ; if ( ( this . linePtr >= <NUM_LIT:0> ) && ( this . lineEnds [ this . linePtr ] >= separatorPos ) ) return ; int length = this . lineEnds . length ; if ( ++ this . linePtr >= length ) System . arraycopy ( this . lineEnds , <NUM_LIT:0> , this . lineEnds = new int [ length + INCREMENT ] , <NUM_LIT:0> , length ) ; this . lineEnds [ this . linePtr ] = separatorPos ; try { if ( this . source [ this . currentPosition ] == '<STR_LIT:\n>' ) { this . lineEnds [ this . linePtr ] = this . currentPosition ; this . currentPosition ++ ; this . wasAcr = false ; } else { this . wasAcr = true ; } } catch ( IndexOutOfBoundsException e ) { this . wasAcr = true ; } } else { if ( this . currentCharacter == '<STR_LIT:\n>' ) { if ( this . wasAcr && ( this . lineEnds [ this . linePtr ] == ( this . currentPosition - <NUM_LIT:2> ) ) ) { this . lineEnds [ this . linePtr ] = this . currentPosition - <NUM_LIT:1> ; } else { int separatorPos = this . currentPosition - <NUM_LIT:1> ; if ( ( this . linePtr >= <NUM_LIT:0> ) && ( this . lineEnds [ this . linePtr ] >= separatorPos ) ) return ; int length = this . lineEnds . length ; if ( ++ this . linePtr >= length ) System . arraycopy ( this . lineEnds , <NUM_LIT:0> , this . lineEnds = new int [ length + INCREMENT ] , <NUM_LIT:0> , length ) ; this . lineEnds [ this . linePtr ] = separatorPos ; } this . wasAcr = false ; } } } public final void pushUnicodeLineSeparator ( ) { if ( this . currentCharacter == '<STR_LIT>' ) { if ( this . source [ this . currentPosition ] == '<STR_LIT:\n>' ) { this . wasAcr = false ; } else { this . wasAcr = true ; } } else { if ( this . currentCharacter == '<STR_LIT:\n>' ) { this . wasAcr = false ; } } } public void recordComment ( int token ) { int commentStart = this . startPosition ; int stopPosition = this . currentPosition ; switch ( token ) { case TokenNameCOMMENT_LINE : commentStart = - this . startPosition ; stopPosition = - this . lastCommentLinePosition ; break ; case TokenNameCOMMENT_BLOCK : stopPosition = - this . currentPosition ; break ; } int length = this . commentStops . length ; if ( ++ this . commentPtr >= length ) { int newLength = length + COMMENT_ARRAYS_SIZE * <NUM_LIT:10> ; System . arraycopy ( this . commentStops , <NUM_LIT:0> , this . commentStops = new int [ newLength ] , <NUM_LIT:0> , length ) ; System . arraycopy ( this . commentStarts , <NUM_LIT:0> , this . commentStarts = new int [ newLength ] , <NUM_LIT:0> , length ) ; System . arraycopy ( this . commentTagStarts , <NUM_LIT:0> , this . commentTagStarts = new int [ newLength ] , <NUM_LIT:0> , length ) ; } this . commentStops [ this . commentPtr ] = stopPosition ; this . commentStarts [ this . commentPtr ] = commentStart ; } public void resetTo ( int begin , int end ) { this . diet = false ; this . initialPosition = this . startPosition = this . currentPosition = begin ; if ( this . source != null && this . source . length < end ) { this . eofPosition = this . source . length ; } else { this . eofPosition = end < Integer . MAX_VALUE ? end + <NUM_LIT:1> : end ; } this . commentPtr = - <NUM_LIT:1> ; this . foundTaskCount = <NUM_LIT:0> ; } public final void scanEscapeCharacter ( ) throws InvalidInputException { switch ( this . currentCharacter ) { case '<CHAR_LIT:b>' : this . currentCharacter = '<STR_LIT>' ; break ; case '<CHAR_LIT>' : this . currentCharacter = '<STR_LIT:\t>' ; break ; case '<CHAR_LIT>' : this . currentCharacter = '<STR_LIT:\n>' ; break ; case '<CHAR_LIT>' : this . currentCharacter = '<STR_LIT>' ; break ; case '<CHAR_LIT>' : this . currentCharacter = '<STR_LIT>' ; break ; case '<STR_LIT:\">' : this . currentCharacter = '<STR_LIT:\">' ; break ; case '<STR_LIT>' : this . currentCharacter = '<STR_LIT>' ; break ; case '<STR_LIT:\\>' : this . currentCharacter = '<STR_LIT:\\>' ; break ; default : int number = ScannerHelper . getNumericValue ( this . currentCharacter ) ; if ( number >= <NUM_LIT:0> && number <= <NUM_LIT:7> ) { boolean zeroToThreeNot = number > <NUM_LIT:3> ; if ( ScannerHelper . isDigit ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) ) { int digit = ScannerHelper . getNumericValue ( this . currentCharacter ) ; if ( digit >= <NUM_LIT:0> && digit <= <NUM_LIT:7> ) { number = ( number * <NUM_LIT:8> ) + digit ; if ( ScannerHelper . isDigit ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) ) { if ( zeroToThreeNot ) { this . currentPosition -- ; } else { digit = ScannerHelper . getNumericValue ( this . currentCharacter ) ; if ( digit >= <NUM_LIT:0> && digit <= <NUM_LIT:7> ) { number = ( number * <NUM_LIT:8> ) + digit ; } else { this . currentPosition -- ; } } } else { this . currentPosition -- ; } } else { this . currentPosition -- ; } } else { this . currentPosition -- ; } if ( number > <NUM_LIT:255> ) throw new InvalidInputException ( INVALID_ESCAPE ) ; this . currentCharacter = ( char ) number ; } else throw new InvalidInputException ( INVALID_ESCAPE ) ; } } public int scanIdentifierOrKeywordWithBoundCheck ( ) { this . useAssertAsAnIndentifier = false ; this . useEnumAsAnIndentifier = false ; char [ ] src = this . source ; identLoop : { int pos ; int srcLength = this . eofPosition ; while ( true ) { if ( ( pos = this . currentPosition ) >= srcLength ) break identLoop ; char c = src [ pos ] ; if ( c < ScannerHelper . MAX_OBVIOUS ) { if ( ( ScannerHelper . OBVIOUS_IDENT_CHAR_NATURES [ c ] & ( ScannerHelper . C_UPPER_LETTER | ScannerHelper . C_LOWER_LETTER | ScannerHelper . C_IDENT_PART | ScannerHelper . C_DIGIT ) ) != <NUM_LIT:0> ) { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { this . currentCharacter = c ; unicodeStore ( ) ; } this . currentPosition ++ ; } else if ( ( ScannerHelper . OBVIOUS_IDENT_CHAR_NATURES [ c ] & ( ScannerHelper . C_SEPARATOR | ScannerHelper . C_JLS_SPACE ) ) != <NUM_LIT:0> ) { this . currentCharacter = c ; break identLoop ; } else { while ( getNextCharAsJavaIdentifierPartWithBoundCheck ( ) ) { } break identLoop ; } } else { while ( getNextCharAsJavaIdentifierPartWithBoundCheck ( ) ) { } break identLoop ; } } } int index , length ; char [ ] data ; if ( this . withoutUnicodePtr == <NUM_LIT:0> ) { if ( ( length = this . currentPosition - this . startPosition ) == <NUM_LIT:1> ) { return TokenNameIdentifier ; } data = this . source ; index = this . startPosition ; } else { if ( ( length = this . withoutUnicodePtr ) == <NUM_LIT:1> ) return TokenNameIdentifier ; data = this . withoutUnicodeBuffer ; index = <NUM_LIT:1> ; } return internalScanIdentifierOrKeyword ( index , length , data ) ; } public int scanIdentifierOrKeyword ( ) { this . useAssertAsAnIndentifier = false ; this . useEnumAsAnIndentifier = false ; char [ ] src = this . source ; identLoop : { int pos ; int srcLength = this . eofPosition ; while ( true ) { if ( ( pos = this . currentPosition ) >= srcLength ) break identLoop ; char c = src [ pos ] ; if ( c < ScannerHelper . MAX_OBVIOUS ) { if ( ( ScannerHelper . OBVIOUS_IDENT_CHAR_NATURES [ c ] & ( ScannerHelper . C_UPPER_LETTER | ScannerHelper . C_LOWER_LETTER | ScannerHelper . C_IDENT_PART | ScannerHelper . C_DIGIT ) ) != <NUM_LIT:0> ) { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { this . currentCharacter = c ; unicodeStore ( ) ; } this . currentPosition ++ ; } else if ( ( ScannerHelper . OBVIOUS_IDENT_CHAR_NATURES [ c ] & ( ScannerHelper . C_SEPARATOR | ScannerHelper . C_JLS_SPACE ) ) != <NUM_LIT:0> ) { this . currentCharacter = c ; break identLoop ; } else { while ( getNextCharAsJavaIdentifierPart ( ) ) { } break identLoop ; } } else { while ( getNextCharAsJavaIdentifierPart ( ) ) { } break identLoop ; } } } int index , length ; char [ ] data ; if ( this . withoutUnicodePtr == <NUM_LIT:0> ) { if ( ( length = this . currentPosition - this . startPosition ) == <NUM_LIT:1> ) { return TokenNameIdentifier ; } data = this . source ; index = this . startPosition ; } else { if ( ( length = this . withoutUnicodePtr ) == <NUM_LIT:1> ) return TokenNameIdentifier ; data = this . withoutUnicodeBuffer ; index = <NUM_LIT:1> ; } return internalScanIdentifierOrKeyword ( index , length , data ) ; } private int internalScanIdentifierOrKeyword ( int index , int length , char [ ] data ) { switch ( data [ index ] ) { case '<CHAR_LIT:a>' : switch ( length ) { case <NUM_LIT:8> : if ( ( data [ ++ index ] == '<CHAR_LIT:b>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:a>' ) && ( data [ ++ index ] == '<CHAR_LIT:c>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) { return TokenNameabstract ; } else { return TokenNameIdentifier ; } case <NUM_LIT:6> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) { if ( this . sourceLevel >= ClassFileConstants . JDK1_4 ) { this . containsAssertKeyword = true ; return TokenNameassert ; } else { this . useAssertAsAnIndentifier = true ; return TokenNameIdentifier ; } } else { return TokenNameIdentifier ; } default : return TokenNameIdentifier ; } case '<CHAR_LIT:b>' : switch ( length ) { case <NUM_LIT:4> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) ) return TokenNamebyte ; else return TokenNameIdentifier ; case <NUM_LIT:5> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) && ( data [ ++ index ] == '<CHAR_LIT:a>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNamebreak ; else return TokenNameIdentifier ; case <NUM_LIT:7> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) && ( data [ ++ index ] == '<CHAR_LIT:a>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNameboolean ; else return TokenNameIdentifier ; default : return TokenNameIdentifier ; } case '<CHAR_LIT:c>' : switch ( length ) { case <NUM_LIT:4> : if ( data [ ++ index ] == '<CHAR_LIT:a>' ) if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) ) return TokenNamecase ; else return TokenNameIdentifier ; else if ( ( data [ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:a>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNamechar ; else return TokenNameIdentifier ; case <NUM_LIT:5> : if ( data [ ++ index ] == '<CHAR_LIT:a>' ) if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:c>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNamecatch ; else return TokenNameIdentifier ; else if ( data [ index ] == '<CHAR_LIT>' ) if ( ( data [ ++ index ] == '<CHAR_LIT:a>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNameclass ; else return TokenNameIdentifier ; else if ( ( data [ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNameconst ; else return TokenNameIdentifier ; case <NUM_LIT:8> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) ) return TokenNamecontinue ; else return TokenNameIdentifier ; default : return TokenNameIdentifier ; } case '<CHAR_LIT>' : switch ( length ) { case <NUM_LIT:2> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNamedo ; else return TokenNameIdentifier ; case <NUM_LIT:6> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:b>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) ) return TokenNamedouble ; else return TokenNameIdentifier ; case <NUM_LIT:7> : if ( ( data [ ++ index ] == '<CHAR_LIT:e>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:a>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNamedefault ; else return TokenNameIdentifier ; default : return TokenNameIdentifier ; } case '<CHAR_LIT:e>' : switch ( length ) { case <NUM_LIT:4> : if ( data [ ++ index ] == '<CHAR_LIT>' ) { if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) ) { return TokenNameelse ; } else { return TokenNameIdentifier ; } } else if ( ( data [ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) { if ( this . sourceLevel >= ClassFileConstants . JDK1_5 ) { return TokenNameenum ; } else { this . useEnumAsAnIndentifier = true ; return TokenNameIdentifier ; } } return TokenNameIdentifier ; case <NUM_LIT:7> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNameextends ; else return TokenNameIdentifier ; default : return TokenNameIdentifier ; } case '<CHAR_LIT>' : switch ( length ) { case <NUM_LIT:3> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNamefor ; else return TokenNameIdentifier ; case <NUM_LIT:5> : if ( data [ ++ index ] == '<CHAR_LIT>' ) if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:a>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) { return TokenNamefinal ; } else return TokenNameIdentifier ; else if ( data [ index ] == '<CHAR_LIT>' ) if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:a>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNamefloat ; else return TokenNameIdentifier ; else if ( ( data [ index ] == '<CHAR_LIT:a>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) ) return TokenNamefalse ; else return TokenNameIdentifier ; case <NUM_LIT:7> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:a>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNamefinally ; else return TokenNameIdentifier ; default : return TokenNameIdentifier ; } case '<CHAR_LIT>' : if ( length == <NUM_LIT:4> ) { if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) { return TokenNamegoto ; } } return TokenNameIdentifier ; case '<CHAR_LIT>' : switch ( length ) { case <NUM_LIT:2> : if ( data [ ++ index ] == '<CHAR_LIT>' ) return TokenNameif ; else return TokenNameIdentifier ; case <NUM_LIT:3> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNameint ; else return TokenNameIdentifier ; case <NUM_LIT:6> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNameimport ; else return TokenNameIdentifier ; case <NUM_LIT:9> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:a>' ) && ( data [ ++ index ] == '<CHAR_LIT:c>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) ) return TokenNameinterface ; else return TokenNameIdentifier ; case <NUM_LIT:10> : if ( data [ ++ index ] == '<CHAR_LIT>' ) if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNameimplements ; else return TokenNameIdentifier ; else if ( ( data [ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:a>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:c>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNameinstanceof ; else return TokenNameIdentifier ; default : return TokenNameIdentifier ; } case '<CHAR_LIT>' : if ( length == <NUM_LIT:4> ) { if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) { return TokenNamelong ; } } return TokenNameIdentifier ; case '<CHAR_LIT>' : switch ( length ) { case <NUM_LIT:3> : if ( ( data [ ++ index ] == '<CHAR_LIT:e>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNamenew ; else return TokenNameIdentifier ; case <NUM_LIT:4> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNamenull ; else return TokenNameIdentifier ; case <NUM_LIT:6> : if ( ( data [ ++ index ] == '<CHAR_LIT:a>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) ) { return TokenNamenative ; } else return TokenNameIdentifier ; default : return TokenNameIdentifier ; } case '<CHAR_LIT>' : switch ( length ) { case <NUM_LIT:6> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:b>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:c>' ) ) { return TokenNamepublic ; } else return TokenNameIdentifier ; case <NUM_LIT:7> : if ( data [ ++ index ] == '<CHAR_LIT:a>' ) if ( ( data [ ++ index ] == '<CHAR_LIT:c>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:a>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) ) return TokenNamepackage ; else return TokenNameIdentifier ; else if ( ( data [ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:a>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) ) { return TokenNameprivate ; } else return TokenNameIdentifier ; case <NUM_LIT:9> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) && ( data [ ++ index ] == '<CHAR_LIT:c>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) { return TokenNameprotected ; } else return TokenNameIdentifier ; default : return TokenNameIdentifier ; } case '<CHAR_LIT>' : if ( length == <NUM_LIT:6> ) { if ( ( data [ ++ index ] == '<CHAR_LIT:e>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) { return TokenNamereturn ; } } return TokenNameIdentifier ; case '<CHAR_LIT>' : switch ( length ) { case <NUM_LIT:5> : if ( data [ ++ index ] == '<CHAR_LIT>' ) if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNameshort ; else return TokenNameIdentifier ; else if ( ( data [ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNamesuper ; else return TokenNameIdentifier ; case <NUM_LIT:6> : if ( data [ ++ index ] == '<CHAR_LIT>' ) if ( ( data [ ++ index ] == '<CHAR_LIT:a>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:c>' ) ) { return TokenNamestatic ; } else return TokenNameIdentifier ; else if ( ( data [ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:c>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNameswitch ; else return TokenNameIdentifier ; case <NUM_LIT:8> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:c>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNamestrictfp ; else return TokenNameIdentifier ; case <NUM_LIT:12> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:c>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) { return TokenNamesynchronized ; } else return TokenNameIdentifier ; default : return TokenNameIdentifier ; } case '<CHAR_LIT>' : switch ( length ) { case <NUM_LIT:3> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNametry ; else return TokenNameIdentifier ; case <NUM_LIT:4> : if ( data [ ++ index ] == '<CHAR_LIT>' ) if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNamethis ; else return TokenNameIdentifier ; else if ( ( data [ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) ) return TokenNametrue ; else return TokenNameIdentifier ; case <NUM_LIT:5> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNamethrow ; else return TokenNameIdentifier ; case <NUM_LIT:6> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNamethrows ; else return TokenNameIdentifier ; case <NUM_LIT:9> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:a>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) { return TokenNametransient ; } else return TokenNameIdentifier ; default : return TokenNameIdentifier ; } case '<CHAR_LIT>' : switch ( length ) { case <NUM_LIT:4> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) ) return TokenNamevoid ; else return TokenNameIdentifier ; case <NUM_LIT:8> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:a>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) ) { return TokenNamevolatile ; } else return TokenNameIdentifier ; default : return TokenNameIdentifier ; } case '<CHAR_LIT>' : switch ( length ) { case <NUM_LIT:5> : if ( ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT>' ) && ( data [ ++ index ] == '<CHAR_LIT:e>' ) ) return TokenNamewhile ; else return TokenNameIdentifier ; default : return TokenNameIdentifier ; } default : return TokenNameIdentifier ; } } public int scanNumber ( boolean dotPrefix ) throws InvalidInputException { boolean floating = dotPrefix ; if ( ( ! dotPrefix ) && ( this . currentCharacter == '<CHAR_LIT:0>' ) ) { if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { int start = this . currentPosition ; while ( getNextCharAsDigit ( <NUM_LIT:16> ) ) { } int end = this . currentPosition ; if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { if ( end == start ) { throw new InvalidInputException ( INVALID_HEXA ) ; } return TokenNameLongLiteral ; } else if ( getNextChar ( '<CHAR_LIT:.>' ) ) { if ( this . sourceLevel < ClassFileConstants . JDK1_5 ) { if ( end == start ) { throw new InvalidInputException ( INVALID_HEXA ) ; } this . currentPosition = end ; return TokenNameIntegerLiteral ; } boolean hasNoDigitsBeforeDot = end == start ; start = this . currentPosition ; while ( getNextCharAsDigit ( <NUM_LIT:16> ) ) { } end = this . currentPosition ; if ( hasNoDigitsBeforeDot && end == start ) { throw new InvalidInputException ( INVALID_HEXA ) ; } if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { this . unicodeAsBackSlash = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; } else { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } if ( ( this . currentCharacter == '<CHAR_LIT:->' ) || ( this . currentCharacter == '<CHAR_LIT>' ) ) { this . unicodeAsBackSlash = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; } else { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } } if ( ! ScannerHelper . isDigit ( this . currentCharacter ) ) { throw new InvalidInputException ( INVALID_HEXA ) ; } while ( getNextCharAsDigit ( ) ) { } if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { return TokenNameFloatingPointLiteral ; } if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { return TokenNameDoubleLiteral ; } if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { throw new InvalidInputException ( INVALID_HEXA ) ; } return TokenNameDoubleLiteral ; } else { throw new InvalidInputException ( INVALID_HEXA ) ; } } else if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { if ( this . sourceLevel < ClassFileConstants . JDK1_5 ) { this . currentPosition = end ; return TokenNameIntegerLiteral ; } this . unicodeAsBackSlash = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; } else { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } if ( ( this . currentCharacter == '<CHAR_LIT:->' ) || ( this . currentCharacter == '<CHAR_LIT>' ) ) { this . unicodeAsBackSlash = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; } else { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } } if ( ! ScannerHelper . isDigit ( this . currentCharacter ) ) throw new InvalidInputException ( INVALID_FLOAT ) ; while ( getNextCharAsDigit ( ) ) { } if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) return TokenNameFloatingPointLiteral ; if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) return TokenNameDoubleLiteral ; if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { throw new InvalidInputException ( INVALID_HEXA ) ; } return TokenNameDoubleLiteral ; } else { if ( end == start ) throw new InvalidInputException ( INVALID_HEXA ) ; return TokenNameIntegerLiteral ; } } if ( getNextCharAsDigit ( ) ) { while ( getNextCharAsDigit ( ) ) { } if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { return TokenNameLongLiteral ; } if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { return TokenNameFloatingPointLiteral ; } if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { return TokenNameDoubleLiteral ; } else { boolean isInteger = true ; if ( getNextChar ( '<CHAR_LIT:.>' ) ) { isInteger = false ; while ( getNextCharAsDigit ( ) ) { } } if ( getNextChar ( '<CHAR_LIT:e>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { isInteger = false ; this . unicodeAsBackSlash = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; } else { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } if ( ( this . currentCharacter == '<CHAR_LIT:->' ) || ( this . currentCharacter == '<CHAR_LIT>' ) ) { this . unicodeAsBackSlash = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; } else { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } } if ( ! ScannerHelper . isDigit ( this . currentCharacter ) ) throw new InvalidInputException ( INVALID_FLOAT ) ; while ( getNextCharAsDigit ( ) ) { } } if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) return TokenNameFloatingPointLiteral ; if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> || ! isInteger ) return TokenNameDoubleLiteral ; return TokenNameIntegerLiteral ; } } else { } } while ( getNextCharAsDigit ( ) ) { } if ( ( ! dotPrefix ) && ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) ) return TokenNameLongLiteral ; if ( ( ! dotPrefix ) && ( getNextChar ( '<CHAR_LIT:.>' ) ) ) { while ( getNextCharAsDigit ( ) ) { } floating = true ; } if ( getNextChar ( '<CHAR_LIT:e>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { floating = true ; this . unicodeAsBackSlash = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; } else { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } if ( ( this . currentCharacter == '<CHAR_LIT:->' ) || ( this . currentCharacter == '<CHAR_LIT>' ) ) { this . unicodeAsBackSlash = false ; if ( ( ( this . currentCharacter = this . source [ this . currentPosition ++ ] ) == '<STR_LIT:\\>' ) && ( this . source [ this . currentPosition ] == '<CHAR_LIT>' ) ) { getNextUnicodeChar ( ) ; } else { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { unicodeStore ( ) ; } } } if ( ! ScannerHelper . isDigit ( this . currentCharacter ) ) throw new InvalidInputException ( INVALID_FLOAT ) ; while ( getNextCharAsDigit ( ) ) { } } if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) return TokenNameDoubleLiteral ; if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) return TokenNameFloatingPointLiteral ; return floating ? TokenNameDoubleLiteral : TokenNameIntegerLiteral ; } public final int getLineNumber ( int position ) { return Util . getLineNumber ( position , this . lineEnds , <NUM_LIT:0> , this . linePtr ) ; } public final void setSource ( char [ ] sourceString ) { int sourceLength ; if ( sourceString == null ) { this . source = CharOperation . NO_CHAR ; sourceLength = <NUM_LIT:0> ; } else { this . source = sourceString ; sourceLength = sourceString . length ; } this . startPosition = - <NUM_LIT:1> ; this . eofPosition = sourceLength ; this . initialPosition = this . currentPosition = <NUM_LIT:0> ; this . containsAssertKeyword = false ; this . linePtr = - <NUM_LIT:1> ; } public final void setSource ( char [ ] contents , CompilationResult compilationResult ) { if ( contents == null ) { char [ ] cuContents = compilationResult . compilationUnit . getContents ( ) ; setSource ( cuContents ) ; } else { setSource ( contents ) ; } int [ ] lineSeparatorPositions = compilationResult . lineSeparatorPositions ; if ( lineSeparatorPositions != null ) { this . lineEnds = lineSeparatorPositions ; this . linePtr = lineSeparatorPositions . length - <NUM_LIT:1> ; } } public final void setSource ( CompilationResult compilationResult ) { setSource ( null , compilationResult ) ; } public String toString ( ) { if ( this . startPosition == this . eofPosition ) return "<STR_LIT>" + new String ( this . source ) ; if ( this . currentPosition > this . eofPosition ) return "<STR_LIT>" + new String ( this . source ) ; if ( this . currentPosition <= <NUM_LIT:0> ) return "<STR_LIT>" + new String ( this . source ) ; StringBuffer buffer = new StringBuffer ( ) ; if ( this . startPosition < <NUM_LIT:1000> ) { buffer . append ( this . source , <NUM_LIT:0> , this . startPosition ) ; } else { buffer . append ( "<STR_LIT>" ) ; int line = Util . getLineNumber ( this . startPosition - <NUM_LIT:1000> , this . lineEnds , <NUM_LIT:0> , this . linePtr ) ; int lineStart = getLineStart ( line ) ; buffer . append ( this . source , lineStart , this . startPosition - lineStart ) ; } buffer . append ( "<STR_LIT>" ) ; int middleLength = ( this . currentPosition - <NUM_LIT:1> ) - this . startPosition + <NUM_LIT:1> ; if ( middleLength > - <NUM_LIT:1> ) { buffer . append ( this . source , this . startPosition , middleLength ) ; } buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . source , ( this . currentPosition - <NUM_LIT:1> ) + <NUM_LIT:1> , this . eofPosition - ( this . currentPosition - <NUM_LIT:1> ) - <NUM_LIT:1> ) ; return buffer . toString ( ) ; } public String toStringAction ( int act ) { switch ( act ) { case TokenNameIdentifier : return "<STR_LIT>" + new String ( getCurrentTokenSource ( ) ) + "<STR_LIT:)>" ; case TokenNameabstract : return "<STR_LIT>" ; case TokenNameboolean : return "<STR_LIT:boolean>" ; case TokenNamebreak : return "<STR_LIT>" ; case TokenNamebyte : return "<STR_LIT>" ; case TokenNamecase : return "<STR_LIT>" ; case TokenNamecatch : return "<STR_LIT>" ; case TokenNamechar : return "<STR_LIT>" ; case TokenNameclass : return "<STR_LIT:class>" ; case TokenNamecontinue : return "<STR_LIT>" ; case TokenNamedefault : return "<STR_LIT:default>" ; case TokenNamedo : return "<STR_LIT>" ; case TokenNamedouble : return "<STR_LIT:double>" ; case TokenNameelse : return "<STR_LIT>" ; case TokenNameextends : return "<STR_LIT>" ; case TokenNamefalse : return "<STR_LIT:false>" ; case TokenNamefinal : return "<STR_LIT>" ; case TokenNamefinally : return "<STR_LIT>" ; case TokenNamefloat : return "<STR_LIT:float>" ; case TokenNamefor : return "<STR_LIT>" ; case TokenNameif : return "<STR_LIT>" ; case TokenNameimplements : return "<STR_LIT>" ; case TokenNameimport : return "<STR_LIT>" ; case TokenNameinstanceof : return "<STR_LIT>" ; case TokenNameint : return "<STR_LIT:int>" ; case TokenNameinterface : return "<STR_LIT>" ; case TokenNamelong : return "<STR_LIT:long>" ; case TokenNamenative : return "<STR_LIT>" ; case TokenNamenew : return "<STR_LIT>" ; case TokenNamenull : return "<STR_LIT:null>" ; case TokenNamepackage : return "<STR_LIT>" ; case TokenNameprivate : return "<STR_LIT>" ; case TokenNameprotected : return "<STR_LIT>" ; case TokenNamepublic : return "<STR_LIT>" ; case TokenNamereturn : return "<STR_LIT>" ; case TokenNameshort : return "<STR_LIT>" ; case TokenNamestatic : return "<STR_LIT>" ; case TokenNamesuper : return "<STR_LIT>" ; case TokenNameswitch : return "<STR_LIT>" ; case TokenNamesynchronized : return "<STR_LIT>" ; case TokenNamethis : return "<STR_LIT>" ; case TokenNamethrow : return "<STR_LIT>" ; case TokenNamethrows : return "<STR_LIT>" ; case TokenNametransient : return "<STR_LIT>" ; case TokenNametrue : return "<STR_LIT:true>" ; case TokenNametry : return "<STR_LIT>" ; case TokenNamevoid : return "<STR_LIT>" ; case TokenNamevolatile : return "<STR_LIT>" ; case TokenNamewhile : return "<STR_LIT>" ; case TokenNameIntegerLiteral : return "<STR_LIT>" + new String ( getCurrentTokenSource ( ) ) + "<STR_LIT:)>" ; case TokenNameLongLiteral : return "<STR_LIT>" + new String ( getCurrentTokenSource ( ) ) + "<STR_LIT:)>" ; case TokenNameFloatingPointLiteral : return "<STR_LIT>" + new String ( getCurrentTokenSource ( ) ) + "<STR_LIT:)>" ; case TokenNameDoubleLiteral : return "<STR_LIT>" + new String ( getCurrentTokenSource ( ) ) + "<STR_LIT:)>" ; case TokenNameCharacterLiteral : return "<STR_LIT>" + new String ( getCurrentTokenSource ( ) ) + "<STR_LIT:)>" ; case TokenNameStringLiteral : return "<STR_LIT>" + new String ( getCurrentTokenSource ( ) ) + "<STR_LIT:)>" ; case TokenNamePLUS_PLUS : return "<STR_LIT>" ; case TokenNameMINUS_MINUS : return "<STR_LIT:-->" ; case TokenNameEQUAL_EQUAL : return "<STR_LIT>" ; case TokenNameLESS_EQUAL : return "<STR_LIT>" ; case TokenNameGREATER_EQUAL : return "<STR_LIT>" ; case TokenNameNOT_EQUAL : return "<STR_LIT>" ; case TokenNameLEFT_SHIFT : return "<STR_LIT>" ; case TokenNameRIGHT_SHIFT : return "<STR_LIT>" ; case TokenNameUNSIGNED_RIGHT_SHIFT : return "<STR_LIT>" ; case TokenNamePLUS_EQUAL : return "<STR_LIT>" ; case TokenNameMINUS_EQUAL : return "<STR_LIT>" ; case TokenNameMULTIPLY_EQUAL : return "<STR_LIT>" ; case TokenNameDIVIDE_EQUAL : return "<STR_LIT>" ; case TokenNameAND_EQUAL : return "<STR_LIT>" ; case TokenNameOR_EQUAL : return "<STR_LIT>" ; case TokenNameXOR_EQUAL : return "<STR_LIT>" ; case TokenNameREMAINDER_EQUAL : return "<STR_LIT>" ; case TokenNameLEFT_SHIFT_EQUAL : return "<STR_LIT>" ; case TokenNameRIGHT_SHIFT_EQUAL : return "<STR_LIT>" ; case TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL : return "<STR_LIT>" ; case TokenNameOR_OR : return "<STR_LIT>" ; case TokenNameAND_AND : return "<STR_LIT>" ; case TokenNamePLUS : return "<STR_LIT:+>" ; case TokenNameMINUS : return "<STR_LIT:->" ; case TokenNameNOT : return "<STR_LIT:!>" ; case TokenNameREMAINDER : return "<STR_LIT:%>" ; case TokenNameXOR : return "<STR_LIT>" ; case TokenNameAND : return "<STR_LIT:&>" ; case TokenNameMULTIPLY : return "<STR_LIT:*>" ; case TokenNameOR : return "<STR_LIT:|>" ; case TokenNameTWIDDLE : return "<STR_LIT>" ; case TokenNameDIVIDE : return "<STR_LIT:/>" ; case TokenNameGREATER : return "<STR_LIT:>>" ; case TokenNameLESS : return "<STR_LIT:<>" ; case TokenNameLPAREN : return "<STR_LIT:(>" ; case TokenNameRPAREN : return "<STR_LIT:)>" ; case TokenNameLBRACE : return "<STR_LIT:{>" ; case TokenNameRBRACE : return "<STR_LIT:}>" ; case TokenNameLBRACKET : return "<STR_LIT:[>" ; case TokenNameRBRACKET : return "<STR_LIT:]>" ; case TokenNameSEMICOLON : return "<STR_LIT:;>" ; case TokenNameQUESTION : return "<STR_LIT:?>" ; case TokenNameCOLON : return "<STR_LIT::>" ; case TokenNameCOMMA : return "<STR_LIT:U+002C>" ; case TokenNameDOT : return "<STR_LIT:.>" ; case TokenNameEQUAL : return "<STR_LIT:=>" ; case TokenNameEOF : return "<STR_LIT>" ; case TokenNameWHITESPACE : return "<STR_LIT>" + new String ( getCurrentTokenSource ( ) ) + "<STR_LIT:)>" ; default : return "<STR_LIT>" ; } } public void unicodeInitializeBuffer ( int length ) { this . withoutUnicodePtr = length ; if ( this . withoutUnicodeBuffer == null ) this . withoutUnicodeBuffer = new char [ length + ( <NUM_LIT:1> + <NUM_LIT:10> ) ] ; int bLength = this . withoutUnicodeBuffer . length ; if ( <NUM_LIT:1> + length >= bLength ) { System . arraycopy ( this . withoutUnicodeBuffer , <NUM_LIT:0> , this . withoutUnicodeBuffer = new char [ length + ( <NUM_LIT:1> + <NUM_LIT:10> ) ] , <NUM_LIT:0> , bLength ) ; } System . arraycopy ( this . source , this . startPosition , this . withoutUnicodeBuffer , <NUM_LIT:1> , length ) ; } public void unicodeStore ( ) { int pos = ++ this . withoutUnicodePtr ; if ( this . withoutUnicodeBuffer == null ) this . withoutUnicodeBuffer = new char [ <NUM_LIT:10> ] ; int length = this . withoutUnicodeBuffer . length ; if ( pos == length ) { System . arraycopy ( this . withoutUnicodeBuffer , <NUM_LIT:0> , this . withoutUnicodeBuffer = new char [ length * <NUM_LIT:2> ] , <NUM_LIT:0> , length ) ; } this . withoutUnicodeBuffer [ pos ] = this . currentCharacter ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import java . lang . ref . ReferenceQueue ; import java . lang . ref . WeakReference ; import org . eclipse . jdt . core . compiler . CharOperation ; public class WeakHashSetOfCharArray { public static class HashableWeakReference extends WeakReference { public int hashCode ; public HashableWeakReference ( char [ ] referent , ReferenceQueue queue ) { super ( referent , queue ) ; this . hashCode = CharOperation . hashCode ( referent ) ; } public boolean equals ( Object obj ) { if ( ! ( obj instanceof HashableWeakReference ) ) return false ; char [ ] referent = ( char [ ] ) get ( ) ; char [ ] other = ( char [ ] ) ( ( HashableWeakReference ) obj ) . get ( ) ; if ( referent == null ) return other == null ; return CharOperation . equals ( referent , other ) ; } public int hashCode ( ) { return this . hashCode ; } public String toString ( ) { char [ ] referent = ( char [ ] ) get ( ) ; if ( referent == null ) return "<STR_LIT>" + this . hashCode + "<STR_LIT>" ; return "<STR_LIT>" + this . hashCode + "<STR_LIT>" + new String ( referent ) + '<STR_LIT:\">' ; } } HashableWeakReference [ ] values ; public int elementSize ; int threshold ; ReferenceQueue referenceQueue = new ReferenceQueue ( ) ; public WeakHashSetOfCharArray ( ) { this ( <NUM_LIT:5> ) ; } public WeakHashSetOfCharArray ( int size ) { this . elementSize = <NUM_LIT:0> ; this . threshold = size ; int extraRoom = ( int ) ( size * <NUM_LIT> ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . values = new HashableWeakReference [ extraRoom ] ; } public char [ ] add ( char [ ] array ) { cleanupGarbageCollectedValues ( ) ; int valuesLength = this . values . length , index = ( CharOperation . hashCode ( array ) & <NUM_LIT> ) % valuesLength ; HashableWeakReference currentValue ; while ( ( currentValue = this . values [ index ] ) != null ) { char [ ] referent ; if ( CharOperation . equals ( array , referent = ( char [ ] ) currentValue . get ( ) ) ) { return referent ; } if ( ++ index == valuesLength ) { index = <NUM_LIT:0> ; } } this . values [ index ] = new HashableWeakReference ( array , this . referenceQueue ) ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return array ; } private void addValue ( HashableWeakReference value ) { char [ ] array = ( char [ ] ) value . get ( ) ; if ( array == null ) return ; int valuesLength = this . values . length ; int index = ( value . hashCode & <NUM_LIT> ) % valuesLength ; HashableWeakReference currentValue ; while ( ( currentValue = this . values [ index ] ) != null ) { if ( CharOperation . equals ( array , ( char [ ] ) currentValue . get ( ) ) ) { return ; } if ( ++ index == valuesLength ) { index = <NUM_LIT:0> ; } } this . values [ index ] = value ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; } private void cleanupGarbageCollectedValues ( ) { HashableWeakReference toBeRemoved ; while ( ( toBeRemoved = ( HashableWeakReference ) this . referenceQueue . poll ( ) ) != null ) { int hashCode = toBeRemoved . hashCode ; int valuesLength = this . values . length ; int index = ( hashCode & <NUM_LIT> ) % valuesLength ; HashableWeakReference currentValue ; while ( ( currentValue = this . values [ index ] ) != null ) { if ( currentValue == toBeRemoved ) { int sameHash = index ; int current ; while ( ( currentValue = this . values [ current = ( sameHash + <NUM_LIT:1> ) % valuesLength ] ) != null && currentValue . hashCode == hashCode ) sameHash = current ; this . values [ index ] = this . values [ sameHash ] ; this . values [ sameHash ] = null ; this . elementSize -- ; break ; } if ( ++ index == valuesLength ) { index = <NUM_LIT:0> ; } } } } public boolean contains ( char [ ] array ) { return get ( array ) != null ; } public char [ ] get ( char [ ] array ) { cleanupGarbageCollectedValues ( ) ; int valuesLength = this . values . length ; int index = ( CharOperation . hashCode ( array ) & <NUM_LIT> ) % valuesLength ; HashableWeakReference currentValue ; while ( ( currentValue = this . values [ index ] ) != null ) { char [ ] referent ; if ( CharOperation . equals ( array , referent = ( char [ ] ) currentValue . get ( ) ) ) { return referent ; } if ( ++ index == valuesLength ) { index = <NUM_LIT:0> ; } } return null ; } private void rehash ( ) { WeakHashSetOfCharArray newHashSet = new WeakHashSetOfCharArray ( this . elementSize * <NUM_LIT:2> ) ; newHashSet . referenceQueue = this . referenceQueue ; HashableWeakReference currentValue ; for ( int i = <NUM_LIT:0> , length = this . values . length ; i < length ; i ++ ) if ( ( currentValue = this . values [ i ] ) != null ) newHashSet . addValue ( currentValue ) ; this . values = newHashSet . values ; this . threshold = newHashSet . threshold ; this . elementSize = newHashSet . elementSize ; } public char [ ] remove ( char [ ] array ) { cleanupGarbageCollectedValues ( ) ; int valuesLength = this . values . length ; int index = ( CharOperation . hashCode ( array ) & <NUM_LIT> ) % valuesLength ; HashableWeakReference currentValue ; while ( ( currentValue = this . values [ index ] ) != null ) { char [ ] referent ; if ( CharOperation . equals ( array , referent = ( char [ ] ) currentValue . get ( ) ) ) { this . elementSize -- ; this . values [ index ] = null ; rehash ( ) ; return referent ; } if ( ++ index == valuesLength ) { index = <NUM_LIT:0> ; } } return null ; } public int size ( ) { return this . elementSize ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT:{>" ) ; for ( int i = <NUM_LIT:0> , length = this . values . length ; i < length ; i ++ ) { HashableWeakReference value = this . values [ i ] ; if ( value != null ) { char [ ] ref = ( char [ ] ) value . get ( ) ; if ( ref != null ) { buffer . append ( '<STR_LIT:\">' ) ; buffer . append ( ref ) ; buffer . append ( "<STR_LIT>" ) ; } } } buffer . append ( "<STR_LIT:}>" ) ; return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . Signature ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . util . ClassFileBytesDisassembler ; import org . eclipse . jdt . core . util . IBytecodeVisitor ; import org . eclipse . jdt . core . util . ICodeAttribute ; import org . eclipse . jdt . core . util . IConstantPoolConstant ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; import org . eclipse . jdt . core . util . ILocalVariableAttribute ; import org . eclipse . jdt . core . util . ILocalVariableTableEntry ; import org . eclipse . jdt . core . util . OpcodeStringValues ; import org . eclipse . jdt . core . util . IOpcodeMnemonics ; public class DefaultBytecodeVisitor implements IBytecodeVisitor { private static final String EMPTY_CLASS_NAME = "<STR_LIT>" ; private static final String EMPTY_LOCAL_NAME = "<STR_LIT>" ; private static final int T_BOOLEAN = <NUM_LIT:4> ; private static final int T_CHAR = <NUM_LIT:5> ; private static final int T_FLOAT = <NUM_LIT:6> ; private static final int T_DOUBLE = <NUM_LIT:7> ; private static final int T_BYTE = <NUM_LIT:8> ; private static final int T_SHORT = <NUM_LIT:9> ; private static final int T_INT = <NUM_LIT:10> ; private static final int T_LONG = <NUM_LIT:11> ; private StringBuffer buffer ; private String lineSeparator ; private int tabNumber ; private int digitNumberForPC ; private ILocalVariableTableEntry [ ] localVariableTableEntries ; private int localVariableAttributeLength ; private int mode ; private char [ ] [ ] parameterNames ; private boolean isStatic ; private int [ ] argumentSizes ; public DefaultBytecodeVisitor ( ICodeAttribute codeAttribute , char [ ] [ ] parameterNames , char [ ] methodDescriptor , boolean isStatic , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { ILocalVariableAttribute localVariableAttribute = codeAttribute . getLocalVariableAttribute ( ) ; this . localVariableAttributeLength = localVariableAttribute == null ? <NUM_LIT:0> : localVariableAttribute . getLocalVariableTableLength ( ) ; if ( this . localVariableAttributeLength != <NUM_LIT:0> ) { this . localVariableTableEntries = localVariableAttribute . getLocalVariableTable ( ) ; } else { this . localVariableTableEntries = null ; } this . buffer = buffer ; this . lineSeparator = lineSeparator ; this . tabNumber = tabNumber + <NUM_LIT:1> ; long codeLength = codeAttribute . getCodeLength ( ) ; this . digitNumberForPC = Long . toString ( codeLength ) . length ( ) ; this . mode = mode ; this . parameterNames = parameterNames ; this . isStatic = isStatic ; if ( parameterNames != null ) { char [ ] [ ] parameterTypes = Signature . getParameterTypes ( methodDescriptor ) ; int length = parameterTypes . length ; this . argumentSizes = new int [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { char [ ] parameterType = parameterTypes [ i ] ; this . argumentSizes [ i ] = parameterType . length == <NUM_LIT:1> && ( parameterType [ <NUM_LIT:0> ] == '<CHAR_LIT>' || parameterType [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) ? <NUM_LIT:2> : <NUM_LIT:1> ; } } } public void _aaload ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . AALOAD ] ) ; writeNewLine ( ) ; } private void dumpPcNumber ( int pc ) { writeTabs ( ) ; int digitForPC = <NUM_LIT:1> ; if ( pc != <NUM_LIT:0> ) { digitForPC = Integer . toString ( pc ) . length ( ) ; } for ( int i = <NUM_LIT:0> , max = this . digitNumberForPC - digitForPC ; i < max ; i ++ ) { this . buffer . append ( '<CHAR_LIT:U+0020>' ) ; } this . buffer . append ( pc ) ; this . buffer . append ( Messages . disassembler_indentation ) ; } public void _aastore ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . AASTORE ] ) ; writeNewLine ( ) ; } public void _aconst_null ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ACONST_NULL ] ) ; writeNewLine ( ) ; } public void _aload_0 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ALOAD_0 ] , getLocalVariableName ( pc , <NUM_LIT:0> ) } ) ) ; writeNewLine ( ) ; } public void _aload_1 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ALOAD_1 ] , getLocalVariableName ( pc , <NUM_LIT:1> ) } ) ) ; writeNewLine ( ) ; } public void _aload_2 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ALOAD_2 ] , getLocalVariableName ( pc , <NUM_LIT:2> ) } ) ) ; writeNewLine ( ) ; } public void _aload_3 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ALOAD_3 ] , getLocalVariableName ( pc , <NUM_LIT:3> ) } ) ) ; writeNewLine ( ) ; } public void _aload ( int pc , int index ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ALOAD ] , getLocalVariableName ( pc , index , true ) } ) ) ; writeNewLine ( ) ; } public void _anewarray ( int pc , int index , IConstantPoolEntry constantClass ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_anewarray , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ANEWARRAY ] , Integer . toString ( index ) , returnConstantClassName ( constantClass ) } ) ) ; writeNewLine ( ) ; } public void _areturn ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ARETURN ] ) ; writeNewLine ( ) ; } public void _arraylength ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ARRAYLENGTH ] ) ; writeNewLine ( ) ; } public void _astore_0 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ASTORE_0 ] , getLocalVariableName ( pc , <NUM_LIT:0> ) } ) ) ; writeNewLine ( ) ; } public void _astore_1 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ASTORE_1 ] , getLocalVariableName ( pc , <NUM_LIT:1> ) } ) ) ; writeNewLine ( ) ; } private String getLocalVariableName ( int pc , int index ) { return getLocalVariableName ( pc , index , false ) ; } private String getLocalVariableName ( int pc , int index , boolean showIndex ) { int nextPC = pc + <NUM_LIT:1> ; switch ( index ) { case <NUM_LIT:0> : case <NUM_LIT:1> : case <NUM_LIT:2> : case <NUM_LIT:3> : break ; default : nextPC = index <= <NUM_LIT:255> ? pc + <NUM_LIT:2> : pc + <NUM_LIT:3> ; } for ( int i = <NUM_LIT:0> , max = this . localVariableAttributeLength ; i < max ; i ++ ) { final ILocalVariableTableEntry entry = this . localVariableTableEntries [ i ] ; final int startPC = entry . getStartPC ( ) ; if ( entry . getIndex ( ) == index && ( startPC <= nextPC ) && ( ( startPC + entry . getLength ( ) ) > nextPC ) ) { final StringBuffer stringBuffer = new StringBuffer ( ) ; if ( showIndex ) { stringBuffer . append ( '<CHAR_LIT:U+0020>' ) . append ( index ) ; } stringBuffer . append ( '<CHAR_LIT:U+0020>' ) . append ( '<CHAR_LIT:[>' ) . append ( entry . getName ( ) ) . append ( '<CHAR_LIT:]>' ) ; return String . valueOf ( stringBuffer ) ; } } if ( this . parameterNames != null ) { if ( index == <NUM_LIT:0> ) { if ( ! this . isStatic ) { final StringBuffer stringBuffer = new StringBuffer ( ) ; stringBuffer . append ( '<CHAR_LIT:U+0020>' ) . append ( '<CHAR_LIT:[>' ) . append ( "<STR_LIT>" ) . append ( '<CHAR_LIT:]>' ) ; return String . valueOf ( stringBuffer ) ; } } int indexInParameterNames = index ; if ( index != <NUM_LIT:0> ) { int resolvedPosition = <NUM_LIT:0> ; if ( ! this . isStatic ) { resolvedPosition = <NUM_LIT:1> ; } int i = <NUM_LIT:0> ; loop : for ( int max = this . argumentSizes . length ; i < max ; i ++ ) { if ( index == resolvedPosition ) { break loop ; } resolvedPosition += this . argumentSizes [ i ] ; } indexInParameterNames = i ; } if ( indexInParameterNames < this . parameterNames . length && this . parameterNames [ indexInParameterNames ] != null ) { final StringBuffer stringBuffer = new StringBuffer ( ) ; if ( showIndex ) { stringBuffer . append ( '<CHAR_LIT:U+0020>' ) . append ( index ) ; } stringBuffer . append ( '<CHAR_LIT:U+0020>' ) . append ( '<CHAR_LIT:[>' ) . append ( this . parameterNames [ indexInParameterNames ] ) . append ( '<CHAR_LIT:]>' ) ; return String . valueOf ( stringBuffer ) ; } } if ( showIndex ) { final StringBuffer stringBuffer = new StringBuffer ( ) ; stringBuffer . append ( '<CHAR_LIT:U+0020>' ) . append ( index ) ; return String . valueOf ( stringBuffer ) ; } return EMPTY_LOCAL_NAME ; } public void _astore_2 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ASTORE_2 ] , getLocalVariableName ( pc , <NUM_LIT:2> ) } ) ) ; writeNewLine ( ) ; } public void _astore_3 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ASTORE_3 ] , getLocalVariableName ( pc , <NUM_LIT:3> ) } ) ) ; writeNewLine ( ) ; } public void _astore ( int pc , int index ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ASTORE ] , getLocalVariableName ( pc , index , true ) } ) ) ; writeNewLine ( ) ; } public void _athrow ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ATHROW ] ) ; writeNewLine ( ) ; } public void _baload ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . BALOAD ] ) ; writeNewLine ( ) ; } public void _bastore ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . BASTORE ] ) ; writeNewLine ( ) ; } public void _bipush ( int pc , byte _byte ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . BIPUSH ] ) . append ( Messages . disassembler_space ) . append ( _byte ) ; writeNewLine ( ) ; } public void _caload ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . CALOAD ] ) ; writeNewLine ( ) ; } public void _castore ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . CASTORE ] ) ; writeNewLine ( ) ; } public void _checkcast ( int pc , int index , IConstantPoolEntry constantClass ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_checkcast , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . CHECKCAST ] , Integer . toString ( index ) , returnConstantClassName ( constantClass ) } ) ) ; writeNewLine ( ) ; } public void _d2f ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . D2F ] ) ; writeNewLine ( ) ; } public void _d2i ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . D2I ] ) ; writeNewLine ( ) ; } public void _d2l ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . D2L ] ) ; writeNewLine ( ) ; } public void _dadd ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DADD ] ) ; writeNewLine ( ) ; } public void _daload ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DALOAD ] ) ; writeNewLine ( ) ; } public void _dastore ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DASTORE ] ) ; writeNewLine ( ) ; } public void _dcmpg ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DCMPG ] ) ; writeNewLine ( ) ; } public void _dcmpl ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DCMPL ] ) ; writeNewLine ( ) ; } public void _dconst_0 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DCONST_0 ] ) ; writeNewLine ( ) ; } public void _dconst_1 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DCONST_1 ] ) ; writeNewLine ( ) ; } public void _ddiv ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DDIV ] ) ; writeNewLine ( ) ; } public void _dload_0 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DLOAD_0 ] , getLocalVariableName ( pc , <NUM_LIT:0> ) } ) ) ; writeNewLine ( ) ; } public void _dload_1 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DLOAD_1 ] , getLocalVariableName ( pc , <NUM_LIT:1> ) } ) ) ; writeNewLine ( ) ; } public void _dload_2 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DLOAD_2 ] , getLocalVariableName ( pc , <NUM_LIT:2> ) } ) ) ; writeNewLine ( ) ; } public void _dload_3 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DLOAD_3 ] , getLocalVariableName ( pc , <NUM_LIT:3> ) } ) ) ; writeNewLine ( ) ; } public void _dload ( int pc , int index ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DLOAD ] , getLocalVariableName ( pc , index , true ) } ) ) ; writeNewLine ( ) ; } public void _dmul ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DMUL ] ) ; writeNewLine ( ) ; } public void _dneg ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DNEG ] ) ; writeNewLine ( ) ; } public void _drem ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DREM ] ) ; writeNewLine ( ) ; } public void _dreturn ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DRETURN ] ) ; writeNewLine ( ) ; } public void _dstore_0 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DSTORE_0 ] , getLocalVariableName ( pc , <NUM_LIT:0> ) } ) ) ; writeNewLine ( ) ; } public void _dstore_1 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DSTORE_1 ] , getLocalVariableName ( pc , <NUM_LIT:1> ) } ) ) ; writeNewLine ( ) ; } public void _dstore_2 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DSTORE_2 ] , getLocalVariableName ( pc , <NUM_LIT:2> ) } ) ) ; writeNewLine ( ) ; } public void _dstore_3 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DSTORE_3 ] , getLocalVariableName ( pc , <NUM_LIT:3> ) } ) ) ; writeNewLine ( ) ; } public void _dstore ( int pc , int index ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DSTORE ] , getLocalVariableName ( pc , index , true ) } ) ) ; writeNewLine ( ) ; } public void _dsub ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DSUB ] ) ; writeNewLine ( ) ; } public void _dup_x1 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DUP_X1 ] ) ; writeNewLine ( ) ; } public void _dup_x2 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DUP_X2 ] ) ; writeNewLine ( ) ; } public void _dup ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DUP ] ) ; writeNewLine ( ) ; } public void _dup2_x1 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DUP2_X1 ] ) ; writeNewLine ( ) ; } public void _dup2_x2 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DUP2_X2 ] ) ; writeNewLine ( ) ; } public void _dup2 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . DUP2 ] ) ; writeNewLine ( ) ; } public void _f2d ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . F2D ] ) ; writeNewLine ( ) ; } public void _f2i ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . F2I ] ) ; writeNewLine ( ) ; } public void _f2l ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . F2L ] ) ; writeNewLine ( ) ; } public void _fadd ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FADD ] ) ; writeNewLine ( ) ; } public void _faload ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FALOAD ] ) ; writeNewLine ( ) ; } public void _fastore ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FASTORE ] ) ; writeNewLine ( ) ; } public void _fcmpg ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FCMPG ] ) ; writeNewLine ( ) ; } public void _fcmpl ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FCMPL ] ) ; writeNewLine ( ) ; } public void _fconst_0 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FCONST_0 ] ) ; writeNewLine ( ) ; } public void _fconst_1 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FCONST_1 ] ) ; writeNewLine ( ) ; } public void _fconst_2 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FCONST_2 ] ) ; writeNewLine ( ) ; } public void _fdiv ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FDIV ] ) ; writeNewLine ( ) ; } public void _fload_0 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FLOAD_0 ] , getLocalVariableName ( pc , <NUM_LIT:0> ) } ) ) ; writeNewLine ( ) ; } public void _fload_1 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FLOAD_1 ] , getLocalVariableName ( pc , <NUM_LIT:1> ) } ) ) ; writeNewLine ( ) ; } public void _fload_2 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FLOAD_2 ] , getLocalVariableName ( pc , <NUM_LIT:2> ) } ) ) ; writeNewLine ( ) ; } public void _fload_3 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FLOAD_3 ] , getLocalVariableName ( pc , <NUM_LIT:3> ) } ) ) ; writeNewLine ( ) ; } public void _fload ( int pc , int index ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FLOAD ] , getLocalVariableName ( pc , index , true ) } ) ) ; writeNewLine ( ) ; } public void _fmul ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FMUL ] ) ; writeNewLine ( ) ; } public void _fneg ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FNEG ] ) ; writeNewLine ( ) ; } public void _frem ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FREM ] ) ; writeNewLine ( ) ; } public void _freturn ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FRETURN ] ) ; writeNewLine ( ) ; } public void _fstore_0 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FSTORE_0 ] , getLocalVariableName ( pc , <NUM_LIT:0> ) } ) ) ; writeNewLine ( ) ; } public void _fstore_1 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FSTORE_1 ] , getLocalVariableName ( pc , <NUM_LIT:1> ) } ) ) ; writeNewLine ( ) ; } public void _fstore_2 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FSTORE_2 ] , getLocalVariableName ( pc , <NUM_LIT:2> ) } ) ) ; writeNewLine ( ) ; } public void _fstore_3 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FSTORE_3 ] , getLocalVariableName ( pc , <NUM_LIT:3> ) } ) ) ; writeNewLine ( ) ; } public void _fstore ( int pc , int index ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FSTORE ] , getLocalVariableName ( pc , index , true ) } ) ) ; writeNewLine ( ) ; } public void _fsub ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . FSUB ] ) ; writeNewLine ( ) ; } public void _getfield ( int pc , int index , IConstantPoolEntry constantFieldref ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_getfield , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . GETFIELD ] , Integer . toString ( index ) , returnDeclaringClassName ( constantFieldref ) , new String ( constantFieldref . getFieldName ( ) ) , returnClassName ( Signature . toCharArray ( constantFieldref . getFieldDescriptor ( ) ) ) } ) ) ; writeNewLine ( ) ; } public void _getstatic ( int pc , int index , IConstantPoolEntry constantFieldref ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_getstatic , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . GETSTATIC ] , Integer . toString ( index ) , returnDeclaringClassName ( constantFieldref ) , new String ( constantFieldref . getFieldName ( ) ) , returnClassName ( Signature . toCharArray ( constantFieldref . getFieldDescriptor ( ) ) ) } ) ) ; writeNewLine ( ) ; } public void _goto_w ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . GOTO_W ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _goto ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . GOTO ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _i2b ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . I2B ] ) ; writeNewLine ( ) ; } public void _i2c ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . I2C ] ) ; writeNewLine ( ) ; } public void _i2d ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . I2D ] ) ; writeNewLine ( ) ; } public void _i2f ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . I2F ] ) ; writeNewLine ( ) ; } public void _i2l ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . I2L ] ) ; writeNewLine ( ) ; } public void _i2s ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . I2S ] ) ; writeNewLine ( ) ; } public void _iadd ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IADD ] ) ; writeNewLine ( ) ; } public void _iaload ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IALOAD ] ) ; writeNewLine ( ) ; } public void _iand ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IAND ] ) ; writeNewLine ( ) ; } public void _iastore ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IASTORE ] ) ; writeNewLine ( ) ; } public void _if_acmpeq ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IF_ACMPEQ ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _if_acmpne ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IF_ACMPNE ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _if_icmpeq ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IF_ICMPEQ ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _if_icmpge ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IF_ICMPGE ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _if_icmpgt ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IF_ICMPGT ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _if_icmple ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IF_ICMPLE ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _if_icmplt ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IF_ICMPLT ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _if_icmpne ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IF_ICMPNE ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _iconst_0 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ICONST_0 ] ) ; writeNewLine ( ) ; } public void _iconst_1 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ICONST_1 ] ) ; writeNewLine ( ) ; } public void _iconst_2 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ICONST_2 ] ) ; writeNewLine ( ) ; } public void _iconst_3 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ICONST_3 ] ) ; writeNewLine ( ) ; } public void _iconst_4 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ICONST_4 ] ) ; writeNewLine ( ) ; } public void _iconst_5 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ICONST_5 ] ) ; writeNewLine ( ) ; } public void _iconst_m1 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ICONST_M1 ] ) ; writeNewLine ( ) ; } public void _idiv ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IDIV ] ) ; writeNewLine ( ) ; } public void _ifeq ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IFEQ ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _ifge ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IFGE ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _ifgt ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IFGT ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _ifle ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IFLE ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _iflt ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IFLT ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _ifne ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IFNE ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _ifnonnull ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IFNONNULL ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _ifnull ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IFNULL ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _iinc ( int pc , int index , int _const ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_iinc , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IINC ] , Integer . toString ( index ) , Integer . toString ( _const ) , getLocalVariableName ( pc , index , false ) } ) ) ; writeNewLine ( ) ; } public void _iload_0 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ILOAD_0 ] , getLocalVariableName ( pc , <NUM_LIT:0> ) } ) ) ; writeNewLine ( ) ; } public void _iload_1 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ILOAD_1 ] , getLocalVariableName ( pc , <NUM_LIT:1> ) } ) ) ; writeNewLine ( ) ; } public void _iload_2 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ILOAD_2 ] , getLocalVariableName ( pc , <NUM_LIT:2> ) } ) ) ; writeNewLine ( ) ; } public void _iload_3 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ILOAD_3 ] , getLocalVariableName ( pc , <NUM_LIT:3> ) } ) ) ; writeNewLine ( ) ; } public void _iload ( int pc , int index ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ILOAD ] , getLocalVariableName ( pc , index , true ) } ) ) ; writeNewLine ( ) ; } public void _imul ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IMUL ] ) ; writeNewLine ( ) ; } public void _ineg ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . INEG ] ) ; writeNewLine ( ) ; } public void _instanceof ( int pc , int index , IConstantPoolEntry constantClass ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_instanceof , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . INSTANCEOF ] , Integer . toString ( index ) , returnConstantClassName ( constantClass ) } ) ) ; writeNewLine ( ) ; } public void _invokedynamic ( int pc , int index , IConstantPoolEntry nameEntry , IConstantPoolEntry descriptorEntry ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_invokedynamic , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . INVOKEDYNAMIC ] , Integer . toString ( index ) , Util . toString ( null , nameEntry . getUtf8Value ( ) , descriptorEntry . getUtf8Value ( ) , true , isCompact ( ) ) } ) ) ; writeNewLine ( ) ; } public void _invokeinterface ( int pc , int index , byte nargs , IConstantPoolEntry constantInterfaceMethodref ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_invokeinterface , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . INVOKEINTERFACE ] , Integer . toString ( index ) , Integer . toString ( nargs ) , Util . toString ( constantInterfaceMethodref . getClassName ( ) , constantInterfaceMethodref . getMethodName ( ) , constantInterfaceMethodref . getMethodDescriptor ( ) , true , isCompact ( ) ) } ) ) ; writeNewLine ( ) ; } public void _invokespecial ( int pc , int index , IConstantPoolEntry constantMethodref ) { dumpPcNumber ( pc ) ; final String signature = returnMethodSignature ( constantMethodref ) ; this . buffer . append ( Messages . bind ( Messages . classformat_invokespecial , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . INVOKESPECIAL ] , Integer . toString ( index ) , signature } ) ) ; writeNewLine ( ) ; } public void _invokestatic ( int pc , int index , IConstantPoolEntry constantMethodref ) { dumpPcNumber ( pc ) ; final String signature = returnMethodSignature ( constantMethodref ) ; this . buffer . append ( Messages . bind ( Messages . classformat_invokestatic , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . INVOKESTATIC ] , Integer . toString ( index ) , signature } ) ) ; writeNewLine ( ) ; } public void _invokevirtual ( int pc , int index , IConstantPoolEntry constantMethodref ) { dumpPcNumber ( pc ) ; final String signature = returnMethodSignature ( constantMethodref ) ; this . buffer . append ( Messages . bind ( Messages . classformat_invokevirtual , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . INVOKEVIRTUAL ] , Integer . toString ( index ) , signature } ) ) ; writeNewLine ( ) ; } public void _ior ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IOR ] ) ; writeNewLine ( ) ; } public void _irem ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IREM ] ) ; writeNewLine ( ) ; } public void _ireturn ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IRETURN ] ) ; writeNewLine ( ) ; } public void _ishl ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ISHL ] ) ; writeNewLine ( ) ; } public void _ishr ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ISHR ] ) ; writeNewLine ( ) ; } public void _istore_0 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ISTORE_0 ] , getLocalVariableName ( pc , <NUM_LIT:0> ) } ) ) ; writeNewLine ( ) ; } public void _istore_1 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ISTORE_1 ] , getLocalVariableName ( pc , <NUM_LIT:1> ) } ) ) ; writeNewLine ( ) ; } public void _istore_2 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ISTORE_2 ] , getLocalVariableName ( pc , <NUM_LIT:2> ) } ) ) ; writeNewLine ( ) ; } public void _istore_3 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ISTORE_3 ] , getLocalVariableName ( pc , <NUM_LIT:3> ) } ) ) ; writeNewLine ( ) ; } public void _istore ( int pc , int index ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ISTORE ] , getLocalVariableName ( pc , index , true ) } ) ) ; writeNewLine ( ) ; } public void _isub ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . ISUB ] ) ; writeNewLine ( ) ; } public void _iushr ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IUSHR ] ) ; writeNewLine ( ) ; } public void _ixor ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IXOR ] ) ; writeNewLine ( ) ; } public void _jsr_w ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . JSR_W ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _jsr ( int pc , int branchOffset ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . JSR ] ) . append ( Messages . disassembler_space ) . append ( branchOffset + pc ) ; writeNewLine ( ) ; } public void _l2d ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . L2D ] ) ; writeNewLine ( ) ; } public void _l2f ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . L2F ] ) ; writeNewLine ( ) ; } public void _l2i ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . L2I ] ) ; writeNewLine ( ) ; } public void _ladd ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LADD ] ) ; writeNewLine ( ) ; } public void _laload ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LALOAD ] ) ; writeNewLine ( ) ; } public void _land ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LAND ] ) ; writeNewLine ( ) ; } public void _lastore ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LASTORE ] ) ; writeNewLine ( ) ; } public void _lcmp ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LCMP ] ) ; writeNewLine ( ) ; } public void _lconst_0 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LCONST_0 ] ) ; writeNewLine ( ) ; } public void _lconst_1 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LCONST_1 ] ) ; writeNewLine ( ) ; } public void _ldc_w ( int pc , int index , IConstantPoolEntry constantPoolEntry ) { dumpPcNumber ( pc ) ; switch ( constantPoolEntry . getKind ( ) ) { case IConstantPoolConstant . CONSTANT_Float : this . buffer . append ( Messages . bind ( Messages . classformat_ldc_w_float , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LDC_W ] , Integer . toString ( index ) , Float . toString ( constantPoolEntry . getFloatValue ( ) ) } ) ) ; break ; case IConstantPoolConstant . CONSTANT_Integer : this . buffer . append ( Messages . bind ( Messages . classformat_ldc_w_integer , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LDC_W ] , Integer . toString ( index ) , Integer . toString ( constantPoolEntry . getIntegerValue ( ) ) } ) ) ; break ; case IConstantPoolConstant . CONSTANT_String : this . buffer . append ( Messages . bind ( Messages . classformat_ldc_w_string , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LDC_W ] , Integer . toString ( index ) , Disassembler . escapeString ( constantPoolEntry . getStringValue ( ) ) } ) ) ; break ; case IConstantPoolConstant . CONSTANT_Class : this . buffer . append ( Messages . bind ( Messages . classformat_ldc_w_class , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LDC_W ] , Integer . toString ( index ) , returnConstantClassName ( constantPoolEntry ) } ) ) ; } writeNewLine ( ) ; } public void _ldc ( int pc , int index , IConstantPoolEntry constantPoolEntry ) { dumpPcNumber ( pc ) ; switch ( constantPoolEntry . getKind ( ) ) { case IConstantPoolConstant . CONSTANT_Float : this . buffer . append ( Messages . bind ( Messages . classformat_ldc_w_float , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LDC ] , Integer . toString ( index ) , Float . toString ( constantPoolEntry . getFloatValue ( ) ) } ) ) ; break ; case IConstantPoolConstant . CONSTANT_Integer : this . buffer . append ( Messages . bind ( Messages . classformat_ldc_w_integer , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LDC ] , Integer . toString ( index ) , Integer . toString ( constantPoolEntry . getIntegerValue ( ) ) } ) ) ; break ; case IConstantPoolConstant . CONSTANT_String : this . buffer . append ( Messages . bind ( Messages . classformat_ldc_w_string , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LDC ] , Integer . toString ( index ) , Disassembler . escapeString ( constantPoolEntry . getStringValue ( ) ) } ) ) ; break ; case IConstantPoolConstant . CONSTANT_Class : this . buffer . append ( Messages . bind ( Messages . classformat_ldc_w_class , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LDC ] , Integer . toString ( index ) , returnConstantClassName ( constantPoolEntry ) } ) ) ; } writeNewLine ( ) ; } public void _ldc2_w ( int pc , int index , IConstantPoolEntry constantPoolEntry ) { dumpPcNumber ( pc ) ; switch ( constantPoolEntry . getKind ( ) ) { case IConstantPoolConstant . CONSTANT_Long : this . buffer . append ( Messages . bind ( Messages . classformat_ldc2_w_long , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LDC2_W ] , Integer . toString ( index ) , Long . toString ( constantPoolEntry . getLongValue ( ) ) } ) ) ; break ; case IConstantPoolConstant . CONSTANT_Double : this . buffer . append ( Messages . bind ( Messages . classformat_ldc2_w_double , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LDC2_W ] , Integer . toString ( index ) , Double . toString ( constantPoolEntry . getDoubleValue ( ) ) } ) ) ; } writeNewLine ( ) ; } public void _ldiv ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LDIV ] ) ; writeNewLine ( ) ; } public void _lload_0 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LLOAD_0 ] , getLocalVariableName ( pc , <NUM_LIT:0> ) } ) ) ; writeNewLine ( ) ; } public void _lload_1 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LLOAD_1 ] , getLocalVariableName ( pc , <NUM_LIT:1> ) } ) ) ; writeNewLine ( ) ; } public void _lload_2 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LLOAD_2 ] , getLocalVariableName ( pc , <NUM_LIT:2> ) } ) ) ; writeNewLine ( ) ; } public void _lload_3 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LLOAD_3 ] , getLocalVariableName ( pc , <NUM_LIT:3> ) } ) ) ; writeNewLine ( ) ; } public void _lload ( int pc , int index ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_load , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LLOAD ] , getLocalVariableName ( pc , index , true ) } ) ) ; writeNewLine ( ) ; } public void _lmul ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LMUL ] ) ; writeNewLine ( ) ; } public void _lneg ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LNEG ] ) ; writeNewLine ( ) ; } public void _lookupswitch ( int pc , int defaultoffset , int npairs , int [ ] [ ] offset_pairs ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LOOKUPSWITCH ] ) . append ( "<STR_LIT>" ) . append ( defaultoffset + pc ) ; writeNewLine ( ) ; for ( int i = <NUM_LIT:0> ; i < npairs ; i ++ ) { writeExtraTabs ( <NUM_LIT:3> ) ; this . buffer . append ( "<STR_LIT>" ) . append ( offset_pairs [ i ] [ <NUM_LIT:0> ] ) . append ( "<STR_LIT::U+0020>" ) . append ( offset_pairs [ i ] [ <NUM_LIT:1> ] + pc ) ; writeNewLine ( ) ; } } public void _lor ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LOR ] ) ; writeNewLine ( ) ; } public void _lrem ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LREM ] ) ; writeNewLine ( ) ; } public void _lreturn ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LRETURN ] ) ; writeNewLine ( ) ; } public void _lshl ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LSHL ] ) ; writeNewLine ( ) ; } public void _lshr ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LSHR ] ) ; writeNewLine ( ) ; } public void _lstore_0 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LSTORE_0 ] , getLocalVariableName ( pc , <NUM_LIT:0> ) } ) ) ; writeNewLine ( ) ; } public void _lstore_1 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LSTORE_1 ] , getLocalVariableName ( pc , <NUM_LIT:1> ) } ) ) ; writeNewLine ( ) ; } public void _lstore_2 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LSTORE_2 ] , getLocalVariableName ( pc , <NUM_LIT:2> ) } ) ) ; writeNewLine ( ) ; } public void _lstore_3 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LSTORE_3 ] , getLocalVariableName ( pc , <NUM_LIT:3> ) } ) ) ; writeNewLine ( ) ; } public void _lstore ( int pc , int index ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_store , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LSTORE ] , getLocalVariableName ( pc , index , true ) } ) ) ; writeNewLine ( ) ; } public void _lsub ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LSUB ] ) ; writeNewLine ( ) ; } public void _lushr ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LUSHR ] ) ; writeNewLine ( ) ; } public void _lxor ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . LXOR ] ) ; writeNewLine ( ) ; } public void _monitorenter ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . MONITORENTER ] ) ; writeNewLine ( ) ; } public void _monitorexit ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . MONITOREXIT ] ) ; writeNewLine ( ) ; } public void _multianewarray ( int pc , int index , int dimensions , IConstantPoolEntry constantClass ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_multianewarray , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . MULTIANEWARRAY ] , Integer . toString ( index ) , returnConstantClassName ( constantClass ) } ) ) ; writeNewLine ( ) ; } public void _new ( int pc , int index , IConstantPoolEntry constantClass ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_new , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . NEW ] , Integer . toString ( index ) , returnConstantClassName ( constantClass ) } ) ) ; writeNewLine ( ) ; } public void _newarray ( int pc , int atype ) { dumpPcNumber ( pc ) ; switch ( atype ) { case T_BOOLEAN : this . buffer . append ( Messages . bind ( Messages . classformat_newarray_boolean , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . NEWARRAY ] , Integer . toString ( atype ) } ) ) ; break ; case T_CHAR : this . buffer . append ( Messages . bind ( Messages . classformat_newarray_char , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . NEWARRAY ] , Integer . toString ( atype ) } ) ) ; break ; case T_FLOAT : this . buffer . append ( Messages . bind ( Messages . classformat_newarray_float , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . NEWARRAY ] , Integer . toString ( atype ) } ) ) ; break ; case T_DOUBLE : this . buffer . append ( Messages . bind ( Messages . classformat_newarray_double , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . NEWARRAY ] , Integer . toString ( atype ) } ) ) ; break ; case T_BYTE : this . buffer . append ( Messages . bind ( Messages . classformat_newarray_byte , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . NEWARRAY ] , Integer . toString ( atype ) } ) ) ; break ; case T_SHORT : this . buffer . append ( Messages . bind ( Messages . classformat_newarray_short , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . NEWARRAY ] , Integer . toString ( atype ) } ) ) ; break ; case T_INT : this . buffer . append ( Messages . bind ( Messages . classformat_newarray_int , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . NEWARRAY ] , Integer . toString ( atype ) } ) ) ; break ; case T_LONG : this . buffer . append ( Messages . bind ( Messages . classformat_newarray_long , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . NEWARRAY ] , Integer . toString ( atype ) } ) ) ; } writeNewLine ( ) ; } public void _nop ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . NOP ] ) ; writeNewLine ( ) ; } public void _pop ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . POP ] ) ; writeNewLine ( ) ; } public void _pop2 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . POP2 ] ) ; writeNewLine ( ) ; } public void _putfield ( int pc , int index , IConstantPoolEntry constantFieldref ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_putfield , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . PUTFIELD ] , Integer . toString ( index ) , returnDeclaringClassName ( constantFieldref ) , new String ( constantFieldref . getFieldName ( ) ) , returnClassName ( Signature . toCharArray ( constantFieldref . getFieldDescriptor ( ) ) ) } ) ) ; writeNewLine ( ) ; } public void _putstatic ( int pc , int index , IConstantPoolEntry constantFieldref ) { dumpPcNumber ( pc ) ; this . buffer . append ( Messages . bind ( Messages . classformat_putstatic , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . PUTSTATIC ] , Integer . toString ( index ) , returnDeclaringClassName ( constantFieldref ) , new String ( constantFieldref . getFieldName ( ) ) , returnClassName ( Signature . toCharArray ( constantFieldref . getFieldDescriptor ( ) ) ) } ) ) ; writeNewLine ( ) ; } public void _ret ( int pc , int index ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . RET ] ) . append ( Messages . disassembler_space ) . append ( index ) ; writeNewLine ( ) ; } public void _return ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . RETURN ] ) ; writeNewLine ( ) ; } public void _saload ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . SALOAD ] ) ; writeNewLine ( ) ; } public void _sastore ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . SASTORE ] ) ; writeNewLine ( ) ; } public void _sipush ( int pc , short value ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . SIPUSH ] ) . append ( Messages . disassembler_space ) . append ( value ) ; writeNewLine ( ) ; } public void _swap ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . SWAP ] ) ; writeNewLine ( ) ; } public void _tableswitch ( int pc , int defaultoffset , int low , int high , int [ ] jump_offsets ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . TABLESWITCH ] ) . append ( "<STR_LIT>" ) . append ( defaultoffset + pc ) ; writeNewLine ( ) ; for ( int i = low ; i < high + <NUM_LIT:1> ; i ++ ) { writeExtraTabs ( <NUM_LIT:3> ) ; this . buffer . append ( "<STR_LIT>" ) . append ( i ) . append ( "<STR_LIT::U+0020>" ) . append ( jump_offsets [ i - low ] + pc ) ; writeNewLine ( ) ; } } public void _wide ( int pc , int iincopcode , int index , int _const ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . WIDE ] ) ; writeNewLine ( ) ; _iinc ( pc + <NUM_LIT:1> , index , _const ) ; } public void _wide ( int pc , int opcode , int index ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . WIDE ] ) ; writeNewLine ( ) ; switch ( opcode ) { case IOpcodeMnemonics . ILOAD : _iload ( pc + <NUM_LIT:1> , index ) ; break ; case IOpcodeMnemonics . FLOAD : _fload ( pc + <NUM_LIT:1> , index ) ; break ; case IOpcodeMnemonics . ALOAD : _aload ( pc + <NUM_LIT:1> , index ) ; break ; case IOpcodeMnemonics . LLOAD : _lload ( pc + <NUM_LIT:1> , index ) ; break ; case IOpcodeMnemonics . DLOAD : _dload ( pc + <NUM_LIT:1> , index ) ; break ; case IOpcodeMnemonics . ISTORE : _istore ( pc + <NUM_LIT:1> , index ) ; break ; case IOpcodeMnemonics . FSTORE : _fstore ( pc + <NUM_LIT:1> , index ) ; break ; case IOpcodeMnemonics . ASTORE : _astore ( pc + <NUM_LIT:1> , index ) ; break ; case IOpcodeMnemonics . LSTORE : _lstore ( pc + <NUM_LIT:1> , index ) ; break ; case IOpcodeMnemonics . DSTORE : _dstore ( pc + <NUM_LIT:1> , index ) ; break ; case IOpcodeMnemonics . RET : _ret ( pc + <NUM_LIT:1> , index ) ; } } public void _breakpoint ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . BREAKPOINT ] ) ; writeNewLine ( ) ; } public void _impdep1 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IMPDEP1 ] ) ; writeNewLine ( ) ; } public void _impdep2 ( int pc ) { dumpPcNumber ( pc ) ; this . buffer . append ( OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . IMPDEP2 ] ) ; writeNewLine ( ) ; } private boolean isCompact ( ) { return ( this . mode & ClassFileBytesDisassembler . COMPACT ) != <NUM_LIT:0> ; } private String returnConstantClassName ( IConstantPoolEntry constantClass ) { char [ ] className = constantClass . getClassInfoName ( ) ; if ( className . length == <NUM_LIT:0> ) { return EMPTY_CLASS_NAME ; } switch ( className [ <NUM_LIT:0> ] ) { case '<CHAR_LIT:[>' : StringBuffer classNameBuffer = new StringBuffer ( ) ; Util . appendTypeSignature ( className , <NUM_LIT:0> , classNameBuffer , isCompact ( ) ) ; return classNameBuffer . toString ( ) ; default : return returnClassName ( className ) ; } } private String returnClassName ( char [ ] classInfoName ) { if ( classInfoName . length == <NUM_LIT:0> ) { return EMPTY_CLASS_NAME ; } else if ( isCompact ( ) ) { int lastIndexOfSlash = CharOperation . lastIndexOf ( '<CHAR_LIT:/>' , classInfoName ) ; if ( lastIndexOfSlash != - <NUM_LIT:1> ) { return new String ( classInfoName , lastIndexOfSlash + <NUM_LIT:1> , classInfoName . length - lastIndexOfSlash - <NUM_LIT:1> ) ; } } CharOperation . replace ( classInfoName , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; return new String ( classInfoName ) ; } private String returnDeclaringClassName ( IConstantPoolEntry constantRef ) { final char [ ] className = constantRef . getClassName ( ) ; return returnClassName ( className ) ; } private String returnMethodSignature ( IConstantPoolEntry constantMethodref ) { final char [ ] methodDescriptor = constantMethodref . getMethodDescriptor ( ) ; CharOperation . replace ( methodDescriptor , '<CHAR_LIT>' , '<CHAR_LIT>' ) ; final char [ ] signature = Util . toString ( constantMethodref . getClassName ( ) , constantMethodref . getMethodName ( ) , methodDescriptor , true , isCompact ( ) ) . toCharArray ( ) ; CharOperation . replace ( signature , '<CHAR_LIT>' , '<CHAR_LIT>' ) ; return String . valueOf ( signature ) ; } private void writeNewLine ( ) { this . buffer . append ( this . lineSeparator ) ; } private void writeTabs ( ) { for ( int i = <NUM_LIT:0> , max = this . tabNumber ; i < max ; i ++ ) { this . buffer . append ( Messages . disassembler_indentation ) ; } } private void writeExtraTabs ( int extraTabs ) { for ( int i = <NUM_LIT:0> , max = this . tabNumber + extraTabs ; i < max ; i ++ ) { this . buffer . append ( Messages . disassembler_indentation ) ; } } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . Signature ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . util . * ; import org . eclipse . jdt . internal . compiler . codegen . AttributeNamesConstants ; import org . eclipse . jdt . internal . compiler . lookup . TypeConstants ; public class Disassembler extends ClassFileBytesDisassembler { private static final char [ ] ANY_EXCEPTION = Messages . classfileformat_anyexceptionhandler . toCharArray ( ) ; private static final String VERSION_UNKNOWN = Messages . classfileformat_versionUnknown ; private boolean appendModifier ( StringBuffer buffer , int accessFlags , int modifierConstant , String modifier , boolean firstModifier ) { if ( ( accessFlags & modifierConstant ) != <NUM_LIT:0> ) { if ( ! firstModifier ) { buffer . append ( Messages . disassembler_space ) ; } if ( firstModifier ) { firstModifier = false ; } buffer . append ( modifier ) ; } return firstModifier ; } private void decodeModifiers ( StringBuffer buffer , int accessFlags , int [ ] checkBits ) { decodeModifiers ( buffer , accessFlags , false , false , checkBits ) ; } private void decodeModifiers ( StringBuffer buffer , int accessFlags , boolean printDefault , boolean asBridge , int [ ] checkBits ) { if ( checkBits == null ) return ; boolean firstModifier = true ; for ( int i = <NUM_LIT:0> , max = checkBits . length ; i < max ; i ++ ) { switch ( checkBits [ i ] ) { case IModifierConstants . ACC_PUBLIC : firstModifier = appendModifier ( buffer , accessFlags , IModifierConstants . ACC_PUBLIC , "<STR_LIT>" , firstModifier ) ; break ; case IModifierConstants . ACC_PROTECTED : firstModifier = appendModifier ( buffer , accessFlags , IModifierConstants . ACC_PROTECTED , "<STR_LIT>" , firstModifier ) ; break ; case IModifierConstants . ACC_PRIVATE : firstModifier = appendModifier ( buffer , accessFlags , IModifierConstants . ACC_PRIVATE , "<STR_LIT>" , firstModifier ) ; break ; case IModifierConstants . ACC_ABSTRACT : firstModifier = appendModifier ( buffer , accessFlags , IModifierConstants . ACC_ABSTRACT , "<STR_LIT>" , firstModifier ) ; break ; case IModifierConstants . ACC_STATIC : firstModifier = appendModifier ( buffer , accessFlags , IModifierConstants . ACC_STATIC , "<STR_LIT>" , firstModifier ) ; break ; case IModifierConstants . ACC_FINAL : firstModifier = appendModifier ( buffer , accessFlags , IModifierConstants . ACC_FINAL , "<STR_LIT>" , firstModifier ) ; break ; case IModifierConstants . ACC_SYNCHRONIZED : firstModifier = appendModifier ( buffer , accessFlags , IModifierConstants . ACC_SYNCHRONIZED , "<STR_LIT>" , firstModifier ) ; break ; case IModifierConstants . ACC_NATIVE : firstModifier = appendModifier ( buffer , accessFlags , IModifierConstants . ACC_NATIVE , "<STR_LIT>" , firstModifier ) ; break ; case IModifierConstants . ACC_STRICT : firstModifier = appendModifier ( buffer , accessFlags , IModifierConstants . ACC_STRICT , "<STR_LIT>" , firstModifier ) ; break ; case IModifierConstants . ACC_TRANSIENT : firstModifier = appendModifier ( buffer , accessFlags , IModifierConstants . ACC_TRANSIENT , "<STR_LIT>" , firstModifier ) ; break ; case IModifierConstants . ACC_VOLATILE : if ( asBridge ) { firstModifier = appendModifier ( buffer , accessFlags , IModifierConstants . ACC_BRIDGE , "<STR_LIT>" , firstModifier ) ; } else { firstModifier = appendModifier ( buffer , accessFlags , IModifierConstants . ACC_VOLATILE , "<STR_LIT>" , firstModifier ) ; } break ; case IModifierConstants . ACC_ENUM : firstModifier = appendModifier ( buffer , accessFlags , IModifierConstants . ACC_ENUM , "<STR_LIT>" , firstModifier ) ; break ; } } if ( ! firstModifier ) { if ( ! printDefault ) buffer . append ( Messages . disassembler_space ) ; } else if ( printDefault ) { buffer . append ( "<STR_LIT:default>" ) ; } } private void decodeModifiersForField ( StringBuffer buffer , int accessFlags ) { decodeModifiers ( buffer , accessFlags , new int [ ] { IModifierConstants . ACC_PUBLIC , IModifierConstants . ACC_PROTECTED , IModifierConstants . ACC_PRIVATE , IModifierConstants . ACC_STATIC , IModifierConstants . ACC_FINAL , IModifierConstants . ACC_TRANSIENT , IModifierConstants . ACC_VOLATILE , IModifierConstants . ACC_ENUM } ) ; } private void decodeModifiersForFieldForWorkingCopy ( StringBuffer buffer , int accessFlags ) { decodeModifiers ( buffer , accessFlags , new int [ ] { IModifierConstants . ACC_PUBLIC , IModifierConstants . ACC_PROTECTED , IModifierConstants . ACC_PRIVATE , IModifierConstants . ACC_STATIC , IModifierConstants . ACC_FINAL , IModifierConstants . ACC_TRANSIENT , IModifierConstants . ACC_VOLATILE , } ) ; } private final void decodeModifiersForInnerClasses ( StringBuffer buffer , int accessFlags , boolean printDefault ) { decodeModifiers ( buffer , accessFlags , printDefault , false , new int [ ] { IModifierConstants . ACC_PUBLIC , IModifierConstants . ACC_PROTECTED , IModifierConstants . ACC_PRIVATE , IModifierConstants . ACC_ABSTRACT , IModifierConstants . ACC_STATIC , IModifierConstants . ACC_FINAL , } ) ; } private final void decodeModifiersForMethod ( StringBuffer buffer , int accessFlags ) { decodeModifiers ( buffer , accessFlags , false , true , new int [ ] { IModifierConstants . ACC_PUBLIC , IModifierConstants . ACC_PROTECTED , IModifierConstants . ACC_PRIVATE , IModifierConstants . ACC_ABSTRACT , IModifierConstants . ACC_STATIC , IModifierConstants . ACC_FINAL , IModifierConstants . ACC_SYNCHRONIZED , IModifierConstants . ACC_NATIVE , IModifierConstants . ACC_STRICT , IModifierConstants . ACC_BRIDGE , } ) ; } private final void decodeModifiersForType ( StringBuffer buffer , int accessFlags ) { decodeModifiers ( buffer , accessFlags , new int [ ] { IModifierConstants . ACC_PUBLIC , IModifierConstants . ACC_ABSTRACT , IModifierConstants . ACC_FINAL , } ) ; } public static String escapeString ( String s ) { return decodeStringValue ( s ) ; } static String decodeStringValue ( char [ ] chars ) { StringBuffer buffer = new StringBuffer ( ) ; for ( int i = <NUM_LIT:0> , max = chars . length ; i < max ; i ++ ) { char c = chars [ i ] ; escapeChar ( buffer , c ) ; } return buffer . toString ( ) ; } private static void escapeChar ( StringBuffer buffer , char c ) { switch ( c ) { case '<STR_LIT>' : buffer . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT:\t>' : buffer . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT:\n>' : buffer . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : buffer . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : buffer . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : buffer . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : buffer . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : buffer . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : buffer . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : buffer . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : buffer . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : buffer . append ( "<STR_LIT>" ) ; break ; case '<STR_LIT>' : buffer . append ( "<STR_LIT>" ) ; break ; default : buffer . append ( c ) ; } } static String decodeStringValue ( String s ) { return decodeStringValue ( s . toCharArray ( ) ) ; } public String disassemble ( byte [ ] classFileBytes , String lineSeparator ) throws ClassFormatException { try { return disassemble ( new ClassFileReader ( classFileBytes , IClassFileReader . ALL ) , lineSeparator , ClassFileBytesDisassembler . DEFAULT ) ; } catch ( ArrayIndexOutOfBoundsException e ) { throw new ClassFormatException ( e . getMessage ( ) , e ) ; } } public String disassemble ( byte [ ] classFileBytes , String lineSeparator , int mode ) throws ClassFormatException { try { return disassemble ( new ClassFileReader ( classFileBytes , IClassFileReader . ALL ) , lineSeparator , mode ) ; } catch ( ArrayIndexOutOfBoundsException e ) { throw new ClassFormatException ( e . getMessage ( ) , e ) ; } } private void disassemble ( IAnnotation annotation , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; final int typeIndex = annotation . getTypeIndex ( ) ; final char [ ] typeName = CharOperation . replaceOnCopy ( annotation . getTypeName ( ) , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; buffer . append ( Messages . bind ( Messages . disassembler_annotationentrystart , new String [ ] { Integer . toString ( typeIndex ) , new String ( returnClassName ( Signature . toCharArray ( typeName ) , '<CHAR_LIT:.>' , mode ) ) } ) ) ; final IAnnotationComponent [ ] components = annotation . getComponents ( ) ; for ( int i = <NUM_LIT:0> , max = components . length ; i < max ; i ++ ) { disassemble ( components [ i ] , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; } writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; buffer . append ( Messages . disassembler_annotationentryend ) ; } private void disassemble ( IAnnotationComponent annotationComponent , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; buffer . append ( Messages . bind ( Messages . disassembler_annotationcomponent , new String [ ] { Integer . toString ( annotationComponent . getComponentNameIndex ( ) ) , new String ( annotationComponent . getComponentName ( ) ) } ) ) ; disassemble ( annotationComponent . getComponentValue ( ) , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; } private void disassemble ( IAnnotationComponentValue annotationComponentValue , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { switch ( annotationComponentValue . getTag ( ) ) { case IAnnotationComponentValue . BYTE_TAG : case IAnnotationComponentValue . CHAR_TAG : case IAnnotationComponentValue . DOUBLE_TAG : case IAnnotationComponentValue . FLOAT_TAG : case IAnnotationComponentValue . INTEGER_TAG : case IAnnotationComponentValue . LONG_TAG : case IAnnotationComponentValue . SHORT_TAG : case IAnnotationComponentValue . BOOLEAN_TAG : case IAnnotationComponentValue . STRING_TAG : IConstantPoolEntry constantPoolEntry = annotationComponentValue . getConstantValue ( ) ; String value = null ; switch ( constantPoolEntry . getKind ( ) ) { case IConstantPoolConstant . CONSTANT_Long : value = constantPoolEntry . getLongValue ( ) + "<STR_LIT>" ; break ; case IConstantPoolConstant . CONSTANT_Float : value = constantPoolEntry . getFloatValue ( ) + "<STR_LIT:f>" ; break ; case IConstantPoolConstant . CONSTANT_Double : value = Double . toString ( constantPoolEntry . getDoubleValue ( ) ) ; break ; case IConstantPoolConstant . CONSTANT_Integer : StringBuffer temp = new StringBuffer ( ) ; switch ( annotationComponentValue . getTag ( ) ) { case IAnnotationComponentValue . CHAR_TAG : temp . append ( '<STR_LIT>' ) ; escapeChar ( temp , ( char ) constantPoolEntry . getIntegerValue ( ) ) ; temp . append ( '<STR_LIT>' ) ; break ; case IAnnotationComponentValue . BOOLEAN_TAG : temp . append ( constantPoolEntry . getIntegerValue ( ) == <NUM_LIT:1> ? "<STR_LIT:true>" : "<STR_LIT:false>" ) ; break ; case IAnnotationComponentValue . BYTE_TAG : temp . append ( "<STR_LIT>" ) . append ( constantPoolEntry . getIntegerValue ( ) ) ; break ; case IAnnotationComponentValue . SHORT_TAG : temp . append ( "<STR_LIT>" ) . append ( constantPoolEntry . getIntegerValue ( ) ) ; break ; case IAnnotationComponentValue . INTEGER_TAG : temp . append ( "<STR_LIT>" ) . append ( constantPoolEntry . getIntegerValue ( ) ) ; } value = String . valueOf ( temp ) ; break ; case IConstantPoolConstant . CONSTANT_Utf8 : value = "<STR_LIT:\">" + decodeStringValue ( constantPoolEntry . getUtf8Value ( ) ) + "<STR_LIT:\">" ; } buffer . append ( Messages . bind ( Messages . disassembler_annotationdefaultvalue , value ) ) ; break ; case IAnnotationComponentValue . ENUM_TAG : final int enumConstantTypeNameIndex = annotationComponentValue . getEnumConstantTypeNameIndex ( ) ; final char [ ] typeName = CharOperation . replaceOnCopy ( annotationComponentValue . getEnumConstantTypeName ( ) , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; final int enumConstantNameIndex = annotationComponentValue . getEnumConstantNameIndex ( ) ; final char [ ] constantName = annotationComponentValue . getEnumConstantName ( ) ; buffer . append ( Messages . bind ( Messages . disassembler_annotationenumvalue , new String [ ] { Integer . toString ( enumConstantTypeNameIndex ) , Integer . toString ( enumConstantNameIndex ) , new String ( returnClassName ( Signature . toCharArray ( typeName ) , '<CHAR_LIT:.>' , mode ) ) , new String ( constantName ) } ) ) ; break ; case IAnnotationComponentValue . CLASS_TAG : final int classIndex = annotationComponentValue . getClassInfoIndex ( ) ; constantPoolEntry = annotationComponentValue . getClassInfo ( ) ; final char [ ] className = CharOperation . replaceOnCopy ( constantPoolEntry . getUtf8Value ( ) , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; buffer . append ( Messages . bind ( Messages . disassembler_annotationclassvalue , new String [ ] { Integer . toString ( classIndex ) , new String ( returnClassName ( Signature . toCharArray ( className ) , '<CHAR_LIT:.>' , mode ) ) } ) ) ; break ; case IAnnotationComponentValue . ANNOTATION_TAG : buffer . append ( Messages . disassembler_annotationannotationvalue ) ; IAnnotation annotation = annotationComponentValue . getAnnotationValue ( ) ; disassemble ( annotation , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; break ; case IAnnotationComponentValue . ARRAY_TAG : buffer . append ( Messages . disassembler_annotationarrayvaluestart ) ; final IAnnotationComponentValue [ ] annotationComponentValues = annotationComponentValue . getAnnotationComponentValues ( ) ; for ( int i = <NUM_LIT:0> , max = annotationComponentValues . length ; i < max ; i ++ ) { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; disassemble ( annotationComponentValues [ i ] , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; } writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; buffer . append ( Messages . disassembler_annotationarrayvalueend ) ; } } private void disassemble ( IAnnotationDefaultAttribute annotationDefaultAttribute , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; buffer . append ( Messages . disassembler_annotationdefaultheader ) ; IAnnotationComponentValue componentValue = annotationDefaultAttribute . getMemberValue ( ) ; writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:2> ) ; disassemble ( componentValue , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; } private void disassemble ( IClassFileAttribute classFileAttribute , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; buffer . append ( Messages . bind ( Messages . disassembler_genericattributeheader , new String [ ] { new String ( classFileAttribute . getAttributeName ( ) ) , Long . toString ( classFileAttribute . getAttributeLength ( ) ) } ) ) ; } private void disassembleEnumConstructor ( IClassFileReader classFileReader , char [ ] className , IMethodInfo methodInfo , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { writeNewLine ( buffer , lineSeparator , tabNumber ) ; final ICodeAttribute codeAttribute = methodInfo . getCodeAttribute ( ) ; char [ ] methodDescriptor = methodInfo . getDescriptor ( ) ; final IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util . getAttribute ( methodInfo , IAttributeNamesConstants . RUNTIME_VISIBLE_ANNOTATIONS ) ; final IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util . getAttribute ( methodInfo , IAttributeNamesConstants . RUNTIME_INVISIBLE_ANNOTATIONS ) ; if ( runtimeInvisibleAnnotationsAttribute != null ) { disassembleAsModifier ( ( IRuntimeInvisibleAnnotationsAttribute ) runtimeInvisibleAnnotationsAttribute , buffer , lineSeparator , tabNumber , mode ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; } if ( runtimeVisibleAnnotationsAttribute != null ) { disassembleAsModifier ( ( IRuntimeVisibleAnnotationsAttribute ) runtimeVisibleAnnotationsAttribute , buffer , lineSeparator , tabNumber , mode ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; } final int accessFlags = methodInfo . getAccessFlags ( ) ; decodeModifiersForMethod ( buffer , accessFlags & IModifierConstants . ACC_PRIVATE ) ; CharOperation . replace ( methodDescriptor , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; final boolean isVarArgs = ( accessFlags & IModifierConstants . ACC_VARARGS ) != <NUM_LIT:0> ; final char [ ] signature = Signature . toCharArray ( methodDescriptor , returnClassName ( className , '<CHAR_LIT:.>' , COMPACT ) , getParameterNames ( methodDescriptor , codeAttribute , accessFlags ) , ! checkMode ( mode , COMPACT ) , false , isVarArgs ) ; int index = CharOperation . indexOf ( '<CHAR_LIT:U+002C>' , signature ) ; index = CharOperation . indexOf ( '<CHAR_LIT:U+002C>' , signature , index + <NUM_LIT:1> ) ; buffer . append ( signature , <NUM_LIT:0> , CharOperation . indexOf ( '<CHAR_LIT:(>' , signature ) + <NUM_LIT:1> ) ; buffer . append ( signature , index + <NUM_LIT:2> , signature . length - index - <NUM_LIT:2> ) ; IExceptionAttribute exceptionAttribute = methodInfo . getExceptionAttribute ( ) ; if ( exceptionAttribute != null ) { buffer . append ( "<STR_LIT>" ) ; char [ ] [ ] exceptionNames = exceptionAttribute . getExceptionNames ( ) ; int length = exceptionNames . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( i != <NUM_LIT:0> ) { buffer . append ( Messages . disassembler_comma ) . append ( Messages . disassembler_space ) ; } char [ ] exceptionName = exceptionNames [ i ] ; CharOperation . replace ( exceptionName , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; buffer . append ( returnClassName ( exceptionName , '<CHAR_LIT:.>' , mode ) ) ; } } if ( ( ( accessFlags & IModifierConstants . ACC_NATIVE ) == <NUM_LIT:0> ) && ( ( accessFlags & IModifierConstants . ACC_ABSTRACT ) == <NUM_LIT:0> ) ) { buffer . append ( "<STR_LIT>" ) ; final char [ ] returnType = Signature . getReturnType ( methodDescriptor ) ; if ( returnType . length == <NUM_LIT:1> ) { switch ( returnType [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : writeNewLine ( buffer , lineSeparator , tabNumber ) ; break ; case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; buffer . append ( "<STR_LIT>" ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; break ; default : writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; buffer . append ( "<STR_LIT>" ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; } } else { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; buffer . append ( "<STR_LIT>" ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; } buffer . append ( '<CHAR_LIT:}>' ) ; } else { buffer . append ( '<CHAR_LIT:;>' ) ; } } private void disassemble ( IClassFileReader classFileReader , char [ ] className , IMethodInfo methodInfo , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { writeNewLine ( buffer , lineSeparator , tabNumber ) ; final ICodeAttribute codeAttribute = methodInfo . getCodeAttribute ( ) ; final char [ ] methodDescriptor = methodInfo . getDescriptor ( ) ; final ISignatureAttribute signatureAttribute = ( ISignatureAttribute ) Util . getAttribute ( methodInfo , IAttributeNamesConstants . SIGNATURE ) ; final IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util . getAttribute ( methodInfo , IAttributeNamesConstants . RUNTIME_VISIBLE_ANNOTATIONS ) ; final IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util . getAttribute ( methodInfo , IAttributeNamesConstants . RUNTIME_INVISIBLE_ANNOTATIONS ) ; final IClassFileAttribute runtimeVisibleParameterAnnotationsAttribute = Util . getAttribute ( methodInfo , IAttributeNamesConstants . RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS ) ; final IClassFileAttribute runtimeInvisibleParameterAnnotationsAttribute = Util . getAttribute ( methodInfo , IAttributeNamesConstants . RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS ) ; final IClassFileAttribute annotationDefaultAttribute = Util . getAttribute ( methodInfo , IAttributeNamesConstants . ANNOTATION_DEFAULT ) ; if ( checkMode ( mode , SYSTEM | DETAILED ) ) { buffer . append ( Messages . bind ( Messages . classfileformat_methoddescriptor , new String [ ] { Integer . toString ( methodInfo . getDescriptorIndex ( ) ) , new String ( methodDescriptor ) } ) ) ; if ( methodInfo . isDeprecated ( ) ) { buffer . append ( Messages . disassembler_deprecated ) ; } writeNewLine ( buffer , lineSeparator , tabNumber ) ; if ( signatureAttribute != null ) { buffer . append ( Messages . bind ( Messages . disassembler_signatureattributeheader , new String ( signatureAttribute . getSignature ( ) ) ) ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; } if ( codeAttribute != null ) { buffer . append ( Messages . bind ( Messages . classfileformat_stacksAndLocals , new String [ ] { Integer . toString ( codeAttribute . getMaxStack ( ) ) , Integer . toString ( codeAttribute . getMaxLocals ( ) ) } ) ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; } } if ( checkMode ( mode , DETAILED ) ) { if ( runtimeInvisibleAnnotationsAttribute != null ) { disassembleAsModifier ( ( IRuntimeInvisibleAnnotationsAttribute ) runtimeInvisibleAnnotationsAttribute , buffer , lineSeparator , tabNumber , mode ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; } if ( runtimeVisibleAnnotationsAttribute != null ) { disassembleAsModifier ( ( IRuntimeVisibleAnnotationsAttribute ) runtimeVisibleAnnotationsAttribute , buffer , lineSeparator , tabNumber , mode ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; } } final int accessFlags = methodInfo . getAccessFlags ( ) ; decodeModifiersForMethod ( buffer , accessFlags ) ; if ( methodInfo . isSynthetic ( ) && ! checkMode ( mode , WORKING_COPY ) ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( Messages . disassembler_space ) ; } CharOperation . replace ( methodDescriptor , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; final boolean isVarArgs = isVarArgs ( methodInfo ) ; char [ ] methodHeader = null ; char [ ] [ ] parameterNames = null ; if ( ! methodInfo . isClinit ( ) ) { parameterNames = getParameterNames ( methodDescriptor , codeAttribute , accessFlags ) ; } if ( methodInfo . isConstructor ( ) ) { if ( checkMode ( mode , WORKING_COPY ) && signatureAttribute != null ) { final char [ ] signature = signatureAttribute . getSignature ( ) ; CharOperation . replace ( signature , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; disassembleGenericSignature ( mode , buffer , signature ) ; buffer . append ( '<CHAR_LIT:U+0020>' ) ; methodHeader = Signature . toCharArray ( signature , returnClassName ( className , '<CHAR_LIT:.>' , COMPACT ) , parameterNames , ! checkMode ( mode , COMPACT ) , false , isVarArgs ) ; } else { methodHeader = Signature . toCharArray ( methodDescriptor , returnClassName ( className , '<CHAR_LIT:.>' , COMPACT ) , parameterNames , ! checkMode ( mode , COMPACT ) , false , isVarArgs ) ; } } else if ( methodInfo . isClinit ( ) ) { methodHeader = Messages . bind ( Messages . classfileformat_clinitname ) . toCharArray ( ) ; } else { if ( checkMode ( mode , WORKING_COPY ) && signatureAttribute != null ) { final char [ ] signature = signatureAttribute . getSignature ( ) ; CharOperation . replace ( signature , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; disassembleGenericSignature ( mode , buffer , signature ) ; buffer . append ( '<CHAR_LIT:U+0020>' ) ; methodHeader = Signature . toCharArray ( signature , methodInfo . getName ( ) , parameterNames , ! checkMode ( mode , COMPACT ) , true , isVarArgs ) ; } else { methodHeader = Signature . toCharArray ( methodDescriptor , methodInfo . getName ( ) , parameterNames , ! checkMode ( mode , COMPACT ) , true , isVarArgs ) ; } } if ( checkMode ( mode , DETAILED ) && ( runtimeInvisibleParameterAnnotationsAttribute != null || runtimeVisibleParameterAnnotationsAttribute != null ) ) { IParameterAnnotation [ ] invisibleParameterAnnotations = null ; IParameterAnnotation [ ] visibleParameterAnnotations = null ; int length = - <NUM_LIT:1> ; if ( runtimeInvisibleParameterAnnotationsAttribute != null ) { IRuntimeInvisibleParameterAnnotationsAttribute attribute = ( IRuntimeInvisibleParameterAnnotationsAttribute ) runtimeInvisibleParameterAnnotationsAttribute ; invisibleParameterAnnotations = attribute . getParameterAnnotations ( ) ; length = invisibleParameterAnnotations . length ; } if ( runtimeVisibleParameterAnnotationsAttribute != null ) { IRuntimeVisibleParameterAnnotationsAttribute attribute = ( IRuntimeVisibleParameterAnnotationsAttribute ) runtimeVisibleParameterAnnotationsAttribute ; visibleParameterAnnotations = attribute . getParameterAnnotations ( ) ; length = visibleParameterAnnotations . length ; } int insertionPosition = CharOperation . indexOf ( '<CHAR_LIT:(>' , methodHeader ) + <NUM_LIT:1> ; int start = <NUM_LIT:0> ; StringBuffer stringBuffer = new StringBuffer ( ) ; stringBuffer . append ( methodHeader , <NUM_LIT:0> , insertionPosition ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( i > <NUM_LIT:0> ) { stringBuffer . append ( '<CHAR_LIT:U+0020>' ) ; } int stringBufferSize = stringBuffer . length ( ) ; if ( runtimeVisibleParameterAnnotationsAttribute != null ) { disassembleAsModifier ( ( IRuntimeVisibleParameterAnnotationsAttribute ) runtimeVisibleParameterAnnotationsAttribute , stringBuffer , i , lineSeparator , tabNumber , mode ) ; } if ( runtimeInvisibleParameterAnnotationsAttribute != null ) { if ( stringBuffer . length ( ) != stringBufferSize ) { stringBuffer . append ( '<CHAR_LIT:U+0020>' ) ; stringBufferSize = stringBuffer . length ( ) ; } disassembleAsModifier ( ( IRuntimeInvisibleParameterAnnotationsAttribute ) runtimeInvisibleParameterAnnotationsAttribute , stringBuffer , i , lineSeparator , tabNumber , mode ) ; } if ( i == <NUM_LIT:0> && stringBuffer . length ( ) != stringBufferSize ) { stringBuffer . append ( '<CHAR_LIT:U+0020>' ) ; } start = insertionPosition ; insertionPosition = CharOperation . indexOf ( '<CHAR_LIT:U+002C>' , methodHeader , start + <NUM_LIT:1> ) + <NUM_LIT:1> ; if ( insertionPosition == <NUM_LIT:0> ) { stringBuffer . append ( methodHeader , start , methodHeader . length - start ) ; } else { stringBuffer . append ( methodHeader , start , insertionPosition - start ) ; } } buffer . append ( stringBuffer ) ; } else { buffer . append ( methodHeader ) ; } IExceptionAttribute exceptionAttribute = methodInfo . getExceptionAttribute ( ) ; if ( exceptionAttribute != null ) { buffer . append ( "<STR_LIT>" ) ; char [ ] [ ] exceptionNames = exceptionAttribute . getExceptionNames ( ) ; int length = exceptionNames . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( i != <NUM_LIT:0> ) { buffer . append ( Messages . disassembler_comma ) . append ( Messages . disassembler_space ) ; } char [ ] exceptionName = exceptionNames [ i ] ; CharOperation . replace ( exceptionName , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; buffer . append ( returnClassName ( exceptionName , '<CHAR_LIT:.>' , mode ) ) ; } } if ( checkMode ( mode , DETAILED ) ) { if ( annotationDefaultAttribute != null ) { buffer . append ( "<STR_LIT>" ) ; disassembleAsModifier ( ( IAnnotationDefaultAttribute ) annotationDefaultAttribute , buffer , lineSeparator , tabNumber , mode ) ; } } if ( checkMode ( mode , WORKING_COPY ) ) { if ( annotationDefaultAttribute != null ) { buffer . append ( "<STR_LIT>" ) ; disassembleAsModifier ( ( IAnnotationDefaultAttribute ) annotationDefaultAttribute , buffer , lineSeparator , tabNumber , mode ) ; } if ( ( ( accessFlags & IModifierConstants . ACC_NATIVE ) == <NUM_LIT:0> ) && ( ( accessFlags & IModifierConstants . ACC_ABSTRACT ) == <NUM_LIT:0> ) ) { buffer . append ( "<STR_LIT>" ) ; final char [ ] returnType = Signature . getReturnType ( methodDescriptor ) ; if ( returnType . length == <NUM_LIT:1> ) { switch ( returnType [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : writeNewLine ( buffer , lineSeparator , tabNumber ) ; break ; case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; buffer . append ( "<STR_LIT>" ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; break ; default : writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; buffer . append ( "<STR_LIT>" ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; } } else { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; buffer . append ( "<STR_LIT>" ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; } buffer . append ( '<CHAR_LIT:}>' ) ; } else { buffer . append ( '<CHAR_LIT:;>' ) ; } } else { buffer . append ( Messages . disassembler_endofmethodheader ) ; } if ( checkMode ( mode , SYSTEM | DETAILED ) ) { if ( codeAttribute != null ) { disassemble ( codeAttribute , parameterNames , methodDescriptor , ( accessFlags & IModifierConstants . ACC_STATIC ) != <NUM_LIT:0> , buffer , lineSeparator , tabNumber , mode ) ; } } if ( checkMode ( mode , SYSTEM ) ) { IClassFileAttribute [ ] attributes = methodInfo . getAttributes ( ) ; int length = attributes . length ; if ( length != <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IClassFileAttribute attribute = attributes [ i ] ; if ( attribute != codeAttribute && attribute != exceptionAttribute && attribute != signatureAttribute && attribute != annotationDefaultAttribute && attribute != runtimeInvisibleAnnotationsAttribute && attribute != runtimeVisibleAnnotationsAttribute && attribute != runtimeInvisibleParameterAnnotationsAttribute && attribute != runtimeVisibleParameterAnnotationsAttribute && ! CharOperation . equals ( attribute . getAttributeName ( ) , IAttributeNamesConstants . DEPRECATED ) && ! CharOperation . equals ( attribute . getAttributeName ( ) , IAttributeNamesConstants . SYNTHETIC ) ) { disassemble ( attribute , buffer , lineSeparator , tabNumber , mode ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; } } } if ( annotationDefaultAttribute != null ) { disassemble ( ( IAnnotationDefaultAttribute ) annotationDefaultAttribute , buffer , lineSeparator , tabNumber , mode ) ; } if ( runtimeVisibleAnnotationsAttribute != null ) { disassemble ( ( IRuntimeVisibleAnnotationsAttribute ) runtimeVisibleAnnotationsAttribute , buffer , lineSeparator , tabNumber , mode ) ; } if ( runtimeInvisibleAnnotationsAttribute != null ) { disassemble ( ( IRuntimeInvisibleAnnotationsAttribute ) runtimeInvisibleAnnotationsAttribute , buffer , lineSeparator , tabNumber , mode ) ; } if ( runtimeVisibleParameterAnnotationsAttribute != null ) { disassemble ( ( IRuntimeVisibleParameterAnnotationsAttribute ) runtimeVisibleParameterAnnotationsAttribute , buffer , lineSeparator , tabNumber , mode ) ; } if ( runtimeInvisibleParameterAnnotationsAttribute != null ) { disassemble ( ( IRuntimeInvisibleParameterAnnotationsAttribute ) runtimeInvisibleParameterAnnotationsAttribute , buffer , lineSeparator , tabNumber , mode ) ; } } } public String disassemble ( IClassFileReader classFileReader , String lineSeparator ) { return disassemble ( classFileReader , lineSeparator , ClassFileBytesDisassembler . DEFAULT ) ; } public String disassemble ( IClassFileReader classFileReader , String lineSeparator , int mode ) { if ( classFileReader == null ) return org . eclipse . jdt . internal . compiler . util . Util . EMPTY_STRING ; char [ ] className = classFileReader . getClassName ( ) ; if ( className == null ) { return org . eclipse . jdt . internal . compiler . util . Util . EMPTY_STRING ; } className = CharOperation . replaceOnCopy ( className , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; final int classNameLength = className . length ; final int accessFlags = classFileReader . getAccessFlags ( ) ; final boolean isEnum = ( accessFlags & IModifierConstants . ACC_ENUM ) != <NUM_LIT:0> ; StringBuffer buffer = new StringBuffer ( ) ; ISourceAttribute sourceAttribute = classFileReader . getSourceFileAttribute ( ) ; IClassFileAttribute classFileAttribute = Util . getAttribute ( classFileReader , IAttributeNamesConstants . SIGNATURE ) ; ISignatureAttribute signatureAttribute = ( ISignatureAttribute ) classFileAttribute ; if ( checkMode ( mode , SYSTEM | DETAILED ) ) { int minorVersion = classFileReader . getMinorVersion ( ) ; int majorVersion = classFileReader . getMajorVersion ( ) ; buffer . append ( Messages . disassembler_begincommentline ) ; if ( sourceAttribute != null ) { buffer . append ( Messages . disassembler_sourceattributeheader ) ; buffer . append ( sourceAttribute . getSourceFileName ( ) ) ; } String versionNumber = VERSION_UNKNOWN ; if ( minorVersion == <NUM_LIT:3> && majorVersion == <NUM_LIT> ) { versionNumber = JavaCore . VERSION_1_1 ; } else if ( minorVersion == <NUM_LIT:0> && majorVersion == <NUM_LIT> ) { versionNumber = JavaCore . VERSION_1_2 ; } else if ( minorVersion == <NUM_LIT:0> && majorVersion == <NUM_LIT> ) { versionNumber = JavaCore . VERSION_1_3 ; } else if ( minorVersion == <NUM_LIT:0> && majorVersion == <NUM_LIT> ) { versionNumber = JavaCore . VERSION_1_4 ; } else if ( minorVersion == <NUM_LIT:0> && majorVersion == <NUM_LIT> ) { versionNumber = JavaCore . VERSION_1_5 ; } else if ( minorVersion == <NUM_LIT:0> && majorVersion == <NUM_LIT> ) { versionNumber = JavaCore . VERSION_1_6 ; } else if ( minorVersion == <NUM_LIT:0> && majorVersion == <NUM_LIT> ) { versionNumber = JavaCore . VERSION_1_7 ; } buffer . append ( Messages . bind ( Messages . classfileformat_versiondetails , new String [ ] { versionNumber , Integer . toString ( majorVersion ) , Integer . toString ( minorVersion ) , ( ( accessFlags & IModifierConstants . ACC_SUPER ) != <NUM_LIT:0> ? Messages . classfileformat_superflagisset : Messages . classfileformat_superflagisnotset ) + ( isDeprecated ( classFileReader ) ? "<STR_LIT>" : org . eclipse . jdt . internal . compiler . util . Util . EMPTY_STRING ) } ) ) ; writeNewLine ( buffer , lineSeparator , <NUM_LIT:0> ) ; if ( signatureAttribute != null ) { buffer . append ( Messages . bind ( Messages . disassembler_signatureattributeheader , new String ( signatureAttribute . getSignature ( ) ) ) ) ; writeNewLine ( buffer , lineSeparator , <NUM_LIT:0> ) ; } } final int lastDotIndexInClassName = CharOperation . lastIndexOf ( '<CHAR_LIT:.>' , className ) ; if ( checkMode ( mode , WORKING_COPY ) && lastDotIndexInClassName != - <NUM_LIT:1> ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( className , <NUM_LIT:0> , lastDotIndexInClassName ) ; buffer . append ( '<CHAR_LIT:;>' ) ; writeNewLine ( buffer , lineSeparator , <NUM_LIT:0> ) ; } IInnerClassesAttribute innerClassesAttribute = classFileReader . getInnerClassesAttribute ( ) ; IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util . getAttribute ( classFileReader , IAttributeNamesConstants . RUNTIME_VISIBLE_ANNOTATIONS ) ; IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util . getAttribute ( classFileReader , IAttributeNamesConstants . RUNTIME_INVISIBLE_ANNOTATIONS ) ; if ( checkMode ( mode , DETAILED ) ) { if ( runtimeInvisibleAnnotationsAttribute != null ) { disassembleAsModifier ( ( IRuntimeInvisibleAnnotationsAttribute ) runtimeInvisibleAnnotationsAttribute , buffer , lineSeparator , <NUM_LIT:0> , mode ) ; writeNewLine ( buffer , lineSeparator , <NUM_LIT:0> ) ; } if ( runtimeVisibleAnnotationsAttribute != null ) { disassembleAsModifier ( ( IRuntimeVisibleAnnotationsAttribute ) runtimeVisibleAnnotationsAttribute , buffer , lineSeparator , <NUM_LIT:0> , mode ) ; writeNewLine ( buffer , lineSeparator , <NUM_LIT:0> ) ; } } boolean decoded = false ; if ( isEnum && checkMode ( mode , WORKING_COPY ) ) { decodeModifiersForType ( buffer , accessFlags & IModifierConstants . ACC_PUBLIC ) ; } else { if ( innerClassesAttribute != null ) { IInnerClassesAttributeEntry [ ] entries = innerClassesAttribute . getInnerClassAttributesEntries ( ) ; for ( int i = <NUM_LIT:0> , max = entries . length ; i < max ; i ++ ) { IInnerClassesAttributeEntry entry = entries [ i ] ; char [ ] innerClassName = entry . getInnerClassName ( ) ; if ( innerClassName != null ) { if ( CharOperation . equals ( classFileReader . getClassName ( ) , innerClassName ) ) { decodeModifiersForInnerClasses ( buffer , entry . getAccessFlags ( ) , false ) ; decoded = true ; } } } } if ( ! decoded ) { decodeModifiersForType ( buffer , accessFlags ) ; if ( isSynthetic ( classFileReader ) ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( Messages . disassembler_space ) ; } } } final boolean isAnnotation = ( accessFlags & IModifierConstants . ACC_ANNOTATION ) != <NUM_LIT:0> ; boolean isInterface = false ; if ( isEnum ) { buffer . append ( "<STR_LIT>" ) ; } else if ( classFileReader . isClass ( ) ) { buffer . append ( "<STR_LIT>" ) ; } else { if ( isAnnotation ) { buffer . append ( "<STR_LIT:@>" ) ; } buffer . append ( "<STR_LIT>" ) ; isInterface = true ; } if ( checkMode ( mode , WORKING_COPY ) ) { final int start = lastDotIndexInClassName + <NUM_LIT:1> ; buffer . append ( className , start , classNameLength - start ) ; className = CharOperation . subarray ( className , start , classNameLength ) ; if ( signatureAttribute != null ) { disassembleGenericSignature ( mode , buffer , signatureAttribute . getSignature ( ) ) ; } } else { buffer . append ( className ) ; } char [ ] superclassName = classFileReader . getSuperclassName ( ) ; if ( superclassName != null ) { CharOperation . replace ( superclassName , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; if ( ! isJavaLangObject ( superclassName ) && ! isEnum ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( returnClassName ( superclassName , '<CHAR_LIT:.>' , mode ) ) ; } } if ( ! isAnnotation || ! checkMode ( mode , WORKING_COPY ) ) { char [ ] [ ] superclassInterfaces = classFileReader . getInterfaceNames ( ) ; int length = superclassInterfaces . length ; if ( length != <NUM_LIT:0> ) { if ( isInterface ) { buffer . append ( "<STR_LIT>" ) ; } else { buffer . append ( "<STR_LIT>" ) ; } for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( i != <NUM_LIT:0> ) { buffer . append ( Messages . disassembler_comma ) . append ( Messages . disassembler_space ) ; } char [ ] superinterface = superclassInterfaces [ i ] ; CharOperation . replace ( superinterface , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; buffer . append ( returnClassName ( superinterface , '<CHAR_LIT:.>' , mode ) ) ; } } } buffer . append ( Messages . bind ( Messages . disassembler_opentypedeclaration ) ) ; if ( checkMode ( mode , SYSTEM ) ) { disassemble ( classFileReader . getConstantPool ( ) , buffer , lineSeparator , <NUM_LIT:1> ) ; } disassembleTypeMembers ( classFileReader , className , buffer , lineSeparator , <NUM_LIT:1> , mode , isEnum ) ; if ( checkMode ( mode , SYSTEM | DETAILED ) ) { IClassFileAttribute [ ] attributes = classFileReader . getAttributes ( ) ; int length = attributes . length ; IEnclosingMethodAttribute enclosingMethodAttribute = getEnclosingMethodAttribute ( classFileReader ) ; int remainingAttributesLength = length ; if ( innerClassesAttribute != null ) { remainingAttributesLength -- ; } if ( enclosingMethodAttribute != null ) { remainingAttributesLength -- ; } if ( sourceAttribute != null ) { remainingAttributesLength -- ; } if ( signatureAttribute != null ) { remainingAttributesLength -- ; } if ( innerClassesAttribute != null || enclosingMethodAttribute != null || remainingAttributesLength != <NUM_LIT:0> ) { writeNewLine ( buffer , lineSeparator , <NUM_LIT:0> ) ; } if ( innerClassesAttribute != null ) { disassemble ( innerClassesAttribute , buffer , lineSeparator , <NUM_LIT:1> ) ; } if ( enclosingMethodAttribute != null ) { disassemble ( enclosingMethodAttribute , buffer , lineSeparator , <NUM_LIT:0> ) ; } if ( checkMode ( mode , SYSTEM ) ) { if ( runtimeVisibleAnnotationsAttribute != null ) { disassemble ( ( IRuntimeVisibleAnnotationsAttribute ) runtimeVisibleAnnotationsAttribute , buffer , lineSeparator , <NUM_LIT:0> , mode ) ; } if ( runtimeInvisibleAnnotationsAttribute != null ) { disassemble ( ( IRuntimeInvisibleAnnotationsAttribute ) runtimeInvisibleAnnotationsAttribute , buffer , lineSeparator , <NUM_LIT:0> , mode ) ; } if ( length != <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IClassFileAttribute attribute = attributes [ i ] ; if ( attribute != innerClassesAttribute && attribute != sourceAttribute && attribute != signatureAttribute && attribute != enclosingMethodAttribute && attribute != runtimeInvisibleAnnotationsAttribute && attribute != runtimeVisibleAnnotationsAttribute && ! CharOperation . equals ( attribute . getAttributeName ( ) , IAttributeNamesConstants . DEPRECATED ) && ! CharOperation . equals ( attribute . getAttributeName ( ) , IAttributeNamesConstants . SYNTHETIC ) ) { disassemble ( attribute , buffer , lineSeparator , <NUM_LIT:0> , mode ) ; } } } } } writeNewLine ( buffer , lineSeparator , <NUM_LIT:0> ) ; buffer . append ( Messages . disassembler_closetypedeclaration ) ; return buffer . toString ( ) ; } private void disassembleGenericSignature ( int mode , StringBuffer buffer , final char [ ] signature ) { CharOperation . replace ( signature , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; final char [ ] [ ] typeParameters = Signature . getTypeParameters ( signature ) ; final int typeParametersLength = typeParameters . length ; if ( typeParametersLength != <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> ; i < typeParametersLength ; i ++ ) { if ( i != <NUM_LIT:0> ) { buffer . append ( Messages . disassembler_comma ) ; } buffer . append ( typeParameters [ i ] , <NUM_LIT:0> , CharOperation . indexOf ( '<CHAR_LIT::>' , typeParameters [ i ] ) ) ; final char [ ] [ ] bounds = Signature . getTypeParameterBounds ( typeParameters [ i ] ) ; final int boundsLength = bounds . length ; if ( boundsLength != <NUM_LIT:0> ) { if ( boundsLength == <NUM_LIT:1> ) { final char [ ] bound = bounds [ <NUM_LIT:0> ] ; if ( ! isJavaLangObject ( Signature . toCharArray ( bound ) ) ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( returnClassName ( Signature . toCharArray ( bound ) , '<CHAR_LIT:.>' , mode ) ) ; } } else { buffer . append ( "<STR_LIT>" ) ; for ( int j = <NUM_LIT:0> ; j < boundsLength ; j ++ ) { if ( j != <NUM_LIT:0> ) { buffer . append ( "<STR_LIT>" ) ; } buffer . append ( returnClassName ( Signature . toCharArray ( bounds [ j ] ) , '<CHAR_LIT:.>' , mode ) ) ; } } } } buffer . append ( '<CHAR_LIT:>>' ) ; } } private boolean isJavaLangObject ( final char [ ] className ) { return CharOperation . equals ( TypeConstants . JAVA_LANG_OBJECT , CharOperation . splitOn ( '<CHAR_LIT:.>' , className ) ) ; } private boolean isVarArgs ( IMethodInfo methodInfo ) { int accessFlags = methodInfo . getAccessFlags ( ) ; if ( ( accessFlags & IModifierConstants . ACC_VARARGS ) != <NUM_LIT:0> ) return true ; return Util . getAttribute ( methodInfo , AttributeNamesConstants . VarargsName ) != null ; } private void disassemble ( ICodeAttribute codeAttribute , char [ ] [ ] parameterNames , char [ ] methodDescriptor , boolean isStatic , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { writeNewLine ( buffer , lineSeparator , tabNumber - <NUM_LIT:1> ) ; DefaultBytecodeVisitor visitor = new DefaultBytecodeVisitor ( codeAttribute , parameterNames , methodDescriptor , isStatic , buffer , lineSeparator , tabNumber , mode ) ; try { codeAttribute . traverse ( visitor ) ; } catch ( ClassFormatException e ) { dumpTab ( tabNumber + <NUM_LIT:2> , buffer ) ; buffer . append ( Messages . classformat_classformatexception ) ; writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; } final int exceptionTableLength = codeAttribute . getExceptionTableLength ( ) ; boolean isFirstAttribute = true ; if ( exceptionTableLength != <NUM_LIT:0> ) { final int tabNumberForExceptionAttribute = tabNumber + <NUM_LIT:2> ; isFirstAttribute = false ; dumpTab ( tabNumberForExceptionAttribute , buffer ) ; final IExceptionTableEntry [ ] exceptionTableEntries = codeAttribute . getExceptionTable ( ) ; buffer . append ( Messages . disassembler_exceptiontableheader ) ; writeNewLine ( buffer , lineSeparator , tabNumberForExceptionAttribute + <NUM_LIT:1> ) ; for ( int i = <NUM_LIT:0> ; i < exceptionTableLength ; i ++ ) { if ( i != <NUM_LIT:0> ) { writeNewLine ( buffer , lineSeparator , tabNumberForExceptionAttribute + <NUM_LIT:1> ) ; } IExceptionTableEntry exceptionTableEntry = exceptionTableEntries [ i ] ; char [ ] catchType ; if ( exceptionTableEntry . getCatchTypeIndex ( ) != <NUM_LIT:0> ) { catchType = exceptionTableEntry . getCatchType ( ) ; CharOperation . replace ( catchType , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; catchType = returnClassName ( catchType , '<CHAR_LIT:.>' , mode ) ; } else { catchType = ANY_EXCEPTION ; } buffer . append ( Messages . bind ( Messages . classfileformat_exceptiontableentry , new String [ ] { Integer . toString ( exceptionTableEntry . getStartPC ( ) ) , Integer . toString ( exceptionTableEntry . getEndPC ( ) ) , Integer . toString ( exceptionTableEntry . getHandlerPC ( ) ) , new String ( catchType ) , } ) ) ; } } final ILineNumberAttribute lineNumberAttribute = codeAttribute . getLineNumberAttribute ( ) ; final int lineAttributeLength = lineNumberAttribute == null ? <NUM_LIT:0> : lineNumberAttribute . getLineNumberTableLength ( ) ; if ( lineAttributeLength != <NUM_LIT:0> ) { int tabNumberForLineAttribute = tabNumber + <NUM_LIT:2> ; if ( ! isFirstAttribute ) { writeNewLine ( buffer , lineSeparator , tabNumberForLineAttribute ) ; } else { dumpTab ( tabNumberForLineAttribute , buffer ) ; isFirstAttribute = false ; } buffer . append ( Messages . disassembler_linenumberattributeheader ) ; writeNewLine ( buffer , lineSeparator , tabNumberForLineAttribute + <NUM_LIT:1> ) ; int [ ] [ ] lineattributesEntries = lineNumberAttribute . getLineNumberTable ( ) ; for ( int i = <NUM_LIT:0> ; i < lineAttributeLength ; i ++ ) { if ( i != <NUM_LIT:0> ) { writeNewLine ( buffer , lineSeparator , tabNumberForLineAttribute + <NUM_LIT:1> ) ; } buffer . append ( Messages . bind ( Messages . classfileformat_linenumbertableentry , new String [ ] { Integer . toString ( lineattributesEntries [ i ] [ <NUM_LIT:0> ] ) , Integer . toString ( lineattributesEntries [ i ] [ <NUM_LIT:1> ] ) } ) ) ; } } final ILocalVariableAttribute localVariableAttribute = codeAttribute . getLocalVariableAttribute ( ) ; final int localVariableAttributeLength = localVariableAttribute == null ? <NUM_LIT:0> : localVariableAttribute . getLocalVariableTableLength ( ) ; if ( localVariableAttributeLength != <NUM_LIT:0> ) { int tabNumberForLocalVariableAttribute = tabNumber + <NUM_LIT:2> ; if ( ! isFirstAttribute ) { writeNewLine ( buffer , lineSeparator , tabNumberForLocalVariableAttribute ) ; } else { isFirstAttribute = false ; dumpTab ( tabNumberForLocalVariableAttribute , buffer ) ; } buffer . append ( Messages . disassembler_localvariabletableattributeheader ) ; writeNewLine ( buffer , lineSeparator , tabNumberForLocalVariableAttribute + <NUM_LIT:1> ) ; ILocalVariableTableEntry [ ] localVariableTableEntries = localVariableAttribute . getLocalVariableTable ( ) ; for ( int i = <NUM_LIT:0> ; i < localVariableAttributeLength ; i ++ ) { if ( i != <NUM_LIT:0> ) { writeNewLine ( buffer , lineSeparator , tabNumberForLocalVariableAttribute + <NUM_LIT:1> ) ; } ILocalVariableTableEntry localVariableTableEntry = localVariableTableEntries [ i ] ; int index = localVariableTableEntry . getIndex ( ) ; int startPC = localVariableTableEntry . getStartPC ( ) ; int length = localVariableTableEntry . getLength ( ) ; final char [ ] typeName = Signature . toCharArray ( localVariableTableEntry . getDescriptor ( ) ) ; CharOperation . replace ( typeName , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; buffer . append ( Messages . bind ( Messages . classfileformat_localvariabletableentry , new String [ ] { Integer . toString ( startPC ) , Integer . toString ( startPC + length ) , new String ( localVariableTableEntry . getName ( ) ) , Integer . toString ( index ) , new String ( returnClassName ( typeName , '<CHAR_LIT:.>' , mode ) ) } ) ) ; } } final ILocalVariableTypeTableAttribute localVariableTypeAttribute = ( ILocalVariableTypeTableAttribute ) getAttribute ( IAttributeNamesConstants . LOCAL_VARIABLE_TYPE_TABLE , codeAttribute ) ; final int localVariableTypeTableLength = localVariableTypeAttribute == null ? <NUM_LIT:0> : localVariableTypeAttribute . getLocalVariableTypeTableLength ( ) ; if ( localVariableTypeTableLength != <NUM_LIT:0> ) { int tabNumberForLocalVariableAttribute = tabNumber + <NUM_LIT:2> ; if ( ! isFirstAttribute ) { writeNewLine ( buffer , lineSeparator , tabNumberForLocalVariableAttribute ) ; } else { isFirstAttribute = false ; dumpTab ( tabNumberForLocalVariableAttribute , buffer ) ; } buffer . append ( Messages . disassembler_localvariabletypetableattributeheader ) ; writeNewLine ( buffer , lineSeparator , tabNumberForLocalVariableAttribute + <NUM_LIT:1> ) ; ILocalVariableTypeTableEntry [ ] localVariableTypeTableEntries = localVariableTypeAttribute . getLocalVariableTypeTable ( ) ; for ( int i = <NUM_LIT:0> ; i < localVariableTypeTableLength ; i ++ ) { if ( i != <NUM_LIT:0> ) { writeNewLine ( buffer , lineSeparator , tabNumberForLocalVariableAttribute + <NUM_LIT:1> ) ; } ILocalVariableTypeTableEntry localVariableTypeTableEntry = localVariableTypeTableEntries [ i ] ; int index = localVariableTypeTableEntry . getIndex ( ) ; int startPC = localVariableTypeTableEntry . getStartPC ( ) ; int length = localVariableTypeTableEntry . getLength ( ) ; final char [ ] typeName = Signature . toCharArray ( localVariableTypeTableEntry . getSignature ( ) ) ; CharOperation . replace ( typeName , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; buffer . append ( Messages . bind ( Messages . classfileformat_localvariabletableentry , new String [ ] { Integer . toString ( startPC ) , Integer . toString ( startPC + length ) , new String ( localVariableTypeTableEntry . getName ( ) ) , Integer . toString ( index ) , new String ( returnClassName ( typeName , '<CHAR_LIT:.>' , mode ) ) } ) ) ; } } final int length = codeAttribute . getAttributesCount ( ) ; if ( length != <NUM_LIT:0> ) { IClassFileAttribute [ ] attributes = codeAttribute . getAttributes ( ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IClassFileAttribute attribute = attributes [ i ] ; if ( CharOperation . equals ( attribute . getAttributeName ( ) , IAttributeNamesConstants . STACK_MAP_TABLE ) ) { IStackMapTableAttribute stackMapTableAttribute = ( IStackMapTableAttribute ) attribute ; if ( ! isFirstAttribute ) { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:2> ) ; } else { isFirstAttribute = false ; dumpTab ( tabNumber + <NUM_LIT:1> , buffer ) ; } int numberOfEntries = stackMapTableAttribute . getNumberOfEntries ( ) ; buffer . append ( Messages . bind ( Messages . disassembler_stackmaptableattributeheader , Integer . toString ( numberOfEntries ) ) ) ; if ( numberOfEntries != <NUM_LIT:0> ) { disassemble ( stackMapTableAttribute , buffer , lineSeparator , tabNumber , mode ) ; } } else if ( CharOperation . equals ( attribute . getAttributeName ( ) , IAttributeNamesConstants . STACK_MAP ) ) { IStackMapAttribute stackMapAttribute = ( IStackMapAttribute ) attribute ; if ( ! isFirstAttribute ) { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:2> ) ; } else { isFirstAttribute = false ; dumpTab ( tabNumber + <NUM_LIT:1> , buffer ) ; } int numberOfEntries = stackMapAttribute . getNumberOfEntries ( ) ; buffer . append ( Messages . bind ( Messages . disassembler_stackmapattributeheader , Integer . toString ( numberOfEntries ) ) ) ; if ( numberOfEntries != <NUM_LIT:0> ) { disassemble ( stackMapAttribute , buffer , lineSeparator , tabNumber , mode ) ; } } else if ( attribute != lineNumberAttribute && attribute != localVariableAttribute && attribute != localVariableTypeAttribute ) { if ( ! isFirstAttribute ) { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:2> ) ; } else { isFirstAttribute = false ; dumpTab ( tabNumber + <NUM_LIT:1> , buffer ) ; } buffer . append ( Messages . bind ( Messages . disassembler_genericattributeheader , new String [ ] { new String ( attribute . getAttributeName ( ) ) , Long . toString ( attribute . getAttributeLength ( ) ) } ) ) ; } } } } private void disassemble ( IStackMapTableAttribute attribute , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:3> ) ; int numberOfEntries = attribute . getNumberOfEntries ( ) ; final IStackMapFrame [ ] stackMapFrames = attribute . getStackMapFrame ( ) ; int absolutePC = - <NUM_LIT:1> ; for ( int j = <NUM_LIT:0> ; j < numberOfEntries ; j ++ ) { if ( j > <NUM_LIT:0> ) { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:3> ) ; } final IStackMapFrame frame = stackMapFrames [ j ] ; int type = frame . getFrameType ( ) ; int offsetDelta = frame . getOffsetDelta ( ) ; if ( absolutePC == - <NUM_LIT:1> ) { absolutePC = offsetDelta ; } else { absolutePC += ( offsetDelta + <NUM_LIT:1> ) ; } switch ( type ) { case <NUM_LIT> : buffer . append ( Messages . bind ( Messages . disassembler_frame_same_locals_1_stack_item_extended , Integer . toString ( absolutePC ) , disassemble ( frame . getStackItems ( ) , mode ) ) ) ; break ; case <NUM_LIT> : case <NUM_LIT> : case <NUM_LIT> : buffer . append ( Messages . bind ( Messages . disassembler_frame_chop , Integer . toString ( absolutePC ) , Integer . toString ( <NUM_LIT> - type ) ) ) ; break ; case <NUM_LIT> : buffer . append ( Messages . bind ( Messages . disassembler_frame_same_frame_extended , Integer . toString ( absolutePC ) ) ) ; break ; case <NUM_LIT> : case <NUM_LIT> : case <NUM_LIT> : buffer . append ( Messages . bind ( Messages . disassembler_frame_append , Integer . toString ( absolutePC ) , disassemble ( frame . getLocals ( ) , mode ) ) ) ; break ; case <NUM_LIT:255> : buffer . append ( Messages . bind ( Messages . disassembler_frame_full_frame , new String [ ] { Integer . toString ( absolutePC ) , Integer . toString ( frame . getNumberOfLocals ( ) ) , disassemble ( frame . getLocals ( ) , mode ) , Integer . toString ( frame . getNumberOfStackItems ( ) ) , disassemble ( frame . getStackItems ( ) , mode ) , dumpNewLineWithTabs ( lineSeparator , tabNumber + <NUM_LIT:5> ) } ) ) ; break ; default : if ( type <= <NUM_LIT> ) { offsetDelta = type ; buffer . append ( Messages . bind ( Messages . disassembler_frame_same_frame , Integer . toString ( absolutePC ) ) ) ; } else if ( type <= <NUM_LIT> ) { offsetDelta = type - <NUM_LIT> ; buffer . append ( Messages . bind ( Messages . disassembler_frame_same_locals_1_stack_item , Integer . toString ( absolutePC ) , disassemble ( frame . getStackItems ( ) , mode ) ) ) ; } } } } private void disassemble ( IStackMapAttribute attribute , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:3> ) ; int numberOfEntries = attribute . getNumberOfEntries ( ) ; final IStackMapFrame [ ] stackMapFrames = attribute . getStackMapFrame ( ) ; for ( int j = <NUM_LIT:0> ; j < numberOfEntries ; j ++ ) { if ( j > <NUM_LIT:0> ) { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:3> ) ; } final IStackMapFrame frame = stackMapFrames [ j ] ; buffer . append ( Messages . bind ( Messages . disassembler_frame_full_frame , new String [ ] { Integer . toString ( frame . getOffsetDelta ( ) ) , Integer . toString ( frame . getNumberOfLocals ( ) ) , disassemble ( frame . getLocals ( ) , mode ) , Integer . toString ( frame . getNumberOfStackItems ( ) ) , disassemble ( frame . getStackItems ( ) , mode ) , dumpNewLineWithTabs ( lineSeparator , tabNumber + <NUM_LIT:5> ) } ) ) ; } } private void disassemble ( IConstantPool constantPool , StringBuffer buffer , String lineSeparator , int tabNumber ) { writeNewLine ( buffer , lineSeparator , tabNumber ) ; int length = constantPool . getConstantPoolCount ( ) ; buffer . append ( Messages . disassembler_constantpoolheader ) ; writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; for ( int i = <NUM_LIT:1> ; i < length ; i ++ ) { if ( i != <NUM_LIT:1> ) { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; } IConstantPoolEntry constantPoolEntry = constantPool . decodeEntry ( i ) ; switch ( constantPool . getEntryKind ( i ) ) { case IConstantPoolConstant . CONSTANT_Class : buffer . append ( Messages . bind ( Messages . disassembler_constantpool_class , new String [ ] { Integer . toString ( i ) , Integer . toString ( constantPoolEntry . getClassInfoNameIndex ( ) ) , new String ( constantPoolEntry . getClassInfoName ( ) ) } ) ) ; break ; case IConstantPoolConstant . CONSTANT_Double : buffer . append ( Messages . bind ( Messages . disassembler_constantpool_double , new String [ ] { Integer . toString ( i ) , Double . toString ( constantPoolEntry . getDoubleValue ( ) ) } ) ) ; break ; case IConstantPoolConstant . CONSTANT_Fieldref : buffer . append ( Messages . bind ( Messages . disassembler_constantpool_fieldref , new String [ ] { Integer . toString ( i ) , Integer . toString ( constantPoolEntry . getClassIndex ( ) ) , Integer . toString ( constantPoolEntry . getNameAndTypeIndex ( ) ) , new String ( constantPoolEntry . getClassName ( ) ) , new String ( constantPoolEntry . getFieldName ( ) ) , new String ( constantPoolEntry . getFieldDescriptor ( ) ) } ) ) ; break ; case IConstantPoolConstant . CONSTANT_Float : buffer . append ( Messages . bind ( Messages . disassembler_constantpool_float , new String [ ] { Integer . toString ( i ) , Float . toString ( constantPoolEntry . getFloatValue ( ) ) } ) ) ; break ; case IConstantPoolConstant . CONSTANT_Integer : buffer . append ( Messages . bind ( Messages . disassembler_constantpool_integer , new String [ ] { Integer . toString ( i ) , Integer . toString ( constantPoolEntry . getIntegerValue ( ) ) } ) ) ; break ; case IConstantPoolConstant . CONSTANT_InterfaceMethodref : buffer . append ( Messages . bind ( Messages . disassembler_constantpool_interfacemethodref , new String [ ] { Integer . toString ( i ) , Integer . toString ( constantPoolEntry . getClassIndex ( ) ) , Integer . toString ( constantPoolEntry . getNameAndTypeIndex ( ) ) , new String ( constantPoolEntry . getClassName ( ) ) , new String ( constantPoolEntry . getMethodName ( ) ) , new String ( constantPoolEntry . getMethodDescriptor ( ) ) } ) ) ; break ; case IConstantPoolConstant . CONSTANT_Long : buffer . append ( Messages . bind ( Messages . disassembler_constantpool_long , new String [ ] { Integer . toString ( i ) , Long . toString ( constantPoolEntry . getLongValue ( ) ) } ) ) ; break ; case IConstantPoolConstant . CONSTANT_Methodref : buffer . append ( Messages . bind ( Messages . disassembler_constantpool_methodref , new String [ ] { Integer . toString ( i ) , Integer . toString ( constantPoolEntry . getClassIndex ( ) ) , Integer . toString ( constantPoolEntry . getNameAndTypeIndex ( ) ) , new String ( constantPoolEntry . getClassName ( ) ) , new String ( constantPoolEntry . getMethodName ( ) ) , new String ( constantPoolEntry . getMethodDescriptor ( ) ) } ) ) ; break ; case IConstantPoolConstant . CONSTANT_NameAndType : int nameIndex = constantPoolEntry . getNameAndTypeInfoNameIndex ( ) ; int typeIndex = constantPoolEntry . getNameAndTypeInfoDescriptorIndex ( ) ; IConstantPoolEntry entry = constantPool . decodeEntry ( nameIndex ) ; char [ ] nameValue = entry . getUtf8Value ( ) ; entry = constantPool . decodeEntry ( typeIndex ) ; char [ ] typeValue = entry . getUtf8Value ( ) ; buffer . append ( Messages . bind ( Messages . disassembler_constantpool_name_and_type , new String [ ] { Integer . toString ( i ) , Integer . toString ( nameIndex ) , Integer . toString ( typeIndex ) , String . valueOf ( nameValue ) , String . valueOf ( typeValue ) } ) ) ; break ; case IConstantPoolConstant . CONSTANT_String : buffer . append ( Messages . bind ( Messages . disassembler_constantpool_string , new String [ ] { Integer . toString ( i ) , Integer . toString ( constantPoolEntry . getStringIndex ( ) ) , decodeStringValue ( constantPoolEntry . getStringValue ( ) ) } ) ) ; break ; case IConstantPoolConstant . CONSTANT_Utf8 : buffer . append ( Messages . bind ( Messages . disassembler_constantpool_utf8 , new String [ ] { Integer . toString ( i ) , decodeStringValue ( new String ( constantPoolEntry . getUtf8Value ( ) ) ) } ) ) ; break ; } } } private void disassemble ( IEnclosingMethodAttribute enclosingMethodAttribute , StringBuffer buffer , String lineSeparator , int tabNumber ) { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; buffer . append ( Messages . disassembler_enclosingmethodheader ) ; buffer . append ( Messages . disassembler_constantpoolindex ) . append ( enclosingMethodAttribute . getEnclosingClassIndex ( ) ) . append ( "<STR_LIT:U+0020>" ) . append ( Messages . disassembler_constantpoolindex ) . append ( enclosingMethodAttribute . getMethodNameAndTypeIndex ( ) ) . append ( "<STR_LIT:U+0020>" ) . append ( enclosingMethodAttribute . getEnclosingClass ( ) ) ; if ( enclosingMethodAttribute . getMethodNameAndTypeIndex ( ) != <NUM_LIT:0> ) { buffer . append ( "<STR_LIT:.>" ) . append ( enclosingMethodAttribute . getMethodName ( ) ) . append ( enclosingMethodAttribute . getMethodDescriptor ( ) ) ; } } private void disassembleEnumConstants ( IFieldInfo fieldInfo , StringBuffer buffer , String lineSeparator , int tabNumber , char [ ] [ ] argumentTypes , int mode ) { writeNewLine ( buffer , lineSeparator , tabNumber ) ; final IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util . getAttribute ( fieldInfo , IAttributeNamesConstants . RUNTIME_VISIBLE_ANNOTATIONS ) ; final IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util . getAttribute ( fieldInfo , IAttributeNamesConstants . RUNTIME_INVISIBLE_ANNOTATIONS ) ; if ( runtimeInvisibleAnnotationsAttribute != null ) { disassembleAsModifier ( ( IRuntimeInvisibleAnnotationsAttribute ) runtimeInvisibleAnnotationsAttribute , buffer , lineSeparator , tabNumber , mode ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; } if ( runtimeVisibleAnnotationsAttribute != null ) { disassembleAsModifier ( ( IRuntimeVisibleAnnotationsAttribute ) runtimeVisibleAnnotationsAttribute , buffer , lineSeparator , tabNumber , mode ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; } buffer . append ( new String ( fieldInfo . getName ( ) ) ) ; buffer . append ( '<CHAR_LIT:(>' ) ; final int length = argumentTypes . length ; if ( length != <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( i != <NUM_LIT:0> ) { buffer . append ( Messages . disassembler_comma ) ; } final char [ ] type = argumentTypes [ i ] ; switch ( type . length ) { case <NUM_LIT:1> : switch ( type [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : buffer . append ( '<CHAR_LIT:0>' ) ; break ; case '<CHAR_LIT:Z>' : buffer . append ( "<STR_LIT:false>" ) ; break ; case '<CHAR_LIT>' : buffer . append ( "<STR_LIT>" ) ; break ; } break ; default : buffer . append ( "<STR_LIT:null>" ) ; } } } buffer . append ( '<CHAR_LIT:)>' ) . append ( Messages . disassembler_comma ) ; } private void disassemble ( IFieldInfo fieldInfo , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { writeNewLine ( buffer , lineSeparator , tabNumber ) ; final char [ ] fieldDescriptor = fieldInfo . getDescriptor ( ) ; final ISignatureAttribute signatureAttribute = ( ISignatureAttribute ) Util . getAttribute ( fieldInfo , IAttributeNamesConstants . SIGNATURE ) ; if ( checkMode ( mode , SYSTEM | DETAILED ) ) { buffer . append ( Messages . bind ( Messages . classfileformat_fieldddescriptor , new String [ ] { Integer . toString ( fieldInfo . getDescriptorIndex ( ) ) , new String ( fieldDescriptor ) } ) ) ; if ( fieldInfo . isDeprecated ( ) ) { buffer . append ( Messages . disassembler_deprecated ) ; } writeNewLine ( buffer , lineSeparator , tabNumber ) ; if ( signatureAttribute != null ) { buffer . append ( Messages . bind ( Messages . disassembler_signatureattributeheader , new String ( signatureAttribute . getSignature ( ) ) ) ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; } } final IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util . getAttribute ( fieldInfo , IAttributeNamesConstants . RUNTIME_VISIBLE_ANNOTATIONS ) ; final IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util . getAttribute ( fieldInfo , IAttributeNamesConstants . RUNTIME_INVISIBLE_ANNOTATIONS ) ; if ( checkMode ( mode , DETAILED ) ) { if ( runtimeInvisibleAnnotationsAttribute != null ) { disassembleAsModifier ( ( IRuntimeInvisibleAnnotationsAttribute ) runtimeInvisibleAnnotationsAttribute , buffer , lineSeparator , tabNumber , mode ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; } if ( runtimeVisibleAnnotationsAttribute != null ) { disassembleAsModifier ( ( IRuntimeVisibleAnnotationsAttribute ) runtimeVisibleAnnotationsAttribute , buffer , lineSeparator , tabNumber , mode ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; } } if ( checkMode ( mode , WORKING_COPY ) ) { decodeModifiersForFieldForWorkingCopy ( buffer , fieldInfo . getAccessFlags ( ) ) ; if ( signatureAttribute != null ) { buffer . append ( returnClassName ( getSignatureForField ( signatureAttribute . getSignature ( ) ) , '<CHAR_LIT:.>' , mode ) ) ; } else { buffer . append ( returnClassName ( getSignatureForField ( fieldDescriptor ) , '<CHAR_LIT:.>' , mode ) ) ; } } else { decodeModifiersForField ( buffer , fieldInfo . getAccessFlags ( ) ) ; if ( fieldInfo . isSynthetic ( ) ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( Messages . disassembler_space ) ; } buffer . append ( returnClassName ( getSignatureForField ( fieldDescriptor ) , '<CHAR_LIT:.>' , mode ) ) ; } buffer . append ( '<CHAR_LIT:U+0020>' ) ; buffer . append ( new String ( fieldInfo . getName ( ) ) ) ; IConstantValueAttribute constantValueAttribute = fieldInfo . getConstantValueAttribute ( ) ; if ( constantValueAttribute != null ) { buffer . append ( Messages . disassembler_fieldhasconstant ) ; IConstantPoolEntry constantPoolEntry = constantValueAttribute . getConstantValue ( ) ; switch ( constantPoolEntry . getKind ( ) ) { case IConstantPoolConstant . CONSTANT_Long : buffer . append ( constantPoolEntry . getLongValue ( ) + "<STR_LIT>" ) ; break ; case IConstantPoolConstant . CONSTANT_Float : buffer . append ( constantPoolEntry . getFloatValue ( ) + "<STR_LIT:f>" ) ; break ; case IConstantPoolConstant . CONSTANT_Double : final double doubleValue = constantPoolEntry . getDoubleValue ( ) ; if ( checkMode ( mode , ClassFileBytesDisassembler . WORKING_COPY ) ) { if ( doubleValue == Double . POSITIVE_INFINITY ) { buffer . append ( "<STR_LIT>" ) ; } else if ( doubleValue == Double . NEGATIVE_INFINITY ) { buffer . append ( "<STR_LIT>" ) ; } else { buffer . append ( constantPoolEntry . getDoubleValue ( ) ) ; } } else { buffer . append ( constantPoolEntry . getDoubleValue ( ) ) ; } break ; case IConstantPoolConstant . CONSTANT_Integer : switch ( fieldDescriptor [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : buffer . append ( "<STR_LIT:'>" + ( char ) constantPoolEntry . getIntegerValue ( ) + "<STR_LIT:'>" ) ; break ; case '<CHAR_LIT:Z>' : buffer . append ( constantPoolEntry . getIntegerValue ( ) == <NUM_LIT:1> ? "<STR_LIT:true>" : "<STR_LIT:false>" ) ; break ; case '<CHAR_LIT>' : buffer . append ( constantPoolEntry . getIntegerValue ( ) ) ; break ; case '<CHAR_LIT>' : buffer . append ( constantPoolEntry . getIntegerValue ( ) ) ; break ; case '<CHAR_LIT>' : buffer . append ( constantPoolEntry . getIntegerValue ( ) ) ; } break ; case IConstantPoolConstant . CONSTANT_String : buffer . append ( "<STR_LIT:\">" + decodeStringValue ( constantPoolEntry . getStringValue ( ) ) + "<STR_LIT:\">" ) ; } } buffer . append ( Messages . disassembler_endoffieldheader ) ; if ( checkMode ( mode , SYSTEM ) ) { IClassFileAttribute [ ] attributes = fieldInfo . getAttributes ( ) ; int length = attributes . length ; if ( length != <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IClassFileAttribute attribute = attributes [ i ] ; if ( attribute != constantValueAttribute && attribute != signatureAttribute && attribute != runtimeInvisibleAnnotationsAttribute && attribute != runtimeVisibleAnnotationsAttribute && ! CharOperation . equals ( attribute . getAttributeName ( ) , IAttributeNamesConstants . DEPRECATED ) && ! CharOperation . equals ( attribute . getAttributeName ( ) , IAttributeNamesConstants . SYNTHETIC ) ) { disassemble ( attribute , buffer , lineSeparator , tabNumber , mode ) ; } } } if ( runtimeVisibleAnnotationsAttribute != null ) { disassemble ( ( IRuntimeVisibleAnnotationsAttribute ) runtimeVisibleAnnotationsAttribute , buffer , lineSeparator , tabNumber , mode ) ; } if ( runtimeInvisibleAnnotationsAttribute != null ) { disassemble ( ( IRuntimeInvisibleAnnotationsAttribute ) runtimeInvisibleAnnotationsAttribute , buffer , lineSeparator , tabNumber , mode ) ; } } } private void disassemble ( IInnerClassesAttribute innerClassesAttribute , StringBuffer buffer , String lineSeparator , int tabNumber ) { writeNewLine ( buffer , lineSeparator , tabNumber ) ; buffer . append ( Messages . disassembler_innerattributesheader ) ; writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; IInnerClassesAttributeEntry [ ] innerClassesAttributeEntries = innerClassesAttribute . getInnerClassAttributesEntries ( ) ; int length = innerClassesAttributeEntries . length ; int innerClassNameIndex , outerClassNameIndex , innerNameIndex , accessFlags ; IInnerClassesAttributeEntry innerClassesAttributeEntry ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( i != <NUM_LIT:0> ) { buffer . append ( Messages . disassembler_comma ) ; writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; } innerClassesAttributeEntry = innerClassesAttributeEntries [ i ] ; innerClassNameIndex = innerClassesAttributeEntry . getInnerClassNameIndex ( ) ; outerClassNameIndex = innerClassesAttributeEntry . getOuterClassNameIndex ( ) ; innerNameIndex = innerClassesAttributeEntry . getInnerNameIndex ( ) ; accessFlags = innerClassesAttributeEntry . getAccessFlags ( ) ; buffer . append ( Messages . disassembler_openinnerclassentry ) . append ( Messages . disassembler_inner_class_info_name ) . append ( Messages . disassembler_constantpoolindex ) . append ( innerClassNameIndex ) ; if ( innerClassNameIndex != <NUM_LIT:0> ) { buffer . append ( Messages . disassembler_space ) . append ( innerClassesAttributeEntry . getInnerClassName ( ) ) ; } buffer . append ( Messages . disassembler_comma ) . append ( Messages . disassembler_space ) . append ( Messages . disassembler_outer_class_info_name ) . append ( Messages . disassembler_constantpoolindex ) . append ( outerClassNameIndex ) ; if ( outerClassNameIndex != <NUM_LIT:0> ) { buffer . append ( Messages . disassembler_space ) . append ( innerClassesAttributeEntry . getOuterClassName ( ) ) ; } writeNewLine ( buffer , lineSeparator , tabNumber ) ; dumpTab ( tabNumber , buffer ) ; buffer . append ( Messages . disassembler_space ) ; buffer . append ( Messages . disassembler_inner_name ) . append ( Messages . disassembler_constantpoolindex ) . append ( innerNameIndex ) ; if ( innerNameIndex != <NUM_LIT:0> ) { buffer . append ( Messages . disassembler_space ) . append ( innerClassesAttributeEntry . getInnerName ( ) ) ; } buffer . append ( Messages . disassembler_comma ) . append ( Messages . disassembler_space ) . append ( Messages . disassembler_inner_accessflags ) . append ( accessFlags ) . append ( Messages . disassembler_space ) ; decodeModifiersForInnerClasses ( buffer , accessFlags , true ) ; buffer . append ( Messages . disassembler_closeinnerclassentry ) ; } } private void disassemble ( int index , IParameterAnnotation parameterAnnotation , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { IAnnotation [ ] annotations = parameterAnnotation . getAnnotations ( ) ; writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; buffer . append ( Messages . bind ( Messages . disassembler_parameterannotationentrystart , new String [ ] { Integer . toString ( index ) , Integer . toString ( annotations . length ) } ) ) ; for ( int i = <NUM_LIT:0> , max = annotations . length ; i < max ; i ++ ) { disassemble ( annotations [ i ] , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; } } private void disassemble ( IRuntimeInvisibleAnnotationsAttribute runtimeInvisibleAnnotationsAttribute , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; buffer . append ( Messages . disassembler_runtimeinvisibleannotationsattributeheader ) ; IAnnotation [ ] annotations = runtimeInvisibleAnnotationsAttribute . getAnnotations ( ) ; for ( int i = <NUM_LIT:0> , max = annotations . length ; i < max ; i ++ ) { disassemble ( annotations [ i ] , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; } } private void disassemble ( IRuntimeInvisibleParameterAnnotationsAttribute runtimeInvisibleParameterAnnotationsAttribute , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; buffer . append ( Messages . disassembler_runtimeinvisibleparameterannotationsattributeheader ) ; IParameterAnnotation [ ] parameterAnnotations = runtimeInvisibleParameterAnnotationsAttribute . getParameterAnnotations ( ) ; for ( int i = <NUM_LIT:0> , max = parameterAnnotations . length ; i < max ; i ++ ) { disassemble ( i , parameterAnnotations [ i ] , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; } } private void disassemble ( IRuntimeVisibleAnnotationsAttribute runtimeVisibleAnnotationsAttribute , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; buffer . append ( Messages . disassembler_runtimevisibleannotationsattributeheader ) ; IAnnotation [ ] annotations = runtimeVisibleAnnotationsAttribute . getAnnotations ( ) ; for ( int i = <NUM_LIT:0> , max = annotations . length ; i < max ; i ++ ) { disassemble ( annotations [ i ] , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; } } private void disassemble ( IRuntimeVisibleParameterAnnotationsAttribute runtimeVisibleParameterAnnotationsAttribute , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; buffer . append ( Messages . disassembler_runtimevisibleparameterannotationsattributeheader ) ; IParameterAnnotation [ ] parameterAnnotations = runtimeVisibleParameterAnnotationsAttribute . getParameterAnnotations ( ) ; for ( int i = <NUM_LIT:0> , max = parameterAnnotations . length ; i < max ; i ++ ) { disassemble ( i , parameterAnnotations [ i ] , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; } } private String disassemble ( IVerificationTypeInfo [ ] infos , int mode ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> , max = infos . length ; i < max ; i ++ ) { if ( i != <NUM_LIT:0> ) { buffer . append ( Messages . disassembler_comma ) . append ( Messages . disassembler_space ) ; } switch ( infos [ i ] . getTag ( ) ) { case IVerificationTypeInfo . ITEM_DOUBLE : buffer . append ( "<STR_LIT:double>" ) ; break ; case IVerificationTypeInfo . ITEM_FLOAT : buffer . append ( "<STR_LIT:float>" ) ; break ; case IVerificationTypeInfo . ITEM_INTEGER : buffer . append ( "<STR_LIT:int>" ) ; break ; case IVerificationTypeInfo . ITEM_LONG : buffer . append ( "<STR_LIT:long>" ) ; break ; case IVerificationTypeInfo . ITEM_NULL : buffer . append ( "<STR_LIT:null>" ) ; break ; case IVerificationTypeInfo . ITEM_OBJECT : char [ ] classTypeName = infos [ i ] . getClassTypeName ( ) ; CharOperation . replace ( classTypeName , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; if ( classTypeName . length > <NUM_LIT:0> && classTypeName [ <NUM_LIT:0> ] == '<CHAR_LIT:[>' ) { classTypeName = Signature . toCharArray ( classTypeName ) ; } buffer . append ( returnClassName ( classTypeName , '<CHAR_LIT:.>' , mode ) ) ; break ; case IVerificationTypeInfo . ITEM_TOP : buffer . append ( "<STR_LIT:_>" ) ; break ; case IVerificationTypeInfo . ITEM_UNINITIALIZED : buffer . append ( "<STR_LIT>" ) ; buffer . append ( infos [ i ] . getOffset ( ) ) ; buffer . append ( '<CHAR_LIT:)>' ) ; break ; case IVerificationTypeInfo . ITEM_UNINITIALIZED_THIS : buffer . append ( "<STR_LIT>" ) ; } } buffer . append ( '<CHAR_LIT:}>' ) ; return String . valueOf ( buffer ) ; } private void disassembleAsModifier ( IAnnotation annotation , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { final char [ ] typeName = CharOperation . replaceOnCopy ( annotation . getTypeName ( ) , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; buffer . append ( '<CHAR_LIT>' ) . append ( returnClassName ( Signature . toCharArray ( typeName ) , '<CHAR_LIT:.>' , mode ) ) ; final IAnnotationComponent [ ] components = annotation . getComponents ( ) ; final int length = components . length ; if ( length != <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT:(>' ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( i > <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT:U+002C>' ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; } disassembleAsModifier ( components [ i ] , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; } buffer . append ( '<CHAR_LIT:)>' ) ; } } private void disassembleAsModifier ( IAnnotationComponent annotationComponent , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { buffer . append ( annotationComponent . getComponentName ( ) ) . append ( '<CHAR_LIT:=>' ) ; disassembleAsModifier ( annotationComponent . getComponentValue ( ) , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; } private void disassembleAsModifier ( IAnnotationComponentValue annotationComponentValue , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { switch ( annotationComponentValue . getTag ( ) ) { case IAnnotationComponentValue . BYTE_TAG : case IAnnotationComponentValue . CHAR_TAG : case IAnnotationComponentValue . DOUBLE_TAG : case IAnnotationComponentValue . FLOAT_TAG : case IAnnotationComponentValue . INTEGER_TAG : case IAnnotationComponentValue . LONG_TAG : case IAnnotationComponentValue . SHORT_TAG : case IAnnotationComponentValue . BOOLEAN_TAG : case IAnnotationComponentValue . STRING_TAG : IConstantPoolEntry constantPoolEntry = annotationComponentValue . getConstantValue ( ) ; String value = null ; switch ( constantPoolEntry . getKind ( ) ) { case IConstantPoolConstant . CONSTANT_Long : value = constantPoolEntry . getLongValue ( ) + "<STR_LIT>" ; break ; case IConstantPoolConstant . CONSTANT_Float : value = constantPoolEntry . getFloatValue ( ) + "<STR_LIT:f>" ; break ; case IConstantPoolConstant . CONSTANT_Double : value = Double . toString ( constantPoolEntry . getDoubleValue ( ) ) ; break ; case IConstantPoolConstant . CONSTANT_Integer : StringBuffer temp = new StringBuffer ( ) ; switch ( annotationComponentValue . getTag ( ) ) { case IAnnotationComponentValue . CHAR_TAG : temp . append ( '<STR_LIT>' ) ; escapeChar ( temp , ( char ) constantPoolEntry . getIntegerValue ( ) ) ; temp . append ( '<STR_LIT>' ) ; break ; case IAnnotationComponentValue . BOOLEAN_TAG : temp . append ( constantPoolEntry . getIntegerValue ( ) == <NUM_LIT:1> ? "<STR_LIT:true>" : "<STR_LIT:false>" ) ; break ; case IAnnotationComponentValue . BYTE_TAG : temp . append ( "<STR_LIT>" ) . append ( constantPoolEntry . getIntegerValue ( ) ) ; break ; case IAnnotationComponentValue . SHORT_TAG : temp . append ( "<STR_LIT>" ) . append ( constantPoolEntry . getIntegerValue ( ) ) ; break ; case IAnnotationComponentValue . INTEGER_TAG : temp . append ( "<STR_LIT>" ) . append ( constantPoolEntry . getIntegerValue ( ) ) ; } value = String . valueOf ( temp ) ; break ; case IConstantPoolConstant . CONSTANT_Utf8 : value = "<STR_LIT:\">" + decodeStringValue ( constantPoolEntry . getUtf8Value ( ) ) + "<STR_LIT:\">" ; } buffer . append ( value ) ; break ; case IAnnotationComponentValue . ENUM_TAG : final char [ ] typeName = CharOperation . replaceOnCopy ( annotationComponentValue . getEnumConstantTypeName ( ) , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; final char [ ] constantName = annotationComponentValue . getEnumConstantName ( ) ; buffer . append ( returnClassName ( Signature . toCharArray ( typeName ) , '<CHAR_LIT:.>' , mode ) ) . append ( '<CHAR_LIT:.>' ) . append ( constantName ) ; break ; case IAnnotationComponentValue . CLASS_TAG : constantPoolEntry = annotationComponentValue . getClassInfo ( ) ; final char [ ] className = CharOperation . replaceOnCopy ( constantPoolEntry . getUtf8Value ( ) , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; buffer . append ( returnClassName ( Signature . toCharArray ( className ) , '<CHAR_LIT:.>' , mode ) ) ; break ; case IAnnotationComponentValue . ANNOTATION_TAG : IAnnotation annotation = annotationComponentValue . getAnnotationValue ( ) ; disassembleAsModifier ( annotation , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; break ; case IAnnotationComponentValue . ARRAY_TAG : final IAnnotationComponentValue [ ] annotationComponentValues = annotationComponentValue . getAnnotationComponentValues ( ) ; buffer . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> , max = annotationComponentValues . length ; i < max ; i ++ ) { if ( i > <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT:U+002C>' ) ; } disassembleAsModifier ( annotationComponentValues [ i ] , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; } buffer . append ( '<CHAR_LIT:}>' ) ; } } private void disassembleAsModifier ( IAnnotationDefaultAttribute annotationDefaultAttribute , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { IAnnotationComponentValue componentValue = annotationDefaultAttribute . getMemberValue ( ) ; disassembleAsModifier ( componentValue , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; } private void disassembleAsModifier ( IRuntimeInvisibleAnnotationsAttribute runtimeInvisibleAnnotationsAttribute , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { IAnnotation [ ] annotations = runtimeInvisibleAnnotationsAttribute . getAnnotations ( ) ; for ( int i = <NUM_LIT:0> , max = annotations . length ; i < max ; i ++ ) { disassembleAsModifier ( annotations [ i ] , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; } } private void disassembleAsModifier ( IRuntimeInvisibleParameterAnnotationsAttribute runtimeInvisibleParameterAnnotationsAttribute , StringBuffer buffer , int index , String lineSeparator , int tabNumber , int mode ) { IParameterAnnotation [ ] parameterAnnotations = runtimeInvisibleParameterAnnotationsAttribute . getParameterAnnotations ( ) ; if ( parameterAnnotations . length > index ) { disassembleAsModifier ( parameterAnnotations [ index ] , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; } } private void disassembleAsModifier ( IRuntimeVisibleParameterAnnotationsAttribute runtimeVisibleParameterAnnotationsAttribute , StringBuffer buffer , int index , String lineSeparator , int tabNumber , int mode ) { IParameterAnnotation [ ] parameterAnnotations = runtimeVisibleParameterAnnotationsAttribute . getParameterAnnotations ( ) ; if ( parameterAnnotations . length > index ) { disassembleAsModifier ( parameterAnnotations [ index ] , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; } } private void disassembleAsModifier ( IParameterAnnotation parameterAnnotation , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { IAnnotation [ ] annotations = parameterAnnotation . getAnnotations ( ) ; for ( int i = <NUM_LIT:0> , max = annotations . length ; i < max ; i ++ ) { if ( i > <NUM_LIT:0> ) { buffer . append ( '<CHAR_LIT:U+0020>' ) ; } disassembleAsModifier ( annotations [ i ] , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; } } private void disassembleAsModifier ( IRuntimeVisibleAnnotationsAttribute runtimeVisibleAnnotationsAttribute , StringBuffer buffer , String lineSeparator , int tabNumber , int mode ) { IAnnotation [ ] annotations = runtimeVisibleAnnotationsAttribute . getAnnotations ( ) ; for ( int i = <NUM_LIT:0> , max = annotations . length ; i < max ; i ++ ) { if ( i > <NUM_LIT:0> ) { writeNewLine ( buffer , lineSeparator , tabNumber ) ; } disassembleAsModifier ( annotations [ i ] , buffer , lineSeparator , tabNumber + <NUM_LIT:1> , mode ) ; } } private void disassembleTypeMembers ( IClassFileReader classFileReader , char [ ] className , StringBuffer buffer , String lineSeparator , int tabNumber , int mode , boolean isEnum ) { IFieldInfo [ ] fields = classFileReader . getFieldInfos ( ) ; if ( isEnum && checkMode ( mode , WORKING_COPY ) ) { int index = <NUM_LIT:0> ; final int fieldsLength = fields . length ; IMethodInfo [ ] methods = classFileReader . getMethodInfos ( ) ; char [ ] [ ] constructorArguments = getConstructorArgumentsForEnum ( methods ) ; enumConstantLoop : for ( ; index < fieldsLength ; index ++ ) { final IFieldInfo fieldInfo = fields [ index ] ; final int accessFlags = fieldInfo . getAccessFlags ( ) ; if ( ( accessFlags & IModifierConstants . ACC_ENUM ) != <NUM_LIT:0> ) { writeNewLine ( buffer , lineSeparator , tabNumber ) ; disassembleEnumConstants ( fields [ index ] , buffer , lineSeparator , tabNumber , constructorArguments , mode ) ; } else { break enumConstantLoop ; } } buffer . append ( '<CHAR_LIT:;>' ) ; boolean foundSyntheticField = false ; fieldLoop : for ( ; index < fieldsLength ; index ++ ) { if ( ! foundSyntheticField && CharOperation . equals ( TypeConstants . SYNTHETIC_ENUM_VALUES , fields [ index ] . getName ( ) ) ) { foundSyntheticField = true ; continue fieldLoop ; } writeNewLine ( buffer , lineSeparator , tabNumber ) ; disassemble ( fields [ index ] , buffer , lineSeparator , tabNumber , mode ) ; } methodLoop : for ( int i = <NUM_LIT:0> , max = methods . length ; i < max ; i ++ ) { final IMethodInfo methodInfo = methods [ i ] ; if ( CharOperation . equals ( methodInfo . getName ( ) , TypeConstants . VALUES ) ) { final char [ ] descriptor = methodInfo . getDescriptor ( ) ; CharOperation . replace ( descriptor , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; if ( Signature . getParameterCount ( descriptor ) == <NUM_LIT:0> ) { if ( CharOperation . equals ( returnClassName ( Signature . getReturnType ( descriptor ) , '<CHAR_LIT:.>' , mode ) , CharOperation . concat ( new char [ ] { '<CHAR_LIT:[>' , '<CHAR_LIT>' } , className , new char [ ] { '<CHAR_LIT:;>' } ) ) ) { continue methodLoop ; } } } else if ( CharOperation . equals ( methodInfo . getName ( ) , TypeConstants . VALUEOF ) ) { final char [ ] descriptor = methodInfo . getDescriptor ( ) ; CharOperation . replace ( descriptor , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; final char [ ] [ ] parameterTypes = Signature . getParameterTypes ( descriptor ) ; if ( parameterTypes . length == <NUM_LIT:1> && CharOperation . equals ( parameterTypes [ <NUM_LIT:0> ] , "<STR_LIT>" . toCharArray ( ) ) ) { if ( CharOperation . equals ( returnClassName ( Signature . getReturnType ( descriptor ) , '<CHAR_LIT:.>' , mode ) , CharOperation . concat ( '<CHAR_LIT>' , className , '<CHAR_LIT:;>' ) ) ) { continue methodLoop ; } } } else if ( methodInfo . isClinit ( ) || methodInfo . isSynthetic ( ) ) { continue methodLoop ; } else if ( methodInfo . isConstructor ( ) ) { writeNewLine ( buffer , lineSeparator , tabNumber ) ; disassembleEnumConstructor ( classFileReader , className , methodInfo , buffer , lineSeparator , tabNumber , mode ) ; } else { writeNewLine ( buffer , lineSeparator , tabNumber ) ; disassemble ( classFileReader , className , methodInfo , buffer , lineSeparator , tabNumber , mode ) ; } } } else { for ( int i = <NUM_LIT:0> , max = fields . length ; i < max ; i ++ ) { writeNewLine ( buffer , lineSeparator , tabNumber ) ; disassemble ( fields [ i ] , buffer , lineSeparator , tabNumber , mode ) ; } IMethodInfo [ ] methods = classFileReader . getMethodInfos ( ) ; for ( int i = <NUM_LIT:0> , max = methods . length ; i < max ; i ++ ) { writeNewLine ( buffer , lineSeparator , tabNumber ) ; disassemble ( classFileReader , className , methods [ i ] , buffer , lineSeparator , tabNumber , mode ) ; } } } private char [ ] [ ] getConstructorArgumentsForEnum ( final IMethodInfo [ ] methods ) { loop : for ( int i = <NUM_LIT:0> , max = methods . length ; i < max ; i ++ ) { IMethodInfo methodInfo = methods [ i ] ; if ( methodInfo . isConstructor ( ) ) { char [ ] [ ] parameterTypes = Signature . getParameterTypes ( methodInfo . getDescriptor ( ) ) ; final int length = parameterTypes . length ; if ( length >= <NUM_LIT:2> ) { return CharOperation . subarray ( parameterTypes , <NUM_LIT:2> , length ) ; } } else { continue loop ; } } return null ; } private final void dumpTab ( int tabNumber , StringBuffer buffer ) { for ( int i = <NUM_LIT:0> ; i < tabNumber ; i ++ ) { buffer . append ( Messages . disassembler_indentation ) ; } } private final String dumpNewLineWithTabs ( String lineSeparator , int tabNumber ) { StringBuffer buffer = new StringBuffer ( ) ; writeNewLine ( buffer , lineSeparator , tabNumber ) ; return String . valueOf ( buffer ) ; } public String getDescription ( ) { return Messages . disassembler_description ; } private IEnclosingMethodAttribute getEnclosingMethodAttribute ( IClassFileReader classFileReader ) { IClassFileAttribute [ ] attributes = classFileReader . getAttributes ( ) ; for ( int i = <NUM_LIT:0> , max = attributes . length ; i < max ; i ++ ) { if ( CharOperation . equals ( attributes [ i ] . getAttributeName ( ) , IAttributeNamesConstants . ENCLOSING_METHOD ) ) { return ( IEnclosingMethodAttribute ) attributes [ i ] ; } } return null ; } private IClassFileAttribute getAttribute ( final char [ ] attributeName , final ICodeAttribute codeAttribute ) { IClassFileAttribute [ ] attributes = codeAttribute . getAttributes ( ) ; for ( int i = <NUM_LIT:0> , max = attributes . length ; i < max ; i ++ ) { if ( CharOperation . equals ( attributes [ i ] . getAttributeName ( ) , attributeName ) ) { return attributes [ i ] ; } } return null ; } private char [ ] [ ] getParameterNames ( char [ ] methodDescriptor , ICodeAttribute codeAttribute , int accessFlags ) { int paramCount = Signature . getParameterCount ( methodDescriptor ) ; char [ ] [ ] parameterNames = new char [ paramCount ] [ ] ; if ( codeAttribute != null ) { ILocalVariableAttribute localVariableAttribute = codeAttribute . getLocalVariableAttribute ( ) ; if ( localVariableAttribute != null ) { ILocalVariableTableEntry [ ] entries = localVariableAttribute . getLocalVariableTable ( ) ; final int startingIndex = ( accessFlags & IModifierConstants . ACC_STATIC ) != <NUM_LIT:0> ? <NUM_LIT:0> : <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < paramCount ; i ++ ) { ILocalVariableTableEntry searchedEntry = getEntryFor ( getLocalIndex ( startingIndex , i , methodDescriptor ) , entries ) ; if ( searchedEntry != null ) { parameterNames [ i ] = searchedEntry . getName ( ) ; } else { parameterNames [ i ] = CharOperation . concat ( Messages . disassembler_parametername . toCharArray ( ) , Integer . toString ( i ) . toCharArray ( ) ) ; } } } else { for ( int i = <NUM_LIT:0> ; i < paramCount ; i ++ ) { parameterNames [ i ] = CharOperation . concat ( Messages . disassembler_parametername . toCharArray ( ) , Integer . toString ( i ) . toCharArray ( ) ) ; } } } else { for ( int i = <NUM_LIT:0> ; i < paramCount ; i ++ ) { parameterNames [ i ] = CharOperation . concat ( Messages . disassembler_parametername . toCharArray ( ) , Integer . toString ( i ) . toCharArray ( ) ) ; } } return parameterNames ; } private int getLocalIndex ( final int startingSlot , final int index , final char [ ] methodDescriptor ) { int slot = startingSlot ; final char [ ] [ ] types = Signature . getParameterTypes ( methodDescriptor ) ; for ( int i = <NUM_LIT:0> ; i < index ; i ++ ) { final char [ ] type = types [ i ] ; switch ( type . length ) { case <NUM_LIT:1> : switch ( type [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : case '<CHAR_LIT>' : slot += <NUM_LIT:2> ; break ; default : slot ++ ; } break ; default : slot ++ ; } } return slot ; } private ILocalVariableTableEntry getEntryFor ( final int index , final ILocalVariableTableEntry [ ] entries ) { for ( int i = <NUM_LIT:0> , max = entries . length ; i < max ; i ++ ) { ILocalVariableTableEntry entry = entries [ i ] ; if ( index == entry . getIndex ( ) ) { return entry ; } } return null ; } private char [ ] getSignatureForField ( char [ ] fieldDescriptor ) { char [ ] newFieldDescriptor = CharOperation . replaceOnCopy ( fieldDescriptor , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; newFieldDescriptor = CharOperation . replaceOnCopy ( newFieldDescriptor , '<CHAR_LIT>' , '<CHAR_LIT>' ) ; char [ ] fieldDescriptorSignature = Signature . toCharArray ( newFieldDescriptor ) ; CharOperation . replace ( fieldDescriptorSignature , '<CHAR_LIT>' , '<CHAR_LIT>' ) ; return fieldDescriptorSignature ; } private boolean isDeprecated ( IClassFileReader classFileReader ) { IClassFileAttribute [ ] attributes = classFileReader . getAttributes ( ) ; for ( int i = <NUM_LIT:0> , max = attributes . length ; i < max ; i ++ ) { if ( CharOperation . equals ( attributes [ i ] . getAttributeName ( ) , IAttributeNamesConstants . DEPRECATED ) ) { return true ; } } return false ; } private boolean isSynthetic ( IClassFileReader classFileReader ) { int flags = classFileReader . getAccessFlags ( ) ; if ( ( flags & IModifierConstants . ACC_SYNTHETIC ) != <NUM_LIT:0> ) { return true ; } IClassFileAttribute [ ] attributes = classFileReader . getAttributes ( ) ; for ( int i = <NUM_LIT:0> , max = attributes . length ; i < max ; i ++ ) { if ( CharOperation . equals ( attributes [ i ] . getAttributeName ( ) , IAttributeNamesConstants . SYNTHETIC ) ) { return true ; } } return false ; } private boolean checkMode ( int mode , int flag ) { return ( mode & flag ) != <NUM_LIT:0> ; } private boolean isCompact ( int mode ) { return ( mode & ClassFileBytesDisassembler . COMPACT ) != <NUM_LIT:0> ; } private char [ ] returnClassName ( char [ ] classInfoName , char separator , int mode ) { if ( classInfoName . length == <NUM_LIT:0> ) { return CharOperation . NO_CHAR ; } else if ( isCompact ( mode ) ) { int lastIndexOfSlash = CharOperation . lastIndexOf ( separator , classInfoName ) ; if ( lastIndexOfSlash != - <NUM_LIT:1> ) { return CharOperation . subarray ( classInfoName , lastIndexOfSlash + <NUM_LIT:1> , classInfoName . length ) ; } } return classInfoName ; } private void writeNewLine ( StringBuffer buffer , String lineSeparator , int tabNumber ) { buffer . append ( lineSeparator ) ; dumpTab ( tabNumber , buffer ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IAnnotation ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IRuntimeInvisibleAnnotationsAttribute ; public class RuntimeInvisibleAnnotationsAttribute extends ClassFileAttribute implements IRuntimeInvisibleAnnotationsAttribute { private static final IAnnotation [ ] NO_ENTRIES = new IAnnotation [ <NUM_LIT:0> ] ; private int annotationsNumber ; private IAnnotation [ ] annotations ; public RuntimeInvisibleAnnotationsAttribute ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { super ( classFileBytes , constantPool , offset ) ; final int length = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; this . annotationsNumber = length ; if ( length != <NUM_LIT:0> ) { int readOffset = <NUM_LIT:8> ; this . annotations = new IAnnotation [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { Annotation annotation = new Annotation ( classFileBytes , constantPool , offset + readOffset ) ; this . annotations [ i ] = annotation ; readOffset += annotation . sizeInBytes ( ) ; } } else { this . annotations = NO_ENTRIES ; } } public IAnnotation [ ] getAnnotations ( ) { return this . annotations ; } public int getAnnotationsNumber ( ) { return this . annotationsNumber ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IStackMapFrame ; import org . eclipse . jdt . core . util . IStackMapTableAttribute ; public class StackMapTableAttribute extends ClassFileAttribute implements IStackMapTableAttribute { private static final IStackMapFrame [ ] NO_FRAMES = new IStackMapFrame [ <NUM_LIT:0> ] ; private static final byte [ ] NO_ENTRIES = new byte [ <NUM_LIT:0> ] ; private int numberOfEntries ; private IStackMapFrame [ ] frames ; private byte [ ] bytes ; public StackMapTableAttribute ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { super ( classFileBytes , constantPool , offset ) ; final int length = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; this . numberOfEntries = length ; if ( length != <NUM_LIT:0> ) { int readOffset = <NUM_LIT:8> ; this . frames = new IStackMapFrame [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { StackMapFrame frame = new StackMapFrame ( classFileBytes , constantPool , offset + readOffset ) ; this . frames [ i ] = frame ; readOffset += frame . sizeInBytes ( ) ; } } else { this . frames = NO_FRAMES ; } final int byteLength = ( int ) u4At ( classFileBytes , <NUM_LIT:2> , offset ) ; if ( length != <NUM_LIT:0> ) { System . arraycopy ( classFileBytes , offset + <NUM_LIT:6> , this . bytes = new byte [ byteLength ] , <NUM_LIT:0> , byteLength ) ; } else { this . bytes = NO_ENTRIES ; } } public int getNumberOfEntries ( ) { return this . numberOfEntries ; } public IStackMapFrame [ ] getStackMapFrame ( ) { return this . frames ; } public byte [ ] getBytes ( ) { return this . bytes ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; public abstract class ClassFileStruct { protected double doubleAt ( byte [ ] reference , int relativeOffset , int structOffset ) { return ( Double . longBitsToDouble ( i8At ( reference , relativeOffset , structOffset ) ) ) ; } protected float floatAt ( byte [ ] reference , int relativeOffset , int structOffset ) { return ( Float . intBitsToFloat ( i4At ( reference , relativeOffset , structOffset ) ) ) ; } protected int i1At ( byte [ ] reference , int relativeOffset , int structOffset ) { return reference [ relativeOffset + structOffset ] ; } protected int i2At ( byte [ ] reference , int relativeOffset , int structOffset ) { int position = relativeOffset + structOffset ; return ( reference [ position ++ ] << <NUM_LIT:8> ) + ( reference [ position ] & <NUM_LIT> ) ; } protected 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 long i8At ( byte [ ] reference , int relativeOffset , int structOffset ) { int position = relativeOffset + structOffset ; return ( ( ( long ) ( reference [ position ++ ] & <NUM_LIT> ) ) << <NUM_LIT> ) + ( ( ( long ) ( reference [ position ++ ] & <NUM_LIT> ) ) << <NUM_LIT> ) + ( ( ( long ) ( reference [ position ++ ] & <NUM_LIT> ) ) << <NUM_LIT> ) + ( ( ( long ) ( reference [ position ++ ] & <NUM_LIT> ) ) << <NUM_LIT:32> ) + ( ( ( long ) ( reference [ position ++ ] & <NUM_LIT> ) ) << <NUM_LIT:24> ) + ( ( ( long ) ( reference [ position ++ ] & <NUM_LIT> ) ) << <NUM_LIT:16> ) + ( ( ( long ) ( reference [ position ++ ] & <NUM_LIT> ) ) << <NUM_LIT:8> ) + ( reference [ position ++ ] & <NUM_LIT> ) ; } protected int u1At ( byte [ ] reference , int relativeOffset , int structOffset ) { return ( reference [ relativeOffset + structOffset ] & <NUM_LIT> ) ; } protected int u2At ( byte [ ] reference , int relativeOffset , int structOffset ) { int position = relativeOffset + structOffset ; return ( ( reference [ position ++ ] & <NUM_LIT> ) << <NUM_LIT:8> ) + ( reference [ position ] & <NUM_LIT> ) ; } protected 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> ) ) ; } protected char [ ] utf8At ( byte [ ] reference , int relativeOffset , int structOffset , int bytesAvailable ) { int length = bytesAvailable ; char outputBuf [ ] = new char [ bytesAvailable ] ; int outputPos = <NUM_LIT:0> ; int readOffset = structOffset + relativeOffset ; 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 ; } 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 ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IConstantPoolConstant ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; import org . eclipse . jdt . core . util . IVerificationTypeInfo ; public class VerificationInfo extends ClassFileStruct implements IVerificationTypeInfo { private int tag ; private int offset ; private int constantPoolIndex ; private char [ ] classTypeName ; private int readOffset ; public VerificationInfo ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { final int t = u1At ( classFileBytes , <NUM_LIT:0> , offset ) ; this . tag = t ; this . readOffset = <NUM_LIT:1> ; switch ( t ) { case IVerificationTypeInfo . ITEM_OBJECT : final int constantIndex = u2At ( classFileBytes , <NUM_LIT:1> , offset ) ; this . constantPoolIndex = constantIndex ; if ( constantIndex != <NUM_LIT:0> ) { IConstantPoolEntry constantPoolEntry = constantPool . decodeEntry ( constantIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Class ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . classTypeName = constantPoolEntry . getClassInfoName ( ) ; } this . readOffset += <NUM_LIT:2> ; break ; case IVerificationTypeInfo . ITEM_UNINITIALIZED : this . offset = u2At ( classFileBytes , <NUM_LIT:1> , offset ) ; this . readOffset += <NUM_LIT:2> ; } } public int getTag ( ) { return this . tag ; } public int getOffset ( ) { return this . offset ; } public int getConstantPoolIndex ( ) { return this . constantPoolIndex ; } public char [ ] getClassTypeName ( ) { return this . classTypeName ; } public int sizeInBytes ( ) { return this . readOffset ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . internal . compiler . ast . CompilationUnitDeclaration ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . parser . Parser ; import org . eclipse . jdt . internal . compiler . parser . Scanner ; import org . eclipse . jdt . internal . compiler . problem . ProblemReporter ; import org . eclipse . jdt . internal . compiler . problem . ProblemSeverities ; public class CommentRecorderParser extends Parser { int [ ] commentStops = new int [ <NUM_LIT:10> ] ; int [ ] commentStarts = new int [ <NUM_LIT:10> ] ; int commentPtr = - <NUM_LIT:1> ; protected final static int CommentIncrement = <NUM_LIT:100> ; public CommentRecorderParser ( ProblemReporter problemReporter , boolean optimizeStringLiterals ) { super ( problemReporter , optimizeStringLiterals ) ; } public void checkComment ( ) { if ( ! ( this . diet && this . dietInt == <NUM_LIT:0> ) && this . scanner . commentPtr >= <NUM_LIT:0> ) { flushCommentsDefinedPriorTo ( this . endStatementPosition ) ; } boolean deprecated = false ; boolean checkDeprecated = false ; int lastCommentIndex = - <NUM_LIT:1> ; nextComment : for ( lastCommentIndex = this . scanner . commentPtr ; lastCommentIndex >= <NUM_LIT:0> ; lastCommentIndex -- ) { int commentSourceStart = this . scanner . commentStarts [ lastCommentIndex ] ; if ( ( commentSourceStart < <NUM_LIT:0> ) || ( this . modifiersSourceStart != - <NUM_LIT:1> && this . modifiersSourceStart < commentSourceStart ) || ( this . scanner . commentStops [ lastCommentIndex ] < <NUM_LIT:0> ) ) { continue nextComment ; } checkDeprecated = true ; int commentSourceEnd = this . scanner . commentStops [ lastCommentIndex ] - <NUM_LIT:1> ; if ( this . javadocParser . shouldReportProblems ) { this . javadocParser . reportProblems = this . currentElement == null || commentSourceEnd > this . lastJavadocEnd ; } else { this . javadocParser . reportProblems = false ; } deprecated = this . javadocParser . checkDeprecation ( lastCommentIndex ) ; this . javadoc = this . javadocParser . docComment ; if ( this . currentElement == null ) this . lastJavadocEnd = commentSourceEnd ; break nextComment ; } if ( deprecated ) { checkAndSetModifiers ( ClassFileConstants . AccDeprecated ) ; } if ( lastCommentIndex >= <NUM_LIT:0> && checkDeprecated ) { this . modifiersSourceStart = this . scanner . commentStarts [ lastCommentIndex ] ; if ( this . modifiersSourceStart < <NUM_LIT:0> ) { this . modifiersSourceStart = - this . modifiersSourceStart ; } } } protected void consumeClassHeader ( ) { pushOnCommentsStack ( <NUM_LIT:0> , this . scanner . commentPtr ) ; super . consumeClassHeader ( ) ; } protected void consumeEmptyTypeDeclaration ( ) { pushOnCommentsStack ( <NUM_LIT:0> , this . scanner . commentPtr ) ; super . consumeEmptyTypeDeclaration ( ) ; } protected void consumeInterfaceHeader ( ) { pushOnCommentsStack ( <NUM_LIT:0> , this . scanner . commentPtr ) ; super . consumeInterfaceHeader ( ) ; } protected CompilationUnitDeclaration endParse ( int act ) { CompilationUnitDeclaration unit = super . endParse ( act ) ; if ( unit . comments == null ) { pushOnCommentsStack ( <NUM_LIT:0> , this . scanner . commentPtr ) ; unit . comments = getCommentsPositions ( ) ; } return unit ; } public int flushCommentsDefinedPriorTo ( int position ) { int lastCommentIndex = this . scanner . commentPtr ; if ( lastCommentIndex < <NUM_LIT:0> ) return position ; int index = lastCommentIndex ; int validCount = <NUM_LIT:0> ; while ( index >= <NUM_LIT:0> ) { int commentEnd = this . scanner . commentStops [ index ] ; if ( commentEnd < <NUM_LIT:0> ) commentEnd = - commentEnd ; if ( commentEnd <= position ) { break ; } index -- ; validCount ++ ; } if ( validCount > <NUM_LIT:0> ) { int immediateCommentEnd = <NUM_LIT:0> ; while ( index < lastCommentIndex && ( immediateCommentEnd = - this . scanner . commentStops [ index + <NUM_LIT:1> ] ) > <NUM_LIT:0> ) { immediateCommentEnd -- ; if ( org . eclipse . jdt . internal . compiler . util . Util . getLineNumber ( position , this . scanner . lineEnds , <NUM_LIT:0> , this . scanner . linePtr ) != org . eclipse . jdt . internal . compiler . util . Util . getLineNumber ( immediateCommentEnd , this . scanner . lineEnds , <NUM_LIT:0> , this . scanner . linePtr ) ) break ; position = immediateCommentEnd ; validCount -- ; index ++ ; } } if ( index < <NUM_LIT:0> ) return position ; pushOnCommentsStack ( <NUM_LIT:0> , index ) ; switch ( validCount ) { case <NUM_LIT:0> : break ; case <NUM_LIT:2> : this . scanner . commentStarts [ <NUM_LIT:0> ] = this . scanner . commentStarts [ index + <NUM_LIT:1> ] ; this . scanner . commentStops [ <NUM_LIT:0> ] = this . scanner . commentStops [ index + <NUM_LIT:1> ] ; this . scanner . commentTagStarts [ <NUM_LIT:0> ] = this . scanner . commentTagStarts [ index + <NUM_LIT:1> ] ; this . scanner . commentStarts [ <NUM_LIT:1> ] = this . scanner . commentStarts [ index + <NUM_LIT:2> ] ; this . scanner . commentStops [ <NUM_LIT:1> ] = this . scanner . commentStops [ index + <NUM_LIT:2> ] ; this . scanner . commentTagStarts [ <NUM_LIT:1> ] = this . scanner . commentTagStarts [ index + <NUM_LIT:2> ] ; break ; case <NUM_LIT:1> : this . scanner . commentStarts [ <NUM_LIT:0> ] = this . scanner . commentStarts [ index + <NUM_LIT:1> ] ; this . scanner . commentStops [ <NUM_LIT:0> ] = this . scanner . commentStops [ index + <NUM_LIT:1> ] ; this . scanner . commentTagStarts [ <NUM_LIT:0> ] = this . scanner . commentTagStarts [ index + <NUM_LIT:1> ] ; break ; default : System . arraycopy ( this . scanner . commentStarts , index + <NUM_LIT:1> , this . scanner . commentStarts , <NUM_LIT:0> , validCount ) ; System . arraycopy ( this . scanner . commentStops , index + <NUM_LIT:1> , this . scanner . commentStops , <NUM_LIT:0> , validCount ) ; System . arraycopy ( this . scanner . commentTagStarts , index + <NUM_LIT:1> , this . scanner . commentTagStarts , <NUM_LIT:0> , validCount ) ; } this . scanner . commentPtr = validCount - <NUM_LIT:1> ; return position ; } public int [ ] [ ] getCommentsPositions ( ) { int [ ] [ ] positions = new int [ this . commentPtr + <NUM_LIT:1> ] [ <NUM_LIT:2> ] ; for ( int i = <NUM_LIT:0> , max = this . commentPtr ; i <= max ; i ++ ) { positions [ i ] [ <NUM_LIT:0> ] = this . commentStarts [ i ] ; positions [ i ] [ <NUM_LIT:1> ] = this . commentStops [ i ] ; } return positions ; } public void initialize ( boolean initializeNLS ) { super . initialize ( initializeNLS ) ; this . commentPtr = - <NUM_LIT:1> ; } public void initialize ( ) { super . initialize ( ) ; this . commentPtr = - <NUM_LIT:1> ; } public void initializeScanner ( ) { this . scanner = new Scanner ( false , false , this . options . getSeverity ( CompilerOptions . NonExternalizedString ) != ProblemSeverities . Ignore , this . options . sourceLevel , this . options . taskTags , this . options . taskPriorities , this . options . isTaskCaseSensitive ) ; this . options . taskPriorities = scanner . taskPriorities ; } private void pushOnCommentsStack ( int start , int end ) { for ( int i = start ; i <= end ; i ++ ) { int scannerStart = this . scanner . commentStarts [ i ] < <NUM_LIT:0> ? - this . scanner . commentStarts [ i ] : this . scanner . commentStarts [ i ] ; int commentStart = this . commentPtr == - <NUM_LIT:1> ? - <NUM_LIT:1> : ( this . commentStarts [ this . commentPtr ] < <NUM_LIT:0> ? - this . commentStarts [ this . commentPtr ] : this . commentStarts [ this . commentPtr ] ) ; if ( commentStart == - <NUM_LIT:1> || scannerStart > commentStart ) { int stackLength = this . commentStarts . length ; if ( ++ this . commentPtr >= stackLength ) { System . arraycopy ( this . commentStarts , <NUM_LIT:0> , this . commentStarts = new int [ stackLength + CommentIncrement ] , <NUM_LIT:0> , stackLength ) ; System . arraycopy ( this . commentStops , <NUM_LIT:0> , this . commentStops = new int [ stackLength + CommentIncrement ] , <NUM_LIT:0> , stackLength ) ; } this . commentStarts [ this . commentPtr ] = this . scanner . commentStarts [ i ] ; this . commentStops [ this . commentPtr ] = this . scanner . commentStops [ i ] ; } } } protected void resetModifiers ( ) { pushOnCommentsStack ( <NUM_LIT:0> , this . scanner . commentPtr ) ; super . resetModifiers ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IAttributeNamesConstants ; import org . eclipse . jdt . core . util . IBytecodeVisitor ; import org . eclipse . jdt . core . util . IClassFileAttribute ; import org . eclipse . jdt . core . util . ICodeAttribute ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IConstantPoolConstant ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; import org . eclipse . jdt . core . util . IExceptionTableEntry ; import org . eclipse . jdt . core . util . ILineNumberAttribute ; import org . eclipse . jdt . core . util . ILocalVariableAttribute ; import org . eclipse . jdt . core . util . IOpcodeMnemonics ; public class CodeAttribute extends ClassFileAttribute implements ICodeAttribute { private static final IExceptionTableEntry [ ] NO_EXCEPTION_TABLE = new IExceptionTableEntry [ <NUM_LIT:0> ] ; private IClassFileAttribute [ ] attributes ; private int attributesCount ; private byte [ ] bytecodes ; private byte [ ] classFileBytes ; private long codeLength ; private int codeOffset ; private IConstantPool constantPool ; private IExceptionTableEntry [ ] exceptionTableEntries ; private int exceptionTableLength ; private ILineNumberAttribute lineNumberAttribute ; private ILocalVariableAttribute localVariableAttribute ; private int maxLocals ; private int maxStack ; CodeAttribute ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { super ( classFileBytes , constantPool , offset ) ; this . classFileBytes = classFileBytes ; this . constantPool = constantPool ; this . maxStack = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; this . maxLocals = u2At ( classFileBytes , <NUM_LIT:8> , offset ) ; this . codeLength = u4At ( classFileBytes , <NUM_LIT:10> , offset ) ; this . codeOffset = offset + <NUM_LIT> ; int readOffset = ( int ) ( <NUM_LIT> + this . codeLength ) ; this . exceptionTableLength = u2At ( classFileBytes , readOffset , offset ) ; readOffset += <NUM_LIT:2> ; this . exceptionTableEntries = NO_EXCEPTION_TABLE ; if ( this . exceptionTableLength != <NUM_LIT:0> ) { this . exceptionTableEntries = new ExceptionTableEntry [ this . exceptionTableLength ] ; for ( int i = <NUM_LIT:0> ; i < this . exceptionTableLength ; i ++ ) { this . exceptionTableEntries [ i ] = new ExceptionTableEntry ( classFileBytes , constantPool , offset + readOffset ) ; readOffset += <NUM_LIT:8> ; } } this . attributesCount = u2At ( classFileBytes , readOffset , offset ) ; this . attributes = ClassFileAttribute . NO_ATTRIBUTES ; if ( this . attributesCount != <NUM_LIT:0> ) { this . attributes = new IClassFileAttribute [ this . attributesCount ] ; } int attributesIndex = <NUM_LIT:0> ; readOffset += <NUM_LIT:2> ; for ( int i = <NUM_LIT:0> ; i < this . attributesCount ; i ++ ) { IConstantPoolEntry constantPoolEntry = constantPool . decodeEntry ( u2At ( classFileBytes , readOffset , offset ) ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } char [ ] attributeName = constantPoolEntry . getUtf8Value ( ) ; if ( equals ( attributeName , IAttributeNamesConstants . LINE_NUMBER ) ) { this . lineNumberAttribute = new LineNumberAttribute ( classFileBytes , constantPool , offset + readOffset ) ; this . attributes [ attributesIndex ++ ] = this . lineNumberAttribute ; } else if ( equals ( attributeName , IAttributeNamesConstants . LOCAL_VARIABLE ) ) { this . localVariableAttribute = new LocalVariableAttribute ( classFileBytes , constantPool , offset + readOffset ) ; this . attributes [ attributesIndex ++ ] = this . localVariableAttribute ; } else if ( equals ( attributeName , IAttributeNamesConstants . LOCAL_VARIABLE_TYPE_TABLE ) ) { this . attributes [ attributesIndex ++ ] = new LocalVariableTypeAttribute ( classFileBytes , constantPool , offset + readOffset ) ; } else if ( equals ( attributeName , IAttributeNamesConstants . STACK_MAP_TABLE ) ) { this . attributes [ attributesIndex ++ ] = new StackMapTableAttribute ( classFileBytes , constantPool , offset + readOffset ) ; } else if ( equals ( attributeName , IAttributeNamesConstants . STACK_MAP ) ) { this . attributes [ attributesIndex ++ ] = new StackMapAttribute ( classFileBytes , constantPool , offset + readOffset ) ; } else { this . attributes [ attributesIndex ++ ] = new ClassFileAttribute ( classFileBytes , constantPool , offset + readOffset ) ; } readOffset += ( <NUM_LIT:6> + u4At ( classFileBytes , readOffset + <NUM_LIT:2> , offset ) ) ; } } public IClassFileAttribute [ ] getAttributes ( ) { return this . attributes ; } public int getAttributesCount ( ) { return this . attributesCount ; } public byte [ ] getBytecodes ( ) { if ( this . bytecodes == null ) { System . arraycopy ( this . classFileBytes , this . codeOffset , ( this . bytecodes = new byte [ ( int ) this . codeLength ] ) , <NUM_LIT:0> , ( int ) this . codeLength ) ; } return this . bytecodes ; } public long getCodeLength ( ) { return this . codeLength ; } public IExceptionTableEntry [ ] getExceptionTable ( ) { return this . exceptionTableEntries ; } public int getExceptionTableLength ( ) { return this . exceptionTableLength ; } public ILineNumberAttribute getLineNumberAttribute ( ) { return this . lineNumberAttribute ; } public ILocalVariableAttribute getLocalVariableAttribute ( ) { return this . localVariableAttribute ; } public int getMaxLocals ( ) { return this . maxLocals ; } public int getMaxStack ( ) { return this . maxStack ; } public void traverse ( IBytecodeVisitor visitor ) throws ClassFormatException { int pc = this . codeOffset ; int opcode , index , _const , branchOffset ; IConstantPoolEntry constantPoolEntry ; while ( true ) { opcode = u1At ( this . classFileBytes , <NUM_LIT:0> , pc ) ; switch ( opcode ) { case IOpcodeMnemonics . NOP : visitor . _nop ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ACONST_NULL : visitor . _aconst_null ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ICONST_M1 : visitor . _iconst_m1 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ICONST_0 : visitor . _iconst_0 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ICONST_1 : visitor . _iconst_1 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ICONST_2 : visitor . _iconst_2 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ICONST_3 : visitor . _iconst_3 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ICONST_4 : visitor . _iconst_4 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ICONST_5 : visitor . _iconst_5 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LCONST_0 : visitor . _lconst_0 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LCONST_1 : visitor . _lconst_1 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FCONST_0 : visitor . _fconst_0 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FCONST_1 : visitor . _fconst_1 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FCONST_2 : visitor . _fconst_2 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DCONST_0 : visitor . _dconst_0 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DCONST_1 : visitor . _dconst_1 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . BIPUSH : visitor . _bipush ( pc - this . codeOffset , ( byte ) i1At ( this . classFileBytes , <NUM_LIT:1> , pc ) ) ; pc += <NUM_LIT:2> ; break ; case IOpcodeMnemonics . SIPUSH : visitor . _sipush ( pc - this . codeOffset , ( short ) i2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . LDC : index = u1At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; constantPoolEntry = this . constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Float && constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Integer && constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_String && constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Class ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } visitor . _ldc ( pc - this . codeOffset , index , constantPoolEntry ) ; pc += <NUM_LIT:2> ; break ; case IOpcodeMnemonics . LDC_W : index = u2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; constantPoolEntry = this . constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Float && constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Integer && constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_String && constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Class ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } visitor . _ldc_w ( pc - this . codeOffset , index , constantPoolEntry ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . LDC2_W : index = u2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; constantPoolEntry = this . constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Double && constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Long ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } visitor . _ldc2_w ( pc - this . codeOffset , index , constantPoolEntry ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . ILOAD : index = u1At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _iload ( pc - this . codeOffset , index ) ; pc += <NUM_LIT:2> ; break ; case IOpcodeMnemonics . LLOAD : index = u1At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _lload ( pc - this . codeOffset , index ) ; pc += <NUM_LIT:2> ; break ; case IOpcodeMnemonics . FLOAD : index = u1At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _fload ( pc - this . codeOffset , index ) ; pc += <NUM_LIT:2> ; break ; case IOpcodeMnemonics . DLOAD : index = u1At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _dload ( pc - this . codeOffset , index ) ; pc += <NUM_LIT:2> ; break ; case IOpcodeMnemonics . ALOAD : index = u1At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _aload ( pc - this . codeOffset , index ) ; pc += <NUM_LIT:2> ; break ; case IOpcodeMnemonics . ILOAD_0 : visitor . _iload_0 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ILOAD_1 : visitor . _iload_1 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ILOAD_2 : visitor . _iload_2 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ILOAD_3 : visitor . _iload_3 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LLOAD_0 : visitor . _lload_0 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LLOAD_1 : visitor . _lload_1 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LLOAD_2 : visitor . _lload_2 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LLOAD_3 : visitor . _lload_3 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FLOAD_0 : visitor . _fload_0 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FLOAD_1 : visitor . _fload_1 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FLOAD_2 : visitor . _fload_2 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FLOAD_3 : visitor . _fload_3 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DLOAD_0 : visitor . _dload_0 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DLOAD_1 : visitor . _dload_1 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DLOAD_2 : visitor . _dload_2 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DLOAD_3 : visitor . _dload_3 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ALOAD_0 : visitor . _aload_0 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ALOAD_1 : visitor . _aload_1 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ALOAD_2 : visitor . _aload_2 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ALOAD_3 : visitor . _aload_3 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . IALOAD : visitor . _iaload ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LALOAD : visitor . _laload ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FALOAD : visitor . _faload ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DALOAD : visitor . _daload ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . AALOAD : visitor . _aaload ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . BALOAD : visitor . _baload ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . CALOAD : visitor . _caload ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . SALOAD : visitor . _saload ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ISTORE : index = u1At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _istore ( pc - this . codeOffset , index ) ; pc += <NUM_LIT:2> ; break ; case IOpcodeMnemonics . LSTORE : index = u1At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _lstore ( pc - this . codeOffset , index ) ; pc += <NUM_LIT:2> ; break ; case IOpcodeMnemonics . FSTORE : index = u1At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _fstore ( pc - this . codeOffset , index ) ; pc += <NUM_LIT:2> ; break ; case IOpcodeMnemonics . DSTORE : index = u1At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _dstore ( pc - this . codeOffset , index ) ; pc += <NUM_LIT:2> ; break ; case IOpcodeMnemonics . ASTORE : index = u1At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _astore ( pc - this . codeOffset , index ) ; pc += <NUM_LIT:2> ; break ; case IOpcodeMnemonics . ISTORE_0 : visitor . _istore_0 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ISTORE_1 : visitor . _istore_1 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ISTORE_2 : visitor . _istore_2 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ISTORE_3 : visitor . _istore_3 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LSTORE_0 : visitor . _lstore_0 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LSTORE_1 : visitor . _lstore_1 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LSTORE_2 : visitor . _lstore_2 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LSTORE_3 : visitor . _lstore_3 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FSTORE_0 : visitor . _fstore_0 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FSTORE_1 : visitor . _fstore_1 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FSTORE_2 : visitor . _fstore_2 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FSTORE_3 : visitor . _fstore_3 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DSTORE_0 : visitor . _dstore_0 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DSTORE_1 : visitor . _dstore_1 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DSTORE_2 : visitor . _dstore_2 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DSTORE_3 : visitor . _dstore_3 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ASTORE_0 : visitor . _astore_0 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ASTORE_1 : visitor . _astore_1 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ASTORE_2 : visitor . _astore_2 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ASTORE_3 : visitor . _astore_3 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . IASTORE : visitor . _iastore ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LASTORE : visitor . _lastore ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FASTORE : visitor . _fastore ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DASTORE : visitor . _dastore ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . AASTORE : visitor . _aastore ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . BASTORE : visitor . _bastore ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . CASTORE : visitor . _castore ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . SASTORE : visitor . _sastore ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . POP : visitor . _pop ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . POP2 : visitor . _pop2 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DUP : visitor . _dup ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DUP_X1 : visitor . _dup_x1 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DUP_X2 : visitor . _dup_x2 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DUP2 : visitor . _dup2 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DUP2_X1 : visitor . _dup2_x1 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DUP2_X2 : visitor . _dup2_x2 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . SWAP : visitor . _swap ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . IADD : visitor . _iadd ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LADD : visitor . _ladd ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FADD : visitor . _fadd ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DADD : visitor . _dadd ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ISUB : visitor . _isub ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LSUB : visitor . _lsub ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FSUB : visitor . _fsub ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DSUB : visitor . _dsub ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . IMUL : visitor . _imul ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LMUL : visitor . _lmul ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FMUL : visitor . _fmul ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DMUL : visitor . _dmul ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . IDIV : visitor . _idiv ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LDIV : visitor . _ldiv ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FDIV : visitor . _fdiv ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DDIV : visitor . _ddiv ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . IREM : visitor . _irem ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LREM : visitor . _lrem ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FREM : visitor . _frem ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DREM : visitor . _drem ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . INEG : visitor . _ineg ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LNEG : visitor . _lneg ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FNEG : visitor . _fneg ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DNEG : visitor . _dneg ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ISHL : visitor . _ishl ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LSHL : visitor . _lshl ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ISHR : visitor . _ishr ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LSHR : visitor . _lshr ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . IUSHR : visitor . _iushr ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LUSHR : visitor . _lushr ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . IAND : visitor . _iand ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LAND : visitor . _land ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . IOR : visitor . _ior ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LOR : visitor . _lor ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . IXOR : visitor . _ixor ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LXOR : visitor . _lxor ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . IINC : index = u1At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; _const = i1At ( this . classFileBytes , <NUM_LIT:2> , pc ) ; visitor . _iinc ( pc - this . codeOffset , index , _const ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . I2L : visitor . _i2l ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . I2F : visitor . _i2f ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . I2D : visitor . _i2d ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . L2I : visitor . _l2i ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . L2F : visitor . _l2f ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . L2D : visitor . _l2d ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . F2I : visitor . _f2i ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . F2L : visitor . _f2l ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . F2D : visitor . _f2d ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . D2I : visitor . _d2i ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . D2L : visitor . _d2l ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . D2F : visitor . _d2f ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . I2B : visitor . _i2b ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . I2C : visitor . _i2c ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . I2S : visitor . _i2s ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LCMP : visitor . _lcmp ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FCMPL : visitor . _fcmpl ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FCMPG : visitor . _fcmpg ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DCMPL : visitor . _dcmpl ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DCMPG : visitor . _dcmpg ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . IFEQ : branchOffset = i2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _ifeq ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . IFNE : branchOffset = i2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _ifne ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . IFLT : branchOffset = i2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _iflt ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . IFGE : branchOffset = i2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _ifge ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . IFGT : branchOffset = i2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _ifgt ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . IFLE : branchOffset = i2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _ifle ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . IF_ICMPEQ : branchOffset = i2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _if_icmpeq ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . IF_ICMPNE : branchOffset = i2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _if_icmpne ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . IF_ICMPLT : branchOffset = i2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _if_icmplt ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . IF_ICMPGE : branchOffset = i2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _if_icmpge ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . IF_ICMPGT : branchOffset = i2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _if_icmpgt ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . IF_ICMPLE : branchOffset = i2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _if_icmple ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . IF_ACMPEQ : branchOffset = i2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _if_acmpeq ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . IF_ACMPNE : branchOffset = i2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _if_acmpne ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . GOTO : branchOffset = i2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _goto ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . JSR : branchOffset = i2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _jsr ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . RET : index = u1At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _ret ( pc - this . codeOffset , index ) ; pc += <NUM_LIT:2> ; break ; case IOpcodeMnemonics . TABLESWITCH : int startpc = pc ; pc ++ ; while ( ( ( pc - this . codeOffset ) & <NUM_LIT> ) != <NUM_LIT:0> ) { pc ++ ; } int defaultOffset = i4At ( this . classFileBytes , <NUM_LIT:0> , pc ) ; pc += <NUM_LIT:4> ; int low = i4At ( this . classFileBytes , <NUM_LIT:0> , pc ) ; pc += <NUM_LIT:4> ; int high = i4At ( this . classFileBytes , <NUM_LIT:0> , pc ) ; pc += <NUM_LIT:4> ; int length = high - low + <NUM_LIT:1> ; int [ ] jumpOffsets = new int [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { jumpOffsets [ i ] = i4At ( this . classFileBytes , <NUM_LIT:0> , pc ) ; pc += <NUM_LIT:4> ; } visitor . _tableswitch ( startpc - this . codeOffset , defaultOffset , low , high , jumpOffsets ) ; break ; case IOpcodeMnemonics . LOOKUPSWITCH : startpc = pc ; pc ++ ; while ( ( ( pc - this . codeOffset ) & <NUM_LIT> ) != <NUM_LIT:0> ) { pc ++ ; } defaultOffset = i4At ( this . classFileBytes , <NUM_LIT:0> , pc ) ; pc += <NUM_LIT:4> ; int npairs = ( int ) u4At ( this . classFileBytes , <NUM_LIT:0> , pc ) ; int [ ] [ ] offset_pairs = new int [ npairs ] [ <NUM_LIT:2> ] ; pc += <NUM_LIT:4> ; for ( int i = <NUM_LIT:0> ; i < npairs ; i ++ ) { offset_pairs [ i ] [ <NUM_LIT:0> ] = i4At ( this . classFileBytes , <NUM_LIT:0> , pc ) ; pc += <NUM_LIT:4> ; offset_pairs [ i ] [ <NUM_LIT:1> ] = i4At ( this . classFileBytes , <NUM_LIT:0> , pc ) ; pc += <NUM_LIT:4> ; } visitor . _lookupswitch ( startpc - this . codeOffset , defaultOffset , npairs , offset_pairs ) ; break ; case IOpcodeMnemonics . IRETURN : visitor . _ireturn ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . LRETURN : visitor . _lreturn ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . FRETURN : visitor . _freturn ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . DRETURN : visitor . _dreturn ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ARETURN : visitor . _areturn ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . RETURN : visitor . _return ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . GETSTATIC : index = u2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; constantPoolEntry = this . constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Fieldref ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } visitor . _getstatic ( pc - this . codeOffset , index , constantPoolEntry ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . PUTSTATIC : index = u2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; constantPoolEntry = this . constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Fieldref ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } visitor . _putstatic ( pc - this . codeOffset , index , constantPoolEntry ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . GETFIELD : index = u2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; constantPoolEntry = this . constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Fieldref ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } visitor . _getfield ( pc - this . codeOffset , index , constantPoolEntry ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . PUTFIELD : index = u2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; constantPoolEntry = this . constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Fieldref ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } visitor . _putfield ( pc - this . codeOffset , index , constantPoolEntry ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . INVOKEVIRTUAL : index = u2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; constantPoolEntry = this . constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Methodref ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } visitor . _invokevirtual ( pc - this . codeOffset , index , constantPoolEntry ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . INVOKESPECIAL : index = u2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; constantPoolEntry = this . constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Methodref ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } visitor . _invokespecial ( pc - this . codeOffset , index , constantPoolEntry ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . INVOKESTATIC : index = u2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; constantPoolEntry = this . constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Methodref ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } visitor . _invokestatic ( pc - this . codeOffset , index , constantPoolEntry ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . INVOKEINTERFACE : index = u2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; constantPoolEntry = this . constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_InterfaceMethodref ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } byte count = ( byte ) u1At ( this . classFileBytes , <NUM_LIT:3> , pc ) ; int extraArgs = u1At ( this . classFileBytes , <NUM_LIT:4> , pc ) ; if ( extraArgs != <NUM_LIT:0> ) { throw new ClassFormatException ( ClassFormatException . INVALID_ARGUMENTS_FOR_INVOKEINTERFACE ) ; } visitor . _invokeinterface ( pc - this . codeOffset , index , count , constantPoolEntry ) ; pc += <NUM_LIT:5> ; break ; case IOpcodeMnemonics . INVOKEDYNAMIC : index = u2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; constantPoolEntry = this . constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_NameAndType ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } visitor . _invokedynamic ( pc - this . codeOffset , index , this . constantPool . decodeEntry ( constantPoolEntry . getNameAndTypeInfoNameIndex ( ) ) , this . constantPool . decodeEntry ( constantPoolEntry . getNameAndTypeInfoDescriptorIndex ( ) ) ) ; pc += <NUM_LIT:5> ; break ; case IOpcodeMnemonics . NEW : index = u2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; constantPoolEntry = this . constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Class ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } visitor . _new ( pc - this . codeOffset , index , constantPoolEntry ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . NEWARRAY : int atype = u1At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _newarray ( pc - this . codeOffset , atype ) ; pc += <NUM_LIT:2> ; break ; case IOpcodeMnemonics . ANEWARRAY : index = u2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; constantPoolEntry = this . constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Class ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } visitor . _anewarray ( pc - this . codeOffset , index , constantPoolEntry ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . ARRAYLENGTH : visitor . _arraylength ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . ATHROW : visitor . _athrow ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . CHECKCAST : index = u2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; constantPoolEntry = this . constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Class ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } visitor . _checkcast ( pc - this . codeOffset , index , constantPoolEntry ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . INSTANCEOF : index = u2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; constantPoolEntry = this . constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Class ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } visitor . _instanceof ( pc - this . codeOffset , index , constantPoolEntry ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . MONITORENTER : visitor . _monitorenter ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . MONITOREXIT : visitor . _monitorexit ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . WIDE : opcode = u1At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; if ( opcode == IOpcodeMnemonics . IINC ) { index = u2At ( this . classFileBytes , <NUM_LIT:2> , pc ) ; _const = i2At ( this . classFileBytes , <NUM_LIT:4> , pc ) ; visitor . _wide ( pc - this . codeOffset , opcode , index , _const ) ; pc += <NUM_LIT:6> ; } else { index = u2At ( this . classFileBytes , <NUM_LIT:2> , pc ) ; visitor . _wide ( pc - this . codeOffset , opcode , index ) ; pc += <NUM_LIT:4> ; } break ; case IOpcodeMnemonics . MULTIANEWARRAY : index = u2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; constantPoolEntry = this . constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Class ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } int dimensions = u1At ( this . classFileBytes , <NUM_LIT:3> , pc ) ; visitor . _multianewarray ( pc - this . codeOffset , index , dimensions , constantPoolEntry ) ; pc += <NUM_LIT:4> ; break ; case IOpcodeMnemonics . IFNULL : branchOffset = i2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _ifnull ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . IFNONNULL : branchOffset = i2At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _ifnonnull ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:3> ; break ; case IOpcodeMnemonics . GOTO_W : branchOffset = i4At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _goto_w ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:5> ; break ; case IOpcodeMnemonics . JSR_W : branchOffset = i4At ( this . classFileBytes , <NUM_LIT:1> , pc ) ; visitor . _jsr_w ( pc - this . codeOffset , branchOffset ) ; pc += <NUM_LIT:5> ; break ; case IOpcodeMnemonics . BREAKPOINT : visitor . _breakpoint ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . IMPDEP1 : visitor . _impdep1 ( pc - this . codeOffset ) ; pc ++ ; break ; case IOpcodeMnemonics . IMPDEP2 : visitor . _impdep2 ( pc - this . codeOffset ) ; pc ++ ; break ; default : throw new ClassFormatException ( ClassFormatException . INVALID_BYTECODE ) ; } if ( pc >= ( this . codeLength + this . codeOffset ) ) { break ; } } } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IConstantPoolConstant ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; import org . eclipse . jdt . core . util . IEnclosingMethodAttribute ; public class EnclosingMethodAttribute extends ClassFileAttribute implements IEnclosingMethodAttribute { private int enclosingClassIndex ; private char [ ] enclosingClassName ; private int methodDescriptorIndex ; private char [ ] methodDescriptor ; private int methodNameIndex ; private char [ ] methodName ; private int methodNameAndTypeIndex ; EnclosingMethodAttribute ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { super ( classFileBytes , constantPool , offset ) ; int index = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; this . enclosingClassIndex = index ; IConstantPoolEntry constantPoolEntry = constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Class ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . enclosingClassName = constantPoolEntry . getClassInfoName ( ) ; this . methodNameAndTypeIndex = u2At ( classFileBytes , <NUM_LIT:8> , offset ) ; if ( this . methodNameAndTypeIndex != <NUM_LIT:0> ) { constantPoolEntry = constantPool . decodeEntry ( this . methodNameAndTypeIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_NameAndType ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . methodDescriptorIndex = constantPoolEntry . getNameAndTypeInfoDescriptorIndex ( ) ; this . methodNameIndex = constantPoolEntry . getNameAndTypeInfoNameIndex ( ) ; constantPoolEntry = constantPool . decodeEntry ( this . methodDescriptorIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . methodDescriptor = constantPoolEntry . getUtf8Value ( ) ; constantPoolEntry = constantPool . decodeEntry ( this . methodNameIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . methodName = constantPoolEntry . getUtf8Value ( ) ; } } public char [ ] getEnclosingClass ( ) { return this . enclosingClassName ; } public int getEnclosingClassIndex ( ) { return this . enclosingClassIndex ; } public char [ ] getMethodDescriptor ( ) { return this . methodDescriptor ; } public int getMethodDescriptorIndex ( ) { return this . methodDescriptorIndex ; } public char [ ] getMethodName ( ) { return this . methodName ; } public int getMethodNameIndex ( ) { return this . methodNameIndex ; } public int getMethodNameAndTypeIndex ( ) { return this . methodNameAndTypeIndex ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . IInitializer ; import org . eclipse . jdt . core . IMember ; import org . eclipse . jdt . core . ISourceRange ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . dom . ASTNode ; import org . eclipse . jdt . core . dom . ASTVisitor ; 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 . ClassInstanceCreation ; import org . eclipse . jdt . core . dom . CompilationUnit ; import org . eclipse . jdt . core . dom . EnumConstantDeclaration ; import org . eclipse . jdt . core . dom . EnumDeclaration ; import org . eclipse . jdt . core . dom . IBinding ; import org . eclipse . jdt . core . dom . ImportDeclaration ; import org . eclipse . jdt . core . dom . Initializer ; import org . eclipse . jdt . core . dom . MarkerAnnotation ; import org . eclipse . jdt . core . dom . MethodDeclaration ; import org . eclipse . jdt . core . dom . NormalAnnotation ; import org . eclipse . jdt . core . dom . PackageDeclaration ; import org . eclipse . jdt . core . dom . ParameterizedType ; import org . eclipse . jdt . core . dom . SingleMemberAnnotation ; import org . eclipse . jdt . core . dom . TypeDeclaration ; import org . eclipse . jdt . core . dom . TypeParameter ; import org . eclipse . jdt . core . dom . VariableDeclarationFragment ; import org . eclipse . jdt . internal . core . SourceRefElement ; public class DOMFinder extends ASTVisitor { public ASTNode foundNode = null ; public IBinding foundBinding = null ; private CompilationUnit ast ; private SourceRefElement element ; private boolean resolveBinding ; private int rangeStart = - <NUM_LIT:1> , rangeLength = <NUM_LIT:0> ; public DOMFinder ( CompilationUnit ast , SourceRefElement element , boolean resolveBinding ) { this . ast = ast ; this . element = element ; this . resolveBinding = resolveBinding ; } protected boolean found ( ASTNode node , ASTNode name ) { if ( name . getStartPosition ( ) == this . rangeStart && name . getLength ( ) == this . rangeLength ) { this . foundNode = node ; return true ; } return false ; } public ASTNode search ( ) throws JavaModelException { ISourceRange range = null ; if ( this . element instanceof IMember && ! ( this . element instanceof IInitializer ) ) range = ( ( IMember ) this . element ) . getNameRange ( ) ; else range = this . element . getSourceRange ( ) ; this . rangeStart = range . getOffset ( ) ; this . rangeLength = range . getLength ( ) ; this . ast . accept ( this ) ; return this . foundNode ; } public boolean visit ( AnnotationTypeDeclaration node ) { if ( found ( node , node . getName ( ) ) && this . resolveBinding ) this . foundBinding = node . resolveBinding ( ) ; return true ; } public boolean visit ( AnnotationTypeMemberDeclaration node ) { if ( found ( node , node . getName ( ) ) && this . resolveBinding ) this . foundBinding = node . resolveBinding ( ) ; return true ; } public boolean visit ( AnonymousClassDeclaration node ) { ASTNode name ; ASTNode parent = node . getParent ( ) ; switch ( parent . getNodeType ( ) ) { case ASTNode . CLASS_INSTANCE_CREATION : name = ( ( ClassInstanceCreation ) parent ) . getType ( ) ; if ( name . getNodeType ( ) == ASTNode . PARAMETERIZED_TYPE ) { name = ( ( ParameterizedType ) name ) . getType ( ) ; } break ; case ASTNode . ENUM_CONSTANT_DECLARATION : name = ( ( EnumConstantDeclaration ) parent ) . getName ( ) ; break ; default : return true ; } if ( found ( node , name ) && this . resolveBinding ) this . foundBinding = node . resolveBinding ( ) ; return true ; } public boolean visit ( EnumConstantDeclaration node ) { if ( found ( node , node . getName ( ) ) && this . resolveBinding ) this . foundBinding = node . resolveVariable ( ) ; return true ; } public boolean visit ( EnumDeclaration node ) { if ( found ( node , node . getName ( ) ) && this . resolveBinding ) this . foundBinding = node . resolveBinding ( ) ; return true ; } public boolean visit ( ImportDeclaration node ) { if ( found ( node , node ) && this . resolveBinding ) this . foundBinding = node . resolveBinding ( ) ; return true ; } public boolean visit ( Initializer node ) { found ( node , node ) ; return true ; } public boolean visit ( MarkerAnnotation node ) { if ( found ( node , node ) && this . resolveBinding ) this . foundBinding = node . resolveAnnotationBinding ( ) ; return true ; } public boolean visit ( MethodDeclaration node ) { if ( found ( node , node . getName ( ) ) && this . resolveBinding ) this . foundBinding = node . resolveBinding ( ) ; return true ; } public boolean visit ( NormalAnnotation node ) { if ( found ( node , node ) && this . resolveBinding ) this . foundBinding = node . resolveAnnotationBinding ( ) ; return true ; } public boolean visit ( PackageDeclaration node ) { if ( found ( node , node ) && this . resolveBinding ) this . foundBinding = node . resolveBinding ( ) ; return true ; } public boolean visit ( SingleMemberAnnotation node ) { if ( found ( node , node ) && this . resolveBinding ) this . foundBinding = node . resolveAnnotationBinding ( ) ; return true ; } public boolean visit ( TypeDeclaration node ) { if ( found ( node , node . getName ( ) ) && this . resolveBinding ) this . foundBinding = node . resolveBinding ( ) ; return true ; } public boolean visit ( TypeParameter node ) { if ( found ( node , node . getName ( ) ) && this . resolveBinding ) this . foundBinding = node . resolveBinding ( ) ; return true ; } public boolean visit ( VariableDeclarationFragment node ) { if ( found ( node , node . getName ( ) ) && this . resolveBinding ) this . foundBinding = node . resolveBinding ( ) ; return true ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import java . util . Enumeration ; public interface ICacheEnumeration extends Enumeration { public Object getValue ( ) ; } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IAnnotation ; import org . eclipse . jdt . core . util . IAnnotationComponent ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IConstantPoolConstant ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; public class Annotation extends ClassFileStruct implements IAnnotation { private static final IAnnotationComponent [ ] NO_ENTRIES = new IAnnotationComponent [ <NUM_LIT:0> ] ; private int typeIndex ; private char [ ] typeName ; private int componentsNumber ; private IAnnotationComponent [ ] components ; private int readOffset ; public Annotation ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { final int index = u2At ( classFileBytes , <NUM_LIT:0> , offset ) ; this . typeIndex = index ; if ( index != <NUM_LIT:0> ) { IConstantPoolEntry constantPoolEntry = constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . typeName = constantPoolEntry . getUtf8Value ( ) ; } else { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } final int length = u2At ( classFileBytes , <NUM_LIT:2> , offset ) ; this . componentsNumber = length ; this . readOffset = <NUM_LIT:4> ; if ( length != <NUM_LIT:0> ) { this . components = new IAnnotationComponent [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { AnnotationComponent component = new AnnotationComponent ( classFileBytes , constantPool , offset + this . readOffset ) ; this . components [ i ] = component ; this . readOffset += component . sizeInBytes ( ) ; } } else { this . components = NO_ENTRIES ; } } public int getTypeIndex ( ) { return this . typeIndex ; } public int getComponentsNumber ( ) { return this . componentsNumber ; } public IAnnotationComponent [ ] getComponents ( ) { return this . components ; } int sizeInBytes ( ) { return this . readOffset ; } public char [ ] getTypeName ( ) { return this . typeName ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . ILineNumberAttribute ; public class LineNumberAttribute extends ClassFileAttribute implements ILineNumberAttribute { private static final int [ ] [ ] NO_ENTRIES = new int [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] ; private int lineNumberTableLength ; private int [ ] [ ] lineNumberTable ; public LineNumberAttribute ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { super ( classFileBytes , constantPool , offset ) ; final int length = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; this . lineNumberTableLength = length ; if ( length != <NUM_LIT:0> ) { this . lineNumberTable = new int [ length ] [ <NUM_LIT:2> ] ; int readOffset = <NUM_LIT:8> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . lineNumberTable [ i ] [ <NUM_LIT:0> ] = u2At ( classFileBytes , readOffset , offset ) ; this . lineNumberTable [ i ] [ <NUM_LIT:1> ] = u2At ( classFileBytes , readOffset + <NUM_LIT:2> , offset ) ; readOffset += <NUM_LIT:4> ; } } else { this . lineNumberTable = NO_ENTRIES ; } } public int [ ] [ ] getLineNumberTable ( ) { return this . lineNumberTable ; } public int getLineNumberTableLength ( ) { return this . lineNumberTableLength ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; public final class HashSetOfArray implements Cloneable { public Object [ ] [ ] set ; public int elementSize ; int threshold ; public HashSetOfArray ( ) { this ( <NUM_LIT> ) ; } public HashSetOfArray ( int size ) { this . elementSize = <NUM_LIT:0> ; this . threshold = size ; int extraRoom = ( int ) ( size * <NUM_LIT> ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . set = new Object [ extraRoom ] [ ] ; } public Object clone ( ) throws CloneNotSupportedException { HashSetOfArray result = ( HashSetOfArray ) super . clone ( ) ; result . elementSize = this . elementSize ; result . threshold = this . threshold ; int length = this . set . length ; result . set = new Object [ length ] [ ] ; System . arraycopy ( this . set , <NUM_LIT:0> , result . set , <NUM_LIT:0> , length ) ; return result ; } public boolean contains ( Object [ ] array ) { int length = this . set . length ; int index = hashCode ( array ) % length ; int arrayLength = array . length ; Object [ ] currentArray ; while ( ( currentArray = this . set [ index ] ) != null ) { if ( currentArray . length == arrayLength && Util . equalArraysOrNull ( currentArray , array ) ) return true ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return false ; } private int hashCode ( Object [ ] element ) { return hashCode ( element , element . length ) ; } private int hashCode ( Object [ ] element , int length ) { int hash = <NUM_LIT:0> ; for ( int i = length - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) hash = Util . combineHashCodes ( hash , element [ i ] . hashCode ( ) ) ; return hash & <NUM_LIT> ; } public Object add ( Object [ ] array ) { int length = this . set . length ; int index = hashCode ( array ) % length ; int arrayLength = array . length ; Object [ ] currentArray ; while ( ( currentArray = this . set [ index ] ) != null ) { if ( currentArray . length == arrayLength && Util . equalArraysOrNull ( currentArray , array ) ) return this . set [ index ] = array ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } this . set [ index ] = array ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return array ; } public Object remove ( Object [ ] array ) { int length = this . set . length ; int index = hashCode ( array ) % length ; int arrayLength = array . length ; Object [ ] currentArray ; while ( ( currentArray = this . set [ index ] ) != null ) { if ( currentArray . length == arrayLength && Util . equalArraysOrNull ( currentArray , array ) ) { Object existing = this . set [ index ] ; this . elementSize -- ; this . set [ index ] = null ; rehash ( ) ; return existing ; } if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return null ; } private void rehash ( ) { HashSetOfArray newHashSet = new HashSetOfArray ( this . elementSize * <NUM_LIT:2> ) ; Object [ ] currentArray ; for ( int i = this . set . length ; -- i >= <NUM_LIT:0> ; ) if ( ( currentArray = this . set [ i ] ) != null ) newHashSet . add ( currentArray ) ; this . set = newHashSet . set ; this . threshold = newHashSet . threshold ; } public int size ( ) { return this . elementSize ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; Object [ ] element ; for ( int i = <NUM_LIT:0> , length = this . set . length ; i < length ; i ++ ) if ( ( element = this . set [ i ] ) != null ) { buffer . append ( '<CHAR_LIT>' ) ; for ( int j = <NUM_LIT:0> , length2 = element . length ; j < length2 ; j ++ ) { buffer . append ( element [ j ] ) ; if ( j != length2 - <NUM_LIT:1> ) buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } buffer . append ( "<STR_LIT:}>" ) ; if ( i != length - <NUM_LIT:1> ) buffer . append ( '<STR_LIT:\n>' ) ; } return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IConstantPoolConstant ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; import org . eclipse . jdt . core . util . ISignatureAttribute ; public class SignatureAttribute extends ClassFileAttribute implements ISignatureAttribute { private int signatureIndex ; private char [ ] signature ; SignatureAttribute ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { super ( classFileBytes , constantPool , offset ) ; final int index = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; this . signatureIndex = index ; IConstantPoolEntry constantPoolEntry = constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . signature = constantPoolEntry . getUtf8Value ( ) ; } public int getSignatureIndex ( ) { return this . signatureIndex ; } public char [ ] getSignature ( ) { return this . signature ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; public class ToStringSorter { Object [ ] sortedObjects ; String [ ] sortedStrings ; public boolean compare ( String stringOne , String stringTwo ) { return stringOne . compareTo ( stringTwo ) < <NUM_LIT:0> ; } private void quickSort ( int left , int right ) { int originalLeft = left ; int originalRight = right ; int midIndex = left + ( right - left ) / <NUM_LIT:2> ; String midToString = this . sortedStrings [ midIndex ] ; do { while ( compare ( this . sortedStrings [ left ] , midToString ) ) left ++ ; while ( compare ( midToString , this . sortedStrings [ right ] ) ) right -- ; if ( left <= right ) { Object tmp = this . sortedObjects [ left ] ; this . sortedObjects [ left ] = this . sortedObjects [ right ] ; this . sortedObjects [ right ] = tmp ; String tmpToString = this . sortedStrings [ left ] ; this . sortedStrings [ left ] = this . sortedStrings [ right ] ; this . sortedStrings [ right ] = tmpToString ; left ++ ; right -- ; } } while ( left <= right ) ; if ( originalLeft < right ) quickSort ( originalLeft , right ) ; if ( left < originalRight ) quickSort ( left , originalRight ) ; } public void sort ( Object [ ] unSortedObjects , String [ ] unsortedStrings ) { int size = unSortedObjects . length ; this . sortedObjects = new Object [ size ] ; this . sortedStrings = new String [ size ] ; System . arraycopy ( unSortedObjects , <NUM_LIT:0> , this . sortedObjects , <NUM_LIT:0> , size ) ; System . arraycopy ( unsortedStrings , <NUM_LIT:0> , this . sortedStrings , <NUM_LIT:0> , size ) ; if ( size > <NUM_LIT:1> ) quickSort ( <NUM_LIT:0> , size - <NUM_LIT:1> ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ast . Wildcard ; public class BindingKeyParser { int keyStart ; static final char C_THROWN = '<CHAR_LIT>' ; static class Scanner { static final int PACKAGE = <NUM_LIT:0> ; static final int TYPE = <NUM_LIT:1> ; static final int FIELD = <NUM_LIT:2> ; static final int METHOD = <NUM_LIT:3> ; static final int ARRAY = <NUM_LIT:4> ; static final int LOCAL_VAR = <NUM_LIT:5> ; static final int FLAGS = <NUM_LIT:6> ; static final int WILDCARD = <NUM_LIT:7> ; static final int CAPTURE = <NUM_LIT:8> ; static final int BASE_TYPE = <NUM_LIT:9> ; static final int END = <NUM_LIT:10> ; static final int START = - <NUM_LIT:1> ; int index = <NUM_LIT:0> , start ; char [ ] source ; int token = START ; Scanner ( char [ ] source ) { this . source = source ; } char [ ] getTokenSource ( ) { int length = this . index - this . start ; char [ ] result = new char [ length ] ; System . arraycopy ( this . source , this . start , result , <NUM_LIT:0> , length ) ; return result ; } boolean isAtAnnotationStart ( ) { return this . index < this . source . length && this . source [ this . index ] == '<CHAR_LIT>' ; } boolean isAtCaptureStart ( ) { return this . index < this . source . length && this . source [ this . index ] == '<CHAR_LIT>' ; } boolean isAtFieldOrMethodStart ( ) { return this . index < this . source . length && this . source [ this . index ] == '<CHAR_LIT:.>' ; } boolean isAtLocalVariableStart ( ) { return this . index < this . source . length && this . source [ this . index ] == '<CHAR_LIT>' ; } boolean isAtMemberTypeStart ( ) { return this . index < this . source . length && ( this . source [ this . index ] == '<CHAR_LIT>' || ( this . source [ this . index ] == '<CHAR_LIT:.>' && this . source [ this . index - <NUM_LIT:1> ] == '<CHAR_LIT:>>' ) ) ; } boolean isAtParametersEnd ( ) { return this . index < this . source . length && this . source [ this . index ] == '<CHAR_LIT:>>' ; } boolean isAtParametersStart ( ) { char currentChar ; return this . index > <NUM_LIT:0> && this . index < this . source . length && ( ( currentChar = this . source [ this . index ] ) == '<CHAR_LIT>' || currentChar == '<CHAR_LIT>' ) ; } boolean isAtRawTypeEnd ( ) { return this . index > <NUM_LIT:0> && this . index < this . source . length && this . source [ this . index ] == '<CHAR_LIT:>>' ; } boolean isAtSecondaryTypeStart ( ) { return this . index < this . source . length && this . source [ this . index ] == '<CHAR_LIT>' ; } boolean isAtWildcardStart ( ) { return this . index < this . source . length && this . source [ this . index ] == '<CHAR_LIT>' ; } boolean isAtTypeParameterStart ( ) { return this . index < this . source . length && this . source [ this . index ] == '<CHAR_LIT>' ; } boolean isAtTypeArgumentStart ( ) { return this . index < this . source . length && "<STR_LIT>" . indexOf ( this . source [ this . index ] ) != - <NUM_LIT:1> ; } boolean isAtThrownStart ( ) { return this . index < this . source . length && this . source [ this . index ] == C_THROWN ; } boolean isAtTypeVariableStart ( ) { return this . index < this . source . length && this . source [ this . index ] == '<CHAR_LIT::>' ; } boolean isAtTypeWithCaptureStart ( ) { return this . index < this . source . length && this . source [ this . index ] == '<CHAR_LIT>' ; } int nextToken ( ) { int previousTokenEnd = this . index ; this . start = this . index ; int dollarIndex = - <NUM_LIT:1> ; int length = this . source . length ; while ( this . index <= length ) { char currentChar = this . index == length ? Character . MIN_VALUE : this . source [ this . index ] ; switch ( currentChar ) { case '<CHAR_LIT>' : case '<CHAR_LIT>' : 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>' : if ( this . index == previousTokenEnd && ( this . index == <NUM_LIT:0> || this . source [ this . index - <NUM_LIT:1> ] != '<CHAR_LIT:.>' ) ) { this . index ++ ; this . token = BASE_TYPE ; return this . token ; } break ; case '<CHAR_LIT>' : case '<CHAR_LIT>' : if ( this . index == previousTokenEnd && ( this . index == <NUM_LIT:0> || this . source [ this . index - <NUM_LIT:1> ] != '<CHAR_LIT:.>' ) ) { this . start = this . index + <NUM_LIT:1> ; dollarIndex = - <NUM_LIT:1> ; } break ; case '<CHAR_LIT:;>' : if ( this . index == previousTokenEnd ) { this . start = this . index + <NUM_LIT:1> ; dollarIndex = - <NUM_LIT:1> ; previousTokenEnd = this . start ; } else { if ( dollarIndex != - <NUM_LIT:1> ) this . index = dollarIndex ; this . token = TYPE ; return this . token ; } break ; case '<CHAR_LIT>' : if ( this . index == previousTokenEnd ) { this . start = this . index + <NUM_LIT:1> ; dollarIndex = - <NUM_LIT:1> ; } else { if ( dollarIndex == - <NUM_LIT:1> ) { dollarIndex = this . index ; break ; } this . index = dollarIndex ; this . token = TYPE ; return this . token ; } break ; case '<CHAR_LIT>' : if ( this . index == previousTokenEnd ) { this . start = this . index + <NUM_LIT:1> ; dollarIndex = - <NUM_LIT:1> ; } else { this . token = TYPE ; return this . token ; } break ; case '<CHAR_LIT:.>' : case '<CHAR_LIT>' : case '<CHAR_LIT::>' : case '<CHAR_LIT:>>' : case '<CHAR_LIT>' : this . start = this . index + <NUM_LIT:1> ; dollarIndex = - <NUM_LIT:1> ; previousTokenEnd = this . start ; break ; case '<CHAR_LIT:[>' : while ( this . index < length && this . source [ this . index ] == '<CHAR_LIT:[>' ) this . index ++ ; this . token = ARRAY ; return this . token ; case '<CHAR_LIT>' : if ( this . start > <NUM_LIT:0> ) { switch ( this . source [ this . start - <NUM_LIT:1> ] ) { case '<CHAR_LIT:.>' : if ( this . source [ this . start - <NUM_LIT:2> ] == '<CHAR_LIT:>>' ) { if ( dollarIndex != - <NUM_LIT:1> ) this . index = dollarIndex ; this . token = TYPE ; } else { this . token = METHOD ; } return this . token ; default : if ( this . index == previousTokenEnd ) { this . start = this . index + <NUM_LIT:1> ; dollarIndex = - <NUM_LIT:1> ; previousTokenEnd = this . start ; } else { if ( dollarIndex != - <NUM_LIT:1> ) this . index = dollarIndex ; this . token = TYPE ; return this . token ; } } } break ; case '<CHAR_LIT:(>' : this . token = METHOD ; return this . token ; case '<CHAR_LIT:)>' : if ( this . token == TYPE ) { this . token = FIELD ; return this . token ; } this . start = this . index + <NUM_LIT:1> ; dollarIndex = - <NUM_LIT:1> ; previousTokenEnd = this . start ; break ; case '<CHAR_LIT>' : if ( this . index == previousTokenEnd ) { this . start = this . index + <NUM_LIT:1> ; dollarIndex = - <NUM_LIT:1> ; previousTokenEnd = this . start ; } else { this . token = LOCAL_VAR ; return this . token ; } break ; case Character . MIN_VALUE : switch ( this . token ) { case START : this . token = PACKAGE ; break ; case METHOD : case LOCAL_VAR : this . token = LOCAL_VAR ; break ; case TYPE : if ( this . index > this . start && this . source [ this . start - <NUM_LIT:1> ] == '<CHAR_LIT:.>' ) this . token = FIELD ; else this . token = END ; break ; case WILDCARD : this . token = TYPE ; break ; default : this . token = END ; break ; } return this . token ; case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT:->' : this . index ++ ; this . token = WILDCARD ; return this . token ; case '<CHAR_LIT>' : case '<CHAR_LIT>' : this . index ++ ; this . token = CAPTURE ; return this . token ; } this . index ++ ; } this . token = END ; return this . token ; } void skipMethodSignature ( ) { this . start = this . index ; int braket = <NUM_LIT:0> ; while ( this . index < this . source . length ) { switch ( this . source [ this . index ] ) { case '<CHAR_LIT>' : case '<CHAR_LIT>' : case '<CHAR_LIT>' : case C_THROWN : return ; case '<CHAR_LIT::>' : if ( braket == <NUM_LIT:0> ) return ; break ; case '<CHAR_LIT>' : case '<CHAR_LIT:(>' : braket ++ ; break ; case '<CHAR_LIT:>>' : case '<CHAR_LIT:)>' : braket -- ; break ; } this . index ++ ; } } void skipRank ( ) { this . start = this . index ; while ( this . index < this . source . length && "<STR_LIT>" . indexOf ( this . source [ this . index ] ) != - <NUM_LIT:1> ) this . index ++ ; } void skipThrownStart ( ) { while ( this . index < this . source . length && this . source [ this . index ] == C_THROWN ) this . index ++ ; } void skipParametersStart ( ) { while ( this . index < this . source . length && ( this . source [ this . index ] == '<CHAR_LIT>' || this . source [ this . index ] == '<CHAR_LIT>' ) ) this . index ++ ; } void skipParametersEnd ( ) { while ( this . index < this . source . length && this . source [ this . index ] != '<CHAR_LIT:>>' ) this . index ++ ; this . index ++ ; } void skipTypeEnd ( ) { if ( this . index < this . source . length && this . source [ this . index ] == '<CHAR_LIT:;>' ) this . index ++ ; } void skipRankStart ( ) { if ( this . index < this . source . length && this . source [ this . index ] == '<CHAR_LIT>' ) this . index ++ ; } void skipRankEnd ( ) { if ( this . index < this . source . length && this . source [ this . index ] == '<CHAR_LIT:}>' ) this . index ++ ; this . start = this . index ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; switch ( this . token ) { case START : buffer . append ( "<STR_LIT>" ) ; break ; case PACKAGE : buffer . append ( "<STR_LIT>" ) ; break ; case TYPE : buffer . append ( "<STR_LIT>" ) ; break ; case FIELD : buffer . append ( "<STR_LIT>" ) ; break ; case METHOD : buffer . append ( "<STR_LIT>" ) ; break ; case ARRAY : buffer . append ( "<STR_LIT>" ) ; break ; case LOCAL_VAR : buffer . append ( "<STR_LIT>" ) ; break ; case FLAGS : buffer . append ( "<STR_LIT>" ) ; break ; case WILDCARD : buffer . append ( "<STR_LIT>" ) ; break ; case CAPTURE : buffer . append ( "<STR_LIT>" ) ; break ; case BASE_TYPE : buffer . append ( "<STR_LIT>" ) ; break ; case END : buffer . append ( "<STR_LIT>" ) ; break ; } if ( this . index < <NUM_LIT:0> ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . source ) ; } else if ( this . index <= this . source . length ) { buffer . append ( this . source , <NUM_LIT:0> , this . start ) ; buffer . append ( '<CHAR_LIT>' ) ; if ( this . start <= this . index ) { buffer . append ( this . source , this . start , this . index - this . start ) ; buffer . append ( '<CHAR_LIT>' ) ; buffer . append ( this . source , this . index , this . source . length - this . index ) ; } else { buffer . append ( '<CHAR_LIT>' ) ; buffer . append ( this . source , this . start , this . source . length - this . start ) ; } } else { buffer . append ( this . source ) ; buffer . append ( "<STR_LIT>" ) ; } return buffer . toString ( ) ; } } private boolean parsingPaused ; private Scanner scanner ; private boolean hasTypeName = true ; private boolean isMalformed ; public BindingKeyParser ( BindingKeyParser parser ) { this ( "<STR_LIT>" ) ; this . scanner = parser . scanner ; } public BindingKeyParser ( String key ) { this . scanner = new Scanner ( key . toCharArray ( ) ) ; } public void consumeAnnotation ( ) { } public void consumeArrayDimension ( char [ ] brakets ) { } public void consumeBaseType ( char [ ] baseTypeSig ) { } public void consumeCapture ( int position ) { } public void consumeException ( ) { } public void consumeField ( char [ ] fieldName ) { } public void consumeParameterizedGenericMethod ( ) { } public void consumeLocalType ( char [ ] uniqueKey ) { } public void consumeLocalVar ( char [ ] varName , int occurrenceCount ) { } public void consumeMethod ( char [ ] selector , char [ ] signature ) { } public void consumeModifiers ( char [ ] modifiers ) { } public void consumeNonGenericType ( ) { } public void consumeMemberType ( char [ ] simpleTypeName ) { } public void consumePackage ( char [ ] pkgName ) { } public void consumeParameterizedType ( char [ ] simpleTypeName , boolean isRaw ) { } public void consumeParser ( BindingKeyParser parser ) { } public void consumeRawType ( ) { } public void consumeScope ( int scopeNumber ) { } public void consumeSecondaryType ( char [ ] simpleTypeName ) { } public void consumeFullyQualifiedName ( char [ ] fullyQualifiedName ) { } public void consumeKey ( ) { } public void consumeTopLevelType ( ) { } public void consumeType ( ) { } public void consumeTypeParameter ( char [ ] typeParameterName ) { } public void consumeTypeVariable ( char [ ] position , char [ ] typeVariableName ) { } public void consumeTypeWithCapture ( ) { } public void consumeWildCard ( int kind ) { } public void consumeWildcardRank ( int rank ) { } public String getKey ( ) { return new String ( this . scanner . source ) ; } public boolean hasTypeName ( ) { return this . hasTypeName ; } public void malformedKey ( ) { this . isMalformed = true ; } public BindingKeyParser newParser ( ) { return new BindingKeyParser ( this ) ; } public void parse ( ) { parse ( false ) ; } public void parse ( boolean pauseAfterFullyQualifiedName ) { if ( ! this . parsingPaused ) { parseFullyQualifiedName ( ) ; parseSecondaryType ( ) ; if ( pauseAfterFullyQualifiedName ) { this . parsingPaused = true ; return ; } } if ( ! hasTypeName ( ) ) { consumeKey ( ) ; return ; } consumeTopLevelType ( ) ; parseInnerType ( ) ; if ( this . scanner . isAtParametersStart ( ) ) { this . scanner . skipParametersStart ( ) ; if ( this . scanner . isAtTypeParameterStart ( ) ) { parseGenericType ( ) ; this . scanner . skipParametersEnd ( ) ; parseInnerType ( ) ; } else if ( this . scanner . isAtTypeArgumentStart ( ) ) parseParameterizedType ( null , false ) ; else if ( this . scanner . isAtRawTypeEnd ( ) ) parseRawType ( ) ; } else { consumeNonGenericType ( ) ; } consumeType ( ) ; this . scanner . skipTypeEnd ( ) ; if ( this . scanner . isAtFieldOrMethodStart ( ) ) { switch ( this . scanner . nextToken ( ) ) { case Scanner . FIELD : parseField ( ) ; if ( this . scanner . isAtAnnotationStart ( ) ) { parseAnnotation ( ) ; } return ; case Scanner . METHOD : parseMethod ( ) ; if ( this . scanner . isAtLocalVariableStart ( ) ) { parseLocalVariable ( ) ; } else if ( this . scanner . isAtTypeVariableStart ( ) ) { parseTypeVariable ( ) ; } else if ( this . scanner . isAtAnnotationStart ( ) ) { parseAnnotation ( ) ; } break ; default : malformedKey ( ) ; return ; } } else if ( this . scanner . isAtTypeVariableStart ( ) ) { parseTypeVariable ( ) ; } else if ( this . scanner . isAtWildcardStart ( ) ) { parseWildcard ( ) ; } else if ( this . scanner . isAtTypeWithCaptureStart ( ) ) { parseTypeWithCapture ( ) ; } else if ( this . scanner . isAtAnnotationStart ( ) ) { parseAnnotation ( ) ; } consumeKey ( ) ; } private void parseFullyQualifiedName ( ) { if ( this . scanner . isAtCaptureStart ( ) ) { parseCapture ( ) ; this . hasTypeName = false ; return ; } switch ( this . scanner . nextToken ( ) ) { case Scanner . PACKAGE : this . keyStart = <NUM_LIT:0> ; consumePackage ( this . scanner . getTokenSource ( ) ) ; this . hasTypeName = false ; return ; case Scanner . TYPE : this . keyStart = this . scanner . start - <NUM_LIT:1> ; consumeFullyQualifiedName ( this . scanner . getTokenSource ( ) ) ; break ; case Scanner . BASE_TYPE : this . keyStart = this . scanner . start - <NUM_LIT:1> ; consumeBaseType ( this . scanner . getTokenSource ( ) ) ; this . hasTypeName = false ; break ; case Scanner . ARRAY : this . keyStart = this . scanner . start ; consumeArrayDimension ( this . scanner . getTokenSource ( ) ) ; switch ( this . scanner . nextToken ( ) ) { case Scanner . TYPE : consumeFullyQualifiedName ( this . scanner . getTokenSource ( ) ) ; break ; case Scanner . BASE_TYPE : consumeBaseType ( this . scanner . getTokenSource ( ) ) ; this . hasTypeName = false ; break ; default : malformedKey ( ) ; return ; } break ; default : malformedKey ( ) ; return ; } } private void parseParameterizedMethod ( ) { this . scanner . skipParametersStart ( ) ; while ( ! this . scanner . isAtParametersEnd ( ) && ! this . isMalformed ) { parseTypeArgument ( ) ; } consumeParameterizedGenericMethod ( ) ; } private void parseGenericType ( ) { while ( ! this . scanner . isAtParametersEnd ( ) && ! this . isMalformed ) { if ( this . scanner . nextToken ( ) != Scanner . TYPE ) { malformedKey ( ) ; return ; } consumeTypeParameter ( this . scanner . getTokenSource ( ) ) ; this . scanner . skipTypeEnd ( ) ; } } private void parseInnerType ( ) { if ( ! this . scanner . isAtMemberTypeStart ( ) || this . scanner . nextToken ( ) != Scanner . TYPE ) return ; char [ ] typeName = this . scanner . getTokenSource ( ) ; if ( Character . isDigit ( typeName [ <NUM_LIT:0> ] ) ) { int nextToken = Scanner . TYPE ; while ( this . scanner . isAtMemberTypeStart ( ) && ! this . isMalformed ) nextToken = this . scanner . nextToken ( ) ; typeName = nextToken == Scanner . END ? this . scanner . source : CharOperation . subarray ( this . scanner . source , this . keyStart , this . scanner . index + <NUM_LIT:1> ) ; consumeLocalType ( typeName ) ; } else { consumeMemberType ( typeName ) ; parseInnerType ( ) ; } } private void parseLocalVariable ( ) { if ( this . scanner . nextToken ( ) != Scanner . LOCAL_VAR ) { malformedKey ( ) ; return ; } char [ ] varName = this . scanner . getTokenSource ( ) ; if ( Character . isDigit ( varName [ <NUM_LIT:0> ] ) ) { int index = Integer . parseInt ( new String ( varName ) ) ; consumeScope ( index ) ; if ( ! this . scanner . isAtLocalVariableStart ( ) ) { malformedKey ( ) ; return ; } parseLocalVariable ( ) ; } else { int occurrenceCount = <NUM_LIT:0> ; if ( this . scanner . isAtLocalVariableStart ( ) ) { if ( this . scanner . nextToken ( ) != Scanner . LOCAL_VAR ) { malformedKey ( ) ; return ; } char [ ] occurrence = this . scanner . getTokenSource ( ) ; occurrenceCount = Integer . parseInt ( new String ( occurrence ) ) ; } consumeLocalVar ( varName , occurrenceCount ) ; } } private void parseMethod ( ) { char [ ] selector = this . scanner . getTokenSource ( ) ; this . scanner . skipMethodSignature ( ) ; char [ ] signature = this . scanner . getTokenSource ( ) ; consumeMethod ( selector , signature ) ; if ( this . scanner . isAtThrownStart ( ) ) { parseThrownExceptions ( ) ; } if ( this . scanner . isAtParametersStart ( ) ) parseParameterizedMethod ( ) ; } private void parseAnnotation ( ) { int token = this . scanner . token ; BindingKeyParser parser = newParser ( ) ; parser . parse ( ) ; consumeParser ( parser ) ; consumeAnnotation ( ) ; this . isMalformed = parser . isMalformed ; this . scanner . token = token ; } private void parseCapture ( ) { if ( this . scanner . nextToken ( ) != Scanner . CAPTURE ) return ; parseCaptureWildcard ( ) ; if ( this . scanner . nextToken ( ) != Scanner . TYPE ) { malformedKey ( ) ; return ; } char [ ] positionChars = this . scanner . getTokenSource ( ) ; int position = Integer . parseInt ( new String ( positionChars ) ) ; consumeCapture ( position ) ; this . scanner . skipTypeEnd ( ) ; } private void parseCaptureWildcard ( ) { int token = this . scanner . token ; BindingKeyParser parser = newParser ( ) ; parser . parse ( ) ; consumeParser ( parser ) ; this . isMalformed = parser . isMalformed ; this . scanner . token = token ; } private void parseField ( ) { char [ ] fieldName = this . scanner . getTokenSource ( ) ; parseReturnType ( ) ; consumeField ( fieldName ) ; } private void parseThrownExceptions ( ) { int token = this . scanner . token ; while ( this . scanner . isAtThrownStart ( ) && ! this . isMalformed ) { this . scanner . skipThrownStart ( ) ; BindingKeyParser parser = newParser ( ) ; parser . parse ( ) ; consumeParser ( parser ) ; consumeException ( ) ; this . isMalformed = parser . isMalformed ; } this . scanner . token = token ; } private void parseParameterizedType ( char [ ] typeName , boolean isRaw ) { if ( ! isRaw ) { while ( ! this . scanner . isAtParametersEnd ( ) && ! this . isMalformed ) { parseTypeArgument ( ) ; } } this . scanner . skipParametersEnd ( ) ; consumeParameterizedType ( typeName , isRaw ) ; this . scanner . skipTypeEnd ( ) ; if ( this . scanner . isAtMemberTypeStart ( ) && this . scanner . nextToken ( ) == Scanner . TYPE ) { typeName = this . scanner . getTokenSource ( ) ; if ( this . scanner . isAtParametersStart ( ) ) { this . scanner . skipParametersStart ( ) ; parseParameterizedType ( typeName , this . scanner . isAtRawTypeEnd ( ) ) ; } else consumeParameterizedType ( typeName , true ) ; } } private void parseRawType ( ) { this . scanner . skipParametersEnd ( ) ; consumeRawType ( ) ; this . scanner . skipTypeEnd ( ) ; if ( this . scanner . isAtMemberTypeStart ( ) && this . scanner . nextToken ( ) == Scanner . TYPE ) { char [ ] typeName = this . scanner . getTokenSource ( ) ; if ( this . scanner . isAtParametersStart ( ) ) { this . scanner . skipParametersStart ( ) ; parseParameterizedType ( typeName , this . scanner . isAtRawTypeEnd ( ) ) ; } else consumeParameterizedType ( typeName , true ) ; } } private void parseReturnType ( ) { this . scanner . index ++ ; int token = this . scanner . token ; BindingKeyParser parser = newParser ( ) ; parser . parse ( ) ; consumeParser ( parser ) ; this . isMalformed = parser . isMalformed ; this . scanner . token = token ; } private void parseSecondaryType ( ) { if ( ! this . scanner . isAtSecondaryTypeStart ( ) || this . scanner . nextToken ( ) != Scanner . TYPE ) return ; consumeSecondaryType ( this . scanner . getTokenSource ( ) ) ; } private void parseTypeArgument ( ) { int token = this . scanner . token ; BindingKeyParser parser = newParser ( ) ; parser . parse ( ) ; consumeParser ( parser ) ; this . isMalformed = parser . isMalformed ; this . scanner . token = token ; } private void parseTypeWithCapture ( ) { if ( this . scanner . nextToken ( ) != Scanner . CAPTURE ) return ; int token = this . scanner . token ; BindingKeyParser parser = newParser ( ) ; parser . parse ( ) ; consumeParser ( parser ) ; consumeTypeWithCapture ( ) ; this . isMalformed = parser . isMalformed ; this . scanner . token = token ; } private void parseTypeVariable ( ) { if ( this . scanner . nextToken ( ) != Scanner . TYPE ) { malformedKey ( ) ; return ; } char [ ] typeVariableName = this . scanner . getTokenSource ( ) ; char [ ] position ; int length = typeVariableName . length ; if ( length > <NUM_LIT:0> && Character . isDigit ( typeVariableName [ <NUM_LIT:0> ] ) ) { int firstT = CharOperation . indexOf ( '<CHAR_LIT>' , typeVariableName ) ; position = CharOperation . subarray ( typeVariableName , <NUM_LIT:0> , firstT ) ; typeVariableName = CharOperation . subarray ( typeVariableName , firstT + <NUM_LIT:1> , typeVariableName . length ) ; } else { position = CharOperation . NO_CHAR ; } consumeTypeVariable ( position , typeVariableName ) ; this . scanner . skipTypeEnd ( ) ; } private void parseWildcard ( ) { parseWildcardRank ( ) ; if ( this . scanner . nextToken ( ) != Scanner . WILDCARD ) return ; char [ ] source = this . scanner . getTokenSource ( ) ; if ( source . length == <NUM_LIT:0> ) { malformedKey ( ) ; return ; } int kind = - <NUM_LIT:1> ; switch ( source [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : kind = Wildcard . UNBOUND ; break ; case '<CHAR_LIT>' : kind = Wildcard . EXTENDS ; break ; case '<CHAR_LIT:->' : kind = Wildcard . SUPER ; break ; } if ( kind == - <NUM_LIT:1> ) { malformedKey ( ) ; return ; } if ( kind != Wildcard . UNBOUND ) parseWildcardBound ( ) ; consumeWildCard ( kind ) ; } private void parseWildcardRank ( ) { this . scanner . skipRankStart ( ) ; this . scanner . skipRank ( ) ; char [ ] source = this . scanner . getTokenSource ( ) ; consumeWildcardRank ( Integer . parseInt ( new String ( source ) ) ) ; this . scanner . skipRankEnd ( ) ; } private void parseWildcardBound ( ) { int token = this . scanner . token ; BindingKeyParser parser = newParser ( ) ; parser . parse ( ) ; consumeParser ( parser ) ; this . isMalformed = parser . isMalformed ; this . scanner . token = token ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . IDocumentListener ; import org . eclipse . jface . text . IDocumentPartitioner ; import org . eclipse . jface . text . IDocumentPartitioningListener ; import org . eclipse . jface . text . IPositionUpdater ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . ITypedRegion ; import org . eclipse . jface . text . Position ; public class SimpleDocument implements IDocument { private StringBuffer buffer ; public SimpleDocument ( String source ) { this . buffer = new StringBuffer ( source ) ; } public char getChar ( int offset ) { return <NUM_LIT:0> ; } public int getLength ( ) { return this . buffer . length ( ) ; } public String get ( ) { return this . buffer . toString ( ) ; } public String get ( int offset , int length ) { return this . buffer . substring ( offset , offset + length ) ; } public void set ( String text ) { } public void replace ( int offset , int length , String text ) { this . buffer . replace ( offset , offset + length , text ) ; } public void addDocumentListener ( IDocumentListener listener ) { } public void removeDocumentListener ( IDocumentListener listener ) { } public void addPrenotifiedDocumentListener ( IDocumentListener documentAdapter ) { } public void removePrenotifiedDocumentListener ( IDocumentListener documentAdapter ) { } public void addPositionCategory ( String category ) { } public void removePositionCategory ( String category ) { } public String [ ] getPositionCategories ( ) { return null ; } public boolean containsPositionCategory ( String category ) { return false ; } public void addPosition ( Position position ) { } public void removePosition ( Position position ) { } public void addPosition ( String category , Position position ) { } public void removePosition ( String category , Position position ) { } public Position [ ] getPositions ( String category ) { return null ; } public boolean containsPosition ( String category , int offset , int length ) { return false ; } public int computeIndexInCategory ( String category , int offset ) { return <NUM_LIT:0> ; } public void addPositionUpdater ( IPositionUpdater updater ) { } public void removePositionUpdater ( IPositionUpdater updater ) { } public void insertPositionUpdater ( IPositionUpdater updater , int index ) { } public IPositionUpdater [ ] getPositionUpdaters ( ) { return null ; } public String [ ] getLegalContentTypes ( ) { return null ; } public String getContentType ( int offset ) { return null ; } public ITypedRegion getPartition ( int offset ) { return null ; } public ITypedRegion [ ] computePartitioning ( int offset , int length ) { return null ; } public void addDocumentPartitioningListener ( IDocumentPartitioningListener listener ) { } public void removeDocumentPartitioningListener ( IDocumentPartitioningListener listener ) { } public void setDocumentPartitioner ( IDocumentPartitioner partitioner ) { } public IDocumentPartitioner getDocumentPartitioner ( ) { return null ; } public int getLineLength ( int line ) { return <NUM_LIT:0> ; } public int getLineOfOffset ( int offset ) { return <NUM_LIT:0> ; } public int getLineOffset ( int line ) { return <NUM_LIT:0> ; } public IRegion getLineInformation ( int line ) { return null ; } public IRegion getLineInformationOfOffset ( int offset ) { return null ; } public int getNumberOfLines ( ) { return <NUM_LIT:0> ; } public int getNumberOfLines ( int offset , int length ) { return <NUM_LIT:0> ; } public int computeNumberOfLines ( String text ) { return <NUM_LIT:0> ; } public String [ ] getLegalLineDelimiters ( ) { return null ; } public String getLineDelimiter ( int line ) { return null ; } public int search ( int startOffset , String findString , boolean forwardSearch , boolean caseSensitive , boolean wholeWord ) { return <NUM_LIT:0> ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import java . util . ArrayList ; import org . eclipse . jdt . core . Signature ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ast . Wildcard ; import org . eclipse . jdt . internal . compiler . codegen . ConstantPool ; public class KeyToSignature extends BindingKeyParser { public static final int SIGNATURE = <NUM_LIT:0> ; public static final int TYPE_ARGUMENTS = <NUM_LIT:1> ; public static final int DECLARING_TYPE = <NUM_LIT:2> ; public static final int THROWN_EXCEPTIONS = <NUM_LIT:3> ; public StringBuffer signature = new StringBuffer ( ) ; private int kind ; private ArrayList arguments = new ArrayList ( ) ; private ArrayList typeArguments = new ArrayList ( ) ; private ArrayList typeParameters = new ArrayList ( ) ; private ArrayList thrownExceptions = new ArrayList ( ) ; private int mainTypeStart = - <NUM_LIT:1> ; private int mainTypeEnd ; private int typeSigStart = - <NUM_LIT:1> ; public KeyToSignature ( BindingKeyParser parser ) { super ( parser ) ; this . kind = ( ( KeyToSignature ) parser ) . kind ; } public KeyToSignature ( String key , int kind ) { super ( key ) ; this . kind = kind ; } public void consumeArrayDimension ( char [ ] brakets ) { this . signature . append ( brakets ) ; } public void consumeBaseType ( char [ ] baseTypeSig ) { this . typeSigStart = this . signature . length ( ) ; this . signature . append ( baseTypeSig ) ; } public void consumeCapture ( int position ) { this . signature . append ( '<CHAR_LIT>' ) ; this . signature . append ( ( ( KeyToSignature ) this . arguments . get ( <NUM_LIT:0> ) ) . signature ) ; } public void consumeLocalType ( char [ ] uniqueKey ) { this . signature = new StringBuffer ( ) ; uniqueKey = CharOperation . subarray ( uniqueKey , <NUM_LIT:0> , uniqueKey . length - <NUM_LIT:1> ) ; CharOperation . replace ( uniqueKey , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; this . signature . append ( uniqueKey ) ; } public void consumeMethod ( char [ ] selector , char [ ] methodSignature ) { this . arguments = new ArrayList ( ) ; this . typeArguments = new ArrayList ( ) ; CharOperation . replace ( methodSignature , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; switch ( this . kind ) { case SIGNATURE : this . signature = new StringBuffer ( ) ; this . signature . append ( methodSignature ) ; break ; case THROWN_EXCEPTIONS : if ( CharOperation . indexOf ( '<CHAR_LIT>' , methodSignature ) > <NUM_LIT:0> ) { char [ ] [ ] types = Signature . getThrownExceptionTypes ( methodSignature ) ; int length = types . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . thrownExceptions . add ( new String ( types [ i ] ) ) ; } } break ; } } public void consumeMemberType ( char [ ] simpleTypeName ) { this . signature . append ( '<CHAR_LIT>' ) ; this . signature . append ( simpleTypeName ) ; } public void consumePackage ( char [ ] pkgName ) { this . signature . append ( pkgName ) ; } public void consumeParameterizedGenericMethod ( ) { this . typeArguments = this . arguments ; int typeParametersSize = this . arguments . size ( ) ; if ( typeParametersSize > <NUM_LIT:0> ) { int sigLength = this . signature . length ( ) ; char [ ] methodSignature = new char [ sigLength ] ; this . signature . getChars ( <NUM_LIT:0> , sigLength , methodSignature , <NUM_LIT:0> ) ; char [ ] [ ] typeParameterSigs = Signature . getTypeParameters ( methodSignature ) ; if ( typeParameterSigs . length != typeParametersSize ) return ; this . signature = new StringBuffer ( ) ; for ( int i = <NUM_LIT:0> ; i < typeParametersSize ; i ++ ) typeParameterSigs [ i ] = CharOperation . concat ( Signature . C_TYPE_VARIABLE , Signature . getTypeVariable ( typeParameterSigs [ i ] ) , Signature . C_SEMICOLON ) ; int paramStart = CharOperation . indexOf ( Signature . C_PARAM_START , methodSignature ) ; char [ ] typeParametersString = CharOperation . subarray ( methodSignature , <NUM_LIT:0> , paramStart ) ; this . signature . append ( typeParametersString ) ; this . signature . append ( Signature . C_PARAM_START ) ; char [ ] [ ] parameters = Signature . getParameterTypes ( methodSignature ) ; for ( int i = <NUM_LIT:0> , parametersLength = parameters . length ; i < parametersLength ; i ++ ) substitute ( parameters [ i ] , typeParameterSigs , typeParametersSize ) ; this . signature . append ( Signature . C_PARAM_END ) ; char [ ] returnType = Signature . getReturnType ( methodSignature ) ; substitute ( returnType , typeParameterSigs , typeParametersSize ) ; char [ ] [ ] exceptions = Signature . getThrownExceptionTypes ( methodSignature ) ; for ( int i = <NUM_LIT:0> , exceptionsLength = exceptions . length ; i < exceptionsLength ; i ++ ) { this . signature . append ( Signature . C_EXCEPTION_START ) ; substitute ( exceptions [ i ] , typeParameterSigs , typeParametersSize ) ; } } } private void substitute ( char [ ] parameter , char [ ] [ ] typeParameterSigs , int typeParametersLength ) { for ( int i = <NUM_LIT:0> ; i < typeParametersLength ; i ++ ) { if ( CharOperation . equals ( parameter , typeParameterSigs [ i ] ) ) { String typeArgument = ( ( KeyToSignature ) this . arguments . get ( i ) ) . signature . toString ( ) ; this . signature . append ( typeArgument ) ; return ; } } int genericStart = CharOperation . indexOf ( Signature . C_GENERIC_START , parameter ) ; if ( genericStart > - <NUM_LIT:1> ) { this . signature . append ( CharOperation . subarray ( parameter , <NUM_LIT:0> , genericStart ) ) ; char [ ] [ ] parameters = Signature . getTypeArguments ( parameter ) ; this . signature . append ( Signature . C_GENERIC_START ) ; for ( int j = <NUM_LIT:0> , paramsLength = parameters . length ; j < paramsLength ; j ++ ) substitute ( parameters [ j ] , typeParameterSigs , typeParametersLength ) ; this . signature . append ( Signature . C_GENERIC_END ) ; this . signature . append ( Signature . C_SEMICOLON ) ; } else { int index = <NUM_LIT:0> ; int length = parameter . length ; loop : while ( index < length ) { char current = parameter [ index ] ; switch ( current ) { case Signature . C_CAPTURE : case Signature . C_EXTENDS : case Signature . C_SUPER : case Signature . C_ARRAY : this . signature . append ( current ) ; index ++ ; break ; default : break loop ; } } if ( index > <NUM_LIT:0> ) substitute ( CharOperation . subarray ( parameter , index , length ) , typeParameterSigs , typeParametersLength ) ; else this . signature . append ( parameter ) ; } } public void consumeParameterizedType ( char [ ] simpleTypeName , boolean isRaw ) { if ( simpleTypeName != null ) { this . signature . append ( '<CHAR_LIT:.>' ) ; this . signature . append ( simpleTypeName ) ; } if ( ! isRaw ) { this . signature . append ( '<CHAR_LIT>' ) ; int length = this . arguments . size ( ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . signature . append ( ( ( KeyToSignature ) this . arguments . get ( i ) ) . signature ) ; } this . signature . append ( '<CHAR_LIT:>>' ) ; this . typeArguments = this . arguments ; this . arguments = new ArrayList ( ) ; } } public void consumeParser ( BindingKeyParser parser ) { this . arguments . add ( parser ) ; } public void consumeField ( char [ ] fieldName ) { if ( this . kind == SIGNATURE ) { this . signature = ( ( KeyToSignature ) this . arguments . get ( <NUM_LIT:0> ) ) . signature ; } } public void consumeException ( ) { int size = this . arguments . size ( ) ; if ( size > <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { this . thrownExceptions . add ( ( ( KeyToSignature ) this . arguments . get ( i ) ) . signature . toString ( ) ) ; } this . arguments = new ArrayList ( ) ; this . typeArguments = new ArrayList ( ) ; } } public void consumeFullyQualifiedName ( char [ ] fullyQualifiedName ) { this . typeSigStart = this . signature . length ( ) ; this . signature . append ( '<CHAR_LIT>' ) ; this . signature . append ( CharOperation . replaceOnCopy ( fullyQualifiedName , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ) ; } public void consumeSecondaryType ( char [ ] simpleTypeName ) { this . signature . append ( '<CHAR_LIT>' ) ; this . mainTypeStart = this . signature . lastIndexOf ( "<STR_LIT:.>" ) + <NUM_LIT:1> ; if ( this . mainTypeStart == <NUM_LIT:0> ) this . mainTypeStart = <NUM_LIT:1> ; this . mainTypeEnd = this . signature . length ( ) ; this . signature . append ( simpleTypeName ) ; } public void consumeType ( ) { if ( this . mainTypeStart != - <NUM_LIT:1> ) { this . signature . replace ( this . mainTypeStart , this . mainTypeEnd , "<STR_LIT>" ) ; } int length = this . typeParameters . size ( ) ; if ( length > <NUM_LIT:0> ) { StringBuffer typeParametersSig = new StringBuffer ( ) ; typeParametersSig . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { char [ ] typeParameterSig = Signature . createTypeParameterSignature ( ( char [ ] ) this . typeParameters . get ( i ) , new char [ ] [ ] { ConstantPool . ObjectSignature } ) ; typeParametersSig . append ( typeParameterSig ) ; } typeParametersSig . append ( '<CHAR_LIT:>>' ) ; this . signature . insert ( this . typeSigStart , typeParametersSig . toString ( ) ) ; this . typeParameters = new ArrayList ( ) ; } this . signature . append ( '<CHAR_LIT:;>' ) ; } public void consumeTypeParameter ( char [ ] typeParameterName ) { this . typeParameters . add ( typeParameterName ) ; } public void consumeTypeVariable ( char [ ] position , char [ ] typeVariableName ) { this . signature = new StringBuffer ( ) ; this . signature . append ( '<CHAR_LIT>' ) ; this . signature . append ( typeVariableName ) ; this . signature . append ( '<CHAR_LIT:;>' ) ; } public void consumeTypeWithCapture ( ) { KeyToSignature keyToSignature = ( KeyToSignature ) this . arguments . get ( <NUM_LIT:0> ) ; this . signature = keyToSignature . signature ; this . arguments = keyToSignature . arguments ; this . typeArguments = keyToSignature . typeArguments ; this . thrownExceptions = keyToSignature . thrownExceptions ; } public void consumeWildCard ( int wildCardKind ) { this . signature = new StringBuffer ( ) ; switch ( wildCardKind ) { case Wildcard . UNBOUND : this . signature . append ( '<CHAR_LIT>' ) ; break ; case Wildcard . EXTENDS : this . signature . append ( '<CHAR_LIT>' ) ; this . signature . append ( ( ( KeyToSignature ) this . arguments . get ( <NUM_LIT:0> ) ) . signature ) ; break ; case Wildcard . SUPER : this . signature . append ( '<CHAR_LIT:->' ) ; this . signature . append ( ( ( KeyToSignature ) this . arguments . get ( <NUM_LIT:0> ) ) . signature ) ; break ; default : return ; } } public String [ ] getThrownExceptions ( ) { int length = this . thrownExceptions . size ( ) ; String [ ] result = new String [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { result [ i ] = ( String ) this . thrownExceptions . get ( i ) ; } return result ; } public String [ ] getTypeArguments ( ) { int length = this . typeArguments . size ( ) ; String [ ] result = new String [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { result [ i ] = ( ( KeyToSignature ) this . typeArguments . get ( i ) ) . signature . toString ( ) ; } return result ; } public BindingKeyParser newParser ( ) { return new KeyToSignature ( this ) ; } public String toString ( ) { return this . signature . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IAnnotation ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IParameterAnnotation ; public class ParameterAnnotation extends ClassFileStruct implements IParameterAnnotation { private static final IAnnotation [ ] NO_ENTRIES = new IAnnotation [ <NUM_LIT:0> ] ; private int annotationsNumber ; private IAnnotation [ ] annotations ; private int readOffset ; public ParameterAnnotation ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { final int length = u2At ( classFileBytes , <NUM_LIT:0> , offset ) ; this . readOffset = <NUM_LIT:2> ; this . annotationsNumber = length ; if ( length != <NUM_LIT:0> ) { this . annotations = new IAnnotation [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { Annotation annotation = new Annotation ( classFileBytes , constantPool , offset + this . readOffset ) ; this . annotations [ i ] = annotation ; this . readOffset += annotation . sizeInBytes ( ) ; } } else { this . annotations = NO_ENTRIES ; } } int sizeInBytes ( ) { return this . readOffset ; } public IAnnotation [ ] getAnnotations ( ) { return this . annotations ; } public int getAnnotationsNumber ( ) { return this . annotationsNumber ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IAttributeNamesConstants ; import org . eclipse . jdt . core . util . IClassFileAttribute ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IConstantPoolConstant ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; import org . eclipse . jdt . core . util . IConstantValueAttribute ; import org . eclipse . jdt . core . util . IFieldInfo ; import org . eclipse . jdt . core . util . IModifierConstants ; public class FieldInfo extends ClassFileStruct implements IFieldInfo { private int accessFlags ; private int attributeBytes ; private IClassFileAttribute [ ] attributes ; private int attributesCount ; private IConstantValueAttribute constantValueAttribute ; private char [ ] descriptor ; private int descriptorIndex ; private boolean isDeprecated ; private boolean isSynthetic ; private char [ ] name ; private int nameIndex ; public FieldInfo ( byte classFileBytes [ ] , IConstantPool constantPool , int offset ) throws ClassFormatException { final int flags = u2At ( classFileBytes , <NUM_LIT:0> , offset ) ; this . accessFlags = flags ; if ( ( flags & IModifierConstants . ACC_SYNTHETIC ) != <NUM_LIT:0> ) { this . isSynthetic = true ; } this . nameIndex = u2At ( classFileBytes , <NUM_LIT:2> , offset ) ; IConstantPoolEntry constantPoolEntry = constantPool . decodeEntry ( this . nameIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . name = constantPoolEntry . getUtf8Value ( ) ; this . descriptorIndex = u2At ( classFileBytes , <NUM_LIT:4> , offset ) ; constantPoolEntry = constantPool . decodeEntry ( this . descriptorIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . descriptor = constantPoolEntry . getUtf8Value ( ) ; this . attributesCount = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; this . attributes = ClassFileAttribute . NO_ATTRIBUTES ; int readOffset = <NUM_LIT:8> ; if ( this . attributesCount != <NUM_LIT:0> ) { this . attributes = new IClassFileAttribute [ this . attributesCount ] ; } int attributesIndex = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < this . attributesCount ; i ++ ) { constantPoolEntry = constantPool . decodeEntry ( u2At ( classFileBytes , readOffset , offset ) ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } char [ ] attributeName = constantPoolEntry . getUtf8Value ( ) ; if ( equals ( attributeName , IAttributeNamesConstants . DEPRECATED ) ) { this . isDeprecated = true ; this . attributes [ attributesIndex ++ ] = new ClassFileAttribute ( classFileBytes , constantPool , offset + readOffset ) ; } else if ( equals ( attributeName , IAttributeNamesConstants . SYNTHETIC ) ) { this . isSynthetic = true ; this . attributes [ attributesIndex ++ ] = new ClassFileAttribute ( classFileBytes , constantPool , offset + readOffset ) ; } else if ( equals ( attributeName , IAttributeNamesConstants . CONSTANT_VALUE ) ) { this . constantValueAttribute = new ConstantValueAttribute ( classFileBytes , constantPool , offset + readOffset ) ; this . attributes [ attributesIndex ++ ] = this . constantValueAttribute ; } else if ( equals ( attributeName , IAttributeNamesConstants . SIGNATURE ) ) { this . attributes [ attributesIndex ++ ] = new SignatureAttribute ( classFileBytes , constantPool , offset + readOffset ) ; } else if ( equals ( attributeName , IAttributeNamesConstants . RUNTIME_VISIBLE_ANNOTATIONS ) ) { this . attributes [ attributesIndex ++ ] = new RuntimeVisibleAnnotationsAttribute ( classFileBytes , constantPool , offset + readOffset ) ; } else if ( equals ( attributeName , IAttributeNamesConstants . RUNTIME_INVISIBLE_ANNOTATIONS ) ) { this . attributes [ attributesIndex ++ ] = new RuntimeInvisibleAnnotationsAttribute ( classFileBytes , constantPool , offset + readOffset ) ; } else { this . attributes [ attributesIndex ++ ] = new ClassFileAttribute ( classFileBytes , constantPool , offset + readOffset ) ; } readOffset += ( <NUM_LIT:6> + u4At ( classFileBytes , readOffset + <NUM_LIT:2> , offset ) ) ; } this . attributeBytes = readOffset ; } public int getAccessFlags ( ) { return this . accessFlags ; } public int getAttributeCount ( ) { return this . attributesCount ; } public IClassFileAttribute [ ] getAttributes ( ) { return this . attributes ; } public IConstantValueAttribute getConstantValueAttribute ( ) { return this . constantValueAttribute ; } public char [ ] getDescriptor ( ) { return this . descriptor ; } public int getDescriptorIndex ( ) { return this . descriptorIndex ; } public char [ ] getName ( ) { return this . name ; } public int getNameIndex ( ) { return this . nameIndex ; } public boolean hasConstantValueAttribute ( ) { return this . constantValueAttribute != null ; } public boolean isDeprecated ( ) { return this . isDeprecated ; } public boolean isSynthetic ( ) { return this . isSynthetic ; } int sizeInBytes ( ) { return this . attributeBytes ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; import org . eclipse . jdt . core . util . IConstantValueAttribute ; public class ConstantValueAttribute extends ClassFileAttribute implements IConstantValueAttribute { private int constantValueIndex ; private IConstantPoolEntry constantPoolEntry ; ConstantValueAttribute ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { super ( classFileBytes , constantPool , offset ) ; this . constantValueIndex = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; this . constantPoolEntry = constantPool . decodeEntry ( this . constantValueIndex ) ; } public IConstantPoolEntry getConstantValue ( ) { return this . constantPoolEntry ; } public int getConstantValueIndex ( ) { return this . constantValueIndex ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IAnnotationComponentValue ; import org . eclipse . jdt . core . util . IAnnotationDefaultAttribute ; import org . eclipse . jdt . core . util . IConstantPool ; public class AnnotationDefaultAttribute extends ClassFileAttribute implements IAnnotationDefaultAttribute { private IAnnotationComponentValue memberValue ; public AnnotationDefaultAttribute ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { super ( classFileBytes , constantPool , offset ) ; this . memberValue = new AnnotationComponentValue ( classFileBytes , constantPool , offset + <NUM_LIT:6> ) ; } public IAnnotationComponentValue getMemberValue ( ) { return this . memberValue ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import java . text . NumberFormat ; import java . util . Enumeration ; import java . util . Hashtable ; public class LRUCache implements Cloneable { protected static class LRUCacheEntry { public Object key ; public Object value ; public int timestamp ; public int space ; public LRUCacheEntry previous ; public LRUCacheEntry next ; public LRUCacheEntry ( Object key , Object value , int space ) { this . key = key ; this . value = value ; this . space = space ; } public String toString ( ) { return "<STR_LIT>" + this . key + "<STR_LIT>" + this . value + "<STR_LIT:]>" ; } } public class Stats { private int [ ] counters = new int [ <NUM_LIT:20> ] ; private long [ ] timestamps = new long [ <NUM_LIT:20> ] ; private int counterIndex = - <NUM_LIT:1> ; private void add ( int counter ) { for ( int i = <NUM_LIT:0> ; i <= this . counterIndex ; i ++ ) { if ( this . counters [ i ] == counter ) return ; } int length = this . counters . length ; if ( ++ this . counterIndex == length ) { int newLength = this . counters . length * <NUM_LIT:2> ; System . arraycopy ( this . counters , <NUM_LIT:0> , this . counters = new int [ newLength ] , <NUM_LIT:0> , length ) ; System . arraycopy ( this . timestamps , <NUM_LIT:0> , this . timestamps = new long [ newLength ] , <NUM_LIT:0> , length ) ; } this . counters [ this . counterIndex ] = counter ; this . timestamps [ this . counterIndex ] = System . currentTimeMillis ( ) ; } private String getAverageAge ( long totalTime , int numberOfElements , long currentTime ) { if ( numberOfElements == <NUM_LIT:0> ) return "<STR_LIT>" ; long time = totalTime / numberOfElements ; long age = currentTime - time ; long ageInSeconds = age / <NUM_LIT:1000> ; int seconds = <NUM_LIT:0> ; int minutes = <NUM_LIT:0> ; int hours = <NUM_LIT:0> ; int days = <NUM_LIT:0> ; if ( ageInSeconds > <NUM_LIT> ) { long ageInMin = ageInSeconds / <NUM_LIT> ; seconds = ( int ) ( ageInSeconds - ( <NUM_LIT> * ageInMin ) ) ; if ( ageInMin > <NUM_LIT> ) { long ageInHours = ageInMin / <NUM_LIT> ; minutes = ( int ) ( ageInMin - ( <NUM_LIT> * ageInHours ) ) ; if ( ageInHours > <NUM_LIT:24> ) { long ageInDays = ageInHours / <NUM_LIT:24> ; hours = ( int ) ( ageInHours - ( <NUM_LIT:24> * ageInDays ) ) ; days = ( int ) ageInDays ; } else { hours = ( int ) ageInHours ; } } else { minutes = ( int ) ageInMin ; } } else { seconds = ( int ) ageInSeconds ; } StringBuffer buffer = new StringBuffer ( ) ; if ( days > <NUM_LIT:0> ) { buffer . append ( days ) ; buffer . append ( "<STR_LIT>" ) ; } if ( hours > <NUM_LIT:0> ) { buffer . append ( hours ) ; buffer . append ( "<STR_LIT>" ) ; } if ( minutes > <NUM_LIT:0> ) { buffer . append ( minutes ) ; buffer . append ( "<STR_LIT>" ) ; } buffer . append ( seconds ) ; buffer . append ( "<STR_LIT>" ) ; return buffer . toString ( ) ; } private long getTimestamps ( int counter ) { for ( int i = <NUM_LIT:0> ; i <= this . counterIndex ; i ++ ) { if ( this . counters [ i ] >= counter ) return this . timestamps [ i ] ; } return - <NUM_LIT:1> ; } public synchronized String printStats ( ) { int numberOfElements = LRUCache . this . currentSpace ; if ( numberOfElements == <NUM_LIT:0> ) { return "<STR_LIT>" ; } StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( numberOfElements ) ; final int numberOfGroups = <NUM_LIT:5> ; int numberOfElementsPerGroup = numberOfElements / numberOfGroups ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( numberOfGroups ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( numberOfElementsPerGroup ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( "<STR_LIT>" ) ; int groupNumber = <NUM_LIT:1> ; int elementCounter = <NUM_LIT:0> ; LRUCacheEntry entry = LRUCache . this . entryQueueTail ; long currentTime = System . currentTimeMillis ( ) ; long accumulatedTime = <NUM_LIT:0> ; while ( entry != null ) { long timeStamps = getTimestamps ( entry . timestamp ) ; if ( timeStamps > <NUM_LIT:0> ) { accumulatedTime += timeStamps ; elementCounter ++ ; } if ( elementCounter >= numberOfElementsPerGroup && ( groupNumber < numberOfGroups ) ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( groupNumber ) ; if ( groupNumber == <NUM_LIT:1> ) { buffer . append ( "<STR_LIT>" ) ; } else { buffer . append ( "<STR_LIT>" ) ; } groupNumber ++ ; buffer . append ( getAverageAge ( accumulatedTime , elementCounter , currentTime ) ) ; elementCounter = <NUM_LIT:0> ; accumulatedTime = <NUM_LIT:0> ; } entry = entry . previous ; } buffer . append ( "<STR_LIT>" ) ; buffer . append ( numberOfGroups ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( getAverageAge ( accumulatedTime , elementCounter , currentTime ) ) ; return buffer . toString ( ) ; } private void removeCountersOlderThan ( int counter ) { for ( int i = <NUM_LIT:0> ; i <= this . counterIndex ; i ++ ) { if ( this . counters [ i ] >= counter ) { if ( i > <NUM_LIT:0> ) { int length = this . counterIndex - i + <NUM_LIT:1> ; System . arraycopy ( this . counters , i , this . counters , <NUM_LIT:0> , length ) ; System . arraycopy ( this . timestamps , i , this . timestamps , <NUM_LIT:0> , length ) ; this . counterIndex = length ; } return ; } } } public Object getOldestElement ( ) { return LRUCache . this . getOldestElement ( ) ; } public long getOldestTimestamps ( ) { return getTimestamps ( getOldestTimestampCounter ( ) ) ; } public synchronized void snapshot ( ) { removeCountersOlderThan ( getOldestTimestampCounter ( ) ) ; add ( getNewestTimestampCounter ( ) ) ; } } protected int currentSpace ; protected int spaceLimit ; protected int timestampCounter ; protected Hashtable entryTable ; protected LRUCacheEntry entryQueue ; protected LRUCacheEntry entryQueueTail ; protected static final int DEFAULT_SPACELIMIT = <NUM_LIT:100> ; public LRUCache ( ) { this ( DEFAULT_SPACELIMIT ) ; } public LRUCache ( int size ) { this . timestampCounter = this . currentSpace = <NUM_LIT:0> ; this . entryQueue = this . entryQueueTail = null ; this . entryTable = new Hashtable ( size ) ; this . spaceLimit = size ; } public Object clone ( ) { LRUCache newCache = newInstance ( this . spaceLimit ) ; LRUCacheEntry qEntry ; qEntry = this . entryQueueTail ; while ( qEntry != null ) { newCache . privateAdd ( qEntry . key , qEntry . value , qEntry . space ) ; qEntry = qEntry . previous ; } return newCache ; } public double fillingRatio ( ) { return ( this . currentSpace ) * <NUM_LIT> / this . spaceLimit ; } public void flush ( ) { this . currentSpace = <NUM_LIT:0> ; LRUCacheEntry entry = this . entryQueueTail ; this . entryTable = new Hashtable ( ) ; this . entryQueue = this . entryQueueTail = null ; while ( entry != null ) { entry = entry . previous ; } } public void flush ( Object key ) { LRUCacheEntry entry ; entry = ( LRUCacheEntry ) this . entryTable . get ( key ) ; if ( entry == null ) return ; privateRemoveEntry ( entry , false ) ; } public Object getKey ( Object key ) { LRUCacheEntry entry = ( LRUCacheEntry ) this . entryTable . get ( key ) ; if ( entry == null ) { return key ; } return entry . key ; } public Object get ( Object key ) { LRUCacheEntry entry = ( LRUCacheEntry ) this . entryTable . get ( key ) ; if ( entry == null ) { return null ; } updateTimestamp ( entry ) ; return entry . value ; } public int getCurrentSpace ( ) { return this . currentSpace ; } public int getNewestTimestampCounter ( ) { return this . entryQueue == null ? <NUM_LIT:0> : this . entryQueue . timestamp ; } public int getOldestTimestampCounter ( ) { return this . entryQueueTail == null ? <NUM_LIT:0> : this . entryQueueTail . timestamp ; } public Object getOldestElement ( ) { return this . entryQueueTail == null ? null : this . entryQueueTail . key ; } public int getSpaceLimit ( ) { return this . spaceLimit ; } public Enumeration keys ( ) { return this . entryTable . keys ( ) ; } public ICacheEnumeration keysAndValues ( ) { return new ICacheEnumeration ( ) { Enumeration values = LRUCache . this . entryTable . elements ( ) ; LRUCacheEntry entry ; public boolean hasMoreElements ( ) { return this . values . hasMoreElements ( ) ; } public Object nextElement ( ) { this . entry = ( LRUCacheEntry ) this . values . nextElement ( ) ; return this . entry . key ; } public Object getValue ( ) { if ( this . entry == null ) { throw new java . util . NoSuchElementException ( ) ; } return this . entry . value ; } } ; } protected boolean makeSpace ( int space ) { int limit ; limit = getSpaceLimit ( ) ; if ( this . currentSpace + space <= limit ) { return true ; } if ( space > limit ) { return false ; } while ( this . currentSpace + space > limit && this . entryQueueTail != null ) { privateRemoveEntry ( this . entryQueueTail , false ) ; } return true ; } protected LRUCache newInstance ( int size ) { return new LRUCache ( size ) ; } public Object peek ( Object key ) { LRUCacheEntry entry = ( LRUCacheEntry ) this . entryTable . get ( key ) ; if ( entry == null ) { return null ; } return entry . value ; } protected void privateAdd ( Object key , Object value , int space ) { LRUCacheEntry entry ; entry = new LRUCacheEntry ( key , value , space ) ; privateAddEntry ( entry , false ) ; } protected void privateAddEntry ( LRUCacheEntry entry , boolean shuffle ) { if ( ! shuffle ) { this . entryTable . put ( entry . key , entry ) ; this . currentSpace += entry . space ; } entry . timestamp = this . timestampCounter ++ ; entry . next = this . entryQueue ; entry . previous = null ; if ( this . entryQueue == null ) { this . entryQueueTail = entry ; } else { this . entryQueue . previous = entry ; } this . entryQueue = entry ; } protected void privateRemoveEntry ( LRUCacheEntry entry , boolean shuffle ) { LRUCacheEntry previous , next ; previous = entry . previous ; next = entry . next ; if ( ! shuffle ) { this . entryTable . remove ( entry . key ) ; this . currentSpace -= entry . space ; } if ( previous == null ) { this . entryQueue = next ; } else { previous . next = next ; } if ( next == null ) { this . entryQueueTail = previous ; } else { next . previous = previous ; } } public Object put ( Object key , Object value ) { int newSpace , oldSpace , newTotal ; LRUCacheEntry entry ; newSpace = spaceFor ( value ) ; entry = ( LRUCacheEntry ) this . entryTable . get ( key ) ; if ( entry != null ) { oldSpace = entry . space ; newTotal = getCurrentSpace ( ) - oldSpace + newSpace ; if ( newTotal <= getSpaceLimit ( ) ) { updateTimestamp ( entry ) ; entry . value = value ; entry . space = newSpace ; this . currentSpace = newTotal ; return value ; } else { privateRemoveEntry ( entry , false ) ; } } if ( makeSpace ( newSpace ) ) { privateAdd ( key , value , newSpace ) ; } return value ; } public Object removeKey ( Object key ) { LRUCacheEntry entry = ( LRUCacheEntry ) this . entryTable . get ( key ) ; if ( entry == null ) { return null ; } Object value = entry . value ; privateRemoveEntry ( entry , false ) ; return value ; } public void setSpaceLimit ( int limit ) { if ( limit < this . spaceLimit ) { makeSpace ( this . spaceLimit - limit ) ; } this . spaceLimit = limit ; } protected int spaceFor ( Object value ) { if ( value instanceof ILRUCacheable ) { return ( ( ILRUCacheable ) value ) . getCacheFootprint ( ) ; } else { return <NUM_LIT:1> ; } } public String toString ( ) { return toStringFillingRation ( "<STR_LIT>" ) + toStringContents ( ) ; } protected String toStringContents ( ) { StringBuffer result = new StringBuffer ( ) ; int length = this . entryTable . size ( ) ; Object [ ] unsortedKeys = new Object [ length ] ; String [ ] unsortedToStrings = new String [ length ] ; Enumeration e = keys ( ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { Object key = e . nextElement ( ) ; unsortedKeys [ i ] = key ; unsortedToStrings [ i ] = ( key instanceof org . eclipse . jdt . internal . core . JavaElement ) ? ( ( org . eclipse . jdt . internal . core . JavaElement ) key ) . getElementName ( ) : key . toString ( ) ; } ToStringSorter sorter = new ToStringSorter ( ) ; sorter . sort ( unsortedKeys , unsortedToStrings ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { String toString = sorter . sortedStrings [ i ] ; Object value = get ( sorter . sortedObjects [ i ] ) ; result . append ( toString ) ; result . append ( "<STR_LIT>" ) ; result . append ( value ) ; result . append ( "<STR_LIT:n>" ) ; } return result . toString ( ) ; } public String toStringFillingRation ( String cacheName ) { StringBuffer buffer = new StringBuffer ( cacheName ) ; buffer . append ( '<CHAR_LIT:[>' ) ; buffer . append ( getSpaceLimit ( ) ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( NumberFormat . getInstance ( ) . format ( fillingRatio ( ) ) ) ; buffer . append ( "<STR_LIT>" ) ; return buffer . toString ( ) ; } protected void updateTimestamp ( LRUCacheEntry entry ) { entry . timestamp = this . timestampCounter ++ ; if ( this . entryQueue != entry ) { privateRemoveEntry ( entry , true ) ; privateAddEntry ( entry , true ) ; } return ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IConstantPoolConstant ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; import org . eclipse . jdt . core . util . ISourceAttribute ; public class SourceFileAttribute extends ClassFileAttribute implements ISourceAttribute { private int sourceFileIndex ; private char [ ] sourceFileName ; public SourceFileAttribute ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { super ( classFileBytes , constantPool , offset ) ; this . sourceFileIndex = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; IConstantPoolEntry constantPoolEntry = constantPool . decodeEntry ( this . sourceFileIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . sourceFileName = constantPoolEntry . getUtf8Value ( ) ; } public int getSourceFileIndex ( ) { return this . sourceFileIndex ; } public char [ ] getSourceFileName ( ) { return this . sourceFileName ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import java . net . URI ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . batch . CompilationUnit ; public class ResourceCompilationUnit extends CompilationUnit { private IFile file ; public ResourceCompilationUnit ( IFile file , URI location ) { super ( null , location == null ? file . getFullPath ( ) . toString ( ) : location . getPath ( ) , null ) ; this . file = file ; } public char [ ] getContents ( ) { if ( this . contents != null ) return this . contents ; try { return Util . getResourceContentsAsCharArray ( this . file ) ; } catch ( CoreException e ) { return CharOperation . NO_CHAR ; } } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IInnerClassesAttribute ; import org . eclipse . jdt . core . util . IInnerClassesAttributeEntry ; public class InnerClassesAttribute extends ClassFileAttribute implements IInnerClassesAttribute { private static final IInnerClassesAttributeEntry [ ] NO_ENTRIES = new IInnerClassesAttributeEntry [ <NUM_LIT:0> ] ; private int numberOfClasses ; private IInnerClassesAttributeEntry [ ] entries ; public InnerClassesAttribute ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { super ( classFileBytes , constantPool , offset ) ; this . numberOfClasses = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; final int length = this . numberOfClasses ; if ( length != <NUM_LIT:0> ) { int readOffset = <NUM_LIT:8> ; this . entries = new IInnerClassesAttributeEntry [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . entries [ i ] = new InnerClassesAttributeEntry ( classFileBytes , constantPool , offset + readOffset ) ; readOffset += <NUM_LIT:8> ; } } else { this . entries = NO_ENTRIES ; } } public IInnerClassesAttributeEntry [ ] getInnerClassAttributesEntries ( ) { return this . entries ; } public int getNumberOfClasses ( ) { return this . numberOfClasses ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import java . util . Locale ; import java . util . Map ; import org . eclipse . jdt . core . compiler . CategorizedProblem ; import org . eclipse . jdt . internal . compiler . CompilationResult ; import org . eclipse . jdt . internal . compiler . DefaultErrorHandlingPolicies ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . CompilationUnitDeclaration ; import org . eclipse . jdt . internal . compiler . ast . ConstructorDeclaration ; import org . eclipse . jdt . internal . compiler . ast . Expression ; import org . eclipse . jdt . internal . compiler . batch . CompilationUnit ; import org . eclipse . jdt . internal . compiler . env . ICompilationUnit ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . problem . DefaultProblemFactory ; import org . eclipse . jdt . internal . compiler . problem . ProblemReporter ; public class CodeSnippetParsingUtil { public RecordedParsingInformation recordedParsingInformation ; public boolean ignoreMethodBodies ; public CodeSnippetParsingUtil ( boolean ignoreMethodBodies ) { this . ignoreMethodBodies = ignoreMethodBodies ; } public CodeSnippetParsingUtil ( ) { this ( false ) ; } private RecordedParsingInformation getRecordedParsingInformation ( CompilationResult compilationResult , int [ ] [ ] commentPositions ) { int problemsCount = compilationResult . problemCount ; CategorizedProblem [ ] problems = null ; if ( problemsCount != <NUM_LIT:0> ) { final CategorizedProblem [ ] compilationResultProblems = compilationResult . problems ; if ( compilationResultProblems . length == problemsCount ) { problems = compilationResultProblems ; } else { System . arraycopy ( compilationResultProblems , <NUM_LIT:0> , ( problems = new CategorizedProblem [ problemsCount ] ) , <NUM_LIT:0> , problemsCount ) ; } } return new RecordedParsingInformation ( problems , compilationResult . getLineSeparatorPositions ( ) , commentPositions ) ; } public ASTNode [ ] parseClassBodyDeclarations ( char [ ] source , Map settings , boolean recordParsingInformation ) { return parseClassBodyDeclarations ( source , <NUM_LIT:0> , source . length , settings , recordParsingInformation , false ) ; } public ASTNode [ ] parseClassBodyDeclarations ( char [ ] source , int offset , int length , Map settings , boolean recordParsingInformation , boolean enabledStatementRecovery ) { if ( source == null ) { throw new IllegalArgumentException ( ) ; } CompilerOptions compilerOptions = new CompilerOptions ( settings ) ; compilerOptions . ignoreMethodBodies = this . ignoreMethodBodies ; final ProblemReporter problemReporter = new ProblemReporter ( DefaultErrorHandlingPolicies . proceedWithAllProblems ( ) , compilerOptions , new DefaultProblemFactory ( Locale . getDefault ( ) ) ) ; CommentRecorderParser parser = new CommentRecorderParser ( problemReporter , false ) ; parser . setMethodsFullRecovery ( false ) ; parser . setStatementsRecovery ( enabledStatementRecovery ) ; ICompilationUnit sourceUnit = new CompilationUnit ( source , "<STR_LIT>" , compilerOptions . defaultEncoding ) ; CompilationResult compilationResult = new CompilationResult ( sourceUnit , <NUM_LIT:0> , <NUM_LIT:0> , compilerOptions . maxProblemsPerUnit ) ; final CompilationUnitDeclaration compilationUnitDeclaration = new CompilationUnitDeclaration ( problemReporter , compilationResult , source . length ) ; ASTNode [ ] result = parser . parseClassBodyDeclarations ( source , offset , length , compilationUnitDeclaration ) ; if ( recordParsingInformation ) { this . recordedParsingInformation = getRecordedParsingInformation ( compilationResult , compilationUnitDeclaration . comments ) ; } return result ; } public CompilationUnitDeclaration parseCompilationUnit ( char [ ] source , Map settings , boolean recordParsingInformation ) { if ( source == null ) { throw new IllegalArgumentException ( ) ; } CompilerOptions compilerOptions = new CompilerOptions ( settings ) ; compilerOptions . ignoreMethodBodies = this . ignoreMethodBodies ; CommentRecorderParser parser = new CommentRecorderParser ( new ProblemReporter ( DefaultErrorHandlingPolicies . proceedWithAllProblems ( ) , compilerOptions , new DefaultProblemFactory ( Locale . getDefault ( ) ) ) , false ) ; ICompilationUnit sourceUnit = new CompilationUnit ( source , "<STR_LIT>" , compilerOptions . defaultEncoding ) ; final CompilationResult compilationResult = new CompilationResult ( sourceUnit , <NUM_LIT:0> , <NUM_LIT:0> , compilerOptions . maxProblemsPerUnit ) ; CompilationUnitDeclaration compilationUnitDeclaration = parser . dietParse ( sourceUnit , compilationResult ) ; if ( recordParsingInformation ) { this . recordedParsingInformation = getRecordedParsingInformation ( compilationResult , compilationUnitDeclaration . comments ) ; } if ( compilationUnitDeclaration . ignoreMethodBodies ) { compilationUnitDeclaration . ignoreFurtherInvestigation = true ; return compilationUnitDeclaration ; } parser . scanner . setSource ( compilationResult ) ; org . eclipse . jdt . internal . compiler . ast . TypeDeclaration [ ] types = compilationUnitDeclaration . types ; if ( types != null ) { for ( int i = <NUM_LIT:0> , length = types . length ; i < length ; i ++ ) { types [ i ] . parseMethods ( parser , compilationUnitDeclaration ) ; } } if ( recordParsingInformation ) { this . recordedParsingInformation . updateRecordedParsingInformation ( compilationResult ) ; } return compilationUnitDeclaration ; } public Expression parseExpression ( char [ ] source , Map settings , boolean recordParsingInformation ) { return parseExpression ( source , <NUM_LIT:0> , source . length , settings , recordParsingInformation ) ; } public Expression parseExpression ( char [ ] source , int offset , int length , Map settings , boolean recordParsingInformation ) { if ( source == null ) { throw new IllegalArgumentException ( ) ; } CompilerOptions compilerOptions = new CompilerOptions ( settings ) ; final ProblemReporter problemReporter = new ProblemReporter ( DefaultErrorHandlingPolicies . proceedWithAllProblems ( ) , compilerOptions , new DefaultProblemFactory ( Locale . getDefault ( ) ) ) ; CommentRecorderParser parser = new CommentRecorderParser ( problemReporter , false ) ; ICompilationUnit sourceUnit = new CompilationUnit ( source , "<STR_LIT>" , compilerOptions . defaultEncoding ) ; CompilationResult compilationResult = new CompilationResult ( sourceUnit , <NUM_LIT:0> , <NUM_LIT:0> , compilerOptions . maxProblemsPerUnit ) ; CompilationUnitDeclaration unit = new CompilationUnitDeclaration ( problemReporter , compilationResult , source . length ) ; Expression result = parser . parseExpression ( source , offset , length , unit ) ; if ( recordParsingInformation ) { this . recordedParsingInformation = getRecordedParsingInformation ( compilationResult , unit . comments ) ; } return result ; } public ConstructorDeclaration parseStatements ( char [ ] source , Map settings , boolean recordParsingInformation , boolean enabledStatementRecovery ) { return parseStatements ( source , <NUM_LIT:0> , source . length , settings , recordParsingInformation , enabledStatementRecovery ) ; } public ConstructorDeclaration parseStatements ( char [ ] source , int offset , int length , Map settings , boolean recordParsingInformation , boolean enabledStatementRecovery ) { if ( source == null ) { throw new IllegalArgumentException ( ) ; } CompilerOptions compilerOptions = new CompilerOptions ( settings ) ; final ProblemReporter problemReporter = new ProblemReporter ( DefaultErrorHandlingPolicies . proceedWithAllProblems ( ) , compilerOptions , new DefaultProblemFactory ( Locale . getDefault ( ) ) ) ; CommentRecorderParser parser = new CommentRecorderParser ( problemReporter , false ) ; parser . setMethodsFullRecovery ( false ) ; parser . setStatementsRecovery ( enabledStatementRecovery ) ; ICompilationUnit sourceUnit = new CompilationUnit ( source , "<STR_LIT>" , compilerOptions . defaultEncoding ) ; final CompilationResult compilationResult = new CompilationResult ( sourceUnit , <NUM_LIT:0> , <NUM_LIT:0> , compilerOptions . maxProblemsPerUnit ) ; CompilationUnitDeclaration compilationUnitDeclaration = new CompilationUnitDeclaration ( problemReporter , compilationResult , length ) ; ConstructorDeclaration constructorDeclaration = new ConstructorDeclaration ( compilationResult ) ; constructorDeclaration . sourceEnd = - <NUM_LIT:1> ; constructorDeclaration . declarationSourceEnd = offset + length - <NUM_LIT:1> ; constructorDeclaration . bodyStart = offset ; constructorDeclaration . bodyEnd = offset + length - <NUM_LIT:1> ; parser . scanner . setSource ( compilationResult ) ; parser . scanner . resetTo ( offset , offset + length ) ; parser . parse ( constructorDeclaration , compilationUnitDeclaration , true ) ; if ( recordParsingInformation ) { this . recordedParsingInformation = getRecordedParsingInformation ( compilationResult , compilationUnitDeclaration . comments ) ; } return constructorDeclaration ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import java . io . * ; import java . net . URI ; import java . util . * ; import java . util . zip . ZipEntry ; import java . util . zip . ZipFile ; import org . eclipse . core . filesystem . EFS ; import org . eclipse . core . filesystem . IFileStore ; import org . eclipse . core . resources . * ; import org . eclipse . core . runtime . * ; import org . eclipse . core . runtime . content . IContentType ; import org . eclipse . core . runtime . preferences . IScopeContext ; import org . eclipse . core . runtime . preferences . InstanceScope ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . dom . ASTNode ; import org . eclipse . jdt . core . dom . ArrayType ; import org . eclipse . jdt . core . dom . ParameterizedType ; import org . eclipse . jdt . core . dom . PrimitiveType ; import org . eclipse . jdt . core . dom . QualifiedType ; import org . eclipse . jdt . core . dom . SimpleType ; import org . eclipse . jdt . core . dom . Type ; import org . eclipse . jdt . core . dom . WildcardType ; import org . eclipse . jdt . core . util . IClassFileAttribute ; import org . eclipse . jdt . core . util . IClassFileReader ; import org . eclipse . jdt . core . util . ICodeAttribute ; import org . eclipse . jdt . core . util . IFieldInfo ; import org . eclipse . jdt . core . util . IMethodInfo ; import org . eclipse . jdt . internal . compiler . ast . AbstractMethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . AnnotationMethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . Argument ; import org . eclipse . jdt . internal . compiler . ast . MethodDeclaration ; import org . eclipse . jdt . internal . compiler . ast . TypeReference ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileReader ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFormatException ; import org . eclipse . jdt . internal . compiler . env . ClassSignature ; import org . eclipse . jdt . internal . compiler . env . EnumConstantSignature ; import org . eclipse . jdt . internal . compiler . env . IBinaryAnnotation ; import org . eclipse . jdt . internal . compiler . env . IDependent ; import org . eclipse . jdt . internal . compiler . impl . Constant ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ReferenceBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeIds ; import org . eclipse . jdt . internal . compiler . parser . ScannerHelper ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . core . Annotation ; import org . eclipse . jdt . internal . core . ClassFile ; import org . eclipse . jdt . internal . core . JavaElement ; import org . eclipse . jdt . internal . core . JavaModelManager ; import org . eclipse . jdt . internal . core . Member ; import org . eclipse . jdt . internal . core . MemberValuePair ; import org . eclipse . jdt . internal . core . PackageFragment ; import org . eclipse . jdt . internal . core . PackageFragmentRoot ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . text . edits . MalformedTreeException ; import org . eclipse . text . edits . TextEdit ; public class Util { public interface Comparable { int compareTo ( Comparable c ) ; } public interface Comparer { int compare ( Object a , Object b ) ; } public static interface BindingsToNodesMap { public org . eclipse . jdt . internal . compiler . ast . ASTNode get ( Binding binding ) ; } private static final char ARGUMENTS_DELIMITER = '<CHAR_LIT>' ; private static final String EMPTY_ARGUMENT = "<STR_LIT>" ; private static char [ ] [ ] JAVA_LIKE_EXTENSIONS ; private static final char [ ] BOOLEAN = "<STR_LIT:boolean>" . toCharArray ( ) ; private static final char [ ] BYTE = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] CHAR = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] DOUBLE = "<STR_LIT:double>" . toCharArray ( ) ; private static final char [ ] FLOAT = "<STR_LIT:float>" . toCharArray ( ) ; private static final char [ ] INT = "<STR_LIT:int>" . toCharArray ( ) ; private static final char [ ] LONG = "<STR_LIT:long>" . toCharArray ( ) ; private static final char [ ] SHORT = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] VOID = "<STR_LIT>" . toCharArray ( ) ; private static final char [ ] INIT = "<STR_LIT>" . toCharArray ( ) ; private static final String TASK_PRIORITIES_PROBLEM = "<STR_LIT>" ; private static List fgRepeatedMessages = new ArrayList ( <NUM_LIT:5> ) ; private Util ( ) { } public static final String [ ] arrayConcat ( String [ ] first , String second ) { if ( second == null ) return first ; if ( first == null ) return new String [ ] { second } ; int length = first . length ; if ( first . length == <NUM_LIT:0> ) { return new String [ ] { second } ; } String [ ] result = new String [ length + <NUM_LIT:1> ] ; System . arraycopy ( first , <NUM_LIT:0> , result , <NUM_LIT:0> , length ) ; result [ length ] = second ; return result ; } private static int checkTypeSignature ( String sig , int start , int end , boolean allowVoid ) { if ( start >= end ) return - <NUM_LIT:1> ; int i = start ; char c = sig . charAt ( i ++ ) ; int nestingDepth = <NUM_LIT:0> ; while ( c == '<CHAR_LIT:[>' ) { ++ nestingDepth ; if ( i >= end ) return - <NUM_LIT:1> ; c = sig . charAt ( i ++ ) ; } switch ( c ) { 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>' : break ; case '<CHAR_LIT>' : if ( ! allowVoid ) return - <NUM_LIT:1> ; if ( nestingDepth != <NUM_LIT:0> ) return - <NUM_LIT:1> ; break ; case '<CHAR_LIT>' : int semicolon = sig . indexOf ( '<CHAR_LIT:;>' , i ) ; if ( semicolon <= i || semicolon >= end ) return - <NUM_LIT:1> ; i = semicolon + <NUM_LIT:1> ; break ; default : return - <NUM_LIT:1> ; } return i ; } public static int combineHashCodes ( int hashCode1 , int hashCode2 ) { return hashCode1 * <NUM_LIT> + hashCode2 ; } public static int compare ( byte [ ] a , byte [ ] b ) { if ( a == b ) return <NUM_LIT:0> ; if ( a == null ) return - <NUM_LIT:1> ; if ( b == null ) return <NUM_LIT:1> ; int len = Math . min ( a . length , b . length ) ; for ( int i = <NUM_LIT:0> ; i < len ; ++ i ) { int diff = a [ i ] - b [ i ] ; if ( diff != <NUM_LIT:0> ) return diff ; } if ( a . length > len ) return <NUM_LIT:1> ; if ( b . length > len ) return - <NUM_LIT:1> ; return <NUM_LIT:0> ; } public static int compare ( char [ ] str1 , char [ ] str2 ) { int len1 = str1 . length ; int len2 = str2 . length ; int n = Math . min ( len1 , len2 ) ; int i = <NUM_LIT:0> ; while ( n -- != <NUM_LIT:0> ) { char c1 = str1 [ i ] ; char c2 = str2 [ i ++ ] ; if ( c1 != c2 ) { return c1 - c2 ; } } return len1 - len2 ; } public static char [ ] concatCompoundNameToCharArray ( String [ ] compoundName ) { if ( compoundName == null ) return null ; int length = compoundName . length ; if ( length == <NUM_LIT:0> ) return new char [ <NUM_LIT:0> ] ; int size = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { size += compoundName [ i ] . length ( ) ; } char [ ] compoundChars = new char [ size + length - <NUM_LIT:1> ] ; int pos = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { String name = compoundName [ i ] ; if ( i > <NUM_LIT:0> ) compoundChars [ pos ++ ] = '<CHAR_LIT:.>' ; int nameLength = name . length ( ) ; name . getChars ( <NUM_LIT:0> , nameLength , compoundChars , pos ) ; pos += nameLength ; } return compoundChars ; } public static String concatenateName ( String name1 , String name2 , char separator ) { StringBuffer buf = new StringBuffer ( ) ; if ( name1 != null && name1 . length ( ) > <NUM_LIT:0> ) { buf . append ( name1 ) ; } if ( name2 != null && name2 . length ( ) > <NUM_LIT:0> ) { if ( buf . length ( ) > <NUM_LIT:0> ) { buf . append ( separator ) ; } buf . append ( name2 ) ; } return buf . toString ( ) ; } public static final String concatWith ( String [ ] array , char separator ) { StringBuffer buffer = new StringBuffer ( ) ; for ( int i = <NUM_LIT:0> , length = array . length ; i < length ; i ++ ) { buffer . append ( array [ i ] ) ; if ( i < length - <NUM_LIT:1> ) buffer . append ( separator ) ; } return buffer . toString ( ) ; } public static final String concatWith ( String [ ] array , String name , char separator ) { if ( array == null || array . length == <NUM_LIT:0> ) return name ; if ( name == null || name . length ( ) == <NUM_LIT:0> ) return concatWith ( array , separator ) ; StringBuffer buffer = new StringBuffer ( ) ; for ( int i = <NUM_LIT:0> , length = array . length ; i < length ; i ++ ) { buffer . append ( array [ i ] ) ; buffer . append ( separator ) ; } buffer . append ( name ) ; return buffer . toString ( ) ; } public static String convertTypeSignature ( char [ ] sig , int start , int length ) { return new String ( sig , start , length ) . replace ( '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; } public static String defaultJavaExtension ( ) { return SuffixConstants . SUFFIX_STRING_java ; } public final static String editedString ( String original , TextEdit edit ) { if ( edit == null ) { return original ; } SimpleDocument document = new SimpleDocument ( original ) ; try { edit . apply ( document , TextEdit . NONE ) ; return document . get ( ) ; } catch ( MalformedTreeException e ) { e . printStackTrace ( ) ; } catch ( BadLocationException e ) { e . printStackTrace ( ) ; } return original ; } public final static boolean endsWithIgnoreCase ( String str , String end ) { int strLength = str == null ? <NUM_LIT:0> : str . length ( ) ; int endLength = end == null ? <NUM_LIT:0> : end . length ( ) ; if ( endLength > strLength ) return false ; for ( int i = <NUM_LIT:1> ; i <= endLength ; i ++ ) { if ( ScannerHelper . toLowerCase ( end . charAt ( endLength - i ) ) != ScannerHelper . toLowerCase ( str . charAt ( strLength - i ) ) ) return false ; } return true ; } public static boolean equalArrays ( Object [ ] a , Object [ ] b , int len ) { if ( a == b ) return true ; if ( a . length < len || b . length < len ) return false ; for ( int i = <NUM_LIT:0> ; i < len ; ++ i ) { if ( a [ i ] == null ) { if ( b [ i ] != null ) return false ; } else { if ( ! a [ i ] . equals ( b [ i ] ) ) return false ; } } return true ; } public static boolean equalArraysOrNull ( int [ ] a , int [ ] b ) { if ( a == b ) return true ; if ( a == null || b == null ) return false ; int len = a . length ; if ( len != b . length ) return false ; for ( int i = <NUM_LIT:0> ; i < len ; ++ i ) { if ( a [ i ] != b [ i ] ) return false ; } return true ; } public static boolean equalArraysOrNull ( Object [ ] a , Object [ ] b ) { if ( a == b ) return true ; if ( a == null || b == null ) return false ; int len = a . length ; if ( len != b . length ) return false ; for ( int i = len - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) { if ( a [ i ] == null ) { if ( b [ i ] != null ) return false ; } else { if ( ! a [ i ] . equals ( b [ i ] ) ) return false ; } } return true ; } public static boolean equalArraysOrNullSortFirst ( Comparable [ ] a , Comparable [ ] b ) { if ( a == b ) return true ; if ( a == null || b == null ) return false ; int len = a . length ; if ( len != b . length ) return false ; if ( len >= <NUM_LIT:2> ) { a = sortCopy ( a ) ; b = sortCopy ( b ) ; } for ( int i = <NUM_LIT:0> ; i < len ; ++ i ) { if ( ! a [ i ] . equals ( b [ i ] ) ) return false ; } return true ; } public static boolean equalArraysOrNullSortFirst ( String [ ] a , String [ ] b ) { if ( a == b ) return true ; if ( a == null || b == null ) return false ; int len = a . length ; if ( len != b . length ) return false ; if ( len >= <NUM_LIT:2> ) { a = sortCopy ( a ) ; b = sortCopy ( b ) ; } for ( int i = <NUM_LIT:0> ; i < len ; ++ i ) { if ( ! a [ i ] . equals ( b [ i ] ) ) return false ; } return true ; } public static boolean equalOrNull ( Object a , Object b ) { if ( a == b ) { return true ; } if ( a == null || b == null ) { return false ; } return a . equals ( b ) ; } public static boolean equalsIgnoreJavaLikeExtension ( String fileName , String string ) { int fileNameLength = fileName . length ( ) ; int stringLength = string . length ( ) ; if ( fileNameLength < stringLength ) return false ; for ( int i = <NUM_LIT:0> ; i < stringLength ; i ++ ) { if ( fileName . charAt ( i ) != string . charAt ( i ) ) { return false ; } } char [ ] [ ] javaLikeExtensions = getJavaLikeExtensions ( ) ; suffixes : for ( int i = <NUM_LIT:0> , length = javaLikeExtensions . length ; i < length ; i ++ ) { char [ ] suffix = javaLikeExtensions [ i ] ; int extensionStart = stringLength + <NUM_LIT:1> ; if ( extensionStart + suffix . length != fileNameLength ) continue ; if ( fileName . charAt ( stringLength ) != '<CHAR_LIT:.>' ) continue ; for ( int j = extensionStart ; j < fileNameLength ; j ++ ) { if ( fileName . charAt ( j ) != suffix [ j - extensionStart ] ) continue suffixes ; } return true ; } return false ; } public static String extractLastName ( String qualifiedName ) { int i = qualifiedName . lastIndexOf ( '<CHAR_LIT:.>' ) ; if ( i == - <NUM_LIT:1> ) return qualifiedName ; return qualifiedName . substring ( i + <NUM_LIT:1> ) ; } public static String [ ] extractParameterTypes ( char [ ] sig ) { int count = getParameterCount ( sig ) ; String [ ] result = new String [ count ] ; if ( count == <NUM_LIT:0> ) return result ; int i = CharOperation . indexOf ( '<CHAR_LIT:(>' , sig ) + <NUM_LIT:1> ; count = <NUM_LIT:0> ; int len = sig . length ; int start = i ; for ( ; ; ) { if ( i == len ) break ; char c = sig [ i ] ; if ( c == '<CHAR_LIT:)>' ) break ; if ( c == '<CHAR_LIT:[>' ) { ++ i ; } else if ( c == '<CHAR_LIT>' ) { i = CharOperation . indexOf ( '<CHAR_LIT:;>' , sig , i + <NUM_LIT:1> ) + <NUM_LIT:1> ; Assert . isTrue ( i != <NUM_LIT:0> ) ; result [ count ++ ] = convertTypeSignature ( sig , start , i - start ) ; start = i ; } else { ++ i ; result [ count ++ ] = convertTypeSignature ( sig , start , i - start ) ; start = i ; } } return result ; } public static String extractReturnType ( String sig ) { int i = sig . lastIndexOf ( '<CHAR_LIT:)>' ) ; Assert . isTrue ( i != - <NUM_LIT:1> ) ; return sig . substring ( i + <NUM_LIT:1> ) ; } private static IFile findFirstClassFile ( IFolder folder ) { try { IResource [ ] members = folder . members ( ) ; for ( int i = <NUM_LIT:0> , max = members . length ; i < max ; i ++ ) { IResource member = members [ i ] ; if ( member . getType ( ) == IResource . FOLDER ) { return findFirstClassFile ( ( IFolder ) member ) ; } else if ( org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( member . getName ( ) ) ) { return ( IFile ) member ; } } } catch ( CoreException e ) { } return null ; } public static String findLineSeparator ( char [ ] text ) { int length = text . length ; if ( length > <NUM_LIT:0> ) { char nextChar = text [ <NUM_LIT:0> ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { char currentChar = nextChar ; nextChar = i < length - <NUM_LIT:1> ? text [ i + <NUM_LIT:1> ] : '<CHAR_LIT:U+0020>' ; switch ( currentChar ) { case '<STR_LIT:\n>' : return "<STR_LIT:n>" ; case '<STR_LIT>' : return nextChar == '<STR_LIT:\n>' ? "<STR_LIT>" : "<STR_LIT:r>" ; } } } return null ; } public static IClassFileAttribute getAttribute ( IClassFileReader classFileReader , char [ ] attributeName ) { IClassFileAttribute [ ] attributes = classFileReader . getAttributes ( ) ; for ( int i = <NUM_LIT:0> , max = attributes . length ; i < max ; i ++ ) { if ( CharOperation . equals ( attributes [ i ] . getAttributeName ( ) , attributeName ) ) { return attributes [ i ] ; } } return null ; } public static IClassFileAttribute getAttribute ( ICodeAttribute codeAttribute , char [ ] attributeName ) { IClassFileAttribute [ ] attributes = codeAttribute . getAttributes ( ) ; for ( int i = <NUM_LIT:0> , max = attributes . length ; i < max ; i ++ ) { if ( CharOperation . equals ( attributes [ i ] . getAttributeName ( ) , attributeName ) ) { return attributes [ i ] ; } } return null ; } public static IClassFileAttribute getAttribute ( IFieldInfo fieldInfo , char [ ] attributeName ) { IClassFileAttribute [ ] attributes = fieldInfo . getAttributes ( ) ; for ( int i = <NUM_LIT:0> , max = attributes . length ; i < max ; i ++ ) { if ( CharOperation . equals ( attributes [ i ] . getAttributeName ( ) , attributeName ) ) { return attributes [ i ] ; } } return null ; } public static IClassFileAttribute getAttribute ( IMethodInfo methodInfo , char [ ] attributeName ) { IClassFileAttribute [ ] attributes = methodInfo . getAttributes ( ) ; for ( int i = <NUM_LIT:0> , max = attributes . length ; i < max ; i ++ ) { if ( CharOperation . equals ( attributes [ i ] . getAttributeName ( ) , attributeName ) ) { return attributes [ i ] ; } } return null ; } private static IClassFile getClassFile ( char [ ] fileName ) { int jarSeparator = CharOperation . indexOf ( IDependent . JAR_FILE_ENTRY_SEPARATOR , fileName ) ; int pkgEnd = CharOperation . lastIndexOf ( '<CHAR_LIT:/>' , fileName ) ; if ( pkgEnd == - <NUM_LIT:1> ) pkgEnd = CharOperation . lastIndexOf ( File . separatorChar , fileName ) ; if ( jarSeparator != - <NUM_LIT:1> && pkgEnd < jarSeparator ) pkgEnd = jarSeparator ; if ( pkgEnd == - <NUM_LIT:1> ) return null ; IPackageFragment pkg = getPackageFragment ( fileName , pkgEnd , jarSeparator ) ; if ( pkg == null ) return null ; int start ; return pkg . getClassFile ( new String ( fileName , start = pkgEnd + <NUM_LIT:1> , fileName . length - start ) ) ; } private static ICompilationUnit getCompilationUnit ( char [ ] fileName , WorkingCopyOwner workingCopyOwner ) { char [ ] slashSeparatedFileName = CharOperation . replaceOnCopy ( fileName , File . separatorChar , '<CHAR_LIT:/>' ) ; int pkgEnd = CharOperation . lastIndexOf ( '<CHAR_LIT:/>' , slashSeparatedFileName ) ; if ( pkgEnd == - <NUM_LIT:1> ) return null ; IPackageFragment pkg = getPackageFragment ( slashSeparatedFileName , pkgEnd , - <NUM_LIT:1> ) ; if ( pkg == null ) return null ; int start ; ICompilationUnit cu = pkg . getCompilationUnit ( new String ( slashSeparatedFileName , start = pkgEnd + <NUM_LIT:1> , slashSeparatedFileName . length - start ) ) ; if ( workingCopyOwner != null ) { ICompilationUnit workingCopy = cu . findWorkingCopy ( workingCopyOwner ) ; if ( workingCopy != null ) return workingCopy ; } return cu ; } public static char [ ] [ ] getJavaLikeExtensions ( ) { if ( JAVA_LIKE_EXTENSIONS == null ) { IContentType javaContentType = Platform . getContentTypeManager ( ) . getContentType ( JavaCore . JAVA_SOURCE_CONTENT_TYPE ) ; HashSet fileExtensions = new HashSet ( ) ; IContentType [ ] contentTypes = Platform . getContentTypeManager ( ) . getAllContentTypes ( ) ; for ( int i = <NUM_LIT:0> , length = contentTypes . length ; i < length ; i ++ ) { if ( contentTypes [ i ] . isKindOf ( javaContentType ) ) { String [ ] fileExtension = contentTypes [ i ] . getFileSpecs ( IContentType . FILE_EXTENSION_SPEC ) ; for ( int j = <NUM_LIT:0> , length2 = fileExtension . length ; j < length2 ; j ++ ) { fileExtensions . add ( fileExtension [ j ] ) ; } } } int length = fileExtensions . size ( ) ; char [ ] [ ] extensions = new char [ length ] [ ] ; extensions [ <NUM_LIT:0> ] = SuffixConstants . EXTENSION_java . toCharArray ( ) ; int index = <NUM_LIT:1> ; Iterator iterator = fileExtensions . iterator ( ) ; while ( iterator . hasNext ( ) ) { String fileExtension = ( String ) iterator . next ( ) ; if ( SuffixConstants . EXTENSION_java . equals ( fileExtension ) ) continue ; extensions [ index ++ ] = fileExtension . toCharArray ( ) ; } JAVA_LIKE_EXTENSIONS = extensions ; } return JAVA_LIKE_EXTENSIONS ; } public static long getJdkLevel ( Object targetLibrary ) { try { ClassFileReader reader = null ; if ( targetLibrary instanceof IFolder ) { IFile classFile = findFirstClassFile ( ( IFolder ) targetLibrary ) ; if ( classFile != null ) reader = Util . newClassFileReader ( classFile ) ; } else { ZipFile jar = null ; try { IPath path = null ; if ( targetLibrary instanceof IResource ) { path = ( ( IResource ) targetLibrary ) . getFullPath ( ) ; } else if ( targetLibrary instanceof File ) { File f = ( File ) targetLibrary ; if ( ! f . isDirectory ( ) ) { path = new Path ( ( ( File ) targetLibrary ) . getPath ( ) ) ; } } if ( path != null ) { jar = JavaModelManager . getJavaModelManager ( ) . getZipFile ( path ) ; for ( Enumeration e = jar . entries ( ) ; e . hasMoreElements ( ) ; ) { ZipEntry member = ( ZipEntry ) e . nextElement ( ) ; String entryName = member . getName ( ) ; if ( org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( entryName ) ) { reader = ClassFileReader . read ( jar , entryName ) ; break ; } } } } catch ( CoreException e ) { } finally { JavaModelManager . getJavaModelManager ( ) . closeZipFile ( jar ) ; } } if ( reader != null ) { return reader . getVersion ( ) ; } } catch ( CoreException e ) { } catch ( ClassFormatException e ) { } catch ( IOException e ) { } return <NUM_LIT:0> ; } public static String getNameWithoutJavaLikeExtension ( String fileName ) { int index = indexOfJavaLikeExtension ( fileName ) ; if ( index == - <NUM_LIT:1> ) return fileName ; return fileName . substring ( <NUM_LIT:0> , index ) ; } public static String getLineSeparator ( String text , IJavaProject project ) { String lineSeparator = null ; if ( text != null && text . length ( ) != <NUM_LIT:0> ) { lineSeparator = findLineSeparator ( text . toCharArray ( ) ) ; if ( lineSeparator != null ) return lineSeparator ; } if ( Platform . isRunning ( ) ) { IScopeContext [ ] scopeContext ; if ( project != null ) { scopeContext = new IScopeContext [ ] { new ProjectScope ( project . getProject ( ) ) } ; lineSeparator = Platform . getPreferencesService ( ) . getString ( Platform . PI_RUNTIME , Platform . PREF_LINE_SEPARATOR , null , scopeContext ) ; if ( lineSeparator != null ) return lineSeparator ; } scopeContext = new IScopeContext [ ] { new InstanceScope ( ) } ; lineSeparator = Platform . getPreferencesService ( ) . getString ( Platform . PI_RUNTIME , Platform . PREF_LINE_SEPARATOR , null , scopeContext ) ; if ( lineSeparator != null ) return lineSeparator ; } return org . eclipse . jdt . internal . compiler . util . Util . LINE_SEPARATOR ; } private static String getLineSeparator ( char [ ] text , char [ ] buffer ) { String lineSeparator = findLineSeparator ( buffer ) ; if ( lineSeparator == null ) { lineSeparator = findLineSeparator ( text ) ; if ( lineSeparator == null ) { return getLineSeparator ( ( String ) null , ( IJavaProject ) null ) ; } } return lineSeparator ; } private static IPackageFragment getPackageFragment ( char [ ] fileName , int pkgEnd , int jarSeparator ) { if ( jarSeparator != - <NUM_LIT:1> ) { String jarMemento = new String ( fileName , <NUM_LIT:0> , jarSeparator ) ; PackageFragmentRoot root = ( PackageFragmentRoot ) JavaCore . create ( jarMemento ) ; if ( pkgEnd == jarSeparator ) return root . getPackageFragment ( CharOperation . NO_STRINGS ) ; char [ ] pkgName = CharOperation . subarray ( fileName , jarSeparator + <NUM_LIT:1> , pkgEnd ) ; char [ ] [ ] compoundName = CharOperation . splitOn ( '<CHAR_LIT:/>' , pkgName ) ; return root . getPackageFragment ( CharOperation . toStrings ( compoundName ) ) ; } else { Path path = new Path ( new String ( fileName , <NUM_LIT:0> , pkgEnd ) ) ; IWorkspaceRoot workspaceRoot = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; IContainer folder = path . segmentCount ( ) == <NUM_LIT:1> ? workspaceRoot . getProject ( path . lastSegment ( ) ) : ( IContainer ) workspaceRoot . getFolder ( path ) ; IJavaElement element = JavaCore . create ( folder ) ; if ( element == null ) return null ; switch ( element . getElementType ( ) ) { case IJavaElement . PACKAGE_FRAGMENT : return ( IPackageFragment ) element ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : return ( ( PackageFragmentRoot ) element ) . getPackageFragment ( CharOperation . NO_STRINGS ) ; case IJavaElement . JAVA_PROJECT : PackageFragmentRoot root = ( PackageFragmentRoot ) ( ( IJavaProject ) element ) . getPackageFragmentRoot ( folder ) ; if ( root == null ) return null ; return root . getPackageFragment ( CharOperation . NO_STRINGS ) ; } return null ; } } public static int getParameterCount ( char [ ] sig ) { int i = CharOperation . indexOf ( '<CHAR_LIT:(>' , sig ) + <NUM_LIT:1> ; Assert . isTrue ( i != <NUM_LIT:0> ) ; int count = <NUM_LIT:0> ; int len = sig . length ; for ( ; ; ) { if ( i == len ) break ; char c = sig [ i ] ; if ( c == '<CHAR_LIT:)>' ) break ; if ( c == '<CHAR_LIT:[>' ) { ++ i ; } else if ( c == '<CHAR_LIT>' ) { ++ count ; i = CharOperation . indexOf ( '<CHAR_LIT:;>' , sig , i + <NUM_LIT:1> ) + <NUM_LIT:1> ; Assert . isTrue ( i != <NUM_LIT:0> ) ; } else { ++ count ; ++ i ; } } return count ; } public static String getProblemArgumentsForMarker ( String [ ] arguments ) { StringBuffer args = new StringBuffer ( <NUM_LIT:10> ) ; args . append ( arguments . length ) ; args . append ( '<CHAR_LIT::>' ) ; for ( int j = <NUM_LIT:0> ; j < arguments . length ; j ++ ) { if ( j != <NUM_LIT:0> ) args . append ( ARGUMENTS_DELIMITER ) ; if ( arguments [ j ] . length ( ) == <NUM_LIT:0> ) { args . append ( EMPTY_ARGUMENT ) ; } else { encodeArgument ( arguments [ j ] , args ) ; } } return args . toString ( ) ; } private static void encodeArgument ( String argument , StringBuffer buffer ) { for ( int i = <NUM_LIT:0> , max = argument . length ( ) ; i < max ; i ++ ) { char charAt = argument . charAt ( i ) ; switch ( charAt ) { case ARGUMENTS_DELIMITER : buffer . append ( ARGUMENTS_DELIMITER ) . append ( ARGUMENTS_DELIMITER ) ; break ; default : buffer . append ( charAt ) ; } } } public static String [ ] getProblemArgumentsFromMarker ( String argumentsString ) { if ( argumentsString == null ) { return null ; } int index = argumentsString . indexOf ( '<CHAR_LIT::>' ) ; if ( index == - <NUM_LIT:1> ) return null ; int length = argumentsString . length ( ) ; int numberOfArg = <NUM_LIT:0> ; try { numberOfArg = Integer . parseInt ( argumentsString . substring ( <NUM_LIT:0> , index ) ) ; } catch ( NumberFormatException e ) { return null ; } argumentsString = argumentsString . substring ( index + <NUM_LIT:1> , length ) ; return decodeArgumentString ( numberOfArg , argumentsString ) ; } private static String [ ] decodeArgumentString ( int length , String argumentsString ) { if ( length == <NUM_LIT:0> ) { if ( argumentsString . length ( ) != <NUM_LIT:0> ) { return null ; } return CharOperation . NO_STRINGS ; } String [ ] result = new String [ length ] ; int count = <NUM_LIT:0> ; StringBuffer buffer = new StringBuffer ( ) ; for ( int i = <NUM_LIT:0> , max = argumentsString . length ( ) ; i < max ; i ++ ) { char current = argumentsString . charAt ( i ) ; switch ( current ) { case ARGUMENTS_DELIMITER : if ( ( i + <NUM_LIT:1> ) == max ) { return null ; } char next = argumentsString . charAt ( i + <NUM_LIT:1> ) ; if ( next == ARGUMENTS_DELIMITER ) { buffer . append ( ARGUMENTS_DELIMITER ) ; i ++ ; } else { String currentArgumentContents = String . valueOf ( buffer ) ; if ( EMPTY_ARGUMENT . equals ( currentArgumentContents ) ) { currentArgumentContents = org . eclipse . jdt . internal . compiler . util . Util . EMPTY_STRING ; } result [ count ++ ] = currentArgumentContents ; if ( count > length ) { return null ; } buffer . delete ( <NUM_LIT:0> , buffer . length ( ) ) ; } break ; default : buffer . append ( current ) ; } } String currentArgumentContents = String . valueOf ( buffer ) ; if ( EMPTY_ARGUMENT . equals ( currentArgumentContents ) ) { currentArgumentContents = org . eclipse . jdt . internal . compiler . util . Util . EMPTY_STRING ; } result [ count ++ ] = currentArgumentContents ; if ( count > length ) { return null ; } buffer . delete ( <NUM_LIT:0> , buffer . length ( ) ) ; return result ; } public static byte [ ] getResourceContentsAsByteArray ( IFile file ) throws JavaModelException { InputStream stream = null ; try { stream = file . getContents ( true ) ; } catch ( CoreException e ) { throw new JavaModelException ( e ) ; } try { return org . eclipse . jdt . internal . compiler . util . Util . getInputStreamAsByteArray ( stream , - <NUM_LIT:1> ) ; } catch ( IOException e ) { throw new JavaModelException ( e , IJavaModelStatusConstants . IO_EXCEPTION ) ; } finally { try { stream . close ( ) ; } catch ( IOException e ) { } } } public static char [ ] getResourceContentsAsCharArray ( IFile file ) throws JavaModelException { String encoding ; try { encoding = file . getCharset ( ) ; } catch ( CoreException ce ) { encoding = null ; } return getResourceContentsAsCharArray ( file , encoding ) ; } public static char [ ] getResourceContentsAsCharArray ( IFile file , String encoding ) throws JavaModelException { IPath location = file . getLocation ( ) ; long length ; if ( location == null ) { try { URI locationURI = file . getLocationURI ( ) ; if ( locationURI == null ) throw new CoreException ( new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , Messages . bind ( Messages . file_notFound , file . getFullPath ( ) . toString ( ) ) ) ) ; length = EFS . getStore ( locationURI ) . fetchInfo ( ) . getLength ( ) ; } catch ( CoreException e ) { throw new JavaModelException ( e , IJavaModelStatusConstants . ELEMENT_DOES_NOT_EXIST ) ; } } else { length = location . toFile ( ) . length ( ) ; } InputStream stream = null ; try { stream = file . getContents ( true ) ; } catch ( CoreException e ) { throw new JavaModelException ( e , IJavaModelStatusConstants . ELEMENT_DOES_NOT_EXIST ) ; } try { return org . eclipse . jdt . internal . compiler . util . Util . getInputStreamAsCharArray ( stream , ( int ) length , encoding ) ; } catch ( IOException e ) { throw new JavaModelException ( e , IJavaModelStatusConstants . IO_EXCEPTION ) ; } finally { try { stream . close ( ) ; } catch ( IOException e ) { } } } public static String getSignature ( Type type ) { StringBuffer buffer = new StringBuffer ( ) ; getFullyQualifiedName ( type , buffer ) ; return Signature . createTypeSignature ( buffer . toString ( ) , false ) ; } public static String getSourceAttachmentProperty ( IPath path ) throws JavaModelException { Map rootPathToAttachments = JavaModelManager . getJavaModelManager ( ) . rootPathToAttachments ; String property = ( String ) rootPathToAttachments . get ( path ) ; if ( property == null ) { try { property = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getPersistentProperty ( getSourceAttachmentPropertyName ( path ) ) ; if ( property == null ) { rootPathToAttachments . put ( path , PackageFragmentRoot . NO_SOURCE_ATTACHMENT ) ; return null ; } rootPathToAttachments . put ( path , property ) ; return property ; } catch ( CoreException e ) { throw new JavaModelException ( e ) ; } } else if ( property . equals ( PackageFragmentRoot . NO_SOURCE_ATTACHMENT ) ) { return null ; } else return property ; } private static QualifiedName getSourceAttachmentPropertyName ( IPath path ) { return new QualifiedName ( JavaCore . PLUGIN_ID , "<STR_LIT>" + path . toOSString ( ) ) ; } public static void setSourceAttachmentProperty ( IPath path , String property ) { if ( property == null ) { JavaModelManager . getJavaModelManager ( ) . rootPathToAttachments . put ( path , PackageFragmentRoot . NO_SOURCE_ATTACHMENT ) ; } else { JavaModelManager . getJavaModelManager ( ) . rootPathToAttachments . put ( path , property ) ; } try { ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . setPersistentProperty ( getSourceAttachmentPropertyName ( path ) , property ) ; } catch ( CoreException e ) { e . printStackTrace ( ) ; } } public static String getDeclaringTypeSignature ( String key ) { KeyToSignature keyToSignature = new KeyToSignature ( key , KeyToSignature . DECLARING_TYPE ) ; keyToSignature . parse ( ) ; return keyToSignature . signature . toString ( ) ; } private static void getFullyQualifiedName ( Type type , StringBuffer buffer ) { switch ( type . getNodeType ( ) ) { case ASTNode . ARRAY_TYPE : ArrayType arrayType = ( ArrayType ) type ; getFullyQualifiedName ( arrayType . getElementType ( ) , buffer ) ; for ( int i = <NUM_LIT:0> , length = arrayType . getDimensions ( ) ; i < length ; i ++ ) { buffer . append ( '<CHAR_LIT:[>' ) ; buffer . append ( '<CHAR_LIT:]>' ) ; } break ; case ASTNode . PARAMETERIZED_TYPE : ParameterizedType parameterizedType = ( ParameterizedType ) type ; getFullyQualifiedName ( parameterizedType . getType ( ) , buffer ) ; buffer . append ( '<CHAR_LIT>' ) ; Iterator iterator = parameterizedType . typeArguments ( ) . iterator ( ) ; boolean isFirst = true ; while ( iterator . hasNext ( ) ) { if ( ! isFirst ) buffer . append ( '<CHAR_LIT:U+002C>' ) ; else isFirst = false ; Type typeArgument = ( Type ) iterator . next ( ) ; getFullyQualifiedName ( typeArgument , buffer ) ; } buffer . append ( '<CHAR_LIT:>>' ) ; break ; case ASTNode . PRIMITIVE_TYPE : buffer . append ( ( ( PrimitiveType ) type ) . getPrimitiveTypeCode ( ) . toString ( ) ) ; break ; case ASTNode . QUALIFIED_TYPE : buffer . append ( ( ( QualifiedType ) type ) . getName ( ) . getFullyQualifiedName ( ) ) ; break ; case ASTNode . SIMPLE_TYPE : buffer . append ( ( ( SimpleType ) type ) . getName ( ) . getFullyQualifiedName ( ) ) ; break ; case ASTNode . WILDCARD_TYPE : buffer . append ( '<CHAR_LIT>' ) ; WildcardType wildcardType = ( WildcardType ) type ; Type bound = wildcardType . getBound ( ) ; if ( bound == null ) return ; if ( wildcardType . isUpperBound ( ) ) { buffer . append ( "<STR_LIT>" ) ; } else { buffer . append ( "<STR_LIT>" ) ; } getFullyQualifiedName ( bound , buffer ) ; break ; } } public static String [ ] getTrimmedSimpleNames ( String name ) { String [ ] result = Signature . getSimpleNames ( name ) ; for ( int i = <NUM_LIT:0> , length = result . length ; i < length ; i ++ ) { result [ i ] = result [ i ] . trim ( ) ; } return result ; } public static JavaElement getUnresolvedJavaElement ( FieldBinding binding , WorkingCopyOwner workingCopyOwner , BindingsToNodesMap bindingsToNodes ) { if ( binding . declaringClass == null ) return null ; JavaElement unresolvedJavaElement = getUnresolvedJavaElement ( binding . declaringClass , workingCopyOwner , bindingsToNodes ) ; if ( unresolvedJavaElement == null || unresolvedJavaElement . getElementType ( ) != IJavaElement . TYPE ) { return null ; } return ( JavaElement ) ( ( IType ) unresolvedJavaElement ) . getField ( String . valueOf ( binding . name ) ) ; } public static JavaElement getUnresolvedJavaElement ( int localSourceStart , int localSourceEnd , JavaElement type ) { try { if ( ! ( type instanceof IType ) ) return null ; IInitializer [ ] initializers = ( ( IType ) type ) . getInitializers ( ) ; for ( int i = <NUM_LIT:0> ; i < initializers . length ; i ++ ) { IInitializer initializer = initializers [ i ] ; ISourceRange sourceRange = initializer . getSourceRange ( ) ; if ( sourceRange != null ) { int initializerStart = sourceRange . getOffset ( ) ; int initializerEnd = initializerStart + sourceRange . getLength ( ) ; if ( initializerStart <= localSourceStart && localSourceEnd <= initializerEnd ) { return ( JavaElement ) initializer ; } } } return null ; } catch ( JavaModelException e ) { return null ; } } public static JavaElement getUnresolvedJavaElement ( MethodBinding methodBinding , WorkingCopyOwner workingCopyOwner , BindingsToNodesMap bindingsToNodes ) { JavaElement unresolvedJavaElement = getUnresolvedJavaElement ( methodBinding . declaringClass , workingCopyOwner , bindingsToNodes ) ; if ( unresolvedJavaElement == null || unresolvedJavaElement . getElementType ( ) != IJavaElement . TYPE ) { return null ; } IType declaringType = ( IType ) unresolvedJavaElement ; org . eclipse . jdt . internal . compiler . ast . ASTNode node = bindingsToNodes == null ? null : bindingsToNodes . get ( methodBinding ) ; if ( node != null && ! declaringType . isBinary ( ) ) { if ( node instanceof AnnotationMethodDeclaration ) { AnnotationMethodDeclaration typeMemberDeclaration = ( AnnotationMethodDeclaration ) node ; return ( JavaElement ) declaringType . getMethod ( String . valueOf ( typeMemberDeclaration . selector ) , CharOperation . NO_STRINGS ) ; } else { MethodDeclaration methodDeclaration = ( MethodDeclaration ) node ; Argument [ ] arguments = methodDeclaration . arguments ; String [ ] parameterSignatures ; if ( arguments != null ) { parameterSignatures = new String [ arguments . length ] ; for ( int i = <NUM_LIT:0> ; i < arguments . length ; i ++ ) { Argument argument = arguments [ i ] ; TypeReference typeReference = argument . type ; int arrayDim = typeReference . dimensions ( ) ; String typeSig = Signature . createTypeSignature ( CharOperation . concatWith ( typeReference . getTypeName ( ) , '<CHAR_LIT:.>' ) , false ) ; if ( arrayDim > <NUM_LIT:0> ) { typeSig = Signature . createArraySignature ( typeSig , arrayDim ) ; } parameterSignatures [ i ] = typeSig ; } } else { parameterSignatures = CharOperation . NO_STRINGS ; } return ( JavaElement ) declaringType . getMethod ( String . valueOf ( methodDeclaration . selector ) , parameterSignatures ) ; } } else { org . eclipse . jdt . internal . compiler . lookup . MethodBinding original = methodBinding . original ( ) ; String selector = original . isConstructor ( ) ? declaringType . getElementName ( ) : new String ( original . selector ) ; boolean isBinary = declaringType . isBinary ( ) ; ReferenceBinding enclosingType = original . declaringClass . enclosingType ( ) ; boolean isInnerBinaryTypeConstructor = isBinary && original . isConstructor ( ) && enclosingType != null ; TypeBinding [ ] parameters = original . parameters ; int length = parameters == null ? <NUM_LIT:0> : parameters . length ; int declaringIndex = isInnerBinaryTypeConstructor ? <NUM_LIT:1> : <NUM_LIT:0> ; String [ ] parameterSignatures = new String [ declaringIndex + length ] ; if ( isInnerBinaryTypeConstructor ) parameterSignatures [ <NUM_LIT:0> ] = new String ( enclosingType . genericTypeSignature ( ) ) . replace ( '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { char [ ] signature = parameters [ i ] . genericTypeSignature ( ) ; if ( isBinary ) { signature = CharOperation . replaceOnCopy ( signature , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; } else { signature = toUnresolvedTypeSignature ( signature ) ; } parameterSignatures [ declaringIndex + i ] = new String ( signature ) ; } IMethod result = declaringType . getMethod ( selector , parameterSignatures ) ; if ( isBinary ) return ( JavaElement ) result ; if ( result . exists ( ) ) return ( JavaElement ) result ; IMethod [ ] methods = null ; try { methods = declaringType . getMethods ( ) ; } catch ( JavaModelException e ) { return null ; } IMethod [ ] candidates = Member . findMethods ( result , methods ) ; if ( candidates == null || candidates . length == <NUM_LIT:0> ) return null ; return ( JavaElement ) candidates [ <NUM_LIT:0> ] ; } } public static JavaElement getUnresolvedJavaElement ( TypeBinding typeBinding , WorkingCopyOwner workingCopyOwner , BindingsToNodesMap bindingsToNodes ) { if ( typeBinding == null ) return null ; switch ( typeBinding . kind ( ) ) { case Binding . ARRAY_TYPE : typeBinding = ( ( org . eclipse . jdt . internal . compiler . lookup . ArrayBinding ) typeBinding ) . leafComponentType ( ) ; return getUnresolvedJavaElement ( typeBinding , workingCopyOwner , bindingsToNodes ) ; case Binding . BASE_TYPE : case Binding . WILDCARD_TYPE : case Binding . INTERSECTION_TYPE : return null ; default : if ( typeBinding . isCapture ( ) ) return null ; } ReferenceBinding referenceBinding ; if ( typeBinding . isParameterizedType ( ) || typeBinding . isRawType ( ) ) referenceBinding = ( ReferenceBinding ) typeBinding . erasure ( ) ; else referenceBinding = ( ReferenceBinding ) typeBinding ; char [ ] fileName = referenceBinding . getFileName ( ) ; if ( referenceBinding . isLocalType ( ) || referenceBinding . isAnonymousType ( ) ) { if ( org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( fileName ) ) { int jarSeparator = CharOperation . indexOf ( IDependent . JAR_FILE_ENTRY_SEPARATOR , fileName ) ; int pkgEnd = CharOperation . lastIndexOf ( '<CHAR_LIT:/>' , fileName ) ; if ( pkgEnd == - <NUM_LIT:1> ) pkgEnd = CharOperation . lastIndexOf ( File . separatorChar , fileName ) ; if ( jarSeparator != - <NUM_LIT:1> && pkgEnd < jarSeparator ) pkgEnd = jarSeparator ; if ( pkgEnd == - <NUM_LIT:1> ) return null ; IPackageFragment pkg = getPackageFragment ( fileName , pkgEnd , jarSeparator ) ; char [ ] constantPoolName = referenceBinding . constantPoolName ( ) ; if ( constantPoolName == null ) { ClassFile classFile = ( ClassFile ) getClassFile ( fileName ) ; return classFile == null ? null : ( JavaElement ) classFile . getType ( ) ; } pkgEnd = CharOperation . lastIndexOf ( '<CHAR_LIT:/>' , constantPoolName ) ; char [ ] classFileName = CharOperation . subarray ( constantPoolName , pkgEnd + <NUM_LIT:1> , constantPoolName . length ) ; ClassFile classFile = ( ClassFile ) pkg . getClassFile ( new String ( classFileName ) + SuffixConstants . SUFFIX_STRING_class ) ; return ( JavaElement ) classFile . getType ( ) ; } ICompilationUnit cu = getCompilationUnit ( fileName , workingCopyOwner ) ; if ( cu == null ) return null ; try { int sourceStart = ( ( org . eclipse . jdt . internal . compiler . lookup . LocalTypeBinding ) referenceBinding ) . sourceStart ; return ( JavaElement ) cu . getElementAt ( sourceStart ) ; } catch ( JavaModelException e ) { return null ; } } else if ( referenceBinding . isTypeVariable ( ) ) { final String typeVariableName = new String ( referenceBinding . sourceName ( ) ) ; org . eclipse . jdt . internal . compiler . lookup . Binding declaringElement = ( ( org . eclipse . jdt . internal . compiler . lookup . TypeVariableBinding ) referenceBinding ) . declaringElement ; if ( declaringElement instanceof MethodBinding ) { IMethod declaringMethod = ( IMethod ) getUnresolvedJavaElement ( ( MethodBinding ) declaringElement , workingCopyOwner , bindingsToNodes ) ; return ( JavaElement ) declaringMethod . getTypeParameter ( typeVariableName ) ; } else { IType declaringType = ( IType ) getUnresolvedJavaElement ( ( TypeBinding ) declaringElement , workingCopyOwner , bindingsToNodes ) ; return ( JavaElement ) declaringType . getTypeParameter ( typeVariableName ) ; } } else { if ( fileName == null ) return null ; TypeBinding declaringTypeBinding = typeBinding . enclosingType ( ) ; if ( declaringTypeBinding == null ) { if ( org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( fileName ) ) { ClassFile classFile = ( ClassFile ) getClassFile ( fileName ) ; if ( classFile == null ) return null ; return ( JavaElement ) classFile . getType ( ) ; } ICompilationUnit cu = getCompilationUnit ( fileName , workingCopyOwner ) ; if ( cu == null ) return null ; return ( JavaElement ) cu . getType ( new String ( referenceBinding . sourceName ( ) ) ) ; } else { IType declaringType = ( IType ) getUnresolvedJavaElement ( declaringTypeBinding , workingCopyOwner , bindingsToNodes ) ; if ( declaringType == null ) return null ; return ( JavaElement ) declaringType . getType ( new String ( referenceBinding . sourceName ( ) ) ) ; } } } public static int indexOfEnclosingPath ( IPath checkedPath , IPath [ ] paths , int pathCount ) { int bestMatch = - <NUM_LIT:1> , bestLength = - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < pathCount ; i ++ ) { if ( paths [ i ] . equals ( checkedPath ) ) continue ; if ( paths [ i ] . isPrefixOf ( checkedPath ) ) { int currentLength = paths [ i ] . segmentCount ( ) ; if ( currentLength > bestLength ) { bestLength = currentLength ; bestMatch = i ; } } } return bestMatch ; } public static int indexOfJavaLikeExtension ( String fileName ) { int fileNameLength = fileName . length ( ) ; char [ ] [ ] javaLikeExtensions = getJavaLikeExtensions ( ) ; extensions : for ( int i = <NUM_LIT:0> , length = javaLikeExtensions . length ; i < length ; i ++ ) { char [ ] extension = javaLikeExtensions [ i ] ; int extensionLength = extension . length ; int extensionStart = fileNameLength - extensionLength ; int dotIndex = extensionStart - <NUM_LIT:1> ; if ( dotIndex < <NUM_LIT:0> ) continue ; if ( fileName . charAt ( dotIndex ) != '<CHAR_LIT:.>' ) continue ; for ( int j = <NUM_LIT:0> ; j < extensionLength ; j ++ ) { if ( fileName . charAt ( extensionStart + j ) != extension [ j ] ) continue extensions ; } return dotIndex ; } return - <NUM_LIT:1> ; } public static int indexOfMatchingPath ( IPath checkedPath , IPath [ ] paths , int pathCount ) { for ( int i = <NUM_LIT:0> ; i < pathCount ; i ++ ) { if ( paths [ i ] . equals ( checkedPath ) ) return i ; } return - <NUM_LIT:1> ; } public static int indexOfNestedPath ( IPath checkedPath , IPath [ ] paths , int pathCount ) { for ( int i = <NUM_LIT:0> ; i < pathCount ; i ++ ) { if ( checkedPath . equals ( paths [ i ] ) ) continue ; if ( checkedPath . isPrefixOf ( paths [ i ] ) ) return i ; } return - <NUM_LIT:1> ; } protected static boolean isAttributeSupported ( int attribute ) { return ( EFS . getLocalFileSystem ( ) . attributes ( ) & attribute ) != <NUM_LIT:0> ; } public static boolean isReadOnly ( IResource resource ) { if ( isReadOnlySupported ( ) ) { ResourceAttributes resourceAttributes = resource . getResourceAttributes ( ) ; if ( resourceAttributes == null ) return false ; return resourceAttributes . isReadOnly ( ) ; } return false ; } public static boolean isReadOnlySupported ( ) { return isAttributeSupported ( EFS . ATTRIBUTE_READ_ONLY ) ; } public static final boolean isExcluded ( IJavaElement element ) { int elementType = element . getElementType ( ) ; switch ( elementType ) { case IJavaElement . JAVA_MODEL : case IJavaElement . JAVA_PROJECT : case IJavaElement . PACKAGE_FRAGMENT_ROOT : return false ; case IJavaElement . PACKAGE_FRAGMENT : PackageFragmentRoot root = ( PackageFragmentRoot ) element . getAncestor ( IJavaElement . PACKAGE_FRAGMENT_ROOT ) ; IResource resource = ( ( PackageFragment ) element ) . resource ( ) ; return resource != null && isExcluded ( resource , root . fullInclusionPatternChars ( ) , root . fullExclusionPatternChars ( ) ) ; case IJavaElement . COMPILATION_UNIT : root = ( PackageFragmentRoot ) element . getAncestor ( IJavaElement . PACKAGE_FRAGMENT_ROOT ) ; resource = element . getResource ( ) ; if ( resource == null ) return false ; if ( isExcluded ( resource , root . fullInclusionPatternChars ( ) , root . fullExclusionPatternChars ( ) ) ) return true ; return isExcluded ( element . getParent ( ) ) ; default : IJavaElement cu = element . getAncestor ( IJavaElement . COMPILATION_UNIT ) ; return cu != null && isExcluded ( cu ) ; } } public final static boolean isExcluded ( IPath resourcePath , char [ ] [ ] inclusionPatterns , char [ ] [ ] exclusionPatterns , boolean isFolderPath ) { if ( inclusionPatterns == null && exclusionPatterns == null ) return false ; return org . eclipse . jdt . internal . compiler . util . Util . isExcluded ( resourcePath . toString ( ) . toCharArray ( ) , inclusionPatterns , exclusionPatterns , isFolderPath ) ; } public final static boolean isExcluded ( IResource resource , char [ ] [ ] inclusionPatterns , char [ ] [ ] exclusionPatterns ) { IPath path = resource . getFullPath ( ) ; int resourceType = resource . getType ( ) ; return isExcluded ( path , inclusionPatterns , exclusionPatterns , resourceType == IResource . FOLDER || resourceType == IResource . PROJECT ) ; } public static boolean isValidClassFileName ( String name , String sourceLevel , String complianceLevel ) { return JavaConventions . validateClassFileName ( name , sourceLevel , complianceLevel ) . getSeverity ( ) != IStatus . ERROR ; } public static boolean isValidCompilationUnitName ( String name , String sourceLevel , String complianceLevel ) { return JavaConventions . validateCompilationUnitName ( name , sourceLevel , complianceLevel ) . getSeverity ( ) != IStatus . ERROR ; } public static boolean isValidFolderNameForPackage ( String folderName , String sourceLevel , String complianceLevel ) { return JavaConventions . validateIdentifier ( folderName , sourceLevel , complianceLevel ) . getSeverity ( ) != IStatus . ERROR ; } public static boolean isValidMethodSignature ( String sig ) { int len = sig . length ( ) ; if ( len == <NUM_LIT:0> ) return false ; int i = <NUM_LIT:0> ; char c = sig . charAt ( i ++ ) ; if ( c != '<CHAR_LIT:(>' ) return false ; if ( i >= len ) return false ; while ( sig . charAt ( i ) != '<CHAR_LIT:)>' ) { i = checkTypeSignature ( sig , i , len , false ) ; if ( i == - <NUM_LIT:1> ) return false ; if ( i >= len ) return false ; } ++ i ; i = checkTypeSignature ( sig , i , len , true ) ; return i == len ; } public static boolean isValidTypeSignature ( String sig , boolean allowVoid ) { int len = sig . length ( ) ; return checkTypeSignature ( sig , <NUM_LIT:0> , len , allowVoid ) == len ; } public static String localTypeName ( String binaryTypeName , int lastDollar , int end ) { if ( lastDollar > <NUM_LIT:0> && binaryTypeName . charAt ( lastDollar - <NUM_LIT:1> ) == '<CHAR_LIT>' ) return binaryTypeName ; int nameStart = lastDollar + <NUM_LIT:1> ; while ( nameStart < end && Character . isDigit ( binaryTypeName . charAt ( nameStart ) ) ) nameStart ++ ; return binaryTypeName . substring ( nameStart , end ) ; } public static void log ( Throwable e , String message ) { Throwable nestedException ; if ( e instanceof JavaModelException && ( nestedException = ( ( JavaModelException ) e ) . getException ( ) ) != null ) { e = nestedException ; } log ( new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , IStatus . ERROR , message , e ) ) ; } public static void logRepeatedMessage ( String key , Exception e ) { if ( key == null ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } if ( fgRepeatedMessages . contains ( key ) ) { return ; } fgRepeatedMessages . add ( key ) ; log ( e ) ; } public static void logRepeatedMessage ( String key , int statusErrorID , String message ) { if ( key == null ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } if ( fgRepeatedMessages . contains ( key ) ) { return ; } fgRepeatedMessages . add ( key ) ; log ( statusErrorID , message ) ; } public static void log ( int statusErrorID , String message ) { log ( new Status ( statusErrorID , JavaCore . PLUGIN_ID , message ) ) ; } public static void log ( IStatus status ) { JavaCore . getPlugin ( ) . getLog ( ) . log ( status ) ; } public static void log ( Throwable e ) { log ( new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , Messages . code_assist_internal_error , e ) ) ; } public static ClassFileReader newClassFileReader ( IResource resource ) throws CoreException , ClassFormatException , IOException { InputStream in = null ; try { in = ( ( IFile ) resource ) . getContents ( true ) ; return ClassFileReader . read ( in , resource . getFullPath ( ) . toString ( ) ) ; } finally { if ( in != null ) in . close ( ) ; } } public static char [ ] normalizeCRs ( char [ ] text , char [ ] buffer ) { CharArrayBuffer result = new CharArrayBuffer ( ) ; int lineStart = <NUM_LIT:0> ; int length = text . length ; if ( length == <NUM_LIT:0> ) return text ; String lineSeparator = getLineSeparator ( text , buffer ) ; char nextChar = text [ <NUM_LIT:0> ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { char currentChar = nextChar ; nextChar = i < length - <NUM_LIT:1> ? text [ i + <NUM_LIT:1> ] : '<CHAR_LIT:U+0020>' ; switch ( currentChar ) { case '<STR_LIT:\n>' : int lineLength = i - lineStart ; char [ ] line = new char [ lineLength ] ; System . arraycopy ( text , lineStart , line , <NUM_LIT:0> , lineLength ) ; result . append ( line ) ; result . append ( lineSeparator ) ; lineStart = i + <NUM_LIT:1> ; break ; case '<STR_LIT>' : lineLength = i - lineStart ; if ( lineLength >= <NUM_LIT:0> ) { line = new char [ lineLength ] ; System . arraycopy ( text , lineStart , line , <NUM_LIT:0> , lineLength ) ; result . append ( line ) ; result . append ( lineSeparator ) ; if ( nextChar == '<STR_LIT:\n>' ) { nextChar = '<CHAR_LIT:U+0020>' ; lineStart = i + <NUM_LIT:2> ; } else { lineStart = i + <NUM_LIT:1> ; } } else { lineStart = i + <NUM_LIT:1> ; } break ; } } char [ ] lastLine ; if ( lineStart > <NUM_LIT:0> ) { int lastLineLength = length - lineStart ; if ( lastLineLength > <NUM_LIT:0> ) { lastLine = new char [ lastLineLength ] ; System . arraycopy ( text , lineStart , lastLine , <NUM_LIT:0> , lastLineLength ) ; result . append ( lastLine ) ; } return result . getContents ( ) ; } return text ; } public static String normalizeCRs ( String text , String buffer ) { return new String ( normalizeCRs ( text . toCharArray ( ) , buffer . toCharArray ( ) ) ) ; } public static String packageName ( IPath pkgPath , String sourceLevel , String complianceLevel ) { StringBuffer pkgName = new StringBuffer ( IPackageFragment . DEFAULT_PACKAGE_NAME ) ; for ( int j = <NUM_LIT:0> , max = pkgPath . segmentCount ( ) ; j < max ; j ++ ) { String segment = pkgPath . segment ( j ) ; if ( ! isValidFolderNameForPackage ( segment , sourceLevel , complianceLevel ) ) { return null ; } pkgName . append ( segment ) ; if ( j < pkgPath . segmentCount ( ) - <NUM_LIT:1> ) { pkgName . append ( "<STR_LIT:.>" ) ; } } return pkgName . toString ( ) ; } public static int prefixLength ( char [ ] s1 , char [ ] s2 ) { int len = <NUM_LIT:0> ; int max = Math . min ( s1 . length , s2 . length ) ; for ( int i = <NUM_LIT:0> ; i < max && s1 [ i ] == s2 [ i ] ; ++ i ) ++ len ; return len ; } public static int prefixLength ( String s1 , String s2 ) { int len = <NUM_LIT:0> ; int max = Math . min ( s1 . length ( ) , s2 . length ( ) ) ; for ( int i = <NUM_LIT:0> ; i < max && s1 . charAt ( i ) == s2 . charAt ( i ) ; ++ i ) ++ len ; return len ; } private static void quickSort ( char [ ] [ ] list , int left , int right ) { int original_left = left ; int original_right = right ; char [ ] mid = list [ left + ( right - left ) / <NUM_LIT:2> ] ; do { while ( compare ( list [ left ] , mid ) < <NUM_LIT:0> ) { left ++ ; } while ( compare ( mid , list [ right ] ) < <NUM_LIT:0> ) { right -- ; } if ( left <= right ) { char [ ] tmp = list [ left ] ; list [ left ] = list [ right ] ; list [ right ] = tmp ; left ++ ; right -- ; } } while ( left <= right ) ; if ( original_left < right ) { quickSort ( list , original_left , right ) ; } if ( left < original_right ) { quickSort ( list , left , original_right ) ; } } private static void quickSort ( Comparable [ ] sortedCollection , int left , int right ) { int original_left = left ; int original_right = right ; Comparable mid = sortedCollection [ left + ( right - left ) / <NUM_LIT:2> ] ; do { while ( sortedCollection [ left ] . compareTo ( mid ) < <NUM_LIT:0> ) { left ++ ; } while ( mid . compareTo ( sortedCollection [ right ] ) < <NUM_LIT:0> ) { right -- ; } if ( left <= right ) { Comparable tmp = sortedCollection [ left ] ; sortedCollection [ left ] = sortedCollection [ right ] ; sortedCollection [ right ] = tmp ; left ++ ; right -- ; } } while ( left <= right ) ; if ( original_left < right ) { quickSort ( sortedCollection , original_left , right ) ; } if ( left < original_right ) { quickSort ( sortedCollection , left , original_right ) ; } } private static void quickSort ( int [ ] list , int left , int right ) { int original_left = left ; int original_right = right ; int mid = list [ left + ( right - left ) / <NUM_LIT:2> ] ; do { while ( list [ left ] < mid ) { left ++ ; } while ( mid < list [ right ] ) { right -- ; } if ( left <= right ) { int tmp = list [ left ] ; list [ left ] = list [ right ] ; list [ right ] = tmp ; left ++ ; right -- ; } } while ( left <= right ) ; if ( original_left < right ) { quickSort ( list , original_left , right ) ; } if ( left < original_right ) { quickSort ( list , left , original_right ) ; } } private static void quickSort ( Object [ ] sortedCollection , int left , int right , Comparer comparer ) { int original_left = left ; int original_right = right ; Object mid = sortedCollection [ left + ( right - left ) / <NUM_LIT:2> ] ; do { while ( comparer . compare ( sortedCollection [ left ] , mid ) < <NUM_LIT:0> ) { left ++ ; } while ( comparer . compare ( mid , sortedCollection [ right ] ) < <NUM_LIT:0> ) { right -- ; } if ( left <= right ) { Object tmp = sortedCollection [ left ] ; sortedCollection [ left ] = sortedCollection [ right ] ; sortedCollection [ right ] = tmp ; left ++ ; right -- ; } } while ( left <= right ) ; if ( original_left < right ) { quickSort ( sortedCollection , original_left , right , comparer ) ; } if ( left < original_right ) { quickSort ( sortedCollection , left , original_right , comparer ) ; } } private static void quickSort ( String [ ] sortedCollection , int left , int right ) { int original_left = left ; int original_right = right ; String mid = sortedCollection [ left + ( right - left ) / <NUM_LIT:2> ] ; do { while ( sortedCollection [ left ] . compareTo ( mid ) < <NUM_LIT:0> ) { left ++ ; } while ( mid . compareTo ( sortedCollection [ right ] ) < <NUM_LIT:0> ) { right -- ; } if ( left <= right ) { String tmp = sortedCollection [ left ] ; sortedCollection [ left ] = sortedCollection [ right ] ; sortedCollection [ right ] = tmp ; left ++ ; right -- ; } } while ( left <= right ) ; if ( original_left < right ) { quickSort ( sortedCollection , original_left , right ) ; } if ( left < original_right ) { quickSort ( sortedCollection , left , original_right ) ; } } public static String relativePath ( IPath fullPath , int skipSegmentCount ) { boolean hasTrailingSeparator = fullPath . hasTrailingSeparator ( ) ; String [ ] segments = fullPath . segments ( ) ; int length = <NUM_LIT:0> ; int max = segments . length ; if ( max > skipSegmentCount ) { for ( int i1 = skipSegmentCount ; i1 < max ; i1 ++ ) { length += segments [ i1 ] . length ( ) ; } length += max - skipSegmentCount - <NUM_LIT:1> ; } if ( hasTrailingSeparator ) length ++ ; char [ ] result = new char [ length ] ; int offset = <NUM_LIT:0> ; int len = segments . length - <NUM_LIT:1> ; if ( len >= skipSegmentCount ) { for ( int i = skipSegmentCount ; i < len ; i ++ ) { int size = segments [ i ] . length ( ) ; segments [ i ] . getChars ( <NUM_LIT:0> , size , result , offset ) ; offset += size ; result [ offset ++ ] = '<CHAR_LIT:/>' ; } int size = segments [ len ] . length ( ) ; segments [ len ] . getChars ( <NUM_LIT:0> , size , result , offset ) ; offset += size ; } if ( hasTrailingSeparator ) result [ offset ++ ] = '<CHAR_LIT:/>' ; return new String ( result ) ; } public static void resetJavaLikeExtensions ( ) { JAVA_LIKE_EXTENSIONS = null ; } public static final String [ ] splitOn ( char divider , String string , int start , int end ) { int length = string == null ? <NUM_LIT:0> : string . length ( ) ; if ( length == <NUM_LIT:0> || start > end ) return CharOperation . NO_STRINGS ; int wordCount = <NUM_LIT:1> ; for ( int i = start ; i < end ; i ++ ) if ( string . charAt ( i ) == divider ) wordCount ++ ; String [ ] split = new String [ wordCount ] ; int last = start , currentWord = <NUM_LIT:0> ; for ( int i = start ; i < end ; i ++ ) { if ( string . charAt ( i ) == divider ) { split [ currentWord ++ ] = string . substring ( last , i ) ; last = i + <NUM_LIT:1> ; } } split [ currentWord ] = string . substring ( last , end ) ; return split ; } public static void setReadOnly ( IResource resource , boolean readOnly ) { if ( isReadOnlySupported ( ) ) { ResourceAttributes resourceAttributes = resource . getResourceAttributes ( ) ; if ( resourceAttributes == null ) return ; resourceAttributes . setReadOnly ( readOnly ) ; try { resource . setResourceAttributes ( resourceAttributes ) ; } catch ( CoreException e ) { } } } public static void sort ( char [ ] [ ] list ) { if ( list . length > <NUM_LIT:1> ) quickSort ( list , <NUM_LIT:0> , list . length - <NUM_LIT:1> ) ; } public static void sort ( Comparable [ ] objects ) { if ( objects . length > <NUM_LIT:1> ) quickSort ( objects , <NUM_LIT:0> , objects . length - <NUM_LIT:1> ) ; } public static void sort ( int [ ] list ) { if ( list . length > <NUM_LIT:1> ) quickSort ( list , <NUM_LIT:0> , list . length - <NUM_LIT:1> ) ; } public static void sort ( Object [ ] objects , Comparer comparer ) { if ( objects . length > <NUM_LIT:1> ) quickSort ( objects , <NUM_LIT:0> , objects . length - <NUM_LIT:1> , comparer ) ; } public static void sort ( String [ ] strings ) { if ( strings . length > <NUM_LIT:1> ) quickSort ( strings , <NUM_LIT:0> , strings . length - <NUM_LIT:1> ) ; } public static Comparable [ ] sortCopy ( Comparable [ ] objects ) { int len = objects . length ; Comparable [ ] copy = new Comparable [ len ] ; System . arraycopy ( objects , <NUM_LIT:0> , copy , <NUM_LIT:0> , len ) ; sort ( copy ) ; return copy ; } public static IJavaElement [ ] sortCopy ( IJavaElement [ ] elements ) { int len = elements . length ; IJavaElement [ ] copy = new IJavaElement [ len ] ; System . arraycopy ( elements , <NUM_LIT:0> , copy , <NUM_LIT:0> , len ) ; sort ( copy , new Comparer ( ) { public int compare ( Object a , Object b ) { return ( ( JavaElement ) a ) . toStringWithAncestors ( ) . compareTo ( ( ( JavaElement ) b ) . toStringWithAncestors ( ) ) ; } } ) ; return copy ; } public static Object [ ] sortCopy ( Object [ ] objects , Comparer comparer ) { int len = objects . length ; Object [ ] copy = new Object [ len ] ; System . arraycopy ( objects , <NUM_LIT:0> , copy , <NUM_LIT:0> , len ) ; sort ( copy , comparer ) ; return copy ; } public static String [ ] sortCopy ( String [ ] objects ) { int len = objects . length ; String [ ] copy = new String [ len ] ; System . arraycopy ( objects , <NUM_LIT:0> , copy , <NUM_LIT:0> , len ) ; sort ( copy ) ; return copy ; } public static boolean startsWithIgnoreCase ( String [ ] compoundName , String [ ] prefix , boolean partialMatch ) { int prefixLength = prefix . length ; int nameLength = compoundName . length ; if ( prefixLength > nameLength ) return false ; for ( int i = <NUM_LIT:0> ; i < prefixLength - <NUM_LIT:1> ; i ++ ) { if ( ! compoundName [ i ] . equalsIgnoreCase ( prefix [ i ] ) ) return false ; } return ( partialMatch || prefixLength == nameLength ) && compoundName [ prefixLength - <NUM_LIT:1> ] . toLowerCase ( ) . startsWith ( prefix [ prefixLength - <NUM_LIT:1> ] . toLowerCase ( ) ) ; } public static char [ ] [ ] toCharArrays ( String [ ] a ) { int len = a . length ; if ( len == <NUM_LIT:0> ) return CharOperation . NO_CHAR_CHAR ; char [ ] [ ] result = new char [ len ] [ ] ; for ( int i = <NUM_LIT:0> ; i < len ; ++ i ) { result [ i ] = a [ i ] . toCharArray ( ) ; } return result ; } public static char [ ] [ ] toCompoundChars ( String s ) { int len = s . length ( ) ; if ( len == <NUM_LIT:0> ) { return CharOperation . NO_CHAR_CHAR ; } int segCount = <NUM_LIT:1> ; for ( int off = s . indexOf ( '<CHAR_LIT:.>' ) ; off != - <NUM_LIT:1> ; off = s . indexOf ( '<CHAR_LIT:.>' , off + <NUM_LIT:1> ) ) { ++ segCount ; } char [ ] [ ] segs = new char [ segCount ] [ ] ; int start = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < segCount ; ++ i ) { int dot = s . indexOf ( '<CHAR_LIT:.>' , start ) ; int end = ( dot == - <NUM_LIT:1> ? s . length ( ) : dot ) ; segs [ i ] = new char [ end - start ] ; s . getChars ( start , end , segs [ i ] , <NUM_LIT:0> ) ; start = end + <NUM_LIT:1> ; } return segs ; } public static File toLocalFile ( URI uri , IProgressMonitor monitor ) throws CoreException { IFileStore fileStore = EFS . getStore ( uri ) ; File localFile = fileStore . toLocalFile ( EFS . NONE , monitor ) ; if ( localFile == null ) localFile = fileStore . toLocalFile ( EFS . CACHE , monitor ) ; return localFile ; } public static String toString ( char [ ] [ ] c ) { StringBuffer sb = new StringBuffer ( ) ; for ( int i = <NUM_LIT:0> , max = c . length ; i < max ; ++ i ) { if ( i != <NUM_LIT:0> ) sb . append ( '<CHAR_LIT:.>' ) ; sb . append ( c [ i ] ) ; } return sb . toString ( ) ; } public static String toString ( char [ ] [ ] c , char [ ] d ) { if ( c == null ) return new String ( d ) ; StringBuffer sb = new StringBuffer ( ) ; for ( int i = <NUM_LIT:0> , max = c . length ; i < max ; ++ i ) { sb . append ( c [ i ] ) ; sb . append ( '<CHAR_LIT:.>' ) ; } sb . append ( d ) ; return sb . toString ( ) ; } public static String [ ] toStrings ( char [ ] [ ] a ) { int len = a . length ; String [ ] result = new String [ len ] ; for ( int i = <NUM_LIT:0> ; i < len ; ++ i ) { result [ i ] = new String ( a [ i ] ) ; } return result ; } private static char [ ] toUnresolvedTypeSignature ( char [ ] signature ) { int length = signature . length ; if ( length <= <NUM_LIT:1> ) return signature ; StringBuffer buffer = new StringBuffer ( length ) ; toUnresolvedTypeSignature ( signature , <NUM_LIT:0> , length , buffer ) ; int bufferLength = buffer . length ( ) ; char [ ] result = new char [ bufferLength ] ; buffer . getChars ( <NUM_LIT:0> , bufferLength , result , <NUM_LIT:0> ) ; return result ; } private static int toUnresolvedTypeSignature ( char [ ] signature , int start , int length , StringBuffer buffer ) { if ( signature [ start ] == Signature . C_RESOLVED ) buffer . append ( Signature . C_UNRESOLVED ) ; else buffer . append ( signature [ start ] ) ; for ( int i = start + <NUM_LIT:1> ; i < length ; i ++ ) { char c = signature [ i ] ; switch ( c ) { case '<CHAR_LIT:/>' : case Signature . C_DOLLAR : buffer . append ( Signature . C_DOT ) ; break ; case Signature . C_GENERIC_START : buffer . append ( Signature . C_GENERIC_START ) ; i = toUnresolvedTypeSignature ( signature , i + <NUM_LIT:1> , length , buffer ) ; break ; case Signature . C_GENERIC_END : buffer . append ( Signature . C_GENERIC_END ) ; return i ; default : buffer . append ( c ) ; break ; } } return length ; } private static void appendArrayTypeSignature ( char [ ] string , int start , StringBuffer buffer , boolean compact ) { int length = string . length ; if ( start >= length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != Signature . C_ARRAY ) { throw new IllegalArgumentException ( ) ; } int index = start ; c = string [ ++ index ] ; while ( c == Signature . C_ARRAY ) { if ( index >= length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } c = string [ ++ index ] ; } appendTypeSignature ( string , index , buffer , compact ) ; for ( int i = <NUM_LIT:0> , dims = index - start ; i < dims ; i ++ ) { buffer . append ( '<CHAR_LIT:[>' ) . append ( '<CHAR_LIT:]>' ) ; } } private static void appendClassTypeSignature ( char [ ] string , int start , StringBuffer buffer , boolean compact ) { char c = string [ start ] ; if ( c != Signature . C_RESOLVED ) { return ; } int p = start + <NUM_LIT:1> ; int checkpoint = buffer . length ( ) ; while ( true ) { c = string [ p ] ; switch ( c ) { case Signature . C_SEMICOLON : return ; case Signature . C_DOT : case '<CHAR_LIT:/>' : if ( compact ) { buffer . setLength ( checkpoint ) ; } else { buffer . append ( '<CHAR_LIT:.>' ) ; } break ; case Signature . C_DOLLAR : buffer . append ( '<CHAR_LIT:.>' ) ; break ; default : buffer . append ( c ) ; } p ++ ; } } static void appendTypeSignature ( char [ ] string , int start , StringBuffer buffer , boolean compact ) { char c = string [ start ] ; switch ( c ) { case Signature . C_ARRAY : appendArrayTypeSignature ( string , start , buffer , compact ) ; break ; case Signature . C_RESOLVED : appendClassTypeSignature ( string , start , buffer , compact ) ; break ; case Signature . C_TYPE_VARIABLE : int e = Util . scanTypeVariableSignature ( string , start ) ; buffer . append ( string , start + <NUM_LIT:1> , e - start - <NUM_LIT:1> ) ; break ; case Signature . C_BOOLEAN : buffer . append ( BOOLEAN ) ; break ; case Signature . C_BYTE : buffer . append ( BYTE ) ; break ; case Signature . C_CHAR : buffer . append ( CHAR ) ; break ; case Signature . C_DOUBLE : buffer . append ( DOUBLE ) ; break ; case Signature . C_FLOAT : buffer . append ( FLOAT ) ; break ; case Signature . C_INT : buffer . append ( INT ) ; break ; case Signature . C_LONG : buffer . append ( LONG ) ; break ; case Signature . C_SHORT : buffer . append ( SHORT ) ; break ; case Signature . C_VOID : buffer . append ( VOID ) ; break ; } } public static String toString ( char [ ] declaringClass , char [ ] methodName , char [ ] methodSignature , boolean includeReturnType , boolean compact ) { final boolean isConstructor = CharOperation . equals ( methodName , INIT ) ; int firstParen = CharOperation . indexOf ( Signature . C_PARAM_START , methodSignature ) ; if ( firstParen == - <NUM_LIT:1> ) { return "<STR_LIT>" ; } StringBuffer buffer = new StringBuffer ( methodSignature . length + <NUM_LIT:10> ) ; if ( declaringClass != null && declaringClass . length > <NUM_LIT:0> ) { char [ ] declaringClassSignature = null ; if ( declaringClass [ <NUM_LIT:0> ] == Signature . C_ARRAY ) { CharOperation . replace ( declaringClass , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; declaringClassSignature = Signature . toCharArray ( declaringClass ) ; } else { CharOperation . replace ( declaringClass , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; declaringClassSignature = declaringClass ; } int lastIndexOfSlash = CharOperation . lastIndexOf ( '<CHAR_LIT:.>' , declaringClassSignature ) ; if ( compact && lastIndexOfSlash != - <NUM_LIT:1> ) { buffer . append ( declaringClassSignature , lastIndexOfSlash + <NUM_LIT:1> , declaringClassSignature . length - lastIndexOfSlash - <NUM_LIT:1> ) ; } else { buffer . append ( declaringClassSignature ) ; } if ( ! isConstructor ) { buffer . append ( '<CHAR_LIT:.>' ) ; } } if ( ! isConstructor && methodName != null ) { buffer . append ( methodName ) ; } buffer . append ( '<CHAR_LIT:(>' ) ; char [ ] [ ] pts = Signature . getParameterTypes ( methodSignature ) ; for ( int i = <NUM_LIT:0> , max = pts . length ; i < max ; i ++ ) { appendTypeSignature ( pts [ i ] , <NUM_LIT:0> , buffer , compact ) ; if ( i != pts . length - <NUM_LIT:1> ) { buffer . append ( '<CHAR_LIT:U+002C>' ) ; buffer . append ( '<CHAR_LIT:U+0020>' ) ; } } buffer . append ( '<CHAR_LIT:)>' ) ; if ( ! isConstructor ) { buffer . append ( "<STR_LIT:U+0020:U+0020>" ) ; if ( includeReturnType ) { char [ ] rts = Signature . getReturnType ( methodSignature ) ; appendTypeSignature ( rts , <NUM_LIT:0> , buffer , compact ) ; } } return String . valueOf ( buffer ) ; } public static String [ ] typeParameterSignatures ( AbstractMethodDeclaration method ) { Argument [ ] args = method . arguments ; if ( args != null ) { int length = args . length ; String [ ] signatures = new String [ length ] ; for ( int i = <NUM_LIT:0> ; i < args . length ; i ++ ) { Argument arg = args [ i ] ; signatures [ i ] = typeSignature ( arg . type ) ; } return signatures ; } return CharOperation . NO_STRINGS ; } public static String typeSignature ( TypeReference type ) { char [ ] [ ] compoundName = type . getParameterizedTypeName ( ) ; char [ ] typeName = CharOperation . concatWith ( compoundName , '<CHAR_LIT:.>' ) ; String signature = Signature . createTypeSignature ( typeName , false ) ; return signature ; } public static void validateMethodSignature ( String sig ) { Assert . isTrue ( isValidMethodSignature ( sig ) ) ; } public static void validateTypeSignature ( String sig , boolean allowVoid ) { Assert . isTrue ( isValidTypeSignature ( sig , allowVoid ) ) ; } public static void verbose ( String log ) { verbose ( log , System . out ) ; } public static synchronized void verbose ( String log , PrintStream printStream ) { int start = <NUM_LIT:0> ; do { int end = log . indexOf ( '<STR_LIT:\n>' , start ) ; printStream . print ( Thread . currentThread ( ) ) ; printStream . print ( "<STR_LIT:U+0020>" ) ; printStream . print ( log . substring ( start , end == - <NUM_LIT:1> ? log . length ( ) : end + <NUM_LIT:1> ) ) ; start = end + <NUM_LIT:1> ; } while ( start != <NUM_LIT:0> ) ; printStream . println ( ) ; } public final static boolean isJavaLikeFileName ( String name ) { if ( name == null ) return false ; return indexOfJavaLikeExtension ( name ) != - <NUM_LIT:1> ; } public final static boolean isJavaLikeFileName ( char [ ] fileName ) { if ( fileName == null ) return false ; int fileNameLength = fileName . length ; char [ ] [ ] javaLikeExtensions = getJavaLikeExtensions ( ) ; extensions : for ( int i = <NUM_LIT:0> , length = javaLikeExtensions . length ; i < length ; i ++ ) { char [ ] extension = javaLikeExtensions [ i ] ; int extensionLength = extension . length ; int extensionStart = fileNameLength - extensionLength ; if ( extensionStart - <NUM_LIT:1> < <NUM_LIT:0> ) continue ; if ( fileName [ extensionStart - <NUM_LIT:1> ] != '<CHAR_LIT:.>' ) continue ; for ( int j = <NUM_LIT:0> ; j < extensionLength ; j ++ ) { if ( fileName [ extensionStart + j ] != extension [ j ] ) continue extensions ; } return true ; } return false ; } public static int scanTypeSignature ( char [ ] string , int start ) { if ( start >= string . length ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; switch ( c ) { case Signature . C_ARRAY : return scanArrayTypeSignature ( string , start ) ; case Signature . C_RESOLVED : case Signature . C_UNRESOLVED : return scanClassTypeSignature ( string , start ) ; case Signature . C_TYPE_VARIABLE : return scanTypeVariableSignature ( string , start ) ; case Signature . C_BOOLEAN : case Signature . C_BYTE : case Signature . C_CHAR : case Signature . C_DOUBLE : case Signature . C_FLOAT : case Signature . C_INT : case Signature . C_LONG : case Signature . C_SHORT : case Signature . C_VOID : return scanBaseTypeSignature ( string , start ) ; case Signature . C_CAPTURE : return scanCaptureTypeSignature ( string , start ) ; case Signature . C_EXTENDS : case Signature . C_SUPER : case Signature . C_STAR : return scanTypeBoundSignature ( string , start ) ; default : throw new IllegalArgumentException ( ) ; } } public static int scanBaseTypeSignature ( char [ ] string , int start ) { if ( start >= string . length ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( "<STR_LIT>" . indexOf ( c ) >= <NUM_LIT:0> ) { return start ; } else { throw new IllegalArgumentException ( ) ; } } public static int scanArrayTypeSignature ( char [ ] string , int start ) { int length = string . length ; if ( start >= length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != Signature . C_ARRAY ) { throw new IllegalArgumentException ( ) ; } c = string [ ++ start ] ; while ( c == Signature . C_ARRAY ) { if ( start >= length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } c = string [ ++ start ] ; } return scanTypeSignature ( string , start ) ; } public static int scanCaptureTypeSignature ( char [ ] string , int start ) { if ( start >= string . length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != Signature . C_CAPTURE ) { throw new IllegalArgumentException ( ) ; } return scanTypeBoundSignature ( string , start + <NUM_LIT:1> ) ; } public static int scanTypeVariableSignature ( char [ ] string , int start ) { if ( start >= string . length - <NUM_LIT:2> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != Signature . C_TYPE_VARIABLE ) { throw new IllegalArgumentException ( ) ; } int id = scanIdentifier ( string , start + <NUM_LIT:1> ) ; c = string [ id + <NUM_LIT:1> ] ; if ( c == Signature . C_SEMICOLON ) { return id + <NUM_LIT:1> ; } else { throw new IllegalArgumentException ( ) ; } } public static int scanIdentifier ( char [ ] string , int start ) { if ( start >= string . length ) { throw new IllegalArgumentException ( ) ; } int p = start ; while ( true ) { char c = string [ p ] ; if ( c == '<CHAR_LIT>' || c == '<CHAR_LIT:>>' || c == '<CHAR_LIT::>' || c == '<CHAR_LIT:;>' || c == '<CHAR_LIT:.>' || c == '<CHAR_LIT:/>' ) { return p - <NUM_LIT:1> ; } p ++ ; if ( p == string . length ) { return p - <NUM_LIT:1> ; } } } public static int scanClassTypeSignature ( char [ ] string , int start ) { if ( start >= string . length - <NUM_LIT:2> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != Signature . C_RESOLVED && c != Signature . C_UNRESOLVED ) { return - <NUM_LIT:1> ; } int p = start + <NUM_LIT:1> ; while ( true ) { if ( p >= string . length ) { throw new IllegalArgumentException ( ) ; } c = string [ p ] ; if ( c == Signature . C_SEMICOLON ) { return p ; } else if ( c == Signature . C_GENERIC_START ) { int e = scanTypeArgumentSignatures ( string , p ) ; p = e ; } else if ( c == Signature . C_DOT || c == '<CHAR_LIT:/>' ) { int id = scanIdentifier ( string , p + <NUM_LIT:1> ) ; p = id ; } p ++ ; } } public static int scanTypeBoundSignature ( char [ ] string , int start ) { if ( start >= string . length ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; switch ( c ) { case Signature . C_STAR : return start ; case Signature . C_SUPER : case Signature . C_EXTENDS : if ( start >= string . length - <NUM_LIT:2> ) { throw new IllegalArgumentException ( ) ; } break ; default : throw new IllegalArgumentException ( ) ; } c = string [ ++ start ] ; switch ( c ) { case Signature . C_CAPTURE : return scanCaptureTypeSignature ( string , start ) ; case Signature . C_SUPER : case Signature . C_EXTENDS : return scanTypeBoundSignature ( string , start ) ; case Signature . C_RESOLVED : case Signature . C_UNRESOLVED : return scanClassTypeSignature ( string , start ) ; case Signature . C_TYPE_VARIABLE : return scanTypeVariableSignature ( string , start ) ; case Signature . C_ARRAY : return scanArrayTypeSignature ( string , start ) ; case Signature . C_STAR : return start ; default : throw new IllegalArgumentException ( ) ; } } public static int scanTypeArgumentSignatures ( char [ ] string , int start ) { if ( start >= string . length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != Signature . C_GENERIC_START ) { throw new IllegalArgumentException ( ) ; } int p = start + <NUM_LIT:1> ; while ( true ) { if ( p >= string . length ) { throw new IllegalArgumentException ( ) ; } c = string [ p ] ; if ( c == Signature . C_GENERIC_END ) { return p ; } int e = scanTypeArgumentSignature ( string , p ) ; p = e + <NUM_LIT:1> ; } } public static int scanTypeArgumentSignature ( char [ ] string , int start ) { if ( start >= string . length ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; switch ( c ) { case Signature . C_STAR : return start ; case Signature . C_EXTENDS : case Signature . C_SUPER : return scanTypeBoundSignature ( string , start ) ; default : return scanTypeSignature ( string , start ) ; } } public final static char [ ] [ ] [ ] getAllTypeArguments ( char [ ] [ ] typeSignatures ) { if ( typeSignatures == null ) return null ; int length = typeSignatures . length ; char [ ] [ ] [ ] typeArguments = new char [ length ] [ ] [ ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { typeArguments [ i ] = Signature . getTypeArguments ( typeSignatures [ i ] ) ; } return typeArguments ; } public static IAnnotation getAnnotation ( JavaElement parent , IBinaryAnnotation binaryAnnotation , String memberValuePairName ) { char [ ] typeName = org . eclipse . jdt . core . Signature . toCharArray ( CharOperation . replaceOnCopy ( binaryAnnotation . getTypeName ( ) , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ) ; return new Annotation ( parent , new String ( typeName ) , memberValuePairName ) ; } public static Object getAnnotationMemberValue ( JavaElement parent , MemberValuePair memberValuePair , Object binaryValue ) { if ( binaryValue instanceof Constant ) { return getAnnotationMemberValue ( memberValuePair , ( Constant ) binaryValue ) ; } else if ( binaryValue instanceof IBinaryAnnotation ) { memberValuePair . valueKind = IMemberValuePair . K_ANNOTATION ; return getAnnotation ( parent , ( IBinaryAnnotation ) binaryValue , memberValuePair . getMemberName ( ) ) ; } else if ( binaryValue instanceof ClassSignature ) { memberValuePair . valueKind = IMemberValuePair . K_CLASS ; char [ ] className = Signature . toCharArray ( CharOperation . replaceOnCopy ( ( ( ClassSignature ) binaryValue ) . getTypeName ( ) , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ) ; return new String ( className ) ; } else if ( binaryValue instanceof EnumConstantSignature ) { memberValuePair . valueKind = IMemberValuePair . K_QUALIFIED_NAME ; EnumConstantSignature enumConstant = ( EnumConstantSignature ) binaryValue ; char [ ] enumName = Signature . toCharArray ( CharOperation . replaceOnCopy ( enumConstant . getTypeName ( ) , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ) ; char [ ] qualifiedName = CharOperation . concat ( enumName , enumConstant . getEnumConstantName ( ) , '<CHAR_LIT:.>' ) ; return new String ( qualifiedName ) ; } else if ( binaryValue instanceof Object [ ] ) { memberValuePair . valueKind = - <NUM_LIT:1> ; Object [ ] binaryValues = ( Object [ ] ) binaryValue ; int length = binaryValues . length ; Object [ ] values = new Object [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { int previousValueKind = memberValuePair . valueKind ; Object value = getAnnotationMemberValue ( parent , memberValuePair , binaryValues [ i ] ) ; if ( previousValueKind != - <NUM_LIT:1> && memberValuePair . valueKind != previousValueKind ) { memberValuePair . valueKind = IMemberValuePair . K_UNKNOWN ; } if ( value instanceof Annotation ) { Annotation annotation = ( Annotation ) value ; for ( int j = <NUM_LIT:0> ; j < i ; j ++ ) { if ( annotation . equals ( values [ j ] ) ) { annotation . occurrenceCount ++ ; } } } values [ i ] = value ; } if ( memberValuePair . valueKind == - <NUM_LIT:1> ) memberValuePair . valueKind = IMemberValuePair . K_UNKNOWN ; return values ; } else { memberValuePair . valueKind = IMemberValuePair . K_UNKNOWN ; return null ; } } public static Object getAnnotationMemberValue ( MemberValuePair memberValuePair , Constant constant ) { if ( constant == null ) { memberValuePair . valueKind = IMemberValuePair . K_UNKNOWN ; return null ; } switch ( constant . typeID ( ) ) { case TypeIds . T_int : memberValuePair . valueKind = IMemberValuePair . K_INT ; return new Integer ( constant . intValue ( ) ) ; case TypeIds . T_byte : memberValuePair . valueKind = IMemberValuePair . K_BYTE ; return new Byte ( constant . byteValue ( ) ) ; case TypeIds . T_short : memberValuePair . valueKind = IMemberValuePair . K_SHORT ; return new Short ( constant . shortValue ( ) ) ; case TypeIds . T_char : memberValuePair . valueKind = IMemberValuePair . K_CHAR ; return new Character ( constant . charValue ( ) ) ; case TypeIds . T_float : memberValuePair . valueKind = IMemberValuePair . K_FLOAT ; return new Float ( constant . floatValue ( ) ) ; case TypeIds . T_double : memberValuePair . valueKind = IMemberValuePair . K_DOUBLE ; return new Double ( constant . doubleValue ( ) ) ; case TypeIds . T_boolean : memberValuePair . valueKind = IMemberValuePair . K_BOOLEAN ; return Boolean . valueOf ( constant . booleanValue ( ) ) ; case TypeIds . T_long : memberValuePair . valueKind = IMemberValuePair . K_LONG ; return new Long ( constant . longValue ( ) ) ; case TypeIds . T_JavaLangString : memberValuePair . valueKind = IMemberValuePair . K_STRING ; return constant . stringValue ( ) ; default : memberValuePair . valueKind = IMemberValuePair . K_UNKNOWN ; return null ; } } public static Object getNegativeAnnotationMemberValue ( MemberValuePair memberValuePair , Constant constant ) { if ( constant == null ) { memberValuePair . valueKind = IMemberValuePair . K_UNKNOWN ; return null ; } switch ( constant . typeID ( ) ) { case TypeIds . T_int : memberValuePair . valueKind = IMemberValuePair . K_INT ; return new Integer ( constant . intValue ( ) * - <NUM_LIT:1> ) ; case TypeIds . T_float : memberValuePair . valueKind = IMemberValuePair . K_FLOAT ; return new Float ( constant . floatValue ( ) * - <NUM_LIT:1.0f> ) ; case TypeIds . T_double : memberValuePair . valueKind = IMemberValuePair . K_DOUBLE ; return new Double ( constant . doubleValue ( ) * - <NUM_LIT:1.0> ) ; case TypeIds . T_long : memberValuePair . valueKind = IMemberValuePair . K_LONG ; return new Long ( constant . longValue ( ) * - <NUM_LIT:1L> ) ; default : memberValuePair . valueKind = IMemberValuePair . K_UNKNOWN ; return null ; } } public final static char [ ] [ ] splitTypeLevelsSignature ( String typeSignature ) { char [ ] source = Signature . removeCapture ( typeSignature . toCharArray ( ) ) ; CharOperation . replace ( source , '<CHAR_LIT>' , '<CHAR_LIT:.>' ) ; char [ ] [ ] signatures = new char [ <NUM_LIT:10> ] [ ] ; int signaturesCount = <NUM_LIT:0> ; int typeArgsCount = <NUM_LIT:0> ; int paramOpening = <NUM_LIT:0> ; for ( int idx = <NUM_LIT:0> , ln = source . length ; idx < ln ; idx ++ ) { switch ( source [ idx ] ) { case '<CHAR_LIT:>>' : paramOpening -- ; if ( paramOpening == <NUM_LIT:0> ) { if ( signaturesCount == signatures . length ) { System . arraycopy ( signatures , <NUM_LIT:0> , signatures = new char [ signaturesCount + <NUM_LIT:10> ] [ ] , <NUM_LIT:0> , signaturesCount ) ; } typeArgsCount = <NUM_LIT:0> ; } break ; case '<CHAR_LIT>' : paramOpening ++ ; if ( paramOpening == <NUM_LIT:1> ) { typeArgsCount = <NUM_LIT:1> ; } break ; case '<CHAR_LIT>' : case '<CHAR_LIT:;>' : if ( paramOpening == <NUM_LIT:1> ) typeArgsCount ++ ; break ; case '<CHAR_LIT:.>' : if ( paramOpening == <NUM_LIT:0> ) { if ( signaturesCount == signatures . length ) { System . arraycopy ( signatures , <NUM_LIT:0> , signatures = new char [ signaturesCount + <NUM_LIT:10> ] [ ] , <NUM_LIT:0> , signaturesCount ) ; } signatures [ signaturesCount ] = new char [ idx + <NUM_LIT:1> ] ; System . arraycopy ( source , <NUM_LIT:0> , signatures [ signaturesCount ] , <NUM_LIT:0> , idx ) ; signatures [ signaturesCount ] [ idx ] = Signature . C_SEMICOLON ; signaturesCount ++ ; } break ; case '<CHAR_LIT:/>' : source [ idx ] = '<CHAR_LIT:.>' ; break ; } } char [ ] [ ] typeSignatures = new char [ signaturesCount + <NUM_LIT:1> ] [ ] ; typeSignatures [ <NUM_LIT:0> ] = source ; for ( int i = <NUM_LIT:1> , j = signaturesCount - <NUM_LIT:1> ; i <= signaturesCount ; i ++ , j -- ) { typeSignatures [ i ] = signatures [ j ] ; } return typeSignatures ; } public static String toAnchor ( int startingIndex , char [ ] methodSignature , String methodName , boolean isVarArgs ) { try { return new String ( toAnchor ( startingIndex , methodSignature , methodName . toCharArray ( ) , isVarArgs ) ) ; } catch ( IllegalArgumentException e ) { return null ; } } public static char [ ] toAnchor ( int startingIndex , char [ ] methodSignature , char [ ] methodName , boolean isVargArgs ) { int firstParen = CharOperation . indexOf ( Signature . C_PARAM_START , methodSignature ) ; if ( firstParen == - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } StringBuffer buffer = new StringBuffer ( methodSignature . length + <NUM_LIT:10> ) ; if ( methodName != null ) { buffer . append ( methodName ) ; } buffer . append ( '<CHAR_LIT:(>' ) ; char [ ] [ ] pts = Signature . getParameterTypes ( methodSignature ) ; for ( int i = startingIndex , max = pts . length ; i < max ; i ++ ) { if ( i == max - <NUM_LIT:1> ) { appendTypeSignatureForAnchor ( pts [ i ] , <NUM_LIT:0> , buffer , isVargArgs ) ; } else { appendTypeSignatureForAnchor ( pts [ i ] , <NUM_LIT:0> , buffer , false ) ; } if ( i != pts . length - <NUM_LIT:1> ) { buffer . append ( '<CHAR_LIT:U+002C>' ) ; buffer . append ( '<CHAR_LIT:U+0020>' ) ; } } buffer . append ( '<CHAR_LIT:)>' ) ; char [ ] result = new char [ buffer . length ( ) ] ; buffer . getChars ( <NUM_LIT:0> , buffer . length ( ) , result , <NUM_LIT:0> ) ; return result ; } private static int appendTypeSignatureForAnchor ( char [ ] string , int start , StringBuffer buffer , boolean isVarArgs ) { if ( start >= string . length ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( isVarArgs ) { switch ( c ) { case Signature . C_ARRAY : return appendArrayTypeSignatureForAnchor ( string , start , buffer , true ) ; case Signature . C_RESOLVED : case Signature . C_TYPE_VARIABLE : case Signature . C_BOOLEAN : case Signature . C_BYTE : case Signature . C_CHAR : case Signature . C_DOUBLE : case Signature . C_FLOAT : case Signature . C_INT : case Signature . C_LONG : case Signature . C_SHORT : case Signature . C_VOID : case Signature . C_STAR : case Signature . C_EXTENDS : case Signature . C_SUPER : case Signature . C_CAPTURE : default : throw new IllegalArgumentException ( ) ; } } else { switch ( c ) { case Signature . C_ARRAY : return appendArrayTypeSignatureForAnchor ( string , start , buffer , false ) ; case Signature . C_RESOLVED : return appendClassTypeSignatureForAnchor ( string , start , buffer ) ; case Signature . C_TYPE_VARIABLE : int e = Util . scanTypeVariableSignature ( string , start ) ; buffer . append ( string , start + <NUM_LIT:1> , e - start - <NUM_LIT:1> ) ; return e ; case Signature . C_BOOLEAN : buffer . append ( BOOLEAN ) ; return start ; case Signature . C_BYTE : buffer . append ( BYTE ) ; return start ; case Signature . C_CHAR : buffer . append ( CHAR ) ; return start ; case Signature . C_DOUBLE : buffer . append ( DOUBLE ) ; return start ; case Signature . C_FLOAT : buffer . append ( FLOAT ) ; return start ; case Signature . C_INT : buffer . append ( INT ) ; return start ; case Signature . C_LONG : buffer . append ( LONG ) ; return start ; case Signature . C_SHORT : buffer . append ( SHORT ) ; return start ; case Signature . C_VOID : buffer . append ( VOID ) ; return start ; case Signature . C_CAPTURE : return appendCaptureTypeSignatureForAnchor ( string , start , buffer ) ; case Signature . C_STAR : case Signature . C_EXTENDS : case Signature . C_SUPER : return appendTypeArgumentSignatureForAnchor ( string , start , buffer ) ; default : throw new IllegalArgumentException ( ) ; } } } private static int appendTypeArgumentSignatureForAnchor ( char [ ] string , int start , StringBuffer buffer ) { if ( start >= string . length ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; switch ( c ) { case Signature . C_STAR : return start ; case Signature . C_EXTENDS : return appendTypeSignatureForAnchor ( string , start + <NUM_LIT:1> , buffer , false ) ; case Signature . C_SUPER : return appendTypeSignatureForAnchor ( string , start + <NUM_LIT:1> , buffer , false ) ; default : return appendTypeSignatureForAnchor ( string , start , buffer , false ) ; } } private static int appendCaptureTypeSignatureForAnchor ( char [ ] string , int start , StringBuffer buffer ) { if ( start >= string . length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != Signature . C_CAPTURE ) { throw new IllegalArgumentException ( ) ; } return appendTypeArgumentSignatureForAnchor ( string , start + <NUM_LIT:1> , buffer ) ; } private static int appendArrayTypeSignatureForAnchor ( char [ ] string , int start , StringBuffer buffer , boolean isVarArgs ) { int length = string . length ; if ( start >= length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != Signature . C_ARRAY ) { throw new IllegalArgumentException ( ) ; } int index = start ; c = string [ ++ index ] ; while ( c == Signature . C_ARRAY ) { if ( index >= length - <NUM_LIT:1> ) { throw new IllegalArgumentException ( ) ; } c = string [ ++ index ] ; } int e = appendTypeSignatureForAnchor ( string , index , buffer , false ) ; for ( int i = <NUM_LIT:1> , dims = index - start ; i < dims ; i ++ ) { buffer . append ( '<CHAR_LIT:[>' ) . append ( '<CHAR_LIT:]>' ) ; } if ( isVarArgs ) { buffer . append ( '<CHAR_LIT:.>' ) . append ( '<CHAR_LIT:.>' ) . append ( '<CHAR_LIT:.>' ) ; } else { buffer . append ( '<CHAR_LIT:[>' ) . append ( '<CHAR_LIT:]>' ) ; } return e ; } private static int appendClassTypeSignatureForAnchor ( char [ ] string , int start , StringBuffer buffer ) { if ( start >= string . length - <NUM_LIT:2> ) { throw new IllegalArgumentException ( ) ; } char c = string [ start ] ; if ( c != Signature . C_RESOLVED && c != Signature . C_UNRESOLVED ) { throw new IllegalArgumentException ( ) ; } int p = start + <NUM_LIT:1> ; while ( true ) { if ( p >= string . length ) { throw new IllegalArgumentException ( ) ; } c = string [ p ] ; switch ( c ) { case Signature . C_SEMICOLON : return p ; case Signature . C_GENERIC_START : int e = scanGenericEnd ( string , p + <NUM_LIT:1> ) ; p = e ; break ; case Signature . C_DOT : buffer . append ( '<CHAR_LIT:.>' ) ; break ; case '<CHAR_LIT:/>' : buffer . append ( '<CHAR_LIT:/>' ) ; break ; case Signature . C_DOLLAR : buffer . append ( '<CHAR_LIT:.>' ) ; break ; default : buffer . append ( c ) ; } p ++ ; } } private static int scanGenericEnd ( char [ ] string , int start ) { if ( string [ start ] == Signature . C_GENERIC_END ) { return start ; } int length = string . length ; int balance = <NUM_LIT:1> ; start ++ ; while ( start <= length ) { switch ( string [ start ] ) { case Signature . C_GENERIC_END : balance -- ; if ( balance == <NUM_LIT:0> ) { return start ; } break ; case Signature . C_GENERIC_START : balance ++ ; break ; } start ++ ; } return start ; } public static void fixTaskTags ( Map defaultOptionsMap ) { Object taskTagsValue = defaultOptionsMap . get ( JavaCore . COMPILER_TASK_TAGS ) ; char [ ] [ ] taskTags = null ; if ( taskTagsValue instanceof String ) { taskTags = CharOperation . splitAndTrimOn ( '<CHAR_LIT:U+002C>' , ( ( String ) taskTagsValue ) . toCharArray ( ) ) ; } Object taskPrioritiesValue = defaultOptionsMap . get ( JavaCore . COMPILER_TASK_PRIORITIES ) ; char [ ] [ ] taskPriorities = null ; if ( taskPrioritiesValue instanceof String ) { taskPriorities = CharOperation . splitAndTrimOn ( '<CHAR_LIT:U+002C>' , ( ( String ) taskPrioritiesValue ) . toCharArray ( ) ) ; } if ( taskPriorities == null ) { if ( taskTags != null ) { Util . logRepeatedMessage ( TASK_PRIORITIES_PROBLEM , IStatus . ERROR , "<STR_LIT>" ) ; defaultOptionsMap . remove ( JavaCore . COMPILER_TASK_TAGS ) ; } return ; } else if ( taskTags == null ) { Util . logRepeatedMessage ( TASK_PRIORITIES_PROBLEM , IStatus . ERROR , "<STR_LIT>" ) ; defaultOptionsMap . remove ( JavaCore . COMPILER_TASK_PRIORITIES ) ; return ; } int taskTagsLength = taskTags . length ; int taskPrioritiesLength = taskPriorities . length ; if ( taskTagsLength != taskPrioritiesLength ) { Util . logRepeatedMessage ( TASK_PRIORITIES_PROBLEM , IStatus . ERROR , "<STR_LIT>" ) ; if ( taskTagsLength > taskPrioritiesLength ) { System . arraycopy ( taskTags , <NUM_LIT:0> , ( taskTags = new char [ taskPrioritiesLength ] [ ] ) , <NUM_LIT:0> , taskPrioritiesLength ) ; defaultOptionsMap . put ( JavaCore . COMPILER_TASK_TAGS , new String ( CharOperation . concatWith ( taskTags , '<CHAR_LIT:U+002C>' ) ) ) ; } else { System . arraycopy ( taskPriorities , <NUM_LIT:0> , ( taskPriorities = new char [ taskTagsLength ] [ ] ) , <NUM_LIT:0> , taskTagsLength ) ; defaultOptionsMap . put ( JavaCore . COMPILER_TASK_PRIORITIES , new String ( CharOperation . concatWith ( taskPriorities , '<CHAR_LIT:U+002C>' ) ) ) ; } } } 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 ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; public abstract class ReferenceInfoAdapter { public void acceptAnnotationTypeReference ( char [ ] [ ] typeName , int sourceStart , int sourceEnd ) { } public void acceptAnnotationTypeReference ( char [ ] typeName , int sourcePosition ) { } public void acceptConstructorReference ( char [ ] typeName , int argCount , int sourcePosition ) { } public void acceptFieldReference ( char [ ] fieldName , int sourcePosition ) { } public void acceptMethodReference ( char [ ] methodName , int argCount , int sourcePosition ) { } public void acceptTypeReference ( char [ ] [ ] typeName , int sourceStart , int sourceEnd ) { } public void acceptTypeReference ( char [ ] typeName , int sourcePosition ) { } public void acceptUnknownReference ( char [ ] [ ] name , int sourceStart , int sourceEnd ) { } public void acceptUnknownReference ( char [ ] name , int sourcePosition ) { } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IClassFileAttribute ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IConstantPoolConstant ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; public class ClassFileAttribute extends ClassFileStruct implements IClassFileAttribute { public static final IClassFileAttribute [ ] NO_ATTRIBUTES = new IClassFileAttribute [ <NUM_LIT:0> ] ; private long attributeLength ; private int attributeNameIndex ; private char [ ] attributeName ; public ClassFileAttribute ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { this . attributeNameIndex = u2At ( classFileBytes , <NUM_LIT:0> , offset ) ; this . attributeLength = u4At ( classFileBytes , <NUM_LIT:2> , offset ) ; IConstantPoolEntry constantPoolEntry = constantPool . decodeEntry ( this . attributeNameIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . attributeName = constantPoolEntry . getUtf8Value ( ) ; } public int getAttributeNameIndex ( ) { return this . attributeNameIndex ; } public char [ ] getAttributeName ( ) { return this . attributeName ; } public long getAttributeLength ( ) { return this . attributeLength ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; public interface ILRUCacheable { public int getCacheFootprint ( ) ; } </s>
<s> package org . eclipse . jdt . internal . core . util ; public final class HashtableOfArrayToObject implements Cloneable { public Object [ ] [ ] keyTable ; public Object [ ] valueTable ; public int elementSize ; int threshold ; public HashtableOfArrayToObject ( ) { this ( <NUM_LIT> ) ; } public HashtableOfArrayToObject ( int size ) { this . elementSize = <NUM_LIT:0> ; this . threshold = size ; int extraRoom = ( int ) ( size * <NUM_LIT> ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . keyTable = new Object [ extraRoom ] [ ] ; this . valueTable = new Object [ extraRoom ] ; } public Object clone ( ) throws CloneNotSupportedException { HashtableOfArrayToObject result = ( HashtableOfArrayToObject ) super . clone ( ) ; result . elementSize = this . elementSize ; result . threshold = this . threshold ; int length = this . keyTable . length ; result . keyTable = new Object [ length ] [ ] ; System . arraycopy ( this . keyTable , <NUM_LIT:0> , result . keyTable , <NUM_LIT:0> , length ) ; length = this . valueTable . length ; result . valueTable = new Object [ length ] ; System . arraycopy ( this . valueTable , <NUM_LIT:0> , result . valueTable , <NUM_LIT:0> , length ) ; return result ; } public boolean containsKey ( Object [ ] key ) { int length = this . keyTable . length ; int index = hashCode ( key ) % length ; int keyLength = key . length ; Object [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && Util . equalArraysOrNull ( currentKey , key ) ) return true ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return false ; } public Object get ( Object [ ] key ) { int length = this . keyTable . length ; int index = hashCode ( key ) % length ; int keyLength = key . length ; Object [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && Util . equalArraysOrNull ( currentKey , key ) ) return this . valueTable [ index ] ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return null ; } public int getIndex ( Object [ ] key ) { int length = this . keyTable . length ; int index = hashCode ( key ) % length ; int keyLength = key . length ; Object [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && Util . equalArraysOrNull ( currentKey , key ) ) return index ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return - <NUM_LIT:1> ; } public Object [ ] getKey ( Object [ ] key , int keyLength ) { int length = this . keyTable . length ; int index = hashCode ( key , keyLength ) % length ; Object [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && Util . equalArrays ( currentKey , key , keyLength ) ) return currentKey ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return null ; } private int hashCode ( Object [ ] element ) { return hashCode ( element , element . length ) ; } private int hashCode ( Object [ ] element , int length ) { int hash = <NUM_LIT:0> ; for ( int i = length - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) hash = Util . combineHashCodes ( hash , element [ i ] . hashCode ( ) ) ; return hash & <NUM_LIT> ; } public Object put ( Object [ ] key , Object value ) { int length = this . keyTable . length ; int index = hashCode ( key ) % length ; int keyLength = key . length ; Object [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && Util . equalArraysOrNull ( currentKey , key ) ) return this . valueTable [ index ] = value ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } this . keyTable [ index ] = key ; this . valueTable [ index ] = value ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return value ; } public Object removeKey ( Object [ ] key ) { int length = this . keyTable . length ; int index = hashCode ( key ) % length ; int keyLength = key . length ; Object [ ] currentKey ; while ( ( currentKey = this . keyTable [ index ] ) != null ) { if ( currentKey . length == keyLength && Util . equalArraysOrNull ( currentKey , key ) ) { Object value = this . valueTable [ index ] ; this . elementSize -- ; this . keyTable [ index ] = null ; this . valueTable [ index ] = null ; rehash ( ) ; return value ; } if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return null ; } private void rehash ( ) { HashtableOfArrayToObject newHashtable = new HashtableOfArrayToObject ( this . elementSize * <NUM_LIT:2> ) ; Object [ ] currentKey ; for ( int i = this . keyTable . length ; -- i >= <NUM_LIT:0> ; ) if ( ( currentKey = this . keyTable [ i ] ) != null ) newHashtable . put ( currentKey , this . valueTable [ i ] ) ; this . keyTable = newHashtable . keyTable ; this . valueTable = newHashtable . valueTable ; this . threshold = newHashtable . threshold ; } public int size ( ) { return this . elementSize ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; Object [ ] element ; for ( int i = <NUM_LIT:0> , length = this . keyTable . length ; i < length ; i ++ ) if ( ( element = this . keyTable [ i ] ) != null ) { buffer . append ( '<CHAR_LIT>' ) ; for ( int j = <NUM_LIT:0> , length2 = element . length ; j < length2 ; j ++ ) { buffer . append ( element [ j ] ) ; if ( j != length2 - <NUM_LIT:1> ) buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . valueTable [ i ] ) ; if ( i != length - <NUM_LIT:1> ) buffer . append ( '<STR_LIT:\n>' ) ; } return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import java . util . HashMap ; import java . util . HashSet ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . Path ; import org . eclipse . jdt . core . IClassFile ; import org . eclipse . jdt . core . IClasspathEntry ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaProject ; import org . eclipse . jdt . core . IMember ; import org . eclipse . jdt . core . IPackageFragment ; import org . eclipse . jdt . core . IPackageFragmentRoot ; import org . eclipse . jdt . core . IType ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . search . IJavaSearchScope ; import org . eclipse . jdt . internal . compiler . ast . * ; import org . eclipse . jdt . internal . compiler . lookup . ClassScope ; import org . eclipse . jdt . internal . compiler . lookup . MethodScope ; import org . eclipse . jdt . internal . compiler . lookup . Scope ; import org . eclipse . jdt . internal . core . * ; import org . eclipse . jdt . internal . core . search . AbstractJavaSearchScope ; import org . eclipse . jdt . internal . core . util . Util ; public class HandleFactory { private String lastPkgFragmentRootPath ; private PackageFragmentRoot lastPkgFragmentRoot ; private HashtableOfArrayToObject packageHandles ; private JavaModel javaModel ; public HandleFactory ( ) { this . javaModel = JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) ; } public Openable createOpenable ( String resourcePath , IJavaSearchScope scope ) { int separatorIndex ; if ( ( separatorIndex = resourcePath . indexOf ( IJavaSearchScope . JAR_FILE_ENTRY_SEPARATOR ) ) > - <NUM_LIT:1> ) { int rootPathLength ; if ( this . lastPkgFragmentRootPath == null || ( rootPathLength = this . lastPkgFragmentRootPath . length ( ) ) != resourcePath . length ( ) || ! resourcePath . regionMatches ( <NUM_LIT:0> , this . lastPkgFragmentRootPath , <NUM_LIT:0> , rootPathLength ) ) { String jarPath = resourcePath . substring ( <NUM_LIT:0> , separatorIndex ) ; PackageFragmentRoot root = getJarPkgFragmentRoot ( resourcePath , separatorIndex , jarPath , scope ) ; if ( root == null ) return null ; this . lastPkgFragmentRootPath = jarPath ; this . lastPkgFragmentRoot = root ; this . packageHandles = new HashtableOfArrayToObject ( <NUM_LIT:5> ) ; } String classFilePath = resourcePath . substring ( separatorIndex + <NUM_LIT:1> ) ; String [ ] simpleNames = new Path ( classFilePath ) . segments ( ) ; String [ ] pkgName ; int length = simpleNames . length - <NUM_LIT:1> ; if ( length > <NUM_LIT:0> ) { pkgName = new String [ length ] ; System . arraycopy ( simpleNames , <NUM_LIT:0> , pkgName , <NUM_LIT:0> , length ) ; } else { pkgName = CharOperation . NO_STRINGS ; } IPackageFragment pkgFragment = ( IPackageFragment ) this . packageHandles . get ( pkgName ) ; if ( pkgFragment == null ) { pkgFragment = this . lastPkgFragmentRoot . getPackageFragment ( pkgName ) ; this . packageHandles . put ( pkgName , pkgFragment ) ; } IClassFile classFile = pkgFragment . getClassFile ( simpleNames [ length ] ) ; return ( Openable ) classFile ; } else { int rootPathLength = - <NUM_LIT:1> ; if ( this . lastPkgFragmentRootPath == null || ! ( resourcePath . startsWith ( this . lastPkgFragmentRootPath ) && ! org . eclipse . jdt . internal . compiler . util . Util . isExcluded ( resourcePath . toCharArray ( ) , this . lastPkgFragmentRoot . fullInclusionPatternChars ( ) , this . lastPkgFragmentRoot . fullExclusionPatternChars ( ) , false ) && ( rootPathLength = this . lastPkgFragmentRootPath . length ( ) ) > <NUM_LIT:0> && resourcePath . charAt ( rootPathLength ) == '<CHAR_LIT:/>' ) ) { PackageFragmentRoot root = getPkgFragmentRoot ( resourcePath ) ; if ( root == null ) return null ; this . lastPkgFragmentRoot = root ; this . lastPkgFragmentRootPath = this . lastPkgFragmentRoot . internalPath ( ) . toString ( ) ; this . packageHandles = new HashtableOfArrayToObject ( <NUM_LIT:5> ) ; } resourcePath = resourcePath . substring ( this . lastPkgFragmentRootPath . length ( ) + <NUM_LIT:1> ) ; String [ ] simpleNames = new Path ( resourcePath ) . segments ( ) ; String [ ] pkgName ; int length = simpleNames . length - <NUM_LIT:1> ; if ( length > <NUM_LIT:0> ) { pkgName = new String [ length ] ; System . arraycopy ( simpleNames , <NUM_LIT:0> , pkgName , <NUM_LIT:0> , length ) ; } else { pkgName = CharOperation . NO_STRINGS ; } IPackageFragment pkgFragment = ( IPackageFragment ) this . packageHandles . get ( pkgName ) ; if ( pkgFragment == null ) { pkgFragment = this . lastPkgFragmentRoot . getPackageFragment ( pkgName ) ; this . packageHandles . put ( pkgName , pkgFragment ) ; } String simpleName = simpleNames [ length ] ; if ( org . eclipse . jdt . internal . core . util . Util . isJavaLikeFileName ( simpleName ) ) { ICompilationUnit unit = pkgFragment . getCompilationUnit ( simpleName ) ; return ( Openable ) unit ; } else if ( org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( simpleName ) ) { IClassFile classFile = pkgFragment . getClassFile ( simpleName ) ; return ( Openable ) classFile ; } return null ; } } public IJavaElement createElement ( ClassScope scope , ICompilationUnit unit , HashSet existingElements , HashMap knownScopes ) { return createElement ( scope , scope . referenceContext . sourceStart , unit , existingElements , knownScopes ) ; } private IJavaElement createElement ( Scope scope , int elementPosition , ICompilationUnit unit , HashSet existingElements , HashMap knownScopes ) { IJavaElement newElement = ( IJavaElement ) knownScopes . get ( scope ) ; if ( newElement != null ) return newElement ; switch ( scope . kind ) { case Scope . COMPILATION_UNIT_SCOPE : newElement = unit ; break ; case Scope . CLASS_SCOPE : IJavaElement parentElement = createElement ( scope . parent , elementPosition , unit , existingElements , knownScopes ) ; switch ( parentElement . getElementType ( ) ) { case IJavaElement . COMPILATION_UNIT : newElement = ( ( ICompilationUnit ) parentElement ) . getType ( new String ( scope . enclosingSourceType ( ) . sourceName ) ) ; break ; case IJavaElement . TYPE : newElement = ( ( IType ) parentElement ) . getType ( new String ( scope . enclosingSourceType ( ) . sourceName ) ) ; break ; case IJavaElement . FIELD : case IJavaElement . INITIALIZER : case IJavaElement . METHOD : IMember member = ( IMember ) parentElement ; if ( member . isBinary ( ) ) { return null ; } else { newElement = member . getType ( new String ( scope . enclosingSourceType ( ) . sourceName ) , <NUM_LIT:1> ) ; if ( newElement != null ) { while ( ! existingElements . add ( newElement ) ) ( ( SourceRefElement ) newElement ) . occurrenceCount ++ ; } } break ; } if ( newElement != null ) { knownScopes . put ( scope , newElement ) ; } break ; case Scope . METHOD_SCOPE : IType parentType = ( IType ) createElement ( scope . parent , elementPosition , unit , existingElements , knownScopes ) ; MethodScope methodScope = ( MethodScope ) scope ; if ( methodScope . isInsideInitializer ( ) ) { TypeDeclaration type = methodScope . referenceType ( ) ; int occurenceCount = <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> , length = type . fields . length ; i < length ; i ++ ) { FieldDeclaration field = type . fields [ i ] ; if ( field . declarationSourceStart <= elementPosition && elementPosition <= field . declarationSourceEnd ) { switch ( field . getKind ( ) ) { case AbstractVariableDeclaration . FIELD : case AbstractVariableDeclaration . ENUM_CONSTANT : newElement = parentType . getField ( new String ( field . name ) ) ; break ; case AbstractVariableDeclaration . INITIALIZER : newElement = parentType . getInitializer ( occurenceCount ) ; break ; } break ; } else if ( field . getKind ( ) == AbstractVariableDeclaration . INITIALIZER ) { occurenceCount ++ ; } } } else { AbstractMethodDeclaration method = methodScope . referenceMethod ( ) ; newElement = parentType . getMethod ( new String ( method . selector ) , Util . typeParameterSignatures ( method ) ) ; if ( newElement != null ) { knownScopes . put ( scope , newElement ) ; } } break ; case Scope . BLOCK_SCOPE : newElement = createElement ( scope . parent , elementPosition , unit , existingElements , knownScopes ) ; break ; } return newElement ; } private PackageFragmentRoot getJarPkgFragmentRoot ( String resourcePathString , int jarSeparatorIndex , String jarPathString , IJavaSearchScope scope ) { IPath jarPath = new Path ( jarPathString ) ; Object target = JavaModel . getTarget ( jarPath , false ) ; if ( target instanceof IFile ) { IFile jarFile = ( IFile ) target ; JavaProject javaProject = ( JavaProject ) this . javaModel . getJavaProject ( jarFile ) ; try { IClasspathEntry entry = javaProject . getClasspathEntryFor ( jarPath ) ; if ( entry != null ) { return ( PackageFragmentRoot ) javaProject . getPackageFragmentRoot ( jarFile ) ; } } catch ( JavaModelException e ) { } } IJavaProject [ ] projects ; if ( scope != null ) { if ( scope instanceof AbstractJavaSearchScope ) { PackageFragmentRoot root = ( PackageFragmentRoot ) ( ( AbstractJavaSearchScope ) scope ) . packageFragmentRoot ( resourcePathString , jarSeparatorIndex , jarPathString ) ; if ( root != null ) return root ; } else { IPath [ ] enclosingProjectsAndJars = scope . enclosingProjectsAndJars ( ) ; int length = enclosingProjectsAndJars . length ; projects = new IJavaProject [ length ] ; int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IPath path = enclosingProjectsAndJars [ i ] ; if ( path . segmentCount ( ) == <NUM_LIT:1> ) { projects [ index ++ ] = this . javaModel . getJavaProject ( path . segment ( <NUM_LIT:0> ) ) ; } } if ( index < length ) { System . arraycopy ( projects , <NUM_LIT:0> , projects = new IJavaProject [ index ] , <NUM_LIT:0> , index ) ; } PackageFragmentRoot root = getJarPkgFragmentRoot ( jarPath , target , projects ) ; if ( root != null ) { return root ; } } } try { projects = this . javaModel . getJavaProjects ( ) ; } catch ( JavaModelException e ) { return null ; } return getJarPkgFragmentRoot ( jarPath , target , projects ) ; } private PackageFragmentRoot getJarPkgFragmentRoot ( IPath jarPath , Object target , IJavaProject [ ] projects ) { for ( int i = <NUM_LIT:0> , projectCount = projects . length ; i < projectCount ; i ++ ) { try { JavaProject javaProject = ( JavaProject ) projects [ i ] ; IClasspathEntry classpathEnty = javaProject . getClasspathEntryFor ( jarPath ) ; if ( classpathEnty != null ) { if ( target instanceof IFile ) { return ( PackageFragmentRoot ) javaProject . getPackageFragmentRoot ( ( IFile ) target ) ; } else { return ( PackageFragmentRoot ) javaProject . getPackageFragmentRoot0 ( jarPath ) ; } } } catch ( JavaModelException e ) { } } return null ; } private PackageFragmentRoot getPkgFragmentRoot ( String pathString ) { IPath path = new Path ( pathString ) ; IProject [ ] projects = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getProjects ( ) ; for ( int i = <NUM_LIT:0> , max = projects . length ; i < max ; i ++ ) { try { IProject project = projects [ i ] ; if ( ! project . isAccessible ( ) || ! project . hasNature ( JavaCore . NATURE_ID ) ) continue ; IJavaProject javaProject = this . javaModel . getJavaProject ( project ) ; IPackageFragmentRoot [ ] roots = javaProject . getPackageFragmentRoots ( ) ; for ( int j = <NUM_LIT:0> , rootCount = roots . length ; j < rootCount ; j ++ ) { PackageFragmentRoot root = ( PackageFragmentRoot ) roots [ j ] ; if ( root . internalPath ( ) . isPrefixOf ( path ) && ! Util . isExcluded ( path , root . fullInclusionPatternChars ( ) , root . fullExclusionPatternChars ( ) , false ) ) { return root ; } } } catch ( CoreException e ) { } } return null ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IConstantPoolConstant ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; import org . eclipse . jdt . core . util . ILocalVariableTypeTableEntry ; public class LocalVariableTypeTableEntry extends ClassFileStruct implements ILocalVariableTypeTableEntry { private int startPC ; private int length ; private int nameIndex ; private int signatureIndex ; private char [ ] name ; private char [ ] signature ; private int index ; public LocalVariableTypeTableEntry ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { this . startPC = u2At ( classFileBytes , <NUM_LIT:0> , offset ) ; this . length = u2At ( classFileBytes , <NUM_LIT:2> , offset ) ; this . nameIndex = u2At ( classFileBytes , <NUM_LIT:4> , offset ) ; this . signatureIndex = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; this . index = u2At ( classFileBytes , <NUM_LIT:8> , offset ) ; IConstantPoolEntry constantPoolEntry = constantPool . decodeEntry ( this . nameIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . name = constantPoolEntry . getUtf8Value ( ) ; constantPoolEntry = constantPool . decodeEntry ( this . signatureIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . signature = constantPoolEntry . getUtf8Value ( ) ; } public int getStartPC ( ) { return this . startPC ; } public int getLength ( ) { return this . length ; } public int getNameIndex ( ) { return this . nameIndex ; } public int getSignatureIndex ( ) { return this . signatureIndex ; } public int getIndex ( ) { return this . index ; } public char [ ] getName ( ) { return this . name ; } public char [ ] getSignature ( ) { return this . signature ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IAnnotationComponent ; import org . eclipse . jdt . core . util . IAnnotationComponentValue ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IConstantPoolConstant ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; public class AnnotationComponent extends ClassFileStruct implements IAnnotationComponent { private int componentNameIndex ; private char [ ] componentName ; private IAnnotationComponentValue componentValue ; private int readOffset ; public AnnotationComponent ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { final int nameIndex = u2At ( classFileBytes , <NUM_LIT:0> , offset ) ; this . componentNameIndex = nameIndex ; if ( nameIndex != <NUM_LIT:0> ) { IConstantPoolEntry constantPoolEntry = constantPool . decodeEntry ( nameIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . componentName = constantPoolEntry . getUtf8Value ( ) ; } this . readOffset = <NUM_LIT:2> ; AnnotationComponentValue value = new AnnotationComponentValue ( classFileBytes , constantPool , offset + this . readOffset ) ; this . componentValue = value ; this . readOffset += value . sizeInBytes ( ) ; } public int getComponentNameIndex ( ) { return this . componentNameIndex ; } public char [ ] getComponentName ( ) { return this . componentName ; } public IAnnotationComponentValue getComponentValue ( ) { return this . componentValue ; } int sizeInBytes ( ) { return this . readOffset ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . compiler . CharOperation ; public final class SimpleWordSet { public char [ ] [ ] words ; public int elementSize ; public int threshold ; public SimpleWordSet ( int size ) { this . elementSize = <NUM_LIT:0> ; this . threshold = size ; int extraRoom = ( int ) ( size * <NUM_LIT> ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . words = new char [ extraRoom ] [ ] ; } public char [ ] add ( char [ ] word ) { int length = this . words . length ; int index = CharOperation . hashCode ( word ) % length ; char [ ] current ; while ( ( current = this . words [ index ] ) != null ) { if ( CharOperation . equals ( current , word ) ) return current ; if ( ++ index == length ) index = <NUM_LIT:0> ; } this . words [ index ] = word ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return word ; } public boolean includes ( char [ ] word ) { int length = this . words . length ; int index = CharOperation . hashCode ( word ) % length ; char [ ] current ; while ( ( current = this . words [ index ] ) != null ) { if ( CharOperation . equals ( current , word ) ) return true ; if ( ++ index == length ) index = <NUM_LIT:0> ; } return false ; } private void rehash ( ) { SimpleWordSet newSet = new SimpleWordSet ( this . elementSize * <NUM_LIT:2> ) ; char [ ] current ; for ( int i = this . words . length ; -- i >= <NUM_LIT:0> ; ) if ( ( current = this . words [ i ] ) != null ) newSet . add ( current ) ; this . words = newSet . words ; this . elementSize = newSet . elementSize ; this . threshold = newSet . threshold ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import java . util . ArrayList ; import org . eclipse . jdt . core . IAnnotatable ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IMethod ; import org . eclipse . jdt . core . IOpenable ; import org . eclipse . jdt . core . IPackageFragment ; import org . eclipse . jdt . core . IType ; import org . eclipse . jdt . core . ITypeRoot ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . Signature ; import org . eclipse . jdt . core . WorkingCopyOwner ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . core . * ; public class JavaElementFinder extends BindingKeyParser { private JavaProject project ; private WorkingCopyOwner owner ; public IJavaElement element ; public JavaModelException exception ; private ArrayList types = new ArrayList ( ) ; public JavaElementFinder ( String key , JavaProject project , WorkingCopyOwner owner ) { super ( key ) ; this . project = project ; this . owner = owner ; } private JavaElementFinder ( BindingKeyParser parser , JavaProject project , WorkingCopyOwner owner ) { super ( parser ) ; this . project = project ; this . owner = owner ; } public void consumeAnnotation ( ) { if ( ! ( this . element instanceof IAnnotatable ) ) return ; int size = this . types . size ( ) ; if ( size == <NUM_LIT:0> ) return ; IJavaElement annotationType = ( ( JavaElementFinder ) this . types . get ( size - <NUM_LIT:1> ) ) . element ; this . element = ( ( IAnnotatable ) this . element ) . getAnnotation ( annotationType . getElementName ( ) ) ; } public void consumeField ( char [ ] fieldName ) { if ( ! ( this . element instanceof IType ) ) return ; this . element = ( ( IType ) this . element ) . getField ( new String ( fieldName ) ) ; } public void consumeFullyQualifiedName ( char [ ] fullyQualifiedName ) { try { this . element = this . project . findType ( new String ( CharOperation . replaceOnCopy ( fullyQualifiedName , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ) , this . owner ) ; } catch ( JavaModelException e ) { this . exception = e ; } } public void consumeLocalType ( char [ ] uniqueKey ) { if ( this . element == null ) return ; if ( this . element instanceof BinaryType ) { int lastSlash = CharOperation . lastIndexOf ( '<CHAR_LIT:/>' , uniqueKey ) ; int end = CharOperation . indexOf ( '<CHAR_LIT:;>' , uniqueKey , lastSlash + <NUM_LIT:1> ) ; char [ ] localName = CharOperation . subarray ( uniqueKey , lastSlash + <NUM_LIT:1> , end ) ; IPackageFragment pkg = ( IPackageFragment ) this . element . getAncestor ( IJavaElement . PACKAGE_FRAGMENT ) ; this . element = pkg . getClassFile ( new String ( localName ) + SuffixConstants . SUFFIX_STRING_class ) ; } else { int firstDollar = CharOperation . indexOf ( '<CHAR_LIT>' , uniqueKey ) ; int end = CharOperation . indexOf ( '<CHAR_LIT>' , uniqueKey , firstDollar + <NUM_LIT:1> ) ; if ( end == - <NUM_LIT:1> ) end = CharOperation . indexOf ( '<CHAR_LIT:;>' , uniqueKey , firstDollar + <NUM_LIT:1> ) ; char [ ] sourceStart = CharOperation . subarray ( uniqueKey , firstDollar + <NUM_LIT:1> , end ) ; int position = Integer . parseInt ( new String ( sourceStart ) ) ; try { this . element = ( ( ITypeRoot ) this . element . getOpenable ( ) ) . getElementAt ( position ) ; } catch ( JavaModelException e ) { this . exception = e ; } } } public void consumeMemberType ( char [ ] simpleTypeName ) { if ( ! ( this . element instanceof IType ) ) return ; this . element = ( ( IType ) this . element ) . getType ( new String ( simpleTypeName ) ) ; } public void consumeMethod ( char [ ] selector , char [ ] signature ) { if ( ! ( this . element instanceof IType ) ) return ; String [ ] parameterTypes = Signature . getParameterTypes ( new String ( signature ) ) ; IType type = ( IType ) this . element ; IMethod method = type . getMethod ( new String ( selector ) , parameterTypes ) ; IMethod [ ] methods = type . findMethods ( method ) ; if ( methods . length > <NUM_LIT:0> ) this . element = methods [ <NUM_LIT:0> ] ; } public void consumePackage ( char [ ] pkgName ) { pkgName = CharOperation . replaceOnCopy ( pkgName , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; try { this . element = this . project . findPackageFragment ( new String ( pkgName ) ) ; } catch ( JavaModelException e ) { this . exception = e ; } } public void consumeParser ( BindingKeyParser parser ) { this . types . add ( parser ) ; } public void consumeSecondaryType ( char [ ] simpleTypeName ) { if ( this . element == null ) return ; IOpenable openable = this . element . getOpenable ( ) ; if ( ! ( openable instanceof ICompilationUnit ) ) return ; this . element = ( ( ICompilationUnit ) openable ) . getType ( new String ( simpleTypeName ) ) ; } public void consumeTypeVariable ( char [ ] position , char [ ] typeVariableName ) { if ( this . element == null ) return ; switch ( this . element . getElementType ( ) ) { case IJavaElement . TYPE : this . element = ( ( IType ) this . element ) . getTypeParameter ( new String ( typeVariableName ) ) ; break ; case IJavaElement . METHOD : this . element = ( ( IMethod ) this . element ) . getTypeParameter ( new String ( typeVariableName ) ) ; break ; } } public BindingKeyParser newParser ( ) { return new JavaElementFinder ( this , this . project , this . owner ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IConstantPoolConstant ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; import org . eclipse . jdt . core . util . IExceptionAttribute ; public class ExceptionAttribute extends ClassFileAttribute implements IExceptionAttribute { private int exceptionsNumber ; private char [ ] [ ] exceptionNames ; private int [ ] exceptionIndexes ; ExceptionAttribute ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { super ( classFileBytes , constantPool , offset ) ; this . exceptionsNumber = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; int exceptionLength = this . exceptionsNumber ; this . exceptionNames = CharOperation . NO_CHAR_CHAR ; this . exceptionIndexes = org . eclipse . jdt . internal . compiler . util . Util . EMPTY_INT_ARRAY ; if ( exceptionLength != <NUM_LIT:0> ) { this . exceptionNames = new char [ exceptionLength ] [ ] ; this . exceptionIndexes = new int [ exceptionLength ] ; } int readOffset = <NUM_LIT:8> ; IConstantPoolEntry constantPoolEntry ; for ( int i = <NUM_LIT:0> ; i < exceptionLength ; i ++ ) { this . exceptionIndexes [ i ] = u2At ( classFileBytes , readOffset , offset ) ; constantPoolEntry = constantPool . decodeEntry ( this . exceptionIndexes [ i ] ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Class ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . exceptionNames [ i ] = constantPoolEntry . getClassInfoName ( ) ; readOffset += <NUM_LIT:2> ; } } public int [ ] getExceptionIndexes ( ) { return this . exceptionIndexes ; } public char [ ] [ ] getExceptionNames ( ) { return this . exceptionNames ; } public int getExceptionsNumber ( ) { return this . exceptionsNumber ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IConstantPoolConstant ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; import org . eclipse . jdt . core . util . IExceptionTableEntry ; public class ExceptionTableEntry extends ClassFileStruct implements IExceptionTableEntry { private int startPC ; private int endPC ; private int handlerPC ; private int catchTypeIndex ; private char [ ] catchType ; ExceptionTableEntry ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { this . startPC = u2At ( classFileBytes , <NUM_LIT:0> , offset ) ; this . endPC = u2At ( classFileBytes , <NUM_LIT:2> , offset ) ; this . handlerPC = u2At ( classFileBytes , <NUM_LIT:4> , offset ) ; this . catchTypeIndex = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; if ( this . catchTypeIndex != <NUM_LIT:0> ) { IConstantPoolEntry constantPoolEntry = constantPool . decodeEntry ( this . catchTypeIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Class ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . catchType = constantPoolEntry . getClassInfoName ( ) ; } } public int getStartPC ( ) { return this . startPC ; } public int getEndPC ( ) { return this . endPC ; } public int getHandlerPC ( ) { return this . handlerPC ; } public int getCatchTypeIndex ( ) { return this . catchTypeIndex ; } public char [ ] getCatchType ( ) { return this . catchType ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import java . lang . ref . ReferenceQueue ; import java . lang . ref . WeakReference ; public class WeakHashSet { public static class HashableWeakReference extends WeakReference { public int hashCode ; public HashableWeakReference ( Object referent , ReferenceQueue queue ) { super ( referent , queue ) ; this . hashCode = referent . hashCode ( ) ; } public boolean equals ( Object obj ) { if ( ! ( obj instanceof HashableWeakReference ) ) return false ; Object referent = get ( ) ; Object other = ( ( HashableWeakReference ) obj ) . get ( ) ; if ( referent == null ) return other == null ; return referent . equals ( other ) ; } public int hashCode ( ) { return this . hashCode ; } public String toString ( ) { Object referent = get ( ) ; if ( referent == null ) return "<STR_LIT>" + this . hashCode + "<STR_LIT>" ; return "<STR_LIT>" + this . hashCode + "<STR_LIT>" + referent . toString ( ) ; } } HashableWeakReference [ ] values ; public int elementSize ; int threshold ; ReferenceQueue referenceQueue = new ReferenceQueue ( ) ; public WeakHashSet ( ) { this ( <NUM_LIT:5> ) ; } public WeakHashSet ( int size ) { this . elementSize = <NUM_LIT:0> ; this . threshold = size ; int extraRoom = ( int ) ( size * <NUM_LIT> ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . values = new HashableWeakReference [ extraRoom ] ; } public Object add ( Object obj ) { cleanupGarbageCollectedValues ( ) ; int valuesLength = this . values . length , index = ( obj . hashCode ( ) & <NUM_LIT> ) % valuesLength ; HashableWeakReference currentValue ; while ( ( currentValue = this . values [ index ] ) != null ) { Object referent ; if ( obj . equals ( referent = currentValue . get ( ) ) ) { return referent ; } if ( ++ index == valuesLength ) { index = <NUM_LIT:0> ; } } this . values [ index ] = new HashableWeakReference ( obj , this . referenceQueue ) ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return obj ; } private void addValue ( HashableWeakReference value ) { Object obj = value . get ( ) ; if ( obj == null ) return ; int valuesLength = this . values . length ; int index = ( value . hashCode & <NUM_LIT> ) % valuesLength ; HashableWeakReference currentValue ; while ( ( currentValue = this . values [ index ] ) != null ) { if ( obj . equals ( currentValue . get ( ) ) ) { return ; } if ( ++ index == valuesLength ) { index = <NUM_LIT:0> ; } } this . values [ index ] = value ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; } private void cleanupGarbageCollectedValues ( ) { HashableWeakReference toBeRemoved ; while ( ( toBeRemoved = ( HashableWeakReference ) this . referenceQueue . poll ( ) ) != null ) { int hashCode = toBeRemoved . hashCode ; int valuesLength = this . values . length ; int index = ( hashCode & <NUM_LIT> ) % valuesLength ; HashableWeakReference currentValue ; while ( ( currentValue = this . values [ index ] ) != null ) { if ( currentValue == toBeRemoved ) { int sameHash = index ; int current ; while ( ( currentValue = this . values [ current = ( sameHash + <NUM_LIT:1> ) % valuesLength ] ) != null && currentValue . hashCode == hashCode ) sameHash = current ; this . values [ index ] = this . values [ sameHash ] ; this . values [ sameHash ] = null ; this . elementSize -- ; break ; } if ( ++ index == valuesLength ) { index = <NUM_LIT:0> ; } } } } public boolean contains ( Object obj ) { return get ( obj ) != null ; } public Object get ( Object obj ) { cleanupGarbageCollectedValues ( ) ; int valuesLength = this . values . length ; int index = ( obj . hashCode ( ) & <NUM_LIT> ) % valuesLength ; HashableWeakReference currentValue ; while ( ( currentValue = this . values [ index ] ) != null ) { Object referent ; if ( obj . equals ( referent = currentValue . get ( ) ) ) { return referent ; } if ( ++ index == valuesLength ) { index = <NUM_LIT:0> ; } } return null ; } private void rehash ( ) { WeakHashSet newHashSet = new WeakHashSet ( this . elementSize * <NUM_LIT:2> ) ; newHashSet . referenceQueue = this . referenceQueue ; HashableWeakReference currentValue ; for ( int i = <NUM_LIT:0> , length = this . values . length ; i < length ; i ++ ) if ( ( currentValue = this . values [ i ] ) != null ) newHashSet . addValue ( currentValue ) ; this . values = newHashSet . values ; this . threshold = newHashSet . threshold ; this . elementSize = newHashSet . elementSize ; } public Object remove ( Object obj ) { cleanupGarbageCollectedValues ( ) ; int valuesLength = this . values . length ; int index = ( obj . hashCode ( ) & <NUM_LIT> ) % valuesLength ; HashableWeakReference currentValue ; while ( ( currentValue = this . values [ index ] ) != null ) { Object referent ; if ( obj . equals ( referent = currentValue . get ( ) ) ) { this . elementSize -- ; this . values [ index ] = null ; rehash ( ) ; return referent ; } if ( ++ index == valuesLength ) { index = <NUM_LIT:0> ; } } return null ; } public int size ( ) { return this . elementSize ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT:{>" ) ; for ( int i = <NUM_LIT:0> , length = this . values . length ; i < length ; i ++ ) { HashableWeakReference value = this . values [ i ] ; if ( value != null ) { Object ref = value . get ( ) ; if ( ref != null ) { buffer . append ( ref . toString ( ) ) ; buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } } } buffer . append ( "<STR_LIT:}>" ) ; return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . ILocalVariableTypeTableAttribute ; import org . eclipse . jdt . core . util . ILocalVariableTypeTableEntry ; public class LocalVariableTypeAttribute extends ClassFileAttribute implements ILocalVariableTypeTableAttribute { private static final ILocalVariableTypeTableEntry [ ] NO_ENTRIES = new ILocalVariableTypeTableEntry [ <NUM_LIT:0> ] ; private int localVariableTypeTableLength ; private ILocalVariableTypeTableEntry [ ] localVariableTypeTableEntries ; public LocalVariableTypeAttribute ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { super ( classFileBytes , constantPool , offset ) ; final int length = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; this . localVariableTypeTableLength = length ; if ( length != <NUM_LIT:0> ) { int readOffset = <NUM_LIT:8> ; this . localVariableTypeTableEntries = new ILocalVariableTypeTableEntry [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . localVariableTypeTableEntries [ i ] = new LocalVariableTypeTableEntry ( classFileBytes , constantPool , offset + readOffset ) ; readOffset += <NUM_LIT:10> ; } } else { this . localVariableTypeTableEntries = NO_ENTRIES ; } } public ILocalVariableTypeTableEntry [ ] getLocalVariableTypeTable ( ) { return this . localVariableTypeTableEntries ; } public int getLocalVariableTypeTableLength ( ) { return this . localVariableTypeTableLength ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IConstantPoolConstant ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; import org . eclipse . jdt . core . util . ILocalVariableTableEntry ; public class LocalVariableTableEntry extends ClassFileStruct implements ILocalVariableTableEntry { private int startPC ; private int length ; private int nameIndex ; private int descriptorIndex ; private char [ ] name ; private char [ ] descriptor ; private int index ; public LocalVariableTableEntry ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { this . startPC = u2At ( classFileBytes , <NUM_LIT:0> , offset ) ; this . length = u2At ( classFileBytes , <NUM_LIT:2> , offset ) ; this . nameIndex = u2At ( classFileBytes , <NUM_LIT:4> , offset ) ; this . descriptorIndex = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; this . index = u2At ( classFileBytes , <NUM_LIT:8> , offset ) ; IConstantPoolEntry constantPoolEntry = constantPool . decodeEntry ( this . nameIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . name = constantPoolEntry . getUtf8Value ( ) ; constantPoolEntry = constantPool . decodeEntry ( this . descriptorIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . descriptor = constantPoolEntry . getUtf8Value ( ) ; } public int getStartPC ( ) { return this . startPC ; } public int getLength ( ) { return this . length ; } public int getNameIndex ( ) { return this . nameIndex ; } public int getDescriptorIndex ( ) { return this . descriptorIndex ; } public int getIndex ( ) { return this . index ; } public char [ ] getName ( ) { return this . name ; } public char [ ] getDescriptor ( ) { return this . descriptor ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; public class KeyKind extends BindingKeyParser { public static final int F_TYPE = <NUM_LIT> ; public static final int F_METHOD = <NUM_LIT> ; public static final int F_FIELD = <NUM_LIT> ; public static final int F_TYPE_PARAMETER = <NUM_LIT> ; public static final int F_LOCAL_VAR = <NUM_LIT> ; public static final int F_MEMBER = <NUM_LIT> ; public static final int F_LOCAL = <NUM_LIT> ; public static final int F_PARAMETERIZED_TYPE = <NUM_LIT> ; public static final int F_RAW_TYPE = <NUM_LIT> ; public static final int F_WILDCARD_TYPE = <NUM_LIT> ; public static final int F_PARAMETERIZED_METHOD = <NUM_LIT> ; public static final int F_CAPTURE = <NUM_LIT> ; public static final int F_CONSTRUCTOR = <NUM_LIT> ; public int flags = <NUM_LIT:0> ; private KeyKind innerKeyKind ; public KeyKind ( BindingKeyParser parser ) { super ( parser ) ; } public KeyKind ( String key ) { super ( key ) ; } public void consumeBaseType ( char [ ] baseTypeSig ) { this . flags |= F_TYPE ; } public void consumeCapture ( int position ) { this . flags |= F_CAPTURE ; } public void consumeField ( char [ ] fieldName ) { this . flags |= F_FIELD ; } public void consumeLocalType ( char [ ] uniqueKey ) { this . flags |= F_LOCAL ; } public void consumeLocalVar ( char [ ] varName , int occurrenceCount ) { this . flags |= F_LOCAL_VAR ; } public void consumeMemberType ( char [ ] simpleTypeName ) { this . flags |= F_MEMBER ; } public void consumeMethod ( char [ ] selector , char [ ] signature ) { this . flags |= F_METHOD ; if ( selector . length == <NUM_LIT:0> ) this . flags |= F_CONSTRUCTOR ; } public void consumeParameterizedGenericMethod ( ) { this . flags |= F_PARAMETERIZED_METHOD ; } public void consumeParameterizedType ( char [ ] simpleTypeName , boolean isRaw ) { this . flags |= isRaw ? F_RAW_TYPE : F_PARAMETERIZED_TYPE ; } public void consumeParser ( BindingKeyParser parser ) { this . innerKeyKind = ( KeyKind ) parser ; } public void consumeRawType ( ) { this . flags |= F_RAW_TYPE ; } public void consumeTopLevelType ( ) { this . flags |= F_TYPE ; } public void consumeTypeParameter ( char [ ] typeParameterName ) { this . flags |= F_TYPE_PARAMETER ; } public void consumeTypeWithCapture ( ) { this . flags = this . innerKeyKind . flags ; } public void consumeWildCard ( int kind ) { this . flags |= F_WILDCARD_TYPE ; } public BindingKeyParser newParser ( ) { return new KeyKind ( this ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . compiler . CharOperation ; public final class HashSetOfCharArrayArray implements Cloneable { public char [ ] [ ] [ ] set ; public int elementSize ; int threshold ; public HashSetOfCharArrayArray ( ) { this ( <NUM_LIT> ) ; } public HashSetOfCharArrayArray ( int size ) { this . elementSize = <NUM_LIT:0> ; this . threshold = size ; int extraRoom = ( int ) ( size * <NUM_LIT> ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . set = new char [ extraRoom ] [ ] [ ] ; } public Object clone ( ) throws CloneNotSupportedException { HashSetOfCharArrayArray result = ( HashSetOfCharArrayArray ) super . clone ( ) ; result . elementSize = this . elementSize ; result . threshold = this . threshold ; int length = this . set . length ; result . set = new char [ length ] [ ] [ ] ; System . arraycopy ( this . set , <NUM_LIT:0> , result . set , <NUM_LIT:0> , length ) ; return result ; } public boolean contains ( char [ ] [ ] array ) { int length = this . set . length ; int index = hashCode ( array ) % length ; int arrayLength = array . length ; char [ ] [ ] currentArray ; while ( ( currentArray = this . set [ index ] ) != null ) { if ( currentArray . length == arrayLength && CharOperation . equals ( currentArray , array ) ) return true ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return false ; } private int hashCode ( char [ ] [ ] element ) { return hashCode ( element , element . length ) ; } private int hashCode ( char [ ] [ ] element , int length ) { int hash = <NUM_LIT:0> ; for ( int i = length - <NUM_LIT:1> ; i >= <NUM_LIT:0> ; i -- ) hash = Util . combineHashCodes ( hash , CharOperation . hashCode ( element [ i ] ) ) ; return hash & <NUM_LIT> ; } public char [ ] [ ] add ( char [ ] [ ] array ) { int length = this . set . length ; int index = hashCode ( array ) % length ; int arrayLength = array . length ; char [ ] [ ] currentArray ; while ( ( currentArray = this . set [ index ] ) != null ) { if ( currentArray . length == arrayLength && CharOperation . equals ( currentArray , array ) ) return this . set [ index ] = array ; if ( ++ index == length ) { index = <NUM_LIT:0> ; } } this . set [ index ] = array ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return array ; } public char [ ] [ ] remove ( char [ ] [ ] array ) { int length = this . set . length ; int index = hashCode ( array ) % length ; int arrayLength = array . length ; char [ ] [ ] currentArray ; while ( ( currentArray = this . set [ index ] ) != null ) { if ( currentArray . length == arrayLength && CharOperation . equals ( currentArray , array ) ) { char [ ] [ ] existing = this . set [ index ] ; this . elementSize -- ; this . set [ index ] = null ; rehash ( ) ; return existing ; } if ( ++ index == length ) { index = <NUM_LIT:0> ; } } return null ; } private void rehash ( ) { HashSetOfCharArrayArray newHashSet = new HashSetOfCharArrayArray ( this . elementSize * <NUM_LIT:2> ) ; char [ ] [ ] currentArray ; for ( int i = this . set . length ; -- i >= <NUM_LIT:0> ; ) if ( ( currentArray = this . set [ i ] ) != null ) newHashSet . add ( currentArray ) ; this . set = newHashSet . set ; this . threshold = newHashSet . threshold ; } public int size ( ) { return this . elementSize ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; for ( int i = <NUM_LIT:0> , length = this . set . length ; i < length ; i ++ ) { char [ ] [ ] arrayArray = this . set [ i ] ; if ( arrayArray != null ) { buffer . append ( "<STR_LIT:{>" ) ; for ( int j = <NUM_LIT:0> , length2 = arrayArray . length ; j < length2 ; j ++ ) { char [ ] array = arrayArray [ j ] ; buffer . append ( '<CHAR_LIT>' ) ; for ( int k = <NUM_LIT:0> , length3 = array . length ; k < length3 ; k ++ ) { buffer . append ( '<STR_LIT>' ) ; buffer . append ( array [ k ] ) ; buffer . append ( '<STR_LIT>' ) ; if ( k != length3 - <NUM_LIT:1> ) buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } buffer . append ( '<CHAR_LIT:}>' ) ; if ( j != length2 - <NUM_LIT:1> ) buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } buffer . append ( "<STR_LIT:}>" ) ; if ( i != length - <NUM_LIT:1> ) buffer . append ( '<STR_LIT:\n>' ) ; } } return buffer . toString ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IStackMapFrame ; import org . eclipse . jdt . core . util . IVerificationTypeInfo ; public class DefaultStackMapFrame extends ClassFileStruct implements IStackMapFrame { private static final IVerificationTypeInfo [ ] EMPTY_LOCALS_OR_STACK_ITEMS = new IVerificationTypeInfo [ <NUM_LIT:0> ] ; private int readOffset ; private int numberOfLocals ; private int numberOfStackItems ; private IVerificationTypeInfo [ ] locals ; private IVerificationTypeInfo [ ] stackItems ; private int offsetDelta ; public DefaultStackMapFrame ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { this . offsetDelta = u2At ( classFileBytes , <NUM_LIT:0> , offset ) ; int tempLocals = u2At ( classFileBytes , <NUM_LIT:2> , offset ) ; this . numberOfLocals = tempLocals ; this . readOffset = <NUM_LIT:4> ; if ( tempLocals != <NUM_LIT:0> ) { this . locals = new IVerificationTypeInfo [ tempLocals ] ; for ( int i = <NUM_LIT:0> ; i < tempLocals ; i ++ ) { VerificationInfo verificationInfo = new VerificationInfo ( classFileBytes , constantPool , offset + this . readOffset ) ; this . locals [ i ] = verificationInfo ; this . readOffset += verificationInfo . sizeInBytes ( ) ; } } else { this . locals = EMPTY_LOCALS_OR_STACK_ITEMS ; } int tempStackItems = u2At ( classFileBytes , this . readOffset , offset ) ; this . readOffset += <NUM_LIT:2> ; this . numberOfStackItems = tempStackItems ; if ( tempStackItems != <NUM_LIT:0> ) { this . stackItems = new IVerificationTypeInfo [ tempStackItems ] ; for ( int i = <NUM_LIT:0> ; i < tempStackItems ; i ++ ) { VerificationInfo verificationInfo = new VerificationInfo ( classFileBytes , constantPool , offset + this . readOffset ) ; this . stackItems [ i ] = verificationInfo ; this . readOffset += verificationInfo . sizeInBytes ( ) ; } } else { this . stackItems = EMPTY_LOCALS_OR_STACK_ITEMS ; } } int sizeInBytes ( ) { return this . readOffset ; } public int getFrameType ( ) { return <NUM_LIT:255> ; } public IVerificationTypeInfo [ ] getLocals ( ) { return this . locals ; } public int getNumberOfLocals ( ) { return this . numberOfLocals ; } public int getNumberOfStackItems ( ) { return this . numberOfStackItems ; } public int getOffsetDelta ( ) { return this . offsetDelta ; } public IVerificationTypeInfo [ ] getStackItems ( ) { return this . stackItems ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IAnnotation ; import org . eclipse . jdt . core . util . IAnnotationComponentValue ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IConstantPoolConstant ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; public class AnnotationComponentValue extends ClassFileStruct implements IAnnotationComponentValue { private static final IAnnotationComponentValue [ ] NO_VALUES = new AnnotationComponentValue [ <NUM_LIT:0> ] ; private IAnnotationComponentValue [ ] annotationComponentValues ; private IAnnotation annotationValue ; private IConstantPoolEntry classInfo ; private int classFileInfoIndex ; private IConstantPoolEntry constantValue ; private int constantValueIndex ; private int enumConstantTypeNameIndex ; private int enumConstantNameIndex ; private char [ ] enumConstantTypeName ; private char [ ] enumConstantName ; private int readOffset ; private int tag ; private int valuesNumber ; public AnnotationComponentValue ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { this . classFileInfoIndex = - <NUM_LIT:1> ; this . constantValueIndex = - <NUM_LIT:1> ; this . enumConstantTypeNameIndex = - <NUM_LIT:1> ; this . enumConstantNameIndex = - <NUM_LIT:1> ; final int t = u1At ( classFileBytes , <NUM_LIT:0> , offset ) ; this . tag = t ; this . readOffset = <NUM_LIT:1> ; switch ( t ) { 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>' : final int constantIndex = u2At ( classFileBytes , this . readOffset , offset ) ; this . constantValueIndex = constantIndex ; if ( constantIndex != <NUM_LIT:0> ) { IConstantPoolEntry constantPoolEntry = constantPool . decodeEntry ( constantIndex ) ; switch ( constantPoolEntry . getKind ( ) ) { case IConstantPoolConstant . CONSTANT_Long : case IConstantPoolConstant . CONSTANT_Float : case IConstantPoolConstant . CONSTANT_Double : case IConstantPoolConstant . CONSTANT_Integer : case IConstantPoolConstant . CONSTANT_Utf8 : break ; default : throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . constantValue = constantPoolEntry ; } this . readOffset += <NUM_LIT:2> ; break ; case '<CHAR_LIT:e>' : int index = u2At ( classFileBytes , this . readOffset , offset ) ; this . enumConstantTypeNameIndex = index ; if ( index != <NUM_LIT:0> ) { IConstantPoolEntry constantPoolEntry = constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . enumConstantTypeName = constantPoolEntry . getUtf8Value ( ) ; } this . readOffset += <NUM_LIT:2> ; index = u2At ( classFileBytes , this . readOffset , offset ) ; this . enumConstantNameIndex = index ; if ( index != <NUM_LIT:0> ) { IConstantPoolEntry constantPoolEntry = constantPool . decodeEntry ( index ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . enumConstantName = constantPoolEntry . getUtf8Value ( ) ; } this . readOffset += <NUM_LIT:2> ; break ; case '<CHAR_LIT:c>' : final int classFileIndex = u2At ( classFileBytes , this . readOffset , offset ) ; this . classFileInfoIndex = classFileIndex ; if ( classFileIndex != <NUM_LIT:0> ) { IConstantPoolEntry constantPoolEntry = constantPool . decodeEntry ( classFileIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . classInfo = constantPoolEntry ; } this . readOffset += <NUM_LIT:2> ; break ; case '<CHAR_LIT>' : Annotation annotation = new Annotation ( classFileBytes , constantPool , this . readOffset + offset ) ; this . annotationValue = annotation ; this . readOffset += annotation . sizeInBytes ( ) ; break ; case '<CHAR_LIT:[>' : final int numberOfValues = u2At ( classFileBytes , this . readOffset , offset ) ; this . valuesNumber = numberOfValues ; this . readOffset += <NUM_LIT:2> ; if ( numberOfValues != <NUM_LIT:0> ) { this . annotationComponentValues = new IAnnotationComponentValue [ numberOfValues ] ; for ( int i = <NUM_LIT:0> ; i < numberOfValues ; i ++ ) { AnnotationComponentValue value = new AnnotationComponentValue ( classFileBytes , constantPool , offset + this . readOffset ) ; this . annotationComponentValues [ i ] = value ; this . readOffset += value . sizeInBytes ( ) ; } } else { this . annotationComponentValues = NO_VALUES ; } break ; } } public IAnnotationComponentValue [ ] getAnnotationComponentValues ( ) { return this . annotationComponentValues ; } public IAnnotation getAnnotationValue ( ) { return this . annotationValue ; } public IConstantPoolEntry getClassInfo ( ) { return this . classInfo ; } public int getClassInfoIndex ( ) { return this . classFileInfoIndex ; } public IConstantPoolEntry getConstantValue ( ) { return this . constantValue ; } public int getConstantValueIndex ( ) { return this . constantValueIndex ; } public char [ ] getEnumConstantName ( ) { return this . enumConstantName ; } public int getEnumConstantNameIndex ( ) { return this . enumConstantNameIndex ; } public char [ ] getEnumConstantTypeName ( ) { return this . enumConstantTypeName ; } public int getEnumConstantTypeNameIndex ( ) { return this . enumConstantTypeNameIndex ; } public int getTag ( ) { return this . tag ; } public int getValuesNumber ( ) { return this . valuesNumber ; } int sizeInBytes ( ) { return this . readOffset ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IParameterAnnotation ; import org . eclipse . jdt . core . util . IRuntimeInvisibleParameterAnnotationsAttribute ; public class RuntimeInvisibleParameterAnnotationsAttribute extends ClassFileAttribute implements IRuntimeInvisibleParameterAnnotationsAttribute { private static final IParameterAnnotation [ ] NO_ENTRIES = new IParameterAnnotation [ <NUM_LIT:0> ] ; private IParameterAnnotation [ ] parameterAnnotations ; private int parametersNumber ; public RuntimeInvisibleParameterAnnotationsAttribute ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { super ( classFileBytes , constantPool , offset ) ; final int length = u1At ( classFileBytes , <NUM_LIT:6> , offset ) ; this . parametersNumber = length ; if ( length != <NUM_LIT:0> ) { int readOffset = <NUM_LIT:7> ; this . parameterAnnotations = new IParameterAnnotation [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { ParameterAnnotation parameterAnnotation = new ParameterAnnotation ( classFileBytes , constantPool , offset + readOffset ) ; this . parameterAnnotations [ i ] = parameterAnnotation ; readOffset += parameterAnnotation . sizeInBytes ( ) ; } } else { this . parameterAnnotations = NO_ENTRIES ; } } public IParameterAnnotation [ ] getParameterAnnotations ( ) { return this . parameterAnnotations ; } public int getParametersNumber ( ) { return this . parametersNumber ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IAttributeNamesConstants ; import org . eclipse . jdt . core . util . IClassFileAttribute ; import org . eclipse . jdt . core . util . IClassFileReader ; import org . eclipse . jdt . core . util . ICodeAttribute ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IConstantPoolConstant ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; import org . eclipse . jdt . core . util . IExceptionAttribute ; import org . eclipse . jdt . core . util . IMethodInfo ; import org . eclipse . jdt . core . util . IModifierConstants ; public class MethodInfo extends ClassFileStruct implements IMethodInfo { private int accessFlags ; private int attributeBytes ; private IClassFileAttribute [ ] attributes ; private int attributesCount ; private ICodeAttribute codeAttribute ; private char [ ] descriptor ; private int descriptorIndex ; private IExceptionAttribute exceptionAttribute ; private boolean isDeprecated ; private boolean isSynthetic ; private char [ ] name ; private int nameIndex ; public MethodInfo ( byte classFileBytes [ ] , IConstantPool constantPool , int offset , int decodingFlags ) throws ClassFormatException { boolean no_code_attribute = ( decodingFlags & IClassFileReader . METHOD_BODIES ) == <NUM_LIT:0> ; final int flags = u2At ( classFileBytes , <NUM_LIT:0> , offset ) ; this . accessFlags = flags ; if ( ( flags & IModifierConstants . ACC_SYNTHETIC ) != <NUM_LIT:0> ) { this . isSynthetic = true ; } this . nameIndex = u2At ( classFileBytes , <NUM_LIT:2> , offset ) ; IConstantPoolEntry constantPoolEntry = constantPool . decodeEntry ( this . nameIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . name = constantPoolEntry . getUtf8Value ( ) ; this . descriptorIndex = u2At ( classFileBytes , <NUM_LIT:4> , offset ) ; constantPoolEntry = constantPool . decodeEntry ( this . descriptorIndex ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } this . descriptor = constantPoolEntry . getUtf8Value ( ) ; this . attributesCount = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; this . attributes = ClassFileAttribute . NO_ATTRIBUTES ; if ( this . attributesCount != <NUM_LIT:0> ) { if ( no_code_attribute && ! isAbstract ( ) && ! isNative ( ) ) { if ( this . attributesCount != <NUM_LIT:1> ) { this . attributes = new IClassFileAttribute [ this . attributesCount - <NUM_LIT:1> ] ; } } else { this . attributes = new IClassFileAttribute [ this . attributesCount ] ; } } int attributesIndex = <NUM_LIT:0> ; int readOffset = <NUM_LIT:8> ; for ( int i = <NUM_LIT:0> ; i < this . attributesCount ; i ++ ) { constantPoolEntry = constantPool . decodeEntry ( u2At ( classFileBytes , readOffset , offset ) ) ; if ( constantPoolEntry . getKind ( ) != IConstantPoolConstant . CONSTANT_Utf8 ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } char [ ] attributeName = constantPoolEntry . getUtf8Value ( ) ; if ( equals ( attributeName , IAttributeNamesConstants . DEPRECATED ) ) { this . isDeprecated = true ; this . attributes [ attributesIndex ++ ] = new ClassFileAttribute ( classFileBytes , constantPool , offset + readOffset ) ; } else if ( equals ( attributeName , IAttributeNamesConstants . SYNTHETIC ) ) { this . isSynthetic = true ; this . attributes [ attributesIndex ++ ] = new ClassFileAttribute ( classFileBytes , constantPool , offset + readOffset ) ; } else if ( equals ( attributeName , IAttributeNamesConstants . CODE ) ) { if ( ! no_code_attribute ) { this . codeAttribute = new CodeAttribute ( classFileBytes , constantPool , offset + readOffset ) ; this . attributes [ attributesIndex ++ ] = this . codeAttribute ; } } else if ( equals ( attributeName , IAttributeNamesConstants . EXCEPTIONS ) ) { this . exceptionAttribute = new ExceptionAttribute ( classFileBytes , constantPool , offset + readOffset ) ; this . attributes [ attributesIndex ++ ] = this . exceptionAttribute ; } else if ( equals ( attributeName , IAttributeNamesConstants . SIGNATURE ) ) { this . attributes [ attributesIndex ++ ] = new SignatureAttribute ( classFileBytes , constantPool , offset + readOffset ) ; } else if ( equals ( attributeName , IAttributeNamesConstants . RUNTIME_VISIBLE_ANNOTATIONS ) ) { this . attributes [ attributesIndex ++ ] = new RuntimeVisibleAnnotationsAttribute ( classFileBytes , constantPool , offset + readOffset ) ; } else if ( equals ( attributeName , IAttributeNamesConstants . RUNTIME_INVISIBLE_ANNOTATIONS ) ) { this . attributes [ attributesIndex ++ ] = new RuntimeInvisibleAnnotationsAttribute ( classFileBytes , constantPool , offset + readOffset ) ; } else if ( equals ( attributeName , IAttributeNamesConstants . RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS ) ) { this . attributes [ attributesIndex ++ ] = new RuntimeVisibleParameterAnnotationsAttribute ( classFileBytes , constantPool , offset + readOffset ) ; } else if ( equals ( attributeName , IAttributeNamesConstants . RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS ) ) { this . attributes [ attributesIndex ++ ] = new RuntimeInvisibleParameterAnnotationsAttribute ( classFileBytes , constantPool , offset + readOffset ) ; } else if ( equals ( attributeName , IAttributeNamesConstants . ANNOTATION_DEFAULT ) ) { this . attributes [ attributesIndex ++ ] = new AnnotationDefaultAttribute ( classFileBytes , constantPool , offset + readOffset ) ; } else { this . attributes [ attributesIndex ++ ] = new ClassFileAttribute ( classFileBytes , constantPool , offset + readOffset ) ; } readOffset += ( <NUM_LIT:6> + u4At ( classFileBytes , readOffset + <NUM_LIT:2> , offset ) ) ; } this . attributeBytes = readOffset ; } public int getAccessFlags ( ) { return this . accessFlags ; } public int getAttributeCount ( ) { return this . attributesCount ; } public IClassFileAttribute [ ] getAttributes ( ) { return this . attributes ; } public ICodeAttribute getCodeAttribute ( ) { return this . codeAttribute ; } public char [ ] getDescriptor ( ) { return this . descriptor ; } public int getDescriptorIndex ( ) { return this . descriptorIndex ; } public IExceptionAttribute getExceptionAttribute ( ) { return this . exceptionAttribute ; } public char [ ] getName ( ) { return this . name ; } public int getNameIndex ( ) { return this . nameIndex ; } private boolean isAbstract ( ) { return ( this . accessFlags & IModifierConstants . ACC_ABSTRACT ) != <NUM_LIT:0> ; } public boolean isClinit ( ) { return this . name [ <NUM_LIT:0> ] == '<CHAR_LIT>' && this . name . length == <NUM_LIT:8> ; } public boolean isConstructor ( ) { return this . name [ <NUM_LIT:0> ] == '<CHAR_LIT>' && this . name . length == <NUM_LIT:6> ; } public boolean isDeprecated ( ) { return this . isDeprecated ; } private boolean isNative ( ) { return ( this . accessFlags & IModifierConstants . ACC_NATIVE ) != <NUM_LIT:0> ; } public boolean isSynthetic ( ) { return this . isSynthetic ; } int sizeInBytes ( ) { return this . attributeBytes ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import java . text . MessageFormat ; import org . eclipse . osgi . util . NLS ; public final class Messages extends NLS { private static final String BUNDLE_NAME = "<STR_LIT>" ; private Messages ( ) { } public static String hierarchy_nullProject ; public static String hierarchy_nullRegion ; public static String hierarchy_nullFocusType ; public static String hierarchy_creating ; public static String hierarchy_creatingOnType ; public static String element_doesNotExist ; public static String element_notOnClasspath ; public static String element_invalidClassFileName ; public static String element_reconciling ; public static String element_attachingSource ; public static String element_invalidResourceForProject ; public static String element_nullName ; public static String element_nullType ; public static String element_illegalParent ; public static String javamodel_initialization ; public static String javamodel_initializing_delta_state ; public static String javamodel_building_after_upgrade ; public static String javamodel_configuring ; public static String javamodel_configuring_classpath_containers ; public static String javamodel_configuring_searchengine ; public static String javamodel_getting_build_state_number ; public static String javamodel_refreshing_external_jars ; public static String javamodel_resetting_source_attachment_properties ; public static String operation_needElements ; public static String operation_needName ; public static String operation_needPath ; public static String operation_needAbsolutePath ; public static String operation_needString ; public static String operation_notSupported ; public static String operation_cancelled ; public static String operation_nullContainer ; public static String operation_nullName ; public static String operation_copyElementProgress ; public static String operation_moveElementProgress ; public static String operation_renameElementProgress ; public static String operation_copyResourceProgress ; public static String operation_moveResourceProgress ; public static String operation_renameResourceProgress ; public static String operation_createUnitProgress ; public static String operation_createFieldProgress ; public static String operation_createImportsProgress ; public static String operation_createInitializerProgress ; public static String operation_createMethodProgress ; public static String operation_createPackageProgress ; public static String operation_createPackageFragmentProgress ; public static String operation_createTypeProgress ; public static String operation_deleteElementProgress ; public static String operation_deleteResourceProgress ; public static String operation_cannotRenameDefaultPackage ; public static String operation_pathOutsideProject ; public static String operation_sortelements ; public static String workingCopy_commit ; public static String buffer_closed ; public static String build_preparingBuild ; public static String build_readStateProgress ; public static String build_saveStateProgress ; public static String build_saveStateComplete ; public static String build_readingDelta ; public static String build_analyzingDeltas ; public static String build_analyzingSources ; public static String build_cleaningOutput ; public static String build_copyingResources ; public static String build_compiling ; public static String build_foundHeader ; public static String build_fixedHeader ; public static String build_oneError ; public static String build_oneWarning ; public static String build_multipleErrors ; public static String build_multipleWarnings ; public static String build_done ; public static String build_wrongFileFormat ; public static String build_cannotSaveState ; public static String build_cannotSaveStates ; public static String build_initializationError ; public static String build_serializationError ; public static String build_classFileCollision ; public static String build_duplicateClassFile ; public static String build_duplicateResource ; public static String build_inconsistentClassFile ; public static String build_inconsistentProject ; public static String build_incompleteClassPath ; public static String build_missingSourceFile ; public static String build_prereqProjectHasClasspathProblems ; public static String build_prereqProjectMustBeRebuilt ; public static String build_abortDueToClasspathProblems ; public static String status_cannot_retrieve_attached_javadoc ; public static String status_cannotUseDeviceOnPath ; public static String status_coreException ; public static String status_defaultPackageReadOnly ; public static String status_evaluationError ; public static String status_JDOMError ; public static String status_IOException ; public static String status_indexOutOfBounds ; public static String status_invalidContents ; public static String status_invalidDestination ; public static String status_invalidName ; public static String status_invalidPackage ; public static String status_invalidPath ; public static String status_invalidProject ; public static String status_invalidResource ; public static String status_invalidResourceType ; public static String status_invalidSibling ; public static String status_nameCollision ; public static String status_noLocalContents ; public static String status_OK ; public static String status_readOnly ; public static String status_targetException ; public static String status_unknown_javadoc_format ; public static String status_updateConflict ; public static String classpath_buildPath ; public static String classpath_cannotNestEntryInEntry ; public static String classpath_cannotNestEntryInEntryNoExclusion ; public static String classpath_cannotNestEntryInLibrary ; public static String classpath_cannotNestEntryInOutput ; public static String classpath_cannotNestOutputInEntry ; public static String classpath_cannotNestOutputInOutput ; public static String classpath_cannotReadClasspathFile ; public static String classpath_cannotReferToItself ; public static String classpath_cannotUseDistinctSourceFolderAsOutput ; public static String classpath_cannotUseLibraryAsOutput ; public static String classpath_closedProject ; public static String classpath_couldNotWriteClasspathFile ; public static String classpath_cycle ; public static String classpath_duplicateEntryPath ; public static String classpath_illegalContainerPath ; public static String classpath_illegalEntryInClasspathFile ; public static String classpath_illegalLibraryPath ; public static String classpath_illegalLibraryPathInContainer ; public static String classpath_illegalLibraryArchive ; public static String classpath_illegalExternalFolder ; public static String classpath_illegalExternalFolderInContainer ; public static String classpath_illegalProjectPath ; public static String classpath_illegalSourceFolderPath ; public static String classpath_illegalVariablePath ; public static String classpath_invalidClasspathInClasspathFile ; public static String classpath_invalidContainer ; public static String classpath_mustEndWithSlash ; public static String classpath_unboundContainerPath ; public static String classpath_unboundLibrary ; public static String classpath_userLibraryInfo ; public static String classpath_containerInfo ; public static String classpath_unboundLibraryInContainer ; public static String classpath_unboundProject ; public static String classpath_settingOutputLocationProgress ; public static String classpath_settingProgress ; public static String classpath_unboundSourceAttachment ; public static String classpath_unboundSourceAttachmentInContainedLibrary ; public static String classpath_unboundSourceFolder ; public static String classpath_unboundVariablePath ; public static String classpath_unknownKind ; public static String classpath_xmlFormatError ; public static String classpath_disabledInclusionExclusionPatterns ; public static String classpath_disabledMultipleOutputLocations ; public static String classpath_incompatibleLibraryJDKLevel ; public static String classpath_incompatibleLibraryJDKLevelInContainer ; public static String classpath_duplicateEntryExtraAttribute ; public static String classpath_deprecated_variable ; public static String file_notFound ; public static String file_badFormat ; public static String path_nullPath ; public static String path_mustBeAbsolute ; public static String cache_invalidLoadFactor ; public static String savedState_jobName ; public static String refreshing_external_folders ; public static String convention_unit_nullName ; public static String convention_unit_notJavaName ; public static String convention_classFile_nullName ; public static String convention_classFile_notClassFileName ; public static String convention_illegalIdentifier ; public static String convention_import_nullImport ; public static String convention_import_unqualifiedImport ; public static String convention_type_nullName ; public static String convention_type_nameWithBlanks ; public static String convention_type_dollarName ; public static String convention_type_lowercaseName ; public static String convention_type_invalidName ; public static String convention_package_nullName ; public static String convention_package_emptyName ; public static String convention_package_dotName ; public static String convention_package_nameWithBlanks ; public static String convention_package_consecutiveDotsName ; public static String convention_package_uppercaseName ; public static String dom_cannotDetail ; public static String dom_nullTypeParameter ; public static String dom_nullNameParameter ; public static String dom_nullReturnType ; public static String dom_nullExceptionType ; public static String dom_mismatchArgNamesAndTypes ; public static String dom_addNullChild ; public static String dom_addIncompatibleChild ; public static String dom_addChildWithParent ; public static String dom_unableAddChild ; public static String dom_addAncestorAsChild ; public static String dom_addNullSibling ; public static String dom_addSiblingBeforeRoot ; public static String dom_addIncompatibleSibling ; public static String dom_addSiblingWithParent ; public static String dom_addAncestorAsSibling ; public static String dom_addNullInterface ; public static String dom_nullInterfaces ; public static String importRewrite_processDescription ; public static String correction_nullRequestor ; public static String correction_nullUnit ; public static String engine_completing ; public static String engine_searching ; public static String engine_searching_indexing ; public static String engine_searching_matching ; public static String exception_wrongFormat ; public static String process_name ; public static String jobmanager_filesToIndex ; public static String jobmanager_indexing ; public static String disassembler_description ; public static String disassembler_opentypedeclaration ; public static String disassembler_closetypedeclaration ; public static String disassembler_parametername ; public static String disassembler_localvariablename ; public static String disassembler_endofmethodheader ; public static String disassembler_begincommentline ; public static String disassembler_fieldhasconstant ; public static String disassembler_endoffieldheader ; public static String disassembler_sourceattributeheader ; public static String disassembler_enclosingmethodheader ; public static String disassembler_exceptiontableheader ; public static String disassembler_linenumberattributeheader ; public static String disassembler_localvariabletableattributeheader ; public static String disassembler_localvariabletypetableattributeheader ; public static String disassembler_arraydimensions ; public static String disassembler_innerattributesheader ; public static String disassembler_inner_class_info_name ; public static String disassembler_outer_class_info_name ; public static String disassembler_inner_name ; public static String disassembler_inner_accessflags ; public static String disassembler_genericattributeheader ; public static String disassembler_signatureattributeheader ; public static String disassembler_indentation ; public static String disassembler_constantpoolindex ; public static String disassembler_space ; public static String disassembler_comma ; public static String disassembler_openinnerclassentry ; public static String disassembler_closeinnerclassentry ; public static String disassembler_deprecated ; public static String disassembler_constantpoolheader ; public static String disassembler_constantpool_class ; public static String disassembler_constantpool_double ; public static String disassembler_constantpool_float ; public static String disassembler_constantpool_integer ; public static String disassembler_constantpool_long ; public static String disassembler_constantpool_string ; public static String disassembler_constantpool_fieldref ; public static String disassembler_constantpool_interfacemethodref ; public static String disassembler_constantpool_methodref ; public static String disassembler_constantpool_name_and_type ; public static String disassembler_constantpool_utf8 ; public static String disassembler_annotationdefaultheader ; public static String disassembler_annotationdefaultvalue ; public static String disassembler_annotationenumvalue ; public static String disassembler_annotationclassvalue ; public static String disassembler_annotationannotationvalue ; public static String disassembler_annotationarrayvaluestart ; public static String disassembler_annotationarrayvalueend ; public static String disassembler_annotationentrystart ; public static String disassembler_annotationentryend ; public static String disassembler_annotationcomponent ; public static String disassembler_runtimevisibleannotationsattributeheader ; public static String disassembler_runtimeinvisibleannotationsattributeheader ; public static String disassembler_runtimevisibleparameterannotationsattributeheader ; public static String disassembler_runtimeinvisibleparameterannotationsattributeheader ; public static String disassembler_parameterannotationentrystart ; public static String disassembler_stackmaptableattributeheader ; public static String disassembler_stackmapattributeheader ; public static String classfileformat_versiondetails ; public static String classfileformat_methoddescriptor ; public static String classfileformat_fieldddescriptor ; public static String classfileformat_stacksAndLocals ; public static String classfileformat_superflagisnotset ; public static String classfileformat_superflagisset ; public static String classfileformat_clinitname ; public static String classformat_classformatexception ; public static String classformat_anewarray ; public static String classformat_checkcast ; public static String classformat_instanceof ; public static String classformat_ldc_w_class ; public static String classformat_ldc_w_float ; public static String classformat_ldc_w_integer ; public static String classformat_ldc_w_string ; public static String classformat_ldc2_w_long ; public static String classformat_ldc2_w_double ; public static String classformat_multianewarray ; public static String classformat_new ; public static String classformat_iinc ; public static String classformat_invokespecial ; public static String classformat_invokeinterface ; public static String classformat_invokestatic ; public static String classformat_invokevirtual ; public static String classformat_invokedynamic ; public static String classformat_getfield ; public static String classformat_getstatic ; public static String classformat_putstatic ; public static String classformat_putfield ; public static String classformat_newarray_boolean ; public static String classformat_newarray_char ; public static String classformat_newarray_float ; public static String classformat_newarray_double ; public static String classformat_newarray_byte ; public static String classformat_newarray_short ; public static String classformat_newarray_int ; public static String classformat_newarray_long ; public static String classformat_store ; public static String classformat_load ; public static String classfileformat_anyexceptionhandler ; public static String classfileformat_exceptiontableentry ; public static String classfileformat_linenumbertableentry ; public static String classfileformat_localvariabletableentry ; public static String classfileformat_versionUnknown ; public static String disassembler_frame_same_locals_1_stack_item_extended ; public static String disassembler_frame_chop ; public static String disassembler_frame_same_frame_extended ; public static String disassembler_frame_append ; public static String disassembler_frame_full_frame ; public static String disassembler_frame_same_frame ; public static String disassembler_frame_same_locals_1_stack_item ; public static String code_assist_internal_error ; static { NLS . initializeMessages ( BUNDLE_NAME , Messages . class ) ; } public static String bind ( String message ) { return bind ( message , null ) ; } public static String bind ( String message , Object binding ) { return bind ( message , new Object [ ] { binding } ) ; } public static String bind ( String message , Object binding1 , Object binding2 ) { return bind ( message , new Object [ ] { binding1 , binding2 } ) ; } public static String bind ( String message , Object [ ] bindings ) { return MessageFormat . format ( message , bindings ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . IConstantPoolEntry ; public class ConstantPoolEntry implements IConstantPoolEntry { private int kind ; private int classInfoNameIndex ; private int classIndex ; private int nameAndTypeIndex ; private int stringIndex ; private char [ ] stringValue ; private int integerValue ; private float floatValue ; private double doubleValue ; private long longValue ; private int nameAndTypeDescriptorIndex ; private int nameAndTypeNameIndex ; private char [ ] className ; private char [ ] fieldName ; private char [ ] methodName ; private char [ ] fieldDescriptor ; private char [ ] methodDescriptor ; private char [ ] utf8Value ; private int utf8Length ; private char [ ] classInfoName ; public ConstantPoolEntry ( ) { this . classInfoNameIndex = - <NUM_LIT:1> ; this . classIndex = - <NUM_LIT:1> ; this . nameAndTypeIndex = - <NUM_LIT:1> ; this . stringIndex = - <NUM_LIT:1> ; this . stringValue = null ; this . integerValue = - <NUM_LIT:1> ; this . floatValue = - <NUM_LIT:0.0f> ; this . doubleValue = - <NUM_LIT:0> - <NUM_LIT:0> ; this . longValue = - <NUM_LIT:1> ; this . nameAndTypeDescriptorIndex = - <NUM_LIT:1> ; this . nameAndTypeNameIndex = - <NUM_LIT:1> ; this . className = null ; this . fieldName = null ; this . methodName = null ; this . fieldDescriptor = null ; this . methodDescriptor = null ; this . utf8Value = null ; this . utf8Length = - <NUM_LIT:1> ; this . classInfoName = null ; } public int getKind ( ) { return this . kind ; } public void setKind ( int kind ) { this . kind = kind ; } public int getClassInfoNameIndex ( ) { return this . classInfoNameIndex ; } public int getClassIndex ( ) { return this . classIndex ; } public int getNameAndTypeIndex ( ) { return this . nameAndTypeIndex ; } public int getStringIndex ( ) { return this . stringIndex ; } public String getStringValue ( ) { return new String ( this . stringValue ) ; } public int getIntegerValue ( ) { return this . integerValue ; } public float getFloatValue ( ) { return this . floatValue ; } public double getDoubleValue ( ) { return this . doubleValue ; } public long getLongValue ( ) { return this . longValue ; } public int getNameAndTypeInfoDescriptorIndex ( ) { return this . nameAndTypeDescriptorIndex ; } public int getNameAndTypeInfoNameIndex ( ) { return this . nameAndTypeNameIndex ; } public char [ ] getClassName ( ) { return this . className ; } public char [ ] getFieldName ( ) { return this . fieldName ; } public char [ ] getMethodName ( ) { return this . methodName ; } public char [ ] getFieldDescriptor ( ) { return this . fieldDescriptor ; } public char [ ] getMethodDescriptor ( ) { return this . methodDescriptor ; } public char [ ] getUtf8Value ( ) { return this . utf8Value ; } public char [ ] getClassInfoName ( ) { return this . classInfoName ; } public void setClassInfoNameIndex ( int classInfoNameIndex ) { this . classInfoNameIndex = classInfoNameIndex ; } public void setClassIndex ( int classIndex ) { this . classIndex = classIndex ; } public void setNameAndTypeIndex ( int nameAndTypeIndex ) { this . nameAndTypeIndex = nameAndTypeIndex ; } public void setStringIndex ( int stringIndex ) { this . stringIndex = stringIndex ; } public void setStringValue ( char [ ] stringValue ) { this . stringValue = stringValue ; } public void setIntegerValue ( int integerValue ) { this . integerValue = integerValue ; } public void setFloatValue ( float floatValue ) { this . floatValue = floatValue ; } public void setDoubleValue ( double doubleValue ) { this . doubleValue = doubleValue ; } public void setLongValue ( long longValue ) { this . longValue = longValue ; } public int getNameAndTypeDescriptorIndex ( ) { return this . nameAndTypeDescriptorIndex ; } public void setNameAndTypeDescriptorIndex ( int nameAndTypeDescriptorIndex ) { this . nameAndTypeDescriptorIndex = nameAndTypeDescriptorIndex ; } public int getNameAndTypeNameIndex ( ) { return this . nameAndTypeNameIndex ; } public void setNameAndTypeNameIndex ( int nameAndTypeNameIndex ) { this . nameAndTypeNameIndex = nameAndTypeNameIndex ; } public void setClassName ( char [ ] className ) { this . className = className ; } public void setFieldName ( char [ ] fieldName ) { this . fieldName = fieldName ; } public void setMethodName ( char [ ] methodName ) { this . methodName = methodName ; } public void setFieldDescriptor ( char [ ] fieldDescriptor ) { this . fieldDescriptor = fieldDescriptor ; } public void setMethodDescriptor ( char [ ] methodDescriptor ) { this . methodDescriptor = methodDescriptor ; } public void setUtf8Value ( char [ ] utf8Value ) { this . utf8Value = utf8Value ; } public void setClassInfoName ( char [ ] classInfoName ) { this . classInfoName = classInfoName ; } public int getUtf8Length ( ) { return this . utf8Length ; } public void setUtf8Length ( int utf8Length ) { this . utf8Length = utf8Length ; } public void reset ( ) { this . kind = <NUM_LIT:0> ; this . classInfoNameIndex = <NUM_LIT:0> ; this . classIndex = <NUM_LIT:0> ; this . nameAndTypeIndex = <NUM_LIT:0> ; this . stringIndex = <NUM_LIT:0> ; this . stringValue = null ; this . integerValue = <NUM_LIT:0> ; this . floatValue = <NUM_LIT:0.0f> ; this . doubleValue = <NUM_LIT:0.0> ; this . longValue = <NUM_LIT> ; this . nameAndTypeDescriptorIndex = <NUM_LIT:0> ; this . nameAndTypeNameIndex = <NUM_LIT:0> ; this . className = null ; this . fieldName = null ; this . methodName = null ; this . fieldDescriptor = null ; this . methodDescriptor = null ; this . utf8Value = null ; this . utf8Length = <NUM_LIT:0> ; this . classInfoName = null ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IParameterAnnotation ; import org . eclipse . jdt . core . util . IRuntimeVisibleParameterAnnotationsAttribute ; public class RuntimeVisibleParameterAnnotationsAttribute extends ClassFileAttribute implements IRuntimeVisibleParameterAnnotationsAttribute { private static final IParameterAnnotation [ ] NO_ENTRIES = new IParameterAnnotation [ <NUM_LIT:0> ] ; private int parametersNumber ; private IParameterAnnotation [ ] parameterAnnotations ; public RuntimeVisibleParameterAnnotationsAttribute ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { super ( classFileBytes , constantPool , offset ) ; final int length = u1At ( classFileBytes , <NUM_LIT:6> , offset ) ; this . parametersNumber = length ; if ( length != <NUM_LIT:0> ) { int readOffset = <NUM_LIT:7> ; this . parameterAnnotations = new IParameterAnnotation [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { ParameterAnnotation parameterAnnotation = new ParameterAnnotation ( classFileBytes , constantPool , offset + readOffset ) ; this . parameterAnnotations [ i ] = parameterAnnotation ; readOffset += parameterAnnotation . sizeInBytes ( ) ; } } else { this . parameterAnnotations = NO_ENTRIES ; } } public IParameterAnnotation [ ] getParameterAnnotations ( ) { return this . parameterAnnotations ; } public int getParametersNumber ( ) { return this . parametersNumber ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . ILocalVariableAttribute ; import org . eclipse . jdt . core . util . ILocalVariableTableEntry ; public class LocalVariableAttribute extends ClassFileAttribute implements ILocalVariableAttribute { private static final ILocalVariableTableEntry [ ] NO_ENTRIES = new ILocalVariableTableEntry [ <NUM_LIT:0> ] ; private int localVariableTableLength ; private ILocalVariableTableEntry [ ] localVariableTable ; public LocalVariableAttribute ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { super ( classFileBytes , constantPool , offset ) ; final int length = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; this . localVariableTableLength = length ; if ( length != <NUM_LIT:0> ) { int readOffset = <NUM_LIT:8> ; this . localVariableTable = new ILocalVariableTableEntry [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . localVariableTable [ i ] = new LocalVariableTableEntry ( classFileBytes , constantPool , offset + readOffset ) ; readOffset += <NUM_LIT:10> ; } } else { this . localVariableTable = NO_ENTRIES ; } } public ILocalVariableTableEntry [ ] getLocalVariableTable ( ) { return this . localVariableTable ; } public int getLocalVariableTableLength ( ) { return this . localVariableTableLength ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IConstantPool ; import org . eclipse . jdt . core . util . IStackMapFrame ; import org . eclipse . jdt . core . util . IStackMapAttribute ; public class StackMapAttribute extends ClassFileAttribute implements IStackMapAttribute { private static final IStackMapFrame [ ] NO_FRAMES = new IStackMapFrame [ <NUM_LIT:0> ] ; private static final byte [ ] NO_ENTRIES = new byte [ <NUM_LIT:0> ] ; private int numberOfEntries ; private IStackMapFrame [ ] frames ; private byte [ ] bytes ; public StackMapAttribute ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { super ( classFileBytes , constantPool , offset ) ; final int length = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; this . numberOfEntries = length ; if ( length != <NUM_LIT:0> ) { int readOffset = <NUM_LIT:8> ; this . frames = new IStackMapFrame [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { DefaultStackMapFrame frame = new DefaultStackMapFrame ( classFileBytes , constantPool , offset + readOffset ) ; this . frames [ i ] = frame ; readOffset += frame . sizeInBytes ( ) ; } } else { this . frames = NO_FRAMES ; } final int byteLength = ( int ) u4At ( classFileBytes , <NUM_LIT:2> , offset ) ; if ( length != <NUM_LIT:0> ) { System . arraycopy ( classFileBytes , offset + <NUM_LIT:6> , this . bytes = new byte [ byteLength ] , <NUM_LIT:0> , byteLength ) ; } else { this . bytes = NO_ENTRIES ; } } public int getNumberOfEntries ( ) { return this . numberOfEntries ; } public IStackMapFrame [ ] getStackMapFrame ( ) { return this . frames ; } public byte [ ] getBytes ( ) { return this . bytes ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . internal . compiler . util . Util ; public class CharArrayBuffer { protected char [ ] [ ] buffer ; public static final int DEFAULT_BUFFER_SIZE = <NUM_LIT:10> ; protected int end ; protected int size ; protected int [ ] [ ] ranges ; public CharArrayBuffer ( ) { this ( null , DEFAULT_BUFFER_SIZE ) ; } public CharArrayBuffer ( char [ ] first ) { this ( first , DEFAULT_BUFFER_SIZE ) ; } public CharArrayBuffer ( char [ ] first , int size ) { this . size = ( size > <NUM_LIT:0> ) ? size : DEFAULT_BUFFER_SIZE ; this . buffer = new char [ this . size ] [ ] ; this . ranges = new int [ this . size ] [ ] ; this . end = <NUM_LIT:0> ; if ( first != null ) append ( first , <NUM_LIT:0> , first . length ) ; } public CharArrayBuffer ( int size ) { this ( null , size ) ; } public CharArrayBuffer append ( char [ ] src ) { if ( src != null ) append ( src , <NUM_LIT:0> , src . length ) ; return this ; } public CharArrayBuffer append ( char [ ] src , int start , int length ) { if ( start < <NUM_LIT:0> ) throw new ArrayIndexOutOfBoundsException ( ) ; if ( length < <NUM_LIT:0> ) throw new ArrayIndexOutOfBoundsException ( ) ; if ( src != null ) { int srcLength = src . length ; if ( start > srcLength ) throw new ArrayIndexOutOfBoundsException ( ) ; if ( length + start > srcLength ) throw new ArrayIndexOutOfBoundsException ( ) ; if ( length > <NUM_LIT:0> ) { if ( this . end == this . size ) { int size2 = this . size * <NUM_LIT:2> ; System . arraycopy ( this . buffer , <NUM_LIT:0> , ( this . buffer = new char [ size2 ] [ ] ) , <NUM_LIT:0> , this . size ) ; System . arraycopy ( this . ranges , <NUM_LIT:0> , ( this . ranges = new int [ size2 ] [ ] ) , <NUM_LIT:0> , this . size ) ; this . size *= <NUM_LIT:2> ; } this . buffer [ this . end ] = src ; this . ranges [ this . end ] = new int [ ] { start , length } ; this . end ++ ; } } return this ; } public CharArrayBuffer append ( char c ) { append ( new char [ ] { c } , <NUM_LIT:0> , <NUM_LIT:1> ) ; return this ; } public CharArrayBuffer append ( String src ) { if ( src != null ) append ( src . toCharArray ( ) , <NUM_LIT:0> , src . length ( ) ) ; return this ; } public char [ ] getContents ( ) { if ( this . end == <NUM_LIT:0> ) return null ; int length = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < this . end ; i ++ ) length += this . ranges [ i ] [ <NUM_LIT:1> ] ; if ( length > <NUM_LIT:0> ) { char [ ] result = new char [ length ] ; int current = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < this . end ; i ++ ) { int [ ] range = this . ranges [ i ] ; int length2 = range [ <NUM_LIT:1> ] ; System . arraycopy ( this . buffer [ i ] , range [ <NUM_LIT:0> ] , result , current , length2 ) ; current += length2 ; } return result ; } return null ; } public String toString ( ) { char [ ] contents = getContents ( ) ; return ( contents != null ) ? new String ( contents ) : Util . EMPTY_STRING ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import java . util . ArrayList ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ASTVisitor ; import org . eclipse . jdt . internal . compiler . Compiler ; import org . eclipse . jdt . internal . compiler . ast . ArrayReference ; import org . eclipse . jdt . internal . compiler . ast . Assignment ; import org . eclipse . jdt . internal . compiler . ast . CastExpression ; import org . eclipse . jdt . internal . compiler . ast . CompilationUnitDeclaration ; import org . eclipse . jdt . internal . compiler . ast . ConditionalExpression ; import org . eclipse . jdt . internal . compiler . ast . FieldReference ; import org . eclipse . jdt . internal . compiler . ast . MessageSend ; import org . eclipse . jdt . internal . compiler . ast . QualifiedNameReference ; import org . eclipse . jdt . internal . compiler . ast . SingleNameReference ; import org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ; import org . eclipse . jdt . internal . compiler . ast . Wildcard ; import org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding ; import org . eclipse . jdt . internal . compiler . lookup . ArrayBinding ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . lookup . BlockScope ; import org . eclipse . jdt . internal . compiler . lookup . CaptureBinding ; 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 . 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 . SourceTypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeBinding ; import org . eclipse . jdt . internal . compiler . lookup . TypeVariableBinding ; import org . eclipse . jdt . internal . compiler . lookup . VariableBinding ; import org . eclipse . jdt . internal . compiler . lookup . WildcardBinding ; import org . eclipse . jdt . internal . compiler . util . HashtableOfObject ; public class BindingKeyResolver extends BindingKeyParser { Compiler compiler ; Binding compilerBinding ; char [ ] [ ] compoundName ; int dimension ; LookupEnvironment environment ; ReferenceBinding genericType ; MethodBinding methodBinding ; AnnotationBinding annotationBinding ; char [ ] secondarySimpleName ; CompilationUnitDeclaration parsedUnit ; BlockScope scope ; TypeBinding typeBinding ; TypeDeclaration typeDeclaration ; ArrayList types = new ArrayList ( ) ; int wildcardRank ; CompilationUnitDeclaration outerMostParsedUnit ; HashtableOfObject resolvedUnits ; private BindingKeyResolver ( BindingKeyParser parser , Compiler compiler , LookupEnvironment environment , CompilationUnitDeclaration outerMostParsedUnit , HashtableOfObject parsedUnits ) { super ( parser ) ; this . compiler = compiler ; this . environment = environment ; this . outerMostParsedUnit = outerMostParsedUnit ; this . resolvedUnits = parsedUnits ; } public BindingKeyResolver ( String key , Compiler compiler , LookupEnvironment environment ) { super ( key ) ; this . compiler = compiler ; this . environment = environment ; this . resolvedUnits = new HashtableOfObject ( ) ; } public char [ ] [ ] compoundName ( ) { return this . compoundName ; } public void consumeAnnotation ( ) { int size = this . types . size ( ) ; if ( size == <NUM_LIT:0> ) return ; Binding annotationType = ( ( BindingKeyResolver ) this . types . get ( size - <NUM_LIT:1> ) ) . compilerBinding ; AnnotationBinding [ ] annotationBindings ; if ( this . compilerBinding == null && this . typeBinding instanceof ReferenceBinding ) { annotationBindings = ( ( ReferenceBinding ) this . typeBinding ) . getAnnotations ( ) ; } else if ( this . compilerBinding instanceof MethodBinding ) { annotationBindings = ( ( MethodBinding ) this . compilerBinding ) . getAnnotations ( ) ; } else if ( this . compilerBinding instanceof VariableBinding ) { annotationBindings = ( ( VariableBinding ) this . compilerBinding ) . getAnnotations ( ) ; } else { return ; } for ( int i = <NUM_LIT:0> , length = annotationBindings . length ; i < length ; i ++ ) { AnnotationBinding binding = annotationBindings [ i ] ; if ( binding . getAnnotationType ( ) == annotationType ) { this . annotationBinding = binding ; break ; } } } public void consumeArrayDimension ( char [ ] brakets ) { this . dimension = brakets . length ; } public void consumeBaseType ( char [ ] baseTypeSig ) { this . compoundName = new char [ ] [ ] { getKey ( ) . toCharArray ( ) } ; TypeBinding baseTypeBinding = getBaseTypeBinding ( baseTypeSig ) ; if ( baseTypeBinding != null ) { this . typeBinding = baseTypeBinding ; } } public void consumeCapture ( final int position ) { CompilationUnitDeclaration outerParsedUnit = this . outerMostParsedUnit == null ? this . parsedUnit : this . outerMostParsedUnit ; if ( outerParsedUnit == null ) return ; final Binding wildcardBinding = ( ( BindingKeyResolver ) this . types . get ( <NUM_LIT:0> ) ) . compilerBinding ; class CaptureFinder extends ASTVisitor { CaptureBinding capture ; boolean checkType ( TypeBinding binding ) { if ( binding == null ) return false ; switch ( binding . kind ( ) ) { case Binding . PARAMETERIZED_TYPE : TypeBinding [ ] arguments = ( ( ParameterizedTypeBinding ) binding ) . arguments ; if ( arguments == null ) return false ; for ( int i = <NUM_LIT:0> , length = arguments . length ; i < length ; i ++ ) { if ( checkType ( arguments [ i ] ) ) return true ; } break ; case Binding . WILDCARD_TYPE : return checkType ( ( ( WildcardBinding ) binding ) . bound ) ; case Binding . INTERSECTION_TYPE : if ( checkType ( ( ( WildcardBinding ) binding ) . bound ) ) return true ; TypeBinding [ ] otherBounds = ( ( WildcardBinding ) binding ) . otherBounds ; for ( int i = <NUM_LIT:0> , length = otherBounds . length ; i < length ; i ++ ) { if ( checkType ( otherBounds [ i ] ) ) return true ; } break ; case Binding . ARRAY_TYPE : return checkType ( ( ( ArrayBinding ) binding ) . leafComponentType ) ; case Binding . TYPE_PARAMETER : if ( binding . isCapture ( ) ) { CaptureBinding captureBinding = ( CaptureBinding ) binding ; if ( captureBinding . position == position && captureBinding . wildcard == wildcardBinding ) { this . capture = captureBinding ; return true ; } } break ; } return false ; } public boolean visit ( SingleNameReference singleNameReference , BlockScope blockScope ) { if ( checkType ( singleNameReference . resolvedType ) ) return false ; return super . visit ( singleNameReference , blockScope ) ; } public boolean visit ( QualifiedNameReference qualifiedNameReference , BlockScope blockScope ) { if ( checkType ( qualifiedNameReference . resolvedType ) ) return false ; return super . visit ( qualifiedNameReference , blockScope ) ; } public boolean visit ( MessageSend messageSend , BlockScope blockScope ) { if ( checkType ( messageSend . resolvedType ) ) return false ; return super . visit ( messageSend , blockScope ) ; } public boolean visit ( FieldReference fieldReference , BlockScope blockScope ) { if ( checkType ( fieldReference . resolvedType ) ) return false ; return super . visit ( fieldReference , blockScope ) ; } public boolean visit ( ConditionalExpression conditionalExpression , BlockScope blockScope ) { if ( checkType ( conditionalExpression . resolvedType ) ) return false ; return super . visit ( conditionalExpression , blockScope ) ; } public boolean visit ( CastExpression castExpression , BlockScope blockScope ) { if ( checkType ( castExpression . resolvedType ) ) return false ; return super . visit ( castExpression , blockScope ) ; } public boolean visit ( Assignment assignment , BlockScope blockScope ) { if ( checkType ( assignment . resolvedType ) ) return false ; return super . visit ( assignment , blockScope ) ; } public boolean visit ( ArrayReference arrayReference , BlockScope blockScope ) { if ( checkType ( arrayReference . resolvedType ) ) return false ; return super . visit ( arrayReference , blockScope ) ; } } CaptureFinder captureFinder = new CaptureFinder ( ) ; outerParsedUnit . traverse ( captureFinder , outerParsedUnit . scope ) ; this . typeBinding = captureFinder . capture ; } public void consumeException ( ) { this . types = new ArrayList ( ) ; } public void consumeField ( char [ ] fieldName ) { if ( this . typeBinding == null ) return ; FieldBinding [ ] fields = ( ( ReferenceBinding ) this . typeBinding ) . availableFields ( ) ; for ( int i = <NUM_LIT:0> , length = fields . length ; i < length ; i ++ ) { FieldBinding field = fields [ i ] ; if ( CharOperation . equals ( fieldName , field . name ) ) { this . typeBinding = null ; this . compilerBinding = field ; return ; } } } public void consumeParameterizedGenericMethod ( ) { if ( this . methodBinding == null ) return ; TypeBinding [ ] arguments = getTypeBindingArguments ( ) ; if ( arguments == null ) { this . methodBinding = null ; this . compilerBinding = null ; return ; } if ( arguments . length != this . methodBinding . typeVariables ( ) . length ) this . methodBinding = this . environment . createParameterizedGenericMethod ( this . methodBinding , ( RawTypeBinding ) null ) ; else this . methodBinding = this . environment . createParameterizedGenericMethod ( this . methodBinding , arguments ) ; this . compilerBinding = this . methodBinding ; } public void consumeLocalType ( char [ ] uniqueKey ) { LocalTypeBinding [ ] localTypeBindings = this . parsedUnit . localTypes ; for ( int i = <NUM_LIT:0> ; i < this . parsedUnit . localTypeCount ; i ++ ) if ( CharOperation . equals ( uniqueKey , localTypeBindings [ i ] . computeUniqueKey ( false ) ) ) { this . typeBinding = localTypeBindings [ i ] ; return ; } } public void consumeLocalVar ( char [ ] varName , int occurrenceCount ) { if ( this . scope == null ) { if ( this . methodBinding == null ) return ; this . scope = this . methodBinding . sourceMethod ( ) . scope ; } for ( int i = <NUM_LIT:0> ; i < this . scope . localIndex ; i ++ ) { LocalVariableBinding local = this . scope . locals [ i ] ; if ( CharOperation . equals ( local . name , varName ) && occurrenceCount -- == <NUM_LIT:0> ) { this . methodBinding = null ; this . compilerBinding = local ; return ; } } } public void consumeMethod ( char [ ] selector , char [ ] signature ) { if ( this . typeBinding == null ) return ; MethodBinding [ ] methods = ( ( ReferenceBinding ) this . typeBinding ) . availableMethods ( ) ; for ( int i = <NUM_LIT:0> , methodLength = methods . length ; i < methodLength ; i ++ ) { MethodBinding method = methods [ i ] ; if ( CharOperation . equals ( selector , method . selector ) || ( selector . length == <NUM_LIT:0> && method . isConstructor ( ) ) ) { char [ ] methodSignature = method . genericSignature ( ) ; if ( methodSignature == null ) methodSignature = method . signature ( ) ; if ( CharOperation . equals ( signature , methodSignature ) ) { this . typeBinding = null ; this . methodBinding = method ; this . compilerBinding = this . methodBinding ; return ; } } } } public void consumeMemberType ( char [ ] simpleTypeName ) { this . typeBinding = getTypeBinding ( simpleTypeName ) ; } public void consumePackage ( char [ ] pkgName ) { this . compoundName = CharOperation . splitOn ( '<CHAR_LIT:/>' , pkgName ) ; this . compilerBinding = new PackageBinding ( this . compoundName , null , this . environment ) ; } public void consumeParameterizedType ( char [ ] simpleTypeName , boolean isRaw ) { if ( this . typeBinding == null ) return ; TypeBinding [ ] arguments = getTypeBindingArguments ( ) ; if ( arguments == null ) { this . typeBinding = null ; this . genericType = null ; return ; } if ( simpleTypeName != null ) { if ( this . genericType == null ) { this . genericType = ( ( ReferenceBinding ) this . typeBinding ) . getMemberType ( simpleTypeName ) ; } else { this . genericType = this . genericType . getMemberType ( simpleTypeName ) ; } if ( ! isRaw ) this . typeBinding = this . environment . createParameterizedType ( this . genericType , arguments , ( ReferenceBinding ) this . typeBinding ) ; else this . typeBinding = this . environment . createRawType ( this . genericType , ( ReferenceBinding ) this . typeBinding ) ; } else { this . genericType = ( ReferenceBinding ) this . typeBinding ; ReferenceBinding enclosing = this . genericType . enclosingType ( ) ; if ( enclosing != null ) enclosing = ( ReferenceBinding ) this . environment . convertToRawType ( enclosing , false ) ; this . typeBinding = this . environment . createParameterizedType ( this . genericType , arguments , enclosing ) ; } } public void consumeParser ( BindingKeyParser parser ) { this . types . add ( parser ) ; } public void consumeScope ( int scopeNumber ) { if ( this . scope == null ) { if ( this . methodBinding == null ) return ; this . scope = this . methodBinding . sourceMethod ( ) . scope ; } if ( scopeNumber >= this . scope . subscopeCount ) return ; this . scope = ( BlockScope ) this . scope . subscopes [ scopeNumber ] ; } public void consumeRawType ( ) { if ( this . typeBinding == null ) return ; this . typeBinding = this . environment . convertToRawType ( this . typeBinding , false ) ; } public void consumeSecondaryType ( char [ ] simpleTypeName ) { this . secondarySimpleName = simpleTypeName ; } public void consumeFullyQualifiedName ( char [ ] fullyQualifiedName ) { this . compoundName = CharOperation . splitOn ( '<CHAR_LIT:/>' , fullyQualifiedName ) ; } public void consumeTopLevelType ( ) { char [ ] fileName ; this . parsedUnit = getCompilationUnitDeclaration ( ) ; if ( this . parsedUnit != null && this . compiler != null && ! this . resolvedUnits . containsKey ( fileName = this . parsedUnit . getFileName ( ) ) ) { this . compiler . process ( this . parsedUnit , this . compiler . totalUnits + <NUM_LIT:1> ) ; this . resolvedUnits . put ( fileName , fileName ) ; } if ( this . parsedUnit == null ) { this . typeBinding = getBinaryBinding ( ) ; } else { char [ ] typeName = this . secondarySimpleName == null ? this . compoundName [ this . compoundName . length - <NUM_LIT:1> ] : this . secondarySimpleName ; this . typeBinding = getTypeBinding ( typeName ) ; } } public void consumeKey ( ) { if ( this . typeBinding != null ) { this . typeBinding = getArrayBinding ( this . dimension , this . typeBinding ) ; this . compilerBinding = this . typeBinding ; } } public void consumeTypeVariable ( char [ ] position , char [ ] typeVariableName ) { if ( position . length > <NUM_LIT:0> ) { if ( this . typeBinding == null ) return ; int pos = Integer . parseInt ( new String ( position ) ) ; MethodBinding [ ] methods = ( ( ReferenceBinding ) this . typeBinding ) . availableMethods ( ) ; if ( methods != null && pos < methods . length ) { this . methodBinding = methods [ pos ] ; } } TypeVariableBinding [ ] typeVariableBindings ; if ( this . methodBinding != null ) { typeVariableBindings = this . methodBinding . typeVariables ( ) ; } else if ( this . typeBinding != null ) { typeVariableBindings = this . typeBinding . typeVariables ( ) ; } else { return ; } for ( int i = <NUM_LIT:0> , length = typeVariableBindings . length ; i < length ; i ++ ) { TypeVariableBinding typeVariableBinding = typeVariableBindings [ i ] ; if ( CharOperation . equals ( typeVariableName , typeVariableBinding . sourceName ( ) ) ) { this . typeBinding = typeVariableBinding ; return ; } } } public void consumeTypeWithCapture ( ) { BindingKeyResolver resolver = ( BindingKeyResolver ) this . types . get ( <NUM_LIT:0> ) ; this . typeBinding = ( TypeBinding ) resolver . compilerBinding ; } public void consumeWildcardRank ( int aRank ) { this . wildcardRank = aRank ; } public void consumeWildCard ( int kind ) { switch ( kind ) { case Wildcard . EXTENDS : case Wildcard . SUPER : BindingKeyResolver boundResolver = ( BindingKeyResolver ) this . types . get ( <NUM_LIT:0> ) ; final Binding boundBinding = boundResolver . compilerBinding ; if ( boundBinding instanceof TypeBinding ) { this . typeBinding = this . environment . createWildcard ( ( ReferenceBinding ) this . typeBinding , this . wildcardRank , ( TypeBinding ) boundBinding , null , kind ) ; } else { this . typeBinding = null ; } break ; case Wildcard . UNBOUND : this . typeBinding = this . environment . createWildcard ( ( ReferenceBinding ) this . typeBinding , this . wildcardRank , null , null , kind ) ; break ; } } public AnnotationBinding getAnnotationBinding ( ) { return this . annotationBinding ; } private TypeBinding getArrayBinding ( int dim , TypeBinding binding ) { if ( binding == null ) return null ; if ( dim == <NUM_LIT:0> ) return binding ; return this . environment . createArrayType ( binding , dim ) ; } private TypeBinding getBaseTypeBinding ( char [ ] signature ) { switch ( signature [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : return TypeBinding . INT ; case '<CHAR_LIT:Z>' : return TypeBinding . BOOLEAN ; case '<CHAR_LIT>' : return TypeBinding . VOID ; case '<CHAR_LIT>' : return TypeBinding . CHAR ; case '<CHAR_LIT>' : return TypeBinding . DOUBLE ; case '<CHAR_LIT>' : return TypeBinding . BYTE ; case '<CHAR_LIT>' : return TypeBinding . FLOAT ; case '<CHAR_LIT>' : return TypeBinding . LONG ; case '<CHAR_LIT>' : return TypeBinding . SHORT ; case '<CHAR_LIT>' : return TypeBinding . NULL ; default : return null ; } } private TypeBinding getBinaryBinding ( ) { if ( this . compoundName . length == <NUM_LIT:0> ) return null ; return this . environment . getType ( this . compoundName ) ; } public CompilationUnitDeclaration getCompilationUnitDeclaration ( ) { char [ ] [ ] name = this . compoundName ; if ( name . length == <NUM_LIT:0> ) return null ; if ( this . environment == null ) return null ; ReferenceBinding binding = this . environment . getType ( name ) ; if ( ! ( binding instanceof SourceTypeBinding ) ) { if ( this . secondarySimpleName == null ) return null ; int length = name . length ; System . arraycopy ( name , <NUM_LIT:0> , name = new char [ length ] [ ] , <NUM_LIT:0> , length - <NUM_LIT:1> ) ; name [ length - <NUM_LIT:1> ] = this . secondarySimpleName ; binding = this . environment . getType ( name ) ; if ( ! ( binding instanceof SourceTypeBinding ) ) return null ; } SourceTypeBinding sourceTypeBinding = ( SourceTypeBinding ) binding ; if ( sourceTypeBinding . scope == null ) return null ; return sourceTypeBinding . scope . compilationUnitScope ( ) . referenceContext ; } public Binding getCompilerBinding ( ) { try { parse ( ) ; return this . compilerBinding ; } catch ( RuntimeException e ) { Util . log ( e , "<STR_LIT>" + getKey ( ) ) ; return null ; } } private TypeBinding getTypeBinding ( char [ ] simpleTypeName ) { if ( this . typeBinding instanceof ReferenceBinding ) { return ( ( ReferenceBinding ) this . typeBinding ) . getMemberType ( simpleTypeName ) ; } TypeDeclaration [ ] typeDeclarations = this . typeDeclaration == null ? ( this . parsedUnit == null ? null : this . parsedUnit . types ) : this . typeDeclaration . memberTypes ; if ( typeDeclarations == null ) return null ; for ( int i = <NUM_LIT:0> , length = typeDeclarations . length ; i < length ; i ++ ) { TypeDeclaration declaration = typeDeclarations [ i ] ; if ( CharOperation . equals ( simpleTypeName , declaration . name ) ) { this . typeDeclaration = declaration ; return declaration . binding ; } } return null ; } private TypeBinding [ ] getTypeBindingArguments ( ) { int size = this . types . size ( ) ; TypeBinding [ ] arguments = new TypeBinding [ size ] ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { BindingKeyResolver resolver = ( BindingKeyResolver ) this . types . get ( i ) ; TypeBinding compilerBinding2 = ( TypeBinding ) resolver . compilerBinding ; if ( compilerBinding2 == null ) { this . types = new ArrayList ( ) ; return null ; } arguments [ i ] = compilerBinding2 ; } this . types = new ArrayList ( ) ; return arguments ; } public void malformedKey ( ) { this . compoundName = CharOperation . NO_CHAR_CHAR ; } public BindingKeyParser newParser ( ) { return new BindingKeyResolver ( this , this . compiler , this . environment , this . outerMostParsedUnit == null ? this . parsedUnit : this . outerMostParsedUnit , this . resolvedUnits ) ; } public String toString ( ) { return getKey ( ) ; } } </s>
<s> package org . eclipse . jdt . internal . core . util ; import org . eclipse . jdt . core . compiler . CategorizedProblem ; import org . eclipse . jdt . internal . compiler . CompilationResult ; public class RecordedParsingInformation { public CategorizedProblem [ ] problems ; public int problemsCount ; public int [ ] lineEnds ; public int [ ] [ ] commentPositions ; public RecordedParsingInformation ( CategorizedProblem [ ] problems , int [ ] lineEnds , int [ ] [ ] commentPositions ) { this . problems = problems ; this . lineEnds = lineEnds ; this . commentPositions = commentPositions ; this . problemsCount = problems != null ? problems . length : <NUM_LIT:0> ; } void updateRecordedParsingInformation ( CompilationResult compilationResult ) { if ( compilationResult . problems != null ) { this . problems = compilationResult . problems ; this . problemsCount = this . problems . length ; } } } </s>
<s> package org . eclipse . jdt . internal . core ; import java . util . HashMap ; import java . util . Iterator ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . jdt . core . IClasspathEntry ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaModel ; import org . eclipse . jdt . core . IJavaProject ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . internal . core . util . Util ; public class SetVariablesOperation extends ChangeClasspathOperation { String [ ] variableNames ; IPath [ ] variablePaths ; boolean updatePreferences ; public SetVariablesOperation ( String [ ] variableNames , IPath [ ] variablePaths , boolean updatePreferences ) { super ( new IJavaElement [ ] { JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) } , ! ResourcesPlugin . getWorkspace ( ) . isTreeLocked ( ) ) ; this . variableNames = variableNames ; this . variablePaths = variablePaths ; this . updatePreferences = updatePreferences ; } protected void executeOperation ( ) throws JavaModelException { checkCanceled ( ) ; try { beginTask ( "<STR_LIT>" , <NUM_LIT:1> ) ; if ( JavaModelManager . CP_RESOLVE_VERBOSE ) verbose_set_variables ( ) ; JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; if ( manager . variablePutIfInitializingWithSameValue ( this . variableNames , this . variablePaths ) ) return ; int varLength = this . variableNames . length ; final HashMap affectedProjectClasspaths = new HashMap ( <NUM_LIT:5> ) ; IJavaModel model = getJavaModel ( ) ; int discardCount = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < varLength ; i ++ ) { String variableName = this . variableNames [ i ] ; IPath oldPath = manager . variableGet ( variableName ) ; if ( oldPath == JavaModelManager . VARIABLE_INITIALIZATION_IN_PROGRESS ) { oldPath = null ; } if ( oldPath != null && oldPath . equals ( this . variablePaths [ i ] ) ) { this . variableNames [ i ] = null ; discardCount ++ ; } } if ( discardCount > <NUM_LIT:0> ) { if ( discardCount == varLength ) return ; int changedLength = varLength - discardCount ; String [ ] changedVariableNames = new String [ changedLength ] ; IPath [ ] changedVariablePaths = new IPath [ changedLength ] ; for ( int i = <NUM_LIT:0> , index = <NUM_LIT:0> ; i < varLength ; i ++ ) { if ( this . variableNames [ i ] != null ) { changedVariableNames [ index ] = this . variableNames [ i ] ; changedVariablePaths [ index ] = this . variablePaths [ i ] ; index ++ ; } } this . variableNames = changedVariableNames ; this . variablePaths = changedVariablePaths ; varLength = changedLength ; } if ( isCanceled ( ) ) return ; IJavaProject [ ] projects = model . getJavaProjects ( ) ; nextProject : for ( int i = <NUM_LIT:0> , projectLength = projects . length ; i < projectLength ; i ++ ) { JavaProject project = ( JavaProject ) projects [ i ] ; IClasspathEntry [ ] classpath = project . getRawClasspath ( ) ; for ( int j = <NUM_LIT:0> , cpLength = classpath . length ; j < cpLength ; j ++ ) { IClasspathEntry entry = classpath [ j ] ; for ( int k = <NUM_LIT:0> ; k < varLength ; k ++ ) { String variableName = this . variableNames [ k ] ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_VARIABLE ) { if ( variableName . equals ( entry . getPath ( ) . segment ( <NUM_LIT:0> ) ) ) { affectedProjectClasspaths . put ( project , project . getResolvedClasspath ( ) ) ; continue nextProject ; } IPath sourcePath , sourceRootPath ; if ( ( ( sourcePath = entry . getSourceAttachmentPath ( ) ) != null && variableName . equals ( sourcePath . segment ( <NUM_LIT:0> ) ) ) || ( ( sourceRootPath = entry . getSourceAttachmentRootPath ( ) ) != null && variableName . equals ( sourceRootPath . segment ( <NUM_LIT:0> ) ) ) ) { affectedProjectClasspaths . put ( project , project . getResolvedClasspath ( ) ) ; continue nextProject ; } } } } } for ( int i = <NUM_LIT:0> ; i < varLength ; i ++ ) { manager . variablePut ( this . variableNames [ i ] , this . variablePaths [ i ] ) ; if ( this . updatePreferences ) manager . variablePreferencesPut ( this . variableNames [ i ] , this . variablePaths [ i ] ) ; } if ( ! affectedProjectClasspaths . isEmpty ( ) ) { String [ ] dbgVariableNames = this . variableNames ; try { Iterator projectsToUpdate = affectedProjectClasspaths . keySet ( ) . iterator ( ) ; while ( projectsToUpdate . hasNext ( ) ) { if ( this . progressMonitor != null && this . progressMonitor . isCanceled ( ) ) return ; JavaProject affectedProject = ( JavaProject ) projectsToUpdate . next ( ) ; if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED ) verbose_update_project ( dbgVariableNames , affectedProject ) ; ClasspathChange classpathChange = affectedProject . getPerProjectInfo ( ) . resetResolvedClasspath ( ) ; classpathChanged ( classpathChange , true ) ; if ( this . canChangeResources ) { affectedProject . getProject ( ) . touch ( this . progressMonitor ) ; } } } catch ( CoreException e ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE || JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE ) { verbose_failure ( dbgVariableNames ) ; e . printStackTrace ( ) ; } if ( e instanceof JavaModelException ) { throw ( JavaModelException ) e ; } else { throw new JavaModelException ( e ) ; } } } } finally { done ( ) ; } } private void verbose_failure ( String [ ] dbgVariableNames ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + org . eclipse . jdt . internal . compiler . util . Util . toString ( dbgVariableNames ) , System . err ) ; } private void verbose_update_project ( String [ ] dbgVariableNames , JavaProject affectedProject ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + affectedProject . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + org . eclipse . jdt . internal . compiler . util . Util . toString ( dbgVariableNames ) ) ; } private void verbose_set_variables ( ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + org . eclipse . jdt . internal . compiler . util . Util . toString ( this . variableNames ) + '<STR_LIT:\n>' + "<STR_LIT>" + org . eclipse . jdt . internal . compiler . util . Util . toString ( this . variablePaths ) ) ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import java . util . HashMap ; import java . util . Map ; import org . eclipse . core . resources . * ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . jdt . core . * ; public class DeletePackageFragmentRootOperation extends JavaModelOperation { int updateResourceFlags ; int updateModelFlags ; public DeletePackageFragmentRootOperation ( IPackageFragmentRoot root , int updateResourceFlags , int updateModelFlags ) { super ( root ) ; this . updateResourceFlags = updateResourceFlags ; this . updateModelFlags = updateModelFlags ; } protected void executeOperation ( ) throws JavaModelException { IPackageFragmentRoot root = ( IPackageFragmentRoot ) getElementToProcess ( ) ; IClasspathEntry rootEntry = root . getRawClasspathEntry ( ) ; DeltaProcessor deltaProcessor = JavaModelManager . getJavaModelManager ( ) . getDeltaProcessor ( ) ; if ( deltaProcessor . oldRoots == null ) deltaProcessor . oldRoots = new HashMap ( ) ; if ( ( this . updateModelFlags & IPackageFragmentRoot . ORIGINATING_PROJECT_CLASSPATH ) != <NUM_LIT:0> ) { updateProjectClasspath ( rootEntry . getPath ( ) , root . getJavaProject ( ) , deltaProcessor . oldRoots ) ; } if ( ( this . updateModelFlags & IPackageFragmentRoot . OTHER_REFERRING_PROJECTS_CLASSPATH ) != <NUM_LIT:0> ) { updateReferringProjectClasspaths ( rootEntry . getPath ( ) , root . getJavaProject ( ) , deltaProcessor . oldRoots ) ; } if ( ! root . isExternal ( ) && ( this . updateModelFlags & IPackageFragmentRoot . NO_RESOURCE_MODIFICATION ) == <NUM_LIT:0> ) { deleteResource ( root , rootEntry ) ; } } protected void deleteResource ( IPackageFragmentRoot root , IClasspathEntry rootEntry ) throws JavaModelException { final char [ ] [ ] exclusionPatterns = ( ( ClasspathEntry ) rootEntry ) . fullExclusionPatternChars ( ) ; IResource rootResource = ( ( JavaElement ) root ) . resource ( ) ; if ( rootEntry . getEntryKind ( ) != IClasspathEntry . CPE_SOURCE || exclusionPatterns == null ) { try { rootResource . delete ( this . updateResourceFlags , this . progressMonitor ) ; } catch ( CoreException e ) { throw new JavaModelException ( e ) ; } } else { final IPath [ ] nestedFolders = getNestedFolders ( root ) ; IResourceProxyVisitor visitor = new IResourceProxyVisitor ( ) { public boolean visit ( IResourceProxy proxy ) throws CoreException { if ( proxy . getType ( ) == IResource . FOLDER ) { IPath path = proxy . requestFullPath ( ) ; if ( prefixesOneOf ( path , nestedFolders ) ) { return ! equalsOneOf ( path , nestedFolders ) ; } else { proxy . requestResource ( ) . delete ( DeletePackageFragmentRootOperation . this . updateResourceFlags , DeletePackageFragmentRootOperation . this . progressMonitor ) ; return false ; } } else { proxy . requestResource ( ) . delete ( DeletePackageFragmentRootOperation . this . updateResourceFlags , DeletePackageFragmentRootOperation . this . progressMonitor ) ; return false ; } } } ; try { rootResource . accept ( visitor , IResource . NONE ) ; } catch ( CoreException e ) { throw new JavaModelException ( e ) ; } } setAttribute ( HAS_MODIFIED_RESOURCE_ATTR , TRUE ) ; } protected void updateReferringProjectClasspaths ( IPath rootPath , IJavaProject projectOfRoot , Map oldRoots ) throws JavaModelException { IJavaModel model = getJavaModel ( ) ; IJavaProject [ ] projects = model . getJavaProjects ( ) ; for ( int i = <NUM_LIT:0> , length = projects . length ; i < length ; i ++ ) { IJavaProject project = projects [ i ] ; if ( project . equals ( projectOfRoot ) ) continue ; updateProjectClasspath ( rootPath , project , oldRoots ) ; } } protected void updateProjectClasspath ( IPath rootPath , IJavaProject project , Map oldRoots ) throws JavaModelException { oldRoots . put ( project , project . getPackageFragmentRoots ( ) ) ; IClasspathEntry [ ] classpath = project . getRawClasspath ( ) ; IClasspathEntry [ ] newClasspath = null ; int cpLength = classpath . length ; int newCPIndex = - <NUM_LIT:1> ; for ( int j = <NUM_LIT:0> ; j < cpLength ; j ++ ) { IClasspathEntry entry = classpath [ j ] ; if ( rootPath . equals ( entry . getPath ( ) ) ) { if ( newClasspath == null ) { newClasspath = new IClasspathEntry [ cpLength - <NUM_LIT:1> ] ; System . arraycopy ( classpath , <NUM_LIT:0> , newClasspath , <NUM_LIT:0> , j ) ; newCPIndex = j ; } } else if ( newClasspath != null ) { newClasspath [ newCPIndex ++ ] = entry ; } } if ( newClasspath != null ) { if ( newCPIndex < newClasspath . length ) { System . arraycopy ( newClasspath , <NUM_LIT:0> , newClasspath = new IClasspathEntry [ newCPIndex ] , <NUM_LIT:0> , newCPIndex ) ; } project . setRawClasspath ( newClasspath , this . progressMonitor ) ; } } protected IJavaModelStatus verify ( ) { IJavaModelStatus status = super . verify ( ) ; if ( ! status . isOK ( ) ) { return status ; } IJavaElement root = getElementToProcess ( ) ; if ( root == null || ! root . exists ( ) ) { return new JavaModelStatus ( IJavaModelStatusConstants . ELEMENT_DOES_NOT_EXIST , root ) ; } IResource resource = ( ( JavaElement ) root ) . resource ( ) ; if ( resource instanceof IFolder ) { if ( resource . isLinked ( ) ) { return new JavaModelStatus ( IJavaModelStatusConstants . INVALID_RESOURCE , root ) ; } } return JavaModelStatus . VERIFIED_OK ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . jobs . ISchedulingRule ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . JavaModelException ; public abstract class ChangeClasspathOperation extends JavaModelOperation { protected boolean canChangeResources ; public ChangeClasspathOperation ( IJavaElement [ ] elements , boolean canChangeResources ) { super ( elements ) ; this . canChangeResources = canChangeResources ; } protected boolean canModifyRoots ( ) { return true ; } protected void classpathChanged ( ClasspathChange change , boolean refreshExternalFolder ) throws JavaModelException { JavaProject project = change . project ; project . resetCaches ( ) ; if ( this . canChangeResources ) { if ( isTopLevelOperation ( ) && ! ResourcesPlugin . getWorkspace ( ) . isTreeLocked ( ) ) { new ClasspathValidation ( project ) . validate ( ) ; } new ProjectReferenceChange ( project , change . oldResolvedClasspath ) . updateProjectReferencesIfNecessary ( ) ; new ExternalFolderChange ( project , change . oldResolvedClasspath ) . updateExternalFoldersIfNecessary ( refreshExternalFolder , null ) ; } else { DeltaProcessingState state = JavaModelManager . getDeltaState ( ) ; JavaElementDelta delta = new JavaElementDelta ( getJavaModel ( ) ) ; int result = change . generateDelta ( delta , true ) ; if ( ( result & ClasspathChange . HAS_DELTA ) != <NUM_LIT:0> ) { addDelta ( delta ) ; state . rootsAreStale = true ; change . requestIndexing ( ) ; state . addClasspathValidation ( project ) ; } if ( ( result & ClasspathChange . HAS_PROJECT_CHANGE ) != <NUM_LIT:0> ) { state . addProjectReferenceChange ( project , change . oldResolvedClasspath ) ; } if ( ( result & ClasspathChange . HAS_LIBRARY_CHANGE ) != <NUM_LIT:0> ) { state . addExternalFolderChange ( project , change . oldResolvedClasspath ) ; } } } protected ISchedulingRule getSchedulingRule ( ) { return null ; } public boolean isReadOnly ( ) { return ! this . canChangeResources ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . env . ISourceMethod ; public abstract class SourceMethodElementInfo extends AnnotatableInfo implements ISourceMethod { protected char [ ] [ ] argumentNames ; protected char [ ] [ ] exceptionTypes ; protected ITypeParameter [ ] typeParameters = TypeParameter . NO_TYPE_PARAMETERS ; public char [ ] [ ] getArgumentNames ( ) { return this . argumentNames ; } public char [ ] [ ] getExceptionTypeNames ( ) { return this . exceptionTypes ; } public abstract char [ ] getReturnTypeName ( ) ; public char [ ] [ ] [ ] getTypeParameterBounds ( ) { int length = this . typeParameters . length ; char [ ] [ ] [ ] typeParameterBounds = new char [ length ] [ ] [ ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { try { TypeParameterElementInfo info = ( TypeParameterElementInfo ) ( ( JavaElement ) this . typeParameters [ i ] ) . getElementInfo ( ) ; typeParameterBounds [ i ] = info . bounds ; } catch ( JavaModelException e ) { } } return typeParameterBounds ; } public char [ ] [ ] getTypeParameterNames ( ) { int length = this . typeParameters . length ; if ( length == <NUM_LIT:0> ) return CharOperation . NO_CHAR_CHAR ; char [ ] [ ] typeParameterNames = new char [ length ] [ ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { typeParameterNames [ i ] = this . typeParameters [ i ] . getElementName ( ) . toCharArray ( ) ; } return typeParameterNames ; } public abstract boolean isConstructor ( ) ; public abstract boolean isAnnotationMethod ( ) ; protected void setArgumentNames ( char [ ] [ ] names ) { this . argumentNames = names ; } protected void setExceptionTypeNames ( char [ ] [ ] types ) { this . exceptionTypes = types ; } protected abstract void setReturnType ( char [ ] type ) ; } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . search . * ; import org . eclipse . jdt . internal . codeassist . ISearchRequestor ; import org . eclipse . jdt . internal . compiler . env . AccessRestriction ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . compiler . env . ICompilationUnit ; import org . eclipse . jdt . internal . compiler . env . INameEnvironment ; import org . eclipse . jdt . internal . compiler . env . ISourceType ; import org . eclipse . jdt . internal . compiler . env . NameEnvironmentAnswer ; import org . eclipse . jdt . internal . core . search . BasicSearchEngine ; import org . eclipse . jdt . internal . core . search . IRestrictedAccessConstructorRequestor ; import org . eclipse . jdt . internal . core . search . IRestrictedAccessTypeRequestor ; import org . eclipse . jdt . internal . core . search . indexing . IndexManager ; import org . eclipse . jdt . internal . core . util . Util ; public class SearchableEnvironment implements INameEnvironment , IJavaSearchConstants { public NameLookup nameLookup ; protected ICompilationUnit unitToSkip ; protected org . eclipse . jdt . core . ICompilationUnit [ ] workingCopies ; protected WorkingCopyOwner owner ; protected JavaProject project ; protected IJavaSearchScope searchScope ; protected boolean checkAccessRestrictions ; public SearchableEnvironment ( JavaProject project , org . eclipse . jdt . core . ICompilationUnit [ ] workingCopies ) throws JavaModelException { this . project = project ; this . checkAccessRestrictions = ! JavaCore . IGNORE . equals ( project . getOption ( JavaCore . COMPILER_PB_FORBIDDEN_REFERENCE , true ) ) || ! JavaCore . IGNORE . equals ( project . getOption ( JavaCore . COMPILER_PB_DISCOURAGED_REFERENCE , true ) ) ; this . workingCopies = workingCopies ; this . nameLookup = project . newNameLookup ( workingCopies ) ; } public SearchableEnvironment ( JavaProject project , WorkingCopyOwner owner ) throws JavaModelException { this ( project , owner == null ? null : JavaModelManager . getJavaModelManager ( ) . getWorkingCopies ( owner , true ) ) ; this . owner = owner ; } private static int convertSearchFilterToModelFilter ( int searchFilter ) { switch ( searchFilter ) { case IJavaSearchConstants . CLASS : return NameLookup . ACCEPT_CLASSES ; case IJavaSearchConstants . INTERFACE : return NameLookup . ACCEPT_INTERFACES ; case IJavaSearchConstants . ENUM : return NameLookup . ACCEPT_ENUMS ; case IJavaSearchConstants . ANNOTATION_TYPE : return NameLookup . ACCEPT_ANNOTATIONS ; case IJavaSearchConstants . CLASS_AND_ENUM : return NameLookup . ACCEPT_CLASSES | NameLookup . ACCEPT_ENUMS ; case IJavaSearchConstants . CLASS_AND_INTERFACE : return NameLookup . ACCEPT_CLASSES | NameLookup . ACCEPT_INTERFACES ; default : return NameLookup . ACCEPT_ALL ; } } protected NameEnvironmentAnswer find ( String typeName , String packageName ) { if ( packageName == null ) packageName = IPackageFragment . DEFAULT_PACKAGE_NAME ; if ( this . owner != null ) { String source = this . owner . findSource ( typeName , packageName ) ; if ( source != null ) { ICompilationUnit cu = new BasicCompilationUnit ( source . toCharArray ( ) , CharOperation . splitOn ( '<CHAR_LIT:.>' , packageName . toCharArray ( ) ) , typeName + Util . defaultJavaExtension ( ) ) ; return new NameEnvironmentAnswer ( cu , null ) ; } } NameLookup . Answer answer = this . nameLookup . findType ( typeName , packageName , false , NameLookup . ACCEPT_ALL , this . checkAccessRestrictions ) ; if ( answer != null ) { if ( answer . type instanceof BinaryType ) { try { return new NameEnvironmentAnswer ( ( IBinaryType ) ( ( BinaryType ) answer . type ) . getElementInfo ( ) , answer . restriction ) ; } catch ( JavaModelException npe ) { } } else { try { SourceTypeElementInfo sourceType = ( SourceTypeElementInfo ) ( ( SourceType ) answer . type ) . getElementInfo ( ) ; ISourceType topLevelType = sourceType ; while ( topLevelType . getEnclosingType ( ) != null ) { topLevelType = topLevelType . getEnclosingType ( ) ; } IType [ ] types = sourceType . getHandle ( ) . getCompilationUnit ( ) . getTypes ( ) ; ISourceType [ ] sourceTypes = new ISourceType [ types . length ] ; sourceTypes [ <NUM_LIT:0> ] = sourceType ; int length = types . length ; for ( int i = <NUM_LIT:0> , index = <NUM_LIT:1> ; i < length ; i ++ ) { ISourceType otherType = ( ISourceType ) ( ( JavaElement ) types [ i ] ) . getElementInfo ( ) ; if ( ! otherType . equals ( topLevelType ) && index < length ) sourceTypes [ index ++ ] = otherType ; } return new NameEnvironmentAnswer ( sourceTypes , answer . restriction ) ; } catch ( JavaModelException npe ) { } } } return null ; } public void findPackages ( char [ ] prefix , ISearchRequestor requestor ) { this . nameLookup . seekPackageFragments ( new String ( prefix ) , true , new SearchableEnvironmentRequestor ( requestor ) ) ; } public void findExactTypes ( char [ ] name , final boolean findMembers , int searchFor , final ISearchRequestor storage ) { try { final String excludePath ; if ( this . unitToSkip != null ) { if ( ! ( this . unitToSkip instanceof IJavaElement ) ) { findExactTypes ( new String ( name ) , storage , convertSearchFilterToModelFilter ( searchFor ) ) ; return ; } excludePath = ( ( IJavaElement ) this . unitToSkip ) . getPath ( ) . toString ( ) ; } else { excludePath = null ; } IProgressMonitor progressMonitor = new IProgressMonitor ( ) { boolean isCanceled = false ; public void beginTask ( String n , int totalWork ) { } public void done ( ) { } public void internalWorked ( double work ) { } public boolean isCanceled ( ) { return this . isCanceled ; } public void setCanceled ( boolean value ) { this . isCanceled = value ; } public void setTaskName ( String n ) { } public void subTask ( String n ) { } public void worked ( int work ) { } } ; IRestrictedAccessTypeRequestor typeRequestor = new IRestrictedAccessTypeRequestor ( ) { public void acceptType ( int modifiers , char [ ] packageName , char [ ] simpleTypeName , char [ ] [ ] enclosingTypeNames , String path , AccessRestriction access ) { if ( excludePath != null && excludePath . equals ( path ) ) return ; if ( ! findMembers && enclosingTypeNames != null && enclosingTypeNames . length > <NUM_LIT:0> ) return ; storage . acceptType ( packageName , simpleTypeName , enclosingTypeNames , modifiers , access ) ; } } ; try { new BasicSearchEngine ( this . workingCopies ) . searchAllTypeNames ( null , SearchPattern . R_EXACT_MATCH , name , SearchPattern . R_EXACT_MATCH , searchFor , getSearchScope ( ) , typeRequestor , CANCEL_IF_NOT_READY_TO_SEARCH , progressMonitor ) ; } catch ( OperationCanceledException e ) { findExactTypes ( new String ( name ) , storage , convertSearchFilterToModelFilter ( searchFor ) ) ; } } catch ( JavaModelException e ) { findExactTypes ( new String ( name ) , storage , convertSearchFilterToModelFilter ( searchFor ) ) ; } } private void findExactTypes ( String name , ISearchRequestor storage , int type ) { SearchableEnvironmentRequestor requestor = new SearchableEnvironmentRequestor ( storage , this . unitToSkip , this . project , this . nameLookup ) ; this . nameLookup . seekTypes ( name , null , false , type , requestor ) ; } public NameEnvironmentAnswer findType ( char [ ] [ ] compoundTypeName ) { if ( compoundTypeName == null ) return null ; int length = compoundTypeName . length ; if ( length <= <NUM_LIT:1> ) { if ( length == <NUM_LIT:0> ) return null ; return find ( new String ( compoundTypeName [ <NUM_LIT:0> ] ) , null ) ; } int lengthM1 = length - <NUM_LIT:1> ; char [ ] [ ] packageName = new char [ lengthM1 ] [ ] ; System . arraycopy ( compoundTypeName , <NUM_LIT:0> , packageName , <NUM_LIT:0> , lengthM1 ) ; return find ( new String ( compoundTypeName [ lengthM1 ] ) , CharOperation . toString ( packageName ) ) ; } public NameEnvironmentAnswer findType ( char [ ] name , char [ ] [ ] packageName ) { if ( name == null ) return null ; return find ( new String ( name ) , packageName == null || packageName . length == <NUM_LIT:0> ? null : CharOperation . toString ( packageName ) ) ; } public void findTypes ( char [ ] prefix , final boolean findMembers , boolean camelCaseMatch , int searchFor , final ISearchRequestor storage ) { findTypes ( prefix , findMembers , camelCaseMatch , searchFor , storage , null ) ; } public void findTypes ( char [ ] prefix , final boolean findMembers , boolean camelCaseMatch , int searchFor , final ISearchRequestor storage , IProgressMonitor monitor ) { try { final String excludePath ; if ( this . unitToSkip != null ) { if ( ! ( this . unitToSkip instanceof IJavaElement ) ) { findTypes ( new String ( prefix ) , storage , convertSearchFilterToModelFilter ( searchFor ) ) ; return ; } excludePath = ( ( IJavaElement ) this . unitToSkip ) . getPath ( ) . toString ( ) ; } else { excludePath = null ; } int lastDotIndex = CharOperation . lastIndexOf ( '<CHAR_LIT:.>' , prefix ) ; char [ ] qualification , simpleName ; if ( lastDotIndex < <NUM_LIT:0> ) { qualification = null ; if ( camelCaseMatch ) { simpleName = prefix ; } else { simpleName = CharOperation . toLowerCase ( prefix ) ; } } else { qualification = CharOperation . subarray ( prefix , <NUM_LIT:0> , lastDotIndex ) ; if ( camelCaseMatch ) { simpleName = CharOperation . subarray ( prefix , lastDotIndex + <NUM_LIT:1> , prefix . length ) ; } else { simpleName = CharOperation . toLowerCase ( CharOperation . subarray ( prefix , lastDotIndex + <NUM_LIT:1> , prefix . length ) ) ; } } IProgressMonitor progressMonitor = new IProgressMonitor ( ) { boolean isCanceled = false ; public void beginTask ( String name , int totalWork ) { } public void done ( ) { } public void internalWorked ( double work ) { } public boolean isCanceled ( ) { return this . isCanceled ; } public void setCanceled ( boolean value ) { this . isCanceled = value ; } public void setTaskName ( String name ) { } public void subTask ( String name ) { } public void worked ( int work ) { } } ; IRestrictedAccessTypeRequestor typeRequestor = new IRestrictedAccessTypeRequestor ( ) { public void acceptType ( int modifiers , char [ ] packageName , char [ ] simpleTypeName , char [ ] [ ] enclosingTypeNames , String path , AccessRestriction access ) { if ( excludePath != null && excludePath . equals ( path ) ) return ; if ( ! findMembers && enclosingTypeNames != null && enclosingTypeNames . length > <NUM_LIT:0> ) return ; storage . acceptType ( packageName , simpleTypeName , enclosingTypeNames , modifiers , access ) ; } } ; int matchRule = SearchPattern . R_PREFIX_MATCH ; if ( camelCaseMatch ) matchRule |= SearchPattern . R_CAMELCASE_MATCH ; if ( monitor != null ) { IndexManager indexManager = JavaModelManager . getIndexManager ( ) ; if ( indexManager . awaitingJobsCount ( ) == <NUM_LIT:0> ) { new BasicSearchEngine ( this . workingCopies ) . searchAllTypeNames ( qualification , SearchPattern . R_EXACT_MATCH , simpleName , matchRule , searchFor , getSearchScope ( ) , typeRequestor , FORCE_IMMEDIATE_SEARCH , progressMonitor ) ; } else { try { Thread . sleep ( <NUM_LIT:100> ) ; } catch ( InterruptedException e ) { } if ( monitor . isCanceled ( ) ) { throw new OperationCanceledException ( ) ; } if ( indexManager . awaitingJobsCount ( ) == <NUM_LIT:0> ) { new BasicSearchEngine ( this . workingCopies ) . searchAllTypeNames ( qualification , SearchPattern . R_EXACT_MATCH , simpleName , matchRule , searchFor , getSearchScope ( ) , typeRequestor , FORCE_IMMEDIATE_SEARCH , progressMonitor ) ; } else { findTypes ( new String ( prefix ) , storage , convertSearchFilterToModelFilter ( searchFor ) ) ; } } } else { try { new BasicSearchEngine ( this . workingCopies ) . searchAllTypeNames ( qualification , SearchPattern . R_EXACT_MATCH , simpleName , matchRule , searchFor , getSearchScope ( ) , typeRequestor , CANCEL_IF_NOT_READY_TO_SEARCH , progressMonitor ) ; } catch ( OperationCanceledException e ) { findTypes ( new String ( prefix ) , storage , convertSearchFilterToModelFilter ( searchFor ) ) ; } } } catch ( JavaModelException e ) { findTypes ( new String ( prefix ) , storage , convertSearchFilterToModelFilter ( searchFor ) ) ; } } public void findConstructorDeclarations ( char [ ] prefix , boolean camelCaseMatch , final ISearchRequestor storage , IProgressMonitor monitor ) { try { final String excludePath ; if ( this . unitToSkip != null && this . unitToSkip instanceof IJavaElement ) { excludePath = ( ( IJavaElement ) this . unitToSkip ) . getPath ( ) . toString ( ) ; } else { excludePath = null ; } int lastDotIndex = CharOperation . lastIndexOf ( '<CHAR_LIT:.>' , prefix ) ; char [ ] qualification , simpleName ; if ( lastDotIndex < <NUM_LIT:0> ) { qualification = null ; if ( camelCaseMatch ) { simpleName = prefix ; } else { simpleName = CharOperation . toLowerCase ( prefix ) ; } } else { qualification = CharOperation . subarray ( prefix , <NUM_LIT:0> , lastDotIndex ) ; if ( camelCaseMatch ) { simpleName = CharOperation . subarray ( prefix , lastDotIndex + <NUM_LIT:1> , prefix . length ) ; } else { simpleName = CharOperation . toLowerCase ( CharOperation . subarray ( prefix , lastDotIndex + <NUM_LIT:1> , prefix . length ) ) ; } } IProgressMonitor progressMonitor = new IProgressMonitor ( ) { boolean isCanceled = false ; public void beginTask ( String name , int totalWork ) { } public void done ( ) { } public void internalWorked ( double work ) { } public boolean isCanceled ( ) { return this . isCanceled ; } public void setCanceled ( boolean value ) { this . isCanceled = value ; } public void setTaskName ( String name ) { } public void subTask ( String name ) { } public void worked ( int work ) { } } ; IRestrictedAccessConstructorRequestor constructorRequestor = new IRestrictedAccessConstructorRequestor ( ) { public void acceptConstructor ( int modifiers , char [ ] simpleTypeName , int parameterCount , char [ ] signature , char [ ] [ ] parameterTypes , char [ ] [ ] parameterNames , int typeModifiers , char [ ] packageName , int extraFlags , String path , AccessRestriction access ) { if ( excludePath != null && excludePath . equals ( path ) ) return ; storage . acceptConstructor ( modifiers , simpleTypeName , parameterCount , signature , parameterTypes , parameterNames , typeModifiers , packageName , extraFlags , path , access ) ; } } ; int matchRule = SearchPattern . R_PREFIX_MATCH ; if ( camelCaseMatch ) matchRule |= SearchPattern . R_CAMELCASE_MATCH ; if ( monitor != null ) { IndexManager indexManager = JavaModelManager . getIndexManager ( ) ; while ( indexManager . awaitingJobsCount ( ) > <NUM_LIT:0> ) { try { Thread . sleep ( <NUM_LIT> ) ; } catch ( InterruptedException e ) { } if ( monitor . isCanceled ( ) ) { throw new OperationCanceledException ( ) ; } } new BasicSearchEngine ( this . workingCopies ) . searchAllConstructorDeclarations ( qualification , simpleName , matchRule , getSearchScope ( ) , constructorRequestor , FORCE_IMMEDIATE_SEARCH , progressMonitor ) ; } else { try { new BasicSearchEngine ( this . workingCopies ) . searchAllConstructorDeclarations ( qualification , simpleName , matchRule , getSearchScope ( ) , constructorRequestor , CANCEL_IF_NOT_READY_TO_SEARCH , progressMonitor ) ; } catch ( OperationCanceledException e ) { } } } catch ( JavaModelException e ) { } } private void findTypes ( String prefix , ISearchRequestor storage , int type ) { SearchableEnvironmentRequestor requestor = new SearchableEnvironmentRequestor ( storage , this . unitToSkip , this . project , this . nameLookup ) ; int index = prefix . lastIndexOf ( '<CHAR_LIT:.>' ) ; if ( index == - <NUM_LIT:1> ) { this . nameLookup . seekTypes ( prefix , null , true , type , requestor ) ; } else { String packageName = prefix . substring ( <NUM_LIT:0> , index ) ; JavaElementRequestor elementRequestor = new JavaElementRequestor ( ) ; this . nameLookup . seekPackageFragments ( packageName , false , elementRequestor ) ; IPackageFragment [ ] fragments = elementRequestor . getPackageFragments ( ) ; if ( fragments != null ) { String className = prefix . substring ( index + <NUM_LIT:1> ) ; for ( int i = <NUM_LIT:0> , length = fragments . length ; i < length ; i ++ ) if ( fragments [ i ] != null ) this . nameLookup . seekTypes ( className , fragments [ i ] , true , type , requestor ) ; } } } private IJavaSearchScope getSearchScope ( ) { if ( this . searchScope == null ) { if ( this . checkAccessRestrictions ) { this . searchScope = BasicSearchEngine . createJavaSearchScope ( new IJavaElement [ ] { this . project } ) ; } else { this . searchScope = BasicSearchEngine . createJavaSearchScope ( this . nameLookup . packageFragmentRoots ) ; } } return this . searchScope ; } public boolean isPackage ( char [ ] [ ] parentPackageName , char [ ] subPackageName ) { String [ ] pkgName ; if ( parentPackageName == null ) pkgName = new String [ ] { new String ( subPackageName ) } ; else { int length = parentPackageName . length ; pkgName = new String [ length + <NUM_LIT:1> ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) pkgName [ i ] = new String ( parentPackageName [ i ] ) ; pkgName [ length ] = new String ( subPackageName ) ; } return ( this . owner != null && this . owner . isPackage ( pkgName ) ) || this . nameLookup . isPackage ( pkgName ) ; } protected String toStringChar ( char [ ] name ) { return "<STR_LIT:[>" + new String ( name ) + "<STR_LIT:]>" ; } protected String toStringCharChar ( char [ ] [ ] names ) { StringBuffer result = new StringBuffer ( ) ; for ( int i = <NUM_LIT:0> ; i < names . length ; i ++ ) { result . append ( toStringChar ( names [ i ] ) ) ; } return result . toString ( ) ; } public void cleanup ( ) { } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaModelStatusConstants ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . internal . core . util . Messages ; public class RenameResourceElementsOperation extends MoveResourceElementsOperation { public RenameResourceElementsOperation ( IJavaElement [ ] elements , IJavaElement [ ] destinations , String [ ] newNames , boolean force ) { super ( elements , destinations , force ) ; setRenamings ( newNames ) ; } protected String getMainTaskName ( ) { return Messages . operation_renameResourceProgress ; } protected boolean isRename ( ) { return true ; } protected void verify ( IJavaElement element ) throws JavaModelException { super . verify ( element ) ; int elementType = element . getElementType ( ) ; if ( ! ( elementType == IJavaElement . COMPILATION_UNIT || elementType == IJavaElement . PACKAGE_FRAGMENT ) ) { error ( IJavaModelStatusConstants . INVALID_ELEMENT_TYPES , element ) ; } if ( elementType == IJavaElement . COMPILATION_UNIT ) { CompilationUnit cu = ( CompilationUnit ) element ; if ( cu . isWorkingCopy ( ) && ! cu . isPrimary ( ) ) { error ( IJavaModelStatusConstants . INVALID_ELEMENT_TYPES , element ) ; } } verifyRenaming ( element ) ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . Path ; import org . eclipse . jdt . core . IClasspathContainer ; import org . eclipse . jdt . core . IClasspathEntry ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . internal . core . util . Util ; public class UserLibraryClasspathContainer implements IClasspathContainer { private String name ; public UserLibraryClasspathContainer ( String name ) { this . name = name ; } public IClasspathEntry [ ] getClasspathEntries ( ) { UserLibrary library = getUserLibrary ( ) ; if ( library != null ) { return library . getEntries ( ) ; } return new IClasspathEntry [ <NUM_LIT:0> ] ; } public String getDescription ( ) { return this . name ; } public int getKind ( ) { UserLibrary library = getUserLibrary ( ) ; if ( library != null && library . isSystemLibrary ( ) ) { return K_SYSTEM ; } return K_APPLICATION ; } public IPath getPath ( ) { return new Path ( JavaCore . USER_LIBRARY_CONTAINER_ID ) . append ( this . name ) ; } private UserLibrary getUserLibrary ( ) { UserLibrary userLibrary = JavaModelManager . getUserLibraryManager ( ) . getUserLibrary ( this . name ) ; if ( userLibrary == null && ( JavaModelManager . CP_RESOLVE_VERBOSE || JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE ) ) { verbose_no_user_library_found ( this . name ) ; } return userLibrary ; } private void verbose_no_user_library_found ( String userLibraryName ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + userLibraryName ) ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . core . resources . IFile ; import org . eclipse . jdt . core . IOpenable ; public class NullBuffer extends Buffer { public NullBuffer ( IFile file , IOpenable owner , boolean readOnly ) { super ( file , owner , readOnly ) ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import java . io . InputStream ; import java . net . URL ; import java . util . ArrayList ; import java . util . HashMap ; import org . eclipse . core . runtime . Assert ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . search . SearchEngine ; import org . eclipse . jdt . internal . codeassist . CompletionEngine ; import org . eclipse . jdt . internal . compiler . ast . TypeDeclaration ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . env . IBinaryAnnotation ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . core . JavaModelManager . PerProjectInfo ; import org . eclipse . jdt . internal . core . hierarchy . TypeHierarchy ; import org . eclipse . jdt . internal . core . util . MementoTokenizer ; import org . eclipse . jdt . internal . core . util . Messages ; import org . eclipse . jdt . internal . core . util . Util ; public class BinaryType extends BinaryMember implements IType , SuffixConstants { private static final IField [ ] NO_FIELDS = new IField [ <NUM_LIT:0> ] ; private static final IMethod [ ] NO_METHODS = new IMethod [ <NUM_LIT:0> ] ; private static final IType [ ] NO_TYPES = new IType [ <NUM_LIT:0> ] ; private static final IInitializer [ ] NO_INITIALIZERS = new IInitializer [ <NUM_LIT:0> ] ; public static final JavadocContents EMPTY_JAVADOC = new JavadocContents ( null , org . eclipse . jdt . internal . compiler . util . Util . EMPTY_STRING ) ; protected BinaryType ( JavaElement parent , String name ) { super ( parent , name ) ; } protected void closing ( Object info ) throws JavaModelException { ClassFileInfo cfi = getClassFileInfo ( ) ; cfi . removeBinaryChildren ( ) ; } public void codeComplete ( char [ ] snippet , int insertion , int position , char [ ] [ ] localVariableTypeNames , char [ ] [ ] localVariableNames , int [ ] localVariableModifiers , boolean isStatic , ICompletionRequestor requestor ) throws JavaModelException { codeComplete ( snippet , insertion , position , localVariableTypeNames , localVariableNames , localVariableModifiers , isStatic , requestor , DefaultWorkingCopyOwner . PRIMARY ) ; } public void codeComplete ( char [ ] snippet , int insertion , int position , char [ ] [ ] localVariableTypeNames , char [ ] [ ] localVariableNames , int [ ] localVariableModifiers , boolean isStatic , ICompletionRequestor requestor , WorkingCopyOwner owner ) throws JavaModelException { if ( requestor == null ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } codeComplete ( snippet , insertion , position , localVariableTypeNames , localVariableNames , localVariableModifiers , isStatic , new org . eclipse . jdt . internal . codeassist . CompletionRequestorWrapper ( requestor ) , owner ) ; } public void codeComplete ( char [ ] snippet , int insertion , int position , char [ ] [ ] localVariableTypeNames , char [ ] [ ] localVariableNames , int [ ] localVariableModifiers , boolean isStatic , CompletionRequestor requestor ) throws JavaModelException { codeComplete ( snippet , insertion , position , localVariableTypeNames , localVariableNames , localVariableModifiers , isStatic , requestor , DefaultWorkingCopyOwner . PRIMARY ) ; } public void codeComplete ( char [ ] snippet , int insertion , int position , char [ ] [ ] localVariableTypeNames , char [ ] [ ] localVariableNames , int [ ] localVariableModifiers , boolean isStatic , CompletionRequestor requestor , IProgressMonitor monitor ) throws JavaModelException { codeComplete ( snippet , insertion , position , localVariableTypeNames , localVariableNames , localVariableModifiers , isStatic , requestor , DefaultWorkingCopyOwner . PRIMARY , monitor ) ; } public void codeComplete ( char [ ] snippet , int insertion , int position , char [ ] [ ] localVariableTypeNames , char [ ] [ ] localVariableNames , int [ ] localVariableModifiers , boolean isStatic , CompletionRequestor requestor , WorkingCopyOwner owner ) throws JavaModelException { codeComplete ( snippet , insertion , position , localVariableTypeNames , localVariableNames , localVariableModifiers , isStatic , requestor , owner , null ) ; } public void codeComplete ( char [ ] snippet , int insertion , int position , char [ ] [ ] localVariableTypeNames , char [ ] [ ] localVariableNames , int [ ] localVariableModifiers , boolean isStatic , CompletionRequestor requestor , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException { if ( requestor == null ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } JavaProject project = ( JavaProject ) getJavaProject ( ) ; SearchableEnvironment environment = project . newSearchableNameEnvironment ( owner ) ; CompletionEngine engine = new CompletionEngine ( environment , requestor , project . getOptions ( true ) , project , owner , monitor ) ; String source = getClassFile ( ) . getSource ( ) ; if ( source != null && insertion > - <NUM_LIT:1> && insertion < source . length ( ) ) { char [ ] prefix = CharOperation . concat ( source . substring ( <NUM_LIT:0> , insertion ) . toCharArray ( ) , new char [ ] { '<CHAR_LIT>' } ) ; char [ ] suffix = CharOperation . concat ( new char [ ] { '<CHAR_LIT:}>' } , source . substring ( insertion ) . toCharArray ( ) ) ; char [ ] fakeSource = CharOperation . concat ( prefix , snippet , suffix ) ; BasicCompilationUnit cu = new BasicCompilationUnit ( fakeSource , null , getElementName ( ) , project ) ; engine . complete ( cu , prefix . length + position , prefix . length , null ) ; } else { engine . complete ( this , snippet , position , localVariableTypeNames , localVariableNames , localVariableModifiers , isStatic ) ; } if ( NameLookup . VERBOSE ) { System . out . println ( Thread . currentThread ( ) + "<STR_LIT>" + environment . nameLookup . timeSpentInSeekTypesInSourcePackage + "<STR_LIT>" ) ; System . out . println ( Thread . currentThread ( ) + "<STR_LIT>" + environment . nameLookup . timeSpentInSeekTypesInBinaryPackage + "<STR_LIT>" ) ; } } public IField createField ( String contents , IJavaElement sibling , boolean force , IProgressMonitor monitor ) throws JavaModelException { throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . READ_ONLY , this ) ) ; } public IInitializer createInitializer ( String contents , IJavaElement sibling , IProgressMonitor monitor ) throws JavaModelException { throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . READ_ONLY , this ) ) ; } public IMethod createMethod ( String contents , IJavaElement sibling , boolean force , IProgressMonitor monitor ) throws JavaModelException { throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . READ_ONLY , this ) ) ; } public IType createType ( String contents , IJavaElement sibling , boolean force , IProgressMonitor monitor ) throws JavaModelException { throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . READ_ONLY , this ) ) ; } public boolean equals ( Object o ) { if ( ! ( o instanceof BinaryType ) ) return false ; return super . equals ( o ) ; } public IMethod [ ] findMethods ( IMethod method ) { try { return findMethods ( method , getMethods ( ) ) ; } catch ( JavaModelException e ) { return null ; } } public IAnnotation [ ] getAnnotations ( ) throws JavaModelException { IBinaryType info = ( IBinaryType ) getElementInfo ( ) ; IBinaryAnnotation [ ] binaryAnnotations = info . getAnnotations ( ) ; return getAnnotations ( binaryAnnotations , info . getTagBits ( ) ) ; } public IJavaElement [ ] getChildren ( ) throws JavaModelException { ClassFileInfo cfi = getClassFileInfo ( ) ; return cfi . binaryChildren ; } public IJavaElement [ ] getChildrenForCategory ( String category ) throws JavaModelException { IJavaElement [ ] children = getChildren ( ) ; int length = children . length ; if ( length == <NUM_LIT:0> ) return children ; SourceMapper mapper = getSourceMapper ( ) ; if ( mapper != null ) { ( ( ClassFile ) getClassFile ( ) ) . getBuffer ( ) ; HashMap categories = mapper . categories ; IJavaElement [ ] result = new IJavaElement [ length ] ; int index = <NUM_LIT:0> ; if ( categories != null ) { for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IJavaElement child = children [ i ] ; String [ ] cats = ( String [ ] ) categories . get ( child ) ; if ( cats != null ) { for ( int j = <NUM_LIT:0> , length2 = cats . length ; j < length2 ; j ++ ) { if ( cats [ j ] . equals ( category ) ) { result [ index ++ ] = child ; break ; } } } } } if ( index < length ) System . arraycopy ( result , <NUM_LIT:0> , result = new IJavaElement [ index ] , <NUM_LIT:0> , index ) ; return result ; } return NO_ELEMENTS ; } protected ClassFileInfo getClassFileInfo ( ) throws JavaModelException { ClassFile cf = ( ClassFile ) this . parent ; return ( ClassFileInfo ) cf . getElementInfo ( ) ; } public IType getDeclaringType ( ) { IClassFile classFile = getClassFile ( ) ; if ( classFile . isOpen ( ) ) { try { char [ ] enclosingTypeName = ( ( IBinaryType ) getElementInfo ( ) ) . getEnclosingTypeName ( ) ; if ( enclosingTypeName == null ) { return null ; } enclosingTypeName = ClassFile . unqualifiedName ( enclosingTypeName ) ; if ( classFile . getElementName ( ) . length ( ) > enclosingTypeName . length + <NUM_LIT:1> && Character . isDigit ( classFile . getElementName ( ) . charAt ( enclosingTypeName . length + <NUM_LIT:1> ) ) ) { return null ; } return getPackageFragment ( ) . getClassFile ( new String ( enclosingTypeName ) + SUFFIX_STRING_class ) . getType ( ) ; } catch ( JavaModelException npe ) { return null ; } } else { String classFileName = classFile . getElementName ( ) ; int lastDollar = - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> , length = classFileName . length ( ) ; i < length ; i ++ ) { char c = classFileName . charAt ( i ) ; if ( Character . isDigit ( c ) && lastDollar == i - <NUM_LIT:1> ) { return null ; } else if ( c == '<CHAR_LIT>' ) { lastDollar = i ; } } if ( lastDollar == - <NUM_LIT:1> ) { return null ; } else { String enclosingName = classFileName . substring ( <NUM_LIT:0> , lastDollar ) ; String enclosingClassFileName = enclosingName + SUFFIX_STRING_class ; return new BinaryType ( ( JavaElement ) getPackageFragment ( ) . getClassFile ( enclosingClassFileName ) , Util . localTypeName ( enclosingName , enclosingName . lastIndexOf ( '<CHAR_LIT>' ) , enclosingName . length ( ) ) ) ; } } } public Object getElementInfo ( IProgressMonitor monitor ) throws JavaModelException { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; Object info = manager . getInfo ( this ) ; if ( info != null && info != JavaModelCache . NON_EXISTING_JAR_TYPE_INFO ) return info ; return openWhenClosed ( createElementInfo ( ) , monitor ) ; } public int getElementType ( ) { return TYPE ; } public IField getField ( String fieldName ) { return new BinaryField ( this , fieldName ) ; } public IField [ ] getFields ( ) throws JavaModelException { ArrayList list = getChildrenOfType ( FIELD ) ; int size ; if ( ( size = list . size ( ) ) == <NUM_LIT:0> ) { return NO_FIELDS ; } else { IField [ ] array = new IField [ size ] ; list . toArray ( array ) ; return array ; } } public int getFlags ( ) throws JavaModelException { IBinaryType info = ( IBinaryType ) getElementInfo ( ) ; return info . getModifiers ( ) & ~ ClassFileConstants . AccSuper ; } public String getFullyQualifiedName ( ) { return this . getFullyQualifiedName ( '<CHAR_LIT>' ) ; } public String getFullyQualifiedName ( char enclosingTypeSeparator ) { try { return getFullyQualifiedName ( enclosingTypeSeparator , false ) ; } catch ( JavaModelException e ) { return null ; } } public String getFullyQualifiedParameterizedName ( ) throws JavaModelException { return getFullyQualifiedName ( '<CHAR_LIT:.>' , true ) ; } public IJavaElement getHandleFromMemento ( String token , MementoTokenizer memento , WorkingCopyOwner workingCopyOwner ) { switch ( token . charAt ( <NUM_LIT:0> ) ) { case JEM_COUNT : return getHandleUpdatingCountFromMemento ( memento , workingCopyOwner ) ; case JEM_FIELD : if ( ! memento . hasMoreTokens ( ) ) return this ; String fieldName = memento . nextToken ( ) ; JavaElement field = ( JavaElement ) getField ( fieldName ) ; return field . getHandleFromMemento ( memento , workingCopyOwner ) ; case JEM_INITIALIZER : if ( ! memento . hasMoreTokens ( ) ) return this ; String count = memento . nextToken ( ) ; JavaElement initializer = ( JavaElement ) getInitializer ( Integer . parseInt ( count ) ) ; return initializer . getHandleFromMemento ( memento , workingCopyOwner ) ; case JEM_METHOD : if ( ! memento . hasMoreTokens ( ) ) return this ; String selector = memento . nextToken ( ) ; ArrayList params = new ArrayList ( ) ; nextParam : while ( memento . hasMoreTokens ( ) ) { token = memento . nextToken ( ) ; switch ( token . charAt ( <NUM_LIT:0> ) ) { case JEM_TYPE : case JEM_TYPE_PARAMETER : case JEM_ANNOTATION : break nextParam ; case JEM_METHOD : if ( ! memento . hasMoreTokens ( ) ) return this ; String param = memento . nextToken ( ) ; StringBuffer buffer = new StringBuffer ( ) ; while ( param . length ( ) == <NUM_LIT:1> && Signature . C_ARRAY == param . charAt ( <NUM_LIT:0> ) ) { buffer . append ( Signature . C_ARRAY ) ; if ( ! memento . hasMoreTokens ( ) ) return this ; param = memento . nextToken ( ) ; } params . add ( buffer . toString ( ) + param ) ; break ; default : break nextParam ; } } String [ ] parameters = new String [ params . size ( ) ] ; params . toArray ( parameters ) ; JavaElement method = ( JavaElement ) getMethod ( selector , parameters ) ; switch ( token . charAt ( <NUM_LIT:0> ) ) { case JEM_TYPE : case JEM_TYPE_PARAMETER : case JEM_LOCALVARIABLE : case JEM_ANNOTATION : return method . getHandleFromMemento ( token , memento , workingCopyOwner ) ; default : return method ; } case JEM_TYPE : String typeName ; if ( memento . hasMoreTokens ( ) ) { typeName = memento . nextToken ( ) ; char firstChar = typeName . charAt ( <NUM_LIT:0> ) ; if ( firstChar == JEM_FIELD || firstChar == JEM_INITIALIZER || firstChar == JEM_METHOD || firstChar == JEM_TYPE || firstChar == JEM_COUNT ) { token = typeName ; typeName = "<STR_LIT>" ; } else { token = null ; } } else { typeName = "<STR_LIT>" ; token = null ; } JavaElement type = ( JavaElement ) getType ( typeName ) ; if ( token == null ) { return type . getHandleFromMemento ( memento , workingCopyOwner ) ; } else { return type . getHandleFromMemento ( token , memento , workingCopyOwner ) ; } case JEM_TYPE_PARAMETER : if ( ! memento . hasMoreTokens ( ) ) return this ; String typeParameterName = memento . nextToken ( ) ; JavaElement typeParameter = new TypeParameter ( this , typeParameterName ) ; return typeParameter . getHandleFromMemento ( memento , workingCopyOwner ) ; case JEM_ANNOTATION : if ( ! memento . hasMoreTokens ( ) ) return this ; String annotationName = memento . nextToken ( ) ; JavaElement annotation = new Annotation ( this , annotationName ) ; return annotation . getHandleFromMemento ( memento , workingCopyOwner ) ; } return null ; } public IInitializer getInitializer ( int count ) { return new Initializer ( this , count ) ; } public IInitializer [ ] getInitializers ( ) { return NO_INITIALIZERS ; } public String getKey ( boolean forceOpen ) throws JavaModelException { return getKey ( this , forceOpen ) ; } public IMethod getMethod ( String selector , String [ ] parameterTypeSignatures ) { return new BinaryMethod ( this , selector , parameterTypeSignatures ) ; } public IMethod [ ] getMethods ( ) throws JavaModelException { ArrayList list = getChildrenOfType ( METHOD ) ; int size ; if ( ( size = list . size ( ) ) == <NUM_LIT:0> ) { return NO_METHODS ; } else { IMethod [ ] array = new IMethod [ size ] ; list . toArray ( array ) ; return array ; } } public IPackageFragment getPackageFragment ( ) { IJavaElement parentElement = this . parent ; while ( parentElement != null ) { if ( parentElement . getElementType ( ) == IJavaElement . PACKAGE_FRAGMENT ) { return ( IPackageFragment ) parentElement ; } else { parentElement = parentElement . getParent ( ) ; } } Assert . isTrue ( false ) ; return null ; } public String getSuperclassTypeSignature ( ) throws JavaModelException { IBinaryType info = ( IBinaryType ) getElementInfo ( ) ; char [ ] genericSignature = info . getGenericSignature ( ) ; if ( genericSignature != null ) { int signatureLength = genericSignature . length ; int index = <NUM_LIT:0> ; if ( genericSignature [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) { int count = <NUM_LIT:1> ; while ( count > <NUM_LIT:0> && ++ index < signatureLength ) { switch ( genericSignature [ index ] ) { case '<CHAR_LIT>' : count ++ ; break ; case '<CHAR_LIT:>>' : count -- ; break ; } } index ++ ; } int start = index ; index = Util . scanClassTypeSignature ( genericSignature , start ) + <NUM_LIT:1> ; char [ ] superclassSig = CharOperation . subarray ( genericSignature , start , index ) ; return new String ( ClassFile . translatedName ( superclassSig ) ) ; } else { char [ ] superclassName = info . getSuperclassName ( ) ; if ( superclassName == null ) { return null ; } return new String ( Signature . createTypeSignature ( ClassFile . translatedName ( superclassName ) , true ) ) ; } } public String getSourceFileName ( IBinaryType info ) { if ( info == null ) { try { info = ( IBinaryType ) getElementInfo ( ) ; } catch ( JavaModelException e ) { IType type = this ; IType enclosingType = getDeclaringType ( ) ; while ( enclosingType != null ) { type = enclosingType ; enclosingType = type . getDeclaringType ( ) ; } return type . getElementName ( ) + Util . defaultJavaExtension ( ) ; } } return sourceFileName ( info ) ; } public String getSuperclassName ( ) throws JavaModelException { IBinaryType info = ( IBinaryType ) getElementInfo ( ) ; char [ ] superclassName = info . getSuperclassName ( ) ; if ( superclassName == null ) { return null ; } return new String ( ClassFile . translatedName ( superclassName ) ) ; } public String [ ] getSuperInterfaceNames ( ) throws JavaModelException { IBinaryType info = ( IBinaryType ) getElementInfo ( ) ; char [ ] [ ] names = info . getInterfaceNames ( ) ; int length ; if ( names == null || ( length = names . length ) == <NUM_LIT:0> ) { return CharOperation . NO_STRINGS ; } names = ClassFile . translatedNames ( names ) ; String [ ] strings = new String [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { strings [ i ] = new String ( names [ i ] ) ; } return strings ; } public String [ ] getSuperInterfaceTypeSignatures ( ) throws JavaModelException { IBinaryType info = ( IBinaryType ) getElementInfo ( ) ; char [ ] genericSignature = info . getGenericSignature ( ) ; if ( genericSignature != null ) { ArrayList interfaces = new ArrayList ( ) ; int signatureLength = genericSignature . length ; int index = <NUM_LIT:0> ; if ( genericSignature [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) { int count = <NUM_LIT:1> ; while ( count > <NUM_LIT:0> && ++ index < signatureLength ) { switch ( genericSignature [ index ] ) { case '<CHAR_LIT>' : count ++ ; break ; case '<CHAR_LIT:>>' : count -- ; break ; } } index ++ ; } index = Util . scanClassTypeSignature ( genericSignature , index ) + <NUM_LIT:1> ; while ( index < signatureLength ) { int start = index ; index = Util . scanClassTypeSignature ( genericSignature , start ) + <NUM_LIT:1> ; char [ ] interfaceSig = CharOperation . subarray ( genericSignature , start , index ) ; interfaces . add ( new String ( ClassFile . translatedName ( interfaceSig ) ) ) ; } int size = interfaces . size ( ) ; String [ ] result = new String [ size ] ; interfaces . toArray ( result ) ; return result ; } else { char [ ] [ ] names = info . getInterfaceNames ( ) ; int length ; if ( names == null || ( length = names . length ) == <NUM_LIT:0> ) { return CharOperation . NO_STRINGS ; } names = ClassFile . translatedNames ( names ) ; String [ ] strings = new String [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { strings [ i ] = new String ( Signature . createTypeSignature ( names [ i ] , true ) ) ; } return strings ; } } public ITypeParameter [ ] getTypeParameters ( ) throws JavaModelException { String [ ] typeParameterSignatures = getTypeParameterSignatures ( ) ; int length = typeParameterSignatures . length ; if ( length == <NUM_LIT:0> ) return TypeParameter . NO_TYPE_PARAMETERS ; ITypeParameter [ ] typeParameters = new ITypeParameter [ length ] ; for ( int i = <NUM_LIT:0> ; i < typeParameterSignatures . length ; i ++ ) { String typeParameterName = Signature . getTypeVariable ( typeParameterSignatures [ i ] ) ; typeParameters [ i ] = new TypeParameter ( this , typeParameterName ) ; } return typeParameters ; } public String [ ] getTypeParameterSignatures ( ) throws JavaModelException { IBinaryType info = ( IBinaryType ) getElementInfo ( ) ; char [ ] genericSignature = info . getGenericSignature ( ) ; if ( genericSignature == null ) return CharOperation . NO_STRINGS ; char [ ] dotBaseSignature = CharOperation . replaceOnCopy ( genericSignature , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; char [ ] [ ] typeParams = Signature . getTypeParameters ( dotBaseSignature ) ; return CharOperation . toStrings ( typeParams ) ; } public IType getType ( String typeName ) { IClassFile classFile = getPackageFragment ( ) . getClassFile ( getTypeQualifiedName ( ) + "<STR_LIT:$>" + typeName + SUFFIX_STRING_class ) ; return new BinaryType ( ( JavaElement ) classFile , typeName ) ; } public ITypeParameter getTypeParameter ( String typeParameterName ) { return new TypeParameter ( this , typeParameterName ) ; } public String getTypeQualifiedName ( ) { return this . getTypeQualifiedName ( '<CHAR_LIT>' ) ; } public String getTypeQualifiedName ( char enclosingTypeSeparator ) { try { return getTypeQualifiedName ( enclosingTypeSeparator , false ) ; } catch ( JavaModelException e ) { return null ; } } public IType [ ] getTypes ( ) throws JavaModelException { ArrayList list = getChildrenOfType ( TYPE ) ; int size ; if ( ( size = list . size ( ) ) == <NUM_LIT:0> ) { return NO_TYPES ; } else { IType [ ] array = new IType [ size ] ; list . toArray ( array ) ; return array ; } } public boolean isAnonymous ( ) throws JavaModelException { IBinaryType info = ( IBinaryType ) getElementInfo ( ) ; return info . isAnonymous ( ) ; } public boolean isClass ( ) throws JavaModelException { IBinaryType info = ( IBinaryType ) getElementInfo ( ) ; return TypeDeclaration . kind ( info . getModifiers ( ) ) == TypeDeclaration . CLASS_DECL ; } public boolean isEnum ( ) throws JavaModelException { IBinaryType info = ( IBinaryType ) getElementInfo ( ) ; return TypeDeclaration . kind ( info . getModifiers ( ) ) == TypeDeclaration . ENUM_DECL ; } public boolean isInterface ( ) throws JavaModelException { IBinaryType info = ( IBinaryType ) getElementInfo ( ) ; switch ( TypeDeclaration . kind ( info . getModifiers ( ) ) ) { case TypeDeclaration . INTERFACE_DECL : case TypeDeclaration . ANNOTATION_TYPE_DECL : return true ; } return false ; } public boolean isAnnotation ( ) throws JavaModelException { IBinaryType info = ( IBinaryType ) getElementInfo ( ) ; return TypeDeclaration . kind ( info . getModifiers ( ) ) == TypeDeclaration . ANNOTATION_TYPE_DECL ; } public boolean isLocal ( ) throws JavaModelException { IBinaryType info = ( IBinaryType ) getElementInfo ( ) ; return info . isLocal ( ) ; } public boolean isMember ( ) throws JavaModelException { IBinaryType info = ( IBinaryType ) getElementInfo ( ) ; return info . isMember ( ) ; } public boolean isResolved ( ) { return false ; } public ITypeHierarchy loadTypeHierachy ( InputStream input , IProgressMonitor monitor ) throws JavaModelException { return loadTypeHierachy ( input , DefaultWorkingCopyOwner . PRIMARY , monitor ) ; } public ITypeHierarchy loadTypeHierachy ( InputStream input , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException { return TypeHierarchy . load ( this , input , owner ) ; } public ITypeHierarchy newSupertypeHierarchy ( IProgressMonitor monitor ) throws JavaModelException { return this . newSupertypeHierarchy ( DefaultWorkingCopyOwner . PRIMARY , monitor ) ; } public ITypeHierarchy newSupertypeHierarchy ( ICompilationUnit [ ] workingCopies , IProgressMonitor monitor ) throws JavaModelException { CreateTypeHierarchyOperation op = new CreateTypeHierarchyOperation ( this , workingCopies , SearchEngine . createWorkspaceScope ( ) , false ) ; op . runOperation ( monitor ) ; return op . getResult ( ) ; } public ITypeHierarchy newSupertypeHierarchy ( IWorkingCopy [ ] workingCopies , IProgressMonitor monitor ) throws JavaModelException { ICompilationUnit [ ] copies ; if ( workingCopies == null ) { copies = null ; } else { int length = workingCopies . length ; System . arraycopy ( workingCopies , <NUM_LIT:0> , copies = new ICompilationUnit [ length ] , <NUM_LIT:0> , length ) ; } return newSupertypeHierarchy ( copies , monitor ) ; } public ITypeHierarchy newSupertypeHierarchy ( WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException { ICompilationUnit [ ] workingCopies = JavaModelManager . getJavaModelManager ( ) . getWorkingCopies ( owner , true ) ; CreateTypeHierarchyOperation op = new CreateTypeHierarchyOperation ( this , workingCopies , SearchEngine . createWorkspaceScope ( ) , false ) ; op . runOperation ( monitor ) ; return op . getResult ( ) ; } public ITypeHierarchy newTypeHierarchy ( IJavaProject project , IProgressMonitor monitor ) throws JavaModelException { return newTypeHierarchy ( project , DefaultWorkingCopyOwner . PRIMARY , monitor ) ; } public ITypeHierarchy newTypeHierarchy ( IJavaProject project , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException { if ( project == null ) { throw new IllegalArgumentException ( Messages . hierarchy_nullProject ) ; } ICompilationUnit [ ] workingCopies = JavaModelManager . getJavaModelManager ( ) . getWorkingCopies ( owner , true ) ; ICompilationUnit [ ] projectWCs = null ; if ( workingCopies != null ) { int length = workingCopies . length ; projectWCs = new ICompilationUnit [ length ] ; int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { ICompilationUnit wc = workingCopies [ i ] ; if ( project . equals ( wc . getJavaProject ( ) ) ) { projectWCs [ index ++ ] = wc ; } } if ( index != length ) { System . arraycopy ( projectWCs , <NUM_LIT:0> , projectWCs = new ICompilationUnit [ index ] , <NUM_LIT:0> , index ) ; } } CreateTypeHierarchyOperation op = new CreateTypeHierarchyOperation ( this , projectWCs , project , true ) ; op . runOperation ( monitor ) ; return op . getResult ( ) ; } public ITypeHierarchy newTypeHierarchy ( IProgressMonitor monitor ) throws JavaModelException { return newTypeHierarchy ( DefaultWorkingCopyOwner . PRIMARY , monitor ) ; } public ITypeHierarchy newTypeHierarchy ( ICompilationUnit [ ] workingCopies , IProgressMonitor monitor ) throws JavaModelException { CreateTypeHierarchyOperation op = new CreateTypeHierarchyOperation ( this , workingCopies , SearchEngine . createWorkspaceScope ( ) , true ) ; op . runOperation ( monitor ) ; return op . getResult ( ) ; } public ITypeHierarchy newTypeHierarchy ( IWorkingCopy [ ] workingCopies , IProgressMonitor monitor ) throws JavaModelException { ICompilationUnit [ ] copies ; if ( workingCopies == null ) { copies = null ; } else { int length = workingCopies . length ; System . arraycopy ( workingCopies , <NUM_LIT:0> , copies = new ICompilationUnit [ length ] , <NUM_LIT:0> , length ) ; } return newTypeHierarchy ( copies , monitor ) ; } public ITypeHierarchy newTypeHierarchy ( WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException { ICompilationUnit [ ] workingCopies = JavaModelManager . getJavaModelManager ( ) . getWorkingCopies ( owner , true ) ; CreateTypeHierarchyOperation op = new CreateTypeHierarchyOperation ( this , workingCopies , SearchEngine . createWorkspaceScope ( ) , true ) ; op . runOperation ( monitor ) ; return op . getResult ( ) ; } public JavaElement resolved ( Binding binding ) { SourceRefElement resolvedHandle = new ResolvedBinaryType ( this . parent , this . name , new String ( binding . computeUniqueKey ( ) ) ) ; resolvedHandle . occurrenceCount = this . occurrenceCount ; return resolvedHandle ; } public String sourceFileName ( IBinaryType info ) { char [ ] sourceFileName = info . sourceFileName ( ) ; if ( sourceFileName == null ) { if ( info . isMember ( ) ) { IType enclosingType = getDeclaringType ( ) ; if ( enclosingType == null ) return null ; while ( enclosingType . getDeclaringType ( ) != null ) { enclosingType = enclosingType . getDeclaringType ( ) ; } return enclosingType . getElementName ( ) + Util . defaultJavaExtension ( ) ; } else if ( info . isLocal ( ) || info . isAnonymous ( ) ) { String typeQualifiedName = getTypeQualifiedName ( ) ; int dollar = typeQualifiedName . indexOf ( '<CHAR_LIT>' ) ; if ( dollar == - <NUM_LIT:1> ) { return getElementName ( ) + Util . defaultJavaExtension ( ) ; } return typeQualifiedName . substring ( <NUM_LIT:0> , dollar ) + Util . defaultJavaExtension ( ) ; } else { return getElementName ( ) + Util . defaultJavaExtension ( ) ; } } else { int index = CharOperation . lastIndexOf ( '<CHAR_LIT:/>' , sourceFileName ) ; return new String ( sourceFileName , index + <NUM_LIT:1> , sourceFileName . length - index - <NUM_LIT:1> ) ; } } protected void toStringInfo ( int tab , StringBuffer buffer , Object info , boolean showResolvedInfo ) { buffer . append ( tabString ( tab ) ) ; if ( info == null ) { toStringName ( buffer ) ; buffer . append ( "<STR_LIT>" ) ; } else if ( info == NO_INFO ) { toStringName ( buffer ) ; } else { try { if ( isAnnotation ( ) ) { buffer . append ( "<STR_LIT>" ) ; } else if ( isEnum ( ) ) { buffer . append ( "<STR_LIT>" ) ; } else if ( isInterface ( ) ) { buffer . append ( "<STR_LIT>" ) ; } else { buffer . append ( "<STR_LIT>" ) ; } toStringName ( buffer ) ; } catch ( JavaModelException e ) { buffer . append ( "<STR_LIT>" + getElementName ( ) ) ; } } } protected void toStringName ( StringBuffer buffer ) { if ( getElementName ( ) . length ( ) > <NUM_LIT:0> ) super . toStringName ( buffer ) ; else buffer . append ( "<STR_LIT>" ) ; } public String getAttachedJavadoc ( IProgressMonitor monitor ) throws JavaModelException { JavadocContents javadocContents = getJavadocContents ( monitor ) ; if ( javadocContents == null ) return null ; return javadocContents . getTypeDoc ( ) ; } public JavadocContents getJavadocContents ( IProgressMonitor monitor ) throws JavaModelException { PerProjectInfo projectInfo = JavaModelManager . getJavaModelManager ( ) . getPerProjectInfoCheckExistence ( getJavaProject ( ) . getProject ( ) ) ; JavadocContents cachedJavadoc = null ; synchronized ( projectInfo . javadocCache ) { cachedJavadoc = ( JavadocContents ) projectInfo . javadocCache . get ( this ) ; } if ( cachedJavadoc != null && cachedJavadoc != EMPTY_JAVADOC ) { return cachedJavadoc ; } URL baseLocation = getJavadocBaseLocation ( ) ; if ( baseLocation == null ) { return null ; } StringBuffer pathBuffer = new StringBuffer ( baseLocation . toExternalForm ( ) ) ; if ( ! ( pathBuffer . charAt ( pathBuffer . length ( ) - <NUM_LIT:1> ) == '<CHAR_LIT:/>' ) ) { pathBuffer . append ( '<CHAR_LIT:/>' ) ; } IPackageFragment pack = getPackageFragment ( ) ; String typeQualifiedName = null ; if ( isMember ( ) ) { IType currentType = this ; StringBuffer typeName = new StringBuffer ( ) ; while ( currentType != null ) { typeName . insert ( <NUM_LIT:0> , currentType . getElementName ( ) ) ; currentType = currentType . getDeclaringType ( ) ; if ( currentType != null ) { typeName . insert ( <NUM_LIT:0> , '<CHAR_LIT:.>' ) ; } } typeQualifiedName = new String ( typeName . toString ( ) ) ; } else { typeQualifiedName = getElementName ( ) ; } pathBuffer . append ( pack . getElementName ( ) . replace ( '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) ) . append ( '<CHAR_LIT:/>' ) . append ( typeQualifiedName ) . append ( JavadocConstants . HTML_EXTENSION ) ; if ( monitor != null && monitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; final String contents = getURLContents ( String . valueOf ( pathBuffer ) ) ; JavadocContents javadocContents = new JavadocContents ( this , contents ) ; synchronized ( projectInfo . javadocCache ) { projectInfo . javadocCache . put ( this , javadocContents ) ; } return javadocContents ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import java . util . Iterator ; import java . util . List ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaModelStatus ; import org . eclipse . jdt . core . IJavaModelStatusConstants ; import org . eclipse . jdt . core . IType ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . Signature ; import org . eclipse . jdt . core . dom . ASTNode ; import org . eclipse . jdt . core . dom . MethodDeclaration ; import org . eclipse . jdt . core . dom . SimpleName ; import org . eclipse . jdt . core . dom . SingleVariableDeclaration ; import org . eclipse . jdt . core . dom . rewrite . ASTRewrite ; import org . eclipse . jdt . internal . core . util . Messages ; import org . eclipse . jdt . internal . core . util . Util ; public class CreateMethodOperation extends CreateTypeMemberOperation { protected String [ ] parameterTypes ; public CreateMethodOperation ( IType parentElement , String source , boolean force ) { super ( parentElement , source , force ) ; } protected String [ ] convertASTMethodTypesToSignatures ( ) { if ( this . parameterTypes == null ) { if ( this . createdNode != null ) { MethodDeclaration methodDeclaration = ( MethodDeclaration ) this . createdNode ; List parameters = methodDeclaration . parameters ( ) ; int size = parameters . size ( ) ; this . parameterTypes = new String [ size ] ; Iterator iterator = parameters . iterator ( ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) { SingleVariableDeclaration parameter = ( SingleVariableDeclaration ) iterator . next ( ) ; String typeSig = Util . getSignature ( parameter . getType ( ) ) ; int extraDimensions = parameter . getExtraDimensions ( ) ; if ( methodDeclaration . isVarargs ( ) && i == size - <NUM_LIT:1> ) extraDimensions ++ ; this . parameterTypes [ i ] = Signature . createArraySignature ( typeSig , extraDimensions ) ; } } } return this . parameterTypes ; } protected ASTNode generateElementAST ( ASTRewrite rewriter , ICompilationUnit cu ) throws JavaModelException { ASTNode node = super . generateElementAST ( rewriter , cu ) ; if ( node . getNodeType ( ) != ASTNode . METHOD_DECLARATION ) throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CONTENTS ) ) ; return node ; } protected IJavaElement generateResultHandle ( ) { String [ ] types = convertASTMethodTypesToSignatures ( ) ; String name = getASTNodeName ( ) ; return getType ( ) . getMethod ( name , types ) ; } private String getASTNodeName ( ) { return ( ( MethodDeclaration ) this . createdNode ) . getName ( ) . getIdentifier ( ) ; } public String getMainTaskName ( ) { return Messages . operation_createMethodProgress ; } protected SimpleName rename ( ASTNode node , SimpleName newName ) { MethodDeclaration method = ( MethodDeclaration ) node ; SimpleName oldName = method . getName ( ) ; method . setName ( newName ) ; return oldName ; } protected IJavaModelStatus verifyNameCollision ( ) { if ( this . createdNode != null ) { IType type = getType ( ) ; String name ; if ( ( ( MethodDeclaration ) this . createdNode ) . isConstructor ( ) ) name = type . getElementName ( ) ; else name = getASTNodeName ( ) ; String [ ] types = convertASTMethodTypesToSignatures ( ) ; if ( type . getMethod ( name , types ) . exists ( ) ) { return new JavaModelStatus ( IJavaModelStatusConstants . NAME_COLLISION , Messages . bind ( Messages . status_nameCollision , name ) ) ; } } return JavaModelStatus . VERIFIED_OK ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . core . resources . IResourceStatus ; import org . eclipse . core . resources . IWorkspaceRunnable ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . jdt . core . IJavaModelStatus ; import org . eclipse . jdt . core . JavaModelException ; public class BatchOperation extends JavaModelOperation { protected IWorkspaceRunnable runnable ; public BatchOperation ( IWorkspaceRunnable runnable ) { this . runnable = runnable ; } protected boolean canModifyRoots ( ) { return true ; } protected void executeOperation ( ) throws JavaModelException { try { this . runnable . run ( this . progressMonitor ) ; } catch ( CoreException ce ) { if ( ce instanceof JavaModelException ) { throw ( JavaModelException ) ce ; } else { if ( ce . getStatus ( ) . getCode ( ) == IResourceStatus . OPERATION_FAILED ) { Throwable e = ce . getStatus ( ) . getException ( ) ; if ( e instanceof JavaModelException ) { throw ( JavaModelException ) e ; } } throw new JavaModelException ( ce ) ; } } } protected IJavaModelStatus verify ( ) { return JavaModelStatus . VERIFIED_OK ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . core . runtime . preferences . IEclipsePreferences ; import org . eclipse . core . runtime . preferences . InstanceScope ; import org . eclipse . core . runtime . preferences . PreferenceModifyListener ; import org . eclipse . jdt . core . * ; import org . osgi . service . prefs . BackingStoreException ; import org . osgi . service . prefs . Preferences ; public class JavaCorePreferenceModifyListener extends PreferenceModifyListener { static int PREFIX_LENGTH = JavaModelManager . CP_CONTAINER_PREFERENCES_PREFIX . length ( ) ; JavaModel javaModel = JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) ; public IEclipsePreferences preApply ( IEclipsePreferences node ) { Preferences instance = node . node ( InstanceScope . SCOPE ) ; cleanJavaCore ( instance . node ( JavaCore . PLUGIN_ID ) ) ; return super . preApply ( node ) ; } void cleanJavaCore ( Preferences preferences ) { try { String [ ] keys = preferences . keys ( ) ; for ( int k = <NUM_LIT:0> , kl = keys . length ; k < kl ; k ++ ) { String key = keys [ k ] ; if ( key . startsWith ( JavaModelManager . CP_CONTAINER_PREFERENCES_PREFIX ) && ! isJavaProjectAccessible ( key ) ) { preferences . remove ( key ) ; } } } catch ( BackingStoreException e ) { } } boolean isJavaProjectAccessible ( String propertyName ) { int index = propertyName . indexOf ( '<CHAR_LIT>' , PREFIX_LENGTH ) ; if ( index > <NUM_LIT:0> ) { final String projectName = propertyName . substring ( PREFIX_LENGTH , index ) . trim ( ) ; JavaProject project = ( JavaProject ) this . javaModel . getJavaProject ( projectName ) ; if ( project . getProject ( ) . isAccessible ( ) ) { return true ; } } return false ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import java . util . HashMap ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . dom . ASTNode ; import org . eclipse . jdt . core . dom . CompilationUnit ; import org . eclipse . jdt . internal . core . util . DOMFinder ; import org . eclipse . jdt . internal . core . util . MementoTokenizer ; import org . eclipse . jdt . internal . core . util . Messages ; public abstract class SourceRefElement extends JavaElement implements ISourceReference { public int occurrenceCount = <NUM_LIT:1> ; protected SourceRefElement ( JavaElement parent ) { super ( parent ) ; } protected void closing ( Object info ) throws JavaModelException { } protected Object createElementInfo ( ) { return null ; } public void copy ( IJavaElement container , IJavaElement sibling , String rename , boolean force , IProgressMonitor monitor ) throws JavaModelException { if ( container == null ) { throw new IllegalArgumentException ( Messages . operation_nullContainer ) ; } IJavaElement [ ] elements = new IJavaElement [ ] { this } ; IJavaElement [ ] containers = new IJavaElement [ ] { container } ; IJavaElement [ ] siblings = null ; if ( sibling != null ) { siblings = new IJavaElement [ ] { sibling } ; } String [ ] renamings = null ; if ( rename != null ) { renamings = new String [ ] { rename } ; } getJavaModel ( ) . copy ( elements , containers , siblings , renamings , force , monitor ) ; } public void delete ( boolean force , IProgressMonitor monitor ) throws JavaModelException { IJavaElement [ ] elements = new IJavaElement [ ] { this } ; getJavaModel ( ) . delete ( elements , force , monitor ) ; } public boolean equals ( Object o ) { if ( ! ( o instanceof SourceRefElement ) ) return false ; return this . occurrenceCount == ( ( SourceRefElement ) o ) . occurrenceCount && super . equals ( o ) ; } public ASTNode findNode ( CompilationUnit ast ) { DOMFinder finder = new DOMFinder ( ast , this , false ) ; try { return finder . search ( ) ; } catch ( JavaModelException e ) { return null ; } } protected void generateInfos ( Object info , HashMap newElements , IProgressMonitor pm ) throws JavaModelException { Openable openableParent = ( Openable ) getOpenableParent ( ) ; if ( openableParent == null ) return ; JavaElementInfo openableParentInfo = ( JavaElementInfo ) JavaModelManager . getJavaModelManager ( ) . getInfo ( openableParent ) ; if ( openableParentInfo == null ) { openableParent . generateInfos ( openableParent . createElementInfo ( ) , newElements , pm ) ; } } public IAnnotation getAnnotation ( String name ) { return new Annotation ( this , name ) ; } public IAnnotation [ ] getAnnotations ( ) throws JavaModelException { AnnotatableInfo info = ( AnnotatableInfo ) getElementInfo ( ) ; return info . annotations ; } public ICompilationUnit getCompilationUnit ( ) { return ( ICompilationUnit ) getAncestor ( COMPILATION_UNIT ) ; } public IResource getCorrespondingResource ( ) throws JavaModelException { if ( ! exists ( ) ) throw newNotPresentException ( ) ; return null ; } public IJavaElement getHandleFromMemento ( String token , MementoTokenizer memento , WorkingCopyOwner workingCopyOwner ) { switch ( token . charAt ( <NUM_LIT:0> ) ) { case JEM_COUNT : return getHandleUpdatingCountFromMemento ( memento , workingCopyOwner ) ; } return this ; } protected void getHandleMemento ( StringBuffer buff ) { super . getHandleMemento ( buff ) ; if ( this . occurrenceCount > <NUM_LIT:1> ) { buff . append ( JEM_COUNT ) ; buff . append ( this . occurrenceCount ) ; } } public IJavaElement getHandleUpdatingCountFromMemento ( MementoTokenizer memento , WorkingCopyOwner owner ) { if ( ! memento . hasMoreTokens ( ) ) return this ; this . occurrenceCount = Integer . parseInt ( memento . nextToken ( ) ) ; if ( ! memento . hasMoreTokens ( ) ) return this ; String token = memento . nextToken ( ) ; return getHandleFromMemento ( token , memento , owner ) ; } public int getOccurrenceCount ( ) { return this . occurrenceCount ; } public IOpenable getOpenableParent ( ) { IJavaElement current = getParent ( ) ; while ( current != null ) { if ( current instanceof IOpenable ) { return ( IOpenable ) current ; } current = current . getParent ( ) ; } return null ; } public IPath getPath ( ) { return getParent ( ) . getPath ( ) ; } public IResource resource ( ) { return this . parent . resource ( ) ; } public String getSource ( ) throws JavaModelException { IOpenable openable = getOpenableParent ( ) ; IBuffer buffer = openable . getBuffer ( ) ; if ( buffer == null ) { return null ; } ISourceRange range = getSourceRange ( ) ; int offset = range . getOffset ( ) ; int length = range . getLength ( ) ; if ( offset == - <NUM_LIT:1> || length == <NUM_LIT:0> ) { return null ; } try { return buffer . getText ( offset , length ) ; } catch ( RuntimeException e ) { return null ; } } public ISourceRange getSourceRange ( ) throws JavaModelException { SourceRefElementInfo info = ( SourceRefElementInfo ) getElementInfo ( ) ; return info . getSourceRange ( ) ; } public IResource getUnderlyingResource ( ) throws JavaModelException { if ( ! exists ( ) ) throw newNotPresentException ( ) ; return getParent ( ) . getUnderlyingResource ( ) ; } public boolean hasChildren ( ) throws JavaModelException { return getChildren ( ) . length > <NUM_LIT:0> ; } public boolean isStructureKnown ( ) throws JavaModelException { return true ; } public void move ( IJavaElement container , IJavaElement sibling , String rename , boolean force , IProgressMonitor monitor ) throws JavaModelException { if ( container == null ) { throw new IllegalArgumentException ( Messages . operation_nullContainer ) ; } IJavaElement [ ] elements = new IJavaElement [ ] { this } ; IJavaElement [ ] containers = new IJavaElement [ ] { container } ; IJavaElement [ ] siblings = null ; if ( sibling != null ) { siblings = new IJavaElement [ ] { sibling } ; } String [ ] renamings = null ; if ( rename != null ) { renamings = new String [ ] { rename } ; } getJavaModel ( ) . move ( elements , containers , siblings , renamings , force , monitor ) ; } public void rename ( String newName , boolean force , IProgressMonitor monitor ) throws JavaModelException { if ( newName == null ) { throw new IllegalArgumentException ( Messages . element_nullName ) ; } IJavaElement [ ] elements = new IJavaElement [ ] { this } ; IJavaElement [ ] dests = new IJavaElement [ ] { getParent ( ) } ; String [ ] renamings = new String [ ] { newName } ; getJavaModel ( ) . rename ( elements , dests , renamings , force , monitor ) ; } protected void toStringName ( StringBuffer buffer ) { super . toStringName ( buffer ) ; if ( this . occurrenceCount > <NUM_LIT:1> ) { buffer . append ( "<STR_LIT:#>" ) ; buffer . append ( this . occurrenceCount ) ; } } } </s>
<s> package org . eclipse . jdt . internal . core ; import java . util . HashMap ; import java . util . Iterator ; import java . util . Map ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . Assert ; import org . eclipse . core . runtime . jobs . ISchedulingRule ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaModelStatusConstants ; import org . eclipse . jdt . core . IRegion ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . dom . AST ; import org . eclipse . jdt . core . dom . ASTNode ; import org . eclipse . jdt . core . dom . ASTParser ; import org . eclipse . jdt . core . dom . CompilationUnit ; import org . eclipse . jdt . core . dom . rewrite . ASTRewrite ; import org . eclipse . jdt . internal . core . util . Messages ; import org . eclipse . text . edits . TextEdit ; public class DeleteElementsOperation extends MultiOperation { protected Map childrenToRemove ; protected ASTParser parser ; public DeleteElementsOperation ( IJavaElement [ ] elementsToDelete , boolean force ) { super ( elementsToDelete , force ) ; initASTParser ( ) ; } private void deleteElement ( IJavaElement elementToRemove , ICompilationUnit cu ) throws JavaModelException { cu . makeConsistent ( this . progressMonitor ) ; this . parser . setSource ( cu ) ; CompilationUnit astCU = ( CompilationUnit ) this . parser . createAST ( this . progressMonitor ) ; ASTNode node = ( ( JavaElement ) elementToRemove ) . findNode ( astCU ) ; if ( node == null ) Assert . isTrue ( false , "<STR_LIT>" + elementToRemove . getElementName ( ) + "<STR_LIT>" + cu . getElementName ( ) ) ; AST ast = astCU . getAST ( ) ; ASTRewrite rewriter = ASTRewrite . create ( ast ) ; rewriter . remove ( node , null ) ; TextEdit edits = rewriter . rewriteAST ( ) ; applyTextEdit ( cu , edits ) ; } private void initASTParser ( ) { this . parser = ASTParser . newParser ( AST . JLS3 ) ; } protected String getMainTaskName ( ) { return Messages . operation_deleteElementProgress ; } protected ISchedulingRule getSchedulingRule ( ) { if ( this . elementsToProcess != null && this . elementsToProcess . length == <NUM_LIT:1> ) { IResource resource = this . elementsToProcess [ <NUM_LIT:0> ] . getResource ( ) ; if ( resource != null ) return ResourcesPlugin . getWorkspace ( ) . getRuleFactory ( ) . modifyRule ( resource ) ; } return super . getSchedulingRule ( ) ; } protected void groupElements ( ) throws JavaModelException { this . childrenToRemove = new HashMap ( <NUM_LIT:1> ) ; int uniqueCUs = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , length = this . elementsToProcess . length ; i < length ; i ++ ) { IJavaElement e = this . elementsToProcess [ i ] ; ICompilationUnit cu = getCompilationUnitFor ( e ) ; if ( cu == null ) { throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . READ_ONLY , e ) ) ; } else { IRegion region = ( IRegion ) this . childrenToRemove . get ( cu ) ; if ( region == null ) { region = new Region ( ) ; this . childrenToRemove . put ( cu , region ) ; uniqueCUs += <NUM_LIT:1> ; } region . add ( e ) ; } } this . elementsToProcess = new IJavaElement [ uniqueCUs ] ; Iterator iter = this . childrenToRemove . keySet ( ) . iterator ( ) ; int i = <NUM_LIT:0> ; while ( iter . hasNext ( ) ) { this . elementsToProcess [ i ++ ] = ( IJavaElement ) iter . next ( ) ; } } protected void processElement ( IJavaElement element ) throws JavaModelException { ICompilationUnit cu = ( ICompilationUnit ) element ; int numberOfImports = cu . getImports ( ) . length ; JavaElementDelta delta = new JavaElementDelta ( cu ) ; IJavaElement [ ] cuElements = ( ( IRegion ) this . childrenToRemove . get ( cu ) ) . getElements ( ) ; for ( int i = <NUM_LIT:0> , length = cuElements . length ; i < length ; i ++ ) { IJavaElement e = cuElements [ i ] ; if ( e . exists ( ) ) { deleteElement ( e , cu ) ; delta . removed ( e ) ; if ( e . getElementType ( ) == IJavaElement . IMPORT_DECLARATION ) { numberOfImports -- ; if ( numberOfImports == <NUM_LIT:0> ) { delta . removed ( cu . getImportContainer ( ) ) ; } } } } if ( delta . getAffectedChildren ( ) . length > <NUM_LIT:0> ) { cu . save ( getSubProgressMonitor ( <NUM_LIT:1> ) , this . force ) ; if ( ! cu . isWorkingCopy ( ) ) { addDelta ( delta ) ; setAttribute ( HAS_MODIFIED_RESOURCE_ATTR , TRUE ) ; } } } protected void processElements ( ) throws JavaModelException { groupElements ( ) ; super . processElements ( ) ; } protected void verify ( IJavaElement element ) throws JavaModelException { IJavaElement [ ] children = ( ( IRegion ) this . childrenToRemove . get ( element ) ) . getElements ( ) ; for ( int i = <NUM_LIT:0> ; i < children . length ; i ++ ) { IJavaElement child = children [ i ] ; if ( child . getCorrespondingResource ( ) != null ) error ( IJavaModelStatusConstants . INVALID_ELEMENT_TYPES , child ) ; if ( child . isReadOnly ( ) ) error ( IJavaModelStatusConstants . READ_ONLY , child ) ; } } } </s>
<s> package org . eclipse . jdt . internal . core ; import java . io . * ; import java . net . URI ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Hashtable ; import java . util . Iterator ; import java . util . LinkedHashSet ; import java . util . List ; import java . util . Map ; import javax . xml . parsers . DocumentBuilder ; import javax . xml . parsers . DocumentBuilderFactory ; import javax . xml . parsers . ParserConfigurationException ; import org . codehaus . jdt . groovy . integration . LanguageSupportFactory ; import org . eclipse . core . resources . ICommand ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IFolder ; import org . eclipse . core . resources . IMarker ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IProjectDescription ; import org . eclipse . core . resources . IProjectNature ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IWorkspace ; import org . eclipse . core . resources . IWorkspaceRoot ; import org . eclipse . core . resources . ProjectScope ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Path ; import org . eclipse . core . runtime . Platform ; import org . eclipse . core . runtime . QualifiedName ; import org . eclipse . core . runtime . content . IContentDescription ; import org . eclipse . core . runtime . preferences . IEclipsePreferences ; import org . eclipse . core . runtime . preferences . IScopeContext ; import org . eclipse . jdt . core . IClasspathAttribute ; import org . eclipse . jdt . core . IClasspathContainer ; import org . eclipse . jdt . core . IClasspathEntry ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaModelMarker ; import org . eclipse . jdt . core . IJavaModelStatus ; import org . eclipse . jdt . core . IJavaModelStatusConstants ; import org . eclipse . jdt . core . IJavaProject ; import org . eclipse . jdt . core . IPackageFragment ; import org . eclipse . jdt . core . IPackageFragmentRoot ; import org . eclipse . jdt . core . IRegion ; import org . eclipse . jdt . core . IType ; import org . eclipse . jdt . core . ITypeHierarchy ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . WorkingCopyOwner ; import org . eclipse . jdt . core . compiler . CategorizedProblem ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . eval . IEvaluationContext ; import org . eclipse . jdt . internal . compiler . util . ObjectVector ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . core . JavaModelManager . PerProjectInfo ; import org . eclipse . jdt . internal . core . JavaProjectElementInfo . ProjectCache ; import org . eclipse . jdt . internal . core . builder . JavaBuilder ; import org . eclipse . jdt . internal . core . eval . EvaluationContextWrapper ; import org . eclipse . jdt . internal . core . util . JavaElementFinder ; import org . eclipse . jdt . internal . core . util . MementoTokenizer ; import org . eclipse . jdt . internal . core . util . Messages ; import org . eclipse . jdt . internal . core . util . Util ; import org . eclipse . jdt . internal . eval . EvaluationContext ; import org . osgi . service . prefs . BackingStoreException ; import org . w3c . dom . Element ; import org . w3c . dom . Node ; import org . w3c . dom . NodeList ; import org . xml . sax . InputSource ; import org . xml . sax . SAXException ; public class JavaProject extends Openable implements IJavaProject , IProjectNature , SuffixConstants { public static final String CLASSPATH_FILENAME = "<STR_LIT>" ; public static final IClasspathEntry [ ] INVALID_CLASSPATH = new IClasspathEntry [ <NUM_LIT:0> ] ; protected static final boolean IS_CASE_SENSITIVE = ! new File ( "<STR_LIT>" ) . equals ( new File ( "<STR_LIT>" ) ) ; protected static final String [ ] NO_PREREQUISITES = CharOperation . NO_STRINGS ; private static final String PREF_FILENAME = "<STR_LIT>" ; public static final String DEFAULT_PREFERENCES_DIRNAME = "<STR_LIT>" ; public static final String JAVA_CORE_PREFS_FILE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final IClasspathEntry [ ] RESOLUTION_IN_PROGRESS = new IClasspathEntry [ <NUM_LIT:0> ] ; private static ArrayList CP_RESOLUTION_BP_LISTENERS ; public static class ClasspathResolutionBreakpointListener { public void breakpoint ( int bp ) { } } protected IProject project ; private IEclipsePreferences . INodeChangeListener preferencesNodeListener ; private IEclipsePreferences . IPreferenceChangeListener preferencesChangeListener ; public JavaProject ( ) { super ( null ) ; } public JavaProject ( IProject project , JavaElement parent ) { super ( parent ) ; this . project = project ; } public static synchronized void addCPResolutionBPListener ( ClasspathResolutionBreakpointListener listener ) { if ( CP_RESOLUTION_BP_LISTENERS == null ) CP_RESOLUTION_BP_LISTENERS = new ArrayList ( ) ; CP_RESOLUTION_BP_LISTENERS . add ( listener ) ; } public static synchronized void removeCPResolutionBPListener ( ClasspathResolutionBreakpointListener listener ) { if ( CP_RESOLUTION_BP_LISTENERS == null ) return ; CP_RESOLUTION_BP_LISTENERS . remove ( listener ) ; if ( CP_RESOLUTION_BP_LISTENERS . size ( ) == <NUM_LIT:0> ) CP_RESOLUTION_BP_LISTENERS = null ; } private static synchronized ClasspathResolutionBreakpointListener [ ] getBPListeners ( ) { if ( CP_RESOLUTION_BP_LISTENERS == null ) return null ; return ( ClasspathResolutionBreakpointListener [ ] ) CP_RESOLUTION_BP_LISTENERS . toArray ( new ClasspathResolutionBreakpointListener [ CP_RESOLUTION_BP_LISTENERS . size ( ) ] ) ; } private static void breakpoint ( int bp , JavaProject project ) { ClasspathResolutionBreakpointListener [ ] listeners = getBPListeners ( ) ; if ( listeners == null ) return ; for ( int j = <NUM_LIT:0> , length = listeners . length ; j < length ; j ++ ) { listeners [ j ] . breakpoint ( bp ) ; } } public static boolean areClasspathsEqual ( IClasspathEntry [ ] firstClasspath , IClasspathEntry [ ] secondClasspath , IPath firstOutputLocation , IPath secondOutputLocation ) { int length = firstClasspath . length ; if ( length != secondClasspath . length ) return false ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( ! firstClasspath [ i ] . equals ( secondClasspath [ i ] ) ) return false ; } if ( firstOutputLocation == null ) return secondOutputLocation == null ; return firstOutputLocation . equals ( secondOutputLocation ) ; } private static boolean areClasspathsEqual ( IClasspathEntry [ ] newClasspath , IPath newOutputLocation , IClasspathEntry [ ] otherClasspathWithOutput ) { if ( otherClasspathWithOutput == null || otherClasspathWithOutput . length == <NUM_LIT:0> ) return false ; int length = otherClasspathWithOutput . length ; if ( length != newClasspath . length + <NUM_LIT:1> ) return false ; for ( int i = <NUM_LIT:0> ; i < length - <NUM_LIT:1> ; i ++ ) { if ( ! otherClasspathWithOutput [ i ] . equals ( newClasspath [ i ] ) ) return false ; } IClasspathEntry output = otherClasspathWithOutput [ length - <NUM_LIT:1> ] ; if ( output . getContentKind ( ) != ClasspathEntry . K_OUTPUT || ! output . getPath ( ) . equals ( newOutputLocation ) ) return false ; return true ; } private static boolean areClasspathsEqual ( IClasspathEntry [ ] first , IClasspathEntry [ ] second ) { if ( first != second ) { if ( first == null ) return false ; int length = first . length ; if ( second == null || second . length != length ) return false ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( ! first [ i ] . equals ( second [ i ] ) ) return false ; } } return true ; } public static IPath canonicalizedPath ( IPath externalPath ) { if ( externalPath == null ) return null ; if ( IS_CASE_SENSITIVE ) { return externalPath ; } IWorkspace workspace = ResourcesPlugin . getWorkspace ( ) ; if ( workspace == null ) return externalPath ; if ( workspace . getRoot ( ) . findMember ( externalPath ) != null ) { return externalPath ; } IPath canonicalPath = null ; try { canonicalPath = new Path ( new File ( externalPath . toOSString ( ) ) . getCanonicalPath ( ) ) ; } catch ( IOException e ) { return externalPath ; } IPath result ; int canonicalLength = canonicalPath . segmentCount ( ) ; if ( canonicalLength == <NUM_LIT:0> ) { return externalPath ; } else if ( externalPath . isAbsolute ( ) ) { result = canonicalPath ; } else { int externalLength = externalPath . segmentCount ( ) ; if ( canonicalLength >= externalLength ) { result = canonicalPath . removeFirstSegments ( canonicalLength - externalLength ) ; } else { return externalPath ; } } if ( externalPath . getDevice ( ) == null ) { result = result . setDevice ( null ) ; } if ( externalPath . hasTrailingSeparator ( ) ) { result = result . addTrailingSeparator ( ) ; } return result ; } public static boolean hasJavaNature ( IProject project ) { try { return project . hasNature ( JavaCore . NATURE_ID ) ; } catch ( CoreException e ) { if ( ExternalJavaProject . EXTERNAL_PROJECT_NAME . equals ( project . getName ( ) ) ) return true ; } return false ; } public static void validateCycles ( Map preferredClasspaths ) throws JavaModelException { IWorkspaceRoot workspaceRoot = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; IProject [ ] rscProjects = workspaceRoot . getProjects ( ) ; int length = rscProjects . length ; JavaProject [ ] projects = new JavaProject [ length ] ; HashSet cycleParticipants = new HashSet ( ) ; HashSet traversed = new HashSet ( ) ; ArrayList prereqChain = new ArrayList ( ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( hasJavaNature ( rscProjects [ i ] ) ) { JavaProject project = ( projects [ i ] = ( JavaProject ) JavaCore . create ( rscProjects [ i ] ) ) ; if ( ! traversed . contains ( project . getPath ( ) ) ) { prereqChain . clear ( ) ; project . updateCycleParticipants ( prereqChain , cycleParticipants , workspaceRoot , traversed , preferredClasspaths ) ; } } } for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { JavaProject project = projects [ i ] ; if ( project != null ) { if ( cycleParticipants . contains ( project . getPath ( ) ) ) { IMarker cycleMarker = project . getCycleMarker ( ) ; String circularCPOption = project . getOption ( JavaCore . CORE_CIRCULAR_CLASSPATH , true ) ; int circularCPSeverity = JavaCore . ERROR . equals ( circularCPOption ) ? IMarker . SEVERITY_ERROR : IMarker . SEVERITY_WARNING ; if ( cycleMarker != null ) { try { int existingSeverity = ( ( Integer ) cycleMarker . getAttribute ( IMarker . SEVERITY ) ) . intValue ( ) ; if ( existingSeverity != circularCPSeverity ) { cycleMarker . setAttribute ( IMarker . SEVERITY , circularCPSeverity ) ; } } catch ( CoreException e ) { throw new JavaModelException ( e ) ; } } else { project . createClasspathProblemMarker ( new JavaModelStatus ( IJavaModelStatusConstants . CLASSPATH_CYCLE , project ) ) ; } } else { project . flushClasspathProblemMarkers ( true , false ) ; } } } } protected void addToBuildSpec ( String builderID ) throws CoreException { IProjectDescription description = this . project . getDescription ( ) ; int javaCommandIndex = getJavaCommandIndex ( description . getBuildSpec ( ) ) ; if ( javaCommandIndex == - <NUM_LIT:1> ) { ICommand command = description . newCommand ( ) ; command . setBuilderName ( builderID ) ; setJavaCommand ( description , command ) ; } } protected boolean buildStructure ( OpenableElementInfo info , IProgressMonitor pm , Map newElements , IResource underlyingResource ) throws JavaModelException { IClasspathEntry [ ] resolvedClasspath = getResolvedClasspath ( ) ; info . setChildren ( computePackageFragmentRoots ( resolvedClasspath , false , null ) ) ; return true ; } public void close ( ) throws JavaModelException { if ( JavaProject . hasJavaNature ( this . project ) ) { JavaModelManager . PerProjectInfo perProjectInfo = JavaModelManager . getJavaModelManager ( ) . getPerProjectInfo ( this . project , false ) ; if ( perProjectInfo != null && perProjectInfo . preferences != null ) { IEclipsePreferences eclipseParentPreferences = ( IEclipsePreferences ) perProjectInfo . preferences . parent ( ) ; if ( this . preferencesNodeListener != null ) { eclipseParentPreferences . removeNodeChangeListener ( this . preferencesNodeListener ) ; this . preferencesNodeListener = null ; } if ( this . preferencesChangeListener != null ) { perProjectInfo . preferences . removePreferenceChangeListener ( this . preferencesChangeListener ) ; this . preferencesChangeListener = null ; } } } LanguageSupportFactory . getEventHandler ( ) . handle ( this , "<STR_LIT>" ) ; super . close ( ) ; } private void computeExpandedClasspath ( ClasspathEntry referringEntry , HashSet rootIDs , ObjectVector accumulatedEntries ) throws JavaModelException { String projectRootId = rootID ( ) ; if ( rootIDs . contains ( projectRootId ) ) { return ; } rootIDs . add ( projectRootId ) ; IClasspathEntry [ ] resolvedClasspath = getResolvedClasspath ( ) ; IWorkspaceRoot workspaceRoot = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; boolean isInitialProject = referringEntry == null ; for ( int i = <NUM_LIT:0> , length = resolvedClasspath . length ; i < length ; i ++ ) { ClasspathEntry entry = ( ClasspathEntry ) resolvedClasspath [ i ] ; if ( isInitialProject || entry . isExported ( ) ) { String rootID = entry . rootID ( ) ; if ( rootIDs . contains ( rootID ) ) { continue ; } ClasspathEntry combinedEntry = entry . combineWith ( referringEntry ) ; accumulatedEntries . add ( combinedEntry ) ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_PROJECT ) { IResource member = workspaceRoot . findMember ( entry . getPath ( ) ) ; if ( member != null && member . getType ( ) == IResource . PROJECT ) { IProject projRsc = ( IProject ) member ; if ( JavaProject . hasJavaNature ( projRsc ) ) { JavaProject javaProject = ( JavaProject ) JavaCore . create ( projRsc ) ; javaProject . computeExpandedClasspath ( combinedEntry , rootIDs , accumulatedEntries ) ; } } } else { rootIDs . add ( rootID ) ; } } } } public IPackageFragmentRoot [ ] computePackageFragmentRoots ( IClasspathEntry resolvedEntry ) { try { return computePackageFragmentRoots ( new IClasspathEntry [ ] { resolvedEntry } , false , null ) ; } catch ( JavaModelException e ) { return new IPackageFragmentRoot [ ] { } ; } } public void computePackageFragmentRoots ( IClasspathEntry resolvedEntry , ObjectVector accumulatedRoots , HashSet rootIDs , IClasspathEntry referringEntry , boolean retrieveExportedRoots , Map rootToResolvedEntries ) throws JavaModelException { String rootID = ( ( ClasspathEntry ) resolvedEntry ) . rootID ( ) ; if ( rootIDs . contains ( rootID ) ) return ; IPath projectPath = this . project . getFullPath ( ) ; IPath entryPath = resolvedEntry . getPath ( ) ; IWorkspaceRoot workspaceRoot = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; IPackageFragmentRoot root = null ; switch ( resolvedEntry . getEntryKind ( ) ) { case IClasspathEntry . CPE_SOURCE : if ( projectPath . isPrefixOf ( entryPath ) ) { Object target = JavaModel . getTarget ( entryPath , true ) ; if ( target == null ) return ; if ( target instanceof IFolder || target instanceof IProject ) { root = getPackageFragmentRoot ( ( IResource ) target ) ; } } break ; case IClasspathEntry . CPE_LIBRARY : if ( referringEntry != null && ! resolvedEntry . isExported ( ) ) return ; Object target = JavaModel . getTarget ( entryPath , true ) ; if ( target == null ) return ; if ( target instanceof IResource ) { root = getPackageFragmentRoot ( ( IResource ) target , entryPath ) ; } else if ( target instanceof File ) { if ( JavaModel . isFile ( target ) ) { root = new JarPackageFragmentRoot ( entryPath , this ) ; } else if ( ( ( File ) target ) . isDirectory ( ) ) { root = new ExternalPackageFragmentRoot ( entryPath , this ) ; } } break ; case IClasspathEntry . CPE_PROJECT : if ( ! retrieveExportedRoots ) return ; if ( referringEntry != null && ! resolvedEntry . isExported ( ) ) return ; IResource member = workspaceRoot . findMember ( entryPath ) ; if ( member != null && member . getType ( ) == IResource . PROJECT ) { IProject requiredProjectRsc = ( IProject ) member ; if ( JavaProject . hasJavaNature ( requiredProjectRsc ) ) { rootIDs . add ( rootID ) ; JavaProject requiredProject = ( JavaProject ) JavaCore . create ( requiredProjectRsc ) ; requiredProject . computePackageFragmentRoots ( requiredProject . getResolvedClasspath ( ) , accumulatedRoots , rootIDs , rootToResolvedEntries == null ? resolvedEntry : ( ( ClasspathEntry ) resolvedEntry ) . combineWith ( ( ClasspathEntry ) referringEntry ) , retrieveExportedRoots , rootToResolvedEntries ) ; } break ; } } if ( root != null ) { accumulatedRoots . add ( root ) ; rootIDs . add ( rootID ) ; if ( rootToResolvedEntries != null ) rootToResolvedEntries . put ( root , ( ( ClasspathEntry ) resolvedEntry ) . combineWith ( ( ClasspathEntry ) referringEntry ) ) ; } } public IPackageFragmentRoot [ ] computePackageFragmentRoots ( IClasspathEntry [ ] resolvedClasspath , boolean retrieveExportedRoots , Map rootToResolvedEntries ) throws JavaModelException { ObjectVector accumulatedRoots = new ObjectVector ( ) ; computePackageFragmentRoots ( resolvedClasspath , accumulatedRoots , new HashSet ( <NUM_LIT:5> ) , null , retrieveExportedRoots , rootToResolvedEntries ) ; IPackageFragmentRoot [ ] rootArray = new IPackageFragmentRoot [ accumulatedRoots . size ( ) ] ; accumulatedRoots . copyInto ( rootArray ) ; return rootArray ; } public void computePackageFragmentRoots ( IClasspathEntry [ ] resolvedClasspath , ObjectVector accumulatedRoots , HashSet rootIDs , IClasspathEntry referringEntry , boolean retrieveExportedRoots , Map rootToResolvedEntries ) throws JavaModelException { if ( referringEntry == null ) { rootIDs . add ( rootID ( ) ) ; } for ( int i = <NUM_LIT:0> , length = resolvedClasspath . length ; i < length ; i ++ ) { computePackageFragmentRoots ( resolvedClasspath [ i ] , accumulatedRoots , rootIDs , referringEntry , retrieveExportedRoots , rootToResolvedEntries ) ; } } public String computeSharedPropertyFileName ( QualifiedName qName ) { return '<CHAR_LIT:.>' + qName . getLocalName ( ) ; } public void configure ( ) throws CoreException { addToBuildSpec ( JavaCore . BUILDER_ID ) ; } public boolean contains ( IResource resource ) { IClasspathEntry [ ] classpath ; IPath output ; try { classpath = getResolvedClasspath ( ) ; output = getOutputLocation ( ) ; } catch ( JavaModelException e ) { return false ; } IPath fullPath = resource . getFullPath ( ) ; IPath innerMostOutput = output . isPrefixOf ( fullPath ) ? output : null ; IClasspathEntry innerMostEntry = null ; ExternalFoldersManager foldersManager = JavaModelManager . getExternalManager ( ) ; for ( int j = <NUM_LIT:0> , cpLength = classpath . length ; j < cpLength ; j ++ ) { IClasspathEntry entry = classpath [ j ] ; IPath entryPath = entry . getPath ( ) ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY ) { IResource linkedFolder = foldersManager . getFolder ( entryPath ) ; if ( linkedFolder != null ) entryPath = linkedFolder . getFullPath ( ) ; } if ( ( innerMostEntry == null || innerMostEntry . getPath ( ) . isPrefixOf ( entryPath ) ) && entryPath . isPrefixOf ( fullPath ) ) { innerMostEntry = entry ; } IPath entryOutput = classpath [ j ] . getOutputLocation ( ) ; if ( entryOutput != null && entryOutput . isPrefixOf ( fullPath ) ) { innerMostOutput = entryOutput ; } } if ( innerMostEntry != null ) { if ( innerMostOutput != null && innerMostOutput . segmentCount ( ) > <NUM_LIT:1> && innerMostEntry . getPath ( ) . segmentCount ( ) == <NUM_LIT:1> ) { return false ; } if ( resource instanceof IFolder ) { return true ; } switch ( innerMostEntry . getEntryKind ( ) ) { case IClasspathEntry . CPE_SOURCE : return ! org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( fullPath . lastSegment ( ) ) ; case IClasspathEntry . CPE_LIBRARY : return ! org . eclipse . jdt . internal . core . util . Util . isJavaLikeFileName ( fullPath . lastSegment ( ) ) ; } } if ( innerMostOutput != null ) { return false ; } return true ; } public void createClasspathProblemMarker ( IJavaModelStatus status ) { IMarker marker = null ; int severity ; String [ ] arguments = CharOperation . NO_STRINGS ; boolean isCycleProblem = false , isClasspathFileFormatProblem = false ; switch ( status . getCode ( ) ) { case IJavaModelStatusConstants . CLASSPATH_CYCLE : isCycleProblem = true ; if ( JavaCore . ERROR . equals ( getOption ( JavaCore . CORE_CIRCULAR_CLASSPATH , true ) ) ) { severity = IMarker . SEVERITY_ERROR ; } else { severity = IMarker . SEVERITY_WARNING ; } break ; case IJavaModelStatusConstants . INVALID_CLASSPATH_FILE_FORMAT : isClasspathFileFormatProblem = true ; severity = IMarker . SEVERITY_ERROR ; break ; case IJavaModelStatusConstants . INCOMPATIBLE_JDK_LEVEL : String setting = getOption ( JavaCore . CORE_INCOMPATIBLE_JDK_LEVEL , true ) ; if ( JavaCore . ERROR . equals ( setting ) ) { severity = IMarker . SEVERITY_ERROR ; } else if ( JavaCore . WARNING . equals ( setting ) ) { severity = IMarker . SEVERITY_WARNING ; } else { return ; } break ; default : IPath path = status . getPath ( ) ; if ( path != null ) arguments = new String [ ] { path . toString ( ) } ; if ( JavaCore . ERROR . equals ( getOption ( JavaCore . CORE_INCOMPLETE_CLASSPATH , true ) ) && status . getSeverity ( ) != IStatus . WARNING ) { severity = IMarker . SEVERITY_ERROR ; } else { severity = IMarker . SEVERITY_WARNING ; } break ; } try { marker = this . project . createMarker ( IJavaModelMarker . BUILDPATH_PROBLEM_MARKER ) ; marker . setAttributes ( new String [ ] { IMarker . MESSAGE , IMarker . SEVERITY , IMarker . LOCATION , IJavaModelMarker . CYCLE_DETECTED , IJavaModelMarker . CLASSPATH_FILE_FORMAT , IJavaModelMarker . ID , IJavaModelMarker . ARGUMENTS , IJavaModelMarker . CATEGORY_ID , IMarker . SOURCE_ID , } , new Object [ ] { status . getMessage ( ) , new Integer ( severity ) , Messages . classpath_buildPath , isCycleProblem ? "<STR_LIT:true>" : "<STR_LIT:false>" , isClasspathFileFormatProblem ? "<STR_LIT:true>" : "<STR_LIT:false>" , new Integer ( status . getCode ( ) ) , Util . getProblemArgumentsForMarker ( arguments ) , new Integer ( CategorizedProblem . CAT_BUILDPATH ) , JavaBuilder . SOURCE_ID , } ) ; } catch ( CoreException e ) { if ( JavaModelManager . VERBOSE ) { e . printStackTrace ( ) ; } } } protected Object createElementInfo ( ) { return new JavaProjectElementInfo ( ) ; } public IClasspathEntry [ ] [ ] decodeClasspath ( String xmlClasspath , Map unknownElements ) throws IOException , ClasspathEntry . AssertionFailedException { ArrayList paths = new ArrayList ( ) ; IClasspathEntry defaultOutput = null ; StringReader reader = new StringReader ( xmlClasspath ) ; Element cpElement ; try { DocumentBuilder parser = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) ; cpElement = parser . parse ( new InputSource ( reader ) ) . getDocumentElement ( ) ; } catch ( SAXException e ) { throw new IOException ( Messages . file_badFormat ) ; } catch ( ParserConfigurationException e ) { throw new IOException ( Messages . file_badFormat ) ; } finally { reader . close ( ) ; } if ( ! cpElement . getNodeName ( ) . equalsIgnoreCase ( "<STR_LIT>" ) ) { throw new IOException ( Messages . file_badFormat ) ; } NodeList list = cpElement . getElementsByTagName ( ClasspathEntry . TAG_CLASSPATHENTRY ) ; int length = list . getLength ( ) ; for ( int i = <NUM_LIT:0> ; i < length ; ++ i ) { Node node = list . item ( i ) ; if ( node . getNodeType ( ) == Node . ELEMENT_NODE ) { IClasspathEntry entry = ClasspathEntry . elementDecode ( ( Element ) node , this , unknownElements ) ; if ( entry != null ) { if ( entry . getContentKind ( ) == ClasspathEntry . K_OUTPUT ) { defaultOutput = entry ; } else { paths . add ( entry ) ; } } } } int pathSize = paths . size ( ) ; IClasspathEntry [ ] [ ] entries = new IClasspathEntry [ <NUM_LIT:2> ] [ ] ; entries [ <NUM_LIT:0> ] = new IClasspathEntry [ pathSize + ( defaultOutput == null ? <NUM_LIT:0> : <NUM_LIT:1> ) ] ; paths . toArray ( entries [ <NUM_LIT:0> ] ) ; if ( defaultOutput != null ) entries [ <NUM_LIT:0> ] [ pathSize ] = defaultOutput ; paths . clear ( ) ; list = cpElement . getElementsByTagName ( ClasspathEntry . TAG_REFERENCED_ENTRY ) ; length = list . getLength ( ) ; for ( int i = <NUM_LIT:0> ; i < length ; ++ i ) { Node node = list . item ( i ) ; if ( node . getNodeType ( ) == Node . ELEMENT_NODE ) { IClasspathEntry entry = ClasspathEntry . elementDecode ( ( Element ) node , this , unknownElements ) ; if ( entry != null ) { paths . add ( entry ) ; } } } entries [ <NUM_LIT:1> ] = new IClasspathEntry [ paths . size ( ) ] ; paths . toArray ( entries [ <NUM_LIT:1> ] ) ; return entries ; } public IClasspathEntry decodeClasspathEntry ( String encodedEntry ) { try { if ( encodedEntry == null ) return null ; StringReader reader = new StringReader ( encodedEntry ) ; Element node ; try { DocumentBuilder parser = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) ; node = parser . parse ( new InputSource ( reader ) ) . getDocumentElement ( ) ; } catch ( SAXException e ) { return null ; } catch ( ParserConfigurationException e ) { return null ; } finally { reader . close ( ) ; } if ( ! node . getNodeName ( ) . equalsIgnoreCase ( ClasspathEntry . TAG_CLASSPATHENTRY ) || node . getNodeType ( ) != Node . ELEMENT_NODE ) { return null ; } return ClasspathEntry . elementDecode ( node , this , null ) ; } catch ( IOException e ) { return null ; } } public void deconfigure ( ) throws CoreException { removeFromBuildSpec ( JavaCore . BUILDER_ID ) ; } protected IClasspathEntry [ ] defaultClasspath ( ) { return new IClasspathEntry [ ] { JavaCore . newSourceEntry ( this . project . getFullPath ( ) ) } ; } protected IPath defaultOutputLocation ( ) { return this . project . getFullPath ( ) . append ( "<STR_LIT>" ) ; } protected String encodeClasspath ( IClasspathEntry [ ] classpath , IClasspathEntry [ ] referencedEntries , IPath outputLocation , boolean indent , Map unknownElements ) throws JavaModelException { try { ByteArrayOutputStream s = new ByteArrayOutputStream ( ) ; OutputStreamWriter writer = new OutputStreamWriter ( s , "<STR_LIT>" ) ; XMLWriter xmlWriter = new XMLWriter ( writer , this , true ) ; xmlWriter . startTag ( ClasspathEntry . TAG_CLASSPATH , indent ) ; for ( int i = <NUM_LIT:0> ; i < classpath . length ; ++ i ) { ( ( ClasspathEntry ) classpath [ i ] ) . elementEncode ( xmlWriter , this . project . getFullPath ( ) , indent , true , unknownElements , false ) ; } if ( outputLocation != null ) { outputLocation = outputLocation . removeFirstSegments ( <NUM_LIT:1> ) ; outputLocation = outputLocation . makeRelative ( ) ; HashMap parameters = new HashMap ( ) ; parameters . put ( ClasspathEntry . TAG_KIND , ClasspathEntry . kindToString ( ClasspathEntry . K_OUTPUT ) ) ; parameters . put ( ClasspathEntry . TAG_PATH , String . valueOf ( outputLocation ) ) ; xmlWriter . printTag ( ClasspathEntry . TAG_CLASSPATHENTRY , parameters , indent , true , true ) ; } if ( referencedEntries != null ) { for ( int i = <NUM_LIT:0> ; i < referencedEntries . length ; ++ i ) { ( ( ClasspathEntry ) referencedEntries [ i ] ) . elementEncode ( xmlWriter , this . project . getFullPath ( ) , indent , true , unknownElements , true ) ; } } xmlWriter . endTag ( ClasspathEntry . TAG_CLASSPATH , indent , true ) ; writer . flush ( ) ; writer . close ( ) ; return s . toString ( "<STR_LIT>" ) ; } catch ( IOException e ) { throw new JavaModelException ( e , IJavaModelStatusConstants . IO_EXCEPTION ) ; } } public String encodeClasspathEntry ( IClasspathEntry classpathEntry ) { try { ByteArrayOutputStream s = new ByteArrayOutputStream ( ) ; OutputStreamWriter writer = new OutputStreamWriter ( s , "<STR_LIT>" ) ; XMLWriter xmlWriter = new XMLWriter ( writer , this , false ) ; ( ( ClasspathEntry ) classpathEntry ) . elementEncode ( xmlWriter , this . project . getFullPath ( ) , true , true , null , ( classpathEntry . getReferencingEntry ( ) != null ) ) ; writer . flush ( ) ; writer . close ( ) ; return s . toString ( "<STR_LIT>" ) ; } catch ( IOException e ) { return null ; } } public boolean equals ( Object o ) { if ( this == o ) return true ; if ( ! ( o instanceof JavaProject ) ) return false ; JavaProject other = ( JavaProject ) o ; return this . project . equals ( other . getProject ( ) ) ; } public IJavaElement findElement ( IPath path ) throws JavaModelException { return findElement ( path , DefaultWorkingCopyOwner . PRIMARY ) ; } public IJavaElement findElement ( IPath path , WorkingCopyOwner owner ) throws JavaModelException { if ( path == null || path . isAbsolute ( ) ) { throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . INVALID_PATH , path ) ) ; } try { String extension = path . getFileExtension ( ) ; if ( extension == null ) { String packageName = path . toString ( ) . replace ( IPath . SEPARATOR , '<CHAR_LIT:.>' ) ; return findPackageFragment ( packageName ) ; } else if ( Util . isJavaLikeFileName ( path . lastSegment ( ) ) || extension . equalsIgnoreCase ( EXTENSION_class ) ) { IPath packagePath = path . removeLastSegments ( <NUM_LIT:1> ) ; String packageName = packagePath . toString ( ) . replace ( IPath . SEPARATOR , '<CHAR_LIT:.>' ) ; String typeName = path . lastSegment ( ) ; typeName = typeName . substring ( <NUM_LIT:0> , typeName . length ( ) - extension . length ( ) - <NUM_LIT:1> ) ; String qualifiedName = null ; if ( packageName . length ( ) > <NUM_LIT:0> ) { qualifiedName = packageName + "<STR_LIT:.>" + typeName ; } else { qualifiedName = typeName ; } NameLookup lookup = newNameLookup ( owner ) ; NameLookup . Answer answer = lookup . findType ( qualifiedName , false , NameLookup . ACCEPT_ALL , true , false , false , null ) ; if ( answer != null ) { return answer . type . getParent ( ) ; } else { return null ; } } else { return null ; } } catch ( JavaModelException e ) { if ( e . getStatus ( ) . getCode ( ) == IJavaModelStatusConstants . ELEMENT_DOES_NOT_EXIST ) { return null ; } else { throw e ; } } } public IJavaElement findPackageFragment ( String packageName ) throws JavaModelException { NameLookup lookup = newNameLookup ( ( WorkingCopyOwner ) null ) ; IPackageFragment [ ] pkgFragments = lookup . findPackageFragments ( packageName , false ) ; if ( pkgFragments == null ) { return null ; } else { for ( int i = <NUM_LIT:0> , length = pkgFragments . length ; i < length ; i ++ ) { IPackageFragment pkgFragment = pkgFragments [ i ] ; if ( equals ( pkgFragment . getParent ( ) . getParent ( ) ) ) { return pkgFragment ; } } return pkgFragments [ <NUM_LIT:0> ] ; } } public IJavaElement findElement ( String bindingKey , WorkingCopyOwner owner ) throws JavaModelException { JavaElementFinder elementFinder = new JavaElementFinder ( bindingKey , this , owner ) ; elementFinder . parse ( ) ; if ( elementFinder . exception != null ) throw elementFinder . exception ; return elementFinder . element ; } public IPackageFragment findPackageFragment ( IPath path ) throws JavaModelException { return findPackageFragment0 ( JavaProject . canonicalizedPath ( path ) ) ; } private IPackageFragment findPackageFragment0 ( IPath path ) throws JavaModelException { NameLookup lookup = newNameLookup ( ( WorkingCopyOwner ) null ) ; return lookup . findPackageFragment ( path ) ; } public IPackageFragmentRoot findPackageFragmentRoot ( IPath path ) throws JavaModelException { return findPackageFragmentRoot0 ( JavaProject . canonicalizedPath ( path ) ) ; } public IPackageFragmentRoot findPackageFragmentRoot0 ( IPath path ) throws JavaModelException { IPackageFragmentRoot [ ] allRoots = this . getAllPackageFragmentRoots ( ) ; if ( ! path . isAbsolute ( ) ) { throw new IllegalArgumentException ( Messages . path_mustBeAbsolute ) ; } for ( int i = <NUM_LIT:0> ; i < allRoots . length ; i ++ ) { IPackageFragmentRoot classpathRoot = allRoots [ i ] ; if ( classpathRoot . getPath ( ) . equals ( path ) ) { return classpathRoot ; } } return null ; } public IPackageFragmentRoot [ ] findPackageFragmentRoots ( IClasspathEntry entry ) { try { IClasspathEntry [ ] classpath = getRawClasspath ( ) ; for ( int i = <NUM_LIT:0> , length = classpath . length ; i < length ; i ++ ) { if ( classpath [ i ] . equals ( entry ) ) { return computePackageFragmentRoots ( resolveClasspath ( new IClasspathEntry [ ] { entry } ) , false , null ) ; } } } catch ( JavaModelException e ) { } return new IPackageFragmentRoot [ ] { } ; } public IType findType ( String fullyQualifiedName ) throws JavaModelException { return findType ( fullyQualifiedName , DefaultWorkingCopyOwner . PRIMARY ) ; } public IType findType ( String fullyQualifiedName , IProgressMonitor progressMonitor ) throws JavaModelException { return findType ( fullyQualifiedName , DefaultWorkingCopyOwner . PRIMARY , progressMonitor ) ; } IType findType ( String fullyQualifiedName , NameLookup lookup , boolean considerSecondaryTypes , IProgressMonitor progressMonitor ) throws JavaModelException { NameLookup . Answer answer = lookup . findType ( fullyQualifiedName , false , NameLookup . ACCEPT_ALL , considerSecondaryTypes , true , false , progressMonitor ) ; if ( answer == null ) { int lastDot = fullyQualifiedName . lastIndexOf ( '<CHAR_LIT:.>' ) ; if ( lastDot == - <NUM_LIT:1> ) return null ; IType type = findType ( fullyQualifiedName . substring ( <NUM_LIT:0> , lastDot ) , lookup , considerSecondaryTypes , progressMonitor ) ; if ( type != null ) { type = type . getType ( fullyQualifiedName . substring ( lastDot + <NUM_LIT:1> ) ) ; if ( ! type . exists ( ) ) { return null ; } } return type ; } return answer . type ; } public IType findType ( String packageName , String typeQualifiedName ) throws JavaModelException { return findType ( packageName , typeQualifiedName , DefaultWorkingCopyOwner . PRIMARY ) ; } public IType findType ( String packageName , String typeQualifiedName , IProgressMonitor progressMonitor ) throws JavaModelException { return findType ( packageName , typeQualifiedName , DefaultWorkingCopyOwner . PRIMARY , progressMonitor ) ; } IType findType ( String packageName , String typeQualifiedName , NameLookup lookup , boolean considerSecondaryTypes , IProgressMonitor progressMonitor ) throws JavaModelException { NameLookup . Answer answer = lookup . findType ( typeQualifiedName , packageName , false , NameLookup . ACCEPT_ALL , considerSecondaryTypes , true , false , progressMonitor ) ; return answer == null ? null : answer . type ; } public IType findType ( String packageName , String typeQualifiedName , WorkingCopyOwner owner ) throws JavaModelException { NameLookup lookup = newNameLookup ( owner ) ; return findType ( packageName , typeQualifiedName , lookup , false , null ) ; } public IType findType ( String packageName , String typeQualifiedName , WorkingCopyOwner owner , IProgressMonitor progressMonitor ) throws JavaModelException { NameLookup lookup = newNameLookup ( owner ) ; return findType ( packageName , typeQualifiedName , lookup , true , progressMonitor ) ; } public IType findType ( String fullyQualifiedName , WorkingCopyOwner owner ) throws JavaModelException { NameLookup lookup = newNameLookup ( owner ) ; return findType ( fullyQualifiedName , lookup , false , null ) ; } public IType findType ( String fullyQualifiedName , WorkingCopyOwner owner , IProgressMonitor progressMonitor ) throws JavaModelException { NameLookup lookup = newNameLookup ( owner ) ; return findType ( fullyQualifiedName , lookup , true , progressMonitor ) ; } protected void flushClasspathProblemMarkers ( boolean flushCycleMarkers , boolean flushClasspathFormatMarkers ) { try { if ( this . project . isAccessible ( ) ) { IMarker [ ] markers = this . project . findMarkers ( IJavaModelMarker . BUILDPATH_PROBLEM_MARKER , false , IResource . DEPTH_ZERO ) ; for ( int i = <NUM_LIT:0> , length = markers . length ; i < length ; i ++ ) { IMarker marker = markers [ i ] ; if ( flushCycleMarkers && flushClasspathFormatMarkers ) { marker . delete ( ) ; } else { String cycleAttr = ( String ) marker . getAttribute ( IJavaModelMarker . CYCLE_DETECTED ) ; String classpathFileFormatAttr = ( String ) marker . getAttribute ( IJavaModelMarker . CLASSPATH_FILE_FORMAT ) ; if ( ( flushCycleMarkers == ( cycleAttr != null && cycleAttr . equals ( "<STR_LIT:true>" ) ) ) && ( flushClasspathFormatMarkers == ( classpathFileFormatAttr != null && classpathFileFormatAttr . equals ( "<STR_LIT:true>" ) ) ) ) { marker . delete ( ) ; } } } } } catch ( CoreException e ) { if ( JavaModelManager . VERBOSE ) { e . printStackTrace ( ) ; } } } public IPath [ ] getAccessRestrictions ( String optionName ) { String sequence = getOption ( optionName , true ) ; if ( sequence == null || sequence . length ( ) == <NUM_LIT:0> ) return null ; IPath [ ] rules = null ; char [ ] [ ] patterns = CharOperation . splitOn ( '<CHAR_LIT>' , sequence . toCharArray ( ) ) ; int patternCount ; if ( ( patternCount = patterns . length ) > <NUM_LIT:0> ) { rules = new IPath [ patternCount ] ; for ( int j = <NUM_LIT:0> ; j < patterns . length ; j ++ ) { rules [ j ] = new Path ( new String ( patterns [ j ] ) ) ; } } return rules ; } public IPackageFragmentRoot [ ] getAllPackageFragmentRoots ( ) throws JavaModelException { return getAllPackageFragmentRoots ( null ) ; } public IPackageFragmentRoot [ ] getAllPackageFragmentRoots ( Map rootToResolvedEntries ) throws JavaModelException { return computePackageFragmentRoots ( getResolvedClasspath ( ) , true , rootToResolvedEntries ) ; } public IClasspathEntry getClasspathEntryFor ( IPath path ) throws JavaModelException { getResolvedClasspath ( ) ; PerProjectInfo perProjectInfo = getPerProjectInfo ( ) ; if ( perProjectInfo == null ) return null ; Map rootPathToResolvedEntries = perProjectInfo . rootPathToResolvedEntries ; if ( rootPathToResolvedEntries == null ) return null ; IClasspathEntry classpathEntry = ( IClasspathEntry ) rootPathToResolvedEntries . get ( path ) ; if ( classpathEntry == null ) { path = getProject ( ) . getWorkspace ( ) . getRoot ( ) . getLocation ( ) . append ( path ) ; classpathEntry = ( IClasspathEntry ) rootPathToResolvedEntries . get ( path ) ; } return classpathEntry ; } public IMarker getCycleMarker ( ) { try { if ( this . project . isAccessible ( ) ) { IMarker [ ] markers = this . project . findMarkers ( IJavaModelMarker . BUILDPATH_PROBLEM_MARKER , false , IResource . DEPTH_ZERO ) ; for ( int i = <NUM_LIT:0> , length = markers . length ; i < length ; i ++ ) { IMarker marker = markers [ i ] ; String cycleAttr = ( String ) marker . getAttribute ( IJavaModelMarker . CYCLE_DETECTED ) ; if ( cycleAttr != null && cycleAttr . equals ( "<STR_LIT:true>" ) ) { return marker ; } } } } catch ( CoreException e ) { } return null ; } public IEclipsePreferences getEclipsePreferences ( ) { if ( ! JavaProject . hasJavaNature ( this . project ) ) return null ; JavaModelManager . PerProjectInfo perProjectInfo = JavaModelManager . getJavaModelManager ( ) . getPerProjectInfo ( this . project , true ) ; if ( perProjectInfo . preferences != null ) return perProjectInfo . preferences ; IScopeContext context = new ProjectScope ( getProject ( ) ) ; final IEclipsePreferences eclipsePreferences = context . getNode ( JavaCore . PLUGIN_ID ) ; updatePreferences ( eclipsePreferences ) ; perProjectInfo . preferences = eclipsePreferences ; final IEclipsePreferences eclipseParentPreferences = ( IEclipsePreferences ) eclipsePreferences . parent ( ) ; if ( eclipseParentPreferences != null ) { if ( this . preferencesNodeListener != null ) { eclipseParentPreferences . removeNodeChangeListener ( this . preferencesNodeListener ) ; } this . preferencesNodeListener = new IEclipsePreferences . INodeChangeListener ( ) { public void added ( IEclipsePreferences . NodeChangeEvent event ) { } public void removed ( IEclipsePreferences . NodeChangeEvent event ) { if ( event . getChild ( ) == eclipsePreferences ) { JavaModelManager . getJavaModelManager ( ) . resetProjectPreferences ( JavaProject . this ) ; } } } ; eclipseParentPreferences . addNodeChangeListener ( this . preferencesNodeListener ) ; } if ( this . preferencesChangeListener != null ) { eclipsePreferences . removePreferenceChangeListener ( this . preferencesChangeListener ) ; } this . preferencesChangeListener = new IEclipsePreferences . IPreferenceChangeListener ( ) { public void preferenceChange ( IEclipsePreferences . PreferenceChangeEvent event ) { String propertyName = event . getKey ( ) ; JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; if ( propertyName . startsWith ( JavaCore . PLUGIN_ID ) ) { if ( propertyName . equals ( JavaCore . CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER ) || propertyName . equals ( JavaCore . CORE_JAVA_BUILD_RESOURCE_COPY_FILTER ) || propertyName . equals ( JavaCore . CORE_JAVA_BUILD_DUPLICATE_RESOURCE ) || propertyName . equals ( JavaCore . CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER ) || propertyName . equals ( JavaCore . CORE_JAVA_BUILD_INVALID_CLASSPATH ) || propertyName . equals ( JavaCore . CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS ) || propertyName . equals ( JavaCore . CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS ) || propertyName . equals ( JavaCore . CORE_INCOMPLETE_CLASSPATH ) || propertyName . equals ( JavaCore . CORE_CIRCULAR_CLASSPATH ) || propertyName . equals ( JavaCore . CORE_INCOMPATIBLE_JDK_LEVEL ) ) { manager . deltaState . addClasspathValidation ( JavaProject . this ) ; } manager . resetProjectOptions ( JavaProject . this ) ; JavaProject . this . resetCaches ( ) ; } } } ; eclipsePreferences . addPreferenceChangeListener ( this . preferencesChangeListener ) ; return eclipsePreferences ; } public String getElementName ( ) { return this . project . getName ( ) ; } public int getElementType ( ) { return JAVA_PROJECT ; } public IClasspathEntry [ ] getExpandedClasspath ( ) throws JavaModelException { ObjectVector accumulatedEntries = new ObjectVector ( ) ; computeExpandedClasspath ( null , new HashSet ( <NUM_LIT:5> ) , accumulatedEntries ) ; IClasspathEntry [ ] expandedPath = new IClasspathEntry [ accumulatedEntries . size ( ) ] ; accumulatedEntries . copyInto ( expandedPath ) ; return expandedPath ; } public IPackageFragmentRoot getFolderPackageFragmentRoot ( IPath path ) { if ( path . segmentCount ( ) == <NUM_LIT:1> ) { return getPackageFragmentRoot ( this . project ) ; } return getPackageFragmentRoot ( this . project . getWorkspace ( ) . getRoot ( ) . getFolder ( path ) ) ; } public IJavaElement getHandleFromMemento ( String token , MementoTokenizer memento , WorkingCopyOwner owner ) { switch ( token . charAt ( <NUM_LIT:0> ) ) { case JEM_PACKAGEFRAGMENTROOT : String rootPath = IPackageFragmentRoot . DEFAULT_PACKAGEROOT_PATH ; token = null ; while ( memento . hasMoreTokens ( ) ) { token = memento . nextToken ( ) ; char firstChar = token . charAt ( <NUM_LIT:0> ) ; if ( firstChar != JEM_PACKAGEFRAGMENT && firstChar != JEM_COUNT ) { rootPath += token ; } else { break ; } } JavaElement root = ( JavaElement ) getPackageFragmentRoot ( new Path ( rootPath ) ) ; if ( token != null && token . charAt ( <NUM_LIT:0> ) == JEM_PACKAGEFRAGMENT ) { return root . getHandleFromMemento ( token , memento , owner ) ; } else { return root . getHandleFromMemento ( memento , owner ) ; } } return null ; } protected char getHandleMementoDelimiter ( ) { return JEM_JAVAPROJECT ; } private int getJavaCommandIndex ( ICommand [ ] buildSpec ) { for ( int i = <NUM_LIT:0> ; i < buildSpec . length ; ++ i ) { if ( buildSpec [ i ] . getBuilderName ( ) . equals ( JavaCore . BUILDER_ID ) ) { return i ; } } return - <NUM_LIT:1> ; } protected JavaProjectElementInfo getJavaProjectElementInfo ( ) throws JavaModelException { return ( JavaProjectElementInfo ) getElementInfo ( ) ; } public Object [ ] getNonJavaResources ( ) throws JavaModelException { return ( ( JavaProjectElementInfo ) getElementInfo ( ) ) . getNonJavaResources ( this ) ; } public String getOption ( String optionName , boolean inheritJavaCoreOptions ) { if ( JavaModelManager . getJavaModelManager ( ) . optionNames . contains ( optionName ) ) { IEclipsePreferences projectPreferences = getEclipsePreferences ( ) ; String javaCoreDefault = inheritJavaCoreOptions ? JavaCore . getOption ( optionName ) : null ; if ( projectPreferences == null ) return javaCoreDefault ; String value = projectPreferences . get ( optionName , javaCoreDefault ) ; return value == null ? null : value . trim ( ) ; } return null ; } public Map getOptions ( boolean inheritJavaCoreOptions ) { Map options = inheritJavaCoreOptions ? JavaCore . getOptions ( ) : new Hashtable ( <NUM_LIT:5> ) ; JavaModelManager . PerProjectInfo perProjectInfo = null ; Hashtable projectOptions = null ; HashSet optionNames = JavaModelManager . getJavaModelManager ( ) . optionNames ; try { perProjectInfo = getPerProjectInfo ( ) ; projectOptions = perProjectInfo . options ; if ( projectOptions == null ) { IEclipsePreferences projectPreferences = getEclipsePreferences ( ) ; if ( projectPreferences == null ) return options ; String [ ] propertyNames = projectPreferences . keys ( ) ; projectOptions = new Hashtable ( propertyNames . length ) ; for ( int i = <NUM_LIT:0> ; i < propertyNames . length ; i ++ ) { String propertyName = propertyNames [ i ] ; String value = projectPreferences . get ( propertyName , null ) ; if ( value != null && optionNames . contains ( propertyName ) ) { projectOptions . put ( propertyName , value . trim ( ) ) ; } } perProjectInfo . options = projectOptions ; } } catch ( JavaModelException jme ) { projectOptions = new Hashtable ( ) ; } catch ( BackingStoreException e ) { projectOptions = new Hashtable ( ) ; } if ( inheritJavaCoreOptions ) { Iterator propertyNames = projectOptions . entrySet ( ) . iterator ( ) ; while ( propertyNames . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) propertyNames . next ( ) ; String propertyName = ( String ) entry . getKey ( ) ; String propertyValue = ( String ) entry . getValue ( ) ; if ( propertyValue != null && optionNames . contains ( propertyName ) ) { options . put ( propertyName , propertyValue . trim ( ) ) ; } } Util . fixTaskTags ( options ) ; return options ; } Util . fixTaskTags ( projectOptions ) ; return projectOptions ; } public IPath getOutputLocation ( ) throws JavaModelException { JavaModelManager . PerProjectInfo perProjectInfo = getPerProjectInfo ( ) ; IPath outputLocation = perProjectInfo . outputLocation ; if ( outputLocation != null ) return outputLocation ; getRawClasspath ( ) ; outputLocation = perProjectInfo . outputLocation ; if ( outputLocation == null ) { return defaultOutputLocation ( ) ; } return outputLocation ; } public IPackageFragmentRoot getPackageFragmentRoot ( IPath path ) { if ( ! path . isAbsolute ( ) ) { path = getPath ( ) . append ( path ) ; } int segmentCount = path . segmentCount ( ) ; if ( segmentCount == <NUM_LIT:0> ) { return null ; } if ( path . getDevice ( ) != null || JavaModel . getExternalTarget ( path , true ) != null ) { return getPackageFragmentRoot0 ( path ) ; } IWorkspaceRoot workspaceRoot = this . project . getWorkspace ( ) . getRoot ( ) ; IResource resource = workspaceRoot . findMember ( path ) ; if ( resource == null ) { if ( path . getFileExtension ( ) != null ) { if ( ! workspaceRoot . getProject ( path . lastSegment ( ) ) . exists ( ) ) { return getPackageFragmentRoot0 ( path ) ; } else { resource = workspaceRoot . getFile ( path ) ; } } else if ( segmentCount == <NUM_LIT:1> ) { String projectName = path . segment ( <NUM_LIT:0> ) ; if ( getElementName ( ) . equals ( projectName ) ) { resource = this . project ; } else { resource = workspaceRoot . getProject ( projectName ) ; } } else { resource = workspaceRoot . getFolder ( path ) ; } } return getPackageFragmentRoot ( resource ) ; } public IPackageFragmentRoot getPackageFragmentRoot ( IResource resource ) { return getPackageFragmentRoot ( resource , null ) ; } private IPackageFragmentRoot getPackageFragmentRoot ( IResource resource , IPath entryPath ) { switch ( resource . getType ( ) ) { case IResource . FILE : return new JarPackageFragmentRoot ( resource , this ) ; case IResource . FOLDER : if ( ExternalFoldersManager . isInternalPathForExternalFolder ( resource . getFullPath ( ) ) ) return new ExternalPackageFragmentRoot ( resource , entryPath , this ) ; return new PackageFragmentRoot ( resource , this ) ; case IResource . PROJECT : return new PackageFragmentRoot ( resource , this ) ; default : return null ; } } public IPackageFragmentRoot getPackageFragmentRoot ( String externalLibraryPath ) { return getPackageFragmentRoot0 ( JavaProject . canonicalizedPath ( new Path ( externalLibraryPath ) ) ) ; } public IPackageFragmentRoot getPackageFragmentRoot0 ( IPath externalLibraryPath ) { IFolder linkedFolder = JavaModelManager . getExternalManager ( ) . getFolder ( externalLibraryPath ) ; if ( linkedFolder != null ) return new ExternalPackageFragmentRoot ( linkedFolder , externalLibraryPath , this ) ; return new JarPackageFragmentRoot ( externalLibraryPath , this ) ; } public IPackageFragmentRoot [ ] getPackageFragmentRoots ( ) throws JavaModelException { Object [ ] children ; int length ; IPackageFragmentRoot [ ] roots ; System . arraycopy ( children = getChildren ( ) , <NUM_LIT:0> , roots = new IPackageFragmentRoot [ length = children . length ] , <NUM_LIT:0> , length ) ; return roots ; } public IPackageFragmentRoot [ ] getPackageFragmentRoots ( IClasspathEntry entry ) { return findPackageFragmentRoots ( entry ) ; } public IPackageFragment [ ] getPackageFragments ( ) throws JavaModelException { IPackageFragmentRoot [ ] roots = getPackageFragmentRoots ( ) ; return getPackageFragmentsInRoots ( roots ) ; } public IPackageFragment [ ] getPackageFragmentsInRoots ( IPackageFragmentRoot [ ] roots ) { ArrayList frags = new ArrayList ( ) ; for ( int i = <NUM_LIT:0> ; i < roots . length ; i ++ ) { IPackageFragmentRoot root = roots [ i ] ; try { IJavaElement [ ] rootFragments = root . getChildren ( ) ; for ( int j = <NUM_LIT:0> ; j < rootFragments . length ; j ++ ) { frags . add ( rootFragments [ j ] ) ; } } catch ( JavaModelException e ) { } } IPackageFragment [ ] fragments = new IPackageFragment [ frags . size ( ) ] ; frags . toArray ( fragments ) ; return fragments ; } public IPath getPath ( ) { return this . project . getFullPath ( ) ; } public JavaModelManager . PerProjectInfo getPerProjectInfo ( ) throws JavaModelException { return JavaModelManager . getJavaModelManager ( ) . getPerProjectInfoCheckExistence ( this . project ) ; } private IPath getPluginWorkingLocation ( ) { return this . project . getWorkingLocation ( JavaCore . PLUGIN_ID ) ; } public IProject getProject ( ) { return this . project ; } public ProjectCache getProjectCache ( ) throws JavaModelException { return ( ( JavaProjectElementInfo ) getElementInfo ( ) ) . getProjectCache ( this ) ; } public IClasspathEntry [ ] getRawClasspath ( ) throws JavaModelException { JavaModelManager . PerProjectInfo perProjectInfo = getPerProjectInfo ( ) ; IClasspathEntry [ ] classpath = perProjectInfo . rawClasspath ; if ( classpath != null ) return classpath ; classpath = perProjectInfo . readAndCacheClasspath ( this ) [ <NUM_LIT:0> ] ; if ( classpath == JavaProject . INVALID_CLASSPATH ) return defaultClasspath ( ) ; return classpath ; } public IClasspathEntry [ ] getReferencedClasspathEntries ( ) throws JavaModelException { return getPerProjectInfo ( ) . referencedEntries ; } public String [ ] getRequiredProjectNames ( ) throws JavaModelException { return projectPrerequisites ( getResolvedClasspath ( ) ) ; } public IClasspathEntry [ ] getResolvedClasspath ( ) throws JavaModelException { PerProjectInfo perProjectInfo = getPerProjectInfo ( ) ; IClasspathEntry [ ] resolvedClasspath = perProjectInfo . getResolvedClasspath ( ) ; if ( resolvedClasspath == null ) { resolveClasspath ( perProjectInfo , false , true ) ; resolvedClasspath = perProjectInfo . getResolvedClasspath ( ) ; if ( resolvedClasspath == null ) { PerProjectInfo temporaryInfo = newTemporaryInfo ( ) ; resolveClasspath ( temporaryInfo , false , true ) ; resolvedClasspath = temporaryInfo . getResolvedClasspath ( ) ; } } return resolvedClasspath ; } public IClasspathEntry [ ] getResolvedClasspath ( boolean ignoreUnresolvedEntry ) throws JavaModelException { if ( JavaModelManager . getJavaModelManager ( ) . isClasspathBeingResolved ( this ) ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED ) verbose_reentering_classpath_resolution ( ) ; return RESOLUTION_IN_PROGRESS ; } PerProjectInfo perProjectInfo = getPerProjectInfo ( ) ; IClasspathEntry [ ] resolvedClasspath ; IJavaModelStatus unresolvedEntryStatus ; synchronized ( perProjectInfo ) { resolvedClasspath = perProjectInfo . getResolvedClasspath ( ) ; unresolvedEntryStatus = perProjectInfo . unresolvedEntryStatus ; } if ( resolvedClasspath == null || ( unresolvedEntryStatus != null && ! unresolvedEntryStatus . isOK ( ) ) ) { resolveClasspath ( perProjectInfo , false , true ) ; synchronized ( perProjectInfo ) { resolvedClasspath = perProjectInfo . getResolvedClasspath ( ) ; unresolvedEntryStatus = perProjectInfo . unresolvedEntryStatus ; } if ( resolvedClasspath == null ) { PerProjectInfo temporaryInfo = newTemporaryInfo ( ) ; resolveClasspath ( temporaryInfo , false , true ) ; resolvedClasspath = temporaryInfo . getResolvedClasspath ( ) ; unresolvedEntryStatus = temporaryInfo . unresolvedEntryStatus ; } } if ( ! ignoreUnresolvedEntry && unresolvedEntryStatus != null && ! unresolvedEntryStatus . isOK ( ) ) throw new JavaModelException ( unresolvedEntryStatus ) ; return resolvedClasspath ; } private void verbose_reentering_classpath_resolution ( ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" ) ; new Exception ( "<STR_LIT>" ) . printStackTrace ( System . out ) ; } public IResource resource ( PackageFragmentRoot root ) { return this . project ; } public String getSharedProperty ( String key ) throws CoreException { String property = null ; IFile rscFile = this . project . getFile ( key ) ; if ( rscFile . exists ( ) ) { byte [ ] bytes = Util . getResourceContentsAsByteArray ( rscFile ) ; try { property = new String ( bytes , org . eclipse . jdt . internal . compiler . util . Util . UTF_8 ) ; } catch ( UnsupportedEncodingException e ) { Util . log ( e , "<STR_LIT>" ) ; property = new String ( bytes ) ; } } else { URI location = rscFile . getLocationURI ( ) ; if ( location != null ) { File file = Util . toLocalFile ( location , null ) ; if ( file != null && file . exists ( ) ) { byte [ ] bytes ; try { bytes = org . eclipse . jdt . internal . compiler . util . Util . getFileByteContent ( file ) ; } catch ( IOException e ) { return null ; } try { property = new String ( bytes , org . eclipse . jdt . internal . compiler . util . Util . UTF_8 ) ; } catch ( UnsupportedEncodingException e ) { Util . log ( e , "<STR_LIT>" ) ; property = new String ( bytes ) ; } } } } return property ; } public SourceMapper getSourceMapper ( ) { return null ; } public IResource getUnderlyingResource ( ) throws JavaModelException { if ( ! exists ( ) ) throw newNotPresentException ( ) ; return this . project ; } public boolean hasBuildState ( ) { return JavaModelManager . getJavaModelManager ( ) . getLastBuiltState ( this . project , null ) != null ; } public boolean hasClasspathCycle ( IClasspathEntry [ ] preferredClasspath ) { HashSet cycleParticipants = new HashSet ( ) ; HashMap preferredClasspaths = new HashMap ( <NUM_LIT:1> ) ; preferredClasspaths . put ( this , preferredClasspath ) ; updateCycleParticipants ( new ArrayList ( <NUM_LIT:2> ) , cycleParticipants , ResourcesPlugin . getWorkspace ( ) . getRoot ( ) , new HashSet ( <NUM_LIT:2> ) , preferredClasspaths ) ; return ! cycleParticipants . isEmpty ( ) ; } public boolean hasCycleMarker ( ) { return getCycleMarker ( ) != null ; } public int hashCode ( ) { return this . project . hashCode ( ) ; } private boolean hasUTF8BOM ( byte [ ] bytes ) { if ( bytes . length > IContentDescription . BOM_UTF_8 . length ) { for ( int i = <NUM_LIT:0> , length = IContentDescription . BOM_UTF_8 . length ; i < length ; i ++ ) { if ( IContentDescription . BOM_UTF_8 [ i ] != bytes [ i ] ) return false ; } return true ; } return false ; } public boolean hasSource ( ) { IClasspathEntry [ ] entries ; try { entries = getRawClasspath ( ) ; } catch ( JavaModelException e ) { return true ; } for ( int i = <NUM_LIT:0> , max = entries . length ; i < max ; i ++ ) { if ( entries [ i ] . getEntryKind ( ) == IClasspathEntry . CPE_SOURCE ) { return true ; } } return false ; } public boolean isOnClasspath ( IJavaElement element ) { IClasspathEntry [ ] rawClasspath ; try { rawClasspath = getRawClasspath ( ) ; } catch ( JavaModelException e ) { return false ; } int elementType = element . getElementType ( ) ; boolean isPackageFragmentRoot = false ; boolean isFolderPath = false ; boolean isSource = false ; switch ( elementType ) { case IJavaElement . JAVA_MODEL : return false ; case IJavaElement . JAVA_PROJECT : break ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : isPackageFragmentRoot = true ; break ; case IJavaElement . PACKAGE_FRAGMENT : isFolderPath = ! ( ( IPackageFragmentRoot ) element . getParent ( ) ) . isArchive ( ) ; break ; case IJavaElement . COMPILATION_UNIT : isSource = true ; break ; default : isSource = element . getAncestor ( IJavaElement . COMPILATION_UNIT ) != null ; break ; } IPath elementPath = element . getPath ( ) ; int length = rawClasspath . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IClasspathEntry entry = rawClasspath [ i ] ; switch ( entry . getEntryKind ( ) ) { case IClasspathEntry . CPE_LIBRARY : case IClasspathEntry . CPE_PROJECT : case IClasspathEntry . CPE_SOURCE : if ( isOnClasspathEntry ( elementPath , isFolderPath , isPackageFragmentRoot , entry ) ) return true ; break ; } } if ( isSource ) return false ; IClasspathEntry [ ] resolvedClasspath = null ; try { resolvedClasspath = getResolvedClasspath ( ) ; } catch ( JavaModelException e ) { return false ; } for ( int index = <NUM_LIT:0> ; index < resolvedClasspath . length ; index ++ ) { if ( isOnClasspathEntry ( elementPath , isFolderPath , isPackageFragmentRoot , resolvedClasspath [ index ] ) ) return true ; } return false ; } public boolean isOnClasspath ( IResource resource ) { IPath exactPath = resource . getFullPath ( ) ; IPath path = exactPath ; int resourceType = resource . getType ( ) ; boolean isFolderPath = resourceType == IResource . FOLDER || resourceType == IResource . PROJECT ; IClasspathEntry [ ] classpath ; try { classpath = this . getResolvedClasspath ( ) ; } catch ( JavaModelException e ) { return false ; } for ( int i = <NUM_LIT:0> ; i < classpath . length ; i ++ ) { IClasspathEntry entry = classpath [ i ] ; IPath entryPath = entry . getPath ( ) ; if ( entryPath . equals ( exactPath ) ) { return true ; } if ( entryPath . isAbsolute ( ) && entryPath . equals ( ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getLocation ( ) . append ( exactPath ) ) ) { return true ; } if ( entryPath . isPrefixOf ( path ) && ! Util . isExcluded ( path , ( ( ClasspathEntry ) entry ) . fullInclusionPatternChars ( ) , ( ( ClasspathEntry ) entry ) . fullExclusionPatternChars ( ) , isFolderPath ) ) { return true ; } } return false ; } private boolean isOnClasspathEntry ( IPath elementPath , boolean isFolderPath , boolean isPackageFragmentRoot , IClasspathEntry entry ) { IPath entryPath = entry . getPath ( ) ; if ( isPackageFragmentRoot ) { if ( entryPath . equals ( elementPath ) ) return true ; } else { if ( entryPath . isPrefixOf ( elementPath ) && ! Util . isExcluded ( elementPath , ( ( ClasspathEntry ) entry ) . fullInclusionPatternChars ( ) , ( ( ClasspathEntry ) entry ) . fullExclusionPatternChars ( ) , isFolderPath ) ) return true ; } if ( entryPath . isAbsolute ( ) && entryPath . equals ( ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getLocation ( ) . append ( elementPath ) ) ) { return true ; } return false ; } private IEclipsePreferences loadPreferences ( ) { IEclipsePreferences preferences = null ; IPath projectMetaLocation = getPluginWorkingLocation ( ) ; if ( projectMetaLocation != null ) { File prefFile = projectMetaLocation . append ( PREF_FILENAME ) . toFile ( ) ; if ( prefFile . exists ( ) ) { InputStream in = null ; try { in = new BufferedInputStream ( new FileInputStream ( prefFile ) ) ; preferences = Platform . getPreferencesService ( ) . readPreferences ( in ) ; } catch ( CoreException e ) { } catch ( IOException e ) { } finally { if ( in != null ) { try { in . close ( ) ; } catch ( IOException e ) { } } } prefFile . delete ( ) ; return preferences ; } } return null ; } public IEvaluationContext newEvaluationContext ( ) { EvaluationContext context = new EvaluationContext ( ) ; context . setLineSeparator ( Util . getLineSeparator ( null , this ) ) ; return new EvaluationContextWrapper ( context , this ) ; } public NameLookup newNameLookup ( ICompilationUnit [ ] workingCopies ) throws JavaModelException { return getJavaProjectElementInfo ( ) . newNameLookup ( this , workingCopies ) ; } public NameLookup newNameLookup ( WorkingCopyOwner owner ) throws JavaModelException { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; ICompilationUnit [ ] workingCopies = owner == null ? null : manager . getWorkingCopies ( owner , true ) ; return newNameLookup ( workingCopies ) ; } public SearchableEnvironment newSearchableNameEnvironment ( ICompilationUnit [ ] workingCopies ) throws JavaModelException { return new SearchableEnvironment ( this , workingCopies ) ; } public SearchableEnvironment newSearchableNameEnvironment ( WorkingCopyOwner owner ) throws JavaModelException { return new SearchableEnvironment ( this , owner ) ; } public PerProjectInfo newTemporaryInfo ( ) { return new PerProjectInfo ( this . project . getProject ( ) ) { protected ClasspathChange addClasspathChange ( ) { return null ; } } ; } public ITypeHierarchy newTypeHierarchy ( IRegion region , IProgressMonitor monitor ) throws JavaModelException { return newTypeHierarchy ( region , DefaultWorkingCopyOwner . PRIMARY , monitor ) ; } public ITypeHierarchy newTypeHierarchy ( IRegion region , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException { if ( region == null ) { throw new IllegalArgumentException ( Messages . hierarchy_nullRegion ) ; } ICompilationUnit [ ] workingCopies = JavaModelManager . getJavaModelManager ( ) . getWorkingCopies ( owner , true ) ; CreateTypeHierarchyOperation op = new CreateTypeHierarchyOperation ( region , workingCopies , null , true ) ; op . runOperation ( monitor ) ; return op . getResult ( ) ; } public ITypeHierarchy newTypeHierarchy ( IType type , IRegion region , IProgressMonitor monitor ) throws JavaModelException { return newTypeHierarchy ( type , region , DefaultWorkingCopyOwner . PRIMARY , monitor ) ; } public ITypeHierarchy newTypeHierarchy ( IType type , IRegion region , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException { if ( type == null ) { throw new IllegalArgumentException ( Messages . hierarchy_nullFocusType ) ; } if ( region == null ) { throw new IllegalArgumentException ( Messages . hierarchy_nullRegion ) ; } ICompilationUnit [ ] workingCopies = JavaModelManager . getJavaModelManager ( ) . getWorkingCopies ( owner , true ) ; CreateTypeHierarchyOperation op = new CreateTypeHierarchyOperation ( region , workingCopies , type , true ) ; op . runOperation ( monitor ) ; return op . getResult ( ) ; } public String [ ] projectPrerequisites ( IClasspathEntry [ ] resolvedClasspath ) throws JavaModelException { ArrayList prerequisites = new ArrayList ( ) ; for ( int i = <NUM_LIT:0> , length = resolvedClasspath . length ; i < length ; i ++ ) { IClasspathEntry entry = resolvedClasspath [ i ] ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_PROJECT ) { prerequisites . add ( entry . getPath ( ) . lastSegment ( ) ) ; } } int size = prerequisites . size ( ) ; if ( size == <NUM_LIT:0> ) { return NO_PREREQUISITES ; } else { String [ ] result = new String [ size ] ; prerequisites . toArray ( result ) ; return result ; } } public IClasspathEntry [ ] [ ] readFileEntriesWithException ( Map unknownElements ) throws CoreException , IOException , ClasspathEntry . AssertionFailedException { IFile rscFile = this . project . getFile ( JavaProject . CLASSPATH_FILENAME ) ; byte [ ] bytes ; if ( rscFile . exists ( ) ) { bytes = Util . getResourceContentsAsByteArray ( rscFile ) ; } else { URI location = rscFile . getLocationURI ( ) ; if ( location == null ) throw new IOException ( "<STR_LIT>" + rscFile ) ; File file = Util . toLocalFile ( location , null ) ; if ( file == null ) throw new IOException ( "<STR_LIT>" + location ) ; try { bytes = org . eclipse . jdt . internal . compiler . util . Util . getFileByteContent ( file ) ; } catch ( IOException e ) { if ( ! file . exists ( ) ) return new IClasspathEntry [ ] [ ] { defaultClasspath ( ) , ClasspathEntry . NO_ENTRIES } ; throw e ; } } if ( hasUTF8BOM ( bytes ) ) { int length = bytes . length - IContentDescription . BOM_UTF_8 . length ; System . arraycopy ( bytes , IContentDescription . BOM_UTF_8 . length , bytes = new byte [ length ] , <NUM_LIT:0> , length ) ; } String xmlClasspath ; try { xmlClasspath = new String ( bytes , org . eclipse . jdt . internal . compiler . util . Util . UTF_8 ) ; } catch ( UnsupportedEncodingException e ) { Util . log ( e , "<STR_LIT>" ) ; xmlClasspath = new String ( bytes ) ; } return decodeClasspath ( xmlClasspath , unknownElements ) ; } private IClasspathEntry [ ] [ ] readFileEntries ( Map unkwownElements ) { try { return readFileEntriesWithException ( unkwownElements ) ; } catch ( CoreException e ) { Util . log ( e , "<STR_LIT>" + getPath ( ) . append ( JavaProject . CLASSPATH_FILENAME ) ) ; return new IClasspathEntry [ ] [ ] { JavaProject . INVALID_CLASSPATH , ClasspathEntry . NO_ENTRIES } ; } catch ( IOException e ) { Util . log ( e , "<STR_LIT>" + getPath ( ) . append ( JavaProject . CLASSPATH_FILENAME ) ) ; return new IClasspathEntry [ ] [ ] { JavaProject . INVALID_CLASSPATH , ClasspathEntry . NO_ENTRIES } ; } catch ( ClasspathEntry . AssertionFailedException e ) { Util . log ( e , "<STR_LIT>" + getPath ( ) . append ( JavaProject . CLASSPATH_FILENAME ) ) ; return new IClasspathEntry [ ] [ ] { JavaProject . INVALID_CLASSPATH , ClasspathEntry . NO_ENTRIES } ; } } public IPath readOutputLocation ( ) { IClasspathEntry [ ] [ ] classpath = readFileEntries ( null ) ; if ( classpath [ <NUM_LIT:0> ] == JavaProject . INVALID_CLASSPATH ) return defaultOutputLocation ( ) ; IPath outputLocation = null ; if ( classpath [ <NUM_LIT:0> ] . length > <NUM_LIT:0> ) { IClasspathEntry entry = classpath [ <NUM_LIT:0> ] [ classpath [ <NUM_LIT:0> ] . length - <NUM_LIT:1> ] ; if ( entry . getContentKind ( ) == ClasspathEntry . K_OUTPUT ) { outputLocation = entry . getPath ( ) ; } } return outputLocation ; } public IClasspathEntry [ ] readRawClasspath ( ) { IClasspathEntry [ ] [ ] classpath = readFileEntries ( null ) ; if ( classpath [ <NUM_LIT:0> ] == JavaProject . INVALID_CLASSPATH ) return defaultClasspath ( ) ; if ( classpath [ <NUM_LIT:0> ] . length > <NUM_LIT:0> ) { IClasspathEntry entry = classpath [ <NUM_LIT:0> ] [ classpath [ <NUM_LIT:0> ] . length - <NUM_LIT:1> ] ; if ( entry . getContentKind ( ) == ClasspathEntry . K_OUTPUT ) { IClasspathEntry [ ] copy = new IClasspathEntry [ classpath [ <NUM_LIT:0> ] . length - <NUM_LIT:1> ] ; System . arraycopy ( classpath [ <NUM_LIT:0> ] , <NUM_LIT:0> , copy , <NUM_LIT:0> , copy . length ) ; classpath [ <NUM_LIT:0> ] = copy ; } } return classpath [ <NUM_LIT:0> ] ; } protected void removeFromBuildSpec ( String builderID ) throws CoreException { IProjectDescription description = this . project . getDescription ( ) ; ICommand [ ] commands = description . getBuildSpec ( ) ; for ( int i = <NUM_LIT:0> ; i < commands . length ; ++ i ) { if ( commands [ i ] . getBuilderName ( ) . equals ( builderID ) ) { ICommand [ ] newCommands = new ICommand [ commands . length - <NUM_LIT:1> ] ; System . arraycopy ( commands , <NUM_LIT:0> , newCommands , <NUM_LIT:0> , i ) ; System . arraycopy ( commands , i + <NUM_LIT:1> , newCommands , i , commands . length - i - <NUM_LIT:1> ) ; description . setBuildSpec ( newCommands ) ; this . project . setDescription ( description , null ) ; return ; } } } public void resetCaches ( ) { JavaProjectElementInfo info = ( JavaProjectElementInfo ) JavaModelManager . getJavaModelManager ( ) . peekAtInfo ( this ) ; if ( info != null ) { info . resetCaches ( ) ; } } public ClasspathChange resetResolvedClasspath ( ) { try { return getPerProjectInfo ( ) . resetResolvedClasspath ( ) ; } catch ( JavaModelException e ) { return null ; } } public IClasspathEntry [ ] resolveClasspath ( IClasspathEntry [ ] rawClasspath ) throws JavaModelException { return resolveClasspath ( rawClasspath , false , true ) . resolvedClasspath ; } static class ResolvedClasspath { IClasspathEntry [ ] resolvedClasspath ; IJavaModelStatus unresolvedEntryStatus = JavaModelStatus . VERIFIED_OK ; HashMap rawReverseMap = new HashMap ( ) ; Map rootPathToResolvedEntries = new HashMap ( ) ; IClasspathEntry [ ] referencedEntries = null ; } public ResolvedClasspath resolveClasspath ( IClasspathEntry [ ] rawClasspath , boolean usePreviousSession , boolean resolveChainedLibraries ) throws JavaModelException { return resolveClasspath ( rawClasspath , null , usePreviousSession , resolveChainedLibraries ) ; } public ResolvedClasspath resolveClasspath ( IClasspathEntry [ ] rawClasspath , IClasspathEntry [ ] referencedEntries , boolean usePreviousSession , boolean resolveChainedLibraries ) throws JavaModelException { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; ExternalFoldersManager externalFoldersManager = JavaModelManager . getExternalManager ( ) ; ResolvedClasspath result = new ResolvedClasspath ( ) ; Map referencedEntriesMap = new HashMap ( ) ; List rawLibrariesPath = new ArrayList ( ) ; LinkedHashSet resolvedEntries = new LinkedHashSet ( ) ; if ( resolveChainedLibraries ) { for ( int index = <NUM_LIT:0> ; index < rawClasspath . length ; index ++ ) { IClasspathEntry currentEntry = rawClasspath [ index ] ; if ( currentEntry . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY ) { rawLibrariesPath . add ( ClasspathEntry . resolveDotDot ( currentEntry . getPath ( ) ) ) ; } } if ( referencedEntries != null ) { LinkedHashSet referencedEntriesSet = new LinkedHashSet ( ) ; for ( int index = <NUM_LIT:0> ; index < referencedEntries . length ; index ++ ) { IPath path = referencedEntries [ index ] . getPath ( ) ; if ( ! rawLibrariesPath . contains ( path ) && referencedEntriesMap . get ( path ) == null ) { referencedEntriesMap . put ( path , referencedEntries [ index ] ) ; referencedEntriesSet . add ( referencedEntries [ index ] ) ; } } if ( referencedEntriesSet . size ( ) > <NUM_LIT:0> ) { result . referencedEntries = new IClasspathEntry [ referencedEntriesSet . size ( ) ] ; referencedEntriesSet . toArray ( result . referencedEntries ) ; } } } int length = rawClasspath . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IClasspathEntry rawEntry = rawClasspath [ i ] ; IClasspathEntry resolvedEntry = rawEntry ; switch ( rawEntry . getEntryKind ( ) ) { case IClasspathEntry . CPE_VARIABLE : try { resolvedEntry = manager . resolveVariableEntry ( rawEntry , usePreviousSession ) ; } catch ( ClasspathEntry . AssertionFailedException e ) { result . unresolvedEntryStatus = new JavaModelStatus ( IJavaModelStatusConstants . INVALID_PATH , e . getMessage ( ) ) ; break ; } if ( resolvedEntry == null ) { result . unresolvedEntryStatus = new JavaModelStatus ( IJavaModelStatusConstants . CP_VARIABLE_PATH_UNBOUND , this , rawEntry . getPath ( ) ) ; } else { if ( resolveChainedLibraries && resolvedEntry . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY && result . rawReverseMap . get ( resolvedEntry . getPath ( ) ) == null ) { ClasspathEntry [ ] extraEntries = ( ( ClasspathEntry ) resolvedEntry ) . resolvedChainedLibraries ( ) ; for ( int j = <NUM_LIT:0> , length2 = extraEntries . length ; j < length2 ; j ++ ) { if ( ! rawLibrariesPath . contains ( extraEntries [ j ] . getPath ( ) ) ) { addToResult ( rawEntry , extraEntries [ j ] , result , resolvedEntries , externalFoldersManager , referencedEntriesMap , true ) ; } } } addToResult ( rawEntry , resolvedEntry , result , resolvedEntries , externalFoldersManager , referencedEntriesMap , false ) ; } break ; case IClasspathEntry . CPE_CONTAINER : IClasspathContainer container = usePreviousSession ? manager . getPreviousSessionContainer ( rawEntry . getPath ( ) , this ) : JavaCore . getClasspathContainer ( rawEntry . getPath ( ) , this ) ; if ( container == null ) { result . unresolvedEntryStatus = new JavaModelStatus ( IJavaModelStatusConstants . CP_CONTAINER_PATH_UNBOUND , this , rawEntry . getPath ( ) ) ; break ; } IClasspathEntry [ ] containerEntries = container . getClasspathEntries ( ) ; if ( containerEntries == null ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE || JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE ) { JavaModelManager . getJavaModelManager ( ) . verbose_missbehaving_container_null_entries ( this , rawEntry . getPath ( ) ) ; } break ; } for ( int j = <NUM_LIT:0> , containerLength = containerEntries . length ; j < containerLength ; j ++ ) { ClasspathEntry cEntry = ( ClasspathEntry ) containerEntries [ j ] ; if ( cEntry == null ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE || JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE ) { JavaModelManager . getJavaModelManager ( ) . verbose_missbehaving_container ( this , rawEntry . getPath ( ) , containerEntries ) ; } break ; } cEntry = cEntry . combineWith ( ( ClasspathEntry ) rawEntry ) ; if ( cEntry . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY ) { cEntry = cEntry . resolvedDotDot ( ) ; if ( resolveChainedLibraries && JavaModelManager . getJavaModelManager ( ) . resolveReferencedLibrariesForContainers && result . rawReverseMap . get ( cEntry . getPath ( ) ) == null ) { ClasspathEntry [ ] extraEntries = cEntry . resolvedChainedLibraries ( ) ; for ( int k = <NUM_LIT:0> , length2 = extraEntries . length ; k < length2 ; k ++ ) { if ( ! rawLibrariesPath . contains ( extraEntries [ k ] . getPath ( ) ) ) { addToResult ( rawEntry , extraEntries [ k ] , result , resolvedEntries , externalFoldersManager , referencedEntriesMap , false ) ; } } } } addToResult ( rawEntry , cEntry , result , resolvedEntries , externalFoldersManager , referencedEntriesMap , false ) ; } break ; case IClasspathEntry . CPE_LIBRARY : resolvedEntry = ( ( ClasspathEntry ) rawEntry ) . resolvedDotDot ( ) ; if ( resolveChainedLibraries && result . rawReverseMap . get ( resolvedEntry . getPath ( ) ) == null ) { ClasspathEntry [ ] extraEntries = ( ( ClasspathEntry ) resolvedEntry ) . resolvedChainedLibraries ( ) ; for ( int k = <NUM_LIT:0> , length2 = extraEntries . length ; k < length2 ; k ++ ) { if ( ! rawLibrariesPath . contains ( extraEntries [ k ] . getPath ( ) ) ) { addToResult ( rawEntry , extraEntries [ k ] , result , resolvedEntries , externalFoldersManager , referencedEntriesMap , true ) ; } } } addToResult ( rawEntry , resolvedEntry , result , resolvedEntries , externalFoldersManager , referencedEntriesMap , false ) ; break ; default : addToResult ( rawEntry , resolvedEntry , result , resolvedEntries , externalFoldersManager , referencedEntriesMap , false ) ; break ; } } result . resolvedClasspath = new IClasspathEntry [ resolvedEntries . size ( ) ] ; resolvedEntries . toArray ( result . resolvedClasspath ) ; return result ; } private void addToResult ( IClasspathEntry rawEntry , IClasspathEntry resolvedEntry , ResolvedClasspath result , LinkedHashSet resolvedEntries , ExternalFoldersManager externalFoldersManager , Map oldChainedEntriesMap , boolean addAsChainedEntry ) { IPath resolvedPath ; if ( result . rawReverseMap . get ( resolvedPath = resolvedEntry . getPath ( ) ) == null ) { result . rawReverseMap . put ( resolvedPath , rawEntry ) ; result . rootPathToResolvedEntries . put ( resolvedPath , resolvedEntry ) ; resolvedEntries . add ( resolvedEntry ) ; if ( addAsChainedEntry ) { IClasspathEntry chainedEntry = null ; chainedEntry = ( ClasspathEntry ) oldChainedEntriesMap . get ( resolvedPath ) ; if ( chainedEntry != null ) { copyFromOldChainedEntry ( ( ClasspathEntry ) resolvedEntry , ( ClasspathEntry ) chainedEntry ) ; } } } if ( resolvedEntry . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY && ExternalFoldersManager . isExternalFolderPath ( resolvedPath ) ) { externalFoldersManager . addFolder ( resolvedPath ) ; } } private void copyFromOldChainedEntry ( ClasspathEntry resolvedEntry , ClasspathEntry chainedEntry ) { IPath path = chainedEntry . getSourceAttachmentPath ( ) ; if ( path != null ) { resolvedEntry . sourceAttachmentPath = path ; } path = chainedEntry . getSourceAttachmentRootPath ( ) ; if ( path != null ) { resolvedEntry . sourceAttachmentRootPath = path ; } IClasspathAttribute [ ] attributes = chainedEntry . getExtraAttributes ( ) ; if ( attributes != null ) { resolvedEntry . extraAttributes = attributes ; } } public void resolveClasspath ( PerProjectInfo perProjectInfo , boolean usePreviousSession , boolean addClasspathChange ) throws JavaModelException { if ( CP_RESOLUTION_BP_LISTENERS != null ) breakpoint ( <NUM_LIT:1> , this ) ; JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; boolean isClasspathBeingResolved = manager . isClasspathBeingResolved ( this ) ; try { if ( ! isClasspathBeingResolved ) { manager . setClasspathBeingResolved ( this , true ) ; } IClasspathEntry [ ] [ ] classpath = new IClasspathEntry [ <NUM_LIT:2> ] [ ] ; int timeStamp ; synchronized ( perProjectInfo ) { classpath [ <NUM_LIT:0> ] = perProjectInfo . rawClasspath ; classpath [ <NUM_LIT:1> ] = perProjectInfo . referencedEntries ; if ( classpath [ <NUM_LIT:0> ] == null ) classpath = perProjectInfo . readAndCacheClasspath ( this ) ; timeStamp = perProjectInfo . rawTimeStamp ; } ResolvedClasspath result = resolveClasspath ( classpath [ <NUM_LIT:0> ] , classpath [ <NUM_LIT:1> ] , usePreviousSession , true ) ; if ( CP_RESOLUTION_BP_LISTENERS != null ) breakpoint ( <NUM_LIT:2> , this ) ; perProjectInfo . setResolvedClasspath ( result . resolvedClasspath , result . referencedEntries , result . rawReverseMap , result . rootPathToResolvedEntries , usePreviousSession ? PerProjectInfo . NEED_RESOLUTION : result . unresolvedEntryStatus , timeStamp , addClasspathChange ) ; } finally { if ( ! isClasspathBeingResolved ) { manager . setClasspathBeingResolved ( this , false ) ; } if ( CP_RESOLUTION_BP_LISTENERS != null ) breakpoint ( <NUM_LIT:3> , this ) ; } } public String rootID ( ) { return "<STR_LIT>" + this . project . getFullPath ( ) ; } public boolean writeFileEntries ( IClasspathEntry [ ] newClasspath , IClasspathEntry [ ] referencedEntries , IPath newOutputLocation ) throws JavaModelException { if ( ! this . project . isAccessible ( ) ) return false ; Map unknownElements = new HashMap ( ) ; IClasspathEntry [ ] [ ] fileEntries = readFileEntries ( unknownElements ) ; if ( fileEntries [ <NUM_LIT:0> ] != JavaProject . INVALID_CLASSPATH && areClasspathsEqual ( newClasspath , newOutputLocation , fileEntries [ <NUM_LIT:0> ] ) && ( referencedEntries == null || areClasspathsEqual ( referencedEntries , fileEntries [ <NUM_LIT:1> ] ) ) ) { return false ; } try { setSharedProperty ( JavaProject . CLASSPATH_FILENAME , encodeClasspath ( newClasspath , referencedEntries , newOutputLocation , true , unknownElements ) ) ; return true ; } catch ( CoreException e ) { throw new JavaModelException ( e ) ; } } public boolean writeFileEntries ( IClasspathEntry [ ] newClasspath , IPath newOutputLocation ) throws JavaModelException { return writeFileEntries ( newClasspath , ClasspathEntry . NO_ENTRIES , newOutputLocation ) ; } private void setJavaCommand ( IProjectDescription description , ICommand newCommand ) throws CoreException { ICommand [ ] oldBuildSpec = description . getBuildSpec ( ) ; int oldJavaCommandIndex = getJavaCommandIndex ( oldBuildSpec ) ; ICommand [ ] newCommands ; if ( oldJavaCommandIndex == - <NUM_LIT:1> ) { newCommands = new ICommand [ oldBuildSpec . length + <NUM_LIT:1> ] ; System . arraycopy ( oldBuildSpec , <NUM_LIT:0> , newCommands , <NUM_LIT:1> , oldBuildSpec . length ) ; newCommands [ <NUM_LIT:0> ] = newCommand ; } else { oldBuildSpec [ oldJavaCommandIndex ] = newCommand ; newCommands = oldBuildSpec ; } description . setBuildSpec ( newCommands ) ; this . project . setDescription ( description , null ) ; } public void setOption ( String optionName , String optionValue ) { if ( ! JavaModelManager . getJavaModelManager ( ) . optionNames . contains ( optionName ) ) return ; IEclipsePreferences projectPreferences = getEclipsePreferences ( ) ; if ( optionValue == null ) { projectPreferences . remove ( optionName ) ; } else { projectPreferences . put ( optionName , optionValue ) ; } try { projectPreferences . flush ( ) ; } catch ( BackingStoreException e ) { } } public void setOptions ( Map newOptions ) { IEclipsePreferences projectPreferences = getEclipsePreferences ( ) ; if ( projectPreferences == null ) return ; try { if ( newOptions == null ) { projectPreferences . clear ( ) ; } else { Iterator entries = newOptions . entrySet ( ) . iterator ( ) ; while ( entries . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) entries . next ( ) ; String key = ( String ) entry . getKey ( ) ; if ( ! JavaModelManager . getJavaModelManager ( ) . optionNames . contains ( key ) ) continue ; projectPreferences . put ( key , ( String ) entry . getValue ( ) ) ; } String [ ] pNames = projectPreferences . keys ( ) ; int ln = pNames . length ; for ( int i = <NUM_LIT:0> ; i < ln ; i ++ ) { String key = pNames [ i ] ; if ( ! newOptions . containsKey ( key ) ) { projectPreferences . remove ( key ) ; } } } projectPreferences . flush ( ) ; try { getPerProjectInfo ( ) . options = null ; } catch ( JavaModelException e ) { } } catch ( BackingStoreException e ) { } } public void setOutputLocation ( IPath path , IProgressMonitor monitor ) throws JavaModelException { if ( path == null ) { throw new IllegalArgumentException ( Messages . path_nullPath ) ; } if ( path . equals ( getOutputLocation ( ) ) ) { return ; } setRawClasspath ( getRawClasspath ( ) , path , monitor ) ; } public void setProject ( IProject project ) { this . project = project ; this . parent = JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) ; } public void setRawClasspath ( IClasspathEntry [ ] entries , boolean canModifyResources , IProgressMonitor monitor ) throws JavaModelException { setRawClasspath ( entries , getOutputLocation ( ) , canModifyResources , monitor ) ; } public void setRawClasspath ( IClasspathEntry [ ] newRawClasspath , IPath newOutputLocation , boolean canModifyResources , IProgressMonitor monitor ) throws JavaModelException { setRawClasspath ( newRawClasspath , null , newOutputLocation , canModifyResources , monitor ) ; } public void setRawClasspath ( IClasspathEntry [ ] entries , IPath outputLocation , IProgressMonitor monitor ) throws JavaModelException { setRawClasspath ( entries , outputLocation , true , monitor ) ; } public void setRawClasspath ( IClasspathEntry [ ] entries , IClasspathEntry [ ] referencedEntries , IPath outputLocation , IProgressMonitor monitor ) throws JavaModelException { setRawClasspath ( entries , referencedEntries , outputLocation , true , monitor ) ; } protected void setRawClasspath ( IClasspathEntry [ ] newRawClasspath , IClasspathEntry [ ] referencedEntries , IPath newOutputLocation , boolean canModifyResources , IProgressMonitor monitor ) throws JavaModelException { try { if ( newRawClasspath == null ) newRawClasspath = defaultClasspath ( ) ; SetClasspathOperation op = new SetClasspathOperation ( this , newRawClasspath , referencedEntries , newOutputLocation , canModifyResources ) ; op . runOperation ( monitor ) ; } catch ( JavaModelException e ) { JavaModelManager . getJavaModelManager ( ) . getDeltaProcessor ( ) . flush ( ) ; throw e ; } } public void setRawClasspath ( IClasspathEntry [ ] entries , IProgressMonitor monitor ) throws JavaModelException { setRawClasspath ( entries , getOutputLocation ( ) , true , monitor ) ; } public void setSharedProperty ( String key , String value ) throws CoreException { IFile rscFile = this . project . getFile ( key ) ; byte [ ] bytes = null ; try { bytes = value . getBytes ( org . eclipse . jdt . internal . compiler . util . Util . UTF_8 ) ; } catch ( UnsupportedEncodingException e ) { Util . log ( e , "<STR_LIT>" ) ; bytes = value . getBytes ( ) ; } InputStream inputStream = new ByteArrayInputStream ( bytes ) ; if ( rscFile . exists ( ) ) { if ( rscFile . isReadOnly ( ) ) { ResourcesPlugin . getWorkspace ( ) . validateEdit ( new IFile [ ] { rscFile } , null ) ; } rscFile . setContents ( inputStream , IResource . FORCE , null ) ; } else { rscFile . create ( inputStream , IResource . FORCE , null ) ; } } public void updateCycleParticipants ( ArrayList prereqChain , HashSet cycleParticipants , IWorkspaceRoot workspaceRoot , HashSet traversed , Map preferredClasspaths ) { IPath path = getPath ( ) ; prereqChain . add ( path ) ; traversed . add ( path ) ; try { IClasspathEntry [ ] classpath = null ; if ( preferredClasspaths != null ) classpath = ( IClasspathEntry [ ] ) preferredClasspaths . get ( this ) ; if ( classpath == null ) classpath = getResolvedClasspath ( ) ; for ( int i = <NUM_LIT:0> , length = classpath . length ; i < length ; i ++ ) { IClasspathEntry entry = classpath [ i ] ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_PROJECT ) { IPath prereqProjectPath = entry . getPath ( ) ; int index = cycleParticipants . contains ( prereqProjectPath ) ? <NUM_LIT:0> : prereqChain . indexOf ( prereqProjectPath ) ; if ( index >= <NUM_LIT:0> ) { for ( int size = prereqChain . size ( ) ; index < size ; index ++ ) { cycleParticipants . add ( prereqChain . get ( index ) ) ; } } else { if ( ! traversed . contains ( prereqProjectPath ) ) { IResource member = workspaceRoot . findMember ( prereqProjectPath ) ; if ( member != null && member . getType ( ) == IResource . PROJECT ) { JavaProject javaProject = ( JavaProject ) JavaCore . create ( ( IProject ) member ) ; javaProject . updateCycleParticipants ( prereqChain , cycleParticipants , workspaceRoot , traversed , preferredClasspaths ) ; } } } } } } catch ( JavaModelException e ) { } prereqChain . remove ( path ) ; } private void updatePreferences ( IEclipsePreferences preferences ) { IEclipsePreferences oldPreferences = loadPreferences ( ) ; if ( oldPreferences != null ) { try { String [ ] propertyNames = oldPreferences . childrenNames ( ) ; for ( int i = <NUM_LIT:0> ; i < propertyNames . length ; i ++ ) { String propertyName = propertyNames [ i ] ; String propertyValue = oldPreferences . get ( propertyName , "<STR_LIT>" ) ; if ( ! "<STR_LIT>" . equals ( propertyValue ) ) { preferences . put ( propertyName , propertyValue ) ; } } preferences . flush ( ) ; } catch ( BackingStoreException e ) { } } } protected IStatus validateExistence ( IResource underlyingResource ) { try { if ( ! ( ( IProject ) underlyingResource ) . hasNature ( JavaCore . NATURE_ID ) ) return newDoesNotExistStatus ( ) ; } catch ( CoreException e ) { return newDoesNotExistStatus ( ) ; } return JavaModelStatus . VERIFIED_OK ; } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . IInitializer ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaProject ; import org . eclipse . jdt . core . IPackageFragment ; import org . eclipse . jdt . core . IType ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . codeassist . ISearchRequestor ; import org . eclipse . jdt . internal . compiler . env . AccessRuleSet ; import org . eclipse . jdt . internal . compiler . env . ICompilationUnit ; import org . eclipse . jdt . internal . compiler . env . AccessRestriction ; class SearchableEnvironmentRequestor extends JavaElementRequestor { protected ISearchRequestor requestor ; protected ICompilationUnit unitToSkip ; protected IJavaProject project ; protected NameLookup nameLookup ; protected boolean checkAccessRestrictions ; public SearchableEnvironmentRequestor ( ISearchRequestor requestor ) { this . requestor = requestor ; this . unitToSkip = null ; this . project = null ; this . nameLookup = null ; this . checkAccessRestrictions = false ; } public SearchableEnvironmentRequestor ( ISearchRequestor requestor , ICompilationUnit unitToSkip , IJavaProject project , NameLookup nameLookup ) { this . requestor = requestor ; this . unitToSkip = unitToSkip ; this . project = project ; this . nameLookup = nameLookup ; this . checkAccessRestrictions = ! JavaCore . IGNORE . equals ( project . getOption ( JavaCore . COMPILER_PB_FORBIDDEN_REFERENCE , true ) ) || ! JavaCore . IGNORE . equals ( project . getOption ( JavaCore . COMPILER_PB_DISCOURAGED_REFERENCE , true ) ) ; } public void acceptInitializer ( IInitializer initializer ) { } public void acceptPackageFragment ( IPackageFragment packageFragment ) { this . requestor . acceptPackage ( packageFragment . getElementName ( ) . toCharArray ( ) ) ; } public void acceptType ( IType type ) { try { if ( this . unitToSkip != null && this . unitToSkip . equals ( type . getCompilationUnit ( ) ) ) { return ; } char [ ] packageName = type . getPackageFragment ( ) . getElementName ( ) . toCharArray ( ) ; boolean isBinary = type instanceof BinaryType ; AccessRestriction accessRestriction = null ; if ( this . checkAccessRestrictions && ( isBinary || ! type . getJavaProject ( ) . equals ( this . project ) ) ) { PackageFragmentRoot root = ( PackageFragmentRoot ) type . getAncestor ( IJavaElement . PACKAGE_FRAGMENT_ROOT ) ; ClasspathEntry entry = ( ClasspathEntry ) this . nameLookup . rootToResolvedEntries . get ( root ) ; if ( entry != null ) { AccessRuleSet accessRuleSet = entry . getAccessRuleSet ( ) ; if ( accessRuleSet != null ) { char [ ] [ ] packageChars = CharOperation . splitOn ( '<CHAR_LIT:.>' , packageName ) ; char [ ] fileWithoutExtension = type . getElementName ( ) . toCharArray ( ) ; accessRestriction = accessRuleSet . getViolatedRestriction ( CharOperation . concatWith ( packageChars , fileWithoutExtension , '<CHAR_LIT:/>' ) ) ; } } } this . requestor . acceptType ( packageName , type . getElementName ( ) . toCharArray ( ) , null , type . getFlags ( ) , accessRestriction ) ; } catch ( JavaModelException jme ) { } } } </s>
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . internal . core . util . Messages ; public class MoveElementsOperation extends CopyElementsOperation { public MoveElementsOperation ( IJavaElement [ ] elementsToMove , IJavaElement [ ] destContainers , boolean force ) { super ( elementsToMove , destContainers , force ) ; } protected String getMainTaskName ( ) { return Messages . operation_moveElementProgress ; } protected boolean isMove ( ) { return true ; } } </s>
<s> package org . eclipse . jdt . internal . core ; public class ResolvedBinaryMethod extends BinaryMethod { private String uniqueKey ; public ResolvedBinaryMethod ( JavaElement parent , String name , String [ ] parameterTypes , String uniqueKey ) { super ( parent , name , parameterTypes ) ; this . uniqueKey = uniqueKey ; } public String getKey ( ) { return this . uniqueKey ; } public boolean isResolved ( ) { return true ; } protected void toStringInfo ( int tab , StringBuffer buffer , Object info , boolean showResolvedInfo ) { super . toStringInfo ( tab , buffer , info , showResolvedInfo ) ; if ( showResolvedInfo ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . uniqueKey ) ; buffer . append ( "<STR_LIT:}>" ) ; } } public JavaElement unresolved ( ) { SourceRefElement handle = new BinaryMethod ( this . parent , this . name , this . parameterTypes ) ; handle . occurrenceCount = this . occurrenceCount ; return handle ; } } </s>