rename Jet* classes to Kt*
This commit is contained in:
+2
-2
@@ -42,7 +42,7 @@ import org.jetbrains.kotlin.container.useInstance
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages
|
||||
import org.jetbrains.kotlin.extensions.ExternalDeclarationsProvider
|
||||
import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor
|
||||
import org.jetbrains.kotlin.psi.JetFile
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform
|
||||
|
||||
@@ -77,7 +77,7 @@ public class AndroidCommandLineProcessor : CommandLineProcessor {
|
||||
}
|
||||
|
||||
public class CliAndroidDeclarationsProvider(private val project: Project) : ExternalDeclarationsProvider {
|
||||
override fun getExternalDeclarations(moduleInfo: ModuleInfo?): Collection<JetFile> {
|
||||
override fun getExternalDeclarations(moduleInfo: ModuleInfo?): Collection<KtFile> {
|
||||
val parser = ServiceManager.getService(project, SyntheticFileGenerator::class.java) as? CliSyntheticFileGenerator
|
||||
return parser?.getSyntheticFiles() ?: listOf()
|
||||
}
|
||||
|
||||
+4
-4
@@ -17,8 +17,8 @@
|
||||
package org.jetbrains.kotlin.android.synthetic
|
||||
|
||||
import com.intellij.openapi.util.Key
|
||||
import org.jetbrains.kotlin.lexer.JetKeywordToken
|
||||
import org.jetbrains.kotlin.lexer.JetTokens
|
||||
import org.jetbrains.kotlin.lexer.KtKeywordToken
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
|
||||
public object AndroidConst {
|
||||
val ANDROID_USER_PACKAGE: Key<String> = Key.create<String>("ANDROID_USER_PACKAGE")
|
||||
@@ -50,8 +50,8 @@ public object AndroidConst {
|
||||
|
||||
val IGNORED_XML_WIDGET_TYPES = setOf("requestFocus", "merge", "tag", "check", "blink")
|
||||
|
||||
val ESCAPED_IDENTIFIERS = (JetTokens.KEYWORDS.types + JetTokens.SOFT_KEYWORDS.types)
|
||||
.map { it as? JetKeywordToken }.filterNotNull().map { it.value }.toSet()
|
||||
val ESCAPED_IDENTIFIERS = (KtTokens.KEYWORDS.types + KtTokens.SOFT_KEYWORDS.types)
|
||||
.map { it as? KtKeywordToken }.filterNotNull().map { it.value }.toSet()
|
||||
|
||||
val FQNAME_RESOLVE_PACKAGES = listOf("android.widget", "android.webkit", "android.view")
|
||||
}
|
||||
|
||||
+3
-3
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.codegen.state.JetTypeMapper
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaClassDescriptor
|
||||
import org.jetbrains.kotlin.psi.JetClassOrObject
|
||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
@@ -97,7 +97,7 @@ public class AndroidExpressionCodegenExtension : ExpressionCodegenExtension {
|
||||
val classBuilder: ClassBuilder,
|
||||
val state: GenerationState,
|
||||
val descriptor: ClassDescriptor,
|
||||
val classOrObject: JetClassOrObject,
|
||||
val classOrObject: KtClassOrObject,
|
||||
val androidClassType: AndroidClassType)
|
||||
|
||||
override fun applyProperty(receiver: StackValue, resolvedCall: ResolvedCall<*>, c: ExpressionCodegenExtension.Context): StackValue? {
|
||||
@@ -234,7 +234,7 @@ public class AndroidExpressionCodegenExtension : ExpressionCodegenExtension {
|
||||
override fun generateClassSyntheticParts(
|
||||
classBuilder: ClassBuilder,
|
||||
state: GenerationState,
|
||||
classOrObject: JetClassOrObject,
|
||||
classOrObject: KtClassOrObject,
|
||||
descriptor: ClassDescriptor
|
||||
) {
|
||||
if (descriptor.kind != ClassKind.CLASS || descriptor.isInner || DescriptorUtils.isLocal(descriptor)) return
|
||||
|
||||
+3
-3
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.codegen.DelegatingClassBuilder
|
||||
import org.jetbrains.kotlin.codegen.extensions.ClassBuilderInterceptorExtension
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
||||
import org.jetbrains.kotlin.psi.JetClass
|
||||
import org.jetbrains.kotlin.psi.KtClass
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
|
||||
import org.jetbrains.org.objectweb.asm.*
|
||||
@@ -64,7 +64,7 @@ public class AndroidOnDestroyClassBuilderInterceptorExtension : ClassBuilderInte
|
||||
internal val delegateClassBuilder: ClassBuilder,
|
||||
val bindingContext: BindingContext
|
||||
) : DelegatingClassBuilder() {
|
||||
private var currentClass: JetClass? = null
|
||||
private var currentClass: KtClass? = null
|
||||
private var currentClassName: String? = null
|
||||
|
||||
override fun getDelegate() = delegateClassBuilder
|
||||
@@ -78,7 +78,7 @@ public class AndroidOnDestroyClassBuilderInterceptorExtension : ClassBuilderInte
|
||||
superName: String,
|
||||
interfaces: Array<out String>
|
||||
) {
|
||||
if (origin is JetClass) {
|
||||
if (origin is KtClass) {
|
||||
currentClass = origin
|
||||
currentClassName = name
|
||||
}
|
||||
|
||||
+3
-3
@@ -18,13 +18,13 @@ package org.jetbrains.kotlin.android.synthetic.diagnostic;
|
||||
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory1;
|
||||
import org.jetbrains.kotlin.diagnostics.Errors;
|
||||
import org.jetbrains.kotlin.psi.JetExpression;
|
||||
import org.jetbrains.kotlin.psi.KtExpression;
|
||||
|
||||
import static org.jetbrains.kotlin.diagnostics.Severity.WARNING;
|
||||
|
||||
public interface ErrorsAndroid {
|
||||
DiagnosticFactory1<JetExpression, String> SYNTHETIC_INVALID_WIDGET_TYPE = DiagnosticFactory1.create(WARNING);
|
||||
DiagnosticFactory1<JetExpression, String> SYNTHETIC_UNRESOLVED_WIDGET_TYPE = DiagnosticFactory1.create(WARNING);
|
||||
DiagnosticFactory1<KtExpression, String> SYNTHETIC_INVALID_WIDGET_TYPE = DiagnosticFactory1.create(WARNING);
|
||||
DiagnosticFactory1<KtExpression, String> SYNTHETIC_UNRESOLVED_WIDGET_TYPE = DiagnosticFactory1.create(WARNING);
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
Object _initializer = new Object() {
|
||||
|
||||
+2
-2
@@ -24,14 +24,14 @@ import com.intellij.openapi.vfs.VirtualFileManager
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.intellij.psi.PsiManager
|
||||
import org.jetbrains.kotlin.psi.JetProperty
|
||||
import org.jetbrains.kotlin.psi.KtProperty
|
||||
import java.util.*
|
||||
|
||||
public abstract class AndroidLayoutXmlFileManager(val project: Project) {
|
||||
|
||||
public abstract val androidModuleInfo: AndroidModuleInfo?
|
||||
|
||||
public open fun propertyToXmlAttributes(property: JetProperty): List<PsiElement> = listOf()
|
||||
public open fun propertyToXmlAttributes(property: KtProperty): List<PsiElement> = listOf()
|
||||
|
||||
public fun getLayoutXmlFiles(): Map<String, List<PsiFile>> {
|
||||
val info = androidModuleInfo ?: return mapOf()
|
||||
|
||||
+2
-2
@@ -25,7 +25,7 @@ import com.intellij.psi.impl.PsiElementFinderImpl
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.android.synthetic.AndroidConst
|
||||
import org.jetbrains.kotlin.android.synthetic.AndroidXmlHandler
|
||||
import org.jetbrains.kotlin.psi.JetFile
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
|
||||
public open class CliSyntheticFileGenerator(
|
||||
project: Project,
|
||||
@@ -43,7 +43,7 @@ public open class CliSyntheticFileGenerator(
|
||||
CliAndroidLayoutXmlFileManager(project, manifestPath, resDirectories)
|
||||
}
|
||||
|
||||
public override fun getSyntheticFiles(): List<JetFile> = cachedJetFiles
|
||||
public override fun getSyntheticFiles(): List<KtFile> = cachedJetFiles
|
||||
|
||||
override fun extractLayoutResources(files: List<PsiFile>): List<AndroidResource> {
|
||||
val resources = arrayListOf<AndroidResource>()
|
||||
|
||||
+4
-4
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.android.synthetic.AndroidConst
|
||||
import org.jetbrains.kotlin.android.synthetic.KotlinStringWriter
|
||||
import org.jetbrains.kotlin.android.synthetic.escapeAndroidIdentifier
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.JetFile
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.types.Flexibility
|
||||
|
||||
public class AndroidSyntheticFile(val name: String, val contents: String) {
|
||||
@@ -42,7 +42,7 @@ public abstract class SyntheticFileGenerator(protected val project: Project) {
|
||||
|
||||
public abstract val layoutXmlFileManager: AndroidLayoutXmlFileManager
|
||||
|
||||
public abstract fun getSyntheticFiles(): List<JetFile>
|
||||
public abstract fun getSyntheticFiles(): List<KtFile>
|
||||
|
||||
protected open fun generateSyntheticFiles(generateCommonFiles: Boolean, supportV4: Boolean): List<AndroidSyntheticFile> {
|
||||
val commonFiles = if (generateCommonFiles) generateCommonFiles(supportV4) else listOf()
|
||||
@@ -197,14 +197,14 @@ public abstract class SyntheticFileGenerator(protected val project: Project) {
|
||||
return resourceMap.values().toList()
|
||||
}
|
||||
|
||||
protected fun generateSyntheticJetFiles(files: List<AndroidSyntheticFile>): List<JetFile> {
|
||||
protected fun generateSyntheticJetFiles(files: List<AndroidSyntheticFile>): List<KtFile> {
|
||||
val psiManager = PsiManager.getInstance(project)
|
||||
val applicationPackage = layoutXmlFileManager.androidModuleInfo?.applicationPackage
|
||||
|
||||
return files.mapIndexed { index, syntheticFile ->
|
||||
val fileName = AndroidConst.SYNTHETIC_FILENAME_PREFIX + syntheticFile.name + ".kt"
|
||||
val virtualFile = LightVirtualFile(fileName, syntheticFile.contents)
|
||||
val jetFile = psiManager.findFile(virtualFile) as JetFile
|
||||
val jetFile = psiManager.findFile(virtualFile) as KtFile
|
||||
if (applicationPackage != null) {
|
||||
jetFile.putUserData(AndroidConst.ANDROID_USER_PACKAGE, applicationPackage)
|
||||
}
|
||||
|
||||
+2
-2
@@ -32,7 +32,7 @@ import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.extensions.ExternalDeclarationsProvider
|
||||
import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor
|
||||
import org.jetbrains.kotlin.psi.JetFile
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import java.io.File
|
||||
|
||||
private class AndroidTestExternalDeclarationsProvider(
|
||||
@@ -41,7 +41,7 @@ private class AndroidTestExternalDeclarationsProvider(
|
||||
val manifestPath: String,
|
||||
val supportV4: Boolean
|
||||
) : ExternalDeclarationsProvider {
|
||||
override fun getExternalDeclarations(moduleInfo: ModuleInfo?): Collection<JetFile> {
|
||||
override fun getExternalDeclarations(moduleInfo: ModuleInfo?): Collection<KtFile> {
|
||||
val parser = CliSyntheticFileGeneratorForConversionTest(project, manifestPath, resPaths, supportV4)
|
||||
return parser.getSyntheticFiles()
|
||||
}
|
||||
|
||||
+6
-6
@@ -32,13 +32,13 @@ import org.jetbrains.kotlin.android.synthetic.res.SyntheticFileGenerator
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ModuleSourceInfo
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.getModuleInfo
|
||||
import org.jetbrains.kotlin.plugin.findUsages.handlers.KotlinFindUsagesHandlerDecorator
|
||||
import org.jetbrains.kotlin.psi.JetNamedDeclaration
|
||||
import org.jetbrains.kotlin.psi.JetProperty
|
||||
import org.jetbrains.kotlin.psi.KtNamedDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtProperty
|
||||
import java.util.ArrayList
|
||||
|
||||
class AndroidFindUsageHandlerDecorator : KotlinFindUsagesHandlerDecorator {
|
||||
override fun decorateHandler(element: PsiElement, forHighlightUsages: Boolean, delegate: FindUsagesHandler): FindUsagesHandler {
|
||||
if (element !is JetNamedDeclaration) return delegate
|
||||
if (element !is KtNamedDeclaration) return delegate
|
||||
if (!isAndroidSyntheticElement(element)) return delegate
|
||||
|
||||
return AndroidFindMemberUsagesHandler(element, delegate)
|
||||
@@ -46,14 +46,14 @@ class AndroidFindUsageHandlerDecorator : KotlinFindUsagesHandlerDecorator {
|
||||
}
|
||||
|
||||
class AndroidFindMemberUsagesHandler(
|
||||
private val declaration: JetNamedDeclaration,
|
||||
private val declaration: KtNamedDeclaration,
|
||||
private val delegate: FindUsagesHandler? = null
|
||||
) : FindUsagesHandler(declaration) {
|
||||
|
||||
override fun getPrimaryElements(): Array<PsiElement> {
|
||||
assert(isAndroidSyntheticElement(declaration))
|
||||
|
||||
val property = declaration as JetProperty
|
||||
val property = declaration as KtProperty
|
||||
val moduleInfo = declaration.getModuleInfo() as? ModuleSourceInfo ?: return super.getPrimaryElements()
|
||||
val parser = ModuleServiceManager.getService(moduleInfo.module, javaClass<SyntheticFileGenerator>())
|
||||
|
||||
@@ -71,7 +71,7 @@ class AndroidFindMemberUsagesHandler(
|
||||
override fun getSecondaryElements(): Array<PsiElement> {
|
||||
assert(isAndroidSyntheticElement(declaration))
|
||||
|
||||
val property = declaration as JetProperty
|
||||
val property = declaration as KtProperty
|
||||
val moduleInfo = declaration.getModuleInfo() as? ModuleSourceInfo ?: return super.getPrimaryElements()
|
||||
val parser = ModuleServiceManager.getService(moduleInfo.module, javaClass<SyntheticFileGenerator>())
|
||||
|
||||
|
||||
+6
-6
@@ -26,16 +26,16 @@ import com.intellij.psi.xml.XmlAttribute
|
||||
import org.jetbrains.kotlin.android.synthetic.res.SyntheticFileGenerator
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ModuleSourceInfo
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.getModuleInfo
|
||||
import org.jetbrains.kotlin.idea.references.JetSimpleNameReference
|
||||
import org.jetbrains.kotlin.psi.JetProperty
|
||||
import org.jetbrains.kotlin.psi.JetSimpleNameExpression
|
||||
import org.jetbrains.kotlin.idea.references.KtSimpleNameReference
|
||||
import org.jetbrains.kotlin.psi.KtProperty
|
||||
import org.jetbrains.kotlin.psi.KtSimpleNameExpression
|
||||
|
||||
public class AndroidGotoDeclarationHandler : GotoDeclarationHandler {
|
||||
|
||||
override fun getGotoDeclarationTargets(sourceElement: PsiElement?, offset: Int, editor: Editor?): Array<PsiElement>? {
|
||||
if (sourceElement is LeafPsiElement && sourceElement.getParent() is JetSimpleNameExpression) {
|
||||
val resolved = JetSimpleNameReference(sourceElement.getParent() as JetSimpleNameExpression).resolve()
|
||||
val property = resolved as? JetProperty ?: return null
|
||||
if (sourceElement is LeafPsiElement && sourceElement.getParent() is KtSimpleNameExpression) {
|
||||
val resolved = KtSimpleNameReference(sourceElement.getParent() as KtSimpleNameExpression).resolve()
|
||||
val property = resolved as? KtProperty ?: return null
|
||||
|
||||
val moduleInfo = sourceElement.getModuleInfo()
|
||||
if (moduleInfo !is ModuleSourceInfo) return null
|
||||
|
||||
+6
-6
@@ -38,13 +38,13 @@ import org.jetbrains.kotlin.android.synthetic.res.SyntheticFileGenerator
|
||||
import org.jetbrains.kotlin.asJava.namedUnwrappedElement
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ModuleSourceInfo
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.getModuleInfo
|
||||
import org.jetbrains.kotlin.psi.JetProperty
|
||||
import org.jetbrains.kotlin.psi.KtProperty
|
||||
|
||||
public class AndroidRenameProcessor : RenamePsiElementProcessor() {
|
||||
|
||||
override fun canProcessElement(element: PsiElement): Boolean {
|
||||
// Either renaming synthetic property, or value in layout xml, or R class field
|
||||
return (element.namedUnwrappedElement is JetProperty &&
|
||||
return (element.namedUnwrappedElement is KtProperty &&
|
||||
isAndroidSyntheticElement(element.namedUnwrappedElement)) || element is XmlAttributeValue ||
|
||||
isRClassField(element)
|
||||
}
|
||||
@@ -72,8 +72,8 @@ public class AndroidRenameProcessor : RenamePsiElementProcessor() {
|
||||
allRenames: MutableMap<PsiElement, String>,
|
||||
scope: SearchScope
|
||||
) {
|
||||
if (element != null && element.namedUnwrappedElement is JetProperty) {
|
||||
renameSyntheticProperty(element.namedUnwrappedElement as JetProperty, newName, allRenames)
|
||||
if (element != null && element.namedUnwrappedElement is KtProperty) {
|
||||
renameSyntheticProperty(element.namedUnwrappedElement as KtProperty, newName, allRenames)
|
||||
}
|
||||
else if (element is XmlAttributeValue) {
|
||||
renameAttributeValue(element, newName, allRenames)
|
||||
@@ -84,7 +84,7 @@ public class AndroidRenameProcessor : RenamePsiElementProcessor() {
|
||||
}
|
||||
|
||||
private fun renameSyntheticProperty(
|
||||
jetProperty: JetProperty,
|
||||
jetProperty: KtProperty,
|
||||
newName: String,
|
||||
allRenames: MutableMap<PsiElement, String>
|
||||
) {
|
||||
@@ -132,7 +132,7 @@ public class AndroidRenameProcessor : RenamePsiElementProcessor() {
|
||||
oldPropName: String,
|
||||
processor: SyntheticFileGenerator
|
||||
) {
|
||||
val props = processor.getSyntheticFiles()?.flatMap { it.findChildrenByClass(javaClass<JetProperty>()).toList() }
|
||||
val props = processor.getSyntheticFiles()?.flatMap { it.findChildrenByClass(javaClass<KtProperty>()).toList() }
|
||||
val matchedProps = props?.filter { it.getName() == oldPropName } ?: listOf()
|
||||
for (prop in matchedProps) {
|
||||
allRenames[prop] = newPropName
|
||||
|
||||
+6
-6
@@ -19,14 +19,14 @@ package org.jetbrains.kotlin.android.synthetic.idea
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.android.dom.wrappers.ValueResourceElementWrapper
|
||||
import org.jetbrains.kotlin.android.synthetic.isAndroidSyntheticElement
|
||||
import org.jetbrains.kotlin.idea.references.JetSimpleNameReference
|
||||
import org.jetbrains.kotlin.idea.references.KtSimpleNameReference
|
||||
import org.jetbrains.kotlin.plugin.references.SimpleNameReferenceExtension
|
||||
import org.jetbrains.kotlin.psi.JetProperty
|
||||
import org.jetbrains.kotlin.psi.JetPsiFactory
|
||||
import org.jetbrains.kotlin.psi.KtProperty
|
||||
import org.jetbrains.kotlin.psi.KtPsiFactory
|
||||
|
||||
public class AndroidSimpleNameReferenceExtension : SimpleNameReferenceExtension {
|
||||
override fun isReferenceTo(reference: JetSimpleNameReference, element: PsiElement): Boolean? {
|
||||
val resolvedElement = reference.resolve() as? JetProperty ?: return null
|
||||
override fun isReferenceTo(reference: KtSimpleNameReference, element: PsiElement): Boolean? {
|
||||
val resolvedElement = reference.resolve() as? KtProperty ?: return null
|
||||
|
||||
if (isAndroidSyntheticElement(resolvedElement)) {
|
||||
if (element is ValueResourceElementWrapper) {
|
||||
@@ -37,7 +37,7 @@ public class AndroidSimpleNameReferenceExtension : SimpleNameReferenceExtension
|
||||
return null
|
||||
}
|
||||
|
||||
override fun handleElementRename(reference: JetSimpleNameReference, psiFactory: JetPsiFactory, newElementName: String): PsiElement? {
|
||||
override fun handleElementRename(reference: KtSimpleNameReference, psiFactory: KtPsiFactory, newElementName: String): PsiElement? {
|
||||
return if (newElementName.startsWith("@+id/"))
|
||||
psiFactory.createNameIdentifier(newElementName.substring(newElementName.indexOf('/') + 1))
|
||||
else
|
||||
|
||||
+2
-2
@@ -23,11 +23,11 @@ import org.jetbrains.kotlin.android.synthetic.idea.res.IDESyntheticFileGenerator
|
||||
import org.jetbrains.kotlin.android.synthetic.res.SyntheticFileGenerator
|
||||
import org.jetbrains.kotlin.extensions.ExternalDeclarationsProvider
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.ModuleSourceInfo
|
||||
import org.jetbrains.kotlin.psi.JetFile
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.moduleInfo
|
||||
|
||||
public class IDEAndroidExternalDeclarationsProvider(private val project: Project) : ExternalDeclarationsProvider {
|
||||
override fun getExternalDeclarations(moduleInfo: ModuleInfo?): Collection<JetFile> {
|
||||
override fun getExternalDeclarations(moduleInfo: ModuleInfo?): Collection<KtFile> {
|
||||
if (moduleInfo !is ModuleSourceInfo) return listOf()
|
||||
|
||||
val module = moduleInfo.module
|
||||
|
||||
+2
-2
@@ -23,13 +23,13 @@ import org.jetbrains.kotlin.android.synthetic.AndroidConst
|
||||
import org.jetbrains.kotlin.android.synthetic.idea.AndroidXmlVisitor
|
||||
import org.jetbrains.kotlin.android.synthetic.res.AndroidLayoutXmlFileManager
|
||||
import org.jetbrains.kotlin.android.synthetic.res.AndroidModuleInfo
|
||||
import org.jetbrains.kotlin.psi.JetProperty
|
||||
import org.jetbrains.kotlin.psi.KtProperty
|
||||
|
||||
public class IDEAndroidLayoutXmlFileManager(val module: Module) : AndroidLayoutXmlFileManager(module.project) {
|
||||
|
||||
override val androidModuleInfo: AndroidModuleInfo? by lazy { module.androidFacet?.toAndroidModuleInfo() }
|
||||
|
||||
override fun propertyToXmlAttributes(property: JetProperty): List<PsiElement> {
|
||||
override fun propertyToXmlAttributes(property: KtProperty): List<PsiElement> {
|
||||
val fqPath = property.getFqName()?.pathSegments() ?: return listOf()
|
||||
if (fqPath.size() <= AndroidConst.SYNTHETIC_PACKAGE_PATH_LENGTH) return listOf()
|
||||
|
||||
|
||||
+3
-3
@@ -28,11 +28,11 @@ import org.jetbrains.kotlin.android.synthetic.idea.AndroidXmlVisitor
|
||||
import org.jetbrains.kotlin.android.synthetic.res.AndroidResource
|
||||
import org.jetbrains.kotlin.android.synthetic.res.AndroidWidget
|
||||
import org.jetbrains.kotlin.android.synthetic.res.SyntheticFileGenerator
|
||||
import org.jetbrains.kotlin.psi.JetFile
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
|
||||
class IDESyntheticFileGenerator(val module: Module) : SyntheticFileGenerator(module.project) {
|
||||
|
||||
private val cachedJetFiles: CachedValue<List<JetFile>> by lazy {
|
||||
private val cachedJetFiles: CachedValue<List<KtFile>> by lazy {
|
||||
cachedValue {
|
||||
val supportV4 = supportV4Available()
|
||||
Result.create(generateSyntheticJetFiles(generateSyntheticFiles(true, supportV4)), psiTreeChangePreprocessor)
|
||||
@@ -45,7 +45,7 @@ class IDESyntheticFileGenerator(val module: Module) : SyntheticFileGenerator(mod
|
||||
module.project.getExtensions(PsiTreeChangePreprocessor.EP_NAME).first { it is AndroidPsiTreeChangePreprocessor }
|
||||
}
|
||||
|
||||
public override fun getSyntheticFiles(): List<JetFile> {
|
||||
public override fun getSyntheticFiles(): List<KtFile> {
|
||||
if (!checkIfClassExist(AndroidConst.VIEW_FQNAME)) return listOf()
|
||||
return cachedJetFiles.value
|
||||
}
|
||||
|
||||
+3
-3
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.android
|
||||
|
||||
import org.jetbrains.kotlin.psi.JetProperty
|
||||
import org.jetbrains.kotlin.psi.KtProperty
|
||||
import com.intellij.codeInsight.navigation.actions.GotoDeclarationAction
|
||||
|
||||
public abstract class AbstractAndroidGotoTest : KotlinAndroidTestCase() {
|
||||
@@ -32,8 +32,8 @@ public abstract class AbstractAndroidGotoTest : KotlinAndroidTestCase() {
|
||||
f.configureFromExistingVirtualFile(virtualFile)
|
||||
|
||||
val resolved = GotoDeclarationAction.findTargetElement(f.getProject(), f.getEditor(), f.getCaretOffset())
|
||||
if (f.getElementAtCaret() !is JetProperty) kotlin.test.fail("element at caret must be a property, not a ${f.getElementAtCaret().javaClass}")
|
||||
kotlin.test.assertEquals("\"@+id/${(f.getElementAtCaret() as JetProperty).getName()}\"", resolved?.getText())
|
||||
if (f.getElementAtCaret() !is KtProperty) kotlin.test.fail("element at caret must be a property, not a ${f.getElementAtCaret().javaClass}")
|
||||
kotlin.test.assertEquals("\"@+id/${(f.getElementAtCaret() as KtProperty).getName()}\"", resolved?.getText())
|
||||
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.android
|
||||
|
||||
import org.jetbrains.kotlin.psi.JetProperty
|
||||
import org.jetbrains.kotlin.psi.KtProperty
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil
|
||||
import com.intellij.codeInsight.TargetElementUtilBase
|
||||
import com.intellij.refactoring.rename.RenameProcessor
|
||||
@@ -41,7 +41,7 @@ public abstract class AbstractAndroidRenameTest : KotlinAndroidTestCase() {
|
||||
completionEditor, TargetElementUtilBase.REFERENCED_ELEMENT_ACCEPTED or TargetElementUtilBase.ELEMENT_NAME_ACCEPTED)
|
||||
|
||||
assert(element != null)
|
||||
assertTrue(element is JetProperty)
|
||||
assertTrue(element is KtProperty)
|
||||
|
||||
RenameProcessor(f.getProject(), element, NEW_NAME, false, true).run()
|
||||
|
||||
@@ -53,7 +53,7 @@ public abstract class AbstractAndroidRenameTest : KotlinAndroidTestCase() {
|
||||
val attributeElement = GotoDeclarationAction.findTargetElement(f.getProject(), f.getEditor(), f.getCaretOffset())
|
||||
RenameProcessor(f.getProject(), attributeElement, "@+id/$OLD_NAME", false, true).run()
|
||||
|
||||
assertEquals(OLD_NAME, (f.getElementAtCaret() as JetProperty).getName())
|
||||
assertEquals(OLD_NAME, (f.getElementAtCaret() as KtProperty).getName())
|
||||
}
|
||||
|
||||
override fun getTestDataPath() = KotlinAndroidTestCaseBase.getPluginTestDataPathBase() + "/rename/" + getTestName(true) + "/"
|
||||
|
||||
+2
-2
@@ -33,8 +33,8 @@ import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticWithParameters1
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.JetCallableDeclaration
|
||||
import org.jetbrains.kotlin.psi.JetDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtCallableDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.jvm.extensions.AnalysisCompletedHandlerExtension
|
||||
import java.io.BufferedWriter
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.cli.common.output.outputUtils.writeAllTo
|
||||
import org.jetbrains.kotlin.codegen.*
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.psi.JetFile
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.BindingTraceContext
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
|
||||
@@ -36,7 +36,7 @@ public class StubProducerExtension(val stubsOutputDir: File) : AnalysisCompleted
|
||||
project: Project,
|
||||
module: ModuleDescriptor,
|
||||
bindingContext: BindingContext,
|
||||
files: Collection<JetFile>
|
||||
files: Collection<KtFile>
|
||||
): AnalysisResult? {
|
||||
val forExtraDiagnostics = BindingTraceContext()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user