763 assert attributes_field != null; 764 return attributes_field; 765 } 766 767 public Type erasure(Types types) { 768 if (erasure_field == null) 769 erasure_field = new ClassType(types.erasure(type.getEnclosingType()), 770 List.<Type>nil(), this); 771 return erasure_field; 772 } 773 774 public String className() { 775 if (name.isEmpty()) 776 return 777 Log.getLocalizedString("anonymous.class", flatname); 778 else 779 return fullname.toString(); 780 } 781 782 public Name getQualifiedName() { 783 return fullname; 784 } 785 786 public Name flatName() { 787 return flatname; 788 } 789 790 public boolean isSubClass(Symbol base, Types types) { 791 if (this == base) { 792 return true; 793 } else if ((base.flags() & INTERFACE) != 0) { 794 for (Type t = type; t.tag == CLASS; t = types.supertype(t)) 795 for (List<Type> is = types.interfaces(t); 796 is.nonEmpty(); 797 is = is.tail) 798 if (is.head.tsym.isSubClass(base, types)) return true; 799 } else { 800 for (Type t = type; t.tag == CLASS; t = types.supertype(t)) 801 if (t.tsym == base) return true; 802 } 803 return false; | 763 assert attributes_field != null; 764 return attributes_field; 765 } 766 767 public Type erasure(Types types) { 768 if (erasure_field == null) 769 erasure_field = new ClassType(types.erasure(type.getEnclosingType()), 770 List.<Type>nil(), this); 771 return erasure_field; 772 } 773 774 public String className() { 775 if (name.isEmpty()) 776 return 777 Log.getLocalizedString("anonymous.class", flatname); 778 else 779 return fullname.toString(); 780 } 781 782 public Name getQualifiedName() { 783 if (fullname != null) 784 return fullname; 785 else // Anonymous classes have an empty name. 786 return name.table.fromString(""); 787 } 788 789 public Name flatName() { 790 return flatname; 791 } 792 793 public boolean isSubClass(Symbol base, Types types) { 794 if (this == base) { 795 return true; 796 } else if ((base.flags() & INTERFACE) != 0) { 797 for (Type t = type; t.tag == CLASS; t = types.supertype(t)) 798 for (List<Type> is = types.interfaces(t); 799 is.nonEmpty(); 800 is = is.tail) 801 if (is.head.tsym.isSubClass(base, types)) return true; 802 } else { 803 for (Type t = type; t.tag == CLASS; t = types.supertype(t)) 804 if (t.tsym == base) return true; 805 } 806 return false; |