mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Migrate Java code to separate QL repo.
This commit is contained in:
18
java/ql/src/Performance/NewStringString.ql
Normal file
18
java/ql/src/Performance/NewStringString.ql
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @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 efficiency
|
||||
* maintainability
|
||||
*/
|
||||
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."
|
||||
Reference in New Issue
Block a user