[apex] False positive ApexSharingViolationsRule, unsupported Apex feature

Fixes #1664
This commit is contained in:
Andreas Dangel
2019-06-27 20:22:05 +02:00
parent e7427a3db0
commit ef011c526d
2 changed files with 13 additions and 1 deletions

View File

@ -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();
}
}

View File

@ -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>