och5351 opened a new pull request, #4440:
URL: https://github.com/apache/streampark/pull/4440

   ## 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](https://github.com/apache/streampark/issues/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)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to