redhat-developer / redhat-developer/vscode-java

Package containing dot character not being parsed correctly

未关闭
#1,406 9 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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

描述

Issue Type: Bug

In the src folder of a Java Gradle project, there's the package structure:

projectRoot/
└── src/
    ├── main/
    │   ├── java/
    │   │   └── javasnap.domain/
    │   │       └── cli/
    │   │           └── ClStringArgs.java
    └── test/
        ├── java/
        │   └── javasnap.domain/
        │       └── cli/
        │           └── ClStringArgsTest.java

The ClStringArgs.java and ClStringArgsTest.java file contains the package declaration:

package javasnap.domain.cli;

Which is resulting in the package delcaration being highlighted as an error by VScode in both the test and production source file:

The declared package "javasnap.domain.cli" does not match the expected package "" Java(536871240)

It's also highlighting any reference to the class ClStringArgs in both the production and test source code with the following error:

ClStringArgs cannot be resolved to a type Java(16777218)

Splitting the directory name containing the dot character into two separate directories with one nested within the other causes this error to go away.

This package naming is valid for Gradle (and Java) to be able to compile and run source code. Attempting to add a directory to the Java Source Path via VScode results in the following message:

Unsupported operation. Please use build.gradle file to manage the source directories of gradle project.

Source: Language Support for Java(TM) by Red Hat (Extension)

This source directory structure is the default structuring of Gradle builds and this package naming convention is valid and used by multiple Java libraries. Can this bug get fixed or the feature of being able to resolve package names containing the dot character correctly be added to the roadmap?

Extension version: 0.60.0
VS Code version: Code 1.44.2 (ff915844119ce9485abfe8aa9076ec76b5300ddd, 2020-04-16T17:07:18.473Z)
OS version: Darwin x64 18.7.0

System Info
Item Value
CPUs Intel(R) Core(TM) i7-3740QM CPU @ 2.70GHz (8 x 2700)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
Load (avg) 3, 3, 3
Memory (System) 16.00GB
Process Argv .
Screen Reader no
VM 0%

贡献指南

打开贡献指南

从这里开始

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

调研方向

使用所示的 Gradle 布局重现该错误,包括带点的 javasnap.domain 目录、ClStringArgs.java、ClStringArgsTest.java 和 build.gradle。首先跟踪扩展如何发现 Gradle Java 源代码目录;当包声明和引用能够无错误地解析,同时项目仍能编译和运行时,即表示完成。

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

评估

技术栈
java
领域
devtools
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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