Interpreting the types method of Javac 2

Source: Internet
Author: User

2. Assuper () method

/**     * Return the (most specific) base type of t this starts with the     * given symbol.  If none exists, return null.     *     * @param t a type     * @param sym a symbol     *    /public type assuper (type T, symbol Sym) {        return assup Er.visit (t, sym);    }

The Assuper object is defined as follows:

 Private simplevisitor<type,symbol> Assuper = new simplevisitor<type,symbol> () {public Type Visitt            Ype (Type T, Symbol sym) {return null;                    } @Override Public Type visitclasstype (ClassType T, Symbol sym) {if (T.tsym = = sym)                return t;                Type st = supertype (t);                    if (St.tag = = CLASS | | st.tag = = Typevar | | st.tag = = ERROR) {Type x = Assuper (St, sym);                if (x = null) return x; } if ((Sym.flags () & INTERFACE)! = 0) {for (list<type> L = interfaces (t); L.N Onempty ();                        L = l.tail) {Type x = Assuper (L.head, sym);                    if (x = null) return x;            }} return null; } @Override Public Type visitarraytype (ARRAytype T, Symbol sym) {return Issubtype (T, sym.type)? Sym.type:null;                    } @Override Public Type Visittypevar (Typevar T, Symbol sym) {if (T.tsym = = sym)                return t;            else return Assuper (T.bound, sym);            } @Override Public Type visiterrortype (ErrorType T, Symbol sym) {return t;   }};

  

By implementing the code you can see that the ClassType, ArrayType, and typevariable are handled. Where the sym symbol is found in T and its parent and implemented interfaces, because T is an array type, the symbol can only be clonable and serializable

Interpreting the types method of Javac 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.