void (RefElement refElement) { if (refElement instanceof RefClass refClass) { UClass uClass = refClass.getUastElement(); if (uClass != null) { for (UClassInitializer initializer : uClass.getInitializers()) { findUnusedLocalVariables(initializer.getUastBody(), refElement); } } } else if (refElement instanceof RefMethod refMethod) { UMethod element = refMethod.getUastElement(); if (element != null) { UExpression body = element.getUastBody(); if (body != null) { findUnusedLocalVariables(body, refElement); } } } else if (refElement instanceof RefField refField) { UField field = refField.getUastElement(); if (field != null) { UExpression initializer = field.getUastInitializer(); if (initializer != null) { findUnusedLocalVariables(initializer, refElement); } } } }