Skip to content

chore: drop JetBrains.Annotations dependency#76

Merged
ChrisonSimtian merged 1 commit into
mainfrom
chore/remove-jetbrains-annotations
May 21, 2026
Merged

chore: drop JetBrains.Annotations dependency#76
ChrisonSimtian merged 1 commit into
mainfrom
chore/remove-jetbrains-annotations

Conversation

@ChrisonSimtian

Copy link
Copy Markdown
Collaborator

Summary

Wholesale removal of JetBrains.Annotations. Every attribute it provided is gone from source and from generated tool wrappers. No runtime semantics change — these were all ReSharper/Rider hints.

399 files changed. Big diff but it's mechanical: anchored-regex sed across src/, tests/, build/, plus generator updates + regenerated tool wrappers.

Removed attributes (count, non-generated source)

Attribute Count
[PublicAPI] ~1,450
[CanBeNull] ~350
[Pure] ~150
[UsedImplicitly] ~65
[ContractAnnotation] ~25
[NotNull] 13
[BaseTypeRequired] 4
[MeansImplicitUse] 2
[InstantHandle], [AssertionMethod], [AssertionCondition], [CodeTemplate], [RegexPattern], [ItemNotNull], [ItemCanBeNull] handful each

Generator + tool wrappers

The code generator emitted [PublicAPI] and [Pure] into Generated.cs. Updated:

  • Generators/{DataClassExtensionGenerator,DataClassGenerator,EnumerationGenerator,TaskGenerator}.cs no longer emit [PublicAPI]
  • Generators/DataClassExtensionGenerator.cs no longer emits [Pure] on setter methods
  • Generators/ToolGenerator.cs dropped "JetBrains.Annotations" from the using-statement list

Regenerated all 62 tool wrappers. Every *.Generated.cs is JetBrains-free.

Package + project surgery

  • Directory.Packages.props: PackageVersion entry removed
  • Directory.Build.props: dropped the JETBRAINS_ANNOTATIONS DefineConstant (no #if ever referenced it)
  • Fallout.Utilities.csproj: removed the only direct PackageReference
  • Fallout.SourceGenerators.csproj: removed both $(PkgJetBrains_Annotations) references (the source generator was bundling the DLL so its emitted code could reference [PublicAPI] etc.)
  • Build.Licenses.cs: removed the JetBrains.Annotations LICENSE.md entry

Reflection-based runtime use

Only one site: tests/Fallout.Common.Tests/CITest.cs was using GetCustomAttribute<CanBeNullAttribute>() at runtime to decide whether a property was allowed to be null. Replaced with a type-shape check (reference types and Nullable<T> allow null; plain value types must be non-null).

NOT in this PR (flagged for separate decision)

JetBrains.ReSharper.GlobalTools — the InspectCode CLI tool — is still in build/_build.csproj as a PackageDownload. It powers IReportIssues/IReportDuplicates for this repo's own static analysis, and there's a Fallout.Common.Tools.ReSharper wrapper for consumers. Different concern (a CLI binary, not a library annotation). Decision tracked in #75.

Verification

  • dotnet build fallout.slnx -c Debug: 0 errors, 15 pre-existing warnings
  • dotnet test fallout.slnx: 408 passed, 7 skipped, 0 failed
  • grep "using JetBrains" src/ tests/ build/: 0 matches
  • grep JetBrains.Annotations in csproj/props: 0 matches

🤖 Generated with Claude Code

Wholesale removal of the JetBrains.Annotations package and every
attribute it provided. ReSharper/Rider hints are gone; nothing
runtime-semantic changes.

## Removed attributes (count, scope: non-generated source)

  [PublicAPI]              ~1450
  [CanBeNull]              ~350
  [Pure]                   ~150
  [UsedImplicitly]         ~65
  [ContractAnnotation]     ~25
  [InstantHandle]          (handful)
  [NotNull]                13
  [MeansImplicitUse]       2
  [BaseTypeRequired]       4
  [AssertionMethod]
  [AssertionCondition]
  [CodeTemplate]
  [RegexPattern]
  [ItemNotNull] / [ItemCanBeNull]

Mass-removed via anchored regex sed across src/, tests/, build/
(excluding *.Generated.cs which are regenerated below).

## Generator + tool wrappers

- Fallout.Tooling.Generator/Generators/*.cs: stopped emitting
  [PublicAPI] (on data class extensions, data classes, enumerations,
  tasks) and [Pure] (on setter methods).
- Fallout.Tooling.Generator/Generators/ToolGenerator.cs: dropped
  "JetBrains.Annotations" from the using-statement list emitted at
  the top of each Generated.cs.
- Regenerated all 62 tool wrappers — every Generated.cs is now
  JetBrains-free.

## Package + project surgery

- Directory.Packages.props: PackageVersion entry removed.
- Directory.Build.props: dropped the JETBRAINS_ANNOTATIONS
  DefineConstant (nothing in the codebase #if'd on it anyway).
- Fallout.Utilities.csproj: removed the only direct PackageReference.
- Fallout.SourceGenerators.csproj: removed the two
  $(PkgJetBrains_Annotations) references (DLL was bundled into the
  generator output for the generated code's [PublicAPI] et al.).

## Test code touch-up

tests/Fallout.Common.Tests/CITest.cs reflected on [CanBeNull] at
runtime to decide whether a CI property was allowed to be null.
With the attribute gone, replaced with a simple type-shape check:
reference types and Nullable<T> values are allowed null, plain
value types must be non-null.

## Reflection-based runtime uses

CITest.cs above was the only such case. Confirmed by grep:
GetCustomAttribute<*Attribute>() doesn't pick up any other
JetBrains attr now that they're gone.

## What's NOT in this PR (intentionally flagged)

JetBrains.ReSharper.GlobalTools — the InspectCode CLI tool — is
still in build/_build.csproj as a PackageDownload, and the
Fallout.Common.Tools.ReSharper wrapper is still in the codebase.
Different concern (CLI tool, not library); kept so this PR doesn't
mix concerns. Filing a follow-up issue to decide whether to drop
InspectCode-based code analysis from this repo's own build, separately
from whether to ship the ReSharper.json tool wrapper at all.

## Verification

- dotnet build fallout.slnx -c Debug: 0 errors, 15 pre-existing warnings
- dotnet test fallout.slnx: 408 passed, 7 skipped, 0 failed
- grep "using JetBrains" src/ tests/ build/: 0 matches
- grep "JetBrains.Annotations" in *.csproj/*.props: 0 matches

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ChrisonSimtian
ChrisonSimtian merged commit ca6a897 into main May 21, 2026
1 check passed
@ChrisonSimtian
ChrisonSimtian deleted the chore/remove-jetbrains-annotations branch May 21, 2026 09:54
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