google / guice

Guice (pronounced 'juice') is a lightweight dependency injection framework for Java 11 and above, brought to you by Google.
https://github.com/google/guice
Apache License 2.0
12.51k stars 1.67k forks source link

Add annotation to allow passthrough default methods on assisted factories #1760

Open jpenilla opened 1 year ago

jpenilla commented 1 year ago

Fixes #1345

Add @PassthroughDefaultMethods annotation to allow using default methods on assisted factories (but only when explicitly requested by the user, see https://github.com/google/guice/pull/1347#issuecomment-1513671014)

As mentioned in the linked comment, we don't want to change existing behavior in case anyone is relying on it. So instead we add an annotation to specify what behavior we want. If the annotation was only able to be placed on individual methods, a more generic name like @Unassisted might be ok, however since I am also allowing the annotation on factory interfaces, I felt a more specific name made sense.

google-cla[bot] commented 1 year ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.