mirror of
https://github.com/github/codeql.git
synced 2026-01-07 19:50:22 +01:00
21 lines
581 B
Plaintext
21 lines
581 B
Plaintext
/**
|
|
* @name Inefficient primitive constructor
|
|
* @description Calling the constructor of a boxed type is inefficient.
|
|
* @kind problem
|
|
* @problem.severity recommendation
|
|
* @precision high
|
|
* @id java/inefficient-boxed-constructor
|
|
* @tags efficiency
|
|
* maintainability
|
|
*/
|
|
|
|
import java
|
|
|
|
from ClassInstanceExpr call, BoxedType type
|
|
where
|
|
type = call.getType() and
|
|
not call.getEnclosingCallable().getDeclaringType() = type
|
|
select call,
|
|
"Inefficient constructor for " + type.getPrimitiveType().getName() + " value, use " +
|
|
type.getName() + ".valueOf(...) instead."
|