diff --git a/easy-random-bean-validation/pom.xml b/easy-random-bean-validation/pom.xml
index 78a4d546..8e964724 100644
--- a/easy-random-bean-validation/pom.xml
+++ b/easy-random-bean-validation/pom.xml
@@ -6,7 +6,7 @@
io.github.dvgaba
easy-random
- 6.1.0
+ 6.1.1
4.0.0
easy-random-bean-validation
diff --git a/easy-random-core/pom.xml b/easy-random-core/pom.xml
index 71bfa3c9..0c5d15d2 100644
--- a/easy-random-core/pom.xml
+++ b/easy-random-core/pom.xml
@@ -6,7 +6,7 @@
io.github.dvgaba
easy-random
- 6.1.0
+ 6.1.1
4.0.0
easy-random-core
diff --git a/easy-random-core/src/main/java/org/jeasy/random/RandomizationContext.java b/easy-random-core/src/main/java/org/jeasy/random/RandomizationContext.java
index b9a527f4..e04d0b88 100644
--- a/easy-random-core/src/main/java/org/jeasy/random/RandomizationContext.java
+++ b/easy-random-core/src/main/java/org/jeasy/random/RandomizationContext.java
@@ -23,8 +23,6 @@
*/
package org.jeasy.random;
-import static java.util.stream.Collectors.toList;
-
import java.lang.reflect.Field;
import java.util.*;
import org.jeasy.random.api.RandomizerContext;
@@ -108,7 +106,7 @@ private List getStackedFieldNames() {
}
private List toLowerCase(final List strings) {
- return strings.stream().map(String::toLowerCase).collect(toList());
+ return strings.stream().map(String::toLowerCase).toList();
}
void setRandomizedObject(Object randomizedObject) {
diff --git a/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java b/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java
index 342457d7..990b2da0 100644
--- a/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java
+++ b/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java
@@ -26,7 +26,6 @@
import static java.lang.String.format;
import static java.util.Arrays.asList;
import static java.util.Locale.ENGLISH;
-import static java.util.stream.Collectors.toList;
import static org.jeasy.random.util.ConversionUtils.convertArguments;
import java.lang.annotation.Annotation;
@@ -203,7 +202,7 @@ public static boolean isPrimitiveFieldWithDefaultValue(final Object object, fina
if (fieldValue == null) {
return false;
}
- if (fieldType.equals(boolean.class) && (boolean) fieldValue == false) {
+ if (fieldType.equals(boolean.class) && !((boolean) fieldValue)) {
return true;
}
if (fieldType.equals(byte.class) && (byte) fieldValue == (byte) 0) {
@@ -374,11 +373,7 @@ public static boolean isJdkBuiltIn(final Class> type) {
* @return true if the type is parameterized, false otherwise
*/
public static boolean isParameterizedType(final Type type) {
- return (
- type != null &&
- type instanceof ParameterizedType &&
- ((ParameterizedType) type).getActualTypeArguments().length > 0
- );
+ return (type instanceof ParameterizedType && ((ParameterizedType) type).getActualTypeArguments().length > 0);
}
/**
@@ -420,8 +415,8 @@ public static List> getPublicConcreteSubTypesOf(final Class type
* @return a list of types having the same parameterized types as the given type
*/
public static List> filterSameParameterizedTypes(final List> types, final Type type) {
- if (type instanceof ParameterizedType) {
- Type[] fieldArugmentTypes = ((ParameterizedType) type).getActualTypeArguments();
+ if (type instanceof ParameterizedType parameterizedType) {
+ Type[] fieldArugmentTypes = parameterizedType.getActualTypeArguments();
List> typesWithSameParameterizedTypes = new ArrayList<>();
for (Class> currentConcreteType : types) {
List actualTypeArguments = getActualTypeArgumentsOfGenericInterfaces(currentConcreteType);
@@ -430,7 +425,7 @@ public static List> filterSameParameterizedTypes(final List> t
.stream()
.filter(currentTypeArguments -> Arrays.equals(fieldArugmentTypes, currentTypeArguments))
.map(currentTypeArguments -> currentConcreteType)
- .collect(toList())
+ .toList()
);
}
return typesWithSameParameterizedTypes;
@@ -598,8 +593,8 @@ private static List getActualTypeArgumentsOfGenericInterfaces(final Clas
List actualTypeArguments = new ArrayList<>();
Type[] genericInterfaceTypes = type.getGenericInterfaces();
for (Type currentGenericInterfaceType : genericInterfaceTypes) {
- if (currentGenericInterfaceType instanceof ParameterizedType) {
- actualTypeArguments.add(((ParameterizedType) currentGenericInterfaceType).getActualTypeArguments());
+ if (currentGenericInterfaceType instanceof ParameterizedType parameterizedType) {
+ actualTypeArguments.add((parameterizedType).getActualTypeArguments());
}
}
return actualTypeArguments;
diff --git a/easy-random-protobuf/pom.xml b/easy-random-protobuf/pom.xml
index cc59ee96..76fade93 100644
--- a/easy-random-protobuf/pom.xml
+++ b/easy-random-protobuf/pom.xml
@@ -6,7 +6,7 @@
io.github.dvgaba
easy-random
- 6.1.0
+ 6.1.1
4.0.0
easy-random-protobuf
diff --git a/easy-random-protobuf/src/main/java/org/jeasy/random/protobuf/ProtobufExclusionPolicy.java b/easy-random-protobuf/src/main/java/org/jeasy/random/protobuf/ProtobufExclusionPolicy.java
index cd51cf9f..a59e0b30 100644
--- a/easy-random-protobuf/src/main/java/org/jeasy/random/protobuf/ProtobufExclusionPolicy.java
+++ b/easy-random-protobuf/src/main/java/org/jeasy/random/protobuf/ProtobufExclusionPolicy.java
@@ -9,6 +9,7 @@
public class ProtobufExclusionPolicy extends DefaultExclusionPolicy {
+ @Override
public boolean shouldBeExcluded(final Field field, final RandomizerContext context, Object object) {
if (!(object instanceof FieldDescriptor)) {
throw new IllegalArgumentException("3rd parameter must be of FieldDescriptor");
diff --git a/easy-random-protobuf/src/main/java/org/jeasy/random/protobuf/ProtobufMessageBuilderRandomizer.java b/easy-random-protobuf/src/main/java/org/jeasy/random/protobuf/ProtobufMessageBuilderRandomizer.java
index 14efe37d..999e07c5 100644
--- a/easy-random-protobuf/src/main/java/org/jeasy/random/protobuf/ProtobufMessageBuilderRandomizer.java
+++ b/easy-random-protobuf/src/main/java/org/jeasy/random/protobuf/ProtobufMessageBuilderRandomizer.java
@@ -34,7 +34,6 @@
public class ProtobufMessageBuilderRandomizer implements ContextAwareRandomizer {
private final ProtobufMessageRandomizer protobufMessageRandomizer;
- private RandomizerContext context;
public ProtobufMessageBuilderRandomizer(
Class messageBuilderClass,
@@ -65,7 +64,6 @@ public String toString() {
@Override
public void setRandomizerContext(RandomizerContext context) {
- this.context = context;
protobufMessageRandomizer.setRandomizerContext(context);
}
}
diff --git a/easy-random-protobuf/src/main/java/org/jeasy/random/protobuf/ProtobufMessageRandomizer.java b/easy-random-protobuf/src/main/java/org/jeasy/random/protobuf/ProtobufMessageRandomizer.java
index eb375a7a..d8172eb4 100644
--- a/easy-random-protobuf/src/main/java/org/jeasy/random/protobuf/ProtobufMessageRandomizer.java
+++ b/easy-random-protobuf/src/main/java/org/jeasy/random/protobuf/ProtobufMessageRandomizer.java
@@ -46,7 +46,6 @@
import java.util.EnumMap;
import java.util.List;
import java.util.function.BiFunction;
-import java.util.stream.Collectors;
import org.jeasy.random.EasyRandom;
import org.jeasy.random.EasyRandomParameters;
import org.jeasy.random.api.ContextAwareRandomizer;
@@ -117,7 +116,7 @@ public Message getRandomValue() {
.getFields()
.stream()
.filter(field -> field.getContainingOneof() == null)
- .collect(Collectors.toList());
+ .toList();
for (FieldDescriptor fieldDescriptor : plainFields) {
populateField(fieldDescriptor, builder);
}
diff --git a/easy-random-protobuf/src/main/java/org/jeasy/random/protobuf/ProtobufPredicates.java b/easy-random-protobuf/src/main/java/org/jeasy/random/protobuf/ProtobufPredicates.java
index 9806a1fd..7f5ab1ad 100644
--- a/easy-random-protobuf/src/main/java/org/jeasy/random/protobuf/ProtobufPredicates.java
+++ b/easy-random-protobuf/src/main/java/org/jeasy/random/protobuf/ProtobufPredicates.java
@@ -18,7 +18,7 @@
public class ProtobufPredicates {
- private static EnumMap protoToJavaTypeMap = new EnumMap(FieldDescriptor.Type.class);
+ private static EnumMap> protoToJavaTypeMap = new EnumMap<>(FieldDescriptor.Type.class);
static {
protoToJavaTypeMap.put(Type.INT32, Int32Value.class);
@@ -37,11 +37,8 @@ public class ProtobufPredicates {
}
public static BiPredicate named(final String name) {
- System.out.println(name);
final Pattern pattern = Pattern.compile(name + "_");
- return (field, fieldDescriptor) -> {
- return pattern.matcher(field.getName()).matches();
- };
+ return (field, fieldDescriptor) -> pattern.matcher(field.getName()).matches();
}
public static BiPredicate ofProtobufType(Class> type) {
@@ -58,8 +55,6 @@ public static BiPredicate ofProtobufType(Class> type) {
}
public static Predicate> ofType(Class> type) {
- return clz -> {
- return clz.equals(type);
- };
+ return clz -> clz.equals(type);
}
}
diff --git a/easy-random-protobuf/src/test/java/org/jeasy/random/protobuf/Protobuf2MessageBuilderGenerationTest.java b/easy-random-protobuf/src/test/java/org/jeasy/random/protobuf/Protobuf2MessageBuilderGenerationTest.java
index c66601ce..5f058de3 100644
--- a/easy-random-protobuf/src/test/java/org/jeasy/random/protobuf/Protobuf2MessageBuilderGenerationTest.java
+++ b/easy-random-protobuf/src/test/java/org/jeasy/random/protobuf/Protobuf2MessageBuilderGenerationTest.java
@@ -108,7 +108,7 @@ void shouldGenerateTheSameValueForTheSameSeed() {
assertThat(embeddedMessage.getEnumField()).isEqualTo(Proto2Enum.THIRD_VALUE);
});
assertThat(protoBuilderInstance.getOneofFieldCase().getNumber())
- .isNotEqualTo(Proto2Message.OneofFieldCase.ONEOFFIELD_NOT_SET);
+ .isNotEqualTo(Proto2Message.OneofFieldCase.ONEOFFIELD_NOT_SET.getNumber());
assertThat(protoBuilderInstance.getMapFieldMap())
.hasSize(4)
.containsEntry(
diff --git a/easy-random-protobuf/src/test/java/org/jeasy/random/protobuf/Protobuf2MessageGenerationTest.java b/easy-random-protobuf/src/test/java/org/jeasy/random/protobuf/Protobuf2MessageGenerationTest.java
index 634d10e7..56b1c6d4 100644
--- a/easy-random-protobuf/src/test/java/org/jeasy/random/protobuf/Protobuf2MessageGenerationTest.java
+++ b/easy-random-protobuf/src/test/java/org/jeasy/random/protobuf/Protobuf2MessageGenerationTest.java
@@ -104,7 +104,7 @@ void shouldGenerateTheSameValueForTheSameSeed() {
assertThat(embeddedMessage.getEnumField()).isEqualTo(Proto2Enum.THIRD_VALUE);
});
assertThat(protoInstance.getOneofFieldCase().getNumber())
- .isNotEqualTo(Proto2Message.OneofFieldCase.ONEOFFIELD_NOT_SET);
+ .isNotEqualTo(Proto2Message.OneofFieldCase.ONEOFFIELD_NOT_SET.getNumber());
assertThat(protoInstance.getMapFieldMap())
.hasSize(4)
.containsEntry(
diff --git a/easy-random-randomizers/pom.xml b/easy-random-randomizers/pom.xml
index 466ac520..d12c8a8e 100644
--- a/easy-random-randomizers/pom.xml
+++ b/easy-random-randomizers/pom.xml
@@ -6,7 +6,7 @@
io.github.dvgaba
easy-random
- 6.1.0
+ 6.1.1
4.0.0
easy-random-randomizers
diff --git a/pom.xml b/pom.xml
index 7d60a0bd..0dbd676f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
4.0.0
io.github.dvgaba
easy-random
- 6.1.0
+ 6.1.1
pom