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

Spec of ForwardingJavaFileManager/ForwardingFileObject/ForwardingJavaFileObject methods should mention delegation instead of being copied

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 18
    • 17
    • tools
    • b06

      The following classes

        https://docs.oracle.com/en/java/javase/16/docs/api/java.compiler/javax/tools/ForwardingFileObject.html
        https://docs.oracle.com/en/java/javase/16/docs/api/java.compiler/javax/tools/ForwardingJavaFileObject.html
        https://docs.oracle.com/en/java/javase/16/docs/api/java.compiler/javax/tools/ForwardingJavaFileManager.html

      are expected to forward all calls to the given file manager or file object or java file object and this is mentioned at class level specs:

      > Forwards calls to a given file object
      > Forwards calls to a given file manager

      However specification for their methods is simply copied from FileObject, JavaFileObject, JavaFileManager interfaces.

      This leads to misleading specs for forwarding implementations of interface methods, since the original specs of the interfaces often refer to "this file object" or "this file manager" and these assertions are just copied.

      Specification for methods of ForwardingX should be overridden to provide correct assertions and expectations.
      Or it should be just hidden somehow since there's nothing actually for this methods to specify in addition to what's said at class level:

      > Forwards calls to a given file object
      > Forwards calls to a given file manager




            jjg Jonathan Gibbons
            dbessono Dmitry Bessonov
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: