Differences between revisions 19 and 20
Revision 19 as of 2012-06-14 15:20:13
Size: 6082
Editor: dslb-092-078-242-053
Revision 20 as of 2012-09-05 12:57:44
Size: 6174
Editor: p5DDC5337
Deletions are marked like this. Additions are marked like this.
Line 54: Line 54:
 * Code should be formatted according to [[http://incubator.apache.org/hama/hama-eclipse-formatter.xml|hama-code-formatter]]  * Code should be formatted according to [[http://hama.apache.org/hama-eclipse-formatter.xml|hama-code-formatter]] [[http://people.apache.org/~tjungblut/downloads/hama-formatter.xml|hama-code-formatter fallbacklink]]

How to Contribute To Hama

Getting the source code

First of all, you need the Hama source code. The official location for Hama is the Apache SVN repository; Git is also supported, and useful if you want to make lots of local changes -and keep those changes under some form or private or public revision control.

SVN access

Get the source code on your local drive using SVN. Most development is done on the TRUNK:

svn checkout https://svn.apache.org/repos/asf/hama/trunk hama-trunk

Git access

* git://git.apache.org/hama.git HTTP, github

Eclipse Project File Generation

We are using Maven so you can easily generate project files for our modules.

First you should make sure you have set up your workspace correctly with maven:

mvn -Declipse.workspace="/home/user/workspace/" eclipse:configure-workspace

Note: "/home/user/workspace/" should be the path to your workspace.

You can check if it was successful in Eclipse via:

Select Window > Preferences
Select Java > Build Path > Classpath Variables

If you see the M2_REPO variable, it worked correctly.

Now run the following commands:

mvn install
mvn eclipse:eclipse

You can now import the projects into your eclipse workspace via:

File -> Import -> Existing Projects into Workspace -> Choose your workspace as the root directory and import the hama-* projects.

Making Changes

Before you start, send a message to the Hama developer mailing list, or file a bug report in Jira. Describe your proposed changes and check that they fit in with what others are doing and have planned for the project. Be patient, it may take folks a while to understand your requirements.

  • Jira usage guidelines

Modify the source code and add some (very) nice features using your favorite IDE.

But take care about the following points

  • All public classes and methods should have informative Javadoc comments.
  • Code should be formatted according to hama-code-formatter hama-code-formatter fallbacklink

  • Contributions should pass existing unit tests.
  • New unit tests should be provided to demonstrate bugs and fixes.
  • Please resolve all warnings according to "Eclipse Warning Levels" below

Generating a patch

Please make sure that all unit tests succeed before constructing your patch and that no new javac compiler warnings are introduced by your patch.

> cd hama-trunk
> mvn install
> mvn --projects core,examples install

# build website
> mvn site

After a while, if you see


all is OK.

Creating a patch

Check to see what files you have modified with:

svn stat

Add any new files with:

svn add src/.../MyNewClass.java

In order to create a patch, type (from the root directory of hama):

svn diff > HAMA-321.patch

This will report all modifications done on Hama sources on your local disk and save them into the HAMA-321.patch file. Read the patch file. Make sure it includes ONLY the modifications required to fix a single issue.

Stay involved

Contributors should join the Hama mailing lists. In particular, the commit list (to see changes as they are made), the dev list (to join discussions of changes) and the user list (to help others).

Coding convention

  • Variables should be meaningful so that they are easily understood by other developers. For instance, the declaration of 'String serverName' would be better than 'String str'.
  • Indentation is 2 spaces, not 4.
  • Argument checks for NullPointerException, IlleagalArgumentException, etc.

Eclipse Warning Levels

We expect that you turn on following warnings in eclipse: (can be found in the project preferences or global preferences under Java/Compiler/"Errors/Warnings")

From top to bottom:

Non-static access to static member (WARNING)
Indirect access to static member (WARNING)
Method with a constructor name (WARNING)
Parameter assignment (WARNING)
Method can be static (WARNING) 

Serializable class without serialID (WARNING)
Assignment has no effect (WARNING)
finally does not complete normally (WARNING)
Using a char array in string concat (WARNING)
hidden catch block (WARNING)
Inexact type match for varags argument (WARNING)
Nullpointer access (WARNING)
Compare identical values (WARNING)
class overrides equals but not hashcode (WARNING)
dead code (WARNING)

Type parameter hides another type (WARNING)
Method does not override package visible method (WARNING)
interface method conflicts with protected object method (WARNING)

Deprecated API (WARNING) // can be neglected by using annotations if not other possible though 
Forbidden references (ERROR)
Discouraged references (WARNING)

Value of local variable is not used (WARNING) // please delete it if never read
Unused import (WARNING) // please format and organize imports before making a patch (in eclipse CTRL+SHIFT+F and CTRL+O)
Unused private member (WARNING) // remove if never used
Unnecessary cast or instanceof operation (WARNING)
Unused break or continue label (WARNING)

Unchecked generic type operation (WARNING)
Usage of raw types (WARNING) // sometimes can not be avoided, can be neglected via annotation
Generic type parameter declared with a final type bound (WARNING)

Missing override annotation (WARNING)
Annotation is used as super interface (WARNING)
Unhandled token in SuppressWarnings (WARNING)

See also

HowToContribute (last edited 2015-10-18 23:54:19 by edwardyoon)