mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
@@ -34,7 +34,6 @@ import com.intellij.psi.stubs.StubInputStream;
|
||||
import com.intellij.psi.stubs.StubOutputStream;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import gnu.trove.TObjectIntHashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -210,7 +209,7 @@ public class TypeInfo {
|
||||
boolean hasEllipsis = isSet(flags, HAS_ELLIPSIS);
|
||||
|
||||
int frequentIndex = FREQUENT_INDEX_MASK & flags;
|
||||
String text = frequentIndex == 0 ? StringRef.toString(record.readName()) : ourIndexFrequentType[frequentIndex];
|
||||
String text = frequentIndex == 0 ? record.readNameString() : ourIndexFrequentType[frequentIndex];
|
||||
|
||||
return new TypeInfo(text, arrayCount, hasEllipsis, PsiAnnotationStub.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public abstract class FunctionalExpressionElementType<T extends PsiFunctionalExp
|
||||
@NotNull
|
||||
@Override
|
||||
public FunctionalExpressionStub<T> deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
return new FunctionalExpressionStub<>(parentStub, this, StringRef.toString(dataStream.readName()));
|
||||
return new FunctionalExpressionStub<>(parentStub, this, dataStream.readNameString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -167,16 +167,16 @@ public abstract class JavaClassElementType extends JavaStubElementType<PsiClassS
|
||||
JavaClassElementType type = typeForClass(isAnonymous, isEnumConst);
|
||||
|
||||
if (!isAnonymous) {
|
||||
StringRef name = dataStream.readName();
|
||||
StringRef qname = dataStream.readName();
|
||||
StringRef sourceFileName = dataStream.readName();
|
||||
PsiClassStubImpl classStub = new PsiClassStubImpl(type, parentStub, StringRef.toString(qname), StringRef.toString(name), null, flags);
|
||||
classStub.setSourceFileName(StringRef.toString(sourceFileName));
|
||||
String name = dataStream.readNameString();
|
||||
String qname = dataStream.readNameString();
|
||||
String sourceFileName = dataStream.readNameString();
|
||||
PsiClassStubImpl classStub = new PsiClassStubImpl(type, parentStub, qname, name, null, flags);
|
||||
classStub.setSourceFileName(sourceFileName);
|
||||
return classStub;
|
||||
}
|
||||
else {
|
||||
StringRef baseRef = dataStream.readName();
|
||||
return new PsiClassStubImpl(type, parentStub, null, null, StringRef.toString(baseRef), flags);
|
||||
String baseRef = dataStream.readNameString();
|
||||
return new PsiClassStubImpl(type, parentStub, null, null, baseRef, flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -32,7 +32,6 @@ import com.intellij.psi.stubs.StubInputStream;
|
||||
import com.intellij.psi.stubs.StubOutputStream;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -87,7 +86,7 @@ public abstract class JavaClassReferenceListElementType extends JavaStubElementT
|
||||
int len = dataStream.readVarInt();
|
||||
String[] names = ArrayUtil.newStringArray(len);
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
names[i] = StringRef.toString(dataStream.readName());
|
||||
names[i] = dataStream.readNameString();
|
||||
}
|
||||
return new PsiClassReferenceListStubImpl(this, parentStub, names);
|
||||
}
|
||||
|
||||
+3
-4
@@ -36,7 +36,6 @@ import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.psi.stubs.StubInputStream;
|
||||
import com.intellij.psi.stubs.StubOutputStream;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -128,11 +127,11 @@ public abstract class JavaFieldStubElementType extends JavaStubElementType<PsiFi
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiFieldStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
StringRef name = dataStream.readName();
|
||||
String name = dataStream.readNameString();
|
||||
TypeInfo type = TypeInfo.readTYPE(dataStream);
|
||||
StringRef initializerText = dataStream.readName();
|
||||
String initializerText = dataStream.readNameString();
|
||||
byte flags = dataStream.readByte();
|
||||
return new PsiFieldStubImpl(parentStub, StringRef.toString(name), type, StringRef.toString(initializerText), flags);
|
||||
return new PsiFieldStubImpl(parentStub, name, type, initializerText, flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-3
@@ -88,9 +88,9 @@ public abstract class JavaImportStatementElementType extends JavaStubElementType
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiImportStatementStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
|
||||
final byte flags = dataStream.readByte();
|
||||
final StringRef refText = dataStream.readName();
|
||||
return new PsiImportStatementStubImpl(parentStub, StringRef.toString(refText), flags);
|
||||
byte flags = dataStream.readByte();
|
||||
String refText = dataStream.readNameString();
|
||||
return new PsiImportStatementStubImpl(parentStub, refText, flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -138,11 +138,11 @@ public abstract class JavaMethodElementType extends JavaStubElementType<PsiMetho
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiMethodStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
|
||||
StringRef name = dataStream.readName();
|
||||
String name = dataStream.readNameString();
|
||||
final TypeInfo type = TypeInfo.readTYPE(dataStream);
|
||||
byte flags = dataStream.readByte();
|
||||
final StringRef defaultMethodValue = PsiMethodStubImpl.isAnnotationMethod(flags) ? dataStream.readName() : null;
|
||||
return new PsiMethodStubImpl(parentStub, StringRef.toString(name), type, flags, StringRef.toString(defaultMethodValue));
|
||||
String defaultMethodValue = PsiMethodStubImpl.isAnnotationMethod(flags) ? dataStream.readNameString() : null;
|
||||
return new PsiMethodStubImpl(parentStub, name, type, flags, defaultMethodValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.intellij.psi.stubs.IndexSink;
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.psi.stubs.StubInputStream;
|
||||
import com.intellij.psi.stubs.StubOutputStream;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -70,8 +69,7 @@ public class JavaModuleElementType extends JavaStubElementType<PsiJavaModuleStub
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiJavaModuleStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
String name = StringRef.toString(dataStream.readName());
|
||||
return new PsiJavaModuleStubImpl(parentStub, name);
|
||||
return new PsiJavaModuleStubImpl(parentStub, dataStream.readNameString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.intellij.psi.stubs.IndexSink;
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.psi.stubs.StubInputStream;
|
||||
import com.intellij.psi.stubs.StubOutputStream;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -92,7 +91,7 @@ public class JavaNameValuePairType extends JavaStubElementType<PsiNameValuePairS
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiNameValuePairStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
String name = StringRef.toString(dataStream.readName());
|
||||
String name = dataStream.readNameString();
|
||||
boolean hasValue = dataStream.readBoolean();
|
||||
return new PsiNameValuePairStubImpl(parentStub, name, hasValue ? dataStream.readUTFFast() : null);
|
||||
}
|
||||
|
||||
+1
-2
@@ -31,7 +31,6 @@ import com.intellij.psi.stubs.StubInputStream;
|
||||
import com.intellij.psi.stubs.StubOutputStream;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -81,7 +80,7 @@ public class JavaPackageAccessibilityStatementElementType extends JavaStubElemen
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiPackageAccessibilityStatementStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
String packageName = StringRef.toString(dataStream.readName());
|
||||
String packageName = dataStream.readNameString();
|
||||
List<String> targets = StringUtil.split(dataStream.readUTFFast(), "/");
|
||||
return new PsiPackageAccessibilityStatementStubImpl(parentStub, this, packageName, targets);
|
||||
}
|
||||
|
||||
+2
-2
@@ -78,11 +78,11 @@ public class JavaParameterElementType extends JavaStubElementType<PsiParameterSt
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiParameterStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
StringRef name = dataStream.readName();
|
||||
String name = dataStream.readNameString();
|
||||
if (name == null) throw new IOException("corrupted indices");
|
||||
TypeInfo type = TypeInfo.readTYPE(dataStream);
|
||||
byte flags = dataStream.readByte();
|
||||
return new PsiParameterStubImpl(parentStub, name.toString(), type, flags);
|
||||
return new PsiParameterStubImpl(parentStub, name, type, flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ public class JavaProvidesStatementElementType extends JavaStubElementType<PsiPro
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiProvidesStatementStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
return new PsiProvidesStatementStubImpl(parentStub, StringRef.toString(dataStream.readName()));
|
||||
return new PsiProvidesStatementStubImpl(parentStub, dataStream.readNameString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ public class JavaRequiresStatementElementType extends JavaStubElementType<PsiReq
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiRequiresStatementStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
return new PsiRequiresStatementStubImpl(parentStub, StringRef.toString(dataStream.readName()));
|
||||
return new PsiRequiresStatementStubImpl(parentStub, dataStream.readNameString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-3
@@ -29,7 +29,6 @@ import com.intellij.psi.stubs.IndexSink;
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.psi.stubs.StubInputStream;
|
||||
import com.intellij.psi.stubs.StubOutputStream;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -74,8 +73,7 @@ public class JavaTypeParameterElementType extends JavaStubElementType<PsiTypePar
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiTypeParameterStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
|
||||
StringRef name = dataStream.readName();
|
||||
return new PsiTypeParameterStubImpl(parentStub, StringRef.toString(name));
|
||||
return new PsiTypeParameterStubImpl(parentStub, dataStream.readNameString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-2
@@ -29,7 +29,6 @@ import com.intellij.psi.stubs.IndexSink;
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.psi.stubs.StubInputStream;
|
||||
import com.intellij.psi.stubs.StubOutputStream;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -70,7 +69,7 @@ public class JavaUsesStatementElementType extends JavaStubElementType<PsiUsesSta
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiUsesStatementStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
return new PsiUsesStatementStubImpl(parentStub, StringRef.toString(dataStream.readName()));
|
||||
return new PsiUsesStatementStubImpl(parentStub, dataStream.readNameString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -108,8 +108,8 @@ public class JavaFileElementType extends ILightStubFileElementType<PsiJavaFileSt
|
||||
public PsiJavaFileStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
boolean compiled = dataStream.readBoolean();
|
||||
int level = dataStream.readByte();
|
||||
StringRef packageName = dataStream.readName();
|
||||
return new PsiJavaFileStubImpl(null, StringRef.toString(packageName), level >= 0 ? LanguageLevel.values()[level] : null, compiled);
|
||||
String packageName = dataStream.readNameString();
|
||||
return new PsiJavaFileStubImpl(null, packageName, level >= 0 ? LanguageLevel.values()[level] : null, compiled);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,14 +43,16 @@ public class StubInputStream extends DataInputStream {
|
||||
|
||||
@Nullable
|
||||
public StringRef readName() throws IOException {
|
||||
return DataInputOutputUtil.readNAME(this, myNameStorage);
|
||||
return StringRef.fromStream(this, myNameStorage);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String readNameString() throws IOException {
|
||||
return StringRef.stringFromStream(this, myNameStorage);
|
||||
}
|
||||
|
||||
public int readVarInt() throws IOException {
|
||||
return DataInputOutputUtil.readINT(this);
|
||||
}
|
||||
|
||||
public String stringFromId(int id) throws IOException {
|
||||
return myNameStorage.valueOf(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,14 +42,12 @@ public class StubOutputStream extends DataOutputStream {
|
||||
}
|
||||
|
||||
public void writeName(@Nullable final String arg) throws IOException {
|
||||
DataInputOutputUtil.writeNAME(this, arg, myNameStorage);
|
||||
final int nameId = arg != null ? myNameStorage.enumerate(arg) : 0;
|
||||
DataInputOutputUtil.writeINT(this, nameId);
|
||||
}
|
||||
|
||||
public void writeVarInt(final int value) throws IOException {
|
||||
DataInputOutputUtil.writeINT(this, value);
|
||||
}
|
||||
|
||||
public int getStringId(final String value) throws IOException {
|
||||
return myNameStorage.enumerate(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.intellij.psi.util;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.stubs.StubInputStream;
|
||||
import com.intellij.psi.stubs.StubOutputStream;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -158,8 +157,7 @@ public class QualifiedName implements Comparable<QualifiedName> {
|
||||
else {
|
||||
qName = new QualifiedName(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
final StringRef name = dataStream.readName();
|
||||
qName.myComponents.add(name == null ? null : name.getString());
|
||||
qName.myComponents.add(dataStream.readNameString());
|
||||
}
|
||||
}
|
||||
return qName;
|
||||
|
||||
@@ -241,7 +241,6 @@ public class GotoActionAction extends GotoActionBase implements DumbAware {
|
||||
if (aw.isAvailable()) {
|
||||
String id = ActionManager.getInstance().getId(aw.getAction());
|
||||
KeymapPanel.addKeyboardShortcut(id, ActionShortcutRestrictions.getInstance().getForActionId(id), activeKeymap, component);
|
||||
popup.repaintListImmediate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,16 +42,6 @@ public class DataInputOutputUtil extends DataInputOutputUtilRt {
|
||||
DataInputOutputUtilRt.writeINT(record, val);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static StringRef readNAME(@NotNull DataInput record, @NotNull AbstractStringEnumerator nameStore) throws IOException {
|
||||
return StringRef.fromStream(record, nameStore);
|
||||
}
|
||||
|
||||
public static void writeNAME(@NotNull DataOutput record, @Nullable String name, @NotNull AbstractStringEnumerator nameStore) throws IOException {
|
||||
final int nameId = name != null ? nameStore.enumerate(name) : 0;
|
||||
writeINT(record, nameId);
|
||||
}
|
||||
|
||||
public static long readLONG(@NotNull DataInput record) throws IOException {
|
||||
final int val = record.readUnsignedByte();
|
||||
if (val < 192) {
|
||||
|
||||
@@ -115,6 +115,12 @@ public class StringRef {
|
||||
return nameId != 0 ? new StringRef(nameId, store) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String stringFromStream(@NotNull DataInput in, @NotNull AbstractStringEnumerator store) throws IOException {
|
||||
final int nameId = DataInputOutputUtil.readINT(in);
|
||||
return nameId != 0 ? store.valueOf(nameId) : null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static StringRef[] createArray(int count) {
|
||||
return count == 0 ? EMPTY_ARRAY : new StringRef[count];
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.intellij.execution.impl.ConsoleViewImpl;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
@@ -31,15 +30,16 @@ import com.intellij.xdebugger.impl.frame.XStackFrameContainerEx;
|
||||
import org.intellij.lang.annotations.Language;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.concurrency.Promise;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@@ -65,15 +65,13 @@ public class XDebuggerTestUtil {
|
||||
|
||||
@Nullable
|
||||
public static XLineBreakpoint toggleBreakpoint(Project project, VirtualFile file, int line) {
|
||||
return new WriteAction<XLineBreakpoint>() {
|
||||
@Override
|
||||
protected void run(@NotNull Result<XLineBreakpoint> result) {
|
||||
Promise<XLineBreakpoint> promise =
|
||||
((XDebuggerUtilImpl)XDebuggerUtil.getInstance()).toggleAndReturnLineBreakpoint(project, file, line, false);
|
||||
|
||||
promise.done(result::setResult);
|
||||
}
|
||||
}.execute().getResultObject();
|
||||
try {
|
||||
return WriteAction.computeAndWait(() -> ((XDebuggerUtilImpl)XDebuggerUtil.getInstance())
|
||||
.toggleAndReturnLineBreakpoint(project, file, line, false)).blockingGet(TIMEOUT_MS);
|
||||
}
|
||||
catch (TimeoutException | ExecutionException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static <P extends XBreakpointProperties> XBreakpoint<P> insertBreakpoint(final Project project,
|
||||
|
||||
+1
-2
@@ -12,7 +12,6 @@ import com.intellij.psi.util.CachedValuesManager;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.io.DataInputOutputUtil;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
|
||||
@@ -42,7 +41,7 @@ public class GrStubUtils {
|
||||
|
||||
@NotNull
|
||||
public static String[] readStringArray(@NotNull StubInputStream dataStream) throws IOException {
|
||||
return ArrayUtil.toStringArray(readSeq(dataStream, () -> StringRef.toString(dataStream.readName())));
|
||||
return ArrayUtil.toStringArray(readSeq(dataStream, () -> dataStream.readNameString()));
|
||||
}
|
||||
|
||||
public static void writeNullableString(StubOutputStream dataStream, @Nullable String typeText) throws IOException {
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ public class GrNameValuePairElementType extends GrStubElementType<GrNameValuePai
|
||||
public GrNameValuePairStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
return new GrNameValuePairStub(
|
||||
parentStub,
|
||||
StringRef.toString(dataStream.readName()),
|
||||
dataStream.readNameString(),
|
||||
dataStream.readBoolean() ? dataStream.readUTFFast() : null
|
||||
);
|
||||
}
|
||||
|
||||
+3
-3
@@ -56,10 +56,10 @@ public abstract class GrTypeDefinitionElementType<TypeDef extends GrTypeDefiniti
|
||||
@Override
|
||||
@NotNull
|
||||
public GrTypeDefinitionStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
String name = StringRef.toString(dataStream.readName());
|
||||
String qname = StringRef.toString(dataStream.readName());
|
||||
String name = dataStream.readNameString();
|
||||
String qname = dataStream.readNameString();
|
||||
byte flags = dataStream.readByte();
|
||||
String baseClassName = StringRef.toString(dataStream.readName());
|
||||
String baseClassName = dataStream.readNameString();
|
||||
String[] annos = readStringArray(dataStream);
|
||||
return new GrTypeDefinitionStub(parentStub, name, baseClassName, this, qname, annos, flags);
|
||||
}
|
||||
|
||||
-35
@@ -6,7 +6,6 @@ import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.ElementClassHint.DeclarationKind;
|
||||
@@ -63,8 +62,6 @@ import org.jetbrains.plugins.groovy.lang.resolve.processors.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.intellij.util.containers.ContainerUtil.count;
|
||||
import static com.intellij.util.containers.ContainerUtil.filter;
|
||||
import static org.jetbrains.plugins.groovy.lang.psi.impl.GrAnnotationUtilKt.hasAnnotation;
|
||||
import static org.jetbrains.plugins.groovy.lang.psi.util.PsiTreeUtilKt.treeWalkUpAndGetSingleElement;
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.ResolveUtilKt.getDefaultConstructor;
|
||||
@@ -1080,19 +1077,6 @@ public class ResolveUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isMethodCallRef(@NotNull GrReferenceExpression ref) {
|
||||
final PsiElement element = PsiTreeUtil.skipParentsOfType(ref, GrReferenceExpression.class);
|
||||
return element instanceof GrMethodCall;
|
||||
}
|
||||
|
||||
public static boolean isPartOfFQN(@NotNull GrReferenceExpression ref) {
|
||||
if (ref.hasAt()) return false;
|
||||
final String name = ref.getReferenceName();
|
||||
if (StringUtil.isEmpty(name)) return false;
|
||||
return Character.isUpperCase(name.charAt(0)) && !isMethodCallRef(ref) ||
|
||||
ref.getParent() instanceof GrReferenceExpression && isPartOfFQN((GrReferenceExpression)ref.getParent());
|
||||
}
|
||||
|
||||
public static boolean canResolveToMethod(@NotNull GrReferenceExpression ref) {
|
||||
return ref.hasMemberPointer() || ref.getParent() instanceof GrMethodCall;
|
||||
}
|
||||
@@ -1107,25 +1091,6 @@ public class ResolveUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<GroovyResolveResult> filterAccessorMethods(@NotNull List<GroovyResolveResult> candidates) {
|
||||
return filter(candidates, it -> !(it.getElement() instanceof GrAccessorMethod));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<GroovyResolveResult> collapseReflectedMethodsSimple(@NotNull List<GroovyResolveResult> candidates) {
|
||||
if (count(candidates, it -> it.getElement() instanceof GrReflectedMethod) < 2) return candidates;
|
||||
final Set<GrMethod> visited = ContainerUtil.newHashSet();
|
||||
return ContainerUtil.mapNotNull(candidates, result -> {
|
||||
final PsiElement element = result.getElement();
|
||||
if (!(element instanceof GrReflectedMethod)) return result;
|
||||
|
||||
final GrMethod baseMethod = ((GrReflectedMethod)element).getBaseMethod();
|
||||
if (!visited.add(baseMethod)) return null;
|
||||
return new ElementGroovyResult<>(baseMethod);
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<GroovyResolveResult> collapseReflectedMethods(Collection<GroovyResolveResult> candidates) {
|
||||
Set<GrMethod> visited = ContainerUtil.newHashSet();
|
||||
|
||||
-10
@@ -18,11 +18,8 @@ import static org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil.collapseRefl
|
||||
|
||||
class GroovyResolverProcessorImpl extends GroovyResolverProcessor implements GrMethodComparator.Context {
|
||||
|
||||
private final boolean myIsPartOfFqn;
|
||||
|
||||
GroovyResolverProcessorImpl(@NotNull final GrReferenceExpression ref, @NotNull EnumSet<GroovyResolveKind> kinds, boolean forceRValue) {
|
||||
super(ref, kinds, null, forceRValue);
|
||||
myIsPartOfFqn = ResolveUtil.isPartOfFQN(ref);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -45,13 +42,6 @@ class GroovyResolverProcessorImpl extends GroovyResolverProcessor implements GrM
|
||||
return candidates;
|
||||
}
|
||||
|
||||
if (myIsPartOfFqn) {
|
||||
candidates = getCandidates(GroovyResolveKind.PACKAGE, GroovyResolveKind.CLASS);
|
||||
if (!candidates.isEmpty()) {
|
||||
return candidates;
|
||||
}
|
||||
}
|
||||
|
||||
candidates = getCandidates(GroovyResolveKind.PROPERTY);
|
||||
if (!candidates.isEmpty()) {
|
||||
return candidates.size() <= 1 ? candidates : ContainerUtil.newSmartList(candidates.get(0));
|
||||
|
||||
+1
-3
@@ -30,7 +30,6 @@ import com.intellij.lang.properties.psi.impl.PropertyStubImpl;
|
||||
import com.intellij.psi.impl.source.tree.LightTreeUtil;
|
||||
import com.intellij.psi.stubs.*;
|
||||
import com.intellij.util.CharTable;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -60,8 +59,7 @@ public class PropertyStubElementType extends ILightStubElementType<PropertyStub,
|
||||
|
||||
@NotNull
|
||||
public PropertyStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
|
||||
final StringRef ref = dataStream.readName();
|
||||
return new PropertyStubImpl(parentStub, ref.getString());
|
||||
return new PropertyStubImpl(parentStub, dataStream.readNameString());
|
||||
}
|
||||
|
||||
public void indexStub(@NotNull final PropertyStub stub, @NotNull final IndexSink sink) {
|
||||
|
||||
@@ -206,7 +206,7 @@ public class PyFileElementType extends IStubFileElementType<PyFileStub> {
|
||||
int size = dataStream.readVarInt();
|
||||
names = new ArrayList<>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
names.add(dataStream.readName().getString());
|
||||
names.add(dataStream.readNameString());
|
||||
}
|
||||
}
|
||||
return names;
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.stubs.*;
|
||||
import com.intellij.psi.util.QualifiedName;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import com.jetbrains.python.PyElementTypes;
|
||||
import com.jetbrains.python.psi.*;
|
||||
import com.jetbrains.python.psi.impl.PyClassImpl;
|
||||
@@ -165,7 +164,7 @@ public class PyClassElementType extends PyStubElementType<PyClassStub, PyClass>
|
||||
|
||||
@NotNull
|
||||
public PyClassStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
|
||||
final String name = StringRef.toString(dataStream.readName());
|
||||
final String name = dataStream.readNameString();
|
||||
|
||||
final int superClassCount = dataStream.readByte();
|
||||
final Map<QualifiedName, QualifiedName> superClasses = new LinkedHashMap<>();
|
||||
@@ -178,10 +177,10 @@ public class PyClassElementType extends PyStubElementType<PyClassStub, PyClass>
|
||||
final ArrayList<String> baseClassesText = new ArrayList<>();
|
||||
for (int i = 0; i < baseClassesCount; i++) {
|
||||
final boolean isParametrized = dataStream.readBoolean();
|
||||
final StringRef ref = dataStream.readName();
|
||||
baseClassesText.add(ref != null ? ref.getString() : null);
|
||||
String ref = dataStream.readNameString();
|
||||
baseClassesText.add(ref);
|
||||
if (ref != null && isParametrized) {
|
||||
parametrizedBaseClasses.add(ref.getString());
|
||||
parametrizedBaseClasses.add(ref);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,12 +29,12 @@ class PyDataclassFieldStubImpl private constructor(private val calleeName: Quali
|
||||
|
||||
@Throws(IOException::class)
|
||||
fun deserialize(stream: StubInputStream): PyDataclassFieldStub? {
|
||||
val calleeName = stream.readName() ?: return null
|
||||
val calleeName = stream.readNameString() ?: return null
|
||||
val hasDefault = stream.readBoolean()
|
||||
val hasDefaultFactory = stream.readBoolean()
|
||||
val initValue = stream.readBoolean()
|
||||
|
||||
return PyDataclassFieldStubImpl(QualifiedName.fromDottedString(calleeName.string), hasDefault, hasDefaultFactory, initValue)
|
||||
return PyDataclassFieldStubImpl(QualifiedName.fromDottedString(calleeName), hasDefault, hasDefaultFactory, initValue)
|
||||
}
|
||||
|
||||
private fun calculateFullyQCalleeName(callee: PyReferenceExpression): QualifiedName? {
|
||||
|
||||
@@ -91,22 +91,22 @@ public class PyFunctionElementType extends PyStubElementType<PyFunctionStub, PyF
|
||||
@Override
|
||||
@NotNull
|
||||
public PyFunctionStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
|
||||
String name = StringRef.toString(dataStream.readName());
|
||||
String name = dataStream.readNameString();
|
||||
String docString = dataStream.readUTFFast();
|
||||
StringRef deprecationMessage = dataStream.readName();
|
||||
String deprecationMessage = dataStream.readNameString();
|
||||
final boolean isAsync = dataStream.readBoolean();
|
||||
final boolean isGenerator = dataStream.readBoolean();
|
||||
final boolean onlyRaisesNotImplementedError = dataStream.readBoolean();
|
||||
final StringRef typeComment = dataStream.readName();
|
||||
final StringRef annotationContent = dataStream.readName();
|
||||
String typeComment = dataStream.readNameString();
|
||||
String annotationContent = dataStream.readNameString();
|
||||
return new PyFunctionStubImpl(name,
|
||||
StringUtil.nullize(docString),
|
||||
deprecationMessage == null ? null : deprecationMessage.getString(),
|
||||
deprecationMessage,
|
||||
isAsync,
|
||||
isGenerator,
|
||||
onlyRaisesNotImplementedError,
|
||||
typeComment == null ? null : typeComment.getString(),
|
||||
annotationContent == null ? null : annotationContent.getString(),
|
||||
typeComment,
|
||||
annotationContent,
|
||||
parentStub,
|
||||
getStubElementType());
|
||||
}
|
||||
|
||||
@@ -72,8 +72,8 @@ public class PyImportElementElementType extends PyStubElementType<PyImportElemen
|
||||
@NotNull
|
||||
public PyImportElementStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
QualifiedName qName = QualifiedName.deserialize(dataStream);
|
||||
StringRef asName = dataStream.readName();
|
||||
return new PyImportElementStubImpl(qName, asName.getString(), parentStub, getStubElementType());
|
||||
String asName = dataStream.readNameString();
|
||||
return new PyImportElementStubImpl(qName, asName, parentStub, getStubElementType());
|
||||
}
|
||||
|
||||
protected IStubElementType getStubElementType() {
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.intellij.psi.stubs.IStubElementType;
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.psi.stubs.StubInputStream;
|
||||
import com.intellij.psi.stubs.StubOutputStream;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import com.jetbrains.python.PyElementTypes;
|
||||
import com.jetbrains.python.psi.PyNamedParameter;
|
||||
import com.jetbrains.python.psi.PyStubElementType;
|
||||
@@ -84,17 +83,17 @@ public class PyNamedParameterElementType extends PyStubElementType<PyNamedParame
|
||||
@Override
|
||||
@NotNull
|
||||
public PyNamedParameterStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
|
||||
String name = StringRef.toString(dataStream.readName());
|
||||
String name = dataStream.readNameString();
|
||||
byte flags = dataStream.readByte();
|
||||
final StringRef defaultValueText = dataStream.readName();
|
||||
final StringRef typeComment = dataStream.readName();
|
||||
final StringRef annotation = dataStream.readName();
|
||||
String defaultValueText = dataStream.readNameString();
|
||||
String typeComment = dataStream.readNameString();
|
||||
String annotation = dataStream.readNameString();
|
||||
return new PyNamedParameterStubImpl(name,
|
||||
(flags & POSITIONAL_CONTAINER) != 0,
|
||||
(flags & KEYWORD_CONTAINER) != 0,
|
||||
defaultValueText == null ? null : defaultValueText.getString(),
|
||||
typeComment == null ? null : typeComment.getString(),
|
||||
annotation == null ? null : annotation.getString(),
|
||||
defaultValueText,
|
||||
typeComment,
|
||||
annotation,
|
||||
parentStub, getStubElementType());
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.intellij.psi.stubs.StubInputStream;
|
||||
import com.intellij.psi.stubs.StubOutputStream;
|
||||
import com.intellij.psi.util.QualifiedName;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import com.jetbrains.python.PyNames;
|
||||
import com.jetbrains.python.codeInsight.typing.PyTypingTypeProvider;
|
||||
import com.jetbrains.python.psi.*;
|
||||
@@ -98,8 +97,8 @@ public class PyNamedTupleStubImpl implements PyNamedTupleStub {
|
||||
|
||||
@Nullable
|
||||
public static PyNamedTupleStub deserialize(@NotNull StubInputStream stream) throws IOException {
|
||||
final StringRef calleeName = stream.readName();
|
||||
final StringRef name = stream.readName();
|
||||
String calleeName = stream.readNameString();
|
||||
String name = stream.readNameString();
|
||||
final LinkedHashMap<String, Optional<String>> fields = deserializeFields(stream, stream.readVarInt());
|
||||
|
||||
if (calleeName == null || name == null) {
|
||||
@@ -107,8 +106,8 @@ public class PyNamedTupleStubImpl implements PyNamedTupleStub {
|
||||
}
|
||||
|
||||
return new PyNamedTupleStubImpl(
|
||||
QualifiedName.fromDottedString(calleeName.getString()),
|
||||
name.getString(),
|
||||
QualifiedName.fromDottedString(calleeName),
|
||||
name,
|
||||
fields
|
||||
);
|
||||
}
|
||||
@@ -177,8 +176,8 @@ public class PyNamedTupleStubImpl implements PyNamedTupleStub {
|
||||
final LinkedHashMap<String, Optional<String>> fields = new LinkedHashMap<>(fieldsSize);
|
||||
|
||||
for (int i = 0; i < fieldsSize; i++) {
|
||||
final String name = StringRef.toString(stream.readName());
|
||||
final String type = StringRef.toString(stream.readName());
|
||||
final String name = stream.readNameString();
|
||||
final String type = stream.readNameString();
|
||||
|
||||
if (name != null) {
|
||||
fields.put(name, Optional.ofNullable(type));
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.intellij.psi.stubs.StubInputStream;
|
||||
import com.intellij.psi.stubs.StubOutputStream;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.QualifiedName;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import com.jetbrains.python.PyElementTypes;
|
||||
import com.jetbrains.python.PyNames;
|
||||
import com.jetbrains.python.PythonDialectsTokenSetProvider;
|
||||
@@ -127,19 +126,17 @@ public class PyTargetExpressionElementType extends PyStubElementType<PyTargetExp
|
||||
@Override
|
||||
@NotNull
|
||||
public PyTargetExpressionStub deserialize(@NotNull final StubInputStream stream, final StubElement parentStub) throws IOException {
|
||||
String name = StringRef.toString(stream.readName());
|
||||
String name = stream.readNameString();
|
||||
String docString = stream.readUTFFast();
|
||||
if (docString.isEmpty()) {
|
||||
docString = null;
|
||||
}
|
||||
PyTargetExpressionStub.InitializerType initializerType = PyTargetExpressionStub.InitializerType.fromIndex(stream.readVarInt());
|
||||
final StringRef typeCommentRef = stream.readName();
|
||||
final String typeComment = typeCommentRef == null ? null : typeCommentRef.getString();
|
||||
final StringRef annotationRef = stream.readName();
|
||||
final String annotation = annotationRef == null ? null : annotationRef.getString();
|
||||
String typeComment = stream.readNameString();
|
||||
String annotation = stream.readNameString();
|
||||
final boolean hasAssignedValue = stream.readBoolean();
|
||||
if (initializerType == PyTargetExpressionStub.InitializerType.Custom) {
|
||||
final String typeName = stream.readName().getString();
|
||||
final String typeName = stream.readNameString();
|
||||
for(CustomTargetExpressionStubType type: getCustomStubTypes()) {
|
||||
if (type.getClass().getCanonicalName().equals(typeName)) {
|
||||
CustomTargetExpressionStub stub = type.deserializeStub(stream);
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.psi.stubs.StubInputStream;
|
||||
import com.intellij.psi.stubs.StubOutputStream;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import com.jetbrains.python.psi.PyStubElementType;
|
||||
import com.jetbrains.python.psi.PyTupleParameter;
|
||||
import com.jetbrains.python.psi.impl.PyTupleParameterImpl;
|
||||
@@ -58,8 +57,7 @@ public class PyTupleParameterElementType extends PyStubElementType<PyTupleParame
|
||||
@Override
|
||||
@NotNull
|
||||
public PyTupleParameterStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
final StringRef defaultValueText = dataStream.readName();
|
||||
return new PyTupleParameterStubImpl(defaultValueText == null ? null : defaultValueText.getString(), parentStub);
|
||||
return new PyTupleParameterStubImpl(dataStream.readNameString(), parentStub);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -131,8 +131,8 @@ public class PyTypingAliasStubType extends CustomTargetExpressionStubType<PyTypi
|
||||
@Nullable
|
||||
@Override
|
||||
public PyTypingAliasStub deserializeStub(StubInputStream stream) throws IOException {
|
||||
final StringRef ref = stream.readName();
|
||||
return ref != null ? new PyTypingTypeAliasStubImpl(ref.getString()) : null;
|
||||
String ref = stream.readNameString();
|
||||
return ref != null ? new PyTypingTypeAliasStubImpl(ref) : null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -48,10 +48,10 @@ class PyTypingNewTypeStubImpl private constructor(val qualifiedName: String,
|
||||
@Throws(IOException::class)
|
||||
fun deserialize(stream: StubInputStream?): PyTypingNewTypeStub? {
|
||||
if (stream != null) {
|
||||
val typeName = stream.readName()
|
||||
val classType = stream.readName()
|
||||
val typeName = stream.readNameString()
|
||||
val classType = stream.readNameString()
|
||||
if (typeName != null && classType != null) {
|
||||
return PyTypingNewTypeStubImpl(typeName.string, classType.string)
|
||||
return PyTypingNewTypeStubImpl(typeName, classType)
|
||||
}
|
||||
}
|
||||
return null
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.jetbrains.python.psi.stubs;
|
||||
import com.intellij.psi.stubs.StubInputStream;
|
||||
import com.intellij.psi.stubs.StubOutputStream;
|
||||
import com.intellij.psi.util.QualifiedName;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import com.jetbrains.python.PyNames;
|
||||
import com.jetbrains.python.psi.PyExpression;
|
||||
import com.jetbrains.python.psi.PyNoneLiteralExpression;
|
||||
@@ -82,8 +81,7 @@ public class PropertyStubStorage extends PropertyBunch<String> implements Custom
|
||||
me.mySetter = readOne(stream);
|
||||
me.myDeleter = readOne(stream);
|
||||
//
|
||||
StringRef ref = stream.readName();
|
||||
me.myDoc = ref != null? ref.getString() : null;
|
||||
me.myDoc = stream.readNameString();
|
||||
return me;
|
||||
}
|
||||
|
||||
@@ -92,10 +90,9 @@ public class PropertyStubStorage extends PropertyBunch<String> implements Custom
|
||||
|
||||
@Nullable
|
||||
private static Maybe<String> readOne(StubInputStream stream) throws IOException {
|
||||
StringRef ref = stream.readName();
|
||||
if (ref == null) return none;
|
||||
String s = stream.readNameString();
|
||||
if (s == null) return none;
|
||||
else {
|
||||
String s = ref.getString();
|
||||
if (IMPOSSIBLE_NAME.equals(s)) return unknown;
|
||||
else return new Maybe<>(s);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user