Skip to content

Enhanced ruleset fails to find AST transform processor classes #795

@pshevche

Description

@pshevche

Description

The latest milestone of the Spock framework has added a couple of annotation-driven AST transforms that started causing CodeNarc warnings if an enhanced ruleset is used (see original issue). The issue does not seem to be Spock-related, as I was able to reproduce it in a standalone project that has a no-op annotation transform. We'd appreciate your input on what may be causing this issue and if there is any workaround we can apply apart from removing the enhanced ruleset.

How to reproduce

  1. Check out https://github.com/pshevche/spock-reproducers/tree/main/issue-2149_codenarc-enhanced-rules-ast-transform
  2. Run ./gradlew :lib:codenarcTest --rerun-tasks
  3. Observe that the output contains the following warning (Build Scan):
WARNING: Compilation error for non-default compiler phase (semantic analysis). Consider removing "enhanced" rules from your ruleset.
Compilation failed for [CustomCompilerPhaseSourceDecorator[SourceFile[/Users/pshevche/dev/spock-reproducers/issue-2149_codenarc-enhanced-rules-ast-transform/lib/src/test/groovy/org/example/SomeTest.groovy]]; phase=4 (semantic analysis)]; org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
None: Could not find class for Transformation Processor org.example.transform.DummyTransform declared by org.example.transform.ApplyDummyTransform

Analysis

I have stumbled upon this issue groovy/groovy-eclipse#270 in groovy-eclipse, where a similar issue was reported. I followed the recommendation from that issue and moved the transformation processor to a new module, but that did not help. The warning was still emitted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions