diff --git a/.idea/libraries/commons_cli.xml b/.idea/libraries/commons_cli.xml index 96a297fac8ad..52479bb8b72f 100644 --- a/.idea/libraries/commons_cli.xml +++ b/.idea/libraries/commons_cli.xml @@ -1,9 +1,9 @@ - + - - 69e1237059acd56f0f8654dcde09d8a1412eee82918bef5564d51f8fb275711b + + ef990c7522ed6caa06265e24317f29ce839f7702938e1aebe8187a0bac19c0d7 @@ -11,11 +11,11 @@ - + - + \ No newline at end of file diff --git a/.idea/libraries/commons_codec.xml b/.idea/libraries/commons_codec.xml index 51c3e24e4af9..a54633f14e71 100644 --- a/.idea/libraries/commons_codec.xml +++ b/.idea/libraries/commons_codec.xml @@ -1,18 +1,18 @@ - + - - ec87bfb55f22cbd1b21e2190eeda28b2b312ed2a431ee49fbdcc01812d04a5e4 + + f700de80ac270d0344fdea7468201d8b9c805e5c648331c3619f2ee067ccfc59 - + - + \ No newline at end of file diff --git a/.idea/libraries/commons_compress.xml b/.idea/libraries/commons_compress.xml index 7b1d165c514e..4b09a190b4ae 100644 --- a/.idea/libraries/commons_compress.xml +++ b/.idea/libraries/commons_compress.xml @@ -5,27 +5,19 @@ 27bb5d40f37c3bb7205b4a0540247df057715e9f6cbbd97d626ab8b50318bb04 - - ec87bfb55f22cbd1b21e2190eeda28b2b312ed2a431ee49fbdcc01812d04a5e4 - - - a58af12ee1b68cfd2ebb0c27caef164f084381a00ec81a48cc275fd7ea54e154 - + + - - - - \ No newline at end of file diff --git a/.idea/libraries/commons_text.xml b/.idea/libraries/commons_text.xml index e14c3ede72d6..7228d1a74b76 100644 --- a/.idea/libraries/commons_text.xml +++ b/.idea/libraries/commons_text.xml @@ -1,18 +1,18 @@ - + - - 2acf30a070b19163d5a480eae411a281341e870020e3534c6d5d4c8472739e30 + + de023257ff166044a56bd1aa9124e843cd05dac5806cc705a9311f3556d5a15f - + - + \ No newline at end of file diff --git a/.idea/libraries/grpc_stub.xml b/.idea/libraries/grpc_stub.xml index 62f20518d24d..e9f02fa37292 100644 --- a/.idea/libraries/grpc_stub.xml +++ b/.idea/libraries/grpc_stub.xml @@ -1,18 +1,18 @@ - + - - 72098cc69a1c786b707a697ceb2a82b45c624add09e78900ec4a5990a594f586 + + a92fc7c7f1ac9d580c5e3df5825b977c842f442874794663b78db22b27d649e0 - + - + \ No newline at end of file diff --git a/.idea/libraries/opentelemetry.xml b/.idea/libraries/opentelemetry.xml index 4dfade366462..a7e8a63dd341 100644 --- a/.idea/libraries/opentelemetry.xml +++ b/.idea/libraries/opentelemetry.xml @@ -1,58 +1,53 @@ - + - - e045c5f881a3f40d80ef336ce2e482609a7877109b480a97e755ab7ac711835c + + 937c7cb743dab7aa566949166462493323683c188e2201a66aa6c2c59bf7dc23 - - 829fb1414188d1b7ecccc6d3fb0f42629f76c6b5019f7f219c0ef31d5a7c540f + + 35976d45acb98fb3fb527c3aced3e3398443e8664fccd069ea4bd2eca0c294ed - - 6a11b6639e48515ae78e010292758cbcd2467023b564465aa5a96c1501731464 + + 98071a718fdb48a493460685660ba92074e0dcea01c545109894d3137df3b6f0 - - 9290ccec42fe696ab0dba44d44996fcc3d978dbbb0d8f9f97e3778844a767c69 + + 1f28165898fecdba9ff9534b86a4ac6da2faa731bc0a59f1e40c116b72c90bd7 - - 0c3715deed39924d0d4e67e74e43c25745b77ff27d3e15d548fa8729dab14ab6 + + 5743bc33f9f046a86c8d827e4c4e321c2224ec69f72e09153232148186f2c77b - - 5ca38a9ecdf2c93183069dae1d7d76ec12e9cf4feb3c2209d04566e82fc4df3c + + 50d129d9a15b691f806533f8edaf6c01f2e1e1e1825c93984ad75006aea2522f - - 1032f86dac2d44c1c32459356f6bd6428d89b2d62e369764ae1434665b571e40 + + 037cdd200d917190e6774029676017fa5ec27e5a5af938dcb97adc75132eda48 - - 1ac2e39563669095f2ef0269924c0df3bee76f143b3a577bc0559ca9a273aaab - - - 96872b1ee7527e223e7a387b4bec1649acf9e9a60e21099a020f76f31bfabe5d + + d3490b686b64528ffb0ef345ada0a25af68dba658810ada25e7b127ceb98cf5c - - - - - - - - - + + + + + + + + - - - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/opentelemetry_exporter_otlp_common.xml b/.idea/libraries/opentelemetry_exporter_otlp_common.xml index 426d3d2e41be..624ff314f5fb 100644 --- a/.idea/libraries/opentelemetry_exporter_otlp_common.xml +++ b/.idea/libraries/opentelemetry_exporter_otlp_common.xml @@ -1,27 +1,28 @@ - + - - 8886aa1f49ecfdd21d96c34b99b5e9bd2a1cb9ce3403f3424865a65efbf88109 + + 228c79ae42e6c1eacfbc4b8b142a0c744ee8e2190d6bad076b71b2c53b0ffd89 - - af9cfd976872bbeacbec345141e84a7447c0e2d23384fb6ee002d994d5542eaa + + de5ffe7719483ddf809f64a1f4e3202757840cb9a219340ba9adb73a7cc7554b - + + - - + + - - + + \ No newline at end of file diff --git a/.idea/libraries/opentelemetry_extension_kotlin.xml b/.idea/libraries/opentelemetry_extension_kotlin.xml index b6feb71e7397..18b0bb1a09b9 100644 --- a/.idea/libraries/opentelemetry_extension_kotlin.xml +++ b/.idea/libraries/opentelemetry_extension_kotlin.xml @@ -1,18 +1,18 @@ - + - - def759aa3b01758a72b573ef4f4eb39776d0975b1f60644c6f78ce4ec97e6354 + + d3d0f6410ad1d18c3970e1cb465e740e9f2623b21b749109e1afb4b8fa70af2c - + - + \ No newline at end of file diff --git a/.idea/libraries/opentelemetry_semconv.xml b/.idea/libraries/opentelemetry_semconv.xml index 330254ed3954..e943fd6eeda6 100644 --- a/.idea/libraries/opentelemetry_semconv.xml +++ b/.idea/libraries/opentelemetry_semconv.xml @@ -1,18 +1,18 @@ - + - - ae8cace98274227cd4b04f1dacee9309a88f3208e2e2bd96df7f8d7d57fb7d4d + + 745a86a75ecb5e03f464f05ea2dc76e0f04d07273c5509fa74f393bff9b222b7 - + - + \ No newline at end of file diff --git a/platform/build-scripts/downloader/src/BuildDependenciesJps.kt b/platform/build-scripts/downloader/src/BuildDependenciesJps.kt index 1ae78abcbc5b..25ef854c2441 100644 --- a/platform/build-scripts/downloader/src/BuildDependenciesJps.kt +++ b/platform/build-scripts/downloader/src/BuildDependenciesJps.kt @@ -1,7 +1,9 @@ -// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.intellij.build -import org.apache.commons.codec.digest.DigestUtils +import com.google.common.hash.Funnels +import com.google.common.hash.Hashing +import com.google.common.io.ByteStreams import org.jetbrains.annotations.ApiStatus import org.jetbrains.intellij.build.dependencies.BuildDependenciesCommunityRoot import org.jetbrains.intellij.build.dependencies.BuildDependenciesDownloader @@ -13,8 +15,8 @@ import org.jetbrains.intellij.build.dependencies.BuildDependenciesUtil.getLibrar import org.jetbrains.intellij.build.dependencies.BuildDependenciesUtil.getSingleChildElement import org.jetbrains.intellij.build.dependencies.BuildDependenciesUtil.tryGetSingleChildElement import java.net.URI +import java.nio.file.Files import java.nio.file.Path -import kotlin.io.path.* @ApiStatus.Internal object BuildDependenciesJps { @@ -32,7 +34,7 @@ object BuildDependenciesJps { ?.replace("\$PROJECT_DIR\$", getSystemIndependentPath(projectHome)) ?: error("Unable to find module '$moduleName' in $modulesXml") val modulePath = Path.of(moduleFile) - check(modulePath.exists()) { + check(Files.exists(modulePath)) { "Module file '$modulePath' does not exist" } return modulePath @@ -77,26 +79,30 @@ object BuildDependenciesJps { val localMavenFile = getLocalArtifactRepositoryRoot().resolve(relativePath) val file = when { - localMavenFile.isRegularFile() && localMavenFile.fileSize() > 0 -> localMavenFile + Files.isRegularFile(localMavenFile) && Files.size(localMavenFile) > 0 -> localMavenFile username != null && password != null -> BuildDependenciesDownloader.downloadFileToCacheLocation(communityRoot, URI(remoteUrl), username, password) else -> BuildDependenciesDownloader.downloadFileToCacheLocation(communityRoot, URI(remoteUrl)) } // '-SNAPSHOT' versions could be used only locally to test new locally built dependencies if (!mavenId.endsWith("-SNAPSHOT")) { - val actualSha256checksum = file.inputStream().use { DigestUtils.sha256Hex(it) } + val actualSha256checksum = Files.newInputStream(file).use { + val hasher = Hashing.sha256().newHasher() + ByteStreams.copy(it, Funnels.asOutputStream(hasher)) + hasher.hash().toString() + } val expectedSha256Checksum = sha256sumMap[fileUrl] ?: error("SHA256 checksum is missing for $fileUrl:\n${library.asText}") if (expectedSha256Checksum != actualSha256checksum) { - error("File $file has wrong checksum. On disk: ${actualSha256checksum}. Expected: ${expectedSha256Checksum}. Library:\n${library.asText}") + Files.delete(file) + error("File $file has wrong checksum. On disk: $actualSha256checksum. Expected: $expectedSha256Checksum. Library:\n${library.asText}") } } - file } if (roots.isEmpty()) { - error("No library roots for library '$libraryName' in the following iml file at '$iml':\n${iml.readText()}") + error("No library roots for library '$libraryName' in the following iml file at '$iml':\n${Files.readString(iml)}") } roots diff --git a/platform/jps-bootstrap/pom.xml b/platform/jps-bootstrap/pom.xml index c4c460a71a3f..1616fc4a12e1 100644 --- a/platform/jps-bootstrap/pom.xml +++ b/platform/jps-bootstrap/pom.xml @@ -33,7 +33,7 @@ commons-cli commons-cli - 1.6.0 + 1.7.0 org.apache.commons @@ -68,7 +68,7 @@ io.opentelemetry opentelemetry-extension-kotlin - 1.35.0 + 1.37.0 com.jetbrains.intellij.platform diff --git a/platform/platform-impl/intellij.platform.ide.impl.iml b/platform/platform-impl/intellij.platform.ide.impl.iml index ac1ea0dec8b0..e033cae45196 100644 --- a/platform/platform-impl/intellij.platform.ide.impl.iml +++ b/platform/platform-impl/intellij.platform.ide.impl.iml @@ -139,7 +139,6 @@ - diff --git a/platform/util/intellij.platform.util.iml b/platform/util/intellij.platform.util.iml index caea92f00387..ebf2d9031ed7 100644 --- a/platform/util/intellij.platform.util.iml +++ b/platform/util/intellij.platform.util.iml @@ -32,7 +32,9 @@ - + + + diff --git a/platform/util/src/com/intellij/util/io/DigestUtil.kt b/platform/util/src/com/intellij/util/io/DigestUtil.kt index bc87ea6399e5..c0a74c7aa76e 100644 --- a/platform/util/src/com/intellij/util/io/DigestUtil.kt +++ b/platform/util/src/com/intellij/util/io/DigestUtil.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. @file:Suppress("FunctionName") package com.intellij.util.io @@ -7,11 +7,11 @@ import com.intellij.util.io.DigestUtil.updateContentHash import java.io.IOException import java.io.InputStream import java.math.BigInteger +import java.nio.file.Files import java.nio.file.Path import java.security.MessageDigest import java.security.Provider import java.security.SecureRandom -import kotlin.io.path.inputStream object DigestUtil { @JvmStatic @@ -44,11 +44,14 @@ object DigestUtil { @JvmStatic fun sha1Hex(input: ByteArray): String = hashToHexString(input, sha1()) + @JvmStatic + fun sha1Hex(input: String): String = hashToHexString(input, sha1()) + @JvmStatic @JvmOverloads fun updateContentHash(digest: MessageDigest, file: Path, buffer: ByteArray = ByteArray(512 * 1024)) { try { - file.inputStream().use { + Files.newInputStream(file).use { updateContentHash(digest, it, buffer) } } @@ -79,7 +82,7 @@ fun sha256Hex(file: Path): String { try { val digest = cloneDigest(sha2_256) val buffer = ByteArray(512 * 1024) - file.inputStream().use { + Files.newInputStream(file).use { updateContentHash(digest, it, buffer) } return bytesToHex(digest.digest()) diff --git a/platform/vcs-impl/intellij.platform.vcs.impl.iml b/platform/vcs-impl/intellij.platform.vcs.impl.iml index 5e7098fcc58d..fc1ad2c62a28 100644 --- a/platform/vcs-impl/intellij.platform.vcs.impl.iml +++ b/platform/vcs-impl/intellij.platform.vcs.impl.iml @@ -35,7 +35,6 @@ - diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CachesHolder.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CachesHolder.java index dbe0b75eb5db..8979aff6b6f8 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CachesHolder.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CachesHolder.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.vcs.changes.committed; import com.intellij.openapi.application.PathManager; @@ -10,25 +10,27 @@ import com.intellij.openapi.vcs.RepositoryLocation; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.CommonProcessors.CollectProcessor; import com.intellij.util.Processor; +import com.intellij.util.io.DigestUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.io.File; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.Collection; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import static com.intellij.util.containers.ContainerUtil.find; -import static org.apache.commons.codec.digest.DigestUtils.md5Hex; +import static com.intellij.util.io.DigestUtilKt.hashToHexString; -public class CachesHolder { +public final class CachesHolder { @NonNls private static final String VCS_CACHE_PATH = "vcsCache"; private final @NotNull Project myProject; - private final @NotNull Map myCacheFiles = new ConcurrentHashMap<>(); + private final @NotNull Map cacheFiles = new ConcurrentHashMap<>(); private final @NotNull RepositoryLocationCache myLocationCache; public CachesHolder(@NotNull Project project, @NotNull RepositoryLocationCache locationCache) { @@ -37,7 +39,7 @@ public class CachesHolder { } /** - * Returns all paths that will be used to collect committed changes about. ideally, for one checkout there should be one file + * Returns all paths that will be used to collect committed changes about. Ideally, for one checkout, there should be one file */ public @NotNull Map getAllRootsUnderVcs(@NotNull AbstractVcs vcs) { return new RootsCalculator(myProject, vcs, myLocationCache).getRoots(); @@ -57,11 +59,11 @@ public class CachesHolder { } public void reset() { - myCacheFiles.clear(); + cacheFiles.clear(); } public void clearAllCaches() { - myCacheFiles.values().forEach(ChangesCacheFile::delete); + cacheFiles.values().forEach(ChangesCacheFile::delete); reset(); } @@ -72,28 +74,32 @@ public class CachesHolder { } public @NotNull ChangesCacheFile getCacheFile(@NotNull AbstractVcs vcs, @NotNull VirtualFile root, @NotNull RepositoryLocation location) { - return myCacheFiles + return cacheFiles .computeIfAbsent(location.getKey(), key -> new ChangesCacheFile(myProject, getCachePath(location), vcs, root, location)); } public @NotNull Path getCacheBasePath() { - return Paths.get(PathManager.getSystemPath(), VCS_CACHE_PATH, myProject.getLocationHash()); + return Path.of(PathManager.getSystemPath(), VCS_CACHE_PATH, myProject.getLocationHash()); } - private @NotNull File getCachePath(@NotNull RepositoryLocation location) { - File file = getCacheBasePath().toFile(); - file.mkdirs(); - return new File(file, md5Hex(location.getKey())); + private @NotNull Path getCachePath(@NotNull RepositoryLocation location) { + Path file = getCacheBasePath(); + try { + Files.createDirectories(file); + } + catch (IOException e) { + throw new UncheckedIOException(e); + } + return file.resolve(hashToHexString(location.getKey(), DigestUtil.md5())); } public @Nullable ChangesCacheFile haveCache(@NotNull RepositoryLocation location) { String key = location.getKey(); - ChangesCacheFile result = myCacheFiles.get(key); - + ChangesCacheFile result = cacheFiles.get(key); if (result == null) { String keyWithSlash = key.endsWith("/") ? key : key + "/"; - String cachedSimilarKey = find(myCacheFiles.keySet(), s -> keyWithSlash.startsWith(s) || s.startsWith(keyWithSlash)); - result = cachedSimilarKey != null ? myCacheFiles.get(cachedSimilarKey) : null; + String cachedSimilarKey = find(cacheFiles.keySet(), s -> keyWithSlash.startsWith(s) || s.startsWith(keyWithSlash)); + result = cachedSimilarKey != null ? cacheFiles.get(cachedSimilarKey) : null; } return result; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangesCacheFile.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangesCacheFile.java index 5ca361c0562d..dfb3764c8a08 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangesCacheFile.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangesCacheFile.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.vcs.changes.committed; import com.google.common.base.Stopwatch; @@ -24,16 +24,17 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.*; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.*; import static com.intellij.openapi.vcs.changes.committed.IncomingChangeState.State.*; - -public class ChangesCacheFile { +public final class ChangesCacheFile { private static final Logger LOG = Logger.getInstance(ChangesCacheFile.class); private static final int VERSION = 7; - private final File myPath; + private final Path file; private final File myIndexPath; private RandomAccessFile myStream; private RandomAccessFile myIndexStream; @@ -55,12 +56,12 @@ public class ChangesCacheFile { private static final int INDEX_ENTRY_SIZE = 3*8+2; private static final int HEADER_SIZE = 46; - public ChangesCacheFile(Project project, File path, AbstractVcs vcs, VirtualFile root, @NotNull RepositoryLocation location) { + public ChangesCacheFile(Project project, Path path, AbstractVcs vcs, VirtualFile root, @NotNull RepositoryLocation location) { reset(); myProject = project; - myPath = path; - myIndexPath = new File(myPath.toString() + INDEX_EXTENSION); + file = path; + myIndexPath = new File(file.toString() + INDEX_EXTENSION); myVcs = vcs; myChangesProvider = (CachingCommittedChangesProvider)vcs.getCommittedChangesProvider(); myVcsManager = ProjectLevelVcsManager.getInstance(project); @@ -91,14 +92,15 @@ public class ChangesCacheFile { } public boolean isEmpty() throws IOException { - if (!myPath.exists()) { + if (!Files.exists(file)) { return true; } + try { loadHeader(); } catch(VersionMismatchException | EOFException ex) { - myPath.delete(); + Files.deleteIfExists(file); myIndexPath.delete(); return true; } @@ -107,7 +109,13 @@ public class ChangesCacheFile { } public void delete() { - FileUtil.delete(myPath); + try { + Files.deleteIfExists(file); + } + catch (IOException e) { + LOG.debug(e); + } + FileUtil.delete(myIndexPath); try { closeStreams(); @@ -195,7 +203,7 @@ public class ChangesCacheFile { } private void openStreams() throws FileNotFoundException { - myStream = new RandomAccessFile(myPath, "rw"); + myStream = new RandomAccessFile(file.toFile(), "rw"); myIndexStream = new RandomAccessFile(myIndexPath, "rw"); myStreamsOpen = true; } @@ -299,7 +307,7 @@ public class ChangesCacheFile { private void loadHeader() throws IOException { if (!myHeaderLoaded) { - try (RandomAccessFile stream = new RandomAccessFile(myPath, "r")) { + try (RandomAccessFile stream = new RandomAccessFile(file.toFile(), "r")) { int version = stream.readInt(); if (version != VERSION) { throw new VersionMismatchException(); @@ -509,7 +517,7 @@ public class ChangesCacheFile { } if (!entries [0].completelyDownloaded) { IncomingChangeListData data = readIncomingChangeListData(offset, entries [0]); - if (data.accountedChanges.size() == 0) { + if (data.accountedChanges.isEmpty()) { result.add(data.changeList); } else { @@ -572,7 +580,7 @@ public class ChangesCacheFile { } } - private boolean processGroup(final FileGroup group, final List incomingData, + private boolean processGroup(final FileGroup group, final List incomingData, final ReceivedChangeListTracker tracker) { boolean haveUnaccountedUpdatedFiles = false; final List> list = group.getFilesAndRevisions(myVcsManager); @@ -597,7 +605,7 @@ public class ChangesCacheFile { private static boolean processFile(final FilePath path, final VcsRevisionNumber number, - final List incomingData, + final List incomingData, final ReceivedChangeListTracker tracker) { boolean foundRevision = false; debug("Processing updated file " + path + ", revision " + number); @@ -621,7 +629,7 @@ public class ChangesCacheFile { } private static boolean processDeletedFile(final FilePath path, - final List incomingData, + final List incomingData, final ReceivedChangeListTracker tracker) { boolean foundRevision = false; for(IncomingChangeListData data: incomingData) { @@ -738,7 +746,7 @@ public class ChangesCacheFile { @NonNls private File getPartialPath(final long offset) { - return new File(myPath + "." + offset + ".partial"); + return new File(file + "." + offset + ".partial"); } public boolean refreshIncomingChanges() throws IOException, VcsException { @@ -758,7 +766,7 @@ public class ChangesCacheFile { return myRootPath; } - private static class RefreshIncomingChangesOperation { + private static final class RefreshIncomingChangesOperation { private final Set myDeletedFiles = new HashSet<>(); private final Set myCreatedFiles = new HashSet<>(); private final Set myReplacedFiles = new HashSet<>(); @@ -812,7 +820,7 @@ public class ChangesCacheFile { return myAnyChanges; } - private boolean refreshIncomingInFile(Collection incomingFiles, List list) throws IOException { + private boolean refreshIncomingInFile(Collection incomingFiles, List list) throws IOException { // the incoming changelist pointers are actually sorted in reverse chronological order, // so we process file delete changes before changes made to deleted files before they were deleted @@ -1116,14 +1124,14 @@ public class ChangesCacheFile { } } - private static class IndexEntry { + private static final class IndexEntry { long number; long date; long offset; boolean completelyDownloaded; } - private static class IncomingChangeListData { + private static final class IncomingChangeListData { public long indexOffset; public IndexEntry indexEntry; public CommittedChangeList changeList; @@ -1136,10 +1144,10 @@ public class ChangesCacheFile { private static final IndexEntry[] NO_ENTRIES = new IndexEntry[0]; - private static class VersionMismatchException extends RuntimeException { + private static final class VersionMismatchException extends RuntimeException { } - private static class ReceivedChangeListTracker { + private static final class ReceivedChangeListTracker { private final Map myMap = new HashMap<>(); public void addChange(CommittedChangeList changeList, Change change) { diff --git a/plugins/evaluation-plugin/core/intellij.evaluationPlugin.core.iml b/plugins/evaluation-plugin/core/intellij.evaluationPlugin.core.iml index ca8fcee3a133..4bd88fd131be 100644 --- a/plugins/evaluation-plugin/core/intellij.evaluationPlugin.core.iml +++ b/plugins/evaluation-plugin/core/intellij.evaluationPlugin.core.iml @@ -10,7 +10,6 @@ - diff --git a/plugins/evaluation-plugin/core/src/com/intellij/cce/report/BaseCompletionGolfFileReportGenerator.kt b/plugins/evaluation-plugin/core/src/com/intellij/cce/report/BaseCompletionGolfFileReportGenerator.kt index f5ade8e5dc22..b7f26f2f23c4 100644 --- a/plugins/evaluation-plugin/core/src/com/intellij/cce/report/BaseCompletionGolfFileReportGenerator.kt +++ b/plugins/evaluation-plugin/core/src/com/intellij/cce/report/BaseCompletionGolfFileReportGenerator.kt @@ -104,7 +104,7 @@ abstract class BaseCompletionGolfFileReportGenerator( span(statsClass) { button(classes = "stats-value") { onClick = "invertRows(event, '$statsClass')" - +((it.value * 100).format() + "%") + +(formatDouble((it.value * 100)) + "%") } } } diff --git a/plugins/evaluation-plugin/core/src/com/intellij/cce/report/CompletionGolfFileReportGenerator.kt b/plugins/evaluation-plugin/core/src/com/intellij/cce/report/CompletionGolfFileReportGenerator.kt index be439a851e18..8aa5541b2baf 100644 --- a/plugins/evaluation-plugin/core/src/com/intellij/cce/report/CompletionGolfFileReportGenerator.kt +++ b/plugins/evaluation-plugin/core/src/com/intellij/cce/report/CompletionGolfFileReportGenerator.kt @@ -26,9 +26,9 @@ class CompletionGolfFileReportGenerator( val totalLatency = TotalLatencyMetric().evaluate(listOf(session)) val info = mutableListOf().apply { - add("${(movesCountNormalised * 100).format()}%".padEnd(4, ' ')) + add("${formatDouble((movesCountNormalised * 100))}%".padEnd(4, ' ')) add("$movesCount act") - add("${(totalLatency / 1000).format()}s".padEnd(4, ' ')) + add("${formatDouble((totalLatency / 1000))}s".padEnd(4, ' ')) } return info diff --git a/plugins/evaluation-plugin/core/src/com/intellij/cce/report/FileReportGenerator.kt b/plugins/evaluation-plugin/core/src/com/intellij/cce/report/FileReportGenerator.kt index 1d68e8144738..5826ebe7b06f 100644 --- a/plugins/evaluation-plugin/core/src/com/intellij/cce/report/FileReportGenerator.kt +++ b/plugins/evaluation-plugin/core/src/com/intellij/cce/report/FileReportGenerator.kt @@ -6,13 +6,13 @@ import com.intellij.cce.workspace.info.FileEvaluationInfo import com.intellij.cce.workspace.storages.FeaturesStorage import kotlinx.html.* import kotlinx.html.stream.createHTML -import org.apache.commons.codec.binary.Base64OutputStream import java.io.ByteArrayOutputStream import java.io.File import java.io.FileWriter import java.io.OutputStreamWriter import java.nio.file.Path import java.text.DecimalFormat +import java.util.* import java.util.zip.GZIPOutputStream abstract class FileReportGenerator( @@ -86,15 +86,13 @@ abstract class FileReportGenerator( protected fun zipJson(json: String): String { val resultStream = ByteArrayOutputStream() - OutputStreamWriter(GZIPOutputStream(Base64OutputStream(resultStream))).use { + OutputStreamWriter(GZIPOutputStream(Base64.getEncoder().wrap(resultStream))).use { it.write(json) } return resultStream.toString() } - protected fun Double.format() = DecimalFormat("0.##").format(this) - - companion object { - private val sessionSerializer = SessionSerializer() - } + protected fun formatDouble(d: Double): String = DecimalFormat("0.##").format(d) } + +private val sessionSerializer = SessionSerializer() diff --git a/plugins/evaluation-plugin/core/src/com/intellij/cce/report/LineCompletionFileReportGenerator.kt b/plugins/evaluation-plugin/core/src/com/intellij/cce/report/LineCompletionFileReportGenerator.kt index 08a9b45ac4b3..a20314d65ac9 100644 --- a/plugins/evaluation-plugin/core/src/com/intellij/cce/report/LineCompletionFileReportGenerator.kt +++ b/plugins/evaluation-plugin/core/src/com/intellij/cce/report/LineCompletionFileReportGenerator.kt @@ -25,9 +25,9 @@ class LineCompletionFileReportGenerator( val totalLatency = TotalLatencyMetric().evaluate(listOf(session)) val info = mutableListOf().apply { - add("${(matchedRatio * 100).format()}%".padEnd(4, ' ')) - add("${(similarity * 100).format()}%".padEnd(4, ' ')) - add("${(totalLatency / 1000).format()}s".padEnd(4, ' ')) + add("${formatDouble((matchedRatio * 100))}%".padEnd(4, ' ')) + add("${formatDouble((similarity * 100))}%".padEnd(4, ' ')) + add("${formatDouble((totalLatency / 1000))}s".padEnd(4, ' ')) } return info diff --git a/plugins/evaluation-plugin/core/src/com/intellij/cce/report/MultiLineFileReportGenerator.kt b/plugins/evaluation-plugin/core/src/com/intellij/cce/report/MultiLineFileReportGenerator.kt index 5a1d24d54170..970399b54328 100644 --- a/plugins/evaluation-plugin/core/src/com/intellij/cce/report/MultiLineFileReportGenerator.kt +++ b/plugins/evaluation-plugin/core/src/com/intellij/cce/report/MultiLineFileReportGenerator.kt @@ -39,7 +39,7 @@ class MultiLineFileReportGenerator( listOf( "${(evaluate(CharFScore()) * 100).roundToInt()}%", "${(evaluate(EditSimilarity()) * 100).roundToInt()}%", - "${(evaluate(TotalLatencyMetric()) / 1000).format()}s" + "${formatDouble((evaluate(TotalLatencyMetric()) / 1000))}s" ).joinToString(" ", transform = { it.padEnd(4) }) to color() } diff --git a/plugins/git4idea/intellij.vcs.git.iml b/plugins/git4idea/intellij.vcs.git.iml index e7f6b371be89..e004e5e83b71 100644 --- a/plugins/git4idea/intellij.vcs.git.iml +++ b/plugins/git4idea/intellij.vcs.git.iml @@ -15,9 +15,7 @@ - - $KOTLIN_BUNDLED$/lib/kotlinx-serialization-compiler-plugin.jar - + $KOTLIN_BUNDLED$/lib/kotlinx-serialization-compiler-plugin.jar @@ -64,7 +62,6 @@ - diff --git a/plugins/git4idea/tests/git4idea/history/GitLogParserTest.kt b/plugins/git4idea/tests/git4idea/history/GitLogParserTest.kt index 8a8796a378e0..e618f7e4d52a 100644 --- a/plugins/git4idea/tests/git4idea/history/GitLogParserTest.kt +++ b/plugins/git4idea/tests/git4idea/history/GitLogParserTest.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package git4idea.history import com.intellij.openapi.util.io.FileUtil @@ -6,13 +6,13 @@ import com.intellij.openapi.util.text.StringUtil import com.intellij.openapi.vcs.VcsException import com.intellij.openapi.vcs.changes.Change import com.intellij.testFramework.UsefulTestCase +import com.intellij.util.io.DigestUtil import git4idea.history.GitLogParser.* import git4idea.history.GitLogParser.GitLogOption.* import git4idea.history.GitLogParser.NameStatus.NONE import git4idea.history.GitLogParser.NameStatus.STATUS import git4idea.test.GitPlatformTest import junit.framework.TestCase -import org.apache.commons.codec.digest.DigestUtils import java.io.File import java.util.* @@ -350,7 +350,7 @@ private fun createTestRecord(vararg parameters: Pair, Pair(COMMITTER_NAME, "John Doe"), Pair(COMMITTER_EMAIL, "John.Doe@example.com")) parameters.associateTo(data) { it } - data[HASH] = DigestUtils.sha1Hex(data.toString()) + data[HASH] = DigestUtil.sha1Hex(data.toString()) return GitTestLogRecord(data, changes, newRefsFormat) } diff --git a/plugins/markdown/core/intellij.markdown.iml b/plugins/markdown/core/intellij.markdown.iml index 6eb3c3a44cae..2839d1456a9a 100644 --- a/plugins/markdown/core/intellij.markdown.iml +++ b/plugins/markdown/core/intellij.markdown.iml @@ -32,7 +32,6 @@ - diff --git a/plugins/maven/maven-server-telemetry/src/com/intellij/maven/server/telemetry/MavenServerTelemetryClasspathUtil.java b/plugins/maven/maven-server-telemetry/src/com/intellij/maven/server/telemetry/MavenServerTelemetryClasspathUtil.java index e5baa99039f3..a1d62309dc15 100644 --- a/plugins/maven/maven-server-telemetry/src/com/intellij/maven/server/telemetry/MavenServerTelemetryClasspathUtil.java +++ b/plugins/maven/maven-server-telemetry/src/com/intellij/maven/server/telemetry/MavenServerTelemetryClasspathUtil.java @@ -6,7 +6,6 @@ import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.context.propagation.TextMapPropagator; import io.opentelemetry.exporter.internal.marshal.MarshalerWithSize; import io.opentelemetry.exporter.internal.otlp.traces.TraceRequestMarshaler; -import io.opentelemetry.extension.incubator.trace.ExtendedSpan; import io.opentelemetry.sdk.OpenTelemetrySdk; import io.opentelemetry.sdk.common.Clock; import io.opentelemetry.sdk.logs.SdkLoggerProvider; @@ -19,7 +18,6 @@ import java.util.Collection; public final class MavenServerTelemetryClasspathUtil { public static final Collection> TELEMETRY_CLASSES = Arrays.asList( SpanExporter.class, - ExtendedSpan.class, TextMapPropagator.class, OpenTelemetry.class, OpenTelemetrySdk.class,