MCPcopy Index your code
hub / github.com/beanshell/beanshell / isSignatureVarargsAssignable

Method isSignatureVarargsAssignable

src/bsh/Types.java:230–259  ·  view source on GitHub ↗
(
        Class<?>[] from, Class<?>[] to )

Source from the content-addressed store, hash-verified

228 }
229
230 private static boolean isSignatureVarargsAssignable(
231 Class<?>[] from, Class<?>[] to )
232 {
233 if ( to.length == 0 || to.length > from.length + 1 )
234 return false;
235
236 int last = to.length - 1;
237 if ( to[last] == null || !to[last].isArray() )
238 return false;
239
240 if ( from.length == to.length
241 && from[last] != null
242 && from[last].isArray()
243 && !isJavaAssignable(to[last].getComponentType(),
244 from[last].getComponentType()) )
245 return false;
246
247 if ( from.length >= to.length
248 && from[last] != null
249 && !from[last].isArray() )
250 for ( int i = last; i < from.length; i++ )
251 if ( !isJavaAssignable(to[last].getComponentType(), from[i]) )
252 return false;
253
254 for ( int i = 0; i < last; i++ )
255 if ( !isJavaAssignable(to[i], from[i]) )
256 return false;
257
258 return true;
259 }
260
261 /**
262 Test if a conversion of the rhsType type to the lhsType type is legal via

Callers 1

isSignatureAssignableMethod · 0.95

Calls 1

isJavaAssignableMethod · 0.95

Tested by

no test coverage detected