JDK8: Getting back the JDK7 look for javadoc

后端 未结 3 554
执笔经年
执笔经年 2020-12-14 09:29

I find it difficult to read the new look-and-feel in JDK8 javadoc compared to JDK7. Here\'s a side-by-side example.

JDK7:

3条回答
  •  旧时难觅i
    2020-12-14 10:00

    You could get the standard JDK 8 stylesheet.css and fix it very quickly, and then you can put that into some source folder and tell javadoc to use that with its stylesheetfile option. The problem with that is that there's no backward compatibility guarantee, the generated HTML changes quite a bit sometimes. That happened with JDK 7, and now with JDK 8. And then often you also have to consider that just because JDk 8 is out, some may will build your project with JDK 7...

    Anyway, what I did was detecting if we are building under JDK 8 or later, and in that case I have applied regexp replacements on stylesheet.css, on build time. That was easy for me, as this old project uses Ant, not Maven. Just to see what the changes are, the relevant part is:

    
      
      Fixing JDK 8 CSS in ${file}
    
      
      
    
      
      
    
      
      
      
      
      
      
      
      
      
    
      
      
      
      
      
      
      
    
    

    So the point is the regular expression above, that anyone can apply with ant, sed, Notepad++, etc (for non-Ant, don't forget to resolve the &...; and ${...} parts).

    The reason I have used regexp is that I hope that it will be able to survive some changes in the HTML and thus in the standard CSS... but maybe I should just use the resulting CSS, I don't know. Or I should opt for using some 3rd party doclet, where thus I can control the used version.

提交回复
热议问题