src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBeansLinker.java

Print this page




 108             return handleType == Object.class && fromType == Object.class;
 109         }
 110 
 111         @Override
 112         public MethodHandle getTypeConverter(final Class<?> sourceType, final Class<?> targetType) {
 113             return linkerServices.getTypeConverter(sourceType, targetType);
 114         }
 115 
 116         @Override
 117         public boolean canConvert(final Class<?> from, final Class<?> to) {
 118             return linkerServices.canConvert(from, to);
 119         }
 120 
 121         @Override
 122         public GuardedInvocation getGuardedInvocation(final LinkRequest linkRequest) throws Exception {
 123             return linkerServices.getGuardedInvocation(linkRequest);
 124         }
 125 
 126         @Override
 127         public Comparison compareConversion(final Class<?> sourceType, final Class<?> targetType1, final Class<?> targetType2) {









 128             return linkerServices.compareConversion(sourceType, targetType1, targetType2);
 129         }
 130     }
 131 }


 108             return handleType == Object.class && fromType == Object.class;
 109         }
 110 
 111         @Override
 112         public MethodHandle getTypeConverter(final Class<?> sourceType, final Class<?> targetType) {
 113             return linkerServices.getTypeConverter(sourceType, targetType);
 114         }
 115 
 116         @Override
 117         public boolean canConvert(final Class<?> from, final Class<?> to) {
 118             return linkerServices.canConvert(from, to);
 119         }
 120 
 121         @Override
 122         public GuardedInvocation getGuardedInvocation(final LinkRequest linkRequest) throws Exception {
 123             return linkerServices.getGuardedInvocation(linkRequest);
 124         }
 125 
 126         @Override
 127         public Comparison compareConversion(final Class<?> sourceType, final Class<?> targetType1, final Class<?> targetType2) {
 128             if (sourceType == ConsString.class) {
 129                 if (String.class == targetType1 || CharSequence.class == targetType1) {
 130                     return Comparison.TYPE_1_BETTER;
 131                 }
 132 
 133                 if (String.class == targetType2 || CharSequence.class == targetType2) {
 134                     return Comparison.TYPE_2_BETTER;
 135                 }
 136             }
 137             return linkerServices.compareConversion(sourceType, targetType1, targetType2);
 138         }
 139     }
 140 }