<Swing Dev> Contributing guidance, code conventions
Anthony Petrov
anthony.petrov at oracle.com
Fri Jul 12 12:56:12 UTC 2013
Hi Petr,
Thank you for your interest in contributing patches to OpenJDK. I
suggest you to start with reading http://openjdk.java.net/contribute/
The code conventions that you're referring to are all still valid. And
answers to your formatting questions are mostly affirmative. I don't
know of any IDE templates to help you format your code automatically,
but the most important thing to pay attention to is TABs vs. spaces:
OpenJDK repos don't allow for TABs (this is enforced by a commit hook),
so you have to use 4 spaces for indenting lines.
Regarding fixing warnings that your IDE highlights: this is a good thing
to do. However, this needs to be done as a separate patch. In other
words, when fixing a specific issue, it is always a good idea to avoid
massive reformatting of sources or otherwise fixing things unrelated to
the main problem. You can always submit new bugs at http://bugs.sun.com/
--
best regards,
Anthony
On 07/12/2013 04:18 PM, Petr Janeček wrote:
> Hello,
>
> I am Petr Janecek, a fresh member of this list who wants to contribute
> by generifying the JSpinner class on behalf of
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6303622 (Use generic
> in Swing components like JComboBox). Besides the related bug reports, I
> could not find any discussion on this topic. Is there anything I should
> know (like "Don't do it, others have tried and failed." or "Don't do it,
> it's already being worked on.") before I start?
>
> On a related note, I opened up the current JSpinner code and lots of
> warnings came on to me from my IDE. Are there any code conventions I
> should adhere to? I found these:
> http://www.oracle.com/technetwork/java/codeconvtoc-136057.html which are
> 14 (!!) years old and are missing quite a few things:
> - should we use generics with Comparable every time?
> - should we use @Override every time we can?
> - is the 80 characters per line limit still strictly enforced?
> - is there a common formatter for any IDE out there?
>
> These are the hottest problems I think should be fixed. Is it advisable
> to change these along the lines with current Java conventions (add
> @Override, generics to Comparables, join some broken lines that would
> take up 85 characters etc.)? If yes, should I do it in my main patch
> (that would add generics to JSpinner), or as a separate patch (or
> possibly even a separate issue)?
>
> Thank you,
> Petr Janecek
More information about the swing-dev
mailing list