redhat-developer / redhat-developer/vscode-java

Java build is failing when trying to import from enum file

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

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

content-assist
主要言語
TypeScript
スター
2.3k
フォーク
546
平均マージ
20時間 1分
マージ済み PR(30日)
11

説明

Environment
  • Operating System: Windows 10 (ssh remote to ubuntu)
  • JDK version: Java 8
  • Visual Studio Code version: 1.47.1
  • Java extension version: 0.9.1
Steps To Reproduce

If you have two enum files with the same package structure, vscode can't figure out which one you are trying to import
Say for example, your source code has an enum (MyEnum), and your test code has the same enum but with an additional value (NON_EXISTING_TYPE), vscode will complain the enum value doesn't exist. Intellij does not have this problem however.

Here com.my.example.MyEnum exists both in source and test folder, and this is how I would import the test enum:

import static com.my.example.MyEnum.NON_EXISTING_TYPE;

It will highlighted with red squigly line, with message:
The import com.my.example.MyEnum.NON_EXISTING_TYPE cannot be resolved Java(268435846)

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

記載されている環境とバージョンを使用して、source フォルダーと test フォルダーに重複した MyEnum ファイルを配置した静的インポートをまず再現します。Java 拡張機能が source と test の型をどのように解決するかを追跡します。テスト enum の NON_EXISTING_TYPE インポートが診断なしで解決されれば作業は完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
devtools
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。