mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
do not open wildcards accessing elements of array (IDEA-57285)
This commit is contained in:
@@ -491,6 +491,10 @@ public class PsiImplUtil {
|
||||
toplevel = (PsiExpression)toplevel.getParent();
|
||||
}
|
||||
|
||||
if (toplevel instanceof PsiArrayAccessExpression) {
|
||||
return type;
|
||||
}
|
||||
|
||||
final PsiType normalized = doNormalizeWildcardByPosition(type, expression, toplevel);
|
||||
LOG.assertTrue(normalized.isValid(), type);
|
||||
if (normalized instanceof PsiClassType && !PsiUtil.isAccessedForWriting(toplevel)) {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package pck;
|
||||
|
||||
abstract class A<S> {
|
||||
S y;
|
||||
void bar(A<? extends int[]> x){
|
||||
Object obj = <error descr="Array type expected; found: 'capture<? extends int[]>'">x.y</error>[0];
|
||||
}
|
||||
|
||||
void baz(A<? super int[]> x){
|
||||
Object obj = <error descr="Array type expected; found: 'capture<? super int[]>'">x.y</error>[0];
|
||||
}
|
||||
}
|
||||
@@ -218,6 +218,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIDEA57265(){ doTest5(false); }
|
||||
public void testIDEA57271(){ doTest5(false); }
|
||||
public void testIDEA57272(){ doTest5(false); }
|
||||
public void testIDEA57285(){ doTest5(false); }
|
||||
public void testIDEA67571(){ doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
|
||||
public void testWildcardsOnRawTypes() { doTest5(false); }
|
||||
|
||||
Reference in New Issue
Block a user