Invoke "remove unnecessary final" intention in compiler modules

This commit is contained in:
Alexander Udalov
2017-04-01 00:23:37 +03:00
parent 463bbbd386
commit 34f0576135
96 changed files with 407 additions and 404 deletions
@@ -106,7 +106,7 @@ public abstract class KotlinMultiFileTestWithJava<M, F> extends KotlinTestWithEn
String expectedText = KotlinTestUtils.doLoadFile(file);
final Map<String, ModuleAndDependencies> modules = new HashMap<String, ModuleAndDependencies>();
Map<String, ModuleAndDependencies> modules = new HashMap<String, ModuleAndDependencies>();
List<F> testFiles =
KotlinTestUtils.createTestFiles(file.getName(), expectedText, new KotlinTestUtils.TestFileFactory<M, F>() {
@@ -80,7 +80,7 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
@NotNull
protected static List<String> findJavaSourcesInDirectory(@NotNull File directory) {
final List<String> javaFilePaths = new ArrayList<String>(1);
List<String> javaFilePaths = new ArrayList<String>(1);
FileUtil.processFilesRecursively(directory, new Processor<File>() {
@Override
@@ -73,7 +73,7 @@ public abstract class AbstractCheckLocalVariablesTableTest extends TestCaseWithT
String classAndMethod = parseClassAndMethodSignature();
String[] split = classAndMethod.split("\\.");
assert split.length == 2 : "Exactly one dot is expected: " + classAndMethod;
final String classFileRegex = StringUtil.escapeToRegexp(split[0] + ".class").replace("\\*", ".+");
String classFileRegex = StringUtil.escapeToRegexp(split[0] + ".class").replace("\\*", ".+");
String methodName = split[1];
OutputFile outputFile = ContainerUtil.find(outputFiles.asList(), new Condition<OutputFile>() {
@@ -144,7 +144,7 @@ public abstract class AbstractCheckLocalVariablesTableTest extends TestCaseWithT
}
@NotNull
private static List<LocalVariable> readLocalVariable(ClassReader cr, final String methodName) throws Exception {
private static List<LocalVariable> readLocalVariable(ClassReader cr, String methodName) throws Exception {
class Visitor extends ClassVisitor {
List<LocalVariable> readVariables = new ArrayList<LocalVariable>();
@@ -167,8 +167,8 @@ public abstract class AbstractLineNumberTest extends TestCaseWithTmpdir {
@NotNull
private static List<String> readTestFunLineNumbers(@NotNull ClassReader cr) {
final List<Label> labels = Lists.newArrayList();
final Map<Label, String> labels2LineNumbers = Maps.newHashMap();
List<Label> labels = Lists.newArrayList();
Map<Label, String> labels2LineNumbers = Maps.newHashMap();
ClassVisitor visitor = new ClassVisitor(Opcodes.ASM5) {
@Override
@@ -212,8 +212,8 @@ public abstract class AbstractLineNumberTest extends TestCaseWithTmpdir {
@NotNull
private static List<String> readAllLineNumbers(@NotNull ClassReader reader) {
final List<String> result = new ArrayList<String>();
final Set<String> visitedLabels = new HashSet<String>();
List<String> result = new ArrayList<String>();
Set<String> visitedLabels = new HashSet<String>();
reader.accept(new ClassVisitor(Opcodes.ASM5) {
@Override
@@ -40,7 +40,7 @@ public abstract class AbstractTopLevelMembersInvocationTest extends AbstractByte
@Override
public void doTest(@NotNull String filename) throws Exception {
File root = new File(filename);
final List<String> sourceFiles = new ArrayList<String>(2);
List<String> sourceFiles = new ArrayList<String>(2);
FileUtil.processFilesRecursively(root, new Processor<File>() {
@Override
@@ -579,7 +579,7 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
}
@NotNull
private static List<TestFile> createTestFiles(File file, String expectedText, final Ref<File> javaFilesDir) {
private static List<TestFile> createTestFiles(File file, String expectedText, Ref<File> javaFilesDir) {
return KotlinTestUtils.createTestFiles(file.getName(), expectedText, new KotlinTestUtils.TestFileFactoryNoModules<TestFile>() {
@NotNull
@Override
@@ -154,7 +154,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
JvmContentRootsKt.addJavaSourceRoot(configuration, new File("compiler/testData/loadJava/include"));
JvmContentRootsKt.addJavaSourceRoot(configuration, tmpdir);
final KotlinCoreEnvironment environment =
KotlinCoreEnvironment environment =
KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
AnalysisResult result = TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(
@@ -227,7 +227,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
}
private void doTestCompiledJava(@NotNull String javaFileName, Configuration configuration) throws Exception {
final File srcDir = new File(tmpdir, "src");
File srcDir = new File(tmpdir, "src");
File compiledDir = new File(tmpdir, "compiled");
assertTrue(srcDir.mkdir());
assertTrue(compiledDir.mkdir());
@@ -55,7 +55,7 @@ public class ExpectedLoadErrorsUtil {
}
private static Map<SourceElement, List<String>> getExpectedLoadErrors(@NotNull PackageViewDescriptor packageFromJava) {
final Map<SourceElement, List<String>> map = new HashMap<SourceElement, List<String>>();
Map<SourceElement, List<String>> map = new HashMap<SourceElement, List<String>>();
packageFromJava.acceptVoid(new DeclarationDescriptorVisitorEmptyBodies<Void, Void>() {
@Override
@@ -106,7 +106,7 @@ public class LoadDescriptorUtil {
}
@NotNull
private static List<KtFile> createKtFiles(@NotNull List<File> kotlinFiles, @NotNull final KotlinCoreEnvironment environment) {
private static List<KtFile> createKtFiles(@NotNull List<File> kotlinFiles, @NotNull KotlinCoreEnvironment environment) {
return CollectionsKt.map(kotlinFiles, new Function1<File, KtFile>() {
@Override
public KtFile invoke(File kotlinFile) {
@@ -365,7 +365,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends KotlinTest
return KotlinTestUtils.doLoadFile(file).replaceAll("ANNOTATION", annotationText);
}
private static String renderAnnotations(Annotations annotations, @Nullable final AnnotationUseSiteTarget defaultTarget) {
private static String renderAnnotations(Annotations annotations, @Nullable AnnotationUseSiteTarget defaultTarget) {
return StringUtil.join(annotations.getAllAnnotations(), new Function<AnnotationWithTarget, String>() {
@Override
public String fun(AnnotationWithTarget annotationWithTarget) {
@@ -403,7 +403,7 @@ public class KotlinTestUtils {
}
@NotNull
public static KtFile createFile(@NotNull @NonNls final String name, @NotNull String text, @NotNull Project project) {
public static KtFile createFile(@NotNull @NonNls String name, @NotNull String text, @NotNull Project project) {
String shortName = name.substring(name.lastIndexOf('/') + 1);
shortName = shortName.substring(shortName.lastIndexOf('\\') + 1);
LightVirtualFile virtualFile = new LightVirtualFile(shortName, KotlinLanguage.INSTANCE, text) {
@@ -909,12 +909,12 @@ public class KotlinTestUtils {
public static void assertAllTestsPresentInSingleGeneratedClass(
@NotNull Class<?> testCaseClass,
@NotNull File testDataDir,
@NotNull final Pattern filenamePattern,
@NotNull final TargetBackend targetBackend
@NotNull Pattern filenamePattern,
@NotNull TargetBackend targetBackend
) {
final File rootFile = new File(getTestsRoot(testCaseClass));
File rootFile = new File(getTestsRoot(testCaseClass));
final Set<String> filePaths = collectPathsMetadata(testCaseClass);
Set<String> filePaths = collectPathsMetadata(testCaseClass);
FileUtil.processFilesRecursively(testDataDir, new Processor<File>() {
@Override
@@ -208,7 +208,7 @@ public abstract class KtUsefulTestCase extends TestCase {
@Override
protected void runTest() throws Throwable {
final Throwable[] throwables = new Throwable[1];
Throwable[] throwables = new Throwable[1];
Runnable runnable = new Runnable() {
@Override