jlahoda commented on a change in pull request #3166:
URL: https://github.com/apache/netbeans/pull/3166#discussion_r720796986
##########
File path: java/java.hints/src/org/netbeans/modules/java/hints/perf/Tiny.java
##########
@@ -314,15 +323,22 @@ private static ErrorDescription enumHint(HintContext ctx,
String baseName, Strin
@Hint(displayName =
"#DN_org.netbeans.modules.java.hints.perf.Tiny.collectionsToArray",
description =
"#DESC_org.netbeans.modules.java.hints.perf.Tiny.collectionsToArray",
category="performance",
- enabled=false,
+ enabled=true,
suppressWarnings="CollectionsToArray")
- @TriggerPattern(value = "$collection.toArray(new $clazz[0])",
- constraints=@ConstraintVariableType(variable="$collection",
-
type="java.util.Collection"))
+ @TriggerPatterns({
+ @TriggerPattern(value = "$collection.toArray(new
$clazz[$collection.size()])",
+ constraints =
@ConstraintVariableType(variable="$collection", type="java.util.Collection")),
+ @TriggerPattern(value = "$collection.toArray(new $clazz[0])",
Review comment:
Right, sorry. The check is fine (we could split the checks into two
method, but then the hint would need to be defined in a class not a method, so
we would need to reorganize things here, and there's probably not a good reason
for that).
--
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