-
Notifications
You must be signed in to change notification settings - Fork 5
Query ideas
Marcono1234 edited this page Apr 26, 2021
·
4 revisions
Ideas for new queries.
- Field has boxed type
- Field is private or package-private; or has higher visibility but is not publicly visible
- Field is only ever assigned non-
null
values (use CodeQL'sNullGuards.clearlyNotNullExpr()
)
Could ignore cases where field value is passed to method accepting only boxed type (respectively supertype), or where boxed type (or supertype) is returned by method; maybe field type was chosen for performance reasons to avoid boxing primitive type. But with true value-based types this performance penalty for wrapping primitive values might be negligible.
Similar to CodeQL's 'java/non-null-boxed-variable' (but that only covers local variables)
- Array component type is boxed
- Array is used only internally (as local variable or field)
- Array elements are only ever assigned non-
null
values (use CodeQL'sNullGuards.clearlyNotNullExpr()
)
TODO: Verify that this is actually a problem
- Starts a new
Process
but does not redirect input and output stream
Could cause deadlock when parent Java process waits for child process to finish and child process waits for parent process to provide input / consume output- Output stream is neither redirected using
ProcessBuilder.redirectOutput
nor obtained from createdProcess
- Error stream is neither redirected using
redirectError
orredirectErrorStream
, nor obtained from createdProcess
- Input stream is neither redirected using
redirectInput
nor obtained from createdProcess
- Output stream is neither redirected using
- Consider
ProcessBuilder
andRuntime
methods for starting process