-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Qute message bundle using enum uppercase with words separated by underscores #44866
Comments
/cc @mkouba (qute) |
Hi @ercalamar and thanks for the report. You're right - Qute incorrectly detects an enum constant message key if a enum constant contains an underscore. We should have used a different separator for method names and enum constants 😦 . So far the only fix I can think of is to come with a different separator for cases where an enum constant contains |
Hi @mkouba, sky is the limit:
The thing is that this pattern is very common in enums. If fixing the issue is out of scope it should at least be warned in the documentation. |
I completely agree.
This needs to be fixed! |
Hm, so the problem is that we currently use the key as a part of the name of a generated method. In other words, it should be a valid Java identifier. Otherwise, we would have to reimplement more stuff (not sure how much actually). So maybe just use the |
So I think that we should take a different path. Different in the sense that we don't want to break existing apps. The separator could be derived from the set of constant enums:
The downside of this approach is that you can't stick with a single separator for everything, i.e. it always depends on the enum constants 🤷. OTOH the backward compatibility has the priority. |
- support constants with underscores - fixes quarkusio#44866
- support constants with underscores - fixes quarkusio#44866
Thanks |
- support constants with underscores - fixes quarkusio#44866 (cherry picked from commit b322dbf)
- support constants with underscores - fixes quarkusio#44866 (cherry picked from commit b322dbf)
Describe the bug
This works:
LocalizedMessages.properties
This does not:
LocalizedMessages.properties
Expected behavior
Get messages
Actual behavior
Does not build:
Caused by: io.quarkus.qute.deployment.MessageBundleException: Message bundle method user_title_CONDITIONAL_CHECK_FAILED() not found on: xxxxxxxx.LocalizedMessages
- file: xxxxxxxx\LocalizedMessages.properties
- line 0
at io.quarkus.qute.deployment.MessageBundleProcessor.parseKeyToTemplateFromLocalizedFile(MessageBundleProcessor.java:848)
at io.quarkus.qute.deployment.MessageBundleProcessor.getLocalizedFileKeyToTemplate(MessageBundleProcessor.java:792)
at io.quarkus.qute.deployment.MessageBundleProcessor.generateImplementations(MessageBundleProcessor.java:737)
at io.quarkus.qute.deployment.MessageBundleProcessor.processBundles(MessageBundleProcessor.java:275)
at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
at java.base/java.lang.Thread.run(Thread.java:1570)
at org.jboss.threads.JBossThread.run(JBossThread.java:499)
How to Reproduce?
No response
Output of
uname -a
orver
Microsoft Windows [Versión 10.0.22631.4460]
Output of
java -version
openjdk 21 2023-09-19 OpenJDK Runtime Environment GraalVM CE 21+35.1 (build 21+35-jvmci-23.1-b15) OpenJDK 64-Bit Server VM GraalVM CE 21+35.1 (build 21+35-jvmci-23.1-b15, mixed mode, sharing)
Quarkus version or git rev
3.17.0
Build tool (ie. output of
mvnw --version
orgradlew --version
)gradle-8.11.1
Additional information
No response
The text was updated successfully, but these errors were encountered: