New J2K: Add DefaultNullabilityToNullableConversion

This commit is contained in:
Ilya Kirillov
2018-12-24 12:54:26 +03:00
committed by Ilya Kirillov
parent 3d62734cc6
commit 295a160f60
@@ -0,0 +1,20 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.j2k.conversions
import org.jetbrains.kotlin.j2k.ast.Nullability
import org.jetbrains.kotlin.j2k.tree.*
import org.jetbrains.kotlin.j2k.tree.impl.JKTypeElementImpl
class DefaultNullabilityToNullableConversion : RecursiveApplicableConversionBase() {
override fun applyToElement(element: JKTreeElement): JKTreeElement {
if (element !is JKTypeElementImpl) return recurse(element)
if (element.type.nullability != Nullability.Default) return recurse(element)
return recurse(
JKTypeElementImpl(element.type.updateNullability(Nullability.Nullable))
)
}
}