com.sun.tdk.signaturetest.core
Class Erasurator

java.lang.Object
  extended by com.sun.tdk.signaturetest.core.Erasurator

public class Erasurator
extends java.lang.Object

Class Erasurator performs "Type erasure" (see JLS Third Edition, p. 4.6) Type erasure is a mapping from types (possibly including parameterized types and type variables) to types (that are never parameterized types or type variables). We write |T| for the erasure of type T. The erasure mapping is defined as follows.

  • The erasure of a parameterized type (p3.5) G<T1, ... ,Tn> is |G|.
  • The erasure of a nested type T.C is |T|.C.
  • The erasure of an array type T[] is |T|[].
  • The erasure of a type variable (p3.4) is the erasure of its leftmost bound.
  • The erasure of every other type is the type itself. The erasure of a method signature s is a signature consisting of the same name as s, and the erasures of all the formal parameter types given in s.

  • When the Erasurator finds the definition of a generic type or method, it removes all occurrences of the type parameters and replaces them by their leftmost bound, or type Object if no bound had been specified.


    Constructor Summary
    Erasurator()
               
     
    Method Summary
     ClassDescription erasure(ClassDescription clz)
               
     ClassDescription fullErasure(ClassDescription clz)
               
     void parseTypeParameters(ClassDescription classDescr)
               
     MemberDescription processMember(MemberDescription mr)
               
    static java.util.Collection replaceFormalParameters(java.lang.String fqn, java.util.Collection members, java.util.List actualTypeParamList, boolean skipRawTypes)
               
    static MemberDescription[] replaceFormalParameters(java.lang.String fqn, MemberDescription[] members, java.util.List actualTypeParamList, boolean skipRawTypes)
               
    static java.util.ArrayList splitParameters(java.lang.String actualTypeParams)
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    Erasurator

    public Erasurator()
    Method Detail

    erasure

    public ClassDescription erasure(ClassDescription clz)

    fullErasure

    public ClassDescription fullErasure(ClassDescription clz)

    parseTypeParameters

    public void parseTypeParameters(ClassDescription classDescr)

    processMember

    public MemberDescription processMember(MemberDescription mr)

    splitParameters

    public static java.util.ArrayList splitParameters(java.lang.String actualTypeParams)

    replaceFormalParameters

    public static MemberDescription[] replaceFormalParameters(java.lang.String fqn,
                                                              MemberDescription[] members,
                                                              java.util.List actualTypeParamList,
                                                              boolean skipRawTypes)

    replaceFormalParameters

    public static java.util.Collection replaceFormalParameters(java.lang.String fqn,
                                                               java.util.Collection members,
                                                               java.util.List actualTypeParamList,
                                                               boolean skipRawTypes)