Used correct stack trace marker interface wrapper sub type indicator

This commit is contained in:
Willem Cazander 2025-01-18 00:20:48 +01:00
parent 27d01d57ab
commit e8811b39df
6 changed files with 50 additions and 54 deletions

View file

@ -22,11 +22,11 @@
*/
package org.x4o.fc18.cake2.fcdoc;
import java.io.Closeable;
import java.io.IOException;
import org.x4o.fc18.cake2.FourCornerDotCake;
import org.x4o.o2o.io.ContentWriterHtml.Tag;
import org.x4o.o2o.io.sax3.ContentCloseable;
import org.x4o.o2o.tdoc.ApiDocContentCss;
import org.x4o.o2o.tdoc.ApiDocContentWriter;
import org.x4o.o2o.tdoc.dom.ApiDocPage;
@ -49,8 +49,8 @@ public class FCDocPageWriterCakeTower implements ApiDocPageWriter {
@Override
public void writePageContent(ApiDocWriteEvent<ApiDocPage> e) throws IOException {
ApiDocContentWriter writer = e.getWriter();
try (Closeable content = writer.docPageContent()) {
try (Closeable table = writer.docTable("Cake Splices", null, ApiDocContentCss.overviewSummary)) {
try (ContentCloseable content = writer.docPageContent()) {
try (ContentCloseable table = writer.docTable("Cake Splices", null, ApiDocContentCss.overviewSummary)) {
writeTableBoxHeader(writer, new String[] {"Name", "Start", "Stop", "Size"});
for (FourCornerDotCake slice : FourCornerDotCake.values()) {
writeCake(e, slice);
@ -62,7 +62,7 @@ public class FCDocPageWriterCakeTower implements ApiDocPageWriter {
private void writeCake(ApiDocWriteEvent<ApiDocPage> e, FourCornerDotCake slice) throws IOException {
String rootId = e.getDoc().getRootNode().getId();
ApiDocContentWriter writer = e.getWriter();
try (Closeable tableRow = writer.docTableRow()) {
try (ContentCloseable tableRow = writer.docTableRow()) {
writer.printTagStart(Tag.td, ApiDocContentCss.colFirst);
if (slice.ordinal() >= e.getDoc().getRootNode().getNodes().size()) {
writer.printCharacters(slice.nameSpec());
@ -76,20 +76,20 @@ public class FCDocPageWriterCakeTower implements ApiDocPageWriter {
}
writer.printTagEnd(Tag.td);
try (Closeable td = writer.printTag(Tag.td, ApiDocContentCss.colOne)) {
try (ContentCloseable td = writer.printTag(Tag.td, ApiDocContentCss.colOne)) {
writer.printCharacters(String.format("0x%06X", slice.getStart()));
}
try (Closeable td = writer.printTag(Tag.td, ApiDocContentCss.colOne)) {
try (ContentCloseable td = writer.printTag(Tag.td, ApiDocContentCss.colOne)) {
writer.printCharacters(String.format("0x%06X", slice.getStop()));
}
try (Closeable td = writer.printTag(Tag.td, ApiDocContentCss.colOne)) {
try (ContentCloseable td = writer.printTag(Tag.td, ApiDocContentCss.colOne)) {
writer.printCharacters(String.format("%d", slice.getLength()));
}
}
}
private void writeTableBoxHeader(ApiDocContentWriter writer, String[] headers) throws IOException {
try (Closeable td = writer.printTag(Tag.tr)) {
try (ContentCloseable td = writer.printTag(Tag.tr)) {
AttributesImpl atts;
for (int i = 0; i < headers.length; i++) {
atts = new AttributesImpl();
@ -101,7 +101,7 @@ public class FCDocPageWriterCakeTower implements ApiDocPageWriter {
atts.addAttribute ("", "class", "", "", ApiDocContentCss.colLast.name());
}
atts.addAttribute ("", "scope", "", "", "col");
try (Closeable th = writer.printTag(Tag.th, atts)) {
try (ContentCloseable th = writer.printTag(Tag.th, atts)) {
writer.printCharacters(headers[i]);
}
}

View file

@ -22,7 +22,6 @@
*/
package org.x4o.fc18.cake2.fcdoc;
import java.io.Closeable;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@ -39,6 +38,7 @@ import org.x4o.fc18.cake2.zero33.FCDotBYD0127DashP7F;
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
import org.x4o.fc18.cake2.zero33.FCDotDEC0127DashPX0;
import org.x4o.o2o.io.ContentWriterHtml.Tag;
import org.x4o.o2o.io.sax3.ContentCloseable;
import org.x4o.o2o.tdoc.ApiDocContentCss;
import org.x4o.o2o.tdoc.ApiDocContentWriter;
import org.x4o.o2o.tdoc.dom.ApiDocPage;
@ -63,8 +63,8 @@ public class FCDocPageWriterMuffin implements ApiDocPageWriter {
@Override
public void writePageContent(ApiDocWriteEvent<ApiDocPage> e) throws IOException {
ApiDocContentWriter writer = e.getWriter();
try (Closeable content = writer.docPageContent()) {
try (Closeable table = writer.docTable(FourCornerDotCake.FC_CDC1604_P6.nameSpec(), null, ApiDocContentCss.overviewSummary)) {
try (ContentCloseable content = writer.docPageContent()) {
try (ContentCloseable table = writer.docTable(FourCornerDotCake.FC_CDC1604_P6.nameSpec(), null, ApiDocContentCss.overviewSummary)) {
writeTableBoxHeader(writer, 17);
writeCDC(writer, 0x00);
writeCDC(writer, 0x10);
@ -72,27 +72,27 @@ public class FCDocPageWriterMuffin implements ApiDocPageWriter {
writeCDC(writer, 0x30);
}
}
try (Closeable content = writer.docPageContent()) {
try (ContentCloseable content = writer.docPageContent()) {
String xSpec = FourCornerDotCake.FC_APL0127_P7A.nameSpec().replaceAll("P7A", "P7x");
try (Closeable table = writer.docTable(xSpec, null, ApiDocContentCss.overviewSummary)) {
try (ContentCloseable table = writer.docTable(xSpec, null, ApiDocContentCss.overviewSummary)) {
writeTableBoxHeader(writer, 28, true);
writeP7x(writer, FourCornerDotCake.FC_APL0127_P7A, v -> FCDotAPL0127DashP7A.valueOf(v).codePoints()[0]);
writeP7x(writer, FourCornerDotCake.FC_APL0127_P7B, v -> FCDotAPL0127DashP7B.valueOf(v).codePoints()[0]);
writeP7x(writer, FourCornerDotCake.FC_APL0127_P7C, v -> FCDotAPL0127DashP7C.valueOf(v).codePoints()[0]);
}
}
try (Closeable content = writer.docPageContent()) {
try (ContentCloseable content = writer.docPageContent()) {
String xSpec = FourCornerDotCake.FC_BYD0127_P7D.nameSpec().replaceAll("P7D", "P7x");
try (Closeable table = writer.docTable(xSpec, null, ApiDocContentCss.overviewSummary)) {
try (ContentCloseable table = writer.docTable(xSpec, null, ApiDocContentCss.overviewSummary)) {
writeTableBoxHeader(writer, 28, true);
writeP7x(writer, FourCornerDotCake.FC_BYD0127_P7D, v -> FCDotBYD0127DashP7D.valueOf(v).codePoints()[0]);
writeP7x(writer, FourCornerDotCake.FC_BYD0127_P7E, v -> FCDotBYD0127DashP7E.valueOf(v).codePoints()[0]);
writeP7x(writer, FourCornerDotCake.FC_BYD0127_P7F, v -> FCDotBYD0127DashP7F.valueOf(v).codePoints()[0]);
}
}
try (Closeable content = writer.docPageContent()) {
try (ContentCloseable content = writer.docPageContent()) {
String xSpec = FourCornerDotCake.FC_PIE9C_01.nameSpec().replaceAll("01", "baklava");
try (Closeable table = writer.docTable(xSpec, null, ApiDocContentCss.overviewSummary)) {
try (ContentCloseable table = writer.docTable(xSpec, null, ApiDocContentCss.overviewSummary)) {
writeTableBoxHeader(writer, 28, true);
writePIE(writer, FourCornerDotCake.FC_PIE9C_01);
writePIE(writer, FourCornerDotCake.FC_PIE9C_02);
@ -123,9 +123,9 @@ public class FCDocPageWriterMuffin implements ApiDocPageWriter {
writePIE(writer, FourCornerDotCake.FC_PIE9C_27);
}
}
try (Closeable content = writer.docPageContent()) {
try (ContentCloseable content = writer.docPageContent()) {
String xSpec = FourCornerDotCake.FC_PIE9D_01.nameSpec().replaceAll("01", "baklava");
try (Closeable table = writer.docTable(xSpec, null, ApiDocContentCss.overviewSummary)) {
try (ContentCloseable table = writer.docTable(xSpec, null, ApiDocContentCss.overviewSummary)) {
writeTableBoxHeader(writer, 28, true);
writePIE(writer, FourCornerDotCake.FC_PIE9D_01);
writePIE(writer, FourCornerDotCake.FC_PIE9D_02);
@ -156,8 +156,8 @@ public class FCDocPageWriterMuffin implements ApiDocPageWriter {
writePIE(writer, FourCornerDotCake.FC_PIE9D_27);
}
}
try (Closeable content = writer.docPageContent()) {
try (Closeable table = writer.docTable(FourCornerDotCake.FC_NCR1632_XD.nameSpec().replaceAll("XD", "baklava"), null, ApiDocContentCss.overviewSummary)) {
try (ContentCloseable content = writer.docPageContent()) {
try (ContentCloseable table = writer.docTable(FourCornerDotCake.FC_NCR1632_XD.nameSpec().replaceAll("XD", "baklava"), null, ApiDocContentCss.overviewSummary)) {
writeTableBoxHeader(writer, 28);
writePIN(writer);
}
@ -166,7 +166,7 @@ public class FCDocPageWriterMuffin implements ApiDocPageWriter {
private void writePIN(ApiDocContentWriter writer) throws IOException {
for (int t = 0; t < 27; t++) {
try (Closeable tableRow = writer.docTableRow()) {
try (ContentCloseable tableRow = writer.docTableRow()) {
String prefixNCR = String.format("T%03d", t + 1);
writer.printTagStart(Tag.td, ApiDocContentCss.colOne);
writer.printCharacters(prefixNCR);
@ -205,7 +205,7 @@ public class FCDocPageWriterMuffin implements ApiDocPageWriter {
}
private void writePIE(ApiDocContentWriter writer, FourCornerDotCake slice) throws IOException {
try (Closeable tableRow = writer.docTableRow()) {
try (ContentCloseable tableRow = writer.docTableRow()) {
String prefixHex = String.format("0x%06X", slice.getStart());
writer.printTagStart(Tag.td, ApiDocContentCss.colFirst);
writer.printCharacters(prefixHex);
@ -241,7 +241,7 @@ public class FCDocPageWriterMuffin implements ApiDocPageWriter {
private void writeP7x(ApiDocContentWriter writer, FourCornerDotCake slice, Function<Integer, Integer> conv) throws IOException {
String prefixHex = String.format("0x%06X", slice.getStart());
try (Closeable tableRow = writer.docTableRow()) {
try (ContentCloseable tableRow = writer.docTableRow()) {
writer.printTagStart(Tag.td, ApiDocContentCss.colFirst);
writer.printCharacters(prefixHex);
writer.printTagEnd(Tag.td);
@ -269,7 +269,7 @@ public class FCDocPageWriterMuffin implements ApiDocPageWriter {
private void writeCDC(ApiDocContentWriter writer, int off) throws IOException {
String prefixHex = String.format("0x%05X0", off >> 4);
try (Closeable tableRow = writer.docTableRow()) {
try (ContentCloseable tableRow = writer.docTableRow()) {
writer.printTagStart(Tag.td, ApiDocContentCss.colOne);
writer.printCharacters(prefixHex);
writer.printTagEnd(Tag.td);

View file

@ -22,12 +22,12 @@
*/
package org.x4o.o2o.io;
import java.io.Closeable;
import java.io.IOException;
import java.io.Writer;
import java.util.Calendar;
import org.x4o.o2o.PropertyConfig;
import org.x4o.o2o.io.sax3.ContentCloseable;
import org.x4o.o2o.io.sax3.ContentWriterTagWrapper;
import org.x4o.o2o.io.sax3.ContentWriterXml;
import org.x4o.o2o.io.sax3.XMLConstants;
@ -183,25 +183,25 @@ public class ContentWriterHtml extends ContentWriterTagWrapper<ContentWriterHtml
printTagEnd(tag);
}
public Closeable printTag(Tag tag, String tagClass) throws IOException {
public ContentCloseable printTag(Tag tag, String tagClass) throws IOException {
return printTag(tag,tagClass,null,null);
}
public Closeable printTag(Tag tag, Enum<?> tagClassEnum) throws IOException {
public ContentCloseable printTag(Tag tag, Enum<?> tagClassEnum) throws IOException {
return printTag(tag,tagClassEnum,null);
}
public Closeable printTag(Tag tag, Enum<?> tagClassEnum, String tagId) throws IOException {
public ContentCloseable printTag(Tag tag, Enum<?> tagClassEnum, String tagId) throws IOException {
return printTag(tag,tagClassEnum,tagId,null);
}
public Closeable printTag(Tag tag, Enum<?> tagClassEnum, String tagId, String typeId) throws IOException {
public ContentCloseable printTag(Tag tag, Enum<?> tagClassEnum, String tagId, String typeId) throws IOException {
return printTag(tag,tagClassEnum.name(),tagId,typeId);
}
public Closeable printTag(Tag tag, String tagClass, String tagId, String typeId) throws IOException {
public ContentCloseable printTag(Tag tag, String tagClass, String tagId, String typeId) throws IOException {
printTagStart(tag,tagClass,tagId,typeId);
return wrapClosable(() -> printTagEnd(tag));
return () -> printTagEnd(tag);
}
public void printTagStart(Tag tag, String tagClass) throws IOException {

View file

@ -22,6 +22,7 @@
*/
package org.x4o.o2o.io.sax3;
import java.io.Closeable;
import java.io.IOException;
@ -32,7 +33,12 @@ import java.io.IOException;
* @version 1.0 Jan 17, 2025
*/
@FunctionalInterface
public interface ContentCloseable {
public interface ContentCloseable extends Closeable {
void closeTag() throws IOException;
@Override
default void close() throws IOException {
closeTag();
}
}

View file

@ -22,7 +22,6 @@
*/
package org.x4o.o2o.io.sax3;
import java.io.Closeable;
import java.io.IOException;
import org.xml.sax.Attributes;
@ -86,13 +85,13 @@ public class ContentWriterTagWrapper<TAG extends Enum<?>,TAG_WRITER extends Cont
}
}
public Closeable printTag(TAG tag) throws IOException {
public ContentCloseable printTag(TAG tag) throws IOException {
return printTag(tag, EMPTY_ATTRIBUTES);
}
public Closeable printTag(TAG tag, Attributes atts) throws IOException {
public ContentCloseable printTag(TAG tag, Attributes atts) throws IOException {
printTagStart(tag,atts);
return wrapClosable(() -> printTagEnd(tag));
return () -> printTagEnd(tag);
}
public void printTagStartEnd(TAG tag, Attributes atts) throws IOException {
@ -158,14 +157,4 @@ public class ContentWriterTagWrapper<TAG extends Enum<?>,TAG_WRITER extends Cont
throw new IOException(e);
}
}
protected Closeable wrapClosable(ContentCloseable end) {
return new Closeable() {
@Override
public void close() throws IOException {
end.closeTag();
}
};
}
}

View file

@ -29,6 +29,7 @@ import java.util.Date;
import java.util.List;
import org.x4o.o2o.io.ContentWriterHtml;
import org.x4o.o2o.io.sax3.ContentCloseable;
import org.xml.sax.helpers.AttributesImpl;
/**
@ -144,9 +145,9 @@ public class ApiDocContentWriter extends ContentWriterHtml {
printComment("======== END OF CLASS DATA ========");
}
public Closeable docPageContent() throws IOException {
public ContentCloseable docPageContent() throws IOException {
docPageContentStart();
return wrapClosable(() -> docPageContentEnd());
return () -> docPageContentEnd();
}
public void docPageContentStart() throws IOException {
@ -181,9 +182,9 @@ public class ApiDocContentWriter extends ContentWriterHtml {
printTagStart(Tag.li,ApiDocContentCss.blockList);
}
public Closeable docTable(String tableTitle, String tableDescription, ApiDocContentCss tableCss) throws IOException {
public ContentCloseable docTable(String tableTitle, String tableDescription, ApiDocContentCss tableCss) throws IOException {
docTableStart(tableTitle, tableDescription, tableCss);
return wrapClosable(() -> docTableEnd());
return () -> docTableEnd();
}
public void docTableStart(String tableTitle, String tableDescription, ApiDocContentCss tableCss) throws IOException {
@ -256,14 +257,14 @@ public class ApiDocContentWriter extends ContentWriterHtml {
printTagEnd(Tag.tr);
}
public Closeable docTableRow() throws IOException {
public ContentCloseable docTableRow() throws IOException {
if (isRowAlt) {
printTagStart(Tag.tr,ApiDocContentCss.altColor);
} else {
printTagStart(Tag.tr,ApiDocContentCss.rowColor);
}
isRowAlt = !isRowAlt;
return wrapClosable(() -> printTagEnd(Tag.tr));
return () -> printTagEnd(Tag.tr);
}
private void docTableRowHref(String dataFirstHref,String dataFirst,String dataLast,String dataBlock,boolean dataFirstCode,boolean dataLastCode,boolean skipLast) throws IOException {