jlahoda commented on a change in pull request #3166:
URL: https://github.com/apache/netbeans/pull/3166#discussion_r720797216



##########
File path: java/java.hints/src/org/netbeans/modules/java/hints/perf/Tiny.java
##########
@@ -337,11 +353,24 @@ public static ErrorDescription 
collectionsToArray(HintContext ctx) {
         Fix[] fixes;
 
         if (pureMemberSelect) {
-            String fixDisplayName = NbBundle.getMessage(Tiny.class, 
"FIX_Tiny_collectionsToArray");
 
-            fixes = new Fix[] {
-                JavaFixUtilities.rewriteFix(ctx, fixDisplayName, 
ctx.getPath(), "$collection.toArray(new $clazz[$collection.size()])")
-            };
+            SourceVersion version = ctx.getInfo().getSourceVersion();
+            TreePath type = ctx.getVariables().get("$clazz");
+            String typeName = type.getLeaf().toString();
+            
+            if 
(Integer.parseInt(version.name().substring(version.name().indexOf('_')+1)) >= 
11) {

Review comment:
       Right again, but I think I'd still somewhat prefer to compare 
SourceVersions than play integer tricks. I'd try to create a static final 
field, initialize to SourceVersion.RELEASE_11 if it exists 
(`SourceVersion.valueOf("RELEASE_11")`), or null. Hopefully easier to find when 
we can depend on the new API.
   
   Thanks.




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