Skip to content

refactor: Use parser-backed annotation discovery across JuLC#36

Merged
satran004 merged 2 commits into
mainfrom
chore/parser_based_source_annotation
May 21, 2026
Merged

refactor: Use parser-backed annotation discovery across JuLC#36
satran004 merged 2 commits into
mainfrom
chore/parser_based_source_annotation

Conversation

@satran004

Copy link
Copy Markdown
Member

Summary

This PR replaces raw substring/regex-based source annotation detection with parser-backed Java AST inspection.

Key changes:

  • Adds JavaSourceIntrospector as the shared parser-based source classification utility.
  • Migrates Gradle, CLI, testkit, blueprint, playground, and compiler discovery paths to AST-backed annotation checks.
  • Fixes false positives where annotations mentioned in comments/Javadocs were treated as real annotations.
  • Adds consistent role-conflict detection for classes combining validator annotations with @OnchainLibrary.
  • Removes deprecated @Validator and @MintingPolicy annotations and migrates tests/docs/examples to current annotations.
  • Improves Gradle plugin generated resource wiring so bundled JuLC sources are produced in a task-owned generated resources directory and consumed through sourceSets.main.resources.

Why

The previous discovery logic used checks like source.contains("@OnchainLibrary") or regex matching. That caused false positives when annotation names appeared in comments or Javadocs, including cases where normal validator files were misclassified as nested on-chain libraries.

Parser-backed discovery keeps source classification aligned with the compiler’s actual view of Java annotations and avoids silent drift across Gradle, CLI, testkit, and playground paths.

Introduce JavaSourceIntrospector for AST-based validator, library, and test annotation discovery instead of raw substring/regex classification.

  Wire Gradle, CLI, testkit, blueprint, playground, and compiler paths through parser-backed source metadata, including role-conflict detection and explicit parse failure handling. Remove deprecated @validator and @MintingPolicy annotations, migrate fixtures/docs/examples to the current validator annotations, and expand tests for discovery, bundling, scanning, and generated resource wiring.
@satran004 satran004 changed the title chore: Use parser-backed annotation discovery across JuLC refactor: Use parser-backed annotation discovery across JuLC May 21, 2026
@satran004 satran004 merged commit 4768400 into main May 21, 2026
1 check passed
@satran004 satran004 deleted the chore/parser_based_source_annotation branch May 21, 2026 09:27
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