Support enums in ultra-light classes

There's no need to add "values"/"valueOf" methods for them
(see com.intellij.psi.impl.compiled.StubBuildingVisitor#visitMethod that ignores them too)

We already have tests that check enum entries/synthetic methods
are properly resolved in Java:
idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/*Enum*
This commit is contained in:
Denis Zharkov
2018-11-21 15:54:22 +03:00
parent d5a640b82d
commit 206466f6ce
4 changed files with 83 additions and 20 deletions
+5 -7
View File
@@ -1,19 +1,18 @@
import java.util.function.*
/** should load cls */
enum class Direction {
NORTH, SOUTH, WEST, EAST
}
/** should load cls */
enum class Color(val rgb: Int) {
enum class Color(val rgb: Int = 5) {
RED(0xFF0000),
GREEN(0x00FF00),
BLUE(0x0000FF)
BLUE("0x0000FF");
constructor(y: String) : this(y.toInt())
}
/** should load cls */
enum class ProtocolState {
WAITING {
override fun signal() = TALKING
@@ -26,7 +25,6 @@ enum class ProtocolState {
abstract fun signal(): ProtocolState
}
/** should load cls */
enum class IntArithmetics : BinaryOperator<Int>, IntBinaryOperator {
PLUS {
override fun apply(t: Int, u: Int): Int = t + u
@@ -40,4 +38,4 @@ enum class IntArithmetics : BinaryOperator<Int>, IntBinaryOperator {
class C {
val enumConst: Direction? = Direction.EAST
}
}