You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/02/26 15:16:39 UTC

[GitHub] manuzhang commented on a change in pull request #23896: [SPARK-26977][CORE] Fix warn against subclassing scala.App

manuzhang commented on a change in pull request #23896: [SPARK-26977][CORE] Fix warn against subclassing scala.App
URL: https://github.com/apache/spark/pull/23896#discussion_r260332912
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala
 ##########
 @@ -828,9 +828,12 @@ private[spark] class SparkSubmit extends Logging {
     val app: SparkApplication = if (classOf[SparkApplication].isAssignableFrom(mainClass)) {
       mainClass.newInstance().asInstanceOf[SparkApplication]
     } else {
-      // SPARK-4170
-      if (classOf[scala.App].isAssignableFrom(mainClass)) {
-        logWarning("Subclasses of scala.App may not work correctly. Use a main() method instead.")
+      // SPARK-4170, SPARK-26977
+      Try {
+        if (classOf[scala.App].isAssignableFrom(Utils.classForName(s"$childMainClass$$"))) {
+          logWarning("Subclasses of scala.App may not work correctly. " +
+            "Use a main() method instead.")
+        }
 
 Review comment:
   1. Which indent is wrong ? `mvn checkstyle:checkstyle` runs fine for me. 
   2. Is there any case the original check would work ? 
   3. What should we do when `ClassNotFoundException` is caught ?Java app will always throw here. 
   4. I'll add more comments

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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