lahodaj commented on code in PR #8437:
URL: https://github.com/apache/netbeans/pull/8437#discussion_r2073596186


##########
java/java.editor.base/src/org/netbeans/modules/java/editor/base/semantic/UnusedDetector.java:
##########
@@ -417,6 +395,32 @@ public Void scan(Tree tree, Element p) {
         return false;
     }
 
+    private record ClassIndexKey(FileObject fo){}
+    
+    // optaining the ClassIndex can be expensive, this is usually called 
multiple times per search
+    private static ClassIndex getCachedClassIndex(FileObject fileObject, 
CompilationInfo info) {
+        ClassIndexKey key = new ClassIndexKey(fileObject);

Review Comment:
   Not very critical, but the use of the `ClassIndexKey` is probably 
unnecessary. Any:
   ```
   private static final Object CLASS_INDEX_KEY = new Object();
   ```
   would probably work. The `FileObject` is got as 
`CompilationInfo.getFileObject()`, and the `CompilationInfo` is not reused for 
multiple `FileObject`s AFAIK.
   



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