docs: public Code declare(MethodId<?, ?> method, int flags) {
          TypeDeclaration typeDeclaration = getTypeDeclaration(method.declaringType);
          if (typeDeclaration.methods.containsKey(method)) {
              throw new IllegalStateException("already declared: " + method);
          }
  
          int supportedFlags = Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED
                  | Modifier.STATIC | Modifier.FINAL | Modifier.SYNCHRONIZED
                  | AccessFlags.ACC_SYNTHETIC | AccessFlags.ACC_BRIDGE;
          if ((flags & ~supportedFlags) != 0) {
              throw new IllegalArgumentException("Unexpected flag: "
                      + Integer.toHexString(flags));
          }
  
          // replace the SYNCHRONIZED flag with the DECLARED_SYNCHRONIZED flag
          if ((flags & Modifier.SYNCHRONIZED) != 0) {
              flags = (flags & ~Modifier.SYNCHRONIZED) | AccessFlags.ACC_DECLARED_SYNCHRONIZED;
          }
  
          if (method.isConstructor() || method.isStaticInitializer()) {
              flags |= ACC_CONSTRUCTOR;
          }
  
          MethodDeclaration methodDeclaration = new MethodDeclaration(method, flags);
          typeDeclaration.methods.put(method, methodDeclaration);
          return methodDeclaration.code;
      }