code: public static String getSourceFile(TypeElement type) {
      if (type instanceof ClassSymbol) {
        JavaFileObject srcFile = ((ClassSymbol) type).sourcefile;
        if (srcFile != null) {
          return srcFile.getName();
        }
      }
      return null;
    }
docs: Returns the source file name for a type element. Returns null if the element
  isn't a javac ClassSymbol, or if it is defined by a classfile which was compiled
  without a source attribute.