Adopt compile-time Lombok for shared and host boilerplate

This commit is contained in:
2026-11-14 07:34:13 +01:00
parent 83b9e4013d
commit 61a72b5cfb
18 changed files with 116 additions and 50 deletions
+2
View File
@@ -7,3 +7,5 @@ This is an independent repository. Confirm its Git root before staging or commit
Run `python3 scripts/check-bootstrap.py` for the current repository foundation. As implementation appears, add relevant build/regression checks and document them in README. Treat POM-only success as foundation validation, not application or plugin qualification.
Keep Kit/IntelliJ dependencies out of application-facing contracts and the preview API. Run application code only in target workers. Establish Java bytecode baselines per module instead of inheriting the host runtime accidentally. Public APIs and release compatibility require evidence from real fixtures.
Prefer Lombok for mechanical accessors, constructors and logger declarations when it makes Java code clearer. Preserve API signatures, visibility, null handling, injection annotations and identity; keep validation, defensive copies, JavaFX property operations and lifecycle logic explicit. Retain records and concise interface adapters. Use focused annotations rather than adding equality/mutability or secret-bearing `toString` through `@Data`/`@Value`. Configure Lombok as compile-time-only with explicit Maven/Gradle annotation processing, preserving processor-module bootstrap rules and fixture contracts. Do not edit the vendored Kit patch merely for style.
+17
View File
@@ -32,6 +32,21 @@ On macOS `IDEA_HOME` points to the IDE application's `Contents` directory. The c
Maven is pinned to **3.9.11** (Wrapper **3.3.4**); the separate IntelliJ build uses **Gradle 9.1.0** and IntelliJ Platform Gradle Plugin **2.20.1**. Wrapper distributions have pinned checksums. Shared-module-only validation is `./mvnw -B -ntp clean verify`; it does not qualify IntelliJ packaging. Plugin output is under `designer-intellij/build/distributions/`.
## Java source conventions
Use focused Lombok annotations for mechanical constructors/accessors/logging,
as described in [AGENTS.md](AGENTS.md). Lombok **1.18.42** is compile-time-only:
Maven uses `provided` plus an explicit processor path; the IntelliJ Gradle build
uses `compileOnly` and `annotationProcessor` (also for tests). Keep these versions
aligned. `lombok.config` stops configuration inheritance outside this checkout.
The Model processor module retains `proc=none` for its own bootstrap; its compiler
tests explicitly exercise Lombok and Model generation together.
Records, interface adapters, JavaFX property methods and lifecycle operations
remain explicit where annotations would obscure their contracts. Vendored Kit
code is excluded from stylistic cleanup. Neither host nor target tooling needs
Lombok on its runtime classpath.
## Run the minimal hosts
For a bundled runtime and native standalone launcher, see [packaging and automated qualification](docs/standalone-distribution.md). The commands below remain development launchers.
@@ -59,6 +74,8 @@ These graphical checks require a macOS desktop session; other platforms are not
## Implementation references
- [Lombok adoption](docs/lombok-adoption.md): scope, API preservation and build/host validation.
- [Initial project contract](docs/initial-project-contract.md): module responsibilities, configuration, snapshots, runtimes, preview sessions and communication.
- [Repository bootstrap plan](docs/repository-bootstrap-plan.md): ordered work packages and acceptance gates. Bootstrap work packages 1–7 are implemented; source-preserving projection is implemented and its [manual drag/resize gate](docs/manual-input-validation.md) passed in both hosts on the recorded baseline. Stage 3 now implements [target-runtime sessions, sizing and navigation](docs/target-runtime-sessions.md), with [manual passes and explicitly skipped remaining checks](docs/manual-runtime-navigation.md) recorded.
- [Decision provenance](docs/provenance.md): workspace planning and captured prototype evidence.
@@ -7,6 +7,8 @@ import java.nio.file.*;
import java.time.*;
import java.util.*;
import java.util.function.BooleanSupplier;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
/**
* Atomic private copies with persistent last-successful state and cross-process eviction leases.
@@ -234,19 +236,13 @@ public final class SnapshotStore {
sources.put(source, before);
}
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public final class Lease implements AutoCloseable {
private final Snapshot snapshot;
private final Path ticket;
private final FileChannel channel;
private final FileLock lock;
private Lease(Snapshot snapshot, Path ticket, FileChannel channel, FileLock lock) {
this.snapshot = snapshot;
this.ticket = ticket;
this.channel = channel;
this.lock = lock;
}
public Snapshot snapshot() {
return snapshot;
}
@@ -2,11 +2,13 @@ package de.neitzel.fxdesigner.generation;
import de.neitzel.fxdesigner.protocol.BindingMetadata;
import java.util.*;
import lombok.RequiredArgsConstructor;
/** Pure, deterministic form proposals. Target discovery validates the resulting document. */
public final class ViewGeneration {
private ViewGeneration() {}
@RequiredArgsConstructor
public enum Control {
TextField("text"),
Label("text"),
@@ -17,10 +19,6 @@ public final class ViewGeneration {
Table("");
private final String property;
Control(String property) {
this.property = property;
}
public String property() {
return property;
}
@@ -1,8 +1,10 @@
package de.neitzel.fxdesigner.workflow;
import java.util.concurrent.*;
import lombok.RequiredArgsConstructor;
/** One retained resource, one running operation and one replaceable pending operation. */
@RequiredArgsConstructor
public final class LatestSession<R extends AutoCloseable> implements AutoCloseable {
public interface Factory<R> {
R open() throws Exception;
@@ -25,10 +27,6 @@ public final class LatestSession<R extends AutoCloseable> implements AutoCloseab
this(value -> true);
}
public LatestSession(java.util.function.Predicate<R> healthy) {
this.healthy = healthy;
}
private Job<R, ?> pending;
private R resource;
private Object resourceKey;
@@ -1,7 +1,6 @@
package de.neitzel.fxdesigner.workflow;
import static de.neitzel.fxdesigner.protocol.WireProtocol.*;
import de.neitzel.fxdesigner.config.DesignerConfiguration;
import de.neitzel.fxdesigner.protocol.*;
import java.io.*;
@@ -11,10 +10,12 @@ import java.time.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.Consumer;
import lombok.RequiredArgsConstructor;
/**
* One target process, authenticated socket and reserved owner pipe. All blocking calls run off UI.
*/
@RequiredArgsConstructor
public final class PreviewWorker implements AutoCloseable {
private final DraftOverlay overlay;
private Process process;
@@ -23,10 +24,6 @@ public final class PreviewWorker implements AutoCloseable {
private ProtocolSession protocol;
private volatile boolean closed;
public PreviewWorker(DraftOverlay overlay) {
this.overlay = overlay;
}
public synchronized boolean healthy() {
return !closed && (process == null || process.isAlive());
}
+6
View File
@@ -14,6 +14,12 @@ java { sourceCompatibility = JavaVersion.VERSION_25; targetCompatibility = JavaV
tasks.withType<JavaCompile>().configureEach { options.release.set(25) }
val fxPlatform = if (System.getProperty("os.arch") == "aarch64") "mac-aarch64" else "mac"
dependencies {
// Keep aligned with the Maven parent's compile-time-only processor.
val lombok = "org.projectlombok:lombok:1.18.42"
compileOnly(lombok)
annotationProcessor(lombok)
testCompileOnly(lombok)
testAnnotationProcessor(lombok)
implementation("de.neitzel.fxdesigner:designer-kit-ui:0.1.0-SNAPSHOT")
intellijPlatform {
local(providers.gradleProperty("ideaHome").orElse(providers.environmentVariable("IDEA_HOME")))
@@ -10,9 +10,11 @@ import de.neitzel.fxdesigner.host.HostServices.*;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Consumer;
import lombok.RequiredArgsConstructor;
/** Current published evidence only; annotators never build or execute target application code. */
@Service(Service.Level.PROJECT)
@RequiredArgsConstructor
public final class DiagnosticAnnotations {
record Publication(
String owner,
@@ -25,10 +27,6 @@ public final class DiagnosticAnnotations {
private final Map<String, Publication> owners = new ConcurrentHashMap<>();
private final Project project;
public DiagnosticAnnotations(Project project) {
this.project = project;
}
static DiagnosticAnnotations get(Project project) {
return project.getService(DiagnosticAnnotations.class);
}
@@ -9,25 +9,20 @@ import de.neitzel.fxdesigner.contracts.DocumentSnapshot;
import de.neitzel.fxdesigner.host.HostServices;
import java.nio.file.Path;
import java.util.*;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/** Publishes only current FXML evidence to the IDE's existing Problems collector. */
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
final class IntellijDiagnostics
implements HostServices.Diagnostics, ProblemsProvider, AutoCloseable {
@Getter(onMethod_ = @Override)
private final Project project;
private final HostServices.Diagnostics output;
private final Map<String, List<Problem>> owned = new HashMap<>(); // EDT only
private volatile boolean closed;
IntellijDiagnostics(Project project, HostServices.Diagnostics output) {
this.project = project;
this.output = output;
}
@Override
public Project getProject() {
return project;
}
@Override
public void report(HostServices.Diagnostic d) {
output.report(d);
@@ -17,6 +17,8 @@ import java.nio.file.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicLong;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
/**
* Adapts actual IntelliJ Documents and native commands/history; never creates a competing undo
@@ -209,15 +211,12 @@ public final class IntellijDocuments implements HostServices.Documents, AutoClos
FileDocumentManager.getInstance().isDocumentUnsaved(s.document));
}
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
private final class Handle implements DocumentSession {
private final State s;
private boolean released;
private Editor editor;
Handle(State s) {
this.s = s;
}
private <T> CompletionStage<T> run(Callable<T> action) {
return edt(
() -> {
+1 -1
View File
@@ -7,7 +7,7 @@
<dependency><groupId>de.neitzel.fxdesigner</groupId><artifactId>designer-contracts</artifactId><version>${project.version}</version></dependency>
<dependency><groupId>org.junit.jupiter</groupId><artifactId>junit-jupiter</artifactId><scope>test</scope></dependency>
<dependency><groupId>de.neitzel.lib</groupId><artifactId>fx</artifactId><version>1.0-SNAPSHOT</version><scope>test</scope></dependency>
<dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.42</version><scope>test</scope></dependency>
<dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>${lombok.version}</version><scope>test</scope></dependency>
</dependencies>
<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><proc>none</proc></configuration></plugin></plugins></build>
</project>
@@ -6,6 +6,8 @@ import java.net.URI;
import java.nio.file.*;
import java.util.*;
import java.util.concurrent.*;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
/**
* Standalone draft store with shared per-file history; all IO/history operations are serialized off
@@ -115,14 +117,11 @@ public final class FileDocuments implements HostServices.Documents, AutoCloseabl
s.file.toUri(), s.revision, s.text, Files.isWritable(s.file), !s.text.equals(s.saved));
}
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
private final class Handle implements DocumentSession {
private final State s;
private volatile boolean closed;
Handle(State s) {
this.s = s;
}
private <T> CompletionStage<T> run(Callable<T> action) {
return submit(
() -> {
@@ -1,16 +1,19 @@
package de.neitzel.fxdesigner.target;
import de.neitzel.fxdesigner.protocol.BindingMetadata;
import de.neitzel.fxdesigner.protocol.BindingMetadata.*;
import de.neitzel.fxdesigner.protocol.BindingMetadata;
import java.beans.*;
import java.io.*;
import java.lang.reflect.*;
import java.util.*;
import javafx.beans.property.Property;
import javafx.beans.value.ObservableValue;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import org.w3c.dom.*;
/** Generated-first, non-initializing discovery with shared compiled-signature fallback. */
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public final class BindingDiscovery {
private static final String FX = "http://javafx.com/fxml/1";
private final ClassLoader loader;
@@ -29,10 +32,6 @@ public final class BindingDiscovery {
private RepeatDiscovery repeats;
private final Map<String, TargetType> targetTypes = new HashMap<>();
private BindingDiscovery(ClassLoader loader) {
this.loader = loader;
}
public static BindingMetadata inspect(
String fxml, String path, String direction, ClassLoader loader) throws Exception {
if (!Set.of("view", "model", "both").contains(direction))
+55
View File
@@ -0,0 +1,55 @@
# Lombok adoption — 2026-11-14
Lombok is now a Java coding preference in the workspace and in both projects'
`AGENTS.md` files. The refactor preserves existing contracts rather than making
Models into value objects.
## Scope
NeitzelLib uses focused accessors for binding declarations, Model JavaBeans,
scanner results, messages and account settings; constructor annotations replace
assignment-only constructors in core, FX, Gson and the reference application.
The ViewModel logger uses `@Slf4j`. Constructor injection remains annotated.
Existing equality, masked account output, null/default behavior and JavaFX
property operations remain unchanged. ResultSet forwarding stays explicit;
experimental delegation was not introduced.
The Designer uses constructor annotations in worker/session, snapshot lease,
discovery and host document/diagnostic adapters. It retains records, concise
interface adapters and constructors that validate, acquire resources or install
listeners. The vendored Kit patch is unchanged.
Both checkouts stop external Lombok configuration inheritance. Maven and Gradle
explicitly select Lombok 1.18.42 as a processor and compile-time dependency. The
Model processor's own `proc=none` bootstrap remains intact. The example's normal
build now enables Lombok; its optional Designer profile selects both processors.
NeitzelLib expands Lombok into `target/delombok` for Javadoc, without compiling
those expanded files. This preserves generated accessors in the published API
documentation and supports generated constructors carrying `@Inject`.
## Validation
- NeitzelLib default reactor: 130 tests, no failures/errors/skips.
- NeitzelLib clean `designer-preview` reactor: 132 tests, no failures/errors/skips.
- Generated Person metadata contains all eight properties, with generated
reader/writer names and collection element types.
- Compiled member signatures/descriptors, including constructor visibility,
match the pre-refactor baseline across 84 affected classes (including nested
classes). Only the private logger name is excluded from the comparison.
- Generated getter/setter Javadoc and injected constructor annotations checked.
- Designer Maven: 148 tests; IntelliJ Gradle: 12 tests; no failures/errors/skips.
- Full `scripts/check-bootstrap.py`: bytecode baselines, target fixture matrix,
Build and Refresh, both host document adapters, native shared Kit in classpath
and module-path configurations, worker lifecycle/abrupt owner death, plugin
packaging and documentation checks pass.
- Packaged standalone host with the changed real `fx-example`: metadata, source
history/save, Component navigation and all five independent interactive samples
pass; workers exit with the host.
- Plugin ZIP inspected: Lombok is absent. Packaging checks now reject it in
both the IntelliJ plugin and standalone runtime dependencies.
The Designer's pinned NeitzelLib runtime artifacts are not replaced by this
source cleanup. The real example qualification builds a disposable copy of the
changed library, so it can exercise the new library and Designer together while
keeping that recorded baseline intact.
+2
View File
@@ -0,0 +1,2 @@
# Keep generated APIs independent of workstation-level configuration.
config.stopBubbling = true
+5 -1
View File
@@ -18,6 +18,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.test.failure.ignore>false</maven.test.failure.ignore>
<lombok.version>1.18.42</lombok.version>
</properties>
<scm>
<connection>scm:git:ssh://git@gitea.neitzel.de:2222/konrad/NeitzelFXDesigner.git</connection>
@@ -28,9 +29,12 @@
<dependencyManagement><dependencies>
<dependency><groupId>org.junit.jupiter</groupId><artifactId>junit-jupiter</artifactId><version>5.12.2</version><scope>test</scope></dependency>
</dependencies></dependencyManagement>
<dependencies>
<dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>${lombok.version}</version><scope>provided</scope></dependency>
</dependencies>
<build>
<pluginManagement><plugins>
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.14.1</version><configuration><release>${module.java.release}</release></configuration></plugin>
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.14.1</version><configuration><release>${module.java.release}</release><annotationProcessorPaths><path><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>${lombok.version}</version></path></annotationProcessorPaths></configuration></plugin>
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><version>3.5.4</version><configuration><testFailureIgnore>false</testFailureIgnore></configuration></plugin>
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-resources-plugin</artifactId><version>3.3.1</version></plugin>
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-jar-plugin</artifactId><version>3.4.2</version></plugin>
+1
View File
@@ -45,6 +45,7 @@ run([ROOT / "designer-intellij" / ("gradlew.bat" if os.name == "nt" else "gradle
run([sys.executable, ROOT / "scripts/check-connected-workflow.py", "--idea-home", args.idea_home, "--target-java-home", args.target_java_home])
with zipfile.ZipFile(next((ROOT / "designer-intellij/build/distributions").glob("*.zip"))) as plugin:
names = plugin.namelist()
assert not any("lombok" in n.lower() for n in names), "Compile-time Lombok bundled in IDE plugin"
assert any("javafx-graphics-26-mac" in n for n in names), "Missing host JavaFX implementation"
assert not any("designer-target-tools" in n or "designer-preview-api" in n or "designer-model-processor" in n or "designer-maven-plugin" in n or "/fx-1.0" in n for n in names), "Target dependency in IDE host"
for document in [ROOT / "README.md", ROOT / "AGENTS.md", ROOT / "THIRD-PARTY-NOTICES.md", *sorted((ROOT / "docs").rglob("*.md"))]:
+1 -1
View File
@@ -25,7 +25,7 @@ with tempfile.TemporaryDirectory(prefix='designer-package-') as tmp:
deps=[Path(s) for s in (ROOT/'designer-standalone/target/package-classpath.txt').read_text().strip().split(os.pathsep)]
paths += sorted(deps,key=lambda f:(0 if f.name.startswith('designer-kit-ui-') else 1,f.name))
for file in paths:
if file.name.endswith('-tests.jar') or any(s in file.name for s in ('junit','intellij','target-tools','preview-api')):
if file.name.endswith('-tests.jar') or any(s in file.name for s in ('junit','intellij','target-tools','preview-api','lombok')):
raise RuntimeError('Unexpected host dependency: '+str(file))
if (stage/file.name).exists(): raise RuntimeError('Duplicate artifact name: '+file.name)
shutil.copy2(file,stage/file.name)