KtLightMethod(Field): use dummyDelegate to determine modifier properties
This commit is contained in:
@@ -91,7 +91,7 @@ sealed class KtLightFieldImpl<T: PsiField>(
|
|||||||
|
|
||||||
override fun getModifierList() = _modifierList
|
override fun getModifierList() = _modifierList
|
||||||
|
|
||||||
override fun hasModifierProperty(@NonNls name: String) = clsDelegate.hasModifierProperty(name)
|
override fun hasModifierProperty(@NonNls name: String) = (dummyDelegate ?: clsDelegate).hasModifierProperty(name)
|
||||||
|
|
||||||
override fun getText() = kotlinOrigin?.text ?: ""
|
override fun getText() = kotlinOrigin?.text ?: ""
|
||||||
|
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ class KtLightMethodImpl private constructor(
|
|||||||
|
|
||||||
override fun getName() = dummyDelegate?.name ?: clsDelegate.name
|
override fun getName() = dummyDelegate?.name ?: clsDelegate.name
|
||||||
|
|
||||||
override fun hasModifierProperty(name: String) = clsDelegate.hasModifierProperty(name)
|
override fun hasModifierProperty(name: String) = (dummyDelegate ?: clsDelegate).hasModifierProperty(name)
|
||||||
|
|
||||||
override fun getThrowsList() = clsDelegate.throwsList
|
override fun getThrowsList() = clsDelegate.throwsList
|
||||||
|
|
||||||
|
|||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
public final class A {
|
||||||
|
@kotlin.jvm.Transient
|
||||||
|
@kotlin.jvm.Volatile
|
||||||
|
@org.jetbrains.annotations.NotNull
|
||||||
|
private transient volatile java.lang.String c;
|
||||||
|
|
||||||
|
@kotlin.jvm.Synchronized
|
||||||
|
@kotlin.jvm.Strictfp
|
||||||
|
public final synchronized strictfp void f() { /* compiled code */ }
|
||||||
|
|
||||||
|
@org.jetbrains.annotations.NotNull
|
||||||
|
public final java.lang.String getC() { /* compiled code */ }
|
||||||
|
|
||||||
|
public final void setC(@org.jetbrains.annotations.NotNull java.lang.String p) { /* compiled code */ }
|
||||||
|
|
||||||
|
public A() { /* compiled code */ }
|
||||||
|
}
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
// A
|
||||||
|
|
||||||
|
class A {
|
||||||
|
@Synchronized
|
||||||
|
@Strictfp
|
||||||
|
fun f() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
@Volatile
|
||||||
|
var c: String = ""
|
||||||
|
}
|
||||||
@@ -80,6 +80,12 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/compilationErrors"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/compilationErrors"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("AnnotationModifiers.kt")
|
||||||
|
public void testAnnotationModifiers() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/compilationErrors/AnnotationModifiers.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("SameName.kt")
|
@TestMetadata("SameName.kt")
|
||||||
public void testSameName() throws Exception {
|
public void testSameName() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/compilationErrors/SameName.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/compilationErrors/SameName.kt");
|
||||||
|
|||||||
@@ -19,10 +19,7 @@ package org.jetbrains.kotlin.idea.caches.resolve
|
|||||||
import com.intellij.openapi.project.Project
|
import com.intellij.openapi.project.Project
|
||||||
import com.intellij.openapi.roots.ModuleRootModificationUtil
|
import com.intellij.openapi.roots.ModuleRootModificationUtil
|
||||||
import com.intellij.openapi.util.io.FileUtilRt
|
import com.intellij.openapi.util.io.FileUtilRt
|
||||||
import com.intellij.psi.JavaPsiFacade
|
import com.intellij.psi.*
|
||||||
import com.intellij.psi.PsiClass
|
|
||||||
import com.intellij.psi.PsiField
|
|
||||||
import com.intellij.psi.PsiMethod
|
|
||||||
import com.intellij.psi.impl.java.stubs.PsiJavaFileStub
|
import com.intellij.psi.impl.java.stubs.PsiJavaFileStub
|
||||||
import com.intellij.psi.search.GlobalSearchScope
|
import com.intellij.psi.search.GlobalSearchScope
|
||||||
import com.intellij.psi.util.PsiTreeUtil
|
import com.intellij.psi.util.PsiTreeUtil
|
||||||
@@ -188,21 +185,28 @@ object LightClassLazinessChecker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private data class FieldInfo(
|
private data class FieldInfo(
|
||||||
val name: String
|
val name: String,
|
||||||
|
val modifiers: List<String>
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun fieldInfo(field: PsiField) = with(field) {
|
private fun fieldInfo(field: PsiField) = with(field) {
|
||||||
FieldInfo(name!!)
|
FieldInfo(
|
||||||
|
name!!, PsiModifier.MODIFIERS.asList().filter { hasModifierProperty(it) }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private data class MethodInfo(
|
private data class MethodInfo(
|
||||||
val name: String,
|
val name: String,
|
||||||
|
val modifiers: List<String>,
|
||||||
val isConstructor: Boolean,
|
val isConstructor: Boolean,
|
||||||
val parameterCount: Int
|
val parameterCount: Int
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun methodInfo(method: PsiMethod) = with(method) {
|
private fun methodInfo(method: PsiMethod) = with(method) {
|
||||||
MethodInfo(name, isConstructor, method.parameterList.parametersCount)
|
MethodInfo(
|
||||||
|
name, PsiModifier.MODIFIERS.asList().filter { hasModifierProperty(it) },
|
||||||
|
isConstructor, method.parameterList.parametersCount
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,12 @@ public class IdeLightClassTestGenerated extends AbstractIdeLightClassTest {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/compilationErrors"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/compilationErrors"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("AnnotationModifiers.kt")
|
||||||
|
public void testAnnotationModifiers() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/compilationErrors/AnnotationModifiers.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("SameName.kt")
|
@TestMetadata("SameName.kt")
|
||||||
public void testSameName() throws Exception {
|
public void testSameName() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/compilationErrors/SameName.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/compilationErrors/SameName.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user