Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge change from google internal #115

Conversation

cgruber
Copy link

@cgruber cgruber commented Feb 4, 2015

Various changes, including:

  • Alternative approach to parent/child relationships between components, using @SubComponent
  • Restrictions for non-@Nullable providers
    • @Nullable checked at compile time such that @Nullable providers can only be used by @Nullable injection sites.
    • non-nullable usages check for null and throw NPEs at the point of use
    • 725e783
  • Bug fix for an infinite loop in ClassName
  • Core implementation of ProductionComponent code gen.
  • Some guice-related interop support
  • Error message improvements
  • Use some recent code in auto/common (MoreTypes.asElement)
  • minor build related fixes.

sethnel99 and others added 19 commits February 4, 2015 11:13
…ass it a nested class.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=84557991
… essentially as a todo), and depend on the released auto-value.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=84571281
…ods &

parameters.  With support for implicit generic types, this otherwise printed
out the unresolved methods/parameters, and was confusing.

In fixing this, I also cleaned up the general listing of the dependency chain
so that variables aren't suffixed with '()', and so that raw types are skipped
(since they're synthetic dependencies due to the way members injectors are
implemented, not real things that folks care about).
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=84577408
…process, clean up general support for subclassing modules & add a lot of validation. The rules are:

a) Modules may be subclasses and may be subclassed.
b) @module(includes) from parent classes are unioned into the child's dependencies.
c) @provides methods may not be overridden or override another method.
d) Modules referenced by @module(includes) must not be abstract.
e) Modules referenced by @module(includes) must have the same @module annotation.
f) @component(modules) must not be abstract.
g) If a Module has type parameters, it must be abstract.

(None of this validation existed before, though some of it should have.)
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=84582926
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=84670820
…sponding functional test.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=84696369
…ment, but can be called statically. Then, clean up all of the places that callers to MoreTypes.asTypeElement were passing through a Types instance just for that reason.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=84753119
… interoperability with Guice.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=84836495
…t now ensures that Dagger does not generate any code that uses Guava.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=84889646
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=84889738
…types or

unbounded types.

In a better world, I would analyze the required dependencies of the members
injected type (and its superclass' dependencies) and allow raw or unbounded
parameters if none of the parameters were used as actual dependencies.
Unfortunately, that's really hard to get right.  So might as well fail with a
sane error message for now until someone gets around to doing it better.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=85010484
…e not themselves @component interfaces.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=85067567
…it's a "use at your own risk" feature, but that is forthcoming.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=85091489
… marked @nullable cannot by injected by an @provides or component method that has @nullable.

Also generate null-checks in provision factories & component factories if they aren't @nullable.

This can be controlled by a "dagger.nullableValidation={ERROR,WARNING}" flag, with the default being ERROR.  WARNING will cause compilation to produce warnings when there's a nullable mismatch, and will ignore null return values from providers/component methods. ERROR will trigger the new behavior.

This also changes compile-testing to support passing options to the compiler.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=85151739
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=85157486
Explicitly mark [] to use WARNING, since they're full of errors.
Global TAP looks pretty happy: []
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=85283950
…face for Producer<T> has a ListenableFuture<T> get() method but the codegen was creating a T get() method.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=85519772
@cgruber
Copy link
Author

cgruber commented Feb 4, 2015

This pull is pending a pull from google/compile-testing. Should be out shortly.

@sameb
Copy link
Member

sameb commented Feb 4, 2015

"Restrictions for non-@nullable providers, such that they properly throw NPEs" undersells that compile-time checking for nullness a little bit. :-)

…d to figure out if we want to revert that and force the functional tests back to 1.6, or just leave it, since the functionality isn't any different.
@cgruber cgruber force-pushed the moe_writing_branch_from_02a32292dab18eafe393676bf6d3a32725219078 branch from 939c09f to 847e2ae Compare February 5, 2015 00:56
@cgruber
Copy link
Author

cgruber commented Feb 5, 2015

LOL. Fair, sam. I'll edit a bit.

@cgruber
Copy link
Author

cgruber commented Feb 5, 2015

@gk5885 - PTAL.

@cgruber cgruber mentioned this pull request Feb 5, 2015
@cgruber
Copy link
Author

cgruber commented Feb 5, 2015

Given that @sameb has eyes on this, and it fixes a currently broken build (caused by a changed upstream dep snapshot, see #113), I'm going to merge this. It contains two non-synced commits (The last two) which we can chat about later.

cgruber added a commit that referenced this pull request Feb 5, 2015
…ab18eafe393676bf6d3a32725219078

Merge change from google internal
@cgruber cgruber merged commit 9bf34e3 into master Feb 5, 2015
@cgruber cgruber deleted the moe_writing_branch_from_02a32292dab18eafe393676bf6d3a32725219078 branch February 5, 2015 22:16
@cgruber cgruber modified the milestone: Dagger 2.0 Release Mar 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants