File tree Expand file tree Collapse file tree
java/ql/consistency-queries Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import java
2+
3+ string topToString ( Top t ) {
4+ result = t .toString ( )
5+ or
6+ // TypeBound doesn't extend Top (but probably should)
7+ result = t .( TypeBound ) .toString ( )
8+ or
9+ // XMLLocatable doesn't extend Top (but probably should)
10+ result = t .( XMLLocatable ) .toString ( )
11+ or
12+ // Java #142
13+ t instanceof FieldDeclaration and not exists ( t .toString ( ) ) and result = "<FieldDeclaration>"
14+ or
15+ // Java #143
16+ t instanceof Javadoc and not exists ( t .toString ( ) ) and result = "<Javadoc>"
17+ or
18+ // Java #144
19+ t instanceof ReflectiveAccessAnnotation and not exists ( t .toString ( ) ) and result = "<ReflectiveAccessAnnotation>"
20+ }
21+
22+ string not1ToString ( ) {
23+ exists ( Top t | count ( topToString ( t ) ) != 1 and result = "Top which doesn't have exactly 1 toString: " + concat ( t .getAQlClass ( ) , ", " ) )
24+ or
25+ exists ( Location l | count ( l .toString ( ) ) != 1 and result = "Location which doesn't have exactly 1 toString: " + concat ( l .getAQlClass ( ) , ", " ) )
26+ or
27+ exists ( Module m | count ( m .toString ( ) ) != 1 and result = "Module which doesn't have exactly 1 toString: " + concat ( m .getAQlClass ( ) , ", " ) )
28+ or
29+ exists ( Directive d | count ( d .toString ( ) ) != 1 and result = "Directive which doesn't have exactly 1 toString: " + concat ( d .getAQlClass ( ) , ", " ) )
30+ }
31+
32+ select not1ToString ( )
33+
You can’t perform that action at this time.
0 commit comments