从TypeElement获取超类
// from 时 代 J a v a 公 众 号 - nowjava.com //package com.nowjava; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; import javax.lang.model.type.DeclaredType; import javax.lang.model.type.TypeMirror; public class Main { public static TypeElement getSuperClass(TypeElement element) { TypeMirror parent = element.getSuperclass(); if (parent instanceof DeclaredType) { Element elt = ((DeclaredType) parent).asElement(); if (elt instanceof TypeElement) {