Replaced JetMethodAnnotationWriter.writeFlags(BitSet) method with method taking indices of bits which should be set.

This commit is contained in:
Evgeny Gerashchenko
2012-06-08 19:13:40 +04:00
parent c446fa3fc9
commit ef856c5888
3 changed files with 11 additions and 5 deletions
@@ -135,7 +135,7 @@ public class FunctionCodegen {
throw new IllegalStateException();
}
JetMethodAnnotationWriter aw = JetMethodAnnotationWriter.visitAnnotation(mv);
aw.writeFlags(new BitSet());
aw.writeFlags();
aw.writeNullableReturnType(functionDescriptor.getReturnType().isNullable());
aw.writeTypeParameters(jvmSignature.getKotlinTypeParameter());
aw.writeReturnType(jvmSignature.getKotlinReturnType());
@@ -223,9 +223,7 @@ public class PropertyCodegen {
public static void generateJetPropertyAnnotation(MethodVisitor mv, @NotNull String kotlinType, @NotNull String typeParameters) {
JetMethodAnnotationWriter aw = JetMethodAnnotationWriter.visitAnnotation(mv);
BitSet flags = new BitSet();
flags.set(JvmStdlibNames.JET_METHOD_FLAG_PROPERTY_BIT);
aw.writeFlags(flags);
aw.writeFlags(JvmStdlibNames.JET_METHOD_FLAG_PROPERTY_BIT);
aw.writeTypeParameters(typeParameters);
aw.writePropertyType(kotlinType);
aw.visitEnd();
@@ -33,7 +33,15 @@ public class JetMethodAnnotationWriter {
this.av = av;
}
public void writeFlags(BitSet flags) {
public void writeFlags(int... flagBits) {
BitSet bitSet = new BitSet();
for (int bit : flagBits) {
bitSet.set(bit);
}
writeFlags(bitSet);
}
private void writeFlags(BitSet flags) {
int flagsValue = 0;
for (int bit = 0; bit < flags.length(); bit++) {
if (flags.get(bit)) {