Add hint to resolve "switch does not cover all input values" javac errors#8860
Add hint to resolve "switch does not cover all input values" javac errors#8860mbien merged 1 commit intoapache:masterfrom
Conversation
|
one of the new test cases is failing on JDK 17. Can't reproduce it locally so far. |
9cdec69 to
5cff9e4
Compare
|
I think this looks conceptually good to me. My longer-term plan is to allow computation (and filling-in) of the missing patterns, but that's still in a non-near future. Thanks! |
5cff9e4 to
6427510
Compare
|
CI should hopefully pass now - my mistake. The tests did have copy/paste induced compiler errors in them. Its interesting though that it did pass on JDK 17-25 locally, CI found the problem though. edit: must be a race condition, since the upper bound JDK 25 test is now also failing which is new. (the failing test cases are also different) |
6427510 to
77edda0
Compare
|
I think I found the issue. the |
donphelix
left a comment
There was a problem hiding this comment.
Improve safety by adding checks or early returns if the list is empty.
java/java.hints/src/org/netbeans/modules/java/hints/errors/AddDefaultCase.java
Show resolved
Hide resolved
java/java.hints/src/org/netbeans/modules/java/hints/errors/AddDefaultCase.java
Outdated
Show resolved
Hide resolved
Hint triggers on the javac error code and offers to append a default case to the switch block. other changes: - checked all JavaFix impls for TreePath access without TreePathHandle - removed some redundant code from tests extending ErrorHintsTestBase commit notes: - originally based on an old draft PR (apache#3440) from Sandeep Mishra - finished the impl and aligned the code to the changed codebase (e.g TreeShims is no more) - added tests Co-Authored-By: mishrasandeep <sandeep.s.mishra@oracle.com>
77edda0 to
c7e40d7
Compare
lahodaj
left a comment
There was a problem hiding this comment.
Looks sensible to me, thanks!
resurrects this old PR #3440. Rewrote parts of it since
TreeShimsis now gone and the impl wasn't complete + added tests.triggers on the javac error and offers to resolve it by adding a default case:
->
closes https://issues.apache.org/jira/browse/NETBEANS-6380
closes #3440