RFR: 8234335: Remove line break in class declaration in java.base

Lance Andersen lance.andersen at oracle.com
Mon Nov 18 18:49:11 UTC 2019


Hi Roger, Julia,

> On Nov 18, 2019, at 10:10 AM, Roger Riggs <Roger.Riggs at oracle.com> wrote:
> 
> If we're putting "public" on the same line as the method then
> it seems useful to put the /* non-public */ on the same line too.
> Though I don't know we have style guidance for that.
> (And elsewhere too).
> 

————————
-    /*non-public*/ static
     @DontInline
-    void maybeCustomize(MethodHandle mh) {
+    /*non-public*/ static void maybeCustomize(MethodHandle mh) {
         byte count = mh.customizationCount;
         if (count >= CUSTOMIZE_THRESHOLD) {
             mh.customize();

———————————

Is the above common coding in the JDK?  To me it seems to be more readable to have the comment above the method?    

If I run reformat in Intellij for example with code similar to the above, it will put /*non-public*/ on its own line.

Before reformat:

——————
/*non-public*/ static void foo(String f1) {
    System.out.printf("hello %s%n", f1);
}
—————————
After reformat:
—————
/*non-public*/
static void foo(String f1) {
    System.out.printf("hello %s%n", f1);
}
——————

HTH

Best
Lance

 <http://oracle.com/us/design/oracle-email-sig-198324.gif>
 <http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif>
 <http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering 
1 Network Drive 
Burlington, MA 01803
Lance.Andersen at oracle.com <mailto:Lance.Andersen at oracle.com>





More information about the core-libs-dev mailing list