code: private void closeFileObject(ModuleSymbol mod, String typeName, FileObject fileObject) {
          /*
           * If typeName is non-null, the file object was opened as a
           * source or class file by the user.  If a file was opened as
           * a resource, typeName will be null and the file is *not*
           * subject to annotation processing.
           */
          if ((typeName != null)) {
              if (!(fileObject instanceof JavaFileObject))
                  throw new AssertionError("JavaFileOject not found for " + fileObject);
              JavaFileObject javaFileObject = (JavaFileObject)fileObject;
              switch(javaFileObject.getKind()) {
              case SOURCE:
                  generatedSourceNames.add(typeName);
                  generatedSourceFileObjects.add(javaFileObject);
                  openTypeNames.remove(typeName);
                  break;
  
              case CLASS:
                  generatedClasses.computeIfAbsent(mod, m -> Collections.synchronizedMap(new LinkedHashMap<>())).put(typeName, javaFileObject);
                  openTypeNames.remove(typeName);
                  break;
  
              default:
                  break;
              }
          }
      }
docs: Upon close, register files opened by create{Source, Class}File
  for annotation processing.