-
-
Notifications
You must be signed in to change notification settings - Fork 5
Submodules
ClassTransform offers a few submodules that can be used to add additional functionality to ClassTransform.
The following submodules are available:
Dependency: net.lenni0451.classtransform:additionalclassprovider
. Maven Central | Maven Server
When using ClassTransform you need to provide the bytecode of additional classes that are required for the transformation (e.g. stack map frame calculation).
This submodule provides a few implementations of the IClassProvider
interface that may be useful in some cases.
Available implementations:
Name | Description |
---|---|
MutableBasicClassProvider |
An extension of the BasicClassProvider with a mutable class loader. |
GuavaClassPathProvider |
Uses the Guava ClassPath to find classes. |
DelegatingClassProvider |
Takes a list of IClassProvider and delegates the request to the first provider that can provide the class. |
MapClassProvider |
Takes a Map<String, byte[]> and uses it to query classes. |
PathClassProvider |
Takes a Path and uses it to resolve classes (class name with / instead of . and .class at the end). |
FileSystemClassProvider |
Uses a FileSystem to resolve classes (class name with / instead of . and .class at the end). |
LazyFileClassProvider |
Takes a collection of File s and lazily opens a FileSystem for each file (class name with / instead of . and .class at the end). |
ClosableFileSystemClassProvider |
Uses a FileSystem to resolve classes (class name with / instead of . and .class at the end). The FileSystem will be closed when the ClosableFileSystemClassProvider is closed. |
Dependency: net.lenni0451.classtransform:mixinstranslator
. Maven Central | Maven Server
This submodule provides an IAnnotationHandlerPreprocessor
implementation that translates Mixins annotations to ClassTransform annotations.
This makes it possible to use the most common Mixins annotations and share the same code between Mixins and ClassTransform.
Using ClassTransform annotations in translated Mixins classes works without any issues and might sometimes be required (see below why).
Due to some differences between Mixins and ClassTransform, some features are not supported or work differently than in Mixins. So be aware that there might be some breaking changes when sharing code between Mixins and ClassTransform.
To register the MixinsTranslator you need to call the addTransformerPreprocessor
method on the TransformerManager
instance.
Make sure to register the translator before registering any transformers that use Mixins annotations.
Example:
TransformerManager transformerManager = ...;
transformerManager.addTransformerPreprocessor(new MixinsTranslator());
Dependency: net.lenni0451.classtransform:mixinsdummy
. Maven Central | Maven Server
This submodule provides a dummy implementation of the Mixins API.
Only the supported annotations are implemented to ensure that the code compiles.
Using the MixinsDummy is useful when using ClassTransform in a project that does not have Mixins as a dependency.
Unsupported features are marked with a @Deprecated
annotation to make it easier to spot differences.