Package org.stianloader.micromixin.transform.internal.annotation

## Class MixinAnnotation<T>

- java.lang.Object
- - org.stianloader.micromixin.transform.internal.annotation.MixinAnnotation<T>

All Implemented Interfaces:
  `java.lang.Comparable<MixinAnnotation<T>>`

Direct Known Subclasses:
  `AbstractOverlayAnnotation`, `MicromixinCanonicalOverwriteAnnotation`, `MixinExtrasModifyReturnValueAnnotation`, `MixinExtrasWrapOperationAnnotation`, `MixinInjectAnnotation`, `MixinModifyArgAnnotation`, `MixinModifyConstantAnnotation`, `MixinModifyVariableAnnotation`, `MixinRedirectAnnotation`, `MixinShadowAnnotation`, `VirtualClInitMergeAnnotation`, `VirtualConstructorMergeAnnotation`

    public abstract class MixinAnnotation<T>
    extends java.lang.Object
    implements java.lang.Comparable<MixinAnnotation<T>>

### Constructor Summary

Constructors
`MixinAnnotation()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
`abstract void` `apply​(org.objectweb.asm.tree.ClassNode to, HandlerContextHelper hctx, MixinStub sourceStub, T source, SimpleRemapper remapper, java.lang.StringBuilder sharedBuilder)`
`abstract void` `collectMappings​(T source, HandlerContextHelper hctx, org.objectweb.asm.tree.ClassNode target, SimpleRemapper remapper, java.lang.StringBuilder sharedBuilder)`
`int` `compareTo​(MixinAnnotation<T> o)`
`boolean` `isCompatible​(java.util.Collection<MixinAnnotation<T>> collection)` Deprecated.
`void` `validateMixin​(T source, MixinLoggingFacade logger, java.lang.StringBuilder sharedBuilder)` Validate the mixin annotation against the member the annotation was applied on.

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

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

### Constructor Detail

#### MixinAnnotation

    public MixinAnnotation()

### Method Detail

#### apply

    public abstract void apply​(@NotNull
                               org.objectweb.asm.tree.ClassNode to,
                               @NotNull
                               HandlerContextHelper hctx,
                               @NotNull
                               MixinStub sourceStub,
                               @NotNull
                               T source,
                               @NotNull
                               SimpleRemapper remapper,
                               @NotNull
                               java.lang.StringBuilder sharedBuilder)

#### collectMappings

    public abstract void collectMappings​(@NotNull
                                         T source,
                                         @NotNull
                                         HandlerContextHelper hctx,
                                         @NotNull
                                         org.objectweb.asm.tree.ClassNode target,
                                         @NotNull
                                         SimpleRemapper remapper,
                                         @NotNull
                                         java.lang.StringBuilder sharedBuilder)

#### compareTo

    public int compareTo​(MixinAnnotation<T> o)

Specified by:
  `compareTo` in interface `java.lang.Comparable<T>`

#### isCompatible

    @Deprecated
    public boolean isCompatible​(java.util.Collection<MixinAnnotation<T>> collection)

Deprecated.

#### validateMixin

    public void validateMixin​(@NotNull
                              T source,
                              @NotNull
                              MixinLoggingFacade logger,
                              @NotNull
                              java.lang.StringBuilder sharedBuilder)

Validate the mixin annotation against the member the annotation was applied on. This method will be called after all annotations on the member have been parsed, but the owner class may not have been parsed in it's entirety. The main purpose of this validation method is to catch obviously flawed mixin handlers as early as possible.

As for larger modded environments this 'as early as possible' may in fact be too early and get drowned out by other log statements, any logging statements made while executing this method should be printed on application too, within reason (i.e. `MixinLoggingFacade.info(Class, String, Object...)` calls have no real reason to be repeated).

Note that at the point this method is being called, micromixin-transformer has no knowledge of the class the mixin handler targets. If the target class or a member from there is required to be known during validation, such validation should be done within `apply(ClassNode, HandlerContextHelper, MixinStub, Object, SimpleRemapper, StringBuilder)` or `collectMappings(Object, HandlerContextHelper, ClassNode, SimpleRemapper, StringBuilder)`.

Parameters:
  `source` - The mixin handler source member which has this annotation annotated.
  `logger` - The logger to print warnings, errors or informational statements to.
  `sharedBuilder` - A shared `StringBuilder` instance that may be freely mutated (note: not thread-safe).