Skip to content

Extension to generate NullMarked package-info#550

Open
edward3h wants to merge 6 commits into
casid:mainfrom
edward3h:feature/nullmarked
Open

Extension to generate NullMarked package-info#550
edward3h wants to merge 6 commits into
casid:mainfrom
edward3h:feature/nullmarked

Conversation

@edward3h
Copy link
Copy Markdown
Collaborator

To help with JSpecify support, #528
Adds a new extension, jte-nullmarked. When enabled, it will generate a package-info.java in each package of generated template code, with the @NullMarked annotation.

@edward3h
Copy link
Copy Markdown
Collaborator Author

The "Validate External Links" failure is because this change adds a new documentation page and links to it.

@edward3h edward3h linked an issue Apr 25, 2026 that may be closed by this pull request
@edward3h
Copy link
Copy Markdown
Collaborator Author

Also I messed up the commit history 👎🏻

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.17%. Comparing base (1694404) to head (5609ca7).

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #550   +/-   ##
=========================================
  Coverage     91.17%   91.17%           
  Complexity     1223     1223           
=========================================
  Files            76       76           
  Lines          3185     3185           
  Branches        489      489           
=========================================
  Hits           2904     2904           
  Misses          173      173           
  Partials        108      108           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@edward3h edward3h force-pushed the feature/nullmarked branch from 37049b9 to 4037b2f Compare April 25, 2026 21:25
Comment thread jte-nullmarked/pom.xml Outdated
<contentType>Html</contentType>
<extensions>
<extension>
<className>gg.jte.nullmarked.NullMarkedExtension</className>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be gg.jte.jspecify.NullMarkedExtension?

.collect(Collectors.toList());
}

private Path writePackageInfo(Path sourcesRoot, String packageName) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we annotate packages or rather the generated classes? What if you want to progressively upgrade to nullmarked? Should we have annotations on templates similar like annotations on parameters?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NullMarked is applied at class, package or module level. While a template is generated into a class, in practice it behaves as a single method. Therefore, a package is the right level. (Since we aren't supporting modules.)

So the question is, do we want a way to include or exclude by package?

If you want more progressive, add @NonNull or @Nullable to individual params.

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.

JSpecify null safety annotations on JTE generated classes

2 participants