public interface TinyVisitor
State information should be stored in the visitor. This visitor preferably should use a stack structure to keep track of its visit state so that it collects context correctly.
The caller of the visitor needs to guarantee the state of the mapping is correct.
All descriptors in the visits are in the format of the namespace at
TinyMetadata.index(String) index} 0. Do not remap these descriptors as
you don't have access to all class mappings when you received the descriptors! It's
recommended to put the collected mappings in a Map and then use a
remapper to remap descriptors when the mapping visit is finished.
| Modifier and Type | Method and Description |
|---|---|
default void |
pop(int count)
Remove a few elements from the context stack.
|
default void |
pushClass(MappingGetter name)
Visit a class.
|
default void |
pushComment(String comment)
Visits a comment (JavaDoc).
|
default void |
pushField(MappingGetter name,
String descriptor)
Visit a field.
|
default void |
pushLocalVariable(MappingGetter name,
int localVariableIndex,
int localVariableStartOffset,
int localVariableTableIndex)
Visits a method's local variable.
|
default void |
pushMethod(MappingGetter name,
String descriptor)
Visit a method.
|
default void |
pushParameter(MappingGetter name,
int localVariableIndex)
Visits a method parameter.
|
default void |
start(TinyMetadata metadata)
Start visiting a new mapping and collect basic mapping information.
|
default void start(TinyMetadata metadata)
It's recommended to collect the index of namespaces you want to track from the metadata.
metadata - the metadata of the Tiny V2 mappingdefault void pushClass(MappingGetter name)
start(TinyMetadata) is called before this call and the visit stack
is empty.
name - the mappingsdefault void pushField(MappingGetter name, String descriptor)
pushClass(MappingGetter) is called before this call and the last
element in the visit stack is a class.
name - the mappingsdescriptor - the descriptor in the index 0 namespace's mappingdefault void pushMethod(MappingGetter name, String descriptor)
pushClass(MappingGetter) is called before this call and the last
element in the visit stack is a class.
name - the mappingsdescriptor - the descriptor in the index 0 namespace's mappingdefault void pushParameter(MappingGetter name, int localVariableIndex)
pushMethod(MappingGetter, String) (MappingGetter)} is called
before this call and the last element in the visit stack is a method.
name - the mappingslocalVariableIndex - the local variable indexdefault void pushLocalVariable(MappingGetter name, int localVariableIndex, int localVariableStartOffset, int localVariableTableIndex)
pushMethod(MappingGetter, String) (MappingGetter)} is called
before this call and the last element in the visit stack is a method.
name - the mappingslocalVariableIndex - the local variable indexlocalVariableStartOffset - the local variable start offsetlocalVariableTableIndex - the local variable table indexdefault void pushComment(String comment)
One of the other push methods is called before this call; the visit stack is not empty, and the last element in the visit stack can be commented (i.e. everything other than a comment).
comment - the commentdefault void pop(int count)
The sum of count of all pop calls should equal to the number of push calls when
each class visit is finished.
count - the number of elements removed