Skip to content

[Feature][Common] Migrate conf package from Scala to Java#4440

Draft
och5351 wants to merge 2 commits into
apache:devfrom
och5351:feature/convert-java-streampark-common-conf-package
Draft

[Feature][Common] Migrate conf package from Scala to Java#4440
och5351 wants to merge 2 commits into
apache:devfrom
och5351:feature/convert-java-streampark-common-conf-package

Conversation

@och5351

@och5351 och5351 commented Jul 19, 2026

Copy link
Copy Markdown

What this PR does

Converts 9 Scala files in streampark-common/src/main/scala/org/apache/streampark/common/conf/ to pure Java as part of the Scala removal plan (#4408).

Converted files

Scala Java
ConfigKeys.scala ConfigKeys.java
InternalOption.scala InternalOption.java
InternalConfigHolder.scala InternalConfigHolder.java
CommonConfig.scala CommonConfig.java
K8sFlinkConfig.scala K8sFlinkConfig.java
ConfigOption.scala ConfigOption.java
Workspace.scala Workspace.java
FlinkVersion.scala FlinkVersion.java
SparkVersion.scala SparkVersion.java

Notable design decisions

  • InternalOption<T>: Made generic (InternalOption<T>) to eliminate unchecked casts in InternalConfigHolder.get(InternalOption<T>). Each config constant exposes a static accessor method (e.g. CommonConfig.MAVEN_SETTINGS_PATH()) to preserve backward compatibility with existing Java callers that relied on Scala val compiling to a no-arg method.
  • InternalOption accessors: Added both getKey()-style (Java convention) and key()-style (Scala case class compatible) accessors to support mixed callers during the migration period.
  • ConfigOption: Scala implicit parameters (implicit prefix: String, implicit prop: Properties) converted to Builder pattern.
  • Workspace: Scala lazy val fields converted to eagerly-initialized constructor fields with DCL (volatile) for singleton instances.
  • FlinkVersion / SparkVersion: Scala lazy val fields compile to no-arg methods in bytecode, so accessor methods use the same names without get prefix (e.g. version(), scalaVersion()) to keep Scala callers working.

Scope extension — TypeCastUtils.java

TypeCastUtils.java is added to the util package as a replacement for Implicits.cast[T], a Scala extension method that Java code cannot call. Three of the converted files require string-to-type casting. Implicits.scala (and its cast method) will be removed when all remaining Scala files are converted.

Also updated

  • EnvInitializer.java in streampark-console-service: updated raw InternalOption reference to InternalOption<?> following the generic change.

Testing

  • mvn compile -pl streampark-common passes
  • mvn test -pl streampark-common passes (13 tests)

closes #4408 (partial — Phase 1.1)

@och5351 och5351 changed the title [Common] Convert streampark-common conf package from Scala to Java [Feature][Common] Convert streampark-common conf package from Scala to Java Jul 19, 2026
@och5351 och5351 changed the title [Feature][Common] Convert streampark-common conf package from Scala to Java [Feature][Common] Migrate conf package from Scala to Java Jul 19, 2026
@och5351
och5351 marked this pull request as draft July 19, 2026 12:45
@och5351
och5351 force-pushed the feature/convert-java-streampark-common-conf-package branch from e8ca259 to 91f2bbd Compare July 19, 2026 13:24
@github-actions github-actions Bot added the INFRA label Jul 19, 2026
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Proposal] Remove Scala from StreamPark — design and migration plan

1 participant