Remove dependency of "descriptors" on StringUtil
This commit is contained in:
@@ -17,8 +17,8 @@
|
|||||||
package org.jetbrains.jet.lang.resolve.name;
|
package org.jetbrains.jet.lang.resolve.name;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.intellij.openapi.util.text.StringUtil;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.jet.utils.UtilsPackage;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -26,8 +26,7 @@ public final class FqName extends FqNameBase {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static FqName fromSegments(@NotNull List<String> names) {
|
public static FqName fromSegments(@NotNull List<String> names) {
|
||||||
String fqName = StringUtil.join(names, ".");
|
return new FqName(UtilsPackage.join(names, "."));
|
||||||
return new FqName(fqName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final FqName ROOT = new FqName("");
|
public static final FqName ROOT = new FqName("");
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
package org.jetbrains.jet.lang.resolve.name;
|
package org.jetbrains.jet.lang.resolve.name;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.intellij.openapi.util.text.StringUtil;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.jetbrains.jet.utils.UtilsPackage;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -256,8 +256,7 @@ public final class FqNameUnsafe extends FqNameBase {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static FqNameUnsafe fromSegments(@NotNull List<Name> names) {
|
public static FqNameUnsafe fromSegments(@NotNull List<Name> names) {
|
||||||
String fqName = StringUtil.join(names, ".");
|
return new FqNameUnsafe(UtilsPackage.join(names, "."));
|
||||||
return new FqNameUnsafe(fqName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ package org.jetbrains.jet.renderer;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.intellij.openapi.util.text.StringUtil;
|
|
||||||
import kotlin.Function1;
|
import kotlin.Function1;
|
||||||
import kotlin.KotlinPackage;
|
import kotlin.KotlinPackage;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -39,6 +38,7 @@ import org.jetbrains.jet.lang.resolve.name.Name;
|
|||||||
import org.jetbrains.jet.lang.types.*;
|
import org.jetbrains.jet.lang.types.*;
|
||||||
import org.jetbrains.jet.lang.types.error.MissingDependencyErrorClass;
|
import org.jetbrains.jet.lang.types.error.MissingDependencyErrorClass;
|
||||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||||
|
import org.jetbrains.jet.utils.UtilsPackage;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -408,7 +408,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(renderType(annotation.getType()));
|
sb.append(renderType(annotation.getType()));
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
sb.append("(").append(StringUtil.join(renderAndSortAnnotationArguments(annotation), ", ")).append(")");
|
sb.append("(").append(UtilsPackage.join(renderAndSortAnnotationArguments(annotation), ", ")).append(")");
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
@@ -436,15 +436,15 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String visitArrayValue(ArrayValue value, Void data) {
|
public String visitArrayValue(ArrayValue value, Void data) {
|
||||||
List<CompileTimeConstant<?>> elements = value.getValue();
|
List<String> renderedElements =
|
||||||
if (elements.isEmpty()) return "{}";
|
KotlinPackage.map(value.getValue(),
|
||||||
List<String> renderedElements = KotlinPackage.map(elements, new Function1<CompileTimeConstant<?>, String>() {
|
new Function1<CompileTimeConstant<?>, String>() {
|
||||||
@Override
|
@Override
|
||||||
public String invoke(CompileTimeConstant<?> constant) {
|
public String invoke(CompileTimeConstant<?> constant) {
|
||||||
return renderConstant(constant);
|
return renderConstant(constant);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return "{" + StringUtil.join(renderedElements, ", ") + "}";
|
return "{" + UtilsPackage.join(renderedElements, ", ") + "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -681,7 +681,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
|||||||
}
|
}
|
||||||
if (!upperBoundStrings.isEmpty()) {
|
if (!upperBoundStrings.isEmpty()) {
|
||||||
builder.append(" ").append(renderKeyword("where")).append(" ");
|
builder.append(" ").append(renderKeyword("where")).append(" ");
|
||||||
builder.append(StringUtil.join(upperBoundStrings, ", "));
|
builder.append(UtilsPackage.join(upperBoundStrings, ", "));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2014 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 org.jetbrains.jet.utils
|
||||||
|
|
||||||
|
// Needed for Java interop: otherwise you need to specify all the optional parameters to join, i.e. prefix, postfix, limit, truncated
|
||||||
|
fun Iterable<Any>.join(separator: String) = joinToString(separator)
|
||||||
Reference in New Issue
Block a user