[maven] unwarranted use of utility methods

This commit is contained in:
Roman Shevchenko
2018-08-13 19:29:14 +02:00
parent b002c476e4
commit 153292c5cb
2 changed files with 15 additions and 40 deletions
@@ -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<MavenArtifactNode> 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
@@ -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("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
@@ -896,7 +883,7 @@ public class MavenProjectTest extends MavenImportingTestCase {
}
protected void assertDependenciesNodes(List<MavenArtifactNode> nodes, String expected) {
assertEquals(expected, MavenArtifactNode.formatNodesList(nodes));
assertEquals(expected, StringUtil.join(nodes, ","));
}
private String findPluginConfig(String groupId, String artifactId, String path) {