Merge pull request #9181 from Marcono1234/marcono1234/FloatingPointLiteral-rename

Java: Rename `FloatingPointLiteral` to `FloatLiteral`
This commit is contained in:
Anders Schack-Mulligen
2022-05-17 10:08:49 +02:00
committed by GitHub
9 changed files with 19 additions and 22 deletions

View File

@@ -0,0 +1,4 @@
---
category: deprecated
---
* The QL class `FloatingPointLiteral` has been renamed to `FloatLiteral`.

View File

@@ -716,20 +716,23 @@ class LongLiteral extends Literal, @longliteral {
override string getAPrimaryQlClass() { result = "LongLiteral" }
}
/** DEPRECATED: Alias for FloatLiteral */
deprecated class FloatingPointLiteral = FloatLiteral;
/**
* A float literal. For example, `4.2f`.
*
* A float literal is never negative; a preceding minus, if any, will always
* be modeled as separate `MinusExpr`.
*/
class FloatingPointLiteral extends Literal, @floatingpointliteral {
class FloatLiteral extends Literal, @floatingpointliteral {
/**
* Gets the value of this literal as CodeQL 64-bit `float`. The value will
* be parsed as Java 32-bit `float` and then converted to a CodeQL `float`.
*/
float getFloatValue() { result = this.getValue().toFloat() }
override string getAPrimaryQlClass() { result = "FloatingPointLiteral" }
override string getAPrimaryQlClass() { result = "FloatLiteral" }
}
/**

View File

@@ -49,7 +49,7 @@ module Private {
/** Class to represent float and double literals. */
class RealLiteral extends J::Literal {
RealLiteral() {
this instanceof J::FloatingPointLiteral or
this instanceof J::FloatLiteral or
this instanceof J::DoubleLiteral
}
}
@@ -191,7 +191,7 @@ private module Impl {
/** Gets the constant `float` value of non-`ConstantIntegerExpr` expressions. */
float getNonIntegerValue(Expr e) {
result = e.(LongLiteral).getValue().toFloat() or
result = e.(FloatingPointLiteral).getValue().toFloat() or
result = e.(FloatLiteral).getValue().toFloat() or
result = e.(DoubleLiteral).getValue().toFloat()
}