ElementHandle

Apache NetBeans Wiki Index

Note: These pages are being reviewed.

As was mentioned above, it is not possible to hold Elements, TypeMirrors and Trees and to compare instances got from different javac instances.

To solve this limitation, ElementHandle was introduced. The ElementHandle allows to pass an Element from one javac instance to another. In the first instance of javac, create the handle using ElementHandle.create(Element) method. Keep the resulting handle, but do not hold the element itself. In the other instance of javac, use ElementHandle.resolve(CompilationInfo) method to resolve the ElementHandle back to the Element.