VSCode implicitly import java.lang.StringTemplate.STR which conflict with org.yaml.snakeyaml.nodes.Tag.STR
renanfranca opened this issue · comments
I am a vscode user and this compilation error (Type mismatch: cannot convert from StringTemplate.Processor<String,RuntimeException> to Tag
) at class YamlFileSpringPropertiesHandler.java
is so annoying:
private Node buildScalarNode(Object value) {
Tag tag = STR;
if (value instanceof Integer || value instanceof Long) {
tag = INT;
} else if (value instanceof Double || value instanceof Float) {
tag = FLOAT;
} else if (value instanceof Boolean) {
tag = BOOL;
}
return new ScalarNode(tag, value.toString(), null, null, DumperOptions.ScalarStyle.PLAIN);
}
Every time before starting work on the project I have to explicitly set Tag.STR to solve the problem:
private Node buildScalarNode(Object value) {
Tag tag = Tag.STR;
if (value instanceof Integer || value instanceof Long) {
tag = INT;
} else if (value instanceof Double || value instanceof Float) {
tag = FLOAT;
} else if (value instanceof Boolean) {
tag = BOOL;
}
return new ScalarNode(tag, value.toString(), null, null, DumperOptions.ScalarStyle.PLAIN);
}
I opened an issue:
@murdos and @pascalgrimaud : Do you face that problem using intellij?
No problem with Intellij here.
But I guess it's related to incoming string templating in next java version.
STR
will be a special word, so il would be better to use Tag.STR
: you can open a PR to change existing code :-)
you can open a PR to change existing code :-)
Thank you! 😅