Overview
When working with the Java related APIs in the NetBeans IDE we recommend making yourself familiar with some of the basic concepts which are used. The APIs are based directly on the APIs of the javac compiler. Some of the APIs are taken directly from javac. Some are added in order to integrate javac into the IDE properly and in order to supply functionality not provided by javac (e.g. modifying code). Being able to understand the basic of how javac works also helps.
Please note that there are some pitfalls when using these APIs. Make sure you know what these are and how to detect basic mistakes (both described later in the text) in order to not harm the performance of the IDE.
The essential packages a module writer will be interested in are:
-
javax.lang.model.element, javax.lang.model.type, javax.lang.model.util. - For reading high level java language elements (classes, methods, fields, …) and for working with types. These are the same APIs as those used for writing annotation processors (AKA JSR269).
-
com.sun.source.tree, com.sun.source.util - For reading the syntactic structure of a java source i.e. AST (Abstract Syntax Trees)
-
org.netbeans.java.source, org.netbeans.java.source.support - For integration with the IDE, additional utility methods and doing source code modifications.