specify the exact collection size when we know
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2000-2016 JetBrains s.r.o.
|
* Copyright 2000-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -93,7 +93,7 @@ public class StructClass extends StructMember {
|
|||||||
|
|
||||||
// fields
|
// fields
|
||||||
length = in.readUnsignedShort();
|
length = in.readUnsignedShort();
|
||||||
fields = new VBStyleCollection<>();
|
fields = new VBStyleCollection<>(length);
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
StructField field = new StructField(in, this);
|
StructField field = new StructField(in, this);
|
||||||
fields.addWithKey(field, InterpreterUtil.makeUniqueKey(field.getName(), field.getDescriptor()));
|
fields.addWithKey(field, InterpreterUtil.makeUniqueKey(field.getName(), field.getDescriptor()));
|
||||||
@@ -101,7 +101,7 @@ public class StructClass extends StructMember {
|
|||||||
|
|
||||||
// methods
|
// methods
|
||||||
length = in.readUnsignedShort();
|
length = in.readUnsignedShort();
|
||||||
methods = new VBStyleCollection<>();
|
methods = new VBStyleCollection<>(length);
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
StructMethod method = new StructMethod(in, this);
|
StructMethod method = new StructMethod(in, this);
|
||||||
methods.addWithKey(method, InterpreterUtil.makeUniqueKey(method.getName(), method.getDescriptor()));
|
methods.addWithKey(method, InterpreterUtil.makeUniqueKey(method.getName(), method.getDescriptor()));
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ public class StructMember {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected VBStyleCollection<StructGeneralAttribute, String> readAttributes(DataInputFullStream in, ConstantPool pool) throws IOException {
|
protected VBStyleCollection<StructGeneralAttribute, String> readAttributes(DataInputFullStream in, ConstantPool pool) throws IOException {
|
||||||
VBStyleCollection<StructGeneralAttribute, String> attributes = new VBStyleCollection<>();
|
|
||||||
|
|
||||||
int length = in.readUnsignedShort();
|
int length = in.readUnsignedShort();
|
||||||
|
|
||||||
|
VBStyleCollection<StructGeneralAttribute, String> attributes = new VBStyleCollection<>(length);
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
int nameIndex = in.readUnsignedShort();
|
int nameIndex = in.readUnsignedShort();
|
||||||
String name = pool.getPrimitiveConstant(nameIndex).getString();
|
String name = pool.getPrimitiveConstant(nameIndex).getString();
|
||||||
|
|||||||
Reference in New Issue
Block a user