J2K: fixed assertion
This commit is contained in:
committed by
valentin
parent
7e147d28c2
commit
899a051a8f
@@ -26,7 +26,7 @@ class AnnotationConverter(private val converter: Converter) {
|
||||
+ listOf(CommonClassNames.JAVA_LANG_OVERRIDE)).toSet()
|
||||
|
||||
public fun convertAnnotations(owner: PsiModifierListOwner): Annotations
|
||||
= (convertAnnotationsOnly(owner) + convertModifiersToAnnotations(owner)).assignNoPrototype()
|
||||
= convertAnnotationsOnly(owner) + convertModifiersToAnnotations(owner)
|
||||
|
||||
private fun convertAnnotationsOnly(owner: PsiModifierListOwner): Annotations {
|
||||
val modifierList = owner.getModifierList()
|
||||
|
||||
@@ -242,7 +242,7 @@ class Converter private(private val elementToConvert: PsiElement,
|
||||
|
||||
val annotationAnnotation = Annotation(Identifier("annotation").assignNoPrototype(), listOf(), false, false).assignNoPrototype()
|
||||
return Class(psiClass.declarationIdentifier(),
|
||||
(convertAnnotations(psiClass) + Annotations(listOf(annotationAnnotation))).assignNoPrototype(),
|
||||
convertAnnotations(psiClass) + Annotations(listOf(annotationAnnotation)),
|
||||
convertModifiers(psiClass).without(Modifier.ABSTRACT),
|
||||
TypeParameterList.Empty(),
|
||||
listOf(),
|
||||
@@ -318,7 +318,7 @@ class Converter private(private val elementToConvert: PsiElement,
|
||||
isInOpenClass: Boolean): Member? {
|
||||
val returnType = typeConverter.convertMethodReturnType(method)
|
||||
|
||||
val annotations = (convertAnnotations(method) + convertThrows(method)).assignNoPrototype()
|
||||
val annotations = convertAnnotations(method) + convertThrows(method)
|
||||
|
||||
var modifiers = convertModifiers(method)
|
||||
if (needOpenModifier(method, isInOpenClass, modifiers)) {
|
||||
|
||||
@@ -62,7 +62,7 @@ class Annotations(val annotations: List<Annotation>) : Element() {
|
||||
override val isEmpty: Boolean
|
||||
get() = annotations.isEmpty()
|
||||
|
||||
fun plus(other: Annotations) = Annotations(annotations + other.annotations)
|
||||
fun plus(other: Annotations) = Annotations(annotations + other.annotations).assignNoPrototype()
|
||||
|
||||
class object {
|
||||
fun Empty() = Annotations(listOf())
|
||||
|
||||
+6
@@ -1059,6 +1059,12 @@ public class JavaToKotlinConverterForWebDemoTestGenerated extends AbstractJavaTo
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fieldsInitializedFromParamsAnnotations.java")
|
||||
public void testFieldsInitializedFromParamsAnnotations() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("j2k/tests/testData/fileOrElement/constructors/fieldsInitializedFromParamsAnnotations.java");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("genericIdentifier.java")
|
||||
public void testGenericIdentifier() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("j2k/tests/testData/fileOrElement/constructors/genericIdentifier.java");
|
||||
|
||||
+6
@@ -1059,6 +1059,12 @@ public class JavaToKotlinConverterSingleFileTestGenerated extends AbstractJavaTo
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fieldsInitializedFromParamsAnnotations.java")
|
||||
public void testFieldsInitializedFromParamsAnnotations() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("j2k/tests/testData/fileOrElement/constructors/fieldsInitializedFromParamsAnnotations.java");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("genericIdentifier.java")
|
||||
public void testGenericIdentifier() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("j2k/tests/testData/fileOrElement/constructors/genericIdentifier.java");
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import java.lang.Deprecated;
|
||||
import java.lang.SuppressWarnings;
|
||||
|
||||
class C {
|
||||
@Deprecated private final int p1;
|
||||
private final int myP2;
|
||||
@SuppressWarnings("x") public int p3;
|
||||
|
||||
public C(int p1, @Deprecated int p2, @Deprecated int p3) {
|
||||
this.p1 = p1;
|
||||
myP2 = p2;
|
||||
this.p3 = p3;
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import java.lang.SuppressWarnings
|
||||
|
||||
class C(deprecated("") private val p1: Int, deprecated("") private val myP2: Int, deprecated("") SuppressWarnings("x") public var p3: Int)
|
||||
Reference in New Issue
Block a user