mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
remove StringFactory because it doesn't have sense anymore
GitOrigin-RevId: 3bd0406d8d6c2783a544c24ada4a97b23e3aa878
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b1f96e26f2
commit
37bfcb68b0
@@ -15,7 +15,6 @@ import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.Interner;
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import gnu.trove.TObjectIntHashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -468,8 +467,8 @@ public abstract class ModuleInsight {
|
||||
@NlsSafe final String name = file.getName();
|
||||
myProgress.setText2(name);
|
||||
try {
|
||||
final char[] chars = FileUtil.loadFileText(file);
|
||||
scanSourceFileForImportedPackages(StringFactory.createShared(chars), s -> usedPackages.add(myInterner.intern(s)));
|
||||
String chars = FileUtil.loadFile(file, (String)null);
|
||||
scanSourceFileForImportedPackages(chars, s -> usedPackages.add(myInterner.intern(s)));
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.info(e);
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.NullableFunction;
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -98,7 +97,7 @@ public abstract class CommonSourceRootDetectionUtil<F> {
|
||||
|
||||
@Override
|
||||
protected CharSequence loadText(final File file) throws IOException {
|
||||
return StringFactory.createShared(loadFileTextSkippingBom(file));
|
||||
return loadFileTextSkippingBom(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,10 +106,11 @@ public abstract class CommonSourceRootDetectionUtil<F> {
|
||||
}
|
||||
};
|
||||
|
||||
private static char[] loadFileTextSkippingBom(File file) throws IOException {
|
||||
@NotNull
|
||||
private static String loadFileTextSkippingBom(File file) throws IOException {
|
||||
try (InputStream stream = CharsetToolkit.inputStreamSkippingBOM(new BufferedInputStream(new FileInputStream(file)));
|
||||
Reader reader = new InputStreamReader(stream, StandardCharsets.UTF_8)) {
|
||||
return FileUtilRt.loadText(reader, (int)file.length());
|
||||
return new String(FileUtilRt.loadText(reader, (int)file.length()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.intellij.util.UrlUtilRt;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.DistinctRootsCollection;
|
||||
import com.intellij.util.io.URLUtil;
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
import java.io.*;
|
||||
@@ -156,7 +155,7 @@ public class VfsUtilCore {
|
||||
}
|
||||
parent = parent.getParent();
|
||||
}
|
||||
return StringFactory.createShared(chars);
|
||||
return new String(chars);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -373,7 +372,7 @@ public class VfsUtilCore {
|
||||
|
||||
public static @NotNull String loadText(@NotNull VirtualFile file, int length) throws IOException {
|
||||
try (InputStreamReader reader = new InputStreamReader(file.getInputStream(), file.getCharset())) {
|
||||
return StringFactory.createShared(FileUtilRt.loadText(reader, length));
|
||||
return new String(FileUtilRt.loadText(reader, length));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.intellij.openapi.editor.impl;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.TextChange;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -46,7 +45,7 @@ public class BulkChangesMerger {
|
||||
* @return merge result
|
||||
*/
|
||||
public CharSequence mergeToCharSequence(char @NotNull [] text, int textLength, @NotNull List<? extends TextChange> changes) {
|
||||
return StringFactory.createShared(mergeToCharArray(text, textLength, changes));
|
||||
return new String(mergeToCharArray(text, textLength, changes));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.intellij.openapi.editor.impl;
|
||||
import com.intellij.openapi.editor.TextChange;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -440,7 +439,7 @@ public class TextChangesStorage {
|
||||
if (outputOffset < data.length) {
|
||||
System.arraycopy(originalData, originalStart, data, outputOffset, data.length - outputOffset);
|
||||
}
|
||||
return StringFactory.createShared(data);
|
||||
return new String(data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,8 +6,6 @@ import com.intellij.psi.CommonClassNames;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.CharTable;
|
||||
import com.intellij.util.ReflectionUtil;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import gnu.trove.TIntObjectHashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -67,9 +65,7 @@ public final class CharTableImpl implements CharTable {
|
||||
if (text instanceof String) {
|
||||
return ((String)text).substring(startOffset, endOffset);
|
||||
}
|
||||
char[] buf = new char[endOffset - startOffset];
|
||||
CharArrayUtil.getChars(text, buf, startOffset, 0, buf.length);
|
||||
return StringFactory.createShared(buf); // this way the .toString() doesn't create another instance (as opposed to new CharArrayCharSequence())
|
||||
return text.subSequence(startOffset, endOffset).toString();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.intellij.psi.PsiComment;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiWhiteSpace;
|
||||
import com.intellij.util.text.CharArrayCharSequence;
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -28,7 +27,7 @@ public final class AstBufferUtil {
|
||||
int length = toBuffer(element, null, 0, true);
|
||||
char[] buffer = new char[length];
|
||||
toBuffer(element, buffer, 0, true);
|
||||
return StringFactory.createShared(buffer);
|
||||
return new String(buffer);
|
||||
}
|
||||
|
||||
public static class BufferVisitor extends RecursiveTreeElementWalkingVisitor {
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.util.ArrayFactory;
|
||||
import com.intellij.util.concurrency.AtomicFieldUpdater;
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -209,7 +208,7 @@ public class CompositeElement extends TreeElement {
|
||||
@Override
|
||||
@NotNull
|
||||
public String getText() {
|
||||
return StringFactory.createShared(textToCharArray());
|
||||
return new String(textToCharArray());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.util.containers.Stack;
|
||||
import com.intellij.util.text.CharSequenceReader;
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import net.n3.nanoxml.*;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -174,7 +173,7 @@ public final class NanoXmlUtil {
|
||||
}
|
||||
|
||||
protected static String readText(final Reader reader) throws IOException {
|
||||
return StringFactory.createShared(StreamUtil.readTextAndConvertSeparators(reader));
|
||||
return new String(StreamUtil.readTextAndConvertSeparators(reader));
|
||||
}
|
||||
|
||||
protected @NonNls String getLocation() {
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.intellij.openapi.vfs.newvfs.persistent.PersistentFS;
|
||||
import com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl;
|
||||
import com.intellij.util.LocalTimeCounter;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import org.intellij.lang.annotations.MagicConstant;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -246,13 +245,13 @@ public abstract class VirtualFileSystemEntry extends NewVirtualFile {
|
||||
int prefixLen = protocol.length() + "://".length();
|
||||
char[] chars = appendPathOnFileSystem(prefixLen, new int[]{prefixLen});
|
||||
copyString(chars, copyString(chars, 0, protocol), "://");
|
||||
return StringFactory.createShared(chars);
|
||||
return new String(chars);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getPath() {
|
||||
return StringFactory.createShared(appendPathOnFileSystem(0, new int[]{0}));
|
||||
return new String(appendPathOnFileSystem(0, new int[]{0}));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.intellij.usages.impl.SyntaxHighlighterOverEditorHighlighter;
|
||||
import com.intellij.usages.impl.rules.UsageType;
|
||||
import com.intellij.util.containers.FactoryMap;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -286,7 +285,7 @@ public final class ChunkExtractor {
|
||||
TextAttributes attrs = bold
|
||||
? TextAttributes.merge(originalAttrs, new TextAttributes(null, null, null, null, Font.BOLD))
|
||||
: originalAttrs;
|
||||
result.add(new TextChunk(attrs, StringFactory.createShared(CharArrayUtil.fromSequence(chars, start, end)), usageType));
|
||||
result.add(new TextChunk(attrs, new String(CharArrayUtil.fromSequence(chars, start, end)), usageType));
|
||||
}
|
||||
|
||||
private static boolean rangeIntersect(int s1, int e1, int s2, int e2) {
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.intellij.util.containers.JBIterable;
|
||||
import com.intellij.util.containers.JBTreeTraverser;
|
||||
import com.intellij.util.io.URLUtil;
|
||||
import com.intellij.util.text.FilePathHashingStrategy;
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import org.intellij.lang.annotations.RegExp;
|
||||
import org.jetbrains.annotations.*;
|
||||
@@ -225,7 +224,7 @@ public class FileUtil extends FileUtilRt {
|
||||
@NotNull
|
||||
public static String loadTextAndClose(@NotNull Reader reader) throws IOException {
|
||||
try {
|
||||
return StringFactory.createShared(adaptiveLoadText(reader));
|
||||
return new String(adaptiveLoadText(reader));
|
||||
}
|
||||
finally {
|
||||
reader.close();
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.intellij.openapi.util.io;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.util.io.UnsyncByteArrayOutputStream;
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -24,7 +23,8 @@ public final class StreamUtil {
|
||||
*/
|
||||
public static int copy(@NotNull InputStream inputStream, @NotNull OutputStream outputStream) throws IOException {
|
||||
byte[] buffer = new byte[8 * 1024];
|
||||
int read, total = 0;
|
||||
int read;
|
||||
int total = 0;
|
||||
while ((read = inputStream.read(buffer)) > 0) {
|
||||
outputStream.write(buffer, 0, read);
|
||||
total += read;
|
||||
@@ -39,17 +39,16 @@ public final class StreamUtil {
|
||||
}
|
||||
|
||||
public static @NotNull String readText(@NotNull Reader reader) throws IOException {
|
||||
char[] chars = readChars(reader);
|
||||
return StringFactory.createShared(chars);
|
||||
return readChars(reader).toString();
|
||||
}
|
||||
|
||||
public static @NotNull String convertSeparators(@NotNull String s) {
|
||||
return StringFactory.createShared(convertSeparators(s.toCharArray()));
|
||||
return new String(convertSeparators(s.toCharArray()));
|
||||
}
|
||||
|
||||
public static char @NotNull [] readTextAndConvertSeparators(@NotNull Reader reader) throws IOException {
|
||||
char[] chars = readChars(reader);
|
||||
return convertSeparators(chars);
|
||||
CharArrayWriter chars = readChars(reader);
|
||||
return convertSeparators(chars.toCharArray());
|
||||
}
|
||||
|
||||
private static char[] convertSeparators(char [] buffer) {
|
||||
@@ -76,12 +75,13 @@ public final class StreamUtil {
|
||||
return Arrays.copyOf(buffer, dst);
|
||||
}
|
||||
|
||||
private static char[] readChars(Reader reader) throws IOException {
|
||||
@NotNull
|
||||
private static CharArrayWriter readChars(Reader reader) throws IOException {
|
||||
CharArrayWriter writer = new CharArrayWriter();
|
||||
char[] buffer = new char[2048];
|
||||
int read;
|
||||
while ((read = reader.read(buffer)) > 0) writer.write(buffer, 0, read);
|
||||
return writer.toCharArray();
|
||||
return writer;
|
||||
}
|
||||
|
||||
//<editor-fold desc="Deprecated stuff.">
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import com.intellij.util.text.CharSequenceSubSequence;
|
||||
import com.intellij.util.text.MergingCharSequence;
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
import javax.swing.text.MutableAttributeSet;
|
||||
@@ -1102,11 +1101,12 @@ public class StringUtil extends StringUtilRt {
|
||||
return ExceptionUtil.getMessage(e);
|
||||
}
|
||||
|
||||
@ReviseWhenPortedToJDK("11") // Character.toString(aChar).repeat(count)
|
||||
@Contract(pure = true)
|
||||
public static @NotNull String repeatSymbol(final char aChar, final int count) {
|
||||
char[] buffer = new char[count];
|
||||
Arrays.fill(buffer, aChar);
|
||||
return StringFactory.createShared(buffer);
|
||||
return new String(buffer);
|
||||
}
|
||||
|
||||
@Contract(pure = true)
|
||||
@@ -1547,7 +1547,7 @@ public class StringUtil extends StringUtilRt {
|
||||
|
||||
char[] buffer = displayString.toCharArray();
|
||||
buffer[0] = uppedFirstChar;
|
||||
return StringFactory.createShared(buffer);
|
||||
return new String(buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// 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.
|
||||
package com.intellij.util;
|
||||
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -98,7 +97,7 @@ public final class Base64Converter {
|
||||
out[outIndex] = '=';
|
||||
}
|
||||
|
||||
return StringFactory.createShared(out);
|
||||
return new String(out);
|
||||
}
|
||||
|
||||
public static String decode(@NotNull String s) {
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.intellij.openapi.util.ThreadLocalCachedByteArray;
|
||||
import com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream;
|
||||
import com.intellij.util.io.DataInputOutputUtil;
|
||||
import com.intellij.util.io.DataOutputStream;
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import net.jpountz.lz4.LZ4Compressor;
|
||||
import net.jpountz.lz4.LZ4Factory;
|
||||
import net.jpountz.lz4.LZ4FastDecompressor;
|
||||
@@ -179,6 +178,6 @@ public final class CompressionUtil {
|
||||
int c = DataInputOutputUtil.readINT(dest);
|
||||
chars[i] = (char)c;
|
||||
}
|
||||
return StringFactory.createShared(chars);
|
||||
return new String(chars);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.intellij.util.containers;
|
||||
|
||||
import com.intellij.util.ArrayFactory;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public final class CharTrie {
|
||||
@@ -54,11 +53,11 @@ public final class CharTrie {
|
||||
* Returns reversed string by unique hash code.
|
||||
*/
|
||||
public String getReversedString(int hashCode) {
|
||||
return StringFactory.createShared(getReversedChars(hashCode));
|
||||
return new String(getReversedChars(hashCode));
|
||||
}
|
||||
|
||||
public String getString(int hashCode) {
|
||||
return StringFactory.createShared(getChars(hashCode));
|
||||
return new String(getChars(hashCode));
|
||||
}
|
||||
|
||||
public int getHashCode(char[] chars) {
|
||||
|
||||
@@ -47,7 +47,7 @@ public class CharSequenceSubSequence implements CharSequence, CharArrayExternali
|
||||
@NotNull
|
||||
public String toString() {
|
||||
if (myChars instanceof String) return ((String)myChars).substring(myStart, myEnd);
|
||||
return StringFactory.createShared(CharArrayUtil.fromSequence(myChars, myStart, myEnd));
|
||||
return new String(CharArrayUtil.fromSequence(myChars, myStart, myEnd));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -341,7 +341,7 @@ final class ImmutableText extends ImmutableCharSequence implements CharArrayExte
|
||||
int len = length();
|
||||
char[] data = new char[len];
|
||||
getChars(0, len, data, 0);
|
||||
return StringFactory.createShared(data);
|
||||
return new String(data);
|
||||
}
|
||||
@Override
|
||||
public CharSequence subSequence(int start, int end) {
|
||||
@@ -426,7 +426,7 @@ final class ImmutableText extends ImmutableCharSequence implements CharArrayExte
|
||||
@NotNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return StringFactory.createShared(data);
|
||||
return new String(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
// 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.
|
||||
package com.intellij.util.text;
|
||||
|
||||
import com.intellij.ReviseWhenPortedToJDK;
|
||||
import com.intellij.openapi.util.SystemInfoRt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
@ReviseWhenPortedToJDK("9")
|
||||
public final class StringFactory {
|
||||
// String(char[], boolean). Works since JDK1.7, earlier JDKs have too slow reflection anyway
|
||||
private static final Constructor<String> ourConstructor;
|
||||
|
||||
static {
|
||||
Constructor<String> constructor = null;
|
||||
// makes no sense in JDK9 because new String(char[],boolean) there parses and copies array too.
|
||||
if (!SystemInfoRt.IS_AT_LEAST_JAVA9) {
|
||||
try {
|
||||
constructor = String.class.getDeclaredConstructor(char[].class, boolean.class);
|
||||
constructor.setAccessible(true);
|
||||
}
|
||||
catch (Throwable ignored) {
|
||||
constructor = null; // setAccessible fails without explicit permission on Java 9
|
||||
}
|
||||
}
|
||||
ourConstructor = constructor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return new instance of String which backed by given char array.
|
||||
*
|
||||
* CAUTION! EXTREMELY DANGEROUS!! DO NOT USE THIS METHOD UNLESS YOU ARE REALLY DESPERATE!!!
|
||||
*/
|
||||
@NotNull
|
||||
public static String createShared(char @NotNull [] chars) {
|
||||
if (ourConstructor != null) {
|
||||
try {
|
||||
return ourConstructor.newInstance(chars, Boolean.TRUE);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
return new String(chars);
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@ import com.intellij.reference.SoftReference;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.ReflectionUtil;
|
||||
import com.intellij.util.text.StringFactory;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -430,6 +429,7 @@ public final class PsiImplUtil {
|
||||
/**
|
||||
* see {@link AstBufferUtil#getTextSkippingWhitespaceComments(ASTNode)}
|
||||
*/
|
||||
@NotNull
|
||||
public static String getTextSkipWhiteSpaceAndComments(ASTNode node) {
|
||||
final TreeElement treeElement = (TreeElement)node;
|
||||
final int length;
|
||||
@@ -443,14 +443,14 @@ public final class PsiImplUtil {
|
||||
final GroovyBufferVisitor textVisitor = new GroovyBufferVisitor(true, true, 0, buffer);
|
||||
treeElement.acceptTree(textVisitor);
|
||||
}
|
||||
return StringFactory.createShared(buffer);
|
||||
return new String(buffer);
|
||||
}
|
||||
|
||||
public static class GroovyBufferVisitor extends AstBufferUtil.BufferVisitor {
|
||||
private static class GroovyBufferVisitor extends AstBufferUtil.BufferVisitor {
|
||||
|
||||
private final boolean mySkipWhiteSpace;
|
||||
|
||||
public GroovyBufferVisitor(boolean skipWhitespace, boolean skipComments, int offset, char @Nullable [] buffer) {
|
||||
GroovyBufferVisitor(boolean skipWhitespace, boolean skipComments, int offset, char @Nullable [] buffer) {
|
||||
super(skipWhitespace, skipComments, offset, buffer);
|
||||
mySkipWhiteSpace = skipWhitespace;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user