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


##########
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:
   As far as I know the "+" operator is implemented with StringBuilder 
underneath (complier generates this code). so at least two allocations are 
required (one for StringBuilder internal buffer and another then its "toString" 
method is called.
   on top of that we have a loop executed every time text is appended to 
StringBuilder and one look then its toString method is called.
   in case of String.concat method only one allocation for the new string is 
needed and only one loop which copies characters to newly allocated string
   
   of course the compiler may actually implement this specific case using 
String.concat underneath and I may simply be not aware of this.
   
   anyway if performance is irrelevant, ignore this comment



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