Skip to content

Commit 2042883

Browse files
committed
Java: Fix Predicate QLDoc style.
1 parent d3e0182 commit 2042883

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

java/ql/src/Violations of Best Practice/Implementation Hiding/VisibleForTestingAbuse.ql

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import java
1616

1717
/**
18-
* A `Callable` is within some `RefType` (including through lambdas and inner classes)
18+
* Holds if a `Callable` is within some `RefType` (including through lambdas and inner classes)
1919
*/
2020
predicate isWithinType(Callable c, RefType t) {
2121
c.getDeclaringType() = t
@@ -24,28 +24,37 @@ predicate isWithinType(Callable c, RefType t) {
2424
}
2525

2626
/**
27-
* A `Callable` is within same package as the `RefType`
27+
* Holds if a `Callable` is within same package as the `RefType`
2828
*/
2929
predicate isWithinPackage(Expr e, RefType t) {
3030
e.getCompilationUnit().getPackage() = t.getPackage()
3131
}
3232

33+
/**
34+
* Holds if a nested class is within a static context
35+
*/
3336
predicate withinStaticContext(NestedClass c) {
3437
c.isStatic() or
3538
c.(AnonymousClass).getClassInstanceExpr().getEnclosingCallable().isStatic() // JLS 15.9.2
3639
}
3740

41+
/**
42+
* Gets the enclosing instance type for a non-static inner class
43+
*/
3844
RefType enclosingInstanceType(Class inner) {
3945
not withinStaticContext(inner) and
4046
result = inner.(NestedClass).getEnclosingType()
4147
}
4248

49+
/**
50+
* A class that encloses one or more inner classes
51+
*/
4352
class OuterClass extends Class {
4453
OuterClass() { this = enclosingInstanceType+(_) }
4554
}
4655

4756
/**
48-
* An innerclass is accessed outside of its outerclass
57+
* Holds if an innerclass is accessed outside of its outerclass
4958
* and also outside of its fellow inner parallel classes
5059
*/
5160
predicate isWithinDirectOuterClassOrSiblingInner(

0 commit comments

Comments
 (0)