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

Add permitted type cases is not suggested #1845

Closed
rgrunber opened this issue Dec 9, 2024 · 1 comment · Fixed by #1846
Closed

Add permitted type cases is not suggested #1845

rgrunber opened this issue Dec 9, 2024 · 1 comment · Fixed by #1846
Assignees
Labels
bug Something isn't working
Milestone

Comments

@rgrunber
Copy link
Contributor

rgrunber commented Dec 9, 2024

I'm trying to test #1817 .

package test;
public final class BatmanSymbol extends Shape {
}
package test;
public final class Circle extends Shape {
}
package test;
public sealed class Shape permits Circle, BatmanSymbol {
}
package test;

public class Test {
	public static void main(String[] args) {
		Shape someShape;
		switch (someShape) {
		}
	}
}

This is all I see over someShape :

image

I think the issue is related to https://github.com/eclipse-jdt/eclipse.jdt.ui/pull/1817/files#diff-e0ec3fbd8bcf1f3175bcbf9d5d49e6bd76b56b06ff24f9875c6203196d015344R2495 . If the classes are all in the same package (no import required), then importName will be empty.

@rgrunber
Copy link
Contributor Author

rgrunber commented Dec 9, 2024

Yeah, If I move the sealed class and its permitted types into a separate package, it works :

Screencast.from.2024-12-09.15-08-07.mp4

jjohnstn added a commit to jjohnstn/eclipse.jdt.ui-1 that referenced this issue Dec 9, 2024
- fix LocalCorrectionsSubProcessor.addPermittedTypes() method to
  not pass empty importName to the search pattern
- add new test to QuickFixTest22
- fixes eclipse-jdt#1845
@jjohnstn jjohnstn added the bug Something isn't working label Dec 9, 2024
@jjohnstn jjohnstn added this to the 4.35 M1 milestone Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants