在如下代码中,我试图追踪defaultLocale时怎么生成的时候
Locale aDefault = Locale.getDefault();
java.util.Locale类部分代码,initDefault()方法debug无法进去
// ...
private static volatile Locale defaultLocale = initDefault();
// ...
public static Locale getDefault() {
// do not synchronize this method - see 4071298
return defaultLocale;
}
// ...
// 以下这个方法的debug一直进不去
private static Locale initDefault() {
String language, region, script, country, variant;
Properties props = GetPropertyAction.privilegedGetProperties();
language = props.getProperty("user.language", "en");
// for compatibility, check for old user.region property
region = props.getProperty("user.region");
if (region != null) {
// region can be of form country, country_variant, or _variant
int i = region.indexOf('_');
if (i >= 0) {
country = region.substring(0, i);
variant = region.substring(i + 1);
} else {
country = region;
variant = "";
}
script = "";
} else {
script = props.getProperty("user.script", "");
country = props.getProperty("user.country", "");
variant = props.getProperty("user.variant", "");
}
return getInstance(language, script, country, variant,
getDefaultExtensions(props.getProperty("user.extensions", ""))
.orElse(null));
}
// ...
后面再debgu的时候,idea发现了一段话:
Skipped breakpoint at java.util.Locale:937 because it happened inside debugger evaluation