From b4d62b754094eed0958b730f45f5ce3dd3fa768d Mon Sep 17 00:00:00 2001 From: Robin Leroy Date: Tue, 24 Oct 2023 23:12:16 +0200 Subject: [PATCH] =?UTF-8?q?Remove=20scary=20assumptions;=20let=E2=80=99s?= =?UTF-8?q?=20not=20risk=20producing=20an=20inconsistent=20UCD.=20(#582)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/unicode/text/UCD/MakeUnicodeFiles.java | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/unicodetools/src/main/java/org/unicode/text/UCD/MakeUnicodeFiles.java b/unicodetools/src/main/java/org/unicode/text/UCD/MakeUnicodeFiles.java index 759361106..dc3e15bd5 100644 --- a/unicodetools/src/main/java/org/unicode/text/UCD/MakeUnicodeFiles.java +++ b/unicodetools/src/main/java/org/unicode/text/UCD/MakeUnicodeFiles.java @@ -1395,29 +1395,17 @@ private static void writeEnumeratedValues( } else if (defaultBidiValues != null) { Bidi_Class_Values bidiValue = Bidi_Class_Values.forName(value); if (defaultBidiValues.containsValue(bidiValue)) { - // We assume that unassigned code points that have this value - // according to the props data also have this value according to the defaults. - // Otherwise we would need to intersect defaultBidiValues.keySet(bidiValue) - // with the unassigned set before removing from s. - s.removeAll(unassigned); + s.removeAll(defaultBidiValues.keySet(bidiValue).retainAll(unassigned)); } } else if (defaultEaValues != null) { East_Asian_Width_Values eaValue = East_Asian_Width_Values.forName(value); if (defaultEaValues.containsValue(eaValue)) { - // We assume that unassigned code points that have this value - // according to the props data also have this value according to the defaults. - // Otherwise we would need to intersect defaultEaValues.keySet(eaValue) - // with the unassigned set before removing from s. - s.removeAll(unassigned); + s.removeAll(defaultEaValues.keySet(eaValue).retainAll(unassigned)); } } else if (defaultLbValues != null) { Line_Break_Values lbValue = Line_Break_Values.forName(value); if (defaultLbValues.containsValue(lbValue)) { - // We assume that unassigned code points that have this value - // according to the props data also have this value according to the defaults. - // Otherwise we would need to intersect defaultEaValues.keySet(eaValue) - // with the unassigned set before removing from s. - s.removeAll(unassigned); + s.removeAll(defaultLbValues.keySet(lbValue).retainAll(unassigned)); } }