-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[apex] Prevent classes from shadowing System Namespace #3184
Comments
@rsoesemann / @daveespo - I'll see if I can provide a PR for this. |
@noerremark please think about your implementation options. This could be a super lean XPath rule just checking a few classes against the class name. The footprint of a real Java rule is only of use when you make it work with previously unknown System classes. |
@rsoesemann - I agree, XPath is the best option here. |
@rsoesemann - I started looking into this, and there is a LOT of classes. I know XPath is the easy route, but what about doing a Java-rule that uses reflections to generate a list of bad names to test against? @adangel - I see you have been doing the stuff on jorle, would it be possible? |
@noerremark I absolutely agree that a Java rule is smart if AND ONLY if it really not only enumerates such classes but actually finds them out magically. Meaning if Salesforce adds a NEW system class this rule should auto-detect it. Can we reference a separate file in XPath?! |
We brainstormed about this rule in #2322. Believe it or not, I had the issue the other day, in a real environment. Salesforce Developers Blog has a 2012 post about it, so it's an official "feature", but pretty bad design.
Proposed Rule Name: ClassShadowsSystemNamespace
Proposed Category: Code Style
Description:
Code Sample:
Since
Database
is also inSystem
this is a violation.The text was updated successfully, but these errors were encountered: