Skip to content

Commit

Permalink
Updated fix for invokeinterface
Browse files Browse the repository at this point in the history
The previous fix for invokeinterface was broken, fixing it properly
  • Loading branch information
ogolberg authored Feb 26, 2024
1 parent 3fabc75 commit 03681a5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
12 changes: 4 additions & 8 deletions core/src/main/kotlin/com/toasttab/expediter/Expediter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,12 @@ private class MemberWithDeclaringType(
)

private fun <M : MemberType> ResolvedTypeHierarchy.CompleteTypeHierarchy.filterToAccessType(access: MemberAccess<M>): Sequence<Type> {
return if (access !is MemberAccess.MethodAccess ||
access.accessType == MethodAccessType.VIRTUAL ||
access.accessType == MethodAccessType.STATIC ||
(access.accessType == MethodAccessType.SPECIAL && !access.ref.isConstructor())
) {
// fields and methods, except for constructors can be declared on any type in the hierarchy
allTypes
} else {
return if (access is MemberAccess.MethodAccess && access.accessType == MethodAccessType.SPECIAL && access.ref.isConstructor()) {
// constructors must always be declared by the type being constructed
sequenceOf(type)
} else {
// fields and methods, except for constructors can be declared on any type in the hierarchy
allTypes
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.lang.invoke.VarHandle;
import java.util.Arrays;
import java.util.List;
import java.util.SortedSet;

public class CallerNegative {
private int x;
Expand All @@ -45,6 +46,10 @@ String toStringOnInterfaceIsOk(List<String> list) {
return list.toString();
}

int inheritedInterfaceMethodIsOk(SortedSet<String> set) {
return set.size();
}

void privateAccessToNestedIsOk() {
new Nested().f = 1;
}
Expand Down

0 comments on commit 03681a5

Please sign in to comment.