Instruction file imported from vepo/jcode (
.cursor/rules/jcode-java.mdc). Copyright stays with the author.
Java conventions
Import order
java.*/javax.*- Third-party (JavaFX, RichTextFX, Jackson, SLF4J)
io.vepo.jcode.*
Style
- Type names: PascalCase classes, records, enums.
- Prefer
varwhen the RHS type is clear. Keep explicit types on fields and public API signatures.
Logging
- SLF4J only — never
System.out. - One static logger per class:
LoggerFactory.getLogger(MyClass.class). - Parameterized messages; pass exception as last arg on
error. - Do not log file contents or user paths at INFO in production hot paths.
JavaFX
- Do not block the JavaFX Application Thread on file I/O or heavy computation.
- UI updates from background threads must use
Platform.runLater(). - FXML is not used — build UI in Java code following existing controls.
Exceptions
- Prefer specific exceptions with context in the message.
- Catch at service or controller boundary; log and surface user-friendly feedback in UI when appropriate.