Class ClassPathTransform.Request.Builder
- Enclosing class:
ClassPathTransform.Request
ClassPathTransform.Request.- Since:
- 3.2.0
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the request.The runtime class path, in the order the application's class loader searches it, the application's own output first: jars or directories.desugarLambdas(boolean desugar) Desugar the lambda and method-reference call sites of every entry of the class path, jars and directories, the application's own output included.foreignPackages(Set<String> packages) Packages, with their subpackages, whose classes the runtime may resolve from somewhere other than the class path, for a launcher whose own loader defines these packages first, such as Micronaut Runner's.outputDirectory(Path directory) Where rewritten copies are written: each under a subdirectory named by its entry's index in the class path, with the entry's own file name.parallelism(int threads) The number of worker threads.stripLocalVariables(Collection<Path> thirdPartyJars) Strip the local-variable tables of the classes in these jars: third-party jars only, never the application's output, a module of the application's own build or a directory.
-
Method Details
-
classPath
The runtime class path, in the order the application's class loader searches it, the application's own output first: jars or directories. Required. Every class on it is part of the model that rewritten classes are verified against; only the entries a step applies to are rewritten.- Parameters:
entries- the class path entries- Returns:
- this builder
-
outputDirectory
Where rewritten copies are written: each under a subdirectory named by its entry's index in the class path, with the entry's own file name. Required. The caller owns the directory and cleans it. It must not hold an entry of the class path, such as a copy that an earlier run wrote there, because a run replaces and deletes files in it, nor be inside a directory of the class path, which would then hold what a run writes.- Parameters:
directory- the output directory- Returns:
- this builder
-
desugarLambdas
Desugar the lambda and method-reference call sites of every entry of the class path, jars and directories, the application's own output included. Default:false.A call site that
LambdaMetafactory.metafactorylinks at run time becomes a call to a class that the step generates next to the class that holds the site, when the step can prove that the generated class resolves what the site resolved; every other site staysinvokedynamic. A name that two entries hold, or that has aMETA-INF/versions/copy, is never rewritten, because a fat JAR or an image does not tell which copy loads. The generated classes depend on the JDK that runs the transform: run it on the feature release the application runs on.- Parameters:
desugar- whether to desugar- Returns:
- this builder
-
foreignPackages
Packages, with their subpackages, whose classes the runtime may resolve from somewhere other than the class path, for a launcher whose own loader defines these packages first, such as Micronaut Runner's. Desugaring never rewrites a site whose host, nest host, implementation owner, functional interface or captured receiver is in one of them, even a package of the JDK, such as one of a module that the launcher's loader does not take from the JDK. Default: none.- Parameters:
packages- the packages, as dotted names such asio.micronaut.runner- Returns:
- this builder
- Throws:
IllegalArgumentException- if a name is not a package name
-
stripLocalVariables
Strip the local-variable tables of the classes in these jars: third-party jars only, never the application's output, a module of the application's own build or a directory. Default: none.A non-empty collection enables the step. Each jar must be an entry of the class path. The step drops
LocalVariableTable,LocalVariableTypeTable,CharacterRangeTable, the type annotations of code and the invisible type annotations, and keeps line numbers, source file names, parameter names, signatures and every other annotation. It strips nothing, and the result carries a warning, when the class path holds a library that reads local-variable tables at run time.- Parameters:
thirdPartyJars- the jars whose classes are stripped- Returns:
- this builder
-
parallelism
The number of worker threads. Default: the available processors. The output does not depend on it.- Parameters:
threads- the number of threads, at least one- Returns:
- this builder
-
build
Builds the request.- Returns:
- the request
- Throws:
IllegalStateException- if the class path or the output directory is missing, or no step is enabledIllegalArgumentException- if a jar to strip is not an entry of the class path, or is a directory, if an entry of the class path is inside the output directory, or if the output directory is inside a directory of the class path
-