GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add filter for Record patterns by Godin · Pull Request #1473 · jacoco/jacoco

Conversation

@Godin

@Godin Godin commented Jun 5, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Godin
(WIP) update validation test
8f5544c
@Godin Godin added type: enhancement component: core.filters language: Java Tickets about Java language support labels Jun 5, 2023
@Godin Godin added this to the 0.8.11 milestone Jun 5, 2023
@Godin Godin self-assigned this Jun 5, 2023
Godin added 2 commits June 5, 2023 16:16
@Godin
(WIP) add unit tests
0ca61db
@Godin
(WIP) add filter
bc71921
@Godin
Godin force-pushed the RecordPatternFilter branch from 727139b to bc71921 Compare June 5, 2023 14:35
@Godin
(WIP) update changelog
6ff6d4a
@Godin
Godin marked this pull request as ready for review June 5, 2023 15:18
@Godin
Godin requested a review from marchof June 5, 2023 15:18
marchof
marchof approved these changes Jun 5, 2023
View reviewed changes
@marchof
marchof merged commit e437b64 into jacoco:master Jun 5, 2023
@marchof

marchof commented Jun 5, 2023

Copy link
Copy Markdown
Member

@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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Godin
Godin deleted the RecordPatternFilter branch June 5, 2023 17:02
@Godin Godin mentioned this pull request Sep 28, 2023
Jacoco includes coverage of pattern switch exception paths which may not be possible to cover. #1514
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@marchof marchof marchof approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@Godin Godin

Labels

component: core.filters language: Java Tickets about Java language support type: enhancement

Projects

Current work items
Status: Done
Filtering
Status: Done

Milestone

0.8.11

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Godin @marchof
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.