mirror of
https://github.com/github/codeql.git
synced 2026-02-13 05:31:22 +01:00
21 lines
586 B
Plaintext
21 lines
586 B
Plaintext
/**
|
|
* @name Inefficient String constructor
|
|
* @description Using the 'String(String)' constructor is less memory efficient than using the
|
|
* constructor argument directly.
|
|
* @kind problem
|
|
* @problem.severity recommendation
|
|
* @precision high
|
|
* @id java/inefficient-string-constructor
|
|
* @tags quality
|
|
* maintainability
|
|
* readability
|
|
*/
|
|
|
|
import java
|
|
|
|
from ClassInstanceExpr e
|
|
where
|
|
e.getConstructor().getDeclaringType() instanceof TypeString and
|
|
e.getArgument(0).getType() instanceof TypeString
|
|
select e, "Inefficient new String(String) constructor."
|