redhat-developer / redhat-developer/vscode-java

Package containing dot character not being parsed correctly

オープン
#1,406 コメント 9 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug upstream
主要言語
TypeScript
スター
2.3k
フォーク
546
平均マージ
20時間 1分
マージ済み PR(30日)
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. リポジトリをフォークし、ブランチを切って変更します。
  4. 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 を短くまとめたダイジェスト。