Flexible Type-Safe Linking of Components for Java-Like Languages