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

Add filter for Record patterns #1473

Merged
merged 4 commits into from Jun 5, 2023
Merged

Conversation

Godin
Copy link
Member

@Godin Godin commented Jun 5, 2023

Before this change for the following Example.java

record Example(int x, int y) {

  static void example_instanceof(Object o) {
    if (o instanceof Example(int x, int y)) {
      System.out.println(x + ", " + y);
    }
  }

  static void example_switch(Object o) {
    switch (o) {
      case Example(int x, int y) -> System.out.println(x + ", " + y);
      default -> System.out.println();
    }
  }

  public static void main(String[] args) {
    example_instanceof(new Object());
    example_instanceof(new Example(1, 2));
    example_switch(new Object());
    example_switch(new Example(1, 2));
  }
}

using

openjdk version "21-ea" 2023-09-19
OpenJDK Runtime Environment (build 21-ea+25-2212)
OpenJDK 64-Bit Server VM (build 21-ea+25-2212, mixed mode, sharing)

execution of

javac Example.java -d classes
java -javaagent:jacocoagent.jar -cp classes Example
java -jar jacococli.jar report jacoco.exec --classfiles classes --sourcefiles . --html report

produces

before before

and after this change

after after

@Godin Godin added this to the 0.8.11 milestone Jun 5, 2023
@Godin Godin self-assigned this Jun 5, 2023
@Godin Godin added this to Awaiting triage in Filtering via automation Jun 5, 2023
@Godin Godin added this to Implementation in Current work items via automation Jun 5, 2023
@Godin Godin moved this from Awaiting triage to In Progress in Filtering Jun 5, 2023
@Godin Godin marked this pull request as ready for review June 5, 2023 15:18
@Godin Godin moved this from Implementation to Review in Current work items Jun 5, 2023
@Godin Godin requested a review from marchof June 5, 2023 15:18
@marchof marchof merged commit e437b64 into jacoco:master Jun 5, 2023
22 checks passed
Filtering automation moved this from In Progress to Done Jun 5, 2023
Current work items automation moved this from Review to Done Jun 5, 2023
@marchof
Copy link
Member

marchof commented Jun 5, 2023

@Godin While reviewing this PR I noticed that record pattern matching and switch pattern matching has been finalized in Java 21. Shouldn't we move it to a new project org.jacoco.text.validation.java21?

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

Successfully merging this pull request may close these issues.

None yet

2 participants