Package org.stianloader.micromixin.transform.api

## Class MixinTransformer<M>

- java.lang.Object
- - org.stianloader.micromixin.transform.api.MixinTransformer<M>

Type Parameters:
  `M` - The modularity attachment type. Modularity attachments are needed to pin down the source of a mixin. This reduces the chance of incompatibilities between mods loaded by two different classloaders. The modularity attachment should ideally implement `Object.equals(Object)` and `Object.hashCode()` if the identity comparison semantics of the default implementations are a potential issue. A recommended type can be `ClassLoader`, but really anything goes, `Void` for example is perfectly fine as long as the `BytecodeProvider` accounts for null attachments. All methods in `MixinTransformer` support null attachments internally, albeit it is not recommended to use null for any method.

    public class MixinTransformer<M>
    extends java.lang.Object

The central brain of Micromixin. An instance of this class stores all mixin-related matters. Multiple instances can be used at the same time, as long as their inputs are separated.

### Field Summary

Fields
`static java.lang.String` `VENDOR_COMPAT_SYSTEM_PROPERTY` Constant defining the name of the vendor compatibility system property.

### Constructor Summary

Constructors
`MixinTransformer​(BytecodeProvider<M> bytecodeProvider, ClassWrapperPool pool)`

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`void` `addMixin​(M attachment, MixinConfig config)`
`InjectionPointSelectorFactory` `getInjectionPointSelectors()` Obtains the `InjectionPointSelectorFactory` that can be used to register custom injection point selectors.
`MixinLoggingFacade` `getLogger()`
`ClassWrapperPool` `getPool()`
`MixinVendor` `getVendorCompatibilityMode()` The vendor compatibility mode is a flag that defines which behaviour should be used when encountering behaviour that is inconsistent across mixin vendors or mixin implementations.
`boolean` `isDelayingParseExceptions()`
`boolean` `isMergingClassFileVersions()`
`boolean` `isMixin​(M attachment, java.lang.String internalName)` Returns whether a package or a class is within a mixin.
`boolean` `isMixinTarget​(java.lang.String name)`
`void` `setDelayParseExceptions​(boolean delayParseExceptions)`
`void` `setLogger​(MixinLoggingFacade logger)`
`void` `setMergeClassFileVersions​(boolean mergeClassFileVersions)`
`void` `setVendorCompatibilityMode​(MixinVendor vendorCompatibilityMode)` The vendor compatibility mode is a flag that defines which behaviour should be used when encountering behaviour that is inconsistent across mixin vendors or mixin implementations.
`void` `transform​(org.objectweb.asm.tree.ClassNode in)` Deprecated.
`void` `transform​(org.objectweb.asm.tree.ClassNode in, java.net.URI classCodeSourceURI)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### VENDOR_COMPAT_SYSTEM_PROPERTY

    @NotNull
    @AvailableSince("0.9.0-a20260503")
    public static final java.lang.String VENDOR_COMPAT_SYSTEM_PROPERTY

Constant defining the name of the vendor compatibility system property.

Note: Please beware that javac inlines strings by default. Changes to the value of the string will as such not be reflected onto other libraries using this constant directly. As such, it is ill-advised to try to change this value.

Since:
  0.9.0-a20260503
See Also:
  Constant Field Values

### Constructor Detail

#### MixinTransformer

    public MixinTransformer​(@NotNull
                            BytecodeProvider<M> bytecodeProvider,
                            @NotNull
                            ClassWrapperPool pool)

### Method Detail

#### addMixin

    public void addMixin​(M attachment,
                         @NotNull
                         MixinConfig config)

#### getInjectionPointSelectors

    @NotNull
    @Contract(pure=true)
    public InjectionPointSelectorFactory getInjectionPointSelectors()

Obtains the `InjectionPointSelectorFactory` that can be used to register custom injection point selectors.

The instance is specific to this specific `MixinTransformer`. Registering an injection point selector to the factory of this instance will not have an effect of any mixins registered via any other transformers.

Returns:
  The active `InjectionPointSelectorFactory` instance.

#### getLogger

    @NotNull
    public MixinLoggingFacade getLogger()

#### getPool

    @NotNull
    public ClassWrapperPool getPool()

#### isDelayingParseExceptions

    public boolean isDelayingParseExceptions()

#### isMergingClassFileVersions

    public boolean isMergingClassFileVersions()

#### isMixin

    public boolean isMixin​(M attachment,
                           @NotNull
                           java.lang.String internalName)

Returns whether a package or a class is within a mixin. Such classes or packages should not be loaded by the classloader.

The internal name must be represented as a fully qualified name using slashes ('/') as package separators.

Parameters:
  `attachment` - The modularity attachment to use
  `internalName` - The internal name of the package or class
Returns:
  True if it is within the package, false otherwise.

#### isMixinTarget

    public boolean isMixinTarget​(@NotNull
                                 java.lang.String name)

#### setDelayParseExceptions

    public void setDelayParseExceptions​(boolean delayParseExceptions)

#### setLogger

    public void setLogger​(@NotNull
                          MixinLoggingFacade logger)

#### setMergeClassFileVersions

    public void setMergeClassFileVersions​(boolean mergeClassFileVersions)

#### transform

    @Deprecated
    @Obsolete
    public void transform​(@NotNull
                          org.objectweb.asm.tree.ClassNode in)

Deprecated.

#### transform

    @AvailableSince("0.7.0-a20241008")
    public void transform​(@NotNull
                          org.objectweb.asm.tree.ClassNode in,
                          @Nullable
                          java.net.URI classCodeSourceURI)

#### getVendorCompatibilityMode

    @Nullable
    @AvailableSince("0.9.0-a20260503")
    public MixinVendor getVendorCompatibilityMode()

The vendor compatibility mode is a flag that defines which behaviour should be used when encountering behaviour that is inconsistent across mixin vendors or mixin implementations.

When not explicitly set via `setVendorCompatibilityMode(MixinVendor)` or the system property, a default lenient mode should be used. When behaviour that might not be supported on all platforms is used, a warning log will be printed. This lenient mode corresponds to a `MixinVendor` value of `null`.

The default value of this flag is defined by the `VENDOR_COMPAT_SYSTEM_PROPERTY` system property. The value of that property may be one of the `Enum.name()` values within the `MixinVendor` enumeration.

Returns:
  the current `MixinVendor` that is set via `setVendorCompatibilityMode(MixinVendor)` or the system property
Since:
  0.9.0-a20260503

#### setVendorCompatibilityMode

    @AvailableSince("0.9.0-a20260503")
    public void setVendorCompatibilityMode​(@Nullable
                                           MixinVendor vendorCompatibilityMode)

The vendor compatibility mode is a flag that defines which behaviour should be used when encountering behaviour that is inconsistent across mixin vendors or mixin implementations.

When not explicitly set via `setVendorCompatibilityMode(MixinVendor)` or the system property, a default lenient mode should be used. When behaviour that might not be supported on all platforms is used, a warning log will be printed. This lenient mode corresponds to a `MixinVendor` value of `null`.

The default value of this flag is defined by the `VENDOR_COMPAT_SYSTEM_PROPERTY` system property. The value of that property may be one of the `Enum.name()` values within the `MixinVendor` enumeration.

Note that in the future, this flag could be overridden on a per-mixin basis via annotations or an equivalent framework. However, as of writing (30 April 2026), such a framework does not yet exist.

Parameters:
  `vendorCompatibilityMode` - The `MixinVendor` implementation to now use.
Since:
  0.9.0-a20260503