Why does IntelliJ's Java to Kotlin converter conve...
# announcements
p
Why does IntelliJ's Java to Kotlin converter convert this
Copy code
class A<T> {}
to
Copy code
class <A?> {}
in Kotlin ?
d
Because in Java everything can be null. You can probably use
@NotNull
annotations, but I am not sure if they will work on type parameters.
w
🤔 Here, in Android Studio 4.0 Canary 4.
Copy code
public class AAA<T> {

}
This Java got converted to
Copy code
class AAA<T>
p
well I'm sad now
lol
i
@Pacane Hi! I can't reproduce the problem with my IDEA and on try.kotlinlang.org. Your code is converted to
internal class A<T>
p
Lol
p
I'm using IntelliJ IDEA 2019.3 (Ultimate Edition) Build #IU-193.5233.102, built on November 27, 2019 FYI
w
I have that as well, let me check
Nope, same result as in Android Studio from my previous message.
Copy code
IntelliJ IDEA 2019.3 (Community Edition)
Build #IC-193.5233.102, built on November 27, 2019
i
Can't reproduce with IntelliJ IDEA 2019.3 (Ultimate Edition) Build #IU-193.5233.102, built on November 28, 2019
Is it only code in your file?
p
no
i
What version of Kotlin do you use?
Can you attach the full code?
p
id 'org.jetbrains.kotlin.jvm' version '1.3.60'
let me try to get a minimal reproducible code
ok got it
Copy code
public interface A {
}

class B<T extends A> {
  
}
A.java
I do CTRL+ALT+SHIFT+K to convert to Kotlin in IntelliJ
end up with this
Copy code
interface A
internal class B<T : A?>
not exactly the same
but still
l
Ah, it's Java to Kotlin converter
I thought it was the Type Inference
p
yeah it's the converter
i
ASFAIU this is a bug:
Copy code
interface A {
}
class B<T extends @NotNull A> {
}
This code should be converted to not nullable type
But it doesn't
p
yeah I tried it as well
i
Can you create an issue in https://youtrack.jetbrains.com/issues/KT ? If you can't I can do it for you
p
Yeah I'll open it and I'll give you the link so you can comment whatever useful information you have
I'm kinda new to kotlin so.
what tag should I use?
nvm I can't tag issues
i
thank you! Just create an issue, we'll do everything else
p