File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
java/ql/src/utils/stub-generator Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 77
88import java
99
10+ /** Holds if `id` is a valid Java identifier. */
11+ bindingset [ id]
12+ private predicate isValidIdentifier ( string id ) { id .regexpMatch ( "[\\w_$]+" ) }
13+
1014/** A type that should be in the generated code. */
1115abstract private class GeneratedType extends ClassOrInterface {
1216 GeneratedType ( ) {
1317 not this instanceof AnonymousClass and
1418 not this .isLocal ( ) and
15- not this .getPackage ( ) instanceof ExcludedPackage
19+ not this .getPackage ( ) instanceof ExcludedPackage and
20+ isValidIdentifier ( this .getName ( ) )
1621 }
1722
1823 private string stubKeyword ( ) {
@@ -108,7 +113,8 @@ abstract private class GeneratedType extends ClassOrInterface {
108113 not result .isPrivate ( ) and
109114 not result .isPackageProtected ( ) and
110115 not result instanceof StaticInitializer and
111- not result instanceof InstanceInitializer
116+ not result instanceof InstanceInitializer and
117+ isValidIdentifier ( result .getName ( ) )
112118 }
113119
114120 final Type getAGeneratedType ( ) {
You can’t perform that action at this time.
0 commit comments