On Fri, Oct 6, 2017 at 8:46 AM, Ryan Cuprak <[email protected]> wrote:
> Hello,
> I have been poking around the NetBeans code and had a
> request/idea.NetBeans is a good size codebase and there is a lot of history
> in the code. One of the challenges with such a large code base is that
> adding features or fixing defects can be daunting. Where is the code for
> feature X, why was it implemented this way, what are the ripple effects of
> changes, what approach wasn’t taken but which should be taken, what tests
> need to be re-run etc.
>
> I’d like to propose:
> 1. Construct a list of individuals that have special knowledge for the
> different modules (basically a goto list for deep questions).
> 2. Mentoring to help new developers work on the code base and
> implement/fix defects (provide guidance).
> 2. Organize training sessions (virtually or at conferences) to ramp up
> new developers on the core NetBeans IDE code base. Go over the code
> structure, what algorithms and were used and why, where are the skeletons,
> etc.
>
> Sitting through the keynote at J1 when Brian Goetz was going over the new
> features in the language I was wondering how one would know where to look
> to implement these changes (and not break something). How would you
> decompose a new language feature into a list of tasks in the IDE code base.
>
So, on adding support for new Java language features: the NetBeans support
for the Java language is based on the javac (the JDK's Java compiler).
javac is providing the model (AST) for the Java source code, and the IDE
features are based on that. In fact, NetBeans has a patched copy of javac,
called nb-javac. Tranditionally(*), adding a support for a new language
feature started with merging nb-javac and the given JDK's javac branch to
get the proper model and then build IDE features based on that. To some
extent the features can be changed incrementally/separately, except for
some classes in java.source{.base} and a few more modules (typically
ImmutableTreeTranslator[0] and the adjacent TreeDuplicator; it would be
best if we could get rid of the latter and have just the ITT). Features
that may need changes include: code generation[1], code completion[2],
lexer[3], semantic highlighting[4], mark occurrences[5], and hints (see the
java.hints module).
I have some prototypes for LVTI and patterns on my laptop, slowly trying to
get to a state where that could be put on a branch, so that it could be
shared.
(*) There is a jdk-javac branch in the Apache NetBeans repository that
allows to use the runtime JDK's javac instead of nb-javac. At the cost of
some more maintenance, (probably) somewhat more complex testing and some
limitations. nb-javac can still be used there to improve the experience.
Jan
[0]
https://git-wip-us.apache.org/repos/asf?p=incubator-netbeans.git;a=blob;f=java.source.base/src/org/netbeans/modules/java/source/transform/ImmutableTreeTranslator.java;hb=3814587fcc8ae6712840b2d6c78126cb02b641e7
[1]
https://git-wip-us.apache.org/repos/asf?p=incubator-netbeans.git;a=blob;f=java.source.base/src/org/netbeans/modules/java/source/save/CasualDiff.java;hb=3814587fcc8ae6712840b2d6c78126cb02b641e7
[2]
https://git-wip-us.apache.org/repos/asf?p=incubator-netbeans.git;a=blob;f=java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java;hb=3814587fcc8ae6712840b2d6c78126cb02b641e7
[3]
https://git-wip-us.apache.org/repos/asf?p=incubator-netbeans.git;a=blob;f=java.lexer/src/org/netbeans/lib/java/lexer/JavaLexer.java;hb=3814587fcc8ae6712840b2d6c78126cb02b641e7
[4]
https://git-wip-us.apache.org/repos/asf?p=incubator-netbeans.git;a=blob;f=java.editor.base/src/org/netbeans/modules/java/editor/base/semantic/SemanticHighlighterBase.java;hb=3814587fcc8ae6712840b2d6c78126cb02b641e7
[5]
https://git-wip-us.apache.org/repos/asf?p=incubator-netbeans.git;a=blob;f=java.editor.base/src/org/netbeans/modules/java/editor/base/semantic/MarkOccurrencesHighlighterBase.java;hb=3814587fcc8ae6712840b2d6c78126cb02b641e7
>
> -Ryan
>