The entire way those bit shifts are coded is error prone.

Should be:

    /** Operating system is Windows NT. */
     public static final int OS_WINNT = 1 << 0;
     /** Operating system is Solaris. */
     public static final int OS_SOLARIS = 1 << 1;
     public static final int OS_SOLARIS = 1 << 3;
     /** Operating system is Linux. */
     public static final int OS_LINUX = 1 << 4;
   …

Not using references to earlier constants and only changing the amount of the 
shift.  Makes it easier to read and see whaat the actual value should be.  It’s 
clear that each value represents a single bit without having to go back to see 
what the original value was, and removing any of the constants will never cause 
subsequent values to change. Maybe add a comment that 1 << 2 is skipped for 
whatever reason.  Perhaps leave a comment documenting the old w95/98 values so 
we know why those values aren’t used anymore.

Scott


> On Aug 11, 2022, at 12:48 PM, László Kishalmi <[email protected]> 
> wrote:
> 
> Anyway, here it is. I hope it helps:
> https://github.com/apache/netbeans/pull/4497
> 
> On Thu, Aug 11, 2022 at 9:15 AM László Kishalmi <[email protected]>
> wrote:
> 
>> OMG!
>> Just had some time to look at this. Unfortunately, I think it is serious.
>> Due to wrong bit-shifts the id-s for MAC_OS and LINUX has been changed,
>> which would mean a serious incompatibility as AFAIK the compiler puts
>> actual value of these fields into the bytecode.
>> That would cause third-party plugin compatibility issues whenever the
>> plugin would use those constants directly.
>> I hate to say it, but I think it is a reason for RC4
>> 
>> Do we have a PR fixing those bit-shifts or shall I create one?
>> 
>> On Wed, Aug 10, 2022 at 1:34 AM Neil C Smith <[email protected]>
>> wrote:
>> 
>>> Hi,
>>> 
>>> I generated the API snapshot sigtest file for review yesterday.
>>> Ideally we need to review earlier in the release process, but for a
>>> number of reasons they haven't been generated until now ...
>>> 
>>> https://github.com/apache/netbeans/pull/4487
>>> 
>>> One thing that stands out to me is the changes in compile time
>>> constants inside Utilities introduced by
>>> https://github.com/apache/netbeans/pull/4025
>>> 
>>> I'm not sure how much of an issue that might be in practice, and
>>> whether it's a reason to run an rc4?  Review welcomed!
>>> 
>>> Thanks,
>>> 
>>> Neil
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>> 
>>> For further information about the NetBeans mailing lists, visit:
>>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>> 
>>> 
>>> 
>>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Reply via email to