diff --git a/java/java-tests/testSrc/com/intellij/java/run/JavaPathMacroCollectorTest.java b/java/java-tests/testSrc/com/intellij/java/run/JavaPathMacroCollectorTest.java index 5168b62fa083..a1d2592e9402 100644 --- a/java/java-tests/testSrc/com/intellij/java/run/JavaPathMacroCollectorTest.java +++ b/java/java-tests/testSrc/com/intellij/java/run/JavaPathMacroCollectorTest.java @@ -44,6 +44,6 @@ public class JavaPathMacroCollectorTest extends LightJavaCodeInsightFixtureTestC """; - assertTrue(PathMacrosCollector.getMacroNames(JDOMUtil.load(text)).isEmpty()); + assertTrue(PathMacrosCollector.Companion.getMacroNames(JDOMUtil.load(text)).isEmpty()); } } diff --git a/platform/platform-tests/testSrc/com/intellij/run/PathMacrosCollectorTest.java b/platform/platform-tests/testSrc/com/intellij/run/PathMacrosCollectorTest.java index 930816c53e88..109ae8c61523 100644 --- a/platform/platform-tests/testSrc/com/intellij/run/PathMacrosCollectorTest.java +++ b/platform/platform-tests/testSrc/com/intellij/run/PathMacrosCollectorTest.java @@ -13,9 +13,6 @@ import org.jetbrains.annotations.NotNull; import java.util.Set; -/** - * @author Eugene Zhuravlev - */ public class PathMacrosCollectorTest extends UsefulTestCase { @Override protected void setUp() throws Exception { @@ -37,7 +34,7 @@ public class PathMacrosCollectorTest extends UsefulTestCase { root.addContent(new Text("$Revision 1.23$")); root.addContent(new Text("file://$root$/some/path/just$file$name.txt")); - final Set macros = PathMacrosCollector.getMacroNames(root, null, new PathMacrosImpl(false)); + final Set macros = PathMacrosCollector.Companion.getMacroNames(root, null, new PathMacrosImpl(false)); UsefulTestCase.assertSameElements(macros, "MACro1", "macro4", "mac_ro6", "macr.o7", "mac-ro8", "root"); } @@ -48,7 +45,7 @@ public class PathMacrosCollectorTest extends UsefulTestCase { configuration.setAttribute("value2", "file://$root$/some/path/just$file$name.txt"); root.addContent(configuration); - final Set macros = PathMacrosCollector.getMacroNames(root, new PathMacroFilter() { + final Set macros = PathMacrosCollector.Companion.getMacroNames(root, new PathMacroFilter() { @Override public boolean recursePathMacros(@NotNull Attribute attribute) { return "value".equals(attribute.getName()); @@ -64,12 +61,12 @@ public class PathMacrosCollectorTest extends UsefulTestCase { testTag.setAttribute("ignore", "$PATH$"); root.addContent(testTag); - final Set macros = PathMacrosCollector.getMacroNames(root, null, new PathMacrosImpl(false)); + final Set macros = PathMacrosCollector.Companion.getMacroNames(root, null, new PathMacrosImpl(false)); assertEquals(2, macros.size()); assertTrue(macros.contains("MACRO")); assertTrue(macros.contains("PATH")); - final Set filtered = PathMacrosCollector.getMacroNames(root, new PathMacroFilter() { + final Set filtered = PathMacrosCollector.Companion.getMacroNames(root, new PathMacroFilter() { @Override public boolean skipPathMacros(@NotNull Attribute attribute) { return "ignore".equals(attribute.getName()); diff --git a/platform/projectModel-impl/api-dump.txt b/platform/projectModel-impl/api-dump.txt index 41f31c85a7fc..b29b4e3a68f6 100644 --- a/platform/projectModel-impl/api-dump.txt +++ b/platform/projectModel-impl/api-dump.txt @@ -4,12 +4,15 @@ f:com.intellij.application.options.PathMacroExpandableProtocolBean - ():V f:com.intellij.application.options.PathMacrosCollector - com.intellij.openapi.components.PathMacroMap +- sf:Companion:com.intellij.application.options.PathMacrosCollector$Companion - sf:MACRO_FILTER_EXTENSION_POINT_NAME:com.intellij.openapi.extensions.ExtensionPointName - sf:MACRO_PATTERN:java.util.regex.Pattern -- s:getMacroNames(org.jdom.Element):java.util.Set +- equals(java.lang.Object):Z - hashCode():I - substitute(java.lang.String,Z):java.lang.String - substituteRecursively(java.lang.String,Z):java.lang.CharSequence +f:com.intellij.application.options.PathMacrosCollector$Companion +- f:getMacroNames(org.jdom.Element):java.util.Set f:com.intellij.application.options.ReplacePathToMacroMap - com.intellij.openapi.components.PathMacroMap - ():V diff --git a/platform/projectModel-impl/src/com/intellij/openapi/components/TrackingPathMacroSubstitutor.kt b/platform/projectModel-impl/src/com/intellij/openapi/components/TrackingPathMacroSubstitutor.kt index 7c2eb52dbf1a..3ab7245c52f7 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/components/TrackingPathMacroSubstitutor.kt +++ b/platform/projectModel-impl/src/com/intellij/openapi/components/TrackingPathMacroSubstitutor.kt @@ -1,39 +1,17 @@ -/* - * Copyright 2000-2015 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. - */ -package com.intellij.openapi.components; +// 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.openapi.components -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.ApiStatus.Internal -import java.util.Collection; -import java.util.Set; +@Internal +interface TrackingPathMacroSubstitutor : PathMacroSubstitutor { + fun getUnknownMacros(componentName: String?): Set -@ApiStatus.Internal -public interface TrackingPathMacroSubstitutor extends PathMacroSubstitutor { - @NotNull - Set getUnknownMacros(@Nullable String componentName); + fun getComponents(macros: Collection): Set - // Mutable set - @NotNull - Set getComponents(@NotNull Collection macros); + fun addUnknownMacros(componentName: String, unknownMacros: Collection) - void addUnknownMacros(@NotNull String componentName, @NotNull Collection unknownMacros); + fun invalidateUnknownMacros(macros: Set) - void invalidateUnknownMacros(@NotNull Set macros); - - void reset(); + fun reset() } diff --git a/platform/projectModel-impl/src/com/intellij/openapi/components/impl/stores/ComponentStorageUtil.kt b/platform/projectModel-impl/src/com/intellij/openapi/components/impl/stores/ComponentStorageUtil.kt index 1fb6f800b597..fe062d14b6d1 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/components/impl/stores/ComponentStorageUtil.kt +++ b/platform/projectModel-impl/src/com/intellij/openapi/components/impl/stores/ComponentStorageUtil.kt @@ -32,9 +32,7 @@ object ComponentStorageUtil { pathMacroSubstitutor?.expandPaths(rootElement) var children = rootElement.getChildren(COMPONENT) - if (children.isEmpty() && - rootElement.name == COMPONENT && - rootElement.getAttributeValue(NAME) != null) { + if (children.isEmpty() && rootElement.name == COMPONENT && rootElement.getAttributeValue(NAME) != null) { // must be modifiable children = SmartList(rootElement) }