diff --git a/plugins/maven/maven-server-api/src/org/jetbrains/idea/maven/model/MavenArtifactNode.java b/plugins/maven/maven-server-api/src/org/jetbrains/idea/maven/model/MavenArtifactNode.java index 38758d6ee611..6f9108ccac96 100644 --- a/plugins/maven/maven-server-api/src/org/jetbrains/idea/maven/model/MavenArtifactNode.java +++ b/plugins/maven/maven-server-api/src/org/jetbrains/idea/maven/model/MavenArtifactNode.java @@ -1,21 +1,6 @@ -/* - * Copyright 2000-2010 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-2018 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. package org.jetbrains.idea.maven.model; -import com.intellij.openapi.util.text.StringUtilRt; import org.jetbrains.annotations.Nullable; import java.io.Serializable; @@ -96,15 +81,18 @@ public class MavenArtifactNode implements Serializable { @Override public String toString() { - String result = myArtifact.getDisplayStringWithTypeAndClassifier(); + StringBuilder result = new StringBuilder(); + result.append(myArtifact.getDisplayStringWithTypeAndClassifier()); if (myState != MavenArtifactState.ADDED) { - result += "[" + myState + ":" + myRelatedArtifact.getDisplayStringWithTypeAndClassifier() + "]"; + result.append('[').append(myState).append(':').append(myRelatedArtifact.getDisplayStringWithTypeAndClassifier()).append(']'); } - return result += "->(" + formatNodesList(myDependencies) + ")"; - } - - public static String formatNodesList(List nodes) { - return StringUtilRt.join(nodes, StringUtilRt.createToStringFunction(), ","); + result.append("->("); + for (int i = 0; i < myDependencies.size(); i++) { + if (i > 0) result.append(','); + result.append(myDependencies.get(i)); + } + result.append(')'); + return result.toString(); } @Override diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/importing/MavenProjectTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/importing/MavenProjectTest.java index 13a831ed912c..7b5b5a301dc3 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/importing/MavenProjectTest.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/importing/MavenProjectTest.java @@ -1,23 +1,10 @@ -/* - * Copyright 2000-2016 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-2018 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. package org.jetbrains.idea.maven.project.importing; import com.intellij.openapi.roots.LanguageLevelModuleExtensionImpl; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.pom.java.LanguageLevel; import org.jetbrains.idea.maven.MavenImportingTestCase; @@ -57,7 +44,7 @@ public class MavenProjectTest extends MavenImportingTestCase { assertDeclaredPlugins(p("group1", "id1"), p("group1", "id2"), p("group2", "id1")); } - + public void testPluginsContainDefaultPlugins() { importProject("test" + "project" + @@ -896,7 +883,7 @@ public class MavenProjectTest extends MavenImportingTestCase { } protected void assertDependenciesNodes(List nodes, String expected) { - assertEquals(expected, MavenArtifactNode.formatNodesList(nodes)); + assertEquals(expected, StringUtil.join(nodes, ",")); } private String findPluginConfig(String groupId, String artifactId, String path) {