[duplicates] enable duplicates analysis in PyCharm/WebStorm/PhpStorm/RubyMine

GitOrigin-RevId: 1545b79fdca4888f4b94f47f22703fd37694fa7a
This commit is contained in:
Alexandr Suhinin
2019-05-13 15:56:13 +03:00
committed by intellij-monorepo-bot
parent e12af508c9
commit 9215f4240b
5566 changed files with 30749 additions and 145848 deletions

View File

@@ -1,15 +0,0 @@
interface Either {
public static final class Left<L> {
private final L value;
private Left(L value) {
this.value = value;
}
}
}
class Main {
{
new <error descr="'Left(L)' has private access in 'Either.Left'">Either.Left<></error>("");
}
}

View File

@@ -1,21 +0,0 @@
import java.util.function.*;
class A {
{
B<Double> local;
method(local = new B<>(new C<>((supplier) -> supplier.get())));
}
void method(B<?> value) {
}
}
class B<T> {
B(C<T> c) { }
}
class C<T> {
C(Function<Supplier<T>, T> f) { }
}

View File

@@ -1,12 +0,0 @@
import java.util.function.Predicate;
class Foo<T> {
public Foo(Predicate<T> p) {
}
void m(Predicate<String> p){
new Foo<>(p == null ? null : acc -> p.test<error descr="'test(java.lang.String)' in 'java.util.function.Predicate' cannot be applied to '(java.lang.Object)'">(acc)</error>);
new Foo<>(acc -> p.test<error descr="'test(java.lang.String)' in 'java.util.function.Predicate' cannot be applied to '(java.lang.Object)'">(acc)</error>);
}
}

View File

@@ -10,7 +10,7 @@ class MyTest {
public <T> void from(Collection<T> elements) { }
public void foo(final Stream<String> artifactStream) {
from<error descr="Ambiguous method call: both 'MyTest.from(Page<String>)' and 'MyTest.from(Collection<String>)' match">(artifactStream.collect(Collectors.toCollection(TreeSet<String>::new)))</error>;
from(artifactStream.collect(Collectors.toCollection(<error descr="Bad return type in method reference: cannot convert java.util.TreeSet<java.lang.String> to C">TreeSet<String>::new</error>)));
}
interface Page<T> extends Iterable<T> {}

View File

@@ -1,6 +1,6 @@
class IntStream {
private void foo(IntStream s) {
s.<error descr="Ambiguous method call: both 'IntStream.map(IntUnaryOperator)' and 'IntStream.map(ObjIntFunction<Object>)' match">map</error>(i -> <error descr="Operator '<<' cannot be applied to 'int', '<lambda parameter>'">1 << i</error>);
s.<error descr="Ambiguous method call: both 'IntStream.map(IntUnaryOperator)' and 'IntStream.map(ObjIntFunction<Object>)' match">map</error>(i -> 1 << i);
s.<error descr="Ambiguous method call: both 'IntStream.map(IntUnaryOperator)' and 'IntStream.map(ObjIntFunction<Object>)' match">map</error>(i -> 1);
s.<error descr="Ambiguous method call: both 'IntStream.map(IntUnaryOperator)' and 'IntStream.map(ObjIntFunction<Object>)' match">map</error>(i -> i);
}

View File

@@ -13,7 +13,7 @@ class Foo<R> {
public void foo() {
reduce(Moo::new);
reduce<error descr="'reduce(Foo.Factory<S>)' in 'Foo' cannot be applied to '(<method reference>)'">(AMoo::new)</error>;
reduce(<error descr="Bad return type in method reference: cannot convert Foo<R>.AMoo to S">AMoo::new</error>);
reduce(AAMoo::new);
reduce(AAAMoo::new);
}

View File

@@ -14,7 +14,7 @@ class Test {
class Test2 {
static void m(Integer i) { }
static void m(Integer <warning descr="Parameter 'i' is never used">i</warning>) { }
interface I1 {
void m(int x);

View File

@@ -77,7 +77,7 @@ abstract class AbstractCollection<E> implements Collection<E> {
public boolean add(E e) {
return true;
}
public boolean addAll(Collection<? extends E> c) {
public boolean addAll(Collection<? extends E> <warning descr="Parameter 'c' is never used">c</warning>) {
boolean modified = false;
return modified;
}

View File

@@ -7,7 +7,7 @@ interface B<BT> {
class Test {
public static void test() {
method1<error descr="'method1(B<A<? super M>>)' in 'Test' cannot be applied to '(<method reference>)'">(Test::method2)</error>;
method1(Test::<error descr="Incompatible types: A<capture of ? super M> is not convertible to A<? super String>">method2</error>);
}
static <M> void method1(B<A<? super M>> arg) { }

View File

@@ -1,23 +0,0 @@
class Logger {}
class Test {
public static void main(String[] args) {
User user = new User();
Logger logger = null;
foo<error descr="'foo(T, java.util.logging.Logger, java.util.function.Function<T,java.lang.String>)' in 'Test' cannot be applied to '(User, Logger, <method reference>)'">(user, logger, User::getId)</error>;
}
private static <T> void foo(T val, java.util.logging.Logger logger, java.util.function.Function<T, String> idFunction) { }
}
class User {
private String Id;
public String getId() {
return Id;
}
public void setId(String id) {
this.Id = id;
}
}

View File

@@ -6,11 +6,11 @@ class Test {
Test m(List<Integer> l1, List<Integer> l2);
}
static Test meth(List<Integer>... lli) {
static Test meth(List<Integer>... <warning descr="Parameter 'lli' is never used">lli</warning>) {
return null;
}
Test(List<Integer>... lli) {}
Test(List<Integer>... <warning descr="Parameter 'lli' is never used">lli</warning>) {}
{
I <warning descr="Variable 'i1' is never used">i1</warning> = <warning descr="Unchecked generics array creation for varargs parameter">Test::meth</warning>;

View File

@@ -1,7 +1,7 @@
import java.util.stream.Stream;
class A {
private void test5(Integer i, String... strings) {}
private void test5(Integer <warning descr="Parameter 'i' is never used">i</warning>, String... <warning descr="Parameter 'strings' is never used">strings</warning>) {}
private void <warning descr="Private method 'test5(java.lang.Integer, java.lang.Integer, java.lang.String...)' is never used">test5</warning>(Integer i, Integer b, String... strings) {
System.out.println(i);
System.out.println(b);

View File

@@ -14,7 +14,7 @@ class Test {
}
void fooBar(IntStream1 instr){
Supplier<Stream<Integer>> si = () -> instr.<error descr="Ambiguous method call: both 'IntStream1.map(IntFunction<Integer>)' and 'IntStream1.map(IntUnaryOperator)' match">map</error> ((i) -> (( <error descr="Operator '%' cannot be applied to '<lambda parameter>', 'int'">i % 2</error>) == 0) ? i : <error descr="Operator '-' cannot be applied to '<lambda parameter>'">-i</error>).boxed();
Supplier<Stream<Integer>> si = () -> instr.<error descr="Ambiguous method call: both 'IntStream1.map(IntFunction<Integer>)' and 'IntStream1.map(IntUnaryOperator)' match">map</error> ((i) -> (( <error descr="Operator '%' cannot be applied to '<lambda parameter>', 'int'">i % 2</error>) == 0) ? i : -i).boxed();
System.out.println(si);
Supplier<Stream<Integer>> si1 = () -> instr.map <error descr="Ambiguous method call: both 'IntStream1.map(IntFunction<Integer>)' and 'IntStream1.map(IntUnaryOperator)' match">(null)</error>.boxed();
System.out.println(si1);

View File

@@ -12,7 +12,7 @@ class MyTest<T> {
public static class Builder<E> {
public Builder<E> add(E element) {
public Builder<E> add(E <warning descr="Parameter 'element' is never used">element</warning>) {
return this;
}

View File

@@ -8,6 +8,6 @@ class Main {
}
public static boolean checkForJdk(String <warning descr="Parameter 'homePath' is never used">homePath</warning>) {return false;}
public static boolean checkForJdk(File homePath) {return false;}
public static boolean checkForJdk(File <warning descr="Parameter 'homePath' is never used">homePath</warning>) {return false;}
}

View File

@@ -12,17 +12,4 @@ interface Test {
static void of(String... lists) { }
}
interface Entry<T> { }
interface ClassA<T> {
static <T> void f(Iterable<T> values) {
}
}
interface ClassB<T> extends ClassA<Entry<T>> {
static <T> void f(Iterable<? extends Entry<? extends T>> values) {}
static void m(Iterable<Entry<String>> x) {
f(x);
}
}

View File

@@ -14,10 +14,10 @@ abstract class Test {
foo(x -> {
return x += 1;
});
<error descr="Ambiguous method call: both 'Test.foo(A)' and 'Test.foo(B)' match">foo</error>(x -> <error descr="Incompatible types. Found: 'int', required: '<lambda parameter>'">x += 1</error>);
<error descr="Ambiguous method call: both 'Test.foo(A)' and 'Test.foo(B)' match">foo</error>(x -> x += 1);
foo(x -> 1);
foo(x -> <error descr="Operator '!' cannot be applied to 'int'">!x</error>);
<error descr="Ambiguous method call: both 'Test.foo(A)' and 'Test.foo(B)' match">foo</error>(x -> <error descr="Operator '++' cannot be applied to '<lambda parameter>'">++x</error>);
<error descr="Ambiguous method call: both 'Test.foo(A)' and 'Test.foo(B)' match">foo</error>(x -> ++x);
foo(x -> o instanceof String ? 1 : 0);
}
}