繁体   English   中英

没有处理器声明任何这些注释

[英]No processor claimed any of these annotations

从 java 8 升级到 java 11 并获得以下注释警告。请建议如何解决。

[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

javac linter 有许多非常不寻常的警告,您无法单独关闭它们。 这是其中之一。 我建议使用不同的 linter。

您无法关闭此特定警告,您只能关闭所有带有-processing标志为-Xlint注释处理器警告,例如。

-Xlint:all,-serial,-processing

在 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>

您可以通过在compiler.properties 中搜索“warn.proc”来查看所有将被禁用的警告。 您可以使用javac --help-lint查看所有 linter 选项。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM