Author: limpbizkit
Date: Thu Oct 16 11:18:10 2008
New Revision: 641
Added:
tags/snapshot20081016/
- copied from r640, /trunk/
tags/snapshot20081016/src/com/google/inject/ProviderMethods.java
Modified:
tags/snapshot20081016/src/com/google/inject/Guice.java
tags/snapshot20081016/src/com/google/inject/internal/ProviderMethodsModule.java
Log:
Changes since 20080818:
Bindings discovered via @ProvidedBy and @ImplementedBy now wrap thrown
RuntimeExceptions in a ProvisionException. If you explicitly catch a
specific subtype of RuntimeException that is thrown by Guice, please ensure
the catch blocks are test covered.
Parent injectors have been completely rewritten. Bindings, scopes,
interceptors, type and converters are now inherited. They now disallow
parent and child injectors from having conflicting bindings for the same
key.
There's a new private modules feature. Inspired by dhalem's
ExportedModules, these allow you to better encapsulate bindings as
implementation details. These leverage parent injectors to support
arbitrary nesting of modules. Private modules will also inherit
just-in-time bindings, interceptors, type converters, and scopes.
Assistedinject factories no longer explode on toString() (by jmourits).
Singletons discovered while injecting just-in-time singletons no longer
pose a potential ConcurrentModificationException (by dtm).
114 new test cases for combinations of scopes, bind targets, and results.
Removed oldversion SPI and commands.
SPI now includes separate InjectionPoints and Dependency models. The
HasInjections interface has been removed, replaced with a
Set<InjectionPoint>.
Configuration errors and runtime errors now use similar syntax, avoiding
the 'unknown source' problem.
@Provides methods in modules continue to be discovered automatically.
ProviderMethods is now deprecated, most calls to it can be removed.
TypeLiteral is no longer Serializable, which was causing unnecessary
warnings in anonymous inner TypeLiterals (by benyu).
Modified: tags/snapshot20081016/src/com/google/inject/Guice.java
==============================================================================
--- /trunk/src/com/google/inject/Guice.java (original)
+++ tags/snapshot20081016/src/com/google/inject/Guice.java Thu Oct 16
11:18:10 2008
@@ -94,4 +94,23 @@
.addModules(modules)
.build();
}
+
+ /** @deprecated replaced with [EMAIL PROTECTED]
Injector#createChildInjector(Iterable)}. Inline this. */
+ @Deprecated
+ public static Injector createInjector(Injector parent, Iterable<?
extends Module> modules) {
+ return parent.createChildInjector(modules);
+ }
+
+ /** @deprecated replaced with [EMAIL PROTECTED]
Injector#createChildInjector(Module[])}. Inline this. */
+ @Deprecated
+ public static Injector createInjector(Injector parent, Module...
modules) {
+ return parent.createChildInjector(modules);
+ }
+
+ /** @deprecated replaced with [EMAIL PROTECTED]
Injector#createChildInjector(Iterable)}. Inline this. */
+ @Deprecated
+ public static Injector createInjector(Injector parent, Stage stage,
+ Iterable<? extends Module> modules) {
+ return parent.createChildInjector(modules);
+ }
}
Added: tags/snapshot20081016/src/com/google/inject/ProviderMethods.java
==============================================================================
--- (empty file)
+++ tags/snapshot20081016/src/com/google/inject/ProviderMethods.java Thu
Oct 16 11:18:10 2008
@@ -0,0 +1,36 @@
+/**
+ * Copyright (C) 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.inject;
+
+import com.google.inject.internal.ProviderMethodsModule;
+
+/**
+ * @author [EMAIL PROTECTED] (Jesse Wilson)
+ */
[EMAIL PROTECTED]
+public class ProviderMethods {
+
+ /**
+ * @deprecated provider methods are automatically discovered on Modules.
Ensure the argument
+ * implements Module, and install that. If you're installing the
provider methods for the
+ * current module, you can remove the install() call completely -
it does nothing.
+ */
+ @Deprecated
+ public static Module from(Object hasProviderMethods) {
+ return ProviderMethodsModule.forModule(hasProviderMethods);
+ }
+}
Modified:
tags/snapshot20081016/src/com/google/inject/internal/ProviderMethodsModule.java
==============================================================================
--- /trunk/src/com/google/inject/internal/ProviderMethodsModule.java
(original)
+++
tags/snapshot20081016/src/com/google/inject/internal/ProviderMethodsModule.java
Thu Oct 16 11:18:10 2008
@@ -39,10 +39,10 @@
* @author [EMAIL PROTECTED] (Bob Lee)
*/
public final class ProviderMethodsModule implements Module {
- private final Module delegate;
+ private final Object delegate;
private final TypeResolver typeResolver;
- private ProviderMethodsModule(Module delegate) {
+ private ProviderMethodsModule(Object delegate) {
this.delegate = checkNotNull(delegate, "delegate");
this.typeResolver = new TypeResolver(this.delegate.getClass());
}
@@ -50,7 +50,7 @@
/**
* Returns a module which creates bindings for provider methods from the
given module.
*/
- public static Module forModule(Module module) {
+ public static Module forModule(Object module) {
// avoid infinite recursion, since installing a module always installs
itself
if (module instanceof ProviderMethodsModule) {
return Modules.EMPTY_MODULE;
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"google-guice-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-guice-dev?hl=en
-~----------~----~----~----~------~----~------~--~---