nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/ConversionComparator.java
equal
deleted
inserted
replaced
83 |
83 |
84 package jdk.internal.dynalink.linker; |
84 package jdk.internal.dynalink.linker; |
85 |
85 |
86 |
86 |
87 /** |
87 /** |
88 * Optional interface to be implemented by {@link GuardingTypeConverterFactory} implementers. Language-specific |
88 * Optional interface to be implemented by {@link GuardingTypeConverterFactory} |
89 * conversions can cause increased overloaded method resolution ambiguity, as many methods can become applicable because |
89 * implementers. Language-specific conversions can cause increased overloaded |
90 * of additional conversions. The static way of selecting the "most specific" method will fail more often, because there |
90 * method resolution ambiguity, as many methods can become applicable because of |
91 * will be multiple maximally specific method with unrelated signatures. In these cases, language runtimes can be asked |
91 * additional conversions. The static way of selecting the "most specific" |
92 * to resolve the ambiguity by expressing preferences for one conversion over the other. |
92 * method will fail more often, because there will be multiple maximally |
|
93 * specific method with unrelated signatures. In these cases, language runtimes |
|
94 * can be asked to resolve the ambiguity by expressing preferences for one |
|
95 * conversion over the other. |
93 */ |
96 */ |
94 public interface ConversionComparator { |
97 public interface ConversionComparator { |
95 /** |
98 /** |
96 * Enumeration of possible outcomes of comparing one conversion to another. |
99 * Enumeration of possible outcomes of comparing one conversion to another. |
97 */ |
100 */ |
103 /** The second conversion is better than the first one. **/ |
106 /** The second conversion is better than the first one. **/ |
104 TYPE_2_BETTER, |
107 TYPE_2_BETTER, |
105 } |
108 } |
106 |
109 |
107 /** |
110 /** |
108 * Determines which of the two target types is the preferred conversion target from a source type. |
111 * Determines which of the two target types is the preferred conversion |
|
112 * target from a source type. |
109 * @param sourceType the source type. |
113 * @param sourceType the source type. |
110 * @param targetType1 one potential target type |
114 * @param targetType1 one potential target type |
111 * @param targetType2 another potential target type. |
115 * @param targetType2 another potential target type. |
112 * @return one of Comparison constants that establish which - if any - of the target types is preferred for the |
116 * @return one of Comparison constants that establish which - if any - of |
113 * conversion. |
117 * the target types is preferred for the conversion. |
114 */ |
118 */ |
115 public Comparison compareConversion(Class<?> sourceType, Class<?> targetType1, Class<?> targetType2); |
119 public Comparison compareConversion(Class<?> sourceType, Class<?> targetType1, Class<?> targetType2); |
116 } |
120 } |