Class ClassPathTransform
It has two steps, which a request enables separately: desugaring the lambda and method-reference call sites of
every entry (ClassPathTransform.Request.Builder.desugarLambdas(boolean)), and stripping the local-variable tables of the
third-party jars a caller names (ClassPathTransform.Request.Builder.stripLocalVariables(Collection)). They run in one pass, in
that order: each class is parsed, rewritten and verified once, against a model of the whole class path, never
against the build tool's own class path; a class whose rewrite verifies worse than the original, or on which a step
fails, is written without that step, or as it was. An entry with a rewritten class, a jar or a directory, is copied
whole, under its own file name, into a directory of its own below the request's output directory; every other class
path entry keeps its own path, its bytes and its hash. The transform never loads a class of the class path, and it
logs nothing: the ClassPathTransform.Result carries a summary and warnings for the caller to log, and the counts of each entry
as numbers, for the caller to report in its own format.
The rewritten bytes depend on the JDK that runs the transform: they are reproducible with the same JDK build, whatever the parallelism.
- Since:
- 3.2.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classWhat to rewrite.static final classWhat a run did. -
Method Summary
Modifier and TypeMethodDescriptionstatic ClassPathTransform.Resultrun(ClassPathTransform.Request request) Rewrites what it can prove safe and leaves everything else as it is.
-
Method Details
-
run
Rewrites what it can prove safe and leaves everything else as it is. It throws only when it cannot read a class path entry it rewrites, or cannot write its output, never because of a class it cannot rewrite.- Parameters:
request- what to rewrite- Returns:
- the class path to package, and what was done
- Throws:
IOException- if a jar to rewrite, or an entry of the class path, cannot be read, or a copy cannot be written
-