Merge branch 'pr-1891'

This commit is contained in:
Andreas Dangel
2019-06-27 20:30:05 +02:00
3 changed files with 15 additions and 1 deletions

View File

@ -46,6 +46,8 @@ datetime field.
### Fixed Issues
* apex
* [#1664](https://github.com/pmd/pmd/issues/1664): \[apex] False positive ApexSharingViolationsRule, unsupported Apex feature
* java
* [#1848](https://github.com/pmd/pmd/issues/1848): \[java] Local classes should preserve their modifiers
* java-bestpractices

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>