-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix TestCompilerTests with locales other than english #31407
Conversation
Ah good catch, @quaff thank you. I think I am probably going to polish that to use a different assertion. |
Turns out I think we should fix this differently. Thanks for the report but we'll follow-up on #31408. |
@snicoll I'm afraid your fix doesn't work, It still report localized error message.
|
Damn, thanks for testing and reporting back. I wonder how it is different from your fix. The only thing I've done is not hardcoding the locale but rather make it configurable. What did I miss? |
Fix TestCompilerTests with locales other than english See spring-projectsGH-31407
|
That's odd. Then I think the PR should rather change |
StandardJavaFileManager standardFileManager = this.compiler.getStandardFileManager(
null, this.locale, null); it doesn't work. |
|
private DynamicClassLoader compile() {
ClassLoader classLoaderToUse = (this.classLoader != null ? this.classLoader
: Thread.currentThread().getContextClassLoader());
List<DynamicJavaFileObject> compilationUnits = this.sourceFiles.stream().map(
DynamicJavaFileObject::new).toList();
StandardJavaFileManager standardFileManager = this.compiler.getStandardFileManager(
null, this.locale, null);
DynamicJavaFileManager fileManager = new DynamicJavaFileManager(
standardFileManager, classLoaderToUse, this.classFiles, this.resourceFiles);
if (!this.sourceFiles.isEmpty()) {
Errors errors = new Errors(this.locale);
CompilationTask task = this.compiler.getTask(null, fileManager, errors,
this.compilerOptions, null, compilationUnits);
task.setLocale(this.locale);
if (!this.processors.isEmpty()) {
task.setProcessors(this.processors);
}
boolean result = task.call();
if (!result || errors.hasReportedErrors()) {
throw new CompilationException(errors.toString(), this.sourceFiles, this.resourceFiles);
}
}
return new DynamicClassLoader(classLoaderToUse, this.classFiles, this.resourceFiles,
fileManager.getDynamicClassFiles(), fileManager.getDynamicResourceFiles());
} Not working. |
I went down a rabbit hole and I am not sure why this does not work. It goes all the way down to In any case. I've reverted the support in #31536 and relaxed the assertion. |
is failed since error message may not be english before this commit.