Skip to content

[Bug] Method-level Coverage Tracing misses Lambda Functions #71

@delsner

Description

@delsner

This is due to the fact that ByteBuddy (and the JVM in general) does provide good capabilities to instrument lambdas (see here).

Example:

import java.util.ArrayList;
import java.util.function.Consumer;

public class App {
    
    private static Consumer<Integer> method = (n) -> { System.out.println(n); };

    public static void main(String[] args) {
        ArrayList<Integer> numbers = new ArrayList<Integer>();
        numbers.add(5);
        numbers.forEach( method );
    }
}
$ javac App.java
$ java -javaagent:~/.m2/repository/edu/tum/sse/jtec-agent/0.0.3/jtec-agent-0.0.3.jar=cov.trace=true,cov.level=method App
$ cat 71150_1671108967249_cov.log
{"71150":["App#main([Ljava.lang.String;)void"]}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions