error-prone icon indicating copy to clipboard operation
error-prone copied to clipboard

patching is broken With 2.43.0 for `UnnecessarilyFullyQualified`

Open Pankraz76 opened this issue 2 months ago • 4 comments

Reproducer:

  • https://github.com/Pankraz76/spotless/pull/7

Discovered by @delanym

  • https://github.com/google/error-prone/issues/5227#issuecomment-3435293868

Pankraz76 avatar Oct 23 '25 07:10 Pankraz76

Could you provide a minimal reproducible example using the Error Prone CLI (https://errorprone.info/docs/installation#command-line)?

cushon avatar Oct 23 '25 08:10 cushon

I think the issue is with one of the other patches. I add my patches like so -Dep-patch=DeadException,DefaultCharset,EffectivelyPrivate,MissingOverride,StringConcatToTextBlock,ThrowsUncheckedException,RemoveUnusedImports,UnnecessarilyFullyQualified,UnnecessarilyUsedValue,UnnecessarilyVisible,UnnecessaryAnonymousClass,UnnecessaryAssignment,UnnecessaryBoxedAssignment,UnnecessaryBoxedVariable,UnnecessaryFinal,UnnecessaryLambda,UnnecessaryMethodInvocationMatcher,UnnecessaryMethodReference,UnnecessaryOptionalGet,UnnecessaryParentheses,UnnecessarySetDefault,UnnecessaryTypeArgument,WildcardImport

Patches fail to apply.

-Dep-patch=UnnecessarilyFullyQualified,RemoveUnusedImports

Patches are applied.

I suspect a bug in one of the patches causes the whole lot to break and not apply. Being in the annotation processor the error is gobbled up instead of causing compilation to fail. @cushon can you confirm my idea?

delanym avatar Oct 23 '25 08:10 delanym

It's hard to say without a minimal self-contained repro.

cushon avatar Nov 06 '25 08:11 cushon

Sure that's one approach. But every project must have an expected behaviour. Do you expect a bug in a patch to fail silently and break the remaining patches? Is this scenario tested?

delanym avatar Nov 06 '25 08:11 delanym