Record Class AccessTransformerRule

java.lang.Object
java.lang.Record
com.hloader.at.AccessTransformerRule
Record Components:
owner - dotted class name the rule targets, in named/deobfuscated form
member - the raw field or method name as it appears in the actual bytecode, or null/"*" to change the class itself
descriptor - the method's raw descriptor if member is a method, null for a field or a whole-class rule

public record AccessTransformerRule(AccessTransformerRule.Visibility visibility, AccessTransformerRule.FinalChange finalChange, String owner, String member, String descriptor) extends Record
One Forge-style access-transformer rule: <access>[+f|-f] <owner> [<member> [<descriptor>]]. owner is given in named (deobfuscated) form and translated to the runtime obfuscated class name via RuntimeClassMap when applied - see AccessTransformerApplier.

member/descriptor, however, are matched literally against the loaded bytecode - i.e. they need to be the class's raw obfuscated field/method name and descriptor, not a human-readable (MCP) one. This mirrors real Forge ATs, which have always referenced members by their stable SRG name for the same reason: translating a member reference through a mapping layer needs its descriptor translated too (every class name it mentions), which is a meaningfully harder problem than translating a single class name and isn't implemented here.

  • Constructor Details

    • AccessTransformerRule

      public AccessTransformerRule(AccessTransformerRule.Visibility visibility, AccessTransformerRule.FinalChange finalChange, String owner, String member, String descriptor)
      Creates an instance of a AccessTransformerRule record class.
      Parameters:
      visibility - the value for the visibility record component
      finalChange - the value for the finalChange record component
      owner - the value for the owner record component
      member - the value for the member record component
      descriptor - the value for the descriptor record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • visibility

      public AccessTransformerRule.Visibility visibility()
      Returns the value of the visibility record component.
      Returns:
      the value of the visibility record component
    • finalChange

      public AccessTransformerRule.FinalChange finalChange()
      Returns the value of the finalChange record component.
      Returns:
      the value of the finalChange record component
    • owner

      public String owner()
      Returns the value of the owner record component.
      Returns:
      the value of the owner record component
    • member

      public String member()
      Returns the value of the member record component.
      Returns:
      the value of the member record component
    • descriptor

      public String descriptor()
      Returns the value of the descriptor record component.
      Returns:
      the value of the descriptor record component