mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-106787: long string arrays in Groovy stubs
This commit is contained in:
@@ -44,9 +44,16 @@ import java.util.List;
|
||||
*/
|
||||
public class GrStubUtils {
|
||||
private static final Logger LOG = Logger.getInstance(GrStubUtils.class);
|
||||
public static final int TOO_LONG = -1;
|
||||
|
||||
public static void writeStringArray(StubOutputStream dataStream, String[] array) throws IOException {
|
||||
dataStream.writeByte(array.length);
|
||||
if (array.length >= Byte.MAX_VALUE) {
|
||||
dataStream.writeByte(TOO_LONG);
|
||||
dataStream.writeInt(array.length);
|
||||
}
|
||||
else {
|
||||
dataStream.writeByte(array.length);
|
||||
}
|
||||
for (String s : array) {
|
||||
LOG.assertTrue(s != null);
|
||||
dataStream.writeName(s);
|
||||
@@ -54,9 +61,12 @@ public class GrStubUtils {
|
||||
}
|
||||
|
||||
public static String[] readStringArray(StubInputStream dataStream) throws IOException {
|
||||
final byte b = dataStream.readByte();
|
||||
final String[] annNames = new String[b];
|
||||
for (int i = 0; i < b; i++) {
|
||||
int length = dataStream.readByte();
|
||||
if (length == TOO_LONG) {
|
||||
length = dataStream.readInt();
|
||||
}
|
||||
final String[] annNames = new String[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
annNames[i] = dataStream.readName().toString();
|
||||
}
|
||||
return annNames;
|
||||
|
||||
+1
-2
@@ -53,8 +53,7 @@ public abstract class GrMethodElementType extends GrStubElementType<GrMethodStub
|
||||
public void serialize(@NotNull GrMethodStub stub, @NotNull StubOutputStream dataStream) throws IOException {
|
||||
dataStream.writeName(stub.getName());
|
||||
GrStubUtils.writeStringArray(dataStream, stub.getAnnotations());
|
||||
final String[] namedParameters = stub.getNamedParameters();
|
||||
GrStubUtils.writeStringArray(dataStream, namedParameters.length <= Byte.MAX_VALUE ? namedParameters : ArrayUtil.EMPTY_STRING_ARRAY);
|
||||
GrStubUtils.writeStringArray(dataStream, stub.getNamedParameters());
|
||||
GrStubUtils.writeNullableString(dataStream, stub.getTypeText());
|
||||
dataStream.writeByte(stub.getFlags());
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -55,7 +55,7 @@ public class GrStubFileElementType extends IStubFileElementType<GrFileStub> {
|
||||
|
||||
@Override
|
||||
public int getStubVersion() {
|
||||
return super.getStubVersion() + 16;
|
||||
return super.getStubVersion() + 17;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user