Logo Search packages:      
Sourcecode: japitools version File versions  Download package

static boolean net::wuffies::japi::Japize::isEntirelyVisible ( Type  t  )  [inline, static, package]

Determine whether a type is entirely visible. If it's not then it should be skipped. A type is entirely visible if it's a class that's entirely visible and all of its type arguments are entirely visible, or it's a primitive type, or it's an array type whose element type is entirely visible, or it's a wildcard type or type parameter whose bounds are entirely visible.

Definition at line 1114 of file Japize.java.

References getWrapper(), and isEntirelyVisible().

                                           {
    if (t == null) {
      return true;
    } else if (t instanceof PrimitiveType) {
      return true;
    } else if (t instanceof ArrayType) {
      return isEntirelyVisible(((ArrayType) t).getElementType());
    } else if (t instanceof ClassType) {
      if (!isEntirelyVisible(((ClassType) t).getWrapper())) return false;
      RefType[] args = ((ClassType) t).getTypeArguments();
      if (args != null) {
        for (int i = 0; i < args.length; i++) {
          if (!isEntirelyVisible(args[i])) return false;
        }
      }
      return true;
    } else if (t instanceof TypeParam) {
      // return true for now because otherwise we tend to get into an infinite loop on, what else,
      // Enum<T extends Enum<T>>
//      NonArrayRefType[] bounds = ((TypeParam) t).getBounds();
//      for (int i = 0; i < bounds.length; i++) {
//        if (!isEntirelyVisible(bounds[i])) return false;
//      }
      return true;
    } else if (t instanceof WildcardType) {
      NonArrayRefType upper = ((WildcardType) t).getUpperBound();
      NonArrayRefType lower = ((WildcardType) t).getLowerBound();
      if (lower != null && !isEntirelyVisible(lower)) return false;
      return isEntirelyVisible(upper);
    } else {
      throw new RuntimeException("Unknown kind of Type " + t.getClass());
    }
  }


Generated by  Doxygen 1.6.0   Back to index