Search code examples
javaspring-tool-suite

No processor claimed any of these annotations


Upgraded from java 8 to java 11 and getting below warnings for annotations.Please suggest how to resolve.

[WARNING] No processor claimed any of these annotations: 
/org.springframework.context.annotation.Primary,
/org.springframework.data.annotation.Id,
/org.springframework.context.annotation.ComponentScan,
/org.springframework.boot.autoconfigure.SpringBootApplication,
/org.springframework.boot.context.properties.ConfigurationProperties,
/org.springframework.data.mongodb.repository.Query,
/com.fasterxml.jackson.annotation.JsonInclude,
/javax.validation.constraints.NotNull,
/org.springframework.context.annotation.ImportResource,
/org.springframework.web.bind.annotation.DeleteMapping,
/org.springframework.web.bind.annotation.PostMapping

Solution

  • The javac linter has a number of warnings that are really off-the-wall, and you can't turn them off individually. This is one of them. I'd suggest using a different linter.

    You can't turn off this specific warning, you can only turn off all annotation processor warnings with the -processing flag to -Xlint, eg.

    -Xlint:all,-serial,-processing

    in Maven:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                    <showWarnings>true</showWarnings>
                    <compilerArgs>
                        <!-- We turn off:
                            - `serial` because we don't use Java serialization 
                              (and all it does is stupidly complain about the serialVersionUID)
                            - `processing` because it complains about every annotation
                        -->
                        <arg>-Xlint:all,-serial,-processing</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
    

    You can see all the warnings that will be disable by searching for "warn.proc" in compiler.properties. You can see all linter options with javac --help-lint.