mbien commented on code in PR #9174:
URL: https://github.com/apache/netbeans/pull/9174#discussion_r2747211804


##########
java/java.hints/src/org/netbeans/modules/java/hints/StaticImport.java:
##########
@@ -77,36 +75,36 @@
  *
  * @author Sam Halliday
  * @author markiewb
- * @see <a href="http://www.netbeans.org/issues/show_bug.cgi?id=89258";>RFE 
89258</a>
- * @see <a 
href="http://java.sun.com/j2se/1.5.0/docs/guide/language/static-import.html>Static
 Imports</a>
+ * @see <a 
href="https://docs.oracle.com/javase/1.5.0/docs/guide/language/static-import.html>Static
 Imports</a>
  */
 @Hint(category="rules15", displayName="#DN_StaticImport", 
description="#DSC_StaticImport", severity=Severity.HINT, enabled=false, 
suppressWarnings={"", "StaticImport"},
         minSourceVersion = "5")
 public class StaticImport {
+    
+    private static final Set<ElementKind> SUPPORTED_TYPES = 
EnumSet.of(ElementKind.METHOD, ElementKind.ENUM_CONSTANT, ElementKind.FIELD);

Review Comment:
   i remembered it wrong, `EnumSet` is also faster than `Set.of`. So its more 
compact and a little bit faster too.
   
   <details>
   
   ```java
   
   package dev.mbien.jmh.collection;
   
   
   import java.util.EnumSet;
   import java.util.Set;
   import java.util.concurrent.TimeUnit;
   import org.openjdk.jmh.annotations.Benchmark;
   import org.openjdk.jmh.annotations.BenchmarkMode;
   import org.openjdk.jmh.annotations.Fork;
   import org.openjdk.jmh.annotations.Level;
   import org.openjdk.jmh.annotations.Measurement;
   import org.openjdk.jmh.annotations.Mode;
   import org.openjdk.jmh.annotations.OutputTimeUnit;
   import org.openjdk.jmh.annotations.Param;
   import org.openjdk.jmh.annotations.Scope;
   import org.openjdk.jmh.annotations.Setup;
   import org.openjdk.jmh.annotations.State;
   import org.openjdk.jmh.annotations.Warmup;
   import org.openjdk.jmh.infra.Blackhole;
   import org.openjdk.jmh.results.format.ResultFormatType;
   import org.openjdk.jmh.runner.Runner;
   import org.openjdk.jmh.runner.RunnerException;
   import org.openjdk.jmh.runner.options.Options;
   import org.openjdk.jmh.runner.options.OptionsBuilder;
   
   @BenchmarkMode(Mode.AverageTime)
   @OutputTimeUnit(TimeUnit.NANOSECONDS)
   @Warmup(iterations = 5, time = 5, timeUnit = TimeUnit.SECONDS)
   @Measurement(iterations = 5, time = 5, timeUnit = TimeUnit.SECONDS)
   @Fork(1)
   @State(Scope.Benchmark)
   public class SetAndEnumSet {
   
       @Param({})
       public String variant;
       
       private Set<?> set;
       
       private enum Keys10 {
           A, B, C, D, E, F, G, H, I, J
       }
       
       @Setup(Level.Iteration)
       public void setup() {
           set = switch (variant) {
               case "EnumSet" -> EnumSet.of(Keys10.B, Keys10.D, Keys10.F);
               case "Set" -> Set.of(Keys10.B, Keys10.D, Keys10.F);
               default -> throw new IllegalStateException();
           };
       }
       
       /*
       25+36-LTS
       
       Benchmark                  (variant)  Mode  Cnt   Score   Error  Units
       SetAndEnumSet.containsNeg    EnumSet  avgt    5   1.037 ± 0.013  ns/op
       SetAndEnumSet.containsNeg        Set  avgt    5   5.192 ± 0.103  ns/op
       
       SetAndEnumSet.containsPos    EnumSet  avgt    5   1.035 ± 0.014  ns/op
       SetAndEnumSet.containsPos        Set  avgt    5   3.866 ± 0.030  ns/op
       
       SetAndEnumSet.toArray        EnumSet  avgt    5  13.830 ± 0.108  ns/op
       SetAndEnumSet.toArray            Set  avgt    5  12.587 ± 0.063  ns/op
   
       */
       
       @Benchmark
       public void toArray(Blackhole bh) throws InterruptedException {
           bh.consume(set.toArray(Keys10[]::new));
       }
   
       @Benchmark
       public void containsPos(Blackhole bh) throws InterruptedException {
           bh.consume(set.contains(Keys10.D));
       }
   
       @Benchmark
       public void containsNeg(Blackhole bh) throws InterruptedException {
           bh.consume(set.contains(Keys10.J));
       }
   
       public static void main(String[] args) throws RunnerException {
           
           Options opt = new OptionsBuilder()
                   .include(SetAndEnumSet.class.getSimpleName())
                   .resultFormat(ResultFormatType.JSON)
                   
.result("results/"+SetAndEnumSet.class.getSimpleName()+".json")
                   .param("variant", "EnumSet", "Set")
                   .build();
   
           new Runner(opt).run();
       }
   
   }
   
   ```
   
   </details>



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