in src/lang/Term.java [91:135]
protected static boolean convertible(Class<?> from, Class<?> to) {
if (from == null)
return ! to.isPrimitive();
if (to.isAssignableFrom(from)) {
return true;
} else if (to.isPrimitive()) {
if (from.equals(Boolean.class)) {
return to.equals(Boolean.TYPE);
} else if (from.equals(Byte.class)) {
return to.equals(Byte.TYPE)
|| to.equals(Short.TYPE)
|| to.equals(Integer.TYPE)
|| to.equals(Long.TYPE)
|| to.equals(Float.TYPE)
|| to.equals(Double.TYPE);
} else if (from.equals(Short.class)) {
return to.equals(Short.TYPE)
|| to.equals(Integer.TYPE)
|| to.equals(Long.TYPE)
|| to.equals(Float.TYPE)
|| to.equals(Double.TYPE);
} else if (from.equals(Character.class)) {
return to.equals(Character.TYPE)
|| to.equals(Integer.TYPE)
|| to.equals(Long.TYPE)
|| to.equals(Float.TYPE)
|| to.equals(Double.TYPE);
} else if (from.equals(Integer.class)) {
return to.equals(Integer.TYPE)
|| to.equals(Long.TYPE)
|| to.equals(Float.TYPE)
|| to.equals(Double.TYPE);
} else if (from.equals(Long.class)) {
return to.equals(Long.TYPE)
|| to.equals(Float.TYPE)
|| to.equals(Double.TYPE);
} else if (from.equals(Float.class)) {
return to.equals(Float.TYPE)
|| to.equals(Double.TYPE);
} else if (from.equals(Double.class)) {
return to.equals(Double.TYPE);
}
}
return false;
}