Skip to content

Commit

Permalink
ResolvableType ignores TypeNotPresentException from generic signature
Browse files Browse the repository at this point in the history
Closes gh-25064
  • Loading branch information
jhoeller committed May 13, 2020
1 parent 1015f79 commit 8212aaf
Showing 1 changed file with 26 additions and 11 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -464,15 +464,25 @@ public ResolvableType as(Class<?> type) {
*/
public ResolvableType getSuperType() {
Class<?> resolved = resolve();
if (resolved == null || resolved.getGenericSuperclass() == null) {
if (resolved == null) {
return NONE;
}
ResolvableType superType = this.superType;
if (superType == null) {
superType = forType(resolved.getGenericSuperclass(), this);
this.superType = superType;
try {
Type superclass = resolved.getGenericSuperclass();
if (superclass == null) {
return NONE;
}
ResolvableType superType = this.superType;
if (superType == null) {
superType = forType(superclass, this);
this.superType = superType;
}
return superType;
}
catch (TypeNotPresentException ex) {
// Ignore non-present types in generic signature
return NONE;
}
return superType;
}

/**
Expand Down Expand Up @@ -544,13 +554,18 @@ public boolean hasUnresolvableGenerics() {
}
Class<?> resolved = resolve();
if (resolved != null) {
for (Type genericInterface : resolved.getGenericInterfaces()) {
if (genericInterface instanceof Class) {
if (forClass((Class<?>) genericInterface).hasGenerics()) {
return true;
try {
for (Type genericInterface : resolved.getGenericInterfaces()) {
if (genericInterface instanceof Class) {
if (forClass((Class<?>) genericInterface).hasGenerics()) {
return true;
}
}
}
}
catch (TypeNotPresentException ex) {
// Ignore non-present types in generic signature
}
return getSuperType().hasUnresolvableGenerics();
}
return false;
Expand Down

0 comments on commit 8212aaf

Please sign in to comment.