From kumar.x.srinivasan at oracle.com Mon Nov 6 21:48:01 2017 From: kumar.x.srinivasan at oracle.com (Kumar Srinivasan) Date: Mon, 06 Nov 2017 13:48:01 -0800 Subject: RFR: JDK-8190295: Introduce a new Table builder class In-Reply-To: <59F3BA6D.1040106@oracle.com> References: <59F3BA6D.1040106@oracle.com> Message-ID: <5A00D891.30102@oracle.com> Hi Jon, This is an enormous improvement and simplification!. Thanks! Table.java: 304 *
  • The prefix should probably be a value such that the genenrated ids cannot s/genenrated/generated/ The previous block is ternary operation, would make it nicer if this is also so. HtmlTree cell; if ((colIndex) == rowScopeColumnIndex) { cell = HtmlTree.TH(cellStyle, "row", c); } else { cell = HtmlTree.TD(cellStyle, c); } final HtmlTree cell = HtmlTree.TH(cellStyle, "row", c) ? HtmlTree.TH(cellStyle, "row", c) : HtmlTree.TD(cellStyle, c); AbstractMemberWriter.java + TypeElement te = utils.getEnclosingTypeElement(element); // is this different from typeElement? I ran a quick test, and encountered several test failures, the reason is ClassUseWriter uses this method, and it creates AbstractMemberWriter with typeElement = null, via public AbstractMemberWriter(SubWriterHolderWriter writer) { this(writer, null); } and thus typeElement could be a null, the following might save some cpu cycles, I verified all tests pass and the comparison tests also pass. + TypeElement te = typeElement == null + ? utils.getEnclosingTypeElement(element) + : typeElement; There were other details we discussed offlist, and that clarifies the questions I had, regarding Table.java. Most of this is in Bhavesh's expertise, I will leave it to him. Kumar > Please review the following change, to replace the code to create HTML > tables with a new > builder-style Table class. With the exception of some minor > differences (bug fixes) on > the deprecated-list page, the generated output should be unchanged for > now, although > we may want to remove some backwards-compatibility hacks at some point > in the future > to make all tables be more uniform when appropriate. > > Before reading the detailed changes in the modified files, you might > want to start by > reviewing the new Table class. > > JBS: https://bugs.openjdk.java.net/browse/JDK-8190295 > Webrev: http://cr.openjdk.java.net/~jjg/8190295/webrev.00/ > > > Notes: > > (Various files) > Stuff that has been deleted has generally moved in some form or other > into the new Table class > or otherwise made redundant. > > AbstractMemberWriter:118-138 > Previously, the state defining the table was indirectly managed in the > MemberSummaryBuilder > class via tableContents and counter (uugh.) Now, the state is kept in > the AbstractMemberWriter > and lazily created by getSummaryTable, line 120. > > AbstractMemberWriter:433-437 > Here's a relatively simple example of creating a Table, new-style. > The table is created (433-437), rows are added (463) and the HTML > generated (465) > Other Tables are created in *WriterImpl classes. > > AbstractMemberWriter: old lines 535-553 > Anything to do with TableTabs is now mostly hidden inside the Table > class, driven by > addTab calls when the Table is initialized. > > AbstractMemberWriter:583-592 > The lines are called by the MemberSummaryBuilder to conclude its work > on the table. > > DeprecatedListWriter: > There is a small, deliberate (bug fix?) change in behavior here. > Previously, modules > in the deprecated list used the colFirst style, and other types used > colDeprecatedItemName. > Now, everything uses the same style, colDeprecatedItemName. It didn't > seem worth > fixing for the old bad behavior. Also note that some cells were > omitted from the table, > causing inconsistent visual appear of the striping. That is also fixed. > > HtmlDocletWriter:2548 > This is made available, for now. The script item itself is in > HtmlWriter (uugh). Long term, > this should move into a new Head class (builder for element) > > MethodWriterImpl.java:258-278 > This is definitely the most exciting part of this work. This is the > client-side replacement for > all the previous code to manage table tabs. Now, each tab is just a > method call with a > name and a predicate. > > ModuleIndexWriter.java:135-141 > Following on from the previous comment, here in ModuleIndexWriter, and > corresponding code > in PackageIndexWriter, we have a dynamically added set of tabs, based > on command line options. > > ModuleWriterImpl.java:635-648 > For now, for compatibility the rows are added in the same order as > before. > Going forward, we might want to add the rows in overall sorted order. > > PropertyWriterImpl.java:234-245 > Because we create differently configures tables for properties and > methods, one without tabs, one with, > it falls out of the design that the rows in the properties table don't > get "ids", thus avoiding the earlier > "duplicate id" problem. > > Table.java: > The new class that does all the work. It's reasonably well commented, > so nothing to add here. > > -- Jon > From kumar.x.srinivasan at oracle.com Tue Nov 7 02:09:42 2017 From: kumar.x.srinivasan at oracle.com (Kumar Srinivasan) Date: Mon, 06 Nov 2017 18:09:42 -0800 Subject: Fwd: RFR: 8190552/8185985: Augment the Compiler API tree ; Html files in doc-files directories should be wrapped In-Reply-To: <5A0114A1.7080909@oracle.com> References: <5A0114A1.7080909@oracle.com> Message-ID: <5A0115E6.3070509@oracle.com> Hello, Please review fix to augment the Compiler API tree to represent the entire HTML content of a file, please see bug [1] and webrev [2]. The above are required to implement the bug [3] and webrev [4], please review these as well. Please note these patches exist as mq patches in my repo, and will be pushed as two discrete changesets. Thanks Kumar [1] https://bugs.openjdk.java.net/browse/JDK-8190552 [2] http://cr.openjdk.java.net/~ksrini/8190552/webrev.00/ [3] https://bugs.openjdk.java.net/browse/JDK-8185985 [4] http://cr.openjdk.java.net/~ksrini/8185985/webrev.00/ From jonathan.gibbons at oracle.com Tue Nov 7 02:17:28 2017 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Mon, 06 Nov 2017 18:17:28 -0800 Subject: RFR: JDK-8190295: Introduce a new Table builder class In-Reply-To: <5A00D891.30102@oracle.com> References: <59F3BA6D.1040106@oracle.com> <5A00D891.30102@oracle.com> Message-ID: <5A0117B8.5080504@oracle.com> Kumar, Thank you for your feedback. I've made the changes you suggested, and included the proposal as part of a series of related changes to generally cleanup more of the same. The overall webrev is now at http://cr.openjdk.java.net/~jjg/8190295-etc/webrev.00/ which contains a series of webrevs as follows: https://bugs.openjdk.java.net/browse/JDK-8190295 http://cr.openjdk.java.net/~jjg/8190295-etc/webrev.00/webrev.tables/index.html changeset: 47482:d222b617b9d2 tag: tables user: jjg date: Mon Nov 06 17:17:07 2017 -0800 summary: 8190295: Introduce a new Table builder class https://bugs.openjdk.java.net/browse/JDK-8190818 http://cr.openjdk.java.net/~jjg/8190295-etc/webrev.00/webrev.scripts/index.html changeset: 47483:875dd666843f tag: scripts user: jjg date: Mon Nov 06 17:18:34 2017 -0800 summary: 8190818: Introduce a new Script builder class https://bugs.openjdk.java.net/browse/JDK-8190819 http://cr.openjdk.java.net/~jjg/8190295-etc/webrev.00/webrev.htmlDocument/index.html changeset: 47484:aaf2675c4f4b tag: htmlDocument user: jjg date: Mon Nov 06 17:19:06 2017 -0800 summary: 8190819: Merge HtmlWriter into HtmlDocument https://bugs.openjdk.java.net/browse/JDK-8190820 http://cr.openjdk.java.net/~jjg/8190295-etc/webrev.00/webrev.head/index.html changeset: 47485:ca0c08593f7a tag: head user: jjg date: Mon Nov 06 17:19:28 2017 -0800 summary: 8190820: Introduce a new Head builder class https://bugs.openjdk.java.net/browse/JDK-8190821 http://cr.openjdk.java.net/~jjg/8190295-etc/webrev.00/webrev.links/index.html changeset: 47486:3e139d148884 tag: links user: jjg date: Mon Nov 06 17:19:47 2017 -0800 summary: 8190821: Introduce a new Links builder class https://bugs.openjdk.java.net/browse/JDK-8190822 http://cr.openjdk.java.net/~jjg/8190295-etc/webrev.00/webrev.linkInfoImplStylename/index.html changeset: 47487:762be115f89a tag: linkInfoImplStylename user: jjg date: Mon Nov 06 17:20:49 2017 -0800 summary: 8190822: Remove dead code that could lead to invalid HTML https://bugs.openjdk.java.net/browse/JDK-8190824 http://cr.openjdk.java.net/~jjg/8190295-etc/webrev.00/webrev.htmldocwriter/index.html changeset: 47488:c09c658d94b3 tag: htmldocwriter tag: qtip tag: tip user: jjg date: Mon Nov 06 17:21:00 2017 -0800 summary: 8190824: Eliminate HtmlDocWriter The first webrev (for Table.java) is the biggie. The others are all much simpler. -- Jon On 11/06/2017 01:48 PM, Kumar Srinivasan wrote: > > Hi Jon, > > This is an enormous improvement and simplification!. Thanks! > > Table.java: > > 304 *
  • The prefix should probably be a value such that the > genenrated ids cannot > > s/genenrated/generated/ > > > The previous block is ternary operation, would make it nicer if this > is also so. > > HtmlTree cell; > if ((colIndex) == rowScopeColumnIndex) { > cell = HtmlTree.TH(cellStyle, "row", c); > } else { > cell = HtmlTree.TD(cellStyle, c); > } > > final HtmlTree cell = HtmlTree.TH(cellStyle, "row", c) > ? HtmlTree.TH(cellStyle, "row", c) > : HtmlTree.TD(cellStyle, c); > > > > AbstractMemberWriter.java > > + TypeElement te = > utils.getEnclosingTypeElement(element); // is this different from > typeElement? > > I ran a quick test, and encountered several test failures, the reason > is ClassUseWriter uses this method, > and it creates AbstractMemberWriter with typeElement = null, via > public AbstractMemberWriter(SubWriterHolderWriter writer) { > this(writer, null); > } > and thus typeElement could be a null, the following might save some > cpu cycles, > I verified all tests pass and the comparison tests also pass. > > + TypeElement te = typeElement == null > + ? utils.getEnclosingTypeElement(element) > + : typeElement; > > > There were other details we discussed offlist, and that clarifies the > questions I had, > regarding Table.java. Most of this is in Bhavesh's expertise, I will > leave it to him. > > Kumar > > >> Please review the following change, to replace the code to create >> HTML tables with a new >> builder-style Table class. With the exception of some minor >> differences (bug fixes) on >> the deprecated-list page, the generated output should be unchanged >> for now, although >> we may want to remove some backwards-compatibility hacks at some >> point in the future >> to make all tables be more uniform when appropriate. >> >> Before reading the detailed changes in the modified files, you might >> want to start by >> reviewing the new Table class. >> >> JBS: https://bugs.openjdk.java.net/browse/JDK-8190295 >> Webrev: http://cr.openjdk.java.net/~jjg/8190295/webrev.00/ >> >> >> Notes: >> >> (Various files) >> Stuff that has been deleted has generally moved in some form or other >> into the new Table class >> or otherwise made redundant. >> >> AbstractMemberWriter:118-138 >> Previously, the state defining the table was indirectly managed in >> the MemberSummaryBuilder >> class via tableContents and counter (uugh.) Now, the state is kept in >> the AbstractMemberWriter >> and lazily created by getSummaryTable, line 120. >> >> AbstractMemberWriter:433-437 >> Here's a relatively simple example of creating a Table, new-style. >> The table is created (433-437), rows are added (463) and the HTML >> generated (465) >> Other Tables are created in *WriterImpl classes. >> >> AbstractMemberWriter: old lines 535-553 >> Anything to do with TableTabs is now mostly hidden inside the Table >> class, driven by >> addTab calls when the Table is initialized. >> >> AbstractMemberWriter:583-592 >> The lines are called by the MemberSummaryBuilder to conclude its work >> on the table. >> >> DeprecatedListWriter: >> There is a small, deliberate (bug fix?) change in behavior here. >> Previously, modules >> in the deprecated list used the colFirst style, and other types used >> colDeprecatedItemName. >> Now, everything uses the same style, colDeprecatedItemName. It didn't >> seem worth >> fixing for the old bad behavior. Also note that some cells were >> omitted from the table, >> causing inconsistent visual appear of the striping. That is also fixed. >> >> HtmlDocletWriter:2548 >> This is made available, for now. The script item itself is in >> HtmlWriter (uugh). Long term, >> this should move into a new Head class (builder for element) >> >> MethodWriterImpl.java:258-278 >> This is definitely the most exciting part of this work. This is the >> client-side replacement for >> all the previous code to manage table tabs. Now, each tab is just a >> method call with a >> name and a predicate. >> >> ModuleIndexWriter.java:135-141 >> Following on from the previous comment, here in ModuleIndexWriter, >> and corresponding code >> in PackageIndexWriter, we have a dynamically added set of tabs, based >> on command line options. >> >> ModuleWriterImpl.java:635-648 >> For now, for compatibility the rows are added in the same order as >> before. >> Going forward, we might want to add the rows in overall sorted order. >> >> PropertyWriterImpl.java:234-245 >> Because we create differently configures tables for properties and >> methods, one without tabs, one with, >> it falls out of the design that the rows in the properties table >> don't get "ids", thus avoiding the earlier >> "duplicate id" problem. >> >> Table.java: >> The new class that does all the work. It's reasonably well commented, >> so nothing to add here. >> >> -- Jon >> > From jonathan.gibbons at oracle.com Tue Nov 7 23:15:53 2017 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Tue, 07 Nov 2017 15:15:53 -0800 Subject: Fwd: RFR: 8190552/8185985: Augment the Compiler API tree ; Html files in doc-files directories should be wrapped In-Reply-To: <5A0115E6.3070509@oracle.com> References: <5A0114A1.7080909@oracle.com> <5A0115E6.3070509@oracle.com> Message-ID: <5A023EA9.8090509@oracle.com> [1] https://bugs.openjdk.java.net/browse/JDK-8190552 src/jdk.compiler/share/classes/com/sun/source/doctree/DocTypeTree.java line 32: typo: @lt; should be < > should be > JavacTrees.java, 1041, 1042, duplicate call > 1040 DocCommentTree docCommentTree = getDocCommentTree(jfo); > 1041 docCommentTree = getDocCommentTree(jfo); In DocCommentParser, the inPhase field can be reduced to a parameter on blockComment. Also, the following replacement for 191-208 is more robust in the face of malformed docs: 191 if (isFileContent) { 192 switch (inPhase) { 193 case PREAMBLE: if (peek("body") == PeekKind.OPEN) { 194 trees.add(html()); 195 if (textStart == -1) { 196 textStart = bp; 197 lastNonWhite = -1; 198 } 199 // mark this as the start, for processing purposes 200 newline = true; 201 break loop; } break; 202 case BLOCK: if(peek("body") == PeekKind.CLOSE) { 203 addPendingText(trees, lastNonWhite); 204 break loop; } break; 205 default: 206 // fall through 207 } 208 } (As a further simplification, you could even make "peek" be "boolean peek(String)" and handle the / in the impl of peek, thus eliminating PeekKind.) DCTree: 161-165 Format the new lines like the preceding lines (3-line form). DCTree: 303,305 Use "text" instead of "body" consistently test/langtools/tools/javac/doctree/dcapi/DocCommentTreeApiTester.java line 196: do you mean "incorrect" here? do you mean"invalid"? (I don't know what it means to say "incorrect input document") line 239: ditto test/langtools/tools/javac/doctree/dcapi/overview0.html and friends why do you still need the partial comment "