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

Empty line handling inconsistency in hybrid snippets

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 20
    • tools
    • None

      Consider the external snippet:

      class Test {
        // @start region=r0
        // @start region=r1
        void one() {}
        // @end
        void two() {}
        // @end
        void three() {}
      }

      I want to render the region r0. I write {@snippet file="Test.java" region=r0} and get in rendered HTML
      void one() {}
      void two() {}

      No empty line between one and two. Ok, it was stripped. But if I use a hybrid snippet and want to remove markup from the inline version, the javadoc tool requires me to write this:

      /**
       * {@snippet file="Test.java" region=r0:
       *
       *
       * void one() {}
       *
       * void two() {}
       * }
       */

      Otherwise, it's not accepted. So, in this case empty lines are not stripped (including even the line that starts the r0 region). Moreover, now the rendering is spoiled, as it's rendered with empty lines as well. It looks like, for rendering an inline version is preferred over the external version. This is not specified, and these versions may produce different result. I would expect that external version is preferred for rendering, though this could be discussed.

            hannesw Hannes Wallnoefer
            tvaleev Tagir Valeev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: