mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-inspections] Test for IDEA-283404 Support Guava's ImmutableSet in 'Overwritten Map, Set, or array element' inspection
PR#1850 GitOrigin-RevId: 0ddfecbae4f28a80c75c87d63331ba3d3bcba7ef
This commit is contained in:
committed by
intellij-monorepo-bot
parent
de2f6db7db
commit
d5a368f4e3
@@ -1,4 +1,5 @@
|
||||
import java.util.*;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
class OverwrittenKey {
|
||||
void fillMap(Map<String, Integer> map) {
|
||||
@@ -59,6 +60,11 @@ class OverwrittenKey {
|
||||
System.out.println(xx);
|
||||
}
|
||||
|
||||
void guavaImmutableSetOf() {
|
||||
ImmutableSet<Double> s = ImmutableSet.of(<warning descr="Duplicate Set element">-10.</warning>, 1d, <warning descr="Duplicate Set element">-10.0</warning>);
|
||||
System.out.println(s);
|
||||
}
|
||||
|
||||
void testParameter(Map<Object, Object> map, String key) {
|
||||
map.put(<warning descr="Duplicate Map key">key</warning>, "k1");
|
||||
map.put(<warning descr="Duplicate Map key">key</warning>, "k2");
|
||||
|
||||
+6
@@ -12,6 +12,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class OverwrittenKeyInspectionTest extends LightJavaInspectionTestCase {
|
||||
public void testOverwrittenKey() {
|
||||
myFixture.addClass("package com.google.common.collect;\n" +
|
||||
"public abstract class ImmutableSet<E> implements Set<E> {\n" +
|
||||
" public static <E> ImmutableSet<E> of(E... e) {\n" +
|
||||
" throw new UnsupportedOperationException();\n" +
|
||||
" }\n" +
|
||||
"}");
|
||||
doTest();
|
||||
}
|
||||
public void testOverwrittenKeyArray() {
|
||||
|
||||
Reference in New Issue
Block a user