please don't reformat the code base :)

there is some room for periodic code cleanups which includes warning fixes and general code improvements, but reviews quickly become *very* time intensive since it is often not trivial to make sure that this isn't causing regressions.

Formatting changes itself entail side effects like being noise while using 'git blame' etc.

thanks && best regards,

-mbien


On 29.03.23 14:57, Jeremy Cavanagh wrote:
Hi Everyone,

It's been quite a while since I have interacted with the group. First of all 
may I congratulate everyone on the tremendous effort producing repeatedly 
better versions of NetBeans. Secondly, may I apologise for the length of this 
email.

I suspect that everyone has forgotten my last email where I personally found 
the source code hard to read and was going to embark upon an attempt to 
reformat it. Well, that has turned out to be a significant task requiring a 
great deal of manual intervention.

Originally, I started with 12.1 but soon gave up when 12.2, 12.3 etc rolled on 
rapidly. So I restarted at version 13. However, not really understanding the 
structure I began with the ide cluster and after a lot of fumbling around 
decided that this wasn't the right place and moved to the harness and platform.

Like Alice I fell down a rabbit hole into a veritable wonderland of confusion 
and surprises.

A simple, so I thought, reformat turned into:

- Reformat to improve readability.
- Correct inconsistent formatting within files.
- Introduce a consistent use of comments:

/**
Javadoc
*/
/*
inline (not end of line) code comments
*/
// Commented out code.

- Remove unused imports and use single class imports not * imports.
- Update code to be JDK11 compatible - gives cleaner code. Plus this had 
already been made the minimum requirement for compiling and running the IDE.
- Tried to make code GREEN by eliminating as many errors as possible (warnings 
are just soft errors).
- Eliminate, where possible, all obsolete code and preferably deprecated code. 
That's easier said than done.
- Make fields final where possible.
- Reduce the use of 'else if', I've never really been a fan but I particularly 
dislike the lack of a proper implementation of it in Java.
- Make return values unmodifiable where necessary/possible.
- Make full use of the internal formatter to handle formatting and reduce, as 
much as possible, any manual intervention.
- Remove unnecessary decoration.
- Replace anonymous inner classes with lambda expressions where possible.
- Remove 'unused assigned values'.
- Change conditional statements from:
testing a value against a variable, to:
testing a variable against a value.

- This includes:
-  ==, != and equals.
- Parameters (in my language formal parameters) should be read from and never 
written to within the method body. Parameters are input to the method while 
return values and side-effects are the output from the method.
- Correct 'inefficient use of string concatenation in logger'.
- Constant name does not follow naming conventions.

Plus many more...

A lot of these where highlighted by the static analyser and therefore were not 
particularly arduous to deal with.

However, the whole process (as yet unfinished) has been time consuming, I have 
visited some 5000 Java files and many have required multiple passes to deal 
with all the problems. I estimate that it has taken me approximately 8 hours a 
day, 7 days a week for 12 months.

But, I have now reached a point where I have some problems that I cannot find a 
solution for and need your help/guidance.

First, a few of the packages (17 of 114) in platform give me the error message 
"cannot find item" and in some cases they are in the same package?

Secondly, I cannot compile anything and therefore cannot test anything. I get 
the error message:

ant -f /Users/jeremycavanagh/netbeans-jc-cleaned/platform/api.io 
-Djavac.includes=org/netbeans/api/io/Fold.java compile-single
init-tasks:
/Users/jeremycavanagh/netbeans-jc-cleaned/nbbuild/default.xml:31: taskdef class 
org.netbeans.nbbuild.JNLPUpdateManifestStartup cannot be found
using the classloader AntClassLoader[]
BUILD FAILED (total time: 0 seconds)

I can only assume that my setup is incorrect for dealing with the NetBeans 
source. I am using the source download for NB13 and have not changed anything 
other than Java files.

Kindest regards

Jeremy



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org
For additional commands, e-mail: dev-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Reply via email to