Files
Tagir Valeevandintellij-monorepo-bot c89e362408 [java] Rework multi-dimensional arrays
This is necessary to support type annotations on array components properly. E.g. if the type is `@C int @A [] @B []`, then the outermost type is annotated via @A, its component via @B, and the deepest component is via @C (before this change, we assumed that the order is @B -> @A -> @C). This caused bugs when normalizing the mixed C-style/Java-style declaration that has annotations on any array component or when reading nullability from type in DFA (IDEA-245323)

Now PSI is changed for multi-dimensional arrays: PsiTypeElement now has only one PsiTypeElement child for the deepest component type and all brackets are placed on the same level.

GitOrigin-RevId: ac2e6eb2d4224e68a25270ccc2a71769bbb1afd3
2020-09-07 07:19:57 +00:00

17 lines
534 B
Java

import typeUse.*;
// IDEA-245323
class Test {
void test0(final Object @NotNull [] @Nullable [] values) {
for (final Object[] line : values) {
for (final Object item : <warning descr="Dereference of 'line' may produce 'NullPointerException'">line</warning>) {
}
}
}
void test1(final Object @Nullable[] @NotNull[] values) {
for (final Object[] line : <warning descr="Dereference of 'values' may produce 'NullPointerException'">values</warning>) {
for (final Object item : line) {
}
}
}
}