1313import java .util .List ;
1414import java .util .Locale ;
1515import org .unicode .cldr .test .CheckCLDR .CheckStatus .Subtype ;
16- import org .unicode .cldr .util .CLDRConfig ;
1716import org .unicode .cldr .util .CLDRFile ;
1817import org .unicode .cldr .util .ComparatorUtilities ;
1918import org .unicode .cldr .util .Factory ;
2019import org .unicode .cldr .util .SimpleUnicodeSetFormatter ;
21- import org .unicode .cldr .util .SupplementalDataInfo ;
2220import org .unicode .cldr .util .UnicodeSetPrettyPrinter ;
2321import org .unicode .cldr .util .XPathParts ;
2422
@@ -30,7 +28,6 @@ public class CheckExemplars extends FactoryCheckCLDR {
3028 "quotationStart" , "quotationEnd" ,
3129 "alternateQuotationStart" , "alternateQuotationEnd"
3230 };
33- static final SupplementalDataInfo SUP = CLDRConfig .getInstance ().getSupplementalDataInfo ();
3431
3532 Collator col ;
3633 boolean isRoot ;
@@ -88,6 +85,12 @@ public class CheckExemplars extends FactoryCheckCLDR {
8885 .removeAll (new UnicodeSet ("[[:Uppercase:]-[\u0130 ]]" ))
8986 .freeze ();
9087
88+ private static final UnicodeSet ALLOWED_IN_NUMBERS_NOT_IN_MAIN =
89+ new UnicodeSet ("[[:Numeric_Type=Decimal:]]" ).freeze ();
90+
91+ private static final UnicodeSet ALLOWED_IN_MAIN =
92+ new UnicodeSet (AllowedInExemplars ).removeAll (ALLOWED_IN_NUMBERS_NOT_IN_MAIN ).freeze ();
93+
9194 public static final UnicodeSet ALLOWED_IN_PUNCTUATION =
9295 new UnicodeSet ("[[:P:][:S:]-[:Sc:]]" ).freeze ();
9396
@@ -102,7 +105,10 @@ public class CheckExemplars extends FactoryCheckCLDR {
102105 .freeze ();
103106
104107 public enum ExemplarType {
105- main (AllowedInExemplars , "(specific-script - uppercase - invisibles + \u0130 )" , true ),
108+ main (
109+ ALLOWED_IN_MAIN ,
110+ "(specific-script - uppercase - invisibles - numbers + \u0130 )" ,
111+ true ),
106112 auxiliary (ALLOWED_IN_AUX , "(specific-script - uppercase - invisibles + \u0130 )" , true ),
107113 punctuation (ALLOWED_IN_PUNCTUATION , "punctuation" , false ),
108114 punctuation_auxiliary (ALLOWED_IN_PUNCTUATION , "punctuation-auxiliary" , false ),
@@ -178,9 +184,9 @@ public CheckCLDR handleSetCldrFileToCheck(
178184 public CheckCLDR handleCheck (
179185 String path , String fullPath , String value , Options options , List <CheckStatus > result ) {
180186 if (fullPath == null ) return this ; // skip paths that we don't have
181- if (path .indexOf ("/exemplarCharacters" ) < 0 ) {
187+ if (! path .contains ("/exemplarCharacters" )) {
182188 if (path .contains ("parseLenient" )) {
183- checkParse (path , fullPath , value , options , result );
189+ checkParse (path , value , result );
184190 }
185191 return this ;
186192 }
@@ -205,7 +211,7 @@ public CheckCLDR handleCheck(
205211 new UnicodeSet (mainSet )
206212 .retainAll (auxiliarySet )
207213 .removeAll (HangulSyllables );
208- if (overlap .size () != 0 ) {
214+ if (! overlap .isEmpty () ) {
209215 String fixedExemplar1 = rawFormatter .format (overlap );
210216 result .add (
211217 new CheckStatus ()
@@ -278,7 +284,7 @@ public CheckCLDR handleCheck(
278284
279285 // check for consistency with RTL
280286
281- Boolean localeIsRTL = false ;
287+ boolean localeIsRTL = false ;
282288 String charOrientation =
283289 getResolvedCldrFileToCheck ()
284290 .getStringValue ("//ldml/layout/orientation/characterOrder" );
@@ -310,8 +316,7 @@ public CheckCLDR handleCheck(
310316 return this ;
311317 }
312318
313- private void checkParse (
314- String path , String fullPath , String value , Options options , List <CheckStatus > result ) {
319+ private void checkParse (String path , String value , List <CheckStatus > result ) {
315320 if (value == null ) {
316321 CheckStatus message =
317322 new CheckStatus ()
@@ -351,11 +356,7 @@ private void checkParse(
351356 .setCause (this )
352357 .setMainType (CheckStatus .errorType )
353358 .setSubtype (Subtype .badParseLenient )
354- .setMessage (
355- e .toString ()
356- + (e .getMessage () == null
357- ? ""
358- : ": " + e .getMessage ()));
359+ .setMessage (e + (e .getMessage () == null ? "" : ": " + e .getMessage ()));
359360 result .add (message );
360361 }
361362 }
@@ -418,10 +419,7 @@ private void checkMixedScripts(String title, UnicodeSet set, List<CheckStatus> r
418419 .setCause (this )
419420 .setMainType (CheckStatus .errorType )
420421 .setSubtype (Subtype .illegalExemplarSet )
421- .setMessage (
422- "{0} exemplars contain multiple scripts: {1}" ,
423- new Object [] {title , scripts }));
424- return ;
422+ .setMessage ("{0} exemplars contain multiple scripts: {1}" , title , scripts ));
425423 }
426424
427425 private void checkExemplar (String v , List <CheckStatus > result , ExemplarType exemplarType ) {
@@ -472,15 +470,13 @@ private void checkExemplar(String v, List<CheckStatus> result, ExemplarType exem
472470 for (String s : remainder0 ) {
473471 if (Character .codePointCount (s , 0 , s .length ()) == 1 ) {
474472 remainder .add (s );
475- } else {
476- // just check normalization
477473 }
474+ // else just check normalization
478475 }
479476
480477 // after a first check, we check again in case we flattened
481478
482- if (remainder .size () != 0 ) {
483- fixedExemplar1 = displayFormatter .format (exemplar1 );
479+ if (!remainder .isEmpty ()) {
484480 result .add (
485481 new CheckStatus ()
486482 .setCause (this )
@@ -490,13 +486,13 @@ private void checkExemplar(String v, List<CheckStatus> result, ExemplarType exem
490486 "Should be limited to "
491487 + exemplarType .message
492488 + "; thus not contain: \u200E {0}\u200E " ,
493- new Object [] { remainder } ));
489+ remainder ));
494490 }
495491 }
496492
497493 // now check for empty
498494
499- if (!isRoot && exemplar1 .size () == 0 ) {
495+ if (!isRoot && exemplar1 .isEmpty () ) {
500496 switch (exemplarType ) {
501497 // case currencySymbol: // ok if empty
502498 // break;
0 commit comments