Example #1
0
    private boolean isInstanceOf(TypeMirror typeMirror, Class type) {
      if (!(typeMirror instanceof DeclaredType)) {
        return false;
      }

      if (typeMirror.toString().startsWith(type.getName())) {
        return true;
      }

      DeclaredType declaredType = (DeclaredType) typeMirror;
      TypeElement typeElement = (TypeElement) declaredType.asElement();
      for (TypeMirror iface : typeElement.getInterfaces()) {
        if (isInstanceOf(iface, type)) {
          return true;
        }
      }
      return isInstanceOf(typeElement.getSuperclass(), type);
    }
Example #2
0
 private void checkInterfaces(TypeElement te, String expect) {
   System.err.println("check interfaces: " + te + " -- " + expect);
   String found = asString(te.getInterfaces(), ", ");
   checkEqual("interfaces", te, found, expect);
 }