[apex] False positive ApexSharingViolationsRule, unsupported Apex feature
Fixes #1664
This commit is contained in:
@ -96,7 +96,8 @@ public class ApexSharingViolationsRule extends AbstractApexRule {
|
||||
* @return
|
||||
*/
|
||||
private boolean isSharingPresent(ASTUserClass node) {
|
||||
return node.getModifiers().isWithoutSharing() || node.getModifiers().isWithSharing();
|
||||
return node.getModifiers().isWithoutSharing() || node.getModifiers().isWithSharing()
|
||||
|| node.getModifiers().isInheritedSharing();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -97,4 +97,15 @@ public without sharing class Foo {
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>Apex class with inherited sharing doing a safe SOQL query</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public inherited sharing class MyClass {
|
||||
public List<Contact> getAllTheSecrets(){
|
||||
return [SELECT Name FROM Contact];
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
</test-data>
|
||||
|
Reference in New Issue
Block a user