Commit Graph
16 Commits
Author SHA1 Message Date
Guice TeamandGuice Team 5caa549395 Enable the new Guice error messages.
Changes include:

 - update Guice tests that asserts error messages
 - export new errors tests
 - update Guice compiler flag so parameter names are available at runtime, which is required for the errors tests

PiperOrigin-RevId: 337602195
2020-10-16 16:55:03 -07:00
Guice TeamandGuice Team 9a8e46716e Revert previous change because it broke some tests when running with openjdk8.
PiperOrigin-RevId: 337517262
2020-10-16 09:13:55 -07:00
Guice TeamandGuice Team 2c8c7fed12 Enable the new Guice error messages.
Changes include:
- update Guice tests that asserts error messages
- export new errors tests
- update Guice compiler flag so parameter names are available at runtime, which is required for the errors tests

PiperOrigin-RevId: 337401912
2020-10-15 16:06:22 -07:00
xiaomingjiaandKurt Alfred Kluever af26c72479 Fix some unchecked and rawtypes warnings in Guice code.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=324843912
2020-08-05 09:53:37 -04:00
kashikeandkevinb9n d071802d48 Add a .withAnnotation() method to simplify creating keys with different annotations.
Closes https://github.com/google/guice/pull/1108

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=313246519
2020-05-27 10:28:27 -07:00
samebandColin Decker 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
samebandKurt Alfred Kluever 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
samebandRon Shapiro 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
lukesandRon Shapiro dcf7bdacc2 remove unnecessary explicit type parameters now that we are on java7
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=145716288
2017-03-21 15:28:23 -04:00
lukesandSam Berlin 34e7c5d715 Run google-java-format on all Guice code.
configure a presubmit to ensure that it stays formatted.

Highlights include:
* simplified import order
* method annotations are now consistently defined on the preceding line
* javadoc reformatted to 100 chars column width

One test that contained line numbers in error messages had to be modified and
the formatter didn't like some of the more complicated preprocessor directives
(MOE and AOP).

To avoid formatting the copyright notices as javadoc i did a preprocessing step to rewrite the initial '/**' to '/*' using perl

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=132718493
2016-09-13 11:47:18 -04:00
lukesandSam Berlin 713c06cce9 Fix issues reported by errorprone
99% of this is adding missing @Override annotations, in the long tail we also have

* insert missing calls to Assert.fail() in tests that are testing exception behavior
* rewrite a few cases of Foo.class.instanceof(c) to c instanceof Foo
* rewrite Class.newInstance - > Class.getConstructor().newInstance() which doesn't break checked exception checking.
* adding @javax.inject.Inject annotations to methods that override methods annotated with @javax.inject.Inject

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131839622
2016-09-07 17:45:54 -04:00
sameb 825f8c1df8 Some work on issue 910 -- ensure that anonymous keys & typeliterals don't
retain references to their parent classes.  Still some more work to do in
WeakKeySet to let it clean up more frequently, but this should help for now.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=89328452
2015-03-23 18:29:08 -04:00
Christian Edward Gruber b0aeeda0b5 Remove loophole for making non-canonical Keys. This makes the behaviour of Key.get(new TypeLiteral<T>() {}) and new Key<T>() {} the same.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=51109122
2013-09-18 15:26:41 -07:00
Christian Edward Gruber e391585254 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
2013-05-16 11:00:54 -07:00
sberlin b7a02b02d8 * 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
2011-07-08 00:34:16 +00:00
mcculls 74d714c1e7 Issue 552: (step 1) move core code to its own subdirectory
git-svn-id: https://google-guice.googlecode.com/svn/trunk@1300 d779f126-a31b-0410-b53b-1d3aecad763e
2010-10-21 19:10:16 +00:00