MCPcopy
hub / github.com/Col-E/Recaf / copyMethodMetadata

Method copyMethodMetadata

src/main/java/me/coley/recaf/util/ClassUtil.java:315–338  ·  view source on GitHub ↗

Copies method metadata. @param from method to copy from. @param to method to copy to.

(MethodNode from, MethodNode to)

Source from the content-addressed store, hash-verified

313 * @param to method to copy to.
314 */
315 public static void copyMethodMetadata(MethodNode from, MethodNode to) {
316 if (to.invisibleAnnotations == null && from.invisibleAnnotations != null)
317 to.invisibleAnnotations = new ArrayList<>();
318 if (to.visibleAnnotations == null && from.visibleAnnotations != null)
319 to.visibleAnnotations = new ArrayList<>();
320 if (to.invisibleTypeAnnotations == null && from.invisibleTypeAnnotations != null)
321 to.invisibleTypeAnnotations = new ArrayList<>();
322 if (to.visibleTypeAnnotations == null && from.visibleTypeAnnotations != null)
323 to.visibleTypeAnnotations = new ArrayList<>();
324 if (to.invisibleLocalVariableAnnotations == null && from.invisibleLocalVariableAnnotations != null)
325 to.invisibleLocalVariableAnnotations = new ArrayList<>();
326 if (to.visibleLocalVariableAnnotations == null && from.visibleLocalVariableAnnotations != null)
327 to.visibleLocalVariableAnnotations = new ArrayList<>();
328 updateAnnotationList(to.invisibleAnnotations, from.invisibleAnnotations);
329 updateAnnotationList(to.visibleAnnotations, from.visibleAnnotations);
330 updateAnnotationList(to.invisibleTypeAnnotations, from.invisibleTypeAnnotations);
331 updateAnnotationList(to.visibleTypeAnnotations, from.visibleTypeAnnotations);
332 updateAnnotationList(to.invisibleLocalVariableAnnotations, from.invisibleLocalVariableAnnotations);
333 updateAnnotationList(to.visibleLocalVariableAnnotations, from.visibleLocalVariableAnnotations);
334 to.invisibleParameterAnnotations = from.invisibleParameterAnnotations;
335 to.visibleParameterAnnotations = from.visibleParameterAnnotations;
336 to.visibleAnnotableParameterCount = from.visibleAnnotableParameterCount;
337 to.invisibleAnnotableParameterCount = from.invisibleAnnotableParameterCount;
338 }
339
340 @SuppressWarnings("all")
341 private static <T extends AnnotationNode> void updateAnnotationList(List<T> to, List<T> from) {

Callers 3

openMethod · 0.95
callMethod · 0.95
updateOrInsertMethod · 0.95

Calls 1

updateAnnotationListMethod · 0.95

Tested by

no test coverage detected