Skip to content

Commit

Permalink
Add contribution section
Browse files Browse the repository at this point in the history
  • Loading branch information
JooHyukKim authored and cowtowncoder committed Dec 18, 2023
1 parent 238a6a4 commit 3f738b7
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ functionality must be part of a major version release.
See [Jackson Releases on the wiki](https://github.com/FasterXML/jackson/wiki/Jackson-Releases)
for more information.

#### Coding Style

Jackson projects usually adhere to well-known conventional coding guides, but there still have
Jackson-specific coding conventions. Please refer to [Jackson Code Style](../../blob/master/contribution/jackson-java-coding-style-guide.md) for details.

#### Testing

Jackson's functionality is vast and is used widely, so automated testing for any changes is
Expand Down
50 changes: 50 additions & 0 deletions contribution/jackson-java-coding-style-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Jackson-Java Coding Style Guide

This document serves as the coding conventions for Java source code in the Jackson project. It's inspired by the Google
Java Style Guide.

## Table of Contents

1. [Source Formatting](#source-formatting)
1. [Indentation](#indentation)
2. [Import Statements](#import-statements)
1. [Wildcard Imports](#wildcard-imports)
2. [Ordering](#ordering)
2. [Naming Conventions](#naming-conventions)
1. [Field Naming](#field-naming)
2. [Method Naming](#method-naming)

## Source Formatting

### Indentation

- **Rule**: Use spaces instead of tabs.
- **Amount**: 4 spaces per indentation level.

### Import Statements

#### Wildcard Imports

- **Usage**: Wildcards are permissible.
- **Threshold**: Employ wildcards for 5 or more imports from the same package.
- **Exceptions**: For frequently used packages like `java.util`, `java.io`, and main Jackson packages (
e.g., `com.fasterxml.jackson.databind`), wildcards may be used for fewer imports.

#### Ordering

1. **JDK Imports**: Begin with standard Java (JDK) imports.
2. **Jackson Imports**: Follow with Jackson imports, starting from base types (annotations, core, databind), ordered
from foundational to higher-level.

## Naming Conventions

### Field Naming

- **Non-Public Fields**: Prefix non-public member fields with an underscore (e.g., `_fieldName`).

### Method Naming

- **Public Methods**: Adhere to standard Java naming conventions.
- **Internal Methods**: Prefix methods used within the class with an underscore.
- **Sub-Class Methods**: Optionally, use a leading underscore for methods intended for subclass use, but not for
external class calls.

0 comments on commit 3f738b7

Please sign in to comment.