kotlinpoet icon indicating copy to clipboard operation
kotlinpoet copied to clipboard

the ``typeOf `` method be confused by ``Class generics``

Open oooplz opened this issue 2 years ago • 2 comments

Describe the bug

typeOf method has totally different result when a class has generics

To Reproduce

annotation class Anno

@Anno
class Foo

@Anno
class Bar<T>

println(typeOf<Foo>().asTypeName().toString()) // Foo  ps. Expected
println(typeOf<Bar<*>>().asTypeName().toString()) // @Anno Bar<*>  ps. Unexpected

Expected behavior

annotation class Anno

@Anno
class Foo

@Anno
class Bar<T>

println(typeOf<Foo>().asTypeName().toString()) // Foo
println(typeOf<Bar<*>>().asTypeName().toString()) // Bar

Additional context Add any other context about the problem here.

oooplz avatar Dec 05 '22 09:12 oooplz

This seems more like an inconsistency with typeOf()?

ZacSweers avatar Dec 05 '22 22:12 ZacSweers

Yes, it's make more sense.

oooplz avatar Dec 06 '22 00:12 oooplz