Types added to raw classes

* Test classes are now typesafe
This commit is contained in:
Ilya.Kazakevich
2017-02-01 16:23:00 +03:00
parent 1408683158
commit f2983d7c83
10 changed files with 18 additions and 17 deletions
@@ -60,7 +60,7 @@ import java.util.Map;
/**
* @author Leonid Shalupov
*/
public abstract class AbstractPythonRunConfiguration<T extends AbstractPythonRunConfiguration> extends AbstractRunConfiguration
public abstract class AbstractPythonRunConfiguration<T extends AbstractPythonRunConfiguration<T>> extends AbstractRunConfiguration
implements LocatableConfiguration, AbstractPythonRunConfigurationParams, CommandLinePatcher {
/**
* When passing path to test to runners, you should join parts with this char.
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.NonNls;
/**
* @author traff
*/
abstract public class AbstractServerPythonRunConfiguration<T extends AbstractServerPythonRunConfiguration> extends AbstractPythonRunConfiguration<T>{
abstract public class AbstractServerPythonRunConfiguration<T extends AbstractServerPythonRunConfiguration<T>> extends AbstractPythonRunConfiguration<T>{
@NonNls private static final String LAUNCH_JAVASCRIPT_DEBUGGER = "launchJavascriptDebuger";
private boolean myLaunchJavascriptDebugger;
@@ -50,7 +50,7 @@ import java.io.File;
/**
* User: catherine
*/
public abstract class AbstractPythonTestRunConfiguration extends AbstractPythonRunConfiguration
public abstract class AbstractPythonTestRunConfiguration<T extends AbstractPythonRunConfiguration<T>> extends AbstractPythonRunConfiguration<T>
implements AbstractPythonRunConfigurationParams,
AbstractPythonTestRunConfigurationParams,
RefactoringListenerProvider {
@@ -39,6 +39,7 @@ import com.jetbrains.python.PythonModuleTypeBase;
import com.jetbrains.python.facet.PythonFacetSettings;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.types.TypeEvalContext;
import com.jetbrains.python.run.AbstractPythonRunConfiguration;
import com.jetbrains.python.run.PythonRunConfigurationProducer;
import com.jetbrains.python.testing.unittest.PythonUnitTestRunConfiguration;
import org.jetbrains.annotations.NonNls;
@@ -53,7 +54,7 @@ import java.util.List;
/**
* User: ktisha
*/
abstract public class PythonTestConfigurationProducer extends RunConfigurationProducer<AbstractPythonTestRunConfiguration> {
abstract public class PythonTestConfigurationProducer<T extends AbstractPythonRunConfiguration<T>> extends RunConfigurationProducer<AbstractPythonTestRunConfiguration<T>> {
public PythonTestConfigurationProducer(final ConfigurationFactory configurationFactory) {
super(configurationFactory);
@@ -109,7 +110,7 @@ abstract public class PythonTestConfigurationProducer extends RunConfigurationPr
}
@Override
protected boolean setupConfigurationFromContext(AbstractPythonTestRunConfiguration configuration,
protected boolean setupConfigurationFromContext(AbstractPythonTestRunConfiguration<T> configuration,
ConfigurationContext context,
Ref<PsiElement> sourceElement) {
if (context == null) return false;
@@ -34,7 +34,7 @@ import org.jetbrains.annotations.NotNull;
/**
* User: catherine
*/
public class PythonAtTestRunConfiguration extends AbstractPythonTestRunConfiguration
public class PythonAtTestRunConfiguration extends AbstractPythonTestRunConfiguration<PythonAtTestRunConfiguration>
implements PythonAtTestRunConfigurationParams {
protected String myTitle = "Attest";
protected String myPluralTitle = "Attests";
@@ -44,7 +44,7 @@ public class PythonAtTestRunConfiguration extends AbstractPythonTestRunConfigura
}
@Override
protected SettingsEditor<? extends RunConfiguration> createConfigurationEditor() {
protected SettingsEditor<PythonAtTestRunConfiguration> createConfigurationEditor() {
return new PythonAtTestRunConfigurationEditor(getProject(), this);
}
@@ -30,7 +30,7 @@ import org.jetbrains.annotations.NotNull;
/**
* User: catherine
*/
public class PythonDocTestRunConfiguration extends AbstractPythonTestRunConfiguration
public class PythonDocTestRunConfiguration extends AbstractPythonTestRunConfiguration<PythonDocTestRunConfiguration>
implements PythonDocTestRunConfigurationParams {
protected String myPluralTitle = "Doctests";
protected String myTitle = "Doctest";
@@ -40,7 +40,7 @@ public class PythonDocTestRunConfiguration extends AbstractPythonTestRunConfigur
}
@Override
protected SettingsEditor<? extends RunConfiguration> createConfigurationEditor() {
protected SettingsEditor<PythonDocTestRunConfiguration> createConfigurationEditor() {
return new PythonDocTestRunConfigurationEditor(getProject(), this);
}
@@ -34,7 +34,7 @@ import org.jetbrains.annotations.NotNull;
/**
* User: catherine
*/
public class PythonNoseTestRunConfiguration extends AbstractPythonTestRunConfiguration
public class PythonNoseTestRunConfiguration extends AbstractPythonTestRunConfiguration<PythonNoseTestRunConfiguration>
implements PythonNoseTestRunConfigurationParams {
private String myParams = ""; // parameters for nosetests
protected String myTitle = "Nosetest";
@@ -47,7 +47,7 @@ public class PythonNoseTestRunConfiguration extends AbstractPythonTestRunConfigu
}
@Override
protected SettingsEditor<? extends RunConfiguration> createConfigurationEditor() {
protected SettingsEditor<PythonNoseTestRunConfiguration> createConfigurationEditor() {
return new PythonNoseTestRunConfigurationEditor(getProject(), this);
}
@@ -44,14 +44,14 @@ import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.List;
public class PyTestConfigurationProducer extends PythonTestConfigurationProducer {
public class PyTestConfigurationProducer extends PythonTestConfigurationProducer<PyTestRunConfiguration> {
public PyTestConfigurationProducer() {
super(PythonTestConfigurationType.getInstance().PY_PYTEST_FACTORY);
}
@Override
protected boolean setupConfigurationFromContext(AbstractPythonTestRunConfiguration configuration,
protected boolean setupConfigurationFromContext(AbstractPythonTestRunConfiguration<PyTestRunConfiguration> configuration,
ConfigurationContext context,
Ref<PsiElement> sourceElement) {
final PsiElement element = sourceElement.get();
@@ -45,7 +45,7 @@ import java.util.List;
/**
* @author yole
*/
public class PyTestRunConfiguration extends AbstractPythonTestRunConfiguration implements PyTestRunConfigurationParams {
public class PyTestRunConfiguration extends AbstractPythonTestRunConfiguration<PyTestRunConfiguration> implements PyTestRunConfigurationParams {
private String myTestToRun = "";
private String myKeywords = "";
private String myParams = "";
@@ -64,7 +64,7 @@ public class PyTestRunConfiguration extends AbstractPythonTestRunConfiguration i
super(project, factory);
}
protected SettingsEditor<? extends RunConfiguration> createConfigurationEditor() {
protected SettingsEditor<PyTestRunConfiguration> createConfigurationEditor() {
return new PyTestConfigurationEditor(getProject(), this);
}
@@ -33,7 +33,7 @@ import org.jetbrains.annotations.NotNull;
* @author Leonid Shalupov
*/
public class PythonUnitTestRunConfiguration extends
AbstractPythonTestRunConfiguration
AbstractPythonTestRunConfiguration<PythonUnitTestRunConfiguration>
implements PythonUnitTestRunConfigurationParams {
private boolean myIsPureUnittest = true;
protected String myTitle = "Unittest";
@@ -48,7 +48,7 @@ public class PythonUnitTestRunConfiguration extends
}
@Override
protected SettingsEditor<? extends RunConfiguration> createConfigurationEditor() {
protected SettingsEditor<PythonUnitTestRunConfiguration> createConfigurationEditor() {
return new PythonUnitTestRunConfigurationEditor(getProject(), this);
}