RFR: 8276348: Use blessed modifier order in java.base

David Holmes david.holmes at oracle.com
Wed Nov 3 12:52:59 UTC 2021


On 3/11/2021 9:26 pm, Pavel Rappo wrote:
> On Tue, 2 Nov 2021 20:34:44 GMT, Martin Buchholz <martin at openjdk.org> wrote:
> 
>>>> Pragmatically, fix the script to ignore those keywords on comment lines. Learn Perl, its just a regular expression pattern match and replace expression.
>>>
>>> I understand in principle how to modify that script to ignore doc comments. The thing I was referring to when said "btw, how would we do that?" was this: not all comment lines are prose. Some of those lines belong to snippets of code, which I guess you would also like to be properly formatted.
>>>   
>>>> But having seen several reviewers be unmoved by the difference, the real pragmatic view is to ignore the English.
>>>
>>> I'm sorry you feel that way. Would it be okay if I made it clear that those two words are not English adjectives but are special symbols that happen to use Latin script and originate from the English words they resemble? If so, I could enclose each of them in `{@code ... }`. If not, I could drop that particular change from this PR.
>>
>> The blessed-modifier-order.sh script intentionally modifies comments, with the hope of finding code snippets (it did!)
>>
>> Probably I manually deleted the change to Object.java back in 2015, to avoid the sort of controversy we're seeing now.
>> I don't have a strong feeling either way on changing that file.
>>
>> I agree with @pavelrappo  that script-generated changes should not be mixed with manual changes.
>> I would also not update copyright years for such changes.
>>
>> It's a feature of blessed-modifier-order.sh that all existing formatting is perfectly preserved.
> 
> One more thing. Please have a look at this other line in the same file; this line was there before the change https://github.com/openjdk/jdk/blob/465d350d0b3cac277a58b9f8ece196c1cde68e80/src/java.base/share/classes/java/lang/Object.java#L49
> 
> So before the change, the file was somewhat inconsistent. The change made it consistent. **If one is going to ever revert that controversial part of the change, please update both lines so that the file remains consistent.**

Line 281 is (was!) consistent with line 277 because it is distinguishing 
a synchronized "static method" from a synchronized "instance method". 
There was no need to make any change to line 281 because of the 
blessed-order of modifiers as defined for method declarations! This text 
is just prose. Now for consistency you should change line 277 to refer 
to a "non-static synchronized method" (as "instance synchronized method" 
would be truly awful).

Line 49 places "static synchronized" in code font, implying that it is 
referring to the actual method modifiers and as such using the blessed 
order is appropriate. Line 49 does not need to be "consistent" with line 
281. If line 49 used a normal font so the words "static" and 
"synchronized" were just prose then either order would be perfectly fine 
in terms of English language, but then you could make a case for having 
it be consistent with line 281.

Cheers,
David
-----


> -------------
> 
> PR: https://git.openjdk.java.net/jdk/pull/6213
> 


More information about the core-libs-dev mailing list