Skip to content

Commit

Permalink
Remove the expectedMangledName
Browse files Browse the repository at this point in the history
  • Loading branch information
biboudis committed Jan 30, 2025
1 parent c51ccd9 commit b19fcfa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,15 @@ public static CallSite invokePattern(MethodHandles.Lookup lookup,
throw new IllegalArgumentException("Cannot find a pattern");
}

String expectedMangledName = PatternBytecodeName.mangle(selectorType,
Arrays.stream(selectorType.getRecordComponents())
.map(RecordComponent::getType)
.toArray(Class<?>[]::new));

if (!expectedMangledName.equals(mangledName)) {
throw new IllegalArgumentException("Unexpected pattern at use site");
}
// todo: strengthen check, erasure in mangled name for records?
// String expectedMangledName = PatternBytecodeName.mangle(selectorType,
// Arrays.stream(selectorType.getRecordComponents())
// .map(RecordComponent::getType)
// .toArray(Class<?>[]::new));
//
// if (!expectedMangledName.equals(mangledName)) {
// throw new IllegalArgumentException("\nUnexpected pattern at use site: " + mangledName + "\nWas expecting: " + expectedMangledName);
// }

target = MethodHandles.insertArguments(StaticHolders.SYNTHETIC_PATTERN, 0, selectorType).asType(invocationType);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
/**
* @test
* @enablePreview
* @compile InstanceOfStatementInPatternsTest.java
* @run main InstanceOfStatementInPatternsTest
*/
public class InstanceOfStatementInPatternsTest {
Expand Down

0 comments on commit b19fcfa

Please sign in to comment.