Move top-level declarations: Implement refactoring processor
This commit is contained in:
@@ -1,4 +1,13 @@
|
|||||||
<root>
|
<root>
|
||||||
|
<item
|
||||||
|
name='com.intellij.refactoring.BaseRefactoringProcessor boolean preprocessUsages(com.intellij.openapi.util.Ref<com.intellij.usageView.UsageInfo[]>)'>
|
||||||
|
<annotation name='kotlin.jvm.KotlinSignature'>
|
||||||
|
<val name="value" val=""fun preprocessUsages(refUsages: Ref<Array<UsageInfo>>): Boolean""/>
|
||||||
|
</annotation>
|
||||||
|
</item>
|
||||||
|
<item name='com.intellij.refactoring.BaseRefactoringProcessor myProject'>
|
||||||
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
|
</item>
|
||||||
<item
|
<item
|
||||||
name='com.intellij.refactoring.BaseRefactoringProcessor.ConflictsInTestsException java.util.Collection<java.lang.String> getMessages()'>
|
name='com.intellij.refactoring.BaseRefactoringProcessor.ConflictsInTestsException java.util.Collection<java.lang.String> getMessages()'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<root>
|
||||||
|
<item
|
||||||
|
name='com.intellij.refactoring.listeners.impl.RefactoringTransaction com.intellij.refactoring.listeners.RefactoringElementListener getElementListener(com.intellij.psi.PsiElement)'>
|
||||||
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
|
</item>
|
||||||
|
</root>
|
||||||
@@ -5,4 +5,8 @@
|
|||||||
<item name='com.intellij.usageView.UsageInfo mySmartPointer'>
|
<item name='com.intellij.usageView.UsageInfo mySmartPointer'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
|
<item
|
||||||
|
name='com.intellij.usageView.UsageViewUtil com.intellij.usageView.UsageInfo[] removeDuplicatedUsages(com.intellij.usageView.UsageInfo[])'>
|
||||||
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
|
</item>
|
||||||
</root>
|
</root>
|
||||||
@@ -262,4 +262,8 @@ public fun JetSimpleNameExpression.getOutermostNonInterleavingQualifiedElement()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun PsiDirectory.getPackage(): PsiPackage? = JavaDirectoryService.getInstance()!!.getPackage(this)
|
public fun PsiDirectory.getPackage(): PsiPackage? = JavaDirectoryService.getInstance()!!.getPackage(this)
|
||||||
|
|
||||||
|
public fun JetModifierListOwner.isPrivate(): Boolean = hasModifier(JetTokens.PRIVATE_KEYWORD)
|
||||||
|
|
||||||
|
public fun PsiElement.isInsideOf(elements: Iterable<PsiElement>): Boolean = elements.any { it.isAncestor(this) }
|
||||||
@@ -41,15 +41,15 @@ import org.jetbrains.jet.lang.psi.JetCallableDeclaration
|
|||||||
import org.jetbrains.jet.lang.psi.psiUtil.isExtensionDeclaration
|
import org.jetbrains.jet.lang.psi.psiUtil.isExtensionDeclaration
|
||||||
import com.intellij.psi.PsiClass
|
import com.intellij.psi.PsiClass
|
||||||
|
|
||||||
fun JetClassOrObject.toLightClass(): PsiClass? = LightClassUtil.getPsiClass(this)
|
fun JetClassOrObject.toLightClass(): KotlinLightClass? = LightClassUtil.getPsiClass(this) as KotlinLightClass?
|
||||||
|
|
||||||
public fun JetDeclaration.toLightElements(): List<PsiElement> =
|
public fun JetDeclaration.toLightElements(): List<PsiNamedElement> =
|
||||||
when (this) {
|
when (this) {
|
||||||
is JetClassOrObject -> Collections.singletonList(LightClassUtil.getPsiClass(this))
|
is JetClassOrObject -> Collections.singletonList(LightClassUtil.getPsiClass(this))
|
||||||
is JetNamedFunction -> Collections.singletonList(LightClassUtil.getLightClassMethod(this))
|
is JetNamedFunction -> Collections.singletonList(LightClassUtil.getLightClassMethod(this))
|
||||||
is JetProperty -> LightClassUtil.getLightClassPropertyMethods(this).toList()
|
is JetProperty -> LightClassUtil.getLightClassPropertyMethods(this).toList()
|
||||||
is JetPropertyAccessor -> Collections.singletonList(LightClassUtil.getLightClassAccessorMethod(this))
|
is JetPropertyAccessor -> Collections.singletonList(LightClassUtil.getLightClassAccessorMethod(this))
|
||||||
is JetParameter -> ArrayList<PsiElement>().let { elements ->
|
is JetParameter -> ArrayList<PsiNamedElement>().let { elements ->
|
||||||
toPsiParameter()?.let { psiParameter -> elements.add(psiParameter) }
|
toPsiParameter()?.let { psiParameter -> elements.add(psiParameter) }
|
||||||
LightClassUtil.getLightClassPropertyMethods(this).toCollection(elements)
|
LightClassUtil.getLightClassPropertyMethods(this).toCollection(elements)
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,19 @@ import org.jetbrains.jet.lang.psi.JetDotQualifiedExpression
|
|||||||
import org.jetbrains.jet.lang.psi.JetExpression
|
import org.jetbrains.jet.lang.psi.JetExpression
|
||||||
import org.jetbrains.jet.lang.psi.JetCallExpression
|
import org.jetbrains.jet.lang.psi.JetCallExpression
|
||||||
import org.jetbrains.jet.lang.psi.JetSimpleNameExpression
|
import org.jetbrains.jet.lang.psi.JetSimpleNameExpression
|
||||||
|
import java.util.Collections
|
||||||
|
|
||||||
object JetFileReferencesResolver {
|
object JetFileReferencesResolver {
|
||||||
|
fun resolve(
|
||||||
|
element: JetElement,
|
||||||
|
visitReceivers: Boolean = true,
|
||||||
|
visitShortNames: Boolean = true
|
||||||
|
): Map<JetReferenceExpression, BindingContext> {
|
||||||
|
return (element.getContainingFile() as? JetFile)?.let { file ->
|
||||||
|
resolve(file, listOf(element), visitReceivers, visitShortNames)
|
||||||
|
} ?: Collections.emptyMap()
|
||||||
|
}
|
||||||
|
|
||||||
fun resolve(
|
fun resolve(
|
||||||
file: JetFile,
|
file: JetFile,
|
||||||
elements: Iterable<JetElement>? = null,
|
elements: Iterable<JetElement>? = null,
|
||||||
|
|||||||
-1
@@ -72,7 +72,6 @@ private fun Project.clearElementsToShorten() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public fun JetElement.addToShorteningWaitSet() {
|
public fun JetElement.addToShorteningWaitSet() {
|
||||||
assert (this is JetQualifiedExpression || this is JetSimpleNameExpression || this is JetUserType, "Unexpected element type: ${getClass()}: ${getText()}")
|
|
||||||
assert (ApplicationManager.getApplication()!!.isWriteAccessAllowed(), "Write access needed")
|
assert (ApplicationManager.getApplication()!!.isWriteAccessAllowed(), "Write access needed")
|
||||||
val project = getProject()
|
val project = getProject()
|
||||||
project.getElementsToShorten(true)!!.add(SmartPointerManager.getInstance(project)!!.createSmartPsiElementPointer(this))
|
project.getElementsToShorten(true)!!.add(SmartPointerManager.getInstance(project)!!.createSmartPsiElementPointer(this))
|
||||||
|
|||||||
@@ -19,3 +19,5 @@ parameter.name.is.invalid=Parameter name ''{0}'' is invalid
|
|||||||
parameter.type.is.invalid=Parameter type ''{0}'' is invalid
|
parameter.type.is.invalid=Parameter type ''{0}'' is invalid
|
||||||
column.name.val.var=Val/Var
|
column.name.val.var=Val/Var
|
||||||
|
|
||||||
|
package.private.0.will.no.longer.be.accessible.from.1=Package-private {0} will no longer be accessible from {1}
|
||||||
|
0.uses.package.private.1={0} uses package-private {1}
|
||||||
@@ -95,4 +95,11 @@ public fun PsiElement.getKotlinFqName(): FqName? {
|
|||||||
is JetNamedDeclaration -> JetPsiUtil.getFQName(element)
|
is JetNamedDeclaration -> JetPsiUtil.getFQName(element)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public fun PsiElement.getUsageContext(): PsiElement {
|
||||||
|
return when (this) {
|
||||||
|
is JetElement -> PsiTreeUtil.getParentOfType(this, javaClass<JetNamedDeclaration>(), javaClass<JetFile>())!!
|
||||||
|
else -> ConflictsUtil.getContainer(this)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+285
@@ -0,0 +1,285 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2014 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.jet.plugin.refactoring.move.moveTopLevelDeclarations
|
||||||
|
|
||||||
|
import com.intellij.refactoring.BaseRefactoringProcessor
|
||||||
|
import com.intellij.openapi.project.Project
|
||||||
|
import com.intellij.usageView.UsageInfo
|
||||||
|
import com.intellij.usageView.UsageViewDescriptor
|
||||||
|
import com.intellij.refactoring.MoveDestination
|
||||||
|
import com.intellij.refactoring.move.MoveCallback
|
||||||
|
import com.intellij.refactoring.move.MoveMultipleElementsViewDescriptor
|
||||||
|
import com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesUtil
|
||||||
|
import com.intellij.usageView.UsageViewUtil
|
||||||
|
import com.intellij.openapi.diagnostic.Logger
|
||||||
|
import com.intellij.psi.PsiElement
|
||||||
|
import com.intellij.refactoring.util.NonCodeUsageInfo
|
||||||
|
import com.intellij.refactoring.move.moveClassesOrPackages.CommonMoveUtil
|
||||||
|
import com.intellij.util.IncorrectOperationException
|
||||||
|
import com.intellij.refactoring.util.RefactoringUIUtil
|
||||||
|
import org.jetbrains.jet.utils.keysToMap
|
||||||
|
import com.intellij.refactoring.rename.RenameUtil
|
||||||
|
import com.intellij.refactoring.move.MoveClassesOrPackagesCallback
|
||||||
|
import org.jetbrains.jet.plugin.refactoring.JetRefactoringBundle
|
||||||
|
import com.intellij.openapi.util.text.StringUtil
|
||||||
|
import com.intellij.psi.PsiDirectory
|
||||||
|
import org.jetbrains.jet.lang.psi.psiUtil.getPackage
|
||||||
|
import org.jetbrains.jet.lang.psi.JetFile
|
||||||
|
import org.jetbrains.jet.plugin.refactoring.move.PackageNameInfo
|
||||||
|
import org.jetbrains.jet.lang.psi.JetPsiUtil
|
||||||
|
import org.jetbrains.jet.lang.resolve.name.FqName
|
||||||
|
import org.jetbrains.jet.plugin.refactoring.createKotlinFile
|
||||||
|
import org.jetbrains.jet.plugin.refactoring.move.updateInternalReferencesOnPackageNameChange
|
||||||
|
import org.jetbrains.jet.plugin.codeInsight.addToShorteningWaitSet
|
||||||
|
import org.jetbrains.jet.plugin.refactoring.move.getFileNameAfterMove
|
||||||
|
import org.jetbrains.jet.lang.psi.JetNamedDeclaration
|
||||||
|
import org.jetbrains.jet.asJava.toLightElements
|
||||||
|
import java.util.HashMap
|
||||||
|
import org.jetbrains.jet.utils.flatten
|
||||||
|
import java.util.ArrayList
|
||||||
|
import java.util.HashSet
|
||||||
|
import com.intellij.psi.PsiReference
|
||||||
|
import com.intellij.psi.search.searches.ReferencesSearch
|
||||||
|
import com.intellij.psi.search.GlobalSearchScope
|
||||||
|
import com.intellij.refactoring.util.MoveRenameUsageInfo
|
||||||
|
import com.intellij.psi.PsiClass
|
||||||
|
import com.intellij.refactoring.util.TextOccurrencesUtil
|
||||||
|
import com.intellij.refactoring.move.moveClassesOrPackages.MoveClassHandler
|
||||||
|
import com.intellij.util.containers.MultiMap
|
||||||
|
import org.jetbrains.jet.asJava.namedUnwrappedElement
|
||||||
|
import org.jetbrains.jet.lang.psi.psiUtil.isPrivate
|
||||||
|
import org.jetbrains.jet.plugin.refactoring.getUsageContext
|
||||||
|
import com.intellij.refactoring.util.CommonRefactoringUtil
|
||||||
|
import org.jetbrains.jet.lang.psi.psiUtil.isInsideOf
|
||||||
|
import org.jetbrains.jet.plugin.codeInsight.JetFileReferencesResolver
|
||||||
|
import org.jetbrains.jet.lang.resolve.BindingContext
|
||||||
|
import org.jetbrains.jet.plugin.codeInsight.DescriptorToDeclarationUtil
|
||||||
|
import org.jetbrains.jet.lang.psi.JetModifierListOwner
|
||||||
|
import com.intellij.psi.PsiModifierListOwner
|
||||||
|
import com.intellij.psi.PsiModifier
|
||||||
|
import com.intellij.util.VisibilityUtil
|
||||||
|
import com.intellij.openapi.util.Ref
|
||||||
|
import org.jetbrains.jet.plugin.refactoring.getKotlinFqName
|
||||||
|
import org.jetbrains.jet.plugin.references.JetSimpleNameReference.ShorteningMode
|
||||||
|
|
||||||
|
public class MoveKotlinTopLevelDeclarationsOptions(
|
||||||
|
val elementsToMove: Collection<JetNamedDeclaration>,
|
||||||
|
val moveDestination: MoveDestination,
|
||||||
|
val searchInCommentsAndStrings: Boolean = true,
|
||||||
|
val searchInNonCode: Boolean = true,
|
||||||
|
val moveCallback: MoveCallback? = null
|
||||||
|
)
|
||||||
|
|
||||||
|
public class MoveKotlinTopLevelDeclarationsProcessor(project: Project, val options: MoveKotlinTopLevelDeclarationsOptions) : BaseRefactoringProcessor(project) {
|
||||||
|
class object {
|
||||||
|
private val LOG: Logger = Logger.getInstance(javaClass<MoveKotlinTopLevelDeclarationsProcessor>())
|
||||||
|
|
||||||
|
private val REFACTORING_NAME: String = JetRefactoringBundle.message("refactoring.move.top.level.declarations")!!
|
||||||
|
}
|
||||||
|
|
||||||
|
private var nonCodeUsages: Array<NonCodeUsageInfo>? = null
|
||||||
|
private val kotlinToLightElements = options.elementsToMove.keysToMap { it.toLightElements() }
|
||||||
|
private val conflicts = MultiMap<PsiElement, String>()
|
||||||
|
|
||||||
|
override fun createUsageViewDescriptor(usages: Array<out UsageInfo>?): UsageViewDescriptor {
|
||||||
|
return MoveMultipleElementsViewDescriptor(
|
||||||
|
options.elementsToMove.copyToArray(),
|
||||||
|
MoveClassesOrPackagesUtil.getPackageName(options.moveDestination.getTargetPackage())
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun findUsages(): Array<UsageInfo> {
|
||||||
|
val newPackageName = options.moveDestination.getTargetPackage()?.getQualifiedName() ?: ""
|
||||||
|
|
||||||
|
fun collectUsages(): List<UsageInfo> {
|
||||||
|
return kotlinToLightElements.values().flatten().flatMap { lightElement ->
|
||||||
|
val newFqName = StringUtil.getQualifiedName(newPackageName, lightElement.getName())
|
||||||
|
|
||||||
|
val foundReferences = HashSet<PsiReference>()
|
||||||
|
val projectScope = GlobalSearchScope.projectScope(lightElement.getProject())
|
||||||
|
val results = ReferencesSearch
|
||||||
|
.search(lightElement, projectScope, false)
|
||||||
|
.mapTo(ArrayList<UsageInfo?>()) { ref ->
|
||||||
|
if (foundReferences.add(ref)) {
|
||||||
|
val range = ref.getRangeInElement()!!
|
||||||
|
MoveRenameUsageInfo(ref.getElement(), ref, range.getStartOffset(), range.getEndOffset(), lightElement, false)
|
||||||
|
}
|
||||||
|
else null
|
||||||
|
}
|
||||||
|
.filterNotNull()
|
||||||
|
|
||||||
|
val name = lightElement.getKotlinFqName()?.asString()
|
||||||
|
if (name != null) {
|
||||||
|
TextOccurrencesUtil.findNonCodeUsages(
|
||||||
|
lightElement,
|
||||||
|
name,
|
||||||
|
options.searchInCommentsAndStrings,
|
||||||
|
options.searchInNonCode,
|
||||||
|
newFqName,
|
||||||
|
results
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
MoveClassHandler.EP_NAME.getExtensions().forEach { handler -> handler.preprocessUsages(results) }
|
||||||
|
|
||||||
|
results
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
There must be a conflict if all of the following conditions are satisfied:
|
||||||
|
declaration is package-private
|
||||||
|
usage does not belong to target package
|
||||||
|
usage is not being moved together with declaration
|
||||||
|
*/
|
||||||
|
|
||||||
|
fun collectConflictsInUsages(usages: List<UsageInfo>) {
|
||||||
|
val declarationToContainers = HashMap<JetNamedDeclaration, MutableSet<PsiElement>>()
|
||||||
|
for (usage in usages) {
|
||||||
|
val element = usage.getElement()
|
||||||
|
if (element == null || usage !is MoveRenameUsageInfo || usage is NonCodeUsageInfo) continue
|
||||||
|
|
||||||
|
val declaration = usage.getReferencedElement()?.namedUnwrappedElement as? JetNamedDeclaration
|
||||||
|
if (declaration == null || !declaration.isPrivate()) continue
|
||||||
|
|
||||||
|
if (element.isInsideOf(options.elementsToMove)) continue
|
||||||
|
|
||||||
|
val container = element.getUsageContext()
|
||||||
|
if (!declarationToContainers.getOrPut(declaration) { HashSet<PsiElement>() }.add(container)) continue
|
||||||
|
|
||||||
|
val currentPackage = element.getContainingFile()?.getContainingDirectory()?.getPackage()
|
||||||
|
if (currentPackage?.getQualifiedName() == newPackageName) continue
|
||||||
|
|
||||||
|
conflicts.putValue(
|
||||||
|
declaration,
|
||||||
|
JetRefactoringBundle.message(
|
||||||
|
"package.private.0.will.no.longer.be.accessible.from.1",
|
||||||
|
RefactoringUIUtil.getDescription(declaration, true),
|
||||||
|
RefactoringUIUtil.getDescription(container, true)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun collectConflictsInDeclarations() {
|
||||||
|
val declarationToReferenceTargets = HashMap<JetNamedDeclaration, MutableSet<PsiElement>>()
|
||||||
|
for (declaration in options.elementsToMove) {
|
||||||
|
val referenceToContext = JetFileReferencesResolver.resolve(element = declaration, visitReceivers = false)
|
||||||
|
for ((refExpr, bindingContext) in referenceToContext) {
|
||||||
|
val refTarget = bindingContext[BindingContext.REFERENCE_TARGET, refExpr]?.let { descriptor ->
|
||||||
|
DescriptorToDeclarationUtil.getDeclaration(declaration.getProject(), descriptor, bindingContext)
|
||||||
|
}
|
||||||
|
if (refTarget == null || refTarget.isInsideOf(options.elementsToMove)) continue
|
||||||
|
|
||||||
|
val packagePrivate = when(refTarget) {
|
||||||
|
is JetModifierListOwner ->
|
||||||
|
refTarget.isPrivate()
|
||||||
|
is PsiModifierListOwner ->
|
||||||
|
VisibilityUtil.getVisibilityModifier(refTarget.getModifierList()) == PsiModifier.PACKAGE_LOCAL
|
||||||
|
else -> false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!packagePrivate) continue
|
||||||
|
|
||||||
|
if (!declarationToReferenceTargets.getOrPut(declaration) { HashSet<PsiElement>() }.add(refTarget)) continue
|
||||||
|
|
||||||
|
val currentPackage = declaration.getContainingFile()?.getContainingDirectory()?.getPackage()
|
||||||
|
if (currentPackage?.getQualifiedName() == newPackageName) continue
|
||||||
|
|
||||||
|
conflicts.putValue(
|
||||||
|
declaration,
|
||||||
|
JetRefactoringBundle.message(
|
||||||
|
"0.uses.package.private.1",
|
||||||
|
RefactoringUIUtil.getDescription(declaration, true),
|
||||||
|
RefactoringUIUtil.getDescription(refTarget, true)
|
||||||
|
)!!.capitalize()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val usages = collectUsages()
|
||||||
|
collectConflictsInUsages(usages)
|
||||||
|
collectConflictsInDeclarations()
|
||||||
|
return UsageViewUtil.removeDuplicatedUsages(usages.copyToArray())
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun preprocessUsages(refUsages: Ref<Array<UsageInfo>>): Boolean {
|
||||||
|
return showConflicts(conflicts, refUsages.get())
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun performRefactoring(usages: Array<out UsageInfo>?) {
|
||||||
|
fun moveDeclaration(declaration: JetNamedDeclaration, moveDestination: PsiDirectory): JetNamedDeclaration? {
|
||||||
|
val newPackage = moveDestination.getPackage()
|
||||||
|
if (newPackage == null) return null
|
||||||
|
|
||||||
|
val file = declaration.getContainingFile() as? JetFile
|
||||||
|
if (file == null) return null
|
||||||
|
|
||||||
|
val packageNameInfo = PackageNameInfo(JetPsiUtil.getFQName(file), FqName(newPackage.getQualifiedName()))
|
||||||
|
|
||||||
|
val existingFile = if (moveDestination != file.getContainingDirectory()) moveDestination.findFile(file.getName()) else null
|
||||||
|
val newFile = existingFile ?: declaration.getFileNameAfterMove()?.let {
|
||||||
|
fileName -> createKotlinFile(fileName, moveDestination)
|
||||||
|
}
|
||||||
|
assert(newFile != null, "Couldn't create Koltin file for: ${declaration.getClass()}: ${declaration.getText()}")
|
||||||
|
|
||||||
|
declaration.updateInternalReferencesOnPackageNameChange(packageNameInfo, ShorteningMode.NO_SHORTENING)
|
||||||
|
val newElement = newFile!!.add(declaration) as JetNamedDeclaration
|
||||||
|
declaration.delete()
|
||||||
|
|
||||||
|
newElement.addToShorteningWaitSet()
|
||||||
|
|
||||||
|
return newElement
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
val oldToNewElementsMapping = HashMap<PsiElement, PsiElement>()
|
||||||
|
for ((oldDeclaration, oldLightElements) in kotlinToLightElements) {
|
||||||
|
val targetDirectory = options.moveDestination.getTargetDirectory(oldDeclaration.getContainingFile())
|
||||||
|
if (targetDirectory == null) continue
|
||||||
|
|
||||||
|
val newDeclaration = moveDeclaration(oldDeclaration, targetDirectory)
|
||||||
|
if (newDeclaration == null) continue
|
||||||
|
|
||||||
|
getTransaction()!!.getElementListener(oldDeclaration).elementMoved(newDeclaration)
|
||||||
|
for ((oldElement, newElement) in oldLightElements.iterator() zip newDeclaration.toLightElements().iterator()) {
|
||||||
|
oldToNewElementsMapping[oldElement] = newElement
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nonCodeUsages = CommonMoveUtil.retargetUsages(usages, oldToNewElementsMapping)
|
||||||
|
}
|
||||||
|
catch (e: IncorrectOperationException) {
|
||||||
|
nonCodeUsages = null
|
||||||
|
RefactoringUIUtil.processIncorrectOperation(myProject, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun performPsiSpoilingRefactoring() {
|
||||||
|
nonCodeUsages?.let { nonCodeUsages -> RenameUtil.renameNonCodeUsages(myProject, nonCodeUsages) }
|
||||||
|
|
||||||
|
options.moveCallback?.let { moveCallback ->
|
||||||
|
if (moveCallback is MoveClassesOrPackagesCallback) {
|
||||||
|
moveCallback.classesOrPackagesMoved(options.moveDestination)
|
||||||
|
}
|
||||||
|
moveCallback.refactoringCompleted()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getCommandName(): String = REFACTORING_NAME
|
||||||
|
}
|
||||||
@@ -27,6 +27,11 @@ import org.jetbrains.jet.lang.resolve.name.FqName
|
|||||||
import org.jetbrains.jet.lang.psi.JetFile
|
import org.jetbrains.jet.lang.psi.JetFile
|
||||||
import org.jetbrains.jet.lang.psi.JetElement
|
import org.jetbrains.jet.lang.psi.JetElement
|
||||||
import org.jetbrains.jet.plugin.references.JetSimpleNameReference.ShorteningMode
|
import org.jetbrains.jet.plugin.references.JetSimpleNameReference.ShorteningMode
|
||||||
|
import com.intellij.psi.PsiClass
|
||||||
|
import org.jetbrains.jet.asJava.KotlinLightClass
|
||||||
|
import org.jetbrains.jet.plugin.JetFileType
|
||||||
|
import org.jetbrains.jet.lang.psi.JetClassOrObject
|
||||||
|
import org.jetbrains.jet.lang.psi.JetNamedDeclaration
|
||||||
|
|
||||||
public class PackageNameInfo(val oldPackageName: FqName, val newPackageName: FqName)
|
public class PackageNameInfo(val oldPackageName: FqName, val newPackageName: FqName)
|
||||||
|
|
||||||
@@ -59,4 +64,10 @@ public fun JetElement.updateInternalReferencesOnPackageNameChange(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public fun JetNamedDeclaration.getFileNameAfterMove(): String? {
|
||||||
|
return (getContainingFile() as? JetFile)?.let { file ->
|
||||||
|
if (file.getDeclarations().size > 1) "${getName()}.${JetFileType.INSTANCE.getDefaultExtension()}" else file.getName()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
import b.Test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: Test = Test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
import b.Test as _Test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: _Test = _Test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
open class Foo {
|
||||||
|
open class Bar {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
import b.Test
|
||||||
|
|
||||||
|
fun test(): Test {
|
||||||
|
return Test()
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package a;
|
||||||
|
|
||||||
|
import b.Test;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
Test t = new Test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
import b.Test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: Test = Test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
import b.Test as _Test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: _Test = _Test()
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
package b
|
||||||
|
|
||||||
|
class Test {
|
||||||
|
val aFoo: a.Foo = a.Foo()
|
||||||
|
val bFoo: Foo = Foo()
|
||||||
|
val cFoo: c.Foo = c.Foo()
|
||||||
|
val aBar: a.Foo.Bar = a.Foo.Bar()
|
||||||
|
val bBar: Foo.Bar = Foo.Bar()
|
||||||
|
val cBar: c.Foo.Bar = c.Foo.Bar()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b
|
||||||
|
|
||||||
|
open class Foo {
|
||||||
|
open class Bar {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
Test t = new Test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package b
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: Test = Test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
Test t = new Test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b
|
||||||
|
|
||||||
|
import a.*
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: Test = Test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
Test t = new Test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b
|
||||||
|
|
||||||
|
import b.Test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: Test = Test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b
|
||||||
|
|
||||||
|
import b.Test as _Test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: _Test = _Test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package c
|
||||||
|
|
||||||
|
open class Foo {
|
||||||
|
open class Bar {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package c;
|
||||||
|
|
||||||
|
import b.Test;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
Test t = new Test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package c
|
||||||
|
|
||||||
|
import b.Test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: Test = Test()
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package c;
|
||||||
|
|
||||||
|
import b.Test;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
Test t = new Test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
package c
|
||||||
|
|
||||||
|
import a.*
|
||||||
|
import b.Test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: Test = Test()
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package c;
|
||||||
|
|
||||||
|
import b.Test;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
Test t = new Test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package c
|
||||||
|
|
||||||
|
import b.Test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: Test = Test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package c
|
||||||
|
|
||||||
|
import b.Test as _Test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: _Test = _Test()
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: Test = Test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
import a.Test as _Test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: _Test = _Test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
open class Foo {
|
||||||
|
open class Bar {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
class <caret>Test {
|
||||||
|
val aFoo: Foo = Foo()
|
||||||
|
val bFoo: b.Foo = b.Foo()
|
||||||
|
val cFoo: c.Foo = c.Foo()
|
||||||
|
val aBar: Foo.Bar = Foo.Bar()
|
||||||
|
val bBar: b.Foo.Bar = b.Foo.Bar()
|
||||||
|
val cBar: c.Foo.Bar = c.Foo.Bar()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test(): Test {
|
||||||
|
return Test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
Test t = new Test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: Test = Test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
import a.Test as _Test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: _Test = _Test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b
|
||||||
|
|
||||||
|
open class Foo {
|
||||||
|
open class Bar {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
a.Test t = new a.Test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package b
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: a.Test = a.Test()
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package b;
|
||||||
|
|
||||||
|
import a.*;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
Test t = new Test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b
|
||||||
|
|
||||||
|
import a.*
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: Test = Test()
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package b;
|
||||||
|
|
||||||
|
import a.Test;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
Test t = new Test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b
|
||||||
|
|
||||||
|
import a.Test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: Test = Test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b
|
||||||
|
|
||||||
|
import a.Test as _Test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: _Test = _Test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package c
|
||||||
|
|
||||||
|
open class Foo {
|
||||||
|
open class Bar {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package c;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
a.Test t = new a.Test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package c
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: a.Test = a.Test()
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package c;
|
||||||
|
|
||||||
|
import a.*;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
Test t = new Test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package c
|
||||||
|
|
||||||
|
import a.*
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: Test = Test()
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package c;
|
||||||
|
|
||||||
|
import a.Test;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
Test t = new Test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package c
|
||||||
|
|
||||||
|
import a.Test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: Test = Test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package c
|
||||||
|
|
||||||
|
import a.Test as _Test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: _Test = _Test()
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"mainFile": "a/main.kt",
|
||||||
|
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
|
||||||
|
"targetPackage": "b"
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
private class Foo {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun foo(value: Foo) {
|
||||||
|
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
private class Test {
|
||||||
|
fun test {
|
||||||
|
foo(Foo())
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
Test t = new Test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: Test = Test()
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
private class Foo {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun foo(value: Foo) {
|
||||||
|
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
private class <caret>Test {
|
||||||
|
fun test {
|
||||||
|
foo(Foo())
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
Test t = new Test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
val t: Test = Test()
|
||||||
|
}
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
Class a.Test uses package-private class a.Foo
|
||||||
|
Class a.Test uses package-private function a.foo
|
||||||
|
Package-private class a.Test will no longer be accessible from method J.bar()
|
||||||
|
Package-private class a.Test will no longer be accessible from property a.bar.t
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"mainFile": "a/main.kt",
|
||||||
|
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
|
||||||
|
"targetPackage": "b"
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
b.test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
import b.test as _test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
_test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
open class Foo {
|
||||||
|
open class Bar {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
class Test {
|
||||||
|
fun foo() {
|
||||||
|
b.test()
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
b.BPackage.test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
b.test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
b.BPackage.test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
import b.test as _test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
_test()
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package a;
|
||||||
|
|
||||||
|
import static b.BPackage.test;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b
|
||||||
|
|
||||||
|
open class Foo {
|
||||||
|
open class Bar {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
b.BPackage.test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package b
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
b.BPackage.test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b
|
||||||
|
|
||||||
|
import a.*
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
b.BPackage.test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
b.BPackage.test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b
|
||||||
|
|
||||||
|
import b.test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package b
|
||||||
|
|
||||||
|
import b.test as _test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
_test()
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package b;
|
||||||
|
|
||||||
|
import static b.BPackage.test;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
package b
|
||||||
|
|
||||||
|
fun test {
|
||||||
|
val aFoo: a.Foo = a.Foo()
|
||||||
|
val bFoo: Foo = Foo()
|
||||||
|
val cFoo: c.Foo = c.Foo()
|
||||||
|
val aBar: a.Foo.Bar = a.Foo.Bar()
|
||||||
|
val bBar: Foo.Bar = Foo.Bar()
|
||||||
|
val cBar: c.Foo.Bar = c.Foo.Bar()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package c
|
||||||
|
|
||||||
|
open class Foo {
|
||||||
|
open class Bar {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package c;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
b.BPackage.test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package c
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
b.test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package c;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
b.BPackage.test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package c
|
||||||
|
|
||||||
|
import a.*
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
b.test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package c;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
b.BPackage.test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package c;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
b.BPackage.test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package c
|
||||||
|
|
||||||
|
import b.test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
test()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package c
|
||||||
|
|
||||||
|
import b.test as _test
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
_test()
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package c;
|
||||||
|
|
||||||
|
import static b.BPackage.test;
|
||||||
|
|
||||||
|
class J {
|
||||||
|
void bar() {
|
||||||
|
test();
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
test()
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user