Interface INameEnvironment
- All Known Subinterfaces:
IModuleAwareNameEnvironment
,INameEnvironmentExtension
,INameEnvironmentWithProgress
- All Known Implementing Classes:
CancelableNameEnvironment
,CodeSnippetEnvironment
,FileSystem
,JavaSearchNameEnvironment
,NameEnvironment
,SearchableEnvironment
,StatefulNameEnvironment
public interface INameEnvironment
The name environment provides a callback API that the compiler
can use to look up types, compilation units, and packages in the
current environment. The name environment is passed to the compiler
on creation.
In JLS diction a name environment implements a "host system", with these responsibilities:
- Determine which packages and compilation units are "observable" (JLS 7.3 & 7.4.3)
- Determine to which module a given compilation unit / package is associated (JLS 7.3)
Note: This internal interface has been implemented illegally by the org.apache.jasper.glassfish bundle from Orbit, see bug 500211. Avoid changing the API or supply default methods to avoid breaking the Eclipse Help system.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanup()
This method cleans the environment.findType(char[][] compoundTypeName)
Find a type with the given compound name.findType(char[] typeName, char[][] packageName)
Find a type namedin the package . boolean
isPackage(char[][] parentPackageName, char[] packageName)
Answer whether packageName is the name of a known subpackage inside the package parentPackageName.
-
Method Details
-
findType
Find a type with the given compound name. Answer the binary form of the type if it is known to be consistent. Otherwise, answer the compilation unit which defines the type or null if the type does not exist. Types in the default package are specified as {{typeName}}. It is unknown whether the package containing the type actually exists. NOTE: This method can be used to find a member type using its internal name A$B, but the source file for A is answered if the binary file is inconsistent. -
findType
Find a type namedin the package . Answer the binary form of the type if it is known to be consistent. Otherwise, answer the compilation unit which defines the type or null if the type does not exist. The default package is indicated by char[0][]. It is known that the package containing the type exists. NOTE: This method can be used to find a member type using its internal name A$B, but the source file for A is answered if the binary file is inconsistent. -
isPackage
boolean isPackage(char[][] parentPackageName, char[] packageName)Answer whether packageName is the name of a known subpackage inside the package parentPackageName. A top level package is found relative to null. The default package is always assumed to exist. For example: isPackage({{java}, {awt}}, {event}); isPackage(null, {java}); -
cleanup
void cleanup()This method cleans the environment. It is responsible for releasing the memory and freeing resources. Passed that point, the name environment is no longer usable. A name environment can have a long life cycle, therefore it is the responsibility of the code which created it to decide when it is a good time to clean it up.
-