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

Fail to Preview and Refactor with deleting parameters in Change Method Signature window #3089

Closed
yuyully opened this issue Apr 27, 2023 · 3 comments

Comments

@yuyully
Copy link

yuyully commented Apr 27, 2023

Environment
  • Operating System: Mac
  • JDK version: 17.0.6
  • Visual Studio Code version: 1.77.3
  • Java extension version: 1.18.0
Steps To Reproduce
  1. In a method which contains two parameters > Change signature from quick action
  2. In Change Method Signature window, delete one parameter > Preview or Refactor
Current Result

image

Expected Result

Can preview and refactor successfully.

@yuyully
Copy link
Author

yuyully commented Apr 27, 2023

  • Change Method Signature > Go to Exception tab > Same behavior while deleting existing exceptions.
  • Change Method Signature > Go to Exception tab > Add an exception with default name > Refactor (succeed) > Add an exception with default name again, Refactor and Preview don't work without errors.

@rgrunber
Copy link
Member

rgrunber commented Jul 14, 2023

I just checked and eclipse-jdtls/eclipse.jdt.ls#2754 should solve all of these, except the "adding an exception with a default name again". If by default name you mean "Exception"/"java.lang.Exception", while it doesn't appear to be a compilation error, it doesn't really make sense to have public void someMethod () throws Exception, Exception. The refactoring is partly correct in pointing out that you haven't really changed anything, although I guess the signature is technically different ?

We could improve this in the future if there really is a case for it.

The latter is actually an upstream issue we'd have to fix in the signature processor because even in Eclipse itself it doesn't permit adding a duplicate :

add-duplicate-exception

@rgrunber
Copy link
Member

I would close this for now as the really annoying aspects of this issue ("change signature" doing downright strange things) should be resolved now.

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

No branches or pull requests

3 participants