pan3793 commented on code in PR #51775:
URL: https://github.com/apache/spark/pull/51775#discussion_r2250798833


##########
common/utils/src/main/java/org/apache/spark/internal/SparkLogger.java:
##########
@@ -65,8 +66,10 @@
  * you can define `custom LogKey` and use it in `java` code as follows:
  * <p>
  *
- * // To add a `custom LogKey`, implement `LogKey`
- * public static class CUSTOM_LOG_KEY implements LogKey { }

Review Comment:
   I think so.
   
   BTW, the previous example does not work for me
   
   ```
   class JavaCustomLogKeys {
     // Custom `LogKey` must be `implements LogKey`
     public static class CUSTOM_LOG_KEY implements LogKey { }
   
     // Singleton
     public static final CUSTOM_LOG_KEY CUSTOM_LOG_KEY = new CUSTOM_LOG_KEY();
   }
   ```
   
   I can use `javac` to compile it, but `scalac` raises error
   ```
   [INFO] --- scala:4.9.5:compile (scala-compile-first) @ SPARK-53064 ---
   [INFO] Compiler bridge file: 
/Users/chengpan/.sbt/1.0/zinc/org.scala-sbt/org.scala-sbt-compiler-bridge_2.13-1.10.8-bin_2.13.16__61.0-1.10.8_20250303T164041.jar
   [INFO] compiling 2 Scala sources and 1 Java source to 
/Users/chengpan/Projects/SPARK-53064/target/classes ...
   [ERROR] 
/Users/chengpan/Projects/SPARK-53064/src/main/java/io/github/pan3793/JavaCustomLogKeys.java:10:
 CUSTOM_LOG_KEY is already defined as class CUSTOM_LOG_KEY
   [ERROR] one error found
   ```



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to