Repository navigation
Drop the HTML.Attribute dependency from the parsers and sinks - #1095
Merged
Merged
Conversation
Every one of the 42 uses was Attribute.X.toString(), a constant table that cost doxia-core and three modules a java.desktop dependency. All eleven names in use match the SinkEventAttributes constant exactly, checked by running HTML.Attribute against the literals rather than reading them off, so no generated output moves. Five of the uses passed the Attribute object itself as an attribute key (XdocSink, Xhtml5Sink). Those worked only because addAttribute calls name.toString() on the key while getAttribute, isDefined and removeAttribute do not, so such an entry could only ever be read back with a String. They are Strings now like every other key. SinkEventAttributes gains CONTENT, the one name in use it lacked. Part of #1092
…tion Only two places can move today: both already hold a SinkEventAttributes, so they can use the entrySet added in 2.1.0. SinkUtils.getAttributeString, asCssString and filterAttributes cannot follow. They take javax.swing.text.AttributeSet, which has no entrySet, and widening those parameters is a binary break. They stay on getAttributeNames until the Swing supertype goes in the next major. Part of #1092
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phases 1 and 2 of #1092, in two commits so each stands on its own.
HTML.Attributeis gone from every main source. All 42 uses wereAttribute.X.toString()—a constant table that cost doxia-core and three modules a
java.desktopdependency. The elevennames in use match their
SinkEventAttributesconstant exactly; I checked that by runningHTML.Attributeagainst the literals rather than reading them off, so no generated output moves.The sink tests that assert exact HTML (
Xhtml5SinkTest,XdocSinkTest,MarkdownSinkTest) passunchanged, which is the real evidence.
Five of those uses passed the
Attributeobject itself as an attribute key, inXdocSinkandXhtml5Sink. They worked only becauseaddAttributecallsname.toString()on the key whilegetAttribute,isDefinedandremoveAttributedo not — so such an entry could only ever be readback with a
String. All keys areStringnow.SinkEventAttributesgainsCONTENT, the one name in use it lacked.Phase 2 is smaller than #1092 claims, and that is my error in the issue. It says to move
SinkUtils.getAttributeString,asCssStringandfilterAttributesontoentrySet(). That is notpossible in 2.x: all three take
javax.swing.text.AttributeSet, which has noentrySet(), andwidening those parameters is a binary break. The same applies to
Xhtml5BaseSink.writeStartTag(Tag, MutableAttributeSet, boolean)and to theSinkEventAttributeSetmethods that implement the Swing interface. Only two sites were free, both already holding a
SinkEventAttributes. The rest waits on phase 4.What is left of javax.swing after this:
HTML.Tag(phase 3) andAttributeSet/MutableAttributeSet(phase 4).
Verified:
mvn verifygreen — japicmp on both published modules, RAT and checkstyle across all ten,every test passing.
Part of #1092
This change was created with AI assistance.