diff --git a/bundles/org.pitest.pitclipse.core/src/org/pitest/pitclipse/core/PitCoreActivator.java b/bundles/org.pitest.pitclipse.core/src/org/pitest/pitclipse/core/PitCoreActivator.java index 13fd7017..6bf7bb85 100644 --- a/bundles/org.pitest.pitclipse.core/src/org/pitest/pitclipse/core/PitCoreActivator.java +++ b/bundles/org.pitest.pitclipse.core/src/org/pitest/pitclipse/core/PitCoreActivator.java @@ -16,7 +16,6 @@ package org.pitest.pitclipse.core; -import static org.eclipse.core.runtime.FileLocator.getBundleFile; import static org.pitest.pitclipse.core.preferences.PitPreferences.AVOID_CALLS_TO; import static org.pitest.pitclipse.core.preferences.PitPreferences.EXCLUDED_CLASSES; import static org.pitest.pitclipse.core.preferences.PitPreferences.EXCLUDED_METHODS; @@ -37,6 +36,7 @@ import java.util.Collections; import java.util.List; +import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; @@ -158,7 +158,9 @@ private void addOurBundleToClasspath(List classpath, String bundleName) } private String getBundleCanonicalPath(String bundleName) throws IOException { - return getBundleFile(Platform.getBundle(bundleName)).getCanonicalPath(); + return FileLocator.getBundleFileLocation(Platform.getBundle(bundleName)) + .orElseThrow(() -> new IOException("Unable to locate the bundle file: " + bundleName)) + .getCanonicalPath(); } private void setupStateDirectories() { diff --git a/bundles/org.pitest.pitclipse.launch.ui/src/org/pitest/pitclipse/launch/ui/PitLaunchShortcut.java b/bundles/org.pitest.pitclipse.launch.ui/src/org/pitest/pitclipse/launch/ui/PitLaunchShortcut.java index 547afc2d..27d6f7d0 100644 --- a/bundles/org.pitest.pitclipse.launch.ui/src/org/pitest/pitclipse/launch/ui/PitLaunchShortcut.java +++ b/bundles/org.pitest.pitclipse.launch.ui/src/org/pitest/pitclipse/launch/ui/PitLaunchShortcut.java @@ -63,6 +63,7 @@ import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IMethod; +import org.eclipse.jdt.core.IOrdinaryClassFile; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.ITypeRoot; import org.eclipse.jface.dialogs.MessageDialog; @@ -364,7 +365,10 @@ private Optional getLaunchElementFor(IJavaElement element) { case METHOD: return Optional.of(element); case CLASS_FILE: - return Optional.ofNullable(((IClassFile) element).getType()); + IClassFile classFile = (IClassFile) element; + if (classFile instanceof IOrdinaryClassFile) { + return Optional.ofNullable(((IOrdinaryClassFile)classFile).getType()); + } case COMPILATION_UNIT: return Optional.ofNullable(((ICompilationUnit) element).findPrimaryType()); default: