Class FAWEReflectionUtilsTransformer
java.lang.Object
eu.cloudnetservice.wrapper.transform.bukkit.FAWEReflectionUtilsTransformer
- All Implemented Interfaces:
ClassTransformer
@Internal
public final class FAWEReflectionUtilsTransformer
extends Object
implements ClassTransformer
FAWEReflectionUtilsTransformer relies on preview features of the Java platform:
FAWEReflectionUtilsTransformerrefers to one or more preview APIs:ClassTransform.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
A transformer implementation that rewrites the
setFailsafeFieldValue method in the ReflectionUtils
class on old FAWE versions. This is due to the fact that the method uses illegal reflection in the attempt to set a final field which is
not possible anymore on newer java versions.-
Nested Class Summary
Nested classes/interfaces inherited from interface eu.cloudnetservice.wrapper.transform.ClassTransformer
ClassTransformer.TransformWillingness -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ClassDescprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final MethodTypeDescprivate static final MethodTypeDesc -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new instance of this transformer, usually done via SPI. -
Method Summary
Modifier and TypeMethodDescriptionclassTransformWillingness(@NonNull String internalClassName) Checks if this class transformer is willing to transform the class with the given internal name.Provides the class transform that will be used to transform the class data.
-
Field Details
-
CNI_REFLECTION_UTILS
- See Also:
-
MN_SET_FAILSAFE_FIELD_VALUE
- See Also:
-
CD_FIELD
-
MN_FIELD_SET_ACCESSIBLE
- See Also:
-
MTD_SET_ACCESSIBLE
-
MN_FIELD_SET
- See Also:
-
MTD_SET
-
-
Constructor Details
-
FAWEReflectionUtilsTransformer
public FAWEReflectionUtilsTransformer()Constructs a new instance of this transformer, usually done via SPI.
-
-
Method Details
-
provideClassTransform
Provides the class transform that will be used to transform the class data. This method should only be called if a prior check toClassTransformer.classTransformWillingness(String)did not indicate a rejection of the class.- Specified by:
provideClassTransformin interfaceClassTransformer- Returns:
- the class transform to apply to the target class.
-
classTransformWillingness
@NonNull public @NonNull ClassTransformer.TransformWillingness classTransformWillingness(@NonNull @NonNull String internalClassName) Checks if this class transformer is willing to transform the class with the given internal name. If this method is not returning a rejection status, theClassTransformer.provideClassTransform()PREVIEW method is called and the transform gets applied to the target class.- Specified by:
classTransformWillingnessin interfaceClassTransformer- Parameters:
internalClassName- the internal class name of the class being checked for transformation.- Returns:
- the willingness of transformation for the class with the given name.
-
FAWEReflectionUtilsTransformerwhen preview features are enabled.