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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]