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); }
public static List<AnnotationExprent> parseAnnotations(ConstantPool pool, DataInputStream data) throws IOException { int len = data.readUnsignedShort(); if (len > 0) { List<AnnotationExprent> annotations = new ArrayList<>(len); for (int i = 0; i < len; i++) { annotations.add(parseAnnotation(data, pool)); } return annotations; } else { return Collections.emptyList(); } }
@Override public void initContent(DataInputFullStream data, ConstantPool pool) throws IOException { defaultValue = StructAnnotationAttribute.parseAnnotationElement(data, pool); }
elements = new ArrayList<>(len); for (int i = 0; i < len; i++) { elements.add(parseAnnotationElement(data, pool)); return parseAnnotation(data, pool);
@Override public void initContent(DataInputFullStream data, ConstantPool pool) throws IOException { annotations = parseAnnotations(pool, data); }
attr = new StructAnnotationAttribute();
elements = new ArrayList<>(len); for (int i = 0; i < len; i++) { elements.add(parseAnnotationElement(data, pool)); return parseAnnotation(data, pool);
@Override public void initContent(DataInputFullStream data, ConstantPool pool) throws IOException { int len = data.readUnsignedByte(); if (len > 0) { paramAnnotations = new ArrayList<>(len); for (int i = 0; i < len; i++) { List<AnnotationExprent> annotations = StructAnnotationAttribute.parseAnnotations(pool, data); paramAnnotations.add(annotations); } } else { paramAnnotations = Collections.emptyList(); } }
attr = new StructAnnotationAttribute();
public static AnnotationExprent parseAnnotation(DataInputStream data, ConstantPool pool) throws IOException { String className = pool.getPrimitiveConstant(data.readUnsignedShort()).getString(); List<String> names; List<Exprent> values; int len = data.readUnsignedShort(); if (len > 0) { names = new ArrayList<>(len); values = new ArrayList<>(len); for (int i = 0; i < len; i++) { names.add(pool.getPrimitiveConstant(data.readUnsignedShort()).getString()); values.add(parseAnnotationElement(data, pool)); } } else { names = Collections.emptyList(); values = Collections.emptyList(); } return new AnnotationExprent(new VarType(className).value, names, values); }
@Override public void initContent(DataInputFullStream data, ConstantPool pool) throws IOException { annotations = parseAnnotations(pool, data); }
AnnotationExprent annotation = StructAnnotationAttribute.parseAnnotation(data, pool);
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); }
@Override public void initContent(DataInputFullStream data, ConstantPool pool) throws IOException { defaultValue = StructAnnotationAttribute.parseAnnotationElement(data, pool); }
@Override public void initContent(DataInputFullStream data, ConstantPool pool) throws IOException { int len = data.readUnsignedByte(); if (len > 0) { paramAnnotations = new ArrayList<>(len); for (int i = 0; i < len; i++) { List<AnnotationExprent> annotations = StructAnnotationAttribute.parseAnnotations(pool, data); paramAnnotations.add(annotations); } } else { paramAnnotations = Collections.emptyList(); } }
public static List<AnnotationExprent> parseAnnotations(ConstantPool pool, DataInputStream data) throws IOException { int len = data.readUnsignedShort(); if (len > 0) { List<AnnotationExprent> annotations = new ArrayList<>(len); for (int i = 0; i < len; i++) { annotations.add(parseAnnotation(data, pool)); } return annotations; } else { return Collections.emptyList(); } }
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; }
public static AnnotationExprent parseAnnotation(DataInputStream data, ConstantPool pool) throws IOException { String className = pool.getPrimitiveConstant(data.readUnsignedShort()).getString(); List<String> names; List<Exprent> values; int len = data.readUnsignedShort(); if (len > 0) { names = new ArrayList<>(len); values = new ArrayList<>(len); for (int i = 0; i < len; i++) { names.add(pool.getPrimitiveConstant(data.readUnsignedShort()).getString()); values.add(parseAnnotationElement(data, pool)); } } else { names = Collections.emptyList(); values = Collections.emptyList(); } return new AnnotationExprent(new VarType(className).value, names, values); }
AnnotationExprent annotation = StructAnnotationAttribute.parseAnnotation(data, pool);
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); }