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


##########
nbbuild/antsrc/org/netbeans/nbbuild/CustomJavac.java:
##########
@@ -226,12 +226,16 @@ private void cleanUpDependDebris() {
                 continue;
             }
             int i = clazz.indexOf('$');
-            File enclosing = new File(d, clazz.substring(0, i) + ".class");
-            if (!enclosing.isFile()) {
-                File enclosed = new File(d, clazz);
-                log(clazz + " will be deleted since " + enclosing.getName() + 
" is missing", Project.MSG_VERBOSE);
-                if (!enclosed.delete()) {
-                    throw new BuildException("could not delete " + enclosed, 
getLocation());
+            // ignore filenames that start right with '$' (separatorChar 
preceded), these could not be inner classes.
+            if (i > 0 && clazz.charAt(i - 1) != File.separatorChar) {
+                File enclosing = new File(d, clazz.substring(0, i) + ".class");

Review Comment:
   i have also an older JMH benchmark to offer:
   ```java
   @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 ConcatJMH {
   
       int i = 0;
   
       @Setup(Iteration)
       public void setup() {
           i = 0;
       }
   
       @Benchmark
       public void chain(Blackhole bh) {
           StringBuilder sb = new StringBuilder();
           sb.append("a");
           sb.append("[").append(i).append("]");
           sb.append("c");
           bh.consume(sb.toString());
       }
   
       @Benchmark
       public void mix(Blackhole bh) {
           StringBuilder sb = new StringBuilder();
           sb.append("a");
           sb.append("["+i+"]");
           sb.append("c");
           bh.consume(sb.toString());
       }
   
       @Benchmark
       public void plus(Blackhole bh) {
           bh.consume("a"+"["+i+"]"+"c");
       }
   
       @Benchmark
       public void concat(Blackhole bh) {
           
bh.consume("a".concat("[").concat(String.valueOf(i)).concat("]").concat("c"));
       }
   
       public static void main(String[] args) throws RunnerException {
           
           Options opt = new OptionsBuilder()
                   .include(ConcatJMH.class.getSimpleName())
                   .resultFormat(ResultFormatType.JSON)
                   .result("results/"+ConcatJMH.class.getSimpleName()+".json")
                   .build();
   
           new Runner(opt).run();
   
       }
   }
   ```
   results on JDK 19:
   ```
   [stdout] Benchmark         Mode  Cnt   Score    Error  Units
   [stdout] ConcatJMH.chain   avgt    5   8.471 ±  2.516  ns/op
   [stdout] ConcatJMH.concat  avgt    5  13.055 ± 18.248  ns/op
   [stdout] ConcatJMH.mix     avgt    5  20.502 ±  9.329  ns/op
   [stdout] ConcatJMH.plus    avgt    5   5.342 ±  1.755  ns/op
   ```
   
   good old '+' wins hands down :)



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