mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
Merge pull request #20116 from github/idrissrio/compact-soruce-file
Java: Add support to Compact Source Files
This commit is contained in:
@@ -33,5 +33,13 @@ class CompilationUnit extends Element, File {
|
||||
*/
|
||||
Module getModule() { cumodule(this, result) }
|
||||
|
||||
/**
|
||||
* Holds if this compilation unit represents a compact source file.
|
||||
* A compact source file contains an implicitly declared top-level class.
|
||||
*/
|
||||
predicate isCompactSourceFile() {
|
||||
exists(Class c | c.getCompilationUnit() = this and c.isImplicit())
|
||||
}
|
||||
|
||||
override string getAPrimaryQlClass() { result = "CompilationUnit" }
|
||||
}
|
||||
|
||||
@@ -700,6 +700,15 @@ class Class extends ClassOrInterface {
|
||||
/** Holds if this class is an anonymous class. */
|
||||
predicate isAnonymous() { isAnonymClass(this.getSourceDeclaration(), _) }
|
||||
|
||||
/** Holds if this class is an implicit class (compact source file). */
|
||||
predicate isImplicit() { isImplicitClass(this.getSourceDeclaration()) }
|
||||
|
||||
/** Holds if this is an auxiliary program element generated by the compiler. */
|
||||
override predicate isCompilerGenerated() {
|
||||
super.isCompilerGenerated() or
|
||||
this.isImplicit()
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an annotation that applies to this class.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user