From f59aea76659a1fca7ab4545ba26324fbfdbea8e5 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Mon, 13 Jan 2025 16:19:43 +0100 Subject: [PATCH] cleanup GitOrigin-RevId: bc781d49df8bed069005e6763f9d664b4add174e --- .../compiler/CompilerManagerImpl.java | 4 ++-- .../org/jetbrains/jps/javac/JavacMain.java | 4 ++-- .../jps/builders/BuildOutputConsumer.java | 23 ++++--------------- .../jps/incremental/CompiledClass.java | 22 ++++++++++++------ .../IjentBuildScriptsConstants.kt | 13 ++++++----- .../src/run/DevKitApplicationPatcher.kt | 2 +- 6 files changed, 32 insertions(+), 36 deletions(-) diff --git a/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java b/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java index 4ea9d5c1bfaf..9bd9f6765c66 100644 --- a/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java +++ b/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java @@ -1,4 +1,4 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.compiler; import com.intellij.compiler.impl.*; @@ -541,7 +541,7 @@ public class CompilerManagerImpl extends CompilerManager { return projectBuildDir; } - private static class CompiledClass implements ClassObject { + private static final class CompiledClass implements ClassObject { private final String myPath; private final String myClassName; private final byte[] myBytes; diff --git a/jps/jps-builders-6/src/org/jetbrains/jps/javac/JavacMain.java b/jps/jps-builders-6/src/org/jetbrains/jps/javac/JavacMain.java index 2c914a9e2925..db989002e670 100644 --- a/jps/jps-builders-6/src/org/jetbrains/jps/javac/JavacMain.java +++ b/jps/jps-builders-6/src/org/jetbrains/jps/javac/JavacMain.java @@ -1,4 +1,4 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.jps.javac; import org.jetbrains.annotations.ApiStatus; @@ -586,7 +586,7 @@ public final class JavacMain { } } - private static class ContextImpl implements JpsJavacFileManager.Context { + private static final class ContextImpl implements JpsJavacFileManager.Context { private final StandardJavaFileManager myStdManager; private final DiagnosticOutputConsumer myOutConsumer; private final OutputFileConsumer myOutputFileSink; diff --git a/jps/jps-builders/src/org/jetbrains/jps/builders/BuildOutputConsumer.java b/jps/jps-builders/src/org/jetbrains/jps/builders/BuildOutputConsumer.java index e3c2d7bea1ae..40afc7e8de25 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/builders/BuildOutputConsumer.java +++ b/jps/jps-builders/src/org/jetbrains/jps/builders/BuildOutputConsumer.java @@ -1,21 +1,8 @@ -/* - * Copyright 2000-2012 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.jps.builders; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Unmodifiable; import java.io.File; import java.io.IOException; @@ -24,18 +11,18 @@ import java.util.Collection; /** * Use methods of this interface to register files produced by a builder in the build system. This will allow other builders to process * generated files and also update the source-to-output mapping. The build system deletes output files corresponding to changed or deleted - * source files before the next build starts. Also all output files registered in the mapping are cleared on forced recompilation (rebuild). + * source files before the next build starts. Also, all output files registered in the mapping are cleared on forced recompilation (rebuild). */ public interface BuildOutputConsumer { /** * Notifies the build system that {@code outputFile} was produced from {@code sourcePaths}. */ - void registerOutputFile(@NotNull File outputFile, @NotNull Collection sourcePaths) throws IOException; + void registerOutputFile(@NotNull File outputFile, @NotNull @Unmodifiable Collection<@NotNull String> sourcePaths) throws IOException; /** * Notifies the build system that the entire contents of {@code outputDir} was produced from {@code sourcePaths}. Note that * if one of {@code sourcePaths} changes after the build is finished the {@code outputDir} will be deleted completely before * the next build starts so don't use this method if {@code outputDir} contains source files or files produced by other builders. */ - void registerOutputDirectory(@NotNull File outputDir, @NotNull Collection sourcePaths) throws IOException; + void registerOutputDirectory(@NotNull File outputDir, @NotNull @Unmodifiable Collection<@NotNull String> sourcePaths) throws IOException; } diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/CompiledClass.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/CompiledClass.java index 7639166b04d0..341e6ec9385b 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/incremental/CompiledClass.java +++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/CompiledClass.java @@ -5,7 +5,6 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.UserDataHolderBase; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtilRt; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Unmodifiable; @@ -13,6 +12,7 @@ import org.jetbrains.jps.builders.BuildTarget; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -26,7 +26,7 @@ public class CompiledClass extends UserDataHolderBase{ private static final Logger LOG = Logger.getInstance(CompiledClass.class); private final @NotNull File myOutputFile; - private final @NotNull Collection mySourceFiles; + private final @NotNull Collection sourceFiles; private final @Nullable String myClassName; private @NotNull BinaryContent myContent; @@ -40,10 +40,10 @@ public class CompiledClass extends UserDataHolderBase{ */ public CompiledClass(@NotNull File outputFile, @NotNull Collection sourceFiles, @Nullable String className, @NotNull BinaryContent content) { myOutputFile = outputFile; - mySourceFiles = sourceFiles; + this.sourceFiles = sourceFiles; myClassName = className; myContent = content; - LOG.assertTrue(!mySourceFiles.isEmpty()); + LOG.assertTrue(!this.sourceFiles.isEmpty()); } public CompiledClass(@NotNull File outputFile, @NotNull File sourceFile, @Nullable String className, @NotNull BinaryContent content) { @@ -60,11 +60,19 @@ public class CompiledClass extends UserDataHolderBase{ } public @NotNull Collection getSourceFiles() { - return mySourceFiles; + return sourceFiles; } public @Unmodifiable @NotNull List getSourceFilesPaths() { - return ContainerUtil.map(mySourceFiles, file -> file.getPath()); + if (sourceFiles.isEmpty()) { + return List.of(); + } + + List result = new ArrayList<>(sourceFiles.size()); + for (File t : sourceFiles) { + result.add(t.getPath()); + } + return result; } public @Nullable String getClassName() { @@ -108,7 +116,7 @@ public class CompiledClass extends UserDataHolderBase{ public String toString() { return "CompiledClass{" + "myOutputFile=" + myOutputFile + - ", mySourceFiles=" + mySourceFiles + + ", mySourceFiles=" + sourceFiles + ", myIsDirty=" + myIsDirty + '}'; } diff --git a/platform/ijent/buildConstants/src/com/intellij/platform/ijent/community/buildConstants/IjentBuildScriptsConstants.kt b/platform/ijent/buildConstants/src/com/intellij/platform/ijent/community/buildConstants/IjentBuildScriptsConstants.kt index e0fdd9f2a5cb..7e23ef8824c5 100644 --- a/platform/ijent/buildConstants/src/com/intellij/platform/ijent/community/buildConstants/IjentBuildScriptsConstants.kt +++ b/platform/ijent/buildConstants/src/com/intellij/platform/ijent/community/buildConstants/IjentBuildScriptsConstants.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.platform.ijent.community.buildConstants /** @@ -9,8 +9,9 @@ package com.intellij.platform.ijent.community.buildConstants * `component>names>script` in `ApplicationInfo.xml`, * `com.intellij.testFramework.common.PlatformPrefix.PREFIX_CANDIDATES`. */ -fun isIjentWslFsEnabledByDefaultForProduct(platformPrefix: String?): Boolean = - platformPrefix !in IJENT_DISABLED_BY_DEFAULT_IN +fun isIjentWslFsEnabledByDefaultForProduct(platformPrefix: String?): Boolean { + return platformPrefix !in IJENT_DISABLED_BY_DEFAULT_IN +} /** * In case of problems in a particular IDE and inability to fix them quickly, add the platform prefix here. @@ -21,11 +22,11 @@ private val IJENT_DISABLED_BY_DEFAULT_IN: Collection = listOf( "Gateway", ) -const val IJENT_BOOT_CLASSPATH_MODULE = "intellij.platform.core.nio.fs" +const val IJENT_BOOT_CLASSPATH_MODULE: String = "intellij.platform.core.nio.fs" -const val IJENT_WSL_FILE_SYSTEM_REGISTRY_KEY = "wsl.use.remote.agent.for.nio.filesystem" +const val IJENT_WSL_FILE_SYSTEM_REGISTRY_KEY: String = "wsl.use.remote.agent.for.nio.filesystem" -const val IJENT_REQUIRED_DEFAULT_NIO_FS_PROVIDER_CLASS = "com.intellij.platform.core.nio.fs.MultiRoutingFileSystemProvider" +const val IJENT_REQUIRED_DEFAULT_NIO_FS_PROVIDER_CLASS: String = "com.intellij.platform.core.nio.fs.MultiRoutingFileSystemProvider" val MULTI_ROUTING_FILE_SYSTEM_VMOPTIONS: List = listOf( "-Djava.nio.file.spi.DefaultFileSystemProvider=$IJENT_REQUIRED_DEFAULT_NIO_FS_PROVIDER_CLASS", diff --git a/plugins/devkit/devkit-core/src/run/DevKitApplicationPatcher.kt b/plugins/devkit/devkit-core/src/run/DevKitApplicationPatcher.kt index 81fcbd4e4334..3a5d0ef48c18 100644 --- a/plugins/devkit/devkit-core/src/run/DevKitApplicationPatcher.kt +++ b/plugins/devkit/devkit-core/src/run/DevKitApplicationPatcher.kt @@ -33,7 +33,7 @@ import java.nio.file.Path import kotlin.io.path.invariantSeparatorsPathString @Suppress("SpellCheckingInspection") -internal class DevKitApplicationPatcher : RunConfigurationExtension() { +private class DevKitApplicationPatcher : RunConfigurationExtension() { override fun > updateJavaParameters( configuration: T, javaParameters: JavaParameters,