Skip to content

VSCode implicitly import java.lang.StringTemplate.STR which conflict with org.yaml.snakeyaml.nodes.Tag.STR #3510

@renanfranca

Description

@renanfranca

VSCode implicitly import java.lang.StringTemplate.STR which conflict with org.yaml.snakeyaml.nodes.Tag.STR

Environment
  • Operating System: Windows 10
  • JDK version: 21
  • Visual Studio Code version: 1.86.2
  • Java extension version: v1.28.1
Steps To Reproduce
  1. Clone the open source project https://github.com/jhipster/jhipster-lite
  2. Import the java project
  3. Go to file tech.jhipster.lite.module.infrastructure.secondary.YamlFileSpringPropertiesHandler.java
  4. See the compilation error (Type mismatch: cannot convert from StringTemplate.Processor<String,RuntimeException> to Tag)

[Screenshot]
image

Current Result

I have to change the code only to run the project:
FROM:

  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);
  }

TO:

  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);
  }
Expected Result

Is there a configuration to solve this problem without need to explicitly use Tag.STR?

Additional Informations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions