873 int runtime_invisible_annotations_length = 0; |
873 int runtime_invisible_annotations_length = 0; |
874 u1* runtime_visible_type_annotations = NULL; |
874 u1* runtime_visible_type_annotations = NULL; |
875 int runtime_visible_type_annotations_length = 0; |
875 int runtime_visible_type_annotations_length = 0; |
876 u1* runtime_invisible_type_annotations = NULL; |
876 u1* runtime_invisible_type_annotations = NULL; |
877 int runtime_invisible_type_annotations_length = 0; |
877 int runtime_invisible_type_annotations_length = 0; |
|
878 bool runtime_invisible_annotations_exists = false; |
878 bool runtime_invisible_type_annotations_exists = false; |
879 bool runtime_invisible_type_annotations_exists = false; |
879 while (attributes_count--) { |
880 while (attributes_count--) { |
880 cfs->guarantee_more(6, CHECK); // attribute_name_index, attribute_length |
881 cfs->guarantee_more(6, CHECK); // attribute_name_index, attribute_length |
881 u2 attribute_name_index = cfs->get_u2_fast(); |
882 u2 attribute_name_index = cfs->get_u2_fast(); |
882 u4 attribute_length = cfs->get_u4_fast(); |
883 u4 attribute_length = cfs->get_u4_fast(); |
918 "Wrong size %u for field's Signature attribute in class file %s", |
919 "Wrong size %u for field's Signature attribute in class file %s", |
919 attribute_length, CHECK); |
920 attribute_length, CHECK); |
920 } |
921 } |
921 generic_signature_index = cfs->get_u2(CHECK); |
922 generic_signature_index = cfs->get_u2(CHECK); |
922 } else if (attribute_name == vmSymbols::tag_runtime_visible_annotations()) { |
923 } else if (attribute_name == vmSymbols::tag_runtime_visible_annotations()) { |
|
924 if (runtime_visible_annotations != NULL) { |
|
925 classfile_parse_error( |
|
926 "Multiple RuntimeVisibleAnnotations attributes for field in class file %s", CHECK); |
|
927 } |
923 runtime_visible_annotations_length = attribute_length; |
928 runtime_visible_annotations_length = attribute_length; |
924 runtime_visible_annotations = cfs->get_u1_buffer(); |
929 runtime_visible_annotations = cfs->get_u1_buffer(); |
925 assert(runtime_visible_annotations != NULL, "null visible annotations"); |
930 assert(runtime_visible_annotations != NULL, "null visible annotations"); |
926 parse_annotations(runtime_visible_annotations, |
931 parse_annotations(runtime_visible_annotations, |
927 runtime_visible_annotations_length, |
932 runtime_visible_annotations_length, |
928 parsed_annotations, |
933 parsed_annotations, |
929 CHECK); |
934 CHECK); |
930 cfs->skip_u1(runtime_visible_annotations_length, CHECK); |
935 cfs->skip_u1(runtime_visible_annotations_length, CHECK); |
931 } else if (PreserveAllAnnotations && attribute_name == vmSymbols::tag_runtime_invisible_annotations()) { |
936 } else if (attribute_name == vmSymbols::tag_runtime_invisible_annotations()) { |
932 runtime_invisible_annotations_length = attribute_length; |
937 if (runtime_invisible_annotations_exists) { |
933 runtime_invisible_annotations = cfs->get_u1_buffer(); |
938 classfile_parse_error( |
934 assert(runtime_invisible_annotations != NULL, "null invisible annotations"); |
939 "Multiple RuntimeInvisibleAnnotations attributes for field in class file %s", CHECK); |
935 cfs->skip_u1(runtime_invisible_annotations_length, CHECK); |
940 } |
|
941 runtime_invisible_annotations_exists = true; |
|
942 if (PreserveAllAnnotations) { |
|
943 runtime_invisible_annotations_length = attribute_length; |
|
944 runtime_invisible_annotations = cfs->get_u1_buffer(); |
|
945 assert(runtime_invisible_annotations != NULL, "null invisible annotations"); |
|
946 } |
|
947 cfs->skip_u1(attribute_length, CHECK); |
936 } else if (attribute_name == vmSymbols::tag_runtime_visible_type_annotations()) { |
948 } else if (attribute_name == vmSymbols::tag_runtime_visible_type_annotations()) { |
937 if (runtime_visible_type_annotations != NULL) { |
949 if (runtime_visible_type_annotations != NULL) { |
938 classfile_parse_error( |
950 classfile_parse_error( |
939 "Multiple RuntimeVisibleTypeAnnotations attributes for field in class file %s", CHECK); |
951 "Multiple RuntimeVisibleTypeAnnotations attributes for field in class file %s", CHECK); |
940 } |
952 } |
2064 int runtime_invisible_parameter_annotations_length = 0; |
2076 int runtime_invisible_parameter_annotations_length = 0; |
2065 u1* runtime_visible_type_annotations = NULL; |
2077 u1* runtime_visible_type_annotations = NULL; |
2066 int runtime_visible_type_annotations_length = 0; |
2078 int runtime_visible_type_annotations_length = 0; |
2067 u1* runtime_invisible_type_annotations = NULL; |
2079 u1* runtime_invisible_type_annotations = NULL; |
2068 int runtime_invisible_type_annotations_length = 0; |
2080 int runtime_invisible_type_annotations_length = 0; |
|
2081 bool runtime_invisible_annotations_exists = false; |
2069 bool runtime_invisible_type_annotations_exists = false; |
2082 bool runtime_invisible_type_annotations_exists = false; |
|
2083 bool runtime_invisible_parameter_annotations_exists = false; |
2070 u1* annotation_default = NULL; |
2084 u1* annotation_default = NULL; |
2071 int annotation_default_length = 0; |
2085 int annotation_default_length = 0; |
2072 |
2086 |
2073 // Parse code and exceptions attribute |
2087 // Parse code and exceptions attribute |
2074 u2 method_attributes_count = cfs->get_u2_fast(); |
2088 u2 method_attributes_count = cfs->get_u2_fast(); |
2293 method_attribute_length, CHECK_(nullHandle)); |
2307 method_attribute_length, CHECK_(nullHandle)); |
2294 } |
2308 } |
2295 cfs->guarantee_more(2, CHECK_(nullHandle)); // generic_signature_index |
2309 cfs->guarantee_more(2, CHECK_(nullHandle)); // generic_signature_index |
2296 generic_signature_index = cfs->get_u2_fast(); |
2310 generic_signature_index = cfs->get_u2_fast(); |
2297 } else if (method_attribute_name == vmSymbols::tag_runtime_visible_annotations()) { |
2311 } else if (method_attribute_name == vmSymbols::tag_runtime_visible_annotations()) { |
|
2312 if (runtime_visible_annotations != NULL) { |
|
2313 classfile_parse_error( |
|
2314 "Multiple RuntimeVisibleAnnotations attributes for method in class file %s", CHECK_(nullHandle)); |
|
2315 } |
2298 runtime_visible_annotations_length = method_attribute_length; |
2316 runtime_visible_annotations_length = method_attribute_length; |
2299 runtime_visible_annotations = cfs->get_u1_buffer(); |
2317 runtime_visible_annotations = cfs->get_u1_buffer(); |
2300 assert(runtime_visible_annotations != NULL, "null visible annotations"); |
2318 assert(runtime_visible_annotations != NULL, "null visible annotations"); |
2301 parse_annotations(runtime_visible_annotations, |
2319 parse_annotations(runtime_visible_annotations, |
2302 runtime_visible_annotations_length, &parsed_annotations, |
2320 runtime_visible_annotations_length, &parsed_annotations, |
2303 CHECK_(nullHandle)); |
2321 CHECK_(nullHandle)); |
2304 cfs->skip_u1(runtime_visible_annotations_length, CHECK_(nullHandle)); |
2322 cfs->skip_u1(runtime_visible_annotations_length, CHECK_(nullHandle)); |
2305 } else if (PreserveAllAnnotations && method_attribute_name == vmSymbols::tag_runtime_invisible_annotations()) { |
2323 } else if (method_attribute_name == vmSymbols::tag_runtime_invisible_annotations()) { |
2306 runtime_invisible_annotations_length = method_attribute_length; |
2324 if (runtime_invisible_annotations_exists) { |
2307 runtime_invisible_annotations = cfs->get_u1_buffer(); |
2325 classfile_parse_error( |
2308 assert(runtime_invisible_annotations != NULL, "null invisible annotations"); |
2326 "Multiple RuntimeInvisibleAnnotations attributes for method in class file %s", CHECK_(nullHandle)); |
2309 cfs->skip_u1(runtime_invisible_annotations_length, CHECK_(nullHandle)); |
2327 } |
|
2328 runtime_invisible_annotations_exists = true; |
|
2329 if (PreserveAllAnnotations) { |
|
2330 runtime_invisible_annotations_length = method_attribute_length; |
|
2331 runtime_invisible_annotations = cfs->get_u1_buffer(); |
|
2332 assert(runtime_invisible_annotations != NULL, "null invisible annotations"); |
|
2333 } |
|
2334 cfs->skip_u1(method_attribute_length, CHECK_(nullHandle)); |
2310 } else if (method_attribute_name == vmSymbols::tag_runtime_visible_parameter_annotations()) { |
2335 } else if (method_attribute_name == vmSymbols::tag_runtime_visible_parameter_annotations()) { |
|
2336 if (runtime_visible_parameter_annotations != NULL) { |
|
2337 classfile_parse_error( |
|
2338 "Multiple RuntimeVisibleParameterAnnotations attributes for method in class file %s", CHECK_(nullHandle)); |
|
2339 } |
2311 runtime_visible_parameter_annotations_length = method_attribute_length; |
2340 runtime_visible_parameter_annotations_length = method_attribute_length; |
2312 runtime_visible_parameter_annotations = cfs->get_u1_buffer(); |
2341 runtime_visible_parameter_annotations = cfs->get_u1_buffer(); |
2313 assert(runtime_visible_parameter_annotations != NULL, "null visible parameter annotations"); |
2342 assert(runtime_visible_parameter_annotations != NULL, "null visible parameter annotations"); |
2314 cfs->skip_u1(runtime_visible_parameter_annotations_length, CHECK_(nullHandle)); |
2343 cfs->skip_u1(runtime_visible_parameter_annotations_length, CHECK_(nullHandle)); |
2315 } else if (PreserveAllAnnotations && method_attribute_name == vmSymbols::tag_runtime_invisible_parameter_annotations()) { |
2344 } else if (method_attribute_name == vmSymbols::tag_runtime_invisible_parameter_annotations()) { |
2316 runtime_invisible_parameter_annotations_length = method_attribute_length; |
2345 if (runtime_invisible_parameter_annotations_exists) { |
2317 runtime_invisible_parameter_annotations = cfs->get_u1_buffer(); |
2346 classfile_parse_error( |
2318 assert(runtime_invisible_parameter_annotations != NULL, "null invisible parameter annotations"); |
2347 "Multiple RuntimeInvisibleParameterAnnotations attributes for method in class file %s", CHECK_(nullHandle)); |
2319 cfs->skip_u1(runtime_invisible_parameter_annotations_length, CHECK_(nullHandle)); |
2348 } |
|
2349 runtime_invisible_parameter_annotations_exists = true; |
|
2350 if (PreserveAllAnnotations) { |
|
2351 runtime_invisible_parameter_annotations_length = method_attribute_length; |
|
2352 runtime_invisible_parameter_annotations = cfs->get_u1_buffer(); |
|
2353 assert(runtime_invisible_parameter_annotations != NULL, "null invisible parameter annotations"); |
|
2354 } |
|
2355 cfs->skip_u1(method_attribute_length, CHECK_(nullHandle)); |
2320 } else if (method_attribute_name == vmSymbols::tag_annotation_default()) { |
2356 } else if (method_attribute_name == vmSymbols::tag_annotation_default()) { |
|
2357 if (annotation_default != NULL) { |
|
2358 classfile_parse_error( |
|
2359 "Multiple AnnotationDefault attributes for method in class file %s", |
|
2360 CHECK_(nullHandle)); |
|
2361 } |
2321 annotation_default_length = method_attribute_length; |
2362 annotation_default_length = method_attribute_length; |
2322 annotation_default = cfs->get_u1_buffer(); |
2363 annotation_default = cfs->get_u1_buffer(); |
2323 assert(annotation_default != NULL, "null annotation default"); |
2364 assert(annotation_default != NULL, "null annotation default"); |
2324 cfs->skip_u1(annotation_default_length, CHECK_(nullHandle)); |
2365 cfs->skip_u1(annotation_default_length, CHECK_(nullHandle)); |
2325 } else if (method_attribute_name == vmSymbols::tag_runtime_visible_type_annotations()) { |
2366 } else if (method_attribute_name == vmSymbols::tag_runtime_visible_type_annotations()) { |
2844 u1* runtime_visible_type_annotations = NULL; |
2885 u1* runtime_visible_type_annotations = NULL; |
2845 int runtime_visible_type_annotations_length = 0; |
2886 int runtime_visible_type_annotations_length = 0; |
2846 u1* runtime_invisible_type_annotations = NULL; |
2887 u1* runtime_invisible_type_annotations = NULL; |
2847 int runtime_invisible_type_annotations_length = 0; |
2888 int runtime_invisible_type_annotations_length = 0; |
2848 bool runtime_invisible_type_annotations_exists = false; |
2889 bool runtime_invisible_type_annotations_exists = false; |
|
2890 bool runtime_invisible_annotations_exists = false; |
|
2891 bool parsed_source_debug_ext_annotations_exist = false; |
2849 u1* inner_classes_attribute_start = NULL; |
2892 u1* inner_classes_attribute_start = NULL; |
2850 u4 inner_classes_attribute_length = 0; |
2893 u4 inner_classes_attribute_length = 0; |
2851 u2 enclosing_method_class_index = 0; |
2894 u2 enclosing_method_class_index = 0; |
2852 u2 enclosing_method_method_index = 0; |
2895 u2 enclosing_method_method_index = 0; |
2853 // Iterate over attributes |
2896 // Iterate over attributes |
2871 parsed_sourcefile_attribute = true; |
2914 parsed_sourcefile_attribute = true; |
2872 } |
2915 } |
2873 parse_classfile_sourcefile_attribute(CHECK); |
2916 parse_classfile_sourcefile_attribute(CHECK); |
2874 } else if (tag == vmSymbols::tag_source_debug_extension()) { |
2917 } else if (tag == vmSymbols::tag_source_debug_extension()) { |
2875 // Check for SourceDebugExtension tag |
2918 // Check for SourceDebugExtension tag |
|
2919 if (parsed_source_debug_ext_annotations_exist) { |
|
2920 classfile_parse_error( |
|
2921 "Multiple SourceDebugExtension attributes in class file %s", CHECK); |
|
2922 } |
|
2923 parsed_source_debug_ext_annotations_exist = true; |
2876 parse_classfile_source_debug_extension_attribute((int)attribute_length, CHECK); |
2924 parse_classfile_source_debug_extension_attribute((int)attribute_length, CHECK); |
2877 } else if (tag == vmSymbols::tag_inner_classes()) { |
2925 } else if (tag == vmSymbols::tag_inner_classes()) { |
2878 // Check for InnerClasses tag |
2926 // Check for InnerClasses tag |
2879 if (parsed_innerclasses_attribute) { |
2927 if (parsed_innerclasses_attribute) { |
2880 classfile_parse_error("Multiple InnerClasses attributes in class file %s", CHECK); |
2928 classfile_parse_error("Multiple InnerClasses attributes in class file %s", CHECK); |
2907 "Wrong Signature attribute length %u in class file %s", |
2955 "Wrong Signature attribute length %u in class file %s", |
2908 attribute_length, CHECK); |
2956 attribute_length, CHECK); |
2909 } |
2957 } |
2910 parse_classfile_signature_attribute(CHECK); |
2958 parse_classfile_signature_attribute(CHECK); |
2911 } else if (tag == vmSymbols::tag_runtime_visible_annotations()) { |
2959 } else if (tag == vmSymbols::tag_runtime_visible_annotations()) { |
|
2960 if (runtime_visible_annotations != NULL) { |
|
2961 classfile_parse_error( |
|
2962 "Multiple RuntimeVisibleAnnotations attributes in class file %s", CHECK); |
|
2963 } |
2912 runtime_visible_annotations_length = attribute_length; |
2964 runtime_visible_annotations_length = attribute_length; |
2913 runtime_visible_annotations = cfs->get_u1_buffer(); |
2965 runtime_visible_annotations = cfs->get_u1_buffer(); |
2914 assert(runtime_visible_annotations != NULL, "null visible annotations"); |
2966 assert(runtime_visible_annotations != NULL, "null visible annotations"); |
2915 parse_annotations(runtime_visible_annotations, |
2967 parse_annotations(runtime_visible_annotations, |
2916 runtime_visible_annotations_length, |
2968 runtime_visible_annotations_length, |
2917 parsed_annotations, |
2969 parsed_annotations, |
2918 CHECK); |
2970 CHECK); |
2919 cfs->skip_u1(runtime_visible_annotations_length, CHECK); |
2971 cfs->skip_u1(runtime_visible_annotations_length, CHECK); |
2920 } else if (PreserveAllAnnotations && tag == vmSymbols::tag_runtime_invisible_annotations()) { |
2972 } else if (tag == vmSymbols::tag_runtime_invisible_annotations()) { |
2921 runtime_invisible_annotations_length = attribute_length; |
2973 if (runtime_invisible_annotations_exists) { |
2922 runtime_invisible_annotations = cfs->get_u1_buffer(); |
2974 classfile_parse_error( |
2923 assert(runtime_invisible_annotations != NULL, "null invisible annotations"); |
2975 "Multiple RuntimeInvisibleAnnotations attributes in class file %s", CHECK); |
2924 cfs->skip_u1(runtime_invisible_annotations_length, CHECK); |
2976 } |
|
2977 runtime_invisible_annotations_exists = true; |
|
2978 if (PreserveAllAnnotations) { |
|
2979 runtime_invisible_annotations_length = attribute_length; |
|
2980 runtime_invisible_annotations = cfs->get_u1_buffer(); |
|
2981 assert(runtime_invisible_annotations != NULL, "null invisible annotations"); |
|
2982 } |
|
2983 cfs->skip_u1(attribute_length, CHECK); |
2925 } else if (tag == vmSymbols::tag_enclosing_method()) { |
2984 } else if (tag == vmSymbols::tag_enclosing_method()) { |
2926 if (parsed_enclosingmethod_attribute) { |
2985 if (parsed_enclosingmethod_attribute) { |
2927 classfile_parse_error("Multiple EnclosingMethod attributes in class file %s", CHECK); |
2986 classfile_parse_error("Multiple EnclosingMethod attributes in class file %s", CHECK); |
2928 } else { |
2987 } else { |
2929 parsed_enclosingmethod_attribute = true; |
2988 parsed_enclosingmethod_attribute = true; |