New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParseException JavaNCSS got an error while parsing the java file #176

Open
mapo-job opened this Issue Jul 29, 2014 · 94 comments

Comments

Projects
None yet
@mapo-job

mapo-job commented Jul 29, 2014

In Cobertura 2.0.3, with gradle, parsing this code gives the below error.
private ArrayList<String[][]> dUpdates = new ArrayList<String[][]>();
(...)
for (String row[][] : dUpdates) { //<-- error here

:generateCoberturaReport
Cobertura 2.0.3 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
net.sourceforge.cobertura.javancss.parser.ParseException: Encountered " ":" ": "" at line 417, column 30.
Was expecting one of:
"[" ...
";" ...
"," ...
"=" ...

    at net.sourceforge.cobertura.javancss.parser.JavaParser.generateParseException(JavaParser.java:11869)
    at net.sourceforge.cobertura.javancss.parser.JavaParser.jj_consume_token(JavaParser.java:11730)
    at net.sourceforge.cobertura.javancss.parser.JavaParser.ForStatement(JavaParser.java:4292)
    at net.sourceforge.cobertura.javancss.parser.JavaParser.Statement(JavaParser.java:3735)
    at net.sourceforge.cobertura.javancss.parser.JavaParser.BlockStatement(JavaParser.java:3906)
    at net.sourceforge.cobertura.javancss.parser.JavaParser.Block(JavaParser.java:3855)
    at net.sourceforge.cobertura.javancss.parser.JavaParser.TryStatement(JavaParser.java:4534)
    at net.sourceforge.cobertura.javancss.parser.JavaParser.Statement(JavaParser.java:3754)
    at net.sourceforge.cobertura.javancss.parser.JavaParser.BlockStatement(JavaParser.java:3906)
    at net.sourceforge.cobertura.javancss.parser.JavaParser.Block(JavaParser.java:3855)
    at net.sourceforge.cobertura.javancss.parser.JavaParser.MethodDeclaration(JavaParser.java:1933)
    at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBodyDeclaration(JavaParser.java:1012)
    at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBody(JavaParser.java:874)
    at net.sourceforge.cobertura.javancss.parser.JavaParser.UnmodifiedClassDeclaration(JavaParser.java:801)
    at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassDeclaration(JavaParser.java:706)
    at net.sourceforge.cobertura.javancss.parser.JavaParser.TypeDeclaration(JavaParser.java:555)
    at net.sourceforge.cobertura.javancss.parser.JavaParser.CompilationUnit(JavaParser.java:303)
    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:346)
    at net.sourceforge.cobertura.reporting.ComplexityCalculator.getAccumlatedCCNForSource(ComplexityCalculator.java:105)
    at net.sourceforge.cobertura.reporting.ComplexityCalculator.getAccumlatedCCNForSingleFile(ComplexityCalculator.java:143)
    at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForSourceFileNameInternal(ComplexityCalculator.java:234)
    at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForPackageInternal(ComplexityCalculator.java:201)
    at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForProject(ComplexityCalculator.java:167)
    at net.sourceforge.cobertura.reporting.html.HTMLReport.generateTableRowForTotal(HTMLReport.java:603)
    at net.sourceforge.cobertura.reporting.html.HTMLReport.generateOverview(HTMLReport.java:287)
    at net.sourceforge.cobertura.reporting.html.HTMLReport.generateOverviews(HTMLReport.java:228)
    at net.sourceforge.cobertura.reporting.html.HTMLReport.<init>(HTMLReport.java:71)
    at net.sourceforge.cobertura.reporting.Main.parseArguments(Main.java:103)
    at net.sourceforge.cobertura.reporting.Main.main(Main.java:169)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSite.invoke(PojoMetaMethodSite.java:189)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
    at net.saliman.gradle.plugin.cobertura.CoberturaRunner.executeCobertura(CoberturaRunner.groovy:199)
    at net.saliman.gradle.plugin.cobertura.CoberturaRunner.this$2$executeCobertura(CoberturaRunner.groovy)
    at net.saliman.gradle.plugin.cobertura.CoberturaRunner$this$2$executeCobertura.callCurrent(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:153)
    at net.saliman.gradle.plugin.cobertura.CoberturaRunner.generateCoverageReport(CoberturaRunner.groovy:100)
    at net.saliman.gradle.plugin.cobertura.CoberturaRunner$generateCoverageReport.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
    at net.saliman.gradle.plugin.cobertura.GenerateReportTask.generateReports(GenerateReportTask.groovy:54)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:533)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:516)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:289)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:86)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
    at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
    at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
    at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
    at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:42)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execute(StartStopIfBuildAndStop.java:33)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:34)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:71)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:69)
    at org.gradle.util.Swapper.swap(Swapper.java:38)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:69)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:60)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:45)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator.runCommand(DaemonStateCoordinator.java:186)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:49)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:36)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.DaemonHygieneAction.execute(DaemonHygieneAction.java:39)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:32)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:51)
    at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.handleCommand(DefaultIncomingConnectionHandler.java:155)
    at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.receiveAndHandleCommand(DefaultIncomingConnectionHandler.java:128)
    at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.run(DefaultIncomingConnectionHandler.java:116)
    at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)

JavaNCSS got an error while parsing the java file C:(...)\SyncTaskData.java
ParseException in STDINronize.getTarget(ColumnMapping.SWITCH_CODE) != null)
Last useful checkpoint: "(...).SyncTaskData.update(Tuple,PreparedStatement,PreparedStatement,PreparedStatement)"
Encountered " ":" ": "" at line 417, column 30
Was expecting one of:
"[" ...
";" ...
"," ...
"=" ...

@jaredstehler

This comment has been minimized.

jaredstehler commented Mar 17, 2015

Also seeing this with a lambda construct:

[INFO] Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[INFO] Cobertura: Loaded information on 37 classes.
[WARN] JavaNCSS got an error while parsing the java file /dev/src/java/projects/.../src/main/java/com/.../MyTask.java
ParseException in STDIN
Last useful checkpoint: "com.MyTask.execute(PrintWriter,Multimap<String,String>,int)"
Encountered " ">" "> "" at line 115, column 22.
Was expecting one of:

code:

    List<ListenableFuture<ContentDiff>> pageFutures = pageWorkers.stream()
      .map((worker) -> executor.submit(worker))
      .collect(Collectors.toList());
@stevesaliman

This comment has been minimized.

stevesaliman commented Mar 24, 2015

I'm also seeing this with version 2.1.1 and Java 8. In my case, the offending line is

Set<String> uniqueTerms = changeList.stream().map(ChangeHistory::getChangeItem).collect(Collectors.toSet());

I don't think it is happy with the double colon in my map call.

@jvinding

This comment has been minimized.

jvinding commented Mar 25, 2015

dying on the :: in Point::getX

        final List<String> categories = series.getPoints().stream()
                                              .map(Point::getX)
                                              .distinct()
                                              .collect(Collectors.toList());
@nicktgr15

This comment has been minimized.

nicktgr15 commented Apr 23, 2015

I'm also having the same issue with double colon in Java 8 when running mvn cobertura:cobertura

@dennisa

This comment has been minimized.

dennisa commented Apr 28, 2015

When is the scheduled fix for this? I think this issue is related to: https://jira.codehaus.org/browse/JAVANCSS-62

@shakuzen

This comment has been minimized.

shakuzen commented Jun 19, 2015

I'm having this problem on all of my Java 8 projects that use cobertura. It fills up our build logs with false-positive errors. It would be nice to have this fixed, especially given the Java 8 adoption rate these days.

@maggmanu77

This comment has been minimized.

maggmanu77 commented Jun 19, 2015

Cant agree more. The usually silent builds are full of false positives whenever a lambda expression is met.

@JWGmeligMeyling

This comment has been minimized.

JWGmeligMeyling commented Jun 20, 2015

@shakuzen @maggmanu77 Why do you consider this a false positive? While coverage results are being generated I'm actually not so sure that we can completely ignore this error.

@maggmanu77

This comment has been minimized.

maggmanu77 commented Jun 24, 2015

simple example:
stream().collect(Collectors.toList(x -> x.value));

If you have a lambda expression with operator -> such as shown above, while executing step cobertura-maven-plugin:2.7:cobertura, we get
[WARN] JavaNCSS got an error while parsing the java file
Encountered " ">" "> "" at line
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> ...
...
"(" ...
"!" ...
"~" ...
"++" ...
"--" ...
"+" ...
"-" ...
which is an incorrect warning. The codebase I work with has thousands of lamda expressions and the log files are full of above false warnings.

@maggmanu77

This comment has been minimized.

maggmanu77 commented Jun 24, 2015

BTW, to get a silent execution via cobertura maven plugin, turn on the quite flag
Example

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>cobertura-maven-plugin</artifactId>
    <version>2.7</version>
    <configuration>
        <quiet>true</quiet>
        <formats>
            <format>xml</format>
        </formats>
        <instrumentation>
            <ignoreTrivial>true</ignoreTrivial>
        </instrumentation>
    </configuration>
    <executions>
        <execution>
            <phase>package</phase>
                <goals>
                    <goal>cobertura</goal>
                </goals>
        </execution>
    </executions>
</plugin>
@jayenhc

This comment has been minimized.

jayenhc commented Jun 25, 2015

Cobertura is set to true it doesn't print anything, even errors, can you please provide fix instead of hiding errors ?

@jfbibeau

This comment has been minimized.

jfbibeau commented Aug 12, 2015

+1, seeing this issue as well. Cobertura doesn't seem to be able to parse lambda with Java 8...

Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
net.sourceforge.cobertura.javancss.parser.ParseException: Encountered " ">" "> "" at line 268, column 88.
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)
@AdamEther

This comment has been minimized.

AdamEther commented Aug 12, 2015

Oh

+1, seeing this issue as well. Cobertura doesn't seem to be able to parse lambda with Java 8...

+1

@psmarcos

This comment has been minimized.

psmarcos commented Aug 25, 2015

+1

7 similar comments
@lorochka

This comment has been minimized.

lorochka commented Aug 25, 2015

+1

@ZhivkoDelchev

This comment has been minimized.

ZhivkoDelchev commented Aug 26, 2015

+1

@vimso

This comment has been minimized.

vimso commented Sep 7, 2015

+1

@zeroows

This comment has been minimized.

zeroows commented Sep 7, 2015

+1

@shevek

This comment has been minimized.

shevek commented Sep 8, 2015

+1

@jdolan

This comment has been minimized.

jdolan commented Sep 9, 2015

+1

@joragupra

This comment has been minimized.

joragupra commented Sep 17, 2015

+1

@sourabhagrawal

This comment has been minimized.

sourabhagrawal commented Mar 17, 2017

+1

@davidharrigan

This comment has been minimized.

davidharrigan commented Mar 20, 2017

+10

1 similar comment
@gustajz

This comment has been minimized.

gustajz commented Mar 27, 2017

+10

@barsan-ds

This comment has been minimized.

barsan-ds commented May 12, 2017

+1

@jamesmn

This comment has been minimized.

jamesmn commented May 12, 2017

FYI, given the similar issues with JDK 1.8, I had switched over to use Atlassian Clover in early 2016 which has been running great plus test optimization feature. At the time, Clover was a paid software but was made open source over 1 month ago. It's now FREE to use. Try it out. You may like it.
https://www.atlassian.com/software/clover

@SolomonShorser-OICR

This comment has been minimized.

SolomonShorser-OICR commented May 26, 2017

@jamesmn Thanks for the info, I will certainly check that out!

@chessracer

This comment has been minimized.

chessracer commented Jun 7, 2017

@jamesmn was looking into that.. was a bit stymied by the open-source version not being available at maven central yet. Are you just compiling it locally for your use-case?

@ddcprg

This comment has been minimized.

ddcprg commented Jan 30, 2018

is there an ETA for this fix?

@hohwille

This comment has been minimized.

hohwille commented Feb 28, 2018

For this code line:
https://github.com/m-m-m/util/blob/master/core/src/main/java/net/sf/mmm/util/math/api/NumericValue.java#L20

I get this error. Seems that JavaNCSS has its own Java parser that is not ready for Java8.

[INFO] Generating "JavaNCSS Report" report      --- javancss-maven-plugin:2.1:report
[INFO] Running JavaNCSS 33.54
ParseException in D:\Projekte\mmm\workspaces\main\util\core\src\main\java\net\sf\mmm\util\math\api\NumericValue.java
Last useful checkpoint: "net.sf.mmm.util.math.api.NumericValue"
Encountered " "default" "default "" at line 20, column 3.
Was expecting one of:
    "boolean" ...
    "byte" ...
    "char" ...
    "double" ...
    "final" ...
    "float" ...
    "int" ...
    "long" ...
    "private" ...
    "protected" ...
    "public" ...
    "short" ...
    "static" ...
    "transient" ...
    "volatile" ...
    "@" ...
    "@" ...
    "@" ...
    "@" ...
    "static" ...
    "final" ...
    "public" ...
    "protected" ...
    "private" ...
    "@" ...
    "@" ...
    "@" ...
    "static" ...
    "final" ...
    "public" ...
    "protected" ...
    "private" ...
    "public" ...
    "static" ...
    "protected" ...
    "private" ...
    "final" ...
    "transient" ...
    "volatile" ...
    "@" ...
    "@" ...
    "@" ...
    "public" ...
    "protected" ...
    "private" ...
    "static" ...
    "final" ...
    "@" ...
    "@" ...
    "@" ...
    "boolean" ...
    "char" ...
    "byte" ...
    "short" ...
    "int" ...
    "long" ...
    "float" ...
    "double" ...
    "boolean" ...
    "char" ...
    "byte" ...
    "short" ...
    "int" ...
    "long" ...
    "float" ...
    "double" ...
    "boolean" ...
    "char" ...
    "byte" ...
    "short" ...
    "int" ...
    "long" ...
    "float" ...
    "double" ...
    "public" ...
    "static" ...
    "protected" ...
    "private" ...
    "final" ...
    "transient" ...
    "volatile" ...
    "@" ...
    "@" ...
    "@" ...
@Rafael-Simonelli

This comment has been minimized.

Rafael-Simonelli commented Mar 13, 2018

I have the same issue.
Is there an ETA for the fix? Is the project still maintained?

@aaronshaver

This comment has been minimized.

aaronshaver commented Mar 29, 2018

I get this too. We are using a lot more Java 8 lambda constructs in our code these days so this is disappointing.

@accepting

This comment has been minimized.

accepting commented Apr 18, 2018

+1

@elharo elharo referenced this issue May 8, 2018

Merged

Nullable #599

@mtrovo

This comment has been minimized.

mtrovo commented Jun 28, 2018

@dennisl I think there's a new person maintaining it on the following fork: https://github.com/nokia/javancss. But I can't find an artifact deployed anywhere.

@herenyi

This comment has been minimized.

herenyi commented Jun 29, 2018

Yes, my fixes should solve the Java8 parsing exceptions. If there are more after the fixes let me know. Unfortunately still there is no new release from cobertura after the fixes. Maybe I will create my own release later to be used.

danielnaber added a commit to languagetool-org/languagetool that referenced this issue Jul 7, 2018

pplx pushed a commit to ilscipio/scipio-erp that referenced this issue Jul 9, 2018

Cobertura: Updated run-tests-with-cobertura task. Properly calls the …
…underlying cobertura tests now.

Unofortunately there is a bug with Java 8 and cobertura, which throws errors: cobertura/cobertura#176 (comment)
@rolkliu

This comment has been minimized.

rolkliu commented Oct 19, 2018

I have the same issue,is there an ETA for this fix?

@holodok

This comment has been minimized.

holodok commented Oct 19, 2018

Yes, my fixes should solve the Java8 parsing exceptions. If there are more after the fixes let me know. Unfortunately still there is no new release from cobertura after the fixes. Maybe I will create my own release later to be used.

Unfortunately your fix is not working for cases like (type conversion for lambda result):
Runnable runnable = (Runnable)() -> System.out.println("Test");
Could you please advice how to fix it?

@herenyi

This comment has been minimized.

herenyi commented Oct 19, 2018

I will check it and provide a fix for it later.

@holodok

This comment has been minimized.

holodok commented Oct 19, 2018

i think the fix should be:

void Expression()  :
{}
{
  AssignmentExpression()
}
...
void ConditionalExpression() :
{}
{
  ConditionalLambdaExpression() [ "?" ConditionalExpression() ":" ConditionalExpression() { _cyc++; } ]
}

void ConditionalLambdaExpression() :
{}
{
  LOOKAHEAD(LambdaExpression())  LambdaExpression() 
|
  ConditionalOrExpression()
}
...
void LambdaExpression():
{}
{
	LOOKAHEAD(4)
	"(" Type() ")" LambdaParameters() "->" LambdaBody()
|
	LambdaParameters() "->" LambdaBody()
}
@herenyi

This comment has been minimized.

herenyi commented Nov 7, 2018

I would solve it another way, like in the language specification: https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.16

Something similar like:
CastExpression:
( PrimitiveType ) UnaryExpression
( ReferenceType {AdditionalBound} ) UnaryExpressionNotPlusMinus
( ReferenceType {AdditionalBound} ) LambdaExpression

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment