Skip to content

Defaults for older files are dependent on having loaded newer files #1438

Description

@eggrobin
        System.err.println(
                IndexUnicodeProperties.make().getProperty(UcdProperty.Numeric_Type).getValue('1'));
        System.err.println(
                IndexUnicodeProperties.make(VersionInfo.UNICODE_4_1)
                        .getProperty(UcdProperty.Numeric_Type)
                        .getValue(0x2006));

correctly prints

Decimal
None

but the second statement alone,

        System.err.println(
                IndexUnicodeProperties.make(VersionInfo.UNICODE_4_1)
                        .getProperty(UcdProperty.Numeric_Type)
                        .getValue(0x2006));

prints null.

This is because we had no @missing lines in 4.1.0 and earlier, and we consider later @missing lines to be valid for earlier versions unless overriden with version suffixes in the Extra files, see

private static void parseMissingFromValueAliases(Iterable<String> aliasesLines) {
for (UcdLineParser.UcdLine line :
new UcdLineParser(aliasesLines).withRange(false).withMissing(true)) {
if (line.getType() == UcdLineParser.UcdLine.Contents.MISSING) {
VersionInfo last_applicable_version = Settings.LATEST_VERSION_INFO;
if (line.getParts().length > 3) {
final String suffix = line.getParts()[3];
if (!VERSION.matcher(suffix).matches()) {
throw new IllegalArgumentException(
"Expected version suffix, got " + suffix);
}
last_applicable_version = VersionInfo.getInstance(suffix.substring(1));
}
// # @missing: 0000..10FFFF; cjkIRG_KPSource; <none>
setDefaultValueForPropertyName(
line.getOriginalLine(),
line.getParts()[1],
line.getParts()[2],
/* isEmpty= */ false,
last_applicable_version);
}
}
}

and
public String getDefaultValue(VersionInfo version) {
for (final var entry : defaultValues.entrySet()) {
if (version.compareTo(entry.getKey()) <= 0) {
return entry.getValue();
}
}

However, we do not actually ensure we load the files with the later @missing lines when reading older files…

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions