Is there a way to get Eclipse to understand Java 13 features, such as text blocks? Eclipse reports errors for the following code:
class Main {
private String text = """
first line
second line
third line
""";
}
Errors include:
first cannot be resolved to a type
Duplicate field Main.line
I suspect the problem is the combination of Eclipse and Java 13 in general.
Building with Maven succeeds (with appropriate --enable-preview
config). The "installed JRE" in use is Java 13 (with --enable-preview
as default VM argument). Installing Java 13 Support for Eclipse 2019-09 doesn't seem to help either (doesn't add the Java 13 compliance level option).
You would need to set JRE13 to eclipse and also will need to select BETA 13 under settings.
Check configuration steps at https://wiki.eclipse.org/Java13/Examples
In Project > Properies: Java Compiler make sure Java 13 preview features are enabled:
I did follow the steps and it worked for me.