chore: drop JetBrains.Annotations dependency#76
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
sedacrosssrc/,tests/,build/, plus generator updates + regenerated tool wrappers.Removed attributes (count, non-generated source)
[PublicAPI][CanBeNull][Pure][UsedImplicitly][ContractAnnotation][NotNull][BaseTypeRequired][MeansImplicitUse][InstantHandle],[AssertionMethod],[AssertionCondition],[CodeTemplate],[RegexPattern],[ItemNotNull],[ItemCanBeNull]Generator + tool wrappers
The code generator emitted
[PublicAPI]and[Pure]into Generated.cs. Updated:Generators/{DataClassExtensionGenerator,DataClassGenerator,EnumerationGenerator,TaskGenerator}.csno longer emit[PublicAPI]Generators/DataClassExtensionGenerator.csno longer emits[Pure]on setter methodsGenerators/ToolGenerator.csdropped"JetBrains.Annotations"from the using-statement listRegenerated all 62 tool wrappers. Every
*.Generated.csis JetBrains-free.Package + project surgery
Directory.Packages.props: PackageVersion entry removedDirectory.Build.props: dropped theJETBRAINS_ANNOTATIONSDefineConstant (no#ifever referenced it)Fallout.Utilities.csproj: removed the only direct PackageReferenceFallout.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 theJetBrains.AnnotationsLICENSE.md entryReflection-based runtime use
Only one site:
tests/Fallout.Common.Tests/CITest.cswas usingGetCustomAttribute<CanBeNullAttribute>()at runtime to decide whether a property was allowed to be null. Replaced with a type-shape check (reference types andNullable<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 inbuild/_build.csprojas aPackageDownload. It powersIReportIssues/IReportDuplicatesfor this repo's own static analysis, and there's aFallout.Common.Tools.ReSharperwrapper 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 warningsdotnet test fallout.slnx: 408 passed, 7 skipped, 0 failedgrep "using JetBrains" src/ tests/ build/: 0 matchesgrep JetBrains.Annotationsin csproj/props: 0 matches🤖 Generated with Claude Code