private static boolean findAndRemoveReturnCheck(Statement stat, StructMethod mt) { boolean is_notnull_check = false; // method annotation, refers to the return value StructAnnotationAttribute attr = mt.getAttribute(StructGeneralAttribute.ATTRIBUTE_RUNTIME_INVISIBLE_ANNOTATIONS); if (attr != null) { List<AnnotationExprent> annotations = attr.getAnnotations(); for (AnnotationExprent ann : annotations) { if (ann.getClassName().equals("org/jetbrains/annotations/NotNull")) { is_notnull_check = true; } } } return is_notnull_check && removeReturnCheck(stat, mt); }
private static void appendAnnotations(TextBuffer buffer, int indent, StructMember mb, int targetType) { Set<String> filter = new HashSet<>(); for (StructGeneralAttribute.Key<?> key : ANNOTATION_ATTRIBUTES) { StructAnnotationAttribute attribute = (StructAnnotationAttribute)mb.getAttribute(key); if (attribute != null) { for (AnnotationExprent annotation : attribute.getAnnotations()) { String text = annotation.toJava(indent, BytecodeMappingTracer.DUMMY).toString(); filter.add(text); buffer.append(text).appendLineSeparator(); } } } appendTypeAnnotations(buffer, indent, mb, targetType, -1, filter); }
private static boolean findAndRemoveReturnCheck(Statement stat, StructMethod mt) { boolean is_notnull_check = false; // method annotation, refers to the return value StructAnnotationAttribute attr = (StructAnnotationAttribute)mt.getAttribute(StructGeneralAttribute.ATTRIBUTE_RUNTIME_INVISIBLE_ANNOTATIONS); if (attr != null) { List<AnnotationExprent> annotations = attr.getAnnotations(); for (AnnotationExprent ann : annotations) { if (ann.getClassName().equals("org/jetbrains/annotations/NotNull")) { is_notnull_check = true; } } } if (is_notnull_check) { return removeReturnCheck(stat, mt); } return false; }
private static void appendAnnotations(TextBuffer buffer, int indent, StructMember mb, int targetType) { Set<String> filter = new HashSet<>(); for (String name : ANNOTATION_ATTRIBUTES) { StructAnnotationAttribute attribute = (StructAnnotationAttribute)mb.getAttribute(name); if (attribute != null) { for (AnnotationExprent annotation : attribute.getAnnotations()) { String text = annotation.toJava(indent, BytecodeMappingTracer.DUMMY).toString(); filter.add(text); buffer.append(text).appendLineSeparator(); } } } appendTypeAnnotations(buffer, indent, mb, targetType, -1, filter); }