// Filter imported classes which are not available yet
Iterator<ImportNode> iter = source.getAST().getImports().iterator();
while (iter.hasNext()) {
ImportNode importedClass = iter.next();
if (!AstUtils.isVisible(source, importedClass.getClassName())) {
try {
Field field = ModuleNode.class.getDeclaredField("imports");
field.setAccessible(true);
Map value = (Map) field.get(source.getAST());
value.remove(importedClass.getAlias());
} catch (Exception e) {
throw UncheckedException.throwAsUncheckedException(e);
}
}
}
iter = source.getAST().getStaticImports().values().iterator();
while (iter.hasNext()) {
ImportNode importedClass = iter.next();
if (!AstUtils.isVisible(source, importedClass.getClassName())) {
iter.remove();
}
}
iter = source.getAST().getStaticStarImports().values().iterator();
while (iter.hasNext()) {
ImportNode importedClass = iter.next();
if (!AstUtils.isVisible(source, importedClass.getClassName())) {
iter.remove();
}
}
ClassNode scriptClass = AstUtils.getScriptClass(source);