Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
Groovy
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<p>This page contains some coding conventions for the Groovy-Eclipse project. This is still a work in progress. If you feel there are some conventions that are missing from here, please raise a jira issue for it.</p> <p>We are only trying to coordinate some high level conventions that maintain the quality of the project across releases and when there are multiple developers. For anything that is not specified here, use your common sense. If you think that there is a major issue of concern, send a message to the eclipse-plugin-dev@groovy.codehaus.org mailing list.</p> <h2>Copying code from Eclipse and JDT</h2> <p>In general, we want to avoid copying code from JDT and Eclipse. Instead, the preferred way to extend or borrow Eclipse functionality is to use sub-classing and reflection. Where this approach is not possible or it is unwieldy, it may be reasonable to copy an entire file. Here are the guidelines for doing this:</p> <ul> <li>Add the copied file to the jdt_patch source folder in the plugin. (If this doesn't exist yet, then create it.)</li> <li>Change the package name by prefixing 'greclipse." to the package. Do not change the type name.</li> <li>First line of the file should describe where it comes from (fully qualified name, plugin, etc).</li> <li><strong>If</strong> there are visibility problems that mean you cannot change the package name, then leave the package as is and suffix the type name with PATCH. This should be a last resort.</li> <li>Surround all changes (apart from the package statement and imports) with "// GROOVY start" and "// GROOVY end"</li> <li>If suitable, add a textual description of why you are doing what you are doing after "// GROOVY start"</li> <li>If you have been <strong>really keen</strong> include the bugzilla entry raised against JDT related to the change you are making "prNNNNNN"</li> <li>Where you are replacing existing code with new code, use this format:</li> </ul> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="java" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6amF2YX0&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre>// GROOVY start: ...reason for the change.. pr131072 /*{ ...old code... }*/ ...new code... // GROOVY end </pre></td></tr></table> <p>This ensures comparisons and merges are easier because the old code will precisely match what is in the original file. If the old code includes /* */ comments just apply common sense and think what will be easiest to merge again later.</p> <p>In some cases, you may want to copy code from JDT as a starting point, but you have no intention of keeping the versions synchronized across Eclipse releases. This situation is fine, but you must keep the original EPL license at the top of the file.</p> <h2>Code formatting, templates, and code cleanups</h2> <p>The Groovy-Eclipse plugins use a set of pre-defined code formatting, templates, and code cleanups. They are set in each project. Also, copies of these preferences are included in the org.codehaus.groovy.eclipse.core project. When creating a new project, be sure to use these preferences.</p> <h2>Task tags in code</h2> <p>Do not use TODO tags. Instead use something like FIXADE (where instead of ADE, use your initials). And after the FIXADE tag, you can optionally include a version number that this change should be applied to (eg- // FIXADE (2.1.0) ). You may also want to add the tag as one that is recognized by the JDT compiler. Go to: Preferences -> Java Compiler -> Task Tags and add what you need.</p> <h2>Error handling</h2> <p>In general, unless there is a good reason not to, errors should be logged to the error log. To do this, in the catch clause, add the following code:</p> <p> GroovyCore.logException(String, Throwable)</p> <p>And when in the org.eclipse.jdt.groovy.core project, use this instead (or one of the variants of the method):</p> <p> org.eclipse.jdt.internal.core.util.Util.log(Throwable)</p> <h2>Jira</h2> <p>The version field of an issue should be the version of Groovy-Eclipse that the issue was raised against. If unknown, choose the most recently released version. If raised against the latest dev build, also choose the most recently released version.</p> <p>Only assign an issue to yourself if you intend to work on it in the near future. </p> <p>Mark the issue as "In Progress" once you are starting to write code.</p>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced