You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure whether this is really a bug in spotbugs, or if my java 11 compiler just does some magic I can't figure out. Perhaps someone out here has some idea.
The following code produces the error:
@TestpublicvoidmapAddTileTwiceTest() {
Map<TestPassage> map = newMap<>(4);
Tile<TestPassage> firstTile = newTile<>(0,0, TestPassage.PRESENT, TestPassage.PRESENT, TestPassage.PRESENT, TestPassage.PRESENT, false);
Tile<TestPassage> secondTile = newTile<>(0,0, TestPassage.NONE, TestPassage.NONE, TestPassage.NONE, TestPassage.NONE, true);
map.addTile(firstTile);
Assertions.assertThrows(IllegalArgumentException.class, () -> map.addTile(secondTile),
"adding two tiles at the same position should throw an IllegalArgumentException");
}
Obviously, I'm not able to change the lambda expression to a method reference as the method has a parameter.
Unfortunately, I was not able to reproduce it with some general Java classes, but changing map.addTile(secondTile) to map.addTile(new Tile<>(0,0, TestPassage.NONE, TestPassage.NONE, TestPassage.NONE, TestPassage.NONE, true)) (inlining the object creation) eliminates the warning.
The text was updated successfully, but these errors were encountered:
I'm not sure whether this is really a bug in spotbugs, or if my java 11 compiler just does some magic I can't figure out. Perhaps someone out here has some idea.
The following code produces the error:
Obviously, I'm not able to change the lambda expression to a method reference as the method has a parameter.
Unfortunately, I was not able to reproduce it with some general Java classes, but changing
map.addTile(secondTile)
tomap.addTile(new Tile<>(0,0, TestPassage.NONE, TestPassage.NONE, TestPassage.NONE, TestPassage.NONE, true))
(inlining the object creation) eliminates the warning.The text was updated successfully, but these errors were encountered: