An explanation of the key aspects to the place and purpose of nb-javac.
What is nb-javac?
"nb-javac" consists of two libraries that provide a NetBeans-specific fork of the Java JDK Java compiler, and is explicitly excluded by Oracle from the NetBeans code donation to Apache.
Where is nb-javac found in the NetBeans sources?
In the "java" cluster, see: Overview: NetBeans Structure
What does nb-javac do that's different to vanilla javac?
A few years back, the NetBeans team wrote a page describing what nb-javac does in addition to/differently to vanilla javac:
http://wiki.netbeans.org/JavacDiff
Looking at the page now, some of the things listed above are not part of nb-javac anymore (e.g., cancelling and some part of the error recovery paragraph) but it still gives a reasonable overview and is good to get an idea what kinds of things nb-javac does.
What is the reason that nb-javac is a fork and not part of the javac main repository?
- The pace at which javac/JDK moves and at which NetBeans moves is simply different. E.g., imagine a refactoring breaking a user's code because of error recovery misbehaving. Once the problem is found it may be fixed in nb-javac in hours or days. Fixing it in javac can easily take weeks or even months (and much more effort in testing and review).
- Even some changes that from the NetBeans point may look innocent may be hard to get into vanilla javac. For example, when javac detects a syntax error, it normally ends without getting to a semantic analysis. This does not work for an IDE (noone probably wants to lose almost all features just because a semicolon is missing). But it may be difficult to push through a fix to semantic analysis for a syntactically broken code (sometimes this passed before, other times, there was a pushback on such changes, depending on the nature of the change needed).
- Some of the changes in nb-javac may be very hard to get in unless there is another user than just NetBeans.