How to contribute to the godot-java project.
| Tool | Version | Purpose |
|---|---|---|
| JDK | 25+ | Panama FFI |
| Maven | 4.0.x | Build system |
| C++ Compiler | C++17 | Native library |
| Git | 2.x | Version control |
- IDE: IntelliJ IDEA (best Java 25 + Panama support)
- Godot: 4.6+ (for integration testing)
git clone --recursive https://github.com/youngledo/godot-java.git
cd godot-java
# Compile Java code
cd godot-java-core
mvn compile -Dcheckstyle.skip=true
# Compile native library (macOS example)
cd native
bash build-macos.sh- Style: Sun Checks (enforced by Maven checkstyle plugin)
- Config:
sun_checks.xml(set in parent POM) - Indentation: 4 spaces (no tabs)
- Comments: English only
- Naming:
- Methods:
camelCase(e.g.,takeDamage,getPosition) - Classes:
PascalCase(e.g.,Bridge,Node2D) - Constants:
UPPER_SNAKE_CASE(e.g.,METHOD_HASHES) - Packages: all lowercase (e.g.,
org.godot.bridge)
- Methods:
Run checkstyle locally:
mvn checkstyle:checkSkip checkstyle during development:
mvn compile -Dcheckstyle.skip=true- Indentation: 4 spaces
- Naming:
snake_case(e.g.,godot_java_init) - Log prefix:
godot-java:
Follow Conventional Commits:
<type>: <description>
| Type | Description | Example |
|---|---|---|
feat: |
New feature | feat: add Node3D wrapper class |
fix: |
Bug fix | fix: correct Variant type conversion for floats |
docs: |
Documentation | docs: add architecture overview |
refactor: |
Code restructuring | refactor: extract method bind caching logic |
test: |
Tests | test: add Variant unit tests |
chore: |
Build/tooling | chore: update Maven dependencies |
perf: |
Performance | perf: cache MethodHandle lookups |
- Use English for descriptions.
- Use present tense ("add" not "added").
- Lowercase first letter, no trailing period.
-
Fork the repository on GitHub.
-
Create a branch:
git checkout -b feat/add-sprite3d-wrapper
-
Develop and commit:
# Write code... git add src/main/java/org/godot/node/Sprite3D.java git commit -m "feat: add Sprite3D wrapper class"
-
Verify CI passes locally:
mvn compile mvn test mvn checkstyle:check -
Push and create a PR:
git push origin feat/add-sprite3d-wrapper
Create a Pull Request on GitHub describing the change and motivation.
-
Code review: A maintainer will review and may request changes.
## Summary
Brief description of the change.
## Motivation
Why this change is needed.
## Testing
- [ ] New/updated unit tests
- [ ] Manual testing passed- Use JUnit 5.
- Tests go in
godot-java-core/src/test/java/. - Integration tests that require a running Godot instance should use
Assumptions.assumeTrue(isGodotInitialized())to skip gracefully in non-Godot environments.
# All tests
mvn test
# Single test class
mvn test -Dtest=VariantTest
# Skip tests
mvn clean install -DskipTestsimport org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class VariantTest {
@Test
void shouldCreateIntVariant() {
Variant v = Variant.fromInt(42L);
assertEquals(42L, v.asLong());
}
}To add a new Godot type wrapper:
-
Create a class in the appropriate package (e.g.,
org.godot.nodefor node types,org.godot.mathfor math types). -
Include a
METHOD_HASHESstatic map with method hashes frommethod_hashes.txt:private static final Map<String, Long> METHOD_HASHES = Map.of( "set_position", 743155724L, "get_position", 3341600327L );
-
Include a
GODOT_CLASS_NAMEconstant:private static final String GODOT_CLASS_NAME = "Node2D";
-
Override
getGodotClassName()to return the Godot class name. -
Write tests.
The godot-java-code-generator module reads extension_api.json and generates wrapper classes. It is currently active and runs during the generate-sources phase.
Generated sources go to godot-java-core/target/src-gen/main/java/ and are added to the compile path automatically.
To skip code generation, set <skip>true</skip> in the exec-maven-plugin configuration within godot-java-core/pom.xml.