diff --git a/pom.xml b/pom.xml
index 5d66db9203..4d804cfa9a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -848,7 +848,8 @@
${project.build.sourceDirectory}
- ${project.build.directory}/generated-sources
+ ${project.build.testSourceDirectory}
+ ${project.basedir}/src/main/templates
diff --git a/src/main/java/io/lettuce/core/dynamic/SimpleBatcher.java b/src/main/java/io/lettuce/core/dynamic/SimpleBatcher.java
index 9d42d37b69..a2ecf48834 100644
--- a/src/main/java/io/lettuce/core/dynamic/SimpleBatcher.java
+++ b/src/main/java/io/lettuce/core/dynamic/SimpleBatcher.java
@@ -184,4 +184,5 @@ private List> prepareDefaultFlush(int consu
private ArrayList newDrainTarget() {
return new ArrayList<>(Math.max(0, Math.min(batchSize, queue.size())));
}
+
}
diff --git a/src/main/templates/io/lettuce/core/api/BaseRedisCommands.java b/src/main/templates/io/lettuce/core/api/BaseRedisCommands.java
index 40d5165f16..405b702307 100644
--- a/src/main/templates/io/lettuce/core/api/BaseRedisCommands.java
+++ b/src/main/templates/io/lettuce/core/api/BaseRedisCommands.java
@@ -180,8 +180,8 @@ public interface BaseRedisCommands {
/**
* @return {@code true} if the connection is open (connected and not closed).
- * @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#isOpen()} method on the connection
- * interface. To be removed with Lettuce 7.0.
+ * @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#isOpen()} method on the
+ * connection interface. To be removed with Lettuce 7.0.
*/
@Deprecated
boolean isOpen();
@@ -189,8 +189,9 @@ public interface BaseRedisCommands {
/**
* Reset the command state. Queued commands will be canceled and the internal state will be reset. This is useful when the
* internal state machine gets out of sync with the connection.
- * @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#reset()} method on the connection
- * interface. To be removed with Lettuce 7.0.
+ *
+ * @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#reset()} method on the
+ * connection interface. To be removed with Lettuce 7.0.
*/
@Deprecated
void reset();
@@ -201,9 +202,9 @@ public interface BaseRedisCommands {
* issued. After calling {@link #flushCommands()} commands are sent to the transport and executed by Redis.
*
* @param autoFlush state of autoFlush.
- * @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#setAutoFlushCommands(boolean)} method on the connection
- * interface. To be removed with Lettuce 7.0.
-
+ * @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#setAutoFlushCommands(boolean)}
+ * method on the connection interface. To be removed with Lettuce 7.0.
+ *
*/
@Deprecated
void setAutoFlushCommands(boolean autoFlush);
@@ -211,9 +212,10 @@ public interface BaseRedisCommands {
/**
* Flush pending commands. This commands forces a flush on the channel and can be used to buffer ("pipeline") commands to
* achieve batching. No-op if channel is not connected.
- * @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#flushCommands()} method on the connection
- * interface. To be removed with Lettuce 7.0.
-
+ *
+ * @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#flushCommands()} method on the
+ * connection interface. To be removed with Lettuce 7.0.
+ *
*/
@Deprecated
void flushCommands();
diff --git a/src/main/templates/io/lettuce/core/api/RedisAclCommands.java b/src/main/templates/io/lettuce/core/api/RedisAclCommands.java
index 6a3b0e58f6..c4dd88c499 100644
--- a/src/main/templates/io/lettuce/core/api/RedisAclCommands.java
+++ b/src/main/templates/io/lettuce/core/api/RedisAclCommands.java
@@ -110,8 +110,8 @@ public interface RedisAclCommands {
List aclList();
/**
- * When Redis is configured to use an ACL file (with the aclfile configuration option), this command
- * will reload the ACLs from the file, replacing all the current ACL rules with the ones defined in the file.
+ * When Redis is configured to use an ACL file (with the aclfile configuration option), this command will reload the ACLs
+ * from the file, replacing all the current ACL rules with the ones defined in the file.
*
* @return String simple-string-reply OK or error message.
*/
@@ -140,8 +140,8 @@ public interface RedisAclCommands {
String aclLogReset();
/**
- * When Redis is configured to use an ACL file (with the aclfile configuration option),
- * this command will save the currently defined ACLs from the server memory to the ACL file.
+ * When Redis is configured to use an ACL file (with the aclfile configuration option), this command will save the currently
+ * defined ACLs from the server memory to the ACL file.
*
* @return String simple-string-reply OK or error message.
*/
@@ -169,4 +169,5 @@ public interface RedisAclCommands {
* @return K bulk-string-reply the username of the current connection.
*/
String aclWhoami();
+
}
diff --git a/src/main/templates/io/lettuce/core/api/RedisGeoCommands.java b/src/main/templates/io/lettuce/core/api/RedisGeoCommands.java
index 7a9a8663e2..3bab7c2b01 100644
--- a/src/main/templates/io/lettuce/core/api/RedisGeoCommands.java
+++ b/src/main/templates/io/lettuce/core/api/RedisGeoCommands.java
@@ -191,8 +191,8 @@ Long georadius(K key, double longitude, double latitude, double distance, GeoArg
Long georadiusbymember(K key, V member, double distance, GeoArgs.Unit unit, GeoRadiusStoreArgs geoRadiusStoreArgs);
/**
- * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}.
- * Use {@link GeoSearch} to create reference and predicate objects.
+ * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. Use
+ * {@link GeoSearch} to create reference and predicate objects.
*
* @param key the key of the geo set.
* @param reference the reference member or longitude/latitude coordinates.
@@ -203,8 +203,8 @@ Long georadius(K key, double longitude, double latitude, double distance, GeoArg
Set geosearch(K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate);
/**
- * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}.
- * Use {@link GeoSearch} to create reference and predicate objects.
+ * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. Use
+ * {@link GeoSearch} to create reference and predicate objects.
*
* @param key the key of the geo set.
* @param reference the reference member or longitude/latitude coordinates.
@@ -224,7 +224,8 @@ Long georadius(K key, double longitude, double latitude, double distance, GeoArg
* @param reference the reference member or longitude/latitude coordinates.
* @param predicate the bounding box or radius to search in.
* @param geoArgs args to control the result.
- * @param storeDist stores the items in a sorted set populated with their distance from the center of the circle or box, as a floating-point number, in the same unit specified for that shape.
+ * @param storeDist stores the items in a sorted set populated with their distance from the center of the circle or box, as
+ * a floating-point number, in the same unit specified for that shape.
* @return Long integer-reply the number of elements in the result.
* @since 6.1
*/
diff --git a/src/main/templates/io/lettuce/core/api/RedisHashCommands.java b/src/main/templates/io/lettuce/core/api/RedisHashCommands.java
index 96dfe525eb..53896d05a7 100644
--- a/src/main/templates/io/lettuce/core/api/RedisHashCommands.java
+++ b/src/main/templates/io/lettuce/core/api/RedisHashCommands.java
@@ -575,4 +575,5 @@ public interface RedisHashCommands {
* associated timeout.
*/
Boolean hpersist(K key, K... fields);
+
}
diff --git a/src/main/templates/io/lettuce/core/api/RedisSortedSetCommands.java b/src/main/templates/io/lettuce/core/api/RedisSortedSetCommands.java
index 841e14a835..1c7f4fca79 100644
--- a/src/main/templates/io/lettuce/core/api/RedisSortedSetCommands.java
+++ b/src/main/templates/io/lettuce/core/api/RedisSortedSetCommands.java
@@ -488,7 +488,8 @@ public interface RedisSortedSetCommands {
* Return {@code count} random members from the sorted set stored at {@code key}.
*
* @param key the key.
- * @param count the number of members to return. If the provided count argument is positive, return an array of distinct fields.
+ * @param count the number of members to return. If the provided count argument is positive, return an array of distinct
+ * fields.
* @return List<ScoredValue<V>> array-reply list of scores and elements.
* @since 6.1
*/
@@ -507,7 +508,8 @@ public interface RedisSortedSetCommands {
* Return {@code count} random members along their value from the sorted set stored at {@code key}.
*
* @param key the key.
- * @param count the number of members to return. If the provided count argument is positive, return an array of distinct fields.
+ * @param count the number of members to return. If the provided count argument is positive, return an array of distinct
+ * fields.
* @return List<ScoredValue<V>> array-reply list of scores and elements.
* @since 6.1
*/
@@ -909,7 +911,8 @@ Long zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Stri
Long zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range extends Number> range, Limit limit);
/**
- * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key.
+ * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the
+ * {@code dstKey} destination key.
*
* @param dstKey the dst key.
* @param srcKey the src key.
@@ -920,7 +923,8 @@ Long zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Stri
Long zrangestore(K dstKey, K srcKey, Range range);
/**
- * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key.
+ * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the
+ * {@code dstKey} destination key.
*
* @param dstKey the dst key.
* @param srcKey the src key.
@@ -932,7 +936,8 @@ Long zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Stri
Long zrangestorebylex(K dstKey, K srcKey, Range extends V> range, Limit limit);
/**
- * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key.
+ * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the
+ * {@code dstKey} destination key.
*
* @param dstKey the dst key.
* @param srcKey the src key.
@@ -1409,7 +1414,8 @@ Long zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, S
Long zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range extends Number> range, Limit limit);
/**
- * Get the specified range of elements ordered from high to low in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key.
+ * Get the specified range of elements ordered from high to low in the sorted set stored at {@code srcKey} and stores the
+ * result in the {@code dstKey} destination key.
*
* @param dstKey the dst key.
* @param srcKey the src key.
@@ -1420,7 +1426,8 @@ Long zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, S
Long zrevrangestore(K dstKey, K srcKey, Range range);
/**
- * Get the lexicographical range ordered from high to low of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key.
+ * Get the lexicographical range ordered from high to low of elements in the sorted set stored at {@code srcKey} and stores
+ * the result in the {@code dstKey} destination key.
*
* @param dstKey the src key.
* @param srcKey the dst key.
@@ -1432,9 +1439,11 @@ Long zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, S
Long zrevrangestorebylex(K dstKey, K srcKey, Range extends V> range, Limit limit);
/**
- * Get the specified range of elements in the sorted set stored at {@code srcKey with scores ordered from high to low and stores the result in the {@code dstKey} destination key.
+ * Get the specified range of elements in the sorted set stored at {@code srcKey with scores ordered from high to low and
+ * stores the result in the {@code dstKey} destination key.
*
* @param dstKey the src key.
+ *
* @param srcKey the dst key.
* @param range the score range.
* @param limit the limit to apply.
diff --git a/src/main/templates/io/lettuce/core/api/RedisStreamCommands.java b/src/main/templates/io/lettuce/core/api/RedisStreamCommands.java
index 29c39e379a..232f1f618c 100644
--- a/src/main/templates/io/lettuce/core/api/RedisStreamCommands.java
+++ b/src/main/templates/io/lettuce/core/api/RedisStreamCommands.java
@@ -373,4 +373,5 @@ public interface RedisStreamCommands {
* @since 6.1
*/
Long xtrim(K key, XTrimArgs args);
+
}
diff --git a/src/test/java/biz/paluch/redis/extensibility/LettuceGeoDemo.java b/src/test/java/biz/paluch/redis/extensibility/LettuceGeoDemo.java
index 57bf25031c..ab9432db10 100644
--- a/src/test/java/biz/paluch/redis/extensibility/LettuceGeoDemo.java
+++ b/src/test/java/biz/paluch/redis/extensibility/LettuceGeoDemo.java
@@ -47,4 +47,5 @@ public static void main(String[] args) {
redis.getStatefulConnection().close();
redisClient.shutdown();
}
+
}
diff --git a/src/test/java/biz/paluch/redis/extensibility/MyExtendedRedisClient.java b/src/test/java/biz/paluch/redis/extensibility/MyExtendedRedisClient.java
index c52c768140..99b029a588 100644
--- a/src/test/java/biz/paluch/redis/extensibility/MyExtendedRedisClient.java
+++ b/src/test/java/biz/paluch/redis/extensibility/MyExtendedRedisClient.java
@@ -32,4 +32,5 @@ protected StatefulRedisPubSubConnectionImpl newStatefulRedisPubSubC
RedisChannelWriter channelWriter, RedisCodec codec, Duration timeout) {
return new MyPubSubConnection<>(endpoint, channelWriter, codec, timeout);
}
+
}
diff --git a/src/test/java/biz/paluch/redis/extensibility/MyPubSubConnection.java b/src/test/java/biz/paluch/redis/extensibility/MyPubSubConnection.java
index 6e91f06a70..7fd38c7750 100644
--- a/src/test/java/biz/paluch/redis/extensibility/MyPubSubConnection.java
+++ b/src/test/java/biz/paluch/redis/extensibility/MyPubSubConnection.java
@@ -28,7 +28,8 @@ class MyPubSubConnection extends StatefulRedisPubSubConnectionImpl {
* @param codec Codec used to encode/decode keys and values.
* @param timeout Maximum time to wait for a response.
*/
- public MyPubSubConnection(PubSubEndpoint endpoint, RedisChannelWriter writer, RedisCodec codec, Duration timeout) {
+ public MyPubSubConnection(PubSubEndpoint endpoint, RedisChannelWriter writer, RedisCodec codec,
+ Duration timeout) {
super(endpoint, writer, codec, timeout);
}
@@ -41,4 +42,5 @@ public RedisCommand dispatch(RedisCommand command) {
return super.dispatch(command);
}
+
}
diff --git a/src/test/java/io/lettuce/RedisBug.java b/src/test/java/io/lettuce/RedisBug.java
index 429cf77353..12078cfd86 100644
--- a/src/test/java/io/lettuce/RedisBug.java
+++ b/src/test/java/io/lettuce/RedisBug.java
@@ -14,5 +14,7 @@
@Documented
@Disabled("Redis Bug")
public @interface RedisBug {
+
String value() default "";
+
}
diff --git a/src/test/java/io/lettuce/apigenerator/CompilationUnitFactory.java b/src/test/java/io/lettuce/apigenerator/CompilationUnitFactory.java
index 2be57d325b..55e54d0496 100644
--- a/src/test/java/io/lettuce/apigenerator/CompilationUnitFactory.java
+++ b/src/test/java/io/lettuce/apigenerator/CompilationUnitFactory.java
@@ -90,22 +90,24 @@ class CompilationUnitFactory {
private CompilationUnit template;
private final CompilationUnit result = new CompilationUnit();
+
private ClassOrInterfaceDeclaration resultType;
public CompilationUnitFactory(File templateFile, File sources, String targetPackage, String targetName,
- Function typeDocFunction, Function methodReturnTypeFunction,
- Predicate methodFilter, Supplier> importSupplier,
- Consumer typeMutator, Function methodCommentMutator) {
+ Function typeDocFunction, Function methodReturnTypeFunction,
+ Predicate methodFilter, Supplier> importSupplier,
+ Consumer typeMutator, Function methodCommentMutator) {
this(templateFile, sources, targetPackage, targetName, typeDocFunction, methodReturnTypeFunction, methodDeclaration -> {
- }, methodFilter, importSupplier, typeMutator, (m, c) -> methodCommentMutator != null ? methodCommentMutator.apply(c) : c);
+ }, methodFilter, importSupplier, typeMutator,
+ (m, c) -> methodCommentMutator != null ? methodCommentMutator.apply(c) : c);
}
public CompilationUnitFactory(File templateFile, File sources, String targetPackage, String targetName,
- Function typeDocFunction, Function methodReturnTypeFunction,
- Consumer onMethod, Predicate methodFilter,
- Supplier> importSupplier, Consumer typeMutator,
- BiFunction methodCommentMutator) {
+ Function typeDocFunction, Function methodReturnTypeFunction,
+ Consumer onMethod, Predicate methodFilter,
+ Supplier> importSupplier, Consumer typeMutator,
+ BiFunction methodCommentMutator) {
this.templateFile = templateFile;
this.sources = sources;
@@ -139,11 +141,13 @@ public void createInterface() throws Exception {
if (!templateTypeDeclaration.getTypeParameters().isEmpty()) {
resultType.setTypeParameters(new NodeList<>());
for (TypeParameter typeParameter : templateTypeDeclaration.getTypeParameters()) {
- resultType.getTypeParameters().add(new TypeParameter(typeParameter.getName().getIdentifier(), typeParameter.getTypeBound()));
+ resultType.getTypeParameters()
+ .add(new TypeParameter(typeParameter.getName().getIdentifier(), typeParameter.getTypeBound()));
}
}
- resultType.setComment(new JavadocComment(typeDocFunction.apply(templateTypeDeclaration.getComment().get().getContent())));
+ resultType
+ .setComment(new JavadocComment(typeDocFunction.apply(templateTypeDeclaration.getComment().get().getContent())));
result.setComment(template.getComment().orElse(null));
result.setImports(new NodeList<>());
@@ -209,24 +213,19 @@ public static boolean contains(Collection haystack, MethodDeclaration ne
public void removeUnusedImports() {
ClassOrInterfaceDeclaration declaringClass = (ClassOrInterfaceDeclaration) result.getChildNodes().get(1);
- List optimizedImports = result
- .getImports()
- .stream()
- .filter(i -> i.isAsterisk()
- || i.isStatic()
- || declaringClass.findFirst(Type.class, t -> {
- String fullType = t.toString();
- String importIdentifier = i.getName().getIdentifier();
-
- return fullType.contains(importIdentifier);
- }).isPresent()
- )
- .sorted((o1, o2) -> {
- if (o1.getNameAsString().startsWith("java")) return -1;
- if (o2.getNameAsString().startsWith("java")) return 1;
+ List optimizedImports = result.getImports().stream()
+ .filter(i -> i.isAsterisk() || i.isStatic() || declaringClass.findFirst(Type.class, t -> {
+ String fullType = t.toString();
+ String importIdentifier = i.getName().getIdentifier();
+
+ return fullType.contains(importIdentifier);
+ }).isPresent()).sorted((o1, o2) -> {
+ if (o1.getNameAsString().startsWith("java"))
+ return -1;
+ if (o2.getNameAsString().startsWith("java"))
+ return 1;
return o1.getNameAsString().compareTo(o2.getNameAsString());
- })
- .collect(Collectors.toList());
+ }).collect(Collectors.toList());
result.setImports(NodeList.nodeList(optimizedImports));
}
@@ -263,16 +262,15 @@ public void visit(MethodDeclaration parsedDeclaration, Object arg) {
private Type getMethodReturnType(MethodDeclaration parsedDeclaration) {
- List, Function>> entries = new ArrayList<>(methodReturnTypeMutation.entrySet());
+ List, Function>> entries = new ArrayList<>(
+ methodReturnTypeMutation.entrySet());
Collections.reverse(entries);
- return entries
- .stream()
- .filter(entry -> entry.getKey().test(parsedDeclaration))
- .findFirst()
- .map(entry -> entry.getValue().apply(parsedDeclaration))
- .orElse(null);
+ return entries.stream().filter(entry -> entry.getKey().test(parsedDeclaration)).findFirst()
+ .map(entry -> entry.getValue().apply(parsedDeclaration)).orElse(null);
}
+
}
+
}
diff --git a/src/test/java/io/lettuce/apigenerator/Constants.java b/src/test/java/io/lettuce/apigenerator/Constants.java
index 744fccbf16..2779ed17aa 100644
--- a/src/test/java/io/lettuce/apigenerator/Constants.java
+++ b/src/test/java/io/lettuce/apigenerator/Constants.java
@@ -26,26 +26,15 @@
*/
class Constants {
- public static final String[] TEMPLATE_NAMES = {
- "BaseRedisCommands",
- "RedisAclCommands",
- "RedisFunctionCommands",
- "RedisGeoCommands",
- "RedisHashCommands",
- "RedisHLLCommands",
- "RedisKeyCommands",
- "RedisListCommands",
- "RedisScriptingCommands",
- "RedisSentinelCommands",
- "RedisServerCommands",
- "RedisSetCommands",
- "RedisSortedSetCommands",
- "RedisStreamCommands",
- "RedisStringCommands",
- "RedisTransactionalCommands"
- };
+ public static final String[] TEMPLATE_NAMES = { "BaseRedisCommands", "RedisAclCommands", "RedisFunctionCommands",
+ "RedisGeoCommands", "RedisHashCommands", "RedisHLLCommands", "RedisKeyCommands", "RedisListCommands",
+ "RedisScriptingCommands", "RedisSentinelCommands", "RedisServerCommands", "RedisSetCommands",
+ "RedisSortedSetCommands", "RedisStreamCommands", "RedisStringCommands", "RedisTransactionalCommands" };
public static final File TEMPLATES = new File("src/main/templates");
+
public static final File SOURCES = new File("src/main/java");
+
public static final File KOTLIN_SOURCES = new File("src/main/kotlin");
+
}
diff --git a/src/test/java/io/lettuce/apigenerator/CreateAsyncApi.java b/src/test/java/io/lettuce/apigenerator/CreateAsyncApi.java
index 300ce31c57..8006578bd7 100644
--- a/src/test/java/io/lettuce/apigenerator/CreateAsyncApi.java
+++ b/src/test/java/io/lettuce/apigenerator/CreateAsyncApi.java
@@ -42,7 +42,9 @@
*/
class CreateAsyncApi {
- public static final Set KEEP_METHOD_RESULT_TYPE = LettuceSets.unmodifiableSet("shutdown", "debugOom", "debugSegfault", "digest", "close", "isOpen", "BaseRedisCommands.reset", "getStatefulConnection", "setAutoFlushCommands", "flushCommands");
+ public static final Set KEEP_METHOD_RESULT_TYPE = LettuceSets.unmodifiableSet("shutdown", "debugOom",
+ "debugSegfault", "digest", "close", "isOpen", "BaseRedisCommands.reset", "getStatefulConnection",
+ "setAutoFlushCommands", "flushCommands");
/**
* Mutate type comment.
@@ -101,4 +103,5 @@ private CompilationUnitFactory createFactory(String templateName) {
return factory;
}
+
}
diff --git a/src/test/java/io/lettuce/apigenerator/CreateAsyncNodeSelectionClusterApi.java b/src/test/java/io/lettuce/apigenerator/CreateAsyncNodeSelectionClusterApi.java
index 294d117c93..7fc1a4f516 100644
--- a/src/test/java/io/lettuce/apigenerator/CreateAsyncNodeSelectionClusterApi.java
+++ b/src/test/java/io/lettuce/apigenerator/CreateAsyncNodeSelectionClusterApi.java
@@ -45,9 +45,12 @@
*/
class CreateAsyncNodeSelectionClusterApi {
- private static final Set FILTER_TEMPLATES = LettuceSets.unmodifiableSet("RedisSentinelCommands", "RedisTransactionalCommands");
- private static final Set FILTER_METHODS = LettuceSets.unmodifiableSet("shutdown", "debugOom", "debugSegfault", "digest", "close",
- "isOpen", "BaseRedisCommands.reset", "readOnly", "readWrite", "setAutoFlushCommands", "flushCommands");
+ private static final Set FILTER_TEMPLATES = LettuceSets.unmodifiableSet("RedisSentinelCommands",
+ "RedisTransactionalCommands");
+
+ private static final Set FILTER_METHODS = LettuceSets.unmodifiableSet("shutdown", "debugOom", "debugSegfault",
+ "digest", "close", "isOpen", "BaseRedisCommands.reset", "readOnly", "readWrite", "setAutoFlushCommands",
+ "flushCommands");
/**
* Mutate type comment.
@@ -93,10 +96,7 @@ void createInterface(String argument) throws Exception {
}
static List arguments() {
- return Stream
- .of(Constants.TEMPLATE_NAMES)
- .filter(t -> !FILTER_TEMPLATES.contains(t))
- .collect(Collectors.toList());
+ return Stream.of(Constants.TEMPLATE_NAMES).filter(t -> !FILTER_TEMPLATES.contains(t)).collect(Collectors.toList());
}
private CompilationUnitFactory createFactory(String templateName) {
@@ -110,4 +110,5 @@ private CompilationUnitFactory createFactory(String templateName) {
return factory;
}
+
}
diff --git a/src/test/java/io/lettuce/apigenerator/CreateKotlinCoroutinesApi.java b/src/test/java/io/lettuce/apigenerator/CreateKotlinCoroutinesApi.java
index 4069bf8da2..ce38436e25 100644
--- a/src/test/java/io/lettuce/apigenerator/CreateKotlinCoroutinesApi.java
+++ b/src/test/java/io/lettuce/apigenerator/CreateKotlinCoroutinesApi.java
@@ -44,10 +44,7 @@ public class CreateKotlinCoroutinesApi {
* @return
*/
Supplier> importSupplier() {
- return () -> Arrays.asList(
- "io.lettuce.core.ExperimentalLettuceCoroutinesApi",
- "kotlinx.coroutines.flow.Flow"
- );
+ return () -> Arrays.asList("io.lettuce.core.ExperimentalLettuceCoroutinesApi", "kotlinx.coroutines.flow.Flow");
}
/**
@@ -56,11 +53,8 @@ Supplier> importSupplier() {
* @return
*/
Function commentInjector() {
- return s -> s
- .replaceAll("\\$\\{intent}", "Coroutine executed commands")
- .replaceAll("\\$\\{author}", "Mikhael Sokolov")
- .replaceAll("\\$\\{since}", "6.0")
- .replaceAll("\\$\\{generator}", getClass().getName());
+ return s -> s.replaceAll("\\$\\{intent}", "Coroutine executed commands").replaceAll("\\$\\{author}", "Mikhael Sokolov")
+ .replaceAll("\\$\\{since}", "6.0").replaceAll("\\$\\{generator}", getClass().getName());
}
@ParameterizedTest
@@ -84,7 +78,8 @@ private KotlinCompilationUnitFactory createFactory(String templateName) {
targetPackage = "io.lettuce.core.api.coroutines";
}
- return new KotlinCompilationUnitFactory(templateFile, KOTLIN_SOURCES, targetPackage,
- targetName, importSupplier(), commentInjector());
+ return new KotlinCompilationUnitFactory(templateFile, KOTLIN_SOURCES, targetPackage, targetName, importSupplier(),
+ commentInjector());
}
+
}
diff --git a/src/test/java/io/lettuce/apigenerator/CreateReactiveApi.java b/src/test/java/io/lettuce/apigenerator/CreateReactiveApi.java
index 8444a7c645..d66872e4bc 100644
--- a/src/test/java/io/lettuce/apigenerator/CreateReactiveApi.java
+++ b/src/test/java/io/lettuce/apigenerator/CreateReactiveApi.java
@@ -51,10 +51,12 @@
*/
public class CreateReactiveApi {
- public static Set KEEP_METHOD_RESULT_TYPE = LettuceSets.unmodifiableSet("digest", "close", "isOpen", "BaseRedisCommands.reset", "getStatefulConnection", "setAutoFlushCommands", "flushCommands");
+ public static Set KEEP_METHOD_RESULT_TYPE = LettuceSets.unmodifiableSet("digest", "close", "isOpen",
+ "BaseRedisCommands.reset", "getStatefulConnection", "setAutoFlushCommands", "flushCommands");
public static Set FORCE_FLUX_RESULT = LettuceSets.unmodifiableSet("eval", "evalsha", "evalReadOnly",
"evalshaReadOnly", "fcall", "fcallReadOnly", "dispatch");
+
public static Set VALUE_WRAP = LettuceSets.unmodifiableSet("geopos", "bitfield");
private static final Map RESULT_SPEC;
@@ -160,8 +162,7 @@ Function methodTypeMutator() {
};
}
- private String getResultType(MethodDeclaration method,
- ClassOrInterfaceDeclaration classOfMethod) {
+ private String getResultType(MethodDeclaration method, ClassOrInterfaceDeclaration classOfMethod) {
String declaration = nameAndParameters(method);
if (RESULT_SPEC.containsKey(declaration)) {
@@ -211,8 +212,8 @@ private CompilationUnitFactory createFactory(String templateName) {
targetPackage = "io.lettuce.core.api.reactive";
}
- CompilationUnitFactory factory = new CompilationUnitFactory(templateFile, Constants.SOURCES, targetPackage, targetName, commentMutator(),
- methodTypeMutator(), methodMutator(), methodDeclaration -> true, importSupplier(), null,
+ CompilationUnitFactory factory = new CompilationUnitFactory(templateFile, Constants.SOURCES, targetPackage, targetName,
+ commentMutator(), methodTypeMutator(), methodMutator(), methodDeclaration -> true, importSupplier(), null,
methodCommentMutator());
factory.keepMethodSignaturesFor(KEEP_METHOD_RESULT_TYPE);
return factory;
@@ -234,4 +235,5 @@ static String nameAndParameters(MethodDeclaration method) {
sb.append(")");
return sb.toString();
}
+
}
diff --git a/src/test/java/io/lettuce/apigenerator/CreateSyncApi.java b/src/test/java/io/lettuce/apigenerator/CreateSyncApi.java
index fb9bf9fcc0..697bf5dce7 100644
--- a/src/test/java/io/lettuce/apigenerator/CreateSyncApi.java
+++ b/src/test/java/io/lettuce/apigenerator/CreateSyncApi.java
@@ -51,8 +51,8 @@ class CreateSyncApi {
* @return
*/
Function commentMutator() {
- return s -> s.replaceAll("\\$\\{intent\\}", "Synchronous executed commands") + "* @generated by "
- + getClass().getName() + "\r\n ";
+ return s -> s.replaceAll("\\$\\{intent\\}", "Synchronous executed commands") + "* @generated by " + getClass().getName()
+ + "\r\n ";
}
/**
@@ -106,4 +106,5 @@ private CompilationUnitFactory createFactory(String templateName) {
return new CompilationUnitFactory(templateFile, Constants.SOURCES, targetPackage, targetName, commentMutator(),
methodTypeMutator(), methodFilter(), importSupplier(), null, Function.identity());
}
+
}
diff --git a/src/test/java/io/lettuce/apigenerator/CreateSyncNodeSelectionClusterApi.java b/src/test/java/io/lettuce/apigenerator/CreateSyncNodeSelectionClusterApi.java
index 88ae384697..9813912cc2 100644
--- a/src/test/java/io/lettuce/apigenerator/CreateSyncNodeSelectionClusterApi.java
+++ b/src/test/java/io/lettuce/apigenerator/CreateSyncNodeSelectionClusterApi.java
@@ -47,9 +47,12 @@
@SuppressWarnings("OptionalGetWithoutIsPresent")
public class CreateSyncNodeSelectionClusterApi {
- private static final Set FILTER_TEMPLATES = LettuceSets.unmodifiableSet("RedisSentinelCommands", "RedisTransactionalCommands");
- private static final Set FILTER_METHODS = LettuceSets.unmodifiableSet("shutdown", "debugOom", "debugSegfault", "digest",
- "close", "isOpen", "BaseRedisCommands.reset", "readOnly", "readWrite", "dispatch", "setAutoFlushCommands", "flushCommands");
+ private static final Set FILTER_TEMPLATES = LettuceSets.unmodifiableSet("RedisSentinelCommands",
+ "RedisTransactionalCommands");
+
+ private static final Set FILTER_METHODS = LettuceSets.unmodifiableSet("shutdown", "debugOom", "debugSegfault",
+ "digest", "close", "isOpen", "BaseRedisCommands.reset", "readOnly", "readWrite", "dispatch", "setAutoFlushCommands",
+ "flushCommands");
/**
* Mutate type comment.
@@ -99,10 +102,7 @@ void createInterface(String argument) throws Exception {
}
static List arguments() {
- return Stream
- .of(Constants.TEMPLATE_NAMES)
- .filter(t -> !FILTER_TEMPLATES.contains(t))
- .collect(Collectors.toList());
+ return Stream.of(Constants.TEMPLATE_NAMES).filter(t -> !FILTER_TEMPLATES.contains(t)).collect(Collectors.toList());
}
private CompilationUnitFactory createFactory(String templateName) {
@@ -116,4 +116,5 @@ private CompilationUnitFactory createFactory(String templateName) {
factory.keepMethodSignaturesFor(FILTER_METHODS);
return factory;
}
+
}
diff --git a/src/test/java/io/lettuce/apigenerator/KotlinCompilationUnitFactory.java b/src/test/java/io/lettuce/apigenerator/KotlinCompilationUnitFactory.java
index 341b1d0477..9b160643ee 100644
--- a/src/test/java/io/lettuce/apigenerator/KotlinCompilationUnitFactory.java
+++ b/src/test/java/io/lettuce/apigenerator/KotlinCompilationUnitFactory.java
@@ -60,26 +60,33 @@
@SuppressWarnings("OptionalGetWithoutIsPresent")
class KotlinCompilationUnitFactory {
- private static final Set SKIP_IMPORTS = LettuceSets.unmodifiableSet("java.util.List", "java.util.Set", "java.util.Map");
- private static final Set NON_SUSPENDABLE_METHODS = LettuceSets.unmodifiableSet("isOpen", "flushCommands", "setAutoFlushCommands");
- private static final Set SKIP_METHODS = LettuceSets.unmodifiableSet("BaseRedisCommands.reset", "getStatefulConnection");
-
- private static final Set FLOW_METHODS = LettuceSets.unmodifiableSet("aclList", "aclLog", "dispatch", "geohash", "georadius",
- "georadiusbymember", "geosearch",
- "hgetall", "hkeys", "hmget", "hvals", "keys", "mget", "sdiff", "sinter", "smembers", "smismember", "sort",
- "sortReadOnly", "srandmember", "sunion",
- "xclaim", "xpending", "xrange", "xread", "xreadgroup", "xrevrange", "zdiff", "zdiffWithScores", "zinter", "zinterWithScores", "zpopmax", "zpopmin", "zrange",
- "zrangeWithScores", "zrangebylex", "zrangebyscore", "zrangebyscoreWithScores", "zrevrange", "zrevrangeWithScores", "zrevrangebylex",
- "zrevrangebyscore", "zrevrangebyscore", "zrevrangebyscoreWithScores", "zunion", "zunionWithScores");
+ private static final Set SKIP_IMPORTS = LettuceSets.unmodifiableSet("java.util.List", "java.util.Set",
+ "java.util.Map");
+
+ private static final Set NON_SUSPENDABLE_METHODS = LettuceSets.unmodifiableSet("isOpen", "flushCommands",
+ "setAutoFlushCommands");
+
+ private static final Set SKIP_METHODS = LettuceSets.unmodifiableSet("BaseRedisCommands.reset",
+ "getStatefulConnection");
+
+ private static final Set FLOW_METHODS = LettuceSets.unmodifiableSet("aclList", "aclLog", "dispatch", "geohash",
+ "georadius", "georadiusbymember", "geosearch", "hgetall", "hkeys", "hmget", "hvals", "keys", "mget", "sdiff",
+ "sinter", "smembers", "smismember", "sort", "sortReadOnly", "srandmember", "sunion", "xclaim", "xpending", "xrange",
+ "xread", "xreadgroup", "xrevrange", "zdiff", "zdiffWithScores", "zinter", "zinterWithScores", "zpopmax", "zpopmin",
+ "zrange", "zrangeWithScores", "zrangebylex", "zrangebyscore", "zrangebyscoreWithScores", "zrevrange",
+ "zrevrangeWithScores", "zrevrangebylex", "zrevrangebyscore", "zrevrangebyscore", "zrevrangebyscoreWithScores",
+ "zunion", "zunionWithScores");
private static final Set NON_NULLABLE_RESULT_METHODS = LettuceSets.unmodifiableSet("discard", "multi", "exec",
"watch", "unwatch", "getMasterAddrByName", "master", "reset", "failover", "monitor",
"RedisSentinelCoroutinesCommands.set", "remove", "RedisSentinelCoroutinesCommands.clientSetname",
"RedisSentinelCoroutinesCommands.clientKill", "RedisSentinelCoroutinesCommands.clientPause",
"RedisSentinelCoroutinesCommands.clientList", "RedisSentinelCoroutinesCommands.info",
- "RedisSentinelCoroutinesCommands.ping", "pubsubNumsub", "pubsubShardNumsub", "pubsubNumpat", "echo", "ping", "readOnly", "readWrite");
+ "RedisSentinelCoroutinesCommands.ping", "pubsubNumsub", "pubsubShardNumsub", "pubsubNumpat", "echo", "ping",
+ "readOnly", "readWrite");
private static final Map RESULT_SPEC;
+
private static final Map KEEP_DEPRECATED_METHODS;
static {
@@ -100,21 +107,21 @@ class KotlinCompilationUnitFactory {
private static final String FORMATTING_INDENT = " ";
private final File templateFile;
+
private final File target;
+
private final String targetPackage;
+
private final String targetName;
private final Supplier> importSupplier;
+
private final Function commentInjector;
private final StringBuilder result = new StringBuilder();
- public KotlinCompilationUnitFactory(File templateFile,
- File sources,
- String targetPackage,
- String targetName,
- Supplier> importSupplier,
- Function commentInjector) {
+ public KotlinCompilationUnitFactory(File templateFile, File sources, String targetPackage, String targetName,
+ Supplier> importSupplier, Function commentInjector) {
this.templateFile = templateFile;
this.targetPackage = targetPackage;
this.targetName = targetName;
@@ -136,40 +143,23 @@ public void create() throws Exception {
importSupplier.get().forEach(l -> result.append("import ").append(l).append("\n"));
- template
- .getImports()
- .stream()
- .filter(i -> SKIP_IMPORTS
- .stream()
- .noneMatch(si -> si.equals(i.getNameAsString()))
- )
- .forEach(i -> result
- .append("import ")
- .append(i.getNameAsString())
- .append(i.isAsterisk() ? ".*" : "")
- .append("\n")
- );
+ template.getImports().stream().filter(i -> SKIP_IMPORTS.stream().noneMatch(si -> si.equals(i.getNameAsString())))
+ .forEach(i -> result.append("import ").append(i.getNameAsString()).append(i.isAsterisk() ? ".*" : "")
+ .append("\n"));
result.append("\n");
ClassOrInterfaceDeclaration clazz = (ClassOrInterfaceDeclaration) template.getTypes().get(0);
result.append(commentInjector.apply(extractJavadoc(clazz.getJavadoc().get())
- .replaceAll("@author Mark Paluch", "@author \\${author}")
- .replaceAll("@since [0-9].0", "@since \\${since}")
- .replaceAll("\\*/", "* @generated by \\${generator}\r\n */")
- ));
+ .replaceAll("@author Mark Paluch", "@author \\${author}").replaceAll("@since [0-9].0", "@since \\${since}")
+ .replaceAll("\\*/", "* @generated by \\${generator}\r\n */")));
result.append("@ExperimentalLettuceCoroutinesApi").append("\n");
NodeList typeParameters = clazz.getTypeParameters();
- result
- .append("interface ")
- .append(targetName)
- .append(extractTypeParams(typeParameters, "Any"))
- .append(" ");
-
+ result.append("interface ").append(targetName).append(extractTypeParams(typeParameters, "Any")).append(" ");
result.append("{\n\n");
new MethodVisitor().visit(template, null);
@@ -190,59 +180,51 @@ public void visit(MethodDeclaration method, Object arg) {
return;
}
- result
- .append(FORMATTING_INDENT)
+ result.append(FORMATTING_INDENT)
.append(extractJavadoc(method.getJavadoc().get()).replace("\n", "\n" + FORMATTING_INDENT))
.append(extractAnnotations(method))
- .append(contains(NON_SUSPENDABLE_METHODS, method) || isFlowable(method) ? "" : "suspend ")
- .append("fun ")
- .append(method.getTypeParameters().isNonEmpty() ? extractTypeParams(method.getTypeParameters(), "Any").concat(" ") : "")
- .append(method.getNameAsString())
- .append("(")
- .append(extractParameters(method))
- .append(")")
- .append(customResultType(method).orElse(toKotlinType(method.getType(), isFlowable(method), contains(NON_NULLABLE_RESULT_METHODS, method))))
+ .append(contains(NON_SUSPENDABLE_METHODS, method) || isFlowable(method) ? "" : "suspend ").append("fun ")
+ .append(method.getTypeParameters().isNonEmpty()
+ ? extractTypeParams(method.getTypeParameters(), "Any").concat(" ")
+ : "")
+ .append(method.getNameAsString()).append("(").append(extractParameters(method)).append(")")
+ .append(customResultType(method).orElse(
+ toKotlinType(method.getType(), isFlowable(method), contains(NON_NULLABLE_RESULT_METHODS, method))))
.append("\n\n");
}
private String extractAnnotations(MethodDeclaration method) {
- return method
- .getAnnotations()
- .stream()
- .map(a -> {
- String annotation = a.getNameAsString();
- if (annotation.equals("Deprecated")) {
- String identifier = method.getName().getIdentifier();
- String replacement = KEEP_DEPRECATED_METHODS.get(identifier);
- return "@" + annotation + "(\"Use [" + replacement + "] instead.\", ReplaceWith(\"" + replacement + "\"))\n" + FORMATTING_INDENT;
- } else {
- return "@" + annotation + "\n" + FORMATTING_INDENT;
- }
- })
- .collect(joining());
+ return method.getAnnotations().stream().map(a -> {
+ String annotation = a.getNameAsString();
+ if (annotation.equals("Deprecated")) {
+ String identifier = method.getName().getIdentifier();
+ String replacement = KEEP_DEPRECATED_METHODS.get(identifier);
+ return "@" + annotation + "(\"Use [" + replacement + "] instead.\", ReplaceWith(\"" + replacement + "\"))\n"
+ + FORMATTING_INDENT;
+ } else {
+ return "@" + annotation + "\n" + FORMATTING_INDENT;
+ }
+ }).collect(joining());
}
private String extractParameters(MethodDeclaration method) {
- return method
- .getParameters()
- .stream()
+ return method.getParameters().stream()
.map(p -> (p.isVarArgs() ? "vararg " : "") + p.getName() + toKotlinType(p.getType(), false, true))
.collect(joining(", "));
}
private Optional customResultType(MethodDeclaration method) {
ClassOrInterfaceDeclaration declaringClass = (ClassOrInterfaceDeclaration) method.getParentNode().get();
- return RESULT_SPEC
- .entrySet()
- .stream()
- .filter(e -> e.getKey().equals(method.getNameAsString()) || e.getKey().contains(declaringClass.getNameAsString() + "." + method.getNameAsString()))
- .findFirst()
- .map(e -> ": " + e.getValue());
+ return RESULT_SPEC.entrySet().stream()
+ .filter(e -> e.getKey().equals(method.getNameAsString())
+ || e.getKey().contains(declaringClass.getNameAsString() + "." + method.getNameAsString()))
+ .findFirst().map(e -> ": " + e.getValue());
}
private boolean contains(Collection haystack, MethodDeclaration method) {
ClassOrInterfaceDeclaration declaringClass = (ClassOrInterfaceDeclaration) method.getParentNode().get();
- return haystack.contains(method.getNameAsString()) || haystack.contains(declaringClass.getNameAsString() + "." + method.getNameAsString());
+ return haystack.contains(method.getNameAsString())
+ || haystack.contains(declaringClass.getNameAsString() + "." + method.getNameAsString());
}
private boolean isCollection(Type type) {
@@ -266,54 +248,34 @@ private String toKotlinType(Type type, boolean isFlowable, boolean isForceNonNul
fixedType = String.format("Array<%s>", componentType.asString());
}
} else if (type.isPrimitiveType()) {
- fixedType = type
- .asPrimitiveType()
- .toBoxedType()
- .getName()
- .asString()
- .replace("Integer", "Int")
+ fixedType = type.asPrimitiveType().toBoxedType().getName().asString().replace("Integer", "Int")
.replace("Object", "Any");
} else if (isFlowable) {
- fixedType = type
- .asString()
- .replaceFirst("List|Map|Set", "Flow")
- .replace("T", "Flow")
- .replace("Object", "Any")
- .replace(",", ", ");
+ fixedType = type.asString().replaceFirst("List|Map|Set", "Flow").replace("T", "Flow")
+ .replace("Object", "Any").replace(",", ", ");
} else {
- fixedType = type
- .asString()
- .replace("void", "Unit")
- .replace("Object", "Any")
- .replace("? extends", "out")
- .replace("? super", "in")
- .replace(",", ", ");
+ fixedType = type.asString().replace("void", "Unit").replace("Object", "Any").replace("? extends", "out")
+ .replace("? super", "in").replace(",", ", ");
}
boolean nullable = !isForceNonNullable && !isFlowable && !type.isPrimitiveType() && !isCollection(type);
return fixedType.equals("Unit") ? "" : ": " + (nullable ? fixedType + "?" : fixedType);
}
+
}
public static String extractTypeParams(NodeList typeParams, String bounds) {
if (typeParams.isEmpty()) {
return "";
} else {
- return typeParams
- .stream()
- .map(tp -> tp.getName().getIdentifier() + (bounds != null ? " : " + bounds : ""))
+ return typeParams.stream().map(tp -> tp.getName().getIdentifier() + (bounds != null ? " : " + bounds : ""))
.collect(joining(", ", "<", ">"));
}
}
public static String extractJavadoc(Javadoc javadoc) {
- String plainJavadoc = javadoc
- .toComment()
- .getContent()
- .replace("<", "<")
- .replace(">", ">")
- .replace("* \n", "*\n");
+ String plainJavadoc = javadoc.toComment().getContent().replace("<", "<").replace(">", ">").replace("* \n", "*\n");
return String.format("/**%s*/\n", convertToKotlinDoc(plainJavadoc));
}
@@ -332,26 +294,25 @@ public static String convertToKotlinDoc(String javaDoc) {
res = replaceSurrounding(res, "{@code ", "}", "`", "`");
res = replaceSurrounding(res, "{@link ", "}", "[", "]");
- return res
- .replace("java.lang.Object", "Any")
- .replace("Object", "Any")
- .replaceAll("\\bdouble\\b", "Double")
+ return res.replace("java.lang.Object", "Any").replace("Object", "Any").replaceAll("\\bdouble\\b", "Double")
.replaceAll("\\bint\\b", "Integer");
}
- public static String replaceSurrounding(String original, String prefix, String suffix, String replacePrefix, String replaceSuffix) {
- Matcher matcher = Pattern.compile(Pattern.quote(prefix) + "[a-zA-Z0-9.,#\\-~()*\\s]+" + Pattern.quote(suffix)).matcher(original);
+ public static String replaceSurrounding(String original, String prefix, String suffix, String replacePrefix,
+ String replaceSuffix) {
+ Matcher matcher = Pattern.compile(Pattern.quote(prefix) + "[a-zA-Z0-9.,#\\-~()*\\s]+" + Pattern.quote(suffix))
+ .matcher(original);
StringBuffer result = new StringBuffer();
while (matcher.find()) {
String substr = StringUtils.substringBetween(matcher.group(), prefix, suffix);
- String replacement = (replacePrefix + substr + replaceSuffix)
- .replace("()", "")
- .replace(replacePrefix + "#", replacePrefix);
+ String replacement = (replacePrefix + substr + replaceSuffix).replace("()", "").replace(replacePrefix + "#",
+ replacePrefix);
matcher.appendReplacement(result, replacement);
}
matcher.appendTail(result);
return result.toString();
}
+
}
diff --git a/src/test/java/io/lettuce/codec/CRC16UnitTests.java b/src/test/java/io/lettuce/codec/CRC16UnitTests.java
index 6d51a0bd57..5f8ae13c22 100644
--- a/src/test/java/io/lettuce/codec/CRC16UnitTests.java
+++ b/src/test/java/io/lettuce/codec/CRC16UnitTests.java
@@ -40,6 +40,7 @@ void testCRC16(Fixture fixture) {
static class Fixture {
final byte[] bytes;
+
final int expected;
Fixture(byte[] bytes, int expected) {
@@ -51,5 +52,7 @@ static class Fixture {
public String toString() {
return "Expects 0x" + Integer.toHexString(expected).toUpperCase();
}
+
}
+
}
diff --git a/src/test/java/io/lettuce/core/AbstractRedisClientTest.java b/src/test/java/io/lettuce/core/AbstractRedisClientTest.java
index f73c5083f8..b7a338baec 100644
--- a/src/test/java/io/lettuce/core/AbstractRedisClientTest.java
+++ b/src/test/java/io/lettuce/core/AbstractRedisClientTest.java
@@ -34,6 +34,7 @@
public abstract class AbstractRedisClientTest extends TestSupport {
protected static RedisClient client;
+
protected RedisCommands redis;
@BeforeAll
@@ -81,4 +82,5 @@ public void closeConnection() throws Exception {
redis.getStatefulConnection().close();
}
}
+
}
diff --git a/src/test/java/io/lettuce/core/AsyncConnectionIntegrationTests.java b/src/test/java/io/lettuce/core/AsyncConnectionIntegrationTests.java
index af5b21b5ba..35e23a7b52 100644
--- a/src/test/java/io/lettuce/core/AsyncConnectionIntegrationTests.java
+++ b/src/test/java/io/lettuce/core/AsyncConnectionIntegrationTests.java
@@ -47,7 +47,9 @@
class AsyncConnectionIntegrationTests extends TestSupport {
private final RedisClient client;
+
private final StatefulRedisConnection connection;
+
private final RedisAsyncCommands async;
@Inject
@@ -126,10 +128,12 @@ void futureListenerCompleted() {
final List