public Object[] getAnnotations() { Document doc = txtEditorPane().getDocument(); DataObject dob = (DataObject)doc.getProperty(Document.StreamDescriptionProperty); JavaEditor edit = (JavaEditor) dob.getCookie(JavaEditor.class); ArrayList pa; try { Field annot = JavaEditor.class.getDeclaredField("annotations"); annot.setAccessible(true); pa = (ArrayList) annot.get(edit); } catch (NoSuchFieldException e) { throw new AssertionFailedErrorException(e); } catch (IllegalAccessException e) { throw new AssertionFailedErrorException(e); } return pa.toArray(); }