From 7ba39bd8cf54c0d80e706272d3b1c2d429a55b9f Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Wed, 2 Mar 2016 19:39:58 +0300 Subject: [PATCH] J2K: refactoring - AccessorBodyToExpression processing can be expressed as intention-based --- .../jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt b/idea/src/org/jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt index 582cbcdecf7..c524a063ef5 100644 --- a/idea/src/org/jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt +++ b/idea/src/org/jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt @@ -54,8 +54,8 @@ object J2KPostProcessingRegistrar { _processings.add(ConvertToStringTemplateProcessing()) _processings.add(UsePropertyAccessSyntaxProcessing()) _processings.add(RemoveRedundantSamAdaptersProcessing()) - _processings.add(AccessorBodyToExpression()) + registerIntentionBasedProcessing(ConvertToExpressionBodyIntention()) { it is KtPropertyAccessor } registerIntentionBasedProcessing(IfThenToSafeAccessIntention()) registerIntentionBasedProcessing(IfThenToElvisIntention()) registerIntentionBasedProcessing(IfNullToElvisIntention()) @@ -210,14 +210,4 @@ object J2KPostProcessingRegistrar { } } } - - private class AccessorBodyToExpression : J2kPostProcessing { - private val intention = ConvertToExpressionBodyIntention() - - override fun createAction(element: KtElement, diagnostics: Diagnostics): (() -> Unit)? { - if (element !is KtPropertyAccessor) return null - if (!intention.isApplicableTo(element)) return null - return { intention.applyTo(element, true) } - } - } } \ No newline at end of file