Skip to content

Commit

Permalink
Turn on additional IntelliJ inspections and fix violations. #1323
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Goldberg <alexander.goldberg@bnymellon.com>
  • Loading branch information
goldbal330 committed Apr 25, 2022
1 parent a4d4621 commit 6ea1fec
Show file tree
Hide file tree
Showing 31 changed files with 79 additions and 54 deletions.
4 changes: 2 additions & 2 deletions .idea/inspectionProfiles/2_Inconsistent_Constructs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/inspectionProfiles/IDE.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -10,6 +10,7 @@

package org.eclipse.collections.codegenerator;

@FunctionalInterface
public interface ErrorListener
{
void error(String string);
Expand Down
Expand Up @@ -281,19 +281,19 @@ public static void assertEmpty(String mutableMapIterableName, MutableMapIterable
{
Assert.fail(mutableMapIterableName + " should be empty; actual size:<" + Iterate.sizeOf(actualMutableMapIterable) + '>');
}
if (actualMutableMapIterable.size() != 0)
if (!actualMutableMapIterable.isEmpty())
{
Assert.fail(mutableMapIterableName + " should be empty; actual size:<" + actualMutableMapIterable.size() + '>');
}
if (actualMutableMapIterable.keySet().size() != 0)
if (!actualMutableMapIterable.keySet().isEmpty())
{
Assert.fail(mutableMapIterableName + " should be empty; actual size:<" + actualMutableMapIterable.keySet().size() + '>');
}
if (actualMutableMapIterable.values().size() != 0)
if (!actualMutableMapIterable.values().isEmpty())
{
Assert.fail(mutableMapIterableName + " should be empty; actual size:<" + actualMutableMapIterable.values().size() + '>');
}
if (actualMutableMapIterable.entrySet().size() != 0)
if (!actualMutableMapIterable.entrySet().isEmpty())
{
Assert.fail(mutableMapIterableName + " should be empty; actual size:<" + actualMutableMapIterable.entrySet().size() + '>');
}
Expand Down Expand Up @@ -322,6 +322,7 @@ public static void assertEmpty(PrimitiveIterable primitiveIterable)
/**
* Assert that the given {@link PrimitiveIterable} is empty.
*/
@SuppressWarnings("SizeReplaceableByIsEmpty")
public static void assertEmpty(String iterableName, PrimitiveIterable primitiveIterable)
{
try
Expand Down Expand Up @@ -489,6 +490,7 @@ public static void assertEmpty(Multimap<?, ?> actualMultimap)
/**
* Assert that the given {@link Multimap} is empty.
*/
@SuppressWarnings("SizeReplaceableByIsEmpty")
public static void assertEmpty(String multimapName, Multimap<?, ?> actualMultimap)
{
try
Expand All @@ -511,23 +513,23 @@ public static void assertEmpty(String multimapName, Multimap<?, ?> actualMultima
{
Assert.fail(multimapName + " should be empty; actual size:<" + actualMultimap.size() + '>');
}
if (actualMultimap.keyBag().size() != 0)
if (!actualMultimap.keyBag().isEmpty())
{
Assert.fail(multimapName + " should be empty; actual size:<" + actualMultimap.keyBag().size() + '>');
}
if (actualMultimap.keysView().size() != 0)
if (!actualMultimap.keysView().isEmpty())
{
Assert.fail(multimapName + " should be empty; actual size:<" + actualMultimap.keysView().size() + '>');
}
if (actualMultimap.valuesView().size() != 0)
if (!actualMultimap.valuesView().isEmpty())
{
Assert.fail(multimapName + " should be empty; actual size:<" + actualMultimap.valuesView().size() + '>');
}
if (actualMultimap.keyValuePairsView().size() != 0)
if (!actualMultimap.keyValuePairsView().isEmpty())
{
Assert.fail(multimapName + " should be empty; actual size:<" + actualMultimap.keyValuePairsView().size() + '>');
}
if (actualMultimap.keyMultiValuePairsView().size() != 0)
if (!actualMultimap.keyMultiValuePairsView().isEmpty())
{
Assert.fail(multimapName + " should be empty; actual size:<" + actualMultimap.keyMultiValuePairsView().size() + '>');
}
Expand All @@ -541,6 +543,7 @@ public static void assertEmpty(String multimapName, Multimap<?, ?> actualMultima
/**
* Assert that the given {@link Map} is empty.
*/
@SuppressWarnings("SizeReplaceableByIsEmpty")
public static void assertEmpty(String mapName, Map<?, ?> actualMap)
{
try
Expand All @@ -555,15 +558,15 @@ public static void assertEmpty(String mapName, Map<?, ?> actualMap)
{
Assert.fail(mapName + " should be empty; actual size:<" + actualMap.size() + '>');
}
if (actualMap.keySet().size() != 0)
if (!actualMap.keySet().isEmpty())
{
Assert.fail(mapName + " should be empty; actual size:<" + actualMap.keySet().size() + '>');
}
if (actualMap.values().size() != 0)
if (!actualMap.values().isEmpty())
{
Assert.fail(mapName + " should be empty; actual size:<" + actualMap.values().size() + '>');
}
if (actualMap.entrySet().size() != 0)
if (!actualMap.entrySet().isEmpty())
{
Assert.fail(mapName + " should be empty; actual size:<" + actualMap.entrySet().size() + '>');
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Goldman Sachs.
* Copyright (c) 2022 Goldman Sachs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
Expand Down Expand Up @@ -202,7 +202,7 @@ private static class Empty extends Predicates<String>
@Override
public boolean accept(String anObject)
{
return anObject != null && anObject.length() == 0;
return anObject != null && anObject.isEmpty();
}

@Override
Expand All @@ -219,7 +219,7 @@ private static class NotEmpty extends Predicates<String>
@Override
public boolean accept(String anObject)
{
return anObject != null && anObject.length() > 0;
return anObject != null && !anObject.isEmpty();
}

@Override
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Goldman Sachs.
* Copyright (c) 2022 Goldman Sachs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
Expand All @@ -15,6 +15,7 @@
/**
* A functional interface that can be represented by a Lambda that can throw a CheckedException.
*/
@FunctionalInterface
public interface ThrowingFunction<T, V> extends Serializable
{
@SuppressWarnings("ProhibitedExceptionDeclared")
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Goldman Sachs.
* Copyright (c) 2022 Goldman Sachs.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
Expand All @@ -15,6 +15,7 @@
/**
* A functional interface that can be represented by a Lambda that can throw a CheckedException.
*/
@FunctionalInterface
public interface ThrowingFunction0<R> extends Serializable
{
@SuppressWarnings("ProhibitedExceptionDeclared")
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Goldman Sachs.
* Copyright (c) 2022 Goldman Sachs.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
Expand All @@ -15,6 +15,7 @@
/**
* A functional interface that can be represented by a Lambda that can throw a CheckedException.
*/
@FunctionalInterface
public interface ThrowingFunction2<T1, T2, R> extends Serializable
{
@SuppressWarnings("ProhibitedExceptionDeclared")
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Goldman Sachs.
* Copyright (c) 2022 Goldman Sachs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
Expand All @@ -19,6 +19,7 @@
*
* @deprecated since 3.0. Use {@link CharToCharFunction} instead.
*/
@FunctionalInterface
@Deprecated
public interface CharFunction
extends Serializable
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Goldman Sachs.
* Copyright (c) 2022 Goldman Sachs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
Expand All @@ -15,6 +15,7 @@
/**
* A CharFunction can be used to convert one character to another.
*/
@FunctionalInterface
public interface CodePointFunction
extends Serializable
{
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Goldman Sachs.
* Copyright (c) 2022 Goldman Sachs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
Expand All @@ -15,6 +15,7 @@
/**
* A Predicate that accepts an int value
*/
@FunctionalInterface
public interface CodePointPredicate
extends Serializable
{
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Goldman Sachs.
* Copyright (c) 2022 Goldman Sachs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
Expand All @@ -15,6 +15,7 @@
/**
* A functional interface that can be represented by a Lambda that can throw a CheckedException.
*/
@FunctionalInterface
public interface ThrowingPredicate<T> extends Serializable
{
@SuppressWarnings("ProhibitedExceptionDeclared")
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Goldman Sachs.
* Copyright (c) 2022 Goldman Sachs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
Expand All @@ -15,6 +15,7 @@
/**
* A functional interface that can be represented by a Lambda that can throw a CheckedException.
*/
@FunctionalInterface
public interface ThrowingPredicate2<T, P> extends Serializable
{
@SuppressWarnings("ProhibitedExceptionDeclared")
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Goldman Sachs.
* Copyright (c) 2022 Goldman Sachs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
Expand All @@ -17,6 +17,7 @@
*
* @deprecated since 3.0. Use {@link org.eclipse.collections.api.block.predicate.primitive.CharPredicate} instead.
*/
@FunctionalInterface
@Deprecated
public interface CharPredicate
extends Serializable
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Goldman Sachs.
* Copyright (c) 2022 Goldman Sachs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
Expand All @@ -15,6 +15,7 @@
/**
* A functional interface that can be represented by a Lambda that can throw a CheckedException.
*/
@FunctionalInterface
public interface ThrowingProcedure<T> extends Serializable
{
@SuppressWarnings("ProhibitedExceptionDeclared")
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Goldman Sachs.
* Copyright (c) 2022 Goldman Sachs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
Expand All @@ -15,6 +15,7 @@
/**
* A functional interface that can be represented by a Lambda that can throw a CheckedException.
*/
@FunctionalInterface
public interface ThrowingProcedure2<T, P> extends Serializable
{
@SuppressWarnings("ProhibitedExceptionDeclared")
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Goldman Sachs.
* Copyright (c) 2022 Goldman Sachs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
Expand All @@ -13,6 +13,7 @@
/**
* @deprecated since 3.0 use {@link org.eclipse.collections.api.block.procedure.primitive.CharProcedure}
*/
@FunctionalInterface
@Deprecated
public interface CharProcedure
{
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Goldman Sachs.
* Copyright (c) 2022 Goldman Sachs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
Expand All @@ -10,6 +10,7 @@

package org.eclipse.collections.impl.block.procedure.primitive;

@FunctionalInterface
public interface CodePointProcedure
{
void value(int codePoint);
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Goldman Sachs.
* Copyright (c) 2022 Goldman Sachs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
Expand All @@ -18,6 +18,7 @@
*
* @deprecated since 3.0 use {@link org.eclipse.collections.api.block.procedure.primitive.IntIntProcedure}
*/
@FunctionalInterface
@Deprecated
public interface IntIntProcedure extends Serializable
{
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Goldman Sachs.
* Copyright (c) 2022 Goldman Sachs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
Expand All @@ -13,6 +13,7 @@
/**
* @deprecated since 3.0 use {@link org.eclipse.collections.api.block.procedure.primitive.IntObjectProcedure}
*/
@FunctionalInterface
@Deprecated
public interface IntObjectProcedure<T>
{
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Goldman Sachs.
* Copyright (c) 2022 Goldman Sachs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
Expand All @@ -13,6 +13,7 @@
/**
* @deprecated since 3.0 use {@link org.eclipse.collections.api.block.procedure.primitive.IntProcedure}
*/
@FunctionalInterface
@Deprecated
public interface IntProcedure
{
Expand Down

0 comments on commit 6ea1fec

Please sign in to comment.