In Casts#castWithPrimitives(...) there seems to be a typo. When converting Number values with boolean.class as the type, it returns true when the given value is 0, and false when the value is 1.
The Java Virtual Machine encodes boolean array components using 1 to represent true and 0 to represent false. Where Java programming language boolean values are mapped by compilers to values of Java Virtual Machine type int, the compilers must use the same encoding.
Below I am attaching a list of all calls to this method:
In
Casts#castWithPrimitives(...)
there seems to be a typo. When convertingNumber
values withboolean.class
as the type, it returnstrue
when the given value is0
, andfalse
when the value is1
.https://github.com/GraxCode/threadtear/blob/f0a13d5d515f769db33cd408cb65944b027d9ef0/core/src/main/java/me/nov/threadtear/util/reflection/Casts.java#L17-L25
As of Java 16, Java Virtual Machine Specification says:
Below I am attaching a list of all calls to this method:
when converting values on stack in
BasicReferenceHandler
; https://github.com/GraxCode/threadtear/blob/f0a13d5d515f769db33cd408cb65944b027d9ef0/core/src/main/java/me/nov/threadtear/analysis/stack/BasicReferenceHandler.java#L65when building
ConstantValue
; https://github.com/GraxCode/threadtear/blob/f0a13d5d515f769db33cd408cb65944b027d9ef0/core/src/main/java/me/nov/threadtear/analysis/stack/ConstantValue.java#L18when updating proxy field values in
StringObfuscationStringer
https://github.com/GraxCode/threadtear/blob/f0a13d5d515f769db33cd408cb65944b027d9ef0/core/src/main/java/me/nov/threadtear/execution/stringer/StringObfuscationStringer.java#L162Not much to fix, but I could send a PR if you want.