Skip to content

ConstantNaming not applied #5277

@Pankraz76

Description

@Pankraz76

It seems that RedundantStringConversion somehow is one of the few one always to be applied, but non of the others root checks.

Others like UnusedMethod, UnusedVariable and many more does not get applied despite it, the log shoes a Did you mean message, considering its patchable.

I can also confirm that sometimes the plugin like methods and stuff apply a lot by patching, until it fails to patch giving not the considered fix upfront.

config:

import static java.lang.System.getenv

apply plugin: 'net.ltgt.errorprone'

dependencies {
	errorprone('com.google.errorprone:error_prone_core:2.42.0')
	errorprone('tech.picnic.error-prone-support:error-prone-contrib:0.25.0')
	constraints {
		errorprone('com.google.guava:guava') {
			version {
				require('33.4.8-jre')
			}
			because('Older versions use deprecated methods in sun.misc.Unsafe')
			// https://github.com/junit-team/junit-framework/pull/5039#discussion_r2414490581
		}
	}
}

tasks.withType(JavaCompile).configureEach {
	options.errorprone {
		disableAllChecks = true // consider removal to avoid error prone error´s, following convention over configuration.
		error('RedundantStringConversion')
		error('UnusedMethod')
		if (!getenv().containsKey('CI') && getenv('IN_PLACE')?.toBoolean()) {
			errorproneArgs.addAll(
					'-XepPatchLocation:IN_PLACE',
					'-XepPatchChecks:UnusedMethod'
					)
		}
	}
}
> Compilation failed; see the compiler output below.
  /Users/vincent.potucek/IdeaProjects/spring-boot/buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ExportedImageTar.java:273: warning: [UnusedVariable] The parameter 'tarFile' is never read.
                ManifestLayerArchiveFactory(Path tarFile, ImageArchiveManifest manifest) {
                                                 ^
      (see https://errorprone.info/bugpattern/UnusedVariable)
    Did you mean 'ManifestLayerArchiveFactory(ImageArchiveManifest manifest) {'?

Describe the bug

  • I have verified that the issue is reproducible against the latest version
    of the project.
  • I have searched through existing issues to verify that this issue is not
    already known.

Minimal Reproducible Example

Its just the same code but does not apply on junit.

If applicable and possible, please replace this section with the code that
triggered the isue.
Logs
Please replace this sentence with log output, if applicable.

Expected behavior

Setup

  • Operating system (e.g. MacOS Monterey).
  • Java version (i.e. java --version, e.g. 17.0.16).
  • Error Prone version (e.g. 2.41.0).
  • Error Prone Support version (e.g. 0.24.0).

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions