<s> package org . eclipse . jdt . internal . core ; import java . io . IOException ; import java . util . HashMap ; import java . util . Map ; import java . util . zip . ZipEntry ; import java . util . zip . ZipFile ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IFolder ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Path ; import org . eclipse . jdt . core . * ; import org . eclipse . jdt . core . compiler . IProblem ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFileReader ; import org . eclipse . jdt . internal . compiler . classfmt . ClassFormatException ; import org . eclipse . jdt . internal . compiler . env . IBinaryType ; import org . eclipse . jdt . internal . compiler . env . IDependent ; import org . eclipse . jdt . internal . compiler . util . SuffixConstants ; import org . eclipse . jdt . internal . core . util . MementoTokenizer ; import org . eclipse . jdt . internal . core . util . Util ; public class ClassFile extends Openable implements IClassFile , SuffixConstants { protected String name ; protected BinaryType binaryType = null ; protected ClassFile ( PackageFragment parent , String nameWithoutExtension ) { super ( parent ) ; this . name = nameWithoutExtension ; } public ICompilationUnit becomeWorkingCopy ( IProblemRequestor problemRequestor , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; CompilationUnit workingCopy = new ClassFileWorkingCopy ( this , owner == null ? DefaultWorkingCopyOwner . PRIMARY : owner ) ; JavaModelManager . PerWorkingCopyInfo perWorkingCopyInfo = manager . getPerWorkingCopyInfo ( workingCopy , false , true , null ) ; if ( perWorkingCopyInfo == null ) { close ( ) ; BecomeWorkingCopyOperation operation = new BecomeWorkingCopyOperation ( workingCopy , problemRequestor ) ; operation . runOperation ( monitor ) ; return workingCopy ; } return perWorkingCopyInfo . workingCopy ; } protected boolean buildStructure ( OpenableElementInfo info , IProgressMonitor pm , Map newElements , IResource underlyingResource ) throws JavaModelException { IBinaryType typeInfo = getBinaryTypeInfo ( ( IFile ) underlyingResource ) ; if ( typeInfo == null ) { info . setChildren ( new IJavaElement [ ] { } ) ; return false ; } IType type = getType ( ) ; info . setChildren ( new IJavaElement [ ] { type } ) ; newElements . put ( type , typeInfo ) ; ( ( ClassFileInfo ) info ) . readBinaryChildren ( this , ( HashMap ) newElements , typeInfo ) ; return true ; } public void codeComplete ( int offset , ICompletionRequestor requestor ) throws JavaModelException { codeComplete ( offset , requestor , DefaultWorkingCopyOwner . PRIMARY ) ; } public void codeComplete ( int offset , ICompletionRequestor requestor , WorkingCopyOwner owner ) throws JavaModelException { if ( requestor == null ) { throw new IllegalArgumentException ( "" ) ; } codeComplete ( offset , new org . eclipse . jdt . internal . codeassist . CompletionRequestorWrapper ( requestor ) , owner ) ; } public void codeComplete ( int offset , CompletionRequestor requestor ) throws JavaModelException { codeComplete ( offset , requestor , DefaultWorkingCopyOwner . PRIMARY ) ; } public void codeComplete ( int offset , CompletionRequestor requestor , IProgressMonitor monitor ) throws JavaModelException { codeComplete ( offset , requestor , DefaultWorkingCopyOwner . PRIMARY , monitor ) ; } public void codeComplete ( int offset , CompletionRequestor requestor , WorkingCopyOwner owner ) throws JavaModelException { codeComplete ( offset , requestor , owner , null ) ; } public void codeComplete ( int offset , CompletionRequestor requestor , WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException { String source = getSource ( ) ; if ( source != null ) { BinaryType type = ( BinaryType ) getType ( ) ; BasicCompilationUnit cu = new BasicCompilationUnit ( getSource ( ) . toCharArray ( ) , null , type . sourceFileName ( ( IBinaryType ) type . getElementInfo ( ) ) , getJavaProject ( ) ) ; codeComplete ( cu , cu , offset , requestor , owner , null , monitor ) ; } } public IJavaElement [ ] codeSelect ( int offset , int length ) throws JavaModelException { return codeSelect ( offset , length , DefaultWorkingCopyOwner . PRIMARY ) ; } public IJavaElement [ ] codeSelect ( int offset , int length , WorkingCopyOwner owner ) throws JavaModelException { IBuffer buffer = getBuffer ( ) ; char [ ] contents ; if ( buffer != null && ( contents = buffer . getCharacters ( ) ) != null ) { BinaryType type = ( BinaryType ) getType ( ) ; BasicCompilationUnit cu = new BasicCompilationUnit ( contents , null , type . sourceFileName ( ( IBinaryType ) type . getElementInfo ( ) ) ) ; return super . codeSelect ( cu , offset , length , owner ) ; } else { return new IJavaElement [ ] { } ; } } protected Object createElementInfo ( ) { return new ClassFileInfo ( ) ; } public boolean equals ( Object o ) { if ( ! ( o instanceof ClassFile ) ) return false ; ClassFile other = ( ClassFile ) o ; return this . name . equals ( other . name ) && this . parent . equals ( other . parent ) ; } public boolean existsUsingJarTypeCache ( ) { if ( getPackageFragmentRoot ( ) . isArchive ( ) ) { JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; IType type = getType ( ) ; Object info = manager . getInfo ( type ) ; if ( info == JavaModelCache . NON_EXISTING_JAR_TYPE_INFO ) return false ; else if ( info != null ) return true ; JavaElementInfo parentInfo = ( JavaElementInfo ) manager . getInfo ( getParent ( ) ) ; if ( parentInfo != null ) { IJavaElement [ ] children = parentInfo . getChildren ( ) ; for ( int i = 0 , length = children . length ; i < length ; i ++ ) { if ( this . name . equals ( ( ( ClassFile ) children [ i ] ) . name ) ) return true ; } return false ; } try { info = getJarBinaryTypeInfo ( ( PackageFragment ) getParent ( ) , true ) ; } catch ( CoreException e ) { } catch ( IOException e ) { } catch ( ClassFormatException e ) { } manager . putJarTypeInfo ( type , info == null ? JavaModelCache . NON_EXISTING_JAR_TYPE_INFO : info ) ; return info != null ; } else return exists ( ) ; } protected IJavaElement findElement ( IJavaElement elt , int position , SourceMapper mapper ) { SourceRange range = mapper . getSourceRange ( elt ) ; if ( range == null || position < range . getOffset ( ) || range . getOffset ( ) + range . getLength ( ) - 1 < position ) { return null ; } if ( elt instanceof IParent ) { try { IJavaElement [ ] children = ( ( IParent ) elt ) . getChildren ( ) ; for ( int i = 0 ; i < children . length ; i ++ ) { IJavaElement match = findElement ( children [ i ] , position , mapper ) ; if ( match != null ) { return match ; } } } catch ( JavaModelException npe ) { } } return elt ; } public IType findPrimaryType ( ) { IType primaryType = getType ( ) ; if ( primaryType . exists ( ) ) { return primaryType ; } return null ; } public String getAttachedJavadoc ( IProgressMonitor monitor ) throws JavaModelException { return getType ( ) . getAttachedJavadoc ( monitor ) ; } public IBinaryType getBinaryTypeInfo ( IFile file ) throws JavaModelException { return getBinaryTypeInfo ( file , true ) ; } public IBinaryType getBinaryTypeInfo ( IFile file , boolean fullyInitialize ) throws JavaModelException { JavaElement pkg = ( JavaElement ) getParent ( ) ; if ( pkg instanceof JarPackageFragment ) { try { IBinaryType info = getJarBinaryTypeInfo ( ( PackageFragment ) pkg , fullyInitialize ) ; if ( info == null ) { throw newNotPresentException ( ) ; } return info ; } catch ( ClassFormatException cfe ) { if ( JavaCore . getPlugin ( ) . isDebugging ( ) ) { cfe . printStackTrace ( System . err ) ; } return null ; } catch ( IOException ioe ) { throw new JavaModelException ( ioe , IJavaModelStatusConstants . IO_EXCEPTION ) ; } catch ( CoreException e ) { if ( e instanceof JavaModelException ) { throw ( JavaModelException ) e ; } else { throw new JavaModelException ( e ) ; } } } else { byte [ ] contents = Util . getResourceContentsAsByteArray ( file ) ; try { return new ClassFileReader ( contents , file . getFullPath ( ) . toString ( ) . toCharArray ( ) , fullyInitialize ) ; } catch ( ClassFormatException cfe ) { return null ; } } } public byte [ ] getBytes ( ) throws JavaModelException { JavaElement pkg = ( JavaElement ) getParent ( ) ; if ( pkg instanceof JarPackageFragment ) { JarPackageFragmentRoot root = ( JarPackageFragmentRoot ) pkg . getParent ( ) ; ZipFile zip = null ; try { zip = root . getJar ( ) ; String entryName = Util . concatWith ( ( ( PackageFragment ) pkg ) . names , getElementName ( ) , '/' ) ; ZipEntry ze = zip . getEntry ( entryName ) ; if ( ze != null ) { return org . eclipse . jdt . internal . compiler . util . Util . getZipEntryByteContent ( ze , zip ) ; } throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . ELEMENT_DOES_NOT_EXIST , this ) ) ; } catch ( IOException ioe ) { throw new JavaModelException ( ioe , IJavaModelStatusConstants . IO_EXCEPTION ) ; } catch ( CoreException e ) { if ( e instanceof JavaModelException ) { throw ( JavaModelException ) e ; } else { throw new JavaModelException ( e ) ; } } finally { JavaModelManager . getJavaModelManager ( ) . closeZipFile ( zip ) ; } } else { IFile file = ( IFile ) resource ( ) ; return Util . getResourceContentsAsByteArray ( file ) ; } } private IBinaryType getJarBinaryTypeInfo ( PackageFragment pkg , boolean fullyInitialize ) throws CoreException , IOException , ClassFormatException { JarPackageFragmentRoot root = ( JarPackageFragmentRoot ) pkg . getParent ( ) ; ZipFile zip = null ; try { zip = root . getJar ( ) ; String entryName = Util . concatWith ( pkg . names , getElementName ( ) , '/' ) ; ZipEntry ze = zip . getEntry ( entryName ) ; if ( ze != null ) { byte contents [ ] = org . eclipse . jdt . internal . compiler . util . Util . getZipEntryByteContent ( ze , zip ) ; String fileName = root . getHandleIdentifier ( ) + IDependent . JAR_FILE_ENTRY_SEPARATOR + entryName ; return new ClassFileReader ( contents , fileName . toCharArray ( ) , fullyInitialize ) ; } } finally { JavaModelManager . getJavaModelManager ( ) . closeZipFile ( zip ) ; } return null ; } public IBuffer getBuffer ( ) throws JavaModelException { IStatus status = validateClassFile ( ) ; if ( status . isOK ( ) ) { return super . getBuffer ( ) ; } else { Object info = ( ( ClassFile ) getClassFile ( ) ) . getBinaryTypeInfo ( ( IFile ) resource ( ) ) ; IBuffer buffer = openBuffer ( null , info ) ; if ( buffer != null && ! ( buffer instanceof NullBuffer ) ) return buffer ; switch ( status . getCode ( ) ) { case IJavaModelStatusConstants . ELEMENT_NOT_ON_CLASSPATH : case IJavaModelStatusConstants . INVALID_ELEMENT_TYPES : return null ; default : throw new JavaModelException ( ( IJavaModelStatus ) status ) ; } } } public IClassFile getClassFile ( ) { return this ; } public ITypeRoot getTypeRoot ( ) { return this ; } public IResource getCorrespondingResource ( ) throws JavaModelException { IPackageFragmentRoot root = ( IPackageFragmentRoot ) getParent ( ) . getParent ( ) ; if ( root . isArchive ( ) ) { return null ; } else { return getUnderlyingResource ( ) ; } } public IJavaElement getElementAt ( int position ) throws JavaModelException { IJavaElement parentElement = getParent ( ) ; while ( parentElement . getElementType ( ) != IJavaElement . PACKAGE_FRAGMENT_ROOT ) { parentElement = parentElement . getParent ( ) ; } PackageFragmentRoot root = ( PackageFragmentRoot ) parentElement ; SourceMapper mapper = root . getSourceMapper ( ) ; if ( mapper == null ) { return null ; } else { getBuffer ( ) ; IType type = getType ( ) ; return findElement ( type , position , mapper ) ; } } public IJavaElement getElementAtConsideringSibling ( int position ) throws JavaModelException { IPackageFragment fragment = ( IPackageFragment ) getParent ( ) ; PackageFragmentRoot root = ( PackageFragmentRoot ) fragment . getAncestor ( IJavaElement . PACKAGE_FRAGMENT_ROOT ) ; SourceMapper mapper = root . getSourceMapper ( ) ; if ( mapper == null ) { return null ; } else { int index = this . name . indexOf ( '$' ) ; int prefixLength = index < 0 ? this . name . length ( ) : index ; IType type = null ; int start = - 1 ; int end = Integer . MAX_VALUE ; IJavaElement [ ] children = fragment . getChildren ( ) ; for ( int i = 0 ; i < children . length ; i ++ ) { String childName = children [ i ] . getElementName ( ) ; int childIndex = childName . indexOf ( '$' ) ; int childPrefixLength = childIndex < 0 ? childName . indexOf ( '.' ) : childIndex ; if ( prefixLength == childPrefixLength && this . name . regionMatches ( 0 , childName , 0 , prefixLength ) ) { IClassFile classFile = ( IClassFile ) children [ i ] ; classFile . getBuffer ( ) ; SourceRange range = mapper . getSourceRange ( classFile . getType ( ) ) ; if ( range == SourceMapper . UNKNOWN_RANGE ) continue ; int newStart = range . getOffset ( ) ; int newEnd = newStart + range . getLength ( ) - 1 ; if ( newStart > start && newEnd < end && newStart <= position && newEnd >= position ) { type = classFile . getType ( ) ; start = newStart ; end = newEnd ; } } } if ( type != null ) { return findElement ( type , position , mapper ) ; } return null ; } } public String getElementName ( ) { return this . name + SuffixConstants . SUFFIX_STRING_class ; } public int getElementType ( ) { return CLASS_FILE ; } public IJavaElement getHandleFromMemento ( String token , MementoTokenizer memento , WorkingCopyOwner owner ) { switch ( token . charAt ( 0 ) ) { case JEM_TYPE : if ( ! memento . hasMoreTokens ( ) ) return this ; String typeName = memento . nextToken ( ) ; JavaElement type = new BinaryType ( this , typeName ) ; return type . getHandleFromMemento ( memento , owner ) ; } return null ; } protected char getHandleMementoDelimiter ( ) { return JavaElement . JEM_CLASSFILE ; } public IPath getPath ( ) { PackageFragmentRoot root = getPackageFragmentRoot ( ) ; if ( root . isArchive ( ) ) { return root . getPath ( ) ; } else { return getParent ( ) . getPath ( ) . append ( getElementName ( ) ) ; } } public IResource resource ( PackageFragmentRoot root ) { return ( ( IContainer ) ( ( Openable ) this . parent ) . resource ( root ) ) . getFile ( new Path ( getElementName ( ) ) ) ; } public String getSource ( ) throws JavaModelException { IBuffer buffer = getBuffer ( ) ; if ( buffer == null ) { return null ; } return buffer . getContents ( ) ; } public ISourceRange getSourceRange ( ) throws JavaModelException { IBuffer buffer = getBuffer ( ) ; if ( buffer != null ) { String contents = buffer . getContents ( ) ; if ( contents == null ) return null ; return new SourceRange ( 0 , contents . length ( ) ) ; } else { return null ; } } public String getTopLevelTypeName ( ) { String topLevelTypeName = getElementName ( ) ; int firstDollar = topLevelTypeName . indexOf ( '$' ) ; if ( firstDollar != - 1 ) { topLevelTypeName = topLevelTypeName . substring ( 0 , firstDollar ) ; } else { topLevelTypeName = topLevelTypeName . substring ( 0 , topLevelTypeName . length ( ) - SUFFIX_CLASS . length ) ; } return topLevelTypeName ; } public IType getType ( ) { if ( this . binaryType == null ) { this . binaryType = new BinaryType ( this , getTypeName ( ) ) ; } return this . binaryType ; } public String getTypeName ( ) { int lastDollar = this . name . lastIndexOf ( '$' ) ; return lastDollar > - 1 ? Util . localTypeName ( this . name , lastDollar , this . name . length ( ) ) : this . name ; } public ICompilationUnit getWorkingCopy ( WorkingCopyOwner owner , IProgressMonitor monitor ) throws JavaModelException { CompilationUnit workingCopy = new ClassFileWorkingCopy ( this , owner == null ? DefaultWorkingCopyOwner . PRIMARY : owner ) ; JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; JavaModelManager . PerWorkingCopyInfo perWorkingCopyInfo = manager . getPerWorkingCopyInfo ( workingCopy , false , true , null ) ; if ( perWorkingCopyInfo != null ) { return perWorkingCopyInfo . getWorkingCopy ( ) ; } BecomeWorkingCopyOperation op = new BecomeWorkingCopyOperation ( workingCopy , null ) ; op . runOperation ( monitor ) ; return workingCopy ; } public IJavaElement getWorkingCopy ( IProgressMonitor monitor , org . eclipse . jdt . core . IBufferFactory factory ) throws JavaModelException { return getWorkingCopy ( BufferFactoryWrapper . create ( factory ) , monitor ) ; } protected boolean hasBuffer ( ) { return true ; } public int hashCode ( ) { return Util . combineHashCodes ( this . name . hashCode ( ) , this . parent . hashCode ( ) ) ; } public boolean isClass ( ) throws JavaModelException { return getType ( ) . isClass ( ) ; } public boolean isInterface ( ) throws JavaModelException { return getType ( ) . isInterface ( ) ; } public boolean isReadOnly ( ) { return true ; } private IStatus validateClassFile ( ) { IPackageFragmentRoot root = getPackageFragmentRoot ( ) ; try { if ( root . getKind ( ) != IPackageFragmentRoot . K_BINARY ) return new JavaModelStatus ( IJavaModelStatusConstants . INVALID_ELEMENT_TYPES , root ) ; } catch ( JavaModelException e ) { return e . getJavaModelStatus ( ) ; } IJavaProject project = getJavaProject ( ) ; return JavaConventions . validateClassFileName ( getElementName ( ) , project . getOption ( JavaCore . COMPILER_SOURCE , true ) , project . getOption ( JavaCore . COMPILER_COMPLIANCE , true ) ) ; } protected IBuffer openBuffer ( IProgressMonitor pm , Object info ) throws JavaModelException { IType outerMostEnclosingType = getOuterMostEnclosingType ( ) ; IBuffer buffer = getBufferManager ( ) . getBuffer ( outerMostEnclosingType . getClassFile ( ) ) ; if ( buffer == null ) { SourceMapper mapper = getSourceMapper ( ) ; IBinaryType typeInfo = info instanceof IBinaryType ? ( IBinaryType ) info : null ; if ( mapper != null ) { buffer = mapSource ( mapper , typeInfo , outerMostEnclosingType . getClassFile ( ) ) ; } } return buffer ; } private IBuffer mapSource ( SourceMapper mapper , IBinaryType info , IClassFile bufferOwner ) { char [ ] contents = mapper . findSource ( getType ( ) , info ) ; if ( contents != null ) { IBuffer buffer = BufferManager . createBuffer ( bufferOwner ) ; if ( buffer == null ) return null ; BufferManager bufManager = getBufferManager ( ) ; bufManager . addBuffer ( buffer ) ; if ( buffer . getCharacters ( ) == null ) { buffer . setContents ( contents ) ; } buffer . addBufferChangedListener ( this ) ; mapper . mapSource ( getOuterMostEnclosingType ( ) , contents , info ) ; return buffer ; } else { IBuffer buffer = BufferManager . createNullBuffer ( bufferOwner ) ; if ( buffer == null ) return null ; BufferManager bufManager = getBufferManager ( ) ; bufManager . addBuffer ( buffer ) ; buffer . addBufferChangedListener ( this ) ; return buffer ; } } static String simpleName ( char [ ] className ) { if ( className == null ) return null ; String simpleName = new String ( unqualifiedName ( className ) ) ; int lastDollar = simpleName . lastIndexOf ( '$' ) ; if ( lastDollar != - 1 ) return Util . localTypeName ( simpleName , lastDollar , simpleName . length ( ) ) ; else return simpleName ; } private IType getOuterMostEnclosingType ( ) { IType type = getType ( ) ; IType enclosingType = type . getDeclaringType ( ) ; while ( enclosingType != null ) { type = enclosingType ; enclosingType = type . getDeclaringType ( ) ; } return type ; } public static char [ ] translatedName ( char [ ] name ) { if ( name == null ) return null ; int nameLength = name . length ; char [ ] newName = new char [ nameLength ] ; for ( int i = 0 ; i < nameLength ; i ++ ) { if ( name [ i ] == '/' ) { newName [ i ] = '.' ; } else { newName [ i ] = name [ i ] ; } } return newName ; } static char [ ] [ ] translatedNames ( char [ ] [ ] names ) { if ( names == null ) return null ; int length = names . length ; char [ ] [ ] newNames = new char [ length ] [ ] ; for ( int i = 0 ; i < length ; i ++ ) { newNames [ i ] = translatedName ( names [ i ] ) ; } return newNames ; } static char [ ] unqualifiedName ( char [ ] className ) { if ( className == null ) return null ; int count = 0 ; for ( int i = className . length - 1 ; i > - 1 ; i -- ) { if ( className [ i ] == '/' ) { char [ ] name = new char [ count ] ; System . arraycopy ( className , i + 1 , name , 0 , count ) ; return name ; } count ++ ; } return className ; } public void codeComplete ( int offset , final org . eclipse . jdt . core . ICodeCompletionRequestor requestor ) throws JavaModelException { if ( requestor == null ) { codeComplete ( offset , ( ICompletionRequestor ) null ) ; return ; } codeComplete ( offset , new ICompletionRequestor ( ) { public void acceptAnonymousType ( char [ ] superTypePackageName , char [ ] superTypeName , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , char [ ] [ ] parameterNames , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) { } public void acceptClass ( char [ ] packageName , char [ ] className , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) { requestor . acceptClass ( packageName , className , completionName , modifiers , completionStart , completionEnd ) ; } public void acceptError ( IProblem error ) { } public void acceptField ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] fieldName , char [ ] typePackageName , char [ ] typeName , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) { requestor . acceptField ( declaringTypePackageName , declaringTypeName , fieldName , typePackageName , typeName , completionName , modifiers , completionStart , completionEnd ) ; } public void acceptInterface ( char [ ] packageName , char [ ] interfaceName , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) { requestor . acceptInterface ( packageName , interfaceName , completionName , modifiers , completionStart , completionEnd ) ; } public void acceptKeyword ( char [ ] keywordName , int completionStart , int completionEnd , int relevance ) { requestor . acceptKeyword ( keywordName , completionStart , completionEnd ) ; } public void acceptLabel ( char [ ] labelName , int completionStart , int completionEnd , int relevance ) { requestor . acceptLabel ( labelName , completionStart , completionEnd ) ; } public void acceptLocalVariable ( char [ ] localVarName , char [ ] typePackageName , char [ ] typeName , int modifiers , int completionStart , int completionEnd , int relevance ) { } public void acceptMethod ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] selector , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , char [ ] [ ] parameterNames , char [ ] returnTypePackageName , char [ ] returnTypeName , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) { requestor . acceptMethod ( declaringTypePackageName , declaringTypeName , selector , parameterPackageNames , parameterTypeNames , returnTypePackageName , returnTypeName , completionName , modifiers , completionStart , completionEnd ) ; } public void acceptMethodDeclaration ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] selector , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , char [ ] [ ] parameterNames , char [ ] returnTypePackageName , char [ ] returnTypeName , char [ ] completionName , int modifiers , int completionStart , int completionEnd , int relevance ) { } public void acceptModifier ( char [ ] modifierName , int completionStart , int completionEnd , int relevance ) { requestor . acceptModifier ( modifierName , completionStart , completionEnd ) ; } public void acceptPackage ( char [ ] packageName , char [ ] completionName , int completionStart , int completionEnd , int relevance ) { requestor . acceptPackage ( packageName , completionName , completionStart , completionEnd ) ; } public void acceptType ( char [ ] packageName , char [ ] typeName , char [ ] completionName , int completionStart , int completionEnd , int relevance ) { requestor . acceptType ( packageName , typeName , completionName , completionStart , completionEnd ) ; } public void acceptVariableName ( char [ ] typePackageName , char [ ] typeName , char [ ] varName , char [ ] completionName , int completionStart , int completionEnd , int relevance ) { } } ) ; } protected IStatus validateExistence ( IResource underlyingResource ) { IStatus status = validateClassFile ( ) ; if ( ! status . isOK ( ) ) return status ; if ( underlyingResource != null ) { if ( ! underlyingResource . isAccessible ( ) ) return newDoesNotExistStatus ( ) ; PackageFragmentRoot root ; if ( ( underlyingResource instanceof IFolder ) && ( root = getPackageFragmentRoot ( ) ) . isArchive ( ) ) { return root . newDoesNotExistStatus ( ) ; } } return JavaModelStatus . VERIFIED_OK ; } public ISourceRange getNameRange ( ) { return null ; } } </s>