use of org.jetbrains.plugins.groovy.lang.resolve.GroovyTraitFieldsFileIndex.TraitFieldDescriptor in project intellij-community by JetBrains.
the class GrTraitUtil method doCollectCompiledTraitFields.
private static void doCollectCompiledTraitFields(ClsClassImpl trait, Collection<GrField> result) {
VirtualFile traitFile = trait.getContainingFile().getVirtualFile();
if (traitFile == null)
return;
VirtualFile helperFile = traitFile.getParent().findChild(trait.getName() + GroovyTraitFieldsFileIndex.HELPER_SUFFIX);
if (helperFile == null)
return;
int key = FileBasedIndex.getFileId(helperFile);
final List<Collection<TraitFieldDescriptor>> values = FileBasedIndex.getInstance().getValues(GroovyTraitFieldsFileIndex.INDEX_ID, key, trait.getResolveScope());
values.forEach(descriptors -> descriptors.forEach(descriptor -> result.add(createTraitField(descriptor, trait))));
}
use of org.jetbrains.plugins.groovy.lang.resolve.GroovyTraitFieldsFileIndex.TraitFieldDescriptor in project intellij-community by JetBrains.
the class GroovyTraitFieldsFileIndex method save.
@Override
public void save(@NotNull DataOutput out, Collection<TraitFieldDescriptor> values) throws IOException {
writeINT(out, values.size());
for (TraitFieldDescriptor descriptor : values) {
out.writeByte(descriptor.flags);
writeUTF(out, descriptor.typeString);
writeUTF(out, descriptor.name);
}
}
use of org.jetbrains.plugins.groovy.lang.resolve.GroovyTraitFieldsFileIndex.TraitFieldDescriptor in project intellij-community by JetBrains.
the class GroovyTraitFieldsFileIndex method read.
@Override
public Collection<TraitFieldDescriptor> read(@NotNull DataInput in) throws IOException {
int size = readINT(in);
Collection<TraitFieldDescriptor> result = ContainerUtil.newArrayListWithCapacity(size);
for (int i = 0; i < size; i++) {
result.add(new TraitFieldDescriptor(in.readByte(), readUTF(in), readUTF(in)));
}
return result;
}
Aggregations