Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolver#getJvmCheckedException results in <ERROR TYPE> when throwing type variable. #1460

bcorso opened this issue Jul 19, 2023 · 1 comment · Fixed by #1680


Copy link

bcorso commented Jul 19, 2023

To reproduce this, define the following java class with a method that throws a type variable:

class MyClass {
  <T extends Throwable> void method() throws T {}

Alternatively, the type variable can also be defined on the class:

class MyClass<T extends Throwable> {
  void method() throws T {}

Then inspect the thrown types:

val myClass = resolver.getClassDeclarationByName(resolver.getKSNameFromString("MyClass"))
myClass?.getAllFunctions()?.forEach { method ->
  println("${method}: ${resolver.getJvmCheckedException(method).toList()}")


method:  [<ERROR TYPE>]
Copy link

bcorso commented Jul 19, 2023

Another thing I noticed is that the <ERROR TYPE> only happens when inspecting the type from source.

If we inspect using a precompiled class for MyClass, then we get:

method: [Throwable]

However, this also seems wrong, as I would expect the type to be the type parameter T:

method: [T]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging a pull request may close this issue.

3 participants