redhat-developer / redhat-developer/vscode-java

Wrong reported errors by compiler

未关闭
#730 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug diagnostics
主要语言
TypeScript
星标
2.3k
派生
547
平均合并
20 小时 1 分钟
30 天内合并 PR
11

描述

I have some pieces of code that compiles fine in IntelliJ and Gradle but VSCode reports them as errors.
Examples:

  1. Error in import

    import sun.security.ssl.ProtocolVersion;

screenshot 2018-11-30 at 11 46 27

I have to point that I'm not using the JVM in the error description. Here's my workspace's settings:

{
   "java.home": "/Users/augusto.dias/.sdkman/candidates/java/8.0.181-oracle",
   "java.jdt.ls.vmargs": "-javaagent:/Users/augusto.dias/my-project/.vscode/lombok.jar -Xbootclasspath/a:/Users/augusto.dias/my-project/.vscode/lombok.jar"
}
  1. Wrong exception handling

I have a RetryTemplate class from spring and I'm calling execute as the following example:

retryTemplate.execute(getCallback(),getRecovery());

private RetryCallback<Void, IOException> getCallback() {
    return context -> {
        if (context.getLastThrowable() instanceof IOException) {
                    IOException e = (IOException) context.getLastThrowable();
    // do some other things
                    throw e;
        }
        return null;
    };
}

private RecoveryCallback getRecovery() {
    return context -> {
        Throwable lastThrowable = context.getLastThrowable();
    // do some other things
        throw lastThrowable instanceof Exception ? (Exception) lastThrowable : new Exception(lastThrowable);
    }
}

screenshot 2018-11-30 at 13 54 27

  1. And finally: false error in method signature
    assertThat((List) ((Envelope) responseEntity.getBody()).getData(), hasItems(siteDTO));
    assertThat((List) ((Envelope) responseEntity.getBody()).getData(), hasSize(1));

screenshot 2018-11-30 at 13 57 43

Environment
  • Operating System: macOS Mojave
  • JDK version: 1.8
  • Visual Studio Code version: 1.29.1
  • Java extension version: 0.34.0

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,使用 workspace 设置、JDK 1.8、VS Code 1.29.1 和 Java extension 0.34.0,在提供的 Java 代码片段中重现报告的三个诊断。将 language server 的结果与 IntelliJ 和 Gradle 进行比较,然后分别确定每个错误是否由相同原因导致。完成的标准是受影响的示例不再产生不正确的诊断,并且为报告的案例提供回归覆盖。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, vscode
领域
devtools
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。