google / google/guice

Misplaced annotation check may be overly strict when dealing with legacy code

Open
#718 1 comment 0 reactions 0 assignees View on GitHub
imported
Dominant language
Java
Stars
12.7k
Forks
1.7k
Avg merge
11m
Merged PRs (30d)
2

Description

_From [mcculls](https://code.google.com/u/108081409801028235828/) on July 29, 2012 20:54:43_

This is not really a defect as such, and only affects a few scenarios, but just wanted to capture the use-case.

When dealing with legacy code you may encounter interfaces with misplaced annotations (such as `@`Singleton). They might use this as a kind of extension-point documentation, or as a way to generate bindings at runtime.

Currently any use of such an interface in Guice will cause the injector to throw a configuration error - the only way to avoid this is to use a different interface or get the interface changed upstream. However sometimes an upstream change is not possible, and it would be useful if instead the injector could be configured to log such errors as warnings.

While this particular use-case is narrow, there may be other errors which are technically not fatal and could be logged as warnings when running in some sort of "non-strict"/"legacy" mode or stage.

_Original issue: http://code.google.com/p/google-guice/issues/detail?id=718_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.