100 Commits
Author SHA1 Message Date
Sam Berlin b22f83c890 Internal change enabling kotlin stack trace demangling.
PiperOrigin-RevId: 968613165
2026-08-21 11:51:43 -07:00
Sam Berlin 9fc2417be2 Remove the word "experimental" from the MethodHandles flag.
PiperOrigin-RevId: 752352166
2025-04-28 10:10:15 -07:00
Sam Berlin b82cc7bbdf Eagerly ensure that user-supplied providers always return the expected type. Historically this was implicitly validated upon injection into whatever used the provider (via reflection magic). However, with the shift to MethodHandles, that particular signature check becomes harder to isolate/replicate without adding a bunch of unnecessary overhead. Thus, we instead change this to validate user-supplied providers when they provide the value (which is the soonest it can go wrong).
PiperOrigin-RevId: 752295067
2025-04-28 07:14:26 -07:00
Sam Berlin bf43b4f37f Rewrote the "child binding already set" error message for better clarity.
PiperOrigin-RevId: 698811431
2024-11-21 09:30:41 -08:00
Sam Berlin 17011080a1 Update to latest bazel-common that has a newer android API level, so it works on the latest macos on github. Also update to the latest Bazel version that supports JavaInfo rule imports, and fix things that break w/ the latest bazel version (requiring imports for defining package statements if a package_info.java exists, and not using @local_jdk//:jar).
PiperOrigin-RevId: 631081930
2024-05-06 11:03:04 -07:00
Sam Berlin cc5511b94f Update open-source Guice to use DirectStackWalkerFinder, now that the base level is JDK11.
PiperOrigin-RevId: 620889085
2024-04-01 10:39:21 -07:00
Sam Berlin 37b7b7e9f5 Update the google_bazel_common ref. The existing one was too old and referenced libs that aren't published anymore.
PiperOrigin-RevId: 597242944
2024-01-10 07:24:08 -08:00
Sam Berlin ba3553a697 Update CI to use 21 instead of 21-ea, and bazel to use 21 now that its not EA.
PiperOrigin-RevId: 571115942
2023-10-05 13:36:33 -07:00
Sam Berlin c58bc33b90 A bunch of environment changes.
* Bump minimum JRE to 11 (from 8).
* Change testing matrix from {8,11,15,17} to {11,17,21-ea}. (Except the bazel build has trouble parsing "21-ea" as a java version, so s/21-ea/20 for bazel.)
* Also test on macos (but only with jdk17). (Attempted to test on windows too, but there's issues right now.)
* Cleanup the POMs a little bit (remove unused mailing list reference, fix CI link)
* Bump bazel version to 6.2.0, otherwise the tests fail b/c they try to set a security manager (see https://github.com/bazelbuild/bazel/issues/14502, which was fixed in https://github.com/bazelbuild/bazel/commit/7556e1107b666d10b660470a571631463c7eb4ec, which was cherrypicked into the 6.2.0 release). This also required suppressing the "BanJNDI" errorprone check in the JNDI extension, which was also added to 6.2.0. (A future change should probably just remove the JNDI extension altogether.)

PiperOrigin-RevId: 532849632
2023-05-17 11:22:54 -07:00
Sam Berlin ed5f5aec71 Bump last stable release to 7.0.0, update README to point to 6.0.0 & 7.0.0 as the last releases, update the 6.0.0 & 7.0.0 release pages.
PiperOrigin-RevId: 531554646
2023-05-12 11:10:25 -07:00
Sam Berlin 654032a954 Internal change.
PiperOrigin-RevId: 531069248
2023-05-10 19:42:14 -07:00
Sam Berlin bee813b7cc Improve MissingImplementationError to lazily calculate suggestions and standardize its output.
The error will now generate suggestions only when the message is used (as opposed to on instantiation). This should significantly improve the performance of any code that happens to call `injector.get{Instance,Provider,Binding}` and catches/ignores a `ProvisionException` (with the intention of falling back to code that deals with the type not being bound). While this isn't a great pattern for code to use, and there are far better ways of doing it... there's enough code that does this that it's worthwhile improving.

This pattern in particular was very problematic with the introduction of the jakarta.inject.Provider variants for Multibinders/MapBinders & OptionalBinders, because we have *lots* of those. By adding N more bindings to each multi/map/optionalbinder, we added a very large number of bindings to the overall total, which resulted in code using this pattern getting much slower.

This code also fixes suggestions to skip "UntargettedBindings", which are bindings like `bind(SomeInterface.class)` and aren't a valid suggestion (because they're missing a .to(..)). By standardizing, this otherwise broke a test in BinderTest that was asserting we failed those with proper error messages (showing their source). We would have otherwise started showing their source twice, once in a "Did you mean?" section and again in the normal "bound here" section. But really we shouldn't show these in "Did you mean?" at all, because it's just a repetition (or incorrect suggestion) of the wrong binding.

PiperOrigin-RevId: 531062151
2023-05-10 18:47:53 -07:00
Sam Berlin 2d64067e99 Use linked bindings for MapBinder/Multibinder/OptionalBinder aliases, instead of linking to the same internal factory implementation. (Reusing the internal factory results in some quirks that we want to avoid.)
PiperOrigin-RevId: 530977598
2023-05-10 12:34:58 -07:00
Sam Berlin be0141cc0d Internal change
PiperOrigin-RevId: 530658894
2023-05-09 11:03:32 -07:00
Sam Berlin 40a5bcfab5 Avoid re-initializing factories that are already initialized. This is necessary because we share the internal factory implementation, which leads to initialize(..) being called multiple times. There are other consequences/quirks of this, but re-initialization is the worst of it.
PiperOrigin-RevId: 530339379
2023-05-08 10:23:36 -07:00
Sam Berlin 9ac476784e Change the way we reference what 6.0 supports in the README, so it doesn't get transformed into jakarta.
Also note that 5.1 only supports javax.

PiperOrigin-RevId: 529858655
2023-05-05 18:02:04 -07:00
Sam Berlin 24324ca6c6 Prepare for the Guice 6.0 & 7.0 releases. This change does the following:
* Bumps the snapshot version to 7.0.1-SNAPSHOT
* Adds Guice 6 & Guice 7 release pages, with explanations of the jakarta transition & how Guice 6.0 & 7.0 should be used. They also include changelogs since 5.1.0.
* Updates the top-level README to reference the 6.0 & 7.0 releases, as well as including "installation instructions" (which fixes #1698).
* Updates the wiki to make sure it's meaningful for both javax & jakarta references, pointing to the correct ones where appropriate.

PiperOrigin-RevId: 529770936
2023-05-05 11:33:15 -07:00
Sam Berlin 49b1a33c59 Remove redundant references to javax.{inject,persistence,servlet} and replace the rest with their jakarta variants.
This required upgrading some test dependencies, because the tests need some impls of the APIs which only exist in newer releases.

This also removes the struts2 extension from the maven & bazel build (although it keeps the now-unused source), because struts2 has no release that supports jakarta. For users that want to continue using the struts2 extension, please continue to use the Guice 6.0 release (instead of the 7.0+ line, which will only support the jakarta dependencies).

Fixes #1383.

(I'll cut the 6.0 candidates/releases from before this commit, and if we need to make further 6.0 changes, I'll manually merge those into the 6.0 branch.)

PiperOrigin-RevId: 529504991
2023-05-04 13:50:43 -07:00
Sam Berlin 5a58425454 Rework sun.misc.Unsafe usages so that we directly refer to sun.misc.Unsafe, and call getObject on it natively instead of through reflection. (Take 2, after exempting its usages internally.)
Calling getObject through reflection breaks Azul JVMs, because the staticFieldBase is a funny "not object", but when passed through reflection it tries to become an Object and fails.

Retrieval of the unsafe is based on how other google open source projects do it, see for example AbstractFuture, UnsignedBytes, and protobufs.

Fixes #1719, and properly fixes #1672.

(Note that this change also bumps the Github Action's bazel version from 4.2.2 to 6.1.2, because somewhere along the way from 4.2.2->6.1.2, Bazel fixed the --javacopts="--release 8" option to also allow sun.misc.Unsafe.)

PiperOrigin-RevId: 529486761
2023-05-04 12:46:50 -07:00
Sam Berlin e7513e64a4 Breaks some conformance around sun.misc.Unsafe usage.
PiperOrigin-RevId: 529476888
2023-05-04 12:06:56 -07:00
Sam Berlin bb931fe974 Expose _something_ from private modules used in tests where the test is validating that the parent can't re-bind something from the private module. If nothing is exposed, the child/private injector can otherwise be immediately GC'd (which then allows the parent to have the binding). (Note that there are other ways the child/private module could be captured: such as a Provider or its Injector being captured into a longer-lived Thread... but this is the simplest way to do it). This is happening with some regularity on the Github Actions tests, making the tests a bit flaky.
PiperOrigin-RevId: 529467328
2023-05-04 11:33:20 -07:00
Sam Berlin 95a2fbbbf4 Rework sun.misc.Unsafe usages so that we directly refer to sun.misc.Unsafe, and call getObject on it natively instead of through reflection.
Calling getObject through reflection breaks Azul JVMs, because the staticFieldBase is a funny "not object", but when passed through reflection it tries to become an Object and fails.

Retrieval of the unsafe is based on how other google open source projects do it, see for example [AbstractFuture](https://github.com/google/guava/blob/d4bd0c5ffa913104283e61aeb2c41bac641af042/guava/src/com/google/common/util/concurrent/AbstractFuture.java#L1340-L1365), [UnsignedBytes](https://github.com/google/guava/blob/6405852bbf453b14d097b8ec3bcae494334b357d/guava/src/com/google/common/primitives/UnsignedBytes.java#L341-L366), and [protobufs](https://github.com/protocolbuffers/protobuf/blob/520c601c99012101c816b6ccc89e8d6fc28fdbb8/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java#L289-L315).

Fixes #1719, and properly fixes #1672.

(Note that this change also bumps the Github Action's bazel version from 4.2.2 to 6.1.2, because somewhere along the way from 4.2.2->6.1.2, Bazel fixed the `--javacopts="--release 8"` option to also allow `sun.misc.Unsafe`.)

PiperOrigin-RevId: 529465570
2023-05-04 11:27:53 -07:00
Sam Berlin 3bb74d7e3b Improve the error message if an EntityManager is provisioned before a unit if work is started, to help users transition to the new default that requires an explicit work open (or the legacy option set).
PiperOrigin-RevId: 529465168
2023-05-04 11:26:21 -07:00
Sam Berlin bb54925a2c Some prefactorings that will make it easier to add transformations that strip javax and only use the jakarta variants.
* BoundFieldModule: just say "Provider" and "Qualifier" instead of FQN of each.
* MapBinderTest/MultibinderTest/SpiUtils/ProvidersTest/googlecode.guice.BUILD: reorder some things so it's easier to strip the javax variants
* OptionalBinderTest: introduce a helper that the tests delegate to, so the strip directives can be consolidated
* ContinuingRequestIntegrationTest/ServletTest: Don't pass null for the response in tests that made that fail, pass mocks instead. Earlier HttpServlet impls allowed null, later HttpServlet impls don't allow null.
* ElementsTest: rename javax-referencing to "spec" so it makes sense when its transformed.
* InjectorSpiTest: Run the formatter, since the next CL would have changed this.
* BoundFieldModuleTest: Reference javax explicitly in some places, explicitly don't reference it in others.
* OSGiContainerTest: Add a TODO about the test's uselessness
* pom.xml: Enable maven test failures to include stack traces, so we have some idea WTF went wrong when things go wrong.

PiperOrigin-RevId: 529463507
2023-05-04 11:20:49 -07:00
Sam Berlin 75df9fc285 Fix a few more places where we should check jakarta variants: DaggerMethodScanner scopes and BytecodeGenTest.
PiperOrigin-RevId: 528900279
2023-05-02 15:11:08 -07:00
Sam Berlin 104a113389 Optimize the way we skip sources of core Guice classes. Instead of building new binders by calling skipSources on-demand, we just skip all the expected sources by default. This significantly reduces some memory pressure when creating injectors (which was otherwise causing issues with the forthcoming CL to additionally bind jakarta Provider variants for MapBinder/Multibinder/OptionalBinder).
PiperOrigin-RevId: 528758521
2023-05-02 06:02:26 -07:00
Sam Berlin 36ff122d25 Rewrite jakarta singleton -> c.g.i Singleton for the SPI too.
PiperOrigin-RevId: 528546653
2023-05-01 12:41:34 -07:00
Sam Berlin 99d0e11294 Add a couple more missing @since tags.
PiperOrigin-RevId: 527669293
2023-04-27 13:36:37 -07:00
Sam Berlin 0c94a80454 Update @since vNext tags to @since 6.0
PiperOrigin-RevId: 527647564
2023-04-27 12:10:45 -07:00
Sam Berlin 5eff2eabd4 Add support for jakarta.inject to core Guice.
This does not add support for `toProvider(...)` to instances of `jakarta.inject.Provider` or classes/keys/typeLiterals of type `jakarta.inject.Provider`. See https://github.com/google/guice/issues/1383#issuecomment-1523410855 for details of the plans. The Guice 6.0 release will support `javax.inject` _and_ `jakarta.inject` (excluding `toProvider()` support for `jakarta.inject`), and the Guice 7.0+ release will remove the `javax.inject` references.

Further background on these issues:
 * https://github.com/google/guice/pull/1630
 * https://github.com/google/guice/issues/1679
 * https://github.com/google/guice/issues/1490
 * https://github.com/google/guice/issues/1383

PiperOrigin-RevId: 527349023
2023-04-26 12:55:35 -07:00
Sam Berlin 8edbe68a06 Don't immediately lookup the linked binding associated with @ImplementedBy. Instead, defer it like a normal bind(X.class).to(Y.class) does. This ensures that later bindings of Y are used.
Much thanks goes to @nineninesevenfour for their investigation (in #1650), which made fixing this much easier.

Fixes #700 and fixes #1650.

PiperOrigin-RevId: 527048972
2023-04-25 12:52:54 -07:00
Sam Berlin 4baf691855 Add a utility class for checking if Guice has enhanced a class (and returning the unenhanced version).
(Also changes the classname suffix to be a hex string instead of an int, which had previously included a leading negative sign, which was weird.)

Fixes #1340 & fixes #187.

PiperOrigin-RevId: 526291523
2023-04-22 09:19:43 -07:00
Sam Berlin e68fab6524 Don't automatically create an EntityManager outside of a UnitOfWork, because it leads to leaks. Fixes #739, fixes #997, fixes #730, fixes #985, fixes #959, fixes #731. This also adds an optional Options to the JpaPersistModule constructor, if users wish to use the legacy behavior. This is a breaking change, but to a better default value. Users who want to keep the dangerous form can opt back in with the options.
PiperOrigin-RevId: 526106112
2023-04-21 12:24:37 -07:00
Sam Berlin 2d78877e67 Recognize scoping annotations on concrete types also annotated with @ProvidedBy when using the @ProvidedBy as the provider.
Notably, this does *not* change things to allow scoping annotations on interfaces or abstract classes (even though theoretically we could, because the @ProvidedBy will be instantiating it). Scopes on abstract classes|interfaces will still throw an exception about the scope being misplaced.

Fixes #251 and fixes #1319.

PiperOrigin-RevId: 526009187
2023-04-21 05:41:01 -07:00
Sam Berlin bccee9c2c1 Fix Guice's dependence on the system line separator by never using the system line separator and always using \n explicitly. (We were previously inconsistent: many places used \n, and many other places used %n with a formatter, which would end up being the system line separator.) This allows tests to pass on Windows, where the line separator is different. Also update tests to do a run with the windows line separator, to catch regressions. Fixes #1213.
PiperOrigin-RevId: 525558598
2023-04-19 14:56:48 -07:00
Sam Berlin 5c95376766 Update documentation to elaborate on how hierarchical modules change the importance of otherwise unnecessary binding statements.
Closes #973, a documentation alternative to #1337.

PiperOrigin-RevId: 525497931
2023-04-19 11:09:04 -07:00
Sam Berlin c6b5cdfa94 Add truth's java8 extensions to the external bzl & maven build and update the version we use.
PiperOrigin-RevId: 525459640
2023-04-19 08:49:08 -07:00
Sam Berlin 22dca18c8c Improve {Checked,Throwing}ProviderTest to allow exception types to be returned in any order from Method.getGenericExceptionTypes. Fixes #1603.
(This does not use the suggested code from the original PR, and does not attempt to change the `testManyMethods` method because we assume that repeated calls to `getDeclaredMethods` will always return the same order of methods. If that ever changes, we can deal with it then.)

PiperOrigin-RevId: 525220025
2023-04-18 12:35:49 -07:00
Sam Berlin 15d95bb199 Fix issues with recursive JIT loading that would lead to a deadlock and/or crash inside Guava's LoadingCache. The problem had to do with the fact that Guice eagerly stores uninitialized JIT bindings in an attempt to allow circular dependencies, and Guice also attempts to cleanup failed JIT bindings (to remove these uninitialized JIT bindings). The JIT binding cache was a guard against a recursive call back into the constructor's cache, but we were removing that guard.
We now only remove the guard if we aren't in the process of loading that JIT binding. The failed JIT binding is naturally cleaned up later on, as the existing & new tests attest to.

Fixes many issues:
 - Fixes #1633
 - Fixes #785
 - Fixes #1389
 - Fixes #1394

Many thanks to @swankjesse for the test-case added in #1389 that was helpful in diagnosing the problem, and to @PaulFridrick for the diagnoses in #1633.

PiperOrigin-RevId: 525219839
2023-04-18 12:35:23 -07:00
Sam Berlin f447cc4855 Bump junit to 4.13.2. Fixes #1585 & #1425.
PiperOrigin-RevId: 525219738
2023-04-18 12:31:10 -07:00
Sam Berlin 23c25d5e68 Bump struts2-core dependency to 2.5.30 & fix the struts2 test to work with the new version. Fixes #1624.
PiperOrigin-RevId: 525219685
2023-04-18 12:30:43 -07:00
Sam Berlin f67f9d19c2 Bump spring dependency to 5.3.18. Fixes #1620.
PiperOrigin-RevId: 525219514
2023-04-18 12:28:11 -07:00
Sam Berlin 8cf8c62a29 Prevent endless loop in lock cycle detection. The following scenario would previously fail:
* T1: Enter `lockOrDetectPotentialLocksCycle`:
    - Lock CAF.class, add itself to `lockThreadIsWaitingOn`, unlock CAF.class
    - Lock the cycle detecting lock (CDL)
    - Lock CAF.class, mark itself as `lockOwnerThread`, remove itself from `lockThreadIsWaitingOn`
    - Exit `lockOrDetectPotentialLocksCycle`
 * T1: Re-enter `lockOrDetectPotentialLocksCycle`:
    - Lock CAF.class, add itself to `lockThreadIsWaitingOn`, unlock CAF.class
 T2: Enter `lockOrDetectPotentialLocksCycle`
    - Lock CAF.class, invoke `detectPotentialLocksCycle`.

At this point, `detectPotentialLocksCycle` will now loop forever, because the `lockOwnerThread` is also in `lockThreadIsWaitingOn`. During the course of looping forever, it will OOM, because it's building up an in-memory structure of what it thinks are cycles.

The solution is to avoid the re-entrant T1 from adding itself to `lockThreadIsWaitingOn` if it's already the `lockOwnerThread`. It's guaranteed that it won't relinquish the lock concurrently, because it's the exact same thread that owns it.

Fixes #1635 and Fixes #1510

PiperOrigin-RevId: 525182219
2023-04-18 10:18:59 -07:00
Sam Berlin 5c37cd9662 Update LineNumbers to ignore all kinds of exceptions when reading classes with ASM, so Guice is less finicky about the precise .class version & ASM version. A while ago I had tried to do this by ignoring UnsupportedOperationException, but per https://github.com/google/guice/issues/1654, ASM doesn't always throw UOE.
This change will log a single failure when Guice encounters an exception while reading classfiles and warn that ASM may be out of date.

The consequences of this failing _all_ line number reading (due to, say, an accidental bug introduced while parsing classfiles) is that Guice won't emit line numbers for bind statements in modules (as binding source locations). A number of other tests would fail in that scenario, warning us that something is off.

PiperOrigin-RevId: 524387180
2023-04-14 14:29:14 -07:00
Sam Berlin d6997b0ad0 Fix the remaining jdkhead issues by introducing a new "dollarSeparator" field in the existing internal Annotations configuration (that already did work to figure out if we need to quote strings or include value= prefixes). Update prior CL's code to use this new approach, update remaining tests to use this, and update some non-test code that emits annotation instance strings to delegate to this.
PiperOrigin-RevId: 481018326
2022-10-13 17:04:00 -07:00
Sam Berlin 286e076aa7 Revise some tests to assume less about the way annotations' toString is printed. Recent JDKs change the output to use '.' instead of '$' for nested annotations.
PiperOrigin-RevId: 480935880
2022-10-13 11:07:16 -07:00
Sam Berlin 8a38aa9ecb Extract the one test that requires add_opens to a separate file, run it with add_opens in the one classloading strategy that requires it. Also run it with other strategies/defaults w/o add_opens (in scenarios where it doesn't require it).
PiperOrigin-RevId: 475929909
2022-09-21 14:51:37 -07:00
Sam Berlin e0f12160dd Extract stack trace walking to an interface so we can have different strategies for doing it.
PiperOrigin-RevId: 430291168
2022-02-22 14:04:27 -08:00
Sam Berlin bcc9fe45e3 Fix JDK17+ assistedinject private lookup behavior by catching InaccessibleObjectException (as Throwable) when attempting to reflect on private JDK internals.
Rewrite the way we iterate through method handle lookups. Don't cache fallback behavior. Instead, eagerly discover what the JDK supports & cache that. On use, if it fails (likely because a proper lookups wasn't supplied), then fallback (but do not cache the fallback).

All these shenanigans are only necessary if javac generated a default method that Guice needs to invoke. Because AssistedInject uses a JDK Proxy, which also proxies default interface methods, we need to use invokespecial to target the proxy (otherwise proxying the method will end up with a stack overflow due to infinite recursion). Note that if we implemented this by code generation, we wouldn't need these hacks... so we take some pains to allow non-public factories without *requiring* the user to call withLookups(..). But the workarounds don't always work, so we still need the withLookups(..) method.

PiperOrigin-RevId: 423822309
2022-01-24 08:32:03 -08:00
Sam Berlin 02c4687594 Mark javadoc_library as manual, so test //... doesn't build it.
PiperOrigin-RevId: 423155378
2022-01-20 14:11:46 -08:00
Sam Berlin 9d12b481dd Instantiate modules if necessary in DaggerAdapter.
PiperOrigin-RevId: 403715358
2021-10-17 00:51:25 -07:00
Sam Berlin a260458b28 Rework MapBinder to avoid a linked binding for the Map<K, ? extends V> binding to reduce noise in the graph.
PiperOrigin-RevId: 366251178
2021-04-01 07:59:57 -07:00
Sam Berlin e6ec2a4a94 Rework the way we bind the Set<? extends T> multibound object so that we can avoid the linked binding. This removes one unnecessary dependency from the graph, making graph visualizations more straight forward.
PiperOrigin-RevId: 366250039
2021-04-01 07:51:04 -07:00
Sam Berlin bfc2e48f4a If all reasonable sources are filtered via skipSource, then show the source as "unknown source" instead of InjectorShell.build (which should be an internal detail).
PiperOrigin-RevId: 358853443
2021-02-22 13:50:35 -08:00
Sam Berlin 1a299822f0 Use respectful terms.
PiperOrigin-RevId: 353310819
2021-01-22 13:44:44 -08:00
Sam Berlin fd4ef5e6a3 Rewrite DeclaredMembers to use stream ordering, so evaluation of subsequent comparators is lazy.
PiperOrigin-RevId: 347713768
2020-12-15 16:14:02 -08:00
Sam Berlin 02a2e3c5d9 Actually, leave branches: only: master in travis.yml. Otherwise (if we rely on the "don't run Travis on pushes"), then Travis doesn't run on the master commit and we only get the Travis run from the PR. I'd like Travis to run on master commits too. After this submits, I'll tweak the Travis settings again.
PiperOrigin-RevId: 337552114
2020-10-16 12:06:57 -07:00
Sam Berlin b9ee4a56b5 Cleanup travis config: remove jdk9, and remove master branch only requirement. (Instead, Travis is now configured to ignore branch commits entirely.)
PiperOrigin-RevId: 337549300
2020-10-16 11:52:21 -07:00
Sam Berlin 0405856c98 Remove after_failure stanza. It breaks Travis integration and it doesn't seem to work anyway. Also fix ant version.
PiperOrigin-RevId: 336301009
2020-10-09 08:53:05 -07:00
Sam Berlin 6586659da6 Update BoundFieldModule to mark the field as the source of the binding.
PiperOrigin-RevId: 333317842
2020-09-23 10:18:28 -07:00
sameb c83404b2fb use the correct suppression name, oops. also add some other suppressions.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=312555246
2020-05-21 17:06:13 -04:00
sameb 39c2ab9eda Suppress warnings for the scope/qualifier annotations intentionally used w/o RUNTIME retention.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=311573006
2020-05-15 09:39:51 -04:00
sameb 485191facb bump snapshot version, update README & prior API xml
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=301892530
2020-03-19 17:20:52 -04:00
sameb 5d34655f68 add & fix @since tags, to prepare for new open-source release.
The new release will be 4.2.3, not 5.0 as originally planned.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=301833910
2020-03-19 13:06:56 -04:00
sameb febf8a0de5 update asm to 7.2.
fixes #1274

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=299381828
2020-03-09 14:05:20 -04:00
sameb f253439461 rm hack around cglib bug & update to version that has the fix.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=263539023
2019-08-15 14:38:41 -04:00
sameb 802feb18ac switch from oraclejdk11 to openjdk11 because of https://travis-ci.community/t/cannot-install-oracle-jdk-11/3892
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=255399201
2019-06-28 09:20:02 -04:00
sameb f31a1060b9 manually install ant (in the only way i could get working) because travis.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=254796904
2019-06-28 09:20:02 -04:00
sameb c209ed23ee Make @RequestScoped use @Scope instead of @ScopeAnnotation.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=253582933
2019-06-28 09:20:02 -04:00
sameb 74304f942f update the opensource asm to 7.1 & cglib to 3.2.12.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=246531728
2019-05-05 12:32:27 -04:00
sameb 45d20a1465 change to openjdk8/9 since travis likes those better now.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=246236488
2019-05-05 12:32:27 -04:00
sameb ac438d161c Use Map<K, List<V>> instead of ListMultimap to avoid a Guava type in the top level APIs, per mcculls' recommendation @ https://github.com/google/guice/pull/1240/files/7e7ac3e60205acd29c5a1116143767e6273d2cf3#r273071139.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=242662395
2019-04-09 23:12:08 -04:00
sameb 7e7ac3e602 Add a note in isTransparentProvider that folks who trace through the code & detect that their binding isn't working because of this call should use @Bind(lazy=true) instead.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=241948208
2019-04-08 10:00:09 -04:00
sameb 3f0dbb8c57 Roll forward of 37255a24d9
Automated rollback of changelist 32fef20b16

*** Original change description ***

Automated rollback of commit 37255a24d9

*** Original change description ***

Refactor code to use java8-isms.

Generated with refaster, with some manual touch-ups afterwards.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=238487042
2019-04-08 09:59:55 -04:00
sameb 32fef20b16 Automated rollback of commit 37255a24d9
*** Original change description ***

Refactor code to use java8-isms.

Generated with refaster, with some manual touch-ups afterwards.

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=238342841
2019-04-08 09:59:33 -04:00
sameb 5058704d37 Stop using reflection to access MethodHandle MethodHandles.Lookups. Continue using reflection to access the private constructor for MethodHandles.Lookups. See https://github.com/google/guice/issues/904 for more information on why we need that particular bit of reflection.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=238113953
2019-04-08 09:59:12 -04:00
sameb e27d4c0e08 Stop using reflection to handle java.util.Optional in OptionalBinder-related code.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=238113224
2019-04-08 09:56:21 -04:00
sameb 37255a24d9 Refactor code to use java8-isms.
Generated with refaster, with some manual touch-ups afterwards.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=238042288
2019-04-08 09:56:03 -04:00
sameb c09ba1d5b7 Some more infrastructure changes to work w/ java8 code. Namely, neuter ant so that we don't use it for anything other than javadoc & jdiff. A few of the libraries it depended on (jarjar, bnd) didn't work with java8 code. We don't really need ant (we just use it for javadocs & jdiffs right now, and theoretically those could move to mvn too if someone figures out how to do that).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=238041337
2019-04-07 19:01:45 -04:00
sameb fd04a9e8ae Change infrastructure to allow using java8-isms.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=237860437
2019-04-07 19:00:16 -04:00
sameb dafa4b0bec Record static injection requests, instance injection requests, members injector lookups and all provider lookups, so we can record more dependency information after the injector is built.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=236366255
2019-03-08 14:24:38 -05:00
sameb a533bf26c6 Ensure that we scan @Provides-like methods in a consistent ordering. Previously we used the results of Class.getDeclaredMethods as-is, which can be non-deterministic from run to run on some JVMs. This will allow some tests to have more stable behavior.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=235046189
2019-02-26 10:38:32 -05:00
sameb 746945fb60 Add support for listing aliases of containers (Multibinder, MapBinder, OptionalBinder).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=233823401
2019-02-13 23:16:39 -05:00
sameb 0367f870f7 Add Injector.getElements method that returns all supported SPI types from the Injector.
Update Injectors to keep track of ProviderLookups attached to InjectionPoints, since these are meaningful for SPI usages.

(See the linked bug for the rationale of why we're adding this.)

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=230719723
2019-01-28 18:59:50 -05:00
sameb 04219a2537 bump snapshot version, update README & prior api xml
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219159125
2018-10-31 11:16:55 -04:00
sameb e1094c3363 Update Guice to use cglib 3.2.9 & asm 7 in the opensource build, for better JDK11 compatibility.
Also remove the jdk10 build from Travis because it doesn't support it anymore and we don't really need it.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219129959
2018-10-29 12:43:10 -04:00
sameb 67369fbf05 Post 4.2.1 release tasks: bump snapshot version, update README & prior API xml.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=214011694
2018-09-28 12:16:58 -04:00
sameb 125bc10449 Rejigger some things so internal deps can use hibernate5.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213623153
2018-09-28 12:16:58 -04:00
sameb b958fd0ef0 Fix the JDK11 opensource build for Guice. This was failing by chance in the testlib tests because some of the tests were trying to create a JIT binding for "Integer", which caused Guice to try to parse Integer.class for line numbers. This failed because the JDK was 11, which compiles with "nest members", but our ASM (ASM6) doesn't support "nest members" yet.
The only sane fix I can think of here is to just blanket ignore unsupported things when parsing line numbers, because even if your code is compiled for an earlier target (all of Guice's code+tests are compiled to target JDK 1.7), the JDK itself might be higher, and code may trigger Guice to try to do ASM operations against the JDK.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213313384
2018-09-17 15:18:32 -04:00
sameb 7e042165a6 Bump asm to 6.2.1, cglib to 3.2.8. The cglib bump should fix the JDK11 test failure, and the asm bump should provide better JDK11 compatibility in general.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212635520
2018-09-17 15:17:15 -04:00
sameb cab3f07f15 Update guice opensource asm dep to 6.2.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203129518
2018-07-13 11:29:19 -04:00
sameb 35caaec1b4 Ignore IllegalStateExceptions when loading classes for retrieving line numbers.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=197761929
2018-05-25 13:36:37 -04:00
sameb c0f89a0a59 Add support for extensions into the proto SPI & convert them.
This converts the BindingProto to use oneofs instead of a type enum in order to let it grow more easily for extensions.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194102075
2018-04-24 13:57:35 -04:00
sameb 72ca1c637d bump api diffs old api version & add 4.2 xml for comparison.
also update README

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187365389
2018-02-28 15:41:17 -05:00
Sam Berlin c9dda9d100 bump snapshot version. 2018-02-28 14:14:01 -05:00
sameb 149942bb94 add empty sources javadoc, per mccull's advice in https://github.com/google/guice/issues/1161#issuecomment-369285370
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187334858
2018-02-28 13:16:23 -05:00
sameb 1a1787ba94 Add a README to multibindings/src per mccull@'s advice
Closes https://github.com/google/guice/issues/1161

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187327733
2018-02-28 13:06:08 -05:00
sameb 78a2063bbf Remove horribly wrong doc.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133746890
2016-10-20 12:43:22 -04:00
Sam Berlin 9f0a899d82 Fully qualify the Singleton so the stripped import doesn't cause issues in the opensource build. 2016-09-13 12:09:38 -04:00
sameb aba3795cff Need to specify throwingproviders as a dependency of testlib now, and also need to explicitly say that truth is in compile scope, since the guice parent pom puts it in the test scope by default.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131623677
2016-08-29 16:42:38 -04:00