text
stringlengths 30
1.67M
|
|---|
<s> package org . eclipse . jdt . internal . core . jdom ; import org . eclipse . jdt . core . Flags ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . jdom . * ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . core . util . CharArrayBuffer ; abstract class DOMMember extends DOMNode implements IDOMMember { protected int fFlags = <NUM_LIT:0> ; protected String fComment = null ; protected int [ ] fCommentRange ; protected char [ ] fModifiers = null ; protected int [ ] fModifierRange ; DOMMember ( ) { } DOMMember ( char [ ] document , int [ ] sourceRange , String name , int [ ] nameRange , int [ ] commentRange , int flags , int [ ] modifierRange ) { super ( document , sourceRange , name , nameRange ) ; this . fFlags = flags ; this . fComment = null ; this . fCommentRange = commentRange ; this . fModifierRange = modifierRange ; setHasComment ( commentRange [ <NUM_LIT:0> ] >= <NUM_LIT:0> ) ; } protected void appendFragmentedContents ( CharArrayBuffer buffer ) { if ( isDetailed ( ) ) { appendMemberHeaderFragment ( buffer ) ; appendMemberDeclarationContents ( buffer ) ; appendMemberBodyContents ( buffer ) ; } else { appendSimpleContents ( buffer ) ; } } protected abstract void appendMemberBodyContents ( CharArrayBuffer buffer ) ; protected abstract void appendMemberDeclarationContents ( CharArrayBuffer buffer ) ; protected void appendMemberHeaderFragment ( CharArrayBuffer buffer ) { int spaceStart , spaceEnd ; if ( hasComment ( ) ) { spaceStart = this . fSourceRange [ <NUM_LIT:0> ] ; spaceEnd = this . fCommentRange [ <NUM_LIT:0> ] ; if ( spaceEnd > <NUM_LIT:0> ) { buffer . append ( this . fDocument , spaceStart , spaceEnd - spaceStart ) ; } } String fragment = getComment ( ) ; if ( fragment != null ) { buffer . append ( fragment ) ; } if ( this . fCommentRange [ <NUM_LIT:1> ] >= <NUM_LIT:0> ) { spaceStart = this . fCommentRange [ <NUM_LIT:1> ] + <NUM_LIT:1> ; } else { spaceStart = this . fSourceRange [ <NUM_LIT:0> ] ; } if ( this . fModifierRange [ <NUM_LIT:0> ] >= <NUM_LIT:0> ) { spaceEnd = this . fModifierRange [ <NUM_LIT:0> ] - <NUM_LIT:1> ; } else { spaceEnd = getMemberDeclarationStartPosition ( ) - <NUM_LIT:1> ; } if ( spaceEnd >= spaceStart ) { buffer . append ( this . fDocument , spaceStart , spaceEnd + <NUM_LIT:1> - spaceStart ) ; } buffer . append ( getModifiersText ( ) ) ; } protected abstract void appendSimpleContents ( CharArrayBuffer buffer ) ; protected String [ ] appendString ( String [ ] list , String element ) { String [ ] copy = new String [ list . length + <NUM_LIT:1> ] ; System . arraycopy ( list , <NUM_LIT:0> , copy , <NUM_LIT:0> , list . length ) ; copy [ list . length ] = element ; return copy ; } protected char [ ] generateFlags ( ) { char [ ] flags = Flags . toString ( getFlags ( ) ) . toCharArray ( ) ; if ( flags . length == <NUM_LIT:0> ) { return flags ; } else { return CharOperation . concat ( flags , new char [ ] { '<CHAR_LIT:U+0020>' } ) ; } } public String getComment ( ) { becomeDetailed ( ) ; if ( hasComment ( ) ) { if ( this . fComment != null ) { return this . fComment ; } else { return new String ( this . fDocument , this . fCommentRange [ <NUM_LIT:0> ] , this . fCommentRange [ <NUM_LIT:1> ] + <NUM_LIT:1> - this . fCommentRange [ <NUM_LIT:0> ] ) ; } } else { return null ; } } public int getFlags ( ) { return this . fFlags ; } protected abstract int getMemberDeclarationStartPosition ( ) ; protected char [ ] getModifiersText ( ) { if ( this . fModifiers == null ) { if ( this . fModifierRange [ <NUM_LIT:0> ] < <NUM_LIT:0> ) { return null ; } else { return CharOperation . subarray ( this . fDocument , this . fModifierRange [ <NUM_LIT:0> ] , this . fModifierRange [ <NUM_LIT:1> ] + <NUM_LIT:1> ) ; } } else { return this . fModifiers ; } } protected boolean hasBody ( ) { return getMask ( MASK_HAS_BODY ) ; } protected boolean hasComment ( ) { return getMask ( MASK_HAS_COMMENT ) ; } protected void offset ( int offset ) { super . offset ( offset ) ; offsetRange ( this . fCommentRange , offset ) ; offsetRange ( this . fModifierRange , offset ) ; } public void setComment ( String comment ) { becomeDetailed ( ) ; this . fComment = comment ; fragment ( ) ; setHasComment ( comment != null ) ; if ( comment != null && comment . indexOf ( "<STR_LIT>" ) >= <NUM_LIT:0> ) { this . fFlags = this . fFlags | ClassFileConstants . AccDeprecated ; return ; } this . fFlags = this . fFlags & ( ~ ClassFileConstants . AccDeprecated ) ; } public void setFlags ( int flags ) { becomeDetailed ( ) ; if ( Flags . isDeprecated ( this . fFlags ) ) { this . fFlags = flags | ClassFileConstants . AccDeprecated ; } else { this . fFlags = flags & ( ~ ClassFileConstants . AccDeprecated ) ; } fragment ( ) ; this . fModifiers = generateFlags ( ) ; } protected void setHasBody ( boolean hasBody ) { setMask ( MASK_HAS_BODY , hasBody ) ; } protected void setHasComment ( boolean hasComment ) { setMask ( MASK_HAS_COMMENT , hasComment ) ; } protected void setStartPosition ( int start ) { if ( this . fCommentRange [ <NUM_LIT:0> ] >= <NUM_LIT:0> ) { this . fCommentRange [ <NUM_LIT:0> ] = start ; } super . setStartPosition ( start ) ; } protected void shareContents ( DOMNode node ) { super . shareContents ( node ) ; DOMMember member = ( DOMMember ) node ; this . fComment = member . fComment ; this . fCommentRange = rangeCopy ( member . fCommentRange ) ; this . fFlags = member . fFlags ; this . fModifiers = member . fModifiers ; this . fModifierRange = rangeCopy ( member . fModifierRange ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . core . jdom ; import org . eclipse . jdt . core . Flags ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IPackageFragment ; import org . eclipse . jdt . core . jdom . * ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . core . util . CharArrayBuffer ; import org . eclipse . jdt . internal . core . util . Messages ; import org . eclipse . jdt . internal . core . util . Util ; class DOMCompilationUnit extends DOMNode implements IDOMCompilationUnit , SuffixConstants { protected String fHeader ; DOMCompilationUnit ( ) { this . fHeader = "<STR_LIT>" ; } DOMCompilationUnit ( char [ ] document , int [ ] sourceRange ) { super ( document , sourceRange , null , new int [ ] { - <NUM_LIT:1> , - <NUM_LIT:1> } ) ; this . fHeader = "<STR_LIT>" ; } protected void appendFragmentedContents ( CharArrayBuffer buffer ) { buffer . append ( getHeader ( ) ) ; appendContentsOfChildren ( buffer ) ; } public boolean canHaveChildren ( ) { return true ; } public String getHeader ( ) { return this . fHeader ; } public IJavaElement getJavaElement ( IJavaElement parent ) throws IllegalArgumentException { if ( parent . getElementType ( ) == IJavaElement . PACKAGE_FRAGMENT ) { return ( ( IPackageFragment ) parent ) . getCompilationUnit ( getName ( ) ) ; } else { throw new IllegalArgumentException ( Messages . element_illegalParent ) ; } } public String getName ( ) { IDOMType topLevelType = null ; IDOMType firstType = null ; IDOMNode child = this . fFirstChild ; while ( child != null ) { if ( child . getNodeType ( ) == IDOMNode . TYPE ) { IDOMType type = ( IDOMType ) child ; if ( firstType == null ) { firstType = type ; } if ( Flags . isPublic ( type . getFlags ( ) ) ) { topLevelType = type ; break ; } } child = child . getNextNode ( ) ; } if ( topLevelType == null ) { topLevelType = firstType ; } if ( topLevelType != null ) { return topLevelType . getName ( ) + Util . defaultJavaExtension ( ) ; } else { return null ; } } public int getNodeType ( ) { return IDOMNode . COMPILATION_UNIT ; } protected void initalizeHeader ( ) { DOMNode child = ( DOMNode ) getFirstChild ( ) ; if ( child != null ) { int childStart = child . getStartPosition ( ) ; if ( childStart > <NUM_LIT:1> ) { setHeader ( new String ( this . fDocument , <NUM_LIT:0> , childStart ) ) ; } } } public boolean isAllowableChild ( IDOMNode node ) { if ( node != null ) { int type = node . getNodeType ( ) ; return type == IDOMNode . PACKAGE || type == IDOMNode . IMPORT || type == IDOMNode . TYPE ; } else { return false ; } } protected DOMNode newDOMNode ( ) { return new DOMCompilationUnit ( ) ; } void normalize ( ILineStartFinder finder ) { super . normalize ( finder ) ; initalizeHeader ( ) ; } public void setHeader ( String comment ) { this . fHeader = comment ; fragment ( ) ; } public void setName ( String name ) { } protected void shareContents ( DOMNode node ) { super . shareContents ( node ) ; this . fHeader = ( ( DOMCompilationUnit ) node ) . fHeader ; } public String toString ( ) { return "<STR_LIT>" + getName ( ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . core . jdom ; import org . eclipse . jdt . internal . compiler . env . ICompilationUnit ; public class CompilationUnit implements ICompilationUnit { protected char [ ] fContents ; protected char [ ] fFileName ; protected char [ ] fMainTypeName ; public CompilationUnit ( char [ ] contents , char [ ] filename ) { this . fContents = contents ; this . fFileName = filename ; String file = new String ( filename ) ; int start = file . lastIndexOf ( "<STR_LIT:/>" ) + <NUM_LIT:1> ; if ( start == <NUM_LIT:0> || start < file . lastIndexOf ( "<STR_LIT:\\>" ) ) start = file . lastIndexOf ( "<STR_LIT:\\>" ) + <NUM_LIT:1> ; int end = file . lastIndexOf ( "<STR_LIT:.>" ) ; if ( end == - <NUM_LIT:1> ) end = file . length ( ) ; this . fMainTypeName = file . substring ( start , end ) . toCharArray ( ) ; } public char [ ] getContents ( ) { return this . fContents ; } public char [ ] getFileName ( ) { return this . fFileName ; } public char [ ] getMainTypeName ( ) { return this . fMainTypeName ; } public char [ ] [ ] getPackageName ( ) { return null ; } public boolean ignoreOptionalProblems ( ) { return false ; } public String toString ( ) { return "<STR_LIT>" + new String ( this . fFileName ) + "<STR_LIT:]>" ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . IBuffer ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . WorkingCopyOwner ; public class DefaultWorkingCopyOwner extends WorkingCopyOwner { public WorkingCopyOwner primaryBufferProvider ; public static final DefaultWorkingCopyOwner PRIMARY = new DefaultWorkingCopyOwner ( ) ; private DefaultWorkingCopyOwner ( ) { } public IBuffer createBuffer ( ICompilationUnit workingCopy ) { if ( this . primaryBufferProvider != null ) return this . primaryBufferProvider . createBuffer ( workingCopy ) ; return super . createBuffer ( workingCopy ) ; } public String toString ( ) { return "<STR_LIT>" ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . compiler . CharOperation ; public class TypeParameter extends SourceRefElement implements ITypeParameter { static final ITypeParameter [ ] NO_TYPE_PARAMETERS = new ITypeParameter [ <NUM_LIT:0> ] ; protected String name ; public TypeParameter ( JavaElement parent , String name ) { super ( parent ) ; this . name = name ; } public boolean equals ( Object o ) { if ( ! ( o instanceof TypeParameter ) ) return false ; return super . equals ( o ) ; } public String [ ] getBounds ( ) throws JavaModelException { TypeParameterElementInfo info = ( TypeParameterElementInfo ) getElementInfo ( ) ; return CharOperation . toStrings ( info . bounds ) ; } public String [ ] getBoundsSignatures ( ) throws JavaModelException { String [ ] boundSignatures = null ; TypeParameterElementInfo info = ( TypeParameterElementInfo ) this . getElementInfo ( ) ; if ( this . parent instanceof BinaryMember ) { char [ ] [ ] boundsSignatures = info . boundsSignatures ; if ( boundsSignatures == null || boundsSignatures . length == <NUM_LIT:0> ) { return CharOperation . NO_STRINGS ; } return CharOperation . toStrings ( info . boundsSignatures ) ; } char [ ] [ ] bounds = info . bounds ; if ( bounds == null || bounds . length == <NUM_LIT:0> ) { return CharOperation . NO_STRINGS ; } int boundsLength = bounds . length ; boundSignatures = new String [ boundsLength ] ; for ( int i = <NUM_LIT:0> ; i < boundsLength ; i ++ ) { boundSignatures [ i ] = new String ( Signature . createCharArrayTypeSignature ( bounds [ i ] , false ) ) ; } return boundSignatures ; } public IMember getDeclaringMember ( ) { return ( IMember ) getParent ( ) ; } public String getElementName ( ) { return this . name ; } public int getElementType ( ) { return TYPE_PARAMETER ; } protected char getHandleMementoDelimiter ( ) { return JavaElement . JEM_TYPE_PARAMETER ; } public ISourceRange getNameRange ( ) throws JavaModelException { SourceMapper mapper = getSourceMapper ( ) ; if ( mapper != null ) { ClassFile classFile = ( ClassFile ) getClassFile ( ) ; if ( classFile != null ) { classFile . getBuffer ( ) ; return mapper . getNameRange ( this ) ; } } TypeParameterElementInfo info = ( TypeParameterElementInfo ) getElementInfo ( ) ; return new SourceRange ( info . nameStart , info . nameEnd - info . nameStart + <NUM_LIT:1> ) ; } public ISourceRange getSourceRange ( ) throws JavaModelException { SourceMapper mapper = getSourceMapper ( ) ; if ( mapper != null ) { ClassFile classFile = ( ClassFile ) getClassFile ( ) ; if ( classFile != null ) { classFile . getBuffer ( ) ; return mapper . getSourceRange ( this ) ; } } return super . getSourceRange ( ) ; } public IClassFile getClassFile ( ) { return ( ( JavaElement ) getParent ( ) ) . getClassFile ( ) ; } public ITypeRoot getTypeRoot ( ) { return this . getDeclaringMember ( ) . getTypeRoot ( ) ; } protected void toStringName ( StringBuffer buffer ) { buffer . append ( '<CHAR_LIT>' ) ; buffer . append ( getElementName ( ) ) ; buffer . append ( '<CHAR_LIT:>>' ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . IField ; import org . eclipse . jdt . core . IInitializer ; import org . eclipse . jdt . core . IMethod ; import org . eclipse . jdt . core . IPackageFragment ; import org . eclipse . jdt . core . IType ; public interface IJavaElementRequestor { public void acceptField ( IField field ) ; public void acceptInitializer ( IInitializer initializer ) ; public void acceptMemberType ( IType type ) ; public void acceptMethod ( IMethod method ) ; public void acceptPackageFragment ( IPackageFragment packageFragment ) ; public void acceptType ( IType type ) ; boolean isCanceled ( ) ; } </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 . compiler . CategorizedProblem ; import org . eclipse . jdt . internal . compiler . problem . AbortCompilation ; import org . eclipse . jdt . internal . compiler . problem . DefaultProblemFactory ; public class CancelableProblemFactory extends DefaultProblemFactory { public IProgressMonitor monitor ; public CancelableProblemFactory ( IProgressMonitor monitor ) { super ( ) ; this . monitor = monitor ; } public CategorizedProblem createProblem ( char [ ] originatingFileName , int problemId , String [ ] problemArguments , String [ ] messageArguments , int severity , int startPosition , int endPosition , int lineNumber , int columnNumber ) { if ( this . monitor != null && this . monitor . isCanceled ( ) ) throw new AbortCompilation ( true , new OperationCanceledException ( ) ) ; return super . createProblem ( originatingFileName , problemId , problemArguments , messageArguments , severity , startPosition , endPosition , lineNumber , columnNumber ) ; } public CategorizedProblem createProblem ( char [ ] originatingFileName , int problemId , String [ ] problemArguments , int elaborationId , String [ ] messageArguments , int severity , int startPosition , int endPosition , int lineNumber , int columnNumber ) { if ( this . monitor != null && this . monitor . isCanceled ( ) ) throw new AbortCompilation ( true , new OperationCanceledException ( ) ) ; return super . createProblem ( originatingFileName , problemId , problemArguments , elaborationId , messageArguments , severity , startPosition , endPosition , lineNumber , columnNumber ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; abstract class MemberElementInfo extends SourceRefElementInfo { protected int flags ; public int getNameSourceEnd ( ) { return - <NUM_LIT:1> ; } public int getNameSourceStart ( ) { return - <NUM_LIT:1> ; } public int getModifiers ( ) { return this . flags ; } protected void setFlags ( int flags ) { this . flags = flags ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import java . net . URL ; import java . util . * ; import java . util . zip . ZipEntry ; import java . util . zip . ZipException ; import java . util . zip . ZipFile ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . core . util . HashtableOfArrayToObject ; import org . eclipse . jdt . internal . core . util . Util ; public class JarPackageFragmentRoot extends PackageFragmentRoot { private final static ArrayList EMPTY_LIST = new ArrayList ( ) ; protected final IPath jarPath ; protected JarPackageFragmentRoot ( IPath externalJarPath , JavaProject project ) { super ( null , project ) ; this . jarPath = externalJarPath ; } protected JarPackageFragmentRoot ( IResource resource , JavaProject project ) { super ( resource , project ) ; this . jarPath = resource . getFullPath ( ) ; } protected boolean computeChildren ( OpenableElementInfo info , IResource underlyingResource ) throws JavaModelException { HashtableOfArrayToObject rawPackageInfo = new HashtableOfArrayToObject ( ) ; IJavaElement [ ] children ; ZipFile jar = null ; try { IJavaProject project = getJavaProject ( ) ; String sourceLevel = project . getOption ( JavaCore . COMPILER_SOURCE , true ) ; String compliance = project . getOption ( JavaCore . COMPILER_COMPLIANCE , true ) ; jar = getJar ( ) ; rawPackageInfo . put ( CharOperation . NO_STRINGS , new ArrayList [ ] { EMPTY_LIST , EMPTY_LIST } ) ; for ( Enumeration e = jar . entries ( ) ; e . hasMoreElements ( ) ; ) { ZipEntry member = ( ZipEntry ) e . nextElement ( ) ; initRawPackageInfo ( rawPackageInfo , member . getName ( ) , member . isDirectory ( ) , sourceLevel , compliance ) ; } children = new IJavaElement [ rawPackageInfo . size ( ) ] ; int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , length = rawPackageInfo . keyTable . length ; i < length ; i ++ ) { String [ ] pkgName = ( String [ ] ) rawPackageInfo . keyTable [ i ] ; if ( pkgName == null ) continue ; children [ index ++ ] = getPackageFragment ( pkgName ) ; } } catch ( CoreException e ) { if ( e . getCause ( ) instanceof ZipException ) { Util . log ( IStatus . ERROR , "<STR_LIT>" + toStringWithAncestors ( ) ) ; children = NO_ELEMENTS ; } else if ( e instanceof JavaModelException ) { throw ( JavaModelException ) e ; } else { throw new JavaModelException ( e ) ; } } finally { JavaModelManager . getJavaModelManager ( ) . closeZipFile ( jar ) ; } info . setChildren ( children ) ; ( ( JarPackageFragmentRootInfo ) info ) . rawPackageInfo = rawPackageInfo ; return true ; } protected Object createElementInfo ( ) { return new JarPackageFragmentRootInfo ( ) ; } protected int determineKind ( IResource underlyingResource ) { return IPackageFragmentRoot . K_BINARY ; } public boolean equals ( Object o ) { if ( this == o ) return true ; if ( o instanceof JarPackageFragmentRoot ) { JarPackageFragmentRoot other = ( JarPackageFragmentRoot ) o ; return this . jarPath . equals ( other . jarPath ) ; } return false ; } public String getElementName ( ) { return this . jarPath . lastSegment ( ) ; } public ZipFile getJar ( ) throws CoreException { return JavaModelManager . getJavaModelManager ( ) . getZipFile ( getPath ( ) ) ; } public int getKind ( ) { return IPackageFragmentRoot . K_BINARY ; } int internalKind ( ) throws JavaModelException { return IPackageFragmentRoot . K_BINARY ; } public Object [ ] getNonJavaResources ( ) throws JavaModelException { Object [ ] defaultPkgResources = ( ( JarPackageFragment ) getPackageFragment ( CharOperation . NO_STRINGS ) ) . storedNonJavaResources ( ) ; int length = defaultPkgResources . length ; if ( length == <NUM_LIT:0> ) return defaultPkgResources ; Object [ ] nonJavaResources = new Object [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { JarEntryResource nonJavaResource = ( JarEntryResource ) defaultPkgResources [ i ] ; nonJavaResources [ i ] = nonJavaResource . clone ( this ) ; } return nonJavaResources ; } public PackageFragment getPackageFragment ( String [ ] pkgName ) { return new JarPackageFragment ( this , pkgName ) ; } public IPath internalPath ( ) { if ( isExternal ( ) ) { return this . jarPath ; } else { return super . internalPath ( ) ; } } public IResource resource ( PackageFragmentRoot root ) { if ( this . resource == null ) { return null ; } return super . resource ( root ) ; } public IResource getUnderlyingResource ( ) throws JavaModelException { if ( isExternal ( ) ) { if ( ! exists ( ) ) throw newNotPresentException ( ) ; return null ; } else { return super . getUnderlyingResource ( ) ; } } public int hashCode ( ) { return this . jarPath . hashCode ( ) ; } private void initRawPackageInfo ( HashtableOfArrayToObject rawPackageInfo , String entryName , boolean isDirectory , String sourceLevel , String compliance ) { int lastSeparator = isDirectory ? entryName . length ( ) - <NUM_LIT:1> : entryName . lastIndexOf ( '<CHAR_LIT:/>' ) ; String [ ] pkgName = Util . splitOn ( '<CHAR_LIT:/>' , entryName , <NUM_LIT:0> , lastSeparator ) ; String [ ] existing = null ; int length = pkgName . length ; int existingLength = length ; while ( existingLength >= <NUM_LIT:0> ) { existing = ( String [ ] ) rawPackageInfo . getKey ( pkgName , existingLength ) ; if ( existing != null ) break ; existingLength -- ; } JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; for ( int i = existingLength ; i < length ; i ++ ) { if ( Util . isValidFolderNameForPackage ( pkgName [ i ] , sourceLevel , compliance ) ) { System . arraycopy ( existing , <NUM_LIT:0> , existing = new String [ i + <NUM_LIT:1> ] , <NUM_LIT:0> , i ) ; existing [ i ] = manager . intern ( pkgName [ i ] ) ; rawPackageInfo . put ( existing , new ArrayList [ ] { EMPTY_LIST , EMPTY_LIST } ) ; } else { if ( ! isDirectory ) { ArrayList [ ] children = ( ArrayList [ ] ) rawPackageInfo . get ( existing ) ; if ( children [ <NUM_LIT:1> ] == EMPTY_LIST ) children [ <NUM_LIT:1> ] = new ArrayList ( ) ; children [ <NUM_LIT:1> ] . add ( entryName ) ; } return ; } } if ( isDirectory ) return ; ArrayList [ ] children = ( ArrayList [ ] ) rawPackageInfo . get ( pkgName ) ; if ( org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( entryName ) ) { if ( children [ <NUM_LIT:0> ] == EMPTY_LIST ) children [ <NUM_LIT:0> ] = new ArrayList ( ) ; String nameWithoutExtension = entryName . substring ( lastSeparator + <NUM_LIT:1> , entryName . length ( ) - <NUM_LIT:6> ) ; children [ <NUM_LIT:0> ] . add ( nameWithoutExtension ) ; } else { if ( children [ <NUM_LIT:1> ] == EMPTY_LIST ) children [ <NUM_LIT:1> ] = new ArrayList ( ) ; children [ <NUM_LIT:1> ] . add ( entryName ) ; } } public boolean isArchive ( ) { return true ; } public boolean isExternal ( ) { return resource ( ) == null ; } public boolean isReadOnly ( ) { return true ; } protected boolean resourceExists ( IResource underlyingResource ) { if ( underlyingResource == null ) { return JavaModel . getExternalTarget ( getPath ( ) , true ) != null ; } else { return super . resourceExists ( underlyingResource ) ; } } protected void toStringAncestors ( StringBuffer buffer ) { if ( isExternal ( ) ) return ; super . toStringAncestors ( buffer ) ; } public URL getIndexPath ( ) { try { IClasspathEntry entry = ( ( JavaProject ) getParent ( ) ) . getClasspathEntryFor ( getPath ( ) ) ; if ( entry != null ) return ( ( ClasspathEntry ) entry ) . getLibraryIndexLocation ( ) ; } catch ( JavaModelException e ) { } return null ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; public interface IPathRequestor { void acceptPath ( String path , boolean containsLocalTypes ) ; } </s>
|
<s> package org . eclipse . jdt . internal . core ; import java . util . ArrayList ; import org . eclipse . jdt . core . IField ; import org . eclipse . jdt . core . IInitializer ; import org . eclipse . jdt . core . IMethod ; import org . eclipse . jdt . core . IPackageFragment ; import org . eclipse . jdt . core . IType ; public class JavaElementRequestor implements IJavaElementRequestor { protected boolean canceled = false ; protected ArrayList fields = null ; protected ArrayList initializers = null ; protected ArrayList memberTypes = null ; protected ArrayList methods = null ; protected ArrayList packageFragments = null ; protected ArrayList types = null ; protected static final IField [ ] EMPTY_FIELD_ARRAY = new IField [ <NUM_LIT:0> ] ; protected static final IInitializer [ ] EMPTY_INITIALIZER_ARRAY = new IInitializer [ <NUM_LIT:0> ] ; protected static final IType [ ] EMPTY_TYPE_ARRAY = new IType [ <NUM_LIT:0> ] ; protected static final IPackageFragment [ ] EMPTY_PACKAGE_FRAGMENT_ARRAY = new IPackageFragment [ <NUM_LIT:0> ] ; protected static final IMethod [ ] EMPTY_METHOD_ARRAY = new IMethod [ <NUM_LIT:0> ] ; public void acceptField ( IField field ) { if ( this . fields == null ) { this . fields = new ArrayList ( ) ; } this . fields . add ( field ) ; } public void acceptInitializer ( IInitializer initializer ) { if ( this . initializers == null ) { this . initializers = new ArrayList ( ) ; } this . initializers . add ( initializer ) ; } public void acceptMemberType ( IType type ) { if ( this . memberTypes == null ) { this . memberTypes = new ArrayList ( ) ; } this . memberTypes . add ( type ) ; } public void acceptMethod ( IMethod method ) { if ( this . methods == null ) { this . methods = new ArrayList ( ) ; } this . methods . add ( method ) ; } public void acceptPackageFragment ( IPackageFragment packageFragment ) { if ( this . packageFragments == null ) { this . packageFragments = new ArrayList ( ) ; } this . packageFragments . add ( packageFragment ) ; } public void acceptType ( IType type ) { if ( this . types == null ) { this . types = new ArrayList ( ) ; } this . types . add ( type ) ; } public IField [ ] getFields ( ) { if ( this . fields == null ) { return EMPTY_FIELD_ARRAY ; } int size = this . fields . size ( ) ; IField [ ] results = new IField [ size ] ; this . fields . toArray ( results ) ; return results ; } public IInitializer [ ] getInitializers ( ) { if ( this . initializers == null ) { return EMPTY_INITIALIZER_ARRAY ; } int size = this . initializers . size ( ) ; IInitializer [ ] results = new IInitializer [ size ] ; this . initializers . toArray ( results ) ; return results ; } public IType [ ] getMemberTypes ( ) { if ( this . memberTypes == null ) { return EMPTY_TYPE_ARRAY ; } int size = this . memberTypes . size ( ) ; IType [ ] results = new IType [ size ] ; this . memberTypes . toArray ( results ) ; return results ; } public IMethod [ ] getMethods ( ) { if ( this . methods == null ) { return EMPTY_METHOD_ARRAY ; } int size = this . methods . size ( ) ; IMethod [ ] results = new IMethod [ size ] ; this . methods . toArray ( results ) ; return results ; } public IPackageFragment [ ] getPackageFragments ( ) { if ( this . packageFragments == null ) { return EMPTY_PACKAGE_FRAGMENT_ARRAY ; } int size = this . packageFragments . size ( ) ; IPackageFragment [ ] results = new IPackageFragment [ size ] ; this . packageFragments . toArray ( results ) ; return results ; } public IType [ ] getTypes ( ) { if ( this . types == null ) { return EMPTY_TYPE_ARRAY ; } int size = this . types . size ( ) ; IType [ ] results = new IType [ size ] ; this . types . toArray ( results ) ; return results ; } public boolean isCanceled ( ) { return this . canceled ; } public void reset ( ) { this . canceled = false ; this . fields = null ; this . initializers = null ; this . memberTypes = null ; this . methods = null ; this . packageFragments = null ; this . types = null ; } public void setCanceled ( boolean b ) { this . canceled = b ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; public interface JavadocConstants { String ANCHOR_PREFIX_END = "<STR_LIT:\">" ; char [ ] ANCHOR_PREFIX_START = "<STR_LIT>" . toCharArray ( ) ; int ANCHOR_PREFIX_START_LENGHT = ANCHOR_PREFIX_START . length ; char [ ] ANCHOR_SUFFIX = "<STR_LIT>" . toCharArray ( ) ; int ANCHOR_SUFFIX_LENGTH = JavadocConstants . ANCHOR_SUFFIX . length ; char [ ] CONSTRUCTOR_DETAIL = "<STR_LIT>" . toCharArray ( ) ; char [ ] CONSTRUCTOR_SUMMARY = "<STR_LIT>" . toCharArray ( ) ; char [ ] FIELD_DETAIL = "<STR_LIT>" . toCharArray ( ) ; char [ ] FIELD_SUMMARY = "<STR_LIT>" . toCharArray ( ) ; char [ ] ENUM_CONSTANT_SUMMARY = "<STR_LIT>" . toCharArray ( ) ; char [ ] ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY = "<STR_LIT>" . toCharArray ( ) ; char [ ] ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY = "<STR_LIT>" . toCharArray ( ) ; char [ ] END_OF_CLASS_DATA = "<STR_LIT>" . toCharArray ( ) ; String HTML_EXTENSION = "<STR_LIT>" ; String INDEX_FILE_NAME = "<STR_LIT>" ; char [ ] METHOD_DETAIL = "<STR_LIT>" . toCharArray ( ) ; char [ ] METHOD_SUMMARY = "<STR_LIT>" . toCharArray ( ) ; char [ ] NESTED_CLASS_SUMMARY = "<STR_LIT>" . toCharArray ( ) ; String PACKAGE_FILE_NAME = "<STR_LIT>" ; char [ ] SEPARATOR_START = "<STR_LIT>" . toCharArray ( ) ; char [ ] START_OF_CLASS_DATA = "<STR_LIT>" . toCharArray ( ) ; int START_OF_CLASS_DATA_LENGTH = JavadocConstants . START_OF_CLASS_DATA . length ; } </s>
|
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . IClasspathAttribute ; import org . eclipse . jdt . internal . core . util . Util ; public class ClasspathAttribute implements IClasspathAttribute { private String name ; private String value ; public ClasspathAttribute ( String name , String value ) { this . name = name ; this . value = value ; } public boolean equals ( Object obj ) { if ( ! ( obj instanceof ClasspathAttribute ) ) return false ; ClasspathAttribute other = ( ClasspathAttribute ) obj ; return this . name . equals ( other . name ) && this . value . equals ( other . value ) ; } public String getName ( ) { return this . name ; } public String getValue ( ) { return this . value ; } public int hashCode ( ) { return Util . combineHashCodes ( this . name . hashCode ( ) , this . value . hashCode ( ) ) ; } public String toString ( ) { return this . name + "<STR_LIT:=>" + this . value ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import java . io . * ; import java . net . URI ; import java . text . MessageFormat ; import java . util . * ; import java . util . Map . Entry ; import java . util . zip . ZipException ; import java . util . zip . ZipFile ; 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 . * ; import org . eclipse . core . runtime . * ; import org . eclipse . core . runtime . content . IContentTypeManager . ContentTypeChangeEvent ; import org . eclipse . core . runtime . content . IContentTypeManager . IContentTypeChangeListener ; import org . eclipse . core . runtime . jobs . Job ; import org . eclipse . core . runtime . preferences . DefaultScope ; import org . eclipse . core . runtime . preferences . IEclipsePreferences ; import org . eclipse . core . runtime . preferences . IPreferencesService ; import org . eclipse . core . runtime . preferences . InstanceScope ; import org . eclipse . core . runtime . preferences . IEclipsePreferences . PreferenceChangeEvent ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . core . compiler . CompilationParticipant ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . core . formatter . DefaultCodeFormatterConstants ; import org . eclipse . jdt . internal . codeassist . CompletionEngine ; import org . eclipse . jdt . internal . codeassist . SelectionEngine ; import org . eclipse . jdt . internal . compiler . AbstractAnnotationProcessorManager ; import org . eclipse . jdt . internal . compiler . Compiler ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . env . AccessRestriction ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . util . HashtableOfObjectToInt ; import org . eclipse . jdt . internal . core . JavaProjectElementInfo . ProjectCache ; import org . eclipse . jdt . internal . core . builder . JavaBuilder ; import org . eclipse . jdt . internal . core . hierarchy . TypeHierarchy ; import org . eclipse . jdt . internal . core . search . AbstractSearchScope ; import org . eclipse . jdt . internal . core . search . BasicSearchEngine ; import org . eclipse . jdt . internal . core . search . IRestrictedAccessTypeRequestor ; import org . eclipse . jdt . internal . core . search . JavaWorkspaceScope ; import org . eclipse . jdt . internal . core . search . indexing . IndexManager ; import org . eclipse . jdt . internal . core . search . processing . JobManager ; import org . eclipse . jdt . internal . core . util . HashtableOfArrayToObject ; import org . eclipse . jdt . internal . core . util . LRUCache ; import org . eclipse . jdt . internal . core . util . Messages ; import org . eclipse . jdt . internal . core . util . Util ; import org . eclipse . jdt . internal . core . util . WeakHashSet ; import org . eclipse . jdt . internal . core . util . WeakHashSetOfCharArray ; import org . eclipse . jdt . internal . core . util . LRUCache . Stats ; import org . eclipse . jdt . internal . formatter . DefaultCodeFormatter ; 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 JavaModelManager implements ISaveParticipant , IContentTypeChangeListener { private static final String NON_CHAINING_JARS_CACHE = "<STR_LIT>" ; private static final String INVALID_ARCHIVES_CACHE = "<STR_LIT>" ; static class ZipCache { private Map map ; Object owner ; ZipCache ( Object owner ) { this . map = new HashMap ( ) ; this . owner = owner ; } public void flush ( ) { Thread currentThread = Thread . currentThread ( ) ; Iterator iterator = this . map . values ( ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { try { ZipFile zipFile = ( ZipFile ) iterator . next ( ) ; if ( JavaModelManager . ZIP_ACCESS_VERBOSE ) { System . out . println ( "<STR_LIT:(>" + currentThread + "<STR_LIT>" + zipFile . getName ( ) ) ; } zipFile . close ( ) ; } catch ( IOException e ) { } } } public ZipFile getCache ( IPath path ) { return ( ZipFile ) this . map . get ( path ) ; } public void setCache ( IPath path , ZipFile zipFile ) { this . map . put ( path , zipFile ) ; } } final JavaModel javaModel = new JavaModel ( ) ; public HashMap variables = new HashMap ( <NUM_LIT:5> ) ; public HashSet variablesWithInitializer = new HashSet ( <NUM_LIT:5> ) ; public HashMap deprecatedVariables = new HashMap ( <NUM_LIT:5> ) ; public HashSet readOnlyVariables = new HashSet ( <NUM_LIT:5> ) ; public HashMap previousSessionVariables = new HashMap ( <NUM_LIT:5> ) ; private ThreadLocal variableInitializationInProgress = new ThreadLocal ( ) ; public HashMap containers = new HashMap ( <NUM_LIT:5> ) ; public HashMap previousSessionContainers = new HashMap ( <NUM_LIT:5> ) ; private ThreadLocal containerInitializationInProgress = new ThreadLocal ( ) ; ThreadLocal containersBeingInitialized = new ThreadLocal ( ) ; public static final int NO_BATCH_INITIALIZATION = <NUM_LIT:0> ; public static final int NEED_BATCH_INITIALIZATION = <NUM_LIT:1> ; public static final int BATCH_INITIALIZATION_IN_PROGRESS = <NUM_LIT:2> ; public static final int BATCH_INITIALIZATION_FINISHED = <NUM_LIT:3> ; public int batchContainerInitializations = NO_BATCH_INITIALIZATION ; public BatchInitializationMonitor batchContainerInitializationsProgress = new BatchInitializationMonitor ( ) ; public Hashtable containerInitializersCache = new Hashtable ( <NUM_LIT:5> ) ; private ThreadLocal classpathsBeingResolved = new ThreadLocal ( ) ; public JavaWorkspaceScope workspaceScope ; private WeakHashSet stringSymbols = new WeakHashSet ( <NUM_LIT:5> ) ; private WeakHashSetOfCharArray charArraySymbols = new WeakHashSetOfCharArray ( <NUM_LIT:5> ) ; private IConfigurationElement annotationProcessorManagerFactory = null ; public Map rootPathToAttachments = new Hashtable ( ) ; public final static String CP_VARIABLE_PREFERENCES_PREFIX = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public final static String CP_CONTAINER_PREFERENCES_PREFIX = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public final static String CP_USERLIBRARY_PREFERENCES_PREFIX = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public final static String CP_ENTRY_IGNORE = "<STR_LIT>" ; public final static IPath CP_ENTRY_IGNORE_PATH = new Path ( CP_ENTRY_IGNORE ) ; public final static String TRUE = "<STR_LIT:true>" ; private final static int VARIABLES_AND_CONTAINERS_FILE_VERSION = <NUM_LIT:2> ; public static final String CPVARIABLE_INITIALIZER_EXTPOINT_ID = "<STR_LIT>" ; public static final String CPCONTAINER_INITIALIZER_EXTPOINT_ID = "<STR_LIT>" ; public static final String FORMATTER_EXTPOINT_ID = "<STR_LIT>" ; public static final String COMPILATION_PARTICIPANT_EXTPOINT_ID = "<STR_LIT>" ; public static final String ANNOTATION_PROCESSOR_MANAGER_EXTPOINT_ID = "<STR_LIT>" ; private static final String RESOLVE_REFERENCED_LIBRARIES_FOR_CONTAINERS = "<STR_LIT>" ; public final static IPath VARIABLE_INITIALIZATION_IN_PROGRESS = new Path ( "<STR_LIT>" ) ; public final static IClasspathContainer CONTAINER_INITIALIZATION_IN_PROGRESS = new IClasspathContainer ( ) { public IClasspathEntry [ ] getClasspathEntries ( ) { return null ; } public String getDescription ( ) { return "<STR_LIT>" ; } public int getKind ( ) { return <NUM_LIT:0> ; } public IPath getPath ( ) { return null ; } public String toString ( ) { return getDescription ( ) ; } } ; private static final String BUFFER_MANAGER_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String INDEX_MANAGER_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String INDEX_MANAGER_ADVANCED_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String COMPILER_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String JAVAMODEL_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String JAVAMODELCACHE_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String CP_RESOLVE_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String CP_RESOLVE_ADVANCED_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String CP_RESOLVE_FAILURE_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String ZIP_ACCESS_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String DELTA_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String DELTA_DEBUG_VERBOSE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String HIERARCHY_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String POST_ACTION_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String BUILDER_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String BUILDER_STATS_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String COMPLETION_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String RESOLUTION_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String SELECTION_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String SEARCH_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String SOURCE_MAPPER_DEBUG_VERBOSE = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private static final String FORMATTER_DEBUG = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String COMPLETION_PERF = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String SELECTION_PERF = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String DELTA_LISTENER_PERF = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String VARIABLE_INITIALIZER_PERF = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String CONTAINER_INITIALIZER_PERF = JavaCore . PLUGIN_ID + "<STR_LIT>" ; public static final String RECONCILE_PERF = JavaCore . PLUGIN_ID + "<STR_LIT>" ; private final static String INDEXED_SECONDARY_TYPES = "<STR_LIT>" ; public static boolean PERF_VARIABLE_INITIALIZER = false ; public static boolean PERF_CONTAINER_INITIALIZER = false ; boolean resolveReferencedLibrariesForContainers = false ; public final static ICompilationUnit [ ] NO_WORKING_COPY = new ICompilationUnit [ <NUM_LIT:0> ] ; private final static int UNKNOWN_OPTION = <NUM_LIT:0> ; private final static int DEPRECATED_OPTION = <NUM_LIT:1> ; private final static int VALID_OPTION = <NUM_LIT:2> ; HashSet optionNames = new HashSet ( <NUM_LIT:20> ) ; Map deprecatedOptions = new HashMap ( ) ; Hashtable optionsCache ; public final IEclipsePreferences [ ] preferencesLookup = new IEclipsePreferences [ <NUM_LIT:2> ] ; static final int PREF_INSTANCE = <NUM_LIT:0> ; static final int PREF_DEFAULT = <NUM_LIT:1> ; static final Object [ ] [ ] NO_PARTICIPANTS = new Object [ <NUM_LIT:0> ] [ ] ; public static class CompilationParticipants { private final static int MAX_SOURCE_LEVEL = <NUM_LIT:7> ; private Object [ ] [ ] registeredParticipants = null ; private HashSet managedMarkerTypes ; public CompilationParticipant [ ] getCompilationParticipants ( IJavaProject project ) { final Object [ ] [ ] participantsPerSource = getRegisteredParticipants ( ) ; if ( participantsPerSource == NO_PARTICIPANTS ) return null ; String sourceLevel = project . getOption ( JavaCore . COMPILER_SOURCE , true ) ; final int sourceLevelIndex = indexForSourceLevel ( sourceLevel ) ; final Object [ ] participants = participantsPerSource [ sourceLevelIndex ] ; int length = participants . length ; CompilationParticipant [ ] result = new CompilationParticipant [ length ] ; int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( participants [ i ] instanceof IConfigurationElement ) { final IConfigurationElement configElement = ( IConfigurationElement ) participants [ i ] ; final int participantIndex = i ; SafeRunner . run ( new ISafeRunnable ( ) { public void handleException ( Throwable exception ) { Util . log ( exception , "<STR_LIT>" ) ; } public void run ( ) throws Exception { Object executableExtension = configElement . createExecutableExtension ( "<STR_LIT:class>" ) ; for ( int j = sourceLevelIndex ; j < MAX_SOURCE_LEVEL ; j ++ ) participantsPerSource [ j ] [ participantIndex ] = executableExtension ; } } ) ; } CompilationParticipant participant ; if ( ( participants [ i ] instanceof CompilationParticipant ) && ( participant = ( CompilationParticipant ) participants [ i ] ) . isActive ( project ) ) result [ index ++ ] = participant ; } if ( index == <NUM_LIT:0> ) return null ; if ( index < length ) System . arraycopy ( result , <NUM_LIT:0> , result = new CompilationParticipant [ index ] , <NUM_LIT:0> , index ) ; return result ; } public HashSet managedMarkerTypes ( ) { if ( this . managedMarkerTypes == null ) { getRegisteredParticipants ( ) ; } return this . managedMarkerTypes ; } private synchronized Object [ ] [ ] getRegisteredParticipants ( ) { if ( this . registeredParticipants != null ) { return this . registeredParticipants ; } this . managedMarkerTypes = new HashSet ( ) ; IExtensionPoint extension = Platform . getExtensionRegistry ( ) . getExtensionPoint ( JavaCore . PLUGIN_ID , COMPILATION_PARTICIPANT_EXTPOINT_ID ) ; if ( extension == null ) return this . registeredParticipants = NO_PARTICIPANTS ; final ArrayList modifyingEnv = new ArrayList ( ) ; final ArrayList creatingProblems = new ArrayList ( ) ; final ArrayList others = new ArrayList ( ) ; IExtension [ ] extensions = extension . getExtensions ( ) ; for ( int i = <NUM_LIT:0> ; i < extensions . length ; i ++ ) { IConfigurationElement [ ] configElements = extensions [ i ] . getConfigurationElements ( ) ; for ( int j = <NUM_LIT:0> ; j < configElements . length ; j ++ ) { final IConfigurationElement configElement = configElements [ j ] ; String elementName = configElement . getName ( ) ; if ( ! ( "<STR_LIT>" . equals ( elementName ) ) ) { continue ; } if ( TRUE . equals ( configElement . getAttribute ( "<STR_LIT>" ) ) ) modifyingEnv . add ( configElement ) ; else if ( TRUE . equals ( configElement . getAttribute ( "<STR_LIT>" ) ) ) creatingProblems . add ( configElement ) ; else others . add ( configElement ) ; IConfigurationElement [ ] managedMarkers = configElement . getChildren ( "<STR_LIT>" ) ; for ( int k = <NUM_LIT:0> , length = managedMarkers . length ; k < length ; k ++ ) { IConfigurationElement element = managedMarkers [ k ] ; String markerType = element . getAttribute ( "<STR_LIT>" ) ; if ( markerType != null ) this . managedMarkerTypes . add ( markerType ) ; } } } int size = modifyingEnv . size ( ) + creatingProblems . size ( ) + others . size ( ) ; if ( size == <NUM_LIT:0> ) return this . registeredParticipants = NO_PARTICIPANTS ; IConfigurationElement [ ] configElements = new IConfigurationElement [ size ] ; int index = <NUM_LIT:0> ; index = sortParticipants ( modifyingEnv , configElements , index ) ; index = sortParticipants ( creatingProblems , configElements , index ) ; index = sortParticipants ( others , configElements , index ) ; Object [ ] [ ] result = new Object [ MAX_SOURCE_LEVEL ] [ ] ; int length = configElements . length ; for ( int i = <NUM_LIT:0> ; i < MAX_SOURCE_LEVEL ; i ++ ) { result [ i ] = new Object [ length ] ; } for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { String sourceLevel = configElements [ i ] . getAttribute ( "<STR_LIT>" ) ; int sourceLevelIndex = indexForSourceLevel ( sourceLevel ) ; for ( int j = sourceLevelIndex ; j < MAX_SOURCE_LEVEL ; j ++ ) { result [ j ] [ i ] = configElements [ i ] ; } } return this . registeredParticipants = result ; } private int indexForSourceLevel ( String sourceLevel ) { if ( sourceLevel == null ) return <NUM_LIT:0> ; int majVersion = ( int ) ( CompilerOptions . versionToJdkLevel ( sourceLevel ) > > > <NUM_LIT:16> ) ; switch ( majVersion ) { case ClassFileConstants . MAJOR_VERSION_1_2 : return <NUM_LIT:1> ; case ClassFileConstants . MAJOR_VERSION_1_3 : return <NUM_LIT:2> ; case ClassFileConstants . MAJOR_VERSION_1_4 : return <NUM_LIT:3> ; case ClassFileConstants . MAJOR_VERSION_1_5 : return <NUM_LIT:4> ; case ClassFileConstants . MAJOR_VERSION_1_6 : return <NUM_LIT:5> ; case ClassFileConstants . MAJOR_VERSION_1_7 : return <NUM_LIT:6> ; default : return <NUM_LIT:0> ; } } private int sortParticipants ( ArrayList group , IConfigurationElement [ ] configElements , int index ) { int size = group . size ( ) ; if ( size == <NUM_LIT:0> ) return index ; Object [ ] elements = group . toArray ( ) ; Util . sort ( elements , new Util . Comparer ( ) { public int compare ( Object a , Object b ) { if ( a == b ) return <NUM_LIT:0> ; String id = ( ( IConfigurationElement ) a ) . getAttribute ( "<STR_LIT:id>" ) ; if ( id == null ) return - <NUM_LIT:1> ; IConfigurationElement [ ] requiredElements = ( ( IConfigurationElement ) b ) . getChildren ( "<STR_LIT>" ) ; for ( int i = <NUM_LIT:0> , length = requiredElements . length ; i < length ; i ++ ) { IConfigurationElement required = requiredElements [ i ] ; if ( id . equals ( required . getAttribute ( "<STR_LIT:id>" ) ) ) return <NUM_LIT:1> ; } return - <NUM_LIT:1> ; } } ) ; for ( int i = <NUM_LIT:0> ; i < size ; i ++ ) configElements [ index + i ] = ( IConfigurationElement ) elements [ i ] ; return index + size ; } } public final CompilationParticipants compilationParticipants = new CompilationParticipants ( ) ; public ThreadLocal abortOnMissingSource = new ThreadLocal ( ) ; private ExternalFoldersManager externalFoldersManager = ExternalFoldersManager . getExternalFoldersManager ( ) ; public static boolean conflictsWithOutputLocation ( IPath folderPath , JavaProject project ) { try { IPath outputLocation = project . getOutputLocation ( ) ; if ( outputLocation == null ) { return true ; } if ( outputLocation . isPrefixOf ( folderPath ) ) { IClasspathEntry [ ] classpath = project . getResolvedClasspath ( ) ; boolean isOutputUsed = false ; for ( int i = <NUM_LIT:0> , length = classpath . length ; i < length ; i ++ ) { IClasspathEntry entry = classpath [ i ] ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_SOURCE ) { if ( entry . getPath ( ) . equals ( outputLocation ) ) { return false ; } if ( entry . getOutputLocation ( ) == null ) { isOutputUsed = true ; } } } return isOutputUsed ; } return false ; } catch ( JavaModelException e ) { return true ; } } public synchronized IClasspathContainer containerGet ( IJavaProject project , IPath containerPath ) { if ( containerIsInitializationInProgress ( project , containerPath ) ) { return CONTAINER_INITIALIZATION_IN_PROGRESS ; } Map projectContainers = ( Map ) this . containers . get ( project ) ; if ( projectContainers == null ) { return null ; } IClasspathContainer container = ( IClasspathContainer ) projectContainers . get ( containerPath ) ; return container ; } public synchronized IClasspathContainer containerGetDefaultToPreviousSession ( IJavaProject project , IPath containerPath ) { Map projectContainers = ( Map ) this . containers . get ( project ) ; if ( projectContainers == null ) return getPreviousSessionContainer ( containerPath , project ) ; IClasspathContainer container = ( IClasspathContainer ) projectContainers . get ( containerPath ) ; if ( container == null ) return getPreviousSessionContainer ( containerPath , project ) ; return container ; } private boolean containerIsInitializationInProgress ( IJavaProject project , IPath containerPath ) { Map initializations = ( Map ) this . containerInitializationInProgress . get ( ) ; if ( initializations == null ) return false ; HashSet projectInitializations = ( HashSet ) initializations . get ( project ) ; if ( projectInitializations == null ) return false ; return projectInitializations . contains ( containerPath ) ; } private void containerAddInitializationInProgress ( IJavaProject project , IPath containerPath ) { Map initializations = ( Map ) this . containerInitializationInProgress . get ( ) ; if ( initializations == null ) this . containerInitializationInProgress . set ( initializations = new HashMap ( ) ) ; HashSet projectInitializations = ( HashSet ) initializations . get ( project ) ; if ( projectInitializations == null ) initializations . put ( project , projectInitializations = new HashSet ( ) ) ; projectInitializations . add ( containerPath ) ; } public void containerBeingInitializedPut ( IJavaProject project , IPath containerPath , IClasspathContainer container ) { Map perProjectContainers = ( Map ) this . containersBeingInitialized . get ( ) ; if ( perProjectContainers == null ) this . containersBeingInitialized . set ( perProjectContainers = new HashMap ( ) ) ; HashMap perPathContainers = ( HashMap ) perProjectContainers . get ( project ) ; if ( perPathContainers == null ) perProjectContainers . put ( project , perPathContainers = new HashMap ( ) ) ; perPathContainers . put ( containerPath , container ) ; } public IClasspathContainer containerBeingInitializedGet ( IJavaProject project , IPath containerPath ) { Map perProjectContainers = ( Map ) this . containersBeingInitialized . get ( ) ; if ( perProjectContainers == null ) return null ; HashMap perPathContainers = ( HashMap ) perProjectContainers . get ( project ) ; if ( perPathContainers == null ) return null ; return ( IClasspathContainer ) perPathContainers . get ( containerPath ) ; } public IClasspathContainer containerBeingInitializedRemove ( IJavaProject project , IPath containerPath ) { Map perProjectContainers = ( Map ) this . containersBeingInitialized . get ( ) ; if ( perProjectContainers == null ) return null ; HashMap perPathContainers = ( HashMap ) perProjectContainers . get ( project ) ; if ( perPathContainers == null ) return null ; IClasspathContainer container = ( IClasspathContainer ) perPathContainers . remove ( containerPath ) ; if ( perPathContainers . size ( ) == <NUM_LIT:0> ) perPathContainers . remove ( project ) ; if ( perProjectContainers . size ( ) == <NUM_LIT:0> ) this . containersBeingInitialized . set ( null ) ; return container ; } public synchronized void containerPut ( IJavaProject project , IPath containerPath , IClasspathContainer container ) { if ( container == CONTAINER_INITIALIZATION_IN_PROGRESS ) { containerAddInitializationInProgress ( project , containerPath ) ; return ; } else { containerRemoveInitializationInProgress ( project , containerPath ) ; Map projectContainers = ( Map ) this . containers . get ( project ) ; if ( projectContainers == null ) { projectContainers = new HashMap ( <NUM_LIT:1> ) ; this . containers . put ( project , projectContainers ) ; } if ( container == null ) { projectContainers . remove ( containerPath ) ; } else { projectContainers . put ( containerPath , container ) ; } Map previousContainers = ( Map ) this . previousSessionContainers . get ( project ) ; if ( previousContainers != null ) { previousContainers . remove ( containerPath ) ; } } } public synchronized void containerRemove ( IJavaProject project ) { Map initializations = ( Map ) this . containerInitializationInProgress . get ( ) ; if ( initializations != null ) { initializations . remove ( project ) ; } this . containers . remove ( project ) ; } public boolean containerPutIfInitializingWithSameEntries ( IPath containerPath , IJavaProject [ ] projects , IClasspathContainer [ ] respectiveContainers ) { int projectLength = projects . length ; if ( projectLength != <NUM_LIT:1> ) return false ; final IClasspathContainer container = respectiveContainers [ <NUM_LIT:0> ] ; IJavaProject project = projects [ <NUM_LIT:0> ] ; if ( ! containerIsInitializationInProgress ( project , containerPath ) ) return false ; IClasspathContainer previousContainer = containerGetDefaultToPreviousSession ( project , containerPath ) ; if ( container == null ) { if ( previousContainer == null ) { containerPut ( project , containerPath , null ) ; return true ; } return false ; } final IClasspathEntry [ ] newEntries = container . getClasspathEntries ( ) ; if ( previousContainer == null ) if ( newEntries . length == <NUM_LIT:0> ) { containerPut ( project , containerPath , container ) ; return true ; } else { if ( CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE ) verbose_missbehaving_container ( containerPath , projects , respectiveContainers , container , newEntries , null ) ; return false ; } final IClasspathEntry [ ] oldEntries = previousContainer . getClasspathEntries ( ) ; if ( oldEntries . length != newEntries . length ) { if ( CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE ) verbose_missbehaving_container ( containerPath , projects , respectiveContainers , container , newEntries , oldEntries ) ; return false ; } for ( int i = <NUM_LIT:0> , length = newEntries . length ; i < length ; i ++ ) { if ( newEntries [ i ] == null ) { if ( CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE ) verbose_missbehaving_container ( project , containerPath , newEntries ) ; return false ; } if ( ! newEntries [ i ] . equals ( oldEntries [ i ] ) ) { if ( CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE ) verbose_missbehaving_container ( containerPath , projects , respectiveContainers , container , newEntries , oldEntries ) ; return false ; } } containerPut ( project , containerPath , container ) ; return true ; } private void verbose_missbehaving_container ( IPath containerPath , IJavaProject [ ] projects , IClasspathContainer [ ] respectiveContainers , final IClasspathContainer container , final IClasspathEntry [ ] newEntries , final IClasspathEntry [ ] oldEntries ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + containerPath + '<STR_LIT:\n>' + "<STR_LIT>" + org . eclipse . jdt . internal . compiler . util . Util . toString ( projects , new org . eclipse . jdt . internal . compiler . util . Util . Displayable ( ) { public String displayString ( Object o ) { return ( ( IJavaProject ) o ) . getElementName ( ) ; } } ) + "<STR_LIT>" + org . eclipse . jdt . internal . compiler . util . Util . toString ( respectiveContainers , new org . eclipse . jdt . internal . compiler . util . Util . Displayable ( ) { public String displayString ( Object o ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; if ( o == null ) { buffer . append ( "<STR_LIT>" ) ; return buffer . toString ( ) ; } buffer . append ( container . getDescription ( ) ) ; buffer . append ( "<STR_LIT>" ) ; if ( oldEntries == null ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( "<STR_LIT>" ) ; } else { for ( int j = <NUM_LIT:0> ; j < oldEntries . length ; j ++ ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( oldEntries [ j ] ) ; buffer . append ( '<STR_LIT:\n>' ) ; } } buffer . append ( "<STR_LIT>" ) ; return buffer . toString ( ) ; } } ) + "<STR_LIT>" + org . eclipse . jdt . internal . compiler . util . Util . toString ( respectiveContainers , new org . eclipse . jdt . internal . compiler . util . Util . Displayable ( ) { public String displayString ( Object o ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; if ( o == null ) { buffer . append ( "<STR_LIT>" ) ; return buffer . toString ( ) ; } buffer . append ( container . getDescription ( ) ) ; buffer . append ( "<STR_LIT>" ) ; for ( int j = <NUM_LIT:0> ; j < newEntries . length ; j ++ ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( newEntries [ j ] ) ; buffer . append ( '<STR_LIT:\n>' ) ; } buffer . append ( "<STR_LIT>" ) ; return buffer . toString ( ) ; } } ) + "<STR_LIT>" ) ; } void verbose_missbehaving_container ( IJavaProject project , IPath containerPath , IClasspathEntry [ ] classpathEntries ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + containerPath + '<STR_LIT:\n>' + "<STR_LIT>" + org . eclipse . jdt . internal . compiler . util . Util . toString ( classpathEntries , new org . eclipse . jdt . internal . compiler . util . Util . Displayable ( ) { public String displayString ( Object o ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; if ( o == null ) { buffer . append ( "<STR_LIT>" ) ; return buffer . toString ( ) ; } buffer . append ( o ) ; return buffer . toString ( ) ; } } ) + "<STR_LIT>" ) ; } void verbose_missbehaving_container_null_entries ( IJavaProject project , IPath containerPath ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + containerPath + '<STR_LIT:\n>' + "<STR_LIT>" ) ; } private void containerRemoveInitializationInProgress ( IJavaProject project , IPath containerPath ) { Map initializations = ( Map ) this . containerInitializationInProgress . get ( ) ; if ( initializations == null ) return ; HashSet projectInitializations = ( HashSet ) initializations . get ( project ) ; if ( projectInitializations == null ) return ; projectInitializations . remove ( containerPath ) ; if ( projectInitializations . size ( ) == <NUM_LIT:0> ) initializations . remove ( project ) ; if ( initializations . size ( ) == <NUM_LIT:0> ) this . containerInitializationInProgress . set ( null ) ; } private synchronized void containersReset ( String [ ] containerIDs ) { for ( int i = <NUM_LIT:0> ; i < containerIDs . length ; i ++ ) { String containerID = containerIDs [ i ] ; Iterator projectIterator = this . containers . values ( ) . iterator ( ) ; while ( projectIterator . hasNext ( ) ) { Map projectContainers = ( Map ) projectIterator . next ( ) ; if ( projectContainers != null ) { Iterator containerIterator = projectContainers . keySet ( ) . iterator ( ) ; while ( containerIterator . hasNext ( ) ) { IPath containerPath = ( IPath ) containerIterator . next ( ) ; if ( containerID . equals ( containerPath . segment ( <NUM_LIT:0> ) ) ) { projectContainers . put ( containerPath , null ) ; } } } } } } public static IJavaElement create ( IResource resource , IJavaProject project ) { if ( resource == null ) { return null ; } int type = resource . getType ( ) ; switch ( type ) { case IResource . PROJECT : return JavaCore . create ( ( IProject ) resource ) ; case IResource . FILE : return create ( ( IFile ) resource , project ) ; case IResource . FOLDER : return create ( ( IFolder ) resource , project ) ; case IResource . ROOT : return JavaCore . create ( ( IWorkspaceRoot ) resource ) ; default : return null ; } } public static IJavaElement create ( IFile file , IJavaProject project ) { if ( file == null ) { return null ; } if ( project == null ) { project = JavaCore . create ( file . getProject ( ) ) ; } if ( file . getFileExtension ( ) != null ) { String name = file . getName ( ) ; if ( org . eclipse . jdt . internal . core . util . Util . isJavaLikeFileName ( name ) ) return createCompilationUnitFrom ( file , project ) ; if ( org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( name ) ) return createClassFileFrom ( file , project ) ; return createJarPackageFragmentRootFrom ( file , project ) ; } return null ; } public static IJavaElement create ( IFolder folder , IJavaProject project ) { if ( folder == null ) { return null ; } IJavaElement element ; if ( project == null ) { project = JavaCore . create ( folder . getProject ( ) ) ; element = determineIfOnClasspath ( folder , project ) ; if ( element == null ) { IJavaProject [ ] projects ; try { projects = JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) . getJavaProjects ( ) ; } catch ( JavaModelException e ) { return null ; } for ( int i = <NUM_LIT:0> , length = projects . length ; i < length ; i ++ ) { project = projects [ i ] ; element = determineIfOnClasspath ( folder , project ) ; if ( element != null ) break ; } } } else { element = determineIfOnClasspath ( folder , project ) ; } return element ; } public static IClassFile createClassFileFrom ( IFile file , IJavaProject project ) { if ( file == null ) { return null ; } if ( project == null ) { project = JavaCore . create ( file . getProject ( ) ) ; } IPackageFragment pkg = ( IPackageFragment ) determineIfOnClasspath ( file , project ) ; if ( pkg == null ) { PackageFragmentRoot root = ( PackageFragmentRoot ) project . getPackageFragmentRoot ( file . getParent ( ) ) ; pkg = root . getPackageFragment ( CharOperation . NO_STRINGS ) ; } return pkg . getClassFile ( file . getName ( ) ) ; } public static ICompilationUnit createCompilationUnitFrom ( IFile file , IJavaProject project ) { if ( file == null ) return null ; if ( project == null ) { project = JavaCore . create ( file . getProject ( ) ) ; } IPackageFragment pkg = ( IPackageFragment ) determineIfOnClasspath ( file , project ) ; if ( pkg == null ) { PackageFragmentRoot root = ( PackageFragmentRoot ) project . getPackageFragmentRoot ( file . getParent ( ) ) ; pkg = root . getPackageFragment ( CharOperation . NO_STRINGS ) ; if ( VERBOSE ) { System . out . println ( "<STR_LIT>" + Thread . currentThread ( ) + "<STR_LIT>" + file . getFullPath ( ) ) ; } } return pkg . getCompilationUnit ( file . getName ( ) ) ; } public static IPackageFragmentRoot createJarPackageFragmentRootFrom ( IFile file , IJavaProject project ) { if ( file == null ) { return null ; } if ( project == null ) { project = JavaCore . create ( file . getProject ( ) ) ; } IPath resourcePath = file . getFullPath ( ) ; try { IClasspathEntry entry = ( ( JavaProject ) project ) . getClasspathEntryFor ( resourcePath ) ; if ( entry != null ) { return project . getPackageFragmentRoot ( file ) ; } } catch ( JavaModelException e ) { } return null ; } public static IJavaElement determineIfOnClasspath ( IResource resource , IJavaProject project ) { IPath resourcePath = resource . getFullPath ( ) ; boolean isExternal = ExternalFoldersManager . isInternalPathForExternalFolder ( resourcePath ) ; if ( isExternal ) resourcePath = resource . getLocation ( ) ; try { JavaProjectElementInfo projectInfo = ( JavaProjectElementInfo ) getJavaModelManager ( ) . getInfo ( project ) ; ProjectCache projectCache = projectInfo == null ? null : projectInfo . projectCache ; HashtableOfArrayToObject allPkgFragmentsCache = projectCache == null ? null : projectCache . allPkgFragmentsCache ; boolean isJavaLike = org . eclipse . jdt . internal . core . util . Util . isJavaLikeFileName ( resourcePath . lastSegment ( ) ) ; IClasspathEntry [ ] entries = isJavaLike ? project . getRawClasspath ( ) : ( ( JavaProject ) project ) . getResolvedClasspath ( ) ; int length = entries . length ; if ( length > <NUM_LIT:0> ) { String sourceLevel = project . getOption ( JavaCore . COMPILER_SOURCE , true ) ; String complianceLevel = project . getOption ( JavaCore . COMPILER_COMPLIANCE , true ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IClasspathEntry entry = entries [ i ] ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_PROJECT ) continue ; IPath rootPath = entry . getPath ( ) ; if ( rootPath . equals ( resourcePath ) ) { if ( isJavaLike ) return null ; return project . getPackageFragmentRoot ( resource ) ; } else if ( rootPath . isPrefixOf ( resourcePath ) ) { if ( ! Util . isExcluded ( resource , ( ( ClasspathEntry ) entry ) . fullInclusionPatternChars ( ) , ( ( ClasspathEntry ) entry ) . fullExclusionPatternChars ( ) ) ) { PackageFragmentRoot root = isExternal ? new ExternalPackageFragmentRoot ( rootPath , ( JavaProject ) project ) : ( PackageFragmentRoot ) ( ( JavaProject ) project ) . getFolderPackageFragmentRoot ( rootPath ) ; if ( root == null ) return null ; IPath pkgPath = resourcePath . removeFirstSegments ( rootPath . segmentCount ( ) ) ; if ( resource . getType ( ) == IResource . FILE ) { pkgPath = pkgPath . removeLastSegments ( <NUM_LIT:1> ) ; } String [ ] pkgName = pkgPath . segments ( ) ; if ( allPkgFragmentsCache != null && allPkgFragmentsCache . containsKey ( pkgName ) ) return root . getPackageFragment ( pkgName ) ; if ( pkgName . length != <NUM_LIT:0> && JavaConventions . validatePackageName ( Util . packageName ( pkgPath , sourceLevel , complianceLevel ) , sourceLevel , complianceLevel ) . getSeverity ( ) == IStatus . ERROR ) { return null ; } return root . getPackageFragment ( pkgName ) ; } } } } } catch ( JavaModelException npe ) { return null ; } return null ; } private static JavaModelManager MANAGER = new JavaModelManager ( ) ; private JavaModelCache cache ; private ThreadLocal temporaryCache = new ThreadLocal ( ) ; protected HashSet elementsOutOfSynchWithBuffers = new HashSet ( <NUM_LIT:11> ) ; public DeltaProcessingState deltaState = new DeltaProcessingState ( ) ; public IndexManager indexManager = null ; protected Map perProjectInfos = new HashMap ( <NUM_LIT:5> ) ; protected Map perWorkingCopyInfos = new HashMap ( <NUM_LIT:5> ) ; protected WeakHashMap searchScopes = new WeakHashMap ( ) ; public static class PerProjectInfo { private static final int JAVADOC_CACHE_INITIAL_SIZE = <NUM_LIT:10> ; static final IJavaModelStatus NEED_RESOLUTION = new JavaModelStatus ( ) ; public IProject project ; public Object savedState ; public boolean triedRead ; public IClasspathEntry [ ] rawClasspath ; public IClasspathEntry [ ] referencedEntries ; public IJavaModelStatus rawClasspathStatus ; public int rawTimeStamp = <NUM_LIT:0> ; public boolean writtingRawClasspath = false ; public IClasspathEntry [ ] resolvedClasspath ; public IJavaModelStatus unresolvedEntryStatus ; public Map rootPathToRawEntries ; public Map rootPathToResolvedEntries ; public IPath outputLocation ; public IEclipsePreferences preferences ; public Hashtable options ; public Hashtable secondaryTypes ; public LRUCache javadocCache ; public PerProjectInfo ( IProject project ) { this . triedRead = false ; this . savedState = null ; this . project = project ; this . javadocCache = new LRUCache ( JAVADOC_CACHE_INITIAL_SIZE ) ; } public synchronized IClasspathEntry [ ] getResolvedClasspath ( ) { if ( this . unresolvedEntryStatus == NEED_RESOLUTION ) return null ; return this . resolvedClasspath ; } public void forgetExternalTimestampsAndIndexes ( ) { IClasspathEntry [ ] classpath = this . resolvedClasspath ; if ( classpath == null ) return ; JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; IndexManager indexManager = manager . indexManager ; Map externalTimeStamps = manager . deltaState . getExternalLibTimeStamps ( ) ; HashMap rootInfos = JavaModelManager . getDeltaState ( ) . otherRoots ; for ( int i = <NUM_LIT:0> , length = classpath . length ; i < length ; i ++ ) { IClasspathEntry entry = classpath [ i ] ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY ) { IPath path = entry . getPath ( ) ; if ( rootInfos . get ( path ) == null ) { externalTimeStamps . remove ( path ) ; indexManager . removeIndex ( path ) ; } } } } public void rememberExternalLibTimestamps ( ) { IClasspathEntry [ ] classpath = this . resolvedClasspath ; if ( classpath == null ) return ; Map externalTimeStamps = JavaModelManager . getJavaModelManager ( ) . deltaState . getExternalLibTimeStamps ( ) ; for ( int i = <NUM_LIT:0> , length = classpath . length ; i < length ; i ++ ) { IClasspathEntry entry = classpath [ i ] ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY ) { IPath path = entry . getPath ( ) ; if ( externalTimeStamps . get ( path ) == null ) { Object target = JavaModel . getExternalTarget ( path , true ) ; if ( target instanceof File ) { long timestamp = DeltaProcessor . getTimeStamp ( ( java . io . File ) target ) ; externalTimeStamps . put ( path , new Long ( timestamp ) ) ; } } } } } public synchronized ClasspathChange resetResolvedClasspath ( ) { JavaModelManager . getJavaModelManager ( ) . resetClasspathListCache ( ) ; return setResolvedClasspath ( null , null , null , null , this . rawTimeStamp , true ) ; } private ClasspathChange setClasspath ( IClasspathEntry [ ] newRawClasspath , IClasspathEntry [ ] referencedEntries , IPath newOutputLocation , IJavaModelStatus newRawClasspathStatus , IClasspathEntry [ ] newResolvedClasspath , Map newRootPathToRawEntries , Map newRootPathToResolvedEntries , IJavaModelStatus newUnresolvedEntryStatus , boolean addClasspathChange ) { ClasspathChange classpathChange = addClasspathChange ? addClasspathChange ( ) : null ; if ( referencedEntries != null ) this . referencedEntries = referencedEntries ; if ( this . referencedEntries == null ) this . referencedEntries = ClasspathEntry . NO_ENTRIES ; this . rawClasspath = newRawClasspath ; this . outputLocation = newOutputLocation ; this . rawClasspathStatus = newRawClasspathStatus ; this . resolvedClasspath = newResolvedClasspath ; this . rootPathToRawEntries = newRootPathToRawEntries ; this . rootPathToResolvedEntries = newRootPathToResolvedEntries ; this . unresolvedEntryStatus = newUnresolvedEntryStatus ; this . javadocCache = new LRUCache ( JAVADOC_CACHE_INITIAL_SIZE ) ; return classpathChange ; } protected ClasspathChange addClasspathChange ( ) { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; ClasspathChange classpathChange = manager . deltaState . addClasspathChange ( this . project , this . rawClasspath , this . outputLocation , this . resolvedClasspath ) ; return classpathChange ; } public ClasspathChange setRawClasspath ( IClasspathEntry [ ] newRawClasspath , IPath newOutputLocation , IJavaModelStatus newRawClasspathStatus ) { return setRawClasspath ( newRawClasspath , null , newOutputLocation , newRawClasspathStatus ) ; } public synchronized ClasspathChange setRawClasspath ( IClasspathEntry [ ] newRawClasspath , IClasspathEntry [ ] referencedEntries , IPath newOutputLocation , IJavaModelStatus newRawClasspathStatus ) { this . rawTimeStamp ++ ; return setClasspath ( newRawClasspath , referencedEntries , newOutputLocation , newRawClasspathStatus , null , null , null , null , true ) ; } public ClasspathChange setResolvedClasspath ( IClasspathEntry [ ] newResolvedClasspath , Map newRootPathToRawEntries , Map newRootPathToResolvedEntries , IJavaModelStatus newUnresolvedEntryStatus , int timeStamp , boolean addClasspathChange ) { return setResolvedClasspath ( newResolvedClasspath , null , newRootPathToRawEntries , newRootPathToResolvedEntries , newUnresolvedEntryStatus , timeStamp , addClasspathChange ) ; } public synchronized ClasspathChange setResolvedClasspath ( IClasspathEntry [ ] newResolvedClasspath , IClasspathEntry [ ] referencedEntries , Map newRootPathToRawEntries , Map newRootPathToResolvedEntries , IJavaModelStatus newUnresolvedEntryStatus , int timeStamp , boolean addClasspathChange ) { if ( this . rawTimeStamp != timeStamp ) return null ; return setClasspath ( this . rawClasspath , referencedEntries , this . outputLocation , this . rawClasspathStatus , newResolvedClasspath , newRootPathToRawEntries , newRootPathToResolvedEntries , newUnresolvedEntryStatus , addClasspathChange ) ; } public synchronized IClasspathEntry [ ] [ ] readAndCacheClasspath ( JavaProject javaProject ) { IClasspathEntry [ ] [ ] classpath ; IJavaModelStatus status ; try { classpath = javaProject . readFileEntriesWithException ( null ) ; status = JavaModelStatus . VERIFIED_OK ; } catch ( CoreException e ) { classpath = new IClasspathEntry [ ] [ ] { JavaProject . INVALID_CLASSPATH , ClasspathEntry . NO_ENTRIES } ; status = new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CLASSPATH_FILE_FORMAT , Messages . bind ( Messages . classpath_cannotReadClasspathFile , javaProject . getElementName ( ) ) ) ; } catch ( IOException e ) { classpath = new IClasspathEntry [ ] [ ] { JavaProject . INVALID_CLASSPATH , ClasspathEntry . NO_ENTRIES } ; if ( Messages . file_badFormat . equals ( e . getMessage ( ) ) ) status = new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CLASSPATH_FILE_FORMAT , Messages . bind ( Messages . classpath_xmlFormatError , javaProject . getElementName ( ) , Messages . file_badFormat ) ) ; else status = new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CLASSPATH_FILE_FORMAT , Messages . bind ( Messages . classpath_cannotReadClasspathFile , javaProject . getElementName ( ) ) ) ; } catch ( ClasspathEntry . AssertionFailedException e ) { classpath = new IClasspathEntry [ ] [ ] { JavaProject . INVALID_CLASSPATH , ClasspathEntry . NO_ENTRIES } ; status = new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CLASSPATH_FILE_FORMAT , Messages . bind ( Messages . classpath_illegalEntryInClasspathFile , new String [ ] { javaProject . getElementName ( ) , e . getMessage ( ) } ) ) ; } int rawClasspathLength = classpath [ <NUM_LIT:0> ] . length ; IPath output = null ; if ( rawClasspathLength > <NUM_LIT:0> ) { IClasspathEntry entry = classpath [ <NUM_LIT:0> ] [ rawClasspathLength - <NUM_LIT:1> ] ; if ( entry . getContentKind ( ) == ClasspathEntry . K_OUTPUT ) { output = entry . getPath ( ) ; IClasspathEntry [ ] copy = new IClasspathEntry [ rawClasspathLength - <NUM_LIT:1> ] ; System . arraycopy ( classpath [ <NUM_LIT:0> ] , <NUM_LIT:0> , copy , <NUM_LIT:0> , copy . length ) ; classpath [ <NUM_LIT:0> ] = copy ; } } setRawClasspath ( classpath [ <NUM_LIT:0> ] , classpath [ <NUM_LIT:1> ] , output , status ) ; return classpath ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . project . getFullPath ( ) ) ; buffer . append ( "<STR_LIT>" ) ; if ( this . rawClasspath == null ) { buffer . append ( "<STR_LIT>" ) ; } else { for ( int i = <NUM_LIT:0> , length = this . rawClasspath . length ; i < length ; i ++ ) { buffer . append ( "<STR_LIT:U+0020U+0020>" ) ; buffer . append ( this . rawClasspath [ i ] ) ; buffer . append ( '<STR_LIT:\n>' ) ; } } buffer . append ( "<STR_LIT>" ) ; IClasspathEntry [ ] resolvedCP = this . resolvedClasspath ; if ( resolvedCP == null ) { buffer . append ( "<STR_LIT>" ) ; } else { for ( int i = <NUM_LIT:0> , length = resolvedCP . length ; i < length ; i ++ ) { buffer . append ( "<STR_LIT:U+0020U+0020>" ) ; buffer . append ( resolvedCP [ i ] ) ; buffer . append ( '<STR_LIT:\n>' ) ; } } buffer . append ( "<STR_LIT>" ) ; if ( this . unresolvedEntryStatus == NEED_RESOLUTION ) buffer . append ( "<STR_LIT>" ) ; else buffer . append ( this . unresolvedEntryStatus == null ? "<STR_LIT>" : this . unresolvedEntryStatus . toString ( ) ) ; buffer . append ( "<STR_LIT>" ) ; if ( this . outputLocation == null ) { buffer . append ( "<STR_LIT>" ) ; } else { buffer . append ( this . outputLocation ) ; } return buffer . toString ( ) ; } public boolean writeAndCacheClasspath ( JavaProject javaProject , final IClasspathEntry [ ] newRawClasspath , IClasspathEntry [ ] newReferencedEntries , final IPath newOutputLocation ) throws JavaModelException { try { this . writtingRawClasspath = true ; if ( newReferencedEntries == null ) newReferencedEntries = this . referencedEntries ; if ( ! javaProject . writeFileEntries ( newRawClasspath , newReferencedEntries , newOutputLocation ) ) { return false ; } setRawClasspath ( newRawClasspath , newReferencedEntries , newOutputLocation , JavaModelStatus . VERIFIED_OK ) ; } finally { this . writtingRawClasspath = false ; } return true ; } public boolean writeAndCacheClasspath ( JavaProject javaProject , final IClasspathEntry [ ] newRawClasspath , final IPath newOutputLocation ) throws JavaModelException { return writeAndCacheClasspath ( javaProject , newRawClasspath , null , newOutputLocation ) ; } } public static class PerWorkingCopyInfo implements IProblemRequestor { int useCount = <NUM_LIT:0> ; IProblemRequestor problemRequestor ; CompilationUnit workingCopy ; public PerWorkingCopyInfo ( CompilationUnit workingCopy , IProblemRequestor problemRequestor ) { this . workingCopy = workingCopy ; this . problemRequestor = problemRequestor ; } public void acceptProblem ( IProblem problem ) { IProblemRequestor requestor = getProblemRequestor ( ) ; if ( requestor == null ) return ; requestor . acceptProblem ( problem ) ; } public void beginReporting ( ) { IProblemRequestor requestor = getProblemRequestor ( ) ; if ( requestor == null ) return ; requestor . beginReporting ( ) ; } public void endReporting ( ) { IProblemRequestor requestor = getProblemRequestor ( ) ; if ( requestor == null ) return ; requestor . endReporting ( ) ; } public IProblemRequestor getProblemRequestor ( ) { if ( this . problemRequestor == null && this . workingCopy . owner != null ) { return this . workingCopy . owner . getProblemRequestor ( this . workingCopy ) ; } return this . problemRequestor ; } public ICompilationUnit getWorkingCopy ( ) { return this . workingCopy ; } public boolean isActive ( ) { IProblemRequestor requestor = getProblemRequestor ( ) ; return requestor != null && requestor . isActive ( ) ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( ( ( JavaElement ) this . workingCopy ) . toStringWithAncestors ( ) ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . useCount ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . problemRequestor ) ; if ( this . problemRequestor == null ) { IProblemRequestor requestor = getProblemRequestor ( ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( requestor ) ; } return buffer . toString ( ) ; } } public static boolean VERBOSE = false ; public static boolean CP_RESOLVE_VERBOSE = false ; public static boolean CP_RESOLVE_VERBOSE_ADVANCED = false ; public static boolean CP_RESOLVE_VERBOSE_FAILURE = false ; public static boolean ZIP_ACCESS_VERBOSE = false ; private ThreadLocal zipFiles = new ThreadLocal ( ) ; private UserLibraryManager userLibraryManager ; private Set nonChainingJars ; private Set invalidArchives ; public static class EclipsePreferencesListener implements IEclipsePreferences . IPreferenceChangeListener { public void preferenceChange ( IEclipsePreferences . PreferenceChangeEvent event ) { String propertyName = event . getKey ( ) ; if ( propertyName . startsWith ( JavaCore . PLUGIN_ID ) ) { if ( propertyName . startsWith ( CP_VARIABLE_PREFERENCES_PREFIX ) ) { String varName = propertyName . substring ( CP_VARIABLE_PREFERENCES_PREFIX . length ( ) ) ; JavaModelManager manager = getJavaModelManager ( ) ; if ( manager . variablesWithInitializer . contains ( varName ) ) { String oldValue = ( String ) event . getOldValue ( ) ; if ( oldValue == null ) { manager . variablesWithInitializer . remove ( varName ) ; } else { manager . getInstancePreferences ( ) . put ( varName , oldValue ) ; } } else { String newValue = ( String ) event . getNewValue ( ) ; IPath newPath ; if ( newValue != null && ! ( newValue = newValue . trim ( ) ) . equals ( CP_ENTRY_IGNORE ) ) { newPath = new Path ( newValue ) ; } else { newPath = null ; } try { SetVariablesOperation operation = new SetVariablesOperation ( new String [ ] { varName } , new IPath [ ] { newPath } , false ) ; operation . runOperation ( null ) ; } catch ( JavaModelException e ) { Util . log ( e , "<STR_LIT>" + varName + "<STR_LIT:U+0020toU+0020>" + newPath ) ; } } } else if ( propertyName . startsWith ( CP_CONTAINER_PREFERENCES_PREFIX ) ) { recreatePersistedContainer ( propertyName , ( String ) event . getNewValue ( ) , false ) ; } else 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 ) || propertyName . equals ( JavaCore . CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE ) ) { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; IJavaModel model = manager . getJavaModel ( ) ; IJavaProject [ ] projects ; try { projects = model . getJavaProjects ( ) ; for ( int i = <NUM_LIT:0> , pl = projects . length ; i < pl ; i ++ ) { JavaProject javaProject = ( JavaProject ) projects [ i ] ; manager . deltaState . addClasspathValidation ( javaProject ) ; try { javaProject . getProject ( ) . touch ( null ) ; } catch ( CoreException e ) { } } } catch ( JavaModelException e ) { } } else if ( propertyName . startsWith ( CP_USERLIBRARY_PREFERENCES_PREFIX ) ) { String libName = propertyName . substring ( CP_USERLIBRARY_PREFERENCES_PREFIX . length ( ) ) ; UserLibraryManager manager = JavaModelManager . getUserLibraryManager ( ) ; manager . updateUserLibrary ( libName , ( String ) event . getNewValue ( ) ) ; } } try { IJavaProject [ ] projects = JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) . getJavaProjects ( ) ; for ( int i = <NUM_LIT:0> , length = projects . length ; i < length ; i ++ ) { ( ( JavaProject ) projects [ i ] ) . resetCaches ( ) ; } } catch ( JavaModelException e ) { } } } EclipsePreferencesListener instancePreferencesListener = new EclipsePreferencesListener ( ) ; IEclipsePreferences . INodeChangeListener instanceNodeListener = new IEclipsePreferences . INodeChangeListener ( ) { public void added ( IEclipsePreferences . NodeChangeEvent event ) { } public void removed ( IEclipsePreferences . NodeChangeEvent event ) { if ( event . getChild ( ) == JavaModelManager . this . preferencesLookup [ PREF_INSTANCE ] ) { JavaModelManager . this . preferencesLookup [ PREF_INSTANCE ] = InstanceScope . INSTANCE . getNode ( JavaCore . PLUGIN_ID ) ; JavaModelManager . this . preferencesLookup [ PREF_INSTANCE ] . addPreferenceChangeListener ( new EclipsePreferencesListener ( ) ) ; } } } ; IEclipsePreferences . INodeChangeListener defaultNodeListener = new IEclipsePreferences . INodeChangeListener ( ) { public void added ( IEclipsePreferences . NodeChangeEvent event ) { } public void removed ( IEclipsePreferences . NodeChangeEvent event ) { if ( event . getChild ( ) == JavaModelManager . this . preferencesLookup [ PREF_DEFAULT ] ) { JavaModelManager . this . preferencesLookup [ PREF_DEFAULT ] = DefaultScope . INSTANCE . getNode ( JavaCore . PLUGIN_ID ) ; } } } ; IEclipsePreferences . IPreferenceChangeListener propertyListener ; IEclipsePreferences . IPreferenceChangeListener resourcesPropertyListener ; private JavaModelManager ( ) { if ( Platform . isRunning ( ) ) { this . indexManager = new IndexManager ( ) ; this . nonChainingJars = loadClasspathListCache ( NON_CHAINING_JARS_CACHE ) ; this . invalidArchives = loadClasspathListCache ( INVALID_ARCHIVES_CACHE ) ; String includeContainerReferencedLib = System . getProperty ( RESOLVE_REFERENCED_LIBRARIES_FOR_CONTAINERS ) ; this . resolveReferencedLibrariesForContainers = TRUE . equalsIgnoreCase ( includeContainerReferencedLib ) ; } } private void addDeprecatedOptions ( Hashtable options ) { options . put ( JavaCore . COMPILER_PB_INVALID_IMPORT , JavaCore . ERROR ) ; options . put ( JavaCore . COMPILER_PB_UNREACHABLE_CODE , JavaCore . ERROR ) ; } public void addNonChainingJar ( IPath path ) { if ( this . nonChainingJars != null ) this . nonChainingJars . add ( path ) ; } public void addInvalidArchive ( IPath path ) { if ( this . invalidArchives == null ) { this . invalidArchives = Collections . synchronizedSet ( new HashSet ( ) ) ; } if ( this . invalidArchives != null ) { this . invalidArchives . add ( path ) ; } } public void cacheZipFiles ( Object owner ) { ZipCache zipCache = ( ZipCache ) this . zipFiles . get ( ) ; if ( zipCache != null ) { return ; } this . zipFiles . set ( new ZipCache ( owner ) ) ; } public void closeZipFile ( ZipFile zipFile ) { if ( zipFile == null ) return ; if ( this . zipFiles . get ( ) != null ) { return ; } try { if ( JavaModelManager . ZIP_ACCESS_VERBOSE ) { System . out . println ( "<STR_LIT:(>" + Thread . currentThread ( ) + "<STR_LIT>" + zipFile . getName ( ) ) ; } zipFile . close ( ) ; } catch ( IOException e ) { } } public void configurePluginDebugOptions ( ) { if ( JavaCore . getPlugin ( ) . isDebugging ( ) ) { String option = Platform . getDebugOption ( BUFFER_MANAGER_DEBUG ) ; if ( option != null ) BufferManager . VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( BUILDER_DEBUG ) ; if ( option != null ) JavaBuilder . DEBUG = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( COMPILER_DEBUG ) ; if ( option != null ) Compiler . DEBUG = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( BUILDER_STATS_DEBUG ) ; if ( option != null ) JavaBuilder . SHOW_STATS = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( COMPLETION_DEBUG ) ; if ( option != null ) CompletionEngine . DEBUG = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( CP_RESOLVE_DEBUG ) ; if ( option != null ) JavaModelManager . CP_RESOLVE_VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( CP_RESOLVE_ADVANCED_DEBUG ) ; if ( option != null ) JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( CP_RESOLVE_FAILURE_DEBUG ) ; if ( option != null ) JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( DELTA_DEBUG ) ; if ( option != null ) DeltaProcessor . DEBUG = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( DELTA_DEBUG_VERBOSE ) ; if ( option != null ) DeltaProcessor . VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( HIERARCHY_DEBUG ) ; if ( option != null ) TypeHierarchy . DEBUG = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( INDEX_MANAGER_DEBUG ) ; if ( option != null ) JobManager . VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( INDEX_MANAGER_ADVANCED_DEBUG ) ; if ( option != null ) IndexManager . DEBUG = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( JAVAMODEL_DEBUG ) ; if ( option != null ) JavaModelManager . VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( JAVAMODELCACHE_DEBUG ) ; if ( option != null ) JavaModelCache . VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( POST_ACTION_DEBUG ) ; if ( option != null ) JavaModelOperation . POST_ACTION_VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( RESOLUTION_DEBUG ) ; if ( option != null ) NameLookup . VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( SEARCH_DEBUG ) ; if ( option != null ) BasicSearchEngine . VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( SELECTION_DEBUG ) ; if ( option != null ) SelectionEngine . DEBUG = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( ZIP_ACCESS_DEBUG ) ; if ( option != null ) JavaModelManager . ZIP_ACCESS_VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( SOURCE_MAPPER_DEBUG_VERBOSE ) ; if ( option != null ) SourceMapper . VERBOSE = option . equalsIgnoreCase ( TRUE ) ; option = Platform . getDebugOption ( FORMATTER_DEBUG ) ; if ( option != null ) DefaultCodeFormatter . DEBUG = option . equalsIgnoreCase ( TRUE ) ; } if ( PerformanceStats . ENABLED ) { CompletionEngine . PERF = PerformanceStats . isEnabled ( COMPLETION_PERF ) ; SelectionEngine . PERF = PerformanceStats . isEnabled ( SELECTION_PERF ) ; DeltaProcessor . PERF = PerformanceStats . isEnabled ( DELTA_LISTENER_PERF ) ; JavaModelManager . PERF_VARIABLE_INITIALIZER = PerformanceStats . isEnabled ( VARIABLE_INITIALIZER_PERF ) ; JavaModelManager . PERF_CONTAINER_INITIALIZER = PerformanceStats . isEnabled ( CONTAINER_INITIALIZER_PERF ) ; ReconcileWorkingCopyOperation . PERF = PerformanceStats . isEnabled ( RECONCILE_PERF ) ; } } public AbstractAnnotationProcessorManager createAnnotationProcessorManager ( ) { synchronized ( this ) { if ( this . annotationProcessorManagerFactory == null ) { IExtensionPoint extension = Platform . getExtensionRegistry ( ) . getExtensionPoint ( JavaCore . PLUGIN_ID , ANNOTATION_PROCESSOR_MANAGER_EXTPOINT_ID ) ; if ( extension == null ) return null ; IExtension [ ] extensions = extension . getExtensions ( ) ; for ( int i = <NUM_LIT:0> ; i < extensions . length ; i ++ ) { if ( i > <NUM_LIT:0> ) { Util . log ( null , "<STR_LIT>" + extensions [ i ] . getUniqueIdentifier ( ) ) ; break ; } IConfigurationElement [ ] configElements = extensions [ i ] . getConfigurationElements ( ) ; for ( int j = <NUM_LIT:0> ; j < configElements . length ; j ++ ) { final IConfigurationElement configElement = configElements [ j ] ; if ( "<STR_LIT>" . equals ( configElement . getName ( ) ) ) { this . annotationProcessorManagerFactory = configElement ; break ; } } } } } if ( this . annotationProcessorManagerFactory == null ) { return null ; } final AbstractAnnotationProcessorManager [ ] apm = new AbstractAnnotationProcessorManager [ <NUM_LIT:1> ] ; apm [ <NUM_LIT:0> ] = null ; final IConfigurationElement factory = this . annotationProcessorManagerFactory ; SafeRunner . run ( new ISafeRunnable ( ) { public void handleException ( Throwable exception ) { Util . log ( exception , "<STR_LIT>" ) ; } public void run ( ) throws Exception { Object executableExtension = factory . createExecutableExtension ( "<STR_LIT:class>" ) ; if ( executableExtension instanceof AbstractAnnotationProcessorManager ) { apm [ <NUM_LIT:0> ] = ( AbstractAnnotationProcessorManager ) executableExtension ; } } } ) ; return apm [ <NUM_LIT:0> ] ; } public int discardPerWorkingCopyInfo ( CompilationUnit workingCopy ) throws JavaModelException { JavaElementDeltaBuilder deltaBuilder = null ; if ( workingCopy . isPrimary ( ) && workingCopy . hasUnsavedChanges ( ) ) { deltaBuilder = new JavaElementDeltaBuilder ( workingCopy ) ; } PerWorkingCopyInfo info = null ; synchronized ( this . perWorkingCopyInfos ) { WorkingCopyOwner owner = workingCopy . owner ; Map workingCopyToInfos = ( Map ) this . perWorkingCopyInfos . get ( owner ) ; if ( workingCopyToInfos == null ) return - <NUM_LIT:1> ; info = ( PerWorkingCopyInfo ) workingCopyToInfos . get ( workingCopy ) ; if ( info == null ) return - <NUM_LIT:1> ; if ( -- info . useCount == <NUM_LIT:0> ) { workingCopyToInfos . remove ( workingCopy ) ; if ( workingCopyToInfos . isEmpty ( ) ) { this . perWorkingCopyInfos . remove ( owner ) ; } } } if ( info . useCount == <NUM_LIT:0> ) { removeInfoAndChildren ( workingCopy ) ; workingCopy . closeBuffer ( ) ; if ( deltaBuilder != null ) { deltaBuilder . buildDeltas ( ) ; if ( deltaBuilder . delta != null ) { getDeltaProcessor ( ) . registerJavaModelDelta ( deltaBuilder . delta ) ; } } } return info . useCount ; } public void doneSaving ( ISaveContext context ) { } public void flushZipFiles ( Object owner ) { ZipCache zipCache = ( ZipCache ) this . zipFiles . get ( ) ; if ( zipCache == null ) { return ; } if ( zipCache . owner == owner ) { this . zipFiles . set ( null ) ; zipCache . flush ( ) ; } } public synchronized boolean forceBatchInitializations ( boolean initAfterLoad ) { switch ( this . batchContainerInitializations ) { case NO_BATCH_INITIALIZATION : this . batchContainerInitializations = NEED_BATCH_INITIALIZATION ; return true ; case BATCH_INITIALIZATION_FINISHED : if ( initAfterLoad ) return false ; this . batchContainerInitializations = NEED_BATCH_INITIALIZATION ; return true ; } return false ; } private synchronized boolean batchContainerInitializations ( ) { switch ( this . batchContainerInitializations ) { case NEED_BATCH_INITIALIZATION : this . batchContainerInitializations = BATCH_INITIALIZATION_IN_PROGRESS ; return true ; case BATCH_INITIALIZATION_IN_PROGRESS : return true ; } return false ; } private synchronized void batchInitializationFinished ( ) { this . batchContainerInitializations = BATCH_INITIALIZATION_FINISHED ; } public IClasspathContainer getClasspathContainer ( final IPath containerPath , final IJavaProject project ) throws JavaModelException { IClasspathContainer container = containerGet ( project , containerPath ) ; if ( container == null ) { if ( batchContainerInitializations ( ) ) { try { container = initializeAllContainers ( project , containerPath ) ; } finally { batchInitializationFinished ( ) ; } } else { container = initializeContainer ( project , containerPath ) ; containerBeingInitializedRemove ( project , containerPath ) ; SetContainerOperation operation = new SetContainerOperation ( containerPath , new IJavaProject [ ] { project } , new IClasspathContainer [ ] { container } ) ; operation . runOperation ( null ) ; } } return container ; } public IClasspathEntry [ ] getReferencedClasspathEntries ( IClasspathEntry libraryEntry , IJavaProject project ) { IClasspathEntry [ ] referencedEntries = ( ( ClasspathEntry ) libraryEntry ) . resolvedChainedLibraries ( ) ; if ( project == null ) return referencedEntries ; PerProjectInfo perProjectInfo = getPerProjectInfo ( project . getProject ( ) , false ) ; if ( perProjectInfo == null ) return referencedEntries ; List pathToReferencedEntries = new ArrayList ( referencedEntries . length ) ; for ( int index = <NUM_LIT:0> ; index < referencedEntries . length ; index ++ ) { if ( pathToReferencedEntries . contains ( referencedEntries [ index ] . getPath ( ) ) ) continue ; IClasspathEntry persistedEntry = null ; if ( ( persistedEntry = ( IClasspathEntry ) perProjectInfo . rootPathToResolvedEntries . get ( referencedEntries [ index ] . getPath ( ) ) ) != null ) { referencedEntries [ index ] = persistedEntry ; } pathToReferencedEntries . add ( referencedEntries [ index ] . getPath ( ) ) ; } return referencedEntries ; } public DeltaProcessor getDeltaProcessor ( ) { return this . deltaState . getDeltaProcessor ( ) ; } public static DeltaProcessingState getDeltaState ( ) { return MANAGER . deltaState ; } protected HashSet getElementsOutOfSynchWithBuffers ( ) { return this . elementsOutOfSynchWithBuffers ; } public static ExternalFoldersManager getExternalManager ( ) { return MANAGER . externalFoldersManager ; } public static IndexManager getIndexManager ( ) { return MANAGER . indexManager ; } public synchronized Object getInfo ( IJavaElement element ) { HashMap tempCache = ( HashMap ) this . temporaryCache . get ( ) ; if ( tempCache != null ) { Object result = tempCache . get ( element ) ; if ( result != null ) { return result ; } } return this . cache . getInfo ( element ) ; } public synchronized IJavaElement getExistingElement ( IJavaElement element ) { return this . cache . getExistingElement ( element ) ; } public HashSet getExternalWorkingCopyProjects ( ) { synchronized ( this . perWorkingCopyInfos ) { HashSet result = null ; Iterator values = this . perWorkingCopyInfos . values ( ) . iterator ( ) ; while ( values . hasNext ( ) ) { Map ownerCopies = ( Map ) values . next ( ) ; Iterator workingCopies = ownerCopies . keySet ( ) . iterator ( ) ; while ( workingCopies . hasNext ( ) ) { ICompilationUnit workingCopy = ( ICompilationUnit ) workingCopies . next ( ) ; IJavaProject project = workingCopy . getJavaProject ( ) ; if ( project . getElementName ( ) . equals ( ExternalJavaProject . EXTERNAL_PROJECT_NAME ) ) { if ( result == null ) result = new HashSet ( ) ; result . add ( project ) ; } } } return result ; } } public IEclipsePreferences getInstancePreferences ( ) { return this . preferencesLookup [ PREF_INSTANCE ] ; } public Hashtable getDefaultOptions ( ) { Hashtable defaultOptions = new Hashtable ( <NUM_LIT:10> ) ; IEclipsePreferences defaultPreferences = getDefaultPreferences ( ) ; Iterator iterator = this . optionNames . iterator ( ) ; while ( iterator . hasNext ( ) ) { String propertyName = ( String ) iterator . next ( ) ; String value = defaultPreferences . get ( propertyName , null ) ; if ( value != null ) defaultOptions . put ( propertyName , value ) ; } defaultOptions . put ( JavaCore . CORE_ENCODING , JavaCore . getEncoding ( ) ) ; addDeprecatedOptions ( defaultOptions ) ; return defaultOptions ; } public IEclipsePreferences getDefaultPreferences ( ) { return this . preferencesLookup [ PREF_DEFAULT ] ; } public final JavaModel getJavaModel ( ) { return this . javaModel ; } public final static JavaModelManager getJavaModelManager ( ) { return MANAGER ; } public Object getLastBuiltState ( IProject project , IProgressMonitor monitor ) { if ( ! JavaProject . hasJavaNature ( project ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( project + "<STR_LIT>" ) ; return null ; } PerProjectInfo info = getPerProjectInfo ( project , true ) ; if ( ! info . triedRead ) { info . triedRead = true ; try { if ( monitor != null ) monitor . subTask ( Messages . bind ( Messages . build_readStateProgress , project . getName ( ) ) ) ; info . savedState = readState ( project ) ; } catch ( CoreException e ) { e . printStackTrace ( ) ; } } return info . savedState ; } public String getOption ( String optionName ) { if ( JavaCore . CORE_ENCODING . equals ( optionName ) ) { return JavaCore . getEncoding ( ) ; } if ( isDeprecatedOption ( optionName ) ) { return JavaCore . ERROR ; } int optionLevel = getOptionLevel ( optionName ) ; if ( optionLevel != UNKNOWN_OPTION ) { IPreferencesService service = Platform . getPreferencesService ( ) ; String value = service . get ( optionName , null , this . preferencesLookup ) ; if ( value == null && optionLevel == DEPRECATED_OPTION ) { String [ ] compatibleOptions = ( String [ ] ) this . deprecatedOptions . get ( optionName ) ; value = service . get ( compatibleOptions [ <NUM_LIT:0> ] , null , this . preferencesLookup ) ; } return value == null ? null : value . trim ( ) ; } return null ; } public String getOption ( String optionName , boolean inheritJavaCoreOptions , IEclipsePreferences projectPreferences ) { switch ( getOptionLevel ( optionName ) ) { case VALID_OPTION : String javaCoreDefault = inheritJavaCoreOptions ? JavaCore . getOption ( optionName ) : null ; if ( projectPreferences == null ) return javaCoreDefault ; String value = projectPreferences . get ( optionName , javaCoreDefault ) ; return value == null ? null : value . trim ( ) ; case DEPRECATED_OPTION : String oldValue = projectPreferences . get ( optionName , null ) ; if ( oldValue != null ) { return oldValue . trim ( ) ; } String [ ] compatibleOptions = ( String [ ] ) this . deprecatedOptions . get ( optionName ) ; String newDefault = inheritJavaCoreOptions ? JavaCore . getOption ( compatibleOptions [ <NUM_LIT:0> ] ) : null ; String newValue = projectPreferences . get ( compatibleOptions [ <NUM_LIT:0> ] , newDefault ) ; return newValue == null ? null : newValue . trim ( ) ; } return null ; } public boolean knowsOption ( String optionName ) { boolean knownOption = this . optionNames . contains ( optionName ) ; if ( ! knownOption ) { knownOption = this . deprecatedOptions . get ( optionName ) != null ; } return knownOption ; } public int getOptionLevel ( String optionName ) { if ( this . optionNames . contains ( optionName ) ) { return VALID_OPTION ; } if ( this . deprecatedOptions . get ( optionName ) != null ) { return DEPRECATED_OPTION ; } return UNKNOWN_OPTION ; } public Hashtable getOptions ( ) { Hashtable cachedOptions ; if ( ( cachedOptions = this . optionsCache ) != null ) { return new Hashtable ( cachedOptions ) ; } if ( ! Platform . isRunning ( ) ) { this . optionsCache = getDefaultOptionsNoInitialization ( ) ; return new Hashtable ( this . optionsCache ) ; } Hashtable options = new Hashtable ( <NUM_LIT:10> ) ; IPreferencesService service = Platform . getPreferencesService ( ) ; Iterator iterator = this . optionNames . iterator ( ) ; while ( iterator . hasNext ( ) ) { String propertyName = ( String ) iterator . next ( ) ; String propertyValue = service . get ( propertyName , null , this . preferencesLookup ) ; if ( propertyValue != null ) { options . put ( propertyName , propertyValue ) ; } } Iterator deprecatedEntries = this . deprecatedOptions . entrySet ( ) . iterator ( ) ; while ( deprecatedEntries . hasNext ( ) ) { Entry entry = ( Entry ) deprecatedEntries . next ( ) ; String propertyName = ( String ) entry . getKey ( ) ; String propertyValue = service . get ( propertyName , null , this . preferencesLookup ) ; if ( propertyValue != null ) { options . put ( propertyName , propertyValue ) ; String [ ] compatibleOptions = ( String [ ] ) entry . getValue ( ) ; for ( int co = <NUM_LIT:0> , length = compatibleOptions . length ; co < length ; co ++ ) { String compatibleOption = compatibleOptions [ co ] ; if ( ! options . containsKey ( compatibleOption ) ) options . put ( compatibleOption , propertyValue ) ; } } } options . put ( JavaCore . CORE_ENCODING , JavaCore . getEncoding ( ) ) ; addDeprecatedOptions ( options ) ; Util . fixTaskTags ( options ) ; this . optionsCache = new Hashtable ( options ) ; return options ; } private Hashtable getDefaultOptionsNoInitialization ( ) { Map defaultOptionsMap = new CompilerOptions ( ) . getMap ( ) ; defaultOptionsMap . put ( JavaCore . COMPILER_LOCAL_VARIABLE_ATTR , JavaCore . GENERATE ) ; defaultOptionsMap . put ( JavaCore . COMPILER_CODEGEN_UNUSED_LOCAL , JavaCore . PRESERVE ) ; defaultOptionsMap . put ( JavaCore . COMPILER_TASK_TAGS , JavaCore . DEFAULT_TASK_TAGS ) ; defaultOptionsMap . put ( JavaCore . COMPILER_TASK_PRIORITIES , JavaCore . DEFAULT_TASK_PRIORITIES ) ; defaultOptionsMap . put ( JavaCore . COMPILER_TASK_CASE_SENSITIVE , JavaCore . ENABLED ) ; defaultOptionsMap . put ( JavaCore . COMPILER_DOC_COMMENT_SUPPORT , JavaCore . ENABLED ) ; defaultOptionsMap . put ( JavaCore . COMPILER_PB_FORBIDDEN_REFERENCE , JavaCore . ERROR ) ; defaultOptionsMap . put ( JavaCore . CORE_JAVA_BUILD_RESOURCE_COPY_FILTER , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CORE_JAVA_BUILD_INVALID_CLASSPATH , JavaCore . ABORT ) ; defaultOptionsMap . put ( JavaCore . CORE_JAVA_BUILD_DUPLICATE_RESOURCE , JavaCore . WARNING ) ; defaultOptionsMap . put ( JavaCore . CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER , JavaCore . CLEAN ) ; defaultOptionsMap . put ( JavaCore . CORE_JAVA_BUILD_ORDER , JavaCore . IGNORE ) ; defaultOptionsMap . put ( JavaCore . CORE_INCOMPLETE_CLASSPATH , JavaCore . ERROR ) ; defaultOptionsMap . put ( JavaCore . CORE_CIRCULAR_CLASSPATH , JavaCore . ERROR ) ; defaultOptionsMap . put ( JavaCore . CORE_INCOMPATIBLE_JDK_LEVEL , JavaCore . IGNORE ) ; defaultOptionsMap . put ( JavaCore . CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE , JavaCore . ERROR ) ; defaultOptionsMap . put ( JavaCore . CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS , JavaCore . ENABLED ) ; defaultOptionsMap . put ( JavaCore . CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS , JavaCore . ENABLED ) ; defaultOptionsMap . putAll ( DefaultCodeFormatterConstants . getEclipseDefaultSettings ( ) ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_VISIBILITY_CHECK , JavaCore . DISABLED ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_DEPRECATION_CHECK , JavaCore . DISABLED ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_IMPLICIT_QUALIFICATION , JavaCore . DISABLED ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_FIELD_PREFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_STATIC_FIELD_PREFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_STATIC_FINAL_FIELD_PREFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_LOCAL_PREFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_ARGUMENT_PREFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_FIELD_SUFFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_STATIC_FIELD_SUFFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_STATIC_FINAL_FIELD_SUFFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_LOCAL_SUFFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_ARGUMENT_SUFFIXES , "<STR_LIT>" ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_FORBIDDEN_REFERENCE_CHECK , JavaCore . ENABLED ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_DISCOURAGED_REFERENCE_CHECK , JavaCore . DISABLED ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_CAMEL_CASE_MATCH , JavaCore . ENABLED ) ; defaultOptionsMap . put ( JavaCore . CODEASSIST_SUGGEST_STATIC_IMPORTS , JavaCore . ENABLED ) ; defaultOptionsMap . put ( JavaCore . TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC , "<STR_LIT>" ) ; return new Hashtable ( defaultOptionsMap ) ; } public PerProjectInfo getPerProjectInfo ( IProject project , boolean create ) { synchronized ( this . perProjectInfos ) { PerProjectInfo info = ( PerProjectInfo ) this . perProjectInfos . get ( project ) ; if ( info == null && create ) { info = new PerProjectInfo ( project ) ; this . perProjectInfos . put ( project , info ) ; } return info ; } } public PerProjectInfo getPerProjectInfoCheckExistence ( IProject project ) throws JavaModelException { JavaModelManager . PerProjectInfo info = getPerProjectInfo ( project , false ) ; if ( info == null ) { if ( ! JavaProject . hasJavaNature ( project ) ) { throw ( ( JavaProject ) JavaCore . create ( project ) ) . newNotPresentException ( ) ; } info = getPerProjectInfo ( project , true ) ; } return info ; } public PerWorkingCopyInfo getPerWorkingCopyInfo ( CompilationUnit workingCopy , boolean create , boolean recordUsage , IProblemRequestor problemRequestor ) { synchronized ( this . perWorkingCopyInfos ) { WorkingCopyOwner owner = workingCopy . owner ; Map workingCopyToInfos = ( Map ) this . perWorkingCopyInfos . get ( owner ) ; if ( workingCopyToInfos == null && create ) { workingCopyToInfos = new HashMap ( ) ; this . perWorkingCopyInfos . put ( owner , workingCopyToInfos ) ; } PerWorkingCopyInfo info = workingCopyToInfos == null ? null : ( PerWorkingCopyInfo ) workingCopyToInfos . get ( workingCopy ) ; if ( info == null && create ) { info = new PerWorkingCopyInfo ( workingCopy , problemRequestor ) ; workingCopyToInfos . put ( workingCopy , info ) ; } if ( info != null && recordUsage ) info . useCount ++ ; return info ; } } public IClasspathContainer getPreviousSessionContainer ( IPath containerPath , IJavaProject project ) { Map previousContainerValues = ( Map ) this . previousSessionContainers . get ( project ) ; if ( previousContainerValues != null ) { IClasspathContainer previousContainer = ( IClasspathContainer ) previousContainerValues . get ( containerPath ) ; if ( previousContainer != null ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED ) verbose_reentering_project_container_access ( containerPath , project , previousContainer ) ; return previousContainer ; } } return null ; } private void verbose_reentering_project_container_access ( IPath containerPath , IJavaProject project , IClasspathContainer previousContainer ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' ) ; buffer . append ( "<STR_LIT>" + containerPath + '<STR_LIT:\n>' ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( previousContainer . getDescription ( ) ) ; buffer . append ( "<STR_LIT>" ) ; IClasspathEntry [ ] entries = previousContainer . getClasspathEntries ( ) ; if ( entries != null ) { for ( int j = <NUM_LIT:0> ; j < entries . length ; j ++ ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( entries [ j ] ) ; buffer . append ( '<STR_LIT:\n>' ) ; } } buffer . append ( "<STR_LIT>" ) ; Util . verbose ( buffer . toString ( ) ) ; new Exception ( "<STR_LIT>" ) . printStackTrace ( System . out ) ; } public IPath getPreviousSessionVariable ( String variableName ) { IPath previousPath = ( IPath ) this . previousSessionVariables . get ( variableName ) ; if ( previousPath != null ) { if ( CP_RESOLVE_VERBOSE_ADVANCED ) verbose_reentering_variable_access ( variableName , previousPath ) ; return previousPath ; } return null ; } private void verbose_reentering_variable_access ( String variableName , IPath previousPath ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + variableName + '<STR_LIT:\n>' + "<STR_LIT>" + previousPath ) ; new Exception ( "<STR_LIT>" ) . printStackTrace ( System . out ) ; } public HashMap getTemporaryCache ( ) { HashMap result = ( HashMap ) this . temporaryCache . get ( ) ; if ( result == null ) { result = new HashMap ( ) ; this . temporaryCache . set ( result ) ; } return result ; } private File getVariableAndContainersFile ( ) { return JavaCore . getPlugin ( ) . getStateLocation ( ) . append ( "<STR_LIT>" ) . toFile ( ) ; } public static String [ ] getRegisteredVariableNames ( ) { Plugin jdtCorePlugin = JavaCore . getPlugin ( ) ; if ( jdtCorePlugin == null ) return null ; ArrayList variableList = new ArrayList ( <NUM_LIT:5> ) ; IExtensionPoint extension = Platform . getExtensionRegistry ( ) . getExtensionPoint ( JavaCore . PLUGIN_ID , JavaModelManager . CPVARIABLE_INITIALIZER_EXTPOINT_ID ) ; if ( extension != null ) { IExtension [ ] extensions = extension . getExtensions ( ) ; for ( int i = <NUM_LIT:0> ; i < extensions . length ; i ++ ) { IConfigurationElement [ ] configElements = extensions [ i ] . getConfigurationElements ( ) ; for ( int j = <NUM_LIT:0> ; j < configElements . length ; j ++ ) { String varAttribute = configElements [ j ] . getAttribute ( "<STR_LIT>" ) ; if ( varAttribute != null ) variableList . add ( varAttribute ) ; } } } String [ ] variableNames = new String [ variableList . size ( ) ] ; variableList . toArray ( variableNames ) ; return variableNames ; } public static String [ ] getRegisteredContainerIDs ( ) { Plugin jdtCorePlugin = JavaCore . getPlugin ( ) ; if ( jdtCorePlugin == null ) return null ; ArrayList containerIDList = new ArrayList ( <NUM_LIT:5> ) ; IExtensionPoint extension = Platform . getExtensionRegistry ( ) . getExtensionPoint ( JavaCore . PLUGIN_ID , JavaModelManager . CPCONTAINER_INITIALIZER_EXTPOINT_ID ) ; if ( extension != null ) { IExtension [ ] extensions = extension . getExtensions ( ) ; for ( int i = <NUM_LIT:0> ; i < extensions . length ; i ++ ) { IConfigurationElement [ ] configElements = extensions [ i ] . getConfigurationElements ( ) ; for ( int j = <NUM_LIT:0> ; j < configElements . length ; j ++ ) { String idAttribute = configElements [ j ] . getAttribute ( "<STR_LIT:id>" ) ; if ( idAttribute != null ) containerIDList . add ( idAttribute ) ; } } } String [ ] containerIDs = new String [ containerIDList . size ( ) ] ; containerIDList . toArray ( containerIDs ) ; return containerIDs ; } public IClasspathEntry resolveVariableEntry ( IClasspathEntry entry , boolean usePreviousSession ) { if ( entry . getEntryKind ( ) != IClasspathEntry . CPE_VARIABLE ) return entry ; IPath resolvedPath = getResolvedVariablePath ( entry . getPath ( ) , usePreviousSession ) ; if ( resolvedPath == null ) return null ; resolvedPath = ClasspathEntry . resolveDotDot ( null , resolvedPath ) ; Object target = JavaModel . getTarget ( resolvedPath , false ) ; if ( target == null ) return null ; if ( target instanceof IResource ) { IResource resolvedResource = ( IResource ) target ; switch ( resolvedResource . getType ( ) ) { case IResource . PROJECT : return JavaCore . newProjectEntry ( resolvedPath , entry . getAccessRules ( ) , entry . combineAccessRules ( ) , entry . getExtraAttributes ( ) , entry . isExported ( ) ) ; case IResource . FILE : return JavaCore . newLibraryEntry ( resolvedPath , getResolvedVariablePath ( entry . getSourceAttachmentPath ( ) , usePreviousSession ) , getResolvedVariablePath ( entry . getSourceAttachmentRootPath ( ) , usePreviousSession ) , entry . getAccessRules ( ) , entry . getExtraAttributes ( ) , entry . isExported ( ) ) ; case IResource . FOLDER : return JavaCore . newLibraryEntry ( resolvedPath , getResolvedVariablePath ( entry . getSourceAttachmentPath ( ) , usePreviousSession ) , getResolvedVariablePath ( entry . getSourceAttachmentRootPath ( ) , usePreviousSession ) , entry . getAccessRules ( ) , entry . getExtraAttributes ( ) , entry . isExported ( ) ) ; } } if ( target instanceof File ) { File externalFile = JavaModel . getFile ( target ) ; if ( externalFile != null ) { return JavaCore . newLibraryEntry ( resolvedPath , getResolvedVariablePath ( entry . getSourceAttachmentPath ( ) , usePreviousSession ) , getResolvedVariablePath ( entry . getSourceAttachmentRootPath ( ) , usePreviousSession ) , entry . getAccessRules ( ) , entry . getExtraAttributes ( ) , entry . isExported ( ) ) ; } else { if ( resolvedPath . isAbsolute ( ) ) { return JavaCore . newLibraryEntry ( resolvedPath , getResolvedVariablePath ( entry . getSourceAttachmentPath ( ) , usePreviousSession ) , getResolvedVariablePath ( entry . getSourceAttachmentRootPath ( ) , usePreviousSession ) , entry . getAccessRules ( ) , entry . getExtraAttributes ( ) , entry . isExported ( ) ) ; } } } return null ; } public IPath getResolvedVariablePath ( IPath variablePath , boolean usePreviousSession ) { if ( variablePath == null ) return null ; int count = variablePath . segmentCount ( ) ; if ( count == <NUM_LIT:0> ) return null ; String variableName = variablePath . segment ( <NUM_LIT:0> ) ; IPath resolvedPath = usePreviousSession ? getPreviousSessionVariable ( variableName ) : JavaCore . getClasspathVariable ( variableName ) ; if ( resolvedPath == null ) return null ; if ( count > <NUM_LIT:1> ) { resolvedPath = resolvedPath . append ( variablePath . removeFirstSegments ( <NUM_LIT:1> ) ) ; } return resolvedPath ; } private File getSerializationFile ( IProject project ) { if ( ! project . exists ( ) ) return null ; IPath workingLocation = project . getWorkingLocation ( JavaCore . PLUGIN_ID ) ; return workingLocation . append ( "<STR_LIT>" ) . toFile ( ) ; } public static UserLibraryManager getUserLibraryManager ( ) { if ( MANAGER . userLibraryManager == null ) { UserLibraryManager libraryManager = new UserLibraryManager ( ) ; synchronized ( MANAGER ) { if ( MANAGER . userLibraryManager == null ) { MANAGER . userLibraryManager = libraryManager ; } } } return MANAGER . userLibraryManager ; } public ICompilationUnit [ ] getWorkingCopies ( WorkingCopyOwner owner , boolean addPrimary ) { synchronized ( this . perWorkingCopyInfos ) { ICompilationUnit [ ] primaryWCs = addPrimary && owner != DefaultWorkingCopyOwner . PRIMARY ? getWorkingCopies ( DefaultWorkingCopyOwner . PRIMARY , false ) : null ; Map workingCopyToInfos = ( Map ) this . perWorkingCopyInfos . get ( owner ) ; if ( workingCopyToInfos == null ) return primaryWCs ; int primaryLength = primaryWCs == null ? <NUM_LIT:0> : primaryWCs . length ; int size = workingCopyToInfos . size ( ) ; ICompilationUnit [ ] result = new ICompilationUnit [ primaryLength + size ] ; int index = <NUM_LIT:0> ; if ( primaryWCs != null ) { for ( int i = <NUM_LIT:0> ; i < primaryLength ; i ++ ) { ICompilationUnit primaryWorkingCopy = primaryWCs [ i ] ; ICompilationUnit workingCopy = LanguageSupportFactory . newCompilationUnit ( ( PackageFragment ) primaryWorkingCopy . getParent ( ) , primaryWorkingCopy . getElementName ( ) , owner ) ; if ( ! workingCopyToInfos . containsKey ( workingCopy ) ) result [ index ++ ] = primaryWorkingCopy ; } if ( index != primaryLength ) System . arraycopy ( result , <NUM_LIT:0> , result = new ICompilationUnit [ index + size ] , <NUM_LIT:0> , index ) ; } Iterator iterator = workingCopyToInfos . values ( ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { result [ index ++ ] = ( ( JavaModelManager . PerWorkingCopyInfo ) iterator . next ( ) ) . getWorkingCopy ( ) ; } return result ; } } public JavaWorkspaceScope getWorkspaceScope ( ) { if ( this . workspaceScope == null ) { this . workspaceScope = new JavaWorkspaceScope ( ) ; } return this . workspaceScope ; } public void verifyArchiveContent ( IPath path ) throws CoreException { if ( isInvalidArchive ( path ) ) { throw new CoreException ( new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . status_IOException , new ZipException ( ) ) ) ; } ZipFile file = getZipFile ( path ) ; closeZipFile ( file ) ; } public ZipFile getZipFile ( IPath path ) throws CoreException { if ( isInvalidArchive ( path ) ) throw new CoreException ( new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . status_IOException , new ZipException ( ) ) ) ; ZipCache zipCache ; ZipFile zipFile ; if ( ( zipCache = ( ZipCache ) this . zipFiles . get ( ) ) != null && ( zipFile = zipCache . getCache ( path ) ) != null ) { return zipFile ; } File localFile = null ; IWorkspaceRoot root = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; IResource file = root . findMember ( path ) ; if ( file != null ) { URI location ; if ( file . getType ( ) != IResource . FILE || ( location = file . getLocationURI ( ) ) == null ) { throw new CoreException ( new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . bind ( Messages . file_notFound , path . toString ( ) ) , null ) ) ; } localFile = Util . toLocalFile ( location , null ) ; if ( localFile == null ) throw new CoreException ( new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . bind ( Messages . file_notFound , path . toString ( ) ) , null ) ) ; } else { localFile = path . toFile ( ) ; } try { if ( ZIP_ACCESS_VERBOSE ) { System . out . println ( "<STR_LIT:(>" + Thread . currentThread ( ) + "<STR_LIT>" + localFile ) ; } zipFile = new ZipFile ( localFile ) ; if ( zipCache != null ) { zipCache . setCache ( path , zipFile ) ; } return zipFile ; } catch ( IOException e ) { addInvalidArchive ( path ) ; throw new CoreException ( new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , - <NUM_LIT:1> , Messages . status_IOException , e ) ) ; } } public boolean hasTemporaryCache ( ) { return this . temporaryCache . get ( ) != null ; } private IClasspathContainer initializeAllContainers ( IJavaProject javaProjectToInit , IPath containerToInit ) throws JavaModelException { if ( CP_RESOLVE_VERBOSE_ADVANCED ) verbose_batching_containers_initialization ( javaProjectToInit , containerToInit ) ; final HashMap allContainerPaths = new HashMap ( ) ; IProject [ ] projects = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getProjects ( ) ; for ( int i = <NUM_LIT:0> , length = projects . length ; i < length ; i ++ ) { IProject project = projects [ i ] ; if ( ! JavaProject . hasJavaNature ( project ) ) continue ; IJavaProject javaProject = new JavaProject ( project , getJavaModel ( ) ) ; HashSet paths = ( HashSet ) allContainerPaths . get ( javaProject ) ; IClasspathEntry [ ] rawClasspath = javaProject . getRawClasspath ( ) ; for ( int j = <NUM_LIT:0> , length2 = rawClasspath . length ; j < length2 ; j ++ ) { IClasspathEntry entry = rawClasspath [ j ] ; IPath path = entry . getPath ( ) ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_CONTAINER && containerGet ( javaProject , path ) == null ) { if ( paths == null ) { paths = new HashSet ( ) ; allContainerPaths . put ( javaProject , paths ) ; } paths . add ( path ) ; } } } if ( javaProjectToInit != null ) { HashSet containerPaths = ( HashSet ) allContainerPaths . get ( javaProjectToInit ) ; if ( containerPaths == null ) { containerPaths = new HashSet ( ) ; allContainerPaths . put ( javaProjectToInit , containerPaths ) ; } containerPaths . add ( containerToInit ) ; } boolean ok = false ; try { IWorkspaceRunnable runnable = new IWorkspaceRunnable ( ) { public void run ( IProgressMonitor monitor ) throws CoreException { try { Set entrySet = allContainerPaths . entrySet ( ) ; int length = entrySet . size ( ) ; if ( monitor != null ) monitor . beginTask ( "<STR_LIT>" , length ) ; Map . Entry [ ] entries = new Map . Entry [ length ] ; entrySet . toArray ( entries ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { Map . Entry entry = entries [ i ] ; IJavaProject javaProject = ( IJavaProject ) entry . getKey ( ) ; HashSet pathSet = ( HashSet ) entry . getValue ( ) ; if ( pathSet == null ) continue ; int length2 = pathSet . size ( ) ; IPath [ ] paths = new IPath [ length2 ] ; pathSet . toArray ( paths ) ; for ( int j = <NUM_LIT:0> ; j < length2 ; j ++ ) { IPath path = paths [ j ] ; initializeContainer ( javaProject , path ) ; IClasspathContainer container = containerBeingInitializedGet ( javaProject , path ) ; if ( container != null ) { containerPut ( javaProject , path , container ) ; } } if ( monitor != null ) monitor . worked ( <NUM_LIT:1> ) ; } Map perProjectContainers = ( Map ) JavaModelManager . this . containersBeingInitialized . get ( ) ; if ( perProjectContainers != null ) { Iterator entriesIterator = perProjectContainers . entrySet ( ) . iterator ( ) ; while ( entriesIterator . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) entriesIterator . next ( ) ; IJavaProject project = ( IJavaProject ) entry . getKey ( ) ; HashMap perPathContainers = ( HashMap ) entry . getValue ( ) ; Iterator containersIterator = perPathContainers . entrySet ( ) . iterator ( ) ; while ( containersIterator . hasNext ( ) ) { Map . Entry containerEntry = ( Map . Entry ) containersIterator . next ( ) ; IPath containerPath = ( IPath ) containerEntry . getKey ( ) ; IClasspathContainer container = ( IClasspathContainer ) containerEntry . getValue ( ) ; SetContainerOperation operation = new SetContainerOperation ( containerPath , new IJavaProject [ ] { project } , new IClasspathContainer [ ] { container } ) ; operation . runOperation ( monitor ) ; } } JavaModelManager . this . containersBeingInitialized . set ( null ) ; } } finally { if ( monitor != null ) monitor . done ( ) ; } } } ; IProgressMonitor monitor = this . batchContainerInitializationsProgress ; IWorkspace workspace = ResourcesPlugin . getWorkspace ( ) ; if ( workspace . isTreeLocked ( ) ) runnable . run ( monitor ) ; else workspace . run ( runnable , null , IWorkspace . AVOID_UPDATE , monitor ) ; ok = true ; } catch ( CoreException e ) { Util . log ( e , "<STR_LIT>" ) ; } finally { if ( ! ok ) { this . containerInitializationInProgress . set ( null ) ; } } return containerGet ( javaProjectToInit , containerToInit ) ; } private void verbose_batching_containers_initialization ( IJavaProject javaProjectToInit , IPath containerToInit ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + ( javaProjectToInit == null ? "<STR_LIT:null>" : javaProjectToInit . getElementName ( ) ) + '<STR_LIT:\n>' + "<STR_LIT>" + containerToInit ) ; } IClasspathContainer initializeContainer ( IJavaProject project , IPath containerPath ) throws JavaModelException { IProgressMonitor monitor = this . batchContainerInitializationsProgress ; if ( monitor != null && monitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; IClasspathContainer container = null ; final ClasspathContainerInitializer initializer = JavaCore . getClasspathContainerInitializer ( containerPath . segment ( <NUM_LIT:0> ) ) ; if ( initializer != null ) { if ( CP_RESOLVE_VERBOSE ) verbose_triggering_container_initialization ( project , containerPath , initializer ) ; if ( CP_RESOLVE_VERBOSE_ADVANCED ) verbose_triggering_container_initialization_invocation_trace ( ) ; PerformanceStats stats = null ; if ( JavaModelManager . PERF_CONTAINER_INITIALIZER ) { stats = PerformanceStats . getStats ( JavaModelManager . CONTAINER_INITIALIZER_PERF , this ) ; stats . startRun ( containerPath + "<STR_LIT>" + project . getPath ( ) ) ; } containerPut ( project , containerPath , CONTAINER_INITIALIZATION_IN_PROGRESS ) ; boolean ok = false ; try { if ( monitor != null ) monitor . subTask ( Messages . bind ( Messages . javamodel_configuring , initializer . getDescription ( containerPath , project ) ) ) ; initializer . initialize ( containerPath , project ) ; if ( monitor != null ) monitor . subTask ( "<STR_LIT>" ) ; container = containerBeingInitializedGet ( project , containerPath ) ; if ( container == null && containerGet ( project , containerPath ) == CONTAINER_INITIALIZATION_IN_PROGRESS ) { container = initializer . getFailureContainer ( containerPath , project ) ; if ( container == null ) { if ( CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE ) verbose_container_null_failure_container ( project , containerPath , initializer ) ; return null ; } if ( CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE ) verbose_container_using_failure_container ( project , containerPath , initializer ) ; containerPut ( project , containerPath , container ) ; } ok = true ; } catch ( CoreException e ) { if ( e instanceof JavaModelException ) { throw ( JavaModelException ) e ; } else { throw new JavaModelException ( e ) ; } } catch ( RuntimeException e ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE ) e . printStackTrace ( ) ; throw e ; } catch ( Error e ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE ) e . printStackTrace ( ) ; throw e ; } finally { if ( JavaModelManager . PERF_CONTAINER_INITIALIZER ) { stats . endRun ( ) ; } if ( ! ok ) { containerRemoveInitializationInProgress ( project , containerPath ) ; if ( CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE ) verbose_container_initialization_failed ( project , containerPath , container , initializer ) ; } } if ( CP_RESOLVE_VERBOSE_ADVANCED ) verbose_container_value_after_initialization ( project , containerPath , container ) ; } else { container = ( new ClasspathContainerInitializer ( ) { public void initialize ( IPath path , IJavaProject javaProject ) throws CoreException { } } ) . getFailureContainer ( containerPath , project ) ; if ( CP_RESOLVE_VERBOSE_ADVANCED || CP_RESOLVE_VERBOSE_FAILURE ) verbose_no_container_initializer_found ( project , containerPath ) ; } return container ; } private void verbose_no_container_initializer_found ( IJavaProject project , IPath containerPath ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + containerPath ) ; } private void verbose_container_value_after_initialization ( IJavaProject project , IPath containerPath , IClasspathContainer container ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' ) ; buffer . append ( "<STR_LIT>" + containerPath + '<STR_LIT:\n>' ) ; if ( container != null ) { buffer . append ( "<STR_LIT>" + container . getDescription ( ) + "<STR_LIT>" ) ; IClasspathEntry [ ] entries = container . getClasspathEntries ( ) ; if ( entries != null ) { for ( int i = <NUM_LIT:0> ; i < entries . length ; i ++ ) { buffer . append ( "<STR_LIT>" + entries [ i ] + '<STR_LIT:\n>' ) ; } } buffer . append ( "<STR_LIT>" ) ; } else { buffer . append ( "<STR_LIT>" ) ; } Util . verbose ( buffer . toString ( ) ) ; } private void verbose_container_initialization_failed ( IJavaProject project , IPath containerPath , IClasspathContainer container , ClasspathContainerInitializer initializer ) { if ( container == CONTAINER_INITIALIZATION_IN_PROGRESS ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + containerPath + '<STR_LIT:\n>' + "<STR_LIT>" + initializer ) ; } else { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + containerPath + '<STR_LIT:\n>' + "<STR_LIT>" + initializer ) ; } } private void verbose_container_null_failure_container ( IJavaProject project , IPath containerPath , ClasspathContainerInitializer initializer ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + containerPath + '<STR_LIT:\n>' + "<STR_LIT>" + initializer ) ; } private void verbose_container_using_failure_container ( IJavaProject project , IPath containerPath , ClasspathContainerInitializer initializer ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + containerPath + '<STR_LIT:\n>' + "<STR_LIT>" + initializer ) ; } private void verbose_triggering_container_initialization ( IJavaProject project , IPath containerPath , ClasspathContainerInitializer initializer ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + project . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + containerPath + '<STR_LIT:\n>' + "<STR_LIT>" + initializer ) ; } private void verbose_triggering_container_initialization_invocation_trace ( ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" ) ; new Exception ( "<STR_LIT>" ) . printStackTrace ( System . out ) ; } public void initializePreferences ( ) { this . preferencesLookup [ PREF_INSTANCE ] = InstanceScope . INSTANCE . getNode ( JavaCore . PLUGIN_ID ) ; this . preferencesLookup [ PREF_DEFAULT ] = DefaultScope . INSTANCE . getNode ( JavaCore . PLUGIN_ID ) ; this . instanceNodeListener = new IEclipsePreferences . INodeChangeListener ( ) { public void added ( IEclipsePreferences . NodeChangeEvent event ) { } public void removed ( IEclipsePreferences . NodeChangeEvent event ) { if ( event . getChild ( ) == JavaModelManager . this . preferencesLookup [ PREF_INSTANCE ] ) { JavaModelManager . this . preferencesLookup [ PREF_INSTANCE ] = InstanceScope . INSTANCE . getNode ( JavaCore . PLUGIN_ID ) ; JavaModelManager . this . preferencesLookup [ PREF_INSTANCE ] . addPreferenceChangeListener ( new EclipsePreferencesListener ( ) ) ; } } } ; ( ( IEclipsePreferences ) this . preferencesLookup [ PREF_INSTANCE ] . parent ( ) ) . addNodeChangeListener ( this . instanceNodeListener ) ; this . preferencesLookup [ PREF_INSTANCE ] . addPreferenceChangeListener ( this . instancePreferencesListener = new EclipsePreferencesListener ( ) ) ; this . defaultNodeListener = new IEclipsePreferences . INodeChangeListener ( ) { public void added ( IEclipsePreferences . NodeChangeEvent event ) { } public void removed ( IEclipsePreferences . NodeChangeEvent event ) { if ( event . getChild ( ) == JavaModelManager . this . preferencesLookup [ PREF_DEFAULT ] ) { JavaModelManager . this . preferencesLookup [ PREF_DEFAULT ] = DefaultScope . INSTANCE . getNode ( JavaCore . PLUGIN_ID ) ; } } } ; ( ( IEclipsePreferences ) this . preferencesLookup [ PREF_DEFAULT ] . parent ( ) ) . addNodeChangeListener ( this . defaultNodeListener ) ; } public synchronized char [ ] intern ( char [ ] array ) { return this . charArraySymbols . add ( array ) ; } public synchronized String intern ( String s ) { return ( String ) this . stringSymbols . add ( new String ( s ) ) ; } private HashSet getClasspathBeingResolved ( ) { HashSet result = ( HashSet ) this . classpathsBeingResolved . get ( ) ; if ( result == null ) { result = new HashSet ( ) ; this . classpathsBeingResolved . set ( result ) ; } return result ; } public boolean isClasspathBeingResolved ( IJavaProject project ) { return getClasspathBeingResolved ( ) . contains ( project ) ; } private boolean isDeprecatedOption ( String optionName ) { return JavaCore . COMPILER_PB_INVALID_IMPORT . equals ( optionName ) || JavaCore . COMPILER_PB_UNREACHABLE_CODE . equals ( optionName ) ; } public boolean isNonChainingJar ( IPath path ) { return this . nonChainingJars != null && this . nonChainingJars . contains ( path ) ; } public boolean isInvalidArchive ( IPath path ) { return this . invalidArchives != null && this . invalidArchives . contains ( path ) ; } public void removeFromInvalidArchiveCache ( IPath path ) { if ( this . invalidArchives != null ) { this . invalidArchives . remove ( path ) ; } } public void setClasspathBeingResolved ( IJavaProject project , boolean classpathIsResolved ) { if ( classpathIsResolved ) { getClasspathBeingResolved ( ) . add ( project ) ; } else { getClasspathBeingResolved ( ) . remove ( project ) ; } } private Set loadClasspathListCache ( String cacheName ) { Set pathCache = new HashSet ( ) ; File cacheFile = getClasspathListFile ( cacheName ) ; DataInputStream in = null ; try { in = new DataInputStream ( new BufferedInputStream ( new FileInputStream ( cacheFile ) ) ) ; int size = in . readInt ( ) ; while ( size -- > <NUM_LIT:0> ) { String path = in . readUTF ( ) ; pathCache . add ( Path . fromPortableString ( path ) ) ; } } catch ( IOException e ) { if ( cacheFile . exists ( ) ) Util . log ( e , "<STR_LIT>" ) ; } finally { if ( in != null ) { try { in . close ( ) ; } catch ( IOException e ) { } } } return Collections . synchronizedSet ( pathCache ) ; } private File getClasspathListFile ( String fileName ) { return JavaCore . getPlugin ( ) . getStateLocation ( ) . append ( fileName ) . toFile ( ) ; } private Set getNonChainingJarsCache ( ) throws CoreException { if ( this . nonChainingJars != null && this . nonChainingJars . size ( ) > <NUM_LIT:0> ) { return this . nonChainingJars ; } Set result = new HashSet ( ) ; IJavaProject [ ] projects = getJavaModel ( ) . getJavaProjects ( ) ; for ( int i = <NUM_LIT:0> , length = projects . length ; i < length ; i ++ ) { IJavaProject javaProject = projects [ i ] ; IClasspathEntry [ ] classpath = ( ( JavaProject ) javaProject ) . getResolvedClasspath ( ) ; for ( int j = <NUM_LIT:0> , length2 = classpath . length ; j < length2 ; j ++ ) { IClasspathEntry entry = classpath [ j ] ; IPath path ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY && ! result . contains ( path = entry . getPath ( ) ) && ClasspathEntry . resolvedChainedLibraries ( path ) . length == <NUM_LIT:0> ) { result . add ( path ) ; } } } this . nonChainingJars = Collections . synchronizedSet ( result ) ; return this . nonChainingJars ; } private Set getClasspathListCache ( String cacheName ) throws CoreException { if ( cacheName == NON_CHAINING_JARS_CACHE ) return getNonChainingJarsCache ( ) ; else if ( cacheName == INVALID_ARCHIVES_CACHE ) return this . invalidArchives ; else return null ; } public void loadVariablesAndContainers ( ) throws CoreException { QualifiedName qName = new QualifiedName ( JavaCore . PLUGIN_ID , "<STR_LIT>" ) ; String xmlString = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getPersistentProperty ( qName ) ; try { if ( xmlString != null ) { StringReader reader = new StringReader ( xmlString ) ; Element cpElement ; try { DocumentBuilder parser = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) ; cpElement = parser . parse ( new InputSource ( reader ) ) . getDocumentElement ( ) ; } catch ( SAXException e ) { return ; } catch ( ParserConfigurationException e ) { return ; } finally { reader . close ( ) ; } if ( cpElement == null ) return ; if ( ! cpElement . getNodeName ( ) . equalsIgnoreCase ( "<STR_LIT>" ) ) { return ; } NodeList list = cpElement . getChildNodes ( ) ; int length = list . getLength ( ) ; for ( int i = <NUM_LIT:0> ; i < length ; ++ i ) { Node node = list . item ( i ) ; short type = node . getNodeType ( ) ; if ( type == Node . ELEMENT_NODE ) { Element element = ( Element ) node ; if ( element . getNodeName ( ) . equalsIgnoreCase ( "<STR_LIT>" ) ) { variablePut ( element . getAttribute ( "<STR_LIT:name>" ) , new Path ( element . getAttribute ( "<STR_LIT:path>" ) ) ) ; } } } } } catch ( IOException e ) { } finally { if ( xmlString != null ) { ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . setPersistentProperty ( qName , null ) ; } } loadVariablesAndContainers ( getDefaultPreferences ( ) ) ; loadVariablesAndContainers ( getInstancePreferences ( ) ) ; File file = getVariableAndContainersFile ( ) ; DataInputStream in = null ; try { in = new DataInputStream ( new BufferedInputStream ( new FileInputStream ( file ) ) ) ; switch ( in . readInt ( ) ) { case <NUM_LIT:2> : new VariablesAndContainersLoadHelper ( in ) . load ( ) ; break ; case <NUM_LIT:1> : int size = in . readInt ( ) ; while ( size -- > <NUM_LIT:0> ) { String varName = in . readUTF ( ) ; String pathString = in . readUTF ( ) ; if ( CP_ENTRY_IGNORE . equals ( pathString ) ) continue ; IPath varPath = Path . fromPortableString ( pathString ) ; this . variables . put ( varName , varPath ) ; this . previousSessionVariables . put ( varName , varPath ) ; } IJavaModel model = getJavaModel ( ) ; int projectSize = in . readInt ( ) ; while ( projectSize -- > <NUM_LIT:0> ) { String projectName = in . readUTF ( ) ; IJavaProject project = model . getJavaProject ( projectName ) ; int containerSize = in . readInt ( ) ; while ( containerSize -- > <NUM_LIT:0> ) { IPath containerPath = Path . fromPortableString ( in . readUTF ( ) ) ; int length = in . readInt ( ) ; byte [ ] containerString = new byte [ length ] ; in . readFully ( containerString ) ; recreatePersistedContainer ( project , containerPath , new String ( containerString ) , true ) ; } } break ; } } catch ( IOException e ) { if ( file . exists ( ) ) Util . log ( e , "<STR_LIT>" ) ; } catch ( RuntimeException e ) { if ( file . exists ( ) ) Util . log ( e , "<STR_LIT>" ) ; } finally { if ( in != null ) { try { in . close ( ) ; } catch ( IOException e ) { } } } String [ ] registeredVariables = getRegisteredVariableNames ( ) ; for ( int i = <NUM_LIT:0> ; i < registeredVariables . length ; i ++ ) { String varName = registeredVariables [ i ] ; this . variables . put ( varName , null ) ; } containersReset ( getRegisteredContainerIDs ( ) ) ; } private void loadVariablesAndContainers ( IEclipsePreferences preferences ) { try { String [ ] propertyNames = preferences . keys ( ) ; int variablePrefixLength = CP_VARIABLE_PREFERENCES_PREFIX . length ( ) ; for ( int i = <NUM_LIT:0> ; i < propertyNames . length ; i ++ ) { String propertyName = propertyNames [ i ] ; if ( propertyName . startsWith ( CP_VARIABLE_PREFERENCES_PREFIX ) ) { String varName = propertyName . substring ( variablePrefixLength ) ; String propertyValue = preferences . get ( propertyName , null ) ; if ( propertyValue != null ) { String pathString = propertyValue . trim ( ) ; if ( CP_ENTRY_IGNORE . equals ( pathString ) ) { preferences . remove ( propertyName ) ; continue ; } IPath varPath = new Path ( pathString ) ; this . variables . put ( varName , varPath ) ; this . previousSessionVariables . put ( varName , varPath ) ; } } else if ( propertyName . startsWith ( CP_CONTAINER_PREFERENCES_PREFIX ) ) { String propertyValue = preferences . get ( propertyName , null ) ; if ( propertyValue != null ) { preferences . remove ( propertyName ) ; recreatePersistedContainer ( propertyName , propertyValue , true ) ; } } } } catch ( BackingStoreException e1 ) { } } private static final class PersistedClasspathContainer implements IClasspathContainer { private final IPath containerPath ; private final IClasspathEntry [ ] entries ; private final IJavaProject project ; PersistedClasspathContainer ( IJavaProject project , IPath containerPath , IClasspathEntry [ ] entries ) { super ( ) ; this . containerPath = containerPath ; this . entries = entries ; this . project = project ; } public IClasspathEntry [ ] getClasspathEntries ( ) { return this . entries ; } public String getDescription ( ) { return "<STR_LIT>" + this . containerPath + "<STR_LIT>" + this . project . getElementName ( ) + "<STR_LIT>" ; } public int getKind ( ) { return <NUM_LIT:0> ; } public IPath getPath ( ) { return this . containerPath ; } public String toString ( ) { return getDescription ( ) ; } } private final class VariablesAndContainersLoadHelper { private static final int ARRAY_INCREMENT = <NUM_LIT> ; private IClasspathEntry [ ] allClasspathEntries ; private int allClasspathEntryCount ; private final Map allPaths ; private String [ ] allStrings ; private int allStringsCount ; private final DataInputStream in ; VariablesAndContainersLoadHelper ( DataInputStream in ) { super ( ) ; this . allClasspathEntries = null ; this . allClasspathEntryCount = <NUM_LIT:0> ; this . allPaths = new HashMap ( ) ; this . allStrings = null ; this . allStringsCount = <NUM_LIT:0> ; this . in = in ; } void load ( ) throws IOException { loadProjects ( getJavaModel ( ) ) ; loadVariables ( ) ; } private IAccessRule loadAccessRule ( ) throws IOException { int problemId = loadInt ( ) ; IPath pattern = loadPath ( ) ; return new ClasspathAccessRule ( pattern . toString ( ) . toCharArray ( ) , problemId ) ; } private IAccessRule [ ] loadAccessRules ( ) throws IOException { int count = loadInt ( ) ; if ( count == <NUM_LIT:0> ) return ClasspathEntry . NO_ACCESS_RULES ; IAccessRule [ ] rules = new IAccessRule [ count ] ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) rules [ i ] = loadAccessRule ( ) ; return rules ; } private IClasspathAttribute loadAttribute ( ) throws IOException { String name = loadString ( ) ; String value = loadString ( ) ; return new ClasspathAttribute ( name , value ) ; } private IClasspathAttribute [ ] loadAttributes ( ) throws IOException { int count = loadInt ( ) ; if ( count == <NUM_LIT:0> ) return ClasspathEntry . NO_EXTRA_ATTRIBUTES ; IClasspathAttribute [ ] attributes = new IClasspathAttribute [ count ] ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) attributes [ i ] = loadAttribute ( ) ; return attributes ; } private boolean loadBoolean ( ) throws IOException { return this . in . readBoolean ( ) ; } private IClasspathEntry [ ] loadClasspathEntries ( ) throws IOException { int count = loadInt ( ) ; IClasspathEntry [ ] entries = new IClasspathEntry [ count ] ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) entries [ i ] = loadClasspathEntry ( ) ; return entries ; } private IClasspathEntry loadClasspathEntry ( ) throws IOException { int id = loadInt ( ) ; if ( id < <NUM_LIT:0> || id > this . allClasspathEntryCount ) throw new IOException ( "<STR_LIT>" ) ; if ( id < this . allClasspathEntryCount ) return this . allClasspathEntries [ id ] ; int contentKind = loadInt ( ) ; int entryKind = loadInt ( ) ; IPath path = loadPath ( ) ; IPath [ ] inclusionPatterns = loadPaths ( ) ; IPath [ ] exclusionPatterns = loadPaths ( ) ; IPath sourceAttachmentPath = loadPath ( ) ; IPath sourceAttachmentRootPath = loadPath ( ) ; IPath specificOutputLocation = loadPath ( ) ; boolean isExported = loadBoolean ( ) ; IAccessRule [ ] accessRules = loadAccessRules ( ) ; boolean combineAccessRules = loadBoolean ( ) ; IClasspathAttribute [ ] extraAttributes = loadAttributes ( ) ; IClasspathEntry entry = new ClasspathEntry ( contentKind , entryKind , path , inclusionPatterns , exclusionPatterns , sourceAttachmentPath , sourceAttachmentRootPath , specificOutputLocation , isExported , accessRules , combineAccessRules , extraAttributes ) ; IClasspathEntry [ ] array = this . allClasspathEntries ; if ( array == null || id == array . length ) { array = new IClasspathEntry [ id + ARRAY_INCREMENT ] ; if ( id != <NUM_LIT:0> ) System . arraycopy ( this . allClasspathEntries , <NUM_LIT:0> , array , <NUM_LIT:0> , id ) ; this . allClasspathEntries = array ; } array [ id ] = entry ; this . allClasspathEntryCount = id + <NUM_LIT:1> ; return entry ; } private void loadContainers ( IJavaProject project ) throws IOException { boolean projectIsAccessible = project . getProject ( ) . isAccessible ( ) ; int count = loadInt ( ) ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) { IPath path = loadPath ( ) ; IClasspathEntry [ ] entries = loadClasspathEntries ( ) ; if ( ! projectIsAccessible ) continue ; IClasspathContainer container = new PersistedClasspathContainer ( project , path , entries ) ; containerPut ( project , path , container ) ; Map oldContainers = ( Map ) JavaModelManager . this . previousSessionContainers . get ( project ) ; if ( oldContainers == null ) { oldContainers = new HashMap ( ) ; JavaModelManager . this . previousSessionContainers . put ( project , oldContainers ) ; } oldContainers . put ( path , container ) ; } } private int loadInt ( ) throws IOException { return this . in . readInt ( ) ; } private IPath loadPath ( ) throws IOException { if ( loadBoolean ( ) ) return null ; String portableString = loadString ( ) ; IPath path = ( IPath ) this . allPaths . get ( portableString ) ; if ( path == null ) { path = Path . fromPortableString ( portableString ) ; this . allPaths . put ( portableString , path ) ; } return path ; } private IPath [ ] loadPaths ( ) throws IOException { int count = loadInt ( ) ; IPath [ ] pathArray = new IPath [ count ] ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) pathArray [ i ] = loadPath ( ) ; return pathArray ; } private void loadProjects ( IJavaModel model ) throws IOException { int count = loadInt ( ) ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) { String projectName = loadString ( ) ; loadContainers ( model . getJavaProject ( projectName ) ) ; } } private String loadString ( ) throws IOException { int id = loadInt ( ) ; if ( id < <NUM_LIT:0> || id > this . allStringsCount ) throw new IOException ( "<STR_LIT>" ) ; if ( id < this . allStringsCount ) return this . allStrings [ id ] ; String string = this . in . readUTF ( ) ; String [ ] array = this . allStrings ; if ( array == null || id == array . length ) { array = new String [ id + ARRAY_INCREMENT ] ; if ( id != <NUM_LIT:0> ) System . arraycopy ( this . allStrings , <NUM_LIT:0> , array , <NUM_LIT:0> , id ) ; this . allStrings = array ; } array [ id ] = string ; this . allStringsCount = id + <NUM_LIT:1> ; return string ; } private void loadVariables ( ) throws IOException { int size = loadInt ( ) ; Map loadedVars = new HashMap ( size ) ; for ( int i = <NUM_LIT:0> ; i < size ; ++ i ) { String varName = loadString ( ) ; IPath varPath = loadPath ( ) ; if ( varPath != null ) loadedVars . put ( varName , varPath ) ; } JavaModelManager . this . previousSessionVariables . putAll ( loadedVars ) ; JavaModelManager . this . variables . putAll ( loadedVars ) ; } } protected synchronized Object peekAtInfo ( IJavaElement element ) { HashMap tempCache = ( HashMap ) this . temporaryCache . get ( ) ; if ( tempCache != null ) { Object result = tempCache . get ( element ) ; if ( result != null ) { return result ; } } return this . cache . peekAtInfo ( element ) ; } public void prepareToSave ( ISaveContext context ) { } protected synchronized Object putInfos ( IJavaElement openedElement , Object newInfo , boolean forceAdd , Map newElements ) { Object existingInfo = this . cache . peekAtInfo ( openedElement ) ; if ( existingInfo != null && ! forceAdd ) { return existingInfo ; } if ( openedElement instanceof IParent ) { closeChildren ( existingInfo ) ; } for ( Iterator it = newElements . entrySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) it . next ( ) ; IJavaElement element = ( IJavaElement ) entry . getKey ( ) ; if ( element instanceof JarPackageFragmentRoot ) { Object info = entry . getValue ( ) ; it . remove ( ) ; this . cache . putInfo ( element , info ) ; } } Iterator iterator = newElements . entrySet ( ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) iterator . next ( ) ; this . cache . putInfo ( ( IJavaElement ) entry . getKey ( ) , entry . getValue ( ) ) ; } return newInfo ; } private void closeChildren ( Object info ) { if ( info instanceof JavaElementInfo ) { IJavaElement [ ] children = ( ( JavaElementInfo ) info ) . getChildren ( ) ; for ( int i = <NUM_LIT:0> , size = children . length ; i < size ; ++ i ) { JavaElement child = ( JavaElement ) children [ i ] ; try { child . close ( ) ; } catch ( JavaModelException e ) { } } } } protected synchronized void putJarTypeInfo ( IJavaElement type , Object info ) { this . cache . jarTypeCache . put ( type , info ) ; } protected Object readState ( IProject project ) throws CoreException { File file = getSerializationFile ( project ) ; if ( file != null && file . exists ( ) ) { try { DataInputStream in = new DataInputStream ( new BufferedInputStream ( new FileInputStream ( file ) ) ) ; try { String pluginID = in . readUTF ( ) ; if ( ! pluginID . equals ( JavaCore . PLUGIN_ID ) ) throw new IOException ( Messages . build_wrongFileFormat ) ; String kind = in . readUTF ( ) ; if ( ! kind . equals ( "<STR_LIT>" ) ) throw new IOException ( Messages . build_wrongFileFormat ) ; if ( in . readBoolean ( ) ) return JavaBuilder . readState ( project , in ) ; if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + project . getName ( ) ) ; } finally { in . close ( ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; throw new CoreException ( new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , Platform . PLUGIN_ERROR , "<STR_LIT>" + project . getName ( ) , e ) ) ; } } else if ( JavaBuilder . DEBUG ) { if ( file == null ) System . out . println ( "<STR_LIT>" + project ) ; else System . out . println ( "<STR_LIT>" + file . getPath ( ) + "<STR_LIT>" ) ; } return null ; } public static void recreatePersistedContainer ( String propertyName , String containerString , boolean addToContainerValues ) { int containerPrefixLength = CP_CONTAINER_PREFERENCES_PREFIX . length ( ) ; int index = propertyName . indexOf ( '<CHAR_LIT>' , containerPrefixLength ) ; if ( containerString != null ) containerString = containerString . trim ( ) ; if ( index > <NUM_LIT:0> ) { String projectName = propertyName . substring ( containerPrefixLength , index ) . trim ( ) ; IJavaProject project = getJavaModelManager ( ) . getJavaModel ( ) . getJavaProject ( projectName ) ; IPath containerPath = new Path ( propertyName . substring ( index + <NUM_LIT:1> ) . trim ( ) ) ; recreatePersistedContainer ( project , containerPath , containerString , addToContainerValues ) ; } } private static void recreatePersistedContainer ( final IJavaProject project , final IPath containerPath , String containerString , boolean addToContainerValues ) { if ( ! project . getProject ( ) . isAccessible ( ) ) return ; if ( containerString == null ) { getJavaModelManager ( ) . containerPut ( project , containerPath , null ) ; } else { IClasspathEntry [ ] entries ; try { entries = ( ( JavaProject ) project ) . decodeClasspath ( containerString , null ) [ <NUM_LIT:0> ] ; } catch ( IOException e ) { Util . log ( e , "<STR_LIT>" + containerString ) ; entries = JavaProject . INVALID_CLASSPATH ; } if ( entries != JavaProject . INVALID_CLASSPATH ) { final IClasspathEntry [ ] containerEntries = entries ; IClasspathContainer container = new IClasspathContainer ( ) { public IClasspathEntry [ ] getClasspathEntries ( ) { return containerEntries ; } public String getDescription ( ) { return "<STR_LIT>" + containerPath + "<STR_LIT>" + project . getElementName ( ) + "<STR_LIT:]>" ; } public int getKind ( ) { return <NUM_LIT:0> ; } public IPath getPath ( ) { return containerPath ; } public String toString ( ) { return getDescription ( ) ; } } ; if ( addToContainerValues ) { getJavaModelManager ( ) . containerPut ( project , containerPath , container ) ; } Map projectContainers = ( Map ) getJavaModelManager ( ) . previousSessionContainers . get ( project ) ; if ( projectContainers == null ) { projectContainers = new HashMap ( <NUM_LIT:1> ) ; getJavaModelManager ( ) . previousSessionContainers . put ( project , projectContainers ) ; } projectContainers . put ( containerPath , container ) ; } } } public void rememberScope ( AbstractSearchScope scope ) { this . searchScopes . put ( scope , null ) ; } public synchronized Object removeInfoAndChildren ( JavaElement element ) throws JavaModelException { Object info = this . cache . peekAtInfo ( element ) ; if ( info != null ) { boolean wasVerbose = false ; try { if ( JavaModelCache . VERBOSE ) { String elementType ; switch ( element . getElementType ( ) ) { case IJavaElement . JAVA_PROJECT : elementType = "<STR_LIT>" ; break ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : elementType = "<STR_LIT:root>" ; break ; case IJavaElement . PACKAGE_FRAGMENT : elementType = "<STR_LIT>" ; break ; case IJavaElement . CLASS_FILE : elementType = "<STR_LIT>" ; break ; case IJavaElement . COMPILATION_UNIT : elementType = "<STR_LIT>" ; break ; default : elementType = "<STR_LIT>" ; } System . out . println ( Thread . currentThread ( ) + "<STR_LIT>" + elementType + "<STR_LIT:U+0020>" + element . toStringWithAncestors ( ) ) ; wasVerbose = true ; JavaModelCache . VERBOSE = false ; } element . closing ( info ) ; if ( element instanceof IParent ) { closeChildren ( info ) ; } this . cache . removeInfo ( element ) ; if ( wasVerbose ) { System . out . println ( this . cache . toStringFillingRation ( "<STR_LIT>" ) ) ; } } finally { JavaModelCache . VERBOSE = wasVerbose ; } return info ; } return null ; } public void removePerProjectInfo ( JavaProject javaProject , boolean removeExtJarInfo ) { synchronized ( this . perProjectInfos ) { IProject project = javaProject . getProject ( ) ; PerProjectInfo info = ( PerProjectInfo ) this . perProjectInfos . get ( project ) ; if ( info != null ) { this . perProjectInfos . remove ( project ) ; if ( removeExtJarInfo ) { info . forgetExternalTimestampsAndIndexes ( ) ; } } } resetClasspathListCache ( ) ; } public void resetProjectOptions ( JavaProject javaProject ) { synchronized ( this . perProjectInfos ) { IProject project = javaProject . getProject ( ) ; PerProjectInfo info = ( PerProjectInfo ) this . perProjectInfos . get ( project ) ; if ( info != null ) { info . options = null ; } } } public void resetProjectPreferences ( JavaProject javaProject ) { synchronized ( this . perProjectInfos ) { IProject project = javaProject . getProject ( ) ; PerProjectInfo info = ( PerProjectInfo ) this . perProjectInfos . get ( project ) ; if ( info != null ) { info . preferences = null ; } } } public static final void doNotUse ( ) { MANAGER . deltaState . doNotUse ( ) ; MANAGER = new JavaModelManager ( ) ; } protected synchronized void resetJarTypeCache ( ) { this . cache . resetJarTypeCache ( ) ; } public void resetClasspathListCache ( ) { if ( this . nonChainingJars != null ) this . nonChainingJars . clear ( ) ; if ( this . invalidArchives != null ) this . invalidArchives . clear ( ) ; } public void resetTemporaryCache ( ) { this . temporaryCache . set ( null ) ; } public void rollback ( ISaveContext context ) { } private void saveState ( PerProjectInfo info , ISaveContext context ) throws CoreException { if ( context . getKind ( ) == ISaveContext . SNAPSHOT ) return ; if ( info . triedRead ) saveBuiltState ( info ) ; } private void saveBuiltState ( PerProjectInfo info ) throws CoreException { if ( JavaBuilder . DEBUG ) System . out . println ( Messages . bind ( Messages . build_saveStateProgress , info . project . getName ( ) ) ) ; File file = getSerializationFile ( info . project ) ; if ( file == null ) return ; long t = System . currentTimeMillis ( ) ; try { DataOutputStream out = new DataOutputStream ( new BufferedOutputStream ( new FileOutputStream ( file ) ) ) ; try { out . writeUTF ( JavaCore . PLUGIN_ID ) ; out . writeUTF ( "<STR_LIT>" ) ; if ( info . savedState == null ) { out . writeBoolean ( false ) ; } else { out . writeBoolean ( true ) ; JavaBuilder . writeState ( info . savedState , out ) ; } } finally { out . close ( ) ; } } catch ( RuntimeException e ) { try { file . delete ( ) ; } catch ( SecurityException se ) { } throw new CoreException ( new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , Platform . PLUGIN_ERROR , Messages . bind ( Messages . build_cannotSaveState , info . project . getName ( ) ) , e ) ) ; } catch ( IOException e ) { try { file . delete ( ) ; } catch ( SecurityException se ) { } throw new CoreException ( new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , Platform . PLUGIN_ERROR , Messages . bind ( Messages . build_cannotSaveState , info . project . getName ( ) ) , e ) ) ; } if ( JavaBuilder . DEBUG ) { t = System . currentTimeMillis ( ) - t ; System . out . println ( Messages . bind ( Messages . build_saveStateComplete , String . valueOf ( t ) ) ) ; } } private void saveClasspathListCache ( String cacheName ) throws CoreException { File file = getClasspathListFile ( cacheName ) ; DataOutputStream out = null ; try { out = new DataOutputStream ( new BufferedOutputStream ( new FileOutputStream ( file ) ) ) ; Set pathCache = getClasspathListCache ( cacheName ) ; synchronized ( pathCache ) { out . writeInt ( pathCache . size ( ) ) ; Iterator entries = pathCache . iterator ( ) ; while ( entries . hasNext ( ) ) { IPath path = ( IPath ) entries . next ( ) ; out . writeUTF ( path . toPortableString ( ) ) ; } } } catch ( IOException e ) { IStatus status = new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , IStatus . ERROR , "<STR_LIT>" , e ) ; throw new CoreException ( status ) ; } finally { if ( out != null ) { try { out . close ( ) ; } catch ( IOException e ) { } } } } private void saveVariablesAndContainers ( ISaveContext context ) throws CoreException { File file = getVariableAndContainersFile ( ) ; DataOutputStream out = null ; try { out = new DataOutputStream ( new BufferedOutputStream ( new FileOutputStream ( file ) ) ) ; out . writeInt ( VARIABLES_AND_CONTAINERS_FILE_VERSION ) ; new VariablesAndContainersSaveHelper ( out ) . save ( context ) ; } catch ( IOException e ) { IStatus status = new Status ( IStatus . ERROR , JavaCore . PLUGIN_ID , IStatus . ERROR , "<STR_LIT>" , e ) ; throw new CoreException ( status ) ; } finally { if ( out != null ) { try { out . close ( ) ; } catch ( IOException e ) { } } } } private final class VariablesAndContainersSaveHelper { private final HashtableOfObjectToInt classpathEntryIds ; private final DataOutputStream out ; private final HashtableOfObjectToInt stringIds ; VariablesAndContainersSaveHelper ( DataOutputStream out ) { super ( ) ; this . classpathEntryIds = new HashtableOfObjectToInt ( ) ; this . out = out ; this . stringIds = new HashtableOfObjectToInt ( ) ; } void save ( ISaveContext context ) throws IOException , JavaModelException { saveProjects ( getJavaModel ( ) . getJavaProjects ( ) ) ; HashMap varsToSave = null ; Iterator iterator = JavaModelManager . this . variables . entrySet ( ) . iterator ( ) ; IEclipsePreferences defaultPreferences = getDefaultPreferences ( ) ; while ( iterator . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) iterator . next ( ) ; String varName = ( String ) entry . getKey ( ) ; if ( defaultPreferences . get ( CP_VARIABLE_PREFERENCES_PREFIX + varName , null ) != null || CP_ENTRY_IGNORE_PATH . equals ( entry . getValue ( ) ) ) { if ( varsToSave == null ) varsToSave = new HashMap ( JavaModelManager . this . variables ) ; varsToSave . remove ( varName ) ; } } saveVariables ( varsToSave != null ? varsToSave : JavaModelManager . this . variables ) ; } private void saveAccessRule ( ClasspathAccessRule rule ) throws IOException { saveInt ( rule . problemId ) ; savePath ( rule . getPattern ( ) ) ; } private void saveAccessRules ( IAccessRule [ ] rules ) throws IOException { int count = rules == null ? <NUM_LIT:0> : rules . length ; saveInt ( count ) ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) saveAccessRule ( ( ClasspathAccessRule ) rules [ i ] ) ; } private void saveAttribute ( IClasspathAttribute attribute ) throws IOException { saveString ( attribute . getName ( ) ) ; saveString ( attribute . getValue ( ) ) ; } private void saveAttributes ( IClasspathAttribute [ ] attributes ) throws IOException { int count = attributes == null ? <NUM_LIT:0> : attributes . length ; saveInt ( count ) ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) saveAttribute ( attributes [ i ] ) ; } private void saveClasspathEntries ( IClasspathEntry [ ] entries ) throws IOException { int count = entries == null ? <NUM_LIT:0> : entries . length ; saveInt ( count ) ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) saveClasspathEntry ( entries [ i ] ) ; } private void saveClasspathEntry ( IClasspathEntry entry ) throws IOException { if ( saveNewId ( entry , this . classpathEntryIds ) ) { saveInt ( entry . getContentKind ( ) ) ; saveInt ( entry . getEntryKind ( ) ) ; savePath ( entry . getPath ( ) ) ; savePaths ( entry . getInclusionPatterns ( ) ) ; savePaths ( entry . getExclusionPatterns ( ) ) ; savePath ( entry . getSourceAttachmentPath ( ) ) ; savePath ( entry . getSourceAttachmentRootPath ( ) ) ; savePath ( entry . getOutputLocation ( ) ) ; this . out . writeBoolean ( entry . isExported ( ) ) ; saveAccessRules ( entry . getAccessRules ( ) ) ; this . out . writeBoolean ( entry . combineAccessRules ( ) ) ; saveAttributes ( entry . getExtraAttributes ( ) ) ; } } private void saveContainers ( IJavaProject project , Map containerMap ) throws IOException { saveInt ( containerMap . size ( ) ) ; for ( Iterator i = containerMap . entrySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Entry entry = ( Entry ) i . next ( ) ; IPath path = ( IPath ) entry . getKey ( ) ; IClasspathContainer container = ( IClasspathContainer ) entry . getValue ( ) ; IClasspathEntry [ ] cpEntries = null ; if ( container == null ) { container = getPreviousSessionContainer ( path , project ) ; } if ( container != null ) cpEntries = container . getClasspathEntries ( ) ; savePath ( path ) ; saveClasspathEntries ( cpEntries ) ; } } private void saveInt ( int value ) throws IOException { this . out . writeInt ( value ) ; } private boolean saveNewId ( Object key , HashtableOfObjectToInt map ) throws IOException { int id = map . get ( key ) ; if ( id == - <NUM_LIT:1> ) { int newId = map . size ( ) ; map . put ( key , newId ) ; saveInt ( newId ) ; return true ; } else { saveInt ( id ) ; return false ; } } private void savePath ( IPath path ) throws IOException { if ( path == null ) { this . out . writeBoolean ( true ) ; } else { this . out . writeBoolean ( false ) ; saveString ( path . toPortableString ( ) ) ; } } private void savePaths ( IPath [ ] paths ) throws IOException { int count = paths == null ? <NUM_LIT:0> : paths . length ; saveInt ( count ) ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) savePath ( paths [ i ] ) ; } private void saveProjects ( IJavaProject [ ] projects ) throws IOException , JavaModelException { int count = projects . length ; saveInt ( count ) ; for ( int i = <NUM_LIT:0> ; i < count ; ++ i ) { IJavaProject project = projects [ i ] ; saveString ( project . getElementName ( ) ) ; Map containerMap = ( Map ) JavaModelManager . this . containers . get ( project ) ; if ( containerMap == null ) { containerMap = Collections . EMPTY_MAP ; } else { containerMap = new HashMap ( containerMap ) ; } saveContainers ( project , containerMap ) ; } } private void saveString ( String string ) throws IOException { if ( saveNewId ( string , this . stringIds ) ) this . out . writeUTF ( string ) ; } private void saveVariables ( Map map ) throws IOException { saveInt ( map . size ( ) ) ; for ( Iterator i = map . entrySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Entry entry = ( Entry ) i . next ( ) ; String varName = ( String ) entry . getKey ( ) ; IPath varPath = ( IPath ) entry . getValue ( ) ; saveString ( varName ) ; savePath ( varPath ) ; } } } private void traceVariableAndContainers ( String action , long start ) { Long delta = new Long ( System . currentTimeMillis ( ) - start ) ; Long length = new Long ( getVariableAndContainersFile ( ) . length ( ) ) ; String pattern = "<STR_LIT>" ; String message = MessageFormat . format ( pattern , new Object [ ] { action , length , delta } ) ; System . out . println ( message ) ; } public void saving ( ISaveContext context ) throws CoreException { long start = - <NUM_LIT:1> ; if ( VERBOSE ) start = System . currentTimeMillis ( ) ; saveVariablesAndContainers ( context ) ; if ( VERBOSE ) traceVariableAndContainers ( "<STR_LIT>" , start ) ; switch ( context . getKind ( ) ) { case ISaveContext . FULL_SAVE : { saveClasspathListCache ( NON_CHAINING_JARS_CACHE ) ; saveClasspathListCache ( INVALID_ARCHIVES_CACHE ) ; context . needDelta ( ) ; IndexManager manager = this . indexManager ; if ( manager != null && this . workspaceScope != null ) { manager . cleanUpIndexes ( ) ; } } case ISaveContext . SNAPSHOT : { this . externalFoldersManager . cleanUp ( null ) ; } } IProject savedProject = context . getProject ( ) ; if ( savedProject != null ) { if ( ! JavaProject . hasJavaNature ( savedProject ) ) return ; PerProjectInfo info = getPerProjectInfo ( savedProject , true ) ; saveState ( info , context ) ; return ; } ArrayList vStats = null ; ArrayList values = null ; synchronized ( this . perProjectInfos ) { values = new ArrayList ( this . perProjectInfos . values ( ) ) ; } Iterator iterator = values . iterator ( ) ; while ( iterator . hasNext ( ) ) { try { PerProjectInfo info = ( PerProjectInfo ) iterator . next ( ) ; saveState ( info , context ) ; } catch ( CoreException e ) { if ( vStats == null ) vStats = new ArrayList ( ) ; vStats . add ( e . getStatus ( ) ) ; } } if ( vStats != null ) { IStatus [ ] stats = new IStatus [ vStats . size ( ) ] ; vStats . toArray ( stats ) ; throw new CoreException ( new MultiStatus ( JavaCore . PLUGIN_ID , IStatus . ERROR , stats , Messages . build_cannotSaveStates , null ) ) ; } this . deltaState . saveExternalLibTimeStamps ( ) ; } public void secondaryTypeAdding ( String path , char [ ] typeName , char [ ] packageName ) { if ( VERBOSE ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; buffer . append ( path ) ; buffer . append ( '<CHAR_LIT:U+002C>' ) ; buffer . append ( '<CHAR_LIT:[>' ) ; buffer . append ( new String ( packageName ) ) ; buffer . append ( '<CHAR_LIT:.>' ) ; buffer . append ( new String ( typeName ) ) ; buffer . append ( '<CHAR_LIT:]>' ) ; buffer . append ( '<CHAR_LIT:)>' ) ; Util . verbose ( buffer . toString ( ) ) ; } IWorkspaceRoot wRoot = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; IResource resource = wRoot . findMember ( path ) ; if ( resource != null ) { if ( org . eclipse . jdt . internal . core . util . Util . isJavaLikeFileName ( path ) && resource . getType ( ) == IResource . FILE ) { IProject project = resource . getProject ( ) ; try { PerProjectInfo projectInfo = getPerProjectInfoCheckExistence ( project ) ; HashMap indexedSecondaryTypes = null ; if ( projectInfo . secondaryTypes == null ) { projectInfo . secondaryTypes = new Hashtable ( <NUM_LIT:3> ) ; indexedSecondaryTypes = new HashMap ( <NUM_LIT:3> ) ; projectInfo . secondaryTypes . put ( INDEXED_SECONDARY_TYPES , indexedSecondaryTypes ) ; } else { indexedSecondaryTypes = ( HashMap ) projectInfo . secondaryTypes . get ( INDEXED_SECONDARY_TYPES ) ; if ( indexedSecondaryTypes == null ) { indexedSecondaryTypes = new HashMap ( <NUM_LIT:3> ) ; projectInfo . secondaryTypes . put ( INDEXED_SECONDARY_TYPES , indexedSecondaryTypes ) ; } } HashMap allTypes = ( HashMap ) indexedSecondaryTypes . get ( resource ) ; if ( allTypes == null ) { allTypes = new HashMap ( <NUM_LIT:3> ) ; indexedSecondaryTypes . put ( resource , allTypes ) ; } ICompilationUnit unit = JavaModelManager . createCompilationUnitFrom ( ( IFile ) resource , null ) ; if ( unit != null ) { String typeString = new String ( typeName ) ; IType type = unit . getType ( typeString ) ; String packageString = type . getPackageFragment ( ) . getElementName ( ) ; HashMap packageTypes = ( HashMap ) allTypes . get ( packageString ) ; if ( packageTypes == null ) { packageTypes = new HashMap ( <NUM_LIT:3> ) ; allTypes . put ( packageString , packageTypes ) ; } packageTypes . put ( typeString , type ) ; } if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" ) ; Iterator entries = indexedSecondaryTypes . entrySet ( ) . iterator ( ) ; while ( entries . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) entries . next ( ) ; IFile file = ( IFile ) entry . getKey ( ) ; Util . verbose ( "<STR_LIT>" + file . getFullPath ( ) + '<CHAR_LIT::>' + entry . getValue ( ) ) ; } } } catch ( JavaModelException jme ) { } } } } public Map secondaryTypes ( IJavaProject project , boolean waitForIndexes , IProgressMonitor monitor ) throws JavaModelException { if ( VERBOSE ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; buffer . append ( project . getElementName ( ) ) ; buffer . append ( '<CHAR_LIT:U+002C>' ) ; buffer . append ( waitForIndexes ) ; buffer . append ( '<CHAR_LIT:)>' ) ; Util . verbose ( buffer . toString ( ) ) ; } final PerProjectInfo projectInfo = getPerProjectInfoCheckExistence ( project . getProject ( ) ) ; Map indexingSecondaryCache = projectInfo . secondaryTypes == null ? null : ( Map ) projectInfo . secondaryTypes . get ( INDEXED_SECONDARY_TYPES ) ; if ( projectInfo . secondaryTypes != null && indexingSecondaryCache == null ) { return projectInfo . secondaryTypes ; } if ( projectInfo . secondaryTypes == null ) { return secondaryTypesSearching ( project , waitForIndexes , monitor , projectInfo ) ; } boolean indexing = this . indexManager . awaitingJobsCount ( ) > <NUM_LIT:0> ; if ( indexing ) { if ( ! waitForIndexes ) { return projectInfo . secondaryTypes ; } while ( this . indexManager . awaitingJobsCount ( ) > <NUM_LIT:0> ) { if ( monitor != null && monitor . isCanceled ( ) ) { return projectInfo . secondaryTypes ; } try { Thread . sleep ( <NUM_LIT:10> ) ; } catch ( InterruptedException e ) { return projectInfo . secondaryTypes ; } } } return secondaryTypesMerging ( projectInfo . secondaryTypes ) ; } private Hashtable secondaryTypesMerging ( Hashtable secondaryTypes ) { if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" ) ; Util . verbose ( "<STR_LIT>" ) ; Iterator entries = secondaryTypes . entrySet ( ) . iterator ( ) ; while ( entries . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) entries . next ( ) ; String packName = ( String ) entry . getKey ( ) ; Util . verbose ( "<STR_LIT>" + packName + '<CHAR_LIT::>' + entry . getValue ( ) ) ; } } HashMap indexedSecondaryTypes = ( HashMap ) secondaryTypes . remove ( INDEXED_SECONDARY_TYPES ) ; if ( indexedSecondaryTypes == null ) { return secondaryTypes ; } Iterator entries = indexedSecondaryTypes . entrySet ( ) . iterator ( ) ; while ( entries . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) entries . next ( ) ; IFile file = ( IFile ) entry . getKey ( ) ; secondaryTypesRemoving ( secondaryTypes , file ) ; HashMap fileSecondaryTypes = ( HashMap ) entry . getValue ( ) ; Iterator entries2 = fileSecondaryTypes . entrySet ( ) . iterator ( ) ; while ( entries2 . hasNext ( ) ) { Map . Entry entry2 = ( Map . Entry ) entries2 . next ( ) ; String packageName = ( String ) entry2 . getKey ( ) ; HashMap cachedTypes = ( HashMap ) secondaryTypes . get ( packageName ) ; if ( cachedTypes == null ) { secondaryTypes . put ( packageName , entry2 . getValue ( ) ) ; } else { HashMap types = ( HashMap ) entry2 . getValue ( ) ; Iterator entries3 = types . entrySet ( ) . iterator ( ) ; while ( entries3 . hasNext ( ) ) { Map . Entry entry3 = ( Map . Entry ) entries3 . next ( ) ; String typeName = ( String ) entry3 . getKey ( ) ; cachedTypes . put ( typeName , entry3 . getValue ( ) ) ; } } } } if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" ) ; entries = secondaryTypes . entrySet ( ) . iterator ( ) ; while ( entries . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) entries . next ( ) ; String packName = ( String ) entry . getKey ( ) ; Util . verbose ( "<STR_LIT>" + packName + '<CHAR_LIT::>' + entry . getValue ( ) ) ; } } return secondaryTypes ; } private Map secondaryTypesSearching ( IJavaProject project , boolean waitForIndexes , IProgressMonitor monitor , final PerProjectInfo projectInfo ) throws JavaModelException { if ( VERBOSE || BasicSearchEngine . VERBOSE ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; buffer . append ( project . getElementName ( ) ) ; buffer . append ( '<CHAR_LIT:U+002C>' ) ; buffer . append ( waitForIndexes ) ; buffer . append ( '<CHAR_LIT:)>' ) ; Util . verbose ( buffer . toString ( ) ) ; } final Hashtable secondaryTypes = new Hashtable ( <NUM_LIT:3> ) ; IRestrictedAccessTypeRequestor nameRequestor = new IRestrictedAccessTypeRequestor ( ) { public void acceptType ( int modifiers , char [ ] packageName , char [ ] simpleTypeName , char [ ] [ ] enclosingTypeNames , String path , AccessRestriction access ) { String key = packageName == null ? "<STR_LIT>" : new String ( packageName ) ; HashMap types = ( HashMap ) secondaryTypes . get ( key ) ; if ( types == null ) types = new HashMap ( <NUM_LIT:3> ) ; types . put ( new String ( simpleTypeName ) , path ) ; secondaryTypes . put ( key , types ) ; } } ; IPackageFragmentRoot [ ] allRoots = project . getAllPackageFragmentRoots ( ) ; int length = allRoots . length , size = <NUM_LIT:0> ; IPackageFragmentRoot [ ] allSourceFolders = new IPackageFragmentRoot [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( allRoots [ i ] . getKind ( ) == IPackageFragmentRoot . K_SOURCE ) { allSourceFolders [ size ++ ] = allRoots [ i ] ; } } if ( size < length ) { System . arraycopy ( allSourceFolders , <NUM_LIT:0> , allSourceFolders = new IPackageFragmentRoot [ size ] , <NUM_LIT:0> , size ) ; } new BasicSearchEngine ( ) . searchAllSecondaryTypeNames ( allSourceFolders , nameRequestor , waitForIndexes , monitor ) ; Iterator packages = secondaryTypes . values ( ) . iterator ( ) ; while ( packages . hasNext ( ) ) { HashMap types = ( HashMap ) packages . next ( ) ; Iterator names = types . entrySet ( ) . iterator ( ) ; while ( names . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) names . next ( ) ; String typeName = ( String ) entry . getKey ( ) ; String path = ( String ) entry . getValue ( ) ; if ( org . eclipse . jdt . internal . core . util . Util . isJavaLikeFileName ( path ) ) { IFile file = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getFile ( new Path ( path ) ) ; ICompilationUnit unit = JavaModelManager . createCompilationUnitFrom ( file , null ) ; IType type = unit . getType ( typeName ) ; types . put ( typeName , type ) ; } else { names . remove ( ) ; } } } if ( projectInfo . secondaryTypes == null || projectInfo . secondaryTypes . get ( INDEXED_SECONDARY_TYPES ) != null ) { projectInfo . secondaryTypes = secondaryTypes ; if ( VERBOSE || BasicSearchEngine . VERBOSE ) { System . out . print ( Thread . currentThread ( ) + "<STR_LIT>" ) ; System . out . println ( ) ; Iterator entries = secondaryTypes . entrySet ( ) . iterator ( ) ; while ( entries . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) entries . next ( ) ; String qualifiedName = ( String ) entry . getKey ( ) ; Util . verbose ( "<STR_LIT>" + qualifiedName + '<CHAR_LIT:->' + entry . getValue ( ) ) ; } } } return projectInfo . secondaryTypes ; } public void secondaryTypesRemoving ( IFile file , boolean cleanIndexCache ) { if ( VERBOSE ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; buffer . append ( file . getName ( ) ) ; buffer . append ( '<CHAR_LIT:)>' ) ; Util . verbose ( buffer . toString ( ) ) ; } if ( file != null ) { PerProjectInfo projectInfo = getPerProjectInfo ( file . getProject ( ) , false ) ; if ( projectInfo != null && projectInfo . secondaryTypes != null ) { if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" + file . getProject ( ) . getName ( ) ) ; } secondaryTypesRemoving ( projectInfo . secondaryTypes , file ) ; HashMap indexingCache = ( HashMap ) projectInfo . secondaryTypes . get ( INDEXED_SECONDARY_TYPES ) ; if ( ! cleanIndexCache ) { if ( indexingCache == null ) { projectInfo . secondaryTypes . put ( INDEXED_SECONDARY_TYPES , new HashMap ( ) ) ; } return ; } if ( indexingCache != null ) { Set keys = indexingCache . keySet ( ) ; int filesSize = keys . size ( ) , filesCount = <NUM_LIT:0> ; IFile [ ] removed = null ; Iterator cachedFiles = keys . iterator ( ) ; while ( cachedFiles . hasNext ( ) ) { IFile cachedFile = ( IFile ) cachedFiles . next ( ) ; if ( file . equals ( cachedFile ) ) { if ( removed == null ) removed = new IFile [ filesSize ] ; filesSize -- ; removed [ filesCount ++ ] = cachedFile ; } } if ( removed != null ) { for ( int i = <NUM_LIT:0> ; i < filesCount ; i ++ ) { indexingCache . remove ( removed [ i ] ) ; } } } } } } private void secondaryTypesRemoving ( Hashtable secondaryTypesMap , IFile file ) { if ( VERBOSE ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; Iterator entries = secondaryTypesMap . entrySet ( ) . iterator ( ) ; while ( entries . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) entries . next ( ) ; String qualifiedName = ( String ) entry . getKey ( ) ; buffer . append ( qualifiedName + '<CHAR_LIT::>' + entry . getValue ( ) ) ; } buffer . append ( '<CHAR_LIT:U+002C>' ) ; buffer . append ( file . getFullPath ( ) ) ; buffer . append ( '<CHAR_LIT:)>' ) ; Util . verbose ( buffer . toString ( ) ) ; } Set packageEntries = secondaryTypesMap . entrySet ( ) ; int packagesSize = packageEntries . size ( ) , removedPackagesCount = <NUM_LIT:0> ; String [ ] removedPackages = null ; Iterator packages = packageEntries . iterator ( ) ; while ( packages . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) packages . next ( ) ; String packName = ( String ) entry . getKey ( ) ; if ( packName != INDEXED_SECONDARY_TYPES ) { HashMap types = ( HashMap ) entry . getValue ( ) ; Set nameEntries = types . entrySet ( ) ; int namesSize = nameEntries . size ( ) , removedNamesCount = <NUM_LIT:0> ; String [ ] removedNames = null ; Iterator names = nameEntries . iterator ( ) ; while ( names . hasNext ( ) ) { Map . Entry entry2 = ( Map . Entry ) names . next ( ) ; String typeName = ( String ) entry2 . getKey ( ) ; JavaElement type = ( JavaElement ) entry2 . getValue ( ) ; if ( file . equals ( type . resource ( ) ) ) { if ( removedNames == null ) removedNames = new String [ namesSize ] ; namesSize -- ; removedNames [ removedNamesCount ++ ] = typeName ; } } if ( removedNames != null ) { for ( int i = <NUM_LIT:0> ; i < removedNamesCount ; i ++ ) { types . remove ( removedNames [ i ] ) ; } } if ( types . size ( ) == <NUM_LIT:0> ) { if ( removedPackages == null ) removedPackages = new String [ packagesSize ] ; packagesSize -- ; removedPackages [ removedPackagesCount ++ ] = packName ; } } } if ( removedPackages != null ) { for ( int i = <NUM_LIT:0> ; i < removedPackagesCount ; i ++ ) { secondaryTypesMap . remove ( removedPackages [ i ] ) ; } } if ( VERBOSE ) { Util . verbose ( "<STR_LIT>" ) ; Iterator entries = secondaryTypesMap . entrySet ( ) . iterator ( ) ; while ( entries . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) entries . next ( ) ; String qualifiedName = ( String ) entry . getKey ( ) ; Util . verbose ( "<STR_LIT>" + qualifiedName + '<CHAR_LIT::>' + entry . getValue ( ) ) ; } } } protected void setBuildOrder ( String [ ] javaBuildOrder ) throws JavaModelException { if ( ! JavaCore . COMPUTE . equals ( JavaCore . getOption ( JavaCore . CORE_JAVA_BUILD_ORDER ) ) ) return ; if ( javaBuildOrder == null || javaBuildOrder . length <= <NUM_LIT:1> ) return ; IWorkspace workspace = ResourcesPlugin . getWorkspace ( ) ; IWorkspaceDescription description = workspace . getDescription ( ) ; String [ ] wksBuildOrder = description . getBuildOrder ( ) ; String [ ] newOrder ; if ( wksBuildOrder == null ) { newOrder = javaBuildOrder ; } else { int javaCount = javaBuildOrder . length ; HashMap newSet = new HashMap ( javaCount ) ; for ( int i = <NUM_LIT:0> ; i < javaCount ; i ++ ) { newSet . put ( javaBuildOrder [ i ] , javaBuildOrder [ i ] ) ; } int removed = <NUM_LIT:0> ; int oldCount = wksBuildOrder . length ; for ( int i = <NUM_LIT:0> ; i < oldCount ; i ++ ) { if ( newSet . containsKey ( wksBuildOrder [ i ] ) ) { wksBuildOrder [ i ] = null ; removed ++ ; } } newOrder = new String [ oldCount - removed + javaCount ] ; System . arraycopy ( javaBuildOrder , <NUM_LIT:0> , newOrder , <NUM_LIT:0> , javaCount ) ; int index = javaCount ; for ( int i = <NUM_LIT:0> ; i < oldCount ; i ++ ) { if ( wksBuildOrder [ i ] != null ) { newOrder [ index ++ ] = wksBuildOrder [ i ] ; } } } description . setBuildOrder ( newOrder ) ; try { workspace . setDescription ( description ) ; } catch ( CoreException e ) { throw new JavaModelException ( e ) ; } } public void setLastBuiltState ( IProject project , Object state ) { if ( JavaProject . hasJavaNature ( project ) ) { PerProjectInfo info = getPerProjectInfo ( project , true ) ; info . triedRead = true ; info . savedState = state ; } if ( state == null ) { try { File file = getSerializationFile ( project ) ; if ( file != null && file . exists ( ) ) file . delete ( ) ; } catch ( SecurityException se ) { } } } public boolean storePreference ( String optionName , String optionValue , IEclipsePreferences eclipsePreferences , Map otherOptions ) { int optionLevel = this . getOptionLevel ( optionName ) ; if ( optionLevel == UNKNOWN_OPTION ) return false ; switch ( optionLevel ) { case JavaModelManager . VALID_OPTION : if ( optionValue == null ) { eclipsePreferences . remove ( optionName ) ; } else { eclipsePreferences . put ( optionName , optionValue ) ; } break ; case JavaModelManager . DEPRECATED_OPTION : eclipsePreferences . remove ( optionName ) ; String [ ] compatibleOptions = ( String [ ] ) this . deprecatedOptions . get ( optionName ) ; for ( int co = <NUM_LIT:0> , length = compatibleOptions . length ; co < length ; co ++ ) { if ( otherOptions != null && otherOptions . containsKey ( compatibleOptions [ co ] ) ) continue ; if ( optionValue == null ) { eclipsePreferences . remove ( compatibleOptions [ co ] ) ; } else { eclipsePreferences . put ( compatibleOptions [ co ] , optionValue ) ; } } break ; default : return false ; } return true ; } public void setOptions ( Hashtable newOptions ) { Hashtable cachedValue = newOptions == null ? null : new Hashtable ( newOptions ) ; IEclipsePreferences defaultPreferences = getDefaultPreferences ( ) ; IEclipsePreferences instancePreferences = getInstancePreferences ( ) ; if ( newOptions == null ) { try { instancePreferences . clear ( ) ; } catch ( BackingStoreException e ) { } } else { Enumeration keys = newOptions . keys ( ) ; while ( keys . hasMoreElements ( ) ) { String key = ( String ) keys . nextElement ( ) ; int optionLevel = getOptionLevel ( key ) ; if ( optionLevel == UNKNOWN_OPTION ) continue ; if ( key . equals ( JavaCore . CORE_ENCODING ) ) { if ( cachedValue != null ) { cachedValue . put ( key , JavaCore . getEncoding ( ) ) ; } continue ; } String value = ( String ) newOptions . get ( key ) ; String defaultValue = defaultPreferences . get ( key , null ) ; if ( defaultValue != null && defaultValue . equals ( value ) ) { value = null ; } storePreference ( key , value , instancePreferences , newOptions ) ; } try { instancePreferences . flush ( ) ; } catch ( BackingStoreException e ) { } } Util . fixTaskTags ( cachedValue ) ; this . optionsCache = cachedValue ; } public void startup ( ) throws CoreException { try { configurePluginDebugOptions ( ) ; this . cache = new JavaModelCache ( ) ; JavaCore . getPlugin ( ) . getStateLocation ( ) ; initializePreferences ( ) ; this . propertyListener = new IEclipsePreferences . IPreferenceChangeListener ( ) { public void preferenceChange ( PreferenceChangeEvent event ) { JavaModelManager . this . optionsCache = null ; } } ; InstanceScope . INSTANCE . getNode ( JavaCore . PLUGIN_ID ) . addPreferenceChangeListener ( this . propertyListener ) ; this . resourcesPropertyListener = new IEclipsePreferences . IPreferenceChangeListener ( ) { public void preferenceChange ( PreferenceChangeEvent event ) { if ( ResourcesPlugin . PREF_ENCODING . equals ( event . getKey ( ) ) ) { JavaModelManager . this . optionsCache = null ; } } } ; String resourcesPluginId = ResourcesPlugin . getPlugin ( ) . getBundle ( ) . getSymbolicName ( ) ; InstanceScope . INSTANCE . getNode ( resourcesPluginId ) . addPreferenceChangeListener ( this . resourcesPropertyListener ) ; Platform . getContentTypeManager ( ) . addContentTypeChangeListener ( this ) ; long start = - <NUM_LIT:1> ; if ( VERBOSE ) start = System . currentTimeMillis ( ) ; loadVariablesAndContainers ( ) ; if ( VERBOSE ) traceVariableAndContainers ( "<STR_LIT>" , start ) ; this . deltaState . initializeRootsWithPreviousSession ( ) ; final IWorkspace workspace = ResourcesPlugin . getWorkspace ( ) ; workspace . addResourceChangeListener ( this . deltaState , IResourceChangeEvent . PRE_BUILD | IResourceChangeEvent . POST_BUILD | IResourceChangeEvent . POST_CHANGE | IResourceChangeEvent . PRE_DELETE | IResourceChangeEvent . PRE_CLOSE | IResourceChangeEvent . PRE_REFRESH ) ; startIndexing ( ) ; Job processSavedState = new Job ( Messages . savedState_jobName ) { protected IStatus run ( IProgressMonitor monitor ) { try { workspace . run ( new IWorkspaceRunnable ( ) { public void run ( IProgressMonitor progress ) throws CoreException { ISavedState savedState = workspace . addSaveParticipant ( JavaCore . PLUGIN_ID , JavaModelManager . this ) ; if ( savedState != null ) { JavaModelManager . this . deltaState . getDeltaProcessor ( ) . overridenEventType = IResourceChangeEvent . POST_CHANGE ; savedState . processResourceChangeEvents ( JavaModelManager . this . deltaState ) ; } } } , monitor ) ; } catch ( CoreException e ) { return e . getStatus ( ) ; } return Status . OK_STATUS ; } } ; processSavedState . setSystem ( true ) ; processSavedState . setPriority ( Job . SHORT ) ; processSavedState . schedule ( ) ; } catch ( RuntimeException e ) { shutdown ( ) ; throw e ; } } private void startIndexing ( ) { if ( this . indexManager != null ) this . indexManager . reset ( ) ; } public void shutdown ( ) { IEclipsePreferences preferences = InstanceScope . INSTANCE . getNode ( JavaCore . PLUGIN_ID ) ; try { preferences . flush ( ) ; } catch ( BackingStoreException e ) { Util . log ( e , "<STR_LIT>" ) ; } IWorkspace workspace = ResourcesPlugin . getWorkspace ( ) ; workspace . removeResourceChangeListener ( this . deltaState ) ; workspace . removeSaveParticipant ( JavaCore . PLUGIN_ID ) ; Platform . getContentTypeManager ( ) . removeContentTypeChangeListener ( this ) ; if ( this . indexManager != null ) { this . indexManager . shutdown ( ) ; } preferences . removePreferenceChangeListener ( this . propertyListener ) ; ( ( IEclipsePreferences ) this . preferencesLookup [ PREF_DEFAULT ] . parent ( ) ) . removeNodeChangeListener ( this . defaultNodeListener ) ; this . preferencesLookup [ PREF_DEFAULT ] = null ; ( ( IEclipsePreferences ) this . preferencesLookup [ PREF_INSTANCE ] . parent ( ) ) . removeNodeChangeListener ( this . instanceNodeListener ) ; this . preferencesLookup [ PREF_INSTANCE ] . removePreferenceChangeListener ( this . instancePreferencesListener ) ; this . preferencesLookup [ PREF_INSTANCE ] = null ; String resourcesPluginId = ResourcesPlugin . getPlugin ( ) . getBundle ( ) . getSymbolicName ( ) ; InstanceScope . INSTANCE . getNode ( resourcesPluginId ) . removePreferenceChangeListener ( this . resourcesPropertyListener ) ; try { Job . getJobManager ( ) . join ( JavaCore . PLUGIN_ID , null ) ; } catch ( InterruptedException e ) { } } public synchronized IPath variableGet ( String variableName ) { HashSet initializations = variableInitializationInProgress ( ) ; if ( initializations . contains ( variableName ) ) { return VARIABLE_INITIALIZATION_IN_PROGRESS ; } return ( IPath ) this . variables . get ( variableName ) ; } private synchronized IPath variableGetDefaultToPreviousSession ( String variableName ) { IPath variablePath = ( IPath ) this . variables . get ( variableName ) ; if ( variablePath == null ) return getPreviousSessionVariable ( variableName ) ; return variablePath ; } private HashSet variableInitializationInProgress ( ) { HashSet initializations = ( HashSet ) this . variableInitializationInProgress . get ( ) ; if ( initializations == null ) { initializations = new HashSet ( ) ; this . variableInitializationInProgress . set ( initializations ) ; } return initializations ; } public synchronized String [ ] variableNames ( ) { int length = this . variables . size ( ) ; String [ ] result = new String [ length ] ; Iterator vars = this . variables . keySet ( ) . iterator ( ) ; int index = <NUM_LIT:0> ; while ( vars . hasNext ( ) ) { result [ index ++ ] = ( String ) vars . next ( ) ; } return result ; } public synchronized void variablePut ( String variableName , IPath variablePath ) { HashSet initializations = variableInitializationInProgress ( ) ; if ( variablePath == VARIABLE_INITIALIZATION_IN_PROGRESS ) { initializations . add ( variableName ) ; return ; } else { initializations . remove ( variableName ) ; if ( variablePath == null ) { this . variables . put ( variableName , CP_ENTRY_IGNORE_PATH ) ; this . variablesWithInitializer . remove ( variableName ) ; this . deprecatedVariables . remove ( variableName ) ; } else { this . variables . put ( variableName , variablePath ) ; } this . previousSessionVariables . remove ( variableName ) ; } } public void variablePreferencesPut ( String variableName , IPath variablePath ) { String variableKey = CP_VARIABLE_PREFERENCES_PREFIX + variableName ; if ( variablePath == null ) { getInstancePreferences ( ) . remove ( variableKey ) ; } else { getInstancePreferences ( ) . put ( variableKey , variablePath . toString ( ) ) ; } try { getInstancePreferences ( ) . flush ( ) ; } catch ( BackingStoreException e ) { } } public boolean variablePutIfInitializingWithSameValue ( String [ ] variableNames , IPath [ ] variablePaths ) { if ( variableNames . length != <NUM_LIT:1> ) return false ; String variableName = variableNames [ <NUM_LIT:0> ] ; IPath oldPath = variableGetDefaultToPreviousSession ( variableName ) ; if ( oldPath == null ) return false ; IPath newPath = variablePaths [ <NUM_LIT:0> ] ; if ( ! oldPath . equals ( newPath ) ) return false ; variablePut ( variableName , newPath ) ; return true ; } public void contentTypeChanged ( ContentTypeChangeEvent event ) { Util . resetJavaLikeExtensions ( ) ; IJavaProject [ ] projects ; try { projects = JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) . getJavaProjects ( ) ; } catch ( JavaModelException e ) { return ; } for ( int i = <NUM_LIT:0> , length = projects . length ; i < length ; i ++ ) { IJavaProject project = projects [ i ] ; final PerProjectInfo projectInfo = getPerProjectInfo ( project . getProject ( ) , false ) ; if ( projectInfo != null ) { projectInfo . secondaryTypes = null ; } } } public synchronized String cacheToString ( String prefix ) { return this . cache . toStringFillingRation ( prefix ) ; } public Stats debugNewOpenableCacheStats ( ) { return this . cache . openableCache . new Stats ( ) ; } public int getOpenableCacheSize ( ) { return this . cache . openableCache . getSpaceLimit ( ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . Signature ; import org . eclipse . jdt . internal . compiler . env . ISourceField ; public class SourceFieldElementInfo extends AnnotatableInfo implements ISourceField { protected char [ ] typeName ; protected char [ ] initializationSource ; public char [ ] getInitializationSource ( ) { return this . initializationSource ; } public char [ ] getTypeName ( ) { return this . typeName ; } protected String getTypeSignature ( ) { return Signature . createTypeSignature ( this . typeName , false ) ; } protected void setTypeName ( char [ ] typeName ) { this . typeName = typeName ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import java . util . * ; import org . codehaus . jdt . groovy . integration . LanguageSupportFactory ; import org . eclipse . core . resources . * ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . Path ; import org . eclipse . core . runtime . jobs . ISchedulingRule ; import org . eclipse . core . runtime . jobs . MultiRule ; import org . eclipse . jdt . core . * ; 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 . AbstractTypeDeclaration ; import org . eclipse . jdt . core . dom . CompilationUnit ; import org . eclipse . jdt . core . dom . Javadoc ; import org . eclipse . jdt . core . dom . MethodDeclaration ; import org . eclipse . jdt . core . dom . Name ; import org . eclipse . jdt . core . dom . PackageDeclaration ; import org . eclipse . jdt . core . dom . SimpleName ; import org . eclipse . jdt . core . dom . rewrite . ASTRewrite ; 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 org . eclipse . text . edits . DeleteEdit ; import org . eclipse . text . edits . InsertEdit ; import org . eclipse . text . edits . MultiTextEdit ; import org . eclipse . text . edits . ReplaceEdit ; import org . eclipse . text . edits . TextEdit ; public class CopyResourceElementsOperation extends MultiOperation implements SuffixConstants { protected ArrayList createdElements ; protected Map deltasPerProject = new HashMap ( <NUM_LIT:1> ) ; protected ASTParser parser ; public CopyResourceElementsOperation ( IJavaElement [ ] resourcesToCopy , IJavaElement [ ] destContainers , boolean force ) { super ( resourcesToCopy , destContainers , force ) ; initializeASTParser ( ) ; } private void initializeASTParser ( ) { this . parser = ASTParser . newParser ( AST . JLS4 ) ; } private IResource [ ] collectResourcesOfInterest ( IPackageFragment source ) throws JavaModelException { IJavaElement [ ] children = source . getChildren ( ) ; int childOfInterest = IJavaElement . COMPILATION_UNIT ; if ( source . getKind ( ) == IPackageFragmentRoot . K_BINARY ) { childOfInterest = IJavaElement . CLASS_FILE ; } ArrayList correctKindChildren = new ArrayList ( children . length ) ; for ( int i = <NUM_LIT:0> ; i < children . length ; i ++ ) { IJavaElement child = children [ i ] ; if ( child . getElementType ( ) == childOfInterest ) { correctKindChildren . add ( ( ( JavaElement ) child ) . resource ( ) ) ; } } Object [ ] nonJavaResources = source . getNonJavaResources ( ) ; int actualNonJavaResourceCount = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> , max = nonJavaResources . length ; i < max ; i ++ ) { if ( nonJavaResources [ i ] instanceof IResource ) actualNonJavaResourceCount ++ ; } IResource [ ] actualNonJavaResources = new IResource [ actualNonJavaResourceCount ] ; for ( int i = <NUM_LIT:0> , max = nonJavaResources . length , index = <NUM_LIT:0> ; i < max ; i ++ ) { if ( nonJavaResources [ i ] instanceof IResource ) actualNonJavaResources [ index ++ ] = ( IResource ) nonJavaResources [ i ] ; } if ( actualNonJavaResourceCount != <NUM_LIT:0> ) { int correctKindChildrenSize = correctKindChildren . size ( ) ; IResource [ ] result = new IResource [ correctKindChildrenSize + actualNonJavaResourceCount ] ; correctKindChildren . toArray ( result ) ; System . arraycopy ( actualNonJavaResources , <NUM_LIT:0> , result , correctKindChildrenSize , actualNonJavaResourceCount ) ; return result ; } else { IResource [ ] result = new IResource [ correctKindChildren . size ( ) ] ; correctKindChildren . toArray ( result ) ; return result ; } } private boolean createNeededPackageFragments ( IContainer sourceFolder , PackageFragmentRoot root , String [ ] newFragName , boolean moveFolder ) throws JavaModelException { boolean containsReadOnlyPackageFragment = false ; IContainer parentFolder = ( IContainer ) root . resource ( ) ; JavaElementDelta projectDelta = null ; String [ ] sideEffectPackageName = null ; char [ ] [ ] inclusionPatterns = root . fullInclusionPatternChars ( ) ; char [ ] [ ] exclusionPatterns = root . fullExclusionPatternChars ( ) ; for ( int i = <NUM_LIT:0> ; i < newFragName . length ; i ++ ) { String subFolderName = newFragName [ i ] ; sideEffectPackageName = Util . arrayConcat ( sideEffectPackageName , subFolderName ) ; IResource subFolder = parentFolder . findMember ( subFolderName ) ; if ( subFolder == null ) { if ( ! ( moveFolder && i == newFragName . length - <NUM_LIT:1> ) ) { createFolder ( parentFolder , subFolderName , this . force ) ; } parentFolder = parentFolder . getFolder ( new Path ( subFolderName ) ) ; sourceFolder = sourceFolder . getFolder ( new Path ( subFolderName ) ) ; if ( Util . isReadOnly ( sourceFolder ) ) { containsReadOnlyPackageFragment = true ; } IPackageFragment sideEffectPackage = root . getPackageFragment ( sideEffectPackageName ) ; if ( i < newFragName . length - <NUM_LIT:1> && ! Util . isExcluded ( parentFolder , inclusionPatterns , exclusionPatterns ) ) { if ( projectDelta == null ) { projectDelta = getDeltaFor ( root . getJavaProject ( ) ) ; } projectDelta . added ( sideEffectPackage ) ; } this . createdElements . add ( sideEffectPackage ) ; } else { parentFolder = ( IContainer ) subFolder ; } } return containsReadOnlyPackageFragment ; } private JavaElementDelta getDeltaFor ( IJavaProject javaProject ) { JavaElementDelta delta = ( JavaElementDelta ) this . deltasPerProject . get ( javaProject ) ; if ( delta == null ) { delta = new JavaElementDelta ( javaProject ) ; this . deltasPerProject . put ( javaProject , delta ) ; } return delta ; } protected String getMainTaskName ( ) { return Messages . operation_copyResourceProgress ; } protected ISchedulingRule getSchedulingRule ( ) { if ( this . elementsToProcess == null ) return null ; int length = this . elementsToProcess . length ; if ( length == <NUM_LIT:1> ) return getSchedulingRule ( this . elementsToProcess [ <NUM_LIT:0> ] ) ; ISchedulingRule [ ] rules = new ISchedulingRule [ length ] ; int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { ISchedulingRule rule = getSchedulingRule ( this . elementsToProcess [ i ] ) ; if ( rule != null ) { rules [ index ++ ] = rule ; } } if ( index != length ) System . arraycopy ( rules , <NUM_LIT:0> , rules = new ISchedulingRule [ index ] , <NUM_LIT:0> , index ) ; return new MultiRule ( rules ) ; } private ISchedulingRule getSchedulingRule ( IJavaElement element ) { if ( element == null ) return null ; IResource sourceResource = getResource ( element ) ; IResource destContainer = getResource ( getDestinationParent ( element ) ) ; if ( ! ( destContainer instanceof IContainer ) ) { return null ; } String newName ; try { newName = getNewNameFor ( element ) ; } catch ( JavaModelException e ) { return null ; } if ( newName == null ) newName = element . getElementName ( ) ; IResource destResource ; String sourceEncoding = null ; if ( sourceResource . getType ( ) == IResource . FILE ) { destResource = ( ( IContainer ) destContainer ) . getFile ( new Path ( newName ) ) ; try { sourceEncoding = ( ( IFile ) sourceResource ) . getCharset ( false ) ; } catch ( CoreException ce ) { } } else { destResource = ( ( IContainer ) destContainer ) . getFolder ( new Path ( newName ) ) ; } IResourceRuleFactory factory = ResourcesPlugin . getWorkspace ( ) . getRuleFactory ( ) ; ISchedulingRule rule ; if ( isMove ( ) ) { rule = factory . moveRule ( sourceResource , destResource ) ; } else { rule = factory . copyRule ( sourceResource , destResource ) ; } if ( sourceEncoding != null ) { rule = new MultiRule ( new ISchedulingRule [ ] { rule , factory . charsetRule ( destResource ) } ) ; } return rule ; } private IResource getResource ( IJavaElement element ) { if ( element == null ) return null ; if ( element . getElementType ( ) == IJavaElement . PACKAGE_FRAGMENT ) { String pkgName = element . getElementName ( ) ; int firstDot = pkgName . indexOf ( '<CHAR_LIT:.>' ) ; if ( firstDot != - <NUM_LIT:1> ) { element = ( ( IPackageFragmentRoot ) element . getParent ( ) ) . getPackageFragment ( pkgName . substring ( <NUM_LIT:0> , firstDot ) ) ; } } return element . getResource ( ) ; } protected void prepareDeltas ( IJavaElement sourceElement , IJavaElement destinationElement , boolean isMove , boolean overWriteCU ) { if ( Util . isExcluded ( sourceElement ) || Util . isExcluded ( destinationElement ) ) return ; IJavaProject destProject = destinationElement . getJavaProject ( ) ; if ( isMove ) { IJavaProject sourceProject = sourceElement . getJavaProject ( ) ; getDeltaFor ( sourceProject ) . movedFrom ( sourceElement , destinationElement ) ; if ( ! overWriteCU ) { getDeltaFor ( destProject ) . movedTo ( destinationElement , sourceElement ) ; return ; } } else { if ( ! overWriteCU ) { getDeltaFor ( destProject ) . added ( destinationElement ) ; return ; } } getDeltaFor ( destinationElement . getJavaProject ( ) ) . changed ( destinationElement , IJavaElementDelta . F_CONTENT ) ; } private void processCompilationUnitResource ( ICompilationUnit source , PackageFragment dest ) throws JavaModelException { String newCUName = getNewNameFor ( source ) ; String destName = ( newCUName != null ) ? newCUName : source . getElementName ( ) ; TextEdit edit = updateContent ( source , dest , newCUName ) ; IFile sourceResource = ( IFile ) source . getResource ( ) ; String sourceEncoding = null ; try { sourceEncoding = sourceResource . getCharset ( false ) ; } catch ( CoreException ce ) { } IContainer destFolder = ( IContainer ) dest . getResource ( ) ; IFile destFile = destFolder . getFile ( new Path ( destName ) ) ; org . eclipse . jdt . internal . core . CompilationUnit destCU = LanguageSupportFactory . newCompilationUnit ( dest , destName , DefaultWorkingCopyOwner . PRIMARY ) ; if ( ! destFile . equals ( sourceResource ) ) { try { if ( ! destCU . isWorkingCopy ( ) ) { if ( destFile . exists ( ) ) { if ( this . force ) { deleteResource ( destFile , IResource . KEEP_HISTORY ) ; destCU . close ( ) ; } else { throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . NAME_COLLISION , Messages . bind ( Messages . status_nameCollision , destFile . getFullPath ( ) . toString ( ) ) ) ) ; } } int flags = this . force ? IResource . FORCE : IResource . NONE ; if ( isMove ( ) ) { flags |= IResource . KEEP_HISTORY ; sourceResource . move ( destFile . getFullPath ( ) , flags , getSubProgressMonitor ( <NUM_LIT:1> ) ) ; } else { if ( edit != null ) flags |= IResource . KEEP_HISTORY ; sourceResource . copy ( destFile . getFullPath ( ) , flags , getSubProgressMonitor ( <NUM_LIT:1> ) ) ; } setAttribute ( HAS_MODIFIED_RESOURCE_ATTR , TRUE ) ; } else { destCU . getBuffer ( ) . setContents ( source . getBuffer ( ) . getContents ( ) ) ; } } catch ( JavaModelException e ) { throw e ; } catch ( CoreException e ) { throw new JavaModelException ( e ) ; } if ( edit != null ) { boolean wasReadOnly = destFile . isReadOnly ( ) ; try { saveContent ( dest , destName , edit , sourceEncoding , destFile ) ; } catch ( CoreException e ) { if ( e instanceof JavaModelException ) throw ( JavaModelException ) e ; throw new JavaModelException ( e ) ; } finally { Util . setReadOnly ( destFile , wasReadOnly ) ; } } boolean contentChanged = this . force && destFile . exists ( ) ; prepareDeltas ( source , destCU , isMove ( ) , contentChanged ) ; if ( newCUName != null ) { String oldName = Util . getNameWithoutJavaLikeExtension ( source . getElementName ( ) ) ; String newName = Util . getNameWithoutJavaLikeExtension ( newCUName ) ; prepareDeltas ( source . getType ( oldName ) , destCU . getType ( newName ) , isMove ( ) , false ) ; } } else { if ( ! this . force ) { throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . NAME_COLLISION , Messages . bind ( Messages . status_nameCollision , destFile . getFullPath ( ) . toString ( ) ) ) ) ; } if ( edit != null ) { saveContent ( dest , destName , edit , sourceEncoding , destFile ) ; } } } protected void processDeltas ( ) { for ( Iterator deltas = this . deltasPerProject . values ( ) . iterator ( ) ; deltas . hasNext ( ) ; ) { addDelta ( ( IJavaElementDelta ) deltas . next ( ) ) ; } } protected void processElement ( IJavaElement element ) throws JavaModelException { IJavaElement dest = getDestinationParent ( element ) ; switch ( element . getElementType ( ) ) { case IJavaElement . COMPILATION_UNIT : processCompilationUnitResource ( ( ICompilationUnit ) element , ( PackageFragment ) dest ) ; this . createdElements . add ( ( ( IPackageFragment ) dest ) . getCompilationUnit ( element . getElementName ( ) ) ) ; break ; case IJavaElement . PACKAGE_FRAGMENT : processPackageFragmentResource ( ( PackageFragment ) element , ( PackageFragmentRoot ) dest , getNewNameFor ( element ) ) ; break ; default : throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . INVALID_ELEMENT_TYPES , element ) ) ; } } protected void processElements ( ) throws JavaModelException { this . createdElements = new ArrayList ( this . elementsToProcess . length ) ; try { super . processElements ( ) ; } catch ( JavaModelException jme ) { throw jme ; } finally { this . resultElements = new IJavaElement [ this . createdElements . size ( ) ] ; this . createdElements . toArray ( this . resultElements ) ; processDeltas ( ) ; } } private void processPackageFragmentResource ( PackageFragment source , PackageFragmentRoot root , String newName ) throws JavaModelException { try { String [ ] newFragName = ( newName == null ) ? source . names : Util . getTrimmedSimpleNames ( newName ) ; PackageFragment newFrag = root . getPackageFragment ( newFragName ) ; IResource [ ] resources = collectResourcesOfInterest ( source ) ; boolean shouldMoveFolder = isMove ( ) && ! newFrag . resource ( ) . exists ( ) ; IFolder srcFolder = ( IFolder ) source . resource ( ) ; IPath destPath = newFrag . getPath ( ) ; if ( shouldMoveFolder ) { if ( srcFolder . getFullPath ( ) . isPrefixOf ( destPath ) ) { shouldMoveFolder = false ; } else { IResource [ ] members = srcFolder . members ( ) ; for ( int i = <NUM_LIT:0> ; i < members . length ; i ++ ) { if ( members [ i ] instanceof IFolder ) { shouldMoveFolder = false ; break ; } } } } boolean containsReadOnlySubPackageFragments = createNeededPackageFragments ( ( IContainer ) source . parent . resource ( ) , root , newFragName , shouldMoveFolder ) ; boolean sourceIsReadOnly = Util . isReadOnly ( srcFolder ) ; if ( shouldMoveFolder ) { if ( sourceIsReadOnly ) { Util . setReadOnly ( srcFolder , false ) ; } srcFolder . move ( destPath , this . force , true , getSubProgressMonitor ( <NUM_LIT:1> ) ) ; if ( sourceIsReadOnly ) { Util . setReadOnly ( srcFolder , true ) ; } setAttribute ( HAS_MODIFIED_RESOURCE_ATTR , TRUE ) ; } else { if ( resources . length > <NUM_LIT:0> ) { if ( isRename ( ) ) { if ( ! destPath . equals ( source . getPath ( ) ) ) { moveResources ( resources , destPath ) ; } } else if ( isMove ( ) ) { for ( int i = <NUM_LIT:0> , max = resources . length ; i < max ; i ++ ) { IResource destinationResource = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . findMember ( destPath . append ( resources [ i ] . getName ( ) ) ) ; if ( destinationResource != null ) { if ( this . force ) { deleteResource ( destinationResource , IResource . KEEP_HISTORY ) ; } else { throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . NAME_COLLISION , Messages . bind ( Messages . status_nameCollision , destinationResource . getFullPath ( ) . toString ( ) ) ) ) ; } } } moveResources ( resources , destPath ) ; } else { for ( int i = <NUM_LIT:0> , max = resources . length ; i < max ; i ++ ) { IResource destinationResource = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . findMember ( destPath . append ( resources [ i ] . getName ( ) ) ) ; if ( destinationResource != null ) { if ( this . force ) { deleteResource ( destinationResource , IResource . KEEP_HISTORY ) ; } else { throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . NAME_COLLISION , Messages . bind ( Messages . status_nameCollision , destinationResource . getFullPath ( ) . toString ( ) ) ) ) ; } } } copyResources ( resources , destPath ) ; } } } if ( ! Util . equalArraysOrNull ( newFragName , source . names ) ) { char [ ] [ ] inclusionPatterns = root . fullInclusionPatternChars ( ) ; char [ ] [ ] exclusionPatterns = root . fullExclusionPatternChars ( ) ; for ( int i = <NUM_LIT:0> ; i < resources . length ; i ++ ) { String resourceName = resources [ i ] . getName ( ) ; if ( Util . isJavaLikeFileName ( resourceName ) ) { ICompilationUnit cu = newFrag . getCompilationUnit ( resourceName ) ; if ( Util . isExcluded ( cu . getPath ( ) , inclusionPatterns , exclusionPatterns , false ) ) continue ; this . parser . setSource ( cu ) ; CompilationUnit astCU = ( CompilationUnit ) this . parser . createAST ( this . progressMonitor ) ; AST ast = astCU . getAST ( ) ; ASTRewrite rewrite = ASTRewrite . create ( ast ) ; updatePackageStatement ( astCU , newFragName , rewrite , cu ) ; TextEdit edits = rewrite . rewriteAST ( ) ; applyTextEdit ( cu , edits ) ; cu . save ( null , false ) ; } } } boolean isEmpty = true ; if ( isMove ( ) ) { updateReadOnlyPackageFragmentsForMove ( ( IContainer ) source . parent . resource ( ) , root , newFragName , sourceIsReadOnly ) ; if ( srcFolder . exists ( ) ) { IResource [ ] remaining = srcFolder . members ( ) ; for ( int i = <NUM_LIT:0> , length = remaining . length ; i < length ; i ++ ) { IResource file = remaining [ i ] ; if ( file instanceof IFile ) { if ( Util . isReadOnly ( file ) ) { Util . setReadOnly ( file , false ) ; } deleteResource ( file , IResource . FORCE | IResource . KEEP_HISTORY ) ; } else { isEmpty = false ; } } } if ( isEmpty ) { IResource rootResource ; if ( destPath . isPrefixOf ( srcFolder . getFullPath ( ) ) ) { rootResource = newFrag . resource ( ) ; } else { rootResource = source . parent . resource ( ) ; } deleteEmptyPackageFragment ( source , false , rootResource ) ; } } else if ( containsReadOnlySubPackageFragments ) { updateReadOnlyPackageFragmentsForCopy ( ( IContainer ) source . parent . resource ( ) , root , newFragName ) ; } if ( isEmpty && isMove ( ) && ! ( Util . isExcluded ( source ) || Util . isExcluded ( newFrag ) ) ) { IJavaProject sourceProject = source . getJavaProject ( ) ; getDeltaFor ( sourceProject ) . movedFrom ( source , newFrag ) ; IJavaProject destProject = newFrag . getJavaProject ( ) ; getDeltaFor ( destProject ) . movedTo ( newFrag , source ) ; } } catch ( JavaModelException e ) { throw e ; } catch ( CoreException ce ) { throw new JavaModelException ( ce ) ; } } private void saveContent ( PackageFragment dest , String destName , TextEdit edits , String sourceEncoding , IFile destFile ) throws JavaModelException { try { if ( sourceEncoding != null ) destFile . setCharset ( sourceEncoding , this . progressMonitor ) ; } catch ( CoreException ce ) { } Util . setReadOnly ( destFile , false ) ; ICompilationUnit destCU = dest . getCompilationUnit ( destName ) ; applyTextEdit ( destCU , edits ) ; destCU . save ( getSubProgressMonitor ( <NUM_LIT:1> ) , this . force ) ; } private TextEdit updateContent ( ICompilationUnit cu , PackageFragment dest , String newName ) throws JavaModelException { String [ ] currPackageName = ( ( PackageFragment ) cu . getParent ( ) ) . names ; String [ ] destPackageName = dest . names ; if ( Util . equalArraysOrNull ( currPackageName , destPackageName ) && newName == null ) { return null ; } else { cu . makeConsistent ( this . progressMonitor ) ; if ( LanguageSupportFactory . isInterestingSourceFile ( cu . getElementName ( ) ) ) { return updateNonJavaContent ( cu , destPackageName , currPackageName , newName ) ; } this . parser . setSource ( cu ) ; CompilationUnit astCU = ( CompilationUnit ) this . parser . createAST ( this . progressMonitor ) ; AST ast = astCU . getAST ( ) ; ASTRewrite rewrite = ASTRewrite . create ( ast ) ; updateTypeName ( cu , astCU , cu . getElementName ( ) , newName , rewrite ) ; updatePackageStatement ( astCU , destPackageName , rewrite , cu ) ; return rewrite . rewriteAST ( ) ; } } private TextEdit updateNonJavaContent ( ICompilationUnit cu , String [ ] destPackageName , String [ ] currPackageName , String newName ) throws JavaModelException { IPackageDeclaration [ ] packageDecls = cu . getPackageDeclarations ( ) ; boolean doPackage = ! Util . equalArraysOrNull ( currPackageName , destPackageName ) ; boolean doName = newName != null ; MultiTextEdit multiEdit = new MultiTextEdit ( ) ; if ( doPackage ) { if ( packageDecls . length == <NUM_LIT:1> ) { ISourceRange packageRange = packageDecls [ <NUM_LIT:0> ] . getSourceRange ( ) ; if ( destPackageName == null || destPackageName . length == <NUM_LIT:0> ) { multiEdit . addChild ( new DeleteEdit ( packageRange . getOffset ( ) , packageRange . getLength ( ) ) ) ; } else { multiEdit . addChild ( new ReplaceEdit ( packageRange . getOffset ( ) , packageRange . getLength ( ) , "<STR_LIT>" + Util . concatWith ( destPackageName , '<CHAR_LIT:.>' ) ) ) ; } } else { multiEdit . addChild ( new InsertEdit ( <NUM_LIT:0> , "<STR_LIT>" + Util . concatWith ( destPackageName , '<CHAR_LIT:.>' ) + "<STR_LIT:n>" ) ) ; } } if ( doName ) { int dotIndex = cu . getElementName ( ) . indexOf ( '<CHAR_LIT:.>' ) ; dotIndex = dotIndex == - <NUM_LIT:1> ? cu . getElementName ( ) . length ( ) : dotIndex ; String oldTypeName = cu . getElementName ( ) . substring ( <NUM_LIT:0> , dotIndex ) ; dotIndex = newName . indexOf ( '<CHAR_LIT:.>' ) ; dotIndex = dotIndex == - <NUM_LIT:1> ? newName . length ( ) : dotIndex ; String newTypeName = newName . substring ( <NUM_LIT:0> , dotIndex ) ; IType type = cu . getType ( oldTypeName ) ; if ( type . exists ( ) ) { ISourceRange nameRange = type . getNameRange ( ) ; if ( nameRange . getOffset ( ) > <NUM_LIT:0> && nameRange . getLength ( ) > <NUM_LIT:0> && oldTypeName . length ( ) == nameRange . getLength ( ) ) { multiEdit . addChild ( new ReplaceEdit ( nameRange . getOffset ( ) , nameRange . getLength ( ) , newTypeName ) ) ; } IJavaElement [ ] children = type . getChildren ( ) ; for ( int i = <NUM_LIT:0> ; i < children . length ; i ++ ) { if ( children [ i ] . getElementType ( ) == IJavaElement . METHOD ) { IMethod method = ( IMethod ) children [ i ] ; if ( method . isConstructor ( ) ) { nameRange = method . getNameRange ( ) ; if ( nameRange . getOffset ( ) > <NUM_LIT:0> && nameRange . getLength ( ) > <NUM_LIT:0> ) { multiEdit . addChild ( new ReplaceEdit ( nameRange . getOffset ( ) , nameRange . getLength ( ) , newTypeName ) ) ; } } } } } } return multiEdit ; } private void updatePackageStatement ( CompilationUnit astCU , String [ ] pkgName , ASTRewrite rewriter , ICompilationUnit cu ) throws JavaModelException { boolean defaultPackage = pkgName . length == <NUM_LIT:0> ; AST ast = astCU . getAST ( ) ; if ( defaultPackage ) { PackageDeclaration pkg = astCU . getPackage ( ) ; if ( pkg != null ) { int pkgStart ; Javadoc javadoc = pkg . getJavadoc ( ) ; if ( javadoc != null ) { pkgStart = javadoc . getStartPosition ( ) + javadoc . getLength ( ) + <NUM_LIT:1> ; } else { pkgStart = pkg . getStartPosition ( ) ; } int extendedStart = astCU . getExtendedStartPosition ( pkg ) ; if ( pkgStart != extendedStart ) { String commentSource = cu . getSource ( ) . substring ( extendedStart , pkgStart ) ; ASTNode comment = rewriter . createStringPlaceholder ( commentSource , ASTNode . PACKAGE_DECLARATION ) ; rewriter . set ( astCU , CompilationUnit . PACKAGE_PROPERTY , comment , null ) ; } else { rewriter . set ( astCU , CompilationUnit . PACKAGE_PROPERTY , null , null ) ; } } } else { org . eclipse . jdt . core . dom . PackageDeclaration pkg = astCU . getPackage ( ) ; if ( pkg != null ) { Name name = ast . newName ( pkgName ) ; rewriter . set ( pkg , PackageDeclaration . NAME_PROPERTY , name , null ) ; } else { pkg = ast . newPackageDeclaration ( ) ; pkg . setName ( ast . newName ( pkgName ) ) ; rewriter . set ( astCU , CompilationUnit . PACKAGE_PROPERTY , pkg , null ) ; } } } private void updateReadOnlyPackageFragmentsForCopy ( IContainer sourceFolder , PackageFragmentRoot root , String [ ] newFragName ) { IContainer parentFolder = ( IContainer ) root . resource ( ) ; for ( int i = <NUM_LIT:0> , length = newFragName . length ; i < length ; i ++ ) { String subFolderName = newFragName [ i ] ; parentFolder = parentFolder . getFolder ( new Path ( subFolderName ) ) ; sourceFolder = sourceFolder . getFolder ( new Path ( subFolderName ) ) ; if ( sourceFolder . exists ( ) && Util . isReadOnly ( sourceFolder ) ) { Util . setReadOnly ( parentFolder , true ) ; } } } private void updateReadOnlyPackageFragmentsForMove ( IContainer sourceFolder , PackageFragmentRoot root , String [ ] newFragName , boolean sourceFolderIsReadOnly ) { IContainer parentFolder = ( IContainer ) root . resource ( ) ; for ( int i = <NUM_LIT:0> , length = newFragName . length ; i < length ; i ++ ) { String subFolderName = newFragName [ i ] ; parentFolder = parentFolder . getFolder ( new Path ( subFolderName ) ) ; sourceFolder = sourceFolder . getFolder ( new Path ( subFolderName ) ) ; if ( ( sourceFolder . exists ( ) && Util . isReadOnly ( sourceFolder ) ) || ( i == length - <NUM_LIT:1> && sourceFolderIsReadOnly ) ) { Util . setReadOnly ( parentFolder , true ) ; Util . setReadOnly ( sourceFolder , false ) ; } } } private void updateTypeName ( ICompilationUnit cu , CompilationUnit astCU , String oldName , String newName , ASTRewrite rewriter ) throws JavaModelException { if ( newName != null ) { String oldTypeName = Util . getNameWithoutJavaLikeExtension ( oldName ) ; String newTypeName = Util . getNameWithoutJavaLikeExtension ( newName ) ; AST ast = astCU . getAST ( ) ; IType [ ] types = cu . getTypes ( ) ; for ( int i = <NUM_LIT:0> , max = types . length ; i < max ; i ++ ) { IType currentType = types [ i ] ; if ( currentType . getElementName ( ) . equals ( oldTypeName ) ) { AbstractTypeDeclaration typeNode = ( AbstractTypeDeclaration ) ( ( JavaElement ) currentType ) . findNode ( astCU ) ; if ( typeNode != null ) { rewriter . replace ( typeNode . getName ( ) , ast . newSimpleName ( newTypeName ) , null ) ; Iterator bodyDeclarations = typeNode . bodyDeclarations ( ) . iterator ( ) ; while ( bodyDeclarations . hasNext ( ) ) { Object bodyDeclaration = bodyDeclarations . next ( ) ; if ( bodyDeclaration instanceof MethodDeclaration ) { MethodDeclaration methodDeclaration = ( MethodDeclaration ) bodyDeclaration ; if ( methodDeclaration . isConstructor ( ) ) { SimpleName methodName = methodDeclaration . getName ( ) ; if ( methodName . getIdentifier ( ) . equals ( oldTypeName ) ) { rewriter . replace ( methodName , ast . newSimpleName ( newTypeName ) , null ) ; } } } } } } } } } protected IJavaModelStatus verify ( ) { IJavaModelStatus status = super . verify ( ) ; if ( ! status . isOK ( ) ) { return status ; } if ( this . renamingsList != null && this . renamingsList . length != this . elementsToProcess . length ) { return new JavaModelStatus ( IJavaModelStatusConstants . INDEX_OUT_OF_BOUNDS ) ; } return JavaModelStatus . VERIFIED_OK ; } protected void verify ( IJavaElement element ) throws JavaModelException { if ( element == null || ! element . exists ( ) ) error ( IJavaModelStatusConstants . ELEMENT_DOES_NOT_EXIST , element ) ; if ( element . isReadOnly ( ) && ( isRename ( ) || isMove ( ) ) ) error ( IJavaModelStatusConstants . READ_ONLY , element ) ; IResource resource = ( ( JavaElement ) element ) . resource ( ) ; if ( resource instanceof IFolder ) { if ( resource . isLinked ( ) ) { error ( IJavaModelStatusConstants . INVALID_RESOURCE , element ) ; } } int elementType = element . getElementType ( ) ; if ( elementType == IJavaElement . COMPILATION_UNIT ) { org . eclipse . jdt . internal . core . CompilationUnit compilationUnit = ( org . eclipse . jdt . internal . core . CompilationUnit ) element ; if ( isMove ( ) && compilationUnit . isWorkingCopy ( ) && ! compilationUnit . isPrimary ( ) ) error ( IJavaModelStatusConstants . INVALID_ELEMENT_TYPES , element ) ; } else if ( elementType != IJavaElement . PACKAGE_FRAGMENT ) { error ( IJavaModelStatusConstants . INVALID_ELEMENT_TYPES , element ) ; } JavaElement dest = ( JavaElement ) getDestinationParent ( element ) ; verifyDestination ( element , dest ) ; if ( this . renamings != null ) { verifyRenaming ( element ) ; } } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . core . runtime . Assert ; import org . eclipse . jdt . core . * ; public class ImportDeclaration extends SourceRefElement implements IImportDeclaration { protected String name ; protected boolean isOnDemand ; protected ImportDeclaration ( ImportContainer parent , String name , boolean isOnDemand ) { super ( parent ) ; this . name = name ; this . isOnDemand = isOnDemand ; } public boolean equals ( Object o ) { if ( ! ( o instanceof ImportDeclaration ) ) return false ; return super . equals ( o ) ; } public String getElementName ( ) { if ( this . isOnDemand ) return this . name + "<STR_LIT>" ; return this . name ; } public String getNameWithoutStar ( ) { return this . name ; } public int getElementType ( ) { return IMPORT_DECLARATION ; } public int getFlags ( ) throws JavaModelException { ImportDeclarationElementInfo info = ( ImportDeclarationElementInfo ) getElementInfo ( ) ; return info . getModifiers ( ) ; } protected void getHandleMemento ( StringBuffer buff ) { ( ( JavaElement ) getParent ( ) ) . getHandleMemento ( buff ) ; escapeMementoName ( buff , getElementName ( ) ) ; if ( this . occurrenceCount > <NUM_LIT:1> ) { buff . append ( JEM_COUNT ) ; buff . append ( this . occurrenceCount ) ; } } protected char getHandleMementoDelimiter ( ) { Assert . isTrue ( false , "<STR_LIT>" ) ; return <NUM_LIT:0> ; } public ISourceRange getNameRange ( ) throws JavaModelException { ImportDeclarationElementInfo info = ( ImportDeclarationElementInfo ) getElementInfo ( ) ; return info . getNameRange ( ) ; } public IJavaElement getPrimaryElement ( boolean checkOwner ) { CompilationUnit cu = ( CompilationUnit ) this . parent . getParent ( ) ; if ( checkOwner && cu . isPrimary ( ) ) return this ; return cu . getImport ( getElementName ( ) ) ; } public boolean isOnDemand ( ) { return this . isOnDemand ; } public String readableName ( ) { return null ; } protected void toStringInfo ( int tab , StringBuffer buffer , Object info , boolean showResolvedInfo ) { buffer . append ( tabString ( tab ) ) ; buffer . append ( "<STR_LIT>" ) ; toStringName ( buffer ) ; if ( info == null ) { buffer . append ( "<STR_LIT>" ) ; } } } </s>
|
<s> package org . eclipse . jdt . internal . core ; 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 . dom . ASTNode ; import org . eclipse . jdt . core . dom . AbstractTypeDeclaration ; import org . eclipse . jdt . core . dom . SimpleName ; import org . eclipse . jdt . core . dom . rewrite . ASTRewrite ; import org . eclipse . jdt . internal . core . util . Messages ; public class CreateTypeOperation extends CreateTypeMemberOperation { public CreateTypeOperation ( IJavaElement parentElement , String source , boolean force ) { super ( parentElement , source , force ) ; } protected ASTNode generateElementAST ( ASTRewrite rewriter , ICompilationUnit cu ) throws JavaModelException { ASTNode node = super . generateElementAST ( rewriter , cu ) ; if ( ! ( node instanceof AbstractTypeDeclaration ) ) throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CONTENTS ) ) ; return node ; } protected IJavaElement generateResultHandle ( ) { IJavaElement parent = getParentElement ( ) ; switch ( parent . getElementType ( ) ) { case IJavaElement . COMPILATION_UNIT : return ( ( ICompilationUnit ) parent ) . getType ( getASTNodeName ( ) ) ; case IJavaElement . TYPE : return ( ( IType ) parent ) . getType ( getASTNodeName ( ) ) ; } return null ; } public String getMainTaskName ( ) { return Messages . operation_createTypeProgress ; } protected IType getType ( ) { IJavaElement parent = getParentElement ( ) ; if ( parent . getElementType ( ) == IJavaElement . TYPE ) { return ( IType ) parent ; } return null ; } protected IJavaModelStatus verifyNameCollision ( ) { IJavaElement parent = getParentElement ( ) ; switch ( parent . getElementType ( ) ) { case IJavaElement . COMPILATION_UNIT : String typeName = getASTNodeName ( ) ; if ( ( ( ICompilationUnit ) parent ) . getType ( typeName ) . exists ( ) ) { return new JavaModelStatus ( IJavaModelStatusConstants . NAME_COLLISION , Messages . bind ( Messages . status_nameCollision , typeName ) ) ; } break ; case IJavaElement . TYPE : typeName = getASTNodeName ( ) ; if ( ( ( IType ) parent ) . getType ( typeName ) . exists ( ) ) { return new JavaModelStatus ( IJavaModelStatusConstants . NAME_COLLISION , Messages . bind ( Messages . status_nameCollision , typeName ) ) ; } break ; } return JavaModelStatus . VERIFIED_OK ; } public IJavaModelStatus verify ( ) { IJavaModelStatus status = super . verify ( ) ; if ( ! status . isOK ( ) ) return status ; try { IJavaElement parent = getParentElement ( ) ; if ( this . anchorElement != null && this . anchorElement . getElementType ( ) == IJavaElement . FIELD && parent . getElementType ( ) == IJavaElement . TYPE && ( ( IType ) parent ) . isEnum ( ) ) return new JavaModelStatus ( IJavaModelStatusConstants . INVALID_SIBLING , this . anchorElement ) ; } catch ( JavaModelException e ) { return e . getJavaModelStatus ( ) ; } return JavaModelStatus . VERIFIED_OK ; } private String getASTNodeName ( ) { return ( ( AbstractTypeDeclaration ) this . createdNode ) . getName ( ) . getIdentifier ( ) ; } protected SimpleName rename ( ASTNode node , SimpleName newName ) { AbstractTypeDeclaration type = ( AbstractTypeDeclaration ) node ; SimpleName oldName = type . getName ( ) ; type . setName ( newName ) ; return oldName ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jdt . core . Flags ; import org . eclipse . jdt . core . IAnnotation ; import org . eclipse . jdt . core . ILocalVariable ; import org . eclipse . jdt . core . IMemberValuePair ; import org . eclipse . jdt . core . IMethod ; import org . eclipse . jdt . core . IType ; import org . eclipse . jdt . core . ITypeParameter ; import org . eclipse . jdt . core . JavaCore ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . Signature ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; import org . eclipse . jdt . internal . compiler . env . IBinaryAnnotation ; import org . eclipse . jdt . internal . compiler . env . IBinaryMethod ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; import org . eclipse . jdt . internal . core . JavaModelManager . PerProjectInfo ; import org . eclipse . jdt . internal . core . util . Util ; class BinaryMethod extends BinaryMember implements IMethod { protected String [ ] parameterTypes ; protected String [ ] erasedParamaterTypes ; protected String [ ] parameterNames ; protected String [ ] exceptionTypes ; protected String returnType ; protected BinaryMethod ( JavaElement parent , String name , String [ ] paramTypes ) { super ( parent , name ) ; if ( paramTypes == null ) { this . parameterTypes = CharOperation . NO_STRINGS ; } else { this . parameterTypes = paramTypes ; } } public boolean equals ( Object o ) { if ( ! ( o instanceof BinaryMethod ) ) return false ; return super . equals ( o ) && Util . equalArraysOrNull ( getErasedParameterTypes ( ) , ( ( BinaryMethod ) o ) . getErasedParameterTypes ( ) ) ; } public IAnnotation [ ] getAnnotations ( ) throws JavaModelException { IBinaryMethod info = ( IBinaryMethod ) getElementInfo ( ) ; IBinaryAnnotation [ ] binaryAnnotations = info . getAnnotations ( ) ; return getAnnotations ( binaryAnnotations , info . getTagBits ( ) ) ; } public ILocalVariable [ ] getParameters ( ) throws JavaModelException { IBinaryMethod info = ( IBinaryMethod ) getElementInfo ( ) ; int length = this . parameterTypes . length ; if ( length == <NUM_LIT:0> ) { return LocalVariable . NO_LOCAL_VARIABLES ; } ILocalVariable [ ] localVariables = new ILocalVariable [ length ] ; char [ ] [ ] argumentNames = info . getArgumentNames ( ) ; if ( argumentNames == null || argumentNames . length < length ) { argumentNames = new char [ length ] [ ] ; for ( int j = <NUM_LIT:0> ; j < length ; j ++ ) { argumentNames [ j ] = ( "<STR_LIT>" + j ) . toCharArray ( ) ; } } for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { LocalVariable localVariable = new LocalVariable ( this , new String ( argumentNames [ i ] ) , <NUM_LIT:0> , - <NUM_LIT:1> , <NUM_LIT:0> , - <NUM_LIT:1> , this . parameterTypes [ i ] , null , - <NUM_LIT:1> , true ) ; localVariables [ i ] = localVariable ; IAnnotation [ ] annotations = getAnnotations ( localVariable , info . getParameterAnnotations ( i ) ) ; localVariable . annotations = annotations ; } return localVariables ; } private IAnnotation [ ] getAnnotations ( JavaElement annotationParent , IBinaryAnnotation [ ] binaryAnnotations ) { if ( binaryAnnotations == null ) return Annotation . NO_ANNOTATIONS ; int length = binaryAnnotations . length ; IAnnotation [ ] annotations = new IAnnotation [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { annotations [ i ] = Util . getAnnotation ( annotationParent , binaryAnnotations [ i ] , null ) ; } return annotations ; } public IMemberValuePair getDefaultValue ( ) throws JavaModelException { IBinaryMethod info = ( IBinaryMethod ) getElementInfo ( ) ; Object defaultValue = info . getDefaultValue ( ) ; if ( defaultValue == null ) return null ; MemberValuePair memberValuePair = new MemberValuePair ( getElementName ( ) ) ; memberValuePair . value = Util . getAnnotationMemberValue ( this , memberValuePair , defaultValue ) ; return memberValuePair ; } public String [ ] getExceptionTypes ( ) throws JavaModelException { if ( this . exceptionTypes == null ) { IBinaryMethod info = ( IBinaryMethod ) getElementInfo ( ) ; char [ ] genericSignature = info . getGenericSignature ( ) ; if ( genericSignature != null ) { char [ ] dotBasedSignature = CharOperation . replaceOnCopy ( genericSignature , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; this . exceptionTypes = Signature . getThrownExceptionTypes ( new String ( dotBasedSignature ) ) ; } if ( this . exceptionTypes == null || this . exceptionTypes . length == <NUM_LIT:0> ) { char [ ] [ ] eTypeNames = info . getExceptionTypeNames ( ) ; if ( eTypeNames == null || eTypeNames . length == <NUM_LIT:0> ) { this . exceptionTypes = CharOperation . NO_STRINGS ; } else { eTypeNames = ClassFile . translatedNames ( eTypeNames ) ; this . exceptionTypes = new String [ eTypeNames . length ] ; for ( int j = <NUM_LIT:0> , length = eTypeNames . length ; j < length ; j ++ ) { int nameLength = eTypeNames [ j ] . length ; char [ ] convertedName = new char [ nameLength + <NUM_LIT:2> ] ; System . arraycopy ( eTypeNames [ j ] , <NUM_LIT:0> , convertedName , <NUM_LIT:1> , nameLength ) ; convertedName [ <NUM_LIT:0> ] = '<CHAR_LIT>' ; convertedName [ nameLength + <NUM_LIT:1> ] = '<CHAR_LIT:;>' ; this . exceptionTypes [ j ] = new String ( convertedName ) ; } } } } return this . exceptionTypes ; } public int getElementType ( ) { return METHOD ; } public int getFlags ( ) throws JavaModelException { IBinaryMethod info = ( IBinaryMethod ) getElementInfo ( ) ; return info . getModifiers ( ) ; } protected void getHandleMemento ( StringBuffer buff ) { ( ( JavaElement ) getParent ( ) ) . getHandleMemento ( buff ) ; char delimiter = getHandleMementoDelimiter ( ) ; buff . append ( delimiter ) ; escapeMementoName ( buff , getElementName ( ) ) ; for ( int i = <NUM_LIT:0> ; i < this . parameterTypes . length ; i ++ ) { buff . append ( delimiter ) ; escapeMementoName ( buff , this . parameterTypes [ i ] ) ; } if ( this . occurrenceCount > <NUM_LIT:1> ) { buff . append ( JEM_COUNT ) ; buff . append ( this . occurrenceCount ) ; } } protected char getHandleMementoDelimiter ( ) { return JavaElement . JEM_METHOD ; } public String getKey ( boolean forceOpen ) throws JavaModelException { return getKey ( this , forceOpen ) ; } public int getNumberOfParameters ( ) { return this . parameterTypes == null ? <NUM_LIT:0> : this . parameterTypes . length ; } public String [ ] getParameterNames ( ) throws JavaModelException { if ( this . parameterNames != null ) return this . parameterNames ; IType type = ( IType ) getParent ( ) ; SourceMapper mapper = getSourceMapper ( ) ; if ( mapper != null ) { char [ ] [ ] paramNames = mapper . getMethodParameterNames ( this ) ; if ( paramNames == null ) { IBinaryType info = ( IBinaryType ) ( ( BinaryType ) getDeclaringType ( ) ) . getElementInfo ( ) ; char [ ] source = mapper . findSource ( type , info ) ; if ( source != null ) { mapper . mapSource ( type , source , info ) ; } paramNames = mapper . getMethodParameterNames ( this ) ; } if ( paramNames != null ) { String [ ] names = new String [ paramNames . length ] ; for ( int i = <NUM_LIT:0> ; i < paramNames . length ; i ++ ) { names [ i ] = new String ( paramNames [ i ] ) ; } return this . parameterNames = names ; } } IBinaryMethod info = ( IBinaryMethod ) getElementInfo ( ) ; int paramCount = Signature . getParameterCount ( new String ( info . getMethodDescriptor ( ) ) ) ; if ( this . isConstructor ( ) ) { final IType declaringType = this . getDeclaringType ( ) ; if ( declaringType . isMember ( ) && ! Flags . isStatic ( declaringType . getFlags ( ) ) ) { paramCount -- ; } } if ( paramCount != <NUM_LIT:0> ) { int modifiers = getFlags ( ) ; if ( ( modifiers & ClassFileConstants . AccSynthetic ) != <NUM_LIT:0> ) { return this . parameterNames = getRawParameterNames ( paramCount ) ; } JavadocContents javadocContents = null ; IType declaringType = getDeclaringType ( ) ; PerProjectInfo projectInfo = JavaModelManager . getJavaModelManager ( ) . getPerProjectInfoCheckExistence ( getJavaProject ( ) . getProject ( ) ) ; synchronized ( projectInfo . javadocCache ) { javadocContents = ( JavadocContents ) projectInfo . javadocCache . get ( declaringType ) ; if ( javadocContents == null ) { projectInfo . javadocCache . put ( declaringType , BinaryType . EMPTY_JAVADOC ) ; } } String methodDoc = null ; if ( javadocContents == null ) { long timeOut = <NUM_LIT> ; try { String option = getJavaProject ( ) . getOption ( JavaCore . TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC , true ) ; if ( option != null ) { timeOut = Long . parseLong ( option ) ; } } catch ( NumberFormatException e ) { } if ( timeOut == <NUM_LIT:0> ) { return getRawParameterNames ( paramCount ) ; } final class ParametersNameCollector { String javadoc ; public void setJavadoc ( String s ) { this . javadoc = s ; } public String getJavadoc ( ) { return this . javadoc ; } } final ParametersNameCollector nameCollector = new ParametersNameCollector ( ) ; Thread collect = new Thread ( ) { public void run ( ) { try { nameCollector . setJavadoc ( BinaryMethod . this . getAttachedJavadoc ( null ) ) ; } catch ( JavaModelException e ) { } synchronized ( nameCollector ) { nameCollector . notify ( ) ; } } } ; collect . start ( ) ; synchronized ( nameCollector ) { try { nameCollector . wait ( timeOut ) ; } catch ( InterruptedException e ) { } } methodDoc = nameCollector . getJavadoc ( ) ; } else if ( javadocContents != BinaryType . EMPTY_JAVADOC ) { try { methodDoc = javadocContents . getMethodDoc ( this ) ; } catch ( JavaModelException e ) { javadocContents = null ; } } if ( methodDoc != null ) { final int indexOfOpenParen = methodDoc . indexOf ( '<CHAR_LIT:(>' ) ; if ( indexOfOpenParen != - <NUM_LIT:1> ) { final int indexOfClosingParen = methodDoc . indexOf ( '<CHAR_LIT:)>' , indexOfOpenParen ) ; if ( indexOfClosingParen != - <NUM_LIT:1> ) { final char [ ] paramsSource = CharOperation . replace ( methodDoc . substring ( indexOfOpenParen + <NUM_LIT:1> , indexOfClosingParen ) . toCharArray ( ) , "<STR_LIT>" . toCharArray ( ) , new char [ ] { '<CHAR_LIT:U+0020>' } ) ; final char [ ] [ ] params = splitParameters ( paramsSource , paramCount ) ; final int paramsLength = params . length ; String [ ] names = new String [ paramsLength ] ; for ( int i = <NUM_LIT:0> ; i < paramsLength ; i ++ ) { final char [ ] param = params [ i ] ; int indexOfSpace = CharOperation . lastIndexOf ( '<CHAR_LIT:U+0020>' , param ) ; if ( indexOfSpace != - <NUM_LIT:1> ) { names [ i ] = String . valueOf ( param , indexOfSpace + <NUM_LIT:1> , param . length - indexOfSpace - <NUM_LIT:1> ) ; } else { names [ i ] = "<STR_LIT>" + i ; } } return this . parameterNames = names ; } } } char [ ] [ ] argumentNames = info . getArgumentNames ( ) ; if ( argumentNames != null && argumentNames . length == paramCount ) { String [ ] names = new String [ paramCount ] ; for ( int i = <NUM_LIT:0> ; i < paramCount ; i ++ ) { names [ i ] = new String ( argumentNames [ i ] ) ; } return this . parameterNames = names ; } } return getRawParameterNames ( paramCount ) ; } private char [ ] [ ] splitParameters ( char [ ] parametersSource , int paramCount ) { char [ ] [ ] params = new char [ paramCount ] [ ] ; int paramIndex = <NUM_LIT:0> ; int index = <NUM_LIT:0> ; int balance = <NUM_LIT:0> ; int length = parametersSource . length ; int start = <NUM_LIT:0> ; while ( index < length ) { switch ( parametersSource [ index ] ) { case '<CHAR_LIT>' : balance ++ ; index ++ ; while ( index < length && parametersSource [ index ] != '<CHAR_LIT:>>' ) { index ++ ; } break ; case '<CHAR_LIT:>>' : balance -- ; index ++ ; break ; case '<CHAR_LIT:U+002C>' : if ( balance == <NUM_LIT:0> && paramIndex < paramCount ) { params [ paramIndex ++ ] = CharOperation . subarray ( parametersSource , start , index ) ; start = index + <NUM_LIT:1> ; } index ++ ; break ; case '<CHAR_LIT>' : if ( ( index + <NUM_LIT:4> ) < length ) { if ( parametersSource [ index + <NUM_LIT:1> ] == '<CHAR_LIT>' && parametersSource [ index + <NUM_LIT:2> ] == '<CHAR_LIT>' && parametersSource [ index + <NUM_LIT:3> ] == '<CHAR_LIT:;>' ) { balance ++ ; index += <NUM_LIT:4> ; } else if ( parametersSource [ index + <NUM_LIT:1> ] == '<CHAR_LIT>' && parametersSource [ index + <NUM_LIT:2> ] == '<CHAR_LIT>' && parametersSource [ index + <NUM_LIT:3> ] == '<CHAR_LIT:;>' ) { balance -- ; index += <NUM_LIT:4> ; } else { index ++ ; } } else { index ++ ; } break ; default : index ++ ; } } if ( paramIndex < paramCount ) { params [ paramIndex ++ ] = CharOperation . subarray ( parametersSource , start , index ) ; } if ( paramIndex != paramCount ) { System . arraycopy ( params , <NUM_LIT:0> , ( params = new char [ paramIndex ] [ ] ) , <NUM_LIT:0> , paramIndex ) ; } return params ; } public String [ ] getParameterTypes ( ) { return this . parameterTypes ; } private String [ ] getErasedParameterTypes ( ) { if ( this . erasedParamaterTypes == null ) { int paramCount = this . parameterTypes . length ; String [ ] erasedTypes = new String [ paramCount ] ; boolean erasureNeeded = false ; for ( int i = <NUM_LIT:0> ; i < paramCount ; i ++ ) { String parameterType = this . parameterTypes [ i ] ; if ( ( erasedTypes [ i ] = Signature . getTypeErasure ( parameterType ) ) != parameterType ) erasureNeeded = true ; } this . erasedParamaterTypes = erasureNeeded ? erasedTypes : this . parameterTypes ; } return this . erasedParamaterTypes ; } private String getErasedParameterType ( int index ) { return getErasedParameterTypes ( ) [ index ] ; } public ITypeParameter getTypeParameter ( String typeParameterName ) { return new TypeParameter ( this , typeParameterName ) ; } 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 { IBinaryMethod info = ( IBinaryMethod ) getElementInfo ( ) ; char [ ] genericSignature = info . getGenericSignature ( ) ; if ( genericSignature == null ) return CharOperation . NO_STRINGS ; char [ ] dotBasedSignature = CharOperation . replaceOnCopy ( genericSignature , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; char [ ] [ ] typeParams = Signature . getTypeParameters ( dotBasedSignature ) ; return CharOperation . toStrings ( typeParams ) ; } public String [ ] getRawParameterNames ( ) throws JavaModelException { IBinaryMethod info = ( IBinaryMethod ) getElementInfo ( ) ; int paramCount = Signature . getParameterCount ( new String ( info . getMethodDescriptor ( ) ) ) ; return getRawParameterNames ( paramCount ) ; } private String [ ] getRawParameterNames ( int paramCount ) { String [ ] result = new String [ paramCount ] ; for ( int i = <NUM_LIT:0> ; i < paramCount ; i ++ ) { result [ i ] = "<STR_LIT>" + i ; } return result ; } public String getReturnType ( ) throws JavaModelException { if ( this . returnType == null ) { IBinaryMethod info = ( IBinaryMethod ) getElementInfo ( ) ; this . returnType = getReturnType ( info ) ; } return this . returnType ; } private String getReturnType ( IBinaryMethod info ) { char [ ] genericSignature = info . getGenericSignature ( ) ; char [ ] signature = genericSignature == null ? info . getMethodDescriptor ( ) : genericSignature ; char [ ] dotBasedSignature = CharOperation . replaceOnCopy ( signature , '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ; String returnTypeName = Signature . getReturnType ( new String ( dotBasedSignature ) ) ; return new String ( ClassFile . translatedName ( returnTypeName . toCharArray ( ) ) ) ; } public String getSignature ( ) throws JavaModelException { IBinaryMethod info = ( IBinaryMethod ) getElementInfo ( ) ; return new String ( info . getMethodDescriptor ( ) ) ; } public int hashCode ( ) { int hash = super . hashCode ( ) ; for ( int i = <NUM_LIT:0> , length = this . parameterTypes . length ; i < length ; i ++ ) { hash = Util . combineHashCodes ( hash , getErasedParameterType ( i ) . hashCode ( ) ) ; } return hash ; } public boolean isConstructor ( ) throws JavaModelException { if ( ! getElementName ( ) . equals ( this . parent . getElementName ( ) ) ) { return false ; } IBinaryMethod info = ( IBinaryMethod ) getElementInfo ( ) ; return info . isConstructor ( ) ; } public boolean isMainMethod ( ) throws JavaModelException { return this . isMainMethod ( this ) ; } public boolean isResolved ( ) { return false ; } public boolean isSimilar ( IMethod method ) { return areSimilarMethods ( getElementName ( ) , getParameterTypes ( ) , method . getElementName ( ) , method . getParameterTypes ( ) , null ) ; } public String readableName ( ) { StringBuffer buffer = new StringBuffer ( super . readableName ( ) ) ; buffer . append ( "<STR_LIT:(>" ) ; String [ ] paramTypes = this . parameterTypes ; int length ; if ( paramTypes != null && ( length = paramTypes . length ) > <NUM_LIT:0> ) { for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { buffer . append ( Signature . toString ( paramTypes [ i ] ) ) ; if ( i < length - <NUM_LIT:1> ) { buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } } } buffer . append ( "<STR_LIT:)>" ) ; return buffer . toString ( ) ; } public JavaElement resolved ( Binding binding ) { SourceRefElement resolvedHandle = new ResolvedBinaryMethod ( this . parent , this . name , this . parameterTypes , new String ( binding . computeUniqueKey ( ) ) ) ; resolvedHandle . occurrenceCount = this . occurrenceCount ; return resolvedHandle ; } 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 { IBinaryMethod methodInfo = ( IBinaryMethod ) info ; int flags = methodInfo . getModifiers ( ) ; if ( Flags . isStatic ( flags ) ) { buffer . append ( "<STR_LIT>" ) ; } if ( ! methodInfo . isConstructor ( ) ) { buffer . append ( Signature . toString ( getReturnType ( methodInfo ) ) ) ; buffer . append ( '<CHAR_LIT:U+0020>' ) ; } toStringName ( buffer , flags ) ; } } protected void toStringName ( StringBuffer buffer ) { toStringName ( buffer , <NUM_LIT:0> ) ; } protected void toStringName ( StringBuffer buffer , int flags ) { buffer . append ( getElementName ( ) ) ; buffer . append ( '<CHAR_LIT:(>' ) ; String [ ] parameters = getParameterTypes ( ) ; int length ; if ( parameters != null && ( length = parameters . length ) > <NUM_LIT:0> ) { boolean isVarargs = Flags . isVarargs ( flags ) ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { try { if ( i < length - <NUM_LIT:1> ) { buffer . append ( Signature . toString ( parameters [ i ] ) ) ; buffer . append ( "<STR_LIT:U+002CU+0020>" ) ; } else if ( isVarargs ) { String parameter = parameters [ i ] . substring ( <NUM_LIT:1> ) ; buffer . append ( Signature . toString ( parameter ) ) ; buffer . append ( "<STR_LIT>" ) ; } else { buffer . append ( Signature . toString ( parameters [ i ] ) ) ; } } catch ( IllegalArgumentException e ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( parameters [ i ] ) ; } } } buffer . append ( '<CHAR_LIT:)>' ) ; if ( this . occurrenceCount > <NUM_LIT:1> ) { buffer . append ( "<STR_LIT:#>" ) ; buffer . append ( this . occurrenceCount ) ; } } public String getAttachedJavadoc ( IProgressMonitor monitor ) throws JavaModelException { JavadocContents javadocContents = ( ( BinaryType ) this . getDeclaringType ( ) ) . getJavadocContents ( monitor ) ; if ( javadocContents == null ) return null ; return javadocContents . getMethodDoc ( this ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; public interface INamingRequestor { void acceptNameWithPrefixAndSuffix ( char [ ] name , boolean isFirstPrefix , boolean isFirstSuffix , int reusedCharacters ) ; void acceptNameWithPrefix ( char [ ] name , boolean isFirstPrefix , int reusedCharacters ) ; void acceptNameWithSuffix ( char [ ] name , boolean isFirstSuffix , int reusedCharacters ) ; void acceptNameWithoutPrefixAndSuffix ( char [ ] name , int reusedCharacters ) ; } </s>
|
<s> package org . eclipse . jdt . internal . core ; import java . io . File ; import java . net . URL ; import java . util . * ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IFolder ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IResourceChangeEvent ; import org . eclipse . core . resources . IResourceDelta ; import org . eclipse . core . resources . IResourceDeltaVisitor ; import org . eclipse . core . resources . IWorkspace ; import org . eclipse . core . resources . IWorkspaceRoot ; import org . eclipse . core . resources . IWorkspaceRunnable ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . resources . WorkspaceJob ; import org . eclipse . core . runtime . * ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . SourceElementParser ; import org . eclipse . jdt . internal . core . JavaModelManager . PerProjectInfo ; import org . eclipse . jdt . internal . core . builder . JavaBuilder ; import org . eclipse . jdt . internal . core . hierarchy . TypeHierarchy ; import org . eclipse . jdt . internal . core . search . AbstractSearchScope ; import org . eclipse . jdt . internal . core . search . JavaWorkspaceScope ; import org . eclipse . jdt . internal . core . search . indexing . IndexManager ; import org . eclipse . jdt . internal . core . util . Messages ; import org . eclipse . jdt . internal . core . util . Util ; public class DeltaProcessor { static class OutputsInfo { int outputCount ; IPath [ ] paths ; int [ ] traverseModes ; OutputsInfo ( IPath [ ] paths , int [ ] traverseModes , int outputCount ) { this . paths = paths ; this . traverseModes = traverseModes ; this . outputCount = outputCount ; } public String toString ( ) { if ( this . paths == null ) return "<STR_LIT>" ; StringBuffer buffer = new StringBuffer ( ) ; for ( int i = <NUM_LIT:0> ; i < this . outputCount ; i ++ ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . paths [ i ] . toString ( ) ) ; buffer . append ( "<STR_LIT>" ) ; switch ( this . traverseModes [ i ] ) { case BINARY : buffer . append ( "<STR_LIT>" ) ; break ; case IGNORE : buffer . append ( "<STR_LIT>" ) ; break ; case SOURCE : buffer . append ( "<STR_LIT>" ) ; break ; default : buffer . append ( "<STR_LIT>" ) ; } if ( i + <NUM_LIT:1> < this . outputCount ) { buffer . append ( '<STR_LIT:\n>' ) ; } } return buffer . toString ( ) ; } } public static class RootInfo { char [ ] [ ] inclusionPatterns ; char [ ] [ ] exclusionPatterns ; public JavaProject project ; IPath rootPath ; int entryKind ; IPackageFragmentRoot root ; IPackageFragmentRoot cache ; RootInfo ( JavaProject project , IPath rootPath , char [ ] [ ] inclusionPatterns , char [ ] [ ] exclusionPatterns , int entryKind ) { this . project = project ; this . rootPath = rootPath ; this . inclusionPatterns = inclusionPatterns ; this . exclusionPatterns = exclusionPatterns ; this . entryKind = entryKind ; this . cache = getPackageFragmentRoot ( ) ; } public IPackageFragmentRoot getPackageFragmentRoot ( ) { IPackageFragmentRoot tRoot = null ; Object target = JavaModel . getTarget ( this . rootPath , false ) ; if ( target instanceof IResource ) { tRoot = this . project . getPackageFragmentRoot ( ( IResource ) target ) ; } else { tRoot = this . project . getPackageFragmentRoot ( this . rootPath . toOSString ( ) ) ; } return tRoot ; } public IPackageFragmentRoot getPackageFragmentRoot ( IResource resource ) { if ( this . root == null ) { if ( resource != null ) { this . root = this . project . getPackageFragmentRoot ( resource ) ; } else { this . root = getPackageFragmentRoot ( ) ; } } if ( this . root != null ) this . cache = this . root ; return this . root ; } boolean isRootOfProject ( IPath path ) { return this . rootPath . equals ( path ) && this . project . getProject ( ) . getFullPath ( ) . isPrefixOf ( path ) ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; if ( this . project == null ) { buffer . append ( "<STR_LIT:null>" ) ; } else { buffer . append ( this . project . getElementName ( ) ) ; } buffer . append ( "<STR_LIT>" ) ; if ( this . rootPath == null ) { buffer . append ( "<STR_LIT:null>" ) ; } else { buffer . append ( this . rootPath . toString ( ) ) ; } buffer . append ( "<STR_LIT>" ) ; if ( this . inclusionPatterns == null ) { buffer . append ( "<STR_LIT:null>" ) ; } else { for ( int i = <NUM_LIT:0> , length = this . inclusionPatterns . length ; i < length ; i ++ ) { buffer . append ( new String ( this . inclusionPatterns [ i ] ) ) ; if ( i < length - <NUM_LIT:1> ) { buffer . append ( "<STR_LIT:|>" ) ; } } } buffer . append ( "<STR_LIT>" ) ; if ( this . exclusionPatterns == null ) { buffer . append ( "<STR_LIT:null>" ) ; } else { for ( int i = <NUM_LIT:0> , length = this . exclusionPatterns . length ; i < length ; i ++ ) { buffer . append ( new String ( this . exclusionPatterns [ i ] ) ) ; if ( i < length - <NUM_LIT:1> ) { buffer . append ( "<STR_LIT:|>" ) ; } } } return buffer . toString ( ) ; } } private final static int IGNORE = <NUM_LIT:0> ; private final static int SOURCE = <NUM_LIT:1> ; private final static int BINARY = <NUM_LIT:2> ; private final static String EXTERNAL_JAR_ADDED = "<STR_LIT>" ; private final static String EXTERNAL_JAR_CHANGED = "<STR_LIT>" ; private final static String EXTERNAL_JAR_REMOVED = "<STR_LIT>" ; private final static String EXTERNAL_JAR_UNCHANGED = "<STR_LIT>" ; private final static String INTERNAL_JAR_IGNORE = "<STR_LIT>" ; private final static int NON_JAVA_RESOURCE = - <NUM_LIT:1> ; public static boolean DEBUG = false ; public static boolean VERBOSE = false ; public static boolean PERF = false ; public static final int DEFAULT_CHANGE_EVENT = <NUM_LIT:0> ; public static long getTimeStamp ( File file ) { return file . lastModified ( ) + file . length ( ) ; } private DeltaProcessingState state ; JavaModelManager manager ; private JavaElementDelta currentDelta ; private Openable currentElement ; public ArrayList javaModelDeltas = new ArrayList ( ) ; public HashMap reconcileDeltas = new HashMap ( ) ; private boolean isFiring = true ; private final ModelUpdater modelUpdater = new ModelUpdater ( ) ; public HashSet projectCachesToReset = new HashSet ( ) ; public Map oldRoots ; public int overridenEventType = - <NUM_LIT:1> ; private SourceElementParser sourceElementParserCache ; public DeltaProcessor ( DeltaProcessingState state , JavaModelManager manager ) { this . state = state ; this . manager = manager ; } private void addDependentProjects ( IJavaProject project , HashMap projectDependencies , HashSet result ) { IJavaProject [ ] dependents = ( IJavaProject [ ] ) projectDependencies . get ( project ) ; if ( dependents == null ) return ; for ( int i = <NUM_LIT:0> , length = dependents . length ; i < length ; i ++ ) { IJavaProject dependent = dependents [ i ] ; if ( result . contains ( dependent ) ) continue ; result . add ( dependent ) ; addDependentProjects ( dependent , projectDependencies , result ) ; } } private void addToParentInfo ( Openable child ) { Openable parent = ( Openable ) child . getParent ( ) ; if ( parent != null && parent . isOpen ( ) ) { try { OpenableElementInfo info = ( OpenableElementInfo ) parent . getElementInfo ( ) ; if ( child instanceof IPackageFragmentRoot ) addPackageFragmentRoot ( info , ( IPackageFragmentRoot ) child ) ; else info . addChild ( child ) ; } catch ( JavaModelException e ) { } } } private void addPackageFragmentRoot ( OpenableElementInfo parent , IPackageFragmentRoot child ) throws JavaModelException { IJavaElement [ ] roots = parent . getChildren ( ) ; if ( roots . length > <NUM_LIT:0> ) { IClasspathEntry [ ] resolvedClasspath = ( ( JavaProject ) child . getJavaProject ( ) ) . getResolvedClasspath ( ) ; IPath currentEntryPath = child . getResolvedClasspathEntry ( ) . getPath ( ) ; int indexToInsert = - <NUM_LIT:1> ; int lastComparedIndex = - <NUM_LIT:1> ; int i = <NUM_LIT:0> , j = <NUM_LIT:0> ; for ( ; i < roots . length && j < resolvedClasspath . length ; ) { IClasspathEntry classpathEntry = resolvedClasspath [ j ] ; if ( lastComparedIndex != j && currentEntryPath . equals ( classpathEntry . getPath ( ) ) ) { indexToInsert = i ; break ; } lastComparedIndex = j ; IClasspathEntry rootEntry = ( ( IPackageFragmentRoot ) roots [ i ] ) . getResolvedClasspathEntry ( ) ; if ( rootEntry . getPath ( ) . equals ( classpathEntry . getPath ( ) ) ) i ++ ; else j ++ ; } for ( ; i < roots . length ; i ++ ) { if ( roots [ i ] . equals ( child ) ) { return ; } if ( ! ( ( IPackageFragmentRoot ) roots [ i ] ) . getResolvedClasspathEntry ( ) . getPath ( ) . equals ( currentEntryPath ) ) break ; } if ( indexToInsert >= <NUM_LIT:0> ) { int newSize = roots . length + <NUM_LIT:1> ; IPackageFragmentRoot [ ] newChildren = new IPackageFragmentRoot [ newSize ] ; if ( indexToInsert > <NUM_LIT:0> ) System . arraycopy ( roots , <NUM_LIT:0> , newChildren , <NUM_LIT:0> , indexToInsert ) ; newChildren [ indexToInsert ] = child ; System . arraycopy ( roots , indexToInsert , newChildren , indexToInsert + <NUM_LIT:1> , ( newSize - indexToInsert - <NUM_LIT:1> ) ) ; parent . setChildren ( newChildren ) ; return ; } } parent . addChild ( child ) ; } private void checkProjectsAndClasspathChanges ( IResourceDelta delta ) { IResource resource = delta . getResource ( ) ; IResourceDelta [ ] children = null ; switch ( resource . getType ( ) ) { case IResource . ROOT : this . state . getOldJavaProjecNames ( ) ; children = delta . getAffectedChildren ( ) ; break ; case IResource . PROJECT : IProject project = ( IProject ) resource ; JavaProject javaProject = ( JavaProject ) JavaCore . create ( project ) ; switch ( delta . getKind ( ) ) { case IResourceDelta . ADDED : this . manager . forceBatchInitializations ( false ) ; this . projectCachesToReset . add ( javaProject ) ; if ( JavaProject . hasJavaNature ( project ) ) { addToParentInfo ( javaProject ) ; readRawClasspath ( javaProject ) ; checkProjectReferenceChange ( project , javaProject ) ; checkExternalFolderChange ( project , javaProject ) ; } this . state . rootsAreStale = true ; break ; case IResourceDelta . CHANGED : if ( ( delta . getFlags ( ) & IResourceDelta . OPEN ) != <NUM_LIT:0> ) { this . manager . forceBatchInitializations ( false ) ; this . projectCachesToReset . add ( javaProject ) ; if ( project . isOpen ( ) ) { if ( JavaProject . hasJavaNature ( project ) ) { addToParentInfo ( javaProject ) ; readRawClasspath ( javaProject ) ; checkProjectReferenceChange ( project , javaProject ) ; checkExternalFolderChange ( project , javaProject ) ; } } else { try { javaProject . close ( ) ; } catch ( JavaModelException e ) { } removeFromParentInfo ( javaProject ) ; this . manager . removePerProjectInfo ( javaProject , false ) ; this . manager . containerRemove ( javaProject ) ; } this . state . rootsAreStale = true ; } else if ( ( delta . getFlags ( ) & IResourceDelta . DESCRIPTION ) != <NUM_LIT:0> ) { boolean wasJavaProject = this . state . findJavaProject ( project . getName ( ) ) != null ; boolean isJavaProject = JavaProject . hasJavaNature ( project ) ; if ( wasJavaProject != isJavaProject ) { this . manager . forceBatchInitializations ( false ) ; this . projectCachesToReset . add ( javaProject ) ; if ( isJavaProject ) { addToParentInfo ( javaProject ) ; readRawClasspath ( javaProject ) ; checkProjectReferenceChange ( project , javaProject ) ; checkExternalFolderChange ( project , javaProject ) ; } else { this . manager . removePerProjectInfo ( javaProject , true ) ; this . manager . containerRemove ( javaProject ) ; try { javaProject . close ( ) ; } catch ( JavaModelException e ) { } removeFromParentInfo ( javaProject ) ; } this . state . rootsAreStale = true ; } else { if ( isJavaProject ) { addToParentInfo ( javaProject ) ; children = delta . getAffectedChildren ( ) ; } } } else { if ( JavaProject . hasJavaNature ( project ) ) { addToParentInfo ( javaProject ) ; children = delta . getAffectedChildren ( ) ; } } break ; case IResourceDelta . REMOVED : this . manager . forceBatchInitializations ( false ) ; this . manager . removePerProjectInfo ( javaProject , true ) ; this . manager . containerRemove ( javaProject ) ; this . state . rootsAreStale = true ; break ; } break ; case IResource . FOLDER : if ( delta . getKind ( ) == IResourceDelta . CHANGED ) { children = delta . getAffectedChildren ( ) ; } break ; case IResource . FILE : IFile file = ( IFile ) resource ; int kind = delta . getKind ( ) ; RootInfo rootInfo ; if ( file . getName ( ) . equals ( JavaProject . CLASSPATH_FILENAME ) ) { this . manager . forceBatchInitializations ( false ) ; switch ( kind ) { case IResourceDelta . CHANGED : int flags = delta . getFlags ( ) ; if ( ( flags & IResourceDelta . CONTENT ) == <NUM_LIT:0> && ( flags & IResourceDelta . ENCODING ) == <NUM_LIT:0> && ( flags & IResourceDelta . MOVED_FROM ) == <NUM_LIT:0> ) { break ; } case IResourceDelta . ADDED : case IResourceDelta . REMOVED : javaProject = ( JavaProject ) JavaCore . create ( file . getProject ( ) ) ; readRawClasspath ( javaProject ) ; break ; } this . state . rootsAreStale = true ; } else if ( ( rootInfo = rootInfo ( file . getFullPath ( ) , kind ) ) != null && rootInfo . entryKind == IClasspathEntry . CPE_LIBRARY ) { javaProject = ( JavaProject ) JavaCore . create ( file . getProject ( ) ) ; javaProject . resetResolvedClasspath ( ) ; this . state . rootsAreStale = true ; } break ; } if ( children != null ) { for ( int i = <NUM_LIT:0> ; i < children . length ; i ++ ) { checkProjectsAndClasspathChanges ( children [ i ] ) ; } } } private void checkExternalFolderChange ( IProject project , JavaProject javaProject ) { ClasspathChange change = this . state . getClasspathChange ( project ) ; this . state . addExternalFolderChange ( javaProject , change == null ? null : change . oldResolvedClasspath ) ; } private void checkProjectReferenceChange ( IProject project , JavaProject javaProject ) { ClasspathChange change = this . state . getClasspathChange ( project ) ; this . state . addProjectReferenceChange ( javaProject , change == null ? null : change . oldResolvedClasspath ) ; } private void readRawClasspath ( JavaProject javaProject ) { try { PerProjectInfo perProjectInfo = javaProject . getPerProjectInfo ( ) ; if ( ! perProjectInfo . writtingRawClasspath ) perProjectInfo . readAndCacheClasspath ( javaProject ) ; } catch ( JavaModelException e ) { if ( VERBOSE ) { e . printStackTrace ( ) ; } } } private void checkSourceAttachmentChange ( IResourceDelta delta , IResource res ) { IPath rootPath = ( IPath ) this . state . sourceAttachments . get ( externalPath ( res ) ) ; if ( rootPath != null ) { RootInfo rootInfo = rootInfo ( rootPath , delta . getKind ( ) ) ; if ( rootInfo != null ) { IJavaProject projectOfRoot = rootInfo . project ; IPackageFragmentRoot root = null ; try { root = projectOfRoot . findPackageFragmentRoot ( rootPath ) ; if ( root != null ) { root . close ( ) ; } } catch ( JavaModelException e ) { } if ( root == null ) return ; switch ( delta . getKind ( ) ) { case IResourceDelta . ADDED : currentDelta ( ) . sourceAttached ( root ) ; break ; case IResourceDelta . CHANGED : currentDelta ( ) . sourceDetached ( root ) ; currentDelta ( ) . sourceAttached ( root ) ; break ; case IResourceDelta . REMOVED : currentDelta ( ) . sourceDetached ( root ) ; break ; } } } } private void close ( Openable element ) { try { element . close ( ) ; } catch ( JavaModelException e ) { } } private void contentChanged ( Openable element ) { boolean isPrimary = false ; boolean isPrimaryWorkingCopy = false ; if ( element . getElementType ( ) == IJavaElement . COMPILATION_UNIT ) { CompilationUnit cu = ( CompilationUnit ) element ; isPrimary = cu . isPrimary ( ) ; isPrimaryWorkingCopy = isPrimary && cu . isWorkingCopy ( ) ; } if ( isPrimaryWorkingCopy ) { currentDelta ( ) . changed ( element , IJavaElementDelta . F_PRIMARY_RESOURCE ) ; } else { close ( element ) ; int flags = IJavaElementDelta . F_CONTENT ; if ( element instanceof JarPackageFragmentRoot ) { flags |= IJavaElementDelta . F_ARCHIVE_CONTENT_CHANGED ; this . projectCachesToReset . add ( element . getJavaProject ( ) ) ; } if ( isPrimary ) { flags |= IJavaElementDelta . F_PRIMARY_RESOURCE ; } currentDelta ( ) . changed ( element , flags ) ; } } private Openable createElement ( IResource resource , int elementType , RootInfo rootInfo ) { if ( resource == null ) return null ; IPath path = resource . getFullPath ( ) ; IJavaElement element = null ; switch ( elementType ) { case IJavaElement . JAVA_PROJECT : if ( resource instanceof IProject ) { popUntilPrefixOf ( path ) ; if ( this . currentElement != null && this . currentElement . getElementType ( ) == IJavaElement . JAVA_PROJECT && ( ( IJavaProject ) this . currentElement ) . getProject ( ) . equals ( resource ) ) { return this . currentElement ; } if ( rootInfo != null && rootInfo . project . getProject ( ) . equals ( resource ) ) { element = rootInfo . project ; break ; } IProject proj = ( IProject ) resource ; if ( JavaProject . hasJavaNature ( proj ) ) { element = JavaCore . create ( proj ) ; } else { element = this . state . findJavaProject ( proj . getName ( ) ) ; } } break ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : element = rootInfo == null ? JavaCore . create ( resource ) : rootInfo . getPackageFragmentRoot ( resource ) ; break ; case IJavaElement . PACKAGE_FRAGMENT : if ( rootInfo != null ) { if ( rootInfo . project . contains ( resource ) ) { PackageFragmentRoot root = ( PackageFragmentRoot ) rootInfo . getPackageFragmentRoot ( null ) ; IPath pkgPath = path . removeFirstSegments ( root . resource ( ) . getFullPath ( ) . segmentCount ( ) ) ; String [ ] pkgName = pkgPath . segments ( ) ; element = root . getPackageFragment ( pkgName ) ; } } else { popUntilPrefixOf ( path ) ; if ( this . currentElement == null ) { element = JavaCore . create ( resource ) ; } else { PackageFragmentRoot root = this . currentElement . getPackageFragmentRoot ( ) ; if ( root == null ) { element = JavaCore . create ( resource ) ; } else if ( ( ( JavaProject ) root . getJavaProject ( ) ) . contains ( resource ) ) { IPath pkgPath = path . removeFirstSegments ( root . getPath ( ) . segmentCount ( ) ) ; String [ ] pkgName = pkgPath . segments ( ) ; element = root . getPackageFragment ( pkgName ) ; } } } break ; case IJavaElement . COMPILATION_UNIT : case IJavaElement . CLASS_FILE : popUntilPrefixOf ( path ) ; if ( this . currentElement == null ) { element = rootInfo == null ? JavaCore . create ( resource ) : JavaModelManager . create ( resource , rootInfo . project ) ; } else { IPackageFragment pkgFragment = null ; switch ( this . currentElement . getElementType ( ) ) { case IJavaElement . PACKAGE_FRAGMENT_ROOT : PackageFragmentRoot root = ( PackageFragmentRoot ) this . currentElement ; IPath rootPath = root . getPath ( ) ; IPath pkgPath = path . removeLastSegments ( <NUM_LIT:1> ) ; String [ ] pkgName = pkgPath . removeFirstSegments ( rootPath . segmentCount ( ) ) . segments ( ) ; pkgFragment = root . getPackageFragment ( pkgName ) ; break ; case IJavaElement . PACKAGE_FRAGMENT : Openable pkg = this . currentElement ; if ( pkg . getPath ( ) . equals ( path . removeLastSegments ( <NUM_LIT:1> ) ) ) { pkgFragment = ( IPackageFragment ) pkg ; } break ; case IJavaElement . COMPILATION_UNIT : case IJavaElement . CLASS_FILE : pkgFragment = ( IPackageFragment ) this . currentElement . getParent ( ) ; break ; } if ( pkgFragment == null ) { element = rootInfo == null ? JavaCore . create ( resource ) : JavaModelManager . create ( resource , rootInfo . project ) ; } else { if ( elementType == IJavaElement . COMPILATION_UNIT ) { String fileName = path . lastSegment ( ) ; element = pkgFragment . getCompilationUnit ( fileName ) ; } else { String fileName = path . lastSegment ( ) ; element = pkgFragment . getClassFile ( fileName ) ; } } } break ; } if ( element == null ) return null ; this . currentElement = ( Openable ) element ; return this . currentElement ; } public void checkExternalArchiveChanges ( IJavaElement [ ] elementsScope , IProgressMonitor monitor ) throws JavaModelException { checkExternalArchiveChanges ( elementsScope , false , monitor ) ; } private void checkExternalArchiveChanges ( IJavaElement [ ] elementsScope , boolean asynchronous , IProgressMonitor monitor ) throws JavaModelException { if ( monitor != null && monitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; try { if ( monitor != null ) monitor . beginTask ( "<STR_LIT>" , <NUM_LIT:1> ) ; boolean hasExternalWorkingCopyProject = false ; for ( int i = <NUM_LIT:0> , length = elementsScope . length ; i < length ; i ++ ) { IJavaElement element = elementsScope [ i ] ; this . state . addForRefresh ( elementsScope [ i ] ) ; if ( element . getElementType ( ) == IJavaElement . JAVA_MODEL ) { HashSet projects = JavaModelManager . getJavaModelManager ( ) . getExternalWorkingCopyProjects ( ) ; if ( projects != null ) { hasExternalWorkingCopyProject = true ; Iterator iterator = projects . iterator ( ) ; while ( iterator . hasNext ( ) ) { JavaProject project = ( JavaProject ) iterator . next ( ) ; project . resetCaches ( ) ; } } } } HashSet elementsToRefresh = this . state . removeExternalElementsToRefresh ( ) ; boolean hasDelta = elementsToRefresh != null && createExternalArchiveDelta ( elementsToRefresh , monitor ) ; if ( hasDelta ) { IJavaElementDelta [ ] projectDeltas = this . currentDelta . getAffectedChildren ( ) ; final int length = projectDeltas . length ; final IProject [ ] projectsToTouch = new IProject [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IJavaElementDelta delta = projectDeltas [ i ] ; JavaProject javaProject = ( JavaProject ) delta . getElement ( ) ; projectsToTouch [ i ] = javaProject . getProject ( ) ; } if ( projectsToTouch . length > <NUM_LIT:0> ) { if ( asynchronous ) { WorkspaceJob touchJob = new WorkspaceJob ( Messages . updating_external_archives_jobName ) { public IStatus runInWorkspace ( IProgressMonitor progressMonitor ) throws CoreException { try { if ( progressMonitor != null ) progressMonitor . beginTask ( "<STR_LIT>" , projectsToTouch . length ) ; touchProjects ( projectsToTouch , progressMonitor ) ; } finally { if ( progressMonitor != null ) progressMonitor . done ( ) ; } return Status . OK_STATUS ; } public boolean belongsTo ( Object family ) { return ResourcesPlugin . FAMILY_MANUAL_REFRESH == family ; } } ; touchJob . schedule ( ) ; } else { IWorkspaceRunnable runnable = new IWorkspaceRunnable ( ) { public void run ( IProgressMonitor progressMonitor ) throws CoreException { for ( int i = <NUM_LIT:0> ; i < projectsToTouch . length ; i ++ ) { IProject project = projectsToTouch [ i ] ; if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + project . getName ( ) + "<STR_LIT>" ) ; project . touch ( progressMonitor ) ; } } } ; try { ResourcesPlugin . getWorkspace ( ) . run ( runnable , monitor ) ; } catch ( CoreException e ) { throw new JavaModelException ( e ) ; } } } if ( this . currentDelta != null ) { fire ( this . currentDelta , DEFAULT_CHANGE_EVENT ) ; } } else if ( hasExternalWorkingCopyProject ) { JavaModelManager . getJavaModelManager ( ) . resetJarTypeCache ( ) ; } } finally { this . currentDelta = null ; if ( monitor != null ) monitor . done ( ) ; } } protected void touchProjects ( final IProject [ ] projectsToTouch , IProgressMonitor progressMonitor ) throws CoreException { for ( int i = <NUM_LIT:0> ; i < projectsToTouch . length ; i ++ ) { IProgressMonitor monitor = progressMonitor == null ? null : new SubProgressMonitor ( progressMonitor , <NUM_LIT:1> ) ; IProject project = projectsToTouch [ i ] ; if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + project . getName ( ) + "<STR_LIT>" ) ; project . touch ( monitor ) ; } } private boolean createExternalArchiveDelta ( HashSet refreshedElements , IProgressMonitor monitor ) { HashMap externalArchivesStatus = new HashMap ( ) ; boolean hasDelta = false ; HashSet archivePathsToRefresh = new HashSet ( ) ; Iterator iterator = refreshedElements . iterator ( ) ; while ( iterator . hasNext ( ) ) { IJavaElement element = ( IJavaElement ) iterator . next ( ) ; switch ( element . getElementType ( ) ) { case IJavaElement . PACKAGE_FRAGMENT_ROOT : archivePathsToRefresh . add ( element . getPath ( ) ) ; break ; case IJavaElement . JAVA_PROJECT : JavaProject javaProject = ( JavaProject ) element ; if ( ! JavaProject . hasJavaNature ( javaProject . getProject ( ) ) ) { break ; } IClasspathEntry [ ] classpath ; try { classpath = javaProject . getResolvedClasspath ( ) ; for ( int j = <NUM_LIT:0> , cpLength = classpath . length ; j < cpLength ; j ++ ) { if ( classpath [ j ] . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY ) { archivePathsToRefresh . add ( classpath [ j ] . getPath ( ) ) ; } } } catch ( JavaModelException e ) { } break ; case IJavaElement . JAVA_MODEL : Iterator projectNames = this . state . getOldJavaProjecNames ( ) . iterator ( ) ; while ( projectNames . hasNext ( ) ) { String projectName = ( String ) projectNames . next ( ) ; IProject project = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getProject ( projectName ) ; if ( ! JavaProject . hasJavaNature ( project ) ) { continue ; } javaProject = ( JavaProject ) JavaCore . create ( project ) ; try { classpath = javaProject . getResolvedClasspath ( ) ; for ( int k = <NUM_LIT:0> , cpLength = classpath . length ; k < cpLength ; k ++ ) { if ( classpath [ k ] . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY ) { archivePathsToRefresh . add ( classpath [ k ] . getPath ( ) ) ; } } } catch ( JavaModelException e2 ) { continue ; } } break ; } } Iterator projectNames = this . state . getOldJavaProjecNames ( ) . iterator ( ) ; IWorkspaceRoot wksRoot = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; while ( projectNames . hasNext ( ) ) { if ( monitor != null && monitor . isCanceled ( ) ) break ; String projectName = ( String ) projectNames . next ( ) ; IProject project = wksRoot . getProject ( projectName ) ; if ( ! JavaProject . hasJavaNature ( project ) ) { continue ; } JavaProject javaProject = ( JavaProject ) JavaCore . create ( project ) ; IClasspathEntry [ ] entries ; try { entries = javaProject . getResolvedClasspath ( ) ; } catch ( JavaModelException e1 ) { continue ; } boolean deltaContainsModifiedJar = false ; for ( int j = <NUM_LIT:0> ; j < entries . length ; j ++ ) { if ( entries [ j ] . getEntryKind ( ) == IClasspathEntry . CPE_LIBRARY ) { IPath entryPath = entries [ j ] . getPath ( ) ; if ( ! archivePathsToRefresh . contains ( entryPath ) ) continue ; String status = ( String ) externalArchivesStatus . get ( entryPath ) ; if ( status == null ) { Object targetLibrary = JavaModel . getTarget ( entryPath , true ) ; if ( targetLibrary == null ) { if ( this . state . getExternalLibTimeStamps ( ) . remove ( entryPath ) != null && this . state . roots . get ( entryPath ) != null ) { externalArchivesStatus . put ( entryPath , EXTERNAL_JAR_REMOVED ) ; this . manager . indexManager . removeIndex ( entryPath ) ; } } else if ( targetLibrary instanceof File ) { File externalFile = ( File ) targetLibrary ; Long oldTimestamp = ( Long ) this . state . getExternalLibTimeStamps ( ) . get ( entryPath ) ; long newTimeStamp = getTimeStamp ( externalFile ) ; if ( oldTimestamp != null ) { if ( newTimeStamp == <NUM_LIT:0> ) { externalArchivesStatus . put ( entryPath , EXTERNAL_JAR_REMOVED ) ; this . state . getExternalLibTimeStamps ( ) . remove ( entryPath ) ; this . manager . indexManager . removeIndex ( entryPath ) ; } else if ( oldTimestamp . longValue ( ) != newTimeStamp ) { externalArchivesStatus . put ( entryPath , EXTERNAL_JAR_CHANGED ) ; this . state . getExternalLibTimeStamps ( ) . put ( entryPath , new Long ( newTimeStamp ) ) ; this . manager . indexManager . removeIndex ( entryPath ) ; this . manager . indexManager . indexLibrary ( entryPath , project . getProject ( ) , ( ( ClasspathEntry ) entries [ j ] ) . getLibraryIndexLocation ( ) ) ; } else { URL indexLocation = ( ( ClasspathEntry ) entries [ j ] ) . getLibraryIndexLocation ( ) ; if ( indexLocation != null ) { this . manager . indexManager . indexLibrary ( entryPath , project . getProject ( ) , indexLocation ) ; } externalArchivesStatus . put ( entryPath , EXTERNAL_JAR_UNCHANGED ) ; } } else { if ( newTimeStamp == <NUM_LIT:0> ) { externalArchivesStatus . put ( entryPath , EXTERNAL_JAR_UNCHANGED ) ; } else { externalArchivesStatus . put ( entryPath , EXTERNAL_JAR_ADDED ) ; this . state . getExternalLibTimeStamps ( ) . put ( entryPath , new Long ( newTimeStamp ) ) ; this . manager . indexManager . removeIndex ( entryPath ) ; this . manager . indexManager . indexLibrary ( entryPath , project . getProject ( ) , ( ( ClasspathEntry ) entries [ j ] ) . getLibraryIndexLocation ( ) ) ; } } } else { externalArchivesStatus . put ( entryPath , INTERNAL_JAR_IGNORE ) ; } } status = ( String ) externalArchivesStatus . get ( entryPath ) ; if ( status != null ) { if ( status == EXTERNAL_JAR_ADDED ) { PackageFragmentRoot root = ( PackageFragmentRoot ) javaProject . getPackageFragmentRoot ( entryPath . toString ( ) ) ; if ( VERBOSE ) { System . out . println ( "<STR_LIT>" + root . getElementName ( ) ) ; } elementAdded ( root , null , null ) ; deltaContainsModifiedJar = true ; this . state . addClasspathValidation ( javaProject ) ; hasDelta = true ; } else if ( status == EXTERNAL_JAR_CHANGED ) { PackageFragmentRoot root = ( PackageFragmentRoot ) javaProject . getPackageFragmentRoot ( entryPath . toString ( ) ) ; if ( VERBOSE ) { System . out . println ( "<STR_LIT>" + root . getElementName ( ) ) ; } contentChanged ( root ) ; deltaContainsModifiedJar = true ; hasDelta = true ; } else if ( status == EXTERNAL_JAR_REMOVED ) { PackageFragmentRoot root = ( PackageFragmentRoot ) javaProject . getPackageFragmentRoot ( entryPath . toString ( ) ) ; if ( VERBOSE ) { System . out . println ( "<STR_LIT>" + root . getElementName ( ) ) ; } elementRemoved ( root , null , null ) ; deltaContainsModifiedJar = true ; this . state . addClasspathValidation ( javaProject ) ; hasDelta = true ; } } } } if ( deltaContainsModifiedJar ) { javaProject . resetResolvedClasspath ( ) ; } } JavaModel . flushExternalFileCache ( ) ; if ( hasDelta ) { JavaModelManager . getJavaModelManager ( ) . resetJarTypeCache ( ) ; } return hasDelta ; } private JavaElementDelta currentDelta ( ) { if ( this . currentDelta == null ) { this . currentDelta = new JavaElementDelta ( this . manager . getJavaModel ( ) ) ; } return this . currentDelta ; } private void deleting ( IProject project ) { try { this . manager . indexManager . discardJobs ( project . getName ( ) ) ; JavaProject javaProject = ( JavaProject ) JavaCore . create ( project ) ; if ( this . oldRoots == null ) { this . oldRoots = new HashMap ( ) ; } if ( javaProject . isOpen ( ) ) { this . oldRoots . put ( javaProject , javaProject . getPackageFragmentRoots ( ) ) ; } else { this . oldRoots . put ( javaProject , javaProject . computePackageFragmentRoots ( javaProject . getResolvedClasspath ( ) , false , null ) ) ; } javaProject . close ( ) ; this . state . getOldJavaProjecNames ( ) ; removeFromParentInfo ( javaProject ) ; this . manager . resetProjectPreferences ( javaProject ) ; } catch ( JavaModelException e ) { } } private void elementAdded ( Openable element , IResourceDelta delta , RootInfo rootInfo ) { int elementType = element . getElementType ( ) ; if ( elementType == IJavaElement . JAVA_PROJECT ) { IProject project ; if ( delta != null && JavaProject . hasJavaNature ( project = ( IProject ) delta . getResource ( ) ) ) { addToParentInfo ( element ) ; this . manager . getPerProjectInfo ( project , true ) . rememberExternalLibTimestamps ( ) ; if ( ( delta . getFlags ( ) & IResourceDelta . MOVED_FROM ) != <NUM_LIT:0> ) { Openable movedFromElement = ( Openable ) element . getJavaModel ( ) . getJavaProject ( delta . getMovedFromPath ( ) . lastSegment ( ) ) ; currentDelta ( ) . movedTo ( element , movedFromElement ) ; } else { close ( element ) ; currentDelta ( ) . added ( element ) ; } this . state . updateRoots ( element . getPath ( ) , delta , this ) ; this . projectCachesToReset . add ( element ) ; } } else { if ( delta == null || ( delta . getFlags ( ) & IResourceDelta . MOVED_FROM ) == <NUM_LIT:0> ) { if ( isPrimaryWorkingCopy ( element , elementType ) ) { currentDelta ( ) . changed ( element , IJavaElementDelta . F_PRIMARY_RESOURCE ) ; } else { addToParentInfo ( element ) ; close ( element ) ; currentDelta ( ) . added ( element ) ; } } else { addToParentInfo ( element ) ; close ( element ) ; IPath movedFromPath = delta . getMovedFromPath ( ) ; IResource res = delta . getResource ( ) ; IResource movedFromRes ; if ( res instanceof IFile ) { movedFromRes = res . getWorkspace ( ) . getRoot ( ) . getFile ( movedFromPath ) ; } else { movedFromRes = res . getWorkspace ( ) . getRoot ( ) . getFolder ( movedFromPath ) ; } IPath rootPath = externalPath ( movedFromRes ) ; RootInfo movedFromInfo = enclosingRootInfo ( rootPath , IResourceDelta . REMOVED ) ; int movedFromType = elementType ( movedFromRes , IResourceDelta . REMOVED , element . getParent ( ) . getElementType ( ) , movedFromInfo ) ; this . currentElement = null ; Openable movedFromElement = elementType != IJavaElement . JAVA_PROJECT && movedFromType == IJavaElement . JAVA_PROJECT ? null : createElement ( movedFromRes , movedFromType , movedFromInfo ) ; if ( movedFromElement == null ) { currentDelta ( ) . added ( element ) ; } else { currentDelta ( ) . movedTo ( element , movedFromElement ) ; } } switch ( elementType ) { case IJavaElement . PACKAGE_FRAGMENT_ROOT : JavaProject project = ( JavaProject ) element . getJavaProject ( ) ; this . projectCachesToReset . add ( project ) ; break ; case IJavaElement . PACKAGE_FRAGMENT : project = ( JavaProject ) element . getJavaProject ( ) ; this . projectCachesToReset . add ( project ) ; break ; } } } private void elementRemoved ( Openable element , IResourceDelta delta , RootInfo rootInfo ) { int elementType = element . getElementType ( ) ; if ( delta == null || ( delta . getFlags ( ) & IResourceDelta . MOVED_TO ) == <NUM_LIT:0> ) { if ( isPrimaryWorkingCopy ( element , elementType ) ) { currentDelta ( ) . changed ( element , IJavaElementDelta . F_PRIMARY_RESOURCE ) ; } else { close ( element ) ; removeFromParentInfo ( element ) ; currentDelta ( ) . removed ( element ) ; } } else { close ( element ) ; removeFromParentInfo ( element ) ; IPath movedToPath = delta . getMovedToPath ( ) ; IResource res = delta . getResource ( ) ; IResource movedToRes ; switch ( res . getType ( ) ) { case IResource . PROJECT : movedToRes = res . getWorkspace ( ) . getRoot ( ) . getProject ( movedToPath . lastSegment ( ) ) ; break ; case IResource . FOLDER : movedToRes = res . getWorkspace ( ) . getRoot ( ) . getFolder ( movedToPath ) ; break ; case IResource . FILE : movedToRes = res . getWorkspace ( ) . getRoot ( ) . getFile ( movedToPath ) ; break ; default : return ; } IPath rootPath = externalPath ( movedToRes ) ; RootInfo movedToInfo = enclosingRootInfo ( rootPath , IResourceDelta . ADDED ) ; int movedToType = elementType ( movedToRes , IResourceDelta . ADDED , element . getParent ( ) . getElementType ( ) , movedToInfo ) ; this . currentElement = null ; Openable movedToElement = elementType != IJavaElement . JAVA_PROJECT && movedToType == IJavaElement . JAVA_PROJECT ? null : createElement ( movedToRes , movedToType , movedToInfo ) ; if ( movedToElement == null ) { currentDelta ( ) . removed ( element ) ; } else { currentDelta ( ) . movedFrom ( element , movedToElement ) ; } } switch ( elementType ) { case IJavaElement . JAVA_MODEL : this . manager . indexManager . reset ( ) ; break ; case IJavaElement . JAVA_PROJECT : this . state . updateRoots ( element . getPath ( ) , delta , this ) ; this . projectCachesToReset . add ( element ) ; break ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : JavaProject project = ( JavaProject ) element . getJavaProject ( ) ; this . projectCachesToReset . add ( project ) ; break ; case IJavaElement . PACKAGE_FRAGMENT : project = ( JavaProject ) element . getJavaProject ( ) ; this . projectCachesToReset . add ( project ) ; break ; } } private int elementType ( IResource res , int kind , int parentType , RootInfo rootInfo ) { switch ( parentType ) { case IJavaElement . JAVA_MODEL : return IJavaElement . JAVA_PROJECT ; case NON_JAVA_RESOURCE : case IJavaElement . JAVA_PROJECT : if ( rootInfo == null ) { rootInfo = enclosingRootInfo ( res . getFullPath ( ) , kind ) ; } if ( rootInfo != null && rootInfo . isRootOfProject ( res . getFullPath ( ) ) ) { return IJavaElement . PACKAGE_FRAGMENT_ROOT ; } case IJavaElement . PACKAGE_FRAGMENT_ROOT : case IJavaElement . PACKAGE_FRAGMENT : if ( rootInfo == null ) { IPath rootPath = externalPath ( res ) ; rootInfo = enclosingRootInfo ( rootPath , kind ) ; } if ( rootInfo == null ) { return NON_JAVA_RESOURCE ; } if ( Util . isExcluded ( res , rootInfo . inclusionPatterns , rootInfo . exclusionPatterns ) ) { return NON_JAVA_RESOURCE ; } if ( res . getType ( ) == IResource . FOLDER ) { if ( parentType == NON_JAVA_RESOURCE && ! Util . isExcluded ( res . getParent ( ) , rootInfo . inclusionPatterns , rootInfo . exclusionPatterns ) ) { return NON_JAVA_RESOURCE ; } String sourceLevel = rootInfo . project == null ? null : rootInfo . project . getOption ( JavaCore . COMPILER_SOURCE , true ) ; String complianceLevel = rootInfo . project == null ? null : rootInfo . project . getOption ( JavaCore . COMPILER_COMPLIANCE , true ) ; if ( Util . isValidFolderNameForPackage ( res . getName ( ) , sourceLevel , complianceLevel ) ) { return IJavaElement . PACKAGE_FRAGMENT ; } return NON_JAVA_RESOURCE ; } String fileName = res . getName ( ) ; String sourceLevel = rootInfo . project == null ? null : rootInfo . project . getOption ( JavaCore . COMPILER_SOURCE , true ) ; String complianceLevel = rootInfo . project == null ? null : rootInfo . project . getOption ( JavaCore . COMPILER_COMPLIANCE , true ) ; if ( Util . isValidCompilationUnitName ( fileName , sourceLevel , complianceLevel ) ) { return IJavaElement . COMPILATION_UNIT ; } else if ( Util . isValidClassFileName ( fileName , sourceLevel , complianceLevel ) ) { return IJavaElement . CLASS_FILE ; } else { IPath rootPath = externalPath ( res ) ; if ( ( rootInfo = rootInfo ( rootPath , kind ) ) != null && rootInfo . project . getProject ( ) . getFullPath ( ) . isPrefixOf ( rootPath ) ) { return IJavaElement . PACKAGE_FRAGMENT_ROOT ; } else { return NON_JAVA_RESOURCE ; } } default : return NON_JAVA_RESOURCE ; } } public void flush ( ) { this . javaModelDeltas = new ArrayList ( ) ; } private SourceElementParser getSourceElementParser ( Openable element ) { if ( this . sourceElementParserCache == null ) this . sourceElementParserCache = this . manager . indexManager . getSourceElementParser ( element . getJavaProject ( ) , null ) ; return this . sourceElementParserCache ; } private RootInfo enclosingRootInfo ( IPath path , int kind ) { while ( path != null && path . segmentCount ( ) > <NUM_LIT:0> ) { RootInfo rootInfo = rootInfo ( path , kind ) ; if ( rootInfo != null ) return rootInfo ; path = path . removeLastSegments ( <NUM_LIT:1> ) ; } return null ; } private IPath externalPath ( IResource res ) { IPath resourcePath = res . getFullPath ( ) ; if ( ExternalFoldersManager . isInternalPathForExternalFolder ( resourcePath ) ) return res . getLocation ( ) ; return resourcePath ; } public void fire ( IJavaElementDelta customDelta , int eventType ) { if ( ! this . isFiring ) return ; if ( DEBUG ) { System . out . println ( "<STR_LIT>" ) ; } IJavaElementDelta deltaToNotify ; if ( customDelta == null ) { deltaToNotify = mergeDeltas ( this . javaModelDeltas ) ; } else { deltaToNotify = customDelta ; } if ( deltaToNotify != null ) { Iterator scopes = this . manager . searchScopes . keySet ( ) . iterator ( ) ; while ( scopes . hasNext ( ) ) { AbstractSearchScope scope = ( AbstractSearchScope ) scopes . next ( ) ; scope . processDelta ( deltaToNotify , eventType ) ; } JavaWorkspaceScope workspaceScope = this . manager . workspaceScope ; if ( workspaceScope != null ) workspaceScope . processDelta ( deltaToNotify , eventType ) ; } IElementChangedListener [ ] listeners ; int [ ] listenerMask ; int listenerCount ; synchronized ( this . state ) { listeners = this . state . elementChangedListeners ; listenerMask = this . state . elementChangedListenerMasks ; listenerCount = this . state . elementChangedListenerCount ; } switch ( eventType ) { case DEFAULT_CHANGE_EVENT : case ElementChangedEvent . POST_CHANGE : firePostChangeDelta ( deltaToNotify , listeners , listenerMask , listenerCount ) ; fireReconcileDelta ( listeners , listenerMask , listenerCount ) ; break ; } } private void firePostChangeDelta ( IJavaElementDelta deltaToNotify , IElementChangedListener [ ] listeners , int [ ] listenerMask , int listenerCount ) { if ( DEBUG ) { System . out . println ( "<STR_LIT>" + Thread . currentThread ( ) + "<STR_LIT>" ) ; System . out . println ( deltaToNotify == null ? "<STR_LIT>" : deltaToNotify . toString ( ) ) ; } if ( deltaToNotify != null ) { flush ( ) ; JavaModelOperation . setAttribute ( JavaModelOperation . HAS_MODIFIED_RESOURCE_ATTR , null ) ; notifyListeners ( deltaToNotify , ElementChangedEvent . POST_CHANGE , listeners , listenerMask , listenerCount ) ; } } private void fireReconcileDelta ( IElementChangedListener [ ] listeners , int [ ] listenerMask , int listenerCount ) { IJavaElementDelta deltaToNotify = mergeDeltas ( this . reconcileDeltas . values ( ) ) ; if ( DEBUG ) { System . out . println ( "<STR_LIT>" + Thread . currentThread ( ) + "<STR_LIT>" ) ; System . out . println ( deltaToNotify == null ? "<STR_LIT>" : deltaToNotify . toString ( ) ) ; } if ( deltaToNotify != null ) { this . reconcileDeltas = new HashMap ( ) ; notifyListeners ( deltaToNotify , ElementChangedEvent . POST_RECONCILE , listeners , listenerMask , listenerCount ) ; } } private boolean isAffectedBy ( IResourceDelta rootDelta ) { if ( rootDelta != null ) { class FoundRelevantDeltaException extends RuntimeException { private static final long serialVersionUID = <NUM_LIT> ; } try { rootDelta . accept ( new IResourceDeltaVisitor ( ) { public boolean visit ( IResourceDelta delta ) { switch ( delta . getKind ( ) ) { case IResourceDelta . ADDED : case IResourceDelta . REMOVED : throw new FoundRelevantDeltaException ( ) ; case IResourceDelta . CHANGED : if ( delta . getAffectedChildren ( ) . length == <NUM_LIT:0> && ( delta . getFlags ( ) & ~ ( IResourceDelta . SYNC | IResourceDelta . MARKERS ) ) != <NUM_LIT:0> ) { throw new FoundRelevantDeltaException ( ) ; } } return true ; } } , IContainer . INCLUDE_HIDDEN ) ; } catch ( FoundRelevantDeltaException e ) { return true ; } catch ( CoreException e ) { } } return false ; } private boolean isPrimaryWorkingCopy ( IJavaElement element , int elementType ) { if ( elementType == IJavaElement . COMPILATION_UNIT ) { CompilationUnit cu = ( CompilationUnit ) element ; return cu . isPrimary ( ) && cu . isWorkingCopy ( ) ; } return false ; } private boolean isResFilteredFromOutput ( RootInfo rootInfo , OutputsInfo info , IResource res , int elementType ) { if ( info != null ) { JavaProject javaProject = null ; String sourceLevel = null ; String complianceLevel = null ; IPath resPath = res . getFullPath ( ) ; for ( int i = <NUM_LIT:0> ; i < info . outputCount ; i ++ ) { if ( info . paths [ i ] . isPrefixOf ( resPath ) ) { if ( info . traverseModes [ i ] != IGNORE ) { if ( info . traverseModes [ i ] == SOURCE && elementType == IJavaElement . CLASS_FILE ) { return true ; } if ( elementType == IJavaElement . JAVA_PROJECT && res instanceof IFile ) { if ( sourceLevel == null ) { javaProject = rootInfo == null ? ( JavaProject ) createElement ( res . getProject ( ) , IJavaElement . JAVA_PROJECT , null ) : rootInfo . project ; if ( javaProject != null ) { sourceLevel = javaProject . getOption ( JavaCore . COMPILER_SOURCE , true ) ; complianceLevel = javaProject . getOption ( JavaCore . COMPILER_COMPLIANCE , true ) ; } } if ( Util . isValidClassFileName ( res . getName ( ) , sourceLevel , complianceLevel ) ) { return true ; } } } else { return true ; } } } } return false ; } private IJavaElementDelta mergeDeltas ( Collection deltas ) { if ( deltas . size ( ) == <NUM_LIT:0> ) return null ; if ( deltas . size ( ) == <NUM_LIT:1> ) return ( IJavaElementDelta ) deltas . iterator ( ) . next ( ) ; if ( VERBOSE ) { System . out . println ( "<STR_LIT>" + deltas . size ( ) + "<STR_LIT>" + Thread . currentThread ( ) + "<STR_LIT:]>" ) ; } Iterator iterator = deltas . iterator ( ) ; JavaElementDelta rootDelta = new JavaElementDelta ( this . manager . javaModel ) ; boolean insertedTree = false ; while ( iterator . hasNext ( ) ) { JavaElementDelta delta = ( JavaElementDelta ) iterator . next ( ) ; if ( VERBOSE ) { System . out . println ( delta . toString ( ) ) ; } IJavaElement element = delta . getElement ( ) ; if ( this . manager . javaModel . equals ( element ) ) { IJavaElementDelta [ ] children = delta . getAffectedChildren ( ) ; for ( int j = <NUM_LIT:0> ; j < children . length ; j ++ ) { JavaElementDelta projectDelta = ( JavaElementDelta ) children [ j ] ; rootDelta . insertDeltaTree ( projectDelta . getElement ( ) , projectDelta ) ; insertedTree = true ; } IResourceDelta [ ] resourceDeltas = delta . getResourceDeltas ( ) ; if ( resourceDeltas != null ) { for ( int i = <NUM_LIT:0> , length = resourceDeltas . length ; i < length ; i ++ ) { rootDelta . addResourceDelta ( resourceDeltas [ i ] ) ; insertedTree = true ; } } } else { rootDelta . insertDeltaTree ( element , delta ) ; insertedTree = true ; } } if ( insertedTree ) return rootDelta ; return null ; } private void notifyListeners ( IJavaElementDelta deltaToNotify , int eventType , IElementChangedListener [ ] listeners , int [ ] listenerMask , int listenerCount ) { final ElementChangedEvent extraEvent = new ElementChangedEvent ( deltaToNotify , eventType ) ; for ( int i = <NUM_LIT:0> ; i < listenerCount ; i ++ ) { if ( ( listenerMask [ i ] & eventType ) != <NUM_LIT:0> ) { final IElementChangedListener listener = listeners [ i ] ; long start = - <NUM_LIT:1> ; if ( VERBOSE ) { System . out . print ( "<STR_LIT>" + ( i + <NUM_LIT:1> ) + "<STR_LIT:=>" + listener . toString ( ) ) ; start = System . currentTimeMillis ( ) ; } SafeRunner . run ( new ISafeRunnable ( ) { public void handleException ( Throwable exception ) { Util . log ( exception , "<STR_LIT>" ) ; } public void run ( ) throws Exception { PerformanceStats stats = null ; if ( PERF ) { stats = PerformanceStats . getStats ( JavaModelManager . DELTA_LISTENER_PERF , listener ) ; stats . startRun ( ) ; } listener . elementChanged ( extraEvent ) ; if ( PERF ) { stats . endRun ( ) ; } } } ) ; if ( VERBOSE ) { System . out . println ( "<STR_LIT>" + ( System . currentTimeMillis ( ) - start ) + "<STR_LIT>" ) ; } } } } private void notifyTypeHierarchies ( IElementChangedListener [ ] listeners , int listenerCount ) { for ( int i = <NUM_LIT:0> ; i < listenerCount ; i ++ ) { final IElementChangedListener listener = listeners [ i ] ; if ( ! ( listener instanceof TypeHierarchy ) ) continue ; SafeRunner . run ( new ISafeRunnable ( ) { public void handleException ( Throwable exception ) { Util . log ( exception , "<STR_LIT>" ) ; } public void run ( ) throws Exception { TypeHierarchy typeHierarchy = ( TypeHierarchy ) listener ; if ( typeHierarchy . hasFineGrainChanges ( ) ) { typeHierarchy . needsRefresh = true ; typeHierarchy . fireChange ( ) ; } } } ) ; } } private void nonJavaResourcesChanged ( Openable element , IResourceDelta delta ) throws JavaModelException { if ( element . isOpen ( ) ) { JavaElementInfo info = ( JavaElementInfo ) element . getElementInfo ( ) ; switch ( element . getElementType ( ) ) { case IJavaElement . JAVA_MODEL : ( ( JavaModelInfo ) info ) . nonJavaResources = null ; if ( ! ExternalFoldersManager . isInternalPathForExternalFolder ( delta . getFullPath ( ) ) ) currentDelta ( ) . addResourceDelta ( delta ) ; return ; case IJavaElement . JAVA_PROJECT : ( ( JavaProjectElementInfo ) info ) . setNonJavaResources ( null ) ; JavaProject project = ( JavaProject ) element ; PackageFragmentRoot projectRoot = ( PackageFragmentRoot ) project . getPackageFragmentRoot ( project . getProject ( ) ) ; if ( projectRoot . isOpen ( ) ) { ( ( PackageFragmentRootInfo ) projectRoot . getElementInfo ( ) ) . setNonJavaResources ( null ) ; } break ; case IJavaElement . PACKAGE_FRAGMENT : ( ( PackageFragmentInfo ) info ) . setNonJavaResources ( null ) ; break ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : ( ( PackageFragmentRootInfo ) info ) . setNonJavaResources ( null ) ; } } JavaElementDelta current = currentDelta ( ) ; JavaElementDelta elementDelta = current . find ( element ) ; if ( elementDelta == null ) { elementDelta = current . changed ( element , IJavaElementDelta . F_CONTENT ) ; } if ( ! ExternalFoldersManager . isInternalPathForExternalFolder ( delta . getFullPath ( ) ) ) elementDelta . addResourceDelta ( delta ) ; } private RootInfo oldRootInfo ( IPath path , JavaProject project ) { RootInfo oldInfo = ( RootInfo ) this . state . oldRoots . get ( path ) ; if ( oldInfo == null ) return null ; if ( oldInfo . project . equals ( project ) ) return oldInfo ; ArrayList oldInfos = ( ArrayList ) this . state . oldOtherRoots . get ( path ) ; if ( oldInfos == null ) return null ; for ( int i = <NUM_LIT:0> , length = oldInfos . size ( ) ; i < length ; i ++ ) { oldInfo = ( RootInfo ) oldInfos . get ( i ) ; if ( oldInfo . project . equals ( project ) ) return oldInfo ; } return null ; } private ArrayList otherRootsInfo ( IPath path , int kind ) { if ( kind == IResourceDelta . REMOVED ) { return ( ArrayList ) this . state . oldOtherRoots . get ( path ) ; } return ( ArrayList ) this . state . otherRoots . get ( path ) ; } private OutputsInfo outputsInfo ( RootInfo rootInfo , IResource res ) { try { JavaProject proj = rootInfo == null ? ( JavaProject ) createElement ( res . getProject ( ) , IJavaElement . JAVA_PROJECT , null ) : rootInfo . project ; if ( proj != null ) { IPath projectOutput = proj . getOutputLocation ( ) ; int traverseMode = IGNORE ; if ( proj . getProject ( ) . getFullPath ( ) . equals ( projectOutput ) ) { return new OutputsInfo ( new IPath [ ] { projectOutput } , new int [ ] { SOURCE } , <NUM_LIT:1> ) ; } IClasspathEntry [ ] classpath = proj . getResolvedClasspath ( ) ; IPath [ ] outputs = new IPath [ classpath . length + <NUM_LIT:1> ] ; int [ ] traverseModes = new int [ classpath . length + <NUM_LIT:1> ] ; int outputCount = <NUM_LIT:1> ; outputs [ <NUM_LIT:0> ] = projectOutput ; traverseModes [ <NUM_LIT:0> ] = traverseMode ; for ( int i = <NUM_LIT:0> , length = classpath . length ; i < length ; i ++ ) { IClasspathEntry entry = classpath [ i ] ; IPath entryPath = entry . getPath ( ) ; IPath output = entry . getOutputLocation ( ) ; if ( output != null ) { outputs [ outputCount ] = output ; if ( entryPath . equals ( output ) ) { traverseModes [ outputCount ++ ] = ( entry . getEntryKind ( ) == IClasspathEntry . CPE_SOURCE ) ? SOURCE : BINARY ; } else { traverseModes [ outputCount ++ ] = IGNORE ; } } if ( entryPath . equals ( projectOutput ) ) { traverseModes [ <NUM_LIT:0> ] = ( entry . getEntryKind ( ) == IClasspathEntry . CPE_SOURCE ) ? SOURCE : BINARY ; } } return new OutputsInfo ( outputs , traverseModes , outputCount ) ; } } catch ( JavaModelException e ) { } return null ; } private void popUntilPrefixOf ( IPath path ) { while ( this . currentElement != null ) { IPath currentElementPath = null ; if ( this . currentElement instanceof IPackageFragmentRoot ) { currentElementPath = ( ( IPackageFragmentRoot ) this . currentElement ) . getPath ( ) ; } else { IResource currentElementResource = this . currentElement . resource ( ) ; if ( currentElementResource != null ) { currentElementPath = currentElementResource . getFullPath ( ) ; } } if ( currentElementPath != null ) { if ( this . currentElement instanceof IPackageFragment && ( ( IPackageFragment ) this . currentElement ) . isDefaultPackage ( ) && currentElementPath . segmentCount ( ) != path . segmentCount ( ) - <NUM_LIT:1> ) { this . currentElement = ( Openable ) this . currentElement . getParent ( ) ; } if ( currentElementPath . isPrefixOf ( path ) ) { return ; } } this . currentElement = ( Openable ) this . currentElement . getParent ( ) ; } } private IJavaElementDelta processResourceDelta ( IResourceDelta changes ) { try { IJavaModel model = this . manager . getJavaModel ( ) ; if ( ! model . isOpen ( ) ) { try { model . open ( null ) ; } catch ( JavaModelException e ) { if ( VERBOSE ) { e . printStackTrace ( ) ; } return null ; } } this . state . initializeRoots ( false ) ; this . currentElement = null ; IResourceDelta [ ] deltas = changes . getAffectedChildren ( IResourceDelta . ADDED | IResourceDelta . REMOVED | IResourceDelta . CHANGED , IContainer . INCLUDE_HIDDEN ) ; for ( int i = <NUM_LIT:0> ; i < deltas . length ; i ++ ) { IResourceDelta delta = deltas [ i ] ; IResource res = delta . getResource ( ) ; RootInfo rootInfo = null ; int elementType ; IProject proj = ( IProject ) res ; boolean wasJavaProject = this . state . findJavaProject ( proj . getName ( ) ) != null ; boolean isJavaProject = JavaProject . hasJavaNature ( proj ) ; if ( ! wasJavaProject && ! isJavaProject ) { elementType = NON_JAVA_RESOURCE ; } else { IPath rootPath = externalPath ( res ) ; rootInfo = enclosingRootInfo ( rootPath , delta . getKind ( ) ) ; if ( rootInfo != null && rootInfo . isRootOfProject ( rootPath ) ) { elementType = IJavaElement . PACKAGE_FRAGMENT_ROOT ; } else { elementType = IJavaElement . JAVA_PROJECT ; } } traverseDelta ( delta , elementType , rootInfo , null ) ; if ( elementType == NON_JAVA_RESOURCE || ( wasJavaProject != isJavaProject && ( delta . getKind ( ) ) == IResourceDelta . CHANGED ) ) { try { nonJavaResourcesChanged ( ( JavaModel ) model , delta ) ; } catch ( JavaModelException e ) { } } } resetProjectCaches ( ) ; return this . currentDelta ; } finally { this . currentDelta = null ; } } public void resetProjectCaches ( ) { if ( this . projectCachesToReset . size ( ) == <NUM_LIT:0> ) return ; JavaModelManager . getJavaModelManager ( ) . resetJarTypeCache ( ) ; Iterator iterator = this . projectCachesToReset . iterator ( ) ; HashMap projectDepencies = this . state . projectDependencies ; HashSet affectedDependents = new HashSet ( ) ; while ( iterator . hasNext ( ) ) { JavaProject project = ( JavaProject ) iterator . next ( ) ; project . resetCaches ( ) ; addDependentProjects ( project , projectDepencies , affectedDependents ) ; } iterator = affectedDependents . iterator ( ) ; while ( iterator . hasNext ( ) ) { JavaProject project = ( JavaProject ) iterator . next ( ) ; project . resetCaches ( ) ; } this . projectCachesToReset . clear ( ) ; } public void registerJavaModelDelta ( IJavaElementDelta delta ) { this . javaModelDeltas . add ( delta ) ; } private void removeFromParentInfo ( Openable child ) { Openable parent = ( Openable ) child . getParent ( ) ; if ( parent != null && parent . isOpen ( ) ) { try { OpenableElementInfo info = ( OpenableElementInfo ) parent . getElementInfo ( ) ; info . removeChild ( child ) ; } catch ( JavaModelException e ) { } } } public void resourceChanged ( IResourceChangeEvent event ) { int eventType = this . overridenEventType == - <NUM_LIT:1> ? event . getType ( ) : this . overridenEventType ; IResource resource = event . getResource ( ) ; IResourceDelta delta = event . getDelta ( ) ; switch ( eventType ) { case IResourceChangeEvent . PRE_DELETE : try { if ( resource . getType ( ) == IResource . PROJECT && ( ( IProject ) resource ) . hasNature ( JavaCore . NATURE_ID ) ) { deleting ( ( IProject ) resource ) ; } } catch ( CoreException e ) { } return ; case IResourceChangeEvent . PRE_REFRESH : IProject [ ] projects = null ; Object o = event . getSource ( ) ; if ( o instanceof IProject ) { projects = new IProject [ ] { ( IProject ) o } ; } else if ( o instanceof IWorkspace ) { projects = ( ( IWorkspace ) o ) . getRoot ( ) . getProjects ( IContainer . INCLUDE_HIDDEN ) ; } JavaModelManager . getExternalManager ( ) . refreshReferences ( projects , null ) ; IJavaProject [ ] javaElements = new IJavaProject [ projects . length ] ; for ( int index = <NUM_LIT:0> ; index < projects . length ; index ++ ) { javaElements [ index ] = JavaCore . create ( projects [ index ] ) ; } try { checkExternalArchiveChanges ( javaElements , true , null ) ; } catch ( JavaModelException e ) { if ( ! e . isDoesNotExist ( ) ) Util . log ( e , "<STR_LIT>" ) ; } return ; case IResourceChangeEvent . POST_CHANGE : HashSet elementsToRefresh = this . state . removeExternalElementsToRefresh ( ) ; if ( isAffectedBy ( delta ) || elementsToRefresh != null ) { try { try { stopDeltas ( ) ; checkProjectsAndClasspathChanges ( delta ) ; if ( elementsToRefresh != null ) { createExternalArchiveDelta ( elementsToRefresh , null ) ; } HashMap classpathChanges = this . state . removeAllClasspathChanges ( ) ; if ( classpathChanges . size ( ) > <NUM_LIT:0> ) { boolean hasDelta = this . currentDelta != null ; JavaElementDelta javaDelta = currentDelta ( ) ; Iterator changes = classpathChanges . values ( ) . iterator ( ) ; while ( changes . hasNext ( ) ) { ClasspathChange change = ( ClasspathChange ) changes . next ( ) ; int result = change . generateDelta ( javaDelta , false ) ; if ( ( result & ClasspathChange . HAS_DELTA ) != <NUM_LIT:0> ) { hasDelta = true ; this . state . rootsAreStale = true ; change . requestIndexing ( ) ; this . state . addClasspathValidation ( change . project ) ; } if ( ( result & ClasspathChange . HAS_PROJECT_CHANGE ) != <NUM_LIT:0> ) { this . state . addProjectReferenceChange ( change . project , change . oldResolvedClasspath ) ; } if ( ( result & ClasspathChange . HAS_LIBRARY_CHANGE ) != <NUM_LIT:0> ) { this . state . addExternalFolderChange ( change . project , change . oldResolvedClasspath ) ; } } elementsToRefresh = this . state . removeExternalElementsToRefresh ( ) ; if ( elementsToRefresh != null ) { hasDelta |= createExternalArchiveDelta ( elementsToRefresh , null ) ; } if ( ! hasDelta ) this . currentDelta = null ; } IJavaElementDelta translatedDelta = processResourceDelta ( delta ) ; if ( translatedDelta != null ) { registerJavaModelDelta ( translatedDelta ) ; } } finally { this . sourceElementParserCache = null ; startDeltas ( ) ; } IElementChangedListener [ ] listeners ; int listenerCount ; synchronized ( this . state ) { listeners = this . state . elementChangedListeners ; listenerCount = this . state . elementChangedListenerCount ; } notifyTypeHierarchies ( listeners , listenerCount ) ; fire ( null , ElementChangedEvent . POST_CHANGE ) ; } finally { this . state . resetOldJavaProjectNames ( ) ; this . oldRoots = null ; } } return ; case IResourceChangeEvent . PRE_BUILD : this . state . initializeRoots ( false ) ; boolean isAffected = isAffectedBy ( delta ) ; boolean needCycleValidation = isAffected && validateClasspaths ( delta ) ; ExternalFolderChange [ ] folderChanges = this . state . removeExternalFolderChanges ( ) ; if ( folderChanges != null ) { for ( int i = <NUM_LIT:0> , length = folderChanges . length ; i < length ; i ++ ) { try { folderChanges [ i ] . updateExternalFoldersIfNecessary ( false , null ) ; } catch ( JavaModelException e ) { if ( ! e . isDoesNotExist ( ) ) Util . log ( e , "<STR_LIT>" ) ; } } } ClasspathValidation [ ] validations = this . state . removeClasspathValidations ( ) ; if ( validations != null ) { for ( int i = <NUM_LIT:0> , length = validations . length ; i < length ; i ++ ) { ClasspathValidation validation = validations [ i ] ; validation . validate ( ) ; } } ProjectReferenceChange [ ] projectRefChanges = this . state . removeProjectReferenceChanges ( ) ; if ( projectRefChanges != null ) { for ( int i = <NUM_LIT:0> , length = projectRefChanges . length ; i < length ; i ++ ) { try { projectRefChanges [ i ] . updateProjectReferencesIfNecessary ( ) ; } catch ( JavaModelException e ) { if ( ! e . isDoesNotExist ( ) ) Util . log ( e , "<STR_LIT>" ) ; } } } if ( needCycleValidation || projectRefChanges != null ) { try { JavaProject . validateCycles ( null ) ; } catch ( JavaModelException e ) { } } if ( isAffected ) { JavaModel . flushExternalFileCache ( ) ; JavaBuilder . buildStarting ( ) ; } return ; case IResourceChangeEvent . POST_BUILD : JavaBuilder . buildFinished ( ) ; return ; } } private RootInfo rootInfo ( IPath path , int kind ) { if ( kind == IResourceDelta . REMOVED ) { return ( RootInfo ) this . state . oldRoots . get ( path ) ; } return ( RootInfo ) this . state . roots . get ( path ) ; } private void startDeltas ( ) { this . isFiring = true ; } private void stopDeltas ( ) { this . isFiring = false ; } private void traverseDelta ( IResourceDelta delta , int elementType , RootInfo rootInfo , OutputsInfo outputsInfo ) { IResource res = delta . getResource ( ) ; if ( this . currentElement == null && rootInfo != null ) { this . currentElement = rootInfo . project ; } boolean processChildren = true ; if ( res instanceof IProject ) { this . sourceElementParserCache = null ; processChildren = updateCurrentDeltaAndIndex ( delta , elementType == IJavaElement . PACKAGE_FRAGMENT_ROOT ? IJavaElement . JAVA_PROJECT : elementType , rootInfo ) ; } else if ( rootInfo != null ) { processChildren = updateCurrentDeltaAndIndex ( delta , elementType , rootInfo ) ; } else { processChildren = true ; } if ( outputsInfo == null ) outputsInfo = outputsInfo ( rootInfo , res ) ; if ( processChildren ) { IResourceDelta [ ] children = delta . getAffectedChildren ( ) ; boolean oneChildOnClasspath = false ; int length = children . length ; IResourceDelta [ ] orphanChildren = null ; Openable parent = null ; boolean isValidParent = true ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IResourceDelta child = children [ i ] ; IResource childRes = child . getResource ( ) ; checkSourceAttachmentChange ( child , childRes ) ; IPath childPath = externalPath ( childRes ) ; int childKind = child . getKind ( ) ; RootInfo childRootInfo = rootInfo ( childPath , childKind ) ; RootInfo originalChildRootInfo = childRootInfo ; if ( childRootInfo != null && ! childRootInfo . isRootOfProject ( childPath ) ) { childRootInfo = null ; } int childType = elementType ( childRes , childKind , elementType , rootInfo == null ? childRootInfo : rootInfo ) ; boolean isResFilteredFromOutput = isResFilteredFromOutput ( rootInfo , outputsInfo , childRes , childType ) ; boolean isNestedRoot = rootInfo != null && childRootInfo != null ; if ( ! isResFilteredFromOutput && ! isNestedRoot ) { traverseDelta ( child , childType , rootInfo == null ? childRootInfo : rootInfo , outputsInfo ) ; if ( childType == NON_JAVA_RESOURCE ) { if ( rootInfo != null ) { if ( ! isValidParent ) continue ; if ( parent == null ) { if ( this . currentElement == null || ! rootInfo . project . equals ( this . currentElement . getJavaProject ( ) ) ) { this . currentElement = rootInfo . project ; } if ( elementType == IJavaElement . JAVA_PROJECT || ( elementType == IJavaElement . PACKAGE_FRAGMENT_ROOT && res instanceof IProject ) ) { parent = rootInfo . project ; } else { parent = createElement ( res , elementType , rootInfo ) ; } if ( parent == null ) { isValidParent = false ; continue ; } } try { nonJavaResourcesChanged ( parent , child ) ; } catch ( JavaModelException e ) { } } else { if ( orphanChildren == null ) orphanChildren = new IResourceDelta [ length ] ; orphanChildren [ i ] = child ; } } else { if ( rootInfo == null && childRootInfo == null ) { if ( orphanChildren == null ) orphanChildren = new IResourceDelta [ length ] ; orphanChildren [ i ] = child ; } } } else { oneChildOnClasspath = true ; } if ( isNestedRoot || ( childRootInfo == null && originalChildRootInfo != null ) ) { traverseDelta ( child , IJavaElement . PACKAGE_FRAGMENT_ROOT , originalChildRootInfo , null ) ; } ArrayList rootList ; if ( ( rootList = otherRootsInfo ( childPath , childKind ) ) != null ) { Iterator iterator = rootList . iterator ( ) ; while ( iterator . hasNext ( ) ) { originalChildRootInfo = ( RootInfo ) iterator . next ( ) ; this . currentElement = null ; traverseDelta ( child , IJavaElement . PACKAGE_FRAGMENT_ROOT , originalChildRootInfo , null ) ; } } } if ( orphanChildren != null && ( oneChildOnClasspath || res instanceof IProject ) ) { IProject rscProject = res . getProject ( ) ; JavaProject adoptiveProject = ( JavaProject ) JavaCore . create ( rscProject ) ; if ( adoptiveProject != null && JavaProject . hasJavaNature ( rscProject ) ) { for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { if ( orphanChildren [ i ] != null ) { try { nonJavaResourcesChanged ( adoptiveProject , orphanChildren [ i ] ) ; } catch ( JavaModelException e ) { } } } } } } } private void validateClasspaths ( IResourceDelta delta , HashSet affectedProjects ) { IResource resource = delta . getResource ( ) ; boolean processChildren = false ; switch ( resource . getType ( ) ) { case IResource . ROOT : if ( delta . getKind ( ) == IResourceDelta . CHANGED ) { processChildren = true ; } break ; case IResource . PROJECT : IProject project = ( IProject ) resource ; int kind = delta . getKind ( ) ; boolean isJavaProject = JavaProject . hasJavaNature ( project ) ; switch ( kind ) { case IResourceDelta . ADDED : processChildren = isJavaProject ; affectedProjects . add ( project . getFullPath ( ) ) ; break ; case IResourceDelta . CHANGED : processChildren = isJavaProject ; if ( ( delta . getFlags ( ) & IResourceDelta . OPEN ) != <NUM_LIT:0> ) { if ( isJavaProject ) { JavaProject javaProject = ( JavaProject ) JavaCore . create ( project ) ; this . state . addClasspathValidation ( javaProject ) ; } affectedProjects . add ( project . getFullPath ( ) ) ; } else if ( ( delta . getFlags ( ) & IResourceDelta . DESCRIPTION ) != <NUM_LIT:0> ) { boolean wasJavaProject = this . state . findJavaProject ( project . getName ( ) ) != null ; if ( wasJavaProject != isJavaProject ) { JavaProject javaProject = ( JavaProject ) JavaCore . create ( project ) ; this . state . addClasspathValidation ( javaProject ) ; affectedProjects . add ( project . getFullPath ( ) ) ; } } break ; case IResourceDelta . REMOVED : affectedProjects . add ( project . getFullPath ( ) ) ; break ; } break ; case IResource . FILE : IFile file = ( IFile ) resource ; String fileName = file . getName ( ) ; RootInfo rootInfo = null ; if ( fileName . equals ( JavaProject . CLASSPATH_FILENAME ) || ( ( rootInfo = rootInfo ( file . getFullPath ( ) , delta . getKind ( ) ) ) != null && rootInfo . entryKind == IClasspathEntry . CPE_LIBRARY ) ) { JavaProject javaProject = ( JavaProject ) JavaCore . create ( file . getProject ( ) ) ; this . state . addClasspathValidation ( javaProject ) ; affectedProjects . add ( file . getProject ( ) . getFullPath ( ) ) ; } break ; } if ( processChildren ) { IResourceDelta [ ] children = delta . getAffectedChildren ( ) ; for ( int i = <NUM_LIT:0> ; i < children . length ; i ++ ) { validateClasspaths ( children [ i ] , affectedProjects ) ; } } } private boolean validateClasspaths ( IResourceDelta delta ) { HashSet affectedProjects = new HashSet ( <NUM_LIT:5> ) ; validateClasspaths ( delta , affectedProjects ) ; boolean needCycleValidation = false ; if ( ! affectedProjects . isEmpty ( ) ) { IWorkspaceRoot workspaceRoot = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; IProject [ ] projects = workspaceRoot . getProjects ( ) ; int length = projects . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IProject project = projects [ i ] ; JavaProject javaProject = ( JavaProject ) JavaCore . create ( project ) ; try { IPath projectPath = project . getFullPath ( ) ; IClasspathEntry [ ] classpath = javaProject . getResolvedClasspath ( ) ; for ( int j = <NUM_LIT:0> , cpLength = classpath . length ; j < cpLength ; j ++ ) { IClasspathEntry entry = classpath [ j ] ; switch ( entry . getEntryKind ( ) ) { case IClasspathEntry . CPE_PROJECT : if ( affectedProjects . contains ( entry . getPath ( ) ) ) { this . state . addClasspathValidation ( javaProject ) ; needCycleValidation = true ; } break ; case IClasspathEntry . CPE_LIBRARY : IPath entryPath = entry . getPath ( ) ; IPath libProjectPath = entryPath . removeLastSegments ( entryPath . segmentCount ( ) - <NUM_LIT:1> ) ; if ( ! libProjectPath . equals ( projectPath ) && affectedProjects . contains ( libProjectPath ) ) { this . state . addClasspathValidation ( javaProject ) ; } break ; } } } catch ( JavaModelException e ) { } } } return needCycleValidation ; } public boolean updateCurrentDeltaAndIndex ( IResourceDelta delta , int elementType , RootInfo rootInfo ) { Openable element ; switch ( delta . getKind ( ) ) { case IResourceDelta . ADDED : IResource deltaRes = delta . getResource ( ) ; element = createElement ( deltaRes , elementType , rootInfo ) ; if ( element == null ) { this . state . updateRoots ( deltaRes . getFullPath ( ) , delta , this ) ; return rootInfo != null && rootInfo . inclusionPatterns != null ; } updateIndex ( element , delta ) ; elementAdded ( element , delta , rootInfo ) ; if ( elementType == IJavaElement . PACKAGE_FRAGMENT_ROOT ) this . state . addClasspathValidation ( rootInfo . project ) ; return elementType == IJavaElement . PACKAGE_FRAGMENT ; case IResourceDelta . REMOVED : deltaRes = delta . getResource ( ) ; element = createElement ( deltaRes , elementType , rootInfo ) ; if ( element == null ) { this . state . updateRoots ( deltaRes . getFullPath ( ) , delta , this ) ; return rootInfo != null && rootInfo . inclusionPatterns != null ; } updateIndex ( element , delta ) ; elementRemoved ( element , delta , rootInfo ) ; if ( elementType == IJavaElement . PACKAGE_FRAGMENT_ROOT ) this . state . addClasspathValidation ( rootInfo . project ) ; if ( deltaRes . getType ( ) == IResource . PROJECT ) { if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + deltaRes ) ; this . manager . setLastBuiltState ( ( IProject ) deltaRes , null ) ; this . manager . previousSessionContainers . remove ( element ) ; } return elementType == IJavaElement . PACKAGE_FRAGMENT ; case IResourceDelta . CHANGED : int flags = delta . getFlags ( ) ; if ( elementType == IJavaElement . PACKAGE_FRAGMENT_ROOT && ( flags & IResourceDelta . LOCAL_CHANGED ) != <NUM_LIT:0> ) { if ( oldRootInfo ( rootInfo . rootPath , rootInfo . project ) == null ) { break ; } deltaRes = delta . getResource ( ) ; Object target = JavaModel . getExternalTarget ( deltaRes . getLocation ( ) , true ) ; element = createElement ( deltaRes , elementType , rootInfo ) ; updateIndex ( element , delta ) ; if ( target != null ) { elementAdded ( element , delta , rootInfo ) ; } else { elementRemoved ( element , delta , rootInfo ) ; } this . state . addClasspathValidation ( rootInfo . project ) ; } else if ( ( flags & IResourceDelta . CONTENT ) != <NUM_LIT:0> || ( flags & IResourceDelta . ENCODING ) != <NUM_LIT:0> ) { element = createElement ( delta . getResource ( ) , elementType , rootInfo ) ; if ( element == null ) return false ; updateIndex ( element , delta ) ; contentChanged ( element ) ; } else if ( elementType == IJavaElement . JAVA_PROJECT ) { if ( ( flags & IResourceDelta . OPEN ) != <NUM_LIT:0> ) { IProject res = ( IProject ) delta . getResource ( ) ; element = createElement ( res , elementType , rootInfo ) ; if ( element == null ) { this . state . updateRoots ( res . getFullPath ( ) , delta , this ) ; return false ; } if ( res . isOpen ( ) ) { if ( JavaProject . hasJavaNature ( res ) ) { addToParentInfo ( element ) ; currentDelta ( ) . opened ( element ) ; this . state . updateRoots ( element . getPath ( ) , delta , this ) ; this . projectCachesToReset . add ( element ) ; this . manager . indexManager . indexAll ( res ) ; } } else { boolean wasJavaProject = this . state . findJavaProject ( res . getName ( ) ) != null ; if ( wasJavaProject ) { close ( element ) ; removeFromParentInfo ( element ) ; currentDelta ( ) . closed ( element ) ; this . manager . indexManager . discardJobs ( element . getElementName ( ) ) ; this . manager . indexManager . removeIndexFamily ( res . getFullPath ( ) ) ; } } return false ; } if ( ( flags & IResourceDelta . DESCRIPTION ) != <NUM_LIT:0> ) { IProject res = ( IProject ) delta . getResource ( ) ; boolean wasJavaProject = this . state . findJavaProject ( res . getName ( ) ) != null ; boolean isJavaProject = JavaProject . hasJavaNature ( res ) ; if ( wasJavaProject != isJavaProject ) { element = createElement ( res , elementType , rootInfo ) ; if ( element == null ) return false ; if ( isJavaProject ) { elementAdded ( element , delta , rootInfo ) ; this . manager . indexManager . indexAll ( res ) ; } else { elementRemoved ( element , delta , rootInfo ) ; this . manager . indexManager . discardJobs ( element . getElementName ( ) ) ; this . manager . indexManager . removeIndexFamily ( res . getFullPath ( ) ) ; if ( JavaBuilder . DEBUG ) System . out . println ( "<STR_LIT>" + res ) ; this . manager . setLastBuiltState ( res , null ) ; } return false ; } } } return true ; } return true ; } private void updateIndex ( Openable element , IResourceDelta delta ) { IndexManager indexManager = this . manager . indexManager ; if ( indexManager == null ) return ; switch ( element . getElementType ( ) ) { case IJavaElement . JAVA_PROJECT : switch ( delta . getKind ( ) ) { case IResourceDelta . ADDED : indexManager . indexAll ( element . getJavaProject ( ) . getProject ( ) ) ; break ; case IResourceDelta . REMOVED : indexManager . removeIndexFamily ( element . getJavaProject ( ) . getProject ( ) . getFullPath ( ) ) ; break ; } break ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : if ( element instanceof JarPackageFragmentRoot ) { JarPackageFragmentRoot root = ( JarPackageFragmentRoot ) element ; IPath jarPath = root . getPath ( ) ; switch ( delta . getKind ( ) ) { case IResourceDelta . ADDED : indexManager . indexLibrary ( jarPath , root . getJavaProject ( ) . getProject ( ) , root . getIndexPath ( ) ) ; break ; case IResourceDelta . CHANGED : indexManager . removeIndex ( jarPath ) ; indexManager . indexLibrary ( jarPath , root . getJavaProject ( ) . getProject ( ) , root . getIndexPath ( ) ) ; break ; case IResourceDelta . REMOVED : indexManager . discardJobs ( jarPath . toString ( ) ) ; indexManager . removeIndex ( jarPath ) ; break ; } break ; } int kind = delta . getKind ( ) ; if ( kind == IResourceDelta . ADDED || kind == IResourceDelta . REMOVED || ( kind == IResourceDelta . CHANGED && ( delta . getFlags ( ) & IResourceDelta . LOCAL_CHANGED ) != <NUM_LIT:0> ) ) { PackageFragmentRoot root = ( PackageFragmentRoot ) element ; updateRootIndex ( root , CharOperation . NO_STRINGS , delta ) ; break ; } case IJavaElement . PACKAGE_FRAGMENT : switch ( delta . getKind ( ) ) { case IResourceDelta . CHANGED : if ( ( delta . getFlags ( ) & IResourceDelta . LOCAL_CHANGED ) == <NUM_LIT:0> ) break ; case IResourceDelta . ADDED : case IResourceDelta . REMOVED : IPackageFragment pkg = null ; if ( element instanceof IPackageFragmentRoot ) { PackageFragmentRoot root = ( PackageFragmentRoot ) element ; pkg = root . getPackageFragment ( CharOperation . NO_STRINGS ) ; } else { pkg = ( IPackageFragment ) element ; } RootInfo rootInfo = rootInfo ( pkg . getParent ( ) . getPath ( ) , delta . getKind ( ) ) ; boolean isSource = rootInfo == null || rootInfo . entryKind == IClasspathEntry . CPE_SOURCE ; IResourceDelta [ ] children = delta . getAffectedChildren ( ) ; for ( int i = <NUM_LIT:0> , length = children . length ; i < length ; i ++ ) { IResourceDelta child = children [ i ] ; IResource resource = child . getResource ( ) ; if ( resource instanceof IFile ) { String name = resource . getName ( ) ; if ( isSource ) { if ( org . eclipse . jdt . internal . core . util . Util . isJavaLikeFileName ( name ) ) { Openable cu = ( Openable ) pkg . getCompilationUnit ( name ) ; updateIndex ( cu , child ) ; } } else if ( org . eclipse . jdt . internal . compiler . util . Util . isClassFileName ( name ) ) { Openable classFile = ( Openable ) pkg . getClassFile ( name ) ; updateIndex ( classFile , child ) ; } } } break ; } break ; case IJavaElement . CLASS_FILE : IFile file = ( IFile ) delta . getResource ( ) ; IJavaProject project = element . getJavaProject ( ) ; PackageFragmentRoot root = element . getPackageFragmentRoot ( ) ; IPath binaryFolderPath = root . isExternal ( ) && ! root . isArchive ( ) ? root . resource ( ) . getFullPath ( ) : root . getPath ( ) ; try { if ( binaryFolderPath . equals ( project . getOutputLocation ( ) ) ) { break ; } } catch ( JavaModelException e ) { } switch ( delta . getKind ( ) ) { case IResourceDelta . CHANGED : int flags = delta . getFlags ( ) ; if ( ( flags & IResourceDelta . CONTENT ) == <NUM_LIT:0> && ( flags & IResourceDelta . ENCODING ) == <NUM_LIT:0> ) break ; case IResourceDelta . ADDED : indexManager . addBinary ( file , binaryFolderPath ) ; break ; case IResourceDelta . REMOVED : String containerRelativePath = Util . relativePath ( file . getFullPath ( ) , binaryFolderPath . segmentCount ( ) ) ; indexManager . remove ( containerRelativePath , binaryFolderPath ) ; break ; } break ; case IJavaElement . COMPILATION_UNIT : file = ( IFile ) delta . getResource ( ) ; switch ( delta . getKind ( ) ) { case IResourceDelta . CHANGED : int flags = delta . getFlags ( ) ; if ( ( flags & IResourceDelta . CONTENT ) == <NUM_LIT:0> && ( flags & IResourceDelta . ENCODING ) == <NUM_LIT:0> ) break ; case IResourceDelta . ADDED : indexManager . addSource ( file , file . getProject ( ) . getFullPath ( ) , getSourceElementParser ( element ) ) ; this . manager . secondaryTypesRemoving ( file , false ) ; break ; case IResourceDelta . REMOVED : indexManager . remove ( Util . relativePath ( file . getFullPath ( ) , <NUM_LIT:1> ) , file . getProject ( ) . getFullPath ( ) ) ; this . manager . secondaryTypesRemoving ( file , true ) ; break ; } } } public void updateJavaModel ( IJavaElementDelta customDelta ) { if ( customDelta == null ) { for ( int i = <NUM_LIT:0> , length = this . javaModelDeltas . size ( ) ; i < length ; i ++ ) { IJavaElementDelta delta = ( IJavaElementDelta ) this . javaModelDeltas . get ( i ) ; this . modelUpdater . processJavaDelta ( delta ) ; } } else { this . modelUpdater . processJavaDelta ( customDelta ) ; } } private void updateRootIndex ( PackageFragmentRoot root , String [ ] pkgName , IResourceDelta delta ) { Openable pkg = root . getPackageFragment ( pkgName ) ; updateIndex ( pkg , delta ) ; IResourceDelta [ ] children = delta . getAffectedChildren ( ) ; for ( int i = <NUM_LIT:0> , length = children . length ; i < length ; i ++ ) { IResourceDelta child = children [ i ] ; IResource resource = child . getResource ( ) ; if ( resource instanceof IFolder ) { String [ ] subpkgName = Util . arrayConcat ( pkgName , resource . getName ( ) ) ; updateRootIndex ( root , subpkgName , child ) ; } } } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . jdt . core . IClasspathContainer ; import org . eclipse . jdt . core . IClasspathEntry ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaProject ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . internal . core . util . Util ; public class SetContainerOperation extends ChangeClasspathOperation { IPath containerPath ; IJavaProject [ ] affectedProjects ; IClasspathContainer [ ] respectiveContainers ; public SetContainerOperation ( IPath containerPath , IJavaProject [ ] affectedProjects , IClasspathContainer [ ] respectiveContainers ) { super ( new IJavaElement [ ] { JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) } , ! ResourcesPlugin . getWorkspace ( ) . isTreeLocked ( ) ) ; this . containerPath = containerPath ; this . affectedProjects = affectedProjects ; this . respectiveContainers = respectiveContainers ; } protected void executeOperation ( ) throws JavaModelException { checkCanceled ( ) ; try { beginTask ( "<STR_LIT>" , <NUM_LIT:1> ) ; if ( JavaModelManager . CP_RESOLVE_VERBOSE ) verbose_set_container ( ) ; if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED ) verbose_set_container_invocation_trace ( ) ; JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; if ( manager . containerPutIfInitializingWithSameEntries ( this . containerPath , this . affectedProjects , this . respectiveContainers ) ) return ; final int projectLength = this . affectedProjects . length ; final IJavaProject [ ] modifiedProjects ; System . arraycopy ( this . affectedProjects , <NUM_LIT:0> , modifiedProjects = new IJavaProject [ projectLength ] , <NUM_LIT:0> , projectLength ) ; int remaining = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < projectLength ; i ++ ) { if ( isCanceled ( ) ) return ; JavaProject affectedProject = ( JavaProject ) this . affectedProjects [ i ] ; IClasspathContainer newContainer = this . respectiveContainers [ i ] ; if ( newContainer == null ) newContainer = JavaModelManager . CONTAINER_INITIALIZATION_IN_PROGRESS ; boolean found = false ; if ( JavaProject . hasJavaNature ( affectedProject . getProject ( ) ) ) { IClasspathEntry [ ] rawClasspath = affectedProject . getRawClasspath ( ) ; for ( int j = <NUM_LIT:0> , cpLength = rawClasspath . length ; j < cpLength ; j ++ ) { IClasspathEntry entry = rawClasspath [ j ] ; if ( entry . getEntryKind ( ) == IClasspathEntry . CPE_CONTAINER && entry . getPath ( ) . equals ( this . containerPath ) ) { found = true ; break ; } } } if ( ! found ) { modifiedProjects [ i ] = null ; manager . containerPut ( affectedProject , this . containerPath , newContainer ) ; continue ; } IClasspathContainer oldContainer = manager . containerGet ( affectedProject , this . containerPath ) ; if ( oldContainer == JavaModelManager . CONTAINER_INITIALIZATION_IN_PROGRESS ) { oldContainer = null ; } if ( ( oldContainer != null && oldContainer . equals ( this . respectiveContainers [ i ] ) ) || ( oldContainer == this . respectiveContainers [ i ] ) ) { modifiedProjects [ i ] = null ; continue ; } remaining ++ ; manager . containerPut ( affectedProject , this . containerPath , newContainer ) ; } if ( remaining == <NUM_LIT:0> ) return ; try { for ( int i = <NUM_LIT:0> ; i < projectLength ; i ++ ) { if ( isCanceled ( ) ) return ; JavaProject affectedProject = ( JavaProject ) modifiedProjects [ i ] ; if ( affectedProject == null ) continue ; if ( JavaModelManager . CP_RESOLVE_VERBOSE_ADVANCED ) verbose_update_project ( affectedProject ) ; ClasspathChange classpathChange = affectedProject . getPerProjectInfo ( ) . resetResolvedClasspath ( ) ; classpathChanged ( classpathChange , i == <NUM_LIT:0> ) ; if ( this . canChangeResources ) { try { affectedProject . getProject ( ) . touch ( this . progressMonitor ) ; } catch ( CoreException e ) { if ( ! ExternalJavaProject . EXTERNAL_PROJECT_NAME . equals ( affectedProject . getElementName ( ) ) ) throw e ; } } } } catch ( CoreException e ) { if ( JavaModelManager . CP_RESOLVE_VERBOSE || JavaModelManager . CP_RESOLVE_VERBOSE_FAILURE ) verbose_failure ( e ) ; if ( e instanceof JavaModelException ) { throw ( JavaModelException ) e ; } else { throw new JavaModelException ( e ) ; } } finally { for ( int i = <NUM_LIT:0> ; i < projectLength ; i ++ ) { if ( this . respectiveContainers [ i ] == null ) { manager . containerPut ( this . affectedProjects [ i ] , this . containerPath , null ) ; } } } } finally { done ( ) ; } } private void verbose_failure ( CoreException e ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + this . containerPath , System . err ) ; e . printStackTrace ( ) ; } private void verbose_update_project ( JavaProject affectedProject ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + affectedProject . getElementName ( ) + '<STR_LIT:\n>' + "<STR_LIT>" + this . containerPath ) ; } private void verbose_set_container ( ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" + this . containerPath + '<STR_LIT:\n>' + "<STR_LIT>" + org . eclipse . jdt . internal . compiler . util . Util . toString ( this . affectedProjects , new org . eclipse . jdt . internal . compiler . util . Util . Displayable ( ) { public String displayString ( Object o ) { return ( ( IJavaProject ) o ) . getElementName ( ) ; } } ) + "<STR_LIT>" + org . eclipse . jdt . internal . compiler . util . Util . toString ( this . respectiveContainers , new org . eclipse . jdt . internal . compiler . util . Util . Displayable ( ) { public String displayString ( Object o ) { StringBuffer buffer = new StringBuffer ( "<STR_LIT>" ) ; if ( o == null ) { buffer . append ( "<STR_LIT>" ) ; return buffer . toString ( ) ; } IClasspathContainer container = ( IClasspathContainer ) o ; buffer . append ( container . getDescription ( ) ) ; buffer . append ( "<STR_LIT>" ) ; IClasspathEntry [ ] entries = container . getClasspathEntries ( ) ; if ( entries != null ) { for ( int i = <NUM_LIT:0> ; i < entries . length ; i ++ ) { buffer . append ( "<STR_LIT>" ) ; buffer . append ( entries [ i ] ) ; buffer . append ( '<STR_LIT:\n>' ) ; } } buffer . append ( "<STR_LIT>" ) ; return buffer . toString ( ) ; } } ) + "<STR_LIT>" ) ; } private void verbose_set_container_invocation_trace ( ) { Util . verbose ( "<STR_LIT>" + "<STR_LIT>" ) ; new Exception ( "<STR_LIT>" ) . printStackTrace ( System . out ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import java . util . Iterator ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IField ; 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 . dom . ASTNode ; import org . eclipse . jdt . core . dom . FieldDeclaration ; import org . eclipse . jdt . core . dom . SimpleName ; import org . eclipse . jdt . core . dom . VariableDeclarationFragment ; import org . eclipse . jdt . core . dom . rewrite . ASTRewrite ; import org . eclipse . jdt . internal . core . util . Messages ; public class CreateFieldOperation extends CreateTypeMemberOperation { public CreateFieldOperation ( IType parentElement , String source , boolean force ) { super ( parentElement , source , force ) ; } protected ASTNode generateElementAST ( ASTRewrite rewriter , ICompilationUnit cu ) throws JavaModelException { ASTNode node = super . generateElementAST ( rewriter , cu ) ; if ( node . getNodeType ( ) != ASTNode . FIELD_DECLARATION ) throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CONTENTS ) ) ; return node ; } protected IJavaElement generateResultHandle ( ) { return getType ( ) . getField ( getASTNodeName ( ) ) ; } public String getMainTaskName ( ) { return Messages . operation_createFieldProgress ; } private VariableDeclarationFragment getFragment ( ASTNode node ) { Iterator fragments = ( ( FieldDeclaration ) node ) . fragments ( ) . iterator ( ) ; if ( this . anchorElement != null ) { VariableDeclarationFragment fragment = null ; String fragmentName = this . anchorElement . getElementName ( ) ; while ( fragments . hasNext ( ) ) { fragment = ( VariableDeclarationFragment ) fragments . next ( ) ; if ( fragment . getName ( ) . getIdentifier ( ) . equals ( fragmentName ) ) { return fragment ; } } return fragment ; } else { return ( VariableDeclarationFragment ) fragments . next ( ) ; } } protected void initializeDefaultPosition ( ) { IType parentElement = getType ( ) ; try { IField [ ] fields = parentElement . getFields ( ) ; if ( fields != null && fields . length > <NUM_LIT:0> ) { final IField lastField = fields [ fields . length - <NUM_LIT:1> ] ; if ( parentElement . isEnum ( ) ) { IField field = lastField ; if ( ! field . isEnumConstant ( ) ) { createAfter ( lastField ) ; } } else { createAfter ( lastField ) ; } } else { IJavaElement [ ] elements = parentElement . getChildren ( ) ; if ( elements != null && elements . length > <NUM_LIT:0> ) { createBefore ( elements [ <NUM_LIT:0> ] ) ; } } } catch ( JavaModelException e ) { } } protected IJavaModelStatus verifyNameCollision ( ) { if ( this . createdNode != null ) { IType type = getType ( ) ; String fieldName = getASTNodeName ( ) ; if ( type . getField ( fieldName ) . exists ( ) ) { return new JavaModelStatus ( IJavaModelStatusConstants . NAME_COLLISION , Messages . bind ( Messages . status_nameCollision , fieldName ) ) ; } } return JavaModelStatus . VERIFIED_OK ; } private String getASTNodeName ( ) { if ( this . alteredName != null ) return this . alteredName ; return getFragment ( this . createdNode ) . getName ( ) . getIdentifier ( ) ; } protected SimpleName rename ( ASTNode node , SimpleName newName ) { VariableDeclarationFragment fragment = getFragment ( node ) ; SimpleName oldName = fragment . getName ( ) ; fragment . setName ( newName ) ; return oldName ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . JavaModelException ; public class ResolvedSourceType extends SourceType { private String uniqueKey ; public ResolvedSourceType ( JavaElement parent , String name , String uniqueKey ) { super ( parent , name ) ; this . uniqueKey = uniqueKey ; } public String getFullyQualifiedParameterizedName ( ) throws JavaModelException { return getFullyQualifiedParameterizedName ( getFullyQualifiedName ( '<CHAR_LIT:.>' ) , this . 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 . getKey ( ) ) ; buffer . append ( "<STR_LIT:}>" ) ; } } public JavaElement unresolved ( ) { SourceType handle = new SourceType ( this . parent , this . name ) ; handle . occurrenceCount = this . occurrenceCount ; handle . localOccurrenceCount = this . localOccurrenceCount ; return handle ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . JavaModelException ; public class BecomeWorkingCopyOperation extends JavaModelOperation { IProblemRequestor problemRequestor ; public BecomeWorkingCopyOperation ( CompilationUnit workingCopy , IProblemRequestor problemRequestor ) { super ( new IJavaElement [ ] { workingCopy } ) ; this . problemRequestor = problemRequestor ; } protected void executeOperation ( ) throws JavaModelException { CompilationUnit workingCopy = getWorkingCopy ( ) ; JavaModelManager . getJavaModelManager ( ) . getPerWorkingCopyInfo ( workingCopy , true , true , this . problemRequestor ) ; workingCopy . openWhenClosed ( workingCopy . createElementInfo ( ) , true , this . progressMonitor ) ; if ( ! workingCopy . isPrimary ( ) ) { JavaElementDelta delta = new JavaElementDelta ( getJavaModel ( ) ) ; delta . added ( workingCopy ) ; addDelta ( delta ) ; } else { if ( workingCopy . getResource ( ) . isAccessible ( ) ) { JavaElementDelta delta = new JavaElementDelta ( getJavaModel ( ) ) ; delta . changed ( workingCopy , IJavaElementDelta . F_PRIMARY_WORKING_COPY ) ; addDelta ( delta ) ; } else { JavaElementDelta delta = new JavaElementDelta ( getJavaModel ( ) ) ; delta . added ( workingCopy , IJavaElementDelta . F_PRIMARY_WORKING_COPY ) ; addDelta ( delta ) ; } } this . resultElements = new IJavaElement [ ] { workingCopy } ; } protected CompilationUnit getWorkingCopy ( ) { return ( CompilationUnit ) getElementToProcess ( ) ; } public boolean isReadOnly ( ) { return true ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import java . util . HashMap ; import java . util . Map ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . jdt . core . * ; public abstract class MultiOperation extends JavaModelOperation { protected Map insertBeforeElements = new HashMap ( <NUM_LIT:1> ) ; protected Map newParents ; protected Map renamings ; protected String [ ] renamingsList = null ; protected MultiOperation ( IJavaElement [ ] elementsToProcess , boolean force ) { super ( elementsToProcess , force ) ; } protected MultiOperation ( IJavaElement [ ] elementsToProcess , IJavaElement [ ] parentElements , boolean force ) { super ( elementsToProcess , parentElements , force ) ; this . newParents = new HashMap ( elementsToProcess . length ) ; if ( elementsToProcess . length == parentElements . length ) { for ( int i = <NUM_LIT:0> ; i < elementsToProcess . length ; i ++ ) { this . newParents . put ( elementsToProcess [ i ] , parentElements [ i ] ) ; } } else { for ( int i = <NUM_LIT:0> ; i < elementsToProcess . length ; i ++ ) { this . newParents . put ( elementsToProcess [ i ] , parentElements [ <NUM_LIT:0> ] ) ; } } } protected void error ( int code , IJavaElement element ) throws JavaModelException { throw new JavaModelException ( new JavaModelStatus ( code , element ) ) ; } protected void executeOperation ( ) throws JavaModelException { processElements ( ) ; } protected IJavaElement getDestinationParent ( IJavaElement child ) { return ( IJavaElement ) this . newParents . get ( child ) ; } protected abstract String getMainTaskName ( ) ; protected String getNewNameFor ( IJavaElement element ) throws JavaModelException { String newName = null ; if ( this . renamings != null ) newName = ( String ) this . renamings . get ( element ) ; if ( newName == null && element instanceof IMethod && ( ( IMethod ) element ) . isConstructor ( ) ) newName = getDestinationParent ( element ) . getElementName ( ) ; return newName ; } private void initializeRenamings ( ) { if ( this . renamingsList != null && this . renamingsList . length == this . elementsToProcess . length ) { this . renamings = new HashMap ( this . renamingsList . length ) ; for ( int i = <NUM_LIT:0> ; i < this . renamingsList . length ; i ++ ) { if ( this . renamingsList [ i ] != null ) { this . renamings . put ( this . elementsToProcess [ i ] , this . renamingsList [ i ] ) ; } } } } protected boolean isMove ( ) { return false ; } protected boolean isRename ( ) { return false ; } protected abstract void processElement ( IJavaElement element ) throws JavaModelException ; protected void processElements ( ) throws JavaModelException { try { beginTask ( getMainTaskName ( ) , this . elementsToProcess . length ) ; IJavaModelStatus [ ] errors = new IJavaModelStatus [ <NUM_LIT:3> ] ; int errorsCounter = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < this . elementsToProcess . length ; i ++ ) { try { verify ( this . elementsToProcess [ i ] ) ; processElement ( this . elementsToProcess [ i ] ) ; } catch ( JavaModelException jme ) { if ( errorsCounter == errors . length ) { System . arraycopy ( errors , <NUM_LIT:0> , ( errors = new IJavaModelStatus [ errorsCounter * <NUM_LIT:2> ] ) , <NUM_LIT:0> , errorsCounter ) ; } errors [ errorsCounter ++ ] = jme . getJavaModelStatus ( ) ; } finally { worked ( <NUM_LIT:1> ) ; } } if ( errorsCounter == <NUM_LIT:1> ) { throw new JavaModelException ( errors [ <NUM_LIT:0> ] ) ; } else if ( errorsCounter > <NUM_LIT:1> ) { if ( errorsCounter != errors . length ) { System . arraycopy ( errors , <NUM_LIT:0> , ( errors = new IJavaModelStatus [ errorsCounter ] ) , <NUM_LIT:0> , errorsCounter ) ; } throw new JavaModelException ( JavaModelStatus . newMultiStatus ( errors ) ) ; } } finally { done ( ) ; } } public void setInsertBefore ( IJavaElement modifiedElement , IJavaElement newSibling ) { this . insertBeforeElements . put ( modifiedElement , newSibling ) ; } public void setRenamings ( String [ ] renamingsList ) { this . renamingsList = renamingsList ; initializeRenamings ( ) ; } protected abstract void verify ( IJavaElement element ) throws JavaModelException ; protected void verifyDestination ( IJavaElement element , IJavaElement destination ) throws JavaModelException { if ( destination == null || ! destination . exists ( ) ) error ( IJavaModelStatusConstants . ELEMENT_DOES_NOT_EXIST , destination ) ; int destType = destination . getElementType ( ) ; switch ( element . getElementType ( ) ) { case IJavaElement . PACKAGE_DECLARATION : case IJavaElement . IMPORT_DECLARATION : if ( destType != IJavaElement . COMPILATION_UNIT ) error ( IJavaModelStatusConstants . INVALID_DESTINATION , element ) ; break ; case IJavaElement . TYPE : if ( destType != IJavaElement . COMPILATION_UNIT && destType != IJavaElement . TYPE ) error ( IJavaModelStatusConstants . INVALID_DESTINATION , element ) ; break ; case IJavaElement . METHOD : case IJavaElement . FIELD : case IJavaElement . INITIALIZER : if ( destType != IJavaElement . TYPE || destination instanceof BinaryType ) error ( IJavaModelStatusConstants . INVALID_DESTINATION , element ) ; break ; case IJavaElement . COMPILATION_UNIT : if ( destType != IJavaElement . PACKAGE_FRAGMENT ) error ( IJavaModelStatusConstants . INVALID_DESTINATION , element ) ; else { CompilationUnit cu = ( CompilationUnit ) element ; if ( isMove ( ) && cu . isWorkingCopy ( ) && ! cu . isPrimary ( ) ) error ( IJavaModelStatusConstants . INVALID_ELEMENT_TYPES , element ) ; } break ; case IJavaElement . PACKAGE_FRAGMENT : IPackageFragment fragment = ( IPackageFragment ) element ; IJavaElement parent = fragment . getParent ( ) ; if ( parent . isReadOnly ( ) ) error ( IJavaModelStatusConstants . READ_ONLY , element ) ; else if ( destType != IJavaElement . PACKAGE_FRAGMENT_ROOT ) error ( IJavaModelStatusConstants . INVALID_DESTINATION , element ) ; break ; default : error ( IJavaModelStatusConstants . INVALID_ELEMENT_TYPES , element ) ; } } protected void verifyRenaming ( IJavaElement element ) throws JavaModelException { String newName = getNewNameFor ( element ) ; boolean isValid = true ; IJavaProject project = element . getJavaProject ( ) ; String sourceLevel = project . getOption ( JavaCore . COMPILER_SOURCE , true ) ; String complianceLevel = project . getOption ( JavaCore . COMPILER_COMPLIANCE , true ) ; switch ( element . getElementType ( ) ) { case IJavaElement . PACKAGE_FRAGMENT : if ( ( ( IPackageFragment ) element ) . isDefaultPackage ( ) ) { throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . NAME_COLLISION , element ) ) ; } isValid = JavaConventions . validatePackageName ( newName , sourceLevel , complianceLevel ) . getSeverity ( ) != IStatus . ERROR ; break ; case IJavaElement . COMPILATION_UNIT : isValid = JavaConventions . validateCompilationUnitName ( newName , sourceLevel , complianceLevel ) . getSeverity ( ) != IStatus . ERROR ; break ; case IJavaElement . INITIALIZER : isValid = false ; break ; default : isValid = JavaConventions . validateIdentifier ( newName , sourceLevel , complianceLevel ) . getSeverity ( ) != IStatus . ERROR ; break ; } if ( ! isValid ) { throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . INVALID_NAME , element , newName ) ) ; } } protected void verifySibling ( IJavaElement element , IJavaElement destination ) throws JavaModelException { IJavaElement insertBeforeElement = ( IJavaElement ) this . insertBeforeElements . get ( element ) ; if ( insertBeforeElement != null ) { if ( ! insertBeforeElement . exists ( ) || ! insertBeforeElement . getParent ( ) . equals ( destination ) ) { error ( IJavaModelStatusConstants . INVALID_SIBLING , insertBeforeElement ) ; } } } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . internal . core . util . Messages ; public class MoveResourceElementsOperation extends CopyResourceElementsOperation { public MoveResourceElementsOperation ( IJavaElement [ ] elementsToMove , IJavaElement [ ] destContainers , boolean force ) { super ( elementsToMove , destContainers , force ) ; } protected String getMainTaskName ( ) { return Messages . operation_moveResourceProgress ; } protected boolean isMove ( ) { return true ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . dom . ASTNode ; import org . eclipse . jdt . internal . compiler . lookup . Binding ; public class SourceField extends NamedMember implements IField { protected SourceField ( JavaElement parent , String name ) { super ( parent , name ) ; } public boolean equals ( Object o ) { if ( ! ( o instanceof SourceField ) ) return false ; return super . equals ( o ) ; } public ASTNode findNode ( org . eclipse . jdt . core . dom . CompilationUnit ast ) { ASTNode node = super . findNode ( ast ) ; if ( node == null ) return null ; if ( node . getNodeType ( ) == ASTNode . ENUM_CONSTANT_DECLARATION ) { return node ; } return node . getParent ( ) ; } public Object getConstant ( ) throws JavaModelException { Object constant = null ; SourceFieldElementInfo info = ( SourceFieldElementInfo ) getElementInfo ( ) ; final char [ ] constantSourceChars = info . initializationSource ; if ( constantSourceChars == null ) { return null ; } String constantSource = new String ( constantSourceChars ) ; String signature = info . getTypeSignature ( ) ; try { if ( signature . equals ( Signature . SIG_INT ) ) { constant = new Integer ( constantSource ) ; } else if ( signature . equals ( Signature . SIG_SHORT ) ) { constant = new Short ( constantSource ) ; } else if ( signature . equals ( Signature . SIG_BYTE ) ) { constant = new Byte ( constantSource ) ; } else if ( signature . equals ( Signature . SIG_BOOLEAN ) ) { constant = Boolean . valueOf ( constantSource ) ; } else if ( signature . equals ( Signature . SIG_CHAR ) ) { if ( constantSourceChars . length != <NUM_LIT:3> ) { return null ; } constant = new Character ( constantSourceChars [ <NUM_LIT:1> ] ) ; } else if ( signature . equals ( Signature . SIG_DOUBLE ) ) { constant = new Double ( constantSource ) ; } else if ( signature . equals ( Signature . SIG_FLOAT ) ) { constant = new Float ( constantSource ) ; } else if ( signature . equals ( Signature . SIG_LONG ) ) { if ( constantSource . endsWith ( "<STR_LIT>" ) || constantSource . endsWith ( "<STR_LIT>" ) ) { int index = constantSource . lastIndexOf ( "<STR_LIT>" ) ; if ( index != - <NUM_LIT:1> ) { constant = new Long ( constantSource . substring ( <NUM_LIT:0> , index ) ) ; } else { constant = new Long ( constantSource . substring ( <NUM_LIT:0> , constantSource . lastIndexOf ( "<STR_LIT>" ) ) ) ; } } else { constant = new Long ( constantSource ) ; } } else if ( signature . equals ( "<STR_LIT>" ) ) { constant = constantSource ; } else if ( signature . equals ( "<STR_LIT>" ) ) { constant = constantSource ; } } catch ( NumberFormatException e ) { return null ; } return constant ; } public int getElementType ( ) { return FIELD ; } public String getKey ( ) { try { return getKey ( this , false ) ; } catch ( JavaModelException e ) { return null ; } } protected char getHandleMementoDelimiter ( ) { return JavaElement . JEM_FIELD ; } public IJavaElement getPrimaryElement ( boolean checkOwner ) { if ( checkOwner ) { CompilationUnit cu = ( CompilationUnit ) getAncestor ( COMPILATION_UNIT ) ; if ( cu . isPrimary ( ) ) return this ; } IJavaElement primaryParent = this . parent . getPrimaryElement ( false ) ; return ( ( IType ) primaryParent ) . getField ( this . name ) ; } public String getTypeSignature ( ) throws JavaModelException { SourceFieldElementInfo info = ( SourceFieldElementInfo ) getElementInfo ( ) ; return info . getTypeSignature ( ) ; } public boolean isEnumConstant ( ) throws JavaModelException { return Flags . isEnum ( getFlags ( ) ) ; } public boolean isResolved ( ) { return false ; } public JavaElement resolved ( Binding binding ) { SourceRefElement resolvedHandle = new ResolvedSourceField ( this . parent , this . name , new String ( binding . computeUniqueKey ( ) ) ) ; resolvedHandle . occurrenceCount = this . occurrenceCount ; return resolvedHandle ; } 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 { buffer . append ( Signature . toString ( getTypeSignature ( ) ) ) ; buffer . append ( "<STR_LIT:U+0020>" ) ; toStringName ( buffer ) ; } catch ( JavaModelException e ) { buffer . append ( "<STR_LIT>" + getElementName ( ) ) ; } } } } </s>
|
<s> package org . eclipse . jdt . internal . core ; public class TypeParameterElementInfo extends SourceRefElementInfo { public int nameStart = - <NUM_LIT:1> ; public int nameEnd = - <NUM_LIT:1> ; public char [ ] [ ] bounds ; public char [ ] [ ] boundsSignatures ; } </s>
|
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IWorkspace ; import org . eclipse . core . runtime . jobs . ISchedulingRule ; 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 . 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 . ChildListPropertyDescriptor ; import org . eclipse . jdt . core . dom . CompilationUnit ; import org . eclipse . jdt . core . dom . StructuralPropertyDescriptor ; import org . eclipse . jdt . core . dom . rewrite . ASTRewrite ; import org . eclipse . jdt . core . dom . rewrite . ListRewrite ; import org . eclipse . jdt . internal . core . util . Util ; import org . eclipse . text . edits . TextEdit ; public abstract class CreateElementInCUOperation extends JavaModelOperation { protected CompilationUnit cuAST ; protected static final int INSERT_LAST = <NUM_LIT:1> ; protected static final int INSERT_AFTER = <NUM_LIT:2> ; protected static final int INSERT_BEFORE = <NUM_LIT:3> ; protected int insertionPolicy = INSERT_LAST ; protected IJavaElement anchorElement = null ; protected boolean creationOccurred = true ; public CreateElementInCUOperation ( IJavaElement parentElement ) { super ( null , new IJavaElement [ ] { parentElement } ) ; initializeDefaultPosition ( ) ; } protected void checkCanceled ( ) { if ( ! this . isNested ) { super . checkCanceled ( ) ; } } public void createAfter ( IJavaElement sibling ) { setRelativePosition ( sibling , INSERT_AFTER ) ; } public void createBefore ( IJavaElement sibling ) { setRelativePosition ( sibling , INSERT_BEFORE ) ; } protected void executeOperation ( ) throws JavaModelException { try { beginTask ( getMainTaskName ( ) , getMainAmountOfWork ( ) ) ; JavaElementDelta delta = newJavaElementDelta ( ) ; ICompilationUnit unit = getCompilationUnit ( ) ; generateNewCompilationUnitAST ( unit ) ; if ( this . creationOccurred ) { unit . save ( null , false ) ; boolean isWorkingCopy = unit . isWorkingCopy ( ) ; if ( ! isWorkingCopy ) setAttribute ( HAS_MODIFIED_RESOURCE_ATTR , TRUE ) ; worked ( <NUM_LIT:1> ) ; this . resultElements = generateResultHandles ( ) ; if ( ! isWorkingCopy && ! Util . isExcluded ( unit ) && unit . getParent ( ) . exists ( ) ) { for ( int i = <NUM_LIT:0> ; i < this . resultElements . length ; i ++ ) { delta . added ( this . resultElements [ i ] ) ; } addDelta ( delta ) ; } } } finally { done ( ) ; } } protected abstract StructuralPropertyDescriptor getChildPropertyDescriptor ( ASTNode parent ) ; protected abstract ASTNode generateElementAST ( ASTRewrite rewriter , ICompilationUnit cu ) throws JavaModelException ; protected void generateNewCompilationUnitAST ( ICompilationUnit cu ) throws JavaModelException { this . cuAST = parse ( cu ) ; AST ast = this . cuAST . getAST ( ) ; ASTRewrite rewriter = ASTRewrite . create ( ast ) ; ASTNode child = generateElementAST ( rewriter , cu ) ; if ( child != null ) { ASTNode parent = ( ( JavaElement ) getParentElement ( ) ) . findNode ( this . cuAST ) ; if ( parent == null ) parent = this . cuAST ; insertASTNode ( rewriter , parent , child ) ; TextEdit edits = rewriter . rewriteAST ( ) ; applyTextEdit ( cu , edits ) ; } worked ( <NUM_LIT:1> ) ; } protected abstract IJavaElement generateResultHandle ( ) ; protected IJavaElement [ ] generateResultHandles ( ) { return new IJavaElement [ ] { generateResultHandle ( ) } ; } protected ICompilationUnit getCompilationUnit ( ) { return getCompilationUnitFor ( getParentElement ( ) ) ; } protected int getMainAmountOfWork ( ) { return <NUM_LIT:2> ; } public abstract String getMainTaskName ( ) ; protected ISchedulingRule getSchedulingRule ( ) { IResource resource = getCompilationUnit ( ) . getResource ( ) ; IWorkspace workspace = resource . getWorkspace ( ) ; return workspace . getRuleFactory ( ) . modifyRule ( resource ) ; } protected void initializeDefaultPosition ( ) { } protected void insertASTNode ( ASTRewrite rewriter , ASTNode parent , ASTNode child ) throws JavaModelException { StructuralPropertyDescriptor propertyDescriptor = getChildPropertyDescriptor ( parent ) ; if ( propertyDescriptor instanceof ChildListPropertyDescriptor ) { ChildListPropertyDescriptor childListPropertyDescriptor = ( ChildListPropertyDescriptor ) propertyDescriptor ; ListRewrite rewrite = rewriter . getListRewrite ( parent , childListPropertyDescriptor ) ; switch ( this . insertionPolicy ) { case INSERT_BEFORE : ASTNode element = ( ( JavaElement ) this . anchorElement ) . findNode ( this . cuAST ) ; if ( childListPropertyDescriptor . getElementType ( ) . isAssignableFrom ( element . getClass ( ) ) ) rewrite . insertBefore ( child , element , null ) ; else rewrite . insertLast ( child , null ) ; break ; case INSERT_AFTER : element = ( ( JavaElement ) this . anchorElement ) . findNode ( this . cuAST ) ; if ( childListPropertyDescriptor . getElementType ( ) . isAssignableFrom ( element . getClass ( ) ) ) rewrite . insertAfter ( child , element , null ) ; else rewrite . insertLast ( child , null ) ; break ; case INSERT_LAST : rewrite . insertLast ( child , null ) ; break ; } } else { rewriter . set ( parent , propertyDescriptor , child , null ) ; } } protected CompilationUnit parse ( ICompilationUnit cu ) throws JavaModelException { cu . makeConsistent ( this . progressMonitor ) ; ASTParser parser = ASTParser . newParser ( AST . JLS4 ) ; parser . setSource ( cu ) ; return ( CompilationUnit ) parser . createAST ( this . progressMonitor ) ; } protected void setAlteredName ( String newName ) { } protected void setRelativePosition ( IJavaElement sibling , int policy ) throws IllegalArgumentException { if ( sibling == null ) { this . anchorElement = null ; this . insertionPolicy = INSERT_LAST ; } else { this . anchorElement = sibling ; this . insertionPolicy = policy ; } } public IJavaModelStatus verify ( ) { if ( getParentElement ( ) == null ) { return new JavaModelStatus ( IJavaModelStatusConstants . NO_ELEMENTS_TO_PROCESS ) ; } if ( this . anchorElement != null ) { IJavaElement domPresentParent = this . anchorElement . getParent ( ) ; if ( domPresentParent . getElementType ( ) == IJavaElement . IMPORT_CONTAINER ) { domPresentParent = domPresentParent . getParent ( ) ; } if ( ! domPresentParent . equals ( getParentElement ( ) ) ) { return new JavaModelStatus ( IJavaModelStatusConstants . INVALID_SIBLING , this . anchorElement ) ; } } return JavaModelStatus . VERIFIED_OK ; } } </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 . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . ArrayInitializer ; import org . eclipse . jdt . internal . compiler . ast . ClassLiteralAccess ; import org . eclipse . jdt . internal . compiler . ast . Expression ; import org . eclipse . jdt . internal . compiler . ast . Literal ; import org . eclipse . jdt . internal . compiler . ast . NullLiteral ; import org . eclipse . jdt . internal . compiler . ast . OperatorIds ; import org . eclipse . jdt . internal . compiler . ast . QualifiedNameReference ; import org . eclipse . jdt . internal . compiler . ast . SingleNameReference ; import org . eclipse . jdt . internal . compiler . ast . UnaryExpression ; import org . eclipse . jdt . internal . compiler . lookup . ExtraCompilerModifiers ; import org . eclipse . jdt . internal . compiler . parser . RecoveryScanner ; import org . eclipse . jdt . internal . core . util . MementoTokenizer ; import org . eclipse . jdt . internal . core . util . Util ; public class LocalVariable extends SourceRefElement implements ILocalVariable { public static final ILocalVariable [ ] NO_LOCAL_VARIABLES = new ILocalVariable [ <NUM_LIT:0> ] ; String name ; public int declarationSourceStart , declarationSourceEnd ; public int nameStart , nameEnd ; String typeSignature ; public IAnnotation [ ] annotations ; private int flags ; private boolean isParameter ; public LocalVariable ( JavaElement parent , String name , int declarationSourceStart , int declarationSourceEnd , int nameStart , int nameEnd , String typeSignature , org . eclipse . jdt . internal . compiler . ast . Annotation [ ] astAnnotations , int flags , boolean isParameter ) { super ( parent ) ; this . name = name ; this . declarationSourceStart = declarationSourceStart ; this . declarationSourceEnd = declarationSourceEnd ; this . nameStart = nameStart ; this . nameEnd = nameEnd ; this . typeSignature = typeSignature ; this . annotations = getAnnotations ( astAnnotations ) ; this . flags = flags ; this . isParameter = isParameter ; } protected void closing ( Object info ) { } protected Object createElementInfo ( ) { return null ; } public boolean equals ( Object o ) { if ( ! ( o instanceof LocalVariable ) ) return false ; LocalVariable other = ( LocalVariable ) o ; return this . declarationSourceStart == other . declarationSourceStart && this . declarationSourceEnd == other . declarationSourceEnd && this . nameStart == other . nameStart && this . nameEnd == other . nameEnd && super . equals ( o ) ; } public boolean exists ( ) { return this . parent . exists ( ) ; } protected void generateInfos ( Object info , HashMap newElements , IProgressMonitor pm ) { } public IAnnotation getAnnotation ( String annotationName ) { for ( int i = <NUM_LIT:0> , length = this . annotations . length ; i < length ; i ++ ) { IAnnotation annotation = this . annotations [ i ] ; if ( annotation . getElementName ( ) . equals ( annotationName ) ) return annotation ; } return super . getAnnotation ( annotationName ) ; } public IAnnotation [ ] getAnnotations ( ) throws JavaModelException { return this . annotations ; } private IAnnotation [ ] getAnnotations ( org . eclipse . jdt . internal . compiler . ast . Annotation [ ] astAnnotations ) { int length ; if ( astAnnotations == null || ( length = astAnnotations . length ) == <NUM_LIT:0> ) return Annotation . NO_ANNOTATIONS ; IAnnotation [ ] result = new IAnnotation [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { result [ i ] = getAnnotation ( astAnnotations [ i ] , this ) ; } return result ; } private IAnnotation getAnnotation ( final org . eclipse . jdt . internal . compiler . ast . Annotation annotation , JavaElement parentElement ) { final int typeStart = annotation . type . sourceStart ( ) ; final int typeEnd = annotation . type . sourceEnd ( ) ; final int sourceStart = annotation . sourceStart ( ) ; final int sourceEnd = annotation . declarationSourceEnd ; class LocalVarAnnotation extends Annotation { IMemberValuePair [ ] memberValuePairs ; public LocalVarAnnotation ( JavaElement localVar , String elementName ) { super ( localVar , elementName ) ; } public IMemberValuePair [ ] getMemberValuePairs ( ) throws JavaModelException { return this . memberValuePairs ; } public ISourceRange getNameRange ( ) throws JavaModelException { return new SourceRange ( typeStart , typeEnd - typeStart + <NUM_LIT:1> ) ; } public ISourceRange getSourceRange ( ) throws JavaModelException { return new SourceRange ( sourceStart , sourceEnd - sourceStart + <NUM_LIT:1> ) ; } public boolean exists ( ) { return this . parent . exists ( ) ; } } String annotationName = new String ( CharOperation . concatWith ( annotation . type . getTypeName ( ) , '<CHAR_LIT:.>' ) ) ; LocalVarAnnotation localVarAnnotation = new LocalVarAnnotation ( parentElement , annotationName ) ; org . eclipse . jdt . internal . compiler . ast . MemberValuePair [ ] astMemberValuePairs = annotation . memberValuePairs ( ) ; int length ; IMemberValuePair [ ] memberValuePairs ; if ( astMemberValuePairs == null || ( length = astMemberValuePairs . length ) == <NUM_LIT:0> ) { memberValuePairs = Annotation . NO_MEMBER_VALUE_PAIRS ; } else { memberValuePairs = new IMemberValuePair [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { org . eclipse . jdt . internal . compiler . ast . MemberValuePair astMemberValuePair = astMemberValuePairs [ i ] ; MemberValuePair memberValuePair = new MemberValuePair ( new String ( astMemberValuePair . name ) ) ; memberValuePair . value = getAnnotationMemberValue ( memberValuePair , astMemberValuePair . value , localVarAnnotation ) ; memberValuePairs [ i ] = memberValuePair ; } } localVarAnnotation . memberValuePairs = memberValuePairs ; return localVarAnnotation ; } private Object getAnnotationMemberValue ( MemberValuePair memberValuePair , Expression expression , JavaElement parentElement ) { if ( expression instanceof NullLiteral ) { return null ; } else if ( expression instanceof Literal ) { ( ( Literal ) expression ) . computeConstant ( ) ; return Util . getAnnotationMemberValue ( memberValuePair , expression . constant ) ; } else if ( expression instanceof org . eclipse . jdt . internal . compiler . ast . Annotation ) { memberValuePair . valueKind = IMemberValuePair . K_ANNOTATION ; return getAnnotation ( ( org . eclipse . jdt . internal . compiler . ast . Annotation ) expression , parentElement ) ; } else if ( expression instanceof ClassLiteralAccess ) { ClassLiteralAccess classLiteral = ( ClassLiteralAccess ) expression ; char [ ] typeName = CharOperation . concatWith ( classLiteral . type . getTypeName ( ) , '<CHAR_LIT:.>' ) ; memberValuePair . valueKind = IMemberValuePair . K_CLASS ; return new String ( typeName ) ; } else if ( expression instanceof QualifiedNameReference ) { char [ ] qualifiedName = CharOperation . concatWith ( ( ( QualifiedNameReference ) expression ) . tokens , '<CHAR_LIT:.>' ) ; memberValuePair . valueKind = IMemberValuePair . K_QUALIFIED_NAME ; return new String ( qualifiedName ) ; } else if ( expression instanceof SingleNameReference ) { char [ ] simpleName = ( ( SingleNameReference ) expression ) . token ; if ( simpleName == RecoveryScanner . FAKE_IDENTIFIER ) { memberValuePair . valueKind = IMemberValuePair . K_UNKNOWN ; return null ; } memberValuePair . valueKind = IMemberValuePair . K_SIMPLE_NAME ; return new String ( simpleName ) ; } else if ( expression instanceof ArrayInitializer ) { memberValuePair . valueKind = - <NUM_LIT:1> ; Expression [ ] expressions = ( ( ArrayInitializer ) expression ) . expressions ; int length = expressions == null ? <NUM_LIT:0> : expressions . length ; Object [ ] values = new Object [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { int previousValueKind = memberValuePair . valueKind ; Object value = getAnnotationMemberValue ( memberValuePair , expressions [ i ] , parentElement ) ; if ( previousValueKind != - <NUM_LIT:1> && memberValuePair . valueKind != previousValueKind ) { memberValuePair . valueKind = IMemberValuePair . K_UNKNOWN ; } values [ i ] = value ; } if ( memberValuePair . valueKind == - <NUM_LIT:1> ) memberValuePair . valueKind = IMemberValuePair . K_UNKNOWN ; return values ; } else if ( expression instanceof UnaryExpression ) { UnaryExpression unaryExpression = ( UnaryExpression ) expression ; if ( ( unaryExpression . bits & ASTNode . OperatorMASK ) > > ASTNode . OperatorSHIFT == OperatorIds . MINUS ) { if ( unaryExpression . expression instanceof Literal ) { Literal subExpression = ( Literal ) unaryExpression . expression ; subExpression . computeConstant ( ) ; return Util . getNegativeAnnotationMemberValue ( memberValuePair , subExpression . constant ) ; } } memberValuePair . valueKind = IMemberValuePair . K_UNKNOWN ; return null ; } else { memberValuePair . valueKind = IMemberValuePair . K_UNKNOWN ; return null ; } } public IJavaElement getHandleFromMemento ( String token , MementoTokenizer memento , WorkingCopyOwner owner ) { switch ( token . charAt ( <NUM_LIT:0> ) ) { case JEM_COUNT : return getHandleUpdatingCountFromMemento ( memento , owner ) ; } return this ; } protected void getHandleMemento ( StringBuffer buff ) { ( ( JavaElement ) getParent ( ) ) . getHandleMemento ( buff ) ; buff . append ( getHandleMementoDelimiter ( ) ) ; buff . append ( this . name ) ; buff . append ( JEM_COUNT ) ; buff . append ( this . declarationSourceStart ) ; buff . append ( JEM_COUNT ) ; buff . append ( this . declarationSourceEnd ) ; buff . append ( JEM_COUNT ) ; buff . append ( this . nameStart ) ; buff . append ( JEM_COUNT ) ; buff . append ( this . nameEnd ) ; buff . append ( JEM_COUNT ) ; escapeMementoName ( buff , this . typeSignature ) ; buff . append ( JEM_COUNT ) ; buff . append ( this . flags ) ; buff . append ( JEM_COUNT ) ; buff . append ( this . isParameter ) ; if ( this . occurrenceCount > <NUM_LIT:1> ) { buff . append ( JEM_COUNT ) ; buff . append ( this . occurrenceCount ) ; } } protected char getHandleMementoDelimiter ( ) { return JavaElement . JEM_LOCALVARIABLE ; } public IResource getCorrespondingResource ( ) { return null ; } public IMember getDeclaringMember ( ) { return ( IMember ) this . parent ; } public String getElementName ( ) { return this . name ; } public int getElementType ( ) { return LOCAL_VARIABLE ; } public int getFlags ( ) { if ( this . flags == - <NUM_LIT:1> ) { SourceMapper mapper = getSourceMapper ( ) ; if ( mapper != null ) { try { ClassFile classFile = ( ClassFile ) getClassFile ( ) ; if ( classFile != null ) { classFile . getBuffer ( ) ; return mapper . getFlags ( this ) ; } } catch ( JavaModelException e ) { } } return <NUM_LIT:0> ; } return this . flags & ExtraCompilerModifiers . AccJustFlag ; } public IClassFile getClassFile ( ) { IJavaElement element = getParent ( ) ; while ( element instanceof IMember ) { element = element . getParent ( ) ; } if ( element instanceof IClassFile ) { return ( IClassFile ) element ; } return null ; } public ISourceRange getNameRange ( ) { if ( this . nameEnd == - <NUM_LIT:1> ) { SourceMapper mapper = getSourceMapper ( ) ; if ( mapper != null ) { try { ClassFile classFile = ( ClassFile ) getClassFile ( ) ; if ( classFile != null ) { classFile . getBuffer ( ) ; return mapper . getNameRange ( this ) ; } } catch ( JavaModelException e ) { } } return SourceMapper . UNKNOWN_RANGE ; } return new SourceRange ( this . nameStart , this . nameEnd - this . nameStart + <NUM_LIT:1> ) ; } public IPath getPath ( ) { return this . parent . getPath ( ) ; } public IResource resource ( ) { return this . parent . resource ( ) ; } public String getSource ( ) throws JavaModelException { IOpenable openable = this . parent . 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 { if ( this . declarationSourceEnd == - <NUM_LIT:1> ) { SourceMapper mapper = getSourceMapper ( ) ; if ( mapper != null ) { ClassFile classFile = ( ClassFile ) getClassFile ( ) ; if ( classFile != null ) { classFile . getBuffer ( ) ; return mapper . getSourceRange ( this ) ; } } return SourceMapper . UNKNOWN_RANGE ; } return new SourceRange ( this . declarationSourceStart , this . declarationSourceEnd - this . declarationSourceStart + <NUM_LIT:1> ) ; } public ITypeRoot getTypeRoot ( ) { return this . getDeclaringMember ( ) . getTypeRoot ( ) ; } public String getTypeSignature ( ) { return this . typeSignature ; } public IResource getUnderlyingResource ( ) throws JavaModelException { return this . parent . getUnderlyingResource ( ) ; } public int hashCode ( ) { return Util . combineHashCodes ( this . parent . hashCode ( ) , this . nameStart ) ; } public boolean isParameter ( ) { return this . isParameter ; } public boolean isStructureKnown ( ) throws JavaModelException { return true ; } protected void toStringInfo ( int tab , StringBuffer buffer , Object info , boolean showResolvedInfo ) { buffer . append ( tabString ( tab ) ) ; if ( info != NO_INFO ) { buffer . append ( Signature . toString ( getTypeSignature ( ) ) ) ; buffer . append ( "<STR_LIT:U+0020>" ) ; } toStringName ( buffer ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import java . io . File ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . Map ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IFolder ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IWorkspace ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . Assert ; 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 . jdt . core . * ; import org . eclipse . jdt . internal . core . util . MementoTokenizer ; import org . eclipse . jdt . internal . core . util . Messages ; public class JavaModel extends Openable implements IJavaModel { public static HashSet existingExternalFiles = new HashSet ( ) ; public static HashSet existingExternalConfirmedFiles = new HashSet ( ) ; protected JavaModel ( ) throws Error { super ( null ) ; } protected boolean buildStructure ( OpenableElementInfo info , IProgressMonitor pm , Map newElements , IResource underlyingResource ) { IProject [ ] projects = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getProjects ( ) ; int length = projects . length ; IJavaElement [ ] children = new IJavaElement [ length ] ; int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IProject project = projects [ i ] ; if ( JavaProject . hasJavaNature ( project ) ) { children [ index ++ ] = getJavaProject ( project ) ; } } if ( index < length ) System . arraycopy ( children , <NUM_LIT:0> , children = new IJavaElement [ index ] , <NUM_LIT:0> , index ) ; info . setChildren ( children ) ; newElements . put ( this , info ) ; return true ; } public boolean contains ( IResource resource ) { switch ( resource . getType ( ) ) { case IResource . ROOT : case IResource . PROJECT : return true ; } IJavaProject [ ] projects ; try { projects = getJavaProjects ( ) ; } catch ( JavaModelException e ) { return false ; } for ( int i = <NUM_LIT:0> , length = projects . length ; i < length ; i ++ ) { JavaProject project = ( JavaProject ) projects [ i ] ; if ( ! project . contains ( resource ) ) { return false ; } } return true ; } public void copy ( IJavaElement [ ] elements , IJavaElement [ ] containers , IJavaElement [ ] siblings , String [ ] renamings , boolean force , IProgressMonitor monitor ) throws JavaModelException { if ( elements != null && elements . length > <NUM_LIT:0> && elements [ <NUM_LIT:0> ] != null && elements [ <NUM_LIT:0> ] . getElementType ( ) < IJavaElement . TYPE ) { runOperation ( new CopyResourceElementsOperation ( elements , containers , force ) , elements , siblings , renamings , monitor ) ; } else { runOperation ( new CopyElementsOperation ( elements , containers , force ) , elements , siblings , renamings , monitor ) ; } } protected Object createElementInfo ( ) { return new JavaModelInfo ( ) ; } public void delete ( IJavaElement [ ] elements , boolean force , IProgressMonitor monitor ) throws JavaModelException { if ( elements != null && elements . length > <NUM_LIT:0> && elements [ <NUM_LIT:0> ] != null && elements [ <NUM_LIT:0> ] . getElementType ( ) < IJavaElement . TYPE ) { new DeleteResourceElementsOperation ( elements , force ) . runOperation ( monitor ) ; } else { new DeleteElementsOperation ( elements , force ) . runOperation ( monitor ) ; } } public boolean equals ( Object o ) { if ( ! ( o instanceof JavaModel ) ) return false ; return super . equals ( o ) ; } public int getElementType ( ) { return JAVA_MODEL ; } public static void flushExternalFileCache ( ) { existingExternalFiles = new HashSet ( ) ; existingExternalConfirmedFiles = new HashSet ( ) ; } public IJavaElement getHandleFromMemento ( String token , MementoTokenizer memento , WorkingCopyOwner owner ) { switch ( token . charAt ( <NUM_LIT:0> ) ) { case JEM_JAVAPROJECT : if ( ! memento . hasMoreTokens ( ) ) return this ; String projectName = memento . nextToken ( ) ; JavaElement project = ( JavaElement ) getJavaProject ( projectName ) ; return project . getHandleFromMemento ( memento , owner ) ; } return null ; } protected void getHandleMemento ( StringBuffer buff ) { buff . append ( getElementName ( ) ) ; } protected char getHandleMementoDelimiter ( ) { Assert . isTrue ( false , "<STR_LIT>" ) ; return <NUM_LIT:0> ; } public IJavaProject getJavaProject ( String projectName ) { return new JavaProject ( ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getProject ( projectName ) , this ) ; } public IJavaProject getJavaProject ( IResource resource ) { switch ( resource . getType ( ) ) { case IResource . FOLDER : return new JavaProject ( ( ( IFolder ) resource ) . getProject ( ) , this ) ; case IResource . FILE : return new JavaProject ( ( ( IFile ) resource ) . getProject ( ) , this ) ; case IResource . PROJECT : return new JavaProject ( ( IProject ) resource , this ) ; default : throw new IllegalArgumentException ( Messages . element_invalidResourceForProject ) ; } } public IJavaProject [ ] getJavaProjects ( ) throws JavaModelException { ArrayList list = getChildrenOfType ( JAVA_PROJECT ) ; IJavaProject [ ] array = new IJavaProject [ list . size ( ) ] ; list . toArray ( array ) ; return array ; } public Object [ ] getNonJavaResources ( ) throws JavaModelException { return ( ( JavaModelInfo ) getElementInfo ( ) ) . getNonJavaResources ( ) ; } public IPath getPath ( ) { return Path . ROOT ; } public IResource resource ( PackageFragmentRoot root ) { return ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; } public IResource getUnderlyingResource ( ) { return null ; } public IWorkspace getWorkspace ( ) { return ResourcesPlugin . getWorkspace ( ) ; } public void move ( IJavaElement [ ] elements , IJavaElement [ ] containers , IJavaElement [ ] siblings , String [ ] renamings , boolean force , IProgressMonitor monitor ) throws JavaModelException { if ( elements != null && elements . length > <NUM_LIT:0> && elements [ <NUM_LIT:0> ] != null && elements [ <NUM_LIT:0> ] . getElementType ( ) < IJavaElement . TYPE ) { runOperation ( new MoveResourceElementsOperation ( elements , containers , force ) , elements , siblings , renamings , monitor ) ; } else { runOperation ( new MoveElementsOperation ( elements , containers , force ) , elements , siblings , renamings , monitor ) ; } } public void refreshExternalArchives ( IJavaElement [ ] elementsScope , IProgressMonitor monitor ) throws JavaModelException { if ( elementsScope == null ) { elementsScope = new IJavaElement [ ] { this } ; } JavaModelManager . getJavaModelManager ( ) . getDeltaProcessor ( ) . checkExternalArchiveChanges ( elementsScope , monitor ) ; } public void rename ( IJavaElement [ ] elements , IJavaElement [ ] destinations , String [ ] renamings , boolean force , IProgressMonitor monitor ) throws JavaModelException { MultiOperation op ; if ( elements != null && elements . length > <NUM_LIT:0> && elements [ <NUM_LIT:0> ] != null && elements [ <NUM_LIT:0> ] . getElementType ( ) < IJavaElement . TYPE ) { op = new RenameResourceElementsOperation ( elements , destinations , renamings , force ) ; } else { op = new RenameElementsOperation ( elements , destinations , renamings , force ) ; } op . runOperation ( monitor ) ; } protected void runOperation ( MultiOperation op , IJavaElement [ ] elements , IJavaElement [ ] siblings , String [ ] renamings , IProgressMonitor monitor ) throws JavaModelException { op . setRenamings ( renamings ) ; if ( siblings != null ) { for ( int i = <NUM_LIT:0> ; i < elements . length ; i ++ ) { op . setInsertBefore ( elements [ i ] , siblings [ i ] ) ; } } op . runOperation ( monitor ) ; } protected void toStringInfo ( int tab , StringBuffer buffer , Object info , boolean showResolvedInfo ) { buffer . append ( tabString ( tab ) ) ; buffer . append ( "<STR_LIT>" ) ; if ( info == null ) { buffer . append ( "<STR_LIT>" ) ; } } public static Object getTarget ( IPath path , boolean checkResourceExistence ) { Object target = getWorkspaceTarget ( path ) ; if ( target != null ) return target ; return getExternalTarget ( path , checkResourceExistence ) ; } public static IResource getWorkspaceTarget ( IPath path ) { if ( path == null || path . getDevice ( ) != null ) return null ; IWorkspace workspace = ResourcesPlugin . getWorkspace ( ) ; if ( workspace == null ) return null ; return workspace . getRoot ( ) . findMember ( path ) ; } public static Object getExternalTarget ( IPath path , boolean checkResourceExistence ) { if ( path == null ) return null ; ExternalFoldersManager externalFoldersManager = JavaModelManager . getExternalManager ( ) ; Object linkedFolder = externalFoldersManager . getFolder ( path ) ; if ( linkedFolder != null ) { if ( checkResourceExistence ) { File externalFile = new File ( path . toOSString ( ) ) ; if ( ! externalFile . isDirectory ( ) ) { return null ; } } return linkedFolder ; } File externalFile = new File ( path . toOSString ( ) ) ; if ( ! checkResourceExistence ) { return externalFile ; } else if ( existingExternalFilesContains ( externalFile ) ) { return externalFile ; } else { if ( JavaModelManager . ZIP_ACCESS_VERBOSE ) { System . out . println ( "<STR_LIT:(>" + Thread . currentThread ( ) + "<STR_LIT>" + path . toString ( ) ) ; } if ( externalFile . isFile ( ) ) { existingExternalFilesAdd ( externalFile ) ; return externalFile ; } } return null ; } private synchronized static void existingExternalFilesAdd ( File externalFile ) { existingExternalFiles . add ( externalFile ) ; } private synchronized static boolean existingExternalFilesContains ( File externalFile ) { return existingExternalFiles . contains ( externalFile ) ; } public static boolean isFile ( Object target ) { return getFile ( target ) != null ; } public static synchronized File getFile ( Object target ) { if ( existingExternalConfirmedFiles . contains ( target ) ) return ( File ) target ; if ( target instanceof File ) { File f = ( File ) target ; if ( f . isFile ( ) ) { existingExternalConfirmedFiles . add ( f ) ; return f ; } } return null ; } protected IStatus validateExistence ( IResource underlyingResource ) { return JavaModelStatus . VERIFIED_OK ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import java . util . ArrayList ; import org . eclipse . jdt . core . Flags ; import org . eclipse . jdt . core . ICompilationUnit ; import org . eclipse . jdt . core . IField ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IMethod ; import org . eclipse . jdt . core . IPackageFragment ; import org . eclipse . jdt . core . ISourceRange ; import org . eclipse . jdt . core . IType ; import org . eclipse . jdt . core . ITypeParameter ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . Signature ; import org . eclipse . jdt . core . compiler . * ; import org . eclipse . jdt . internal . codeassist . ISelectionRequestor ; import org . eclipse . jdt . internal . codeassist . SelectionEngine ; import org . eclipse . jdt . internal . compiler . ast . AbstractVariableDeclaration ; import org . eclipse . jdt . internal . compiler . ast . LocalDeclaration ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileConstants ; 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 . MethodBinding ; import org . eclipse . jdt . internal . compiler . lookup . ParameterizedTypeBinding ; 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 . TypeConstants ; import org . eclipse . jdt . internal . compiler . lookup . TypeVariableBinding ; import org . eclipse . jdt . internal . core . util . HandleFactory ; import org . eclipse . jdt . internal . core . util . Util ; public class SelectionRequestor implements ISelectionRequestor { protected NameLookup nameLookup ; protected Openable openable ; protected IJavaElement [ ] elements = JavaElement . NO_ELEMENTS ; protected int elementIndex = - <NUM_LIT:1> ; protected HandleFactory handleFactory = new HandleFactory ( ) ; public SelectionRequestor ( NameLookup nameLookup , Openable openable ) { super ( ) ; this . nameLookup = nameLookup ; this . openable = openable ; } private void acceptBinaryMethod ( IType type , IMethod method , char [ ] uniqueKey , boolean isConstructor ) { try { if ( ! isConstructor || ( ( JavaElement ) method ) . getClassFile ( ) . getBuffer ( ) == null ) { if ( uniqueKey != null ) { ResolvedBinaryMethod resolvedMethod = new ResolvedBinaryMethod ( ( JavaElement ) method . getParent ( ) , method . getElementName ( ) , method . getParameterTypes ( ) , new String ( uniqueKey ) ) ; resolvedMethod . occurrenceCount = method . getOccurrenceCount ( ) ; method = resolvedMethod ; } addElement ( method ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( method . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } else { ISourceRange range = method . getSourceRange ( ) ; if ( range . getOffset ( ) != - <NUM_LIT:1> && range . getLength ( ) != <NUM_LIT:0> ) { if ( uniqueKey != null ) { ResolvedBinaryMethod resolvedMethod = new ResolvedBinaryMethod ( ( JavaElement ) method . getParent ( ) , method . getElementName ( ) , method . getParameterTypes ( ) , new String ( uniqueKey ) ) ; resolvedMethod . occurrenceCount = method . getOccurrenceCount ( ) ; method = resolvedMethod ; } addElement ( method ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( method . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } else { addElement ( type ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( type . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } } } catch ( JavaModelException e ) { } } protected void acceptBinaryMethod ( IType type , char [ ] selector , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , String [ ] parameterSignatures , char [ ] [ ] typeParameterNames , char [ ] [ ] [ ] typeParameterBoundNames , char [ ] uniqueKey , boolean isConstructor ) { IMethod method = type . getMethod ( new String ( selector ) , parameterSignatures ) ; if ( method . exists ( ) ) { if ( typeParameterNames != null && typeParameterNames . length != <NUM_LIT:0> ) { IMethod [ ] methods = type . findMethods ( method ) ; if ( methods != null && methods . length > <NUM_LIT:1> ) { for ( int i = <NUM_LIT:0> ; i < methods . length ; i ++ ) { if ( areTypeParametersCompatible ( methods [ i ] , typeParameterNames , typeParameterBoundNames ) ) { acceptBinaryMethod ( type , method , uniqueKey , isConstructor ) ; } } return ; } } acceptBinaryMethod ( type , method , uniqueKey , isConstructor ) ; } } public void acceptType ( char [ ] packageName , char [ ] typeName , int modifiers , boolean isDeclaration , char [ ] uniqueKey , int start , int end ) { int acceptFlags = <NUM_LIT:0> ; int kind = modifiers & ( ClassFileConstants . AccInterface | ClassFileConstants . AccEnum | ClassFileConstants . AccAnnotation ) ; switch ( kind ) { case ClassFileConstants . AccAnnotation : case ClassFileConstants . AccAnnotation | ClassFileConstants . AccInterface : acceptFlags = NameLookup . ACCEPT_ANNOTATIONS ; break ; case ClassFileConstants . AccEnum : acceptFlags = NameLookup . ACCEPT_ENUMS ; break ; case ClassFileConstants . AccInterface : acceptFlags = NameLookup . ACCEPT_INTERFACES ; break ; default : acceptFlags = NameLookup . ACCEPT_CLASSES ; break ; } IType type = null ; if ( isDeclaration ) { type = resolveTypeByLocation ( packageName , typeName , acceptFlags , start , end ) ; } else { type = resolveType ( packageName , typeName , acceptFlags ) ; if ( type != null ) { String key = uniqueKey == null ? type . getKey ( ) : new String ( uniqueKey ) ; if ( type . isBinary ( ) ) { ResolvedBinaryType resolvedType = new ResolvedBinaryType ( ( JavaElement ) type . getParent ( ) , type . getElementName ( ) , key ) ; resolvedType . occurrenceCount = type . getOccurrenceCount ( ) ; type = resolvedType ; } else { ResolvedSourceType resolvedType = new ResolvedSourceType ( ( JavaElement ) type . getParent ( ) , type . getElementName ( ) , key ) ; resolvedType . occurrenceCount = type . getOccurrenceCount ( ) ; type = resolvedType ; } } } if ( type != null ) { addElement ( type ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( type . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } } public void acceptType ( IType type ) { String key = type . getKey ( ) ; if ( type . isBinary ( ) ) { ResolvedBinaryType resolvedType = new ResolvedBinaryType ( ( JavaElement ) type . getParent ( ) , type . getElementName ( ) , key ) ; resolvedType . occurrenceCount = type . getOccurrenceCount ( ) ; type = resolvedType ; } else { ResolvedSourceType resolvedType = new ResolvedSourceType ( ( JavaElement ) type . getParent ( ) , type . getElementName ( ) , key ) ; resolvedType . occurrenceCount = type . getOccurrenceCount ( ) ; type = resolvedType ; } addElement ( type ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( type . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } public void acceptError ( CategorizedProblem error ) { } public void acceptField ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] name , boolean isDeclaration , char [ ] uniqueKey , int start , int end ) { if ( isDeclaration ) { IType type = resolveTypeByLocation ( declaringTypePackageName , declaringTypeName , NameLookup . ACCEPT_ALL , start , end ) ; if ( type != null ) { try { IField [ ] fields = type . getFields ( ) ; for ( int i = <NUM_LIT:0> ; i < fields . length ; i ++ ) { IField field = fields [ i ] ; ISourceRange range = field . getNameRange ( ) ; if ( range . getOffset ( ) <= start && range . getOffset ( ) + range . getLength ( ) >= end && field . getElementName ( ) . equals ( new String ( name ) ) ) { addElement ( fields [ i ] ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( field . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } return ; } } } catch ( JavaModelException e ) { return ; } } } else { IType type = resolveType ( declaringTypePackageName , declaringTypeName , NameLookup . ACCEPT_ALL ) ; if ( type != null ) { IField field = type . getField ( new String ( name ) ) ; if ( field . exists ( ) ) { if ( uniqueKey != null ) { if ( field . isBinary ( ) ) { ResolvedBinaryField resolvedField = new ResolvedBinaryField ( ( JavaElement ) field . getParent ( ) , field . getElementName ( ) , new String ( uniqueKey ) ) ; resolvedField . occurrenceCount = field . getOccurrenceCount ( ) ; field = resolvedField ; } else { ResolvedSourceField resolvedField = new ResolvedSourceField ( ( JavaElement ) field . getParent ( ) , field . getElementName ( ) , new String ( uniqueKey ) ) ; resolvedField . occurrenceCount = field . getOccurrenceCount ( ) ; field = resolvedField ; } } addElement ( field ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( field . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } } } } public void acceptLocalField ( FieldBinding fieldBinding ) { IJavaElement res ; if ( fieldBinding . declaringClass instanceof ParameterizedTypeBinding ) { LocalTypeBinding localTypeBinding = ( LocalTypeBinding ) ( ( ParameterizedTypeBinding ) fieldBinding . declaringClass ) . genericType ( ) ; res = findLocalElement ( localTypeBinding . sourceStart ( ) ) ; } else { SourceTypeBinding typeBinding = ( SourceTypeBinding ) fieldBinding . declaringClass ; res = findLocalElement ( typeBinding . sourceStart ( ) ) ; } if ( res != null && res . getElementType ( ) == IJavaElement . TYPE ) { IType type = ( IType ) res ; IField field = type . getField ( new String ( fieldBinding . name ) ) ; if ( field . exists ( ) ) { char [ ] uniqueKey = fieldBinding . computeUniqueKey ( ) ; if ( field . isBinary ( ) ) { ResolvedBinaryField resolvedField = new ResolvedBinaryField ( ( JavaElement ) field . getParent ( ) , field . getElementName ( ) , new String ( uniqueKey ) ) ; resolvedField . occurrenceCount = field . getOccurrenceCount ( ) ; field = resolvedField ; } else { ResolvedSourceField resolvedField = new ResolvedSourceField ( ( JavaElement ) field . getParent ( ) , field . getElementName ( ) , new String ( uniqueKey ) ) ; resolvedField . occurrenceCount = field . getOccurrenceCount ( ) ; field = resolvedField ; } addElement ( field ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( field . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } } } public void acceptLocalMethod ( MethodBinding methodBinding ) { IJavaElement res = findLocalElement ( methodBinding . original ( ) . sourceStart ( ) ) ; if ( res != null ) { if ( res . getElementType ( ) == IJavaElement . METHOD ) { IMethod method = ( IMethod ) res ; char [ ] uniqueKey = methodBinding . computeUniqueKey ( ) ; if ( method . isBinary ( ) ) { ResolvedBinaryMethod resolvedRes = new ResolvedBinaryMethod ( ( JavaElement ) res . getParent ( ) , method . getElementName ( ) , method . getParameterTypes ( ) , new String ( uniqueKey ) ) ; resolvedRes . occurrenceCount = method . getOccurrenceCount ( ) ; res = resolvedRes ; } else { ResolvedSourceMethod resolvedRes = new ResolvedSourceMethod ( ( JavaElement ) res . getParent ( ) , method . getElementName ( ) , method . getParameterTypes ( ) , new String ( uniqueKey ) ) ; resolvedRes . occurrenceCount = method . getOccurrenceCount ( ) ; res = resolvedRes ; } addElement ( res ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( res . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } else if ( methodBinding . selector == TypeConstants . INIT && res . getElementType ( ) == IJavaElement . TYPE ) { res = ( ( JavaElement ) res ) . resolved ( methodBinding . declaringClass ) ; addElement ( res ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( res . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } } } public void acceptLocalType ( TypeBinding typeBinding ) { IJavaElement res = null ; if ( typeBinding instanceof ParameterizedTypeBinding ) { LocalTypeBinding localTypeBinding = ( LocalTypeBinding ) ( ( ParameterizedTypeBinding ) typeBinding ) . genericType ( ) ; res = findLocalElement ( localTypeBinding . sourceStart ( ) ) ; } else if ( typeBinding instanceof SourceTypeBinding ) { res = findLocalElement ( ( ( SourceTypeBinding ) typeBinding ) . sourceStart ( ) ) ; } if ( res != null && res . getElementType ( ) == IJavaElement . TYPE ) { res = ( ( JavaElement ) res ) . resolved ( typeBinding ) ; addElement ( res ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( res . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } } public void acceptLocalTypeParameter ( TypeVariableBinding typeVariableBinding ) { IJavaElement res ; if ( typeVariableBinding . declaringElement instanceof ParameterizedTypeBinding ) { LocalTypeBinding localTypeBinding = ( LocalTypeBinding ) ( ( ParameterizedTypeBinding ) typeVariableBinding . declaringElement ) . genericType ( ) ; res = findLocalElement ( localTypeBinding . sourceStart ( ) ) ; } else { SourceTypeBinding typeBinding = ( SourceTypeBinding ) typeVariableBinding . declaringElement ; res = findLocalElement ( typeBinding . sourceStart ( ) ) ; } if ( res != null && res . getElementType ( ) == IJavaElement . TYPE ) { IType type = ( IType ) res ; ITypeParameter typeParameter = type . getTypeParameter ( new String ( typeVariableBinding . sourceName ) ) ; if ( typeParameter . exists ( ) ) { addElement ( typeParameter ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( typeParameter . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } } } public void acceptLocalMethodTypeParameter ( TypeVariableBinding typeVariableBinding ) { MethodBinding methodBinding = ( MethodBinding ) typeVariableBinding . declaringElement ; IJavaElement res = findLocalElement ( methodBinding . sourceStart ( ) ) ; if ( res != null && res . getElementType ( ) == IJavaElement . METHOD ) { IMethod method = ( IMethod ) res ; ITypeParameter typeParameter = method . getTypeParameter ( new String ( typeVariableBinding . sourceName ) ) ; if ( typeParameter . exists ( ) ) { addElement ( typeParameter ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( typeParameter . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } } } public void acceptLocalVariable ( LocalVariableBinding binding ) { LocalDeclaration local = binding . declaration ; IJavaElement parent = findLocalElement ( local . sourceStart ) ; LocalVariable localVar = null ; if ( parent != null ) { localVar = new LocalVariable ( ( JavaElement ) parent , new String ( local . name ) , local . declarationSourceStart , local . declarationSourceEnd , local . sourceStart , local . sourceEnd , Util . typeSignature ( local . type ) , local . annotations , local . modifiers , local . getKind ( ) == AbstractVariableDeclaration . PARAMETER ) ; } if ( localVar != null ) { addElement ( localVar ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( localVar . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } } public void acceptMethod ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , String enclosingDeclaringTypeSignature , char [ ] selector , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , String [ ] parameterSignatures , char [ ] [ ] typeParameterNames , char [ ] [ ] [ ] typeParameterBoundNames , boolean isConstructor , boolean isDeclaration , char [ ] uniqueKey , int start , int end ) { IJavaElement [ ] previousElement = this . elements ; int previousElementIndex = this . elementIndex ; this . elements = JavaElement . NO_ELEMENTS ; this . elementIndex = - <NUM_LIT:1> ; if ( isDeclaration ) { IType type = resolveTypeByLocation ( declaringTypePackageName , declaringTypeName , NameLookup . ACCEPT_ALL , start , end ) ; if ( type != null ) { acceptMethodDeclaration ( type , selector , start , end ) ; } } else { IType type = resolveType ( declaringTypePackageName , declaringTypeName , NameLookup . ACCEPT_ALL ) ; if ( type != null ) { if ( type . isBinary ( ) ) { IType declaringDeclaringType = type . getDeclaringType ( ) ; boolean isStatic = false ; try { isStatic = Flags . isStatic ( type . getFlags ( ) ) ; } catch ( JavaModelException e ) { } if ( declaringDeclaringType != null && isConstructor && ! isStatic ) { int length = parameterPackageNames . length ; System . arraycopy ( parameterPackageNames , <NUM_LIT:0> , parameterPackageNames = new char [ length + <NUM_LIT:1> ] [ ] , <NUM_LIT:1> , length ) ; System . arraycopy ( parameterTypeNames , <NUM_LIT:0> , parameterTypeNames = new char [ length + <NUM_LIT:1> ] [ ] , <NUM_LIT:1> , length ) ; System . arraycopy ( parameterSignatures , <NUM_LIT:0> , parameterSignatures = new String [ length + <NUM_LIT:1> ] , <NUM_LIT:1> , length ) ; parameterPackageNames [ <NUM_LIT:0> ] = declaringDeclaringType . getPackageFragment ( ) . getElementName ( ) . toCharArray ( ) ; parameterTypeNames [ <NUM_LIT:0> ] = declaringDeclaringType . getTypeQualifiedName ( ) . toCharArray ( ) ; parameterSignatures [ <NUM_LIT:0> ] = Signature . getTypeErasure ( enclosingDeclaringTypeSignature ) ; } acceptBinaryMethod ( type , selector , parameterPackageNames , parameterTypeNames , parameterSignatures , typeParameterNames , typeParameterBoundNames , uniqueKey , isConstructor ) ; } else { acceptSourceMethod ( type , selector , parameterPackageNames , parameterTypeNames , parameterSignatures , typeParameterNames , typeParameterBoundNames , uniqueKey ) ; } } } if ( previousElementIndex > - <NUM_LIT:1> ) { int elementsLength = this . elementIndex + previousElementIndex + <NUM_LIT:2> ; if ( elementsLength > this . elements . length ) { System . arraycopy ( this . elements , <NUM_LIT:0> , this . elements = new IJavaElement [ elementsLength * <NUM_LIT:2> + <NUM_LIT:1> ] , <NUM_LIT:0> , this . elementIndex + <NUM_LIT:1> ) ; } System . arraycopy ( previousElement , <NUM_LIT:0> , this . elements , this . elementIndex + <NUM_LIT:1> , previousElementIndex + <NUM_LIT:1> ) ; this . elementIndex += previousElementIndex + <NUM_LIT:1> ; } } public void acceptPackage ( char [ ] packageName ) { IPackageFragment [ ] pkgs = this . nameLookup . findPackageFragments ( new String ( packageName ) , false ) ; if ( pkgs != null ) { for ( int i = <NUM_LIT:0> , length = pkgs . length ; i < length ; i ++ ) { addElement ( pkgs [ i ] ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( pkgs [ i ] . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } } } protected void acceptSourceMethod ( IType type , char [ ] selector , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , String [ ] parameterSignatures , char [ ] [ ] typeParameterNames , char [ ] [ ] [ ] typeParameterBoundNames , char [ ] uniqueKey ) { String name = new String ( selector ) ; IMethod [ ] methods = null ; try { methods = type . getMethods ( ) ; for ( int i = <NUM_LIT:0> ; i < methods . length ; i ++ ) { if ( methods [ i ] . getElementName ( ) . equals ( name ) && methods [ i ] . getParameterTypes ( ) . length == parameterTypeNames . length ) { IMethod method = methods [ i ] ; if ( uniqueKey != null ) { ResolvedSourceMethod resolvedMethod = new ResolvedSourceMethod ( ( JavaElement ) method . getParent ( ) , method . getElementName ( ) , method . getParameterTypes ( ) , new String ( uniqueKey ) ) ; resolvedMethod . occurrenceCount = method . getOccurrenceCount ( ) ; method = resolvedMethod ; } addElement ( method ) ; } } } catch ( JavaModelException e ) { return ; } if ( this . elementIndex == - <NUM_LIT:1> ) { addElement ( type ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( type . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } return ; } if ( this . elementIndex == <NUM_LIT:0> ) { if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( this . elements [ <NUM_LIT:0> ] . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } return ; } IJavaElement [ ] matches = this . elements ; int matchesIndex = this . elementIndex ; this . elements = JavaElement . NO_ELEMENTS ; this . elementIndex = - <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i <= matchesIndex ; i ++ ) { IMethod method = ( IMethod ) matches [ i ] ; String [ ] signatures = method . getParameterTypes ( ) ; boolean match = true ; for ( int p = <NUM_LIT:0> ; p < signatures . length ; p ++ ) { String simpleName = Signature . getSimpleName ( Signature . toString ( Signature . getTypeErasure ( signatures [ p ] ) ) ) ; char [ ] simpleParameterName = CharOperation . lastSegment ( parameterTypeNames [ p ] , '<CHAR_LIT:.>' ) ; if ( ! simpleName . equals ( new String ( simpleParameterName ) ) ) { match = false ; break ; } } if ( match && ! areTypeParametersCompatible ( method , typeParameterNames , typeParameterBoundNames ) ) { match = false ; } if ( match ) { addElement ( method ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( method . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } } } protected void acceptMethodDeclaration ( IType type , char [ ] selector , int start , int end ) { String name = new String ( selector ) ; IMethod [ ] methods = null ; try { methods = type . getMethods ( ) ; for ( int i = <NUM_LIT:0> ; i < methods . length ; i ++ ) { ISourceRange range = methods [ i ] . getNameRange ( ) ; if ( range . getOffset ( ) <= start && range . getOffset ( ) + range . getLength ( ) >= end && methods [ i ] . getElementName ( ) . equals ( name ) ) { addElement ( methods [ i ] ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( this . elements [ <NUM_LIT:0> ] . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } return ; } } } catch ( JavaModelException e ) { return ; } addElement ( type ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( type . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } return ; } public void acceptTypeParameter ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] typeParameterName , boolean isDeclaration , int start , int end ) { IType type ; if ( isDeclaration ) { type = resolveTypeByLocation ( declaringTypePackageName , declaringTypeName , NameLookup . ACCEPT_ALL , start , end ) ; } else { type = resolveType ( declaringTypePackageName , declaringTypeName , NameLookup . ACCEPT_ALL ) ; } if ( type != null ) { ITypeParameter typeParameter = type . getTypeParameter ( new String ( typeParameterName ) ) ; if ( typeParameter == null ) { addElement ( type ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( type . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } else { addElement ( typeParameter ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( typeParameter . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } } } public void acceptMethodTypeParameter ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] selector , int selectorStart , int selectorEnd , char [ ] typeParameterName , boolean isDeclaration , int start , int end ) { IType type = resolveTypeByLocation ( declaringTypePackageName , declaringTypeName , NameLookup . ACCEPT_ALL , selectorStart , selectorEnd ) ; if ( type != null ) { IMethod method = null ; String name = new String ( selector ) ; IMethod [ ] methods = null ; try { methods = type . getMethods ( ) ; done : for ( int i = <NUM_LIT:0> ; i < methods . length ; i ++ ) { ISourceRange range = methods [ i ] . getNameRange ( ) ; if ( range . getOffset ( ) >= selectorStart && range . getOffset ( ) + range . getLength ( ) <= selectorEnd && methods [ i ] . getElementName ( ) . equals ( name ) ) { method = methods [ i ] ; break done ; } } } catch ( JavaModelException e ) { } if ( method == null ) { addElement ( type ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( type . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } else { ITypeParameter typeParameter = method . getTypeParameter ( new String ( typeParameterName ) ) ; if ( typeParameter == null ) { addElement ( method ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( method . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } else { addElement ( typeParameter ) ; if ( SelectionEngine . DEBUG ) { System . out . print ( "<STR_LIT>" ) ; System . out . print ( typeParameter . toString ( ) ) ; System . out . println ( "<STR_LIT:)>" ) ; } } } } } protected void addElement ( IJavaElement element ) { int elementLength = this . elementIndex + <NUM_LIT:1> ; for ( int i = <NUM_LIT:0> ; i < elementLength ; i ++ ) { if ( this . elements [ i ] . equals ( element ) ) { return ; } } if ( elementLength == this . elements . length ) { System . arraycopy ( this . elements , <NUM_LIT:0> , this . elements = new IJavaElement [ ( elementLength * <NUM_LIT:2> ) + <NUM_LIT:1> ] , <NUM_LIT:0> , elementLength ) ; } this . elements [ ++ this . elementIndex ] = element ; } private boolean areTypeParametersCompatible ( IMethod method , char [ ] [ ] typeParameterNames , char [ ] [ ] [ ] typeParameterBoundNames ) { try { ITypeParameter [ ] typeParameters = method . getTypeParameters ( ) ; int length1 = typeParameters == null ? <NUM_LIT:0> : typeParameters . length ; int length2 = typeParameterNames == null ? <NUM_LIT:0> : typeParameterNames . length ; if ( length1 != length2 ) { return false ; } else { for ( int j = <NUM_LIT:0> ; j < length1 ; j ++ ) { ITypeParameter typeParameter = typeParameters [ j ] ; String typeParameterName = typeParameter . getElementName ( ) ; if ( ! typeParameterName . equals ( new String ( typeParameterNames [ j ] ) ) ) { return false ; } String [ ] bounds = typeParameter . getBounds ( ) ; int boundCount = typeParameterBoundNames [ j ] == null ? <NUM_LIT:0> : typeParameterBoundNames [ j ] . length ; if ( bounds . length != boundCount ) { return false ; } else { for ( int k = <NUM_LIT:0> ; k < boundCount ; k ++ ) { String simpleName = Signature . getSimpleName ( bounds [ k ] ) ; int index = simpleName . indexOf ( '<CHAR_LIT>' ) ; if ( index != - <NUM_LIT:1> ) { simpleName = simpleName . substring ( <NUM_LIT:0> , index ) ; } if ( ! simpleName . equals ( new String ( typeParameterBoundNames [ j ] [ k ] ) ) ) { return false ; } } } } } } catch ( JavaModelException e ) { return false ; } return true ; } protected IJavaElement findLocalElement ( int pos ) { IJavaElement res = null ; if ( this . openable instanceof ICompilationUnit ) { ICompilationUnit cu = ( ICompilationUnit ) this . openable ; try { res = cu . getElementAt ( pos ) ; } catch ( JavaModelException e ) { } } else if ( this . openable instanceof ClassFile ) { ClassFile cf = ( ClassFile ) this . openable ; try { res = cf . getElementAtConsideringSibling ( pos ) ; } catch ( JavaModelException e ) { } } return res ; } public IJavaElement findMethodFromBinding ( MethodBinding method , String [ ] signatures , ReferenceBinding declaringClass ) { IType foundType = this . resolveType ( declaringClass . qualifiedPackageName ( ) , declaringClass . qualifiedSourceName ( ) , NameLookup . ACCEPT_CLASSES & NameLookup . ACCEPT_INTERFACES ) ; if ( foundType != null ) { if ( foundType instanceof BinaryType ) { try { return Util . findMethod ( foundType , method . selector , signatures , method . isConstructor ( ) ) ; } catch ( JavaModelException e ) { return null ; } } else { return foundType . getMethod ( new String ( method . selector ) , signatures ) ; } } return null ; } public IJavaElement [ ] getElements ( ) { int elementLength = this . elementIndex + <NUM_LIT:1> ; if ( this . elements . length != elementLength ) { System . arraycopy ( this . elements , <NUM_LIT:0> , this . elements = new IJavaElement [ elementLength ] , <NUM_LIT:0> , elementLength ) ; } return this . elements ; } protected IType resolveType ( char [ ] packageName , char [ ] typeName , int acceptFlags ) { IType type = null ; if ( this . openable instanceof CompilationUnit && ( ( CompilationUnit ) this . openable ) . isWorkingCopy ( ) ) { CompilationUnit wc = ( CompilationUnit ) this . openable ; try { if ( ( ( packageName == null || packageName . length == <NUM_LIT:0> ) && wc . getPackageDeclarations ( ) . length == <NUM_LIT:0> ) || ( ! ( packageName == null || packageName . length == <NUM_LIT:0> ) && wc . getPackageDeclaration ( new String ( packageName ) ) . exists ( ) ) ) { char [ ] [ ] compoundName = CharOperation . splitOn ( '<CHAR_LIT:.>' , typeName ) ; if ( compoundName . length > <NUM_LIT:0> ) { type = wc . getType ( new String ( compoundName [ <NUM_LIT:0> ] ) ) ; for ( int i = <NUM_LIT:1> , length = compoundName . length ; i < length ; i ++ ) { type = type . getType ( new String ( compoundName [ i ] ) ) ; } } if ( type != null && ! type . exists ( ) ) { type = null ; } } } catch ( JavaModelException e ) { } } if ( type == null ) { IPackageFragment [ ] pkgs = this . nameLookup . findPackageFragments ( ( packageName == null || packageName . length == <NUM_LIT:0> ) ? IPackageFragment . DEFAULT_PACKAGE_NAME : new String ( packageName ) , false ) ; for ( int i = <NUM_LIT:0> , length = pkgs == null ? <NUM_LIT:0> : pkgs . length ; i < length ; i ++ ) { type = this . nameLookup . findType ( new String ( typeName ) , pkgs [ i ] , false , acceptFlags , true ) ; if ( type != null ) break ; } if ( type == null ) { String pName = IPackageFragment . DEFAULT_PACKAGE_NAME ; if ( packageName != null ) { pName = new String ( packageName ) ; } if ( this . openable != null && this . openable . getParent ( ) . getElementName ( ) . equals ( pName ) ) { String tName = new String ( typeName ) ; tName = tName . replace ( '<CHAR_LIT:.>' , '<CHAR_LIT>' ) ; IType [ ] allTypes = null ; try { ArrayList list = this . openable . getChildrenOfType ( IJavaElement . TYPE ) ; allTypes = new IType [ list . size ( ) ] ; list . toArray ( allTypes ) ; } catch ( JavaModelException e ) { return null ; } for ( int i = <NUM_LIT:0> ; i < allTypes . length ; i ++ ) { if ( allTypes [ i ] . getTypeQualifiedName ( ) . equals ( tName ) ) { return allTypes [ i ] ; } } } } } return type ; } protected IType resolveTypeByLocation ( char [ ] packageName , char [ ] typeName , int acceptFlags , int start , int end ) { IType type = null ; if ( this . openable instanceof CompilationUnit && ( ( CompilationUnit ) this . openable ) . isOpen ( ) ) { CompilationUnit wc = ( CompilationUnit ) this . openable ; try { if ( ( ( packageName == null || packageName . length == <NUM_LIT:0> ) && wc . getPackageDeclarations ( ) . length == <NUM_LIT:0> ) || ( ! ( packageName == null || packageName . length == <NUM_LIT:0> ) && wc . getPackageDeclaration ( new String ( packageName ) ) . exists ( ) ) ) { char [ ] [ ] compoundName = CharOperation . splitOn ( '<CHAR_LIT:.>' , typeName ) ; if ( compoundName . length > <NUM_LIT:0> ) { IType [ ] tTypes = wc . getTypes ( ) ; int i = <NUM_LIT:0> ; int depth = <NUM_LIT:0> ; done : while ( i < tTypes . length ) { ISourceRange range = tTypes [ i ] . getSourceRange ( ) ; if ( range . getOffset ( ) <= start && range . getOffset ( ) + range . getLength ( ) >= end && tTypes [ i ] . getElementName ( ) . equals ( new String ( compoundName [ depth ] ) ) ) { if ( depth == compoundName . length - <NUM_LIT:1> ) { type = tTypes [ i ] ; break done ; } tTypes = tTypes [ i ] . getTypes ( ) ; i = <NUM_LIT:0> ; depth ++ ; continue done ; } i ++ ; } } if ( type != null && ! type . exists ( ) ) { type = null ; } } } catch ( JavaModelException e ) { } } if ( type == null ) { IPackageFragment [ ] pkgs = this . nameLookup . findPackageFragments ( ( packageName == null || packageName . length == <NUM_LIT:0> ) ? IPackageFragment . DEFAULT_PACKAGE_NAME : new String ( packageName ) , false ) ; for ( int i = <NUM_LIT:0> , length = pkgs == null ? <NUM_LIT:0> : pkgs . length ; i < length ; i ++ ) { type = this . nameLookup . findType ( new String ( typeName ) , pkgs [ i ] , false , acceptFlags , true ) ; if ( type != null ) break ; } if ( type == null ) { String pName = IPackageFragment . DEFAULT_PACKAGE_NAME ; if ( packageName != null ) { pName = new String ( packageName ) ; } if ( this . openable != null && this . openable . getParent ( ) . getElementName ( ) . equals ( pName ) ) { String tName = new String ( typeName ) ; tName = tName . replace ( '<CHAR_LIT:.>' , '<CHAR_LIT>' ) ; IType [ ] allTypes = null ; try { ArrayList list = this . openable . getChildrenOfType ( IJavaElement . TYPE ) ; allTypes = new IType [ list . size ( ) ] ; list . toArray ( allTypes ) ; } catch ( JavaModelException e ) { return null ; } for ( int i = <NUM_LIT:0> ; i < allTypes . length ; i ++ ) { if ( allTypes [ i ] . getTypeQualifiedName ( ) . equals ( tName ) ) { return allTypes [ i ] ; } } } } } return type ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . IJavaElement ; public class SourceMethodWithChildrenInfo extends SourceMethodInfo { protected IJavaElement [ ] children ; public SourceMethodWithChildrenInfo ( IJavaElement [ ] children ) { this . children = children ; } public IJavaElement [ ] getChildren ( ) { return this . children ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . Map ; import java . util . Set ; import org . eclipse . jdt . core . IAnnotation ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . IJavaElementDelta ; import org . eclipse . jdt . core . IParent ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . core . util . Util ; public class JavaElementDeltaBuilder { IJavaElement javaElement ; int maxDepth = Integer . MAX_VALUE ; Map infos ; Map annotationInfos ; Map oldPositions ; Map newPositions ; public JavaElementDelta delta = null ; HashSet added ; HashSet removed ; static class ListItem { public IJavaElement previous ; public IJavaElement next ; public ListItem ( IJavaElement previous , IJavaElement next ) { this . previous = previous ; this . next = next ; } } public JavaElementDeltaBuilder ( IJavaElement javaElement ) { this . javaElement = javaElement ; initialize ( ) ; recordElementInfo ( javaElement , ( JavaModel ) this . javaElement . getJavaModel ( ) , <NUM_LIT:0> ) ; } public JavaElementDeltaBuilder ( IJavaElement javaElement , int maxDepth ) { this . javaElement = javaElement ; this . maxDepth = maxDepth ; initialize ( ) ; recordElementInfo ( javaElement , ( JavaModel ) this . javaElement . getJavaModel ( ) , <NUM_LIT:0> ) ; } private void added ( IJavaElement element ) { this . added . add ( element ) ; ListItem current = getNewPosition ( element ) ; ListItem previous = null , next = null ; if ( current . previous != null ) previous = getNewPosition ( current . previous ) ; if ( current . next != null ) next = getNewPosition ( current . next ) ; if ( previous != null ) previous . next = current . next ; if ( next != null ) next . previous = current . previous ; } public void buildDeltas ( ) { this . delta = new JavaElementDelta ( this . javaElement ) ; if ( this . javaElement . getElementType ( ) >= IJavaElement . COMPILATION_UNIT ) { this . delta . fineGrained ( ) ; } recordNewPositions ( this . javaElement , <NUM_LIT:0> ) ; findAdditions ( this . javaElement , <NUM_LIT:0> ) ; findDeletions ( ) ; findChangesInPositioning ( this . javaElement , <NUM_LIT:0> ) ; trimDelta ( this . delta ) ; if ( this . delta . getAffectedChildren ( ) . length == <NUM_LIT:0> ) { this . delta . contentChanged ( ) ; } } private 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 ( ! CharOperation . equals ( first [ i ] , second [ i ] ) ) return false ; return true ; } private void findAdditions ( IJavaElement newElement , int depth ) { JavaElementInfo oldInfo = getElementInfo ( newElement ) ; if ( oldInfo == null && depth < this . maxDepth ) { this . delta . added ( newElement ) ; added ( newElement ) ; } else { removeElementInfo ( newElement ) ; } if ( depth >= this . maxDepth ) { this . delta . changed ( newElement , IJavaElementDelta . F_CONTENT ) ; return ; } JavaElementInfo newInfo = null ; try { newInfo = ( JavaElementInfo ) ( ( JavaElement ) newElement ) . getElementInfo ( ) ; } catch ( JavaModelException npe ) { return ; } findContentChange ( oldInfo , newInfo , newElement ) ; if ( oldInfo != null && newElement instanceof IParent ) { IJavaElement [ ] children = newInfo . getChildren ( ) ; if ( children != null ) { int length = children . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { findAdditions ( children [ i ] , depth + <NUM_LIT:1> ) ; } } } } private void findChangesInPositioning ( IJavaElement element , int depth ) { if ( depth >= this . maxDepth || this . added . contains ( element ) || this . removed . contains ( element ) ) return ; if ( ! isPositionedCorrectly ( element ) ) { this . delta . changed ( element , IJavaElementDelta . F_REORDER ) ; } if ( element instanceof IParent ) { JavaElementInfo info = null ; try { info = ( JavaElementInfo ) ( ( JavaElement ) element ) . getElementInfo ( ) ; } catch ( JavaModelException npe ) { return ; } IJavaElement [ ] children = info . getChildren ( ) ; if ( children != null ) { int length = children . length ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { findChangesInPositioning ( children [ i ] , depth + <NUM_LIT:1> ) ; } } } } private void findAnnotationChanges ( IAnnotation [ ] oldAnnotations , IAnnotation [ ] newAnnotations , IJavaElement parent ) { ArrayList annotationDeltas = null ; for ( int i = <NUM_LIT:0> , length = newAnnotations . length ; i < length ; i ++ ) { IAnnotation newAnnotation = newAnnotations [ i ] ; Object oldInfo = this . annotationInfos . remove ( newAnnotation ) ; if ( oldInfo == null ) { JavaElementDelta annotationDelta = new JavaElementDelta ( newAnnotation ) ; annotationDelta . added ( ) ; if ( annotationDeltas == null ) annotationDeltas = new ArrayList ( ) ; annotationDeltas . add ( annotationDelta ) ; continue ; } else { AnnotationInfo newInfo = null ; try { newInfo = ( AnnotationInfo ) ( ( JavaElement ) newAnnotation ) . getElementInfo ( ) ; } catch ( JavaModelException npe ) { return ; } if ( ! Util . equalArraysOrNull ( ( ( AnnotationInfo ) oldInfo ) . members , newInfo . members ) ) { JavaElementDelta annotationDelta = new JavaElementDelta ( newAnnotation ) ; annotationDelta . changed ( IJavaElementDelta . F_CONTENT ) ; if ( annotationDeltas == null ) annotationDeltas = new ArrayList ( ) ; annotationDeltas . add ( annotationDelta ) ; } } } for ( int i = <NUM_LIT:0> , length = oldAnnotations . length ; i < length ; i ++ ) { IAnnotation oldAnnotation = oldAnnotations [ i ] ; if ( this . annotationInfos . remove ( oldAnnotation ) != null ) { JavaElementDelta annotationDelta = new JavaElementDelta ( oldAnnotation ) ; annotationDelta . removed ( ) ; if ( annotationDeltas == null ) annotationDeltas = new ArrayList ( ) ; annotationDeltas . add ( annotationDelta ) ; } } if ( annotationDeltas == null ) return ; int size = annotationDeltas . size ( ) ; if ( size > <NUM_LIT:0> ) { JavaElementDelta parentDelta = this . delta . changed ( parent , IJavaElementDelta . F_ANNOTATIONS ) ; parentDelta . annotationDeltas = ( IJavaElementDelta [ ] ) annotationDeltas . toArray ( new IJavaElementDelta [ size ] ) ; } } private void findContentChange ( JavaElementInfo oldInfo , JavaElementInfo newInfo , IJavaElement newElement ) { if ( oldInfo instanceof MemberElementInfo && newInfo instanceof MemberElementInfo ) { if ( ( ( MemberElementInfo ) oldInfo ) . getModifiers ( ) != ( ( MemberElementInfo ) newInfo ) . getModifiers ( ) ) { this . delta . changed ( newElement , IJavaElementDelta . F_MODIFIERS ) ; } if ( oldInfo instanceof AnnotatableInfo && newInfo instanceof AnnotatableInfo ) { findAnnotationChanges ( ( ( AnnotatableInfo ) oldInfo ) . annotations , ( ( AnnotatableInfo ) newInfo ) . annotations , newElement ) ; } if ( oldInfo instanceof SourceMethodElementInfo && newInfo instanceof SourceMethodElementInfo ) { SourceMethodElementInfo oldSourceMethodInfo = ( SourceMethodElementInfo ) oldInfo ; SourceMethodElementInfo newSourceMethodInfo = ( SourceMethodElementInfo ) newInfo ; if ( ! CharOperation . equals ( oldSourceMethodInfo . getReturnTypeName ( ) , newSourceMethodInfo . getReturnTypeName ( ) ) || ! CharOperation . equals ( oldSourceMethodInfo . getTypeParameterNames ( ) , newSourceMethodInfo . getTypeParameterNames ( ) ) || ! equals ( oldSourceMethodInfo . getTypeParameterBounds ( ) , newSourceMethodInfo . getTypeParameterBounds ( ) ) ) { this . delta . changed ( newElement , IJavaElementDelta . F_CONTENT ) ; } } else if ( oldInfo instanceof SourceFieldElementInfo && newInfo instanceof SourceFieldElementInfo ) { if ( ! CharOperation . equals ( ( ( SourceFieldElementInfo ) oldInfo ) . getTypeName ( ) , ( ( SourceFieldElementInfo ) newInfo ) . getTypeName ( ) ) ) { this . delta . changed ( newElement , IJavaElementDelta . F_CONTENT ) ; } } else if ( oldInfo instanceof SourceTypeElementInfo && newInfo instanceof SourceTypeElementInfo ) { SourceTypeElementInfo oldSourceTypeInfo = ( SourceTypeElementInfo ) oldInfo ; SourceTypeElementInfo newSourceTypeInfo = ( SourceTypeElementInfo ) newInfo ; if ( ! CharOperation . equals ( oldSourceTypeInfo . getSuperclassName ( ) , newSourceTypeInfo . getSuperclassName ( ) ) || ! CharOperation . equals ( oldSourceTypeInfo . getInterfaceNames ( ) , newSourceTypeInfo . getInterfaceNames ( ) ) ) { this . delta . changed ( newElement , IJavaElementDelta . F_SUPER_TYPES ) ; } if ( ! CharOperation . equals ( oldSourceTypeInfo . getTypeParameterNames ( ) , newSourceTypeInfo . getTypeParameterNames ( ) ) || ! equals ( oldSourceTypeInfo . getTypeParameterBounds ( ) , newSourceTypeInfo . getTypeParameterBounds ( ) ) ) { this . delta . changed ( newElement , IJavaElementDelta . F_CONTENT ) ; } HashMap oldTypeCategories = oldSourceTypeInfo . categories ; HashMap newTypeCategories = newSourceTypeInfo . categories ; if ( oldTypeCategories != null ) { Set elements ; if ( newTypeCategories != null ) { elements = new HashSet ( oldTypeCategories . keySet ( ) ) ; elements . addAll ( newTypeCategories . keySet ( ) ) ; } else elements = oldTypeCategories . keySet ( ) ; Iterator iterator = elements . iterator ( ) ; while ( iterator . hasNext ( ) ) { IJavaElement element = ( IJavaElement ) iterator . next ( ) ; String [ ] oldCategories = ( String [ ] ) oldTypeCategories . get ( element ) ; String [ ] newCategories = newTypeCategories == null ? null : ( String [ ] ) newTypeCategories . get ( element ) ; if ( ! Util . equalArraysOrNull ( oldCategories , newCategories ) ) { this . delta . changed ( element , IJavaElementDelta . F_CATEGORIES ) ; } } } else if ( newTypeCategories != null ) { Iterator elements = newTypeCategories . keySet ( ) . iterator ( ) ; while ( elements . hasNext ( ) ) { IJavaElement element = ( IJavaElement ) elements . next ( ) ; this . delta . changed ( element , IJavaElementDelta . F_CATEGORIES ) ; } } } } } private void findDeletions ( ) { Iterator iter = this . infos . keySet ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { IJavaElement element = ( IJavaElement ) iter . next ( ) ; this . delta . removed ( element ) ; removed ( element ) ; } } private JavaElementInfo getElementInfo ( IJavaElement element ) { return ( JavaElementInfo ) this . infos . get ( element ) ; } private ListItem getNewPosition ( IJavaElement element ) { return ( ListItem ) this . newPositions . get ( element ) ; } private ListItem getOldPosition ( IJavaElement element ) { return ( ListItem ) this . oldPositions . get ( element ) ; } private void initialize ( ) { this . infos = new HashMap ( <NUM_LIT:20> ) ; this . oldPositions = new HashMap ( <NUM_LIT:20> ) ; this . newPositions = new HashMap ( <NUM_LIT:20> ) ; this . oldPositions . put ( this . javaElement , new ListItem ( null , null ) ) ; this . newPositions . put ( this . javaElement , new ListItem ( null , null ) ) ; this . added = new HashSet ( <NUM_LIT:5> ) ; this . removed = new HashSet ( <NUM_LIT:5> ) ; } private void insertPositions ( IJavaElement [ ] elements , boolean isNew ) { int length = elements . length ; IJavaElement previous = null , current = null , next = ( length > <NUM_LIT:0> ) ? elements [ <NUM_LIT:0> ] : null ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { previous = current ; current = next ; next = ( i + <NUM_LIT:1> < length ) ? elements [ i + <NUM_LIT:1> ] : null ; if ( isNew ) { this . newPositions . put ( current , new ListItem ( previous , next ) ) ; } else { this . oldPositions . put ( current , new ListItem ( previous , next ) ) ; } } } private boolean isPositionedCorrectly ( IJavaElement element ) { ListItem oldListItem = getOldPosition ( element ) ; if ( oldListItem == null ) return false ; ListItem newListItem = getNewPosition ( element ) ; if ( newListItem == null ) return false ; IJavaElement oldPrevious = oldListItem . previous ; IJavaElement newPrevious = newListItem . previous ; if ( oldPrevious == null ) { return newPrevious == null ; } else { return oldPrevious . equals ( newPrevious ) ; } } private void recordElementInfo ( IJavaElement element , JavaModel model , int depth ) { if ( depth >= this . maxDepth ) { return ; } JavaElementInfo info = ( JavaElementInfo ) JavaModelManager . getJavaModelManager ( ) . getInfo ( element ) ; if ( info == null ) return ; this . infos . put ( element , info ) ; if ( element instanceof IParent ) { IJavaElement [ ] children = info . getChildren ( ) ; if ( children != null ) { insertPositions ( children , false ) ; for ( int i = <NUM_LIT:0> , length = children . length ; i < length ; i ++ ) recordElementInfo ( children [ i ] , model , depth + <NUM_LIT:1> ) ; } } IAnnotation [ ] annotations = null ; if ( info instanceof AnnotatableInfo ) annotations = ( ( AnnotatableInfo ) info ) . annotations ; if ( annotations != null ) { if ( this . annotationInfos == null ) this . annotationInfos = new HashMap ( ) ; JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; for ( int i = <NUM_LIT:0> , length = annotations . length ; i < length ; i ++ ) { this . annotationInfos . put ( annotations [ i ] , manager . getInfo ( annotations [ i ] ) ) ; } } } private void recordNewPositions ( IJavaElement newElement , int depth ) { if ( depth < this . maxDepth && newElement instanceof IParent ) { JavaElementInfo info = null ; try { info = ( JavaElementInfo ) ( ( JavaElement ) newElement ) . getElementInfo ( ) ; } catch ( JavaModelException npe ) { return ; } IJavaElement [ ] children = info . getChildren ( ) ; if ( children != null ) { insertPositions ( children , true ) ; for ( int i = <NUM_LIT:0> , length = children . length ; i < length ; i ++ ) { recordNewPositions ( children [ i ] , depth + <NUM_LIT:1> ) ; } } } } private void removed ( IJavaElement element ) { this . removed . add ( element ) ; ListItem current = getOldPosition ( element ) ; ListItem previous = null , next = null ; if ( current . previous != null ) previous = getOldPosition ( current . previous ) ; if ( current . next != null ) next = getOldPosition ( current . next ) ; if ( previous != null ) previous . next = current . next ; if ( next != null ) next . previous = current . previous ; } private void removeElementInfo ( IJavaElement element ) { this . infos . remove ( element ) ; } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . delta == null ? "<STR_LIT>" : this . delta . toString ( ) ) ; return buffer . toString ( ) ; } private void trimDelta ( JavaElementDelta elementDelta ) { if ( elementDelta . getKind ( ) == IJavaElementDelta . REMOVED ) { IJavaElementDelta [ ] children = elementDelta . getAffectedChildren ( ) ; for ( int i = <NUM_LIT:0> , length = children . length ; i < length ; i ++ ) { elementDelta . removeAffectedChild ( ( JavaElementDelta ) children [ i ] ) ; } } else { IJavaElementDelta [ ] children = elementDelta . getAffectedChildren ( ) ; for ( int i = <NUM_LIT:0> , length = children . length ; i < length ; i ++ ) { trimDelta ( ( JavaElementDelta ) children [ i ] ) ; } } } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . IMemberValuePair ; import org . eclipse . jdt . internal . core . util . Util ; public class MemberValuePair implements IMemberValuePair { String memberName ; public Object value ; public int valueKind = K_UNKNOWN ; public MemberValuePair ( String memberName ) { this . memberName = memberName ; } public MemberValuePair ( String memberName , Object value , int valueKind ) { this ( memberName ) ; this . value = value ; this . valueKind = valueKind ; } public boolean equals ( Object obj ) { if ( ! ( obj instanceof MemberValuePair ) ) { return false ; } MemberValuePair other = ( MemberValuePair ) obj ; return this . valueKind == other . valueKind && this . memberName . equals ( other . memberName ) && ( this . value == other . value || ( this . value != null && this . value . equals ( other . value ) ) || ( this . value instanceof Object [ ] && other . value instanceof Object [ ] && Util . equalArraysOrNull ( ( Object [ ] ) this . value , ( Object [ ] ) other . value ) ) ) ; } public String getMemberName ( ) { return this . memberName ; } public Object getValue ( ) { return this . value ; } public int getValueKind ( ) { return this . valueKind ; } public int hashCode ( ) { final int prime = <NUM_LIT:31> ; int result = <NUM_LIT:1> ; result = prime * result + ( ( this . memberName == null ) ? <NUM_LIT:0> : this . memberName . hashCode ( ) ) ; result = prime * result + ( ( this . value == null ) ? <NUM_LIT:0> : this . value . hashCode ( ) ) ; result = prime * result + this . valueKind ; return result ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import java . util . HashMap ; import java . util . Map ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . internal . core . util . LRUCache ; import org . eclipse . jdt . internal . core . util . Util ; public class JavaModelCache { public static boolean VERBOSE = false ; public static final int DEFAULT_PROJECT_SIZE = <NUM_LIT:5> ; public static final int DEFAULT_ROOT_SIZE = <NUM_LIT> ; public static final int DEFAULT_PKG_SIZE = <NUM_LIT> ; public static final int DEFAULT_OPENABLE_SIZE = <NUM_LIT> ; public static final int DEFAULT_CHILDREN_SIZE = <NUM_LIT> * <NUM_LIT:20> ; public static final String RATIO_PROPERTY = "<STR_LIT>" ; public static final String JAR_TYPE_RATIO_PROPERTY = "<STR_LIT>" ; public static final Object NON_EXISTING_JAR_TYPE_INFO = new Object ( ) ; protected double memoryRatio = - <NUM_LIT:1> ; protected Object modelInfo ; protected HashMap projectCache ; protected ElementCache rootCache ; protected ElementCache pkgCache ; protected ElementCache openableCache ; protected Map childrenCache ; protected LRUCache jarTypeCache ; public JavaModelCache ( ) { double ratio = getMemoryRatio ( ) ; double openableRatio = getOpenableRatio ( ) ; this . projectCache = new HashMap ( DEFAULT_PROJECT_SIZE ) ; if ( VERBOSE ) { this . rootCache = new VerboseElementCache ( ( int ) ( DEFAULT_ROOT_SIZE * ratio ) , "<STR_LIT>" ) ; this . pkgCache = new VerboseElementCache ( ( int ) ( DEFAULT_PKG_SIZE * ratio ) , "<STR_LIT>" ) ; this . openableCache = new VerboseElementCache ( ( int ) ( DEFAULT_OPENABLE_SIZE * ratio * openableRatio ) , "<STR_LIT>" ) ; } else { this . rootCache = new ElementCache ( ( int ) ( DEFAULT_ROOT_SIZE * ratio ) ) ; this . pkgCache = new ElementCache ( ( int ) ( DEFAULT_PKG_SIZE * ratio ) ) ; this . openableCache = new ElementCache ( ( int ) ( DEFAULT_OPENABLE_SIZE * ratio * openableRatio ) ) ; } this . childrenCache = new HashMap ( ( int ) ( DEFAULT_CHILDREN_SIZE * ratio * openableRatio ) ) ; resetJarTypeCache ( ) ; } private double getOpenableRatio ( ) { return getRatioForProperty ( RATIO_PROPERTY ) ; } private double getJarTypeRatio ( ) { return getRatioForProperty ( JAR_TYPE_RATIO_PROPERTY ) ; } private double getRatioForProperty ( String propertyName ) { String property = System . getProperty ( propertyName ) ; if ( property != null ) { try { return Double . parseDouble ( property ) ; } catch ( NumberFormatException e ) { Util . log ( e , "<STR_LIT>" + propertyName + "<STR_LIT::U+0020>" + property ) ; } } return <NUM_LIT:1.0> ; } public Object getInfo ( IJavaElement element ) { switch ( element . getElementType ( ) ) { case IJavaElement . JAVA_MODEL : return this . modelInfo ; case IJavaElement . JAVA_PROJECT : return this . projectCache . get ( element ) ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : return this . rootCache . get ( element ) ; case IJavaElement . PACKAGE_FRAGMENT : return this . pkgCache . get ( element ) ; case IJavaElement . COMPILATION_UNIT : case IJavaElement . CLASS_FILE : return this . openableCache . get ( element ) ; case IJavaElement . TYPE : Object result = this . jarTypeCache . get ( element ) ; if ( result != null ) return result ; else return this . childrenCache . get ( element ) ; default : return this . childrenCache . get ( element ) ; } } public IJavaElement getExistingElement ( IJavaElement element ) { switch ( element . getElementType ( ) ) { case IJavaElement . JAVA_MODEL : return element ; case IJavaElement . JAVA_PROJECT : return element ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : return ( IJavaElement ) this . rootCache . getKey ( element ) ; case IJavaElement . PACKAGE_FRAGMENT : return ( IJavaElement ) this . pkgCache . getKey ( element ) ; case IJavaElement . COMPILATION_UNIT : case IJavaElement . CLASS_FILE : return ( IJavaElement ) this . openableCache . getKey ( element ) ; case IJavaElement . TYPE : return element ; default : return element ; } } protected double getMemoryRatio ( ) { if ( ( int ) this . memoryRatio == - <NUM_LIT:1> ) { long maxMemory = Runtime . getRuntime ( ) . maxMemory ( ) ; this . memoryRatio = maxMemory == Long . MAX_VALUE ? <NUM_LIT> : ( ( double ) maxMemory ) / ( <NUM_LIT> * <NUM_LIT> ) ; } return this . memoryRatio ; } protected Object peekAtInfo ( IJavaElement element ) { switch ( element . getElementType ( ) ) { case IJavaElement . JAVA_MODEL : return this . modelInfo ; case IJavaElement . JAVA_PROJECT : return this . projectCache . get ( element ) ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : return this . rootCache . peek ( element ) ; case IJavaElement . PACKAGE_FRAGMENT : return this . pkgCache . peek ( element ) ; case IJavaElement . COMPILATION_UNIT : case IJavaElement . CLASS_FILE : return this . openableCache . peek ( element ) ; case IJavaElement . TYPE : Object result = this . jarTypeCache . peek ( element ) ; if ( result != null ) return result ; else return this . childrenCache . get ( element ) ; default : return this . childrenCache . get ( element ) ; } } protected void putInfo ( IJavaElement element , Object info ) { switch ( element . getElementType ( ) ) { case IJavaElement . JAVA_MODEL : this . modelInfo = info ; break ; case IJavaElement . JAVA_PROJECT : this . projectCache . put ( element , info ) ; this . rootCache . ensureSpaceLimit ( info , element ) ; break ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : this . rootCache . put ( element , info ) ; this . pkgCache . ensureSpaceLimit ( info , element ) ; break ; case IJavaElement . PACKAGE_FRAGMENT : this . pkgCache . put ( element , info ) ; this . openableCache . ensureSpaceLimit ( info , element ) ; break ; case IJavaElement . COMPILATION_UNIT : case IJavaElement . CLASS_FILE : this . openableCache . put ( element , info ) ; break ; default : this . childrenCache . put ( element , info ) ; } } protected void removeInfo ( JavaElement element ) { switch ( element . getElementType ( ) ) { case IJavaElement . JAVA_MODEL : this . modelInfo = null ; break ; case IJavaElement . JAVA_PROJECT : this . projectCache . remove ( element ) ; this . rootCache . resetSpaceLimit ( ( int ) ( DEFAULT_ROOT_SIZE * getMemoryRatio ( ) ) , element ) ; break ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : this . rootCache . remove ( element ) ; this . pkgCache . resetSpaceLimit ( ( int ) ( DEFAULT_PKG_SIZE * getMemoryRatio ( ) ) , element ) ; break ; case IJavaElement . PACKAGE_FRAGMENT : this . pkgCache . remove ( element ) ; this . openableCache . resetSpaceLimit ( ( int ) ( DEFAULT_OPENABLE_SIZE * getMemoryRatio ( ) * getOpenableRatio ( ) ) , element ) ; break ; case IJavaElement . COMPILATION_UNIT : case IJavaElement . CLASS_FILE : this . openableCache . remove ( element ) ; break ; default : this . childrenCache . remove ( element ) ; } } protected void resetJarTypeCache ( ) { this . jarTypeCache = new LRUCache ( ( int ) ( DEFAULT_OPENABLE_SIZE * getMemoryRatio ( ) * getJarTypeRatio ( ) ) ) ; } public String toString ( ) { return toStringFillingRation ( "<STR_LIT>" ) ; } public String toStringFillingRation ( String prefix ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( prefix ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( this . projectCache . size ( ) ) ; buffer . append ( "<STR_LIT>" ) ; buffer . append ( prefix ) ; buffer . append ( this . rootCache . toStringFillingRation ( "<STR_LIT>" ) ) ; buffer . append ( '<STR_LIT:\n>' ) ; buffer . append ( prefix ) ; buffer . append ( this . pkgCache . toStringFillingRation ( "<STR_LIT>" ) ) ; buffer . append ( '<STR_LIT:\n>' ) ; buffer . append ( prefix ) ; buffer . append ( this . openableCache . toStringFillingRation ( "<STR_LIT>" ) ) ; buffer . append ( '<STR_LIT:\n>' ) ; buffer . append ( prefix ) ; buffer . append ( this . jarTypeCache . toStringFillingRation ( "<STR_LIT>" ) ) ; buffer . append ( '<STR_LIT:\n>' ) ; return buffer . toString ( ) ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . JavaModelException ; public class ResolvedBinaryType extends BinaryType { private String uniqueKey ; public ResolvedBinaryType ( JavaElement parent , String name , String uniqueKey ) { super ( parent , name ) ; this . uniqueKey = uniqueKey ; } public String getFullyQualifiedParameterizedName ( ) throws JavaModelException { return getFullyQualifiedParameterizedName ( getFullyQualifiedName ( '<CHAR_LIT:.>' ) , this . 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 BinaryType ( this . parent , this . name ) ; handle . occurrenceCount = this . occurrenceCount ; return handle ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import java . io . ByteArrayInputStream ; import java . io . IOException ; import java . io . InputStream ; import java . util . zip . ZipEntry ; import java . util . zip . ZipFile ; import org . eclipse . core . resources . IStorage ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . jdt . core . IJarEntryResource ; import org . eclipse . jdt . core . IJavaModelStatusConstants ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . internal . compiler . util . Util ; public class JarEntryFile extends JarEntryResource { private static final IJarEntryResource [ ] NO_CHILDREN = new IJarEntryResource [ <NUM_LIT:0> ] ; public JarEntryFile ( String simpleName ) { super ( simpleName ) ; } public JarEntryResource clone ( Object newParent ) { JarEntryFile file = new JarEntryFile ( this . simpleName ) ; file . setParent ( newParent ) ; return file ; } public InputStream getContents ( ) throws CoreException { ZipFile zipFile = null ; try { zipFile = getZipFile ( ) ; if ( JavaModelManager . ZIP_ACCESS_VERBOSE ) { System . out . println ( "<STR_LIT:(>" + Thread . currentThread ( ) + "<STR_LIT>" + zipFile . getName ( ) ) ; } String entryName = getEntryName ( ) ; ZipEntry zipEntry = zipFile . getEntry ( entryName ) ; if ( zipEntry == null ) { throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . INVALID_PATH , entryName ) ) ; } byte [ ] contents = Util . getZipEntryByteContent ( zipEntry , zipFile ) ; return new ByteArrayInputStream ( contents ) ; } catch ( IOException e ) { throw new JavaModelException ( e , IJavaModelStatusConstants . IO_EXCEPTION ) ; } finally { JavaModelManager . getJavaModelManager ( ) . closeZipFile ( zipFile ) ; } } public IJarEntryResource [ ] getChildren ( ) { return NO_CHILDREN ; } public boolean isFile ( ) { return true ; } public String toString ( ) { return "<STR_LIT>" + getEntryName ( ) + "<STR_LIT:]>" ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . ResourcesPlugin ; public class JavaModelInfo extends OpenableElementInfo { Object [ ] nonJavaResources ; private Object [ ] computeNonJavaResources ( ) { IProject [ ] projects = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getProjects ( ) ; int length = projects . length ; Object [ ] resources = null ; int index = <NUM_LIT:0> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { IProject project = projects [ i ] ; if ( ! JavaProject . hasJavaNature ( project ) ) { if ( resources == null ) { resources = new Object [ length ] ; } resources [ index ++ ] = project ; } } if ( index == <NUM_LIT:0> ) return NO_NON_JAVA_RESOURCES ; if ( index < length ) { System . arraycopy ( resources , <NUM_LIT:0> , resources = new Object [ index ] , <NUM_LIT:0> , index ) ; } return resources ; } Object [ ] getNonJavaResources ( ) { if ( this . nonJavaResources == null ) { this . nonJavaResources = computeNonJavaResources ( ) ; } return this . nonJavaResources ; } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . * ; public class PackageDeclaration extends SourceRefElement implements IPackageDeclaration { String name ; protected PackageDeclaration ( CompilationUnit parent , String name ) { super ( parent ) ; this . name = name ; } public boolean equals ( Object o ) { if ( ! ( o instanceof PackageDeclaration ) ) return false ; return super . equals ( o ) ; } public String getElementName ( ) { return this . name ; } public int getElementType ( ) { return PACKAGE_DECLARATION ; } protected char getHandleMementoDelimiter ( ) { return JavaElement . JEM_PACKAGEDECLARATION ; } public ISourceRange getNameRange ( ) throws JavaModelException { AnnotatableInfo info = ( AnnotatableInfo ) getElementInfo ( ) ; return info . getNameRange ( ) ; } public IJavaElement getPrimaryElement ( boolean checkOwner ) { CompilationUnit cu = ( CompilationUnit ) getAncestor ( COMPILATION_UNIT ) ; if ( checkOwner && cu . isPrimary ( ) ) return this ; return cu . getPackageDeclaration ( this . name ) ; } protected void toStringInfo ( int tab , StringBuffer buffer , Object info , boolean showResolvedInfo ) { buffer . append ( tabString ( tab ) ) ; buffer . append ( "<STR_LIT>" ) ; toStringName ( buffer ) ; if ( info == null ) { buffer . append ( "<STR_LIT>" ) ; } } } </s>
|
<s> package org . eclipse . jdt . internal . core ; import java . util . HashSet ; import java . util . Iterator ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jdt . core . IClasspathEntry ; import org . eclipse . jdt . core . JavaModelException ; public class ExternalFolderChange { private JavaProject project ; private IClasspathEntry [ ] oldResolvedClasspath ; public ExternalFolderChange ( JavaProject project , IClasspathEntry [ ] oldResolvedClasspath ) { this . project = project ; this . oldResolvedClasspath = oldResolvedClasspath ; } public void updateExternalFoldersIfNecessary ( boolean refreshIfExistAlready , IProgressMonitor monitor ) throws JavaModelException { HashSet oldFolders = ExternalFoldersManager . getExternalFolders ( this . oldResolvedClasspath ) ; IClasspathEntry [ ] newResolvedClasspath = this . project . getResolvedClasspath ( ) ; HashSet newFolders = ExternalFoldersManager . getExternalFolders ( newResolvedClasspath ) ; if ( newFolders == null ) return ; ExternalFoldersManager foldersManager = JavaModelManager . getExternalManager ( ) ; Iterator iterator = newFolders . iterator ( ) ; while ( iterator . hasNext ( ) ) { Object folderPath = iterator . next ( ) ; if ( oldFolders == null || ! oldFolders . remove ( folderPath ) || foldersManager . removePendingFolder ( folderPath ) ) { try { foldersManager . createLinkFolder ( ( IPath ) folderPath , refreshIfExistAlready , monitor ) ; } catch ( CoreException e ) { throw new JavaModelException ( e ) ; } } } } public String toString ( ) { return "<STR_LIT>" + this . project . getElementName ( ) ; } } </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 ( ) , false , 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 = org . eclipse . jdt . internal . compiler . util . 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 = org . eclipse . jdt . internal . compiler . util . Util . scanClassTypeSignature ( genericSignature , index ) + <NUM_LIT:1> ; while ( index < signatureLength ) { int start = index ; index = org . eclipse . jdt . internal . compiler . util . 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 . 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 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 ; 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 . 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 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 . 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 . 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 ; 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 . 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 . 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 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 . 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 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 ; 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 . 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 . core . util . ClassFormatException ; import org . eclipse . jdt . core . util . IBootstrapMethodsEntry ; import org . eclipse . jdt . core . util . IConstantPool ; public class BootstrapMethodsEntry extends ClassFileStruct implements IBootstrapMethodsEntry { private int bootstrapMethodReference ; private int [ ] bootstrapArguments ; public BootstrapMethodsEntry ( byte classFileBytes [ ] , IConstantPool constantPool , int offset ) throws ClassFormatException { this . bootstrapMethodReference = u2At ( classFileBytes , <NUM_LIT:0> , offset ) ; int length = u2At ( classFileBytes , <NUM_LIT:2> , offset ) ; int [ ] arguments = new int [ length ] ; int position = <NUM_LIT:4> ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { arguments [ i ] = u2At ( classFileBytes , position , offset ) ; position += <NUM_LIT:2> ; } this . bootstrapArguments = arguments ; } public int [ ] getBootstrapArguments ( ) { return this . bootstrapArguments ; } public int getBootstrapMethodReference ( ) { return this . bootstrapMethodReference ; } } </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_timeout_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_archiveReadError ; 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 updating_external_archives_jobName ; 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_bootstrapmethodattributesheader ; public static String disassembler_bootstrapmethodentry ; public static String disassembler_bootstrapmethodentry_argument ; 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_constantpool_methodhandle ; public static String disassembler_constantpool_methodtype ; public static String disassembler_constantpool_invokedynamic ; 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 ; public static String disassembler_method_type_ref_getfield ; public static String disassembler_method_type_ref_putfield ; public static String disassembler_method_type_ref_getstatic ; public static String disassembler_method_type_ref_putstatic ; public static String disassembler_method_type_ref_invokestatic ; public static String disassembler_method_type_ref_invokevirtual ; public static String disassembler_method_type_ref_invokespecial ; public static String disassembler_method_type_ref_invokeinterface ; public static String disassembler_method_type_ref_newinvokespecial ; 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 . 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 . 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 . 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 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 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 java . util . ArrayList ; import org . eclipse . jdt . core . Signature ; 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 . PolymorphicMethodBinding ; 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 . TagBits ; 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 ; } else if ( ( method . tagBits & TagBits . AnnotationPolymorphicSignature ) != <NUM_LIT:0> ) { this . typeBinding = null ; char [ ] [ ] typeParameters = Signature . getParameterTypes ( signature ) ; int length = typeParameters . length ; TypeBinding [ ] parameterTypes = new TypeBinding [ length ] ; for ( int j = <NUM_LIT:0> ; j < length ; j ++ ) { parameterTypes [ j ] = getType ( typeParameters [ j ] ) ; } PolymorphicMethodBinding polymorphicMethod = this . environment . createPolymorphicMethod ( method , parameterTypes ) ; this . methodBinding = polymorphicMethod ; this . methodBinding = this . environment . updatePolymorphicMethodReturnType ( polymorphicMethod , getType ( Signature . getReturnType ( signature ) ) ) ; this . compilerBinding = this . methodBinding ; return ; } } } } private TypeBinding getType ( char [ ] type ) { TypeBinding binding = null ; int length = type . length ; switch ( length ) { case <NUM_LIT:1> : switch ( type [ <NUM_LIT:0> ] ) { case '<CHAR_LIT>' : binding = TypeBinding . INT ; break ; case '<CHAR_LIT:Z>' : binding = TypeBinding . BOOLEAN ; break ; case '<CHAR_LIT>' : binding = TypeBinding . VOID ; break ; case '<CHAR_LIT>' : binding = TypeBinding . CHAR ; break ; case '<CHAR_LIT>' : binding = TypeBinding . DOUBLE ; break ; case '<CHAR_LIT>' : binding = TypeBinding . BYTE ; break ; case '<CHAR_LIT>' : binding = TypeBinding . FLOAT ; break ; case '<CHAR_LIT>' : binding = TypeBinding . LONG ; break ; case '<CHAR_LIT>' : binding = TypeBinding . SHORT ; break ; } break ; default : int dimensions = <NUM_LIT:0> ; int start = <NUM_LIT:0> ; while ( type [ start ] == '<CHAR_LIT:[>' ) { start ++ ; dimensions ++ ; } binding = this . environment . getType ( CharOperation . splitOn ( '<CHAR_LIT:/>' , type , start + <NUM_LIT:1> , length - <NUM_LIT:1> ) ) ; if ( dimensions != <NUM_LIT:0> ) { binding = this . environment . createArrayType ( binding , dimensions ) ; } } return binding ; } 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 . util . ClassFormatException ; import org . eclipse . jdt . core . util . IBootstrapMethodsAttribute ; import org . eclipse . jdt . core . util . IBootstrapMethodsEntry ; import org . eclipse . jdt . core . util . IConstantPool ; public class BootstrapMethodsAttribute extends ClassFileAttribute implements IBootstrapMethodsAttribute { private static final IBootstrapMethodsEntry [ ] NO_ENTRIES = new IBootstrapMethodsEntry [ <NUM_LIT:0> ] ; private IBootstrapMethodsEntry [ ] entries ; private int numberOfBootstrapMethods ; public BootstrapMethodsAttribute ( byte [ ] classFileBytes , IConstantPool constantPool , int offset ) throws ClassFormatException { super ( classFileBytes , constantPool , offset ) ; this . numberOfBootstrapMethods = u2At ( classFileBytes , <NUM_LIT:6> , offset ) ; final int length = this . numberOfBootstrapMethods ; if ( length != <NUM_LIT:0> ) { int readOffset = <NUM_LIT:8> ; this . entries = new IBootstrapMethodsEntry [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { this . entries [ i ] = new BootstrapMethodsEntry ( classFileBytes , constantPool , offset + readOffset ) ; readOffset += <NUM_LIT:8> ; } } else { this . entries = NO_ENTRIES ; } } public IBootstrapMethodsEntry [ ] getBootstrapMethods ( ) { return this . entries ; } public int getBootstrapMethodsLength ( ) { return this . numberOfBootstrapMethods ; } } </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 . 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 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 . 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 . 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 ; 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 = this . 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 . 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 . 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 . 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 ; case IConstantPoolConstant . CONSTANT_MethodHandle : constantPoolOffsets [ i ] = readOffset ; readOffset += IConstantPoolConstant . CONSTANT_MethodHandle_SIZE ; break ; case IConstantPoolConstant . CONSTANT_MethodType : constantPoolOffsets [ i ] = readOffset ; readOffset += IConstantPoolConstant . CONSTANT_MethodType_SIZE ; break ; case IConstantPoolConstant . CONSTANT_InvokeDynamic : constantPoolOffsets [ i ] = readOffset ; readOffset += IConstantPoolConstant . CONSTANT_InvokeDynamic_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 if ( equals ( attributeName , IAttributeNamesConstants . BOOTSTRAP_METHODS ) ) { this . attributes [ attributesIndex ++ ] = new BootstrapMethodsAttribute ( 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 . 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 = null ; int kind = getEntryKind ( index ) ; switch ( kind ) { case IConstantPoolConstant . CONSTANT_Class : constantPoolEntry = new ConstantPoolEntry ( ) ; constantPoolEntry . reset ( ) ; constantPoolEntry . setKind ( kind ) ; constantPoolEntry . setClassInfoNameIndex ( u2At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ) ; constantPoolEntry . setClassInfoName ( getUtf8ValueAt ( constantPoolEntry . getClassInfoNameIndex ( ) ) ) ; break ; case IConstantPoolConstant . CONSTANT_Double : constantPoolEntry = new ConstantPoolEntry ( ) ; constantPoolEntry . reset ( ) ; constantPoolEntry . setKind ( kind ) ; constantPoolEntry . setDoubleValue ( doubleAt ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ) ; break ; case IConstantPoolConstant . CONSTANT_Fieldref : constantPoolEntry = new ConstantPoolEntry ( ) ; constantPoolEntry . reset ( ) ; constantPoolEntry . setKind ( kind ) ; constantPoolEntry . reset ( ) ; constantPoolEntry . setKind ( kind ) ; 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 = new ConstantPoolEntry ( ) ; constantPoolEntry . reset ( ) ; constantPoolEntry . setKind ( kind ) ; constantPoolEntry . reset ( ) ; constantPoolEntry . setKind ( kind ) ; 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 = new ConstantPoolEntry ( ) ; constantPoolEntry . reset ( ) ; constantPoolEntry . setKind ( kind ) ; constantPoolEntry . reset ( ) ; constantPoolEntry . setKind ( kind ) ; constantPoolEntry . setFloatValue ( floatAt ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ) ; break ; case IConstantPoolConstant . CONSTANT_Integer : constantPoolEntry = new ConstantPoolEntry ( ) ; constantPoolEntry . reset ( ) ; constantPoolEntry . setKind ( kind ) ; constantPoolEntry . setIntegerValue ( i4At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ) ; break ; case IConstantPoolConstant . CONSTANT_Long : constantPoolEntry = new ConstantPoolEntry ( ) ; constantPoolEntry . reset ( ) ; constantPoolEntry . setKind ( kind ) ; constantPoolEntry . setLongValue ( i8At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ) ; break ; case IConstantPoolConstant . CONSTANT_NameAndType : constantPoolEntry = new ConstantPoolEntry ( ) ; constantPoolEntry . reset ( ) ; constantPoolEntry . setKind ( kind ) ; 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 = new ConstantPoolEntry ( ) ; constantPoolEntry . reset ( ) ; constantPoolEntry . setKind ( kind ) ; constantPoolEntry . setStringIndex ( u2At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ) ; constantPoolEntry . setStringValue ( getUtf8ValueAt ( constantPoolEntry . getStringIndex ( ) ) ) ; break ; case IConstantPoolConstant . CONSTANT_Utf8 : constantPoolEntry = new ConstantPoolEntry ( ) ; constantPoolEntry . reset ( ) ; constantPoolEntry . setKind ( kind ) ; constantPoolEntry . setUtf8Length ( u2At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ) ; constantPoolEntry . setUtf8Value ( getUtf8ValueAt ( index ) ) ; break ; case IConstantPoolConstant . CONSTANT_MethodHandle : ConstantPoolEntry2 constantPoolEntry2 = new ConstantPoolEntry2 ( ) ; constantPoolEntry2 . reset ( ) ; constantPoolEntry2 . setKind ( kind ) ; constantPoolEntry2 . setReferenceKind ( u1At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ) ; constantPoolEntry2 . setReferenceIndex ( u2At ( this . classFileBytes , <NUM_LIT:2> , this . constantPoolOffset [ index ] ) ) ; constantPoolEntry = constantPoolEntry2 ; break ; case IConstantPoolConstant . CONSTANT_MethodType : constantPoolEntry2 = new ConstantPoolEntry2 ( ) ; constantPoolEntry2 . reset ( ) ; constantPoolEntry2 . setKind ( kind ) ; methodDescriptorIndex = u2At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ; constantPoolEntry2 . setDescriptorIndex ( methodDescriptorIndex ) ; constantPoolEntry2 . setMethodDescriptor ( getUtf8ValueAt ( methodDescriptorIndex ) ) ; constantPoolEntry = constantPoolEntry2 ; break ; case IConstantPoolConstant . CONSTANT_InvokeDynamic : constantPoolEntry2 = new ConstantPoolEntry2 ( ) ; constantPoolEntry2 . reset ( ) ; constantPoolEntry2 . setKind ( kind ) ; constantPoolEntry2 . setBootstrapMethodAttributeIndex ( u2At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ index ] ) ) ; int nameAndTypeIndex = u2At ( this . classFileBytes , <NUM_LIT:3> , this . constantPoolOffset [ index ] ) ; constantPoolEntry2 . setNameAndTypeIndex ( nameAndTypeIndex ) ; methodNameIndex = u2At ( this . classFileBytes , <NUM_LIT:1> , this . constantPoolOffset [ nameAndTypeIndex ] ) ; methodDescriptorIndex = u2At ( this . classFileBytes , <NUM_LIT:3> , this . constantPoolOffset [ nameAndTypeIndex ] ) ; constantPoolEntry2 . setMethodName ( getUtf8ValueAt ( methodNameIndex ) ) ; constantPoolEntry2 . setMethodDescriptor ( getUtf8ValueAt ( methodDescriptorIndex ) ) ; constantPoolEntry = constantPoolEntry2 ; break ; } 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 ; 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 . 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 . 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 . parser . TerminalTokens ; 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 ; public static final String INVALID_BINARY = "<STR_LIT>" ; public static final String BINARY_LITERAL_NOT_BELOW_17 = "<STR_LIT>" ; public static final String ILLEGAL_HEXA_LITERAL = "<STR_LIT>" ; public static final String INVALID_UNDERSCORE = "<STR_LIT>" ; public static final String UNDERSCORES_IN_LITERALS_NOT_BELOW_17 = "<STR_LIT>" ; 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 taskTagsLength = taskTags . length ; int length = taskTagsLength ; if ( taskPriorities != null ) { int taskPrioritiesLength = taskPriorities . length ; if ( taskPrioritiesLength != taskTagsLength ) { if ( taskPrioritiesLength > taskTagsLength ) { System . arraycopy ( taskPriorities , <NUM_LIT:0> , ( taskPriorities = new char [ taskTagsLength ] [ ] ) , <NUM_LIT:0> , taskTagsLength ) ; } else { System . arraycopy ( taskTags , <NUM_LIT:0> , ( taskTags = new char [ taskPrioritiesLength ] [ ] ) , <NUM_LIT:0> , taskPrioritiesLength ) ; length = taskPrioritiesLength ; } } int [ ] initialIndexes = new int [ length ] ; for ( int i = <NUM_LIT:0> ; i < length ; i ++ ) { initialIndexes [ i ] = i ; } Util . reverseQuickSort ( taskTags , <NUM_LIT:0> , 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> , 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 ( this . complianceLevel , tag [ <NUM_LIT:0> ] ) ) { if ( ScannerHelper . isJavaIdentifierPart ( this . complianceLevel , 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 ( this . complianceLevel , src [ i + tagLength - <NUM_LIT:1> ] ) ) { if ( ScannerHelper . isJavaIdentifierPart ( this . complianceLevel , 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 ( ) { if ( this . withoutUnicodePtr != <NUM_LIT:0> ) { char [ ] result = new char [ this . withoutUnicodePtr ] ; System . arraycopy ( this . withoutUnicodeBuffer , <NUM_LIT:1> , result , <NUM_LIT:0> , this . withoutUnicodePtr ) ; return result ; } 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 ( ) ; } char [ ] result = new char [ length ] ; System . arraycopy ( this . source , this . startPosition , result , <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> ; } } private final void consumeDigits ( int radix ) throws InvalidInputException { consumeDigits ( radix , false ) ; } private final void consumeDigits ( int radix , boolean expectingDigitFirst ) throws InvalidInputException { final int USING_UNDERSCORE = <NUM_LIT:1> ; final int INVALID_POSITION = <NUM_LIT:2> ; switch ( consumeDigits0 ( radix , USING_UNDERSCORE , INVALID_POSITION , expectingDigitFirst ) ) { case USING_UNDERSCORE : if ( this . sourceLevel < ClassFileConstants . JDK1_7 ) { throw new InvalidInputException ( UNDERSCORES_IN_LITERALS_NOT_BELOW_17 ) ; } break ; case INVALID_POSITION : if ( this . sourceLevel < ClassFileConstants . JDK1_7 ) { throw new InvalidInputException ( UNDERSCORES_IN_LITERALS_NOT_BELOW_17 ) ; } throw new InvalidInputException ( INVALID_UNDERSCORE ) ; } } private final int consumeDigits0 ( int radix , int usingUnderscore , int invalidPosition , boolean expectingDigitFirst ) throws InvalidInputException { int kind = <NUM_LIT:0> ; if ( getNextChar ( '<CHAR_LIT:_>' ) ) { if ( expectingDigitFirst ) { return invalidPosition ; } kind = usingUnderscore ; while ( getNextChar ( '<CHAR_LIT:_>' ) ) { } } if ( getNextCharAsDigit ( radix ) ) { while ( getNextCharAsDigit ( radix ) ) { } int kind2 = consumeDigits0 ( radix , usingUnderscore , invalidPosition , false ) ; if ( kind2 == <NUM_LIT:0> ) { return kind ; } return kind2 ; } if ( kind == usingUnderscore ) return invalidPosition ; return kind ; } 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 ( this . complianceLevel , 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 ( this . complianceLevel , 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 ( this . complianceLevel , 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 ( this . complianceLevel , 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 ( this . complianceLevel , 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 = ScannerHelper . isJavaIdentifierStart ( this . complianceLevel , 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 ( this . complianceLevel , 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 = ScannerHelper . isJavaIdentifierStart ( this . complianceLevel , 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 . getHexadecimalValue ( this . source [ this . currentPosition ++ ] ) ) > <NUM_LIT:15> || c1 < <NUM_LIT:0> || ( c2 = ScannerHelper . getHexadecimalValue ( this . source [ this . currentPosition ++ ] ) ) > <NUM_LIT:15> || c2 < <NUM_LIT:0> || ( c3 = ScannerHelper . getHexadecimalValue ( this . source [ this . currentPosition ++ ] ) ) > <NUM_LIT:15> || c3 < <NUM_LIT:0> || ( c4 = ScannerHelper . getHexadecimalValue ( 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 ( this . complianceLevel , c , low ) ; } else if ( c >= LOW_SURROGATE_MIN_VALUE && c <= LOW_SURROGATE_MAX_VALUE ) { break NextToken ; } else { isJavaIdStart = ScannerHelper . isJavaIdentifierStart ( this . complianceLevel , 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> ; } protected 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 . getHexadecimalValue ( 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 . getHexadecimalValue ( 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 . getHexadecimalValue ( 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 ; consumeDigits ( <NUM_LIT:16> , true ) ; 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:.>' ) ) { boolean hasNoDigitsBeforeDot = end == start ; start = this . currentPosition ; consumeDigits ( <NUM_LIT:16> , true ) ; end = this . currentPosition ; if ( hasNoDigitsBeforeDot && end == start ) { if ( this . sourceLevel < ClassFileConstants . JDK1_5 ) { throw new InvalidInputException ( ILLEGAL_HEXA_LITERAL ) ; } 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 ) ) { if ( this . sourceLevel < ClassFileConstants . JDK1_5 ) { throw new InvalidInputException ( ILLEGAL_HEXA_LITERAL ) ; } if ( this . currentCharacter == '<CHAR_LIT:_>' ) { consumeDigits ( <NUM_LIT:10> ) ; throw new InvalidInputException ( INVALID_UNDERSCORE ) ; } throw new InvalidInputException ( INVALID_HEXA ) ; } consumeDigits ( <NUM_LIT:10> ) ; if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { if ( this . sourceLevel < ClassFileConstants . JDK1_5 ) { throw new InvalidInputException ( ILLEGAL_HEXA_LITERAL ) ; } return TokenNameFloatingPointLiteral ; } if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { if ( this . sourceLevel < ClassFileConstants . JDK1_5 ) { throw new InvalidInputException ( ILLEGAL_HEXA_LITERAL ) ; } return TokenNameDoubleLiteral ; } if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { if ( this . sourceLevel < ClassFileConstants . JDK1_5 ) { throw new InvalidInputException ( ILLEGAL_HEXA_LITERAL ) ; } throw new InvalidInputException ( INVALID_HEXA ) ; } if ( this . sourceLevel < ClassFileConstants . JDK1_5 ) { throw new InvalidInputException ( ILLEGAL_HEXA_LITERAL ) ; } return TokenNameDoubleLiteral ; } else { if ( this . sourceLevel < ClassFileConstants . JDK1_5 ) { throw new InvalidInputException ( ILLEGAL_HEXA_LITERAL ) ; } throw new InvalidInputException ( INVALID_HEXA ) ; } } else 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 ) ) { if ( this . sourceLevel < ClassFileConstants . JDK1_5 ) { throw new InvalidInputException ( ILLEGAL_HEXA_LITERAL ) ; } if ( this . currentCharacter == '<CHAR_LIT:_>' ) { consumeDigits ( <NUM_LIT:10> ) ; throw new InvalidInputException ( INVALID_UNDERSCORE ) ; } throw new InvalidInputException ( INVALID_FLOAT ) ; } consumeDigits ( <NUM_LIT:10> ) ; if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { if ( this . sourceLevel < ClassFileConstants . JDK1_5 ) { throw new InvalidInputException ( ILLEGAL_HEXA_LITERAL ) ; } return TokenNameFloatingPointLiteral ; } if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { if ( this . sourceLevel < ClassFileConstants . JDK1_5 ) { throw new InvalidInputException ( ILLEGAL_HEXA_LITERAL ) ; } return TokenNameDoubleLiteral ; } if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { if ( this . sourceLevel < ClassFileConstants . JDK1_5 ) { throw new InvalidInputException ( ILLEGAL_HEXA_LITERAL ) ; } throw new InvalidInputException ( INVALID_HEXA ) ; } if ( this . sourceLevel < ClassFileConstants . JDK1_5 ) { throw new InvalidInputException ( ILLEGAL_HEXA_LITERAL ) ; } return TokenNameDoubleLiteral ; } else { if ( end == start ) throw new InvalidInputException ( INVALID_HEXA ) ; return TokenNameIntegerLiteral ; } } else if ( getNextChar ( '<CHAR_LIT:b>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { int start = this . currentPosition ; consumeDigits ( <NUM_LIT:2> , true ) ; int end = this . currentPosition ; if ( end == start ) { if ( this . sourceLevel < ClassFileConstants . JDK1_7 ) { throw new InvalidInputException ( BINARY_LITERAL_NOT_BELOW_17 ) ; } throw new InvalidInputException ( INVALID_BINARY ) ; } if ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) { if ( this . sourceLevel < ClassFileConstants . JDK1_7 ) { throw new InvalidInputException ( BINARY_LITERAL_NOT_BELOW_17 ) ; } return TokenNameLongLiteral ; } if ( this . sourceLevel < ClassFileConstants . JDK1_7 ) { throw new InvalidInputException ( BINARY_LITERAL_NOT_BELOW_17 ) ; } return TokenNameIntegerLiteral ; } if ( getNextCharAsDigit ( ) ) { consumeDigits ( <NUM_LIT:10> ) ; 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 ; consumeDigits ( <NUM_LIT:10> ) ; } 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 ) ) { if ( this . currentCharacter == '<CHAR_LIT:_>' ) { consumeDigits ( <NUM_LIT:10> ) ; throw new InvalidInputException ( INVALID_UNDERSCORE ) ; } throw new InvalidInputException ( INVALID_FLOAT ) ; } consumeDigits ( <NUM_LIT:10> ) ; } 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 { } } consumeDigits ( <NUM_LIT:10> ) ; if ( ( ! dotPrefix ) && ( getNextChar ( '<CHAR_LIT>' , '<CHAR_LIT>' ) >= <NUM_LIT:0> ) ) return TokenNameLongLiteral ; if ( ( ! dotPrefix ) && ( getNextChar ( '<CHAR_LIT:.>' ) ) ) { consumeDigits ( <NUM_LIT:10> , true ) ; 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 ) ) { if ( this . currentCharacter == '<CHAR_LIT:_>' ) { consumeDigits ( <NUM_LIT:10> ) ; throw new InvalidInputException ( INVALID_UNDERSCORE ) ; } throw new InvalidInputException ( INVALID_FLOAT ) ; } consumeDigits ( <NUM_LIT:10> ) ; } 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 ; } public void unicodeStore ( char character ) { 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 ] = character ; } public static boolean isIdentifier ( int token ) { return token == TerminalTokens . TokenNameIdentifier ; } public static boolean isLiteral ( int token ) { switch ( token ) { case TerminalTokens . TokenNameIntegerLiteral : case TerminalTokens . TokenNameLongLiteral : case TerminalTokens . TokenNameFloatingPointLiteral : case TerminalTokens . TokenNameDoubleLiteral : case TerminalTokens . TokenNameStringLiteral : case TerminalTokens . TokenNameCharacterLiteral : return true ; default : return false ; } } public static boolean isKeyword ( int token ) { switch ( token ) { case TerminalTokens . TokenNameabstract : case TerminalTokens . TokenNameassert : case TerminalTokens . TokenNamebyte : case TerminalTokens . TokenNamebreak : case TerminalTokens . TokenNameboolean : case TerminalTokens . TokenNamecase : case TerminalTokens . TokenNamechar : case TerminalTokens . TokenNamecatch : case TerminalTokens . TokenNameclass : case TerminalTokens . TokenNamecontinue : case TerminalTokens . TokenNamedo : case TerminalTokens . TokenNamedouble : case TerminalTokens . TokenNamedefault : case TerminalTokens . TokenNameelse : case TerminalTokens . TokenNameextends : case TerminalTokens . TokenNamefor : case TerminalTokens . TokenNamefinal : case TerminalTokens . TokenNamefloat : case TerminalTokens . TokenNamefalse : case TerminalTokens . TokenNamefinally : case TerminalTokens . TokenNameif : case TerminalTokens . TokenNameint : case TerminalTokens . TokenNameimport : case TerminalTokens . TokenNameinterface : case TerminalTokens . TokenNameimplements : case TerminalTokens . TokenNameinstanceof : case TerminalTokens . TokenNamelong : case TerminalTokens . TokenNamenew : case TerminalTokens . TokenNamenull : case TerminalTokens . TokenNamenative : case TerminalTokens . TokenNamepublic : case TerminalTokens . TokenNamepackage : case TerminalTokens . TokenNameprivate : case TerminalTokens . TokenNameprotected : case TerminalTokens . TokenNamereturn : case TerminalTokens . TokenNameshort : case TerminalTokens . TokenNamesuper : case TerminalTokens . TokenNamestatic : case TerminalTokens . TokenNameswitch : case TerminalTokens . TokenNamestrictfp : case TerminalTokens . TokenNamesynchronized : case TerminalTokens . TokenNametry : case TerminalTokens . TokenNamethis : case TerminalTokens . TokenNametrue : case TerminalTokens . TokenNamethrow : case TerminalTokens . TokenNamethrows : case TerminalTokens . TokenNametransient : case TerminalTokens . TokenNamevoid : case TerminalTokens . TokenNamevolatile : case TerminalTokens . TokenNamewhile : return true ; default : return false ; } } } </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 ( length > <NUM_LIT:0> ) { int parameterNamesLength = parameterNames . length ; if ( length < parameterNamesLength ) { System . arraycopy ( invisibleParameterAnnotations , <NUM_LIT:0> , ( invisibleParameterAnnotations = new IParameterAnnotation [ parameterNamesLength ] ) , <NUM_LIT:1> , length ) ; length = parameterNamesLength ; } } } if ( runtimeVisibleParameterAnnotationsAttribute != null ) { IRuntimeVisibleParameterAnnotationsAttribute attribute = ( IRuntimeVisibleParameterAnnotationsAttribute ) runtimeVisibleParameterAnnotationsAttribute ; visibleParameterAnnotations = attribute . getParameterAnnotations ( ) ; length = visibleParameterAnnotations . length ; if ( length > <NUM_LIT:0> ) { int parameterNamesLength = parameterNames . length ; if ( length < parameterNamesLength ) { System . arraycopy ( visibleParameterAnnotations , <NUM_LIT:0> , ( visibleParameterAnnotations = new IParameterAnnotation [ parameterNamesLength ] ) , <NUM_LIT:1> , length ) ; length = parameterNamesLength ; } } } 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 ( visibleParameterAnnotations != null ) { disassembleAsModifier ( visibleParameterAnnotations , stringBuffer , i , lineSeparator , tabNumber , mode ) ; } if ( invisibleParameterAnnotations != null ) { if ( stringBuffer . length ( ) != stringBufferSize ) { stringBuffer . append ( '<CHAR_LIT:U+0020>' ) ; stringBufferSize = stringBuffer . length ( ) ; } disassembleAsModifier ( invisibleParameterAnnotations , 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 ) ; IClassFileAttribute bootstrapMethods = Util . getAttribute ( classFileReader , IAttributeNamesConstants . BOOTSTRAP_METHODS ) ; 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 ( bootstrapMethods != null ) { remainingAttributesLength -- ; } if ( innerClassesAttribute != null || enclosingMethodAttribute != null || bootstrapMethods != null || remainingAttributesLength != <NUM_LIT:0> ) { if ( buffer . lastIndexOf ( lineSeparator ) != buffer . length ( ) - lineSeparator . length ( ) ) { 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 ( bootstrapMethods != null ) { disassemble ( ( IBootstrapMethodsAttribute ) bootstrapMethods , 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 ) && attribute != bootstrapMethods ) { 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 ; case IConstantPoolConstant . CONSTANT_MethodHandle : IConstantPoolEntry2 entry2 = ( IConstantPoolEntry2 ) constantPoolEntry ; buffer . append ( Messages . bind ( Messages . disassembler_constantpool_methodhandle , new String [ ] { Integer . toString ( i ) , getReferenceKind ( entry2 . getReferenceKind ( ) ) , Integer . toString ( entry2 . getReferenceIndex ( ) ) , } ) ) ; break ; case IConstantPoolConstant . CONSTANT_MethodType : entry2 = ( IConstantPoolEntry2 ) constantPoolEntry ; buffer . append ( Messages . bind ( Messages . disassembler_constantpool_methodtype , new String [ ] { Integer . toString ( i ) , Integer . toString ( entry2 . getDescriptorIndex ( ) ) , String . valueOf ( entry2 . getMethodDescriptor ( ) ) , } ) ) ; break ; case IConstantPoolConstant . CONSTANT_InvokeDynamic : entry2 = ( IConstantPoolEntry2 ) constantPoolEntry ; buffer . append ( Messages . bind ( Messages . disassembler_constantpool_invokedynamic , new String [ ] { Integer . toString ( i ) , Integer . toString ( entry2 . getBootstrapMethodAttributeIndex ( ) ) , Integer . toString ( entry2 . getNameAndTypeIndex ( ) ) , new String ( constantPoolEntry . getMethodName ( ) ) , new String ( constantPoolEntry . getMethodDescriptor ( ) ) } ) ) ; } } } private String getReferenceKind ( int referenceKind ) { String message = null ; switch ( referenceKind ) { case IConstantPoolConstant . METHOD_TYPE_REF_GetField : message = Messages . disassembler_method_type_ref_getfield ; break ; case IConstantPoolConstant . METHOD_TYPE_REF_GetStatic : message = Messages . disassembler_method_type_ref_getstatic ; break ; case IConstantPoolConstant . METHOD_TYPE_REF_PutField : message = Messages . disassembler_method_type_ref_putfield ; break ; case IConstantPoolConstant . METHOD_TYPE_REF_PutStatic : message = Messages . disassembler_method_type_ref_putstatic ; break ; case IConstantPoolConstant . METHOD_TYPE_REF_InvokeInterface : message = Messages . disassembler_method_type_ref_invokeinterface ; break ; case IConstantPoolConstant . METHOD_TYPE_REF_InvokeSpecial : message = Messages . disassembler_method_type_ref_invokespecial ; break ; case IConstantPoolConstant . METHOD_TYPE_REF_InvokeStatic : message = Messages . disassembler_method_type_ref_invokestatic ; break ; case IConstantPoolConstant . METHOD_TYPE_REF_InvokeVirtual : message = Messages . disassembler_method_type_ref_invokevirtual ; break ; default : message = Messages . disassembler_method_type_ref_newinvokespecial ; } return Messages . bind ( message , new String [ ] { Integer . toString ( referenceKind ) } ) ; } 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 ( IBootstrapMethodsAttribute bootstrapMethodsAttribute , StringBuffer buffer , String lineSeparator , int tabNumber ) { writeNewLine ( buffer , lineSeparator , tabNumber ) ; buffer . append ( Messages . disassembler_bootstrapmethodattributesheader ) ; writeNewLine ( buffer , lineSeparator , tabNumber + <NUM_LIT:1> ) ; IBootstrapMethodsEntry [ ] entries = bootstrapMethodsAttribute . getBootstrapMethods ( ) ; int length = entries . length ; 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> ) ; } IBootstrapMethodsEntry entry = entries [ i ] ; buffer . append ( Messages . bind ( Messages . disassembler_bootstrapmethodentry , new String [ ] { Integer . toString ( i ) , Integer . toString ( entry . getBootstrapMethodReference ( ) ) , getArguments ( entry . getBootstrapArguments ( ) ) } ) ) ; } } private String getArguments ( int [ ] arguments ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( '<CHAR_LIT>' ) ; for ( int i = <NUM_LIT:0> , max = arguments . length ; i < max ; i ++ ) { if ( i != <NUM_LIT:0> ) { buffer . append ( Messages . disassembler_comma ) ; } buffer . append ( Messages . bind ( Messages . disassembler_bootstrapmethodentry_argument , new String [ ] { Integer . toString ( arguments [ i ] ) , } ) ) ; } buffer . append ( '<CHAR_LIT:}>' ) ; return String . valueOf ( buffer ) ; } 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 ( IParameterAnnotation [ ] parameterAnnotations , StringBuffer buffer , int index , String lineSeparator , int tabNumber , int mode ) { 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 ) { if ( parameterAnnotation == null ) return ; 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 . 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 . 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_InvokeDynamic ) { throw new ClassFormatException ( ClassFormatException . INVALID_CONSTANT_POOL_ENTRY ) ; } visitor . _invokedynamic ( pc - this . codeOffset , index , constantPoolEntry ) ; 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 . 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 . IConstantPoolEntry2 ; 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 _invokedynamic ( int pc , int index , IConstantPoolEntry invokeDynamicEntry ) { dumpPcNumber ( pc ) ; IConstantPoolEntry2 entry = ( IConstantPoolEntry2 ) invokeDynamicEntry ; this . buffer . append ( Messages . bind ( Messages . classformat_invokedynamic , new String [ ] { OpcodeStringValues . BYTECODE_NAMES [ IOpcodeMnemonics . INVOKEDYNAMIC ] , Integer . toString ( index ) , Integer . toString ( entry . getBootstrapMethodAttributeIndex ( ) ) , Util . toString ( null , entry . getMethodName ( ) , entry . getMethodDescriptor ( ) , 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 . 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 . IConstantPoolEntry2 ; public class ConstantPoolEntry2 extends ConstantPoolEntry implements IConstantPoolEntry2 { private int descriptorIndex ; private int referenceKind ; private int referenceIndex ; private int bootstrapMethodAttributeIndex ; public int getDescriptorIndex ( ) { return this . descriptorIndex ; } public int getReferenceKind ( ) { return this . referenceKind ; } public int getReferenceIndex ( ) { return this . referenceIndex ; } public int getBootstrapMethodAttributeIndex ( ) { return this . bootstrapMethodAttributeIndex ; } public void setDescriptorIndex ( int descriptorIndex ) { this . descriptorIndex = descriptorIndex ; } public void setReferenceKind ( int referenceKind ) { this . referenceKind = referenceKind ; } public void setReferenceIndex ( int referenceIndex ) { this . referenceIndex = referenceIndex ; } public void setBootstrapMethodAttributeIndex ( int bootstrapMethodAttributeIndex ) { this . bootstrapMethodAttributeIndex = bootstrapMethodAttributeIndex ; } public void reset ( ) { super . reset ( ) ; this . descriptorIndex = <NUM_LIT:0> ; this . referenceKind = <NUM_LIT:0> ; this . referenceIndex = <NUM_LIT:0> ; this . bootstrapMethodAttributeIndex = <NUM_LIT:0> ; } } </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 . * ; 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 . internal . core . JavaElement ; public class MementoTokenizer { public static final String COUNT = Character . toString ( JavaElement . JEM_COUNT ) ; public static final String JAVAPROJECT = Character . toString ( JavaElement . JEM_JAVAPROJECT ) ; public static final String PACKAGEFRAGMENTROOT = Character . toString ( JavaElement . JEM_PACKAGEFRAGMENTROOT ) ; public static final String PACKAGEFRAGMENT = Character . toString ( JavaElement . JEM_PACKAGEFRAGMENT ) ; public static final String FIELD = Character . toString ( JavaElement . JEM_FIELD ) ; public static final String METHOD = Character . toString ( JavaElement . JEM_METHOD ) ; public static final String INITIALIZER = Character . toString ( JavaElement . JEM_INITIALIZER ) ; public static final String COMPILATIONUNIT = Character . toString ( JavaElement . JEM_COMPILATIONUNIT ) ; public static final String CLASSFILE = Character . toString ( JavaElement . JEM_CLASSFILE ) ; public static final String TYPE = Character . toString ( JavaElement . JEM_TYPE ) ; public static final String PACKAGEDECLARATION = Character . toString ( JavaElement . JEM_PACKAGEDECLARATION ) ; public static final String IMPORTDECLARATION = Character . toString ( JavaElement . JEM_IMPORTDECLARATION ) ; public static final String LOCALVARIABLE = Character . toString ( JavaElement . JEM_LOCALVARIABLE ) ; public static final String TYPE_PARAMETER = Character . toString ( JavaElement . JEM_TYPE_PARAMETER ) ; public 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 . 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 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 ; 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 ; 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 . 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 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 ; 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 . 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 ; 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 . Enumeration ; public interface ICacheEnumeration extends Enumeration { public Object getValue ( ) ; } </s>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.