-
-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always return a TypeParameter from resolve() (#706)
- Loading branch information
Showing
4 changed files
with
74 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/test/java/io/github/classgraph/issues/issue706/Issue706.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.github.classgraph.issues.issue706; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.github.classgraph.ClassGraph; | ||
import io.github.classgraph.ClassInfo; | ||
import io.github.classgraph.ScanResult; | ||
import io.github.classgraph.TypeArgument; | ||
import io.github.classgraph.TypeVariableSignature; | ||
|
||
public class Issue706 { | ||
static public class GenericBase<T> { | ||
} | ||
|
||
static public class GenericBypass<T> extends GenericBase<T> { | ||
} | ||
|
||
@Test | ||
void genericSuperclass() { | ||
final ScanResult scanResult = new ClassGraph().acceptPackages(Issue706.class.getPackage().getName()) | ||
.enableClassInfo().scan(); | ||
final ClassInfo bypassCls = scanResult.getClassInfo(GenericBypass.class.getName()); | ||
final TypeArgument superclassArg = bypassCls.getTypeSignature().getSuperclassSignature() | ||
.getSuffixTypeArguments().get(0).get(0); | ||
final TypeVariableSignature superclassArgTVar = (TypeVariableSignature) superclassArg.getTypeSignature(); | ||
final Object bypassTParamFromSuperclassArg = superclassArgTVar.resolve(); | ||
assertThat(bypassTParamFromSuperclassArg.toString()).isEqualTo("T"); | ||
} | ||
} |