BaseTypeRegistry implements WritableTypeRegistry { protected String finalTypename(String typeName, String programContext) { String qualifiedName = qualifiedTypenameInternal(typeName, programContext); if (typedefs.containsKey(qualifiedName)) { String resolved = typedefs.get(qualifiedName); return finalTypename(resolved, programContext); } return qualifiedName; } protected  BaseTypeRegistry(); @Override void registerTypedef(@Nonnull String identifier,
                                @Nonnull String program,
                                @Nonnull String target); @Nonnull @Override @SuppressWarnings("unchecked") PDescriptorProvider getProvider(@Nonnull String name,
                                           @Nonnull final String context,
                                           @Nullable Map<String, String> annotations); @Nonnull @Override PServiceProvider getServiceProvider(final String serviceName, final String programContext); @Override void registerRecursively(@Nonnull PService service); @Override void registerRecursively(PDeclaredDescriptor<T> declaredType);  }
@Test public void testFinalTypename() { assertEquals("double", registry.finalTypename("real", "number")); assertEquals("double", registry.finalTypename("number.real", "calculator")); assertEquals("list<double>", registry.finalTypename("list<real>", "number")); assertEquals("set<double>", registry.finalTypename("set<number.real>", "calculator")); assertEquals("list<number.Imaginary>", registry.finalTypename("list<I>", "number")); assertEquals("set<number.Imaginary>", registry.finalTypename("set<number.I>", "calculator")); assertEquals((PDeclaredDescriptor) Imaginary.kDescriptor, registry.getDeclaredType("I", "number")); assertEquals((PDeclaredDescriptor) Imaginary.kDescriptor, registry.getDeclaredType("number.I", "calculator")); }