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

Task 136 get rid of guava #160

Merged
merged 64 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
5627d14
136: removed Guava from pitclipse.core
LorenzoBettini Jul 12, 2021
5dbc6e8
136: removed Guava from LaunchConfigurationWrapper
LorenzoBettini Jul 12, 2021
890eb78
136: removed Guava from PackageFinder
LorenzoBettini Jul 12, 2021
d708600
136: ProjectLevelClassFinder
LorenzoBettini Jul 13, 2021
4a60f44
136: ProjectLevelClassFinder
LorenzoBettini Jul 13, 2021
ca0e86f
136: ProjectLevelProjectFinder
LorenzoBettini Jul 13, 2021
cf38dcd
136: ProjectLevelSourceDirFinder
LorenzoBettini Jul 13, 2021
d066743
136: ProjectUtils
LorenzoBettini Jul 13, 2021
2827b9f
136: WorkspaceLevelClassFinder
LorenzoBettini Jul 13, 2021
f8709c0
Merge branch 'task_135-Fix_SonarQube_issues' into
LorenzoBettini Jul 13, 2021
fecb004
136: rename variable
LorenzoBettini Jul 13, 2021
61d57e8
136: remove Guava from WorkspaceLevelProjectFinder
LorenzoBettini Jul 13, 2021
bdc823e
136: formatted with spaces
LorenzoBettini Jul 13, 2021
675aa76
136: remove Guava from AbstractPitLaunchDelegate
LorenzoBettini Jul 13, 2021
386c262
136: remove Guava from org.pitest.pitclipse.launch
LorenzoBettini Jul 13, 2021
cbb8d90
Merge remote-tracking branch 'origin/HEAD' into
LorenzoBettini Jul 22, 2021
6fa797a
Merge branch 'master' into task_136-Get_rid_of_Guava
LorenzoBettini Jul 26, 2021
34dac70
136: remove Guava from org.pitest.pitclipse.launch.ui
LorenzoBettini Jul 26, 2021
578cade
Merge branch 'master' into task_136-Get_rid_of_Guava
LorenzoBettini Jul 27, 2021
f5a9555
Merge branch 'master' into task_136-Get_rid_of_Guava
LorenzoBettini Aug 3, 2021
6bef67a
Merge branch 'master' into task_136-Get_rid_of_Guava
LorenzoBettini Aug 3, 2021
6be913b
136: starting removing Guava from ClassMutations
LorenzoBettini Aug 3, 2021
49ac172
136: removing Guava from ClassMutations
LorenzoBettini Aug 3, 2021
2531227
tab instead of chars for indenting
LorenzoBettini Aug 3, 2021
1d76dfc
136: refined coverage exclusions
LorenzoBettini Aug 3, 2021
9138f76
136: starting removing Guava from ModelBuilder
LorenzoBettini Aug 3, 2021
2e4ed9a
136: further removing Guava from ModelBuilder
LorenzoBettini Aug 3, 2021
dc18b11
136: removed Guava from ModelBuilder
LorenzoBettini Aug 3, 2021
6460f20
136: tested additional conditions of cli args
LorenzoBettini Aug 3, 2021
7d1599b
136: removed Guava from PitCliArguments
LorenzoBettini Aug 4, 2021
4c3baa4
Merge branch 'master' into task_136-Get_rid_of_Guava
LorenzoBettini Aug 4, 2021
498f98f
Merge branch 'master' into task_136-Get_rid_of_Guava
LorenzoBettini Aug 21, 2021
13c052e
Merge remote-tracking branch 'origin/HEAD' into
LorenzoBettini Aug 21, 2021
9b087b6
Merge branch 'master' into task_136-Get_rid_of_Guava
LorenzoBettini Aug 5, 2022
ec129b8
136: removed MutationsByStatus
LorenzoBettini Aug 8, 2022
a6b4936
136: PitclipseMutationsResultListener
LorenzoBettini Aug 8, 2022
6ca3614
136: ClassSummary
LorenzoBettini Aug 8, 2022
423c0f4
136: SummaryResult
LorenzoBettini Aug 9, 2022
9765633
136: part of PitOptions
LorenzoBettini Aug 9, 2022
13f0711
Merge branch 'master' into task_136-Get_rid_of_Guava
LorenzoBettini Aug 23, 2022
1f497c6
Merge branch 'master' into task_136-Get_rid_of_Guava
LorenzoBettini Aug 24, 2022
39393d8
Merge branch 'master' into task_136-Get_rid_of_Guava
LorenzoBettini Aug 26, 2022
0eb1a80
136: PitUtils.splitBasedOnComma
LorenzoBettini Aug 28, 2022
ba6a8dc
136: completed PitOptions
LorenzoBettini Aug 28, 2022
b67835d
136: SummaryResultListener
LorenzoBettini Aug 28, 2022
2efd375
136: PitRequest
LorenzoBettini Aug 28, 2022
cc2641d
136: PitResults
LorenzoBettini Aug 28, 2022
ee9f8e3
136: PitRunner
LorenzoBettini Aug 28, 2022
303e661
136: PitRunnerMain
LorenzoBettini Aug 28, 2022
c91f4cf
136: Status
LorenzoBettini Aug 28, 2022
c71b337
136: PackageMutations
LorenzoBettini Aug 28, 2022
6412557
136: PackageMutations
LorenzoBettini Aug 28, 2022
732b118
136: MutationsModel
LorenzoBettini Aug 28, 2022
8869417
136: StatusComparator use array instead of list
LorenzoBettini Aug 28, 2022
b20bd56
136: removed guava from runner project
LorenzoBettini Aug 28, 2022
e2ad258
136: PitViewFinder
LorenzoBettini Aug 28, 2022
35b6998
Merge branch 'master' into task_136-Get_rid_of_Guava
LorenzoBettini Aug 29, 2022
9afcb4b
136: PitMutationsViewLabelProvider set
LorenzoBettini Aug 29, 2022
472111a
136: removed guava from ui project
LorenzoBettini Aug 29, 2022
c67395c
136: removed guava from classpath when running PIT
LorenzoBettini Aug 31, 2022
a92e9af
136: removed guava from required bundles of our feature
LorenzoBettini Aug 31, 2022
291805a
136: removed guava from core feature
LorenzoBettini Aug 31, 2022
cc5cfe1
136: removed repository reference for Orbit
LorenzoBettini Aug 31, 2022
14b04b2
136: temporarily revert to Tycho 2.7.3
LorenzoBettini Sep 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions bundles/org.pitest.pitclipse.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,5 @@ Export-Package: org.pitest.pitclipse.core,
org.pitest.pitclipse.core.launch,
org.pitest.pitclipse.core.preferences
Automatic-Module-Name: org.pitest.pitclipse.core
Import-Package: com.google.common.collect;version="21.0.0",
com.google.common.io;version="21.0.0",
org.eclipse.jface.preference,
Import-Package: org.eclipse.jface.preference,
org.eclipse.ui.preferences
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void start(BundleContext context) throws Exception { // NOPMD - Base
addMavenJarToClasspath(pitestClasspath, ORG_PITEST, "pitest-entry.jar");
addMavenJarToClasspath(pitestClasspath, ORG_PITEST, "pitest-command-line.jar");
addMavenJarToClasspath(pitestClasspath, ORG_PITEST, "pitest-html-report.jar");
pitestClasspath.add(getBundleCanonicalPath("com.google.guava"));
// we don't need "com.google.guava" anymore

if (Platform.getBundle(ORG_PITEST_PITCLIPSE_LISTENERS) != null) {
addOurBundleToClasspath(pitestClasspath, ORG_PITEST_PITCLIPSE_LISTENERS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@

package org.pitest.pitclipse.core.extension.point;

import com.google.common.collect.ImmutableList;
import java.util.List;

import org.pitest.pitclipse.runner.PitOptions;

import java.util.List;

/**
* <p>Options used by a running PIT application.</p>
*
Expand All @@ -32,7 +30,7 @@ public class PitRuntimeOptions {

private final int portNumber;
private final PitOptions options;
private final ImmutableList<String> projects;
private final List<String> projects;

/**
* Creates a new object representing the options used by a running PIT application.
Expand All @@ -47,7 +45,7 @@ public class PitRuntimeOptions {
public PitRuntimeOptions(int portNumber, PitOptions options, List<String> projects) {
this.portNumber = portNumber;
this.options = options;
this.projects = ImmutableList.copyOf(projects);
this.projects = projects;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions bundles/org.pitest.pitclipse.launch.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.11.1,4.0.0)",
org.eclipse.ui.workbench;bundle-version="[3.107.1,4.0.0)",
org.eclipse.jdt.debug.ui;bundle-version="[3.7.101,4.0.0)",
org.pitest.pitclipse.ui;bundle-version="2.1.2"
Import-Package: com.google.common.collect;version="21.0.0",
org.pitest.mutationtest.engine.gregor.config
Import-Package: org.pitest.mutationtest.engine.gregor.config
Export-Package: org.pitest.pitclipse.launch.ui
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static org.eclipse.jdt.ui.JavaUI.getEditorInputTypeRoot;

import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
Expand All @@ -30,8 +31,6 @@
import org.eclipse.ui.IEditorInput;
import org.pitest.pitclipse.ui.utils.PitclipseUiUtils;

import com.google.common.collect.ImmutableList;

final class LaunchShortcut {

static <T> Optional<T> forEditorInputDo(IEditorInput i, Function<ITypeRoot, Optional<T>> onFound, Supplier<Optional<T>> notFound) {
Expand All @@ -52,8 +51,8 @@ static Optional<IJavaElement> asJavaElement(Object o) {
return Optional.ofNullable(PitclipseUiUtils.tryToAdapt(o, IJavaElement.class));
}

static ImmutableList<ILaunchConfiguration> emptyLaunchConfiguration() {
return ImmutableList.<ILaunchConfiguration>of();
static List<ILaunchConfiguration> emptyLaunchConfiguration() {
return Collections.emptyList();
}

static ILaunchConfiguration[] emptyList() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import static org.pitest.pitclipse.launch.ui.PitLaunchUiActivator.getActiveWorkbenchShell;
import static org.pitest.pitclipse.launch.ui.PitMigrationDelegate.mapResources;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
Expand Down Expand Up @@ -75,9 +76,6 @@
import org.pitest.pitclipse.runner.config.PitConfiguration;
import org.pitest.pitclipse.ui.utils.PitclipseUiUtils;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;

/**
* Allows to launch a PIT analyze from a contextual menu.
*/
Expand Down Expand Up @@ -275,13 +273,13 @@ private List<ILaunchConfiguration> findExistingLaunchConfigurations(ILaunchConfi
ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations(configType);
String[] attributeToCompare = getAttributeNamesToCompare();

Builder<ILaunchConfiguration> candidateConfigs = ImmutableList.builder();
List<ILaunchConfiguration> candidateConfigs = new ArrayList<>();
for (ILaunchConfiguration config : configs) {
if (hasSameAttributes(config, temporary, attributeToCompare)) {
candidateConfigs.add(config);
}
}
return candidateConfigs.build();
return candidateConfigs;
}

private List<ILaunchConfiguration> findExistingLaunchConfigurations(Object candidate) {
Expand Down
2 changes: 0 additions & 2 deletions bundles/org.pitest.pitclipse.launch/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.11.1,4.0.0)",
org.eclipse.jdt.junit.core
Export-Package: org.pitest.pitclipse.launch,
org.pitest.pitclipse.launch.config
Import-Package: com.google.common.base;version="21.0.0",
com.google.common.collect;version="21.0.0"
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import static org.pitest.pitclipse.core.PitCoreActivator.getDefault;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.eclipse.core.runtime.CoreException;
Expand All @@ -42,8 +44,6 @@
import org.pitest.pitclipse.runner.config.PitConfiguration;
import org.pitest.pitclipse.runner.io.SocketProvider;

import com.google.common.collect.ImmutableList;

/**
* <p>Abstract launch configuration used to execute PIT in a background VM.</p>
*
Expand Down Expand Up @@ -75,15 +75,13 @@ public String getMainTypeName(ILaunchConfiguration launchConfig) throws CoreExce

@Override
public String[] getClasspath(ILaunchConfiguration launchConfig) throws CoreException {
ImmutableList.Builder<String> builder = ImmutableList.<String>builder()
.addAll(getDefault().getPitClasspath());
builder.addAll(ImmutableList.copyOf(super.getClasspath(launchConfig)));
List<String> newClasspath = new ArrayList<>(getDefault().getPitClasspath());
newClasspath.addAll(Arrays.asList(super.getClasspath(launchConfig)));
if (projectUsesJunit5) {
// Allow Pitest to detect Junit5 tests
builder.addAll(getDefault().getPitestJunit5PluginClasspath());
newClasspath.addAll(getDefault().getPitestJunit5PluginClasspath());
}
List<String> newClasspath = builder.build();


return newClasspath.toArray(new String[newClasspath.size()]);
}

Expand All @@ -103,15 +101,14 @@ public void launch(ILaunchConfiguration configuration, String mode, ILaunch laun

projectUsesJunit5 = isJUnit5InClasspathOf(configWrapper.getProject());
PitOptionsBuilder optionsBuilder = configWrapper.getPitOptionsBuilder();
PitOptions options = optionsBuilder.withUseJUnit5(projectUsesJunit5)
.build();
PitOptions options = optionsBuilder.withUseJUnit5(projectUsesJunit5).build();

super.launch(configuration, mode, launch, monitor);

IExtensionRegistry registry = Platform.getExtensionRegistry();

new ExtensionPointHandler<PitRuntimeOptions>(EXTENSION_POINT_ID).execute(registry, new PitRuntimeOptions(
portNumber, options, configWrapper.getMutatedProjects()));
new ExtensionPointHandler<PitRuntimeOptions>(EXTENSION_POINT_ID).execute(registry,
new PitRuntimeOptions(portNumber, options, configWrapper.getMutatedProjects()));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.pitest.pitclipse.launch.config;


import static org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME;
import static org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME;
import static org.pitest.pitclipse.core.PitCoreActivator.getDefault;
Expand All @@ -24,6 +25,7 @@

import java.io.File;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import org.eclipse.core.resources.IProject;
Expand All @@ -42,9 +44,7 @@
import org.pitest.pitclipse.runner.PitOptions;
import org.pitest.pitclipse.runner.PitOptions.PitOptionsBuilder;
import org.pitest.pitclipse.runner.config.PitConfiguration;

import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
import org.pitest.pitclipse.runner.util.PitUtils;

public class LaunchConfigurationWrapper {

Expand Down Expand Up @@ -207,39 +207,33 @@ public Builder withPitConfiguration(PitConfiguration pitConfiguration) {
}

private List<String> getExcludedMethods() throws CoreException {
ImmutableList.Builder<String> results = ImmutableList.builder();
String excludedMethods;
if (launchConfig.hasAttribute(ATTR_EXCLUDE_METHODS)) {
excludedMethods = launchConfig.getAttribute(ATTR_EXCLUDE_METHODS, "");
} else {
excludedMethods = pitConfiguration.getExcludedMethods();
}
results.addAll(Splitter.on(',').trimResults().omitEmptyStrings().split(excludedMethods));
return results.build();
return PitUtils.splitBasedOnComma(excludedMethods);
}

private List<String> getAvoidCallsTo() throws CoreException {
ImmutableList.Builder<String> results = ImmutableList.builder();
String avoidCallsTo;
if (launchConfig.hasAttribute(ATTR_AVOID_CALLS_TO)) {
avoidCallsTo = launchConfig.getAttribute(ATTR_AVOID_CALLS_TO, "");
} else {
avoidCallsTo = pitConfiguration.getAvoidCallsTo();
}
results.addAll(Splitter.on(',').trimResults().omitEmptyStrings().split(avoidCallsTo));
return results.build();
return PitUtils.splitBasedOnComma(avoidCallsTo);
}

private List<String> getExcludedClasses() throws CoreException {
ImmutableList.Builder<String> results = ImmutableList.builder();
String excludedClasses;
if (launchConfig.hasAttribute(ATTR_EXCLUDE_CLASSES)) {
excludedClasses = launchConfig.getAttribute(ATTR_EXCLUDE_CLASSES, "");
} else {
excludedClasses = pitConfiguration.getExcludedClasses();
}
results.addAll(Splitter.on(',').trimResults().omitEmptyStrings().split(excludedClasses));
return results.build();
return PitUtils.splitBasedOnComma(excludedClasses);
}

private boolean isIncrementalAnalysis() throws CoreException {
Expand All @@ -264,10 +258,9 @@ private List<String> getClassesFromProject() throws CoreException {
}

private List<String> getTargetClasses() throws CoreException {
ImmutableList.Builder<String> results = ImmutableList.builder();
final String targetClasses = launchConfig.getAttribute(ATTR_TARGET_CLASSES, "");
return targetClasses.equals("") ? null
: results.addAll(Splitter.on(',').trimResults().omitEmptyStrings().split(targetClasses)).build();
: new ArrayList<>(PitUtils.splitBasedOnComma(targetClasses));
}

public IResource[] getMappedResources() throws CoreException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,17 @@

package org.pitest.pitclipse.launch.config;

import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder;
import static org.eclipse.core.resources.IResource.FOLDER;
import static org.eclipse.core.resources.IResource.NONE;
import static org.eclipse.core.resources.IResource.PROJECT;
import static org.eclipse.jdt.core.IJavaElement.PACKAGE_FRAGMENT;
import static org.eclipse.jdt.core.IJavaElement.PACKAGE_FRAGMENT_ROOT;
import static org.eclipse.jdt.core.IPackageFragment.DEFAULT_PACKAGE_NAME;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceProxy;
Expand All @@ -31,24 +40,13 @@
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;

import java.util.List;
import java.util.Set;

import static com.google.common.collect.ImmutableList.copyOf;
import static org.eclipse.core.resources.IResource.FOLDER;
import static org.eclipse.core.resources.IResource.NONE;
import static org.eclipse.core.resources.IResource.PROJECT;
import static org.eclipse.jdt.core.IJavaElement.PACKAGE_FRAGMENT;
import static org.eclipse.jdt.core.IJavaElement.PACKAGE_FRAGMENT_ROOT;
import static org.eclipse.jdt.core.IPackageFragment.DEFAULT_PACKAGE_NAME;

public class PackageFinder {

private static final class ProjectLevelProxyVisitor implements IResourceProxyVisitor {
private final LaunchConfigurationWrapper configurationWrapper;
private final Builder<String> builder;
private final Set<String> builder;

private ProjectLevelProxyVisitor(LaunchConfigurationWrapper configurationWrapper, Builder<String> builder) {
private ProjectLevelProxyVisitor(LaunchConfigurationWrapper configurationWrapper, Set<String> builder) {
this.configurationWrapper = configurationWrapper;
this.builder = builder;
}
Expand All @@ -75,18 +73,18 @@ public boolean visit(IResourceProxy proxy) throws CoreException {
}

private Set<String> getPackagesFromRoot(IJavaProject project, String handleId) throws CoreException {
Builder<String> setBuilder = ImmutableSet.builder();
Set<String> setBuilder = new HashSet<>();
IPackageFragmentRoot[] roots = project.getPackageFragmentRoots();
for (IPackageFragmentRoot root : roots) {
if (handleId.equals(root.getHandleIdentifier())) {
setBuilder.addAll(packagesFrom(root));
}
}
return setBuilder.build();
return setBuilder;
}

private Set<String> packagesFrom(IPackageFragmentRoot root) throws CoreException {
Builder<String> setBuilder = ImmutableSet.builder();
Set<String> setBuilder = new HashSet<>();
IJavaElement[] elements = root.getChildren();
for (IJavaElement element : elements) {
if (element instanceof IPackageFragment) {
Expand All @@ -95,40 +93,40 @@ private Set<String> packagesFrom(IPackageFragmentRoot root) throws CoreException
}

}
return setBuilder.build();
return setBuilder;
}

private Set<String> packagesFrom(IPackageFragment packageFragment) throws CoreException {
Builder<String> setBuilder = ImmutableSet.builder();
Set<String> setBuilder = new HashSet<>();
if (packageFragment.getElementName().equals(DEFAULT_PACKAGE_NAME)) {
setBuilder.addAll(classesFromDefaultPackage(packageFragment));
} else {
if (packageFragment.getCompilationUnits().length > 0) {
setBuilder.add(packageFragment.getElementName() + ".*");
}
}
return setBuilder.build();
return setBuilder;
}

private Set<String> classesFromDefaultPackage(IPackageFragment packageFragment) throws CoreException {
Builder<String> setBuilder = ImmutableSet.builder();
Set<String> setBuilder = new HashSet<>();
for (ICompilationUnit c : packageFragment.getCompilationUnits()) {
for (IType type : c.getAllTypes()) {
setBuilder.add(type.getFullyQualifiedName());
}
}
return setBuilder.build();
return setBuilder;
}
}

public List<String> getPackages(LaunchConfigurationWrapper configurationWrapper) throws CoreException {
final Builder<String> builder = ImmutableSet.builder();
Set<String> setBuilder = new HashSet<>();
IResource[] resources = configurationWrapper.getMappedResources();
IResourceProxyVisitor visitor = new ProjectLevelProxyVisitor(configurationWrapper, builder);
IResourceProxyVisitor visitor = new ProjectLevelProxyVisitor(configurationWrapper, setBuilder);
for (IResource resource : resources) {
resource.accept(visitor, NONE);
}
return copyOf(builder.build());
return new ArrayList<>(setBuilder);
}

}
Loading