You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2020/07/30 14:03:51 UTC

[GitHub] [netbeans] Akshay-Gupta-Oracle opened a new pull request #2283: [NETBEANS-4311]: Auto completion for Sealed Types

Akshay-Gupta-Oracle opened a new pull request #2283:
URL: https://github.com/apache/netbeans/pull/2283


   Auto completion of keywords sealed, non-sealed, permits and classes,records names inside permits clause.


----------------------------------------------------------------
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.

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


[GitHub] [netbeans] neilcsmith-net commented on pull request #2283: [NETBEANS-3990]: Auto completion for Sealed Types

Posted by GitBox <gi...@apache.org>.
neilcsmith-net commented on pull request #2283:
URL: https://github.com/apache/netbeans/pull/2283#issuecomment-670844142


   For same reason as #2282 moving to 12.2.


----------------------------------------------------------------
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.

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


[GitHub] [netbeans] Akshay-Gupta-Oracle merged pull request #2283: [NETBEANS-3990]: Auto completion for Sealed Types

Posted by GitBox <gi...@apache.org>.
Akshay-Gupta-Oracle merged pull request #2283:
URL: https://github.com/apache/netbeans/pull/2283


   


----------------------------------------------------------------
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.

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


[GitHub] [netbeans] junichi11 commented on a change in pull request #2283: [NETBEANS-3990]: Auto completion for Sealed Types

Posted by GitBox <gi...@apache.org>.
junichi11 commented on a change in pull request #2283:
URL: https://github.com/apache/netbeans/pull/2283#discussion_r496643925



##########
File path: java/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java
##########
@@ -4779,9 +4850,13 @@ private void addClassModifiers(Env env, Set<Modifier> modifiers) {
         if (!modifiers.contains(PUBLIC) && !modifiers.contains(PRIVATE)) {
             kws.add(PUBLIC_KEYWORD);
         }
-        if (!modifiers.contains(FINAL) && !modifiers.contains(ABSTRACT)) {
+        if (!modifiers.contains(FINAL) && !modifiers.contains(ABSTRACT) && !modifiers.contains(SEALED_KEYWORD) && !modifiers.contains(NON_SEALED_KEYWORD)) {
             kws.add(ABSTRACT_KEYWORD);
             kws.add(FINAL_KEYWORD);
+            if(isSealedSupported(env)){
+                kws.add(SEALED_KEYWORD);
+                kws.add(NON_SEALED_KEYWORD);
+            }

Review comment:
       Please format.




----------------------------------------------------------------
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.

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


[GitHub] [netbeans] arvindaprameya commented on pull request #2283: [NETBEANS-3990]: Auto completion for Sealed Types

Posted by GitBox <gi...@apache.org>.
arvindaprameya commented on pull request #2283:
URL: https://github.com/apache/netbeans/pull/2283#issuecomment-695935209


   Approved, thanks for doing this Akshay for  12.2.


----------------------------------------------------------------
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.

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


[GitHub] [netbeans] Akshay-Gupta-Oracle commented on pull request #2283: [NETBEANS-3990]: Auto completion for Sealed Types

Posted by GitBox <gi...@apache.org>.
Akshay-Gupta-Oracle commented on pull request #2283:
URL: https://github.com/apache/netbeans/pull/2283#issuecomment-700454794


   @lahodaj , @junichi11 Does this looks OK to merge??


----------------------------------------------------------------
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.

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


[GitHub] [netbeans] lahodaj commented on a change in pull request #2283: [NETBEANS-4311]: Auto completion for Sealed Types

Posted by GitBox <gi...@apache.org>.
lahodaj commented on a change in pull request #2283:
URL: https://github.com/apache/netbeans/pull/2283#discussion_r463615083



##########
File path: java/java.source.base/src/org/netbeans/modules/java/source/TreeShims.java
##########
@@ -149,6 +151,33 @@ public static Name getBinding(Tree node) {
         }
     }
 
+    public static List<JCTree.JCExpression> getPermits(JCClassDecl newT) {

Review comment:
       Please do not return internal javac types (i.e. anything from com.sun.tools.**) from API or semi-API methods like this. It should be simply List<ExpressionTree>, or something similar.

##########
File path: java/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java
##########
@@ -22,6 +22,7 @@
 import com.sun.source.tree.*;
 import com.sun.source.tree.Tree.Kind;
 import com.sun.source.util.*;
+import com.sun.tools.javac.tree.JCTree.JCExpression;

Review comment:
       Please no internal types inside language features (besides the language infrastructure, like java.source{.base}, etc.).

##########
File path: java/java.completion/test/unit/data/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/1.8/CreateConstructorNonDefaultConstructor.pass
##########
@@ -25,9 +25,11 @@ int
 interface
 long
 native
+non-sealed

Review comment:
       I think I would prefer to only have the keywords for an appropriate source level. The existing tests are probably not setting source level to 14, so I would incline to not add the keywords there. New tests may set source level to 14 and check the keywords are proposed by the code completion.




----------------------------------------------------------------
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.

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


[GitHub] [netbeans] junichi11 commented on a change in pull request #2283: [NETBEANS-3990]: Auto completion for Sealed Types

Posted by GitBox <gi...@apache.org>.
junichi11 commented on a change in pull request #2283:
URL: https://github.com/apache/netbeans/pull/2283#discussion_r496644654



##########
File path: java/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java
##########
@@ -780,6 +812,12 @@ private void insideClass(Env env) throws IOException {
                 controller.toPhase(Phase.ELEMENTS_RESOLVED);
                 env.addToExcludes(controller.getTrees().getElement(path));
                 addTypes(env, EnumSet.of(INTERFACE, ANNOTATION_TYPE), null);
+            } else if (isSealedSupported(env) && last != null && TokenUtilities.textEquals(last.token().text(),PERMITS_KEYWORD)) {
+                controller.toPhase(Phase.ELEMENTS_RESOLVED);
+                env.addToExcludes(controller.getTrees().getElement(path));
+                addClassTypes(env, null);
+            } else if(isSealedSupported(env)){
+                addKeyword(env, PERMITS_KEYWORD, SPACE, false);

Review comment:
       Please format.




----------------------------------------------------------------
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.

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


[GitHub] [netbeans] Akshay-Gupta-Oracle commented on pull request #2283: [NETBEANS-3990]: Auto completion for Sealed Types

Posted by GitBox <gi...@apache.org>.
Akshay-Gupta-Oracle commented on pull request #2283:
URL: https://github.com/apache/netbeans/pull/2283#issuecomment-704727537


   I've addressed and all the comments regarding formatting @junichi11. Squashed as well. Waiting for merge.


----------------------------------------------------------------
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.

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


[GitHub] [netbeans] junichi11 commented on a change in pull request #2283: [NETBEANS-3990]: Auto completion for Sealed Types

Posted by GitBox <gi...@apache.org>.
junichi11 commented on a change in pull request #2283:
URL: https://github.com/apache/netbeans/pull/2283#discussion_r463869450



##########
File path: java/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java
##########
@@ -780,6 +813,13 @@ private void insideClass(Env env) throws IOException {
                 controller.toPhase(Phase.ELEMENTS_RESOLVED);
                 env.addToExcludes(controller.getTrees().getElement(path));
                 addTypes(env, EnumSet.of(INTERFACE, ANNOTATION_TYPE), null);
+            } else if (last != null && last.token().text().toString().equals("permits")) {

Review comment:
       should use `TokenUtilities.textEquals()`.
   Please reformat each your change. (Select your changes > Source > Format)




----------------------------------------------------------------
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.

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


[GitHub] [netbeans] junichi11 commented on a change in pull request #2283: [NETBEANS-3990]: Auto completion for Sealed Types

Posted by GitBox <gi...@apache.org>.
junichi11 commented on a change in pull request #2283:
URL: https://github.com/apache/netbeans/pull/2283#discussion_r496643705



##########
File path: java/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java
##########
@@ -858,13 +905,22 @@ private void insideClass(Env env) throws IOException {
                     addTypes(env, EnumSet.of(INTERFACE, ANNOTATION_TYPE), null);
                     break;
                 case IDENTIFIER:
+                    if (isSealedSupported(env) && TokenUtilities.textEquals(lastNonWhitespaceToken.token().text(),PERMITS_KEYWORD)) {
+                        controller.toPhase(Phase.ELEMENTS_RESOLVED);
+                        env.addToExcludes(controller.getTrees().getElement(path));
+                        addClassTypes(env, null);
+                        break;
+                    }
                     if (!tu.isAnnotation(cls)) {
                         if (!tu.isEnum(cls)) {
                             addKeyword(env, EXTENDS_KEYWORD, SPACE, false);
+                            if (isSealedSupported(env)) {
+                                addKeyword(env, PERMITS_KEYWORD, SPACE, false);
+                            }
                         }
                         if (!tu.isInterface(cls)) {
                             addKeyword(env, IMPLEMENTS_KEYWORD, SPACE, false);
-                        }
+                         }

Review comment:
       Please revert.




----------------------------------------------------------------
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.

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


[GitHub] [netbeans] junichi11 commented on a change in pull request #2283: [NETBEANS-3990]: Auto completion for Sealed Types

Posted by GitBox <gi...@apache.org>.
junichi11 commented on a change in pull request #2283:
URL: https://github.com/apache/netbeans/pull/2283#discussion_r496643393



##########
File path: java/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java
##########
@@ -792,8 +830,14 @@ private void insideClass(Env env) throws IOException {
                     controller.toPhase(Phase.ELEMENTS_RESOLVED);
                     env.addToExcludes(controller.getTrees().getElement(path));
                     addTypes(env, EnumSet.of(INTERFACE, ANNOTATION_TYPE), null);
+                } else if (isSealedSupported(env) && last != null && TokenUtilities.textEquals(last.token().text(),PERMITS_KEYWORD)) {
+                    controller.toPhase(Phase.ELEMENTS_RESOLVED);
+                    env.addToExcludes(controller.getTrees().getElement(path));
+                    addClassTypes(env, null);
                 } else {
                     addKeyword(env, IMPLEMENTS_KEYWORD, SPACE, false);
+                   if(isSealedSupported(env)) 
+                       addKeyword(env, PERMITS_KEYWORD, SPACE, false);

Review comment:
       Please format and use `{}`




----------------------------------------------------------------
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.

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


[GitHub] [netbeans] arvindaprameya commented on pull request #2283: [NETBEANS-3990]: Auto completion for Sealed Types

Posted by GitBox <gi...@apache.org>.
arvindaprameya commented on pull request #2283:
URL: https://github.com/apache/netbeans/pull/2283#issuecomment-695935209


   Approved, thanks for doing this Akshay for  12.2.


----------------------------------------------------------------
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.

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