Search in sources :

Example 61 with ConfigurationException

use of com.google.inject.ConfigurationException in project google-gin by gwtplus.

the class FactoryBindingTest method testMismatchedFactoryAndClassAnnotations.

public void testMismatchedFactoryAndClassAnnotations() {
    try {
        new FactoryBinding(Collections.<Key<?>, TypeLiteral<?>>emptyMap(), Key.get(MismatchedFactoryAndClassAssistedValuesFactory.class), CONTEXT, new GuiceUtil(createInjectableCollector()), null);
        fail("Expected ConfigurationException.");
    } catch (ConfigurationException e) {
        assertTrue(e.getMessage(), e.getMessage().contains("has no constructors matching " + "the parameters in method"));
    }
}
Also used : GuiceUtil(com.google.gwt.inject.rebind.util.GuiceUtil) ConfigurationException(com.google.inject.ConfigurationException)

Example 62 with ConfigurationException

use of com.google.inject.ConfigurationException in project google-gin by gwtplus.

the class BindingsProcessor method createBindingsForFactories.

private void createBindingsForFactories(GinjectorBindings bindings) {
    for (final FactoryModule<?> factoryModule : bindings.getFactoryModules()) {
        FactoryBinding binding;
        try {
            binding = bindingFactory.getFactoryBinding(factoryModule.getBindings(), factoryModule.getFactoryType(), Context.forText(factoryModule.getSource()));
        } catch (ConfigurationException e) {
            errorManager.logError("Factory %s could not be created", e, factoryModule.getFactoryType());
            continue;
        }
        bindings.addBinding(factoryModule.getFactoryType(), binding);
    }
}
Also used : ConfigurationException(com.google.inject.ConfigurationException) FactoryBinding(com.google.gwt.inject.rebind.binding.FactoryBinding)

Aggregations

ConfigurationException (com.google.inject.ConfigurationException)62 Injector (com.google.inject.Injector)16 Errors (com.google.inject.internal.Errors)13 InjectionPoint (com.google.inject.spi.InjectionPoint)8 Method (java.lang.reflect.Method)7 AbstractModule (com.google.inject.AbstractModule)5 Inject (com.google.inject.Inject)5 ErrorsException (com.google.inject.internal.ErrorsException)5 Annotation (java.lang.annotation.Annotation)5 TypeLiteral (com.google.inject.TypeLiteral)4 Map (java.util.Map)4 ImmutableMap (com.google.common.collect.ImmutableMap)3 GuiceUtil (com.google.gwt.inject.rebind.util.GuiceUtil)3 Module (com.google.inject.Module)3 Message (com.google.inject.spi.Message)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Test (org.junit.Test)3 ImmutableSet (com.google.common.collect.ImmutableSet)2 Binding (com.google.inject.Binding)2