Klasse SourceMapper
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.util.ReferenceInfoAdapter
org.aspectj.org.eclipse.jdt.internal.core.SourceMapper
- Alle implementierten Schnittstellen:
ISourceElementRequestor,SuffixConstants
public class SourceMapper
extends ReferenceInfoAdapter
implements ISourceElementRequestor, SuffixConstants
A SourceMapper maps source code in a ZIP file to binary types or
binary modules in a JAR. The SourceMapper uses the fuzzy parser
to identify source fragments in a .java file, and attempts to match
the source code with children in a binary type.
Since a module has no children in the Java Model no such matching
happens in that case.
A SourceMapper is associated with a JarPackageFragment by an AttachSourceOperation.
- Siehe auch:
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenVon Schnittstelle geerbte verschachtelte Klassen/Schnittstellen org.aspectj.org.eclipse.jdt.internal.compiler.ISourceElementRequestor
ISourceElementRequestor.FieldInfo, ISourceElementRequestor.MethodInfo, ISourceElementRequestor.ModuleInfo, ISourceElementRequestor.PackageExportInfo, ISourceElementRequestor.ParameterInfo, ISourceElementRequestor.RequiresInfo, ISourceElementRequestor.ServicesInfo, ISourceElementRequestor.TypeInfo, ISourceElementRequestor.TypeParameterInfo -
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprotected NamedMemberThe binary type or module source is being mapped forprotected HashMapprotected HashSetSet that contains all final local variables.protected int[]The position within the source of the start of the current member element, or -1 if we are outside a member.protected String[]The name of the current member element.protected SourceRange[]TheSourceRangeof the name of the current member element.protected char[][][]The parameter names for the current member method element.protected char[][][]The parameter types for the current member method element.protected HashMapTable that maps a binary method to its parameter names.protected HashMapTable that contains all source ranges for local variables.protected StringSpecifies the location of the package fragment root within the zip (empty specifies the default root).protected ArrayListSpecifies the location of the package fragment roots within the zip (empty specifies the default root).protected IJavaElementThe element searched forprotected org.eclipse.core.runtime.IPathThe location of the zip file containing source.protected HashMapTable that maps a binary element to itsSourceRanges.static final SourceRangeThe unknown source range {-1, 0}static booleanVon Schnittstelle geerbte Felder org.aspectj.org.eclipse.jdt.internal.compiler.util.SuffixConstants
EXTENSION_aj, EXTENSION_AJ, EXTENSION_class, EXTENSION_CLASS, EXTENSION_java, EXTENSION_JAVA, EXTENSION_jmod, EXTENSION_JMOD, SUFFIX_aj, SUFFIX_AJ, SUFFIX_class, SUFFIX_CLASS, SUFFIX_java, SUFFIX_JAVA, SUFFIX_STRING_aj, SUFFIX_STRING_AJ, SUFFIX_STRING_class, SUFFIX_STRING_CLASS, SUFFIX_STRING_java, SUFFIX_STRING_JAVA -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungSourceMapper(org.eclipse.core.runtime.IPath sourcePath, String rootPath, Map options) SourceMapper(org.eclipse.core.runtime.IPath sourcePath, String rootPath, Map options, String encoding) Creates aSourceMapperthat locates source in the zip file at the given location in the specified package fragment root. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidacceptImport(int declarationStart, int declarationEnd, int nameStart, int nameEnd, char[][] tokens, boolean onDemand, int modifiers) voidacceptLineSeparatorPositions(int[] positions) voidacceptPackage(ImportReference importReference) voidacceptProblem(CategorizedProblem problem) voidclose()Closes thisSourceMapper's zip file.String[]convertTypeNamesToSigs(char[][] typeNames) NOT API, public only for access by Unit tests.voidvoidenterConstructor(ISourceElementRequestor.MethodInfo methodInfo) voidenterField(ISourceElementRequestor.FieldInfo fieldInfo) voidenterInitializer(int declarationSourceStart, int modifiers) voidenterMethod(ISourceElementRequestor.MethodInfo methodInfo) voidenterModule(ISourceElementRequestor.ModuleInfo moduleInfo) voidenterType(ISourceElementRequestor.TypeInfo typeInfo) voidexitCompilationUnit(int declarationEnd) voidexitConstructor(int declarationEnd) voidexitField(int initializationStart, int declarationEnd, int declarationSourceEnd) voidexitInitializer(int declarationEnd) voidexitMethod(int declarationEnd, Expression defaultValue) voidexitModule(int declarationEnd) voidexitRecordComponent(int declarationEnd, int declarationSourceEnd) voidexitType(int declarationEnd) char[]findSource(String fullName) char[]findSource(IModuleDescription module) Locates and returns source code for the given (binary) module, in this SourceMapper's ZIP file, or returnsnullif source code cannot be found.char[]findSource(IType type, String simpleSourceFileName) Locates and returns source code for the given (binary) type, in this SourceMapper's ZIP file, or returnsnullif source code cannot be found.char[]findSource(IType type, IBinaryType info) Locates and returns source code for the given (binary) type, in this SourceMapper's ZIP file, or returnsnullif source code cannot be found.intgetFlags(IJavaElement element) char[][]getImports(Member typeOrModule) Return a char[][] array containing the imports of the attached source for the binary typechar[][]getMethodParameterNames(IMethod method) Returns parameters names for the given method, or null if no parameter names are known for the method.getNameRange(IJavaElement element) Returns the SourceRange for the name of the given element, or {-1, -1} if no source range is known for the name of the element.getSourceRange(IJavaElement element) Returns theSourceRangefor the given element, or {-1, -1} if no source range is known for the element.protected ITypeReturns the type with the giventypeName.protected IJavaElement[]getUnqualifiedMethodHandle(IMethod method, boolean noDollar) Creates a handle that has parameter types that are not fully qualified so that the correct source is found.voidmapSource(NamedMember typeOrModule, char[] contents, IBinaryType info) Maps the given source code to the given binary type or module and its children.mapSource(NamedMember typeOrModule, char[] contents, IBinaryType info, IJavaElement elementToFind) Maps the given source code to the given binary type and its children.protected voidsetMethodParameterNames(IMethod method, char[][] parameterNames) Sets the mapping for this method to its parameter names.protected voidsetSourceRange(IJavaElement element, SourceRange sourceRange, SourceRange nameRange) Sets the mapping for this element to its source ranges for its source range and name range.Von Klasse geerbte Methoden org.aspectj.org.eclipse.jdt.internal.core.util.ReferenceInfoAdapter
acceptAnnotationTypeReference, acceptAnnotationTypeReference, acceptConstructorReference, acceptFieldReference, acceptMethodReference, acceptTypeReference, acceptTypeReference, acceptUnknownReference, acceptUnknownReferenceVon Klasse geerbte Methoden java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitVon Schnittstelle geerbte Methoden org.aspectj.org.eclipse.jdt.internal.compiler.ISourceElementRequestor
acceptAnnotationTypeReference, acceptAnnotationTypeReference, acceptConstructorReference, acceptFieldReference, acceptMethodReference, acceptTypeReference, acceptTypeReference, acceptUnknownReference, acceptUnknownReference
-
Felddetails
-
VERBOSE
public static boolean VERBOSE -
rootPaths
Specifies the location of the package fragment roots within the zip (empty specifies the default root).nullis not a valid root path. -
binaryTypeOrModule
The binary type or module source is being mapped for -
sourcePath
protected org.eclipse.core.runtime.IPath sourcePathThe location of the zip file containing source. -
rootPath
Specifies the location of the package fragment root within the zip (empty specifies the default root).nullis not a valid root path. -
parameterNames
Table that maps a binary method to its parameter names. Keys are the method handles, entries arechar[][]. -
sourceRanges
Table that maps a binary element to itsSourceRanges. Keys are the element handles, entries areSourceRange[]which is a two element array; the first being source range, the second being name range. -
categories
-
parametersRanges
Table that contains all source ranges for local variables. Keys are the special local variable elements, entries arechar[][]. -
finalParameters
Set that contains all final local variables. -
UNKNOWN_RANGE
The unknown source range {-1, 0} -
memberDeclarationStart
protected int[] memberDeclarationStartThe position within the source of the start of the current member element, or -1 if we are outside a member. -
memberNameRange
TheSourceRangeof the name of the current member element. -
memberName
The name of the current member element. -
methodParameterNames
protected char[][][] methodParameterNamesThe parameter names for the current member method element. -
methodParameterTypes
protected char[][][] methodParameterTypesThe parameter types for the current member method element. -
searchedElement
The element searched for
-
-
Konstruktordetails
-
Methodendetails
-
acceptImport
public void acceptImport(int declarationStart, int declarationEnd, int nameStart, int nameEnd, char[][] tokens, boolean onDemand, int modifiers) - Angegeben von:
acceptImportin SchnittstelleISourceElementRequestor- Parameter:
declarationStart- This is the position of the first character of the import keyword.declarationEnd- This is the position of the ';' ending the import statement or the end of the comment following the import.nameStart- This is the position of the first character of the import declaration's name.nameEnd- This is the position of the last character of the import declaration's name.tokens- This are the tokens of the import like specified in the source.onDemand- set to true if the import is an import on demand (e.g. import java.io.*). False otherwise.modifiers- can be set to static from 1.5 on.- Siehe auch:
-
acceptLineSeparatorPositions
public void acceptLineSeparatorPositions(int[] positions) - Angegeben von:
acceptLineSeparatorPositionsin SchnittstelleISourceElementRequestor- Siehe auch:
-
acceptPackage
- Angegeben von:
acceptPackagein SchnittstelleISourceElementRequestor- Siehe auch:
-
acceptProblem
- Angegeben von:
acceptProblemin SchnittstelleISourceElementRequestor- Siehe auch:
-
close
public void close()Closes thisSourceMapper's zip file. Once this is done, thisSourceMappercannot be used again. -
convertTypeNamesToSigs
NOT API, public only for access by Unit tests. Converts these type names to unqualified signatures. This needs to be done in order to be consistent with the way the source range is retrieved.- Siehe auch:
-
enterType
- Angegeben von:
enterTypein SchnittstelleISourceElementRequestor- Siehe auch:
-
enterModule
- Angegeben von:
enterModulein SchnittstelleISourceElementRequestor
-
exitModule
public void exitModule(int declarationEnd) - Angegeben von:
exitModulein SchnittstelleISourceElementRequestor
-
enterCompilationUnit
public void enterCompilationUnit()- Angegeben von:
enterCompilationUnitin SchnittstelleISourceElementRequestor- Siehe auch:
-
enterConstructor
- Angegeben von:
enterConstructorin SchnittstelleISourceElementRequestor- Siehe auch:
-
enterField
- Angegeben von:
enterFieldin SchnittstelleISourceElementRequestor- Siehe auch:
-
enterInitializer
public void enterInitializer(int declarationSourceStart, int modifiers) - Angegeben von:
enterInitializerin SchnittstelleISourceElementRequestor- Siehe auch:
-
enterMethod
- Angegeben von:
enterMethodin SchnittstelleISourceElementRequestor- Siehe auch:
-
exitType
public void exitType(int declarationEnd) - Angegeben von:
exitTypein SchnittstelleISourceElementRequestor- Siehe auch:
-
exitCompilationUnit
public void exitCompilationUnit(int declarationEnd) - Angegeben von:
exitCompilationUnitin SchnittstelleISourceElementRequestor- Siehe auch:
-
exitConstructor
public void exitConstructor(int declarationEnd) - Angegeben von:
exitConstructorin SchnittstelleISourceElementRequestor- Siehe auch:
-
exitField
public void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd) - Angegeben von:
exitFieldin SchnittstelleISourceElementRequestor- Siehe auch:
-
exitRecordComponent
public void exitRecordComponent(int declarationEnd, int declarationSourceEnd) - Angegeben von:
exitRecordComponentin SchnittstelleISourceElementRequestor- Siehe auch:
-
exitInitializer
public void exitInitializer(int declarationEnd) - Angegeben von:
exitInitializerin SchnittstelleISourceElementRequestor- Siehe auch:
-
exitMethod
- Angegeben von:
exitMethodin SchnittstelleISourceElementRequestor- Siehe auch:
-
findSource
Locates and returns source code for the given (binary) type, in this SourceMapper's ZIP file, or returnsnullif source code cannot be found. -
findSource
Locates and returns source code for the given (binary) type, in this SourceMapper's ZIP file, or returnsnullif source code cannot be found. The given simpleSourceFileName is the .java file name (without the enclosing folder) used to create the given type (e.g. "A.java" for x/y/A$Inner.class) -
findSource
Locates and returns source code for the given (binary) module, in this SourceMapper's ZIP file, or returnsnullif source code cannot be found. -
findSource
-
getFlags
-
getNameRange
Returns the SourceRange for the name of the given element, or {-1, -1} if no source range is known for the name of the element. -
getMethodParameterNames
Returns parameters names for the given method, or null if no parameter names are known for the method. -
getSourceRange
Returns theSourceRangefor the given element, or {-1, -1} if no source range is known for the element. -
getType
Returns the type with the giventypeName. Returns inner classes as well. -
getUnqualifiedMethodHandle
Creates a handle that has parameter types that are not fully qualified so that the correct source is found. -
mapSource
Maps the given source code to the given binary type or module and its children. -
mapSource
public ISourceRange mapSource(NamedMember typeOrModule, char[] contents, IBinaryType info, IJavaElement elementToFind) Maps the given source code to the given binary type and its children. If a non-null java element is passed, finds the name range for the given java element without storing it. -
setMethodParameterNames
Sets the mapping for this method to its parameter names.- Siehe auch:
-
setSourceRange
Sets the mapping for this element to its source ranges for its source range and name range.- Siehe auch:
-
getImports
Return a char[][] array containing the imports of the attached source for the binary type
-