/** * Returns a list of all loaded sources. The sources are returned in the order as they have been * loaded by the languages. * * @return an unmodifiable list of sources * @since 0.17 */ public List<Source> getLoadedSources() { final List<Source> sources = new ArrayList<>(); EventBinding<?> binding = env.getInstrumenter() .attachLoadSourceListener( SourceSectionFilter.ANY, new LoadSourceListener() { public void onLoad(LoadSourceEvent event) { sources.add(event.getSource()); } }, true); binding.dispose(); return Collections.unmodifiableList(sources); }