redhat-developer / redhat-developer/vscode-java

Package containing dot character not being parsed correctly

Offen
#1,406 9 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug upstream
Vorherrschende Sprache
TypeScript
Sterne
2.3k
Forks
546
Ø Merge
20 Std. 1 Min.
Gemergte PRs (30 T.)
11

Beschreibung

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%

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere den Fehler mit dem gezeigten Gradle-Layout, einschließlich des Verzeichnisses javasnap.domain mit Punkten, ClStringArgs.java, ClStringArgsTest.java und build.gradle. Beginne damit nachzuverfolgen, wie die Erweiterung die Java-Quellverzeichnisse von Gradle erkennt; die Aufgabe ist erledigt, wenn Paketdeklarationen und Referenzen ohne Fehler aufgelöst werden, während das Projekt weiterhin kompiliert und ausgeführt wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
devtools
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.