Skip to content

Conversation

@pditommaso
Copy link
Contributor

@pditommaso pditommaso commented Jan 7, 2026

Summary

Converts all production source files in lib-data-stream-redis from Groovy to pure Java while keeping tests in Groovy/Spock. This removes the Groovy runtime dependency from production code.

Files converted

Groovy File Java File
AbstractMessageStream.groovy AbstractMessageStream.java
MessageConsumer.groovy MessageConsumer.java
MessageStream.groovy MessageStream.java
impl/LocalMessageStream.groovy impl/LocalMessageStream.java
impl/RedisMessageStream.groovy impl/RedisMessageStream.java
impl/RedisStreamConfig.groovy impl/RedisStreamConfig.java

Key Groovy-to-Java conversions

Groovy Feature Java Equivalent
@Slf4j annotation private static final Logger log = LoggerFactory.getLogger(...)
@CompileStatic Removed (Java is statically typed)
@Memoized Removed (not critical for simple millis conversion)
GString "${var}" String concatenation or String.format()
def keyword Explicit types
Safe navigation ?. Explicit null checks
Elvis operator ?: Ternary operator
final local vars Explicit final or mutable vars
return in finally block (suppresses exceptions) Catch exception without rethrowing (see note below)

Note on exception handling in LocalMessageStream.consume()

In Groovy, having return result inside a finally block suppresses any exception thrown in the try/catch block. The original code relied on this behavior to catch consumer exceptions and return false instead of propagating the exception.

In Java, this was converted to explicitly catch the exception without rethrowing:

catch (Throwable e) {
    result = false;
    // exception is caught but not rethrown - message will be re-queued
}

build.gradle changes

  • Removed io.seqera.groovy-library-conventions plugin
  • Changed Groovy dependencies from implementation to testImplementation
  • Kept groovy plugin for test compilation (Spock tests remain in Groovy)

Test plan

  • All 8 existing tests pass
  • Production code compiles without Groovy dependencies
  • Review generated Java code for correctness

🤖 Generated with Claude Code

Convert all production source files from Groovy to pure Java while
keeping tests in Groovy/Spock. This removes the Groovy runtime
dependency from production code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants