gpt4 book ai didi

java - cobertura 解析错误(cobertura.javacss.parser.ParseException)

转载 作者:行者123 更新时间:2023-11-30 10:51:35 28 4
gpt4 key购买 nike

我对部署和代码覆盖问题还很陌生,现在我遇到了一个问题,我的应用程序使用 cobertura maven 插件 2.7 和 covertura 版本 2.1.1 和 java 8。我在 cobertura 报告中运行我的部署时遇到错误

[ERROR] net.sourceforge.cobertura.javancss.parser.ParseException: Encountered " ">" "> "" at line 45, column 36.
Was expecting one of:
"assert" ...
"boolean" ...
"byte" ...
"char" ...
"double" ...
"enum" ...
"false" ...
"float" ...
"int" ...
"long" ...
"new" ...
"null" ...
"short" ...
"super" ...
"this" ...
"true" ...
"void" ...
<INTEGER_LITERAL> ...
<FLOATING_POINT_LITERAL> ...
<CHARACTER_LITERAL> ...
<STRING_LITERAL> ...
<IDENTIFIER> ...
"(" ...
"!" ...
"~" ...
"++" ...
"--" ...
"+" ...
"-" ...

at net.sourceforge.cobertura.javancss.parser.JavaParser.generateParseException(JavaParser.java:10490)
at net.sourceforge.cobertura.javancss.parser.JavaParser.jj_consume_token(JavaParser.java:10366)
at net.sourceforge.cobertura.javancss.parser.JavaParser.UnaryExpression(JavaParser.java:3175)
at net.sourceforge.cobertura.javancss.parser.JavaParser.MultiplicativeExpression(JavaParser.java:3090)
at net.sourceforge.cobertura.javancss.parser.JavaParser.AdditiveExpression(JavaParser.java:3085)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ShiftExpression(JavaParser.java:3027)
at net.sourceforge.cobertura.javancss.parser.JavaParser.RelationalExpression(JavaParser.java:2990)
at net.sourceforge.cobertura.javancss.parser.JavaParser.InstanceOfExpression(JavaParser.java:2977)
at net.sourceforge.cobertura.javancss.parser.JavaParser.AssigmentExpression(JavaParser.java:2959)
at net.sourceforge.cobertura.javancss.parser.JavaParser.EqualityExpression(JavaParser.java:2886)
at net.sourceforge.cobertura.javancss.parser.JavaParser.AndExpression(JavaParser.java:2860)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ExclusiveOrExpression(JavaParser.java:2843)
at net.sourceforge.cobertura.javancss.parser.JavaParser.InclusiveOrExpression(JavaParser.java:2826)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ConditionalAndExpression(JavaParser.java:2808)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ConditionalOrExpression(JavaParser.java:2790)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ConditionalExpression(JavaParser.java:2774)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Expression(JavaParser.java:2718)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ArgumentList(JavaParser.java:3620)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Arguments(JavaParser.java:3610)
at net.sourceforge.cobertura.javancss.parser.JavaParser.PrimarySuffix(JavaParser.java:3511)
at net.sourceforge.cobertura.javancss.parser.JavaParser.PrimaryExpression(JavaParser.java:3384)
at net.sourceforge.cobertura.javancss.parser.JavaParser.PostfixExpression(JavaParser.java:3330)
at net.sourceforge.cobertura.javancss.parser.JavaParser.UnaryExpressionNotPlusMinus(JavaParser.java:3237)
at net.sourceforge.cobertura.javancss.parser.JavaParser.UnaryExpression(JavaParser.java:3171)
at net.sourceforge.cobertura.javancss.parser.JavaParser.MultiplicativeExpression(JavaParser.java:3090)
at net.sourceforge.cobertura.javancss.parser.JavaParser.AdditiveExpression(JavaParser.java:3061)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ShiftExpression(JavaParser.java:3027)
at net.sourceforge.cobertura.javancss.parser.JavaParser.RelationalExpression(JavaParser.java:2990)
at net.sourceforge.cobertura.javancss.parser.JavaParser.InstanceOfExpression(JavaParser.java:2977)
at net.sourceforge.cobertura.javancss.parser.JavaParser.AssigmentExpression(JavaParser.java:2959)
at net.sourceforge.cobertura.javancss.parser.JavaParser.EqualityExpression(JavaParser.java:2886)
at net.sourceforge.cobertura.javancss.parser.JavaParser.AndExpression(JavaParser.java:2860)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ExclusiveOrExpression(JavaParser.java:2843)
at net.sourceforge.cobertura.javancss.parser.JavaParser.InclusiveOrExpression(JavaParser.java:2826)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ConditionalAndExpression(JavaParser.java:2808)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ConditionalOrExpression(JavaParser.java:2790)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ConditionalExpression(JavaParser.java:2774)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Expression(JavaParser.java:2718)
at net.sourceforge.cobertura.javancss.parser.JavaParser.VariableInitializer(JavaParser.java:1744)
at net.sourceforge.cobertura.javancss.parser.JavaParser.VariableDeclarator(JavaParser.java:1672)
at net.sourceforge.cobertura.javancss.parser.JavaParser.LocalVariableDeclaration(JavaParser.java:4019)
at net.sourceforge.cobertura.javancss.parser.JavaParser.BlockStatement(JavaParser.java:3941)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Block(JavaParser.java:3934)
at net.sourceforge.cobertura.javancss.parser.JavaParser.MethodDeclaration(JavaParser.java:1987)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBodyDeclaration(JavaParser.java:1039)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBody(JavaParser.java:898)
at net.sourceforge.cobertura.javancss.parser.JavaParser.UnmodifiedClassDeclaration(JavaParser.java:824)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassDeclaration(JavaParser.java:728)
at net.sourceforge.cobertura.javancss.parser.JavaParser.TypeDeclaration(JavaParser.java:575)
at net.sourceforge.cobertura.javancss.parser.JavaParser.CompilationUnit(JavaParser.java:318)
at net.sourceforge.cobertura.javancss.parser.JavaParser.parse(JavaParser.java:100)
at net.sourceforge.cobertura.javancss.Javancss._measureSource(Javancss.java:192)
at net.sourceforge.cobertura.javancss.Javancss._measureRoot(Javancss.java:268)
at net.sourceforge.cobertura.javancss.Javancss.<init>(Javancss.java:347)
at net.sourceforge.cobertura.javancss.JavancssFactory.newInstance(JavancssFactory.java:40)
at net.sourceforge.cobertura.reporting.ComplexityCalculator.getFunctionMetricsForSingleFile(ComplexityCalculator.java:243)
at net.sourceforge.cobertura.reporting.ComplexityCalculator.getAccumlatedCCNForSingleFile(ComplexityCalculator.java:143)
at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForSourceFileNameInternal(ComplexityCalculator.java:273)
at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForPackageInternal(ComplexityCalculator.java:208)
at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForProject(ComplexityCalculator.java:174)
at net.sourceforge.cobertura.reporting.xml.XMLReport.<init>(XMLReport.java:70)
at net.sourceforge.cobertura.reporting.xml.XMLReportFormatStrategy.save(XMLReportFormatStrategy.java:18)
at net.sourceforge.cobertura.reporting.NativeReport.export(NativeReport.java:31)
at net.sourceforge.cobertura.reporting.CompositeReport.export(CompositeReport.java:19)
at net.sourceforge.cobertura.reporting.ReportMain.parseArgumentsAndReport(ReportMain.java:91)
at net.sourceforge.cobertura.reporting.ReportMain.generateReport(ReportMain.java:141)
at net.sourceforge.cobertura.reporting.ReportMain.main(ReportMain.java:151)
net.sourceforge.cobertura.javancss.parser.ParseException: Encountered " ">" "> "" at line 48, column 36.
`Was expecting one of:
"assert" ...
"boolean" ...
"byte" ...
"char" ...
"double" ...
"enum" ...
"false" ...
"float" ...
"int" ...
"long" ...
"new" ...
"null" ...
"short" ...
"super" ...
"this" ...
"true" ...
"void" ...
<INTEGER_LITERAL> ...
<FLOATING_POINT_LITERAL> ...
<CHARACTER_LITERAL> ...
<STRING_LITERAL> ...
<IDENTIFIER> ...
"(" ...
"!" ...
"~" ...
"++" ...
"--" ...
"+" ...
"-" ...

很高兴收到一些建议,因为这是应用程序的障碍,谢谢

最佳答案

javancss 无法处理某些 Java8 代码,您在解析时遇到错误。

最后一次提交是 2 年前,所以你必须尝试像 SonarCube 这样的替代方法

关于java - cobertura 解析错误(cobertura.javacss.parser.ParseException),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34664152/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com