mbien commented on code in PR #4440:
URL: https://github.com/apache/netbeans/pull/4440#discussion_r931630020


##########
java/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java:
##########
@@ -3890,6 +3882,33 @@ && isOfKindAndType(e.getEnclosingElement().asType(), e, 
kinds, baseType, scope,
                 }
                 return false;
             }
+
+            private boolean checkMethodAccepted(String sn, Element e,
+                    TypeMirror t) {
+                //4 checks to include property accessors
+                String initialPrefix = env.getPrefix();
+                //TODO: maybe cache these?
+                String[] prefixes = {
+                    initialPrefix,
+                    "is" + initialPrefix,
+                    "get" + initialPrefix,
+                    "set" + initialPrefix
+                };
+                for (String prefix : prefixes) {
+                    if (checkMethodAccepted(sn, prefix, e, t)){
+                        return true;
+                    }
+                }
+                return false;

Review Comment:
   alternative which might be more readable:
   ```java
   return checkMethodAccepted(sn, initialPrefix, e, t)
       || checkMethodAccepted(sn, "is" + initialPrefix, e, t)
       || checkMethodAccepted(sn, "get" + initialPrefix, e, t)
       || checkMethodAccepted(sn, "set" + initialPrefix, e, t)
   ```
   
   I am a little worried about performance here. We recently made completion in 
cases with large amount of fields faster (#4142).
   We will have to check that this is not affecting performance negatively.
   
   Here a file for manual tests: 
https://github.com/apache/netbeans/issues/4140#issuecomment-1134414691



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to