Skip to content
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

Clover fails to instrument source code with TYPE_USE annotations in implements clause #161

Closed
satob opened this issue Jan 15, 2022 · 0 comments · Fixed by #162
Closed

Clover fails to instrument source code with TYPE_USE annotations in implements clause #161

satob opened this issue Jan 15, 2022 · 0 comments · Fixed by #162
Labels
bug Something isn't working resolved
Milestone

Comments

@satob
Copy link
Contributor

satob commented Jan 15, 2022

When you have the folowing code:

package typeannotation.implementsclause;

import static java.lang.annotation.RetentionPolicy.*;

import java.io.Serializable;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

public class TypeAnnotationImplements implements @AnnotationForType1 Serializable {
}

@Retention(RUNTIME) @Target({ElementType.TYPE_USE})
@interface AnnotationForType1 {
}

This code causes Clover instrumentation to throw the exception below. Removing the type annotation immediately fixes the problem.

C:\home\satob\git\JavaSyntaxTestcase\build.xml:31: line 10:50: expecting IDENT, found '@'
        at clover.antlr.Parser.match(Parser.java:211)
        at com.atlassian.clover.instr.java.JavaRecognizer.classOrInterfaceType(JavaRecognizer.java:1523)
        at com.atlassian.clover.instr.java.JavaRecognizer.implementsClause(JavaRecognizer.java:2187)
        at com.atlassian.clover.instr.java.JavaRecognizer.classDefinition(JavaRecognizer.java:1231)
        at com.atlassian.clover.instr.java.JavaRecognizer.typeDefinition2(JavaRecognizer.java:1167)
        at com.atlassian.clover.instr.java.JavaRecognizer.typeDefinition(JavaRecognizer.java:1071)
        at com.atlassian.clover.instr.java.JavaRecognizer.compilationUnit(JavaRecognizer.java:983)
        at com.atlassian.clover.instr.java.Instrumenter.instrument(Instrumenter.java:211)
        at com.atlassian.clover.instr.java.Instrumenter.instrument(Instrumenter.java:124)
        at com.atlassian.clover.ant.taskdefs.CloverCompilerAdapter.setJavac(CloverCompilerAdapter.java:223)
        at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1349)
        at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:1092)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
        at org.apache.tools.ant.Task.perform(Task.java:350)
        at org.apache.tools.ant.Target.execute(Target.java:449)
        at org.apache.tools.ant.Target.performTasks(Target.java:470)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1374)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
        at org.apache.tools.ant.Main.runBuild(Main.java:818)
        at org.apache.tools.ant.Main.startAnt(Main.java:223)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working resolved
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants