85f14e03ee00b20e20fd0f018a00ef52fcf909b1 |
|
25-Feb-2015 |
sameb <sameb@google.com> |
Further fixes for https://github.com/google/guice/issues/904 -- java8 generates default methods for subclasses when they override generic methods with the more specific type. We use a two-tiered approach to fixing: (1) try to use MethodHandles + unreflectSpecial, which lets us call default method implementations directly, and if that doesn't work then (2) try to map default methods to compatible method signatures that could be the overrides of the method. (1) may not always work because we're using a private API [new Lookup(clazz, int)], but we need to do that in order to non-public classes. (2) may not always work because it's possible to have more than one compatible method signature. In the unlikely case that both (1) & (2) fail, we give an error message. Also: we must validate the default method's return type for visibility vs the factory type's visibility too. This ends up with two possible differences caused by java8: a) If the Lookup cxtor can't be used (different JDK, version skew, etc..) and there's more than one compatible method signature: we fail. b) If the default method's return type isn't public but the factory is public: we fail. For reference, javac8 generates a default method in the following scenario: interface Parent<I extends CharSequence, O extends Number> { O create(I input); } interface Child<String, Integer> { Integer create(String input); } Child has a generated default method of: Number create(CharSequence input); ... so, for example, failure could be newly triggered if 'Number' was package-private but Child was public, or if the reflection APIs didn't work and Child also had a 'Integer create(StringBuilder input);' method. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=87097207
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
a36310535c69e68b25d74b49ee9f9442abebd954 |
|
18-Feb-2015 |
sameb <sameb@google.com> |
Fix https://github.com/google/guice/issues/904 -- assistedinject factory method scanning did not ignore synthetic methods created by java8, leading to errors when the factory interface extended from a superinterface that had generics. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=86628771
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
c00df28be8bfa45b2bdc8b4d3c101c20a9cbdc12 |
|
01-Jul-2014 |
Sam Berlin <sameb@google.com> |
Automated code cleanups by internal tool. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=69390543
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
a23bc0e97c2a45f47b55e1cb9a7edb0d41c2ef76 |
|
03-May-2014 |
Sam Berlin <sameb@google.com> |
Implement hashCode and equals in FactoryProvider/FactoryProvider2, with the aim of allowing Guice to dedupe bindings. Reroll of earlier change with a bug fixed. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=65611245
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
20dd9afe0aa02f92cb642bc0c88f920799e6a7c5 |
|
03-May-2014 |
Sam Berlin <sameb@google.com> |
Automated rollback. *** Reason for rollback *** equals method too liberal in what can be equal *** Original change description *** Implement hashCode and equals in FactoryProvider/FactoryProvider2, with the aim of allowing Guice to dedupe bindings. Also fixed a bunch of niggly Eclipse warnings, but this will be easy to remove if it's not wanted. *** ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=65608468
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
615f61f109f39b81f1c87b70b24080c578f00c04 |
|
03-May-2014 |
Sam Berlin <sameb@google.com> |
Implement hashCode and equals in FactoryProvider/FactoryProvider2, with the aim of allowing Guice to dedupe bindings. Also fixed a bunch of niggly Eclipse warnings, but this will be easy to remove if it's not wanted. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=65607792
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
9e2d95b4393bd41b7eb882705d208124e2a4dd18 |
|
27-Jun-2013 |
Christian Edward Gruber <cgruber@google.com> |
Clean up some formatting (includes some format artifacts from internal changes), and remove executable bit from several files which do not need them.
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
8f196358f5a494f974a741b5a982f96f03171223 |
|
16-May-2013 |
Christian Edward Gruber <cgruber@google.com> |
Add logging for when AssistedInject falls into non-optimized mode, so people can take action and fix it. An @Assisted Provider in a class param: WARNING: AssistedInject factory com.google.inject.assistedinject.FactoryProvider2Test$ColoredCarFactory will be slow because class com.google.inject.assistedinject.FactoryProvider2Test$Subaru has Assisted Provider dependencies or injects the Injector. Stop injecting Assisted Provider<T> (instead use Assisted T) or Injector to speed things up. (It will be a ~6500% speed bump!) The exact offending deps are: [Key[type=com.google.inject.Provider<com.google.inject.assistedinject.FactoryProvider2Test$Color>, annotation=@com.google.inject.assistedinject.Assisted(value=)]@com.google.inject.assistedinject.FactoryProvider2Test$Subaru.colorProvider] The injector in class param: WARNING: AssistedInject factory com.google.inject.assistedinject.FactoryProvider2Test$ColoredCarFactory will be slow because class com.google.inject.assistedinject.FactoryProvider2Test$Segway has Assisted Provider dependencies or injects the Injector. Stop injecting Assisted Provider<T> (instead use Assisted T) or Injector to speed things up. (It will be a ~6500% speed bump!) The exact offending deps are: [Key[type=com.google.inject.Injector, annotation=[none]]@com.google.inject.assistedinject.FactoryProvider2Test$Segway.injector] An @Assisted Provider in a constructor arg: WARNING: AssistedInject factory com.google.inject.assistedinject.FactoryProvider2Test$ColoredCarFactory will be slow because class com.google.inject.assistedinject.FactoryProvider2Test$Flamingbird has Assisted Provider dependencies or injects the Injector. Stop injecting Assisted Provider<T> (instead use Assisted T) or Injector to speed things up. (It will be a ~6500% speed bump!) The exact offending deps are: [Key[type=com.google.inject.Provider<com.google.inject.assistedinject.FactoryProvider2Test$Color>, annotation=@com.google.inject.assistedinject.Assisted(value=)]@com.google.inject.assistedinject.FactoryProvider2Test$Flamingbird.<init>()[1]] ---------------- Manually Synced. COMMIT=45725763
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
9f8b438b370a688cd393983abf29aa00344795a4 |
|
16-May-2013 |
Christian Edward Gruber <cgruber@google.com> |
Use a single UniqueAnnotation instead of creating a new one each time. ----------------- Manually Synced. COMMIT=45708839
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
e39158525475eca7971966c667494d240be7e242 |
|
16-May-2013 |
Christian Edward Gruber <cgruber@google.com> |
Change Key so that it upgrades Annotation classes where all methods have default values into an instance of the Annotation with the defaults as values, so that: @Retention(RUNTIME) @BindingAnnotation @interface AllDefaults { int hasDefault() default 1; } @AllDefaults class Foo {} void testKey() { assertEquals(Key.get(Foo.class, Foo.class.getAnnotation(AllDefaults.class)), Key.get(Foo.class, AllDefaults.class)); } Also adds an option to "require exact binding annotations", which disables the error-prone fallback built into Guice whereby a binding for @Named Foo can substitute for @Named("foo") Foo if the latter doesn't exist but the former does. ----------------- Manually Synced. COMMIT=45600016
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
45d86df69be98dc64a455e397ae6c492f803771e |
|
16-May-2013 |
Christian Edward Gruber <cgruber@google.com> |
Fix http://code.google.com/p/google-guice/issues/detail?id=742 by having assistedinject fail if the target implementation class has a scop ing annotation on it. Scope annotations on assistedinject targets were always ignored by Guice, and allowing them on the classes led to lots of confusion when reading code. The new behavior makes for much more readable code. This could potentially cause runtime errors at injector creation time if you accidentally had scoping annotations on the implementation class. The fix is just to remove that scoping annotation -- there will be no change in behavior, because the scope was ignored. There is an extreme edge case where this change may cause a problem, but it creates sufficiently confusing code that we are OK with turning it into a failure: You used assistedinject yet had no assisted parameters, and sometimes injected the object directly and other times constructed it through the factory. When injecting directly, it would adhere to the scope, but when constructing through the factory it would create a new instance every time. ... If you *really* wanted this behavior, the workaround would be to bind using toConstructor in Scopes.NO_SCOPE to a named(unscoped) version of the class, which is also more expressive. (But, more often than not, what you really wanted was to *not do this*.) ------------------ Manually Synced. COMMIT=43242119
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
b7a02b02d81c830d148355c90bc309bcd66fb592 |
|
08-Jul-2011 |
sberlin <sberlin@d779f126-a31b-0410-b53b-1d3aecad763e> |
* Remove unused imports * Sort imports * Convert tabs to spaces * Fix the ant no_aop build Revision created by MOE tool push_codebase. MOE_MIGRATION=2532 git-svn-id: https://google-guice.googlecode.com/svn/trunk@1572 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
d9c913acca55023ef5d76a32c3d4a51ee6b420cb |
|
26-Jun-2011 |
sberlin <sberlin@d779f126-a31b-0410-b53b-1d3aecad763e> |
switch Guice from manually repackaging Guava to depending on Guava. it's still jarjar'd right now, which is causing a ~400k increase in guice-snapshot.jar. next step is to switch to ProGuard to remove the unnecessary code and cut it back down (even further?!). this will let people build from Guice source and depend directly on Guava code without having to worry about hiding internal/util. git-svn-id: https://google-guice.googlecode.com/svn/trunk@1558 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
23cf2d4f4944389bd0d9a9dc9ac9a1bcbce5584f |
|
29-Jan-2011 |
sberlin <sberlin@d779f126-a31b-0410-b53b-1d3aecad763e> |
fix issue 594 -- assistedinject does the wrong thing if assisted type is scoped. git-svn-id: https://google-guice.googlecode.com/svn/trunk@1483 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
2ef22666df8b6f32425edb45e56ec60c9ab5b7ba |
|
25-Oct-2010 |
sberlin <sberlin@d779f126-a31b-0410-b53b-1d3aecad763e> |
issue 428 - better error validation for AssistedInject, specifically with public factories & non-public method return types that can lead to IllegalAccessErrors. git-svn-id: https://google-guice.googlecode.com/svn/trunk@1316 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
287355590aa8ad2d87f8ebfac3a0710e3b442c27 |
|
17-Oct-2010 |
sberlin <sberlin@d779f126-a31b-0410-b53b-1d3aecad763e> |
flip the order of the type parameters in ProviderWithExtensionVisitor to match the order in the BindingTargetVisitor. git-svn-id: https://google-guice.googlecode.com/svn/trunk@1294 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
4b91955979afbbfff317b36af89b6bd1a1aa9b47 |
|
17-Oct-2010 |
sberlin <sberlin@d779f126-a31b-0410-b53b-1d3aecad763e> |
patch from ramakrishna (with very minor changes from me) for an extension SPI for assisted inject. git-svn-id: https://google-guice.googlecode.com/svn/trunk@1293 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
b199afd5c1da15c2bc8a9f223a8d0b7b6266aa1d |
|
23-Sep-2010 |
sberlin <sberlin@d779f126-a31b-0410-b53b-1d3aecad763e> |
new AssistedInject factories now implement HasDependencies (like the old assistedinject factories) git-svn-id: https://google-guice.googlecode.com/svn/trunk@1271 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
b5a75ed3c72d772e7dc9f771a63b3e7226695919 |
|
31-Jul-2010 |
sberlin <sberlin@d779f126-a31b-0410-b53b-1d3aecad763e> |
issue 506 - fail fast & with a useful error message when an AssistedInject factory has Provider<T> as a factory type. patch ( slightly modified) by ffaber. git-svn-id: https://google-guice.googlecode.com/svn/trunk@1192 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
88f9a14dc9fa9f6704f8a86e376b7f218e492f98 |
|
17-Jul-2010 |
sberlin@gmail.com <sberlin@gmail.com@d779f126-a31b-0410-b53b-1d3aecad763e> |
remove confusing behavior from assistedinject -- it used to allow factory creations to be resolved by the injector if the return key matched something in the injector. now it always creates new objects. the prior behavior created a scenario where, if the following pseudo-code was used... public class Bar { ... } interface BarFactory { Bar createBar(...); } ... protected void configure() { // allow custom Bars to be created if using BarFactory install(new FactoryModuleBuilder().build(BarFactory.class)); } @Provides Bar defaultBar() { // allow a default value return new Bar(...); } ...Someone wants to allow default Bars to be injected AND create custom ones if using BarFactory. But, AssistedInject didn't actually do that. When someone called BarFactory.create(...), it returned the bar created from the @Provides method, because AssistedInject saw the main injector had a binding for Bar. This removes that behavior, so AssistedInject will always create a new Bar when its factory method is called. git-svn-id: https://google-guice.googlecode.com/svn/trunk@1189 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
9a227bef3b82a045323ef2cf38ec60b2e42cf0fe |
|
03-Jul-2010 |
limpbizkit@gmail.com <limpbizkit@gmail.com@d779f126-a31b-0410-b53b-1d3aecad763e> |
Move internal utility code to separate package. These files have moved from c.g.i.internal to c.g.i.internal.util. Visibility has been increased when necessary. AbstractIterator.java AbstractMapEntry.java AsynchronousComputationException.java Classes.java Collections2.java ComputationException.java CustomConcurrentHashMap.java ExpirationTimer.java FinalizablePhantomReference.java FinalizableReference.java FinalizableReferenceQueue.java FinalizableSoftReference.java FinalizableWeakReference.java Finalizer.java Function.java Hashing.java ImmutableCollection.java ImmutableEntry.java ImmutableList.java ImmutableMap.java ImmutableSet.java Iterables.java Iterators.java Join.java LineNumbers.java Lists.java MapMaker.java Maps.java NullOutputException.java ObjectArrays.java Objects.java Preconditions.java Sets.java SourceProvider.java StackTraceElements.java Stopwatch.java Strings.java ToStringBuilder.java UnmodifiableIterator.java The rest of this change is just imports changes. Thanks to Max Bowsher for the idea. git-svn-id: https://google-guice.googlecode.com/svn/trunk@1185 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
3748e4a0979e6332ab9f0a3601ab5b8e595b7a12 |
|
23-May-2010 |
sberlin <sberlin@d779f126-a31b-0410-b53b-1d3aecad763e> |
issue 329 - cleanup error message for under-specified assistedinject factory. git-svn-id: https://google-guice.googlecode.com/svn/trunk@1165 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
af9a4df94a042856eacd99e9ce4dcdf4cd6eb5dd |
|
11-May-2010 |
sberlin <sberlin@d779f126-a31b-0410-b53b-1d3aecad763e> |
fixes issue 478. git-svn-id: https://google-guice.googlecode.com/svn/trunk@1159 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
f7ac6ea677ccfff6c3bec7db1d3621e6b6cf4097 |
|
09-May-2010 |
sberlin <sberlin@d779f126-a31b-0410-b53b-1d3aecad763e> |
Patches to let Guice be more OSGi (and classloader) friendly. Solves issue 439, issue 337, issue 443, and issue 343. All provided by Stuart McCulloch. Many thanks, Stuart! git-svn-id: https://google-guice.googlecode.com/svn/trunk@1158 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
b5ec94a953eb64b773e56658f50e728f47519288 |
|
27-Mar-2010 |
sberlin <sberlin@d779f126-a31b-0410-b53b-1d3aecad763e> |
patch AssistedInject extension to support multi-constructor injection with FactoryModuleBuilder. reuses @AssistedInject annotation to mark valid constructors. undeprecates @AssistedInject. deprecates FactoryProvider in favor of FactoryModuleBuilder now that all functionality is matched and performance problems are fixed. you can still get the "old" behavior (ordered matching of parameters, non-guiced objects, etc..) by using @AssistedInject+FactoryProvider, but using @Inject or @AssistedInject with FactoryModuleBuilder will give you the new behavior. git-svn-id: https://google-guice.googlecode.com/svn/trunk@1148 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
141f800c09d66898ce04c7684330e1e9dc8a31ab |
|
25-Mar-2010 |
sberlin <sberlin@d779f126-a31b-0410-b53b-1d3aecad763e> |
optimize assistedinject - touches on issue 435 - it is now about ~4x faster than the old style assisted inject (instead of being ~15x slower than it). the optimization only applies if the assisted objects do not inject an Injector or a Provider of an assisted key. git-svn-id: https://google-guice.googlecode.com/svn/trunk@1147 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
97c2271b505bec77f509e1f190695cc6a2997427 |
|
05-Feb-2010 |
sberlin <sberlin@d779f126-a31b-0410-b53b-1d3aecad763e> |
issue 454 - add an annotation to mark @Injectable methods as wanting injection during Stage.TOOL. git-svn-id: https://google-guice.googlecode.com/svn/trunk@1140 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
6840fcbcaaf1dda6b1eb387b1b7811599a69eaa5 |
|
19-Aug-2009 |
limpbizkit <limpbizkit@d779f126-a31b-0410-b53b-1d3aecad763e> |
Jesse's tweaks to aragos' patch r1063. His patch was quite well implemented and these changes are mostly pedantic. Most notably, I un-deprecated FactoryProvider, replacing the deprecation tag with an obsolete warning. We should make a best effort to fix deprecated callers before we deprecate something, otherwise we're punishing our users for our own mistakes. git-svn-id: https://google-guice.googlecode.com/svn/trunk@1064 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
c1e65da70833eadebf37a37b559ce81536c30288 |
|
19-Aug-2009 |
limpbizkit <limpbizkit@d779f126-a31b-0410-b53b-1d3aecad763e> |
aragos' four-month old patch for issue 346, wherein he adds FactoryModuleBuilder. git-svn-id: https://google-guice.googlecode.com/svn/trunk@1063 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
9d6b656e0526d6d2d85c0223a1f5f70544766298 |
|
27-Feb-2009 |
limpbizkit <limpbizkit@d779f126-a31b-0410-b53b-1d3aecad763e> |
Applying ilya.firman's patch for issue 218. I tweaked the patch to use TypeLiteral's new type resolution methods like TypeLiteral.getReturnType(Method) etc., which makes it so we always just do-the-right-thing for matching type variables. git-svn-id: https://google-guice.googlecode.com/svn/trunk@871 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
53664a7f17492bd0c3c4728df61679147907dd18 |
|
21-Feb-2009 |
limpbizkit <limpbizkit@d779f126-a31b-0410-b53b-1d3aecad763e> |
Regrettably replacing jarjar'd Google Collections with minimal copies of the parts that we use. The main benefit is a (significant) reduction in size of the Guice+AOP .jar - from 1004KB to 641KB. The drawback is that it's now a lot harder to use new Google Collections features, or to keep up-to-date with Google Collections bugfixes and optimizations. git-svn-id: https://google-guice.googlecode.com/svn/trunk@859 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
ddb3862415e078080293abba05f1a24a921c007c |
|
29-Dec-2008 |
limpbizkit <limpbizkit@d779f126-a31b-0410-b53b-1d3aecad763e> |
Supporting HasDependencies for Multibinder, MapBinder and AssistedInject v1. AssistedInject v2 support isn't here yet, it's difficult. Since we use a child injector in that package, we need a strategy for how the bindings from that injector should work. I don't think getting this perfect is urgent. git-svn-id: https://google-guice.googlecode.com/svn/trunk@747 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|
2d633cd04273a80a31c920f24fc1d3c5f1f8e7df |
|
09-Dec-2008 |
limpbizkit <limpbizkit@d779f126-a31b-0410-b53b-1d3aecad763e> |
Big API change to AssistedInject Deluxe. I unified the API - both old and new use the same API, and the code detects which to use (by looking for the presence or absence of an @AssistedInject annotation) This means that: - Upgrading from new to old is extremely easy - Unified Javadocs for old and new. The new Javadocs just have a section pointing out the differences when @AssistedInject is used instead of @Assisted - It's a little clumsier to make sure you're getting the right one. This is mitigated by some new checks on the factory interface to ensure the old constructor isn't used with the newer factories. Also applying local variable naming fixes to InjectionPoint, as pointed out by Brian Harris. git-svn-id: https://google-guice.googlecode.com/svn/trunk@723 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
|