@@ -82,8 +82,6 @@ private SwitchBootstraps() {}
82
82
private static final MethodTypeDesc TYPES_SWITCH_DESCRIPTOR =
83
83
MethodTypeDesc .ofDescriptor ("(Ljava/lang/Object;ILjava/util/function/BiPredicate;Ljava/util/List;)I" );
84
84
85
- private static final Map <TypePairs , String > typePairToName ;
86
-
87
85
static {
88
86
try {
89
87
NULL_CHECK = LOOKUP .findStatic (Objects .class , "isNull" ,
@@ -99,7 +97,6 @@ private SwitchBootstraps() {}
99
97
catch (ReflectiveOperationException e ) {
100
98
throw new ExceptionInInitializerError (e );
101
99
}
102
- typePairToName = TypePairs .initialize ();
103
100
}
104
101
105
102
/**
@@ -507,7 +504,7 @@ record Element(Label target, Label next, Object caseLabel) { }
507
504
}
508
505
509
506
TypePairs typePair = TypePairs .of (Wrapper .asPrimitiveType (selectorType ), classLabel );
510
- String methodName = typePairToName .get (typePair );
507
+ String methodName = TypePairs . typePairToName .get (typePair );
511
508
cb .invokestatic (ExactConversionsSupport .class .describeConstable ().orElseThrow (),
512
509
methodName ,
513
510
MethodTypeDesc .of (ConstantDescs .CD_boolean , typePair .from .describeConstable ().orElseThrow ()));
@@ -684,13 +681,27 @@ else if (selectorType.equals(targetType) ||
684
681
685
682
// TypePairs should be in sync with the corresponding record in Lower
686
683
record TypePairs (Class <?> from , Class <?> to ) {
684
+
685
+ private static final Map <TypePairs , String > typePairToName = initialize ();
686
+
687
687
public static TypePairs of (Class <?> from , Class <?> to ) {
688
688
if (from == byte .class || from == short .class || from == char .class ) {
689
689
from = int .class ;
690
690
}
691
691
return new TypePairs (from , to );
692
692
}
693
693
694
+ public int hashCode () {
695
+ return 31 * from .hashCode () + to .hashCode ();
696
+ }
697
+
698
+ public boolean equals (Object other ) {
699
+ if (other instanceof TypePairs otherPair ) {
700
+ return otherPair .from == from && otherPair .to == to ;
701
+ }
702
+ return false ;
703
+ }
704
+
694
705
public static Map <TypePairs , String > initialize () {
695
706
Map <TypePairs , String > typePairToName = new HashMap <>();
696
707
typePairToName .put (new TypePairs (byte .class , char .class ), "isIntToCharExact" ); // redirected
0 commit comments