From 8544081c4617833ab24828e379a62a905fa2d539 Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Sun, 23 Apr 2023 00:50:06 -0700 Subject: [PATCH] SLC: enable enum test case --- .../lightClassByPsi/enums.fir.java | 164 +++++++++--------- .../lightClasses/lightClassByPsi/enums.kt | 3 - .../lightClassByPsi/enums.lib.java | 87 +++++++++- 3 files changed, 166 insertions(+), 88 deletions(-) diff --git a/compiler/testData/asJava/lightClasses/lightClassByPsi/enums.fir.java b/compiler/testData/asJava/lightClasses/lightClassByPsi/enums.fir.java index 06ef6b02813..76325955366 100644 --- a/compiler/testData/asJava/lightClasses/lightClassByPsi/enums.fir.java +++ b/compiler/testData/asJava/lightClasses/lightClassByPsi/enums.fir.java @@ -1,5 +1,34 @@ -@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) -public abstract @interface Some /* Some*/ { +public final class C /* C*/ { + @org.jetbrains.annotations.Nullable() + private final Direction enumConst = Direction.EAST /* initializer type: Direction */; + + @org.jetbrains.annotations.Nullable() + public final Direction getEnumConst();// getEnumConst() + + public C();// .ctor() +} + +public enum Color /* Color*/ { + RED, + GREEN, + BLUE; + + private final int rgb = 5 /* initializer type: int */; + + @org.jetbrains.annotations.NotNull() + public static Color valueOf(java.lang.String) throws java.lang.IllegalArgumentException, java.lang.NullPointerException;// valueOf(java.lang.String) + + @org.jetbrains.annotations.NotNull() + public static Color[] values();// values() + + @org.jetbrains.annotations.NotNull() + public static kotlin.enums.EnumEntries getEntries();// getEntries() + + private Color(int);// .ctor(int) + + private Color(java.lang.String);// .ctor(java.lang.String) + + public final int getRgb();// getRgb() } public enum Direction /* Direction*/ { @@ -9,133 +38,108 @@ public enum Direction /* Direction*/ { EAST; @org.jetbrains.annotations.NotNull() - public static Direction valueOf(@org.jetbrains.annotations.NotNull() java.lang.String) throws java.lang.IllegalArgumentException;// valueOf(java.lang.String) + public static Direction valueOf(java.lang.String) throws java.lang.IllegalArgumentException, java.lang.NullPointerException;// valueOf(java.lang.String) @org.jetbrains.annotations.NotNull() public static Direction[] values();// values() - private Direction();// .ctor() + @org.jetbrains.annotations.NotNull() + public static kotlin.enums.EnumEntries getEntries();// getEntries() + private Direction();// .ctor() } -public enum Color /* Color*/ { - RED, - GREEN, - BLUE; +public enum IntArithmetics /* IntArithmetics*/ implements BinaryOperator, IntBinaryOperator { + PLUS { + PLUS();// .ctor() - private final int rgb; + @java.lang.Override() + public int apply(int, int);// apply(int, int) + }, + TIMES { + TIMES();// .ctor() + + @java.lang.Override() + public int apply(int, int);// apply(int, int) + }; + + @java.lang.Override() + @org.jetbrains.annotations.NotNull() + public IntArithmetics applyAsInt(int, int);// applyAsInt(int, int) @org.jetbrains.annotations.NotNull() - public static Color valueOf(@org.jetbrains.annotations.NotNull() java.lang.String) throws java.lang.IllegalArgumentException;// valueOf(java.lang.String) + public static IntArithmetics valueOf(java.lang.String) throws java.lang.IllegalArgumentException, java.lang.NullPointerException;// valueOf(java.lang.String) @org.jetbrains.annotations.NotNull() - public static Color[] values();// values() + public static IntArithmetics[] values();// values() - private Color(int);// .ctor(int) + @org.jetbrains.annotations.NotNull() + public static kotlin.enums.EnumEntries getEntries();// getEntries() - private Color(java.lang.String);// .ctor(java.lang.String) + private IntArithmetics();// .ctor() +} - public final int getRgb();// getRgb() +static final class PLUS /* IntArithmetics.PLUS*/ extends IntArithmetics { + PLUS();// .ctor() + @java.lang.Override() + public int apply(int, int);// apply(int, int) } public enum ProtocolState /* ProtocolState*/ { WAITING { - WAITING();// .ctor() - - @java.lang.Override() - @org.jetbrains.annotations.NotNull() - public ProtocolState signal();// signal() + WAITING();// .ctor() + @java.lang.Override() + @org.jetbrains.annotations.NotNull() + public ProtocolState signal();// signal() }, TALKING { - TALKING();// .ctor() - - @java.lang.Override() - @org.jetbrains.annotations.NotNull() - public ProtocolState signal();// signal() + TALKING();// .ctor() + @java.lang.Override() + @org.jetbrains.annotations.NotNull() + public ProtocolState signal();// signal() }; @org.jetbrains.annotations.NotNull() public abstract ProtocolState signal();// signal() @org.jetbrains.annotations.NotNull() - public static ProtocolState valueOf(@org.jetbrains.annotations.NotNull() java.lang.String) throws java.lang.IllegalArgumentException;// valueOf(java.lang.String) + public static ProtocolState valueOf(java.lang.String) throws java.lang.IllegalArgumentException, java.lang.NullPointerException;// valueOf(java.lang.String) @org.jetbrains.annotations.NotNull() public static ProtocolState[] values();// values() - private ProtocolState();// .ctor() - -} - -public static final class WAITING /* ProtocolState.WAITING*/ extends ProtocolState { - WAITING();// .ctor() - - @java.lang.Override() @org.jetbrains.annotations.NotNull() - public ProtocolState signal();// signal() + public static kotlin.enums.EnumEntries getEntries();// getEntries() + private ProtocolState();// .ctor() } -public static final class TALKING /* ProtocolState.TALKING*/ extends ProtocolState { +@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) +public abstract @interface Some /* Some*/ { +} + +static final class TALKING /* ProtocolState.TALKING*/ extends ProtocolState { TALKING();// .ctor() @java.lang.Override() @org.jetbrains.annotations.NotNull() public ProtocolState signal();// signal() - } -public enum IntArithmetics /* IntArithmetics*/ { - PLUS { - PLUS();// .ctor() - - public int apply(int, int);// apply(int, int) - - }, - TIMES { - TIMES();// .ctor() - - public int apply(int, int);// apply(int, int) - - }; - - @org.jetbrains.annotations.NotNull() - public IntArithmetics applyAsInt(int, int);// applyAsInt(int, int) - - @org.jetbrains.annotations.NotNull() - public static IntArithmetics valueOf(@org.jetbrains.annotations.NotNull() java.lang.String) throws java.lang.IllegalArgumentException;// valueOf(java.lang.String) - - @org.jetbrains.annotations.NotNull() - public static IntArithmetics[] values();// values() - - private IntArithmetics();// .ctor() - -} - -public static final class PLUS /* IntArithmetics.PLUS*/ extends IntArithmetics { - PLUS();// .ctor() - - public int apply(int, int);// apply(int, int) - -} - -public static final class TIMES /* IntArithmetics.TIMES*/ extends IntArithmetics { +static final class TIMES /* IntArithmetics.TIMES*/ extends IntArithmetics { TIMES();// .ctor() + @java.lang.Override() public int apply(int, int);// apply(int, int) - } -public final class C /* C*/ { - @org.jetbrains.annotations.Nullable() - private final Direction enumConst; - - @org.jetbrains.annotations.Nullable() - public final Direction getEnumConst();// getEnumConst() - - public C();// .ctor() +static final class WAITING /* ProtocolState.WAITING*/ extends ProtocolState { + WAITING();// .ctor() + @java.lang.Override() + @org.jetbrains.annotations.NotNull() + public ProtocolState signal();// signal() } diff --git a/compiler/testData/asJava/lightClasses/lightClassByPsi/enums.kt b/compiler/testData/asJava/lightClasses/lightClassByPsi/enums.kt index 9270f455108..70dcde56c0a 100644 --- a/compiler/testData/asJava/lightClasses/lightClassByPsi/enums.kt +++ b/compiler/testData/asJava/lightClasses/lightClassByPsi/enums.kt @@ -1,6 +1,3 @@ -// IGNORE_FIR -// Ignored due to KT-53573 - import java.util.function.* annotation class Some diff --git a/compiler/testData/asJava/lightClasses/lightClassByPsi/enums.lib.java b/compiler/testData/asJava/lightClasses/lightClassByPsi/enums.lib.java index 1e0ea49be3d..0cd2b781aab 100644 --- a/compiler/testData/asJava/lightClasses/lightClassByPsi/enums.lib.java +++ b/compiler/testData/asJava/lightClasses/lightClassByPsi/enums.lib.java @@ -1,3 +1,76 @@ +public final class C /* C*/ { + @org.jetbrains.annotations.Nullable() + private final Direction enumConst; + + @org.jetbrains.annotations.Nullable() + public final Direction getEnumConst();// getEnumConst() + + public C();// .ctor() +} + +public enum Color /* Color*/ { + RED, + GREEN, + BLUE; + + private final int rgb; + + @org.jetbrains.annotations.NotNull() + public static Color valueOf(java.lang.String) throws java.lang.IllegalArgumentException, java.lang.NullPointerException;// valueOf(java.lang.String) + + @org.jetbrains.annotations.NotNull() + public static Color[] values();// values() + + @org.jetbrains.annotations.NotNull() + public static kotlin.enums.EnumEntries getEntries();// getEntries() + + private Color(int);// .ctor(int) + + private Color(java.lang.String);// .ctor(java.lang.String) + + public final int getRgb();// getRgb() +} + +public enum Direction /* Direction*/ { + @Some() NORTH, + SOUTH, + WEST, + EAST; + + @org.jetbrains.annotations.NotNull() + public static Direction valueOf(java.lang.String) throws java.lang.IllegalArgumentException, java.lang.NullPointerException;// valueOf(java.lang.String) + + @org.jetbrains.annotations.NotNull() + public static Direction[] values();// values() + + @org.jetbrains.annotations.NotNull() + public static kotlin.enums.EnumEntries getEntries();// getEntries() + + private Direction();// .ctor() +} + +public abstract enum IntArithmetics /* IntArithmetics*/ implements java.util.function.BinaryOperator, java.util.function.IntBinaryOperator { + PLUS, + TIMES; + + @org.jetbrains.annotations.NotNull() + public static IntArithmetics valueOf(java.lang.String) throws java.lang.IllegalArgumentException, java.lang.NullPointerException;// valueOf(java.lang.String) + + @org.jetbrains.annotations.NotNull() + public static IntArithmetics[] values();// values() + + @org.jetbrains.annotations.NotNull() + public static kotlin.enums.EnumEntries getEntries();// getEntries() + + private IntArithmetics();// .ctor() + + public int applyAsInt(int, int);// applyAsInt(int, int) + + class PLUS ... + + class TIMES ... +} + public abstract enum ProtocolState /* ProtocolState*/ { WAITING, TALKING; @@ -6,17 +79,21 @@ public abstract enum ProtocolState /* ProtocolState*/ { public abstract ProtocolState signal();// signal() @org.jetbrains.annotations.NotNull() - public static ProtocolState valueOf(@org.jetbrains.annotations.NotNull() java.lang.String) throws java.lang.IllegalArgumentException;// valueOf(java.lang.String) + public static ProtocolState valueOf(java.lang.String) throws java.lang.IllegalArgumentException, java.lang.NullPointerException;// valueOf(java.lang.String) @org.jetbrains.annotations.NotNull() public static ProtocolState[] values();// values() + @org.jetbrains.annotations.NotNull() + public static kotlin.enums.EnumEntries getEntries();// getEntries() + private ProtocolState();// .ctor() - - class TALKING ... - class WAITING ... + class WAITING ... +} - } +@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) +public abstract @interface Some /* Some*/ { +}