private static Annotation translateEnclosingMethod(AttributeList attribs) {
    AttEnclosingMethod enclosingMethod =
        (AttEnclosingMethod) attribs.findFirst(AttEnclosingMethod.ATTRIBUTE_NAME);

    if (enclosingMethod == null) {
      return null;
    }

    CstType enclosingClass = enclosingMethod.getEnclosingClass();
    CstNat nat = enclosingMethod.getMethod();

    if (nat == null) {
      /*
       * Dalvik doesn't use EnclosingMethod annotations unless
       * there really is an enclosing method. Anonymous classes
       * are unambiguously identified by having an InnerClass
       * annotation with an empty name along with an appropriate
       * EnclosingClass.
       */
      return AnnotationUtils.makeEnclosingClass(enclosingClass);
    }

    return AnnotationUtils.makeEnclosingMethod(new CstMethodRef(enclosingClass, nat));
  }
Gets the {@code EnclosingMethod} attribute out of a given {@link AttributeList}, if any,
translating it to an annotation. If the class really has an enclosing method, this returns an
{@code EnclosingMethod} annotation; if not, this returns an {@code EnclosingClass} annotation.

@param attribs {@code non-null;} the attributes list to search in
@return {@code null-ok;} the converted {@code EnclosingMethod} or {@code EnclosingClass}
    annotation, if there was an attribute to translate
android/android_framework/dex-maker/src/main/java/com/android/dx/dex/cf/AttributeTranslator.java