mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
Merge pull request #19892 from owen-mc/fix-markdown-query-help-formatting
Fix markdown query help formatting
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
# Use of `String#replaceAll` with a first argument which is not a regular expression
|
||||
|
||||
Using `String#replaceAll` is less performant than `String#replace` when the first argument is not a regular expression.
|
||||
|
||||
## Overview
|
||||
|
||||
The `String#replaceAll` method is designed to work with regular expressions as its first parameter. When you use a simple string without any regex patterns (like special characters or syntax), it's more efficient to use `String#replace` instead. This is because `replaceAll` has to compile the input as a regular expression first, which adds unnecessary overhead when you are just replacing literal text.
|
||||
|
||||
@@ -8,6 +8,8 @@ Avoid calling `finalize()` in application code. Allow the JVM to determine a gar
|
||||
|
||||
## Example
|
||||
|
||||
### Incorrect Usage
|
||||
|
||||
```java
|
||||
class LocalCache {
|
||||
private Collection<File> cacheFiles = ...;
|
||||
@@ -19,9 +21,10 @@ void main() {
|
||||
// ...
|
||||
cache.finalize(); // NON_COMPLIANT
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### Correct Usage
|
||||
|
||||
```java
|
||||
import java.lang.AutoCloseable;
|
||||
import java.lang.Override;
|
||||
@@ -43,10 +46,9 @@ void main() {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
# Implementation Notes
|
||||
## Implementation Notes
|
||||
|
||||
This rule ignores `super.finalize()` calls that occur within `finalize()` overrides since calling the superclass finalizer is required when overriding `finalize()`. Also, although overriding `finalize()` is not recommended, this rule only alerts on direct calls to `finalize()` and does not alert on method declarations overriding `finalize()`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user