Class PackageInfoCache
java.lang.Object
com.google.j2cl.transpiler.frontend.common.PackageInfoCache
A cache for information on package-info files that are needed for transpilation, like JsInterop
annotations.
The cached information comes from two sources. It can either be extracted from previously compiled package-info.class files in the classpath or from package-info.java sources that are part of the current compile.
Requests are answered against the package-info file in the same package and same class path entry as the queried about type. To do anything else would lead to inconsistent answers when multiple class path entries contain the same packages but with different package info files, depending on what arbitrary set of class path entries do or do not happen to be included in the current compile.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEncapsulates all that is known about a particular package in a particular class path entry. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PackageInfoCache.PackageReportWhen nothing is known about a particular package in a particular class path entry the answers to questions about package properties are taken from this instance.static final String -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclear()static PackageInfoCacheget()getJsNamespace(String topLevelTypeSourceName) Returns the JsNamespace for the given type, which must be a top level type and referenced by fully qualified source name.getObjectiveCName(String topLevelTypeSourceName) Returns the ObjectiveCName for the given type which must be a top level type and referenced by its fully qualified source name.static voidbooleanisNullMarked(String topLevelTypeSourceName) voidmarkAsSource(String topLevelTypeSourceName) Let the PackageInfoCache know that this class is Source, otherwise it would have to rummage around in the class path to figure it out and it might even come up with the wrong answer.voidsetPackageProperties(String classPathEntry, String packagePath, String packageJsNamespace, String objectiveCName, boolean isNullMarked) Specify the JavaScript namespace and whether it defines a null marked scope for a given package (as identified by the combination of class path entry and package path).
-
Field Details
-
SOURCE_CLASS_PATH_ENTRY
- See Also:
-
DEFAULT_PACKAGE_REPORT
When nothing is known about a particular package in a particular class path entry the answers to questions about package properties are taken from this instance.
-
-
Method Details
-
clear
public static void clear() -
get
-
init
-
getJsNamespace
Returns the JsNamespace for the given type, which must be a top level type and referenced by fully qualified source name. -
getObjectiveCName
Returns the ObjectiveCName for the given type which must be a top level type and referenced by its fully qualified source name. -
isNullMarked
-
markAsSource
Let the PackageInfoCache know that this class is Source, otherwise it would have to rummage around in the class path to figure it out and it might even come up with the wrong answer. For example if this class has also been globbed into some other library that is a dependency of this one. -
setPackageProperties
public void setPackageProperties(String classPathEntry, String packagePath, String packageJsNamespace, String objectiveCName, boolean isNullMarked) Specify the JavaScript namespace and whether it defines a null marked scope for a given package (as identified by the combination of class path entry and package path).
-