RFR: 8015854: [macosx] JButton's HTML ImageView adding unwanted padding [v2]

Alexey Ivanov aivanov at openjdk.java.net
Tue Mar 1 12:35:06 UTC 2022


On Fri, 4 Feb 2022 02:55:02 GMT, DamonGuy <duke at openjdk.java.net> wrote:

>> DamonGuy has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Add cycling of all installed LAFs. Add image generation to avoid saving an image to repo.
>>  - Changed frame to dispose regardless of passing or failing.
>
> I noticed I mistakenly left the thrown exception for failures commented out for the most recent push while testing the new changes. The new test with the run-time generated image and cycled LAFs seems to fail for Nimbus LAF, so I will fix this and push to the branch again.

A general comment: You, @DamonGuy, have quite a few comments in the test. Most of these comments are redundant because they repeat what the code does. The code should be self-documenting by using meaningful method and variable names, and I think you follow this rule.

The problem with comments is that they may be left unmodified when the code changes. Thus, the comments become misleading, confusing and therefore don't help a reader understand the code but make the reader guess whether they should believe the comment or the code.

A couple of points from [Programming Practices](http://cr.openjdk.java.net/~alundblad/styleguide/index-v6.html#toc-commenting-code) section from the Java Style Guide:

• _“First and foremost, try to make the code simple enough that it’s self explanatory. While comments explaining the code are good, not having to explain the code is better.”_

• _“Avoid comments that run the risk of getting out of sync as the code evolves. (If a comment runs the risk of getting out of sync, it’s often a sign that it comments how the code works rather than what the code achieves.)”_

-------------

PR: https://git.openjdk.java.net/jdk/pull/7310



More information about the client-libs-dev mailing list