Don't report conflicting extension for marked with @HiddenDeclaration

This commit is contained in:
Valentin Kipyatkov
2015-08-31 23:04:12 +03:00
parent 690473313f
commit b2ea369129
2 changed files with 11 additions and 2 deletions
@@ -45,6 +45,7 @@ import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
import org.jetbrains.kotlin.resolve.descriptorUtil.isAnnotatedAsHidden
import org.jetbrains.kotlin.resolve.scopes.FileScope
import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
@@ -60,8 +61,12 @@ public class ConflictingExtensionPropertyInspection : AbstractKotlinInspection()
if (property.receiverTypeReference != null) {
val nameElement = property.nameIdentifier ?: return
val conflictingExtension = conflictingSyntheticExtension(property.resolveToDescriptor() as PropertyDescriptor, fileScope)
val propertyDescriptor = property.resolveToDescriptor() as PropertyDescriptor
val conflictingExtension = conflictingSyntheticExtension(propertyDescriptor, fileScope)
if (conflictingExtension != null) {
// don't report on hidden declarations
if (propertyDescriptor.isAnnotatedAsHidden()) return
val problemDescriptor = holder.manager.createProblemDescriptor(
nameElement,
"This property conflicts with synthetic extension and should be removed to avoid breaking code by future changes in the compiler",
@@ -13,4 +13,8 @@ val File.parent: File
class MyFile : File("")
val MyFile.isFile: Boolean
get() = isFile()
get() = isFile()
@HiddenDeclaration
val Thread.priority: Int
get() = getPriority()