mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
Merge pull request #6651 from smowton/smowton/admin/functional-interface-tests
Add tests for functional interfaces
This commit is contained in:
29
java/ql/test/library-tests/functional-interfaces/Test.java
Normal file
29
java/ql/test/library-tests/functional-interfaces/Test.java
Normal file
@@ -0,0 +1,29 @@
|
||||
public class Test {
|
||||
|
||||
interface Functional {
|
||||
int f();
|
||||
}
|
||||
|
||||
class Concrete implements Functional {
|
||||
public int f() { return 0; }
|
||||
}
|
||||
|
||||
interface FunctionalWithDefaults {
|
||||
int f();
|
||||
|
||||
default int g() { return 1; }
|
||||
}
|
||||
|
||||
interface NotFunctional {
|
||||
default int g() { return 1; }
|
||||
}
|
||||
|
||||
interface FunctionalWithObjectMethods {
|
||||
int f();
|
||||
|
||||
String toString();
|
||||
|
||||
int hashCode();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
| Test.java:3:13:3:22 | Functional |
|
||||
| Test.java:11:13:11:34 | FunctionalWithDefaults |
|
||||
| Test.java:21:13:21:39 | FunctionalWithObjectMethods |
|
||||
3
java/ql/test/library-tests/functional-interfaces/test.ql
Normal file
3
java/ql/test/library-tests/functional-interfaces/test.ql
Normal file
@@ -0,0 +1,3 @@
|
||||
import java
|
||||
|
||||
select any(FunctionalInterface fi | fi.fromSource())
|
||||
Reference in New Issue
Block a user