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

Migrating to the new API #1283

Open
LorenzoBettini opened this issue Dec 11, 2023 · 2 comments
Open

Migrating to the new API #1283

LorenzoBettini opened this issue Dec 11, 2023 · 2 comments

Comments

@LorenzoBettini
Copy link

Hi

In Pitclipse, https://github.com/pitest/pitclipse, we need to update to a more recent version of pit to support Java 21 (pitest/pitclipse#221). We were using 1.6.8 and moving to 1.15.3 leads to compilation errors. I seem to understand this is due to 95e8102 which changes the API of CoverageDatabase (we were using its methods getNumberOfCoveredLines and getClassInfo, which now are gone), which we used to retrieve from ListenerArguments.getCoverage, which now returns a ReportCoverage.

Is there any suggested way to migrate to the new API?

thanks in advance

@hcoles
Copy link
Owner

hcoles commented Dec 13, 2023

Yes, the interface as changed a lot and the ClassInfo class has been largely deprecated.

You should have all the data you need to determine the number of covered lines for the

Set<ClassLine> getCoveredLines(ClassName clazz);

Method.

How were you using ClassInfo?

@LorenzoBettini
Copy link
Author

@hcoles thanks for the answer.

That's the main part https://github.com/pitest/pitclipse/blob/0b1f2926d97fb0b92f3c79dd31f4667823d287c5/bundles/org.pitest.pitclipse.runner/src/org/pitest/pitclipse/runner/results/summary/SummaryResultListener.java#L63 where we are using CoverageDatabase.

Concerning ClassInfo then we use it mainly here: https://github.com/pitest/pitclipse/blob/0b1f2926d97fb0b92f3c79dd31f4667823d287c5/bundles/org.pitest.pitclipse.runner/src/org/pitest/pitclipse/runner/results/summary/ClassSummary.java#L46

We are also using MethodName, which I seem to understand it's now removed; but IIRC we use that in tests, so that's less crucial.

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

No branches or pull requests

2 participants