Beispiel #1
0
 /** Return true if the given type is 'void' or 'Void'. */
 public static boolean isVoidType(Type type, VisitorState state) {
   if (type == null) {
     return false;
   }
   return type.getKind() == TypeKind.VOID
       || state.getTypes().isSameType(Suppliers.JAVA_LANG_VOID_TYPE.get(state), type);
 }
Beispiel #2
0
 public WildcardType getWildcardType(TypeMirror extendsBound, TypeMirror superBound) {
   BoundKind bkind;
   Type bound;
   if (extendsBound == null && superBound == null) {
     bkind = BoundKind.UNBOUND;
     bound = syms.objectType;
   } else if (superBound == null) {
     bkind = BoundKind.EXTENDS;
     bound = (Type) extendsBound;
   } else if (extendsBound == null) {
     bkind = BoundKind.SUPER;
     bound = (Type) superBound;
   } else {
     throw new IllegalArgumentException("Extends and super bounds cannot both be provided");
   }
   switch (bound.getKind()) {
     case ARRAY:
     case DECLARED:
     case ERROR:
     case TYPEVAR:
       return new Type.WildcardType(bound, bkind, syms.boundClass);
     default:
       throw new IllegalArgumentException(bound.toString());
   }
 }
  protected void printType(String label, Type type, Details details) {
    if (type == null) printNull(label);
    else {
      switch (details) {
        case SUMMARY:
          printString(label, toString(type));
          break;

        case FULL:
          indent();
          out.print(label);
          out.println(
              ": " + info(type.getClass(), type.getTag(), type.getKind()) + " " + hashString(type));

          indent(+1);
          printSymbol("tsym", type.tsym, Details.SUMMARY);
          printObject("constValue", type.constValue(), Details.SUMMARY);
          printObject("annotations", type.getAnnotationMirrors(), Details.SUMMARY);
          type.accept(typeVisitor, null);
          indent(-1);
      }
    }
  }