Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symbol lookup in Java shows duplicates #3854

Closed
rajinder-yadav opened this issue Nov 10, 2024 · 5 comments
Closed

Symbol lookup in Java shows duplicates #3854

rajinder-yadav opened this issue Nov 10, 2024 · 5 comments

Comments

@rajinder-yadav
Copy link

Type: Bug

When I try to look up a Symbol in a Java project, I am seeing duplicate.

For example, type: CTRL+p to bring up the command field, then type, "#ArrayList".

Image

Extension version: 1.36.0
VS Code version: Code - Insiders 1.96.0-insider (4a98be2738be4ad8647feb52d1e6845e06515dea, 2024-11-08T09:56:49.748Z)
OS version: Linux x64 6.11.6-2-default
Modes:

System Info
Item Value
CPUs AMD Ryzen 9 5900X 12-Core Processor (24 x 4499)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off
Load (avg) 0, 0, 0
Memory (System) 62.71GB (48.55GB free)
Process Argv . --crash-reporter-id 16b87d92-ec94-4851-bc93-3fb4ac5a3bf3
Screen Reader no
VM 0%
DESKTOP_SESSION plasma6
XDG_CURRENT_DESKTOP KDE
XDG_SESSION_DESKTOP KDE
XDG_SESSION_TYPE x11
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vsc_aa:30263845
vscod805cf:30301675
vsaa593cf:30376535
py29gd2263:31024238
c4g48928:30535728
2i9eh265:30646982
962ge761:30841072
pythongtdpath:30726887
pythonnoceb:30776497
asynctok:30898717
dsvsc014:30777825
dsvsc015:30821418
pythonmypyd1:30859725
h48ei257:31000450
pythontbext0:30879054
cppperfnew:30980852
pythonait:30973460
01bff139:31013167
dvdeprecation:31040973
dwnewjupyter:31046869
nb_pri_only:31057983
nativerepl1:31134653
refactort:31084545
pythonrstrctxt:31093868
nativeloc1:31118317
cf971741:31144450
e80f6927:31120813
i21gd607:31141543
iacca1:31150324
notype1:31143044
dwcopilot:31158714
h409b430:31177054

@snjeza
Copy link
Contributor

snjeza commented Nov 11, 2024

@rajinder-yadav Could you try VS Code 1.95.x ?

@rgrunber
Copy link
Member

rgrunber commented Nov 12, 2024

Should have been fixed in #3452 , unless this is a different case. Can you share the sample project for which this occurs ? Is it managed by Maven, Gradle, or is it just an unmanaged project (folders and source files, no build tool). Does your project configure 2 different Java versions ?

You could try following the instructions at #3452 (comment) . Basically that would help us confirm that it is in fact 2 separate JDKs that are being picked up (based on the URI).

Update: One way I can reproduce this behaviour is by taking a Maven multi-module project, where two modules configure different compiler/source versions. You'll end up getting what appears to be duplicate classes when in fact they're just coming from different JDKs. More generally, in #3452 (comment) , I left a note that where a project depends on different versions of the same library, we should probably modify the workspace symbol entry to list the version so it's more clear what's going on.

@rajinder-yadav
Copy link
Author

Well it's somewhat fixed, still seeing double entries for some symbols. Is the 2nd one really necessary?

I believe I was using a nobuild project, but I also tried maven no architype project.

Image

Version info

Version: 1.96.0-insider
Commit: 4a98be2738be4ad8647feb52d1e6845e06515dea
Date: 2024-11-08T09:56:49.748Z
Electron: 32.2.1
ElectronBuildId: 10427718
Chromium: 128.0.6613.186
Node.js: 20.18.0
V8: 12.8.374.38-electron.0
OS: Linux x64 6.11.6-2-default

@rgrunber
Copy link
Member

rgrunber commented Nov 15, 2024

java.util.Arrays.ArrayList is a private nested class that is not a duplicate of java.util.ArrayList. It's used to implement Arrays.asList(..) ensuring that the resulting list is fixed-size. It's a bit less obvious because the package name is in smaller font, but libraries can have classes that are the same name, but in different packages.

@rajinder-yadav
Copy link
Author

@rgrunber thanks for clearing that up. I am going to close this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants