mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-13 15:52:01 +07:00
[java-highlighting] IDEA-378880 False compilation error in a compact source file
- disable correction by scope for classes inside compact source files (cherry picked from commit 44831301a6c14f60d26ae4715df18c4cd24e1ee8) IJ-CR-175022 GitOrigin-RevId: 7240e79a4db2222006d0c32fdab7e38d4b167dde
This commit is contained in:
committed by
intellij-monorepo-bot
parent
19ad203e9b
commit
773f837fff
@@ -90,12 +90,12 @@ public final class PsiSuperMethodUtil {
|
||||
* For the multi-module projects which use different jdks or libraries,
|
||||
* it's important to map e.g. super class hierarchy to the current jdk.
|
||||
* <p>Example:</p>
|
||||
* Suppose there is an abstract reader in a module with jdk 1.6 which inherits {@link Closeable} (no super interfaces!).
|
||||
* Suppose there is an abstract reader in a module with jdk 1.6 which inherits {@link Closeable} (no super interfaces!).
|
||||
* In another module with jdk 1.7+ an inheritor of this reader should implement {@link AutoCloseable} though.
|
||||
*
|
||||
* @param psiClass a class to remap
|
||||
* @param resolveScope scope where class should be found
|
||||
* @return remapped class or same, if no other candidates were found
|
||||
*
|
||||
* @param psiClass a class to remap
|
||||
* @param resolveScope scope where class should be found
|
||||
* @return remapped class or same, if no other candidates were found
|
||||
*/
|
||||
public static @Nullable PsiClass correctClassByScope(@NotNull PsiClass psiClass, @NotNull GlobalSearchScope resolveScope) {
|
||||
String qualifiedName = psiClass.getQualifiedName();
|
||||
@@ -107,7 +107,10 @@ public final class PsiSuperMethodUtil {
|
||||
if (file == null || !file.getViewProvider().isPhysical()) {
|
||||
return psiClass;
|
||||
}
|
||||
|
||||
//it shouldn't be corrected because it is not inside indexes and doesn't have FQN
|
||||
if (JavaImplicitClassUtil.isFileWithImplicitClass(file)) {
|
||||
return psiClass;
|
||||
}
|
||||
final VirtualFile vFile = file.getVirtualFile();
|
||||
if (vFile == null) {
|
||||
return psiClass;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
void main() {
|
||||
new A() { public void a() {}}.a();
|
||||
new A.B() { public void a() {}}.b();
|
||||
|
||||
|
||||
var user = new MyUser();
|
||||
user.name = "test";
|
||||
}
|
||||
|
||||
interface A {
|
||||
void a();
|
||||
interface B extends A {
|
||||
default void b() {
|
||||
a();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Person{
|
||||
public String name;
|
||||
public int age;
|
||||
}
|
||||
|
||||
class MyUser extends Person{
|
||||
public String email;
|
||||
public String password;
|
||||
}
|
||||
@@ -280,6 +280,10 @@ class ImplicitClassHighlightingTest : LightJavaCodeInsightFixtureTestCase() {
|
||||
})
|
||||
}
|
||||
|
||||
fun testInheritedMembers() {
|
||||
doTest()
|
||||
}
|
||||
|
||||
private fun doTest() {
|
||||
myFixture.configureByFile(getTestName(false) + ".java")
|
||||
myFixture.checkHighlighting()
|
||||
|
||||
Reference in New Issue
Block a user