public DeclaredType getContainingType() {
        if (type.getEnclosingType().tag == TypeTags.CLASS) {
            // This is the type of an inner class.
            return (DeclaredType) env.typeMaker.getType(type.getEnclosingType());
        }
        ClassSymbol enclosing = type.tsym.owner.enclClass();
        if (enclosing != null) {
            // Nested but not inner.  Return the raw type of the enclosing
            // class or interface.
            // See java.lang.reflect.ParameterizedType.getOwnerType().
            return (DeclaredType) env.typeMaker.getType(
                                        env.jctypes.erasure(enclosing.type));
        }
        return null;
    }