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 7
7
8
8
import java
9
9
10
+ /** Holds if `id` is a valid Java identifier. */
11
+ bindingset [ id]
12
+ private predicate isValidIdentifier ( string id ) { id .regexpMatch ( "[\\w_$]+" ) }
13
+
10
14
/** A type that should be in the generated code. */
11
15
abstract private class GeneratedType extends ClassOrInterface {
12
16
GeneratedType ( ) {
13
17
not this instanceof AnonymousClass and
14
18
not this .isLocal ( ) and
15
- not this .getPackage ( ) instanceof ExcludedPackage
19
+ not this .getPackage ( ) instanceof ExcludedPackage and
20
+ isValidIdentifier ( this .getName ( ) )
16
21
}
17
22
18
23
private string stubKeyword ( ) {
@@ -108,7 +113,8 @@ abstract private class GeneratedType extends ClassOrInterface {
108
113
not result .isPrivate ( ) and
109
114
not result .isPackageProtected ( ) and
110
115
not result instanceof StaticInitializer and
111
- not result instanceof InstanceInitializer
116
+ not result instanceof InstanceInitializer and
117
+ isValidIdentifier ( result .getName ( ) )
112
118
}
113
119
114
120
final Type getAGeneratedType ( ) {
You can’t perform that action at this time.
0 commit comments