GeezerVison is showing github.com — Add filter for Record patterns by Godin · Pull Request #1473 · jacoco/jacoco
Conversation
Godin
commented
Jun 5, 2023
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
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
and after this change
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@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?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
marchof
marchof approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.