KT-7704 Intention actions on visibility modifier for quick changing it
#KT-7704 Fixed
This commit is contained in:
Generated
+2
-2
@@ -270,6 +270,7 @@
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="XML">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
<option name="TAB_SIZE" value="8" />
|
||||
</indentOptions>
|
||||
@@ -287,5 +288,4 @@
|
||||
</option>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
</project>
|
||||
@@ -22,6 +22,7 @@ import com.intellij.navigation.ItemPresentationProviders;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -255,4 +256,9 @@ public class JetClass extends JetTypeParameterListOwnerStub<KotlinClassStub> imp
|
||||
JetClassBody body = getBody();
|
||||
return body != null ? body.getSecondaryConstructors() : Collections.<JetSecondaryConstructor>emptyList();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PsiElement getClassOrTraitKeyword() {
|
||||
return findChildByType(TokenSet.create(JetTokens.CLASS_KEYWORD, JetTokens.TRAIT_KEYWORD));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class JetNamedFunction extends JetTypeParameterListOwnerStub<KotlinFuncti
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public PsiElement getFunToken() {
|
||||
public PsiElement getFunKeyword() {
|
||||
PsiElement element = findChildByType(JetTokens.FUN_KEYWORD);
|
||||
assert element != null : "'fun' must be present: " + PsiUtilPackage.getElementTextWithContext(this);
|
||||
return element;
|
||||
|
||||
@@ -52,9 +52,7 @@ internal fun addModifier(modifierList: JetModifierList, modifier: JetModifierKey
|
||||
|
||||
if (modifier == defaultVisibilityModifier) { // do not insert explicit 'internal' keyword (or 'public' for primary constructor)
|
||||
//TODO: code style option
|
||||
if (modifierToReplace != null) {
|
||||
modifierToReplace.delete()
|
||||
}
|
||||
modifierToReplace?.delete()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -72,8 +70,17 @@ internal fun addModifier(modifierList: JetModifierList, modifier: JetModifierKey
|
||||
return newModifierOrder > order
|
||||
}
|
||||
|
||||
val anchor = modifierList.getLastChild()?.siblings(forward = false)?.firstOrNull(::placeAfter)
|
||||
val lastChild = modifierList.getLastChild()
|
||||
val anchor = lastChild?.siblings(forward = false)?.firstOrNull(::placeAfter)
|
||||
modifierList.addAfter(newModifier, anchor)
|
||||
|
||||
if (anchor == lastChild) { // add line break if needed, otherwise visibility keyword may appear on previous line
|
||||
val whiteSpace = modifierList.getNextSibling() as? PsiWhiteSpace
|
||||
if (whiteSpace != null && whiteSpace.getText().contains('\n')) {
|
||||
modifierList.addAfter(whiteSpace, anchor)
|
||||
whiteSpace.delete()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -34,6 +34,8 @@ public abstract class JetSelfTargetingIntention<TElement : JetElement>(
|
||||
private val firstElementOfTypeOnly: Boolean = false
|
||||
) : IntentionAction {
|
||||
|
||||
protected val defaultText: String = text
|
||||
|
||||
protected fun setText(text: String) {
|
||||
this.text = text
|
||||
}
|
||||
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
class C {
|
||||
<spot>internal</spot> fun foo() {
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
class C {
|
||||
<spot>private</spot> fun foo() {
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention changes declaration visibility modifier to 'internal'.
|
||||
</body>
|
||||
</html>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
class C {
|
||||
<spot>private</spot> fun foo() {
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
class C {
|
||||
<spot>public</spot> fun foo() {
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention changes declaration visibility modifier to 'private'.
|
||||
</body>
|
||||
</html>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
class C {
|
||||
<spot>protected</spot> fun foo() {
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
class C {
|
||||
<spot>private</spot> fun foo() {
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention changes declaration visibility modifier to 'protected'.
|
||||
</body>
|
||||
</html>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
class C {
|
||||
<spot>public</spot> fun foo() {
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
class C {
|
||||
<spot>private</spot> fun foo() {
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention changes declaration visibility modifier to 'public'.
|
||||
</body>
|
||||
</html>
|
||||
@@ -875,11 +875,31 @@
|
||||
<category>Kotlin</category>
|
||||
</intentionAction>
|
||||
|
||||
<intentionAction>
|
||||
<className>org.jetbrains.kotlin.idea.intentions.ChangeVisibilityModifierIntention$Public</className>
|
||||
<category>Kotlin</category>
|
||||
</intentionAction>
|
||||
|
||||
<intentionAction>
|
||||
<className>org.jetbrains.kotlin.idea.intentions.ChangeVisibilityModifierIntention$Private</className>
|
||||
<category>Kotlin</category>
|
||||
</intentionAction>
|
||||
|
||||
<intentionAction>
|
||||
<className>org.jetbrains.kotlin.idea.intentions.ChangeVisibilityModifierIntention$Protected</className>
|
||||
<category>Kotlin</category>
|
||||
</intentionAction>
|
||||
|
||||
<intentionAction>
|
||||
<className>org.jetbrains.kotlin.idea.intentions.ChangeVisibilityModifierIntention$Internal</className>
|
||||
<category>Kotlin</category>
|
||||
</intentionAction>
|
||||
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.intentions.conventionNameCalls.ExplicitGetInspection"
|
||||
displayName="Explicit 'get'"
|
||||
groupName="Kotlin"
|
||||
enabledByDefault="false"
|
||||
level="WEAK WARNING"
|
||||
displayName="Explicit 'get'"
|
||||
groupName="Kotlin"
|
||||
enabledByDefault="false"
|
||||
level="WEAK WARNING"
|
||||
/>
|
||||
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.IfThenToElvisInspection"
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.intentions
|
||||
|
||||
import com.intellij.codeInsight.intention.HighPriorityAction
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiModifier
|
||||
import org.jetbrains.kotlin.lexer.JetModifierKeywordToken
|
||||
import org.jetbrains.kotlin.lexer.JetTokens
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||
|
||||
public open class ChangeVisibilityModifierIntention protected(
|
||||
val modifier: JetModifierKeywordToken
|
||||
) : JetSelfTargetingRangeIntention<JetDeclaration>(javaClass(), "Make ${modifier.getValue()}") {
|
||||
|
||||
override fun applicabilityRange(element: JetDeclaration): TextRange? {
|
||||
val modifierList = element.getModifierList()
|
||||
if (modifierList?.hasModifier(modifier) ?: false) return null
|
||||
if (modifierList?.hasModifier(JetTokens.OVERRIDE_KEYWORD) ?: false) return null
|
||||
|
||||
setText(defaultText)
|
||||
|
||||
val modifierToChange = modifierToChange(element)
|
||||
if (modifierToChange != null) {
|
||||
return modifierToChange.getTextRange()
|
||||
}
|
||||
|
||||
val defaultRange = canAddVisibilityModifier(element) ?: return null
|
||||
|
||||
val defaultVisibility = if (element is JetPrimaryConstructor) JetTokens.PUBLIC_KEYWORD else JetTokens.INTERNAL_KEYWORD
|
||||
if (modifier == defaultVisibility) return null
|
||||
|
||||
if (element is JetPrimaryConstructor && defaultRange.isEmpty()) {
|
||||
setText("Make primary constructor ${modifier.getValue()}") // otherwise it may be confusing
|
||||
}
|
||||
|
||||
return if (modifierList != null)
|
||||
TextRange(modifierList.startOffset, defaultRange.getEndOffset()) //TODO: smaller range? now it includes annotations too
|
||||
else
|
||||
defaultRange
|
||||
}
|
||||
|
||||
override fun applyTo(element: JetDeclaration, editor: Editor) {
|
||||
val modifierToChange = modifierToChange(element)
|
||||
if (modifierToChange != null) {
|
||||
val newModifier = JetPsiFactory(element).createModifierList(modifier).getModifier(modifier)!!
|
||||
modifierToChange.replace(newModifier)
|
||||
}
|
||||
else {
|
||||
element.addModifier(modifier)
|
||||
}
|
||||
}
|
||||
|
||||
private fun modifierToChange(element: JetDeclaration): PsiElement? {
|
||||
val modifierList = element.getModifierList() ?: return null
|
||||
return JetTokens.VISIBILITY_MODIFIERS.getTypes()
|
||||
.asSequence()
|
||||
.map { modifierList.getModifier(it as JetModifierKeywordToken) }
|
||||
.firstOrNull { it != null } ?: return null
|
||||
}
|
||||
|
||||
private fun canAddVisibilityModifier(declaration: JetDeclaration): TextRange? {
|
||||
if (JetPsiUtil.isLocal(declaration)) return null
|
||||
return when (declaration) {
|
||||
is JetNamedFunction -> declaration.getFunKeyword().getTextRange()
|
||||
is JetProperty -> declaration.getValOrVarNode().getTextRange()
|
||||
is JetClass -> declaration.getClassOrTraitKeyword()?.getTextRange()
|
||||
is JetObjectDeclaration -> declaration.getObjectKeyword().getTextRange()
|
||||
is JetPrimaryConstructor -> declaration.getValueParameterList()?.let { TextRange.from(it.startOffset, 0) } //TODO: use constructor keyword if exist
|
||||
is JetSecondaryConstructor -> declaration.getConstructorKeyword().getTextRange()
|
||||
is JetParameter -> declaration.getValOrVarNode()?.getTextRange()
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
public class Public : ChangeVisibilityModifierIntention(JetTokens.PUBLIC_KEYWORD), HighPriorityAction
|
||||
|
||||
public class Private : ChangeVisibilityModifierIntention(JetTokens.PRIVATE_KEYWORD), HighPriorityAction {
|
||||
override fun applicabilityRange(element: JetDeclaration): TextRange? {
|
||||
return if (canBePrivate(element)) super<ChangeVisibilityModifierIntention>.applicabilityRange(element) else null
|
||||
}
|
||||
|
||||
private fun canBePrivate(declaration: JetDeclaration): Boolean {
|
||||
if (declaration.getModifierList()?.hasModifier(JetTokens.ABSTRACT_KEYWORD) ?: false) return false
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
public class Protected : ChangeVisibilityModifierIntention(JetTokens.PROTECTED_KEYWORD) {
|
||||
override fun applicabilityRange(element: JetDeclaration): TextRange? {
|
||||
return if (canBeProtected(element)) super.applicabilityRange(element) else null
|
||||
}
|
||||
|
||||
private fun canBeProtected(declaration: JetDeclaration): Boolean {
|
||||
var parent = declaration.getParent()
|
||||
if (parent is JetClassBody) {
|
||||
parent = parent.getParent()
|
||||
}
|
||||
return parent is JetClass
|
||||
}
|
||||
}
|
||||
|
||||
public class Internal : ChangeVisibilityModifierIntention(JetTokens.INTERNAL_KEYWORD)
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class ConvertFunctionToPropertyIntention : JetSelfTargetingIntention<JetN
|
||||
originalFunction.typeFqNameToAdd?.let { function.setTypeReference(psiFactory.createType(it)) }
|
||||
}
|
||||
|
||||
function.getFunToken().replace(propertySample.getValOrVarNode().getPsi())
|
||||
function.getFunKeyword().replace(propertySample.getValOrVarNode().getPsi())
|
||||
function.getValueParameterList()?.delete()
|
||||
val insertAfter = (function.getEqualsToken() ?: function.getBodyExpression())
|
||||
?.siblings(forward = false, withItself = false)
|
||||
|
||||
@@ -67,7 +67,7 @@ public class ConvertPropertyToFunctionIntention : JetSelfTargetingIntention<JetP
|
||||
|
||||
val sampleFunction = psiFactory.createFunction("fun foo() {\n\n}");
|
||||
|
||||
property.getValOrVarNode().getPsi().replace(sampleFunction.getFunToken());
|
||||
property.getValOrVarNode().getPsi().replace(sampleFunction.getFunKeyword());
|
||||
property.addAfter(psiFactory.createParameterList("()"), property.getNameIdentifier());
|
||||
if (property.getInitializer() == null) {
|
||||
if (getter != null) {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.intentions.ChangeVisibilityModifierIntention$Internal
|
||||
@@ -0,0 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
class C {
|
||||
<caret>fun foo(){}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class C {
|
||||
<caret>public fun foo(){}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class C {
|
||||
<caret>internal fun foo(){}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.intentions.ChangeVisibilityModifierIntention$Private
|
||||
@@ -0,0 +1 @@
|
||||
<caret>class C
|
||||
@@ -0,0 +1 @@
|
||||
<caret>private class C
|
||||
@@ -0,0 +1,3 @@
|
||||
class C {
|
||||
<caret>fun foo(){}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class C {
|
||||
<caret>private fun foo(){}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<caret>object O
|
||||
@@ -0,0 +1 @@
|
||||
<caret>private object O
|
||||
@@ -0,0 +1,2 @@
|
||||
// INTENTION_TEXT: Make primary constructor private
|
||||
class C<caret>(val v: Int)
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
// INTENTION_TEXT: Make primary constructor private
|
||||
class C<caret> private (val v: Int)
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class C {
|
||||
<caret>constructor() {
|
||||
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class C {
|
||||
<caret>private constructor() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<caret>trait I
|
||||
@@ -0,0 +1 @@
|
||||
<caret>private trait I
|
||||
@@ -0,0 +1,3 @@
|
||||
class C {
|
||||
val<caret> v = 1
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class C {
|
||||
private val<caret> v = 1
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
class C(<caret>val v: Int)
|
||||
@@ -0,0 +1 @@
|
||||
class C(<caret>private val v: Int)
|
||||
@@ -0,0 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
abstract class C {
|
||||
<caret>public abstract fun foo()
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun foo() {
|
||||
<caret>val v = 1
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
// IS_APPLICABLE: false
|
||||
class C(<caret>v: Int)
|
||||
@@ -0,0 +1,3 @@
|
||||
class C {
|
||||
<caret>public fun foo(){}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class C {
|
||||
<caret>private fun foo(){}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
@deprecated("a")
|
||||
<caret>class C
|
||||
@@ -0,0 +1,2 @@
|
||||
@deprecated("a")
|
||||
private<caret> class C
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.intentions.ChangeVisibilityModifierIntention$Protected
|
||||
@@ -0,0 +1,3 @@
|
||||
abstract class C {
|
||||
<caret>abstract fun foo()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
abstract class C {
|
||||
<caret>protected abstract fun foo()
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
object O {
|
||||
<caret>public fun foo(){}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
// IS_APPLICABLE: false
|
||||
<caret>public fun String.foo(){}
|
||||
@@ -0,0 +1,3 @@
|
||||
class C {
|
||||
<caret>public fun foo(){}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class C {
|
||||
<caret>protected fun foo(){}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.intentions.ChangeVisibilityModifierIntention$Public
|
||||
@@ -0,0 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
class C {
|
||||
<caret>public fun foo(){}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class C {
|
||||
private<caret> fun foo(){}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class C {
|
||||
public<caret> fun foo(){}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: Cannot weaken access privilege 'public' for 'foo' in 'T'
|
||||
trait T {
|
||||
public fun foo()
|
||||
}
|
||||
abstract class C : T {
|
||||
<caret>protected override fun foo() {}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
// INTENTION_TEXT: Make public
|
||||
class C <caret>private (val v: Int)
|
||||
@@ -0,0 +1,2 @@
|
||||
// INTENTION_TEXT: Make public
|
||||
class C <caret>public (val v: Int)
|
||||
@@ -0,0 +1,2 @@
|
||||
// IS_APPLICABLE: false
|
||||
class C<caret>(val v: Int)
|
||||
@@ -0,0 +1,3 @@
|
||||
class C {
|
||||
<caret>private fun foo(){}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class C {
|
||||
<caret>public fun foo(){}
|
||||
}
|
||||
@@ -1936,6 +1936,201 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/intentions/changeVisibility")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ChangeVisibility extends AbstractIntentionTest {
|
||||
public void testAllFilesPresentInChangeVisibility() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/changeVisibility"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/intentions/changeVisibility/internal")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Internal extends AbstractIntentionTest {
|
||||
public void testAllFilesPresentInInternal() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/changeVisibility/internal"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("internalByDefault.kt")
|
||||
public void testInternalByDefault() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/internal/internalByDefault.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/internal/simple.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/intentions/changeVisibility/private")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Private extends AbstractIntentionTest {
|
||||
public void testAllFilesPresentInPrivate() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/changeVisibility/private"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("noModifierListClass.kt")
|
||||
public void testNoModifierListClass() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/private/noModifierListClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noModifierListFun.kt")
|
||||
public void testNoModifierListFun() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/private/noModifierListFun.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noModifierListObject.kt")
|
||||
public void testNoModifierListObject() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/private/noModifierListObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noModifierListPrimaryConstructor.kt")
|
||||
public void testNoModifierListPrimaryConstructor() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/private/noModifierListPrimaryConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noModifierListSecondaryConstructor.kt")
|
||||
public void testNoModifierListSecondaryConstructor() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/private/noModifierListSecondaryConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noModifierListTrait.kt")
|
||||
public void testNoModifierListTrait() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/private/noModifierListTrait.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noModifierListVal.kt")
|
||||
public void testNoModifierListVal() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/private/noModifierListVal.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noModifierListValParam.kt")
|
||||
public void testNoModifierListValParam() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/private/noModifierListValParam.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("notForAbstract.kt")
|
||||
public void testNotForAbstract() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/private/notForAbstract.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("notForLocal.kt")
|
||||
public void testNotForLocal() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/private/notForLocal.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("notForParameter.kt")
|
||||
public void testNotForParameter() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/private/notForParameter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/private/simple.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("withAnnotations.kt")
|
||||
public void testWithAnnotations() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/private/withAnnotations.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/intentions/changeVisibility/protected")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Protected extends AbstractIntentionTest {
|
||||
public void testAllFilesPresentInProtected() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/changeVisibility/protected"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("noModifier.kt")
|
||||
public void testNoModifier() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/protected/noModifier.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("notForObjectMember.kt")
|
||||
public void testNotForObjectMember() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/protected/notForObjectMember.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("notForTopLevel.kt")
|
||||
public void testNotForTopLevel() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/protected/notForTopLevel.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/protected/simple.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/intentions/changeVisibility/public")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Public extends AbstractIntentionTest {
|
||||
public void testAllFilesPresentInPublic() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/changeVisibility/public"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("alreadyPublic.kt")
|
||||
public void testAlreadyPublic() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/public/alreadyPublic.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("caretAfter.kt")
|
||||
public void testCaretAfter() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/public/caretAfter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("notForOverride.kt")
|
||||
public void testNotForOverride() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/public/notForOverride.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("primaryConstructor.kt")
|
||||
public void testPrimaryConstructor() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/public/primaryConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("primaryConstructorPublicByDefault.kt")
|
||||
public void testPrimaryConstructorPublicByDefault() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/public/primaryConstructorPublicByDefault.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/changeVisibility/public/simple.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/intentions/conventionNameCalls")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user