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

Javadoc unexpectedly reports that hybrid snippet contents mismatch

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • 24
    • 18, 19, 20, 21
    • tools
    • None

      Steps:

      1. Create Java class MyTest.java:
      package com.example;

      /**
       * {@snippet class="Test" region=reg:
       *
       *
       * void two() {}}
       */
      public class MyTest {
      }
      2. Create the Test.java snippet in snippet-files:
      class Test {
          // @start region=reg
          // @replace region substring="one" replacement="two"
          void one() {}
          // @end
          // @end
      }
      3. Run javadoc tool
      javadoc.exe --snippet-path=snippet-files MyTest.java

      Expected result: either no errors, or an error message which clearly shows what should be fixed

      Actual result: error message that says about content mismatch, while the rendered content shown in error message is byte-to-byte the same.

      Here's the complete output:

      Loading source file MyTest.java...
      Constructing Javadoc information...
      Building index for all the packages and classes...
      Standard Doclet version 21-ea+12-971
      Building tree for all the packages and classes...
      Generating .\com\example\MyTest.html...
      MyTest.java:4: error: contents mismatch:
       * {@snippet class="Test" region=reg:
         ^
        ----------------- inline -------------------
        
        
        void two() {}
        ----------------- external -----------------
        
        
        void two() {}
      MyTest.java:9: warning: use of default constructor, which does not provide a comment
      public class MyTest {
             ^
      Generating .\com\example\package-summary.html...
      Generating .\com\example\package-tree.html...
      Generating .\overview-tree.html...
      Building index for all classes...
      Generating .\allclasses-index.html...
      Generating .\allpackages-index.html...
      Generating .\index-all.html...
      Generating .\search.html...
      Generating .\index.html...
      Generating .\help-doc.html...
      1 error
      1 warning

            prappo Pavel Rappo
            tvaleev Tagir Valeev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: