diff --git a/.classpath b/.classpath index 14c0c49c3a74bcca8f9725ed0f45cac86dbb5576..3a4499b6c0e577280ce69894d82da68ea8e60566 100644 --- a/.classpath +++ b/.classpath @@ -15,6 +15,6 @@ - + diff --git a/build.properties b/build.properties index 4480221a757e4fbcab8979250f5470dbd7f40fcf..d5e8539b3c917ae28264eb71abb79fe46ac7919d 100644 --- a/build.properties +++ b/build.properties @@ -35,6 +35,7 @@ build.shvm=${build.dir}/shvm build.shvm.dispatch=${build.shvm}-dispatch build.test=${build.dir}/test build.doc.intro=${build.dir}/intro +build.disl.native=${build.dir}/native # Build system libraries build.ivy.url = http://central.maven.org/maven2/org/apache/ivy/ivy/${ivy.rev}/ivy-${ivy.rev}.jar diff --git a/build.xml b/build.xml index bce63cc79825c660e37283e441b0df151466976c..966bf09d01db39150923abb78dade42353e9f468 100644 --- a/build.xml +++ b/build.xml @@ -513,7 +513,7 @@ @@ -527,13 +527,25 @@ - - + + - - - - + + + + + + + + + + + + + + + + diff --git a/dependencies.properties b/dependencies.properties index 1bb0e2dd18b4e879ee3ec356e5cda686fa5b008b..bbff0284ff324a9aa05e2bf877635aae81a919ec 100644 --- a/dependencies.properties +++ b/dependencies.properties @@ -12,6 +12,6 @@ asm.org=org.ow2.asm log4j.rev=1.2.17 log4j.org=log4j -protobuf.rev=3.0.1 +protobuf.rev=3.11.0 protobuf.org=com.google.protobuf -protobuf.lib=protobuf-lite +protobuf.lib=protobuf-javalite diff --git a/lib/artifacts.lst b/lib/artifacts.lst index 47025d4f9e45ab8e3507dc50029cb0394caeb3f5..3b5770977441fb818fa550497c8ea70d8b1bbef1 100644 --- a/lib/artifacts.lst +++ b/lib/artifacts.lst @@ -6,6 +6,6 @@ lib/disl/asm-tree.jar lib/disl/asm-util.jar lib/disl/asm.jar lib/disl/log4j.jar -lib/disl/protobuf-lite.jar +lib/disl/protobuf-javalite.jar lib/test/hamcrest-core.jar lib/test/junit.jar diff --git a/src-disl-agent/dislagent.c b/src-disl-agent/dislagent.c index cfbb2db7401349ffdc627e6ac0eedf6c0fde8937..27e8015231ce002f7be1af0f5d8ee2faf7da40d5 100644 --- a/src-disl-agent/dislagent.c +++ b/src-disl-agent/dislagent.c @@ -219,10 +219,8 @@ __instrument_class ( // connection again. // InstrumentClassRequest request = INSTRUMENT_CLASS_REQUEST__INIT; - request.has_flags = true; request.flags = request_flags; request.classname = (char *) class_name; - request.has_classbytes = true; request.classbytes.len = class_def->class_byte_count; request.classbytes.data = (uint8_t *) class_def->class_bytes; @@ -266,7 +264,6 @@ __instrument_class ( class_def->class_byte_count = response->classbytes.len; class_def->class_bytes = response->classbytes.data; - response->has_classbytes = false; response->classbytes.len = 0; response->classbytes.data = NULL; diff --git a/src-disl-agent/dislserver.pb-c.c b/src-disl-agent/dislserver.pb-c.c index 75e44dcb36ae9feb84bc124b07d3a42c8f9496b5..39838db833cbe3693ce1c2afa6e84e05b96ea86f 100644 --- a/src-disl-agent/dislserver.pb-c.c +++ b/src-disl-agent/dislserver.pb-c.c @@ -10,7 +10,7 @@ void instrument_class_request__init (InstrumentClassRequest *message) { - static InstrumentClassRequest init_value = INSTRUMENT_CLASS_REQUEST__INIT; + static const InstrumentClassRequest init_value = INSTRUMENT_CLASS_REQUEST__INIT; *message = init_value; } size_t instrument_class_request__get_packed_size @@ -47,13 +47,15 @@ void instrument_class_request__free_unpacked (InstrumentClassRequest *message, ProtobufCAllocator *allocator) { + if(!message) + return; assert(message->base.descriptor == &instrument_class_request__descriptor); protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); } void instrument_class_response__init (InstrumentClassResponse *message) { - static InstrumentClassResponse init_value = INSTRUMENT_CLASS_RESPONSE__INIT; + static const InstrumentClassResponse init_value = INSTRUMENT_CLASS_RESPONSE__INIT; *message = init_value; } size_t instrument_class_response__get_packed_size @@ -90,6 +92,8 @@ void instrument_class_response__free_unpacked (InstrumentClassResponse *message, ProtobufCAllocator *allocator) { + if(!message) + return; assert(message->base.descriptor == &instrument_class_response__descriptor); protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); } @@ -98,9 +102,9 @@ static const ProtobufCFieldDescriptor instrument_class_request__field_descriptor { "flags", 1, - PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_LABEL_NONE, PROTOBUF_C_TYPE_INT32, - offsetof(InstrumentClassRequest, has_flags), + 0, /* quantifier_offset */ offsetof(InstrumentClassRequest, flags), NULL, NULL, @@ -110,21 +114,21 @@ static const ProtobufCFieldDescriptor instrument_class_request__field_descriptor { "className", 2, - PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_LABEL_NONE, PROTOBUF_C_TYPE_STRING, 0, /* quantifier_offset */ offsetof(InstrumentClassRequest, classname), NULL, - NULL, + &protobuf_c_empty_string, 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, { "classBytes", 3, - PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_LABEL_NONE, PROTOBUF_C_TYPE_BYTES, - offsetof(InstrumentClassRequest, has_classbytes), + 0, /* quantifier_offset */ offsetof(InstrumentClassRequest, classbytes), NULL, NULL, @@ -162,9 +166,9 @@ static const ProtobufCFieldDescriptor instrument_class_response__field_descripto { "result", 1, - PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_LABEL_NONE, PROTOBUF_C_TYPE_ENUM, - offsetof(InstrumentClassResponse, has_result), + 0, /* quantifier_offset */ offsetof(InstrumentClassResponse, result), &instrument_class_result__descriptor, NULL, @@ -174,21 +178,21 @@ static const ProtobufCFieldDescriptor instrument_class_response__field_descripto { "errorMessage", 2, - PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_LABEL_NONE, PROTOBUF_C_TYPE_STRING, 0, /* quantifier_offset */ offsetof(InstrumentClassResponse, errormessage), NULL, - NULL, + &protobuf_c_empty_string, 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, { "classBytes", 3, - PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_LABEL_NONE, PROTOBUF_C_TYPE_BYTES, - offsetof(InstrumentClassResponse, has_classbytes), + 0, /* quantifier_offset */ offsetof(InstrumentClassResponse, classbytes), NULL, NULL, diff --git a/src-disl-agent/dislserver.pb-c.h b/src-disl-agent/dislserver.pb-c.h index e4118084c7c8dcda67a842176f905cd1e0b52777..7675de78c9993ec3dec08a41fa17093c578accc0 100644 --- a/src-disl-agent/dislserver.pb-c.h +++ b/src-disl-agent/dislserver.pb-c.h @@ -8,9 +8,9 @@ PROTOBUF_C__BEGIN_DECLS -#if PROTOBUF_C_VERSION_NUMBER < 1000000 +#if PROTOBUF_C_VERSION_NUMBER < 1003000 # error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. -#elif 1002001 < PROTOBUF_C_MIN_COMPILER_VERSION +#elif 1003002 < PROTOBUF_C_MIN_COMPILER_VERSION # error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. #endif @@ -33,29 +33,25 @@ typedef enum _InstrumentClassResult { struct _InstrumentClassRequest { ProtobufCMessage base; - protobuf_c_boolean has_flags; int32_t flags; char *classname; - protobuf_c_boolean has_classbytes; ProtobufCBinaryData classbytes; }; #define INSTRUMENT_CLASS_REQUEST__INIT \ { PROTOBUF_C_MESSAGE_INIT (&instrument_class_request__descriptor) \ - , 0,0, NULL, 0,{0,NULL} } + , 0, (char *)protobuf_c_empty_string, {0,NULL} } struct _InstrumentClassResponse { ProtobufCMessage base; - protobuf_c_boolean has_result; InstrumentClassResult result; char *errormessage; - protobuf_c_boolean has_classbytes; ProtobufCBinaryData classbytes; }; #define INSTRUMENT_CLASS_RESPONSE__INIT \ { PROTOBUF_C_MESSAGE_INIT (&instrument_class_response__descriptor) \ - , 0,0, NULL, 0,{0,NULL} } + , INSTRUMENT_CLASS_RESULT__CLASS_UNMODIFIED, (char *)protobuf_c_empty_string, {0,NULL} } /* InstrumentClassRequest methods */ diff --git a/src-disl-agent/protobuf-c.c b/src-disl-agent/protobuf-c.c index 5debac820862642dde1c32f00b0b478801502c8e..4c8aaa0738765b0d139b67d8f76256000800d869 100644 --- a/src-disl-agent/protobuf-c.c +++ b/src-disl-agent/protobuf-c.c @@ -2072,6 +2072,11 @@ parse_tag_and_wiretype(size_t len, unsigned shift = 4; unsigned rv; + /* 0 is not a valid tag value */ + if ((data[0] & 0xf8) == 0) { + return 0; + } + *wiretype_out = data[0] & 7; if ((data[0] & 0x80) == 0) { *tag_out = tag; @@ -2103,18 +2108,18 @@ struct _ScannedMember { const uint8_t *data; /**< Pointer to field data. */ }; -static inline uint32_t +static inline size_t scan_length_prefixed_data(size_t len, const uint8_t *data, size_t *prefix_len_out) { unsigned hdr_max = len < 5 ? len : 5; unsigned hdr_len; - uint32_t val = 0; + size_t val = 0; unsigned i; unsigned shift = 0; for (i = 0; i < hdr_max; i++) { - val |= (data[i] & 0x7f) << shift; + val |= ((size_t)data[i] & 0x7f) << shift; shift += 7; if ((data[i] & 0x80) == 0) break; @@ -2125,8 +2130,15 @@ scan_length_prefixed_data(size_t len, const uint8_t *data, } hdr_len = i + 1; *prefix_len_out = hdr_len; + if (val > INT_MAX) { + // Protobuf messages should always be less than 2 GiB in size. + // We also want to return early here so that hdr_len + val does + // not overflow on 32-bit systems. + PROTOBUF_C_UNPACK_ERROR("length prefix of %lu is too large", val); + return 0; + } if (hdr_len + val > len) { - PROTOBUF_C_UNPACK_ERROR("data too short after length-prefix of %u", val); + PROTOBUF_C_UNPACK_ERROR("data too short after length-prefix of %lu", val); return 0; } return hdr_len + val; @@ -2239,6 +2251,8 @@ merge_messages(ProtobufCMessage *earlier_msg, latter_msg->descriptor ->field_ranges, *earlier_case_p); + if (field_index < 0) + return FALSE; field = latter_msg->descriptor->fields + field_index; } else { @@ -2627,14 +2641,17 @@ parse_oneof_member (ScannedMember *scanned_member, /* If we have already parsed a member of this oneof, free it. */ if (*oneof_case != 0) { + const ProtobufCFieldDescriptor *old_field; + size_t el_size; /* lookup field */ int field_index = int_range_lookup(message->descriptor->n_field_ranges, message->descriptor->field_ranges, *oneof_case); - const ProtobufCFieldDescriptor *old_field = - message->descriptor->fields + field_index; - size_t el_size = sizeof_elt_in_repeated_array(old_field->type); + if (field_index < 0) + return FALSE; + old_field = message->descriptor->fields + field_index; + el_size = sizeof_elt_in_repeated_array(old_field->type); switch (old_field->type) { case PROTOBUF_C_TYPE_STRING: { @@ -3411,6 +3428,13 @@ protobuf_c_message_check(const ProtobufCMessage *message) ProtobufCLabel label = f->label; void *field = STRUCT_MEMBER_P (message, f->offset); + if (f->flags & PROTOBUF_C_FIELD_FLAG_ONEOF) { + const uint32_t *oneof_case = STRUCT_MEMBER_P (message, f->quantifier_offset); + if (f->id != *oneof_case) { + continue; //Do not check if it is an unpopulated oneof member. + } + } + if (label == PROTOBUF_C_LABEL_REPEATED) { size_t *quantity = STRUCT_MEMBER_P (message, f->quantifier_offset); @@ -3639,4 +3663,4 @@ protobuf_c_service_descriptor_get_method_by_name(const ProtobufCServiceDescripto if (strcmp(desc->methods[desc->method_indices_by_name[start]].name, name) == 0) return desc->methods + desc->method_indices_by_name[start]; return NULL; -} +} \ No newline at end of file diff --git a/src-disl-agent/protobuf-c.h b/src-disl-agent/protobuf-c.h index c8fa4fc2a7ce904cd4991b4c3a00e6965e0be9e2..c33237b2f98de745a953c2e2ff6617d1d6d3ea2d 100644 --- a/src-disl-agent/protobuf-c.h +++ b/src-disl-agent/protobuf-c.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2017, Dave Benson and the protobuf-c authors. + * Copyright (c) 2008-2018, Dave Benson and the protobuf-c authors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -790,13 +790,13 @@ protobuf_c_version_number(void); * The version of the protobuf-c headers, represented as a string using the same * format as protobuf_c_version(). */ -#define PROTOBUF_C_VERSION "1.3.0" +#define PROTOBUF_C_VERSION "1.3.2" /** * The version of the protobuf-c headers, represented as an integer using the * same format as protobuf_c_version_number(). */ -#define PROTOBUF_C_VERSION_NUMBER 1003000 +#define PROTOBUF_C_VERSION_NUMBER 1003002 /** * The minimum protoc-c version which works with the current version of the @@ -1103,4 +1103,4 @@ protobuf_c_service_invoke_internal( PROTOBUF_C__END_DECLS -#endif /* PROTOBUF_C_H */ +#endif /* PROTOBUF_C_H */ \ No newline at end of file diff --git a/src-disl/ch/usi/dag/disl/DiSL.java b/src-disl/ch/usi/dag/disl/DiSL.java index 0d3a0d69b5fab5cca5dc0c3290c03d92a677ba86..7db0de810818545116f331459aab8b26103f5772 100644 --- a/src-disl/ch/usi/dag/disl/DiSL.java +++ b/src-disl/ch/usi/dag/disl/DiSL.java @@ -2,6 +2,7 @@ package ch.usi.dag.disl; import java.io.FileOutputStream; import java.io.IOException; +import java.lang.annotation.Native; import java.util.Collection; import java.util.EnumSet; import java.util.HashMap; @@ -429,7 +430,7 @@ public final class DiSL { if (!tlvs.isEmpty ()) { // instrument fields - final ClassNode cnWithFields = new ClassNode (Opcodes.ASM5); + final ClassNode cnWithFields = new ClassNode (Opcodes.ASM7); classNode.accept (new TLVInserter (cnWithFields, tlvs)); // replace original code with instrumented one @@ -586,9 +587,13 @@ public final class DiSL { * used when communicating with DiSL agent. */ public interface Flag { + @Native static final int CREATE_BYPASS = 1 << 0; + @Native static final int DYNAMIC_BYPASS = 1 << 1; + @Native static final int SPLIT_METHODS = 1 << 2; + @Native static final int CATCH_EXCEPTIONS = 1 << 3; } diff --git a/src-disl/ch/usi/dag/disl/TLVInserter.java b/src-disl/ch/usi/dag/disl/TLVInserter.java index a97aa12b0dd860f120c1caadda6d86771ce79fa8..b37ebe7fadccd7f63915ab7ab92a6683373e6428 100644 --- a/src-disl/ch/usi/dag/disl/TLVInserter.java +++ b/src-disl/ch/usi/dag/disl/TLVInserter.java @@ -30,7 +30,7 @@ final class TLVInserter extends ClassVisitor { // public TLVInserter (final ClassVisitor cv, final Set tlvs) { - super (Opcodes.ASM5, cv); + super (Opcodes.ASM7, cv); __threadLocals = tlvs; } @@ -97,7 +97,7 @@ final class TLVInserter extends ClassVisitor { final MethodVisitor mv, final int access, final String name, final String desc ) { - super (Opcodes.ASM5, mv, access, name, desc); + super (Opcodes.ASM7, mv, access, name, desc); assert JavaNames.isConstructorName (name); } diff --git a/src-disl/ch/usi/dag/disl/classparser/AnnotationMapper.java b/src-disl/ch/usi/dag/disl/classparser/AnnotationMapper.java index ca612a843e8a5ae28435e003741d3e4547e9eb08..2aedfa8a25e03d947eea0a748fa660750df215bc 100644 --- a/src-disl/ch/usi/dag/disl/classparser/AnnotationMapper.java +++ b/src-disl/ch/usi/dag/disl/classparser/AnnotationMapper.java @@ -110,7 +110,7 @@ final class AnnotationMapper { Predicate , BiConsumer > consumers = __findConsumers (ac); - an.accept (new AnnotationVisitor (Opcodes.ASM5) { + an.accept (new AnnotationVisitor (Opcodes.ASM7) { @Override public void visit (final String name, final Object value) { __getConsumer (consumers, name).accept (name, value); @@ -149,7 +149,7 @@ final class AnnotationMapper { final BiConsumer __consumer; ListCollector (final String name, final BiConsumer consumer) { - super (Opcodes.ASM5); + super (Opcodes.ASM7); __name = name; __consumer = consumer; diff --git a/src-disl/ch/usi/dag/disl/marker/AfterInitBodyMarker.java b/src-disl/ch/usi/dag/disl/marker/AfterInitBodyMarker.java index 01fd64893ef29df8d81473d895a242ac2f20b857..0a4554153f9eb9641f989b9ab2fe8b3b412d877d 100644 --- a/src-disl/ch/usi/dag/disl/marker/AfterInitBodyMarker.java +++ b/src-disl/ch/usi/dag/disl/marker/AfterInitBodyMarker.java @@ -76,7 +76,7 @@ public class AfterInitBodyMarker extends AbstractMarker { // final AtomicBoolean superInitialized = new AtomicBoolean (false); final AdviceAdapter adapter = new AdviceAdapter ( - Opcodes.ASM5, new MethodVisitor (Opcodes.ASM5) { /* empty */ }, + Opcodes.ASM7, new MethodVisitor (Opcodes.ASM7) { /* empty */ }, method.access, method.name, method.desc ) { @Override diff --git a/src-disl/ch/usi/dag/disl/util/AsmHelper.java b/src-disl/ch/usi/dag/disl/util/AsmHelper.java index 71ebafa5b4561198e4bd4ba33c5ab1b8bf51860f..4a234530f661d8c7d0ef0088bc96d814fbaea50e 100644 --- a/src-disl/ch/usi/dag/disl/util/AsmHelper.java +++ b/src-disl/ch/usi/dag/disl/util/AsmHelper.java @@ -470,7 +470,7 @@ public abstract class AsmHelper { */ public static MethodNode cloneMethod (final MethodNode method) { final MethodNode result = new MethodNode ( - Opcodes.ASM5, method.access, method.name, method.desc, + Opcodes.ASM7, method.access, method.name, method.desc, method.signature, method.exceptions.toArray ( new String [method.exceptions.size ()] ) diff --git a/src-disl/ch/usi/dag/disl/weaver/pe/ConstInterpreter.java b/src-disl/ch/usi/dag/disl/weaver/pe/ConstInterpreter.java index 1890994da735394439681938e90176ff146bd953..28bbdd756ebe5e2674fcd5103d1afb4fdcd0bee2 100644 --- a/src-disl/ch/usi/dag/disl/weaver/pe/ConstInterpreter.java +++ b/src-disl/ch/usi/dag/disl/weaver/pe/ConstInterpreter.java @@ -17,7 +17,7 @@ import org.objectweb.asm.tree.analysis.Interpreter; public class ConstInterpreter extends Interpreter { protected ConstInterpreter() { - super(Opcodes.ASM5); + super(Opcodes.ASM7); } @Override diff --git a/src-disl/ch/usi/dag/dislserver/Protocol.java b/src-disl/ch/usi/dag/dislserver/Protocol.java index c88131454595b39ff0c8a267c06cf4d0a4c434d4..04decac77b64172cf684aca56a32e3551cf835d0 100644 --- a/src-disl/ch/usi/dag/dislserver/Protocol.java +++ b/src-disl/ch/usi/dag/dislserver/Protocol.java @@ -42,11 +42,18 @@ public final class Protocol { public static final int ERROR_VALUE = 3; + @java.lang.Override public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } return value; } /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. * @deprecated Use {@link #forNumber(int)} instead. */ @java.lang.Deprecated @@ -70,11 +77,26 @@ public final class Protocol { private static final com.google.protobuf.Internal.EnumLiteMap< InstrumentClassResult> internalValueMap = new com.google.protobuf.Internal.EnumLiteMap() { + @java.lang.Override public InstrumentClassResult findValueByNumber(int number) { return InstrumentClassResult.forNumber(number); } }; + public static com.google.protobuf.Internal.EnumVerifier + internalGetVerifier() { + return InstrumentClassResultVerifier.INSTANCE; + } + + private static final class InstrumentClassResultVerifier implements + com.google.protobuf.Internal.EnumVerifier { + static final com.google.protobuf.Internal.EnumVerifier INSTANCE = new InstrumentClassResultVerifier(); + @java.lang.Override + public boolean isInRange(int number) { + return InstrumentClassResult.forNumber(number) != null; + } + }; + private final int value; private InstrumentClassResult(int value) { @@ -89,22 +111,26 @@ public final class Protocol { com.google.protobuf.MessageLiteOrBuilder { /** - * optional int32 flags = 1; + * int32 flags = 1; + * @return The flags. */ int getFlags(); /** - * optional string className = 2; + * string className = 2; + * @return The className. */ java.lang.String getClassName(); /** - * optional string className = 2; + * string className = 2; + * @return The bytes for className. */ com.google.protobuf.ByteString getClassNameBytes(); /** - * optional bytes classBytes = 3; + * bytes classBytes = 3; + * @return The classBytes. */ com.google.protobuf.ByteString getClassBytes(); } @@ -123,20 +149,23 @@ public final class Protocol { public static final int FLAGS_FIELD_NUMBER = 1; private int flags_; /** - * optional int32 flags = 1; + * int32 flags = 1; + * @return The flags. */ + @java.lang.Override public int getFlags() { return flags_; } /** - * optional int32 flags = 1; + * int32 flags = 1; + * @param value The flags to set. */ private void setFlags(int value) { flags_ = value; } /** - * optional int32 flags = 1; + * int32 flags = 1; */ private void clearFlags() { @@ -146,20 +175,25 @@ public final class Protocol { public static final int CLASSNAME_FIELD_NUMBER = 2; private java.lang.String className_; /** - * optional string className = 2; + * string className = 2; + * @return The className. */ + @java.lang.Override public java.lang.String getClassName() { return className_; } /** - * optional string className = 2; + * string className = 2; + * @return The bytes for className. */ + @java.lang.Override public com.google.protobuf.ByteString getClassNameBytes() { return com.google.protobuf.ByteString.copyFromUtf8(className_); } /** - * optional string className = 2; + * string className = 2; + * @param value The className to set. */ private void setClassName( java.lang.String value) { @@ -170,14 +204,15 @@ public final class Protocol { className_ = value; } /** - * optional string className = 2; + * string className = 2; */ private void clearClassName() { className_ = getDefaultInstance().getClassName(); } /** - * optional string className = 2; + * string className = 2; + * @param value The bytes for className to set. */ private void setClassNameBytes( com.google.protobuf.ByteString value) { @@ -192,13 +227,16 @@ public final class Protocol { public static final int CLASSBYTES_FIELD_NUMBER = 3; private com.google.protobuf.ByteString classBytes_; /** - * optional bytes classBytes = 3; + * bytes classBytes = 3; + * @return The classBytes. */ + @java.lang.Override public com.google.protobuf.ByteString getClassBytes() { return classBytes_; } /** - * optional bytes classBytes = 3; + * bytes classBytes = 3; + * @param value The classBytes to set. */ private void setClassBytes(com.google.protobuf.ByteString value) { if (value == null) { @@ -208,47 +246,26 @@ public final class Protocol { classBytes_ = value; } /** - * optional bytes classBytes = 3; + * bytes classBytes = 3; */ private void clearClassBytes() { classBytes_ = getDefaultInstance().getClassBytes(); } - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (flags_ != 0) { - output.writeInt32(1, flags_); - } - if (!className_.isEmpty()) { - output.writeString(2, getClassName()); - } - if (!classBytes_.isEmpty()) { - output.writeBytes(3, classBytes_); - } + public static ch.usi.dag.dislserver.Protocol.InstrumentClassRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); } - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (flags_ != 0) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(1, flags_); - } - if (!className_.isEmpty()) { - size += com.google.protobuf.CodedOutputStream - .computeStringSize(2, getClassName()); - } - if (!classBytes_.isEmpty()) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, classBytes_); - } - memoizedSerializedSize = size; - return size; + public static ch.usi.dag.dislserver.Protocol.InstrumentClassRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); } - public static ch.usi.dag.dislserver.Protocol.InstrumentClassRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -311,10 +328,10 @@ public final class Protocol { } public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); + return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(ch.usi.dag.dislserver.Protocol.InstrumentClassRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -332,13 +349,17 @@ public final class Protocol { /** - * optional int32 flags = 1; + * int32 flags = 1; + * @return The flags. */ + @java.lang.Override public int getFlags() { return instance.getFlags(); } /** - * optional int32 flags = 1; + * int32 flags = 1; + * @param value The flags to set. + * @return This builder for chaining. */ public Builder setFlags(int value) { copyOnWrite(); @@ -346,7 +367,8 @@ public final class Protocol { return this; } /** - * optional int32 flags = 1; + * int32 flags = 1; + * @return This builder for chaining. */ public Builder clearFlags() { copyOnWrite(); @@ -355,20 +377,26 @@ public final class Protocol { } /** - * optional string className = 2; + * string className = 2; + * @return The className. */ + @java.lang.Override public java.lang.String getClassName() { return instance.getClassName(); } /** - * optional string className = 2; + * string className = 2; + * @return The bytes for className. */ + @java.lang.Override public com.google.protobuf.ByteString getClassNameBytes() { return instance.getClassNameBytes(); } /** - * optional string className = 2; + * string className = 2; + * @param value The className to set. + * @return This builder for chaining. */ public Builder setClassName( java.lang.String value) { @@ -377,7 +405,8 @@ public final class Protocol { return this; } /** - * optional string className = 2; + * string className = 2; + * @return This builder for chaining. */ public Builder clearClassName() { copyOnWrite(); @@ -385,7 +414,9 @@ public final class Protocol { return this; } /** - * optional string className = 2; + * string className = 2; + * @param value The bytes for className to set. + * @return This builder for chaining. */ public Builder setClassNameBytes( com.google.protobuf.ByteString value) { @@ -395,13 +426,17 @@ public final class Protocol { } /** - * optional bytes classBytes = 3; + * bytes classBytes = 3; + * @return The classBytes. */ + @java.lang.Override public com.google.protobuf.ByteString getClassBytes() { return instance.getClassBytes(); } /** - * optional bytes classBytes = 3; + * bytes classBytes = 3; + * @param value The classBytes to set. + * @return This builder for chaining. */ public Builder setClassBytes(com.google.protobuf.ByteString value) { copyOnWrite(); @@ -409,7 +444,8 @@ public final class Protocol { return this; } /** - * optional bytes classBytes = 3; + * bytes classBytes = 3; + * @return This builder for chaining. */ public Builder clearClassBytes() { copyOnWrite(); @@ -419,94 +455,54 @@ public final class Protocol { // @@protoc_insertion_point(builder_scope:InstrumentClassRequest) } - protected final Object dynamicMethod( + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, - Object arg0, Object arg1) { + java.lang.Object arg0, java.lang.Object arg1) { switch (method) { case NEW_MUTABLE_INSTANCE: { return new ch.usi.dag.dislserver.Protocol.InstrumentClassRequest(); } - case IS_INITIALIZED: { - return DEFAULT_INSTANCE; - } - case MAKE_IMMUTABLE: { - return null; - } case NEW_BUILDER: { return new Builder(); } - case VISIT: { - Visitor visitor = (Visitor) arg0; - ch.usi.dag.dislserver.Protocol.InstrumentClassRequest other = (ch.usi.dag.dislserver.Protocol.InstrumentClassRequest) arg1; - flags_ = visitor.visitInt(flags_ != 0, flags_, - other.flags_ != 0, other.flags_); - className_ = visitor.visitString(!className_.isEmpty(), className_, - !other.className_.isEmpty(), other.className_); - classBytes_ = visitor.visitByteString(classBytes_ != com.google.protobuf.ByteString.EMPTY, classBytes_, - other.classBytes_ != com.google.protobuf.ByteString.EMPTY, other.classBytes_); - if (visitor == com.google.protobuf.GeneratedMessageLite.MergeFromVisitor - .INSTANCE) { - } - return this; - } - case MERGE_FROM_STREAM: { - com.google.protobuf.CodedInputStream input = - (com.google.protobuf.CodedInputStream) arg0; - com.google.protobuf.ExtensionRegistryLite extensionRegistry = - (com.google.protobuf.ExtensionRegistryLite) arg1; - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!input.skipField(tag)) { - done = true; - } - break; - } - case 8: { - - flags_ = input.readInt32(); - break; - } - case 18: { - String s = input.readStringRequireUtf8(); - - className_ = s; - break; - } - case 26: { - - classBytes_ = input.readBytes(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw new RuntimeException(e.setUnfinishedMessage(this)); - } catch (java.io.IOException e) { - throw new RuntimeException( - new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this)); - } finally { - } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "flags_", + "className_", + "classBytes_", + }; + java.lang.String info = + "\u0000\u0003\u0000\u0000\u0001\u0003\u0003\u0000\u0000\u0000\u0001\u0004\u0002\u0208" + + "\u0003\n"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); } + // fall through case GET_DEFAULT_INSTANCE: { return DEFAULT_INSTANCE; } case GET_PARSER: { - if (PARSER == null) { synchronized (ch.usi.dag.dislserver.Protocol.InstrumentClassRequest.class) { - if (PARSER == null) { - PARSER = new DefaultInstanceBasedParser(DEFAULT_INSTANCE); + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (ch.usi.dag.dislserver.Protocol.InstrumentClassRequest.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; } } } - return PARSER; - } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } } throw new UnsupportedOperationException(); } @@ -515,8 +511,12 @@ public final class Protocol { // @@protoc_insertion_point(class_scope:InstrumentClassRequest) private static final ch.usi.dag.dislserver.Protocol.InstrumentClassRequest DEFAULT_INSTANCE; static { - DEFAULT_INSTANCE = new InstrumentClassRequest(); - DEFAULT_INSTANCE.makeImmutable(); + InstrumentClassRequest defaultInstance = new InstrumentClassRequest(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + InstrumentClassRequest.class, defaultInstance); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassRequest getDefaultInstance() { @@ -535,26 +535,31 @@ public final class Protocol { com.google.protobuf.MessageLiteOrBuilder { /** - * optional .InstrumentClassResult result = 1; + * .InstrumentClassResult result = 1; + * @return The enum numeric value on the wire for result. */ int getResultValue(); /** - * optional .InstrumentClassResult result = 1; + * .InstrumentClassResult result = 1; + * @return The result. */ ch.usi.dag.dislserver.Protocol.InstrumentClassResult getResult(); /** - * optional string errorMessage = 2; + * string errorMessage = 2; + * @return The errorMessage. */ java.lang.String getErrorMessage(); /** - * optional string errorMessage = 2; + * string errorMessage = 2; + * @return The bytes for errorMessage. */ com.google.protobuf.ByteString getErrorMessageBytes(); /** - * optional bytes classBytes = 3; + * bytes classBytes = 3; + * @return The classBytes. */ com.google.protobuf.ByteString getClassBytes(); } @@ -573,26 +578,32 @@ public final class Protocol { public static final int RESULT_FIELD_NUMBER = 1; private int result_; /** - * optional .InstrumentClassResult result = 1; + * .InstrumentClassResult result = 1; + * @return The enum numeric value on the wire for result. */ + @java.lang.Override public int getResultValue() { return result_; } /** - * optional .InstrumentClassResult result = 1; + * .InstrumentClassResult result = 1; + * @return The result. */ + @java.lang.Override public ch.usi.dag.dislserver.Protocol.InstrumentClassResult getResult() { ch.usi.dag.dislserver.Protocol.InstrumentClassResult result = ch.usi.dag.dislserver.Protocol.InstrumentClassResult.forNumber(result_); return result == null ? ch.usi.dag.dislserver.Protocol.InstrumentClassResult.UNRECOGNIZED : result; } /** - * optional .InstrumentClassResult result = 1; + * .InstrumentClassResult result = 1; + * @param value The enum numeric value on the wire for result to set. */ private void setResultValue(int value) { result_ = value; } /** - * optional .InstrumentClassResult result = 1; + * .InstrumentClassResult result = 1; + * @param value The result to set. */ private void setResult(ch.usi.dag.dislserver.Protocol.InstrumentClassResult value) { if (value == null) { @@ -602,7 +613,7 @@ public final class Protocol { result_ = value.getNumber(); } /** - * optional .InstrumentClassResult result = 1; + * .InstrumentClassResult result = 1; */ private void clearResult() { @@ -612,20 +623,25 @@ public final class Protocol { public static final int ERRORMESSAGE_FIELD_NUMBER = 2; private java.lang.String errorMessage_; /** - * optional string errorMessage = 2; + * string errorMessage = 2; + * @return The errorMessage. */ + @java.lang.Override public java.lang.String getErrorMessage() { return errorMessage_; } /** - * optional string errorMessage = 2; + * string errorMessage = 2; + * @return The bytes for errorMessage. */ + @java.lang.Override public com.google.protobuf.ByteString getErrorMessageBytes() { return com.google.protobuf.ByteString.copyFromUtf8(errorMessage_); } /** - * optional string errorMessage = 2; + * string errorMessage = 2; + * @param value The errorMessage to set. */ private void setErrorMessage( java.lang.String value) { @@ -636,14 +652,15 @@ public final class Protocol { errorMessage_ = value; } /** - * optional string errorMessage = 2; + * string errorMessage = 2; */ private void clearErrorMessage() { errorMessage_ = getDefaultInstance().getErrorMessage(); } /** - * optional string errorMessage = 2; + * string errorMessage = 2; + * @param value The bytes for errorMessage to set. */ private void setErrorMessageBytes( com.google.protobuf.ByteString value) { @@ -658,13 +675,16 @@ public final class Protocol { public static final int CLASSBYTES_FIELD_NUMBER = 3; private com.google.protobuf.ByteString classBytes_; /** - * optional bytes classBytes = 3; + * bytes classBytes = 3; + * @return The classBytes. */ + @java.lang.Override public com.google.protobuf.ByteString getClassBytes() { return classBytes_; } /** - * optional bytes classBytes = 3; + * bytes classBytes = 3; + * @param value The classBytes to set. */ private void setClassBytes(com.google.protobuf.ByteString value) { if (value == null) { @@ -674,47 +694,26 @@ public final class Protocol { classBytes_ = value; } /** - * optional bytes classBytes = 3; + * bytes classBytes = 3; */ private void clearClassBytes() { classBytes_ = getDefaultInstance().getClassBytes(); } - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (result_ != ch.usi.dag.dislserver.Protocol.InstrumentClassResult.CLASS_UNMODIFIED.getNumber()) { - output.writeEnum(1, result_); - } - if (!errorMessage_.isEmpty()) { - output.writeString(2, getErrorMessage()); - } - if (!classBytes_.isEmpty()) { - output.writeBytes(3, classBytes_); - } + public static ch.usi.dag.dislserver.Protocol.InstrumentClassResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); } - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (result_ != ch.usi.dag.dislserver.Protocol.InstrumentClassResult.CLASS_UNMODIFIED.getNumber()) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(1, result_); - } - if (!errorMessage_.isEmpty()) { - size += com.google.protobuf.CodedOutputStream - .computeStringSize(2, getErrorMessage()); - } - if (!classBytes_.isEmpty()) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, classBytes_); - } - memoizedSerializedSize = size; - return size; + public static ch.usi.dag.dislserver.Protocol.InstrumentClassResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); } - public static ch.usi.dag.dislserver.Protocol.InstrumentClassResponse parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -777,10 +776,10 @@ public final class Protocol { } public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); + return (Builder) DEFAULT_INSTANCE.createBuilder(); } public static Builder newBuilder(ch.usi.dag.dislserver.Protocol.InstrumentClassResponse prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); } /** @@ -798,13 +797,17 @@ public final class Protocol { /** - * optional .InstrumentClassResult result = 1; + * .InstrumentClassResult result = 1; + * @return The enum numeric value on the wire for result. */ + @java.lang.Override public int getResultValue() { return instance.getResultValue(); } /** - * optional .InstrumentClassResult result = 1; + * .InstrumentClassResult result = 1; + * @param value The result to set. + * @return This builder for chaining. */ public Builder setResultValue(int value) { copyOnWrite(); @@ -812,13 +815,17 @@ public final class Protocol { return this; } /** - * optional .InstrumentClassResult result = 1; + * .InstrumentClassResult result = 1; + * @return The result. */ + @java.lang.Override public ch.usi.dag.dislserver.Protocol.InstrumentClassResult getResult() { return instance.getResult(); } /** - * optional .InstrumentClassResult result = 1; + * .InstrumentClassResult result = 1; + * @param value The enum numeric value on the wire for result to set. + * @return This builder for chaining. */ public Builder setResult(ch.usi.dag.dislserver.Protocol.InstrumentClassResult value) { copyOnWrite(); @@ -826,7 +833,8 @@ public final class Protocol { return this; } /** - * optional .InstrumentClassResult result = 1; + * .InstrumentClassResult result = 1; + * @return This builder for chaining. */ public Builder clearResult() { copyOnWrite(); @@ -835,20 +843,26 @@ public final class Protocol { } /** - * optional string errorMessage = 2; + * string errorMessage = 2; + * @return The errorMessage. */ + @java.lang.Override public java.lang.String getErrorMessage() { return instance.getErrorMessage(); } /** - * optional string errorMessage = 2; + * string errorMessage = 2; + * @return The bytes for errorMessage. */ + @java.lang.Override public com.google.protobuf.ByteString getErrorMessageBytes() { return instance.getErrorMessageBytes(); } /** - * optional string errorMessage = 2; + * string errorMessage = 2; + * @param value The errorMessage to set. + * @return This builder for chaining. */ public Builder setErrorMessage( java.lang.String value) { @@ -857,7 +871,8 @@ public final class Protocol { return this; } /** - * optional string errorMessage = 2; + * string errorMessage = 2; + * @return This builder for chaining. */ public Builder clearErrorMessage() { copyOnWrite(); @@ -865,7 +880,9 @@ public final class Protocol { return this; } /** - * optional string errorMessage = 2; + * string errorMessage = 2; + * @param value The bytes for errorMessage to set. + * @return This builder for chaining. */ public Builder setErrorMessageBytes( com.google.protobuf.ByteString value) { @@ -875,13 +892,17 @@ public final class Protocol { } /** - * optional bytes classBytes = 3; + * bytes classBytes = 3; + * @return The classBytes. */ + @java.lang.Override public com.google.protobuf.ByteString getClassBytes() { return instance.getClassBytes(); } /** - * optional bytes classBytes = 3; + * bytes classBytes = 3; + * @param value The classBytes to set. + * @return This builder for chaining. */ public Builder setClassBytes(com.google.protobuf.ByteString value) { copyOnWrite(); @@ -889,7 +910,8 @@ public final class Protocol { return this; } /** - * optional bytes classBytes = 3; + * bytes classBytes = 3; + * @return This builder for chaining. */ public Builder clearClassBytes() { copyOnWrite(); @@ -899,94 +921,54 @@ public final class Protocol { // @@protoc_insertion_point(builder_scope:InstrumentClassResponse) } - protected final Object dynamicMethod( + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, - Object arg0, Object arg1) { + java.lang.Object arg0, java.lang.Object arg1) { switch (method) { case NEW_MUTABLE_INSTANCE: { return new ch.usi.dag.dislserver.Protocol.InstrumentClassResponse(); } - case IS_INITIALIZED: { - return DEFAULT_INSTANCE; - } - case MAKE_IMMUTABLE: { - return null; - } case NEW_BUILDER: { return new Builder(); } - case VISIT: { - Visitor visitor = (Visitor) arg0; - ch.usi.dag.dislserver.Protocol.InstrumentClassResponse other = (ch.usi.dag.dislserver.Protocol.InstrumentClassResponse) arg1; - result_ = visitor.visitInt(result_ != 0, result_, other.result_ != 0, other.result_); - errorMessage_ = visitor.visitString(!errorMessage_.isEmpty(), errorMessage_, - !other.errorMessage_.isEmpty(), other.errorMessage_); - classBytes_ = visitor.visitByteString(classBytes_ != com.google.protobuf.ByteString.EMPTY, classBytes_, - other.classBytes_ != com.google.protobuf.ByteString.EMPTY, other.classBytes_); - if (visitor == com.google.protobuf.GeneratedMessageLite.MergeFromVisitor - .INSTANCE) { - } - return this; - } - case MERGE_FROM_STREAM: { - com.google.protobuf.CodedInputStream input = - (com.google.protobuf.CodedInputStream) arg0; - com.google.protobuf.ExtensionRegistryLite extensionRegistry = - (com.google.protobuf.ExtensionRegistryLite) arg1; - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!input.skipField(tag)) { - done = true; - } - break; - } - case 8: { - int rawValue = input.readEnum(); - - result_ = rawValue; - break; - } - case 18: { - String s = input.readStringRequireUtf8(); - - errorMessage_ = s; - break; - } - case 26: { - - classBytes_ = input.readBytes(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw new RuntimeException(e.setUnfinishedMessage(this)); - } catch (java.io.IOException e) { - throw new RuntimeException( - new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this)); - } finally { - } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "result_", + "errorMessage_", + "classBytes_", + }; + java.lang.String info = + "\u0000\u0003\u0000\u0000\u0001\u0003\u0003\u0000\u0000\u0000\u0001\f\u0002\u0208" + + "\u0003\n"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); } + // fall through case GET_DEFAULT_INSTANCE: { return DEFAULT_INSTANCE; } case GET_PARSER: { - if (PARSER == null) { synchronized (ch.usi.dag.dislserver.Protocol.InstrumentClassResponse.class) { - if (PARSER == null) { - PARSER = new DefaultInstanceBasedParser(DEFAULT_INSTANCE); + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (ch.usi.dag.dislserver.Protocol.InstrumentClassResponse.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; } } } - return PARSER; - } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } } throw new UnsupportedOperationException(); } @@ -995,8 +977,12 @@ public final class Protocol { // @@protoc_insertion_point(class_scope:InstrumentClassResponse) private static final ch.usi.dag.dislserver.Protocol.InstrumentClassResponse DEFAULT_INSTANCE; static { - DEFAULT_INSTANCE = new InstrumentClassResponse(); - DEFAULT_INSTANCE.makeImmutable(); + InstrumentClassResponse defaultInstance = new InstrumentClassResponse(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + InstrumentClassResponse.class, defaultInstance); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassResponse getDefaultInstance() { diff --git a/src-test/ch/usi/dag/disl/test/suite/sendspecial/app/TargetClass.java b/src-test/ch/usi/dag/disl/test/suite/sendspecial/app/TargetClass.java index 2c959a332da5789f9f9c71d19d73f5e0895f79ea..408a77fd4e1cafdee1bd6f4eab6c7e1f86e7c0e4 100644 --- a/src-test/ch/usi/dag/disl/test/suite/sendspecial/app/TargetClass.java +++ b/src-test/ch/usi/dag/disl/test/suite/sendspecial/app/TargetClass.java @@ -64,7 +64,7 @@ public class TargetClass { sendThread (false, thread); // Send a lot of empty events to force the agent to flush buffers. - for (int i = 0; i < 35000; i++) { + for (int i = 0; i < 100000; i++) { sendEmpty (); } diff --git a/src-test/ch/usi/dag/dislreserver/shadow/ShadowClassTestBase.java b/src-test/ch/usi/dag/dislreserver/shadow/ShadowClassTestBase.java index 412cd50bcdb75b44be4954c5683d9e7a12af0b7a..f5a5df14b145ab55cf28319ab338e423650fa9e0 100644 --- a/src-test/ch/usi/dag/dislreserver/shadow/ShadowClassTestBase.java +++ b/src-test/ch/usi/dag/dislreserver/shadow/ShadowClassTestBase.java @@ -14,6 +14,7 @@ import java.util.stream.Stream; import org.junit.Assert; import org.junit.experimental.theories.PotentialAssignment; +import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; import org.objectweb.asm.tree.ClassNode; @@ -33,6 +34,18 @@ abstract class ShadowClassTestBase { protected abstract ShadowClass _createShadowClass (final Class type); + /** + * Removes ASM specific access flags not defined in the + * JVM specification. This is necessary to compare regular and + * shadow info. + * + * JVM access flags are stored using 16 bits only, so it is just + * possible to apply a mask. + */ + private int removeASMSpecificAccessFlags(int modifiers) { + return modifiers & 65535; + } + // void getNameMatchesReflection (final Class type) { @@ -171,7 +184,7 @@ abstract class ShadowClassTestBase { private void __assertEquals (final Field field, final FieldInfo shadowField) { Assert.assertEquals (field.getName (), shadowField.getName ()); Assert.assertEquals (Type.getType (field.getType ()).getDescriptor (), shadowField.getDescriptor ()); - Assert.assertEquals (field.getModifiers (), shadowField.getModifiers ()); + Assert.assertEquals (field.getModifiers (), removeASMSpecificAccessFlags(shadowField.getModifiers ())); } // @@ -233,7 +246,7 @@ abstract class ShadowClassTestBase { private void __assertEqual (final Method method, final MethodInfo shadowMethod) { Assert.assertEquals (method.getName (), shadowMethod.getName ()); Assert.assertEquals (Type.getMethodDescriptor (method), shadowMethod.getDescriptor ()); - Assert.assertEquals (method.getModifiers (), shadowMethod.getModifiers ()); + Assert.assertEquals (method.getModifiers (), removeASMSpecificAccessFlags(shadowMethod.getModifiers ())); } // diff --git a/src-tools/ch/usi/dag/disl/tools/ExtendThread.java b/src-tools/ch/usi/dag/disl/tools/ExtendThread.java index 089071e337bd814e8b4f3376eb9febbe20becdbc..0209304f6cdbc027cf57779a4de35940bf77a9d9 100644 --- a/src-tools/ch/usi/dag/disl/tools/ExtendThread.java +++ b/src-tools/ch/usi/dag/disl/tools/ExtendThread.java @@ -60,7 +60,7 @@ public final class ExtendThread { private Type __owner; public FieldExtender (final FieldDefinition fd, final ClassWriter cw) { - super (Opcodes.ASM5, cw); + super (Opcodes.ASM7, cw); __fd = fd; } @@ -86,7 +86,7 @@ public final class ExtendThread { if ("".equals (name)) { // Initialize the field. - return new AdviceAdapter (Opcodes.ASM5, mv, access, name, desc) { + return new AdviceAdapter (Opcodes.ASM7, mv, access, name, desc) { @Override protected void onMethodEnter () { __fd.initialize (__owner, this); @@ -150,7 +150,7 @@ public final class ExtendThread { throws IOException { final ClassReader cr = new ClassReader (Thread.class.getName ()); final ClassWriter cw = new ClassWriter (cr, 0); - cr.accept (new FieldExtender (fd, cw), 0); + cr.accept (new FieldExtender (fd, cw), ClassReader.EXPAND_FRAMES); return cw.toByteArray (); } diff --git a/src-util/ch/usi/dag/util/asm/ClassNodeHelper.java b/src-util/ch/usi/dag/util/asm/ClassNodeHelper.java index 855a4e3e0e7d37b7381e7f7701dd70eecac386cf..bc35173b7057971bbda6a19152a22601d5007096 100644 --- a/src-util/ch/usi/dag/util/asm/ClassNodeHelper.java +++ b/src-util/ch/usi/dag/util/asm/ClassNodeHelper.java @@ -52,7 +52,7 @@ public enum ClassNodeHelper { * from the given array. */ public ClassNode unmarshal (final byte [] bytes) { - final ClassNode result = new ClassNode (Opcodes.ASM5); + final ClassNode result = new ClassNode (Opcodes.ASM7); new ClassReader (bytes).accept (result, __flags); return result; } @@ -63,7 +63,7 @@ public enum ClassNodeHelper { * from the given input stream. */ public ClassNode unmarshal (final InputStream is) throws IOException { - final ClassNode result = new ClassNode (Opcodes.ASM5); + final ClassNode result = new ClassNode (Opcodes.ASM7); new ClassReader (is).accept (result, __flags); return result; } @@ -74,7 +74,7 @@ public enum ClassNodeHelper { * as a resource using the system class loader. */ public ClassNode load (final String className) throws IOException { - final ClassNode result = new ClassNode (Opcodes.ASM5); + final ClassNode result = new ClassNode (Opcodes.ASM7); new ClassReader (className).accept (result, __flags); return result; } @@ -89,7 +89,7 @@ public enum ClassNodeHelper { * @return a new {@link ClassNode} instance */ public static ClassNode duplicate (final ClassNode source) { - final ClassNode result = new ClassNode (Opcodes.ASM5); + final ClassNode result = new ClassNode (Opcodes.ASM7); source.accept (result); return result; }