Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Contributions should pass existing unit tests.
  • Contributions should document public facing APIs.
  • Contributions should add new tests to demonstrate bug fixes or test new features.
    Java
  • All public classes and methods should have informative Javadoc comments.
    • Do not use @author tags.
  • Code Java code should be formatted according to Sun's conventions, with one exception:
    • Indent two spaces per level, not four.
  • JUnit is our test framework:
    • You must implement a class whose class name starts with Test.
  • Define methods within your class and tag them with the @Test annotation. Call JUnit's many assert methods to verify conditions; these methods will be executed when you run mvn test.
  • By default, do not let tests write any temporary files to /tmp. Instead, the tests should write to the location specified by the test.dir system property.
  • Place your class in the src/test/java/ tree.
  • You can run all the unit tests with the command mvn test, or you can run a specific unit test with the command mvn -Dtest=<class name, fully qualified or short name> test (for example mvn -Dtest=TestFoo test)

Code Style (Autoformatting)

For Java code we use Spotless to format the code to comply with Avro's code style conventions (see above). Automatic formatting relies on Avro's Eclipse JDT formatter definition. You can use the same definition to auto format from Eclipse or from IntelliJ configuring the Eclipse formatter plugin.

If you use maven code styles issues are checked at the compile phase. If your code breaks because of bad formatting, you can format it automatically by running the command:

Java
No Format
> mvn spotless:apply

Unit Tests

Please make sure that all unit tests succeed before constructing your patch and that no new compiler warnings are introduced by your patch. Each language has its own directory and test process.

Java
No Format
> cd avro-trunk/lang/java
> mvn clean test

...

Please also check the documentation.

Java
No Format
> mvn compile 
> mvn javadoc:aggregate
> firefox target/site/apidocs/index.html

...