[
https://issues.apache.org/jira/browse/NIFI-16142?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Stieglitz updated NIFI-16142:
------------------------------------
Description: In a handful of places a long is read from a byte array using
bit-wise operators which is hard to read. In addition there are some
unnecessary casts when using this method. Athough all casts were kept in PR
#[11440|[https://github.com/apache/nifi/pull/11440]] that was only for
consistency so one wouldn't have to wonder why some lines of casts and others
do not, but ideally unnecessary ones should not be included. Since Java 9,
there is an alternative using java.lang.invoke.VarHandle which is a fast and
convenient way to load multiple bytes from from a byte array into a long
variable. More can be read about it here (was: In a handful of places a long
is read from a byte array using bit-wise operators which is hard to read. In
addition there are some unnecessary casts when using this method although all
casts were kept in PR #[11440|[https://github.com/apache/nifi/pull/11440]] that
was only for consistency so one wouldn't have to wonder why some lines of casts
and others do not. Since Java 9, there is an alternative using )
> Replace the use of bitwise operators to read a long from a byte array with
> java.lang.invoke.VarHandle
> -----------------------------------------------------------------------------------------------------
>
> Key: NIFI-16142
> URL: https://issues.apache.org/jira/browse/NIFI-16142
> Project: Apache NiFi
> Issue Type: Improvement
> Reporter: Daniel Stieglitz
> Assignee: Daniel Stieglitz
> Priority: Minor
>
> In a handful of places a long is read from a byte array using bit-wise
> operators which is hard to read. In addition there are some unnecessary casts
> when using this method. Athough all casts were kept in PR
> #[11440|[https://github.com/apache/nifi/pull/11440]] that was only for
> consistency so one wouldn't have to wonder why some lines of casts and others
> do not, but ideally unnecessary ones should not be included. Since Java 9,
> there is an alternative using java.lang.invoke.VarHandle which is a fast and
> convenient way to load multiple bytes from from a byte array into a long
> variable. More can be read about it here
--
This message was sent by Atlassian Jira
(v8.20.10#820010)