-
Notifications
You must be signed in to change notification settings - Fork 28.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-8962] Add Scalastyle rule to ban direct use of Class.forName; fix existing uses #7350
Conversation
This pull request might become intractable to review due to how many files it touches, so I recommend using the Reviewable link to keep track of changes. |
Test build #37065 has finished for PR 7350 at commit
|
The RBackendHandler change looks good to me. I do find it weird that we have scala style rules for not using specific functions, but I guess its hard to track this during code review in a large codebase. |
@shivaram, in this case I think the style rule is justified even if it's inconvenient or a hassle to implement because this |
@JoshRosen looks like you missed a few places. Can you fix them so we can merge this? |
Test build #1053 has finished for PR 7350 at commit
|
Test build #37158 has finished for PR 7350 at commit
|
Test build #37159 has finished for PR 7350 at commit
|
Unfortunately another pr created a conflict again ... |
Argh... will fix now. |
Test build #37190 has finished for PR 7350 at commit
|
Jenkins, retest this please. |
1 similar comment
Jenkins, retest this please. |
Test build #37247 has finished for PR 7350 at commit
|
Jenkins, retest this please. |
Test build #37260 has finished for PR 7350 at commit
|
Thanks - merging this in. |
This pull request adds a Scalastyle regex rule which fails the style check if
Class.forName
is used directly.Class.forName
always loads classes from the default / system classloader, but in a majority of cases, we should be using Spark's ownUtils.classForName
instead, which tries to load classes from the current thread's context classloader and falls back to the classloader which loaded Spark when the context classloader is not defined.