troizet commented on code in PR #8673:
URL: https://github.com/apache/netbeans/pull/8673#discussion_r2256244722


##########
php/php.editor/src/org/netbeans/modules/php/editor/verification/IncorrectNonAbstractMethodHintError.java:
##########
@@ -107,17 +111,26 @@ private void addHint(ASTNode node, String description, 
List<Hint> hints, List<Hi
     //~ Inner classes
     private static final class CheckVisitor extends DefaultVisitor {
 
+        private final Model model;
+
         private final Set<MethodDeclaration> incorrectNonAbstractMethods = new 
HashSet<>();
 
+        public CheckVisitor(Model model) {
+            super();
+            this.model = model;
+        }
+
         @Override
         public void visit(MethodDeclaration node) {
             if (CancelSupport.getDefault().isCancelled()) {
                 return;
             }
             if (!Modifier.isAbstract(node.getModifier())) {
                 FunctionDeclaration function = node.getFunction();
-                Block body = function.getBody();
-                if (body == null) {
+                final VariableScope variableScope = 
model.getVariableScope(function.getEndOffset() - 1);

Review Comment:
   Yes, there were thoughts that perhaps it is not worth doing this.
   But, for example, in `AbstractClassInstantiationHintError` the model is also 
called in the visitor.
   
https://github.com/apache/netbeans/blob/51789f035849212c4b0803eefb7adba41108fad3/php/php.editor/src/org/netbeans/modules/php/editor/verification/AbstractClassInstantiationHintError.java#L71-L120
   I will do performance measurements later. Thank you!



-- 
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-unsubscr...@netbeans.apache.org

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


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

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

Reply via email to