Files
Tagir Valeevandintellij-monorepo-bot 6f8f56d319 [java-inspections] Fix interaction with suppression
1. Don't include suppression comment itself to the inspection range
2. Use first statement as anchor when possible (otherwise suppression mechanism went wild)
Fixes (in most of the cases) IDEA-341289 Wrong "Redundant suppression" warning for suppression for "Extract method" weak warning

GitOrigin-RevId: 5fa48805d9b34236a733a206275d3b21c26bd2ef
2023-12-20 22:44:48 +00:00

33 lines
883 B
Java

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
class Main {
public static void main(String[] args) {
char[][] field = new char[10][10];
for (char[] chars : field) {
Arrays.fill(chars, '.');
}
//noinspection ExtractMethodRecommender
List<String> list = new ArrayList<>();
int numRows = field.length;
int numCols = field[0].length;
for (int row = 0; row < numRows; row++) {
if (field[row][0] == '.') {
list.add("Empty first cell at row " + row);
}
}
for (int col = 0; col < numCols; col++) {
if (field[0][col] == '.') {
list.add("Empty first cell at col " + col);
}
}
for (String dummyText : list) {
// More dummy stuff to trigger warning
System.out.println(dummyText);
System.out.println("Dummy stuff to trigger the warning");
}
}
}