NJ2K: preserve annotations while converting class to object
#KT-38879 fixed
This commit is contained in:
@@ -49,7 +49,7 @@ class ClassToObjectPromotionConversion(context: NewJ2kConverterContext) : Recurs
|
|||||||
it is JKClass && it.classKind != JKClass.ClassKind.COMPANION
|
it is JKClass && it.classKind != JKClass.ClassKind.COMPANION
|
||||||
}.map { it.detached(element.classBody) }
|
}.map { it.detached(element.classBody) }
|
||||||
},
|
},
|
||||||
JKAnnotationList(),
|
element.annotationList,
|
||||||
element.otherModifierElements,
|
element.otherModifierElements,
|
||||||
element.visibilityElement,
|
element.visibilityElement,
|
||||||
JKModalityModifierElement(Modality.FINAL)
|
JKModalityModifierElement(Modality.FINAL)
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
@interface Foo
|
||||||
|
|
||||||
|
@Foo
|
||||||
|
class A {
|
||||||
|
static void bar() {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
internal annotation class Foo
|
||||||
|
|
||||||
|
@Foo
|
||||||
|
internal object A {
|
||||||
|
fun bar() {}
|
||||||
|
}
|
||||||
+5
@@ -839,6 +839,11 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
|||||||
runTest("nj2k/testData/newJ2k/class/ClassShadowing.java");
|
runTest("nj2k/testData/newJ2k/class/ClassShadowing.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("classToObjectWithAnnotations.java")
|
||||||
|
public void testClassToObjectWithAnnotations() throws Exception {
|
||||||
|
runTest("nj2k/testData/newJ2k/class/classToObjectWithAnnotations.java");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("classWithEmptyMethods.java")
|
@TestMetadata("classWithEmptyMethods.java")
|
||||||
public void testClassWithEmptyMethods() throws Exception {
|
public void testClassWithEmptyMethods() throws Exception {
|
||||||
runTest("nj2k/testData/newJ2k/class/classWithEmptyMethods.java");
|
runTest("nj2k/testData/newJ2k/class/classWithEmptyMethods.java");
|
||||||
|
|||||||
Reference in New Issue
Block a user