Skip to content

Commit ca970c8

Browse files
committed
apirecorder: handle super method invocations on interfaces
for some reason these have weird types that normal TypeName.super.method invocations do not
1 parent b86a77c commit ca970c8

4 files changed

Lines changed: 11 additions & 3 deletions

File tree

apirecorder/src/main/java/net/runelite/pluginhub/apirecorder/RecordingTreeScanner.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,12 @@ public Void visitIdentifier(IdentifierTree node, Void unused)
117117
@Override
118118
public Void visitMemberSelect(MemberSelectTree node, Void unused)
119119
{
120-
TypeMirror receiver = trees.getTypeMirror(new TreePath(getCurrentPath(), node.getExpression()));
121-
recordElement(trees.getElement(getCurrentPath()), receiver);
120+
// if we are super-ing then the receiver is already recorded
121+
if (!node.getIdentifier().contentEquals("super"))
122+
{
123+
TypeMirror receiver = trees.getTypeMirror(new TreePath(getCurrentPath(), node.getExpression()));
124+
recordElement(trees.getElement(getCurrentPath()), receiver);
125+
}
122126
return super.visitMemberSelect(node, unused);
123127
}
124128

apirecorder/src/test/resources/net/runelite/pluginhub/apirecorder/expected.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Lnet/runelite/pluginhub/apirecorder/test/core/CoreConstants;b
88
Lnet/runelite/pluginhub/apirecorder/test/core/CoreEnum;.FIRST:Lnet/runelite/pluginhub/apirecorder/test/core/CoreEnum;:bsf:
99
Lnet/runelite/pluginhub/apirecorder/test/core/CoreEnum;bf
1010
Lnet/runelite/pluginhub/apirecorder/test/core/CoreGrandparent;.grandparentMethod()V:b
11+
Lnet/runelite/pluginhub/apirecorder/test/core/CoreInterfaceBase;.baseMethod()V:b
1112
Lnet/runelite/pluginhub/apirecorder/test/core/CoreInterfaceChild;>Lnet/runelite/pluginhub/apirecorder/test/core/CoreInterfaceBase;
1213
Lnet/runelite/pluginhub/apirecorder/test/core/CoreInterfaceChild;aib
1314
Lnet/runelite/pluginhub/apirecorder/test/core/CoreParent;>Lnet/runelite/pluginhub/apirecorder/test/core/CoreGrandparent;

apirecorder/src/testCore/java/net/runelite/pluginhub/apirecorder/test/core/CoreInterfaceBase.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22

33
public interface CoreInterfaceBase
44
{
5-
void baseMethod();
5+
default void baseMethod()
6+
{
7+
}
68
}

apirecorder/src/testPlugin/java/net/runelite/pluginhub/apirecorder/test/plugin/ImplementsInterface.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ public class ImplementsInterface implements CoreInterfaceChild
77
@Override
88
public void baseMethod()
99
{
10+
CoreInterfaceChild.super.baseMethod();
1011
}
1112

1213
@Override

0 commit comments

Comments
 (0)