RFR: 8234335: Remove line break in class declaration in java.base
Julia Boes
julia.boes at oracle.com
Tue Nov 19 10:06:44 UTC 2019
Hi Roger, Lance,
> Can you recheck the edit to java/lang/invoke/ClassSpecializer.java: 544
>
> I would think the line should be broken at the "..."
>
> * class TopClass { ... * private static final class Species_LLI
> extends TopClass {
That's right, there was also a closing brace missing.
> MemberName.java:1098
> It seems like there should be some indentation of the 2nd line of the
> declaration:
>
> public <NoSuchMemberExceptionextends ReflectiveOperationException>
> ........MemberName resolveOrFail(byte refKind, MemberName m, Class<?>
> lookupClass,
> Class<NoSuchMemberException> nsmClass)
Done.
>> 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).
> 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);
> }
> ——————
Looking at the existing code base, the same-line version is slightly
more common (57 of 100). I would lean on the side of consistency and
stick to the same-line version unless there are any objections.
Updated webrev: http://cr.openjdk.java.net/~jboes/webrevs/8234335/webrev.01/
Regards,
Julia
More information about the core-libs-dev
mailing list