631 Type otherType = other.getClassDeclaration().getType();
632 boolean result = isMoreSpecific(bestType, otherType)
633 && isApplicable(other, best.getType().getArgumentTypes());
634 // System.out.println("isMoreSpecific: " + best + "/" + other
635 // + " => " + result);
636 return result;
637 }
638
639 /**
640 * Returns true if "from" is a more specific type than "to"
641 */
642
643 public boolean isMoreSpecific(Type from, Type to) throws ClassNotFound {
644 return implicitCast(from, to);
645 }
646
647 /**
648 * Return true if an implicit cast from this type to
649 * the given type is allowed.
650 */
651 public boolean implicitCast(Type from, Type to) throws ClassNotFound {
652 if (from == to)
653 return true;
654
655 int toTypeCode = to.getTypeCode();
656
657 switch(from.getTypeCode()) {
658 case TC_BYTE:
659 if (toTypeCode == TC_SHORT)
660 return true;
661 case TC_SHORT:
662 case TC_CHAR:
663 if (toTypeCode == TC_INT) return true;
664 case TC_INT:
665 if (toTypeCode == TC_LONG) return true;
666 case TC_LONG:
667 if (toTypeCode == TC_FLOAT) return true;
668 case TC_FLOAT:
669 if (toTypeCode == TC_DOUBLE) return true;
670 case TC_DOUBLE:
|
631 Type otherType = other.getClassDeclaration().getType();
632 boolean result = isMoreSpecific(bestType, otherType)
633 && isApplicable(other, best.getType().getArgumentTypes());
634 // System.out.println("isMoreSpecific: " + best + "/" + other
635 // + " => " + result);
636 return result;
637 }
638
639 /**
640 * Returns true if "from" is a more specific type than "to"
641 */
642
643 public boolean isMoreSpecific(Type from, Type to) throws ClassNotFound {
644 return implicitCast(from, to);
645 }
646
647 /**
648 * Return true if an implicit cast from this type to
649 * the given type is allowed.
650 */
651 @SuppressWarnings("fallthrough")
652 public boolean implicitCast(Type from, Type to) throws ClassNotFound {
653 if (from == to)
654 return true;
655
656 int toTypeCode = to.getTypeCode();
657
658 switch(from.getTypeCode()) {
659 case TC_BYTE:
660 if (toTypeCode == TC_SHORT)
661 return true;
662 case TC_SHORT:
663 case TC_CHAR:
664 if (toTypeCode == TC_INT) return true;
665 case TC_INT:
666 if (toTypeCode == TC_LONG) return true;
667 case TC_LONG:
668 if (toTypeCode == TC_FLOAT) return true;
669 case TC_FLOAT:
670 if (toTypeCode == TC_DOUBLE) return true;
671 case TC_DOUBLE:
|