src/share/classes/com/sun/tools/javac/code/Type.java

changeset 635
dc550520ed6f
parent 581
f2fdd52e4e87
child 640
995bcdb9a41d
equal deleted inserted replaced
634:27bae58329d5 635:dc550520ed6f
345 l = l.tail) 345 l = l.tail)
346 if (l.head.contains(t)) return true; 346 if (l.head.contains(t)) return true;
347 return false; 347 return false;
348 } 348 }
349 349
350 /** Does this type contain an occurrence of some type in `elems'? 350 /** Does this type contain an occurrence of some type in 'ts'?
351 */ 351 */
352 public boolean containsSome(List<Type> ts) { 352 public boolean containsAny(List<Type> ts) {
353 for (List<Type> l = ts; l.nonEmpty(); l = l.tail) 353 for (Type t : ts)
354 if (this.contains(ts.head)) return true; 354 if (this.contains(t)) return true;
355 return false;
356 }
357
358 public static boolean containsAny(List<Type> ts1, List<Type> ts2) {
359 for (Type t : ts1)
360 if (t.containsAny(ts2)) return true;
355 return false; 361 return false;
356 } 362 }
357 363
358 public boolean isSuperBound() { return false; } 364 public boolean isSuperBound() { return false; }
359 public boolean isExtendsBound() { return false; } 365 public boolean isExtendsBound() { return false; }
427 } 433 }
428 434
429 public WildcardType(Type type, BoundKind kind, TypeSymbol tsym, TypeVar bound) { 435 public WildcardType(Type type, BoundKind kind, TypeSymbol tsym, TypeVar bound) {
430 this(type, kind, tsym); 436 this(type, kind, tsym);
431 this.bound = bound; 437 this.bound = bound;
438 }
439
440 public boolean contains(Type t) {
441 return kind != UNBOUND && type.contains(t);
432 } 442 }
433 443
434 public boolean isSuperBound() { 444 public boolean isSuperBound() {
435 return kind == SUPER || 445 return kind == SUPER ||
436 kind == UNBOUND; 446 kind == UNBOUND;
679 689
680 public boolean contains(Type elem) { 690 public boolean contains(Type elem) {
681 return 691 return
682 elem == this 692 elem == this
683 || (isParameterized() 693 || (isParameterized()
684 && (getEnclosingType().contains(elem) || contains(getTypeArguments(), elem))); 694 && (getEnclosingType().contains(elem) || contains(getTypeArguments(), elem)))
695 || (isCompound()
696 && (supertype_field.contains(elem) || contains(interfaces_field, elem)));
685 } 697 }
686 698
687 public void complete() { 699 public void complete() {
688 if (tsym.completer != null) tsym.complete(); 700 if (tsym.completer != null) tsym.complete();
689 } 701 }

mercurial