mbien commented on code in PR #7548:
URL: https://github.com/apache/netbeans/pull/7548#discussion_r1686915070
##########
java/java.hints/src/org/netbeans/modules/java/hints/bugs/Unused.java:
##########
@@ -52,7 +52,12 @@ public class Unused {
@BooleanOption(displayName="#LBL_UnusedPackagePrivate",
tooltip="#TP_UnusedPackagePrivate",
defaultValue=DETECT_UNUSED_PACKAGE_PRIVATE_DEFAULT)
public static final String DETECT_UNUSED_PACKAGE_PRIVATE =
"detect.unused.package.private";
- @TriggerTreeKind(Kind.COMPILATION_UNIT)
+ @TriggerTreeKind({
+ //class-like kinds:
+ Kind.ANNOTATION_TYPE, Kind.CLASS, Kind.ENUM, Kind.INTERFACE,
Kind.RECORD,
+ Kind.VARIABLE,
+ Kind.METHOD
+ })
public static List<ErrorDescription> unused(HintContext ctx) {
Review Comment:
@Achal1607 question: why was this change made?
I ran some benchmarks which were based on generated files I used for
https://github.com/apache/netbeans/pull/4142 +
https://github.com/apache/netbeans/pull/4501
very large files (10K fields and getters) with many positive unused hits
performed slightly worse:
PR:
```
FINE [org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker]:
{time=69114.52ms, invocations=20003, cancelled=false}:
org.netbeans.modules.java.hints.bugs.Unused
FINE [org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker]: hint
processing complete
```
master:
```
FINE [org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker]:
{time=62578.07ms, invocations=1, cancelled=false}:
org.netbeans.modules.java.hints.bugs.Unused
FINE [org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker]: hint
processing complete
```
the more concerning bit is this though. a 3k fields file which are _not_
unused:
PR:
```
FINE [org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker]:
{time=565.49ms, invocations=6003, cancelled=false}:
org.netbeans.modules.java.hints.bugs.Unused
FINE [org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker]: hint
processing complete
```
master:
```
FINE [org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker]:
{time=0.11ms, invocations=1, cancelled=false}:
org.netbeans.modules.java.hints.bugs.Unused
FINE [org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker]: hint
processing complete
```
--
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