`
Rainbow702
  • 浏览: 1078146 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类

Cannot use the diamond generic notation when running in JDK inferior to 1.7 mode

阅读更多

今天在使用Sonar qube 检测代码的时候,报了一个错,错误信息为:

Cannot use the diamond generic notation when running in JDK inferior to 1.7 mode!

 

后在网上查了一下,是因为在sonar-project.properties 这份配置文件中,没有明确指定 JDK 版本的原因。所以,须像如下一样进行指定:

# setting the java class version
sonar.java.source=1.7

 然后就可以啦!

 

附: stack信息为:

09:02:47.184 INFO  - Sensor PmdSensor...
09:02:47.187 INFO  - Execute PMD 4.3...
09:02:47.226 INFO  - Java version: 1.5
09:02:47.271 INFO  - PMD configuration: D:\ppp\.sonar\pmd.xml
09:02:48.465 ERROR - Fail to execute PMD. Following file is ignored: D:\ppp\src\com\ppm\dao\implement\ParentInfo_DAL.java
net.sourceforge.pmd.ast.ParseException: Cannot use the diamond generic notation when running in JDK inferior to 1.7 mode!
        at net.sourceforge.pmd.ast.JavaParser.checkForBadDiamondUsage(JavaParser.java:75) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.TypeArguments(JavaParser.java:2017) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.ClassOrInterfaceType(JavaParser.java:1945) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.AllocationExpression(JavaParser.java:3875) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.PrimaryPrefix(JavaParser.java:3535) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.PrimaryExpression(JavaParser.java:3433) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.PostfixExpression(JavaParser.java:3337) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.UnaryExpressionNotPlusMinus(JavaParser.java:3237) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.UnaryExpression(JavaParser.java:3098) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.MultiplicativeExpression(JavaParser.java:2989) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.AdditiveExpression(JavaParser.java:2934) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.ShiftExpression(JavaParser.java:2881) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.RelationalExpression(JavaParser.java:2816) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.InstanceOfExpression(JavaParser.java:2779) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.EqualityExpression(JavaParser.java:2724) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.AndExpression(JavaParser.java:2683) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.ExclusiveOrExpression(JavaParser.java:2642) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.InclusiveOrExpression(JavaParser.java:2601) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.ConditionalAndExpression(JavaParser.java:2560) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.ConditionalOrExpression(JavaParser.java:2519) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.ConditionalExpression(JavaParser.java:2479) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.Expression(JavaParser.java:2340) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.VariableInitializer(JavaParser.java:1278) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.VariableDeclarator(JavaParser.java:1180) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.LocalVariableDeclaration(JavaParser.java:4269) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.BlockStatement(JavaParser.java:4198) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.Block(JavaParser.java:4162) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.Statement(JavaParser.java:4025) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.IfStatement(JavaParser.java:4517) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.Statement(JavaParser.java:4061) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.BlockStatement(JavaParser.java:4201) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.Block(JavaParser.java:4162) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.Statement(JavaParser.java:4025) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.IfStatement(JavaParser.java:4517) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.Statement(JavaParser.java:4061) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.BlockStatement(JavaParser.java:4201) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.Block(JavaParser.java:4162) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.Statement(JavaParser.java:4025) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.IfStatement(JavaParser.java:4522) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.Statement(JavaParser.java:4061) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.BlockStatement(JavaParser.java:4201) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.Block(JavaParser.java:4162) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.MethodDeclaration(JavaParser.java:1416) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.ClassOrInterfaceBodyDeclaration(JavaParser.java:1085) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.ClassOrInterfaceBody(JavaParser.java:1004) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.ClassOrInterfaceDeclaration(JavaParser.java:514) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.TypeDeclaration(JavaParser.java:406) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.ast.JavaParser.CompilationUnit(JavaParser.java:164) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.parsers.Java15Parser.parse(Java15Parser.java:24) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.PMD.processFile(PMD.java:98) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.PMD.processFile(PMD.java:75) ~[pmd-4.3.jar:na]
        at net.sourceforge.pmd.PMD.processFile(PMD.java:210) ~[pmd-4.3.jar:na]
        at org.sonar.plugins.pmd.PmdTemplate.process(PmdTemplate.java:71) ~[sonar-pmd-plugin-1.5.jar:na]
        at org.sonar.plugins.pmd.PmdExecutor.executeRules(PmdExecutor.java:100) [sonar-pmd-plugin-1.5.jar:na]
        at org.sonar.plugins.pmd.PmdExecutor.executePmd(PmdExecutor.java:75) [sonar-pmd-plugin-1.5.jar:na]
        at org.sonar.plugins.pmd.PmdExecutor.execute(PmdExecutor.java:61) [sonar-pmd-plugin-1.5.jar:na]
        at org.sonar.plugins.pmd.PmdSensor.analyse(PmdSensor.java:52) [sonar-pmd-plugin-1.5.jar:na]
        at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:72) [sonar-batch-4.1.1.jar:na]
        at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:114) [sonar-batch-4.1.1.jar:na]
        at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:150) [sonar-batch-4.1.1.jar:na]
        at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) [sonar-plugin-api-4.1.1.jar:na]
        at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) [sonar-plugin-api-4.1.1.jar:na]
        at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:211) [sonar-batch-4.1.1.jar:na]
        at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:206) [sonar-batch-4.1.1.jar:na]
        at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:199) [sonar-batch-4.1.1.jar:na]
        at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) [sonar-plugin-api-4.1.1.jar:na]
        at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) [sonar-plugin-api-4.1.1.jar:na]
        at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:58) [sonar-batch-4.1.1.jar:na]
        at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45) [sonar-batch-4.1.1.jar:na]
        at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:82) [sonar-batch-4.1.1.jar:na]
        at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) [sonar-plugin-api-4.1.1.jar:na]
        at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) [sonar-plugin-api-4.1.1.jar:na]
        at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:144) [sonar-batch-4.1.1.jar:na]
        at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:132) [sonar-batch-4.1.1.jar:na]
        at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) [sonar-plugin-api-4.1.1.jar:na]
        at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) [sonar-plugin-api-4.1.1.jar:na]
        at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92) [sonar-batch-4.1.1.jar:na]
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74) [sonar-batch-4.1.1.jar:na]
        at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:45) [sonar-runner-batch6119497299030140902.jar:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_13]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_13]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_13]
        at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_13]
        at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87) [sonar-runner-dist-2.3.jar:na]
        at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75) [sonar-runner-dist-2.3.jar:na]
        at java.security.AccessController.doPrivileged(Native Method) [na:1.7.0_13]
        at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) [sonar-runner-dist-2.3.jar:na]
        at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50) [sonar-runner-dist-2.3.jar:na]
        at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102) [sonar-runner-dist-2.3.jar:na]
        at org.sonar.runner.api.Runner.execute(Runner.java:90) [sonar-runner-dist-2.3.jar:na]
        at org.sonar.runner.Main.executeTask(Main.java:70) [sonar-runner-dist-2.3.jar:na]
        at org.sonar.runner.Main.execute(Main.java:59) [sonar-runner-dist-2.3.jar:na]
        at org.sonar.runner.Main.main(Main.java:41) [sonar-runner-dist-2.3.jar:na]

 

分享到:
评论

相关推荐

    bcprov-jdk15on-1.70.jar中文-英文对照文档.zip

    标题 "bcprov-jdk15on-1.70.jar中文-英文对照文档.zip" 提供的是一个关于Bouncy Castle库的中文-英文对照文档的压缩包,版本为1.70,适用于JDK 15及更高版本。Bouncy Castle是一个开源的Java加密库,提供了大量的...

    The Haskell Road to Logic, Maths and Programming. Second Edition(英文第二版)

    Long ago, when Alexander the Great asked the mathematician Menaechmus for a crash course in geometry, he got the famous reply ``There is no royal road to mathematics.’’ Where there was no shortcut ...

    Aspect.Oriented.Software.Development.with.Use.Cases [chm]

    Addison.Wesley.Aspect.Oriented.Software.Development.with.Use.Cases ...Modeling use-cases slices and aspects using the newest extensions to the UML notation Applying use cases and aspects in projects

    The N-way Toolbox for MATLAB ver. 3.10

    Instead of using the cell notation, it is possible to use the M-file FAC2LET (factors to letters) to extract components; e.g. [A,B,C] = fac2let(Factors); MISSING DATA For all algorithms the same ...

    Rigid Body Dynamics Algorithms Featherstone, Roy

    The use of spatial vector notation greatly reduces the volume of algebra which allows systems to be described using fewer equations and fewer quantities. It also allows problems to be solved in fewer...

    Common LISP A Gentle Introduction to Symbolic Computation

    such as the use of function boxes in the first two chapters to visually distinguish functions from data, use of evaltrace notation in later chapters to illustrate the operation of evaluation rules, ...

    PHP JSON出错:Cannot use object of type stdClass as array解决方法

    在PHP编程中,JSON(JavaScript Object Notation)是一种轻量级的数据交换格式,常用于前后端数据传输。...这不仅能避免出现“Cannot use object of type stdClass as array”的错误,还能提高你的代码质量和效率。

    The Unified Modeling Language Reference Manual, Second Edition

    Within the notation summary in Appendix B, magenta annotations on diagrams can be clicked to jump to the referenced articles. The Adobe Reader previous view arrow can be used to restore a previous ...

    Common LISP: A Gentle Introduction to Symbolic Computation 2013最新版

    such as the use of function boxes in the first two chapters to visually distinguish functions from data, use of evaltrace notation in later chapters to illustrate the operation of evaluation rules, ...

    MIBBrowser8.rar

    the Generic SNMP Trace window is particularly useful for debugging when developing an SNMP agent and for resolving problems when MIB Browser cannot properly query an SNMP agent. The enclosed MIB ...

    jdk-7u191 (windows和linux)

    Java Development Kit(JDK)是Java编程语言的核心组件,它包含了一组开发工具,使得开发者能够编写、编译、调试和运行Java应用程序。标题提到的"jdk-7u191"指的是JDK的第7个主要版本的第191次更新。此版本在发布时...

    数位板压力测试

    In the Windows environment, multiple applications that use the tablet may be running at once. Each ap-plication will require different services. Applications must be able to get the services they need...

    The.Fortran.2003.Handbook

    The history of Fortran dates back to the mid-1950s when it was developed at IBM. It was designed to simplify the process of writing mathematical and scientific computations. Before Fortran, ...

    【船级社】 ABS Guide for the Optional Class Notation Deep Water

    【船级社】 ABS Guide for the Optional Class Notation Deep Water Anchoring for Oil Tankers and Bulk Carriers (DWA) 2021-09.pdf

    GSN_Standard.pdf

    Secondly, it aims to provide clear guidance on current best practice in the use of the notation for those concerned with the development and evaluation of engineering arguments – argument owners, ...

    11g_plsql_user_guide_and_reference.pdf

    The `CONTINUE` statement has been added to PL/SQL, allowing developers to skip the rest of the current iteration in a loop and proceed to the next one. This can be particularly useful for implementing...

    Algorithms in C++, Parts 1-4: Fundamentals, Data Structures, Sorting, Searching

    4. **Big-Oh Notation**: Big-Oh notation is a mathematical notation used to describe the upper bound of an algorithm’s running time or space usage. It provides a way to express the worst-case scenario...

    Introduction_to_Optimum_Design.pdf

    - **Postoptimality Analysis:** Analyzes the sensitivity of the solution to changes in constraint limits and cost function scaling, providing insights into the robustness of the solution. ### Chapter ...

    CSharp 3.0 With the .NET Framework 3.5 Unleashed(english)

    - **Variables and Types**: This section explains the different data types available in C# and how to declare and use variables. ### 3. Writing C# Expressions and Statements - **C# Operators**: C# ...

Global site tag (gtag.js) - Google Analytics