mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[kotlin] J2K: Document some JK tree conversions
GitOrigin-RevId: 82436d73ee980a5d04e4da077199d65f104c6477
This commit is contained in:
committed by
intellij-monorepo-bot
parent
79af0dbadd
commit
7e45bd374c
+9
@@ -8,6 +8,15 @@ import org.jetbrains.kotlin.nj2k.tree.*
|
||||
import org.jetbrains.kotlin.nj2k.types.*
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
|
||||
/**
|
||||
* Converts Java-specific statements to Kotlin statements:
|
||||
* * `assert` statement
|
||||
* * `synchronized` statement
|
||||
* * Try-with-resources or `try` with multiple `catch` blocks
|
||||
* * A so-called "guard clause" of the form
|
||||
* `if (param == null) throw new IllegalArgumentException("error message")` to a more idiomatic Kotlin
|
||||
* `requireNotNull` call (disabled in basic mode)
|
||||
*/
|
||||
class JavaStatementConversion(context: NewJ2kConverterContext) : RecursiveConversion(context) {
|
||||
context(KtAnalysisSession)
|
||||
override fun applyToElement(element: JKTreeElement): JKTreeElement {
|
||||
|
||||
+6
@@ -10,6 +10,12 @@ import org.jetbrains.kotlin.nj2k.tree.*
|
||||
import org.jetbrains.kotlin.nj2k.types.asPrimitiveType
|
||||
import org.jetbrains.kotlin.nj2k.types.isFloatingPoint
|
||||
|
||||
/**
|
||||
* A code style conversion (disabled in basic mode) that simplifies negated binary expressions
|
||||
* of the form `!(a > b)` -> `a <= b`.
|
||||
*
|
||||
* This is a J2K equivalent of `SimplifyNegatedBinaryExpressionInspection`.
|
||||
*/
|
||||
class SimplifyNegatedBinaryExpressionConversion(context: NewJ2kConverterContext) : RecursiveConversion(context) {
|
||||
override fun isEnabledInBasicMode(): Boolean = false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user