MCPcopy Create free account
hub / github.com/MultiMC/Launcher / readElementValue

Method readElementValue

libraries/classparser/src/annotations.cpp:43–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43element_value *element_value::readElementValue(util::membuffer &input,
44 java::constant_pool &pool)
45{
46 element_value_type type = INVALID;
47 input.read(type);
48 uint16_t index = 0;
49 uint16_t index2 = 0;
50 std::vector<element_value *> vals;
51 switch (type)
52 {
53 case PRIMITIVE_BYTE:
54 case PRIMITIVE_CHAR:
55 case PRIMITIVE_DOUBLE:
56 case PRIMITIVE_FLOAT:
57 case PRIMITIVE_INT:
58 case PRIMITIVE_LONG:
59 case PRIMITIVE_SHORT:
60 case PRIMITIVE_BOOLEAN:
61 case STRING:
62 input.read_be(index);
63 return new element_value_simple(type, index, pool);
64 case ENUM_CONSTANT:
65 input.read_be(index);
66 input.read_be(index2);
67 return new element_value_enum(type, index, index2, pool);
68 case CLASS: // Class
69 input.read_be(index);
70 return new element_value_class(type, index, pool);
71 case ANNOTATION: // Annotation
72 // FIXME: runtime visibility info needs to be passed from parent
73 return new element_value_annotation(ANNOTATION, annotation::read(input, pool), pool);
74 case ARRAY: // Array
75 input.read_be(index);
76 for (int i = 0; i < index; i++)
77 {
78 vals.push_back(element_value::readElementValue(input, pool));
79 }
80 return new element_value_array(ARRAY, vals, pool);
81 default:
82 throw new java::classfile_exception();
83 }
84}
85}

Callers

nothing calls this directly

Calls 3

readFunction · 0.85
read_beMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected