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
Von 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
Modifizierer und TypFeldBeschreibungprotected NamedMember
The binary type or module source is being mapped forprotected HashMap
protected HashSet
Set 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[]
TheSourceRange
of 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 HashMap
Table that maps a binary method to its parameter names.protected HashMap
Table that contains all source ranges for local variables.protected String
Specifies the location of the package fragment root within the zip (empty specifies the default root).protected ArrayList
Specifies the location of the package fragment roots within the zip (empty specifies the default root).protected IJavaElement
The element searched forprotected org.eclipse.core.runtime.IPath
The location of the zip file containing source.protected HashMap
Table that maps a binary element to itsSourceRange
s.static final SourceRange
The unknown source range {-1, 0}static boolean
Von 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
KonstruktorBeschreibungSourceMapper
(org.eclipse.core.runtime.IPath sourcePath, String rootPath, Map options) SourceMapper
(org.eclipse.core.runtime.IPath sourcePath, String rootPath, Map options, String encoding) Creates aSourceMapper
that locates source in the zip file at the given location in the specified package fragment root. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
acceptImport
(int declarationStart, int declarationEnd, int nameStart, int nameEnd, char[][] tokens, boolean onDemand, int modifiers) void
acceptLineSeparatorPositions
(int[] positions) void
acceptPackage
(ImportReference importReference) void
acceptProblem
(CategorizedProblem problem) void
close()
Closes thisSourceMapper
's zip file.String[]
convertTypeNamesToSigs
(char[][] typeNames) NOT API, public only for access by Unit tests.void
void
enterConstructor
(ISourceElementRequestor.MethodInfo methodInfo) void
enterField
(ISourceElementRequestor.FieldInfo fieldInfo) void
enterInitializer
(int declarationSourceStart, int modifiers) void
enterMethod
(ISourceElementRequestor.MethodInfo methodInfo) void
enterModule
(ISourceElementRequestor.ModuleInfo moduleInfo) void
enterType
(ISourceElementRequestor.TypeInfo typeInfo) void
exitCompilationUnit
(int declarationEnd) void
exitConstructor
(int declarationEnd) void
exitField
(int initializationStart, int declarationEnd, int declarationSourceEnd) void
exitInitializer
(int declarationEnd) void
exitMethod
(int declarationEnd, Expression defaultValue) void
exitModule
(int declarationEnd) void
exitType
(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 returnsnull
if 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 returnsnull
if 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 returnsnull
if source code cannot be found.int
getFlags
(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 theSourceRange
for the given element, or {-1, -1} if no source range is known for the element.protected IType
Returns 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.void
mapSource
(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 void
setMethodParameterNames
(IMethod method, char[][] parameterNames) Sets the mapping for this method to its parameter names.protected void
setSourceRange
(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, acceptUnknownReference
Von Klasse geerbte Methoden java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Von Schnittstelle geerbte Methoden org.aspectj.org.eclipse.jdt.internal.compiler.ISourceElementRequestor
acceptAnnotationTypeReference, acceptAnnotationTypeReference, acceptConstructorReference, acceptFieldReference, acceptMethodReference, acceptTypeReference, acceptTypeReference, acceptUnknownReference, acceptUnknownReference, enterCompactConstructor, exitCompactConstructor
-
Felddetails
-
VERBOSE
public static boolean VERBOSE -
rootPaths
Specifies the location of the package fragment roots within the zip (empty specifies the default root).null
is 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).null
is 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 itsSourceRange
s. 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
TheSourceRange
of 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:
acceptImport
in 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:
acceptLineSeparatorPositions
in SchnittstelleISourceElementRequestor
- Siehe auch:
-
acceptPackage
- Angegeben von:
acceptPackage
in SchnittstelleISourceElementRequestor
- Siehe auch:
-
acceptProblem
- Angegeben von:
acceptProblem
in SchnittstelleISourceElementRequestor
- Siehe auch:
-
close
public void close()Closes thisSourceMapper
's zip file. Once this is done, thisSourceMapper
cannot 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:
enterType
in SchnittstelleISourceElementRequestor
- Siehe auch:
-
enterModule
- Angegeben von:
enterModule
in SchnittstelleISourceElementRequestor
-
exitModule
public void exitModule(int declarationEnd) - Angegeben von:
exitModule
in SchnittstelleISourceElementRequestor
-
enterCompilationUnit
public void enterCompilationUnit()- Angegeben von:
enterCompilationUnit
in SchnittstelleISourceElementRequestor
- Siehe auch:
-
enterConstructor
- Angegeben von:
enterConstructor
in SchnittstelleISourceElementRequestor
- Siehe auch:
-
enterField
- Angegeben von:
enterField
in SchnittstelleISourceElementRequestor
- Siehe auch:
-
enterInitializer
public void enterInitializer(int declarationSourceStart, int modifiers) - Angegeben von:
enterInitializer
in SchnittstelleISourceElementRequestor
- Siehe auch:
-
enterMethod
- Angegeben von:
enterMethod
in SchnittstelleISourceElementRequestor
- Siehe auch:
-
exitType
public void exitType(int declarationEnd) - Angegeben von:
exitType
in SchnittstelleISourceElementRequestor
- Siehe auch:
-
exitCompilationUnit
public void exitCompilationUnit(int declarationEnd) - Angegeben von:
exitCompilationUnit
in SchnittstelleISourceElementRequestor
- Siehe auch:
-
exitConstructor
public void exitConstructor(int declarationEnd) - Angegeben von:
exitConstructor
in SchnittstelleISourceElementRequestor
- Siehe auch:
-
exitField
public void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd) - Angegeben von:
exitField
in SchnittstelleISourceElementRequestor
- Siehe auch:
-
exitInitializer
public void exitInitializer(int declarationEnd) - Angegeben von:
exitInitializer
in SchnittstelleISourceElementRequestor
- Siehe auch:
-
exitMethod
- Angegeben von:
exitMethod
in SchnittstelleISourceElementRequestor
- Siehe auch:
-
findSource
Locates and returns source code for the given (binary) type, in this SourceMapper's ZIP file, or returnsnull
if source code cannot be found. -
findSource
Locates and returns source code for the given (binary) type, in this SourceMapper's ZIP file, or returnsnull
if 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 returnsnull
if 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 theSourceRange
for 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
-