Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
wagyourtail committed Jun 18, 2024
2 parents 4dfcc89 + 1112b78 commit 12a317d
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions src/main/java/xyz/wagyourtail/jvmdg/version/VersionProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static void main(String[] args) {
System.out.println(Type.getType(boolean.class).getDescriptor());
}

public static FullyQualifiedMemberNameAndDesc resolveStubTarget(Member member, Ref ref) {
public FullyQualifiedMemberNameAndDesc resolveStubTarget(Member member, Ref ref) {
if (member instanceof Method) {
Method method = (Method) member;
Type owner;
Expand All @@ -65,6 +65,27 @@ public static FullyQualifiedMemberNameAndDesc resolveStubTarget(Member member, R
}
}

Class<?>[] paramClasses = method.getParameterTypes();
for (int i = 0; i < params.size(); i++) {
Adapter a = paramClasses[i].getAnnotation(Adapter.class);
if (a != null) {
String aRef = a.value();
Type t;
if (aRef.startsWith("L") && aRef.endsWith(";")) {
t = Type.getType(aRef);
} else {
t = Type.getObjectType(aRef);
}

for (VersionProvider versionProvider : downgrader.versionProviders(this.outputVersion)) {
if (versionProvider.classStubs.containsKey(t)) {
params.set(i, t);
break;
}
}
}
}

Type ret = Type.getReturnType(method);
if (ref.value().isEmpty()) {
owner = params.remove(0);
Expand Down Expand Up @@ -404,9 +425,9 @@ public MethodNode stubMethods(MethodNode method, ClassNode owner, Set<ClassNode>
AbstractInsnNode insn = method.instructions.get(i);
if (insn instanceof MethodInsnNode) {
MethodInsnNode min = (MethodInsnNode) insn;
min.owner = stubClass(Type.getObjectType(min.owner)).getInternalName();
min.desc = stubClass(Type.getMethodType(min.desc)).getDescriptor();
if (!min.owner.startsWith("[")) {
min.owner = stubClass(Type.getObjectType(min.owner)).getInternalName();
min.desc = stubClass(Type.getMethodType(min.desc)).getDescriptor();
getStubMapper(Type.getObjectType(min.owner), min.itf, memberResolver, superTypeResolver).transform(method, i, owner, extra, enableRuntime);
}
} else if (insn instanceof TypeInsnNode) {
Expand Down

0 comments on commit 12a317d

Please sign in to comment.