mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
Do not accept empty default methods
This commit is contained in:
@@ -28,7 +28,7 @@ public class Test {
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
The rule excludes reporting methods that are annotated or marked as `default`.
|
||||
The rule excludes reporting methods that are annotated.
|
||||
|
||||
## References
|
||||
- [java.util.Collections.add](https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/util/Collection.html#add(E))
|
||||
|
||||
@@ -86,8 +86,6 @@ where
|
||||
not exists(m.getDoc().getJavadoc()) and
|
||||
//annotated methods are considered compliant
|
||||
not exists(m.getAnAnnotation()) and
|
||||
//default methods are not abstract, but are considered compliant
|
||||
not m.isDefault() and
|
||||
//native methods have no body
|
||||
not m.isNative()
|
||||
select m, "This empty method should be completed."
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
| Test.java:13:15:13:16 | f2 | This empty method should be completed. |
|
||||
| Test.java:35:18:35:23 | method | This empty method should be completed. |
|
||||
|
||||
@@ -32,8 +32,7 @@ public class Test {
|
||||
|
||||
public interface TestInterface {
|
||||
|
||||
default void method() {
|
||||
}
|
||||
default void method() { } // $ Alert
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user