Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8275508

Pass originating elements from Filer to JavaFileManager

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 18
    • tools
    • None
    • source
    • low
    • Adding new methods to JavaFileManager can cause compatibility issues for subclasses may have a method with the same name and signature, conflicting with the newly added method. Given the names of the proposed methods, this appears to be very unlikely.
    • Java API
    • SE

      Summary

      JavaFileManager is enhanced with two new methods used to create new files on behalf of Filer.

      Problem

      Various methods in javax.annotation.processing.Filer, like createSourceFile, allow to specify the Elements from which the content of the file "originates". But these Elements are completely unused, are ignored in Filer, and the JavaFileManager that ultimately creates the files is not aware of them.

      Solution

      Two new methods (getJavaFileForOutputForOriginatingFiles and getFileForOutputForOriginatingFiles), accepting "originating files" are added to JavaFileManager, and the Filer implementation in javac will delegate to these methods, converting originating Elements to JavaFileObjects.

      Specification

      The specdiff is attached as specdiff.01.zip and is also available for convenience here: http://cr.openjdk.java.net/~jlahoda/8272234/specdiff.01/overview-summary.html

            jlahoda Jan Lahoda
            jlahoda Jan Lahoda
            Vicente Arturo Romero Zaldivar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: