From 5844cd9e7540ab334cf92cf6e9dbf9c8992dbf4b Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Fri, 26 Jun 2026 12:11:27 +0200 Subject: [PATCH] Remove the leftover SAC references after the value-record migration Follow-up to 5a8b66848d, which deleted the tkuiTestsToRefactor legacy sources but left Import-Package: org.w3c.css.sac in the org.eclipse.e4.ui.tests.css.swt manifest, plus stale SAC/Batik mentions in two css.core Javadoc comments. Nothing on the build path uses SAC anymore, so drop the import and rewrite the comments. The org.w3c.css.sac library can now leave the target platform once no bundle outside this repo needs it. --- .../e4/ui/css/core/impl/dom/CssValues.java | 5 ++--- .../ui/css/core/impl/engine/CSSEngineImpl.java | 6 +++--- .../impl/engine/selector/SelectorMatcher.java | 10 +++++----- .../css/core/impl/engine/selector/Selectors.java | 16 ++++++---------- .../css/core/impl/parser/CssParseException.java | 3 +-- .../e4/ui/css/core/impl/parser/CssParser.java | 6 +++--- .../engine/selector/SelectorMatcherTest.java | 4 +--- .../e4/ui/tests/css/core/CSSEngineTest.java | 6 +++--- .../ui/tests/css/core/parser/CssParserTest.java | 3 +-- .../META-INF/MANIFEST.MF | 3 +-- 10 files changed, 26 insertions(+), 36 deletions(-) diff --git a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/CssValues.java b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/CssValues.java index 2030149569d..2f4d2bb046d 100644 --- a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/CssValues.java +++ b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/CssValues.java @@ -26,8 +26,7 @@ /** * The internal CSS value model produced by the parser. A small sealed hierarchy * of immutable values that replaces the former {@code Measure} / {@code - * RGBColorImpl} / {@code CSSValueListImpl} wrappers and removes the last SAC - * dependency ({@code LexicalUnit}). + * RGBColorImpl} / {@code CSSValueListImpl} wrappers. * *

* Consumers pattern-match on the record variants ({@link CssNumber}, @@ -258,7 +257,7 @@ public String getCssText() { /** * A separator (currently only {@code ,}) carried inside a value list, kept - * for parity with the former SAC behaviour where the comma was a list item. + * for parity with the historical behaviour where the comma was a list item. */ public record CssOperator(String text) implements CssPrimitive { @Override diff --git a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/engine/CSSEngineImpl.java b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/engine/CSSEngineImpl.java index 64d0dddd09f..e62eaf685b9 100644 --- a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/engine/CSSEngineImpl.java +++ b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/engine/CSSEngineImpl.java @@ -477,9 +477,9 @@ private void applyConditionalPseudoStyle(ExtendedCSSRule parentRule, String pseu * Returns {@code true} if {@code selector} carries a pseudo-class or * attribute selector (anywhere in a compound or descendant combinator) * whose target value equals {@code pseudoInstance}. Mirrors the legacy - * SAC walker, which handled both {@code :selected} (a pseudo-class) and - * {@code Shell[active='true']} (an attribute) through SAC's shared - * {@code AttributeCondition} interface. + * walker, which handled both {@code :selected} (a pseudo-class) and + * {@code Shell[active='true']} (an attribute) through a shared + * condition interface. */ private static boolean matchesPseudoInstanceAttribute(Selectors.Selector selector, String pseudoInstance) { if (selector instanceof Selectors.PseudoClass pc) { diff --git a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/engine/selector/SelectorMatcher.java b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/engine/selector/SelectorMatcher.java index 82e97624dd3..ef8ff609dbc 100644 --- a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/engine/selector/SelectorMatcher.java +++ b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/engine/selector/SelectorMatcher.java @@ -36,14 +36,14 @@ * *

* Every method is static; the matcher carries no state. Callers pass the - * element being tested plus an optional pseudo-element string (the same - * argument the SAC engine carried) so that pseudo-class matching can defer - * to the existing {@link CSSStylableElement#isPseudoInstanceOf} contract. + * element being tested plus an optional pseudo-element string so that + * pseudo-class matching can defer to the existing + * {@link CSSStylableElement#isPseudoInstanceOf} contract. *

* *

- * Tag-name comparison is case sensitive, matching the existing SAC matcher - * (Phase 1 test {@code testTagNameCaseSensitivity} in {@code CSSEngineTest} + * Tag-name comparison is case sensitive, preserving the historical matcher + * behaviour (Phase 1 test {@code testTagNameCaseSensitivity} in {@code CSSEngineTest} * locks this in). Pseudo-class semantics also follow the existing engine: * the static-pseudo-instance carve-out from * {@code CSSPseudoClassConditionImpl} is preserved so cascade behaviour diff --git a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/engine/selector/Selectors.java b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/engine/selector/Selectors.java index ebca60b165b..5622b1ad9fc 100644 --- a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/engine/selector/Selectors.java +++ b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/engine/selector/Selectors.java @@ -19,14 +19,10 @@ * Internal CSS selector AST. * *

- * The engine historically exposed W3C SAC selectors - * ({@code org.w3c.css.sac.Selector} and friends) and matched against them - * through a hierarchy of vendored Batik wrapper classes under - * {@code impl/sac/*}. This package replaces both with a small set of records - * that the engine owns end to end. The W3C SAC types stay only as long as - * the parser still emits them; a translator turns the SAC selector tree - * produced by the Batik SAC parser into one of these records before it - * reaches the engine matcher. + * This package is the engine's own selector model: a small set of records + * the parser builds directly and the matcher consumes end to end. It + * replaced an earlier layer of vendored selector wrapper classes that the + * engine no longer depends on. *

* *

@@ -312,12 +308,12 @@ public List alternatives() { return alternatives; } - /** Number of alternatives in the list. SAC-style accessor for callers iterating the list. */ + /** Number of alternatives in the list. Indexed accessor for callers iterating the list. */ public int getLength() { return alternatives.size(); } - /** {@code i}-th alternative. SAC-style accessor for callers iterating the list. */ + /** {@code i}-th alternative. Indexed accessor for callers iterating the list. */ public Selector item(int i) { return alternatives.get(i); } diff --git a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/parser/CssParseException.java b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/parser/CssParseException.java index 1c8ec46c2cb..adaedcc0fea 100644 --- a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/parser/CssParseException.java +++ b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/parser/CssParseException.java @@ -15,8 +15,7 @@ /** * Thrown by the hand-written CSS parser when the input cannot be parsed. - * Replaces {@code org.w3c.css.sac.CSSException} for the internal parser, which - * like its SAC predecessor is unchecked. + * Unchecked so it can surface from the parser without checked-exception plumbing. */ public class CssParseException extends RuntimeException { diff --git a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/parser/CssParser.java b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/parser/CssParser.java index 395e4f8ac97..46a9a50eeec 100644 --- a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/parser/CssParser.java +++ b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/parser/CssParser.java @@ -413,7 +413,7 @@ private Selector compound() { case COLON: advance(); if (peek().kind == Kind.COLON) { - advance(); // pseudo-element ::, modelled as a pseudo-class like the SAC path + advance(); // pseudo-element ::, modelled as a pseudo-class } conditions.add(new PseudoClass(expect(Kind.IDENT).text)); break; @@ -430,8 +430,8 @@ private Selector compound() { for (int i = conditions.size() - 2; i >= 0; i--) { conditionTree = new And(conditions.get(i), conditionTree); } - // A universal element before conditions is dropped, matching the SAC - // translator: '.foo' and '*[a]' carry no element-type contribution. + // A universal element before conditions is dropped: '.foo' and '*[a]' + // carry no element-type contribution. return element instanceof ElementType ? new And(element, conditionTree) : conditionTree; } diff --git a/tests/org.eclipse.e4.ui.tests.css.core/src/org/eclipse/e4/ui/css/core/impl/engine/selector/SelectorMatcherTest.java b/tests/org.eclipse.e4.ui.tests.css.core/src/org/eclipse/e4/ui/css/core/impl/engine/selector/SelectorMatcherTest.java index 31162dd52c7..4c2186848c4 100644 --- a/tests/org.eclipse.e4.ui.tests.css.core/src/org/eclipse/e4/ui/css/core/impl/engine/selector/SelectorMatcherTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.core/src/org/eclipse/e4/ui/css/core/impl/engine/selector/SelectorMatcherTest.java @@ -38,9 +38,7 @@ /** * Unit tests for {@link SelectorMatcher}. The cases mirror those in the - * Phase 1 {@code CSSEngineTest}, but go through the new internal selector - * AST instead of SAC. When Phase 3 Step 1 wires the engine to use this - * matcher, the SAC-based duplicate tests can be retired. + * Phase 1 {@code CSSEngineTest}, but go through the internal selector AST. */ class SelectorMatcherTest { diff --git a/tests/org.eclipse.e4.ui.tests.css.core/src/org/eclipse/e4/ui/tests/css/core/CSSEngineTest.java b/tests/org.eclipse.e4.ui.tests.css.core/src/org/eclipse/e4/ui/tests/css/core/CSSEngineTest.java index cb00446b1fb..101f7877c31 100644 --- a/tests/org.eclipse.e4.ui.tests.css.core/src/org/eclipse/e4/ui/tests/css/core/CSSEngineTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.core/src/org/eclipse/e4/ui/tests/css/core/CSSEngineTest.java @@ -261,9 +261,9 @@ void testSelectorListMatch() throws Exception { @Test void testTagNameCaseSensitivity() throws Exception { - // Locks in current case-sensitive matching of the SAC engine. If the - // parser swap moves to case-insensitive (closer to HTML semantics), this - // test must be updated together with that change. + // Locks in current case-sensitive matching. If the matching ever moves + // to case-insensitive (closer to HTML semantics), this test must be + // updated together with that change. TestCSSEngine engine = new TestCSSEngine(); Selector capital = parse(engine, "Button"); Selector lower = parse(engine, "button"); diff --git a/tests/org.eclipse.e4.ui.tests.css.core/src/org/eclipse/e4/ui/tests/css/core/parser/CssParserTest.java b/tests/org.eclipse.e4.ui.tests.css.core/src/org/eclipse/e4/ui/tests/css/core/parser/CssParserTest.java index a4c7d549de3..412f6c81d1e 100644 --- a/tests/org.eclipse.e4.ui.tests.css.core/src/org/eclipse/e4/ui/tests/css/core/parser/CssParserTest.java +++ b/tests/org.eclipse.e4.ui.tests.css.core/src/org/eclipse/e4/ui/tests/css/core/parser/CssParserTest.java @@ -91,8 +91,7 @@ void testAttributeAndPseudoSelectors() { @Test void testUniversalElementDroppedBeforeConditions() { - // '.foo' and '*[a]' carry no element-type contribution, matching the - // previous SAC translator. + // '.foo' and '*[a]' carry no element-type contribution. assertInstanceOf(Selectors.ClassSelector.class, firstSelector(".foo")); assertInstanceOf(Selectors.AttributeSelector.class, firstSelector("*[a]")); } diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/META-INF/MANIFEST.MF b/tests/org.eclipse.e4.ui.tests.css.swt/META-INF/MANIFEST.MF index 374046bd91b..b69efde84cd 100644 --- a/tests/org.eclipse.e4.ui.tests.css.swt/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.e4.ui.tests.css.swt/META-INF/MANIFEST.MF @@ -16,8 +16,7 @@ Import-Package: org.eclipse.core.runtime;version="3.5.0", org.junit.jupiter.api.function;version="[5.14.0,6.0.0)", org.junit.platform.suite.api;version="[1.14.0,2.0.0)", org.osgi.framework;version="[1.7.0,2.0.0)", - org.osgi.service.event;version="[1.3.0,2.0.0)", - org.w3c.css.sac;version="1.3.0" + org.osgi.service.event;version="[1.3.0,2.0.0)" Eclipse-BundleShape: dir Automatic-Module-Name: org.eclipse.e4.ui.tests.css.swt Bundle-Vendor: %Bundle-Vendor