@Test public void shouldResolveDataType() { assertThat(resolver.getEntry(symbol("scotch.data.maybe.Maybe")).get().getDataType(), is(Optional.of(dataType( "scotch.data.maybe.Maybe", asList(toType(var("a"))), asList( constructor( 0, "scotch.data.maybe.Maybe", "scotch.data.maybe.Nothing", "scotch/data/maybe/Maybe$Nothing" ), constructor( 1, "scotch.data.maybe.Maybe", "scotch.data.maybe.Just", "scotch/data/maybe/Maybe$Just", asList(field(0, "value", "getValue", var("a"))) ) ) )))); }
@Override public Optional<SymbolEntry> getEntry(Symbol symbol) { search(symbol); if (namedSymbols.containsKey(symbol)) { return Optional.ofNullable(namedSymbols.get(symbol)); } else { return symbol.accept(new SymbolVisitor<Optional<SymbolEntry>>() { @Override public Optional<SymbolEntry> visit(QualifiedSymbol symbol) { return reExports.qualify(symbol).flatMap(ClassLoaderResolver.this::getEntry); } @Override public Optional<SymbolEntry> visit(UnqualifiedSymbol symbol) { return Optional.empty(); } }); } }
ClassLoaderResolver extends URLClassLoader implements SymbolResolver { @Override public Optional<SymbolEntry> getEntry(Symbol symbol) { search(symbol); if (namedSymbols.containsKey(symbol)) { return Optional.ofNullable(namedSymbols.get(symbol)); } else { return symbol.accept(new SymbolVisitor<Optional<SymbolEntry>>() { @Override public Optional<SymbolEntry> visit(QualifiedSymbol symbol) { return reExports.qualify(symbol).flatMap(ClassLoaderResolver.this::getEntry); } @Override public Optional<SymbolEntry> visit(UnqualifiedSymbol symbol) { return Optional.empty(); } }); } } }
ClassLoaderResolver extends URLClassLoader implements SymbolResolver { @Override public Optional<SymbolEntry> getEntry(Symbol symbol) { search(symbol); if (namedSymbols.containsKey(symbol)) { return Optional.ofNullable(namedSymbols.get(symbol)); } else { return symbol.accept(new SymbolVisitor<Optional<SymbolEntry>>() { @Override public Optional<SymbolEntry> visit(QualifiedSymbol symbol) { return reExports.qualify(symbol).flatMap(ClassLoaderResolver.this::getEntry); } @Override public Optional<SymbolEntry> visit(UnqualifiedSymbol symbol) { return Optional.empty(); } }); } } ClassLoaderResolver(Optional<File> optionalOutputPath, ClassLoader parent);  ClassLoaderResolver(Optional<File> optionalOutputPath, URL[] urls, ClassLoader parent); }
ClassLoaderResolver extends URLClassLoader implements SymbolResolver { @Override public Optional<SymbolEntry> getEntry(Symbol symbol) { search(symbol); if (namedSymbols.containsKey(symbol)) { return Optional.ofNullable(namedSymbols.get(symbol)); } else { return symbol.accept(new SymbolVisitor<Optional<SymbolEntry>>() { @Override public Optional<SymbolEntry> visit(QualifiedSymbol symbol) { return reExports.qualify(symbol).flatMap(ClassLoaderResolver.this::getEntry); } @Override public Optional<SymbolEntry> visit(UnqualifiedSymbol symbol) { return Optional.empty(); } }); } } ClassLoaderResolver(Optional<File> optionalOutputPath, ClassLoader parent);  ClassLoaderResolver(Optional<File> optionalOutputPath, URL[] urls, ClassLoader parent); static ClassLoaderResolver resolver(Optional<File> optionalOutputPath); Class<?> define(GeneratedClass generatedClass); List<Class<?>> defineAll(List<GeneratedClass> generatedClasses); @Override Optional<SymbolEntry> getEntry(Symbol symbol); @Override Set<TypeInstanceDescriptor> getTypeInstances(Symbol symbol, List<TypeDescriptor> types); @Override Set<TypeInstanceDescriptor> getTypeInstancesByModule(String moduleName); }
ClassLoaderResolver extends URLClassLoader implements SymbolResolver { @Override public Optional<SymbolEntry> getEntry(Symbol symbol) { search(symbol); if (namedSymbols.containsKey(symbol)) { return Optional.ofNullable(namedSymbols.get(symbol)); } else { return symbol.accept(new SymbolVisitor<Optional<SymbolEntry>>() { @Override public Optional<SymbolEntry> visit(QualifiedSymbol symbol) { return reExports.qualify(symbol).flatMap(ClassLoaderResolver.this::getEntry); } @Override public Optional<SymbolEntry> visit(UnqualifiedSymbol symbol) { return Optional.empty(); } }); } } ClassLoaderResolver(Optional<File> optionalOutputPath, ClassLoader parent);  ClassLoaderResolver(Optional<File> optionalOutputPath, URL[] urls, ClassLoader parent); static ClassLoaderResolver resolver(Optional<File> optionalOutputPath); Class<?> define(GeneratedClass generatedClass); List<Class<?>> defineAll(List<GeneratedClass> generatedClasses); @Override Optional<SymbolEntry> getEntry(Symbol symbol); @Override Set<TypeInstanceDescriptor> getTypeInstances(Symbol symbol, List<TypeDescriptor> types); @Override Set<TypeInstanceDescriptor> getTypeInstancesByModule(String moduleName);  }