You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "lahodaj (via GitHub)" <gi...@apache.org> on 2024/11/14 16:27:30 UTC

[PR] Improving Java code completion support for sealed types in switches. [netbeans]

lahodaj opened a new pull request, #7966:
URL: https://github.com/apache/netbeans/pull/7966

   Consider code like:
   ```
   package sealed.test;
   
   public class SealedTest {
       private int test(I i) {
           return switch (i) {
               case /*invoke code completion here*/
           };
       }
   
       public sealed interface I {}
       public final class A implements I {}
       public final class B implements I {}
       public class E extends Exception {}
       public enum AI implements I {A, B, C;}
   }
   ```
   
   The (Java) code completion returns all types at the specified place, instead of just subtypes of `i`. This patch is trying to solve that, by using the selector's type as a base type, and hence only proposing the correct subclasses/interfaces.
   
   The patch is sadly a bit biggish, partly as it seems I need to add `smartType` flag to `createStaticMemberItem`. The code is also tricky around qualified enum constants (which are permitted since JDK 21).
   
   There may be further improvements possible, but I hope this PR leads to a not completely unreasonable state.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Improving Java code completion support for sealed types in switches. [netbeans]

Posted by "lahodaj (via GitHub)" <gi...@apache.org>.
lahodaj merged PR #7966:
URL: https://github.com/apache/netbeans/pull/7966


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists