Skip to content

processing: split ProcessingContext into generic AnnotationProcessingContext base (#348) - #362

Merged
AndreasIgel merged 12 commits into
java-helpers:mainfrom
igel-devin-ai:devin/1792704022-annotation-context
Oct 22, 2026
Merged

AndreasIgel merged 12 commits into
java-helpers:mainfrom
igel-devin-ai:devin/1792704022-annotation-context

Conversation

@igel-devin-ai

@igel-devin-ai igel-devin-ai commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Implements #348 — second step of the codegen extraction tracked in #233.

What

  • New AnnotationProcessingContext base class in processing: wraps ProcessingEnvironment, Elements/Types helpers, logger and the performance tracker with domain-agnostic element/type operations.
  • ProcessingContext is renamed to BuilderProcessingContext and extends the base, keeping only builder state: configuration reader, builder scope resolver, generator registry, processing target, strict-mode reporting. (rename commit, history preserved)
  • The base constructor takes a ready-made PerformanceTracker (compiler-argument reading stays builder-side in a private static factory), so the base carries no builder vocabulary.
  • The package-visibility check moved to the base as isAccessibleFromGeneratedPackage(Element) — generic semantics ("can generated code call this member") implemented via a protected abstract getGeneratedPackageName() hook. BuilderProcessingContext supplies getBuilderPackageName(); isMemberAccessibleFromBuilderPackage remains as a delegating alias for its existing callers.

Signature migration

  • JavaLangAnalyser: all signatures now take AnnotationProcessingContext — it only ever used generic helpers (getTypeElement, getAllMembers, getElementValuesWithDefaults, isSameType, accessibility check).
  • JavaLangMapper/FieldAnnotationExtractor already take the narrower TypeMappingContext interface — unchanged.
  • BuilderDefinitionCreator and BuilderScopeResolver stay on BuilderProcessingContext: they use getConfiguration, getGeneratorRegistry and getBuilderPackageName.

Verification

Pure rename/extraction, no behavior change: all 528 processor tests pass, example/generated-example-builder output is byte-identical to before the change.

@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Oct 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@AndreasIgel
AndreasIgel merged commit 0841ee7 into java-helpers:main Oct 22, 2026
6 checks passed
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.

3 participants