https://kotlinlang.org logo
#announcements
Title
# announcements
p

Pacane

12/04/2019, 3:12 PM
Why does IntelliJ's Java to Kotlin converter convert this
Copy code
class A<T> {}
to
Copy code
class <A?> {}
in Kotlin ?
d

diesieben07

12/04/2019, 3:19 PM
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

wbertan

12/04/2019, 3:22 PM
🤔 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

Pacane

12/04/2019, 3:22 PM
well I'm sad now
lol
i

Ivan Kubyshkin [JetBrains]

12/04/2019, 3:22 PM
@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

pascalchidi

12/04/2019, 3:22 PM
Lol
p

Pacane

12/04/2019, 3:23 PM
I'm using IntelliJ IDEA 2019.3 (Ultimate Edition) Build #IU-193.5233.102, built on November 27, 2019 FYI
w

wbertan

12/04/2019, 3:23 PM
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

Ivan Kubyshkin [JetBrains]

12/04/2019, 3:25 PM
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

Pacane

12/04/2019, 3:26 PM
no
i

Ivan Kubyshkin [JetBrains]

12/04/2019, 3:26 PM
What version of Kotlin do you use?
Can you attach the full code?
p

Pacane

12/04/2019, 3:26 PM
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

LeoColman

12/04/2019, 3:37 PM
Ah, it's Java to Kotlin converter
I thought it was the Type Inference
p

Pacane

12/04/2019, 3:37 PM
yeah it's the converter
i

Ivan Kubyshkin [JetBrains]

12/04/2019, 3:43 PM
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

Pacane

12/04/2019, 3:44 PM
yeah I tried it as well
i

Ivan Kubyshkin [JetBrains]

12/04/2019, 3:46 PM
Can you create an issue in https://youtrack.jetbrains.com/issues/KT ? If you can't I can do it for you
p

Pacane

12/04/2019, 3:47 PM
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

Ivan Kubyshkin [JetBrains]

12/04/2019, 3:49 PM
thank you! Just create an issue, we'll do everything else
p

Pacane

12/04/2019, 3:51 PM