Skip to content

fix(spin-java-module): detect cyclic module requires when resolving Java compiler dependencies - #172

Merged
deer merged 1 commit into
mainfrom
detect_cycles
Aug 1, 2026
Merged

fix(spin-java-module): detect cyclic module requires when resolving Java compiler dependencies#172
deer merged 1 commit into
mainfrom
detect_cycles

Conversation

@deer

@deer deer commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

AbstractCompile, AbstractJavaDependencyAnalysis, and CustomizationPlugin each had a long-standing TODO noting that a required module could turn out to require the module doing the requiring, forming a cycle that went undetected.

This adds a ModuleCycles.checkNotCyclic helper that throws IllegalStateException when a candidate JDKModuleDescriptor requires the module currently resolving its dependencies, and wires it into all three sites: the workspace-project match in JavaCompilerPlugin.resolveRequiredCompilerPlugin, and the two requires-clause matches (workspace project and external artifact) in CustomizationPlugin.getDependencies.

While making this change, the duplicated logic for locating a project's JavaCompilerPlugin by required module name (previously copy-pasted between AbstractCompile and AbstractJavaDependencyAnalysis) was consolidated into the new static JavaCompilerPlugin.resolveRequiredCompilerPlugin method, so the cycle check only needed to be added once for that lookup path.

@deer
deer merged commit 028936e into main Aug 1, 2026
1 check passed
@deer
deer deleted the detect_cycles branch August 1, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant