6 ms·
I would have loved to see Java introduce something similar to the IntelliJ @Language-annotation in the standard library but maybe they'll figure out the sweet s
by tofflos 2y ago
I would have loved to see Java introduce something similar to the IntelliJ @Language-annotation in the standard library but maybe they'll figure out the sweet spot in a future String Templating JEP.
@Language("application/sql")
String query = "SELECT 1";
@Language("application/graphql+json")
String query = """
query HeroNameAndFriends {
hero {
name
friends {
name
}
}
}
""";
- neonsunset 2y agoThis is exactly how raw string literals together with StringSyntaxAttribute work in C#. It is very useful in e.g Regex syntax highlighting.