Should indexOfLatin1Unsafe be private instead of public in java\lang\StringUTF16.java?
Patrick Zhang OS
patrick at os.amperecomputing.com
Fri Feb 14 03:29:44 UTC 2020
OK, thanks Roger, I am looking for the opportunity of speeding up indexOf, and would fix it by the way once I have a patch there.
Regards
Patrick
-----Original Message-----
From: core-libs-dev <core-libs-dev-bounces at openjdk.java.net> On Behalf Of Roger Riggs
Sent: Friday, February 14, 2020 12:12 AM
To: core-libs-dev at openjdk.java.net
Subject: Re: Should indexOfLatin1Unsafe be private instead of public in java\lang\StringUTF16.java?
Hi Patrick,
Private would be good, but since they are in a package-private class they are not visibile outside the package.
If there is some other change to the class then fix it but otherwise not worth the overhead.
Roger
On 2/13/20 10:34 AM, Patrick Zhang OS wrote:
> Hi,
>
> A quick question,
> I read the code snippets of indexOf(String str), found indexOfUnsafe [1] and indexOfLatin1Unsafe [2] have different access control, but it looks both should be private. Did I miss any outer caller or any other restriction? Thanks for your comment.
>
> [1] private static int indexOfUnsafe(byte[] value, int valueCount,
> byte[] str, int strCount, int fromIndex)
> http://hg.openjdk.java.net/jdk/jdk/file/cf6409153216/src/java.base/sha
> re/classes/java/lang/StringUTF16.java#l392
> [2] public static int indexOfLatin1Unsafe(byte[] src, int srcCount,
> byte[] tgt, int tgtCount, int fromIndex)
> http://hg.openjdk.java.net/jdk/jdk/file/cf6409153216/src/java.base/sha
> re/classes/java/lang/StringUTF16.java#l440
>
> Regards
> Patrick
>
More information about the core-libs-dev
mailing list