LUCENE-9894: Hunspell: add user-friendly diagnostics for morph data API misuse (#51)

This commit is contained in:
Peter Gromov 2021-04-07 14:52:36 +02:00 committed by GitHub
parent 8eb582e671
commit 7f147fece0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -551,8 +551,9 @@ public class Dictionary {
@Override
public List<String> getMorphologicalValues(int entryIndex, String key) {
assert key.length() == 3;
assert key.charAt(2) == ':';
assert key.length() == 3 && key.charAt(2) == ':'
: "A morphological data key should consist of two letters followed by a semicolon, found: "
+ key;
String fields = getMorphologicalData(entryIndex);
if (fields.isEmpty() || !fields.contains(key)) return Collections.emptyList();