Replaced int flags with BitSet in internal API.
This commit is contained in:
@@ -29,7 +29,6 @@ import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor;
|
||||
import org.objectweb.asm.Label;
|
||||
@@ -136,7 +135,7 @@ public class FunctionCodegen {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
JetMethodAnnotationWriter aw = JetMethodAnnotationWriter.visitAnnotation(mv);
|
||||
aw.writeFlags(JvmStdlibNames.JET_METHOD_FLAGS_DEFAULT);
|
||||
aw.writeFlags(new BitSet());
|
||||
aw.writeNullableReturnType(functionDescriptor.getReturnType().isNullable());
|
||||
aw.writeTypeParameters(jvmSignature.getKotlinTypeParameter());
|
||||
aw.writeReturnType(jvmSignature.getKotlinReturnType());
|
||||
|
||||
@@ -36,6 +36,8 @@ import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.commons.InstructionAdapter;
|
||||
|
||||
import java.util.BitSet;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
@@ -221,7 +223,9 @@ public class PropertyCodegen {
|
||||
|
||||
public static void generateJetPropertyAnnotation(MethodVisitor mv, @NotNull String kotlinType, @NotNull String typeParameters) {
|
||||
JetMethodAnnotationWriter aw = JetMethodAnnotationWriter.visitAnnotation(mv);
|
||||
aw.writeFlags(JvmStdlibNames.JET_METHOD_FLAG_PROPERTY);
|
||||
BitSet flags = new BitSet();
|
||||
flags.set(JvmStdlibNames.JET_METHOD_FLAG_PROPERTY_BIT);
|
||||
aw.writeFlags(flags);
|
||||
aw.writeTypeParameters(typeParameters);
|
||||
aw.writePropertyType(kotlinType);
|
||||
aw.visitEnd();
|
||||
|
||||
+14
-5
@@ -21,6 +21,8 @@ import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
|
||||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
|
||||
import java.util.BitSet;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
@@ -30,13 +32,20 @@ public class JetMethodAnnotationWriter {
|
||||
private JetMethodAnnotationWriter(AnnotationVisitor av) {
|
||||
this.av = av;
|
||||
}
|
||||
|
||||
public void writeFlags(int flags) {
|
||||
if (flags != JvmStdlibNames.JET_METHOD_FLAGS_DEFAULT) {
|
||||
av.visit(JvmStdlibNames.JET_METHOD_FLAGS_FIELD, flags);
|
||||
|
||||
public void writeFlags(BitSet flags) {
|
||||
int flagsValue = 0;
|
||||
for (int bit = 0; bit < flags.length(); bit++) {
|
||||
if (flags.get(bit)) {
|
||||
flagsValue |= (1 << bit);
|
||||
}
|
||||
}
|
||||
|
||||
if (flagsValue != JvmStdlibNames.JET_METHOD_FLAGS_DEFAULT_VALUE) {
|
||||
av.visit(JvmStdlibNames.JET_METHOD_FLAGS_FIELD, flagsValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void writeTypeParameters(@NotNull String typeParameters) {
|
||||
if (typeParameters.length() > 0) {
|
||||
av.visit(JvmStdlibNames.JET_METHOD_TYPE_PARAMETERS_FIELD, typeParameters);
|
||||
|
||||
Reference in New Issue
Block a user