Minor. Cleanup code
This commit is contained in:
@@ -86,7 +86,7 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
|
||||
protected GeneratedClassLoader initializedClassLoader;
|
||||
|
||||
protected ConfigurationKind configurationKind = ConfigurationKind.JDK_ONLY;
|
||||
public final String defaultJvmTarget = System.getProperty(DEFAULT_JVM_TARGET_FOR_TEST);
|
||||
private final String defaultJvmTarget = System.getProperty(DEFAULT_JVM_TARGET_FOR_TEST);
|
||||
|
||||
protected final void createEnvironmentWithMockJdkAndIdeaAnnotations(
|
||||
@NotNull ConfigurationKind configurationKind,
|
||||
@@ -399,7 +399,8 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
|
||||
protected ClassFileFactory generateClassesInFile() {
|
||||
if (classFileFactory == null) {
|
||||
try {
|
||||
classFileFactory = generateFiles(myEnvironment, myFiles, getClassBuilderFactory());
|
||||
classFileFactory =
|
||||
GenerationUtils.compileFiles(myFiles.getPsiFiles(), myEnvironment, getClassBuilderFactory()).getFactory();
|
||||
|
||||
if (verifyWithDex() && DxChecker.RUN_DX_CHECKER) {
|
||||
DxChecker.check(classFileFactory);
|
||||
@@ -583,7 +584,7 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected List<String> extractJavacOptions(@NotNull List<TestFile> files) {
|
||||
protected static List<String> extractJavacOptions(@NotNull List<TestFile> files) {
|
||||
List<String> javacOptions = new ArrayList<>(0);
|
||||
for (TestFile file : files) {
|
||||
javacOptions.addAll(InTextDirectivesUtils.findListWithPrefixes(file.content, "// JAVAC_OPTIONS:"));
|
||||
|
||||
@@ -43,15 +43,6 @@ public class CodegenTestUtil {
|
||||
return GenerationUtils.compileFiles(files.getPsiFiles(), environment).getFactory();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ClassFileFactory generateFiles(
|
||||
@NotNull KotlinCoreEnvironment environment,
|
||||
@NotNull CodegenTestFiles files,
|
||||
@NotNull ClassBuilderFactory factory
|
||||
) {
|
||||
return GenerationUtils.compileFiles(files.getPsiFiles(), environment, factory).getFactory();
|
||||
}
|
||||
|
||||
public static void assertThrows(@NotNull Method foo, @NotNull Class<? extends Throwable> exceptionClass,
|
||||
@Nullable Object instance, @NotNull Object... args) throws IllegalAccessException {
|
||||
boolean caught = false;
|
||||
|
||||
+10
-11
@@ -141,17 +141,16 @@ public abstract class AbstractWriteFlagsTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
private static TestClassVisitor getClassVisitor(String visitorKind, String testedObjectName, boolean allowSynthetic) {
|
||||
if (visitorKind.equals("class")) {
|
||||
return new ClassFlagsVisitor();
|
||||
}
|
||||
else if (visitorKind.equals("function")) {
|
||||
return new FunctionFlagsVisitor(testedObjectName, allowSynthetic);
|
||||
}
|
||||
else if (visitorKind.equals("property")) {
|
||||
return new PropertyFlagsVisitor(testedObjectName);
|
||||
}
|
||||
else if (visitorKind.equals("innerClass")) {
|
||||
return new InnerClassFlagsVisitor(testedObjectName);
|
||||
switch (visitorKind) {
|
||||
case "class":
|
||||
return new ClassFlagsVisitor();
|
||||
case "function":
|
||||
return new FunctionFlagsVisitor(testedObjectName, allowSynthetic);
|
||||
case "property":
|
||||
return new PropertyFlagsVisitor(testedObjectName);
|
||||
case "innerClass":
|
||||
return new InnerClassFlagsVisitor(testedObjectName);
|
||||
default:
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("Value of TESTED_OBJECT_KIND is incorrect: " + visitorKind);
|
||||
|
||||
Reference in New Issue
Block a user