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

Failed to quick fix variable declaration #2417

Closed
pingu8007 opened this issue Apr 18, 2022 · 2 comments
Closed

Failed to quick fix variable declaration #2417

pingu8007 opened this issue Apr 18, 2022 · 2 comments

Comments

@pingu8007
Copy link

Issue Type: Bug

  1. Open any java project
  2. Declare local variable
    arg = ""; // first occurance, no type declared
  3. Call Quick Fix/Create Local Variable... from menu

Expect

Code should be corrected to

String arg = ""; // first occurance, type attached

Actual

exception thrown in output panel

[Error - 下午5:43:16] Request codeAction/resolve failed.
  Message: Internal error.
  Code: -32603 
java.util.concurrent.CompletionException: java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    org/eclipse/jdt/internal/corext/dom/LinkedNodeFinder.findByNode(Lorg/eclipse/jdt/core/dom/ASTNode;Lorg/eclipse/jdt/core/dom/Name;)[Lorg/eclipse/jdt/core/dom/Name; @11: invokestatic
  Reason:
    Type '[Lorg/eclipse/jdt/core/dom/Name;' (current frame, stack[0]) is not assignable to '[Lorg/eclipse/jdt/core/dom/SimpleName;'
  Current Frame:
    bci: @11
    flags: { }
    locals: { 'org/eclipse/jdt/core/dom/ASTNode', 'org/eclipse/jdt/core/dom/Name', '[Lorg/eclipse/jdt/core/dom/Name;' }
    stack: { '[Lorg/eclipse/jdt/core/dom/Name;' }
  Bytecode:
    0000000: 2a2b b801 044d 2cc6 0008 2cb8 016b b02b
    0000010: b601 06b6 00f6 3e1d 101e 9f00 0f1d 100a
    0000020: 9f00 091d 1012 a000 32bb 00d0 59b7 00d2
    0000030: 3a04 bb01 0959 2b19 04b7 010b 3a05 2a19
    0000040: 05b6 00d8 1904 1904 b600 dcbd 0107 b600
    0000050: dfc0 010e b801 6bb0 04bd 0107 5903 2b53
    0000060: b801 6bb0                              
  Stackmap Table:
    append_frame(@15,Object[#270])
    append_frame(@41,Integer)
    same_frame(@88)

	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Caused by: java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    org/eclipse/jdt/internal/corext/dom/LinkedNodeFinder.findByNode(Lorg/eclipse/jdt/core/dom/ASTNode;Lorg/eclipse/jdt/core/dom/Name;)[Lorg/eclipse/jdt/core/dom/Name; @11: invokestatic
  Reason:
    Type '[Lorg/eclipse/jdt/core/dom/Name;' (current frame, stack[0]) is not assignable to '[Lorg/eclipse/jdt/core/dom/SimpleName;'
  Current Frame:
    bci: @11
    flags: { }
    locals: { 'org/eclipse/jdt/core/dom/ASTNode', 'org/eclipse/jdt/core/dom/Name', '[Lorg/eclipse/jdt/core/dom/Name;' }
    stack: { '[Lorg/eclipse/jdt/core/dom/Name;' }
  Bytecode:
    0000000: 2a2b b801 044d 2cc6 0008 2cb8 016b b02b
    0000010: b601 06b6 00f6 3e1d 101e 9f00 0f1d 100a
    0000020: 9f00 091d 1012 a000 32bb 00d0 59b7 00d2
    0000030: 3a04 bb01 0959 2b19 04b7 010b 3a05 2a19
    0000040: 05b6 00d8 1904 1904 b600 dcbd 0107 b600
    0000050: dfc0 010e b801 6bb0 04bd 0107 5903 2b53
    0000060: b801 6bb0                              
  Stackmap Table:
    append_frame(@15,Object[#270])
    append_frame(@41,Integer)
    same_frame(@88)

	at org.eclipse.jdt.ls.core.internal.corrections.proposals.NewVariableCorrectionProposal.getAllReferences(NewVariableCorrectionProposal.java:329)
	at org.eclipse.jdt.ls.core.internal.corrections.proposals.NewVariableCorrectionProposal.doAddLocal(NewVariableCorrectionProposal.java:219)
	at org.eclipse.jdt.ls.core.internal.corrections.proposals.NewVariableCorrectionProposal.getRewrite(NewVariableCorrectionProposal.java:113)
	at org.eclipse.jdt.ls.core.internal.corrections.proposals.ASTRewriteCorrectionProposal.addEdits(ASTRewriteCorrectionProposal.java:89)
	at org.eclipse.jdt.ls.core.internal.corrections.proposals.CUCorrectionProposal.createTextChange(CUCorrectionProposal.java:109)
	at org.eclipse.jdt.ls.core.internal.corrections.proposals.CUCorrectionProposal.createChange(CUCorrectionProposal.java:115)
	at org.eclipse.jdt.core.manipulation.ChangeCorrectionProposalCore.getChange(ChangeCorrectionProposalCore.java:150)
	at org.eclipse.jdt.ls.core.internal.handlers.CodeActionResolveHandler.resolve(CodeActionResolveHandler.java:46)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$16(JDTLanguageServer.java:683)
	at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:75)
	... 7 more

Extension version: 1.5.0
VS Code version: Code 1.66.2 (dfd34e8260c270da74b5c2d86d61aee4b6d56977, 2022-04-11T07:46:01.075Z)
OS version: Windows_NT x64 10.0.19044
Restricted Mode: No
Remote OS version: Windows_NT x64 10.0.19044
Remote OS version: Windows_NT x64 10.0.19044

System Info
Item Value
CPUs Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz (8 x 1800)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 39.86GB (22.77GB free)
Process Argv --crash-reporter-id b8f457c0-9048-433e-a6ca-4f6fc6e425e9
Screen Reader no
VM 29%
Item Value
Remote SSH: HCA2101023.uft.com
OS Windows_NT x64 10.0.19044
CPUs Intel(R) Core(TM) i5-10500 CPU @ 3.10GHz (12 x 3096)
Memory (System) 31.75GB (16.82GB free)
VM 0%
Item Value
Remote SSH: HCA2101023.uft.com
OS Windows_NT x64 10.0.19044
CPUs Intel(R) Core(TM) i5-10500 CPU @ 3.10GHz (12 x 3096)
Memory (System) 31.75GB (16.82GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392:30443607
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
pythondataviewer:30285071
vscod805cf:30301675
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
pythonvsnew555:30457759
vscscmwlcmt:30465135

@snjeza
Copy link
Contributor

snjeza commented Apr 18, 2022

@pingu8007 I can't reproduce the issue.
Could you attach a sample project reproducing the error?

@pingu8007
Copy link
Author

pingu8007 commented Apr 19, 2022

@snjeza I finally figure out that lombok plugin is broken due to something changed recently, see projectlombok/lombok#3134. This issue is solved in lombok 1.18.24.

To reproduce, add -javaagent:\"/path/to/lombok.jar\" into java.jdt.ls.vmargs, where the version of lombok plugin should be 1.18.22 or earlier.

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

2 participants