@@ -416,7 +416,24 @@ public boolean hasGenerics() {
416
416
}
417
417
418
418
/**
419
- * Determine whether the underlying type has unresolvable generics:
419
+ * Return {@code true} if this type contains unresolvable generics only,
420
+ * that is, no substitute for any of its declared type variables.
421
+ */
422
+ boolean isEntirelyUnresolvable () {
423
+ if (this == NONE ) {
424
+ return false ;
425
+ }
426
+ ResolvableType [] generics = getGenerics ();
427
+ for (ResolvableType generic : generics ) {
428
+ if (!generic .isUnresolvableTypeVariable () && !generic .isWildcardWithoutBounds ()) {
429
+ return false ;
430
+ }
431
+ }
432
+ return true ;
433
+ }
434
+
435
+ /**
436
+ * Determine whether the underlying type has any unresolvable generics:
420
437
* either through an unresolvable type variable on the type itself
421
438
* or through implementing a generic interface in a raw fashion,
422
439
* i.e. without substituting that interface's type variables.
@@ -634,8 +651,8 @@ public Class<?>[] resolveGenerics(Class<?> fallback) {
634
651
/**
635
652
* Convenience method that will {@link #getGeneric(int...) get} and
636
653
* {@link #resolve() resolve} a specific generic parameters.
637
- * @param indexes the indexes that refer to the generic parameter (may be omitted to
638
- * return the first generic)
654
+ * @param indexes the indexes that refer to the generic parameter
655
+ * (may be omitted to return the first generic)
639
656
* @return a resolved {@link Class} or {@code null}
640
657
* @see #getGeneric(int...)
641
658
* @see #resolve()
@@ -645,11 +662,11 @@ public Class<?> resolveGeneric(int... indexes) {
645
662
}
646
663
647
664
/**
648
- * Resolve this type to a {@link java.lang.Class}, returning {@code null} if the type
649
- * cannot be resolved. This method will consider bounds of {@link TypeVariable}s and
650
- * {@link WildcardType}s if direct resolution fails; however, bounds of
651
- * {@code Object.class} will be ignored.
652
- * @return the resolved {@link Class} or {@code null}
665
+ * Resolve this type to a {@link java.lang.Class}, returning {@code null}
666
+ * if the type cannot be resolved. This method will consider bounds of
667
+ * {@link TypeVariable}s and {@link WildcardType}s if direct resolution fails;
668
+ * however, bounds of {@code Object.class} will be ignored.
669
+ * @return the resolved {@link Class}, or {@code null} if not resolvable
653
670
* @see #resolve(Class)
654
671
* @see #resolveGeneric(int...)
655
672
* @see #resolveGenerics()
0 commit comments