From f74759d1c27b1e6e914886b9c1b81cfcec7ebcfb Mon Sep 17 00:00:00 2001 From: dpb Date: Wed, 6 Jul 2016 08:35:07 -0700 Subject: [PATCH 01/17] Delete an unneeded packageinfo file. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=126701315 --- .../releaseablereferences/package-info.java | 27 ------------------- 1 file changed, 27 deletions(-) delete mode 100644 core/src/main/java/dagger/releaseablereferences/package-info.java diff --git a/core/src/main/java/dagger/releaseablereferences/package-info.java b/core/src/main/java/dagger/releaseablereferences/package-info.java deleted file mode 100644 index d53cccb887a..00000000000 --- a/core/src/main/java/dagger/releaseablereferences/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2016 The Dagger Authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * This package contains the API by which Dagger allows you - * release - * references held within some scopes. - * - *

Note:Releasable references uses Java's {@link java.lang.ref.WeakReference}, and so is - * not compatible with GWT. - * - * @since 2.NEXT - */ -package dagger.releaseablereferences; From c10186638f20fd841afade2441fe00aa41179168 Mon Sep 17 00:00:00 2001 From: dpb Date: Wed, 6 Jul 2016 13:44:29 -0700 Subject: [PATCH 02/17] Replace BindingKey.create(Kind, Key) with specific factory methods. Makes calling code more concise and readable. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=126733127 --- .../main/java/dagger/internal/codegen/BindingGraph.java | 4 +--- .../dagger/internal/codegen/BindingGraphValidator.java | 3 +-- .../src/main/java/dagger/internal/codegen/BindingKey.java | 8 ++++++-- .../java/dagger/internal/codegen/ContributionBinding.java | 4 ++++ .../java/dagger/internal/codegen/DependencyRequest.java | 6 +++--- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java b/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java index 25eeaebe475..ee00ed823eb 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java @@ -67,7 +67,6 @@ import static com.google.common.base.Predicates.not; import static com.google.common.base.Verify.verify; import static com.google.common.collect.Iterables.isEmpty; -import static dagger.internal.codegen.BindingKey.Kind.CONTRIBUTION; import static dagger.internal.codegen.BindingType.isOfType; import static dagger.internal.codegen.ComponentDescriptor.isComponentContributionMethod; import static dagger.internal.codegen.ComponentDescriptor.isComponentProductionMethod; @@ -635,8 +634,7 @@ private Optional getOwningResolver(ContributionBinding binding) { if (binding.scope().isPresent() && binding.scope().get().equals(reusableScope(elements))) { for (Resolver requestResolver : getResolverLineage().reverse()) { // If a @Reusable binding was resolved in an ancestor, use that component. - if (requestResolver.resolvedBindings.containsKey( - BindingKey.create(CONTRIBUTION, binding.key()))) { + if (requestResolver.resolvedBindings.containsKey(binding.bindingKey())) { return Optional.of(requestResolver); } } diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java b/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java index 431872b9a44..0f4e64ed4bc 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java @@ -1046,8 +1046,7 @@ private ValidationReport.Builder owningReportBuilder( Iterable duplicateBindings) { ImmutableSet.Builder owningComponentsBuilder = ImmutableSet.builder(); for (ContributionBinding binding : duplicateBindings) { - BindingKey bindingKey = BindingKey.create(BindingKey.Kind.CONTRIBUTION, binding.key()); - ResolvedBindings resolvedBindings = subject.resolvedBindings().get(bindingKey); + ResolvedBindings resolvedBindings = subject.resolvedBindings().get(binding.bindingKey()); owningComponentsBuilder.addAll( resolvedBindings.allContributionBindings().inverse().get(binding)); } diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingKey.java b/compiler/src/main/java/dagger/internal/codegen/BindingKey.java index 8fe7adbefbc..bbdadbbc9b5 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingKey.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingKey.java @@ -31,8 +31,12 @@ enum Kind { CONTRIBUTION, MEMBERS_INJECTION; } - static BindingKey create(Kind kind, Key key) { - return new AutoValue_BindingKey(kind, key); + static BindingKey contribution(Key key) { + return new AutoValue_BindingKey(Kind.CONTRIBUTION, key); + } + + static BindingKey membersInjection(Key key) { + return new AutoValue_BindingKey(Kind.MEMBERS_INJECTION, key); } abstract Kind kind(); diff --git a/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java b/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java index ced8a81c508..472c7115a6c 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java @@ -207,6 +207,10 @@ static Kind forMultibindingRequest(DependencyRequest request) { */ protected abstract Kind bindingKind(); + BindingKey bindingKey() { + return BindingKey.contribution(key()); + } + /** * The strategy for getting an instance of a factory for a {@link ContributionBinding}. */ diff --git a/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java b/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java index 178d5e2cf39..7cbf73acfec 100644 --- a/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java +++ b/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java @@ -141,11 +141,11 @@ BindingKey bindingKey() { case PRODUCER: case PRODUCED: case FUTURE: - return BindingKey.create(BindingKey.Kind.CONTRIBUTION, key()); + return BindingKey.contribution(key()); case MEMBERS_INJECTOR: - return BindingKey.create(BindingKey.Kind.MEMBERS_INJECTION, key()); + return BindingKey.membersInjection(key()); default: - throw new AssertionError(); + throw new AssertionError(this); } } From 7d2d3a577d4bbf5765fb946dca25485a8e4198fc Mon Sep 17 00:00:00 2001 From: dpb Date: Thu, 7 Jul 2016 06:59:46 -0700 Subject: [PATCH 03/17] Make BindingDeclaration's bindingElement optional, so that undeclared bindings such as synthetic multibindings don't use an arbitrary request element. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=126801598 --- .../codegen/AbstractComponentWriter.java | 41 ++++---- .../internal/codegen/BindingDeclaration.java | 94 ++++++++++++------- .../codegen/BindingDeclarationFormatter.java | 21 +++-- .../dagger/internal/codegen/BindingGraph.java | 4 +- .../codegen/BindingGraphValidator.java | 63 +++++++------ .../internal/codegen/ContributionBinding.java | 3 +- .../internal/codegen/DelegateDeclaration.java | 3 +- .../internal/codegen/FactoryGenerator.java | 25 +++-- .../internal/codegen/FrameworkField.java | 4 +- .../codegen/InjectBindingRegistry.java | 2 +- .../codegen/MembersInjectionBinding.java | 13 ++- .../codegen/MultibindingDeclaration.java | 2 +- .../codegen/ProducerFactoryGenerator.java | 22 +++-- .../internal/codegen/ProductionBinding.java | 4 +- .../internal/codegen/ProvisionBinding.java | 10 +- .../internal/codegen/ResolvedBindings.java | 34 +------ .../dagger/internal/codegen/SourceFiles.java | 11 ++- 17 files changed, 180 insertions(+), 176 deletions(-) diff --git a/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java b/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java index 95b01f38b9b..d9d48b6e4d5 100644 --- a/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java +++ b/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java @@ -76,7 +76,6 @@ import static dagger.internal.codegen.AnnotationSpecs.SUPPRESS_WARNINGS_UNCHECKED; import static dagger.internal.codegen.CodeBlocks.makeParametersCodeBlock; import static dagger.internal.codegen.ContributionBinding.FactoryCreationStrategy.ENUM_INSTANCE; -import static dagger.internal.codegen.ContributionBinding.Kind.PROVISION; import static dagger.internal.codegen.ErrorMessages.CANNOT_RETURN_NULL_FROM_NON_NULLABLE_COMPONENT_METHOD; import static dagger.internal.codegen.FrameworkDependency.frameworkDependenciesForBinding; import static dagger.internal.codegen.MapKeys.getMapKeyExpression; @@ -117,7 +116,6 @@ import static javax.lang.model.element.Modifier.FINAL; import static javax.lang.model.element.Modifier.PRIVATE; import static javax.lang.model.element.Modifier.PUBLIC; -import static javax.lang.model.element.Modifier.STATIC; import static javax.lang.model.type.TypeKind.DECLARED; import static javax.lang.model.type.TypeKind.VOID; @@ -936,14 +934,11 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi case COMPONENT_PROVISION: { - TypeElement bindingTypeElement = - graph.componentDescriptor().dependencyMethodIndex().get(binding.bindingElement()); - String localFactoryVariable = simpleVariableName(bindingTypeElement); + TypeElement dependencyType = dependencyTypeForBinding(binding); + String dependencyVariable = simpleVariableName(dependencyType); CodeBlock callFactoryMethod = CodeBlock.of( - "$L.$L()", - localFactoryVariable, - binding.bindingElement().getSimpleName().toString()); + "$L.$L()", dependencyVariable, binding.bindingElement().get().getSimpleName()); // TODO(sameb): This throws a very vague NPE right now. The stack trace doesn't // help to figure out what the method or return type is. If we include a string // of the return type or method name in the error message, that can defeat obfuscation. @@ -969,10 +964,10 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi "}"), /* 1 */ FACTORY, /* 2 */ bindingKeyTypeName, - /* 3 */ getComponentContributionExpression(bindingTypeElement), + /* 3 */ getComponentContributionExpression(dependencyType), /* 4 */ nullableAnnotation(binding.nullableType()), - /* 5 */ TypeName.get(bindingTypeElement.asType()), - /* 6 */ localFactoryVariable, + /* 5 */ TypeName.get(dependencyType.asType()), + /* 6 */ dependencyVariable, /* 7 */ getMethodBody); } @@ -987,15 +982,14 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi "}"), /* 1 */ FACTORY, /* 2 */ bindingKeyTypeName, - /* 3 */ binding.bindingElement().getSimpleName().toString()); + /* 3 */ binding.bindingElement().get().getSimpleName()); case INJECTION: case PROVISION: { List arguments = Lists.newArrayListWithCapacity(binding.dependencies().size() + 1); - if (binding.bindingKind().equals(PROVISION) - && !binding.bindingElement().getModifiers().contains(STATIC)) { + if (binding.requiresModuleInstance()) { arguments.add(getComponentContributionExpression(binding.contributingModule().get())); } arguments.addAll(getDependencyArguments(binding)); @@ -1012,8 +1006,7 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi case COMPONENT_PRODUCTION: { - TypeElement bindingTypeElement = - graph.componentDescriptor().dependencyMethodIndex().get(binding.bindingElement()); + TypeElement dependencyType = dependencyTypeForBinding(binding); return CodeBlock.of( Joiner.on('\n') .join( @@ -1026,10 +1019,10 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi /* 1 */ PRODUCER, /* 2 */ TypeName.get(binding.key().type()), /* 3 */ LISTENABLE_FUTURE, - /* 4 */ getComponentContributionExpression(bindingTypeElement), - /* 5 */ binding.bindingElement().getSimpleName().toString(), - /* 6 */ TypeName.get(bindingTypeElement.asType()), - /* 7 */ simpleVariableName(bindingTypeElement)); + /* 4 */ getComponentContributionExpression(dependencyType), + /* 5 */ binding.bindingElement().get().getSimpleName(), + /* 6 */ TypeName.get(dependencyType.asType()), + /* 7 */ simpleVariableName(dependencyType)); } case IMMEDIATE: @@ -1037,8 +1030,8 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi { List arguments = Lists.newArrayListWithCapacity(binding.implicitDependencies().size() + 2); - if (!binding.bindingElement().getModifiers().contains(STATIC)) { - arguments.add(getComponentContributionExpression(binding.bindingTypeElement())); + if (binding.requiresModuleInstance()) { + arguments.add(getComponentContributionExpression(binding.contributingModule().get())); } arguments.addAll(getDependencyArguments(binding)); @@ -1065,6 +1058,10 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi } } + private TypeElement dependencyTypeForBinding(ContributionBinding binding) { + return graph.componentDescriptor().dependencyMethodIndex().get(binding.bindingElement().get()); + } + private CodeBlock decorateForScope(CodeBlock factoryCreate, Scope scope) { return CodeBlock.of( "$T.provider($L)", diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java b/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java index 7fe894edc6a..f71c83287bf 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java @@ -15,59 +15,54 @@ */ package dagger.internal.codegen; -import com.google.auto.common.MoreElements; import com.google.common.base.Function; import com.google.common.base.Optional; import com.google.common.base.Predicate; import dagger.internal.codegen.Key.HasKey; import java.util.Set; import javax.lang.model.element.Element; -import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.Modifier; import javax.lang.model.element.TypeElement; -import javax.lang.model.type.DeclaredType; -import static dagger.internal.codegen.Util.AS_DECLARED_TYPE; import static dagger.internal.codegen.Util.ENCLOSING_TYPE_ELEMENT; +import static javax.lang.model.element.Modifier.ABSTRACT; +import static javax.lang.model.element.Modifier.STATIC; /** An object that declares or specifies a binding. */ abstract class BindingDeclaration implements HasKey { - /** The {@link Element} that declares the binding. */ - abstract Element bindingElement(); - /** - * The {@link ExecutableElement} that declares the binding. Equivalent to - * {@code MoreElements.asExecutable(bindingElement())}. - * - * @throws IllegalStateException if {@link #bindingElement()} is not an executable element + * The {@link Element} that declares the binding. Absent for bindings without identifying + * declarations. */ - ExecutableElement bindingElementAsExecutable() { - try { - return MoreElements.asExecutable(bindingElement()); - } catch (IllegalArgumentException e) { - throw new IllegalStateException(e); - } - } + abstract Optional bindingElement(); - /** The type enclosing the {@link #bindingElement()}. */ - TypeElement bindingTypeElement() { - return ENCLOSING_TYPE_ELEMENT.visit(bindingElement()); + /** + * The type enclosing the {@link #bindingElement()}, or {@link Optional#absent()} if {@link + * #bindingElement()} is absent. + */ + Optional bindingTypeElement() { + return bindingElement() + .transform( + new Function() { + @Override + public TypeElement apply(Element element) { + return element.accept(ENCLOSING_TYPE_ELEMENT, null); + } + }); } - + /** - * The installed module class that contributed the {@link #bindingElement()}. May be a subclass - * of the class that contains {@link #bindingElement()}. + * The installed module class that contributed the {@link #bindingElement()}. May be a subclass of + * the class that contains {@link #bindingElement()}. Absent if {@link #bindingElement()} is + * absent. */ abstract Optional contributingModule(); /** - * The type of {@link #contributingModule()}. + * A function that returns a singleton set containing the {@link #contributingModule()} for + * binding declarations that have one, and an empty set for those that don't. */ - Optional contributingModuleType() { - return contributingModule().transform(AS_DECLARED_TYPE); - } - static final Function> CONTRIBUTING_MODULE = new Function>() { @Override @@ -76,12 +71,39 @@ public Set apply(BindingDeclaration bindingDeclaration) { } }; - static Predicate bindingElementHasModifier(final Modifier modifier) { - return new Predicate() { - @Override - public boolean apply(BindingDeclaration bindingDeclaration) { - return bindingDeclaration.bindingElement().getModifiers().contains(modifier); - } - }; + /** + * {@code true} if {@link #contributingModule()} is present and this is a nonabstract instance + * method. + */ + boolean requiresModuleInstance() { + if (!bindingElement().isPresent() || !contributingModule().isPresent()) { + return false; + } + Set modifiers = bindingElement().get().getModifiers(); + return !modifiers.contains(ABSTRACT) && !modifiers.contains(STATIC); } + + /** + * A predicate that passes for binding declarations for which {@link #requiresModuleInstance()} is + * {@code true}. + */ + static final Predicate REQUIRES_MODULE_INSTANCE = + new Predicate() { + @Override + public boolean apply(BindingDeclaration bindingDeclaration) { + return bindingDeclaration.requiresModuleInstance(); + } + }; + + /** + * A predicate that passes for binding declarations for which {@link #bindingElement()} is + * present. + */ + static final Predicate HAS_BINDING_ELEMENT = + new Predicate() { + @Override + public boolean apply(BindingDeclaration bindingDeclaration) { + return bindingDeclaration.bindingElement().isPresent(); + } + }; } diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java b/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java index d682ea4867e..22188182192 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java @@ -15,7 +15,12 @@ */ package dagger.internal.codegen; +import com.google.auto.common.MoreElements; +import javax.lang.model.element.Element; + +import static com.google.common.base.Preconditions.checkArgument; import static dagger.internal.codegen.ErrorMessages.stripCommonTypePrefixes; +import static dagger.internal.codegen.Util.AS_DECLARED_TYPE; /** * Formats a {@link BindingDeclaration} into a {@link String} suitable for use in error messages. @@ -29,16 +34,20 @@ final class BindingDeclarationFormatter extends Formatter { @Override public String format(BindingDeclaration bindingDeclaration) { - switch (bindingDeclaration.bindingElement().asType().getKind()) { + checkArgument( + bindingDeclaration.bindingElement().isPresent(), + "Cannot format bindings without source elements: %s", + bindingDeclaration); + Element bindingElement = bindingDeclaration.bindingElement().get(); + switch (bindingElement.asType().getKind()) { case EXECUTABLE: return methodSignatureFormatter.format( - bindingDeclaration.bindingElementAsExecutable(), - bindingDeclaration.contributingModuleType()); + MoreElements.asExecutable(bindingElement), + bindingDeclaration.contributingModule().transform(AS_DECLARED_TYPE)); case DECLARED: - return stripCommonTypePrefixes(bindingDeclaration.bindingElement().asType().toString()); + return stripCommonTypePrefixes(bindingElement.asType().toString()); default: - throw new IllegalArgumentException( - "Formatting unsupported for element: " + bindingDeclaration.bindingElement()); + throw new IllegalArgumentException("Formatting unsupported for element: " + bindingElement); } } } diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java b/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java index ee00ed823eb..a2bdf2fe924 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java @@ -79,7 +79,6 @@ import static dagger.internal.codegen.Key.indexByKey; import static dagger.internal.codegen.Scope.reusableScope; import static javax.lang.model.element.Modifier.ABSTRACT; -import static javax.lang.model.element.Modifier.STATIC; /** * The canonical representation of a full-resolved graph. @@ -129,8 +128,7 @@ ImmutableSet componentRequirements() { .preOrderTraversal(this) .transformAndConcat(RESOLVED_BINDINGS) .transformAndConcat(ResolvedBindings.CONTRIBUTION_BINDINGS) - .filter(not(BindingDeclaration.bindingElementHasModifier(STATIC))) - .filter(not(BindingDeclaration.bindingElementHasModifier(ABSTRACT))) + .filter(BindingDeclaration.REQUIRES_MODULE_INSTANCE) .transformAndConcat(BindingDeclaration.CONTRIBUTING_MODULE) .filter(in(ownedModuleTypes())) .append(componentDescriptor().dependencies()) diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java b/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java index 0f4e64ed4bc..8ac7dd89b7c 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java @@ -72,6 +72,7 @@ import static com.google.auto.common.MoreTypes.asDeclared; import static com.google.auto.common.MoreTypes.asExecutable; import static com.google.auto.common.MoreTypes.asTypeElements; +import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Predicates.equalTo; import static com.google.common.base.Predicates.in; @@ -81,6 +82,7 @@ import static com.google.common.collect.Iterables.getOnlyElement; import static com.google.common.collect.Iterables.indexOf; import static com.google.common.collect.Maps.filterKeys; +import static dagger.internal.codegen.BindingDeclaration.HAS_BINDING_ELEMENT; import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodDescriptor.isOfKind; import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodKind.PRODUCTION_SUBCOMPONENT; import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodKind.SUBCOMPONENT; @@ -88,8 +90,6 @@ import static dagger.internal.codegen.ContributionBinding.indexMapBindingsByAnnotationType; import static dagger.internal.codegen.ContributionBinding.indexMapBindingsByMapKey; import static dagger.internal.codegen.ContributionBinding.Kind.INJECTION; -import static dagger.internal.codegen.ContributionBinding.Kind.IS_SYNTHETIC_KIND; -import static dagger.internal.codegen.ContributionBinding.Kind.SYNTHETIC_DELEGATE_BINDING; import static dagger.internal.codegen.ContributionBinding.Kind.SYNTHETIC_MULTIBOUND_MAP; import static dagger.internal.codegen.ContributionType.indexByContributionType; import static dagger.internal.codegen.ErrorMessages.CANNOT_INJECT_WILDCARD_TYPE; @@ -425,10 +425,7 @@ && doesPathRequireProvisionOnly(path)) { } } if (contributionBinding.bindingKind().equals(SYNTHETIC_MULTIBOUND_MAP)) { - ImmutableSet multibindings = - inlineSyntheticNondelegateContributions(resolvedBindings).contributionBindings(); - validateMapKeySet(path, multibindings); - validateMapKeyAnnotationTypes(path, multibindings); + validateMapKeys(path, contributionBinding); } break; case MEMBERS_INJECTION: @@ -451,32 +448,28 @@ && doesPathRequireProvisionOnly(path)) { /** * Returns an object that contains all the same bindings as {@code resolvedBindings}, except - * that any synthetic {@link ContributionBinding}s are replaced by the contribution bindings and - * multibinding declarations of their dependencies. + * that any {@link ContributionBinding}s without {@linkplain Binding#bindingElement() binding + * elements} are replaced by the contribution bindings and multibinding declarations of their + * dependencies. * *

For example, if: * *

* - * then {@code inlineSyntheticNondelegateContributions(bindingsForKey1)} has bindings {@code A}, - * {@code C}, and {@code D}, with multibinding declarations {@code X} and {@code Y}. + * then {@code inlineContributionsWithoutBindingElements(bindingsForKey1)} has bindings {@code + * A}, {@code C}, and {@code D}, with multibinding declarations {@code X} and {@code Y}. * - *

The replacement is repeated until none of the bindings are synthetic. + *

The replacement is repeated until all of the bindings have elements. */ - // TODO(dpb): The actual operation we want is to inline bindings without real binding elements. - // Delegate bindings are the first example of synthetic bindings that have real binding elements - // and nonsynthetic dependencies. - private ResolvedBindings inlineSyntheticNondelegateContributions( + private ResolvedBindings inlineContributionsWithoutBindingElements( ResolvedBindings resolvedBinding) { - if (!FluentIterable.from(resolvedBinding.contributionBindings()) - .transform(ContributionBinding.KIND) - .anyMatch(IS_SYNTHETIC_KIND)) { + if (Iterables.all(resolvedBinding.bindings(), HAS_BINDING_ELEMENT)) { return resolvedBinding; } @@ -494,13 +487,12 @@ private ResolvedBindings inlineSyntheticNondelegateContributions( queued.allContributionBindings().entries()) { BindingGraph owningGraph = validationForComponent(bindingEntry.getKey()).subject; ContributionBinding binding = bindingEntry.getValue(); - if (binding.isSyntheticBinding() - && !binding.bindingKind().equals(SYNTHETIC_DELEGATE_BINDING)) { + if (binding.bindingElement().isPresent()) { + contributions.put(bindingEntry); + } else { for (DependencyRequest dependency : binding.dependencies()) { queue.add(owningGraph.resolvedBindings().get(dependency.bindingKey())); } - } else { - contributions.put(bindingEntry); } } } @@ -513,7 +505,7 @@ private ResolvedBindings inlineSyntheticNondelegateContributions( private ImmutableListMultimap declarationsByType( ResolvedBindings resolvedBinding) { - ResolvedBindings inlined = inlineSyntheticNondelegateContributions(resolvedBinding); + ResolvedBindings inlined = inlineContributionsWithoutBindingElements(resolvedBinding); return new ImmutableListMultimap.Builder() .putAll(indexByContributionType(inlined.contributionBindings())) .putAll(indexByContributionType(inlined.multibindingDeclarations())) @@ -545,6 +537,23 @@ private void validateNullability(DependencyRequest request, Set multibindingContributionsBuilder = + ImmutableSet.builder(); + for (DependencyRequest dependency : binding.dependencies()) { + multibindingContributionsBuilder.add( + subject.resolvedBindings().get(dependency.bindingKey()).contributionBinding()); + } + ImmutableSet multibindingContributions = + multibindingContributionsBuilder.build(); + validateMapKeySet(path, multibindingContributions); + validateMapKeyAnnotationTypes(path, multibindingContributions); + } + /** * Reports errors if {@code mapBindings} has more than one binding for the same map key. */ @@ -904,13 +913,13 @@ void validateComponentScope() { case PROVISION: incompatiblyScopedMethodsBuilder.add( methodSignatureFormatter.format( - contributionBinding.bindingElementAsExecutable())); + MoreElements.asExecutable(contributionBinding.bindingElement().get()))); break; case INJECTION: incompatiblyScopedMethodsBuilder.add( bindingScope.get().getReadableSource() + " class " - + contributionBinding.bindingTypeElement().getQualifiedName()); + + contributionBinding.bindingTypeElement().get().getQualifiedName()); break; default: throw new IllegalStateException(); @@ -1032,7 +1041,7 @@ private void reportDuplicateBindings(DependencyPath path) { new Formatter(builder) .format(ErrorMessages.DUPLICATE_BINDINGS_FOR_KEY_FORMAT, formatRootRequestKey(path)); ImmutableSet duplicateBindings = - inlineSyntheticNondelegateContributions(resolvedBindings).contributionBindings(); + inlineContributionsWithoutBindingElements(resolvedBindings).contributionBindings(); bindingDeclarationFormatter.formatIndentedList( builder, duplicateBindings, 1, DUPLICATE_SIZE_LIMIT); owningReportBuilder(duplicateBindings).addError(builder.toString(), path.entryPointElement()); diff --git a/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java b/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java index 472c7115a6c..c9114f7338d 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java @@ -50,7 +50,6 @@ import static dagger.internal.codegen.ContributionType.SET; import static dagger.internal.codegen.MapKeys.unwrapValue; import static dagger.internal.codegen.MoreAnnotationMirrors.unwrapOptionalEquivalence; -import static javax.lang.model.element.Modifier.STATIC; /** * An abstract class for a value object representing the mechanism by which a {@link Key} can be @@ -239,7 +238,7 @@ FactoryCreationStrategy factoryCreationStrategy() { case SYNTHETIC_DELEGATE_BINDING: return DELEGATE; case PROVISION: - return implicitDependencies().isEmpty() && bindingElement().getModifiers().contains(STATIC) + return implicitDependencies().isEmpty() && !requiresModuleInstance() ? ENUM_INSTANCE : CLASS_CONSTRUCTOR; case INJECTION: diff --git a/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java b/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java index f4653b538c1..77f8cfa0293 100644 --- a/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java +++ b/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java @@ -24,6 +24,7 @@ import dagger.Binds; import dagger.internal.codegen.ContributionType.HasContributionType; import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.Element; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.type.ExecutableType; @@ -67,7 +68,7 @@ DelegateDeclaration create( return new AutoValue_DelegateDeclaration( ContributionType.fromBindingMethod(bindsMethod), keyFactory.forBindsMethod(bindsMethod, contributingElement), - bindsMethod, + Optional.of(bindsMethod), Optional.of(contributingElement), delegateRequest, wrapOptionalInEquivalence(getMapKey(bindsMethod))); diff --git a/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java b/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java index 276c0447c91..228fe3154f9 100644 --- a/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java @@ -38,7 +38,7 @@ import javax.lang.model.util.Elements; import javax.tools.Diagnostic; -import static com.google.common.base.Preconditions.checkState; +import static com.google.common.base.Preconditions.checkArgument; import static com.squareup.javapoet.MethodSpec.constructorBuilder; import static com.squareup.javapoet.MethodSpec.methodBuilder; import static com.squareup.javapoet.TypeSpec.classBuilder; @@ -90,13 +90,14 @@ ClassName nameGeneratedType(ProvisionBinding binding) { @Override Optional getElementForErrorReporting(ProvisionBinding binding) { - return Optional.of(binding.bindingElement()); + return binding.bindingElement(); } @Override Optional write(ClassName generatedTypeName, ProvisionBinding binding) { // We don't want to write out resolved bindings -- we want to write out the generic version. - checkState(!binding.unresolved().isPresent()); + checkArgument(!binding.unresolved().isPresent()); + checkArgument(binding.bindingElement().isPresent()); if (binding.bindingKind().equals(INJECTION) && !injectValidator.isValidType(binding.factoryType())) { @@ -128,14 +129,11 @@ Optional write(ClassName generatedTypeName, ProvisionBinding b break; case CLASS_CONSTRUCTOR: factoryBuilder = - classBuilder(generatedTypeName) - .addTypeVariables(typeParameters) - .addModifiers(FINAL); + classBuilder(generatedTypeName).addTypeVariables(typeParameters).addModifiers(FINAL); constructorBuilder = Optional.of(constructorBuilder().addModifiers(PUBLIC)); - if (binding.bindingKind().equals(PROVISION) - && !binding.bindingElement().getModifiers().contains(STATIC)) { + if (binding.requiresModuleInstance()) { addConstructorParameterAndTypeField( - TypeName.get(binding.bindingTypeElement().asType()), + TypeName.get(binding.bindingTypeElement().get().asType()), "module", factoryBuilder, constructorBuilder.get()); @@ -228,13 +226,14 @@ Optional write(ClassName generatedTypeName, ProvisionBinding b if (binding.bindingKind().equals(PROVISION)) { CodeBlock.Builder providesMethodInvocationBuilder = CodeBlock.builder(); - if (binding.bindingElement().getModifiers().contains(STATIC)) { - providesMethodInvocationBuilder.add("$T", ClassName.get(binding.bindingTypeElement())); - } else { + if (binding.requiresModuleInstance()) { providesMethodInvocationBuilder.add("module"); + } else { + providesMethodInvocationBuilder.add( + "$T", ClassName.get(binding.bindingTypeElement().get())); } providesMethodInvocationBuilder.add( - ".$L($L)", binding.bindingElement().getSimpleName(), parametersCodeBlock); + ".$L($L)", binding.bindingElement().get().getSimpleName(), parametersCodeBlock); CodeBlock providesMethodInvocation = providesMethodInvocationBuilder.build(); if (binding.nullableType().isPresent() diff --git a/compiler/src/main/java/dagger/internal/codegen/FrameworkField.java b/compiler/src/main/java/dagger/internal/codegen/FrameworkField.java index b7fb2b1357d..f23ccf38fd1 100644 --- a/compiler/src/main/java/dagger/internal/codegen/FrameworkField.java +++ b/compiler/src/main/java/dagger/internal/codegen/FrameworkField.java @@ -91,8 +91,8 @@ private static TypeMirror fieldValueType(ResolvedBindings resolvedBindings) { private static String frameworkFieldName(ResolvedBindings resolvedBindings) { if (resolvedBindings.bindingKey().kind().equals(BindingKey.Kind.CONTRIBUTION)) { ContributionBinding binding = resolvedBindings.contributionBinding(); - if (!binding.isSyntheticBinding()) { - return BINDING_ELEMENT_NAME.visit(binding.bindingElement(), binding); + if (binding.bindingElement().isPresent()) { + return BINDING_ELEMENT_NAME.visit(binding.bindingElement().get(), binding); } } return BindingVariableNamer.name(resolvedBindings.binding()); diff --git a/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java b/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java index ee94329d0f8..1e842224265 100644 --- a/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java +++ b/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java @@ -133,7 +133,7 @@ private void tryToCacheBinding(B binding) { // We only cache resolved bindings or unresolved bindings w/o type arguments. // Unresolved bindings w/ type arguments aren't valid for the object graph. if (binding.unresolved().isPresent() - || binding.bindingTypeElement().getTypeParameters().isEmpty()) { + || binding.bindingTypeElement().get().getTypeParameters().isEmpty()) { Key key = binding.key(); Binding previousValue = bindingsByKey.put(key, binding); checkState(previousValue == null || binding.equals(previousValue), diff --git a/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java b/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java index 2854eb5192c..a3d3bbae2d4 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java @@ -61,13 +61,16 @@ */ @AutoValue abstract class MembersInjectionBinding extends Binding { + @Override + Optional bindingElement() { + return Optional.of(membersInjectedType()); + } + + abstract TypeElement membersInjectedType(); + @Override abstract Optional unresolved(); - TypeElement membersInjectedType() { - return MoreElements.asType(bindingElement()); - } - @Override Optional contributingModule() { return Optional.absent(); @@ -225,9 +228,9 @@ public Key apply(DeclaredType superclass) { Key key = keyFactory.forMembersInjectedType(declaredType); TypeElement typeElement = MoreElements.asType(declaredType.asElement()); return new AutoValue_MembersInjectionBinding( - typeElement, key, dependencies, + typeElement, hasNonDefaultTypeParameters(typeElement, key.type(), types) ? Optional.of( forInjectedType( diff --git a/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java b/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java index 9bb8b16366d..5a3ae304d9c 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java +++ b/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java @@ -146,7 +146,7 @@ private MultibindingDeclaration forDeclaredMethod( "%s must return a set or map", method); return new AutoValue_MultibindingDeclaration( - method, + Optional.of(method), Optional.of(contributingType), keyFactory.forMultibindsMethod(bindingType, methodType, method), contributionType(returnType), diff --git a/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java b/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java index 38ef0ad5118..2b7023d83f6 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java @@ -35,6 +35,7 @@ import javax.lang.model.type.TypeMirror; import javax.lang.model.util.Elements; +import static com.google.common.base.Preconditions.checkArgument; import static com.squareup.javapoet.ClassName.OBJECT; import static com.squareup.javapoet.MethodSpec.constructorBuilder; import static com.squareup.javapoet.MethodSpec.methodBuilder; @@ -56,7 +57,6 @@ import static javax.lang.model.element.Modifier.PRIVATE; import static javax.lang.model.element.Modifier.PROTECTED; import static javax.lang.model.element.Modifier.PUBLIC; -import static javax.lang.model.element.Modifier.STATIC; /** * Generates {@link Producer} implementations from {@link ProductionBinding} instances. @@ -79,11 +79,13 @@ ClassName nameGeneratedType(ProductionBinding binding) { @Override Optional getElementForErrorReporting(ProductionBinding binding) { - return Optional.of(binding.bindingElement()); + return binding.bindingElement(); } @Override Optional write(ClassName generatedTypeName, ProductionBinding binding) { + checkArgument(binding.bindingElement().isPresent()); + TypeName providedTypeName = TypeName.get(binding.factoryType()); TypeName futureTypeName = listenableFutureOf(providedTypeName); @@ -103,8 +105,8 @@ Optional write(ClassName generatedTypeName, ProductionBinding fields.get(binding.monitorRequest().get().bindingKey()).name(), producerTokenConstruction(generatedTypeName, binding)); - if (!binding.bindingElement().getModifiers().contains(STATIC)) { - TypeName moduleType = TypeName.get(binding.bindingTypeElement().asType()); + if (binding.requiresModuleInstance()) { + TypeName moduleType = TypeName.get(binding.bindingTypeElement().get().asType()); addFieldAndConstructorParameter(factoryBuilder, constructorBuilder, "module", moduleType); } @@ -215,8 +217,8 @@ private CodeBlock producerTokenConstruction( "$S", String.format( "%s#%s", - ClassName.get(binding.bindingTypeElement()), - binding.bindingElement().getSimpleName())) + ClassName.get(binding.bindingTypeElement().get()), + binding.bindingElement().get().getSimpleName())) : CodeBlock.of("$T.class", generatedTypeName); return CodeBlock.of("$T.create($L)", PRODUCER_TOKEN, producerTokenArgs); } @@ -457,10 +459,10 @@ private CodeBlock getInvocationCodeBlock( CodeBlock moduleCodeBlock = CodeBlock.of( "$L.$L($L)", - binding.bindingElement().getModifiers().contains(STATIC) - ? CodeBlock.of("$T", ClassName.get(binding.bindingTypeElement())) - : CodeBlock.of("$T.this.module", generatedTypeName), - binding.bindingElement().getSimpleName(), + binding.requiresModuleInstance() + ? CodeBlock.of("$T.this.module", generatedTypeName) + : CodeBlock.of("$T", ClassName.get(binding.bindingTypeElement().get())), + binding.bindingElement().get().getSimpleName(), makeParametersCodeBlock(parameterCodeBlocks)); // NOTE(beder): We don't worry about catching exceptions from the monitor methods themselves diff --git a/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java b/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java index bfe8a099d5a..f27f6bef9b3 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java @@ -162,7 +162,6 @@ ProductionBinding syntheticMapOfValuesOrProducedBinding( requestForMapOfValuesOrProduced, mapOfProducersKey.get()); return ProductionBinding.builder() .contributionType(ContributionType.UNIQUE) - .bindingElement(requestForMapOfProducers.requestElement()) .key(requestForMapOfValuesOrProduced.key()) .dependencies(requestForMapOfProducers) .bindingKind(Kind.SYNTHETIC_MAP) @@ -179,7 +178,6 @@ ProductionBinding syntheticMultibinding( DependencyRequest request, Iterable multibindingContributions) { return ProductionBinding.builder() .contributionType(ContributionType.UNIQUE) - .bindingElement(request.requestElement()) .key(request.key()) .dependencies( dependencyRequestFactory.forMultibindingContributions( @@ -206,7 +204,7 @@ ProductionBinding delegate( DelegateDeclaration delegateDeclaration, ProductionBinding delegateBinding) { return ProductionBinding.builder() .contributionType(delegateDeclaration.contributionType()) - .bindingElement(delegateDeclaration.bindingElement()) + .bindingElement(delegateDeclaration.bindingElement().get()) .contributingModule(delegateDeclaration.contributingModule().get()) .key(keyFactory.forDelegateBinding(delegateDeclaration, Producer.class)) .dependencies(delegateDeclaration.delegateRequest()) diff --git a/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java b/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java index 6d43149b1e6..532778e0cf1 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java @@ -209,13 +209,9 @@ ProvisionBinding syntheticMapOfValuesBinding(DependencyRequest requestForMapOfVa requestForMapOfValues, mapOfProvidersKey.get()); return ProvisionBinding.builder() .contributionType(ContributionType.UNIQUE) - .bindingElement(requestForMapOfProviders.requestElement()) .key(requestForMapOfValues.key()) .dependencies(requestForMapOfProviders) - .wrappedMapKey( - wrapOptionalInEquivalence(getMapKey(requestForMapOfProviders.requestElement()))) .bindingKind(Kind.SYNTHETIC_MAP) - .scope(Scope.uniqueScopeOf(requestForMapOfProviders.requestElement())) .build(); } @@ -229,13 +225,11 @@ ProvisionBinding syntheticMultibinding( DependencyRequest request, Iterable multibindingContributions) { return ProvisionBinding.builder() .contributionType(ContributionType.UNIQUE) - .bindingElement(request.requestElement()) .key(request.key()) .dependencies( dependencyRequestFactory.forMultibindingContributions( request, multibindingContributions)) .bindingKind(Kind.forMultibindingRequest(request)) - .scope(Scope.uniqueScopeOf(request.requestElement())) .build(); } @@ -282,14 +276,14 @@ ProvisionBinding delegate( DelegateDeclaration delegateDeclaration, ProvisionBinding delegate) { return ProvisionBinding.builder() .contributionType(delegateDeclaration.contributionType()) - .bindingElement(delegateDeclaration.bindingElement()) + .bindingElement(delegateDeclaration.bindingElement().get()) .contributingModule(delegateDeclaration.contributingModule().get()) .key(keyFactory.forDelegateBinding(delegateDeclaration, Provider.class)) .dependencies(delegateDeclaration.delegateRequest()) .nullableType(delegate.nullableType()) .wrappedMapKey(delegateDeclaration.wrappedMapKey()) .bindingKind(Kind.SYNTHETIC_DELEGATE_BINDING) - .scope(Scope.uniqueScopeOf(delegateDeclaration.bindingElement())) + .scope(Scope.uniqueScopeOf(delegateDeclaration.bindingElement().get())) .build(); } } diff --git a/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java b/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java index 9bb8d3df3f9..76ff8a72cc6 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java +++ b/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java @@ -20,7 +20,6 @@ import com.google.common.base.Optional; import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSetMultimap; @@ -35,7 +34,6 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; import static com.google.common.collect.Iterables.getOnlyElement; -import static dagger.internal.codegen.ContributionType.indexByContributionType; /** * The collection of bindings that have been resolved for a binding key. For valid graphs, contains @@ -288,38 +286,12 @@ public BindingType bindingType() { /** * The contribution type for these bindings. * - * @throws IllegalStateException if {@link #isEmpty()} or the contribution types conflict + * @throws IllegalStateException if there is not exactly one element in {@link + * #contributionBindings()}, which will never happen for contributions in valid graphs */ @Override public ContributionType contributionType() { - ImmutableSet types = contributionTypes(); - checkState(!types.isEmpty(), "no bindings or declarations for %s", bindingKey()); - checkState( - types.size() == 1, - "More than one binding present of different types for %s: %s", - bindingKey(), - bindingsAndDeclarationsByContributionType()); - return getOnlyElement(types); - } - - /** - * The contribution types represented by {@link #contributionBindings()} and - * {@link #multibindingDeclarations()}. - */ - ImmutableSet contributionTypes() { - return bindingsAndDeclarationsByContributionType().keySet(); - } - - /** - * The {@link #contributionBindings()} and {@link #multibindingDeclarations()}, indexed by - * {@link ContributionType}. - */ - ImmutableListMultimap - bindingsAndDeclarationsByContributionType() { - return new ImmutableListMultimap.Builder() - .putAll(indexByContributionType(contributionBindings())) - .putAll(indexByContributionType(multibindingDeclarations())) - .build(); + return contributionBinding().contributionType(); } /** diff --git a/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java b/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java index ac455d3a0da..8fda68942ea 100644 --- a/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java +++ b/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java @@ -147,8 +147,8 @@ static ClassName generatedClassNameForBinding(Binding binding) { case PROVISION: case PRODUCTION: ContributionBinding contribution = (ContributionBinding) binding; - checkArgument(!contribution.isSyntheticBinding()); - ClassName enclosingClassName = ClassName.get(contribution.bindingTypeElement()); + checkArgument(contribution.bindingTypeElement().isPresent()); + ClassName enclosingClassName = ClassName.get(contribution.bindingTypeElement().get()); switch (contribution.bindingKind()) { case INJECTION: case PROVISION: @@ -203,7 +203,7 @@ private static Optional typeMirrorForBindingTypeParameters(Binding b // the module, not the types of the binding. // Consider: Module { @Provides List provideB(B b) { .. }} // The binding is just parameterized on , but we need all of . - return Optional.of(contributionBinding.bindingTypeElement().asType()); + return Optional.of(contributionBinding.bindingTypeElement().get().asType()); case IMMEDIATE: case FUTURE_PRODUCTION: @@ -267,7 +267,7 @@ private static String factoryPrefix(ContributionBinding binding) { case IMMEDIATE: case FUTURE_PRODUCTION: return CaseFormat.LOWER_CAMEL.to( - UPPER_CAMEL, binding.bindingElement().getSimpleName().toString()); + UPPER_CAMEL, binding.bindingElement().get().getSimpleName().toString()); default: throw new IllegalArgumentException(); @@ -276,7 +276,8 @@ private static String factoryPrefix(ContributionBinding binding) { static ImmutableList bindingTypeElementTypeVariableNames(Binding binding) { ImmutableList.Builder builder = ImmutableList.builder(); - for (TypeParameterElement typeParameter : binding.bindingTypeElement().getTypeParameters()) { + for (TypeParameterElement typeParameter : + binding.bindingTypeElement().get().getTypeParameters()) { builder.add(TypeVariableName.get(typeParameter)); } return builder.build(); From 57bbb43f8acce88022a094d7b09c24d9d0663115 Mon Sep 17 00:00:00 2001 From: dpb Date: Thu, 7 Jul 2016 14:10:02 -0700 Subject: [PATCH 04/17] Let Provider> break dependency cycles. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=126844861 --- .../src/it/functional-tests/src/main/java/test/cycle/Cycles.java | 1 + .../main/java/dagger/internal/codegen/BindingGraphValidator.java | 1 + 2 files changed, 2 insertions(+) diff --git a/compiler/src/it/functional-tests/src/main/java/test/cycle/Cycles.java b/compiler/src/it/functional-tests/src/main/java/test/cycle/Cycles.java index 7ec14458c63..81e7f1bfc2b 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/cycle/Cycles.java +++ b/compiler/src/it/functional-tests/src/main/java/test/cycle/Cycles.java @@ -64,6 +64,7 @@ static class B { static class C { public final Provider aProvider; @Inject public Lazy aLazy; + @Inject public Provider> aLazyProvider; @Inject C(Provider aProvider) { diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java b/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java index 8ac7dd89b7c..34a2786a10a 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java @@ -1177,6 +1177,7 @@ public boolean apply(DependencyRequest dependencyRequest) { switch (dependencyRequest.kind()) { case PROVIDER: case LAZY: + case PROVIDER_OF_LAZY: return true; case INSTANCE: From 633c97b2236d0326f3d2b768957f48af83dcd1a3 Mon Sep 17 00:00:00 2001 From: gak Date: Thu, 7 Jul 2016 16:30:35 -0700 Subject: [PATCH 05/17] Automated g4 rollback of changelist 126801598. *** Reason for rollback *** Broke a build internally *** Original change description *** Make BindingDeclaration's bindingElement optional, so that undeclared bindings such as synthetic multibindings don't use an arbitrary request element. *** ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=126860254 --- .../codegen/AbstractComponentWriter.java | 41 ++++---- .../internal/codegen/BindingDeclaration.java | 94 +++++++------------ .../codegen/BindingDeclarationFormatter.java | 21 ++--- .../dagger/internal/codegen/BindingGraph.java | 4 +- .../codegen/BindingGraphValidator.java | 63 ++++++------- .../internal/codegen/ContributionBinding.java | 3 +- .../internal/codegen/DelegateDeclaration.java | 3 +- .../internal/codegen/FactoryGenerator.java | 25 ++--- .../internal/codegen/FrameworkField.java | 4 +- .../codegen/InjectBindingRegistry.java | 2 +- .../codegen/MembersInjectionBinding.java | 13 +-- .../codegen/MultibindingDeclaration.java | 2 +- .../codegen/ProducerFactoryGenerator.java | 22 ++--- .../internal/codegen/ProductionBinding.java | 4 +- .../internal/codegen/ProvisionBinding.java | 10 +- .../internal/codegen/ResolvedBindings.java | 34 ++++++- .../dagger/internal/codegen/SourceFiles.java | 11 +-- 17 files changed, 176 insertions(+), 180 deletions(-) diff --git a/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java b/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java index d9d48b6e4d5..95b01f38b9b 100644 --- a/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java +++ b/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java @@ -76,6 +76,7 @@ import static dagger.internal.codegen.AnnotationSpecs.SUPPRESS_WARNINGS_UNCHECKED; import static dagger.internal.codegen.CodeBlocks.makeParametersCodeBlock; import static dagger.internal.codegen.ContributionBinding.FactoryCreationStrategy.ENUM_INSTANCE; +import static dagger.internal.codegen.ContributionBinding.Kind.PROVISION; import static dagger.internal.codegen.ErrorMessages.CANNOT_RETURN_NULL_FROM_NON_NULLABLE_COMPONENT_METHOD; import static dagger.internal.codegen.FrameworkDependency.frameworkDependenciesForBinding; import static dagger.internal.codegen.MapKeys.getMapKeyExpression; @@ -116,6 +117,7 @@ import static javax.lang.model.element.Modifier.FINAL; import static javax.lang.model.element.Modifier.PRIVATE; import static javax.lang.model.element.Modifier.PUBLIC; +import static javax.lang.model.element.Modifier.STATIC; import static javax.lang.model.type.TypeKind.DECLARED; import static javax.lang.model.type.TypeKind.VOID; @@ -934,11 +936,14 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi case COMPONENT_PROVISION: { - TypeElement dependencyType = dependencyTypeForBinding(binding); - String dependencyVariable = simpleVariableName(dependencyType); + TypeElement bindingTypeElement = + graph.componentDescriptor().dependencyMethodIndex().get(binding.bindingElement()); + String localFactoryVariable = simpleVariableName(bindingTypeElement); CodeBlock callFactoryMethod = CodeBlock.of( - "$L.$L()", dependencyVariable, binding.bindingElement().get().getSimpleName()); + "$L.$L()", + localFactoryVariable, + binding.bindingElement().getSimpleName().toString()); // TODO(sameb): This throws a very vague NPE right now. The stack trace doesn't // help to figure out what the method or return type is. If we include a string // of the return type or method name in the error message, that can defeat obfuscation. @@ -964,10 +969,10 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi "}"), /* 1 */ FACTORY, /* 2 */ bindingKeyTypeName, - /* 3 */ getComponentContributionExpression(dependencyType), + /* 3 */ getComponentContributionExpression(bindingTypeElement), /* 4 */ nullableAnnotation(binding.nullableType()), - /* 5 */ TypeName.get(dependencyType.asType()), - /* 6 */ dependencyVariable, + /* 5 */ TypeName.get(bindingTypeElement.asType()), + /* 6 */ localFactoryVariable, /* 7 */ getMethodBody); } @@ -982,14 +987,15 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi "}"), /* 1 */ FACTORY, /* 2 */ bindingKeyTypeName, - /* 3 */ binding.bindingElement().get().getSimpleName()); + /* 3 */ binding.bindingElement().getSimpleName().toString()); case INJECTION: case PROVISION: { List arguments = Lists.newArrayListWithCapacity(binding.dependencies().size() + 1); - if (binding.requiresModuleInstance()) { + if (binding.bindingKind().equals(PROVISION) + && !binding.bindingElement().getModifiers().contains(STATIC)) { arguments.add(getComponentContributionExpression(binding.contributingModule().get())); } arguments.addAll(getDependencyArguments(binding)); @@ -1006,7 +1012,8 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi case COMPONENT_PRODUCTION: { - TypeElement dependencyType = dependencyTypeForBinding(binding); + TypeElement bindingTypeElement = + graph.componentDescriptor().dependencyMethodIndex().get(binding.bindingElement()); return CodeBlock.of( Joiner.on('\n') .join( @@ -1019,10 +1026,10 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi /* 1 */ PRODUCER, /* 2 */ TypeName.get(binding.key().type()), /* 3 */ LISTENABLE_FUTURE, - /* 4 */ getComponentContributionExpression(dependencyType), - /* 5 */ binding.bindingElement().get().getSimpleName(), - /* 6 */ TypeName.get(dependencyType.asType()), - /* 7 */ simpleVariableName(dependencyType)); + /* 4 */ getComponentContributionExpression(bindingTypeElement), + /* 5 */ binding.bindingElement().getSimpleName().toString(), + /* 6 */ TypeName.get(bindingTypeElement.asType()), + /* 7 */ simpleVariableName(bindingTypeElement)); } case IMMEDIATE: @@ -1030,8 +1037,8 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi { List arguments = Lists.newArrayListWithCapacity(binding.implicitDependencies().size() + 2); - if (binding.requiresModuleInstance()) { - arguments.add(getComponentContributionExpression(binding.contributingModule().get())); + if (!binding.bindingElement().getModifiers().contains(STATIC)) { + arguments.add(getComponentContributionExpression(binding.bindingTypeElement())); } arguments.addAll(getDependencyArguments(binding)); @@ -1058,10 +1065,6 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi } } - private TypeElement dependencyTypeForBinding(ContributionBinding binding) { - return graph.componentDescriptor().dependencyMethodIndex().get(binding.bindingElement().get()); - } - private CodeBlock decorateForScope(CodeBlock factoryCreate, Scope scope) { return CodeBlock.of( "$T.provider($L)", diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java b/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java index f71c83287bf..7fe894edc6a 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java @@ -15,54 +15,59 @@ */ package dagger.internal.codegen; +import com.google.auto.common.MoreElements; import com.google.common.base.Function; import com.google.common.base.Optional; import com.google.common.base.Predicate; import dagger.internal.codegen.Key.HasKey; import java.util.Set; import javax.lang.model.element.Element; +import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.Modifier; import javax.lang.model.element.TypeElement; +import javax.lang.model.type.DeclaredType; +import static dagger.internal.codegen.Util.AS_DECLARED_TYPE; import static dagger.internal.codegen.Util.ENCLOSING_TYPE_ELEMENT; -import static javax.lang.model.element.Modifier.ABSTRACT; -import static javax.lang.model.element.Modifier.STATIC; /** An object that declares or specifies a binding. */ abstract class BindingDeclaration implements HasKey { - /** - * The {@link Element} that declares the binding. Absent for bindings without identifying - * declarations. - */ - abstract Optional bindingElement(); + /** The {@link Element} that declares the binding. */ + abstract Element bindingElement(); /** - * The type enclosing the {@link #bindingElement()}, or {@link Optional#absent()} if {@link - * #bindingElement()} is absent. + * The {@link ExecutableElement} that declares the binding. Equivalent to + * {@code MoreElements.asExecutable(bindingElement())}. + * + * @throws IllegalStateException if {@link #bindingElement()} is not an executable element */ - Optional bindingTypeElement() { - return bindingElement() - .transform( - new Function() { - @Override - public TypeElement apply(Element element) { - return element.accept(ENCLOSING_TYPE_ELEMENT, null); - } - }); + ExecutableElement bindingElementAsExecutable() { + try { + return MoreElements.asExecutable(bindingElement()); + } catch (IllegalArgumentException e) { + throw new IllegalStateException(e); + } } - + + /** The type enclosing the {@link #bindingElement()}. */ + TypeElement bindingTypeElement() { + return ENCLOSING_TYPE_ELEMENT.visit(bindingElement()); + } + /** - * The installed module class that contributed the {@link #bindingElement()}. May be a subclass of - * the class that contains {@link #bindingElement()}. Absent if {@link #bindingElement()} is - * absent. + * The installed module class that contributed the {@link #bindingElement()}. May be a subclass + * of the class that contains {@link #bindingElement()}. */ abstract Optional contributingModule(); /** - * A function that returns a singleton set containing the {@link #contributingModule()} for - * binding declarations that have one, and an empty set for those that don't. + * The type of {@link #contributingModule()}. */ + Optional contributingModuleType() { + return contributingModule().transform(AS_DECLARED_TYPE); + } + static final Function> CONTRIBUTING_MODULE = new Function>() { @Override @@ -71,39 +76,12 @@ public Set apply(BindingDeclaration bindingDeclaration) { } }; - /** - * {@code true} if {@link #contributingModule()} is present and this is a nonabstract instance - * method. - */ - boolean requiresModuleInstance() { - if (!bindingElement().isPresent() || !contributingModule().isPresent()) { - return false; - } - Set modifiers = bindingElement().get().getModifiers(); - return !modifiers.contains(ABSTRACT) && !modifiers.contains(STATIC); + static Predicate bindingElementHasModifier(final Modifier modifier) { + return new Predicate() { + @Override + public boolean apply(BindingDeclaration bindingDeclaration) { + return bindingDeclaration.bindingElement().getModifiers().contains(modifier); + } + }; } - - /** - * A predicate that passes for binding declarations for which {@link #requiresModuleInstance()} is - * {@code true}. - */ - static final Predicate REQUIRES_MODULE_INSTANCE = - new Predicate() { - @Override - public boolean apply(BindingDeclaration bindingDeclaration) { - return bindingDeclaration.requiresModuleInstance(); - } - }; - - /** - * A predicate that passes for binding declarations for which {@link #bindingElement()} is - * present. - */ - static final Predicate HAS_BINDING_ELEMENT = - new Predicate() { - @Override - public boolean apply(BindingDeclaration bindingDeclaration) { - return bindingDeclaration.bindingElement().isPresent(); - } - }; } diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java b/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java index 22188182192..d682ea4867e 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java @@ -15,12 +15,7 @@ */ package dagger.internal.codegen; -import com.google.auto.common.MoreElements; -import javax.lang.model.element.Element; - -import static com.google.common.base.Preconditions.checkArgument; import static dagger.internal.codegen.ErrorMessages.stripCommonTypePrefixes; -import static dagger.internal.codegen.Util.AS_DECLARED_TYPE; /** * Formats a {@link BindingDeclaration} into a {@link String} suitable for use in error messages. @@ -34,20 +29,16 @@ final class BindingDeclarationFormatter extends Formatter { @Override public String format(BindingDeclaration bindingDeclaration) { - checkArgument( - bindingDeclaration.bindingElement().isPresent(), - "Cannot format bindings without source elements: %s", - bindingDeclaration); - Element bindingElement = bindingDeclaration.bindingElement().get(); - switch (bindingElement.asType().getKind()) { + switch (bindingDeclaration.bindingElement().asType().getKind()) { case EXECUTABLE: return methodSignatureFormatter.format( - MoreElements.asExecutable(bindingElement), - bindingDeclaration.contributingModule().transform(AS_DECLARED_TYPE)); + bindingDeclaration.bindingElementAsExecutable(), + bindingDeclaration.contributingModuleType()); case DECLARED: - return stripCommonTypePrefixes(bindingElement.asType().toString()); + return stripCommonTypePrefixes(bindingDeclaration.bindingElement().asType().toString()); default: - throw new IllegalArgumentException("Formatting unsupported for element: " + bindingElement); + throw new IllegalArgumentException( + "Formatting unsupported for element: " + bindingDeclaration.bindingElement()); } } } diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java b/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java index a2bdf2fe924..ee00ed823eb 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java @@ -79,6 +79,7 @@ import static dagger.internal.codegen.Key.indexByKey; import static dagger.internal.codegen.Scope.reusableScope; import static javax.lang.model.element.Modifier.ABSTRACT; +import static javax.lang.model.element.Modifier.STATIC; /** * The canonical representation of a full-resolved graph. @@ -128,7 +129,8 @@ ImmutableSet componentRequirements() { .preOrderTraversal(this) .transformAndConcat(RESOLVED_BINDINGS) .transformAndConcat(ResolvedBindings.CONTRIBUTION_BINDINGS) - .filter(BindingDeclaration.REQUIRES_MODULE_INSTANCE) + .filter(not(BindingDeclaration.bindingElementHasModifier(STATIC))) + .filter(not(BindingDeclaration.bindingElementHasModifier(ABSTRACT))) .transformAndConcat(BindingDeclaration.CONTRIBUTING_MODULE) .filter(in(ownedModuleTypes())) .append(componentDescriptor().dependencies()) diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java b/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java index 34a2786a10a..b9826d3bf48 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java @@ -72,7 +72,6 @@ import static com.google.auto.common.MoreTypes.asDeclared; import static com.google.auto.common.MoreTypes.asExecutable; import static com.google.auto.common.MoreTypes.asTypeElements; -import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Predicates.equalTo; import static com.google.common.base.Predicates.in; @@ -82,7 +81,6 @@ import static com.google.common.collect.Iterables.getOnlyElement; import static com.google.common.collect.Iterables.indexOf; import static com.google.common.collect.Maps.filterKeys; -import static dagger.internal.codegen.BindingDeclaration.HAS_BINDING_ELEMENT; import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodDescriptor.isOfKind; import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodKind.PRODUCTION_SUBCOMPONENT; import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodKind.SUBCOMPONENT; @@ -90,6 +88,8 @@ import static dagger.internal.codegen.ContributionBinding.indexMapBindingsByAnnotationType; import static dagger.internal.codegen.ContributionBinding.indexMapBindingsByMapKey; import static dagger.internal.codegen.ContributionBinding.Kind.INJECTION; +import static dagger.internal.codegen.ContributionBinding.Kind.IS_SYNTHETIC_KIND; +import static dagger.internal.codegen.ContributionBinding.Kind.SYNTHETIC_DELEGATE_BINDING; import static dagger.internal.codegen.ContributionBinding.Kind.SYNTHETIC_MULTIBOUND_MAP; import static dagger.internal.codegen.ContributionType.indexByContributionType; import static dagger.internal.codegen.ErrorMessages.CANNOT_INJECT_WILDCARD_TYPE; @@ -425,7 +425,10 @@ && doesPathRequireProvisionOnly(path)) { } } if (contributionBinding.bindingKind().equals(SYNTHETIC_MULTIBOUND_MAP)) { - validateMapKeys(path, contributionBinding); + ImmutableSet multibindings = + inlineSyntheticNondelegateContributions(resolvedBindings).contributionBindings(); + validateMapKeySet(path, multibindings); + validateMapKeyAnnotationTypes(path, multibindings); } break; case MEMBERS_INJECTION: @@ -448,28 +451,32 @@ && doesPathRequireProvisionOnly(path)) { /** * Returns an object that contains all the same bindings as {@code resolvedBindings}, except - * that any {@link ContributionBinding}s without {@linkplain Binding#bindingElement() binding - * elements} are replaced by the contribution bindings and multibinding declarations of their - * dependencies. + * that any synthetic {@link ContributionBinding}s are replaced by the contribution bindings and + * multibinding declarations of their dependencies. * *

For example, if: * *

* - * then {@code inlineContributionsWithoutBindingElements(bindingsForKey1)} has bindings {@code - * A}, {@code C}, and {@code D}, with multibinding declarations {@code X} and {@code Y}. + * then {@code inlineSyntheticNondelegateContributions(bindingsForKey1)} has bindings {@code A}, + * {@code C}, and {@code D}, with multibinding declarations {@code X} and {@code Y}. * - *

The replacement is repeated until all of the bindings have elements. + *

The replacement is repeated until none of the bindings are synthetic. */ - private ResolvedBindings inlineContributionsWithoutBindingElements( + // TODO(dpb): The actual operation we want is to inline bindings without real binding elements. + // Delegate bindings are the first example of synthetic bindings that have real binding elements + // and nonsynthetic dependencies. + private ResolvedBindings inlineSyntheticNondelegateContributions( ResolvedBindings resolvedBinding) { - if (Iterables.all(resolvedBinding.bindings(), HAS_BINDING_ELEMENT)) { + if (!FluentIterable.from(resolvedBinding.contributionBindings()) + .transform(ContributionBinding.KIND) + .anyMatch(IS_SYNTHETIC_KIND)) { return resolvedBinding; } @@ -487,12 +494,13 @@ private ResolvedBindings inlineContributionsWithoutBindingElements( queued.allContributionBindings().entries()) { BindingGraph owningGraph = validationForComponent(bindingEntry.getKey()).subject; ContributionBinding binding = bindingEntry.getValue(); - if (binding.bindingElement().isPresent()) { - contributions.put(bindingEntry); - } else { + if (binding.isSyntheticBinding() + && !binding.bindingKind().equals(SYNTHETIC_DELEGATE_BINDING)) { for (DependencyRequest dependency : binding.dependencies()) { queue.add(owningGraph.resolvedBindings().get(dependency.bindingKey())); } + } else { + contributions.put(bindingEntry); } } } @@ -505,7 +513,7 @@ private ResolvedBindings inlineContributionsWithoutBindingElements( private ImmutableListMultimap declarationsByType( ResolvedBindings resolvedBinding) { - ResolvedBindings inlined = inlineContributionsWithoutBindingElements(resolvedBinding); + ResolvedBindings inlined = inlineSyntheticNondelegateContributions(resolvedBinding); return new ImmutableListMultimap.Builder() .putAll(indexByContributionType(inlined.contributionBindings())) .putAll(indexByContributionType(inlined.multibindingDeclarations())) @@ -537,23 +545,6 @@ private void validateNullability(DependencyRequest request, Set multibindingContributionsBuilder = - ImmutableSet.builder(); - for (DependencyRequest dependency : binding.dependencies()) { - multibindingContributionsBuilder.add( - subject.resolvedBindings().get(dependency.bindingKey()).contributionBinding()); - } - ImmutableSet multibindingContributions = - multibindingContributionsBuilder.build(); - validateMapKeySet(path, multibindingContributions); - validateMapKeyAnnotationTypes(path, multibindingContributions); - } - /** * Reports errors if {@code mapBindings} has more than one binding for the same map key. */ @@ -913,13 +904,13 @@ void validateComponentScope() { case PROVISION: incompatiblyScopedMethodsBuilder.add( methodSignatureFormatter.format( - MoreElements.asExecutable(contributionBinding.bindingElement().get()))); + contributionBinding.bindingElementAsExecutable())); break; case INJECTION: incompatiblyScopedMethodsBuilder.add( bindingScope.get().getReadableSource() + " class " - + contributionBinding.bindingTypeElement().get().getQualifiedName()); + + contributionBinding.bindingTypeElement().getQualifiedName()); break; default: throw new IllegalStateException(); @@ -1041,7 +1032,7 @@ private void reportDuplicateBindings(DependencyPath path) { new Formatter(builder) .format(ErrorMessages.DUPLICATE_BINDINGS_FOR_KEY_FORMAT, formatRootRequestKey(path)); ImmutableSet duplicateBindings = - inlineContributionsWithoutBindingElements(resolvedBindings).contributionBindings(); + inlineSyntheticNondelegateContributions(resolvedBindings).contributionBindings(); bindingDeclarationFormatter.formatIndentedList( builder, duplicateBindings, 1, DUPLICATE_SIZE_LIMIT); owningReportBuilder(duplicateBindings).addError(builder.toString(), path.entryPointElement()); diff --git a/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java b/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java index c9114f7338d..472c7115a6c 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java @@ -50,6 +50,7 @@ import static dagger.internal.codegen.ContributionType.SET; import static dagger.internal.codegen.MapKeys.unwrapValue; import static dagger.internal.codegen.MoreAnnotationMirrors.unwrapOptionalEquivalence; +import static javax.lang.model.element.Modifier.STATIC; /** * An abstract class for a value object representing the mechanism by which a {@link Key} can be @@ -238,7 +239,7 @@ FactoryCreationStrategy factoryCreationStrategy() { case SYNTHETIC_DELEGATE_BINDING: return DELEGATE; case PROVISION: - return implicitDependencies().isEmpty() && !requiresModuleInstance() + return implicitDependencies().isEmpty() && bindingElement().getModifiers().contains(STATIC) ? ENUM_INSTANCE : CLASS_CONSTRUCTOR; case INJECTION: diff --git a/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java b/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java index 77f8cfa0293..f4653b538c1 100644 --- a/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java +++ b/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java @@ -24,7 +24,6 @@ import dagger.Binds; import dagger.internal.codegen.ContributionType.HasContributionType; import javax.lang.model.element.AnnotationMirror; -import javax.lang.model.element.Element; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.type.ExecutableType; @@ -68,7 +67,7 @@ DelegateDeclaration create( return new AutoValue_DelegateDeclaration( ContributionType.fromBindingMethod(bindsMethod), keyFactory.forBindsMethod(bindsMethod, contributingElement), - Optional.of(bindsMethod), + bindsMethod, Optional.of(contributingElement), delegateRequest, wrapOptionalInEquivalence(getMapKey(bindsMethod))); diff --git a/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java b/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java index 228fe3154f9..276c0447c91 100644 --- a/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java @@ -38,7 +38,7 @@ import javax.lang.model.util.Elements; import javax.tools.Diagnostic; -import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkState; import static com.squareup.javapoet.MethodSpec.constructorBuilder; import static com.squareup.javapoet.MethodSpec.methodBuilder; import static com.squareup.javapoet.TypeSpec.classBuilder; @@ -90,14 +90,13 @@ ClassName nameGeneratedType(ProvisionBinding binding) { @Override Optional getElementForErrorReporting(ProvisionBinding binding) { - return binding.bindingElement(); + return Optional.of(binding.bindingElement()); } @Override Optional write(ClassName generatedTypeName, ProvisionBinding binding) { // We don't want to write out resolved bindings -- we want to write out the generic version. - checkArgument(!binding.unresolved().isPresent()); - checkArgument(binding.bindingElement().isPresent()); + checkState(!binding.unresolved().isPresent()); if (binding.bindingKind().equals(INJECTION) && !injectValidator.isValidType(binding.factoryType())) { @@ -129,11 +128,14 @@ Optional write(ClassName generatedTypeName, ProvisionBinding b break; case CLASS_CONSTRUCTOR: factoryBuilder = - classBuilder(generatedTypeName).addTypeVariables(typeParameters).addModifiers(FINAL); + classBuilder(generatedTypeName) + .addTypeVariables(typeParameters) + .addModifiers(FINAL); constructorBuilder = Optional.of(constructorBuilder().addModifiers(PUBLIC)); - if (binding.requiresModuleInstance()) { + if (binding.bindingKind().equals(PROVISION) + && !binding.bindingElement().getModifiers().contains(STATIC)) { addConstructorParameterAndTypeField( - TypeName.get(binding.bindingTypeElement().get().asType()), + TypeName.get(binding.bindingTypeElement().asType()), "module", factoryBuilder, constructorBuilder.get()); @@ -226,14 +228,13 @@ Optional write(ClassName generatedTypeName, ProvisionBinding b if (binding.bindingKind().equals(PROVISION)) { CodeBlock.Builder providesMethodInvocationBuilder = CodeBlock.builder(); - if (binding.requiresModuleInstance()) { - providesMethodInvocationBuilder.add("module"); + if (binding.bindingElement().getModifiers().contains(STATIC)) { + providesMethodInvocationBuilder.add("$T", ClassName.get(binding.bindingTypeElement())); } else { - providesMethodInvocationBuilder.add( - "$T", ClassName.get(binding.bindingTypeElement().get())); + providesMethodInvocationBuilder.add("module"); } providesMethodInvocationBuilder.add( - ".$L($L)", binding.bindingElement().get().getSimpleName(), parametersCodeBlock); + ".$L($L)", binding.bindingElement().getSimpleName(), parametersCodeBlock); CodeBlock providesMethodInvocation = providesMethodInvocationBuilder.build(); if (binding.nullableType().isPresent() diff --git a/compiler/src/main/java/dagger/internal/codegen/FrameworkField.java b/compiler/src/main/java/dagger/internal/codegen/FrameworkField.java index f23ccf38fd1..b7fb2b1357d 100644 --- a/compiler/src/main/java/dagger/internal/codegen/FrameworkField.java +++ b/compiler/src/main/java/dagger/internal/codegen/FrameworkField.java @@ -91,8 +91,8 @@ private static TypeMirror fieldValueType(ResolvedBindings resolvedBindings) { private static String frameworkFieldName(ResolvedBindings resolvedBindings) { if (resolvedBindings.bindingKey().kind().equals(BindingKey.Kind.CONTRIBUTION)) { ContributionBinding binding = resolvedBindings.contributionBinding(); - if (binding.bindingElement().isPresent()) { - return BINDING_ELEMENT_NAME.visit(binding.bindingElement().get(), binding); + if (!binding.isSyntheticBinding()) { + return BINDING_ELEMENT_NAME.visit(binding.bindingElement(), binding); } } return BindingVariableNamer.name(resolvedBindings.binding()); diff --git a/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java b/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java index 1e842224265..ee94329d0f8 100644 --- a/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java +++ b/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java @@ -133,7 +133,7 @@ private void tryToCacheBinding(B binding) { // We only cache resolved bindings or unresolved bindings w/o type arguments. // Unresolved bindings w/ type arguments aren't valid for the object graph. if (binding.unresolved().isPresent() - || binding.bindingTypeElement().get().getTypeParameters().isEmpty()) { + || binding.bindingTypeElement().getTypeParameters().isEmpty()) { Key key = binding.key(); Binding previousValue = bindingsByKey.put(key, binding); checkState(previousValue == null || binding.equals(previousValue), diff --git a/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java b/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java index a3d3bbae2d4..2854eb5192c 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java @@ -61,16 +61,13 @@ */ @AutoValue abstract class MembersInjectionBinding extends Binding { - @Override - Optional bindingElement() { - return Optional.of(membersInjectedType()); - } - - abstract TypeElement membersInjectedType(); - @Override abstract Optional unresolved(); + TypeElement membersInjectedType() { + return MoreElements.asType(bindingElement()); + } + @Override Optional contributingModule() { return Optional.absent(); @@ -228,9 +225,9 @@ public Key apply(DeclaredType superclass) { Key key = keyFactory.forMembersInjectedType(declaredType); TypeElement typeElement = MoreElements.asType(declaredType.asElement()); return new AutoValue_MembersInjectionBinding( + typeElement, key, dependencies, - typeElement, hasNonDefaultTypeParameters(typeElement, key.type(), types) ? Optional.of( forInjectedType( diff --git a/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java b/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java index 5a3ae304d9c..9bb8b16366d 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java +++ b/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java @@ -146,7 +146,7 @@ private MultibindingDeclaration forDeclaredMethod( "%s must return a set or map", method); return new AutoValue_MultibindingDeclaration( - Optional.of(method), + method, Optional.of(contributingType), keyFactory.forMultibindsMethod(bindingType, methodType, method), contributionType(returnType), diff --git a/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java b/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java index 2b7023d83f6..38ef0ad5118 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java @@ -35,7 +35,6 @@ import javax.lang.model.type.TypeMirror; import javax.lang.model.util.Elements; -import static com.google.common.base.Preconditions.checkArgument; import static com.squareup.javapoet.ClassName.OBJECT; import static com.squareup.javapoet.MethodSpec.constructorBuilder; import static com.squareup.javapoet.MethodSpec.methodBuilder; @@ -57,6 +56,7 @@ import static javax.lang.model.element.Modifier.PRIVATE; import static javax.lang.model.element.Modifier.PROTECTED; import static javax.lang.model.element.Modifier.PUBLIC; +import static javax.lang.model.element.Modifier.STATIC; /** * Generates {@link Producer} implementations from {@link ProductionBinding} instances. @@ -79,13 +79,11 @@ ClassName nameGeneratedType(ProductionBinding binding) { @Override Optional getElementForErrorReporting(ProductionBinding binding) { - return binding.bindingElement(); + return Optional.of(binding.bindingElement()); } @Override Optional write(ClassName generatedTypeName, ProductionBinding binding) { - checkArgument(binding.bindingElement().isPresent()); - TypeName providedTypeName = TypeName.get(binding.factoryType()); TypeName futureTypeName = listenableFutureOf(providedTypeName); @@ -105,8 +103,8 @@ Optional write(ClassName generatedTypeName, ProductionBinding fields.get(binding.monitorRequest().get().bindingKey()).name(), producerTokenConstruction(generatedTypeName, binding)); - if (binding.requiresModuleInstance()) { - TypeName moduleType = TypeName.get(binding.bindingTypeElement().get().asType()); + if (!binding.bindingElement().getModifiers().contains(STATIC)) { + TypeName moduleType = TypeName.get(binding.bindingTypeElement().asType()); addFieldAndConstructorParameter(factoryBuilder, constructorBuilder, "module", moduleType); } @@ -217,8 +215,8 @@ private CodeBlock producerTokenConstruction( "$S", String.format( "%s#%s", - ClassName.get(binding.bindingTypeElement().get()), - binding.bindingElement().get().getSimpleName())) + ClassName.get(binding.bindingTypeElement()), + binding.bindingElement().getSimpleName())) : CodeBlock.of("$T.class", generatedTypeName); return CodeBlock.of("$T.create($L)", PRODUCER_TOKEN, producerTokenArgs); } @@ -459,10 +457,10 @@ private CodeBlock getInvocationCodeBlock( CodeBlock moduleCodeBlock = CodeBlock.of( "$L.$L($L)", - binding.requiresModuleInstance() - ? CodeBlock.of("$T.this.module", generatedTypeName) - : CodeBlock.of("$T", ClassName.get(binding.bindingTypeElement().get())), - binding.bindingElement().get().getSimpleName(), + binding.bindingElement().getModifiers().contains(STATIC) + ? CodeBlock.of("$T", ClassName.get(binding.bindingTypeElement())) + : CodeBlock.of("$T.this.module", generatedTypeName), + binding.bindingElement().getSimpleName(), makeParametersCodeBlock(parameterCodeBlocks)); // NOTE(beder): We don't worry about catching exceptions from the monitor methods themselves diff --git a/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java b/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java index f27f6bef9b3..bfe8a099d5a 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java @@ -162,6 +162,7 @@ ProductionBinding syntheticMapOfValuesOrProducedBinding( requestForMapOfValuesOrProduced, mapOfProducersKey.get()); return ProductionBinding.builder() .contributionType(ContributionType.UNIQUE) + .bindingElement(requestForMapOfProducers.requestElement()) .key(requestForMapOfValuesOrProduced.key()) .dependencies(requestForMapOfProducers) .bindingKind(Kind.SYNTHETIC_MAP) @@ -178,6 +179,7 @@ ProductionBinding syntheticMultibinding( DependencyRequest request, Iterable multibindingContributions) { return ProductionBinding.builder() .contributionType(ContributionType.UNIQUE) + .bindingElement(request.requestElement()) .key(request.key()) .dependencies( dependencyRequestFactory.forMultibindingContributions( @@ -204,7 +206,7 @@ ProductionBinding delegate( DelegateDeclaration delegateDeclaration, ProductionBinding delegateBinding) { return ProductionBinding.builder() .contributionType(delegateDeclaration.contributionType()) - .bindingElement(delegateDeclaration.bindingElement().get()) + .bindingElement(delegateDeclaration.bindingElement()) .contributingModule(delegateDeclaration.contributingModule().get()) .key(keyFactory.forDelegateBinding(delegateDeclaration, Producer.class)) .dependencies(delegateDeclaration.delegateRequest()) diff --git a/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java b/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java index 532778e0cf1..6d43149b1e6 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java @@ -209,9 +209,13 @@ ProvisionBinding syntheticMapOfValuesBinding(DependencyRequest requestForMapOfVa requestForMapOfValues, mapOfProvidersKey.get()); return ProvisionBinding.builder() .contributionType(ContributionType.UNIQUE) + .bindingElement(requestForMapOfProviders.requestElement()) .key(requestForMapOfValues.key()) .dependencies(requestForMapOfProviders) + .wrappedMapKey( + wrapOptionalInEquivalence(getMapKey(requestForMapOfProviders.requestElement()))) .bindingKind(Kind.SYNTHETIC_MAP) + .scope(Scope.uniqueScopeOf(requestForMapOfProviders.requestElement())) .build(); } @@ -225,11 +229,13 @@ ProvisionBinding syntheticMultibinding( DependencyRequest request, Iterable multibindingContributions) { return ProvisionBinding.builder() .contributionType(ContributionType.UNIQUE) + .bindingElement(request.requestElement()) .key(request.key()) .dependencies( dependencyRequestFactory.forMultibindingContributions( request, multibindingContributions)) .bindingKind(Kind.forMultibindingRequest(request)) + .scope(Scope.uniqueScopeOf(request.requestElement())) .build(); } @@ -276,14 +282,14 @@ ProvisionBinding delegate( DelegateDeclaration delegateDeclaration, ProvisionBinding delegate) { return ProvisionBinding.builder() .contributionType(delegateDeclaration.contributionType()) - .bindingElement(delegateDeclaration.bindingElement().get()) + .bindingElement(delegateDeclaration.bindingElement()) .contributingModule(delegateDeclaration.contributingModule().get()) .key(keyFactory.forDelegateBinding(delegateDeclaration, Provider.class)) .dependencies(delegateDeclaration.delegateRequest()) .nullableType(delegate.nullableType()) .wrappedMapKey(delegateDeclaration.wrappedMapKey()) .bindingKind(Kind.SYNTHETIC_DELEGATE_BINDING) - .scope(Scope.uniqueScopeOf(delegateDeclaration.bindingElement().get())) + .scope(Scope.uniqueScopeOf(delegateDeclaration.bindingElement())) .build(); } } diff --git a/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java b/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java index 76ff8a72cc6..9bb8d3df3f9 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java +++ b/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java @@ -20,6 +20,7 @@ import com.google.common.base.Optional; import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSetMultimap; @@ -34,6 +35,7 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; import static com.google.common.collect.Iterables.getOnlyElement; +import static dagger.internal.codegen.ContributionType.indexByContributionType; /** * The collection of bindings that have been resolved for a binding key. For valid graphs, contains @@ -286,12 +288,38 @@ public BindingType bindingType() { /** * The contribution type for these bindings. * - * @throws IllegalStateException if there is not exactly one element in {@link - * #contributionBindings()}, which will never happen for contributions in valid graphs + * @throws IllegalStateException if {@link #isEmpty()} or the contribution types conflict */ @Override public ContributionType contributionType() { - return contributionBinding().contributionType(); + ImmutableSet types = contributionTypes(); + checkState(!types.isEmpty(), "no bindings or declarations for %s", bindingKey()); + checkState( + types.size() == 1, + "More than one binding present of different types for %s: %s", + bindingKey(), + bindingsAndDeclarationsByContributionType()); + return getOnlyElement(types); + } + + /** + * The contribution types represented by {@link #contributionBindings()} and + * {@link #multibindingDeclarations()}. + */ + ImmutableSet contributionTypes() { + return bindingsAndDeclarationsByContributionType().keySet(); + } + + /** + * The {@link #contributionBindings()} and {@link #multibindingDeclarations()}, indexed by + * {@link ContributionType}. + */ + ImmutableListMultimap + bindingsAndDeclarationsByContributionType() { + return new ImmutableListMultimap.Builder() + .putAll(indexByContributionType(contributionBindings())) + .putAll(indexByContributionType(multibindingDeclarations())) + .build(); } /** diff --git a/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java b/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java index 8fda68942ea..ac455d3a0da 100644 --- a/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java +++ b/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java @@ -147,8 +147,8 @@ static ClassName generatedClassNameForBinding(Binding binding) { case PROVISION: case PRODUCTION: ContributionBinding contribution = (ContributionBinding) binding; - checkArgument(contribution.bindingTypeElement().isPresent()); - ClassName enclosingClassName = ClassName.get(contribution.bindingTypeElement().get()); + checkArgument(!contribution.isSyntheticBinding()); + ClassName enclosingClassName = ClassName.get(contribution.bindingTypeElement()); switch (contribution.bindingKind()) { case INJECTION: case PROVISION: @@ -203,7 +203,7 @@ private static Optional typeMirrorForBindingTypeParameters(Binding b // the module, not the types of the binding. // Consider: Module { @Provides List provideB(B b) { .. }} // The binding is just parameterized on , but we need all of . - return Optional.of(contributionBinding.bindingTypeElement().get().asType()); + return Optional.of(contributionBinding.bindingTypeElement().asType()); case IMMEDIATE: case FUTURE_PRODUCTION: @@ -267,7 +267,7 @@ private static String factoryPrefix(ContributionBinding binding) { case IMMEDIATE: case FUTURE_PRODUCTION: return CaseFormat.LOWER_CAMEL.to( - UPPER_CAMEL, binding.bindingElement().get().getSimpleName().toString()); + UPPER_CAMEL, binding.bindingElement().getSimpleName().toString()); default: throw new IllegalArgumentException(); @@ -276,8 +276,7 @@ private static String factoryPrefix(ContributionBinding binding) { static ImmutableList bindingTypeElementTypeVariableNames(Binding binding) { ImmutableList.Builder builder = ImmutableList.builder(); - for (TypeParameterElement typeParameter : - binding.bindingTypeElement().get().getTypeParameters()) { + for (TypeParameterElement typeParameter : binding.bindingTypeElement().getTypeParameters()) { builder.add(TypeVariableName.get(typeParameter)); } return builder.build(); From 788eaea98653a0ca54565ad8b4260ff7fb554b10 Mon Sep 17 00:00:00 2001 From: ronshapiro Date: Fri, 8 Jul 2016 09:06:59 -0700 Subject: [PATCH 06/17] Update to 2.6-SNAPSHOT ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=126916632 --- compiler/pom.xml | 2 +- compiler/src/it/functional-tests/pom.xml | 2 +- compiler/src/it/producers-functional-tests/pom.xml | 2 +- compiler/src/it/tck/pom.xml | 2 +- core/pom.xml | 2 +- examples/android-activity-graphs/pom.xml | 2 +- examples/android-simple/pom.xml | 2 +- examples/pom.xml | 2 +- examples/simple/pom.xml | 2 +- gwt/pom.xml | 2 +- pom.xml | 2 +- producers/pom.xml | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/compiler/pom.xml b/compiler/pom.xml index 5a982c35e3e..b91a49a6ad5 100644 --- a/compiler/pom.xml +++ b/compiler/pom.xml @@ -21,7 +21,7 @@ com.google.dagger dagger-parent - 2.5-SNAPSHOT + 2.6-snapshot dagger-compiler diff --git a/compiler/src/it/functional-tests/pom.xml b/compiler/src/it/functional-tests/pom.xml index 9d1ab456714..c5e34321d24 100644 --- a/compiler/src/it/functional-tests/pom.xml +++ b/compiler/src/it/functional-tests/pom.xml @@ -22,7 +22,7 @@ limitations under the License. com.google.dagger dagger-parent - 2.5-SNAPSHOT + 2.6-snapshot dagger.tests functional-tests diff --git a/compiler/src/it/producers-functional-tests/pom.xml b/compiler/src/it/producers-functional-tests/pom.xml index df96e0b1dad..ae10b3cc2ab 100644 --- a/compiler/src/it/producers-functional-tests/pom.xml +++ b/compiler/src/it/producers-functional-tests/pom.xml @@ -22,7 +22,7 @@ limitations under the License. com.google.dagger dagger-parent - 2.5-SNAPSHOT + 2.6-snapshot dagger.tests producers-functional-tests diff --git a/compiler/src/it/tck/pom.xml b/compiler/src/it/tck/pom.xml index 022dc233e21..22e069de7b0 100644 --- a/compiler/src/it/tck/pom.xml +++ b/compiler/src/it/tck/pom.xml @@ -22,7 +22,7 @@ limitations under the License. com.google.dagger dagger-parent - 2.5-SNAPSHOT + 2.6-snapshot dagger.tests tck diff --git a/core/pom.xml b/core/pom.xml index 76559449af1..12e84c123a8 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -20,7 +20,7 @@ com.google.dagger dagger-parent - 2.5-SNAPSHOT + 2.6-snapshot dagger diff --git a/examples/android-activity-graphs/pom.xml b/examples/android-activity-graphs/pom.xml index 6c77a198be1..24098fcf1ce 100644 --- a/examples/android-activity-graphs/pom.xml +++ b/examples/android-activity-graphs/pom.xml @@ -20,7 +20,7 @@ com.google.dagger.example dagger-example-parent - 2.5-SNAPSHOT + 2.6-snapshot android-activity-graphs diff --git a/examples/android-simple/pom.xml b/examples/android-simple/pom.xml index fff3de566b4..d14207d08af 100644 --- a/examples/android-simple/pom.xml +++ b/examples/android-simple/pom.xml @@ -20,7 +20,7 @@ com.google.dagger.example dagger-example-parent - 2.5-SNAPSHOT + 2.6-snapshot android-simple diff --git a/examples/pom.xml b/examples/pom.xml index d5d04b3ce87..a8970e59292 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -21,7 +21,7 @@ com.google.dagger dagger-parent - 2.5-SNAPSHOT + 2.6-snapshot com.google.dagger.example diff --git a/examples/simple/pom.xml b/examples/simple/pom.xml index f9bd6929562..749c67f6a44 100644 --- a/examples/simple/pom.xml +++ b/examples/simple/pom.xml @@ -20,7 +20,7 @@ com.google.dagger.example dagger-example-parent - 2.5-SNAPSHOT + 2.6-snapshot simple diff --git a/gwt/pom.xml b/gwt/pom.xml index 06d031fb72f..072daf7795b 100644 --- a/gwt/pom.xml +++ b/gwt/pom.xml @@ -22,7 +22,7 @@ com.google.dagger dagger-parent - 2.5-SNAPSHOT + 2.6-snapshot dagger-gwt diff --git a/pom.xml b/pom.xml index 843fcf1fb6d..cbb586035c0 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ com.google.dagger dagger-parent pom - 2.5-SNAPSHOT + 2.6-snapshot Dagger (Parent) A fast dependency injector for Android and Java. https://github.com/square/dagger diff --git a/producers/pom.xml b/producers/pom.xml index b20421b6277..59965fc420d 100644 --- a/producers/pom.xml +++ b/producers/pom.xml @@ -20,7 +20,7 @@ com.google.dagger dagger-parent - 2.5-SNAPSHOT + 2.6-snapshot dagger-producers From dd276032f8a180314ba2c8be8e68304d9a28e301 Mon Sep 17 00:00:00 2001 From: dpb Date: Mon, 11 Jul 2016 09:34:43 -0700 Subject: [PATCH 07/17] Make BindingDeclaration's bindingElement optional, so that undeclared bindings such as synthetic multibindings don't use an arbitrary request element. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=127095001 --- .../codegen/AbstractComponentWriter.java | 41 ++++---- .../internal/codegen/BindingDeclaration.java | 94 ++++++++++++------- .../codegen/BindingDeclarationFormatter.java | 21 +++-- .../dagger/internal/codegen/BindingGraph.java | 4 +- .../codegen/BindingGraphValidator.java | 63 +++++++------ .../internal/codegen/ContributionBinding.java | 3 +- .../internal/codegen/DelegateDeclaration.java | 3 +- .../internal/codegen/FactoryGenerator.java | 25 +++-- .../internal/codegen/FrameworkField.java | 4 +- .../codegen/InjectBindingRegistry.java | 2 +- .../codegen/MembersInjectionBinding.java | 13 ++- .../codegen/MultibindingDeclaration.java | 2 +- .../codegen/ProducerFactoryGenerator.java | 22 +++-- .../internal/codegen/ProductionBinding.java | 4 +- .../internal/codegen/ProvisionBinding.java | 10 +- .../internal/codegen/ResolvedBindings.java | 34 +------ .../dagger/internal/codegen/SourceFiles.java | 11 ++- 17 files changed, 180 insertions(+), 176 deletions(-) diff --git a/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java b/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java index 95b01f38b9b..d9d48b6e4d5 100644 --- a/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java +++ b/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java @@ -76,7 +76,6 @@ import static dagger.internal.codegen.AnnotationSpecs.SUPPRESS_WARNINGS_UNCHECKED; import static dagger.internal.codegen.CodeBlocks.makeParametersCodeBlock; import static dagger.internal.codegen.ContributionBinding.FactoryCreationStrategy.ENUM_INSTANCE; -import static dagger.internal.codegen.ContributionBinding.Kind.PROVISION; import static dagger.internal.codegen.ErrorMessages.CANNOT_RETURN_NULL_FROM_NON_NULLABLE_COMPONENT_METHOD; import static dagger.internal.codegen.FrameworkDependency.frameworkDependenciesForBinding; import static dagger.internal.codegen.MapKeys.getMapKeyExpression; @@ -117,7 +116,6 @@ import static javax.lang.model.element.Modifier.FINAL; import static javax.lang.model.element.Modifier.PRIVATE; import static javax.lang.model.element.Modifier.PUBLIC; -import static javax.lang.model.element.Modifier.STATIC; import static javax.lang.model.type.TypeKind.DECLARED; import static javax.lang.model.type.TypeKind.VOID; @@ -936,14 +934,11 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi case COMPONENT_PROVISION: { - TypeElement bindingTypeElement = - graph.componentDescriptor().dependencyMethodIndex().get(binding.bindingElement()); - String localFactoryVariable = simpleVariableName(bindingTypeElement); + TypeElement dependencyType = dependencyTypeForBinding(binding); + String dependencyVariable = simpleVariableName(dependencyType); CodeBlock callFactoryMethod = CodeBlock.of( - "$L.$L()", - localFactoryVariable, - binding.bindingElement().getSimpleName().toString()); + "$L.$L()", dependencyVariable, binding.bindingElement().get().getSimpleName()); // TODO(sameb): This throws a very vague NPE right now. The stack trace doesn't // help to figure out what the method or return type is. If we include a string // of the return type or method name in the error message, that can defeat obfuscation. @@ -969,10 +964,10 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi "}"), /* 1 */ FACTORY, /* 2 */ bindingKeyTypeName, - /* 3 */ getComponentContributionExpression(bindingTypeElement), + /* 3 */ getComponentContributionExpression(dependencyType), /* 4 */ nullableAnnotation(binding.nullableType()), - /* 5 */ TypeName.get(bindingTypeElement.asType()), - /* 6 */ localFactoryVariable, + /* 5 */ TypeName.get(dependencyType.asType()), + /* 6 */ dependencyVariable, /* 7 */ getMethodBody); } @@ -987,15 +982,14 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi "}"), /* 1 */ FACTORY, /* 2 */ bindingKeyTypeName, - /* 3 */ binding.bindingElement().getSimpleName().toString()); + /* 3 */ binding.bindingElement().get().getSimpleName()); case INJECTION: case PROVISION: { List arguments = Lists.newArrayListWithCapacity(binding.dependencies().size() + 1); - if (binding.bindingKind().equals(PROVISION) - && !binding.bindingElement().getModifiers().contains(STATIC)) { + if (binding.requiresModuleInstance()) { arguments.add(getComponentContributionExpression(binding.contributingModule().get())); } arguments.addAll(getDependencyArguments(binding)); @@ -1012,8 +1006,7 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi case COMPONENT_PRODUCTION: { - TypeElement bindingTypeElement = - graph.componentDescriptor().dependencyMethodIndex().get(binding.bindingElement()); + TypeElement dependencyType = dependencyTypeForBinding(binding); return CodeBlock.of( Joiner.on('\n') .join( @@ -1026,10 +1019,10 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi /* 1 */ PRODUCER, /* 2 */ TypeName.get(binding.key().type()), /* 3 */ LISTENABLE_FUTURE, - /* 4 */ getComponentContributionExpression(bindingTypeElement), - /* 5 */ binding.bindingElement().getSimpleName().toString(), - /* 6 */ TypeName.get(bindingTypeElement.asType()), - /* 7 */ simpleVariableName(bindingTypeElement)); + /* 4 */ getComponentContributionExpression(dependencyType), + /* 5 */ binding.bindingElement().get().getSimpleName(), + /* 6 */ TypeName.get(dependencyType.asType()), + /* 7 */ simpleVariableName(dependencyType)); } case IMMEDIATE: @@ -1037,8 +1030,8 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi { List arguments = Lists.newArrayListWithCapacity(binding.implicitDependencies().size() + 2); - if (!binding.bindingElement().getModifiers().contains(STATIC)) { - arguments.add(getComponentContributionExpression(binding.bindingTypeElement())); + if (binding.requiresModuleInstance()) { + arguments.add(getComponentContributionExpression(binding.contributingModule().get())); } arguments.addAll(getDependencyArguments(binding)); @@ -1065,6 +1058,10 @@ private CodeBlock initializeFactoryForContributionBinding(ContributionBinding bi } } + private TypeElement dependencyTypeForBinding(ContributionBinding binding) { + return graph.componentDescriptor().dependencyMethodIndex().get(binding.bindingElement().get()); + } + private CodeBlock decorateForScope(CodeBlock factoryCreate, Scope scope) { return CodeBlock.of( "$T.provider($L)", diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java b/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java index 7fe894edc6a..f71c83287bf 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java @@ -15,59 +15,54 @@ */ package dagger.internal.codegen; -import com.google.auto.common.MoreElements; import com.google.common.base.Function; import com.google.common.base.Optional; import com.google.common.base.Predicate; import dagger.internal.codegen.Key.HasKey; import java.util.Set; import javax.lang.model.element.Element; -import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.Modifier; import javax.lang.model.element.TypeElement; -import javax.lang.model.type.DeclaredType; -import static dagger.internal.codegen.Util.AS_DECLARED_TYPE; import static dagger.internal.codegen.Util.ENCLOSING_TYPE_ELEMENT; +import static javax.lang.model.element.Modifier.ABSTRACT; +import static javax.lang.model.element.Modifier.STATIC; /** An object that declares or specifies a binding. */ abstract class BindingDeclaration implements HasKey { - /** The {@link Element} that declares the binding. */ - abstract Element bindingElement(); - /** - * The {@link ExecutableElement} that declares the binding. Equivalent to - * {@code MoreElements.asExecutable(bindingElement())}. - * - * @throws IllegalStateException if {@link #bindingElement()} is not an executable element + * The {@link Element} that declares the binding. Absent for bindings without identifying + * declarations. */ - ExecutableElement bindingElementAsExecutable() { - try { - return MoreElements.asExecutable(bindingElement()); - } catch (IllegalArgumentException e) { - throw new IllegalStateException(e); - } - } + abstract Optional bindingElement(); - /** The type enclosing the {@link #bindingElement()}. */ - TypeElement bindingTypeElement() { - return ENCLOSING_TYPE_ELEMENT.visit(bindingElement()); + /** + * The type enclosing the {@link #bindingElement()}, or {@link Optional#absent()} if {@link + * #bindingElement()} is absent. + */ + Optional bindingTypeElement() { + return bindingElement() + .transform( + new Function() { + @Override + public TypeElement apply(Element element) { + return element.accept(ENCLOSING_TYPE_ELEMENT, null); + } + }); } - + /** - * The installed module class that contributed the {@link #bindingElement()}. May be a subclass - * of the class that contains {@link #bindingElement()}. + * The installed module class that contributed the {@link #bindingElement()}. May be a subclass of + * the class that contains {@link #bindingElement()}. Absent if {@link #bindingElement()} is + * absent. */ abstract Optional contributingModule(); /** - * The type of {@link #contributingModule()}. + * A function that returns a singleton set containing the {@link #contributingModule()} for + * binding declarations that have one, and an empty set for those that don't. */ - Optional contributingModuleType() { - return contributingModule().transform(AS_DECLARED_TYPE); - } - static final Function> CONTRIBUTING_MODULE = new Function>() { @Override @@ -76,12 +71,39 @@ public Set apply(BindingDeclaration bindingDeclaration) { } }; - static Predicate bindingElementHasModifier(final Modifier modifier) { - return new Predicate() { - @Override - public boolean apply(BindingDeclaration bindingDeclaration) { - return bindingDeclaration.bindingElement().getModifiers().contains(modifier); - } - }; + /** + * {@code true} if {@link #contributingModule()} is present and this is a nonabstract instance + * method. + */ + boolean requiresModuleInstance() { + if (!bindingElement().isPresent() || !contributingModule().isPresent()) { + return false; + } + Set modifiers = bindingElement().get().getModifiers(); + return !modifiers.contains(ABSTRACT) && !modifiers.contains(STATIC); } + + /** + * A predicate that passes for binding declarations for which {@link #requiresModuleInstance()} is + * {@code true}. + */ + static final Predicate REQUIRES_MODULE_INSTANCE = + new Predicate() { + @Override + public boolean apply(BindingDeclaration bindingDeclaration) { + return bindingDeclaration.requiresModuleInstance(); + } + }; + + /** + * A predicate that passes for binding declarations for which {@link #bindingElement()} is + * present. + */ + static final Predicate HAS_BINDING_ELEMENT = + new Predicate() { + @Override + public boolean apply(BindingDeclaration bindingDeclaration) { + return bindingDeclaration.bindingElement().isPresent(); + } + }; } diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java b/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java index d682ea4867e..22188182192 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java @@ -15,7 +15,12 @@ */ package dagger.internal.codegen; +import com.google.auto.common.MoreElements; +import javax.lang.model.element.Element; + +import static com.google.common.base.Preconditions.checkArgument; import static dagger.internal.codegen.ErrorMessages.stripCommonTypePrefixes; +import static dagger.internal.codegen.Util.AS_DECLARED_TYPE; /** * Formats a {@link BindingDeclaration} into a {@link String} suitable for use in error messages. @@ -29,16 +34,20 @@ final class BindingDeclarationFormatter extends Formatter { @Override public String format(BindingDeclaration bindingDeclaration) { - switch (bindingDeclaration.bindingElement().asType().getKind()) { + checkArgument( + bindingDeclaration.bindingElement().isPresent(), + "Cannot format bindings without source elements: %s", + bindingDeclaration); + Element bindingElement = bindingDeclaration.bindingElement().get(); + switch (bindingElement.asType().getKind()) { case EXECUTABLE: return methodSignatureFormatter.format( - bindingDeclaration.bindingElementAsExecutable(), - bindingDeclaration.contributingModuleType()); + MoreElements.asExecutable(bindingElement), + bindingDeclaration.contributingModule().transform(AS_DECLARED_TYPE)); case DECLARED: - return stripCommonTypePrefixes(bindingDeclaration.bindingElement().asType().toString()); + return stripCommonTypePrefixes(bindingElement.asType().toString()); default: - throw new IllegalArgumentException( - "Formatting unsupported for element: " + bindingDeclaration.bindingElement()); + throw new IllegalArgumentException("Formatting unsupported for element: " + bindingElement); } } } diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java b/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java index ee00ed823eb..a2bdf2fe924 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java @@ -79,7 +79,6 @@ import static dagger.internal.codegen.Key.indexByKey; import static dagger.internal.codegen.Scope.reusableScope; import static javax.lang.model.element.Modifier.ABSTRACT; -import static javax.lang.model.element.Modifier.STATIC; /** * The canonical representation of a full-resolved graph. @@ -129,8 +128,7 @@ ImmutableSet componentRequirements() { .preOrderTraversal(this) .transformAndConcat(RESOLVED_BINDINGS) .transformAndConcat(ResolvedBindings.CONTRIBUTION_BINDINGS) - .filter(not(BindingDeclaration.bindingElementHasModifier(STATIC))) - .filter(not(BindingDeclaration.bindingElementHasModifier(ABSTRACT))) + .filter(BindingDeclaration.REQUIRES_MODULE_INSTANCE) .transformAndConcat(BindingDeclaration.CONTRIBUTING_MODULE) .filter(in(ownedModuleTypes())) .append(componentDescriptor().dependencies()) diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java b/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java index b9826d3bf48..34a2786a10a 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java @@ -72,6 +72,7 @@ import static com.google.auto.common.MoreTypes.asDeclared; import static com.google.auto.common.MoreTypes.asExecutable; import static com.google.auto.common.MoreTypes.asTypeElements; +import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Predicates.equalTo; import static com.google.common.base.Predicates.in; @@ -81,6 +82,7 @@ import static com.google.common.collect.Iterables.getOnlyElement; import static com.google.common.collect.Iterables.indexOf; import static com.google.common.collect.Maps.filterKeys; +import static dagger.internal.codegen.BindingDeclaration.HAS_BINDING_ELEMENT; import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodDescriptor.isOfKind; import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodKind.PRODUCTION_SUBCOMPONENT; import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodKind.SUBCOMPONENT; @@ -88,8 +90,6 @@ import static dagger.internal.codegen.ContributionBinding.indexMapBindingsByAnnotationType; import static dagger.internal.codegen.ContributionBinding.indexMapBindingsByMapKey; import static dagger.internal.codegen.ContributionBinding.Kind.INJECTION; -import static dagger.internal.codegen.ContributionBinding.Kind.IS_SYNTHETIC_KIND; -import static dagger.internal.codegen.ContributionBinding.Kind.SYNTHETIC_DELEGATE_BINDING; import static dagger.internal.codegen.ContributionBinding.Kind.SYNTHETIC_MULTIBOUND_MAP; import static dagger.internal.codegen.ContributionType.indexByContributionType; import static dagger.internal.codegen.ErrorMessages.CANNOT_INJECT_WILDCARD_TYPE; @@ -425,10 +425,7 @@ && doesPathRequireProvisionOnly(path)) { } } if (contributionBinding.bindingKind().equals(SYNTHETIC_MULTIBOUND_MAP)) { - ImmutableSet multibindings = - inlineSyntheticNondelegateContributions(resolvedBindings).contributionBindings(); - validateMapKeySet(path, multibindings); - validateMapKeyAnnotationTypes(path, multibindings); + validateMapKeys(path, contributionBinding); } break; case MEMBERS_INJECTION: @@ -451,32 +448,28 @@ && doesPathRequireProvisionOnly(path)) { /** * Returns an object that contains all the same bindings as {@code resolvedBindings}, except - * that any synthetic {@link ContributionBinding}s are replaced by the contribution bindings and - * multibinding declarations of their dependencies. + * that any {@link ContributionBinding}s without {@linkplain Binding#bindingElement() binding + * elements} are replaced by the contribution bindings and multibinding declarations of their + * dependencies. * *

For example, if: * *

    *
  • The bindings for {@code key1} are {@code A} and {@code B}, with multibinding declaration * {@code X}. - *
  • {@code B} is a synthetic binding with a dependency on {@code key2}. + *
  • {@code B} is a binding without a binding element that has a dependency on {@code key2}. *
  • The bindings for {@code key2} are {@code C} and {@code D}, with multibinding declaration * {@code Y}. *
* - * then {@code inlineSyntheticNondelegateContributions(bindingsForKey1)} has bindings {@code A}, - * {@code C}, and {@code D}, with multibinding declarations {@code X} and {@code Y}. + * then {@code inlineContributionsWithoutBindingElements(bindingsForKey1)} has bindings {@code + * A}, {@code C}, and {@code D}, with multibinding declarations {@code X} and {@code Y}. * - *

The replacement is repeated until none of the bindings are synthetic. + *

The replacement is repeated until all of the bindings have elements. */ - // TODO(dpb): The actual operation we want is to inline bindings without real binding elements. - // Delegate bindings are the first example of synthetic bindings that have real binding elements - // and nonsynthetic dependencies. - private ResolvedBindings inlineSyntheticNondelegateContributions( + private ResolvedBindings inlineContributionsWithoutBindingElements( ResolvedBindings resolvedBinding) { - if (!FluentIterable.from(resolvedBinding.contributionBindings()) - .transform(ContributionBinding.KIND) - .anyMatch(IS_SYNTHETIC_KIND)) { + if (Iterables.all(resolvedBinding.bindings(), HAS_BINDING_ELEMENT)) { return resolvedBinding; } @@ -494,13 +487,12 @@ private ResolvedBindings inlineSyntheticNondelegateContributions( queued.allContributionBindings().entries()) { BindingGraph owningGraph = validationForComponent(bindingEntry.getKey()).subject; ContributionBinding binding = bindingEntry.getValue(); - if (binding.isSyntheticBinding() - && !binding.bindingKind().equals(SYNTHETIC_DELEGATE_BINDING)) { + if (binding.bindingElement().isPresent()) { + contributions.put(bindingEntry); + } else { for (DependencyRequest dependency : binding.dependencies()) { queue.add(owningGraph.resolvedBindings().get(dependency.bindingKey())); } - } else { - contributions.put(bindingEntry); } } } @@ -513,7 +505,7 @@ private ResolvedBindings inlineSyntheticNondelegateContributions( private ImmutableListMultimap declarationsByType( ResolvedBindings resolvedBinding) { - ResolvedBindings inlined = inlineSyntheticNondelegateContributions(resolvedBinding); + ResolvedBindings inlined = inlineContributionsWithoutBindingElements(resolvedBinding); return new ImmutableListMultimap.Builder() .putAll(indexByContributionType(inlined.contributionBindings())) .putAll(indexByContributionType(inlined.multibindingDeclarations())) @@ -545,6 +537,23 @@ private void validateNullability(DependencyRequest request, Set multibindingContributionsBuilder = + ImmutableSet.builder(); + for (DependencyRequest dependency : binding.dependencies()) { + multibindingContributionsBuilder.add( + subject.resolvedBindings().get(dependency.bindingKey()).contributionBinding()); + } + ImmutableSet multibindingContributions = + multibindingContributionsBuilder.build(); + validateMapKeySet(path, multibindingContributions); + validateMapKeyAnnotationTypes(path, multibindingContributions); + } + /** * Reports errors if {@code mapBindings} has more than one binding for the same map key. */ @@ -904,13 +913,13 @@ void validateComponentScope() { case PROVISION: incompatiblyScopedMethodsBuilder.add( methodSignatureFormatter.format( - contributionBinding.bindingElementAsExecutable())); + MoreElements.asExecutable(contributionBinding.bindingElement().get()))); break; case INJECTION: incompatiblyScopedMethodsBuilder.add( bindingScope.get().getReadableSource() + " class " - + contributionBinding.bindingTypeElement().getQualifiedName()); + + contributionBinding.bindingTypeElement().get().getQualifiedName()); break; default: throw new IllegalStateException(); @@ -1032,7 +1041,7 @@ private void reportDuplicateBindings(DependencyPath path) { new Formatter(builder) .format(ErrorMessages.DUPLICATE_BINDINGS_FOR_KEY_FORMAT, formatRootRequestKey(path)); ImmutableSet duplicateBindings = - inlineSyntheticNondelegateContributions(resolvedBindings).contributionBindings(); + inlineContributionsWithoutBindingElements(resolvedBindings).contributionBindings(); bindingDeclarationFormatter.formatIndentedList( builder, duplicateBindings, 1, DUPLICATE_SIZE_LIMIT); owningReportBuilder(duplicateBindings).addError(builder.toString(), path.entryPointElement()); diff --git a/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java b/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java index 472c7115a6c..c9114f7338d 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java @@ -50,7 +50,6 @@ import static dagger.internal.codegen.ContributionType.SET; import static dagger.internal.codegen.MapKeys.unwrapValue; import static dagger.internal.codegen.MoreAnnotationMirrors.unwrapOptionalEquivalence; -import static javax.lang.model.element.Modifier.STATIC; /** * An abstract class for a value object representing the mechanism by which a {@link Key} can be @@ -239,7 +238,7 @@ FactoryCreationStrategy factoryCreationStrategy() { case SYNTHETIC_DELEGATE_BINDING: return DELEGATE; case PROVISION: - return implicitDependencies().isEmpty() && bindingElement().getModifiers().contains(STATIC) + return implicitDependencies().isEmpty() && !requiresModuleInstance() ? ENUM_INSTANCE : CLASS_CONSTRUCTOR; case INJECTION: diff --git a/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java b/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java index f4653b538c1..77f8cfa0293 100644 --- a/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java +++ b/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java @@ -24,6 +24,7 @@ import dagger.Binds; import dagger.internal.codegen.ContributionType.HasContributionType; import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.Element; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.type.ExecutableType; @@ -67,7 +68,7 @@ DelegateDeclaration create( return new AutoValue_DelegateDeclaration( ContributionType.fromBindingMethod(bindsMethod), keyFactory.forBindsMethod(bindsMethod, contributingElement), - bindsMethod, + Optional.of(bindsMethod), Optional.of(contributingElement), delegateRequest, wrapOptionalInEquivalence(getMapKey(bindsMethod))); diff --git a/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java b/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java index 276c0447c91..228fe3154f9 100644 --- a/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java @@ -38,7 +38,7 @@ import javax.lang.model.util.Elements; import javax.tools.Diagnostic; -import static com.google.common.base.Preconditions.checkState; +import static com.google.common.base.Preconditions.checkArgument; import static com.squareup.javapoet.MethodSpec.constructorBuilder; import static com.squareup.javapoet.MethodSpec.methodBuilder; import static com.squareup.javapoet.TypeSpec.classBuilder; @@ -90,13 +90,14 @@ ClassName nameGeneratedType(ProvisionBinding binding) { @Override Optional getElementForErrorReporting(ProvisionBinding binding) { - return Optional.of(binding.bindingElement()); + return binding.bindingElement(); } @Override Optional write(ClassName generatedTypeName, ProvisionBinding binding) { // We don't want to write out resolved bindings -- we want to write out the generic version. - checkState(!binding.unresolved().isPresent()); + checkArgument(!binding.unresolved().isPresent()); + checkArgument(binding.bindingElement().isPresent()); if (binding.bindingKind().equals(INJECTION) && !injectValidator.isValidType(binding.factoryType())) { @@ -128,14 +129,11 @@ Optional write(ClassName generatedTypeName, ProvisionBinding b break; case CLASS_CONSTRUCTOR: factoryBuilder = - classBuilder(generatedTypeName) - .addTypeVariables(typeParameters) - .addModifiers(FINAL); + classBuilder(generatedTypeName).addTypeVariables(typeParameters).addModifiers(FINAL); constructorBuilder = Optional.of(constructorBuilder().addModifiers(PUBLIC)); - if (binding.bindingKind().equals(PROVISION) - && !binding.bindingElement().getModifiers().contains(STATIC)) { + if (binding.requiresModuleInstance()) { addConstructorParameterAndTypeField( - TypeName.get(binding.bindingTypeElement().asType()), + TypeName.get(binding.bindingTypeElement().get().asType()), "module", factoryBuilder, constructorBuilder.get()); @@ -228,13 +226,14 @@ Optional write(ClassName generatedTypeName, ProvisionBinding b if (binding.bindingKind().equals(PROVISION)) { CodeBlock.Builder providesMethodInvocationBuilder = CodeBlock.builder(); - if (binding.bindingElement().getModifiers().contains(STATIC)) { - providesMethodInvocationBuilder.add("$T", ClassName.get(binding.bindingTypeElement())); - } else { + if (binding.requiresModuleInstance()) { providesMethodInvocationBuilder.add("module"); + } else { + providesMethodInvocationBuilder.add( + "$T", ClassName.get(binding.bindingTypeElement().get())); } providesMethodInvocationBuilder.add( - ".$L($L)", binding.bindingElement().getSimpleName(), parametersCodeBlock); + ".$L($L)", binding.bindingElement().get().getSimpleName(), parametersCodeBlock); CodeBlock providesMethodInvocation = providesMethodInvocationBuilder.build(); if (binding.nullableType().isPresent() diff --git a/compiler/src/main/java/dagger/internal/codegen/FrameworkField.java b/compiler/src/main/java/dagger/internal/codegen/FrameworkField.java index b7fb2b1357d..f23ccf38fd1 100644 --- a/compiler/src/main/java/dagger/internal/codegen/FrameworkField.java +++ b/compiler/src/main/java/dagger/internal/codegen/FrameworkField.java @@ -91,8 +91,8 @@ private static TypeMirror fieldValueType(ResolvedBindings resolvedBindings) { private static String frameworkFieldName(ResolvedBindings resolvedBindings) { if (resolvedBindings.bindingKey().kind().equals(BindingKey.Kind.CONTRIBUTION)) { ContributionBinding binding = resolvedBindings.contributionBinding(); - if (!binding.isSyntheticBinding()) { - return BINDING_ELEMENT_NAME.visit(binding.bindingElement(), binding); + if (binding.bindingElement().isPresent()) { + return BINDING_ELEMENT_NAME.visit(binding.bindingElement().get(), binding); } } return BindingVariableNamer.name(resolvedBindings.binding()); diff --git a/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java b/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java index ee94329d0f8..1e842224265 100644 --- a/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java +++ b/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java @@ -133,7 +133,7 @@ private void tryToCacheBinding(B binding) { // We only cache resolved bindings or unresolved bindings w/o type arguments. // Unresolved bindings w/ type arguments aren't valid for the object graph. if (binding.unresolved().isPresent() - || binding.bindingTypeElement().getTypeParameters().isEmpty()) { + || binding.bindingTypeElement().get().getTypeParameters().isEmpty()) { Key key = binding.key(); Binding previousValue = bindingsByKey.put(key, binding); checkState(previousValue == null || binding.equals(previousValue), diff --git a/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java b/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java index 2854eb5192c..a3d3bbae2d4 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java @@ -61,13 +61,16 @@ */ @AutoValue abstract class MembersInjectionBinding extends Binding { + @Override + Optional bindingElement() { + return Optional.of(membersInjectedType()); + } + + abstract TypeElement membersInjectedType(); + @Override abstract Optional unresolved(); - TypeElement membersInjectedType() { - return MoreElements.asType(bindingElement()); - } - @Override Optional contributingModule() { return Optional.absent(); @@ -225,9 +228,9 @@ public Key apply(DeclaredType superclass) { Key key = keyFactory.forMembersInjectedType(declaredType); TypeElement typeElement = MoreElements.asType(declaredType.asElement()); return new AutoValue_MembersInjectionBinding( - typeElement, key, dependencies, + typeElement, hasNonDefaultTypeParameters(typeElement, key.type(), types) ? Optional.of( forInjectedType( diff --git a/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java b/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java index 9bb8b16366d..5a3ae304d9c 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java +++ b/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java @@ -146,7 +146,7 @@ private MultibindingDeclaration forDeclaredMethod( "%s must return a set or map", method); return new AutoValue_MultibindingDeclaration( - method, + Optional.of(method), Optional.of(contributingType), keyFactory.forMultibindsMethod(bindingType, methodType, method), contributionType(returnType), diff --git a/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java b/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java index 38ef0ad5118..2b7023d83f6 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java @@ -35,6 +35,7 @@ import javax.lang.model.type.TypeMirror; import javax.lang.model.util.Elements; +import static com.google.common.base.Preconditions.checkArgument; import static com.squareup.javapoet.ClassName.OBJECT; import static com.squareup.javapoet.MethodSpec.constructorBuilder; import static com.squareup.javapoet.MethodSpec.methodBuilder; @@ -56,7 +57,6 @@ import static javax.lang.model.element.Modifier.PRIVATE; import static javax.lang.model.element.Modifier.PROTECTED; import static javax.lang.model.element.Modifier.PUBLIC; -import static javax.lang.model.element.Modifier.STATIC; /** * Generates {@link Producer} implementations from {@link ProductionBinding} instances. @@ -79,11 +79,13 @@ ClassName nameGeneratedType(ProductionBinding binding) { @Override Optional getElementForErrorReporting(ProductionBinding binding) { - return Optional.of(binding.bindingElement()); + return binding.bindingElement(); } @Override Optional write(ClassName generatedTypeName, ProductionBinding binding) { + checkArgument(binding.bindingElement().isPresent()); + TypeName providedTypeName = TypeName.get(binding.factoryType()); TypeName futureTypeName = listenableFutureOf(providedTypeName); @@ -103,8 +105,8 @@ Optional write(ClassName generatedTypeName, ProductionBinding fields.get(binding.monitorRequest().get().bindingKey()).name(), producerTokenConstruction(generatedTypeName, binding)); - if (!binding.bindingElement().getModifiers().contains(STATIC)) { - TypeName moduleType = TypeName.get(binding.bindingTypeElement().asType()); + if (binding.requiresModuleInstance()) { + TypeName moduleType = TypeName.get(binding.bindingTypeElement().get().asType()); addFieldAndConstructorParameter(factoryBuilder, constructorBuilder, "module", moduleType); } @@ -215,8 +217,8 @@ private CodeBlock producerTokenConstruction( "$S", String.format( "%s#%s", - ClassName.get(binding.bindingTypeElement()), - binding.bindingElement().getSimpleName())) + ClassName.get(binding.bindingTypeElement().get()), + binding.bindingElement().get().getSimpleName())) : CodeBlock.of("$T.class", generatedTypeName); return CodeBlock.of("$T.create($L)", PRODUCER_TOKEN, producerTokenArgs); } @@ -457,10 +459,10 @@ private CodeBlock getInvocationCodeBlock( CodeBlock moduleCodeBlock = CodeBlock.of( "$L.$L($L)", - binding.bindingElement().getModifiers().contains(STATIC) - ? CodeBlock.of("$T", ClassName.get(binding.bindingTypeElement())) - : CodeBlock.of("$T.this.module", generatedTypeName), - binding.bindingElement().getSimpleName(), + binding.requiresModuleInstance() + ? CodeBlock.of("$T.this.module", generatedTypeName) + : CodeBlock.of("$T", ClassName.get(binding.bindingTypeElement().get())), + binding.bindingElement().get().getSimpleName(), makeParametersCodeBlock(parameterCodeBlocks)); // NOTE(beder): We don't worry about catching exceptions from the monitor methods themselves diff --git a/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java b/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java index bfe8a099d5a..f27f6bef9b3 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java @@ -162,7 +162,6 @@ ProductionBinding syntheticMapOfValuesOrProducedBinding( requestForMapOfValuesOrProduced, mapOfProducersKey.get()); return ProductionBinding.builder() .contributionType(ContributionType.UNIQUE) - .bindingElement(requestForMapOfProducers.requestElement()) .key(requestForMapOfValuesOrProduced.key()) .dependencies(requestForMapOfProducers) .bindingKind(Kind.SYNTHETIC_MAP) @@ -179,7 +178,6 @@ ProductionBinding syntheticMultibinding( DependencyRequest request, Iterable multibindingContributions) { return ProductionBinding.builder() .contributionType(ContributionType.UNIQUE) - .bindingElement(request.requestElement()) .key(request.key()) .dependencies( dependencyRequestFactory.forMultibindingContributions( @@ -206,7 +204,7 @@ ProductionBinding delegate( DelegateDeclaration delegateDeclaration, ProductionBinding delegateBinding) { return ProductionBinding.builder() .contributionType(delegateDeclaration.contributionType()) - .bindingElement(delegateDeclaration.bindingElement()) + .bindingElement(delegateDeclaration.bindingElement().get()) .contributingModule(delegateDeclaration.contributingModule().get()) .key(keyFactory.forDelegateBinding(delegateDeclaration, Producer.class)) .dependencies(delegateDeclaration.delegateRequest()) diff --git a/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java b/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java index 6d43149b1e6..532778e0cf1 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java @@ -209,13 +209,9 @@ ProvisionBinding syntheticMapOfValuesBinding(DependencyRequest requestForMapOfVa requestForMapOfValues, mapOfProvidersKey.get()); return ProvisionBinding.builder() .contributionType(ContributionType.UNIQUE) - .bindingElement(requestForMapOfProviders.requestElement()) .key(requestForMapOfValues.key()) .dependencies(requestForMapOfProviders) - .wrappedMapKey( - wrapOptionalInEquivalence(getMapKey(requestForMapOfProviders.requestElement()))) .bindingKind(Kind.SYNTHETIC_MAP) - .scope(Scope.uniqueScopeOf(requestForMapOfProviders.requestElement())) .build(); } @@ -229,13 +225,11 @@ ProvisionBinding syntheticMultibinding( DependencyRequest request, Iterable multibindingContributions) { return ProvisionBinding.builder() .contributionType(ContributionType.UNIQUE) - .bindingElement(request.requestElement()) .key(request.key()) .dependencies( dependencyRequestFactory.forMultibindingContributions( request, multibindingContributions)) .bindingKind(Kind.forMultibindingRequest(request)) - .scope(Scope.uniqueScopeOf(request.requestElement())) .build(); } @@ -282,14 +276,14 @@ ProvisionBinding delegate( DelegateDeclaration delegateDeclaration, ProvisionBinding delegate) { return ProvisionBinding.builder() .contributionType(delegateDeclaration.contributionType()) - .bindingElement(delegateDeclaration.bindingElement()) + .bindingElement(delegateDeclaration.bindingElement().get()) .contributingModule(delegateDeclaration.contributingModule().get()) .key(keyFactory.forDelegateBinding(delegateDeclaration, Provider.class)) .dependencies(delegateDeclaration.delegateRequest()) .nullableType(delegate.nullableType()) .wrappedMapKey(delegateDeclaration.wrappedMapKey()) .bindingKind(Kind.SYNTHETIC_DELEGATE_BINDING) - .scope(Scope.uniqueScopeOf(delegateDeclaration.bindingElement())) + .scope(Scope.uniqueScopeOf(delegateDeclaration.bindingElement().get())) .build(); } } diff --git a/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java b/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java index 9bb8d3df3f9..76ff8a72cc6 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java +++ b/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java @@ -20,7 +20,6 @@ import com.google.common.base.Optional; import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSetMultimap; @@ -35,7 +34,6 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; import static com.google.common.collect.Iterables.getOnlyElement; -import static dagger.internal.codegen.ContributionType.indexByContributionType; /** * The collection of bindings that have been resolved for a binding key. For valid graphs, contains @@ -288,38 +286,12 @@ public BindingType bindingType() { /** * The contribution type for these bindings. * - * @throws IllegalStateException if {@link #isEmpty()} or the contribution types conflict + * @throws IllegalStateException if there is not exactly one element in {@link + * #contributionBindings()}, which will never happen for contributions in valid graphs */ @Override public ContributionType contributionType() { - ImmutableSet types = contributionTypes(); - checkState(!types.isEmpty(), "no bindings or declarations for %s", bindingKey()); - checkState( - types.size() == 1, - "More than one binding present of different types for %s: %s", - bindingKey(), - bindingsAndDeclarationsByContributionType()); - return getOnlyElement(types); - } - - /** - * The contribution types represented by {@link #contributionBindings()} and - * {@link #multibindingDeclarations()}. - */ - ImmutableSet contributionTypes() { - return bindingsAndDeclarationsByContributionType().keySet(); - } - - /** - * The {@link #contributionBindings()} and {@link #multibindingDeclarations()}, indexed by - * {@link ContributionType}. - */ - ImmutableListMultimap - bindingsAndDeclarationsByContributionType() { - return new ImmutableListMultimap.Builder() - .putAll(indexByContributionType(contributionBindings())) - .putAll(indexByContributionType(multibindingDeclarations())) - .build(); + return contributionBinding().contributionType(); } /** diff --git a/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java b/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java index ac455d3a0da..8fda68942ea 100644 --- a/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java +++ b/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java @@ -147,8 +147,8 @@ static ClassName generatedClassNameForBinding(Binding binding) { case PROVISION: case PRODUCTION: ContributionBinding contribution = (ContributionBinding) binding; - checkArgument(!contribution.isSyntheticBinding()); - ClassName enclosingClassName = ClassName.get(contribution.bindingTypeElement()); + checkArgument(contribution.bindingTypeElement().isPresent()); + ClassName enclosingClassName = ClassName.get(contribution.bindingTypeElement().get()); switch (contribution.bindingKind()) { case INJECTION: case PROVISION: @@ -203,7 +203,7 @@ private static Optional typeMirrorForBindingTypeParameters(Binding b // the module, not the types of the binding. // Consider: Module { @Provides List provideB(B b) { .. }} // The binding is just parameterized on , but we need all of . - return Optional.of(contributionBinding.bindingTypeElement().asType()); + return Optional.of(contributionBinding.bindingTypeElement().get().asType()); case IMMEDIATE: case FUTURE_PRODUCTION: @@ -267,7 +267,7 @@ private static String factoryPrefix(ContributionBinding binding) { case IMMEDIATE: case FUTURE_PRODUCTION: return CaseFormat.LOWER_CAMEL.to( - UPPER_CAMEL, binding.bindingElement().getSimpleName().toString()); + UPPER_CAMEL, binding.bindingElement().get().getSimpleName().toString()); default: throw new IllegalArgumentException(); @@ -276,7 +276,8 @@ private static String factoryPrefix(ContributionBinding binding) { static ImmutableList bindingTypeElementTypeVariableNames(Binding binding) { ImmutableList.Builder builder = ImmutableList.builder(); - for (TypeParameterElement typeParameter : binding.bindingTypeElement().getTypeParameters()) { + for (TypeParameterElement typeParameter : + binding.bindingTypeElement().get().getTypeParameters()) { builder.add(TypeVariableName.get(typeParameter)); } return builder.build(); From a69ead520031d78a0c259ab8db668b57fec781d2 Mon Sep 17 00:00:00 2001 From: dpb Date: Mon, 11 Jul 2016 10:05:20 -0700 Subject: [PATCH 08/17] Use a synthetic binding for Set rather than individual synthetic multibinding contributions. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=127098028 --- .../java/dagger/internal/codegen/BindingGraph.java | 3 ++- .../internal/codegen/BindingGraphValidator.java | 3 ++- .../dagger/internal/codegen/ContributionBinding.java | 12 +++--------- .../src/main/java/dagger/internal/codegen/Key.java | 1 + .../main/java/dagger/internal/codegen/TypeNames.java | 8 ++++++-- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java b/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java index a2bdf2fe924..b77283674d6 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java @@ -632,7 +632,8 @@ private Optional getOwningResolver(ContributionBinding binding) { if (binding.scope().isPresent() && binding.scope().get().equals(reusableScope(elements))) { for (Resolver requestResolver : getResolverLineage().reverse()) { // If a @Reusable binding was resolved in an ancestor, use that component. - if (requestResolver.resolvedBindings.containsKey(binding.bindingKey())) { + if (requestResolver.resolvedBindings.containsKey( + BindingKey.contribution(binding.key()))) { return Optional.of(requestResolver); } } diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java b/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java index 34a2786a10a..3e8c642a45c 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java @@ -1055,7 +1055,8 @@ private ValidationReport.Builder owningReportBuilder( Iterable duplicateBindings) { ImmutableSet.Builder owningComponentsBuilder = ImmutableSet.builder(); for (ContributionBinding binding : duplicateBindings) { - ResolvedBindings resolvedBindings = subject.resolvedBindings().get(binding.bindingKey()); + ResolvedBindings resolvedBindings = + subject.resolvedBindings().get(BindingKey.contribution(binding.key())); owningComponentsBuilder.addAll( resolvedBindings.allContributionBindings().inverse().get(binding)); } diff --git a/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java b/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java index c9114f7338d..0da899abe89 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java @@ -47,7 +47,6 @@ import static dagger.internal.codegen.ContributionBinding.FactoryCreationStrategy.DELEGATE; import static dagger.internal.codegen.ContributionBinding.FactoryCreationStrategy.ENUM_INSTANCE; import static dagger.internal.codegen.ContributionBinding.Kind.IS_SYNTHETIC_KIND; -import static dagger.internal.codegen.ContributionType.SET; import static dagger.internal.codegen.MapKeys.unwrapValue; import static dagger.internal.codegen.MoreAnnotationMirrors.unwrapOptionalEquivalence; @@ -206,10 +205,6 @@ static Kind forMultibindingRequest(DependencyRequest request) { */ protected abstract Kind bindingKind(); - BindingKey bindingKey() { - return BindingKey.contribution(key()); - } - /** * The strategy for getting an instance of a factory for a {@link ContributionBinding}. */ @@ -225,11 +220,10 @@ enum FactoryCreationStrategy { /** * Returns the {@link FactoryCreationStrategy} appropriate for a binding. * - *

Delegate bindings - * use the {@link FactoryCreationStrategy#DELEGATE} strategy. + *

Delegate bindings use the {@link FactoryCreationStrategy#DELEGATE} strategy. * - *

Bindings without dependencies that don't require a module instance use the - * {@link FactoryCreationStrategy#ENUM_INSTANCE} strategy. + *

Bindings without dependencies that don't require a module instance use the {@link + * FactoryCreationStrategy#ENUM_INSTANCE} strategy. * *

All other bindings use the {@link FactoryCreationStrategy#CLASS_CONSTRUCTOR} strategy. */ diff --git a/compiler/src/main/java/dagger/internal/codegen/Key.java b/compiler/src/main/java/dagger/internal/codegen/Key.java index 0cf6c535166..31de3a1a279 100644 --- a/compiler/src/main/java/dagger/internal/codegen/Key.java +++ b/compiler/src/main/java/dagger/internal/codegen/Key.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.AnnotationMirrors; diff --git a/compiler/src/main/java/dagger/internal/codegen/TypeNames.java b/compiler/src/main/java/dagger/internal/codegen/TypeNames.java index a524f207a82..939f15ff162 100644 --- a/compiler/src/main/java/dagger/internal/codegen/TypeNames.java +++ b/compiler/src/main/java/dagger/internal/codegen/TypeNames.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.util.concurrent.AsyncFunction; @@ -91,13 +92,16 @@ final class TypeNames { static final ClassName VOID_CLASS = ClassName.get(Void.class); static final TypeName SET_OF_FACTORIES = - ParameterizedTypeName.get( - ClassName.get(Set.class), ClassName.get(ProductionComponentMonitor.Factory.class)); + ParameterizedTypeName.get(Set.class, ProductionComponentMonitor.Factory.class); static ParameterizedTypeName listOf(TypeName typeName) { return ParameterizedTypeName.get(LIST, typeName); } + static ParameterizedTypeName setOf(TypeName elementType) { + return ParameterizedTypeName.get(SET, elementType); + } + static ParameterizedTypeName abstractProducerOf(TypeName typeName) { return ParameterizedTypeName.get(ABSTRACT_PRODUCER, typeName); } From 1b65b6a46ee5392f161820552f94779a6e07d687 Mon Sep 17 00:00:00 2001 From: dpb Date: Mon, 11 Jul 2016 12:11:24 -0700 Subject: [PATCH 09/17] Add blank line above package declaration ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=127113316 --- compiler/src/it/functional-tests/src/main/java/test/A.java | 1 + .../src/main/java/test/AbstractMembersInjectingBaseClass.java | 1 + .../src/main/java/test/AbstractMiddleClassWithoutMembers.java | 1 + compiler/src/it/functional-tests/src/main/java/test/B.java | 1 + .../src/main/java/test/BasicAbstractClassComponent.java | 1 + .../it/functional-tests/src/main/java/test/BasicComponent.java | 1 + .../src/it/functional-tests/src/main/java/test/BooleanKey.java | 1 + .../src/main/java/test/BoundedGenericComponent.java | 1 + .../src/main/java/test/BoundedGenericModule.java | 1 + .../it/functional-tests/src/main/java/test/BoundedGenerics.java | 1 + compiler/src/it/functional-tests/src/main/java/test/ByteKey.java | 1 + compiler/src/it/functional-tests/src/main/java/test/CharKey.java | 1 + .../it/functional-tests/src/main/java/test/ComplexGenerics.java | 1 + .../src/main/java/test/ComponentDependsOnGeneratedCode.java | 1 + .../main/java/test/ComponentSupertypeDependsOnGeneratedCode.java | 1 + .../test/ComponentSupertypeDependsOnGeneratedCodeInterface.java | 1 + .../src/main/java/test/ComponentWithReusableBindings.java | 1 + .../src/main/java/test/ComponentsWithNestedModules.java | 1 + compiler/src/it/functional-tests/src/main/java/test/Generic.java | 1 + .../src/it/functional-tests/src/main/java/test/Generic2.java | 1 + .../src/it/functional-tests/src/main/java/test/GenericChild.java | 1 + .../it/functional-tests/src/main/java/test/GenericComponent.java | 1 + .../src/main/java/test/GenericDoubleReferences.java | 1 + .../it/functional-tests/src/main/java/test/GenericNoDeps.java | 1 + .../it/functional-tests/src/main/java/test/GenericParent.java | 1 + .../it/functional-tests/src/main/java/test/InjectedThing.java | 1 + .../src/it/functional-tests/src/main/java/test/Injector.java | 1 + .../src/main/java/test/MultibindingComponent.java | 1 + .../test/MultibindingComponentWithMultibindingsInterface.java | 1 + .../src/main/java/test/MultibindingDependency.java | 1 + .../functional-tests/src/main/java/test/MultibindingModule.java | 1 + .../src/main/java/test/MultibindingsInterfaceModule.java | 1 + .../it/functional-tests/src/main/java/test/MultibindsModule.java | 1 + .../src/it/functional-tests/src/main/java/test/NeedsFactory.java | 1 + .../src/main/java/test/NestedAnnotationContainer.java | 1 + .../src/main/java/test/NonComponentDependencyComponent.java | 1 + .../it/functional-tests/src/main/java/test/NullableModule.java | 1 + .../it/functional-tests/src/main/java/test/NumberClassKey.java | 1 + .../it/functional-tests/src/main/java/test/OuterClassBar.java | 1 + .../it/functional-tests/src/main/java/test/OuterClassFoo.java | 1 + .../functional-tests/src/main/java/test/ReferencesGeneric.java | 1 + .../src/it/functional-tests/src/main/java/test/ShortKey.java | 1 + .../it/functional-tests/src/main/java/test/SomeQualifier.java | 1 + compiler/src/it/functional-tests/src/main/java/test/Thing.java | 1 + .../src/main/java/test/TypeWithInheritedMembersInjection.java | 1 + .../src/main/java/test/UnwrappedAnnotationKey.java | 1 + .../src/main/java/test/WrappedAnnotationKey.java | 1 + .../src/it/functional-tests/src/main/java/test/binds/Foo.java | 1 + .../functional-tests/src/main/java/test/binds/FooOfStrings.java | 1 + .../src/main/java/test/binds/InterfaceModule.java | 1 + .../src/main/java/test/binds/SimpleBindingModule.java | 1 + .../functional-tests/src/main/java/test/binds/TestComponent.java | 1 + .../functional-tests/src/main/java/test/builder/ByteModule.java | 1 + .../src/main/java/test/builder/DepComponent.java | 1 + .../src/main/java/test/builder/DoubleModule.java | 1 + .../functional-tests/src/main/java/test/builder/FloatModule.java | 1 + .../src/main/java/test/builder/GenericParent.java | 1 + .../functional-tests/src/main/java/test/builder/Grandchild.java | 1 + .../main/java/test/builder/IntModuleIncludingDoubleAndFloat.java | 1 + .../functional-tests/src/main/java/test/builder/LongModule.java | 1 + .../functional-tests/src/main/java/test/builder/MiddleChild.java | 1 + .../functional-tests/src/main/java/test/builder/MiddleScope.java | 1 + .../src/main/java/test/builder/OtherMiddleChild.java | 1 + .../src/main/java/test/builder/ParentComponent.java | 1 + .../src/main/java/test/builder/ParentOfGenericComponent.java | 1 + .../src/main/java/test/builder/RequiresSubcomponentBuilder.java | 1 + .../src/main/java/test/builder/StringModule.java | 1 + .../test/builder/TestChildComponentWithBuilderAbstractClass.java | 1 + .../test/builder/TestChildComponentWithBuilderInterface.java | 1 + .../java/test/builder/TestComponentWithBuilderAbstractClass.java | 1 + .../java/test/builder/TestComponentWithBuilderInterface.java | 1 + .../builder/TestComponentWithGenericBuilderAbstractClass.java | 1 + .../test/builder/TestComponentWithGenericBuilderInterface.java | 1 + .../src/it/functional-tests/src/main/java/test/cycle/Cycles.java | 1 + .../it/functional-tests/src/main/java/test/cycle/LongCycle.java | 1 + .../test/membersinject/ChildOfArrayOfParentOfStringArray.java | 1 + .../main/java/test/membersinject/ChildOfPrimitiveIntArray.java | 1 + .../src/main/java/test/membersinject/ChildOfStringArray.java | 1 + .../src/main/java/test/membersinject/MembersInjectComponent.java | 1 + .../main/java/test/membersinject/MembersInjectGenericParent.java | 1 + .../src/main/java/test/membersinject/MembersInjectModule.java | 1 + .../src/main/java/test/membersinject/NonRequestedChild.java | 1 + .../test/multipackage/MembersInjectionVisibilityComponent.java | 1 + .../src/main/java/test/multipackage/a/AGrandchild.java | 1 + .../src/main/java/test/multipackage/a/APackagePrivateObject.java | 1 + .../src/main/java/test/multipackage/a/AParent.java | 1 + .../src/main/java/test/multipackage/a/APublicObject.java | 1 + .../src/main/java/test/multipackage/a/UsesInaccessible.java | 1 + .../src/main/java/test/multipackage/b/BChild.java | 1 + .../src/main/java/test/multipackage/b/BPackagePrivateObject.java | 1 + .../src/main/java/test/nullables/NullComponent.java | 1 + .../main/java/test/nullables/NullComponentWithDependency.java | 1 + .../functional-tests/src/main/java/test/nullables/NullFoo.java | 1 + .../src/main/java/test/nullables/NullModule.java | 1 + .../it/functional-tests/src/main/java/test/scope/BlueModule.java | 1 + .../it/functional-tests/src/main/java/test/scope/BlueScope.java | 1 + .../functional-tests/src/main/java/test/scope/GreenModule.java | 1 + .../it/functional-tests/src/main/java/test/scope/GreenScope.java | 1 + .../src/main/java/test/scope/ScopedComponent.java | 1 + .../src/main/java/test/scope/TurquoiseModule.java | 1 + .../src/main/java/test/staticprovides/AllStaticModule.java | 1 + .../src/main/java/test/staticprovides/SomeStaticModule.java | 1 + .../src/main/java/test/staticprovides/StaticTestComponent.java | 1 + .../java/test/staticprovides/StaticTestComponentWithBuilder.java | 1 + .../src/main/java/test/sub/ContributionsModule.java | 1 + .../it/functional-tests/src/main/java/test/sub/OtherThing.java | 1 + .../src/main/java/test/subcomponent/AnInterface.java | 1 + .../src/main/java/test/subcomponent/BoundAsSingleton.java | 1 + .../main/java/test/subcomponent/ChildAbstractClassComponent.java | 1 + .../src/main/java/test/subcomponent/ChildComponent.java | 1 + .../java/test/subcomponent/ChildComponentRequiringModules.java | 1 + .../src/main/java/test/subcomponent/ChildModule.java | 1 + .../main/java/test/subcomponent/ChildModuleWithParameters.java | 1 + .../src/main/java/test/subcomponent/ChildModuleWithState.java | 1 + .../src/main/java/test/subcomponent/GenericParentComponent.java | 1 + .../src/main/java/test/subcomponent/GrandchildComponent.java | 1 + .../src/main/java/test/subcomponent/GrandchildModule.java | 1 + .../src/main/java/test/subcomponent/ImplementsAnInterface.java | 1 + .../main/java/test/subcomponent/MultibindingSubcomponents.java | 1 + .../src/main/java/test/subcomponent/NeedsAnInterface.java | 1 + .../src/main/java/test/subcomponent/ParentComponent.java | 1 + .../src/main/java/test/subcomponent/ParentGetters.java | 1 + .../src/main/java/test/subcomponent/ParentModule.java | 1 + .../main/java/test/subcomponent/ParentOfGenericComponent.java | 1 + .../src/main/java/test/subcomponent/RequiresSingletons.java | 1 + .../src/main/java/test/subcomponent/SingletonType.java | 1 + .../src/main/java/test/subcomponent/StaticChildModule.java | 1 + .../src/main/java/test/subcomponent/Unbound.java | 1 + .../main/java/test/subcomponent/UnresolvableChildComponent.java | 1 + .../java/test/subcomponent/UnresolvableChildComponentModule.java | 1 + .../src/main/java/test/subcomponent/UnscopedType.java | 1 + .../src/main/java/test/subcomponent/hiding/ChildComponent.java | 1 + .../src/main/java/test/subcomponent/hiding/ParentComponent.java | 1 + .../main/java/test/subcomponent/hiding/a/CommonModuleName.java | 1 + .../src/main/java/test/subcomponent/hiding/a/CommonName.java | 1 + .../main/java/test/subcomponent/hiding/b/CommonModuleName.java | 1 + .../src/main/java/test/subcomponent/hiding/b/CommonName.java | 1 + .../src/main/java/test/subcomponent/repeat/ParentComponent.java | 1 + .../src/main/java/test/subcomponent/repeat/RepeatedModule.java | 1 + .../test/subcomponent/repeat/SubcomponentWithRepeatedModule.java | 1 + .../subcomponent/repeat/SubcomponentWithoutRepeatedModule.java | 1 + .../src/it/functional-tests/src/test/java/test/BasicTest.java | 1 + .../src/test/java/test/DependsOnGeneratedCodeTest.java | 1 + .../src/it/functional-tests/src/test/java/test/GenericTest.java | 1 + .../it/functional-tests/src/test/java/test/MultibindingTest.java | 1 + .../src/it/functional-tests/src/test/java/test/NestedTest.java | 1 + .../src/test/java/test/NonComponentDependencyTest.java | 1 + .../src/it/functional-tests/src/test/java/test/ReusableTest.java | 1 + .../test/binds/BindsCollectionsWithoutMultibindingsTest.java | 1 + .../it/functional-tests/src/test/java/test/binds/BindsTest.java | 1 + .../functional-tests/src/test/java/test/builder/BuilderTest.java | 1 + .../it/functional-tests/src/test/java/test/cycle/CycleTest.java | 1 + .../functional-tests/src/test/java/test/cycle/LongCycleTest.java | 1 + .../src/test/java/test/membersinject/MembersInjectTest.java | 1 + .../src/test/java/test/nullables/NullabilityTest.java | 1 + .../it/functional-tests/src/test/java/test/scope/ScopeTest.java | 1 + .../src/test/java/test/staticprovides/StaticProvidesTest.java | 1 + .../java/test/subcomponent/SubcomponentMultibindingsTest.java | 1 + .../src/test/java/test/subcomponent/SubcomponentTest.java | 1 + .../java/test/subcomponent/hiding/SubcomponentHidingTest.java | 1 + .../test/java/test/subcomponent/repeat/RepeatedModuleTest.java | 1 + .../src/main/java/producerstest/DependedComponent.java | 1 + .../src/main/java/producerstest/DependedModule.java | 1 + .../src/main/java/producerstest/DependedProducerModule.java | 1 + .../src/main/java/producerstest/DependedProductionComponent.java | 1 + .../src/main/java/producerstest/DependentComponent.java | 1 + .../src/main/java/producerstest/DependentProducerModule.java | 1 + .../src/main/java/producerstest/ExecutorModule.java | 1 + .../src/main/java/producerstest/ProvidesInProducerModule.java | 1 + .../src/main/java/producerstest/Request.java | 1 + .../src/main/java/producerstest/Response.java | 1 + .../src/main/java/producerstest/ResponseModule.java | 1 + .../src/main/java/producerstest/ResponseProducerModule.java | 1 + .../src/main/java/producerstest/SimpleComponent.java | 1 + .../src/main/java/producerstest/SimpleProducerModule.java | 1 + .../main/java/producerstest/badexecutor/ComponentDependency.java | 1 + .../src/main/java/producerstest/badexecutor/SimpleComponent.java | 1 + .../java/producerstest/badexecutor/SimpleProducerModule.java | 1 + .../src/main/java/producerstest/binds/Foo.java | 1 + .../src/main/java/producerstest/binds/FooOfStrings.java | 1 + .../src/main/java/producerstest/binds/SimpleBindingModule.java | 1 + .../java/producerstest/binds/SimpleBindsProductionComponent.java | 1 + .../src/main/java/producerstest/builder/DepComponent.java | 1 + .../src/main/java/producerstest/builder/IntModule.java | 1 + .../src/main/java/producerstest/builder/StringModule.java | 1 + .../java/producerstest/builder/TestComponentWithBuilder.java | 1 + .../main/java/producerstest/monitoring/MonitoredComponent.java | 1 + .../src/main/java/producerstest/monitoring/MonitoringModule.java | 1 + .../src/main/java/producerstest/monitoring/ServingModule.java | 1 + .../src/main/java/producerstest/monitoring/StringStub.java | 1 + .../src/main/java/producerstest/monitoring/StubModule.java | 1 + .../java/producerstest/multibindings/MultibindingComponent.java | 1 + .../java/producerstest/multibindings/MultibindingModule.java | 1 + .../producerstest/multibindings/MultibindingProducerModule.java | 1 + .../src/main/java/producerstest/multibindings/Qualifiers.java | 1 + .../src/main/java/producerstest/provisions/Provisions.java | 1 + .../src/main/java/producerstest/scope/ScopedModule.java | 1 + .../src/main/java/producerstest/scope/ScopedObject.java | 1 + .../src/main/java/producerstest/scope/SetComponent.java | 1 + .../src/main/java/producerstest/scope/SetProducerModule.java | 1 + .../producerstest/subcomponent/MultiPackageSubcomponents.java | 1 + .../subcomponent/SubcomponentsWithBoundExecutor.java | 1 + .../main/java/producerstest/subcomponent/sub/ChildComponent.java | 1 + .../main/java/producerstest/subcomponent/sub/ChildModule.java | 1 + .../src/test/java/producerstest/DependentTest.java | 1 + .../src/test/java/producerstest/ProducerFactoryTest.java | 1 + .../src/test/java/producerstest/SimpleTest.java | 1 + .../src/test/java/producerstest/binds/BindsProducersTest.java | 1 + .../producerstest/builder/ProductionComponentBuilderTest.java | 1 + .../src/test/java/producerstest/monitoring/MonitoringTest.java | 1 + .../test/java/producerstest/multibindings/MultibindingTest.java | 1 + .../src/test/java/producerstest/provisions/ProvisionsTest.java | 1 + .../src/test/java/producerstest/scope/ScopeTest.java | 1 + .../producerstest/subcomponent/MultiPackageSubcomponentTest.java | 1 + .../subcomponent/SubcomponentWithBoundExecutorTest.java | 1 + compiler/src/it/tck/src/main/java/test/tck/CarModule.java | 1 + compiler/src/it/tck/src/main/java/test/tck/CarShop.java | 1 + compiler/src/it/tck/src/main/java/test/tck/EngineModule.java | 1 + compiler/src/it/tck/src/main/java/test/tck/FuelTankModule.java | 1 + compiler/src/it/tck/src/main/java/test/tck/SeatModule.java | 1 + compiler/src/it/tck/src/main/java/test/tck/TireModule.java | 1 + compiler/src/it/tck/src/test/java/test/tck/TckTest.java | 1 + .../java/dagger/internal/codegen/AbstractComponentWriter.java | 1 + .../src/main/java/dagger/internal/codegen/Accessibility.java | 1 + .../src/main/java/dagger/internal/codegen/AnnotationSpecs.java | 1 + compiler/src/main/java/dagger/internal/codegen/Binding.java | 1 + .../main/java/dagger/internal/codegen/BindingDeclaration.java | 1 + .../dagger/internal/codegen/BindingDeclarationFormatter.java | 1 + compiler/src/main/java/dagger/internal/codegen/BindingGraph.java | 1 + .../main/java/dagger/internal/codegen/BindingGraphValidator.java | 1 + compiler/src/main/java/dagger/internal/codegen/BindingKey.java | 1 + .../java/dagger/internal/codegen/BindingMethodValidator.java | 1 + compiler/src/main/java/dagger/internal/codegen/BindingType.java | 1 + .../main/java/dagger/internal/codegen/BindingVariableNamer.java | 1 + .../main/java/dagger/internal/codegen/BindsMethodValidator.java | 1 + .../src/main/java/dagger/internal/codegen/BuilderValidator.java | 1 + compiler/src/main/java/dagger/internal/codegen/CodeBlocks.java | 1 + .../src/main/java/dagger/internal/codegen/CompilerOptions.java | 1 + .../main/java/dagger/internal/codegen/ComponentDescriptor.java | 1 + .../main/java/dagger/internal/codegen/ComponentGenerator.java | 1 + .../dagger/internal/codegen/ComponentHierarchyValidator.java | 1 + .../java/dagger/internal/codegen/ComponentProcessingStep.java | 1 + .../main/java/dagger/internal/codegen/ComponentProcessor.java | 1 + .../main/java/dagger/internal/codegen/ComponentValidator.java | 1 + .../src/main/java/dagger/internal/codegen/ComponentWriter.java | 1 + .../java/dagger/internal/codegen/ConfigurationAnnotations.java | 1 + .../main/java/dagger/internal/codegen/ContributionBinding.java | 1 + .../src/main/java/dagger/internal/codegen/ContributionType.java | 1 + .../main/java/dagger/internal/codegen/DelegateDeclaration.java | 1 + .../src/main/java/dagger/internal/codegen/DependencyRequest.java | 1 + .../java/dagger/internal/codegen/DependencyRequestFormatter.java | 1 + .../java/dagger/internal/codegen/DependencyRequestMapper.java | 1 + .../java/dagger/internal/codegen/DependencyVariableNamer.java | 1 + .../src/main/java/dagger/internal/codegen/ErrorMessages.java | 1 + .../src/main/java/dagger/internal/codegen/FactoryGenerator.java | 1 + .../src/main/java/dagger/internal/codegen/FeatureStatus.java | 1 + compiler/src/main/java/dagger/internal/codegen/Formatter.java | 1 + .../main/java/dagger/internal/codegen/FrameworkDependency.java | 1 + .../src/main/java/dagger/internal/codegen/FrameworkField.java | 1 + .../src/main/java/dagger/internal/codegen/FrameworkTypes.java | 1 + .../main/java/dagger/internal/codegen/InjectBindingRegistry.java | 1 + .../main/java/dagger/internal/codegen/InjectProcessingStep.java | 1 + .../src/main/java/dagger/internal/codegen/InjectValidator.java | 1 + .../main/java/dagger/internal/codegen/InjectionAnnotations.java | 1 + compiler/src/main/java/dagger/internal/codegen/KeyFormatter.java | 1 + .../src/main/java/dagger/internal/codegen/MapKeyGenerator.java | 1 + .../main/java/dagger/internal/codegen/MapKeyProcessingStep.java | 1 + .../src/main/java/dagger/internal/codegen/MapKeyValidator.java | 1 + compiler/src/main/java/dagger/internal/codegen/MapKeys.java | 1 + compiler/src/main/java/dagger/internal/codegen/MapType.java | 1 + compiler/src/main/java/dagger/internal/codegen/MemberSelect.java | 1 + .../java/dagger/internal/codegen/MembersInjectionBinding.java | 1 + .../java/dagger/internal/codegen/MembersInjectorGenerator.java | 1 + .../java/dagger/internal/codegen/MethodSignatureFormatter.java | 1 + .../java/dagger/internal/codegen/MissingBindingSuggestions.java | 1 + .../src/main/java/dagger/internal/codegen/ModuleDescriptor.java | 1 + .../main/java/dagger/internal/codegen/ModuleProcessingStep.java | 1 + .../src/main/java/dagger/internal/codegen/ModuleValidator.java | 1 + .../java/dagger/internal/codegen/MonitoringModuleGenerator.java | 1 + .../dagger/internal/codegen/MonitoringModuleProcessingStep.java | 1 + .../main/java/dagger/internal/codegen/MoreAnnotationMirrors.java | 1 + .../java/dagger/internal/codegen/MultibindingAnnotations.java | 1 + .../internal/codegen/MultibindingAnnotationsProcessingStep.java | 1 + .../java/dagger/internal/codegen/MultibindingDeclaration.java | 1 + .../dagger/internal/codegen/MultibindingsMethodValidator.java | 1 + .../dagger/internal/codegen/MultibindingsProcessingStep.java | 1 + .../java/dagger/internal/codegen/MultibindingsValidator.java | 1 + .../java/dagger/internal/codegen/MultibindsMethodValidator.java | 1 + .../java/dagger/internal/codegen/ProducerFactoryGenerator.java | 1 + .../java/dagger/internal/codegen/ProducesMethodValidator.java | 1 + .../src/main/java/dagger/internal/codegen/ProductionBinding.java | 1 + .../internal/codegen/ProductionExecutorModuleGenerator.java | 1 + .../internal/codegen/ProductionExecutorModuleProcessingStep.java | 1 + .../java/dagger/internal/codegen/ProvidesMethodValidator.java | 1 + .../src/main/java/dagger/internal/codegen/ProvisionBinding.java | 1 + .../src/main/java/dagger/internal/codegen/ResolvedBindings.java | 1 + compiler/src/main/java/dagger/internal/codegen/Scope.java | 1 + compiler/src/main/java/dagger/internal/codegen/SetType.java | 1 + .../java/dagger/internal/codegen/SimpleAnnotationMirror.java | 1 + .../java/dagger/internal/codegen/SimpleTypeAnnotationValue.java | 1 + .../dagger/internal/codegen/SourceFileGenerationException.java | 1 + .../main/java/dagger/internal/codegen/SourceFileGenerator.java | 1 + compiler/src/main/java/dagger/internal/codegen/SourceFiles.java | 1 + .../main/java/dagger/internal/codegen/SubcomponentWriter.java | 1 + compiler/src/main/java/dagger/internal/codegen/TypeSpecs.java | 1 + .../src/main/java/dagger/internal/codegen/UniqueNameSet.java | 1 + compiler/src/main/java/dagger/internal/codegen/Util.java | 1 + .../src/main/java/dagger/internal/codegen/ValidationReport.java | 1 + .../src/main/java/dagger/internal/codegen/ValidationType.java | 1 + .../src/test/java/dagger/internal/codegen/AccessibilityTest.java | 1 + .../java/dagger/internal/codegen/BindsMethodValidatorTest.java | 1 + .../test/java/dagger/internal/codegen/ComponentBuilderTest.java | 1 + .../java/dagger/internal/codegen/ComponentProcessorTest.java | 1 + .../java/dagger/internal/codegen/DaggerModuleMethodSubject.java | 1 + .../dagger/internal/codegen/DependencyRequestMapperTest.java | 1 + .../src/test/java/dagger/internal/codegen/ErrorMessagesTest.java | 1 + .../test/java/dagger/internal/codegen/FrameworkFieldTest.java | 1 + .../src/test/java/dagger/internal/codegen/GeneratedLines.java | 1 + .../java/dagger/internal/codegen/GraphValidationScopingTest.java | 1 + .../test/java/dagger/internal/codegen/GraphValidationTest.java | 1 + .../test/java/dagger/internal/codegen/InaccessibleTypeTest.java | 1 + .../internal/codegen/InjectConstructorFactoryGeneratorTest.java | 1 + compiler/src/test/java/dagger/internal/codegen/KeyTest.java | 1 + .../internal/codegen/MapBindingComponentProcessorTest.java | 1 + .../test/java/dagger/internal/codegen/MapKeyProcessorTest.java | 1 + .../test/java/dagger/internal/codegen/MembersInjectionTest.java | 1 + .../dagger/internal/codegen/MethodSignatureFormatterTest.java | 1 + .../dagger/internal/codegen/MissingBindingSuggestionsTest.java | 1 + .../java/dagger/internal/codegen/ModuleFactoryGeneratorTest.java | 1 + .../src/test/java/dagger/internal/codegen/MultibindingTest.java | 1 + .../java/dagger/internal/codegen/MultibindingsValidatorTest.java | 1 + .../java/dagger/internal/codegen/MultibindsValidatorTest.java | 1 + .../test/java/dagger/internal/codegen/MultipleRequestTest.java | 1 + .../internal/codegen/ProductionComponentProcessorTest.java | 1 + .../dagger/internal/codegen/ProductionGraphValidationTest.java | 1 + .../internal/codegen/SubcomponentBuilderValidationTest.java | 1 + .../java/dagger/internal/codegen/SubcomponentValidationTest.java | 1 + .../test/java/dagger/internal/codegen/ValidationReportTest.java | 1 + .../tests/integration/operation/PrimitiveInjectionTest.java | 1 + core/src/main/java/dagger/Binds.java | 1 + core/src/main/java/dagger/Component.java | 1 + core/src/main/java/dagger/Lazy.java | 1 + core/src/main/java/dagger/MapKey.java | 1 + core/src/main/java/dagger/MembersInjector.java | 1 + core/src/main/java/dagger/Module.java | 1 + core/src/main/java/dagger/Multibindings.java | 1 + core/src/main/java/dagger/Provides.java | 1 + core/src/main/java/dagger/Reusable.java | 1 + core/src/main/java/dagger/Subcomponent.java | 1 + core/src/main/java/dagger/internal/Beta.java | 1 + core/src/main/java/dagger/internal/DaggerCollections.java | 1 + core/src/main/java/dagger/internal/DelegateFactory.java | 1 + core/src/main/java/dagger/internal/DoubleCheck.java | 1 + core/src/main/java/dagger/internal/Factory.java | 1 + core/src/main/java/dagger/internal/GwtIncompatible.java | 1 + core/src/main/java/dagger/internal/InstanceFactory.java | 1 + core/src/main/java/dagger/internal/MapFactory.java | 1 + core/src/main/java/dagger/internal/MapProviderFactory.java | 1 + core/src/main/java/dagger/internal/MembersInjectors.java | 1 + core/src/main/java/dagger/internal/Preconditions.java | 1 + core/src/main/java/dagger/internal/ProviderOfLazy.java | 1 + core/src/main/java/dagger/internal/SetFactory.java | 1 + core/src/main/java/dagger/internal/SingleCheck.java | 1 + core/src/main/java/dagger/multibindings/ClassKey.java | 1 + core/src/main/java/dagger/multibindings/ElementsIntoSet.java | 1 + core/src/main/java/dagger/multibindings/IntKey.java | 1 + core/src/main/java/dagger/multibindings/IntoMap.java | 1 + core/src/main/java/dagger/multibindings/IntoSet.java | 1 + core/src/main/java/dagger/multibindings/LongKey.java | 1 + core/src/main/java/dagger/multibindings/Multibinds.java | 1 + core/src/main/java/dagger/multibindings/StringKey.java | 1 + core/src/main/java/dagger/multibindings/package-info.java | 1 + core/src/main/java/dagger/package-info.java | 1 + core/src/test/java/dagger/internal/DoubleCheckTest.java | 1 + core/src/test/java/dagger/internal/InstanceFactoryTest.java | 1 + core/src/test/java/dagger/internal/MapProviderFactoryTest.java | 1 + core/src/test/java/dagger/internal/SetFactoryTest.java | 1 + core/src/test/java/dagger/internal/SingleCheckTest.java | 1 + .../example/dagger/activitygraphs/AbstractActivityComponent.java | 1 + .../java/com/example/dagger/activitygraphs/ActivityModule.java | 1 + .../com/example/dagger/activitygraphs/ApplicationComponent.java | 1 + .../java/com/example/dagger/activitygraphs/DemoApplication.java | 1 + .../com/example/dagger/activitygraphs/DemoApplicationModule.java | 1 + .../main/java/com/example/dagger/activitygraphs/PerActivity.java | 1 + .../dagger/activitygraphs/ui/ActivityTitleController.java | 1 + .../java/com/example/dagger/activitygraphs/ui/HomeActivity.java | 1 + .../java/com/example/dagger/activitygraphs/ui/HomeComponent.java | 1 + .../java/com/example/dagger/activitygraphs/ui/HomeFragment.java | 1 + .../src/main/java/com/example/dagger/simple/AndroidModule.java | 1 + .../src/main/java/com/example/dagger/simple/DemoActivity.java | 1 + .../src/main/java/com/example/dagger/simple/DemoApplication.java | 1 + .../src/main/java/com/example/dagger/simple/ForApplication.java | 1 + .../src/main/java/com/example/dagger/simple/ui/HomeActivity.java | 1 + producers/src/main/java/dagger/producers/Produced.java | 1 + producers/src/main/java/dagger/producers/Producer.java | 1 + producers/src/main/java/dagger/producers/ProducerModule.java | 1 + producers/src/main/java/dagger/producers/Produces.java | 1 + producers/src/main/java/dagger/producers/Production.java | 1 + .../src/main/java/dagger/producers/ProductionComponent.java | 1 + producers/src/main/java/dagger/producers/ProductionScope.java | 1 + .../src/main/java/dagger/producers/ProductionSubcomponent.java | 1 + .../main/java/dagger/producers/internal/AbstractProducer.java | 1 + .../java/dagger/producers/internal/MapOfProducedProducer.java | 1 + .../java/dagger/producers/internal/MapOfProducerProducer.java | 1 + .../src/main/java/dagger/producers/internal/MapProducer.java | 1 + producers/src/main/java/dagger/producers/internal/Producers.java | 1 + .../java/dagger/producers/internal/ProductionImplementation.java | 1 + .../java/dagger/producers/internal/SetOfProducedProducer.java | 1 + .../src/main/java/dagger/producers/internal/SetProducer.java | 1 + .../main/java/dagger/producers/monitoring/ProducerMonitor.java | 1 + .../java/dagger/producers/monitoring/ProducerTimingRecorder.java | 1 + .../src/main/java/dagger/producers/monitoring/ProducerToken.java | 1 + .../dagger/producers/monitoring/ProductionComponentMonitor.java | 1 + .../producers/monitoring/ProductionComponentTimingRecorder.java | 1 + .../java/dagger/producers/monitoring/TimingProducerMonitor.java | 1 + .../producers/monitoring/TimingProductionComponentMonitor.java | 1 + .../main/java/dagger/producers/monitoring/TimingRecorders.java | 1 + .../main/java/dagger/producers/monitoring/internal/Monitors.java | 1 + .../src/main/java/dagger/producers/monitoring/package-info.java | 1 + producers/src/main/java/dagger/producers/package-info.java | 1 + producers/src/test/java/dagger/producers/ProducedTest.java | 1 + .../java/dagger/producers/internal/AbstractProducerTest.java | 1 + .../dagger/producers/internal/MapOfProducerProducerTest.java | 1 + .../src/test/java/dagger/producers/internal/MapProducerTest.java | 1 + .../src/test/java/dagger/producers/internal/ProducersTest.java | 1 + .../dagger/producers/internal/SetOfProducedProducerTest.java | 1 + .../src/test/java/dagger/producers/internal/SetProducerTest.java | 1 + .../monitoring/TimingProductionComponentMonitorTest.java | 1 + .../java/dagger/producers/monitoring/TimingRecordersTest.java | 1 + .../java/dagger/producers/monitoring/internal/MonitorsTest.java | 1 + 430 files changed, 430 insertions(+) diff --git a/compiler/src/it/functional-tests/src/main/java/test/A.java b/compiler/src/it/functional-tests/src/main/java/test/A.java index 853f64ccfe5..b6c27338b1a 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/A.java +++ b/compiler/src/it/functional-tests/src/main/java/test/A.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/AbstractMembersInjectingBaseClass.java b/compiler/src/it/functional-tests/src/main/java/test/AbstractMembersInjectingBaseClass.java index 96a80507fa4..7e9676888dd 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/AbstractMembersInjectingBaseClass.java +++ b/compiler/src/it/functional-tests/src/main/java/test/AbstractMembersInjectingBaseClass.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/AbstractMiddleClassWithoutMembers.java b/compiler/src/it/functional-tests/src/main/java/test/AbstractMiddleClassWithoutMembers.java index 0728c39cd2c..41bcddbdc47 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/AbstractMiddleClassWithoutMembers.java +++ b/compiler/src/it/functional-tests/src/main/java/test/AbstractMiddleClassWithoutMembers.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; abstract class AbstractMiddleClassWithoutMembers extends AbstractMembersInjectingBaseClass { diff --git a/compiler/src/it/functional-tests/src/main/java/test/B.java b/compiler/src/it/functional-tests/src/main/java/test/B.java index 96a4b6919b7..844f9d7cb97 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/B.java +++ b/compiler/src/it/functional-tests/src/main/java/test/B.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/BasicAbstractClassComponent.java b/compiler/src/it/functional-tests/src/main/java/test/BasicAbstractClassComponent.java index 3ab8b66ee20..473c085c4c8 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/BasicAbstractClassComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/BasicAbstractClassComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/BasicComponent.java b/compiler/src/it/functional-tests/src/main/java/test/BasicComponent.java index 85149222c9f..6f068c51e30 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/BasicComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/BasicComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/BooleanKey.java b/compiler/src/it/functional-tests/src/main/java/test/BooleanKey.java index 9d75568aeb4..78fab2e458e 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/BooleanKey.java +++ b/compiler/src/it/functional-tests/src/main/java/test/BooleanKey.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.MapKey; diff --git a/compiler/src/it/functional-tests/src/main/java/test/BoundedGenericComponent.java b/compiler/src/it/functional-tests/src/main/java/test/BoundedGenericComponent.java index 1a46691b8a6..605bf0ae59d 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/BoundedGenericComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/BoundedGenericComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/BoundedGenericModule.java b/compiler/src/it/functional-tests/src/main/java/test/BoundedGenericModule.java index 4feede8b76b..f24f4616673 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/BoundedGenericModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/BoundedGenericModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/BoundedGenerics.java b/compiler/src/it/functional-tests/src/main/java/test/BoundedGenerics.java index 4087a496f0b..d433728aa22 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/BoundedGenerics.java +++ b/compiler/src/it/functional-tests/src/main/java/test/BoundedGenerics.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import java.util.List; diff --git a/compiler/src/it/functional-tests/src/main/java/test/ByteKey.java b/compiler/src/it/functional-tests/src/main/java/test/ByteKey.java index f0fbe41f9c4..e04ee33dd38 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/ByteKey.java +++ b/compiler/src/it/functional-tests/src/main/java/test/ByteKey.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.MapKey; diff --git a/compiler/src/it/functional-tests/src/main/java/test/CharKey.java b/compiler/src/it/functional-tests/src/main/java/test/CharKey.java index af2cf0190b3..276ee615320 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/CharKey.java +++ b/compiler/src/it/functional-tests/src/main/java/test/CharKey.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.MapKey; diff --git a/compiler/src/it/functional-tests/src/main/java/test/ComplexGenerics.java b/compiler/src/it/functional-tests/src/main/java/test/ComplexGenerics.java index c6a6e7335b4..272b29bec27 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/ComplexGenerics.java +++ b/compiler/src/it/functional-tests/src/main/java/test/ComplexGenerics.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Lazy; diff --git a/compiler/src/it/functional-tests/src/main/java/test/ComponentDependsOnGeneratedCode.java b/compiler/src/it/functional-tests/src/main/java/test/ComponentDependsOnGeneratedCode.java index 6f1dc3cb23b..cdc693d0b6a 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/ComponentDependsOnGeneratedCode.java +++ b/compiler/src/it/functional-tests/src/main/java/test/ComponentDependsOnGeneratedCode.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/ComponentSupertypeDependsOnGeneratedCode.java b/compiler/src/it/functional-tests/src/main/java/test/ComponentSupertypeDependsOnGeneratedCode.java index 8076b79f786..28fcf5fc86d 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/ComponentSupertypeDependsOnGeneratedCode.java +++ b/compiler/src/it/functional-tests/src/main/java/test/ComponentSupertypeDependsOnGeneratedCode.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/ComponentSupertypeDependsOnGeneratedCodeInterface.java b/compiler/src/it/functional-tests/src/main/java/test/ComponentSupertypeDependsOnGeneratedCodeInterface.java index 15404e678ed..325c449704d 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/ComponentSupertypeDependsOnGeneratedCodeInterface.java +++ b/compiler/src/it/functional-tests/src/main/java/test/ComponentSupertypeDependsOnGeneratedCodeInterface.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; interface ComponentSupertypeDependsOnGeneratedCodeInterface { diff --git a/compiler/src/it/functional-tests/src/main/java/test/ComponentWithReusableBindings.java b/compiler/src/it/functional-tests/src/main/java/test/ComponentWithReusableBindings.java index f1b39c16645..ad1e4c88194 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/ComponentWithReusableBindings.java +++ b/compiler/src/it/functional-tests/src/main/java/test/ComponentWithReusableBindings.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/ComponentsWithNestedModules.java b/compiler/src/it/functional-tests/src/main/java/test/ComponentsWithNestedModules.java index bfd49f112e0..48faad19015 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/ComponentsWithNestedModules.java +++ b/compiler/src/it/functional-tests/src/main/java/test/ComponentsWithNestedModules.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/Generic.java b/compiler/src/it/functional-tests/src/main/java/test/Generic.java index 8917737eb05..72e8f1c5d86 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/Generic.java +++ b/compiler/src/it/functional-tests/src/main/java/test/Generic.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/Generic2.java b/compiler/src/it/functional-tests/src/main/java/test/Generic2.java index 7771d18228a..0d353bf6bcf 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/Generic2.java +++ b/compiler/src/it/functional-tests/src/main/java/test/Generic2.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/GenericChild.java b/compiler/src/it/functional-tests/src/main/java/test/GenericChild.java index aa35373b92b..3c42bc885cd 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/GenericChild.java +++ b/compiler/src/it/functional-tests/src/main/java/test/GenericChild.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/GenericComponent.java b/compiler/src/it/functional-tests/src/main/java/test/GenericComponent.java index c1940257a47..6ce8d89acea 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/GenericComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/GenericComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/GenericDoubleReferences.java b/compiler/src/it/functional-tests/src/main/java/test/GenericDoubleReferences.java index 96278a0d2e0..d70f9e25cac 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/GenericDoubleReferences.java +++ b/compiler/src/it/functional-tests/src/main/java/test/GenericDoubleReferences.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/GenericNoDeps.java b/compiler/src/it/functional-tests/src/main/java/test/GenericNoDeps.java index b19948120f5..b569ecb3edb 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/GenericNoDeps.java +++ b/compiler/src/it/functional-tests/src/main/java/test/GenericNoDeps.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/GenericParent.java b/compiler/src/it/functional-tests/src/main/java/test/GenericParent.java index a69065452c1..1f7a322f349 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/GenericParent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/GenericParent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/InjectedThing.java b/compiler/src/it/functional-tests/src/main/java/test/InjectedThing.java index afedca37f95..a262e87aeb0 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/InjectedThing.java +++ b/compiler/src/it/functional-tests/src/main/java/test/InjectedThing.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Lazy; diff --git a/compiler/src/it/functional-tests/src/main/java/test/Injector.java b/compiler/src/it/functional-tests/src/main/java/test/Injector.java index 2a739834301..e890640a2fe 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/Injector.java +++ b/compiler/src/it/functional-tests/src/main/java/test/Injector.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Lazy; diff --git a/compiler/src/it/functional-tests/src/main/java/test/MultibindingComponent.java b/compiler/src/it/functional-tests/src/main/java/test/MultibindingComponent.java index 39d0992b443..cd9aba794a2 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/MultibindingComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/MultibindingComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/MultibindingComponentWithMultibindingsInterface.java b/compiler/src/it/functional-tests/src/main/java/test/MultibindingComponentWithMultibindingsInterface.java index 7830f552196..c711bb25745 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/MultibindingComponentWithMultibindingsInterface.java +++ b/compiler/src/it/functional-tests/src/main/java/test/MultibindingComponentWithMultibindingsInterface.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/MultibindingDependency.java b/compiler/src/it/functional-tests/src/main/java/test/MultibindingDependency.java index b3d651b0627..d4dca4f32d9 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/MultibindingDependency.java +++ b/compiler/src/it/functional-tests/src/main/java/test/MultibindingDependency.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; interface MultibindingDependency { diff --git a/compiler/src/it/functional-tests/src/main/java/test/MultibindingModule.java b/compiler/src/it/functional-tests/src/main/java/test/MultibindingModule.java index b20d2933c88..6f8be978fee 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/MultibindingModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/MultibindingModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/MultibindingsInterfaceModule.java b/compiler/src/it/functional-tests/src/main/java/test/MultibindingsInterfaceModule.java index 654c1fc0786..cc58830a9ad 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/MultibindingsInterfaceModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/MultibindingsInterfaceModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/MultibindsModule.java b/compiler/src/it/functional-tests/src/main/java/test/MultibindsModule.java index 024b7763503..7e213e61be4 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/MultibindsModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/MultibindsModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/NeedsFactory.java b/compiler/src/it/functional-tests/src/main/java/test/NeedsFactory.java index 2531acb6103..a60345f3199 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/NeedsFactory.java +++ b/compiler/src/it/functional-tests/src/main/java/test/NeedsFactory.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import com.google.auto.factory.AutoFactory; diff --git a/compiler/src/it/functional-tests/src/main/java/test/NestedAnnotationContainer.java b/compiler/src/it/functional-tests/src/main/java/test/NestedAnnotationContainer.java index 1c4725eecbc..e5d3b64997f 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/NestedAnnotationContainer.java +++ b/compiler/src/it/functional-tests/src/main/java/test/NestedAnnotationContainer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.MapKey; diff --git a/compiler/src/it/functional-tests/src/main/java/test/NonComponentDependencyComponent.java b/compiler/src/it/functional-tests/src/main/java/test/NonComponentDependencyComponent.java index 9f0ed54d5e8..f9f68ced5d8 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/NonComponentDependencyComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/NonComponentDependencyComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/NullableModule.java b/compiler/src/it/functional-tests/src/main/java/test/NullableModule.java index 68e58ab91fd..f1545e47c85 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/NullableModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/NullableModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/NumberClassKey.java b/compiler/src/it/functional-tests/src/main/java/test/NumberClassKey.java index 55db642c1bb..3980260edc6 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/NumberClassKey.java +++ b/compiler/src/it/functional-tests/src/main/java/test/NumberClassKey.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.MapKey; diff --git a/compiler/src/it/functional-tests/src/main/java/test/OuterClassBar.java b/compiler/src/it/functional-tests/src/main/java/test/OuterClassBar.java index 0388d17e584..80106e7afca 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/OuterClassBar.java +++ b/compiler/src/it/functional-tests/src/main/java/test/OuterClassBar.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/OuterClassFoo.java b/compiler/src/it/functional-tests/src/main/java/test/OuterClassFoo.java index bdd2e6876d4..73c68c2aaa1 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/OuterClassFoo.java +++ b/compiler/src/it/functional-tests/src/main/java/test/OuterClassFoo.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/ReferencesGeneric.java b/compiler/src/it/functional-tests/src/main/java/test/ReferencesGeneric.java index 17e6cb6aa2e..453bdfb7efb 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/ReferencesGeneric.java +++ b/compiler/src/it/functional-tests/src/main/java/test/ReferencesGeneric.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/ShortKey.java b/compiler/src/it/functional-tests/src/main/java/test/ShortKey.java index e3ab6270c07..9cb8f3e8696 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/ShortKey.java +++ b/compiler/src/it/functional-tests/src/main/java/test/ShortKey.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.MapKey; diff --git a/compiler/src/it/functional-tests/src/main/java/test/SomeQualifier.java b/compiler/src/it/functional-tests/src/main/java/test/SomeQualifier.java index 5ef8087e751..d95021d50e7 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/SomeQualifier.java +++ b/compiler/src/it/functional-tests/src/main/java/test/SomeQualifier.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import java.lang.annotation.Documented; diff --git a/compiler/src/it/functional-tests/src/main/java/test/Thing.java b/compiler/src/it/functional-tests/src/main/java/test/Thing.java index fb76a8d430e..2099eba6cea 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/Thing.java +++ b/compiler/src/it/functional-tests/src/main/java/test/Thing.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/TypeWithInheritedMembersInjection.java b/compiler/src/it/functional-tests/src/main/java/test/TypeWithInheritedMembersInjection.java index c37e36c408e..8bb6fcac4c5 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/TypeWithInheritedMembersInjection.java +++ b/compiler/src/it/functional-tests/src/main/java/test/TypeWithInheritedMembersInjection.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/UnwrappedAnnotationKey.java b/compiler/src/it/functional-tests/src/main/java/test/UnwrappedAnnotationKey.java index b86894534da..96d2cb28986 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/UnwrappedAnnotationKey.java +++ b/compiler/src/it/functional-tests/src/main/java/test/UnwrappedAnnotationKey.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.MapKey; diff --git a/compiler/src/it/functional-tests/src/main/java/test/WrappedAnnotationKey.java b/compiler/src/it/functional-tests/src/main/java/test/WrappedAnnotationKey.java index ea63c38483d..50306d032ba 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/WrappedAnnotationKey.java +++ b/compiler/src/it/functional-tests/src/main/java/test/WrappedAnnotationKey.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.MapKey; diff --git a/compiler/src/it/functional-tests/src/main/java/test/binds/Foo.java b/compiler/src/it/functional-tests/src/main/java/test/binds/Foo.java index bcfaaac7002..6835ebbba74 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/binds/Foo.java +++ b/compiler/src/it/functional-tests/src/main/java/test/binds/Foo.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.binds; /** diff --git a/compiler/src/it/functional-tests/src/main/java/test/binds/FooOfStrings.java b/compiler/src/it/functional-tests/src/main/java/test/binds/FooOfStrings.java index 71e4f8bae53..0243e3a1824 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/binds/FooOfStrings.java +++ b/compiler/src/it/functional-tests/src/main/java/test/binds/FooOfStrings.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.binds; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/binds/InterfaceModule.java b/compiler/src/it/functional-tests/src/main/java/test/binds/InterfaceModule.java index e989b8d29e3..732c040c59f 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/binds/InterfaceModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/binds/InterfaceModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.binds; import dagger.Binds; diff --git a/compiler/src/it/functional-tests/src/main/java/test/binds/SimpleBindingModule.java b/compiler/src/it/functional-tests/src/main/java/test/binds/SimpleBindingModule.java index 6af054c6a0d..1482e984fbb 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/binds/SimpleBindingModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/binds/SimpleBindingModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.binds; import dagger.Binds; diff --git a/compiler/src/it/functional-tests/src/main/java/test/binds/TestComponent.java b/compiler/src/it/functional-tests/src/main/java/test/binds/TestComponent.java index 31e833ad3c9..d3a4e9635a6 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/binds/TestComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/binds/TestComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.binds; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/ByteModule.java b/compiler/src/it/functional-tests/src/main/java/test/builder/ByteModule.java index da431ee053d..feafdd0d6d4 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/ByteModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/ByteModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/DepComponent.java b/compiler/src/it/functional-tests/src/main/java/test/builder/DepComponent.java index ae6b6febb6a..1d18341f400 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/DepComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/DepComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/DoubleModule.java b/compiler/src/it/functional-tests/src/main/java/test/builder/DoubleModule.java index 7abe44dd53d..8cf226befd9 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/DoubleModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/DoubleModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/FloatModule.java b/compiler/src/it/functional-tests/src/main/java/test/builder/FloatModule.java index 838ab4230b1..0d3af1d315a 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/FloatModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/FloatModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/GenericParent.java b/compiler/src/it/functional-tests/src/main/java/test/builder/GenericParent.java index 7cb1c34b402..beffe27a643 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/GenericParent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/GenericParent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; interface GenericParent { diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/Grandchild.java b/compiler/src/it/functional-tests/src/main/java/test/builder/Grandchild.java index c6067c75d59..759b470df77 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/Grandchild.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/Grandchild.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import dagger.Subcomponent; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/IntModuleIncludingDoubleAndFloat.java b/compiler/src/it/functional-tests/src/main/java/test/builder/IntModuleIncludingDoubleAndFloat.java index 1cfe6993472..69c12259d96 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/IntModuleIncludingDoubleAndFloat.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/IntModuleIncludingDoubleAndFloat.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/LongModule.java b/compiler/src/it/functional-tests/src/main/java/test/builder/LongModule.java index 70b9ac2985b..cb848a70788 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/LongModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/LongModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/MiddleChild.java b/compiler/src/it/functional-tests/src/main/java/test/builder/MiddleChild.java index a7952af3209..b606b7986dc 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/MiddleChild.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/MiddleChild.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import dagger.Subcomponent; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/MiddleScope.java b/compiler/src/it/functional-tests/src/main/java/test/builder/MiddleScope.java index 4f43094abd3..c71acca6ba8 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/MiddleScope.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/MiddleScope.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import java.lang.annotation.Retention; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/OtherMiddleChild.java b/compiler/src/it/functional-tests/src/main/java/test/builder/OtherMiddleChild.java index 0854a3b2680..a5871c6e837 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/OtherMiddleChild.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/OtherMiddleChild.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import dagger.Subcomponent; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/ParentComponent.java b/compiler/src/it/functional-tests/src/main/java/test/builder/ParentComponent.java index 1fdd3598205..a9b8fc7230a 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/ParentComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/ParentComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/ParentOfGenericComponent.java b/compiler/src/it/functional-tests/src/main/java/test/builder/ParentOfGenericComponent.java index 74a8b89113f..ad0c4919399 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/ParentOfGenericComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/ParentOfGenericComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/RequiresSubcomponentBuilder.java b/compiler/src/it/functional-tests/src/main/java/test/builder/RequiresSubcomponentBuilder.java index 65ba4d494e9..23bbaa9044f 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/RequiresSubcomponentBuilder.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/RequiresSubcomponentBuilder.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/StringModule.java b/compiler/src/it/functional-tests/src/main/java/test/builder/StringModule.java index e014f0000bc..c1fb723fb75 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/StringModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/StringModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/TestChildComponentWithBuilderAbstractClass.java b/compiler/src/it/functional-tests/src/main/java/test/builder/TestChildComponentWithBuilderAbstractClass.java index 70a4b2ec9ac..21d1ddd59a1 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/TestChildComponentWithBuilderAbstractClass.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/TestChildComponentWithBuilderAbstractClass.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import dagger.Subcomponent; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/TestChildComponentWithBuilderInterface.java b/compiler/src/it/functional-tests/src/main/java/test/builder/TestChildComponentWithBuilderInterface.java index b458b5adcf6..59e39e54335 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/TestChildComponentWithBuilderInterface.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/TestChildComponentWithBuilderInterface.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import dagger.Subcomponent; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/TestComponentWithBuilderAbstractClass.java b/compiler/src/it/functional-tests/src/main/java/test/builder/TestComponentWithBuilderAbstractClass.java index 3ef5932c121..da966cc6d52 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/TestComponentWithBuilderAbstractClass.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/TestComponentWithBuilderAbstractClass.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/TestComponentWithBuilderInterface.java b/compiler/src/it/functional-tests/src/main/java/test/builder/TestComponentWithBuilderInterface.java index d2a6550f4d5..6cd556199a0 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/TestComponentWithBuilderInterface.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/TestComponentWithBuilderInterface.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/TestComponentWithGenericBuilderAbstractClass.java b/compiler/src/it/functional-tests/src/main/java/test/builder/TestComponentWithGenericBuilderAbstractClass.java index 4a679cfa1cd..d7603e9c882 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/TestComponentWithGenericBuilderAbstractClass.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/TestComponentWithGenericBuilderAbstractClass.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/TestComponentWithGenericBuilderInterface.java b/compiler/src/it/functional-tests/src/main/java/test/builder/TestComponentWithGenericBuilderInterface.java index f6c1b8223e9..5e8ca24004c 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/TestComponentWithGenericBuilderInterface.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/TestComponentWithGenericBuilderInterface.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/cycle/Cycles.java b/compiler/src/it/functional-tests/src/main/java/test/cycle/Cycles.java index 81e7f1bfc2b..412d3e4d045 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/cycle/Cycles.java +++ b/compiler/src/it/functional-tests/src/main/java/test/cycle/Cycles.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.cycle; import dagger.Binds; diff --git a/compiler/src/it/functional-tests/src/main/java/test/cycle/LongCycle.java b/compiler/src/it/functional-tests/src/main/java/test/cycle/LongCycle.java index a8c3441dc3d..ed1518b3585 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/cycle/LongCycle.java +++ b/compiler/src/it/functional-tests/src/main/java/test/cycle/LongCycle.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.cycle; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/membersinject/ChildOfArrayOfParentOfStringArray.java b/compiler/src/it/functional-tests/src/main/java/test/membersinject/ChildOfArrayOfParentOfStringArray.java index 132ee3313d8..de07ef9f83f 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/membersinject/ChildOfArrayOfParentOfStringArray.java +++ b/compiler/src/it/functional-tests/src/main/java/test/membersinject/ChildOfArrayOfParentOfStringArray.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.membersinject; class ChildOfArrayOfParentOfStringArray extends diff --git a/compiler/src/it/functional-tests/src/main/java/test/membersinject/ChildOfPrimitiveIntArray.java b/compiler/src/it/functional-tests/src/main/java/test/membersinject/ChildOfPrimitiveIntArray.java index 58da58ef017..9ba1ca34918 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/membersinject/ChildOfPrimitiveIntArray.java +++ b/compiler/src/it/functional-tests/src/main/java/test/membersinject/ChildOfPrimitiveIntArray.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.membersinject; class ChildOfPrimitiveIntArray extends MembersInjectGenericParent { diff --git a/compiler/src/it/functional-tests/src/main/java/test/membersinject/ChildOfStringArray.java b/compiler/src/it/functional-tests/src/main/java/test/membersinject/ChildOfStringArray.java index aa0a88145f7..e11dad1cdff 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/membersinject/ChildOfStringArray.java +++ b/compiler/src/it/functional-tests/src/main/java/test/membersinject/ChildOfStringArray.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.membersinject; class ChildOfStringArray extends MembersInjectGenericParent { diff --git a/compiler/src/it/functional-tests/src/main/java/test/membersinject/MembersInjectComponent.java b/compiler/src/it/functional-tests/src/main/java/test/membersinject/MembersInjectComponent.java index 35eae333fd7..29350451899 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/membersinject/MembersInjectComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/membersinject/MembersInjectComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.membersinject; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/membersinject/MembersInjectGenericParent.java b/compiler/src/it/functional-tests/src/main/java/test/membersinject/MembersInjectGenericParent.java index bf6f9bad93c..674da5052f8 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/membersinject/MembersInjectGenericParent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/membersinject/MembersInjectGenericParent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.membersinject; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/membersinject/MembersInjectModule.java b/compiler/src/it/functional-tests/src/main/java/test/membersinject/MembersInjectModule.java index 4425d1416b9..fc31c772e62 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/membersinject/MembersInjectModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/membersinject/MembersInjectModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.membersinject; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/membersinject/NonRequestedChild.java b/compiler/src/it/functional-tests/src/main/java/test/membersinject/NonRequestedChild.java index 6e8fc723142..448c37df1e7 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/membersinject/NonRequestedChild.java +++ b/compiler/src/it/functional-tests/src/main/java/test/membersinject/NonRequestedChild.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.membersinject; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/multipackage/MembersInjectionVisibilityComponent.java b/compiler/src/it/functional-tests/src/main/java/test/multipackage/MembersInjectionVisibilityComponent.java index ac7165cb4b8..608255b9db0 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/multipackage/MembersInjectionVisibilityComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/multipackage/MembersInjectionVisibilityComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.multipackage; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/AGrandchild.java b/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/AGrandchild.java index 75f689f43d9..31a5e61fc6d 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/AGrandchild.java +++ b/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/AGrandchild.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.multipackage.a; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/APackagePrivateObject.java b/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/APackagePrivateObject.java index 006f869b43a..3e67bb08842 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/APackagePrivateObject.java +++ b/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/APackagePrivateObject.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.multipackage.a; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/AParent.java b/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/AParent.java index 95082d92886..647ebdeda08 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/AParent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/AParent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.multipackage.a; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/APublicObject.java b/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/APublicObject.java index f98f50c94ad..5262ec40ebf 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/APublicObject.java +++ b/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/APublicObject.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.multipackage.a; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/UsesInaccessible.java b/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/UsesInaccessible.java index 27b3c0071fa..90146b991ce 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/UsesInaccessible.java +++ b/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/UsesInaccessible.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.multipackage.a; import java.util.Map; diff --git a/compiler/src/it/functional-tests/src/main/java/test/multipackage/b/BChild.java b/compiler/src/it/functional-tests/src/main/java/test/multipackage/b/BChild.java index f104e093ac6..8fec0c5bb71 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/multipackage/b/BChild.java +++ b/compiler/src/it/functional-tests/src/main/java/test/multipackage/b/BChild.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.multipackage.b; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/multipackage/b/BPackagePrivateObject.java b/compiler/src/it/functional-tests/src/main/java/test/multipackage/b/BPackagePrivateObject.java index 30b7461e1fd..bce3e4c71ed 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/multipackage/b/BPackagePrivateObject.java +++ b/compiler/src/it/functional-tests/src/main/java/test/multipackage/b/BPackagePrivateObject.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.multipackage.b; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/nullables/NullComponent.java b/compiler/src/it/functional-tests/src/main/java/test/nullables/NullComponent.java index 9f9976b97e9..a53a415ece8 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/nullables/NullComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/nullables/NullComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.nullables; import javax.inject.Provider; diff --git a/compiler/src/it/functional-tests/src/main/java/test/nullables/NullComponentWithDependency.java b/compiler/src/it/functional-tests/src/main/java/test/nullables/NullComponentWithDependency.java index e390f9a6c71..fe7a8e414ac 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/nullables/NullComponentWithDependency.java +++ b/compiler/src/it/functional-tests/src/main/java/test/nullables/NullComponentWithDependency.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.nullables; import javax.inject.Provider; diff --git a/compiler/src/it/functional-tests/src/main/java/test/nullables/NullFoo.java b/compiler/src/it/functional-tests/src/main/java/test/nullables/NullFoo.java index b07f800d874..13f60fe7807 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/nullables/NullFoo.java +++ b/compiler/src/it/functional-tests/src/main/java/test/nullables/NullFoo.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.nullables; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/nullables/NullModule.java b/compiler/src/it/functional-tests/src/main/java/test/nullables/NullModule.java index e819df3c8c9..dc827adfe51 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/nullables/NullModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/nullables/NullModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.nullables; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/scope/BlueModule.java b/compiler/src/it/functional-tests/src/main/java/test/scope/BlueModule.java index 61011ce05f9..ff4703152ed 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/scope/BlueModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/scope/BlueModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.scope; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/scope/BlueScope.java b/compiler/src/it/functional-tests/src/main/java/test/scope/BlueScope.java index b2d8e2bf15a..83f2b65bd42 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/scope/BlueScope.java +++ b/compiler/src/it/functional-tests/src/main/java/test/scope/BlueScope.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.scope; import java.lang.annotation.Documented; diff --git a/compiler/src/it/functional-tests/src/main/java/test/scope/GreenModule.java b/compiler/src/it/functional-tests/src/main/java/test/scope/GreenModule.java index 7be7057de36..a8d96057d0c 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/scope/GreenModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/scope/GreenModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.scope; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/scope/GreenScope.java b/compiler/src/it/functional-tests/src/main/java/test/scope/GreenScope.java index 9b0ab9efb70..ab3a7173634 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/scope/GreenScope.java +++ b/compiler/src/it/functional-tests/src/main/java/test/scope/GreenScope.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.scope; import java.lang.annotation.Documented; diff --git a/compiler/src/it/functional-tests/src/main/java/test/scope/ScopedComponent.java b/compiler/src/it/functional-tests/src/main/java/test/scope/ScopedComponent.java index 67c5e91f1a1..8ea281108eb 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/scope/ScopedComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/scope/ScopedComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.scope; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/scope/TurquoiseModule.java b/compiler/src/it/functional-tests/src/main/java/test/scope/TurquoiseModule.java index 0b5cf166138..ef6fb54554c 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/scope/TurquoiseModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/scope/TurquoiseModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.scope; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/staticprovides/AllStaticModule.java b/compiler/src/it/functional-tests/src/main/java/test/staticprovides/AllStaticModule.java index 9c100051bc0..632382578f7 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/staticprovides/AllStaticModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/staticprovides/AllStaticModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.staticprovides; import static java.util.Collections.emptySet; diff --git a/compiler/src/it/functional-tests/src/main/java/test/staticprovides/SomeStaticModule.java b/compiler/src/it/functional-tests/src/main/java/test/staticprovides/SomeStaticModule.java index 4202fe1f5fc..56d10f9a62b 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/staticprovides/SomeStaticModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/staticprovides/SomeStaticModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.staticprovides; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/staticprovides/StaticTestComponent.java b/compiler/src/it/functional-tests/src/main/java/test/staticprovides/StaticTestComponent.java index 9c0fd4fdb0d..1a3e67799bb 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/staticprovides/StaticTestComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/staticprovides/StaticTestComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.staticprovides; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/staticprovides/StaticTestComponentWithBuilder.java b/compiler/src/it/functional-tests/src/main/java/test/staticprovides/StaticTestComponentWithBuilder.java index 4427a39a383..8ae132d3907 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/staticprovides/StaticTestComponentWithBuilder.java +++ b/compiler/src/it/functional-tests/src/main/java/test/staticprovides/StaticTestComponentWithBuilder.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.staticprovides; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/sub/ContributionsModule.java b/compiler/src/it/functional-tests/src/main/java/test/sub/ContributionsModule.java index 35de7e7c508..a72ab14aa9f 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/sub/ContributionsModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/sub/ContributionsModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.sub; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/sub/OtherThing.java b/compiler/src/it/functional-tests/src/main/java/test/sub/OtherThing.java index 9adc09f0517..9597f570cb0 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/sub/OtherThing.java +++ b/compiler/src/it/functional-tests/src/main/java/test/sub/OtherThing.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.sub; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/AnInterface.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/AnInterface.java index 5bc24d28d06..325bbb421dc 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/AnInterface.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/AnInterface.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; interface AnInterface { diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/BoundAsSingleton.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/BoundAsSingleton.java index dad7efa588b..c9786707392 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/BoundAsSingleton.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/BoundAsSingleton.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import java.lang.annotation.Documented; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildAbstractClassComponent.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildAbstractClassComponent.java index 431efe5f3e4..b7abe940801 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildAbstractClassComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildAbstractClassComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import dagger.Subcomponent; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildComponent.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildComponent.java index 048e374539d..3353cf0919e 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import dagger.Subcomponent; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildComponentRequiringModules.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildComponentRequiringModules.java index 34df5f0dc54..78a5c4a731c 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildComponentRequiringModules.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildComponentRequiringModules.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import dagger.Subcomponent; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildModule.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildModule.java index 635c01638bd..a86093a3693 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildModuleWithParameters.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildModuleWithParameters.java index 8a829ca5671..fd6b7fddd2a 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildModuleWithParameters.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildModuleWithParameters.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildModuleWithState.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildModuleWithState.java index 23ffb77780b..1952a27a1f8 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildModuleWithState.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ChildModuleWithState.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/GenericParentComponent.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/GenericParentComponent.java index 7adb041b418..5b8414ceae2 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/GenericParentComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/GenericParentComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; interface GenericParentComponent { diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/GrandchildComponent.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/GrandchildComponent.java index 6eea7b5dfb9..0fc79f979ba 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/GrandchildComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/GrandchildComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import dagger.Subcomponent; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/GrandchildModule.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/GrandchildModule.java index e566e3f047e..a261117a564 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/GrandchildModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/GrandchildModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import dagger.Binds; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ImplementsAnInterface.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ImplementsAnInterface.java index 47d8b246e6d..8be798f425f 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ImplementsAnInterface.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ImplementsAnInterface.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/MultibindingSubcomponents.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/MultibindingSubcomponents.java index 4d6ddf81358..a32b0968bee 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/MultibindingSubcomponents.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/MultibindingSubcomponents.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import dagger.Binds; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/NeedsAnInterface.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/NeedsAnInterface.java index 7d4564483e8..e1d983180de 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/NeedsAnInterface.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/NeedsAnInterface.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; class NeedsAnInterface { diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentComponent.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentComponent.java index 1032464cfff..38f298adf4c 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentGetters.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentGetters.java index 1fb55d25a9e..6614ddfe5cb 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentGetters.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentGetters.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import java.util.Set; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentModule.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentModule.java index c0f5ce9b1e5..5a21def0514 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import dagger.Binds; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentOfGenericComponent.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentOfGenericComponent.java index 6087c88a46b..edd3095cb1a 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentOfGenericComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentOfGenericComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/RequiresSingletons.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/RequiresSingletons.java index f616998dcee..2e9cadb57c9 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/RequiresSingletons.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/RequiresSingletons.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/SingletonType.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/SingletonType.java index de3b74c1e04..68a063600c4 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/SingletonType.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/SingletonType.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/StaticChildModule.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/StaticChildModule.java index b4959390409..4896dd67af9 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/StaticChildModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/StaticChildModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/Unbound.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/Unbound.java index 6244ba6c649..bf7a578fbb8 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/Unbound.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/Unbound.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import java.lang.annotation.Documented; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/UnresolvableChildComponent.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/UnresolvableChildComponent.java index 02c21e219aa..a7d470212bd 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/UnresolvableChildComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/UnresolvableChildComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import dagger.Subcomponent; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/UnresolvableChildComponentModule.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/UnresolvableChildComponentModule.java index c04809eee9f..34aa73e95ff 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/UnresolvableChildComponentModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/UnresolvableChildComponentModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/UnscopedType.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/UnscopedType.java index b6fb6b796c3..620df47b5d7 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/UnscopedType.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/UnscopedType.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/ChildComponent.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/ChildComponent.java index 64958e4aa43..5f7c0258a1a 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/ChildComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/ChildComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent.hiding; import dagger.Subcomponent; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/ParentComponent.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/ParentComponent.java index 194027fca9b..ffbea8fe48a 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/ParentComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/ParentComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent.hiding; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/a/CommonModuleName.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/a/CommonModuleName.java index ad1dfce5f4c..8fbbd6f151f 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/a/CommonModuleName.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/a/CommonModuleName.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent.hiding.a; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/a/CommonName.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/a/CommonName.java index 9a6bdda4989..864799f305a 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/a/CommonName.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/a/CommonName.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent.hiding.a; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/b/CommonModuleName.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/b/CommonModuleName.java index ab2b7be3e72..10f5a1f3291 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/b/CommonModuleName.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/b/CommonModuleName.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent.hiding.b; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/b/CommonName.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/b/CommonName.java index 1eac79c6a44..21c1a115c08 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/b/CommonName.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/hiding/b/CommonName.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent.hiding.b; import javax.inject.Inject; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/repeat/ParentComponent.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/repeat/ParentComponent.java index 76d3064b9bc..6ecfd17ccc7 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/repeat/ParentComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/repeat/ParentComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent.repeat; import dagger.Component; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/repeat/RepeatedModule.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/repeat/RepeatedModule.java index 1ad1c1e1973..f4635e55ef4 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/repeat/RepeatedModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/repeat/RepeatedModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent.repeat; import dagger.Module; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/repeat/SubcomponentWithRepeatedModule.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/repeat/SubcomponentWithRepeatedModule.java index e9c30e92d4a..4a3dd061e68 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/repeat/SubcomponentWithRepeatedModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/repeat/SubcomponentWithRepeatedModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent.repeat; import dagger.Subcomponent; diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/repeat/SubcomponentWithoutRepeatedModule.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/repeat/SubcomponentWithoutRepeatedModule.java index a0197c1c029..2b6950462f7 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/repeat/SubcomponentWithoutRepeatedModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/repeat/SubcomponentWithoutRepeatedModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent.repeat; import dagger.Subcomponent; diff --git a/compiler/src/it/functional-tests/src/test/java/test/BasicTest.java b/compiler/src/it/functional-tests/src/test/java/test/BasicTest.java index 25e3c5fc9fd..56d98f45fb8 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/BasicTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/BasicTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import dagger.Lazy; diff --git a/compiler/src/it/functional-tests/src/test/java/test/DependsOnGeneratedCodeTest.java b/compiler/src/it/functional-tests/src/test/java/test/DependsOnGeneratedCodeTest.java index 2e55d49423a..ceebd8b6dee 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/DependsOnGeneratedCodeTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/DependsOnGeneratedCodeTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import org.junit.Test; diff --git a/compiler/src/it/functional-tests/src/test/java/test/GenericTest.java b/compiler/src/it/functional-tests/src/test/java/test/GenericTest.java index 3b35d791a75..efe99a632e9 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/GenericTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/GenericTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import java.util.ArrayList; diff --git a/compiler/src/it/functional-tests/src/test/java/test/MultibindingTest.java b/compiler/src/it/functional-tests/src/test/java/test/MultibindingTest.java index be05f760f46..21c9b377cdc 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/MultibindingTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/MultibindingTest.java @@ -11,6 +11,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ + package test; import com.google.auto.value.AutoAnnotation; diff --git a/compiler/src/it/functional-tests/src/test/java/test/NestedTest.java b/compiler/src/it/functional-tests/src/test/java/test/NestedTest.java index 77f25d96997..fcbe02ad414 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/NestedTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/NestedTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import org.junit.Test; diff --git a/compiler/src/it/functional-tests/src/test/java/test/NonComponentDependencyTest.java b/compiler/src/it/functional-tests/src/test/java/test/NonComponentDependencyTest.java index 8b527bc2887..ef9dba544dc 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/NonComponentDependencyTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/NonComponentDependencyTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import org.junit.Test; diff --git a/compiler/src/it/functional-tests/src/test/java/test/ReusableTest.java b/compiler/src/it/functional-tests/src/test/java/test/ReusableTest.java index 49f1441e8db..feed4c28d14 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/ReusableTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/ReusableTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test; import org.junit.Test; diff --git a/compiler/src/it/functional-tests/src/test/java/test/binds/BindsCollectionsWithoutMultibindingsTest.java b/compiler/src/it/functional-tests/src/test/java/test/binds/BindsCollectionsWithoutMultibindingsTest.java index cd6fad14198..8279f3984ec 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/binds/BindsCollectionsWithoutMultibindingsTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/binds/BindsCollectionsWithoutMultibindingsTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.binds; import com.google.common.collect.ImmutableMap; diff --git a/compiler/src/it/functional-tests/src/test/java/test/binds/BindsTest.java b/compiler/src/it/functional-tests/src/test/java/test/binds/BindsTest.java index 04029907146..258553c8deb 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/binds/BindsTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/binds/BindsTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.binds; import com.google.common.collect.ImmutableMap; diff --git a/compiler/src/it/functional-tests/src/test/java/test/builder/BuilderTest.java b/compiler/src/it/functional-tests/src/test/java/test/builder/BuilderTest.java index e6f63673625..05427e8a68b 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/builder/BuilderTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/builder/BuilderTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.builder; import org.junit.Test; diff --git a/compiler/src/it/functional-tests/src/test/java/test/cycle/CycleTest.java b/compiler/src/it/functional-tests/src/test/java/test/cycle/CycleTest.java index 77cd5ecd1b7..0b230fc7cb7 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/cycle/CycleTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/cycle/CycleTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.cycle; import org.junit.Test; diff --git a/compiler/src/it/functional-tests/src/test/java/test/cycle/LongCycleTest.java b/compiler/src/it/functional-tests/src/test/java/test/cycle/LongCycleTest.java index 57843d4bca3..2ae97f266da 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/cycle/LongCycleTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/cycle/LongCycleTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.cycle; import org.junit.Test; diff --git a/compiler/src/it/functional-tests/src/test/java/test/membersinject/MembersInjectTest.java b/compiler/src/it/functional-tests/src/test/java/test/membersinject/MembersInjectTest.java index 48a3a7b609c..84fb58dd62a 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/membersinject/MembersInjectTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/membersinject/MembersInjectTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.membersinject; import dagger.MembersInjector; diff --git a/compiler/src/it/functional-tests/src/test/java/test/nullables/NullabilityTest.java b/compiler/src/it/functional-tests/src/test/java/test/nullables/NullabilityTest.java index 53f8749c6a8..be1ce51ce06 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/nullables/NullabilityTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/nullables/NullabilityTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.nullables; import javax.inject.Provider; diff --git a/compiler/src/it/functional-tests/src/test/java/test/scope/ScopeTest.java b/compiler/src/it/functional-tests/src/test/java/test/scope/ScopeTest.java index d46057929d9..7a3b1d94cd1 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/scope/ScopeTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/scope/ScopeTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.scope; import static com.google.common.truth.Truth.assertThat; diff --git a/compiler/src/it/functional-tests/src/test/java/test/staticprovides/StaticProvidesTest.java b/compiler/src/it/functional-tests/src/test/java/test/staticprovides/StaticProvidesTest.java index c1e679fb57a..4b36e339131 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/staticprovides/StaticProvidesTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/staticprovides/StaticProvidesTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.staticprovides; import com.google.common.collect.ImmutableSet; diff --git a/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentMultibindingsTest.java b/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentMultibindingsTest.java index b3fe4b097b0..5e3c88ab346 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentMultibindingsTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentMultibindingsTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import com.google.common.collect.ImmutableMap; diff --git a/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentTest.java b/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentTest.java index e1e7c29883a..18b03bee515 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent; import java.util.Arrays; diff --git a/compiler/src/it/functional-tests/src/test/java/test/subcomponent/hiding/SubcomponentHidingTest.java b/compiler/src/it/functional-tests/src/test/java/test/subcomponent/hiding/SubcomponentHidingTest.java index d58106c9866..75847071de8 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/subcomponent/hiding/SubcomponentHidingTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/subcomponent/hiding/SubcomponentHidingTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent.hiding; import org.junit.Test; diff --git a/compiler/src/it/functional-tests/src/test/java/test/subcomponent/repeat/RepeatedModuleTest.java b/compiler/src/it/functional-tests/src/test/java/test/subcomponent/repeat/RepeatedModuleTest.java index 4f7de481703..d61d3aad19b 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/subcomponent/repeat/RepeatedModuleTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/subcomponent/repeat/RepeatedModuleTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.subcomponent.repeat; import org.junit.Before; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependedComponent.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependedComponent.java index 1ab53b9d5f0..81306c002aa 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependedComponent.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependedComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest; import dagger.Component; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependedModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependedModule.java index 16a9d7a083c..47b722d3496 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependedModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependedModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest; import dagger.Module; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependedProducerModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependedProducerModule.java index 39d984fa5e7..b352c6bd3e0 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependedProducerModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependedProducerModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest; import dagger.producers.ProducerModule; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependedProductionComponent.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependedProductionComponent.java index 56ed80792cf..8fd6761c9ac 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependedProductionComponent.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependedProductionComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest; import com.google.common.util.concurrent.ListenableFuture; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependentComponent.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependentComponent.java index c2a1946d0a1..114701123dd 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependentComponent.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependentComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest; import com.google.common.util.concurrent.ListenableFuture; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependentProducerModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependentProducerModule.java index b26bb80e73a..ecfadb0a143 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependentProducerModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependentProducerModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest; import com.google.common.base.Ascii; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/ExecutorModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/ExecutorModule.java index 891405c7e83..92492471f33 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/ExecutorModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/ExecutorModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest; import com.google.common.util.concurrent.MoreExecutors; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/ProvidesInProducerModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/ProvidesInProducerModule.java index 37677aa8118..70617127db2 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/ProvidesInProducerModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/ProvidesInProducerModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest; import com.google.common.util.concurrent.ListenableFuture; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/Request.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/Request.java index de410adfd6b..6a6cbba20f9 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/Request.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/Request.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest; import javax.inject.Inject; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/Response.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/Response.java index 108af4f91d6..2e87cc440ec 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/Response.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/Response.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest; final class Response { diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/ResponseModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/ResponseModule.java index 3780caf1664..3252ce36d89 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/ResponseModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/ResponseModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest; import dagger.Module; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/ResponseProducerModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/ResponseProducerModule.java index 4f9ceaa52c7..0b75e881c65 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/ResponseProducerModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/ResponseProducerModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest; import com.google.common.util.concurrent.Futures; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/SimpleComponent.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/SimpleComponent.java index 6000393b194..0ac75a47628 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/SimpleComponent.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/SimpleComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest; import com.google.common.util.concurrent.ListenableFuture; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/SimpleProducerModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/SimpleProducerModule.java index 2f230836aea..0485075e6ce 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/SimpleProducerModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/SimpleProducerModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest; import com.google.common.collect.ImmutableSet; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/badexecutor/ComponentDependency.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/badexecutor/ComponentDependency.java index 8655a53f7e9..0844b0cbf79 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/badexecutor/ComponentDependency.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/badexecutor/ComponentDependency.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.badexecutor; import com.google.common.util.concurrent.ListenableFuture; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/badexecutor/SimpleComponent.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/badexecutor/SimpleComponent.java index 90481bc573e..e13c4702468 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/badexecutor/SimpleComponent.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/badexecutor/SimpleComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.badexecutor; import com.google.common.util.concurrent.ListenableFuture; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/badexecutor/SimpleProducerModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/badexecutor/SimpleProducerModule.java index f2871cc9a31..24a5ae52ba1 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/badexecutor/SimpleProducerModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/badexecutor/SimpleProducerModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.badexecutor; import dagger.producers.ProducerModule; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/binds/Foo.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/binds/Foo.java index 4e1f9ba10a3..343e90ecb56 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/binds/Foo.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/binds/Foo.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.binds; /** diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/binds/FooOfStrings.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/binds/FooOfStrings.java index 4b3867abe9f..a0c89cd0f02 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/binds/FooOfStrings.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/binds/FooOfStrings.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.binds; /** diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/binds/SimpleBindingModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/binds/SimpleBindingModule.java index c40aa19fa52..84b09689ad1 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/binds/SimpleBindingModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/binds/SimpleBindingModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.binds; import com.google.common.util.concurrent.MoreExecutors; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/binds/SimpleBindsProductionComponent.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/binds/SimpleBindsProductionComponent.java index 3a8b3189806..db72ca8b55f 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/binds/SimpleBindsProductionComponent.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/binds/SimpleBindsProductionComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.binds; import com.google.common.util.concurrent.ListenableFuture; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/builder/DepComponent.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/builder/DepComponent.java index da06e1006a2..1c72cdb668e 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/builder/DepComponent.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/builder/DepComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.builder; import com.google.common.util.concurrent.ListenableFuture; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/builder/IntModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/builder/IntModule.java index 912ea4d8c8d..be7fb16ff04 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/builder/IntModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/builder/IntModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.builder; import dagger.Module; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/builder/StringModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/builder/StringModule.java index 5854a6ee36e..30e6eb9a1f7 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/builder/StringModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/builder/StringModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.builder; import dagger.producers.ProducerModule; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/builder/TestComponentWithBuilder.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/builder/TestComponentWithBuilder.java index 59a503b5e93..2705a657316 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/builder/TestComponentWithBuilder.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/builder/TestComponentWithBuilder.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.builder; import com.google.common.util.concurrent.ListenableFuture; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/MonitoredComponent.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/MonitoredComponent.java index 85ceb2804de..27df6fb52d8 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/MonitoredComponent.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/MonitoredComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.monitoring; import com.google.common.util.concurrent.ListenableFuture; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/MonitoringModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/MonitoringModule.java index 84f9fb645ff..489b89a8876 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/MonitoringModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/MonitoringModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.monitoring; import dagger.Module; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/ServingModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/ServingModule.java index 17603acf290..caaefa60bbc 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/ServingModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/ServingModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.monitoring; import com.google.common.util.concurrent.ListenableFuture; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/StringStub.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/StringStub.java index 31def450626..9503a74f4a4 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/StringStub.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/StringStub.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.monitoring; import com.google.common.util.concurrent.ListenableFuture; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/StubModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/StubModule.java index a25f6ca836a..0bc3bd6817d 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/StubModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/monitoring/StubModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.monitoring; import dagger.Module; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingComponent.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingComponent.java index 6ab7484849f..e858bed6850 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingComponent.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.multibindings; import com.google.common.util.concurrent.ListenableFuture; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingModule.java index 29ae9714a85..6ace5fc5f66 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.multibindings; import com.google.common.collect.ImmutableSet; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingProducerModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingProducerModule.java index 133c3f6fc06..24c5bfe883f 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingProducerModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingProducerModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.multibindings; import com.google.common.collect.ImmutableSet; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/Qualifiers.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/Qualifiers.java index 286504fb84e..6a3fad105ba 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/Qualifiers.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/Qualifiers.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.multibindings; import java.lang.annotation.Documented; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/provisions/Provisions.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/provisions/Provisions.java index cd791870731..d9020fc6221 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/provisions/Provisions.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/provisions/Provisions.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.provisions; import com.google.common.util.concurrent.ListenableFuture; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/scope/ScopedModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/scope/ScopedModule.java index 0f9d7288503..5027a7b57aa 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/scope/ScopedModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/scope/ScopedModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.scope; import dagger.Module; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/scope/ScopedObject.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/scope/ScopedObject.java index d6e97f00dff..cdb72d8d8cd 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/scope/ScopedObject.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/scope/ScopedObject.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.scope; import dagger.producers.ProductionScope; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/scope/SetComponent.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/scope/SetComponent.java index 929eddd363e..a4bde48e84a 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/scope/SetComponent.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/scope/SetComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.scope; import com.google.common.util.concurrent.ListenableFuture; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/scope/SetProducerModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/scope/SetProducerModule.java index b42e81ea945..23a441815df 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/scope/SetProducerModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/scope/SetProducerModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.scope; import dagger.multibindings.IntoSet; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/subcomponent/MultiPackageSubcomponents.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/subcomponent/MultiPackageSubcomponents.java index d8df928208c..afef85d1aba 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/subcomponent/MultiPackageSubcomponents.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/subcomponent/MultiPackageSubcomponents.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.subcomponent; import dagger.Component; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/subcomponent/SubcomponentsWithBoundExecutor.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/subcomponent/SubcomponentsWithBoundExecutor.java index 4d35df32f6f..bbd418a580e 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/subcomponent/SubcomponentsWithBoundExecutor.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/subcomponent/SubcomponentsWithBoundExecutor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.subcomponent; import com.google.common.util.concurrent.ListenableFuture; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/subcomponent/sub/ChildComponent.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/subcomponent/sub/ChildComponent.java index 02e40b76cc5..c49e1c08a9a 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/subcomponent/sub/ChildComponent.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/subcomponent/sub/ChildComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.subcomponent.sub; import com.google.common.util.concurrent.ListenableFuture; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/subcomponent/sub/ChildModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/subcomponent/sub/ChildModule.java index 03879703390..c8d730f75c9 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/subcomponent/sub/ChildModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/subcomponent/sub/ChildModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.subcomponent.sub; import dagger.producers.ProducerModule; diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/DependentTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/DependentTest.java index 878541912cf..a3bcf01974f 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/DependentTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/DependentTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest; import com.google.common.util.concurrent.Futures; diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/ProducerFactoryTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/ProducerFactoryTest.java index a96f7567619..125737b108e 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/ProducerFactoryTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/ProducerFactoryTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest; import com.google.common.util.concurrent.ListenableFuture; diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/SimpleTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/SimpleTest.java index cc82034cb8f..1e0d82ea39e 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/SimpleTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/SimpleTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest; import org.junit.Test; diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/binds/BindsProducersTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/binds/BindsProducersTest.java index 73ad4d03378..cde5824e198 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/binds/BindsProducersTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/binds/BindsProducersTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.binds; import com.google.common.collect.ImmutableMap; diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/builder/ProductionComponentBuilderTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/builder/ProductionComponentBuilderTest.java index 94018d1c148..e57e4d19f79 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/builder/ProductionComponentBuilderTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/builder/ProductionComponentBuilderTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.builder; import com.google.common.util.concurrent.Futures; diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/monitoring/MonitoringTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/monitoring/MonitoringTest.java index fd899e8c11c..1b94df479a1 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/monitoring/MonitoringTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/monitoring/MonitoringTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.monitoring; import com.google.common.base.Throwables; diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/multibindings/MultibindingTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/multibindings/MultibindingTest.java index 5a3917d6309..668b3507ada 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/multibindings/MultibindingTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/multibindings/MultibindingTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.multibindings; import com.google.common.collect.Iterables; diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/provisions/ProvisionsTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/provisions/ProvisionsTest.java index e627af0181f..7e1e4a11965 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/provisions/ProvisionsTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/provisions/ProvisionsTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.provisions; import org.junit.Test; diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/scope/ScopeTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/scope/ScopeTest.java index 9302038dd3c..436c4587a00 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/scope/ScopeTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/scope/ScopeTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.scope; import org.junit.Test; diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/subcomponent/MultiPackageSubcomponentTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/subcomponent/MultiPackageSubcomponentTest.java index 1e681e565e4..3902a5477f7 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/subcomponent/MultiPackageSubcomponentTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/subcomponent/MultiPackageSubcomponentTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.subcomponent; import static com.google.common.truth.Truth.assertThat; diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/subcomponent/SubcomponentWithBoundExecutorTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/subcomponent/SubcomponentWithBoundExecutorTest.java index 527414ac1a7..2bd0ca49e60 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/subcomponent/SubcomponentWithBoundExecutorTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/subcomponent/SubcomponentWithBoundExecutorTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package producerstest.subcomponent; import java.util.concurrent.atomic.AtomicInteger; diff --git a/compiler/src/it/tck/src/main/java/test/tck/CarModule.java b/compiler/src/it/tck/src/main/java/test/tck/CarModule.java index 7961522de60..5eda77c7858 100644 --- a/compiler/src/it/tck/src/main/java/test/tck/CarModule.java +++ b/compiler/src/it/tck/src/main/java/test/tck/CarModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.tck; import dagger.Binds; diff --git a/compiler/src/it/tck/src/main/java/test/tck/CarShop.java b/compiler/src/it/tck/src/main/java/test/tck/CarShop.java index 3f37289fc3d..c47c850246e 100644 --- a/compiler/src/it/tck/src/main/java/test/tck/CarShop.java +++ b/compiler/src/it/tck/src/main/java/test/tck/CarShop.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.tck; import dagger.Component; diff --git a/compiler/src/it/tck/src/main/java/test/tck/EngineModule.java b/compiler/src/it/tck/src/main/java/test/tck/EngineModule.java index e622e6a4c81..dd27dcb4062 100644 --- a/compiler/src/it/tck/src/main/java/test/tck/EngineModule.java +++ b/compiler/src/it/tck/src/main/java/test/tck/EngineModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.tck; import dagger.MembersInjector; diff --git a/compiler/src/it/tck/src/main/java/test/tck/FuelTankModule.java b/compiler/src/it/tck/src/main/java/test/tck/FuelTankModule.java index bd67d488aca..77f6a417231 100644 --- a/compiler/src/it/tck/src/main/java/test/tck/FuelTankModule.java +++ b/compiler/src/it/tck/src/main/java/test/tck/FuelTankModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.tck; import dagger.Module; diff --git a/compiler/src/it/tck/src/main/java/test/tck/SeatModule.java b/compiler/src/it/tck/src/main/java/test/tck/SeatModule.java index eae9dc41b9c..fecb278a479 100644 --- a/compiler/src/it/tck/src/main/java/test/tck/SeatModule.java +++ b/compiler/src/it/tck/src/main/java/test/tck/SeatModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.tck; import dagger.Binds; diff --git a/compiler/src/it/tck/src/main/java/test/tck/TireModule.java b/compiler/src/it/tck/src/main/java/test/tck/TireModule.java index 7323a668204..66e63346251 100644 --- a/compiler/src/it/tck/src/main/java/test/tck/TireModule.java +++ b/compiler/src/it/tck/src/main/java/test/tck/TireModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.tck; import dagger.Binds; diff --git a/compiler/src/it/tck/src/test/java/test/tck/TckTest.java b/compiler/src/it/tck/src/test/java/test/tck/TckTest.java index 1d9b709c877..e6d6301a064 100644 --- a/compiler/src/it/tck/src/test/java/test/tck/TckTest.java +++ b/compiler/src/it/tck/src/test/java/test/tck/TckTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package test.tck; import junit.framework.Test; diff --git a/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java b/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java index d9d48b6e4d5..a9b75fde189 100644 --- a/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java +++ b/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/Accessibility.java b/compiler/src/main/java/dagger/internal/codegen/Accessibility.java index 3196ebe4d5b..4ea67b9e9d4 100644 --- a/compiler/src/main/java/dagger/internal/codegen/Accessibility.java +++ b/compiler/src/main/java/dagger/internal/codegen/Accessibility.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/AnnotationSpecs.java b/compiler/src/main/java/dagger/internal/codegen/AnnotationSpecs.java index 45570f4acaf..1b8a1f15140 100644 --- a/compiler/src/main/java/dagger/internal/codegen/AnnotationSpecs.java +++ b/compiler/src/main/java/dagger/internal/codegen/AnnotationSpecs.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.squareup.javapoet.AnnotationSpec; diff --git a/compiler/src/main/java/dagger/internal/codegen/Binding.java b/compiler/src/main/java/dagger/internal/codegen/Binding.java index 453fec041fa..dcbf7219265 100644 --- a/compiler/src/main/java/dagger/internal/codegen/Binding.java +++ b/compiler/src/main/java/dagger/internal/codegen/Binding.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java b/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java index f71c83287bf..3d5dc81fea3 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Function; diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java b/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java index 22188182192..64beaa74565 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java b/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java index b77283674d6..7c06d0f8741 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreTypes; diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java b/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java index 3e8c642a45c..f6be78d24db 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingKey.java b/compiler/src/main/java/dagger/internal/codegen/BindingKey.java index bbdadbbc9b5..59e1d1aea91 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingKey.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingKey.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.value.AutoValue; diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingMethodValidator.java b/compiler/src/main/java/dagger/internal/codegen/BindingMethodValidator.java index b0bfed5fa32..cc3fad5a799 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingMethodValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingMethodValidator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Function; diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingType.java b/compiler/src/main/java/dagger/internal/codegen/BindingType.java index fea14a8d42e..a2a6dcdb8e3 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingType.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingType.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Function; diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingVariableNamer.java b/compiler/src/main/java/dagger/internal/codegen/BindingVariableNamer.java index 76ea08f3dc0..be55b467b71 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingVariableNamer.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingVariableNamer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import java.util.Iterator; diff --git a/compiler/src/main/java/dagger/internal/codegen/BindsMethodValidator.java b/compiler/src/main/java/dagger/internal/codegen/BindsMethodValidator.java index 80adfdbff1b..e7564ee3c80 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindsMethodValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindsMethodValidator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/BuilderValidator.java b/compiler/src/main/java/dagger/internal/codegen/BuilderValidator.java index 7db5eb3d6f2..17e4074e702 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BuilderValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/BuilderValidator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreTypes; diff --git a/compiler/src/main/java/dagger/internal/codegen/CodeBlocks.java b/compiler/src/main/java/dagger/internal/codegen/CodeBlocks.java index 1b8c9c94be2..d5f4880c5e7 100644 --- a/compiler/src/main/java/dagger/internal/codegen/CodeBlocks.java +++ b/compiler/src/main/java/dagger/internal/codegen/CodeBlocks.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Function; diff --git a/compiler/src/main/java/dagger/internal/codegen/CompilerOptions.java b/compiler/src/main/java/dagger/internal/codegen/CompilerOptions.java index dbe1a9917fa..f7e9b213234 100644 --- a/compiler/src/main/java/dagger/internal/codegen/CompilerOptions.java +++ b/compiler/src/main/java/dagger/internal/codegen/CompilerOptions.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.value.AutoValue; diff --git a/compiler/src/main/java/dagger/internal/codegen/ComponentDescriptor.java b/compiler/src/main/java/dagger/internal/codegen/ComponentDescriptor.java index 5e66cfd4d17..51604fbe129 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ComponentDescriptor.java +++ b/compiler/src/main/java/dagger/internal/codegen/ComponentDescriptor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/ComponentGenerator.java b/compiler/src/main/java/dagger/internal/codegen/ComponentGenerator.java index 00d514331d2..980f8e36aa2 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ComponentGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/ComponentGenerator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Joiner; diff --git a/compiler/src/main/java/dagger/internal/codegen/ComponentHierarchyValidator.java b/compiler/src/main/java/dagger/internal/codegen/ComponentHierarchyValidator.java index 8301d75fe16..c9d10f332ba 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ComponentHierarchyValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/ComponentHierarchyValidator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreTypes; diff --git a/compiler/src/main/java/dagger/internal/codegen/ComponentProcessingStep.java b/compiler/src/main/java/dagger/internal/codegen/ComponentProcessingStep.java index 42febcf9815..851f2d6e47e 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ComponentProcessingStep.java +++ b/compiler/src/main/java/dagger/internal/codegen/ComponentProcessingStep.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.BasicAnnotationProcessor.ProcessingStep; diff --git a/compiler/src/main/java/dagger/internal/codegen/ComponentProcessor.java b/compiler/src/main/java/dagger/internal/codegen/ComponentProcessor.java index 242a9c01f7a..c0c5aa11d47 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ComponentProcessor.java +++ b/compiler/src/main/java/dagger/internal/codegen/ComponentProcessor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.BasicAnnotationProcessor; diff --git a/compiler/src/main/java/dagger/internal/codegen/ComponentValidator.java b/compiler/src/main/java/dagger/internal/codegen/ComponentValidator.java index 399f956aad5..56f5ea37d68 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ComponentValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/ComponentValidator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/ComponentWriter.java b/compiler/src/main/java/dagger/internal/codegen/ComponentWriter.java index e82a50bcbb5..3d0b43b4d35 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ComponentWriter.java +++ b/compiler/src/main/java/dagger/internal/codegen/ComponentWriter.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Function; diff --git a/compiler/src/main/java/dagger/internal/codegen/ConfigurationAnnotations.java b/compiler/src/main/java/dagger/internal/codegen/ConfigurationAnnotations.java index 4da27d26a1c..8774e471d6a 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ConfigurationAnnotations.java +++ b/compiler/src/main/java/dagger/internal/codegen/ConfigurationAnnotations.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java b/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java index 0da899abe89..c663e7f328c 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreTypes; diff --git a/compiler/src/main/java/dagger/internal/codegen/ContributionType.java b/compiler/src/main/java/dagger/internal/codegen/ContributionType.java index ef97a4301b1..ec45c6df2d2 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ContributionType.java +++ b/compiler/src/main/java/dagger/internal/codegen/ContributionType.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Function; diff --git a/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java b/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java index 77f8cfa0293..e9cfc78a113 100644 --- a/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java +++ b/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java b/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java index 7cbf73acfec..e8be0963763 100644 --- a/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java +++ b/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreTypes; diff --git a/compiler/src/main/java/dagger/internal/codegen/DependencyRequestFormatter.java b/compiler/src/main/java/dagger/internal/codegen/DependencyRequestFormatter.java index 2841909d30a..dec1df97544 100644 --- a/compiler/src/main/java/dagger/internal/codegen/DependencyRequestFormatter.java +++ b/compiler/src/main/java/dagger/internal/codegen/DependencyRequestFormatter.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/DependencyRequestMapper.java b/compiler/src/main/java/dagger/internal/codegen/DependencyRequestMapper.java index 559bc1c0a4b..e667e6d952a 100644 --- a/compiler/src/main/java/dagger/internal/codegen/DependencyRequestMapper.java +++ b/compiler/src/main/java/dagger/internal/codegen/DependencyRequestMapper.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Function; diff --git a/compiler/src/main/java/dagger/internal/codegen/DependencyVariableNamer.java b/compiler/src/main/java/dagger/internal/codegen/DependencyVariableNamer.java index ba633284ddc..f68cedf55ab 100644 --- a/compiler/src/main/java/dagger/internal/codegen/DependencyVariableNamer.java +++ b/compiler/src/main/java/dagger/internal/codegen/DependencyVariableNamer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Ascii; diff --git a/compiler/src/main/java/dagger/internal/codegen/ErrorMessages.java b/compiler/src/main/java/dagger/internal/codegen/ErrorMessages.java index 7b94f9c6181..66385681591 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ErrorMessages.java +++ b/compiler/src/main/java/dagger/internal/codegen/ErrorMessages.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreTypes; diff --git a/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java b/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java index 228fe3154f9..9f748b924ce 100644 --- a/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Optional; diff --git a/compiler/src/main/java/dagger/internal/codegen/FeatureStatus.java b/compiler/src/main/java/dagger/internal/codegen/FeatureStatus.java index 1bd99ea0ea2..9ff254e2ccf 100644 --- a/compiler/src/main/java/dagger/internal/codegen/FeatureStatus.java +++ b/compiler/src/main/java/dagger/internal/codegen/FeatureStatus.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; /** Allows options to control how features in component processing are enabled. */ diff --git a/compiler/src/main/java/dagger/internal/codegen/Formatter.java b/compiler/src/main/java/dagger/internal/codegen/Formatter.java index ac53e71df6a..9cd62d9bf20 100644 --- a/compiler/src/main/java/dagger/internal/codegen/Formatter.java +++ b/compiler/src/main/java/dagger/internal/codegen/Formatter.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Function; diff --git a/compiler/src/main/java/dagger/internal/codegen/FrameworkDependency.java b/compiler/src/main/java/dagger/internal/codegen/FrameworkDependency.java index c26940016e4..fd2c0fd20ac 100644 --- a/compiler/src/main/java/dagger/internal/codegen/FrameworkDependency.java +++ b/compiler/src/main/java/dagger/internal/codegen/FrameworkDependency.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.value.AutoValue; diff --git a/compiler/src/main/java/dagger/internal/codegen/FrameworkField.java b/compiler/src/main/java/dagger/internal/codegen/FrameworkField.java index f23ccf38fd1..3eff8ec54fe 100644 --- a/compiler/src/main/java/dagger/internal/codegen/FrameworkField.java +++ b/compiler/src/main/java/dagger/internal/codegen/FrameworkField.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.value.AutoValue; diff --git a/compiler/src/main/java/dagger/internal/codegen/FrameworkTypes.java b/compiler/src/main/java/dagger/internal/codegen/FrameworkTypes.java index f6b96352414..377735a15fe 100644 --- a/compiler/src/main/java/dagger/internal/codegen/FrameworkTypes.java +++ b/compiler/src/main/java/dagger/internal/codegen/FrameworkTypes.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreTypes; diff --git a/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java b/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java index 1e842224265..6fdd913b81f 100644 --- a/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java +++ b/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/InjectProcessingStep.java b/compiler/src/main/java/dagger/internal/codegen/InjectProcessingStep.java index 36f636767bb..7556a4527b7 100644 --- a/compiler/src/main/java/dagger/internal/codegen/InjectProcessingStep.java +++ b/compiler/src/main/java/dagger/internal/codegen/InjectProcessingStep.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.BasicAnnotationProcessor; diff --git a/compiler/src/main/java/dagger/internal/codegen/InjectValidator.java b/compiler/src/main/java/dagger/internal/codegen/InjectValidator.java index a3f3a141287..b3c4428ccb1 100644 --- a/compiler/src/main/java/dagger/internal/codegen/InjectValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/InjectValidator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/InjectionAnnotations.java b/compiler/src/main/java/dagger/internal/codegen/InjectionAnnotations.java index a01da280e45..13dd79e3e90 100644 --- a/compiler/src/main/java/dagger/internal/codegen/InjectionAnnotations.java +++ b/compiler/src/main/java/dagger/internal/codegen/InjectionAnnotations.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.AnnotationMirrors; diff --git a/compiler/src/main/java/dagger/internal/codegen/KeyFormatter.java b/compiler/src/main/java/dagger/internal/codegen/KeyFormatter.java index a2f5b3934c3..b14869fafaa 100644 --- a/compiler/src/main/java/dagger/internal/codegen/KeyFormatter.java +++ b/compiler/src/main/java/dagger/internal/codegen/KeyFormatter.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; /** diff --git a/compiler/src/main/java/dagger/internal/codegen/MapKeyGenerator.java b/compiler/src/main/java/dagger/internal/codegen/MapKeyGenerator.java index 7843bb5e54c..5ff269b5a21 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MapKeyGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/MapKeyGenerator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreTypes; diff --git a/compiler/src/main/java/dagger/internal/codegen/MapKeyProcessingStep.java b/compiler/src/main/java/dagger/internal/codegen/MapKeyProcessingStep.java index 3bf6267f4aa..8eaceac993f 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MapKeyProcessingStep.java +++ b/compiler/src/main/java/dagger/internal/codegen/MapKeyProcessingStep.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.BasicAnnotationProcessor; diff --git a/compiler/src/main/java/dagger/internal/codegen/MapKeyValidator.java b/compiler/src/main/java/dagger/internal/codegen/MapKeyValidator.java index 2a924820d43..4b2b19f8aec 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MapKeyValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/MapKeyValidator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import dagger.MapKey; diff --git a/compiler/src/main/java/dagger/internal/codegen/MapKeys.java b/compiler/src/main/java/dagger/internal/codegen/MapKeys.java index c9fcd67226a..e24f7ab56db 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MapKeys.java +++ b/compiler/src/main/java/dagger/internal/codegen/MapKeys.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreTypes; diff --git a/compiler/src/main/java/dagger/internal/codegen/MapType.java b/compiler/src/main/java/dagger/internal/codegen/MapType.java index f1a00c77f3a..6c38c244235 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MapType.java +++ b/compiler/src/main/java/dagger/internal/codegen/MapType.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreTypes; diff --git a/compiler/src/main/java/dagger/internal/codegen/MemberSelect.java b/compiler/src/main/java/dagger/internal/codegen/MemberSelect.java index a6da94fb985..546af2fee40 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MemberSelect.java +++ b/compiler/src/main/java/dagger/internal/codegen/MemberSelect.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.ImmutableList; diff --git a/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java b/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java index a3d3bbae2d4..070f2c80b7b 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/MembersInjectorGenerator.java b/compiler/src/main/java/dagger/internal/codegen/MembersInjectorGenerator.java index c261ab96e47..d5a40628c60 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MembersInjectorGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/MembersInjectorGenerator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/MethodSignatureFormatter.java b/compiler/src/main/java/dagger/internal/codegen/MethodSignatureFormatter.java index ef6e04aac3d..8586314a21c 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MethodSignatureFormatter.java +++ b/compiler/src/main/java/dagger/internal/codegen/MethodSignatureFormatter.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/MissingBindingSuggestions.java b/compiler/src/main/java/dagger/internal/codegen/MissingBindingSuggestions.java index 5f6179b6e62..3841548099c 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MissingBindingSuggestions.java +++ b/compiler/src/main/java/dagger/internal/codegen/MissingBindingSuggestions.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.ImmutableList; diff --git a/compiler/src/main/java/dagger/internal/codegen/ModuleDescriptor.java b/compiler/src/main/java/dagger/internal/codegen/ModuleDescriptor.java index f922c06f368..27f769e687e 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ModuleDescriptor.java +++ b/compiler/src/main/java/dagger/internal/codegen/ModuleDescriptor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/ModuleProcessingStep.java b/compiler/src/main/java/dagger/internal/codegen/ModuleProcessingStep.java index 1db210797a1..9a03b976e5c 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ModuleProcessingStep.java +++ b/compiler/src/main/java/dagger/internal/codegen/ModuleProcessingStep.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.BasicAnnotationProcessor.ProcessingStep; diff --git a/compiler/src/main/java/dagger/internal/codegen/ModuleValidator.java b/compiler/src/main/java/dagger/internal/codegen/ModuleValidator.java index b746b0da8e7..e9845c215d7 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ModuleValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/ModuleValidator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/MonitoringModuleGenerator.java b/compiler/src/main/java/dagger/internal/codegen/MonitoringModuleGenerator.java index 3a54fae6ee1..1ead2435068 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MonitoringModuleGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/MonitoringModuleGenerator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Optional; diff --git a/compiler/src/main/java/dagger/internal/codegen/MonitoringModuleProcessingStep.java b/compiler/src/main/java/dagger/internal/codegen/MonitoringModuleProcessingStep.java index 4aa42c292de..03e229ddba2 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MonitoringModuleProcessingStep.java +++ b/compiler/src/main/java/dagger/internal/codegen/MonitoringModuleProcessingStep.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.BasicAnnotationProcessor.ProcessingStep; diff --git a/compiler/src/main/java/dagger/internal/codegen/MoreAnnotationMirrors.java b/compiler/src/main/java/dagger/internal/codegen/MoreAnnotationMirrors.java index 427661ffa5b..ce211e687c5 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MoreAnnotationMirrors.java +++ b/compiler/src/main/java/dagger/internal/codegen/MoreAnnotationMirrors.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.AnnotationMirrors; diff --git a/compiler/src/main/java/dagger/internal/codegen/MultibindingAnnotations.java b/compiler/src/main/java/dagger/internal/codegen/MultibindingAnnotations.java index f43a08a8572..4fb49f52ffd 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MultibindingAnnotations.java +++ b/compiler/src/main/java/dagger/internal/codegen/MultibindingAnnotations.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.ImmutableSet; diff --git a/compiler/src/main/java/dagger/internal/codegen/MultibindingAnnotationsProcessingStep.java b/compiler/src/main/java/dagger/internal/codegen/MultibindingAnnotationsProcessingStep.java index b303776a8c1..f36d01c3f81 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MultibindingAnnotationsProcessingStep.java +++ b/compiler/src/main/java/dagger/internal/codegen/MultibindingAnnotationsProcessingStep.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.BasicAnnotationProcessor.ProcessingStep; diff --git a/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java b/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java index 5a3ae304d9c..072cd4db927 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java +++ b/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreTypes; diff --git a/compiler/src/main/java/dagger/internal/codegen/MultibindingsMethodValidator.java b/compiler/src/main/java/dagger/internal/codegen/MultibindingsMethodValidator.java index f9bd9ef83af..fed327ff122 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MultibindingsMethodValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/MultibindingsMethodValidator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.ImmutableSet; diff --git a/compiler/src/main/java/dagger/internal/codegen/MultibindingsProcessingStep.java b/compiler/src/main/java/dagger/internal/codegen/MultibindingsProcessingStep.java index 0ddf9679839..7108de52de5 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MultibindingsProcessingStep.java +++ b/compiler/src/main/java/dagger/internal/codegen/MultibindingsProcessingStep.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.BasicAnnotationProcessor.ProcessingStep; diff --git a/compiler/src/main/java/dagger/internal/codegen/MultibindingsValidator.java b/compiler/src/main/java/dagger/internal/codegen/MultibindingsValidator.java index 043b4fff745..22fd7e2061a 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MultibindingsValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/MultibindingsValidator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Optional; diff --git a/compiler/src/main/java/dagger/internal/codegen/MultibindsMethodValidator.java b/compiler/src/main/java/dagger/internal/codegen/MultibindsMethodValidator.java index b1e5a3b10c5..ec99ec4f7fc 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MultibindsMethodValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/MultibindsMethodValidator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreTypes; diff --git a/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java b/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java index 2b7023d83f6..93616f5397a 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Function; diff --git a/compiler/src/main/java/dagger/internal/codegen/ProducesMethodValidator.java b/compiler/src/main/java/dagger/internal/codegen/ProducesMethodValidator.java index ee2dcd82a22..49469174eee 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProducesMethodValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProducesMethodValidator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreTypes; diff --git a/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java b/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java index f27f6bef9b3..c3c7a04c87e 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreTypes; diff --git a/compiler/src/main/java/dagger/internal/codegen/ProductionExecutorModuleGenerator.java b/compiler/src/main/java/dagger/internal/codegen/ProductionExecutorModuleGenerator.java index defd5119079..b5559757080 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProductionExecutorModuleGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProductionExecutorModuleGenerator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Optional; diff --git a/compiler/src/main/java/dagger/internal/codegen/ProductionExecutorModuleProcessingStep.java b/compiler/src/main/java/dagger/internal/codegen/ProductionExecutorModuleProcessingStep.java index 78e60a35242..3b57223787b 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProductionExecutorModuleProcessingStep.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProductionExecutorModuleProcessingStep.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.BasicAnnotationProcessor.ProcessingStep; diff --git a/compiler/src/main/java/dagger/internal/codegen/ProvidesMethodValidator.java b/compiler/src/main/java/dagger/internal/codegen/ProvidesMethodValidator.java index ea29b9f5ff9..68959d19046 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProvidesMethodValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProvidesMethodValidator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.ImmutableSet; diff --git a/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java b/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java index 532778e0cf1..4be7bec5795 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java b/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java index 76ff8a72cc6..d48a2447f02 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java +++ b/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.value.AutoValue; diff --git a/compiler/src/main/java/dagger/internal/codegen/Scope.java b/compiler/src/main/java/dagger/internal/codegen/Scope.java index 737d9df2138..361729821cc 100644 --- a/compiler/src/main/java/dagger/internal/codegen/Scope.java +++ b/compiler/src/main/java/dagger/internal/codegen/Scope.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.AnnotationMirrors; diff --git a/compiler/src/main/java/dagger/internal/codegen/SetType.java b/compiler/src/main/java/dagger/internal/codegen/SetType.java index 4cbda04b220..9407933c63d 100644 --- a/compiler/src/main/java/dagger/internal/codegen/SetType.java +++ b/compiler/src/main/java/dagger/internal/codegen/SetType.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreTypes; diff --git a/compiler/src/main/java/dagger/internal/codegen/SimpleAnnotationMirror.java b/compiler/src/main/java/dagger/internal/codegen/SimpleAnnotationMirror.java index 1b445b303ac..c381f4732dd 100644 --- a/compiler/src/main/java/dagger/internal/codegen/SimpleAnnotationMirror.java +++ b/compiler/src/main/java/dagger/internal/codegen/SimpleAnnotationMirror.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreTypes; diff --git a/compiler/src/main/java/dagger/internal/codegen/SimpleTypeAnnotationValue.java b/compiler/src/main/java/dagger/internal/codegen/SimpleTypeAnnotationValue.java index fee4790746d..7f043db02db 100644 --- a/compiler/src/main/java/dagger/internal/codegen/SimpleTypeAnnotationValue.java +++ b/compiler/src/main/java/dagger/internal/codegen/SimpleTypeAnnotationValue.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import javax.lang.model.element.AnnotationValue; diff --git a/compiler/src/main/java/dagger/internal/codegen/SourceFileGenerationException.java b/compiler/src/main/java/dagger/internal/codegen/SourceFileGenerationException.java index 321d96f47d0..202440a9069 100644 --- a/compiler/src/main/java/dagger/internal/codegen/SourceFileGenerationException.java +++ b/compiler/src/main/java/dagger/internal/codegen/SourceFileGenerationException.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Optional; diff --git a/compiler/src/main/java/dagger/internal/codegen/SourceFileGenerator.java b/compiler/src/main/java/dagger/internal/codegen/SourceFileGenerator.java index bc5ed68fce1..3494bfa10bd 100644 --- a/compiler/src/main/java/dagger/internal/codegen/SourceFileGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/SourceFileGenerator.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Optional; diff --git a/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java b/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java index 8fda68942ea..78b18dcd610 100644 --- a/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java +++ b/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java @@ -11,6 +11,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ + package dagger.internal.codegen; import com.google.common.base.CaseFormat; diff --git a/compiler/src/main/java/dagger/internal/codegen/SubcomponentWriter.java b/compiler/src/main/java/dagger/internal/codegen/SubcomponentWriter.java index b69844bf608..ba223603546 100644 --- a/compiler/src/main/java/dagger/internal/codegen/SubcomponentWriter.java +++ b/compiler/src/main/java/dagger/internal/codegen/SubcomponentWriter.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreTypes; diff --git a/compiler/src/main/java/dagger/internal/codegen/TypeSpecs.java b/compiler/src/main/java/dagger/internal/codegen/TypeSpecs.java index 32d574c6ab5..3adcde1ad6d 100644 --- a/compiler/src/main/java/dagger/internal/codegen/TypeSpecs.java +++ b/compiler/src/main/java/dagger/internal/codegen/TypeSpecs.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.squareup.javapoet.ClassName; diff --git a/compiler/src/main/java/dagger/internal/codegen/UniqueNameSet.java b/compiler/src/main/java/dagger/internal/codegen/UniqueNameSet.java index 9e1cd875f9a..27a275ceb6d 100644 --- a/compiler/src/main/java/dagger/internal/codegen/UniqueNameSet.java +++ b/compiler/src/main/java/dagger/internal/codegen/UniqueNameSet.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import java.util.HashSet; diff --git a/compiler/src/main/java/dagger/internal/codegen/Util.java b/compiler/src/main/java/dagger/internal/codegen/Util.java index af755e6823d..44e6a99575e 100644 --- a/compiler/src/main/java/dagger/internal/codegen/Util.java +++ b/compiler/src/main/java/dagger/internal/codegen/Util.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/main/java/dagger/internal/codegen/ValidationReport.java b/compiler/src/main/java/dagger/internal/codegen/ValidationReport.java index 9a1802f25a9..67885e72794 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ValidationReport.java +++ b/compiler/src/main/java/dagger/internal/codegen/ValidationReport.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.value.AutoValue; diff --git a/compiler/src/main/java/dagger/internal/codegen/ValidationType.java b/compiler/src/main/java/dagger/internal/codegen/ValidationType.java index 764b7f6ef26..e242db08f91 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ValidationType.java +++ b/compiler/src/main/java/dagger/internal/codegen/ValidationType.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Optional; diff --git a/compiler/src/test/java/dagger/internal/codegen/AccessibilityTest.java b/compiler/src/test/java/dagger/internal/codegen/AccessibilityTest.java index 8b3ddc31625..394d1a31610 100644 --- a/compiler/src/test/java/dagger/internal/codegen/AccessibilityTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/AccessibilityTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.testing.compile.CompilationRule; diff --git a/compiler/src/test/java/dagger/internal/codegen/BindsMethodValidatorTest.java b/compiler/src/test/java/dagger/internal/codegen/BindsMethodValidatorTest.java index b4e1da15e4e..8f9868d0ae8 100644 --- a/compiler/src/test/java/dagger/internal/codegen/BindsMethodValidatorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/BindsMethodValidatorTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.ImmutableList; diff --git a/compiler/src/test/java/dagger/internal/codegen/ComponentBuilderTest.java b/compiler/src/test/java/dagger/internal/codegen/ComponentBuilderTest.java index 1a635151c2b..19be954d51e 100644 --- a/compiler/src/test/java/dagger/internal/codegen/ComponentBuilderTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/ComponentBuilderTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.ImmutableList; diff --git a/compiler/src/test/java/dagger/internal/codegen/ComponentProcessorTest.java b/compiler/src/test/java/dagger/internal/codegen/ComponentProcessorTest.java index 5d6ba06eb23..70609b63526 100644 --- a/compiler/src/test/java/dagger/internal/codegen/ComponentProcessorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/ComponentProcessorTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreElements; diff --git a/compiler/src/test/java/dagger/internal/codegen/DaggerModuleMethodSubject.java b/compiler/src/test/java/dagger/internal/codegen/DaggerModuleMethodSubject.java index 036cba84b19..2ca0906ac85 100644 --- a/compiler/src/test/java/dagger/internal/codegen/DaggerModuleMethodSubject.java +++ b/compiler/src/test/java/dagger/internal/codegen/DaggerModuleMethodSubject.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Function; diff --git a/compiler/src/test/java/dagger/internal/codegen/DependencyRequestMapperTest.java b/compiler/src/test/java/dagger/internal/codegen/DependencyRequestMapperTest.java index 16be2e9cf21..d75ca88eae2 100644 --- a/compiler/src/test/java/dagger/internal/codegen/DependencyRequestMapperTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/DependencyRequestMapperTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.Iterables; diff --git a/compiler/src/test/java/dagger/internal/codegen/ErrorMessagesTest.java b/compiler/src/test/java/dagger/internal/codegen/ErrorMessagesTest.java index 987f29cf7af..6aafc3550d2 100644 --- a/compiler/src/test/java/dagger/internal/codegen/ErrorMessagesTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/ErrorMessagesTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import org.junit.Test; diff --git a/compiler/src/test/java/dagger/internal/codegen/FrameworkFieldTest.java b/compiler/src/test/java/dagger/internal/codegen/FrameworkFieldTest.java index ab17256ec31..072a6c3480e 100644 --- a/compiler/src/test/java/dagger/internal/codegen/FrameworkFieldTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/FrameworkFieldTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.testing.compile.CompilationRule; diff --git a/compiler/src/test/java/dagger/internal/codegen/GeneratedLines.java b/compiler/src/test/java/dagger/internal/codegen/GeneratedLines.java index cc77a2bc4ea..4a6f2f47744 100644 --- a/compiler/src/test/java/dagger/internal/codegen/GeneratedLines.java +++ b/compiler/src/test/java/dagger/internal/codegen/GeneratedLines.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; /** diff --git a/compiler/src/test/java/dagger/internal/codegen/GraphValidationScopingTest.java b/compiler/src/test/java/dagger/internal/codegen/GraphValidationScopingTest.java index 74c0545a14b..4705304705e 100644 --- a/compiler/src/test/java/dagger/internal/codegen/GraphValidationScopingTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/GraphValidationScopingTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.testing.compile.JavaFileObjects; diff --git a/compiler/src/test/java/dagger/internal/codegen/GraphValidationTest.java b/compiler/src/test/java/dagger/internal/codegen/GraphValidationTest.java index ed561200c95..9209c711d15 100644 --- a/compiler/src/test/java/dagger/internal/codegen/GraphValidationTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/GraphValidationTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Joiner; diff --git a/compiler/src/test/java/dagger/internal/codegen/InaccessibleTypeTest.java b/compiler/src/test/java/dagger/internal/codegen/InaccessibleTypeTest.java index ec770e9e80d..4008630de74 100644 --- a/compiler/src/test/java/dagger/internal/codegen/InaccessibleTypeTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/InaccessibleTypeTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.ImmutableList; diff --git a/compiler/src/test/java/dagger/internal/codegen/InjectConstructorFactoryGeneratorTest.java b/compiler/src/test/java/dagger/internal/codegen/InjectConstructorFactoryGeneratorTest.java index b137f1d9ec2..1f319954e2c 100644 --- a/compiler/src/test/java/dagger/internal/codegen/InjectConstructorFactoryGeneratorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/InjectConstructorFactoryGeneratorTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.ImmutableList; diff --git a/compiler/src/test/java/dagger/internal/codegen/KeyTest.java b/compiler/src/test/java/dagger/internal/codegen/KeyTest.java index 755681cf11f..50d1c18efc3 100644 --- a/compiler/src/test/java/dagger/internal/codegen/KeyTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/KeyTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.common.MoreTypes; diff --git a/compiler/src/test/java/dagger/internal/codegen/MapBindingComponentProcessorTest.java b/compiler/src/test/java/dagger/internal/codegen/MapBindingComponentProcessorTest.java index 00f39a276a8..4b3ad45275d 100644 --- a/compiler/src/test/java/dagger/internal/codegen/MapBindingComponentProcessorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/MapBindingComponentProcessorTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.value.processor.AutoAnnotationProcessor; diff --git a/compiler/src/test/java/dagger/internal/codegen/MapKeyProcessorTest.java b/compiler/src/test/java/dagger/internal/codegen/MapKeyProcessorTest.java index fbb612dfe1f..98e3d67f817 100644 --- a/compiler/src/test/java/dagger/internal/codegen/MapKeyProcessorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/MapKeyProcessorTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.auto.value.processor.AutoAnnotationProcessor; diff --git a/compiler/src/test/java/dagger/internal/codegen/MembersInjectionTest.java b/compiler/src/test/java/dagger/internal/codegen/MembersInjectionTest.java index 0bc94e7fe5c..9f58ec0f6e8 100644 --- a/compiler/src/test/java/dagger/internal/codegen/MembersInjectionTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/MembersInjectionTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.base.Joiner; diff --git a/compiler/src/test/java/dagger/internal/codegen/MethodSignatureFormatterTest.java b/compiler/src/test/java/dagger/internal/codegen/MethodSignatureFormatterTest.java index b8213c4e1b6..0b09e359259 100644 --- a/compiler/src/test/java/dagger/internal/codegen/MethodSignatureFormatterTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/MethodSignatureFormatterTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.ImmutableList; diff --git a/compiler/src/test/java/dagger/internal/codegen/MissingBindingSuggestionsTest.java b/compiler/src/test/java/dagger/internal/codegen/MissingBindingSuggestionsTest.java index 7779b2ede1c..136dd84a492 100644 --- a/compiler/src/test/java/dagger/internal/codegen/MissingBindingSuggestionsTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/MissingBindingSuggestionsTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.ImmutableList; diff --git a/compiler/src/test/java/dagger/internal/codegen/ModuleFactoryGeneratorTest.java b/compiler/src/test/java/dagger/internal/codegen/ModuleFactoryGeneratorTest.java index 949bb8fa3ee..f4796d6ff0c 100644 --- a/compiler/src/test/java/dagger/internal/codegen/ModuleFactoryGeneratorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/ModuleFactoryGeneratorTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.ImmutableList; diff --git a/compiler/src/test/java/dagger/internal/codegen/MultibindingTest.java b/compiler/src/test/java/dagger/internal/codegen/MultibindingTest.java index 04ba0bb22f2..6e53ce1e3fc 100644 --- a/compiler/src/test/java/dagger/internal/codegen/MultibindingTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/MultibindingTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.testing.compile.JavaFileObjects; diff --git a/compiler/src/test/java/dagger/internal/codegen/MultibindingsValidatorTest.java b/compiler/src/test/java/dagger/internal/codegen/MultibindingsValidatorTest.java index 1d80e3fe1d7..6eb55a1b656 100644 --- a/compiler/src/test/java/dagger/internal/codegen/MultibindingsValidatorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/MultibindingsValidatorTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.testing.compile.JavaFileObjects; diff --git a/compiler/src/test/java/dagger/internal/codegen/MultibindsValidatorTest.java b/compiler/src/test/java/dagger/internal/codegen/MultibindsValidatorTest.java index 5c756f60a66..286b6cf2084 100644 --- a/compiler/src/test/java/dagger/internal/codegen/MultibindsValidatorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/MultibindsValidatorTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.ImmutableList; diff --git a/compiler/src/test/java/dagger/internal/codegen/MultipleRequestTest.java b/compiler/src/test/java/dagger/internal/codegen/MultipleRequestTest.java index 7ef24f81e63..0434efc06ef 100644 --- a/compiler/src/test/java/dagger/internal/codegen/MultipleRequestTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/MultipleRequestTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.ImmutableList; diff --git a/compiler/src/test/java/dagger/internal/codegen/ProductionComponentProcessorTest.java b/compiler/src/test/java/dagger/internal/codegen/ProductionComponentProcessorTest.java index 1749f4135bf..0edfc797e6c 100644 --- a/compiler/src/test/java/dagger/internal/codegen/ProductionComponentProcessorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/ProductionComponentProcessorTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.ImmutableList; diff --git a/compiler/src/test/java/dagger/internal/codegen/ProductionGraphValidationTest.java b/compiler/src/test/java/dagger/internal/codegen/ProductionGraphValidationTest.java index baf2d8f3266..600ed909074 100644 --- a/compiler/src/test/java/dagger/internal/codegen/ProductionGraphValidationTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/ProductionGraphValidationTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.ImmutableList; diff --git a/compiler/src/test/java/dagger/internal/codegen/SubcomponentBuilderValidationTest.java b/compiler/src/test/java/dagger/internal/codegen/SubcomponentBuilderValidationTest.java index 379828b4c0d..31fe74c3ec3 100644 --- a/compiler/src/test/java/dagger/internal/codegen/SubcomponentBuilderValidationTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/SubcomponentBuilderValidationTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.ImmutableList; diff --git a/compiler/src/test/java/dagger/internal/codegen/SubcomponentValidationTest.java b/compiler/src/test/java/dagger/internal/codegen/SubcomponentValidationTest.java index c4d2c982b8d..49e950849d0 100644 --- a/compiler/src/test/java/dagger/internal/codegen/SubcomponentValidationTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/SubcomponentValidationTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.ImmutableList; diff --git a/compiler/src/test/java/dagger/internal/codegen/ValidationReportTest.java b/compiler/src/test/java/dagger/internal/codegen/ValidationReportTest.java index eb44346eb54..67c63eb4a21 100644 --- a/compiler/src/test/java/dagger/internal/codegen/ValidationReportTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/ValidationReportTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal.codegen; import com.google.common.collect.ImmutableSet; diff --git a/compiler/src/test/java/dagger/tests/integration/operation/PrimitiveInjectionTest.java b/compiler/src/test/java/dagger/tests/integration/operation/PrimitiveInjectionTest.java index 6d76f4be754..ee5dd2b1487 100644 --- a/compiler/src/test/java/dagger/tests/integration/operation/PrimitiveInjectionTest.java +++ b/compiler/src/test/java/dagger/tests/integration/operation/PrimitiveInjectionTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.tests.integration.operation; import com.google.testing.compile.JavaFileObjects; diff --git a/core/src/main/java/dagger/Binds.java b/core/src/main/java/dagger/Binds.java index 5b076796fe9..c61a81fbfe2 100644 --- a/core/src/main/java/dagger/Binds.java +++ b/core/src/main/java/dagger/Binds.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger; import java.lang.annotation.Documented; diff --git a/core/src/main/java/dagger/Component.java b/core/src/main/java/dagger/Component.java index c82edbb9728..26730ce74db 100644 --- a/core/src/main/java/dagger/Component.java +++ b/core/src/main/java/dagger/Component.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger; import java.lang.annotation.Documented; diff --git a/core/src/main/java/dagger/Lazy.java b/core/src/main/java/dagger/Lazy.java index 00df9f48019..a5ad92e9892 100644 --- a/core/src/main/java/dagger/Lazy.java +++ b/core/src/main/java/dagger/Lazy.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger; /** diff --git a/core/src/main/java/dagger/MapKey.java b/core/src/main/java/dagger/MapKey.java index 77a2b0f9e14..33d12d348e6 100644 --- a/core/src/main/java/dagger/MapKey.java +++ b/core/src/main/java/dagger/MapKey.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger; import dagger.internal.Beta; diff --git a/core/src/main/java/dagger/MembersInjector.java b/core/src/main/java/dagger/MembersInjector.java index a9c3cdc6f97..510f476a9b7 100644 --- a/core/src/main/java/dagger/MembersInjector.java +++ b/core/src/main/java/dagger/MembersInjector.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger; /** diff --git a/core/src/main/java/dagger/Module.java b/core/src/main/java/dagger/Module.java index e29dcd4c854..0ebf9b9415a 100644 --- a/core/src/main/java/dagger/Module.java +++ b/core/src/main/java/dagger/Module.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger; import java.lang.annotation.ElementType; diff --git a/core/src/main/java/dagger/Multibindings.java b/core/src/main/java/dagger/Multibindings.java index 73e2f5c4833..ecf38535817 100644 --- a/core/src/main/java/dagger/Multibindings.java +++ b/core/src/main/java/dagger/Multibindings.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger; import dagger.internal.Beta; diff --git a/core/src/main/java/dagger/Provides.java b/core/src/main/java/dagger/Provides.java index d29cdc09b63..f46249fbb45 100644 --- a/core/src/main/java/dagger/Provides.java +++ b/core/src/main/java/dagger/Provides.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger; import dagger.internal.Beta; diff --git a/core/src/main/java/dagger/Reusable.java b/core/src/main/java/dagger/Reusable.java index 1347b4dc91c..80bc90546a4 100644 --- a/core/src/main/java/dagger/Reusable.java +++ b/core/src/main/java/dagger/Reusable.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger; import dagger.internal.Beta; diff --git a/core/src/main/java/dagger/Subcomponent.java b/core/src/main/java/dagger/Subcomponent.java index 6b7a032f181..857a23bd955 100644 --- a/core/src/main/java/dagger/Subcomponent.java +++ b/core/src/main/java/dagger/Subcomponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger; import java.lang.annotation.Documented; diff --git a/core/src/main/java/dagger/internal/Beta.java b/core/src/main/java/dagger/internal/Beta.java index 879012b7a16..089b0873a13 100644 --- a/core/src/main/java/dagger/internal/Beta.java +++ b/core/src/main/java/dagger/internal/Beta.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal; import java.lang.annotation.Documented; diff --git a/core/src/main/java/dagger/internal/DaggerCollections.java b/core/src/main/java/dagger/internal/DaggerCollections.java index 928d63bee0d..3d47a8497c1 100644 --- a/core/src/main/java/dagger/internal/DaggerCollections.java +++ b/core/src/main/java/dagger/internal/DaggerCollections.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal; import java.util.ArrayList; diff --git a/core/src/main/java/dagger/internal/DelegateFactory.java b/core/src/main/java/dagger/internal/DelegateFactory.java index 4161fe625fe..4ec047ca8f5 100644 --- a/core/src/main/java/dagger/internal/DelegateFactory.java +++ b/core/src/main/java/dagger/internal/DelegateFactory.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal; import javax.inject.Provider; diff --git a/core/src/main/java/dagger/internal/DoubleCheck.java b/core/src/main/java/dagger/internal/DoubleCheck.java index a866cb9fc55..ba94aa24405 100644 --- a/core/src/main/java/dagger/internal/DoubleCheck.java +++ b/core/src/main/java/dagger/internal/DoubleCheck.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal; import dagger.Lazy; diff --git a/core/src/main/java/dagger/internal/Factory.java b/core/src/main/java/dagger/internal/Factory.java index ed90c732da5..4fa0399fa60 100644 --- a/core/src/main/java/dagger/internal/Factory.java +++ b/core/src/main/java/dagger/internal/Factory.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal; import dagger.Provides; diff --git a/core/src/main/java/dagger/internal/GwtIncompatible.java b/core/src/main/java/dagger/internal/GwtIncompatible.java index 8d60e3325ed..f6100a2d039 100644 --- a/core/src/main/java/dagger/internal/GwtIncompatible.java +++ b/core/src/main/java/dagger/internal/GwtIncompatible.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal; /** Marks an element incompatible with GWT. */ diff --git a/core/src/main/java/dagger/internal/InstanceFactory.java b/core/src/main/java/dagger/internal/InstanceFactory.java index 53821a5ad20..d4b96ea2d37 100644 --- a/core/src/main/java/dagger/internal/InstanceFactory.java +++ b/core/src/main/java/dagger/internal/InstanceFactory.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal; /** diff --git a/core/src/main/java/dagger/internal/MapFactory.java b/core/src/main/java/dagger/internal/MapFactory.java index 782d47d7931..81c1d53d642 100644 --- a/core/src/main/java/dagger/internal/MapFactory.java +++ b/core/src/main/java/dagger/internal/MapFactory.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal; import java.util.Map; diff --git a/core/src/main/java/dagger/internal/MapProviderFactory.java b/core/src/main/java/dagger/internal/MapProviderFactory.java index a19788e79c1..fe712b3e8b8 100644 --- a/core/src/main/java/dagger/internal/MapProviderFactory.java +++ b/core/src/main/java/dagger/internal/MapProviderFactory.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal; import java.util.Collections; diff --git a/core/src/main/java/dagger/internal/MembersInjectors.java b/core/src/main/java/dagger/internal/MembersInjectors.java index d636adcfe00..b93a6496234 100644 --- a/core/src/main/java/dagger/internal/MembersInjectors.java +++ b/core/src/main/java/dagger/internal/MembersInjectors.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal; import dagger.MembersInjector; diff --git a/core/src/main/java/dagger/internal/Preconditions.java b/core/src/main/java/dagger/internal/Preconditions.java index 31b19058ed5..7ac5026ccfb 100644 --- a/core/src/main/java/dagger/internal/Preconditions.java +++ b/core/src/main/java/dagger/internal/Preconditions.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal; /** diff --git a/core/src/main/java/dagger/internal/ProviderOfLazy.java b/core/src/main/java/dagger/internal/ProviderOfLazy.java index 9014481f165..1f6fe003828 100644 --- a/core/src/main/java/dagger/internal/ProviderOfLazy.java +++ b/core/src/main/java/dagger/internal/ProviderOfLazy.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal; import dagger.Lazy; diff --git a/core/src/main/java/dagger/internal/SetFactory.java b/core/src/main/java/dagger/internal/SetFactory.java index 2595367284a..c2e292ed3fa 100644 --- a/core/src/main/java/dagger/internal/SetFactory.java +++ b/core/src/main/java/dagger/internal/SetFactory.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal; import java.util.ArrayList; diff --git a/core/src/main/java/dagger/internal/SingleCheck.java b/core/src/main/java/dagger/internal/SingleCheck.java index 7e2f008398d..b356dea9070 100644 --- a/core/src/main/java/dagger/internal/SingleCheck.java +++ b/core/src/main/java/dagger/internal/SingleCheck.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal; import dagger.Lazy; diff --git a/core/src/main/java/dagger/multibindings/ClassKey.java b/core/src/main/java/dagger/multibindings/ClassKey.java index a4da29a8d1d..b6e0f48b763 100644 --- a/core/src/main/java/dagger/multibindings/ClassKey.java +++ b/core/src/main/java/dagger/multibindings/ClassKey.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.multibindings; import dagger.MapKey; diff --git a/core/src/main/java/dagger/multibindings/ElementsIntoSet.java b/core/src/main/java/dagger/multibindings/ElementsIntoSet.java index 5ec17621669..1ce136e33a0 100644 --- a/core/src/main/java/dagger/multibindings/ElementsIntoSet.java +++ b/core/src/main/java/dagger/multibindings/ElementsIntoSet.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.multibindings; import java.lang.annotation.Documented; diff --git a/core/src/main/java/dagger/multibindings/IntKey.java b/core/src/main/java/dagger/multibindings/IntKey.java index a670a5c6541..c9d343115c7 100644 --- a/core/src/main/java/dagger/multibindings/IntKey.java +++ b/core/src/main/java/dagger/multibindings/IntKey.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.multibindings; import dagger.MapKey; diff --git a/core/src/main/java/dagger/multibindings/IntoMap.java b/core/src/main/java/dagger/multibindings/IntoMap.java index a39a6da3ba0..7b47caf4014 100644 --- a/core/src/main/java/dagger/multibindings/IntoMap.java +++ b/core/src/main/java/dagger/multibindings/IntoMap.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.multibindings; import dagger.internal.Beta; diff --git a/core/src/main/java/dagger/multibindings/IntoSet.java b/core/src/main/java/dagger/multibindings/IntoSet.java index 78caf0ee0bb..b784a527bc9 100644 --- a/core/src/main/java/dagger/multibindings/IntoSet.java +++ b/core/src/main/java/dagger/multibindings/IntoSet.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.multibindings; import java.lang.annotation.Documented; diff --git a/core/src/main/java/dagger/multibindings/LongKey.java b/core/src/main/java/dagger/multibindings/LongKey.java index 7efaa912a44..748b31ab2c7 100644 --- a/core/src/main/java/dagger/multibindings/LongKey.java +++ b/core/src/main/java/dagger/multibindings/LongKey.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.multibindings; import dagger.MapKey; diff --git a/core/src/main/java/dagger/multibindings/Multibinds.java b/core/src/main/java/dagger/multibindings/Multibinds.java index 8d5a9b83618..3731ae05c1c 100644 --- a/core/src/main/java/dagger/multibindings/Multibinds.java +++ b/core/src/main/java/dagger/multibindings/Multibinds.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.multibindings; import dagger.internal.Beta; diff --git a/core/src/main/java/dagger/multibindings/StringKey.java b/core/src/main/java/dagger/multibindings/StringKey.java index 1b5712ae361..1b4bda58ba2 100644 --- a/core/src/main/java/dagger/multibindings/StringKey.java +++ b/core/src/main/java/dagger/multibindings/StringKey.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.multibindings; import dagger.MapKey; diff --git a/core/src/main/java/dagger/multibindings/package-info.java b/core/src/main/java/dagger/multibindings/package-info.java index 8efc6abac58..fdf64d2115c 100644 --- a/core/src/main/java/dagger/multibindings/package-info.java +++ b/core/src/main/java/dagger/multibindings/package-info.java @@ -21,4 +21,5 @@ * @see Multibindings in the Dagger * User's Guide */ + package dagger.multibindings; diff --git a/core/src/main/java/dagger/package-info.java b/core/src/main/java/dagger/package-info.java index 94690cea6da..92e1fc9ad3c 100644 --- a/core/src/main/java/dagger/package-info.java +++ b/core/src/main/java/dagger/package-info.java @@ -31,4 +31,5 @@ * {@linkplain java.util.ServiceLoader service loader} to automatically configure the processor, so * explict build configuration shouldn't be necessary. */ + package dagger; diff --git a/core/src/test/java/dagger/internal/DoubleCheckTest.java b/core/src/test/java/dagger/internal/DoubleCheckTest.java index afbed9b7f48..635b600caa7 100644 --- a/core/src/test/java/dagger/internal/DoubleCheckTest.java +++ b/core/src/test/java/dagger/internal/DoubleCheckTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal; import com.google.common.collect.Lists; diff --git a/core/src/test/java/dagger/internal/InstanceFactoryTest.java b/core/src/test/java/dagger/internal/InstanceFactoryTest.java index 6da509174ea..6f94fb9291c 100644 --- a/core/src/test/java/dagger/internal/InstanceFactoryTest.java +++ b/core/src/test/java/dagger/internal/InstanceFactoryTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal; import org.junit.Rule; diff --git a/core/src/test/java/dagger/internal/MapProviderFactoryTest.java b/core/src/test/java/dagger/internal/MapProviderFactoryTest.java index c3f56255246..b1c9e94270e 100644 --- a/core/src/test/java/dagger/internal/MapProviderFactoryTest.java +++ b/core/src/test/java/dagger/internal/MapProviderFactoryTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal; import java.util.LinkedHashMap; diff --git a/core/src/test/java/dagger/internal/SetFactoryTest.java b/core/src/test/java/dagger/internal/SetFactoryTest.java index b6540ab5a49..fd7c8f8deda 100644 --- a/core/src/test/java/dagger/internal/SetFactoryTest.java +++ b/core/src/test/java/dagger/internal/SetFactoryTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal; import com.google.common.collect.ImmutableSet; diff --git a/core/src/test/java/dagger/internal/SingleCheckTest.java b/core/src/test/java/dagger/internal/SingleCheckTest.java index da30d0f9ccf..20dd138e830 100644 --- a/core/src/test/java/dagger/internal/SingleCheckTest.java +++ b/core/src/test/java/dagger/internal/SingleCheckTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.internal; import javax.inject.Provider; diff --git a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/AbstractActivityComponent.java b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/AbstractActivityComponent.java index 82d6a0a040c..35f578d6c4f 100644 --- a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/AbstractActivityComponent.java +++ b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/AbstractActivityComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.example.dagger.activitygraphs; import android.app.Activity; diff --git a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ActivityModule.java b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ActivityModule.java index c04628f1cb8..1a2a5945ec0 100644 --- a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ActivityModule.java +++ b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ActivityModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.example.dagger.activitygraphs; import android.app.Activity; diff --git a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ApplicationComponent.java b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ApplicationComponent.java index d452918314c..37629ee3b71 100644 --- a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ApplicationComponent.java +++ b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ApplicationComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.example.dagger.activitygraphs; import android.app.Application; diff --git a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/DemoApplication.java b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/DemoApplication.java index cf4bbe2ca0a..5a9ab0771fc 100644 --- a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/DemoApplication.java +++ b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/DemoApplication.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.example.dagger.activitygraphs; import android.app.Application; diff --git a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/DemoApplicationModule.java b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/DemoApplicationModule.java index 25b003cd637..4807b35c3ce 100644 --- a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/DemoApplicationModule.java +++ b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/DemoApplicationModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.example.dagger.activitygraphs; import android.app.Application; diff --git a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/PerActivity.java b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/PerActivity.java index 3346b9c1e5e..7577aafcc0b 100644 --- a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/PerActivity.java +++ b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/PerActivity.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.example.dagger.activitygraphs; import java.lang.annotation.Retention; diff --git a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/ActivityTitleController.java b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/ActivityTitleController.java index 786179ce0c5..6352d837fa6 100644 --- a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/ActivityTitleController.java +++ b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/ActivityTitleController.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.example.dagger.activitygraphs.ui; import android.app.Activity; diff --git a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/HomeActivity.java b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/HomeActivity.java index 7b6ee9764cc..dcdb1b8853a 100644 --- a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/HomeActivity.java +++ b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/HomeActivity.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.example.dagger.activitygraphs.ui; import android.location.LocationManager; diff --git a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/HomeComponent.java b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/HomeComponent.java index b2050af6287..57b9b894b2e 100644 --- a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/HomeComponent.java +++ b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/HomeComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.example.dagger.activitygraphs.ui; import com.example.dagger.activitygraphs.AbstractActivityComponent; diff --git a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/HomeFragment.java b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/HomeFragment.java index ce894af4976..3207c5208d5 100644 --- a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/HomeFragment.java +++ b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/HomeFragment.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.example.dagger.activitygraphs.ui; import android.os.Bundle; diff --git a/examples/android-simple/src/main/java/com/example/dagger/simple/AndroidModule.java b/examples/android-simple/src/main/java/com/example/dagger/simple/AndroidModule.java index eac1f8096e6..dc5922300b6 100644 --- a/examples/android-simple/src/main/java/com/example/dagger/simple/AndroidModule.java +++ b/examples/android-simple/src/main/java/com/example/dagger/simple/AndroidModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.example.dagger.simple; import android.content.Context; diff --git a/examples/android-simple/src/main/java/com/example/dagger/simple/DemoActivity.java b/examples/android-simple/src/main/java/com/example/dagger/simple/DemoActivity.java index d7616175a09..4847b101c46 100644 --- a/examples/android-simple/src/main/java/com/example/dagger/simple/DemoActivity.java +++ b/examples/android-simple/src/main/java/com/example/dagger/simple/DemoActivity.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.example.dagger.simple; import android.app.Activity; diff --git a/examples/android-simple/src/main/java/com/example/dagger/simple/DemoApplication.java b/examples/android-simple/src/main/java/com/example/dagger/simple/DemoApplication.java index 470e6d0a2ea..630128de97e 100644 --- a/examples/android-simple/src/main/java/com/example/dagger/simple/DemoApplication.java +++ b/examples/android-simple/src/main/java/com/example/dagger/simple/DemoApplication.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.example.dagger.simple; import android.app.Application; diff --git a/examples/android-simple/src/main/java/com/example/dagger/simple/ForApplication.java b/examples/android-simple/src/main/java/com/example/dagger/simple/ForApplication.java index ba8778ae034..2cad1ce8138 100644 --- a/examples/android-simple/src/main/java/com/example/dagger/simple/ForApplication.java +++ b/examples/android-simple/src/main/java/com/example/dagger/simple/ForApplication.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.example.dagger.simple; import java.lang.annotation.Retention; diff --git a/examples/android-simple/src/main/java/com/example/dagger/simple/ui/HomeActivity.java b/examples/android-simple/src/main/java/com/example/dagger/simple/ui/HomeActivity.java index 8363aedfc64..f0669c61df8 100644 --- a/examples/android-simple/src/main/java/com/example/dagger/simple/ui/HomeActivity.java +++ b/examples/android-simple/src/main/java/com/example/dagger/simple/ui/HomeActivity.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.example.dagger.simple.ui; import android.location.LocationManager; diff --git a/producers/src/main/java/dagger/producers/Produced.java b/producers/src/main/java/dagger/producers/Produced.java index d68411e6bf1..c87732ca04b 100644 --- a/producers/src/main/java/dagger/producers/Produced.java +++ b/producers/src/main/java/dagger/producers/Produced.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers; import com.google.common.base.Objects; diff --git a/producers/src/main/java/dagger/producers/Producer.java b/producers/src/main/java/dagger/producers/Producer.java index 5441c42cb5b..978f3ad84f4 100644 --- a/producers/src/main/java/dagger/producers/Producer.java +++ b/producers/src/main/java/dagger/producers/Producer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers; import dagger.internal.Beta; diff --git a/producers/src/main/java/dagger/producers/ProducerModule.java b/producers/src/main/java/dagger/producers/ProducerModule.java index 5d32e88c608..d5ce4a570bc 100644 --- a/producers/src/main/java/dagger/producers/ProducerModule.java +++ b/producers/src/main/java/dagger/producers/ProducerModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers; import dagger.Module; diff --git a/producers/src/main/java/dagger/producers/Produces.java b/producers/src/main/java/dagger/producers/Produces.java index 07681eeb520..f388bec001c 100644 --- a/producers/src/main/java/dagger/producers/Produces.java +++ b/producers/src/main/java/dagger/producers/Produces.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers; import dagger.internal.Beta; diff --git a/producers/src/main/java/dagger/producers/Production.java b/producers/src/main/java/dagger/producers/Production.java index 1e303fbfca5..a65c0eb48cd 100644 --- a/producers/src/main/java/dagger/producers/Production.java +++ b/producers/src/main/java/dagger/producers/Production.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers; import dagger.internal.Beta; diff --git a/producers/src/main/java/dagger/producers/ProductionComponent.java b/producers/src/main/java/dagger/producers/ProductionComponent.java index 14eb1a98710..a93f049db17 100644 --- a/producers/src/main/java/dagger/producers/ProductionComponent.java +++ b/producers/src/main/java/dagger/producers/ProductionComponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers; import com.google.common.util.concurrent.ListenableFuture; diff --git a/producers/src/main/java/dagger/producers/ProductionScope.java b/producers/src/main/java/dagger/producers/ProductionScope.java index ac187c37a63..90e044b95c6 100644 --- a/producers/src/main/java/dagger/producers/ProductionScope.java +++ b/producers/src/main/java/dagger/producers/ProductionScope.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers; import java.lang.annotation.Documented; diff --git a/producers/src/main/java/dagger/producers/ProductionSubcomponent.java b/producers/src/main/java/dagger/producers/ProductionSubcomponent.java index 0ea724088c4..c8a41639b82 100644 --- a/producers/src/main/java/dagger/producers/ProductionSubcomponent.java +++ b/producers/src/main/java/dagger/producers/ProductionSubcomponent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers; import dagger.Component; diff --git a/producers/src/main/java/dagger/producers/internal/AbstractProducer.java b/producers/src/main/java/dagger/producers/internal/AbstractProducer.java index 6411718fe30..c44033e61c4 100644 --- a/producers/src/main/java/dagger/producers/internal/AbstractProducer.java +++ b/producers/src/main/java/dagger/producers/internal/AbstractProducer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.internal; import com.google.common.util.concurrent.ListenableFuture; diff --git a/producers/src/main/java/dagger/producers/internal/MapOfProducedProducer.java b/producers/src/main/java/dagger/producers/internal/MapOfProducedProducer.java index 4205471c83c..d982132fc08 100644 --- a/producers/src/main/java/dagger/producers/internal/MapOfProducedProducer.java +++ b/producers/src/main/java/dagger/producers/internal/MapOfProducedProducer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.internal; import com.google.common.base.Function; diff --git a/producers/src/main/java/dagger/producers/internal/MapOfProducerProducer.java b/producers/src/main/java/dagger/producers/internal/MapOfProducerProducer.java index d7c624f8295..f06792a2430 100644 --- a/producers/src/main/java/dagger/producers/internal/MapOfProducerProducer.java +++ b/producers/src/main/java/dagger/producers/internal/MapOfProducerProducer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.internal; import com.google.common.collect.ImmutableMap; diff --git a/producers/src/main/java/dagger/producers/internal/MapProducer.java b/producers/src/main/java/dagger/producers/internal/MapProducer.java index 671b6d39df7..b5104f01d4f 100644 --- a/producers/src/main/java/dagger/producers/internal/MapProducer.java +++ b/producers/src/main/java/dagger/producers/internal/MapProducer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.internal; import com.google.common.base.Function; diff --git a/producers/src/main/java/dagger/producers/internal/Producers.java b/producers/src/main/java/dagger/producers/internal/Producers.java index f0debe977d7..41210b40b60 100644 --- a/producers/src/main/java/dagger/producers/internal/Producers.java +++ b/producers/src/main/java/dagger/producers/internal/Producers.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.internal; import com.google.common.base.Function; diff --git a/producers/src/main/java/dagger/producers/internal/ProductionImplementation.java b/producers/src/main/java/dagger/producers/internal/ProductionImplementation.java index b79552c0742..0391274426e 100644 --- a/producers/src/main/java/dagger/producers/internal/ProductionImplementation.java +++ b/producers/src/main/java/dagger/producers/internal/ProductionImplementation.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.internal; import dagger.internal.Beta; diff --git a/producers/src/main/java/dagger/producers/internal/SetOfProducedProducer.java b/producers/src/main/java/dagger/producers/internal/SetOfProducedProducer.java index e1e69346cd0..bb1e49c3f1f 100644 --- a/producers/src/main/java/dagger/producers/internal/SetOfProducedProducer.java +++ b/producers/src/main/java/dagger/producers/internal/SetOfProducedProducer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.internal; import com.google.common.base.Function; diff --git a/producers/src/main/java/dagger/producers/internal/SetProducer.java b/producers/src/main/java/dagger/producers/internal/SetProducer.java index e35daf0b032..29b66242aa7 100644 --- a/producers/src/main/java/dagger/producers/internal/SetProducer.java +++ b/producers/src/main/java/dagger/producers/internal/SetProducer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.internal; import com.google.common.base.Function; diff --git a/producers/src/main/java/dagger/producers/monitoring/ProducerMonitor.java b/producers/src/main/java/dagger/producers/monitoring/ProducerMonitor.java index 958a1735dfc..040ea3ca6da 100644 --- a/producers/src/main/java/dagger/producers/monitoring/ProducerMonitor.java +++ b/producers/src/main/java/dagger/producers/monitoring/ProducerMonitor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.monitoring; import com.google.common.util.concurrent.FutureCallback; diff --git a/producers/src/main/java/dagger/producers/monitoring/ProducerTimingRecorder.java b/producers/src/main/java/dagger/producers/monitoring/ProducerTimingRecorder.java index 9dc2cf37569..ae09cd4d88b 100644 --- a/producers/src/main/java/dagger/producers/monitoring/ProducerTimingRecorder.java +++ b/producers/src/main/java/dagger/producers/monitoring/ProducerTimingRecorder.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.monitoring; import dagger.producers.Produces; diff --git a/producers/src/main/java/dagger/producers/monitoring/ProducerToken.java b/producers/src/main/java/dagger/producers/monitoring/ProducerToken.java index 9ec4c89d2df..50281074ff2 100644 --- a/producers/src/main/java/dagger/producers/monitoring/ProducerToken.java +++ b/producers/src/main/java/dagger/producers/monitoring/ProducerToken.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.monitoring; import dagger.producers.Produces; diff --git a/producers/src/main/java/dagger/producers/monitoring/ProductionComponentMonitor.java b/producers/src/main/java/dagger/producers/monitoring/ProductionComponentMonitor.java index 544e4cc8908..17cce77ef24 100644 --- a/producers/src/main/java/dagger/producers/monitoring/ProductionComponentMonitor.java +++ b/producers/src/main/java/dagger/producers/monitoring/ProductionComponentMonitor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.monitoring; import dagger.producers.Produces; diff --git a/producers/src/main/java/dagger/producers/monitoring/ProductionComponentTimingRecorder.java b/producers/src/main/java/dagger/producers/monitoring/ProductionComponentTimingRecorder.java index 218cc15ddd2..718d4d97253 100644 --- a/producers/src/main/java/dagger/producers/monitoring/ProductionComponentTimingRecorder.java +++ b/producers/src/main/java/dagger/producers/monitoring/ProductionComponentTimingRecorder.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.monitoring; import dagger.producers.Produces; diff --git a/producers/src/main/java/dagger/producers/monitoring/TimingProducerMonitor.java b/producers/src/main/java/dagger/producers/monitoring/TimingProducerMonitor.java index deae8f8df2e..1b7a6668c6a 100644 --- a/producers/src/main/java/dagger/producers/monitoring/TimingProducerMonitor.java +++ b/producers/src/main/java/dagger/producers/monitoring/TimingProducerMonitor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.monitoring; import com.google.common.base.Stopwatch; diff --git a/producers/src/main/java/dagger/producers/monitoring/TimingProductionComponentMonitor.java b/producers/src/main/java/dagger/producers/monitoring/TimingProductionComponentMonitor.java index 0e018fbadab..66589d9512e 100644 --- a/producers/src/main/java/dagger/producers/monitoring/TimingProductionComponentMonitor.java +++ b/producers/src/main/java/dagger/producers/monitoring/TimingProductionComponentMonitor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.monitoring; import com.google.common.base.Stopwatch; diff --git a/producers/src/main/java/dagger/producers/monitoring/TimingRecorders.java b/producers/src/main/java/dagger/producers/monitoring/TimingRecorders.java index 1d1e321422c..471d527c738 100644 --- a/producers/src/main/java/dagger/producers/monitoring/TimingRecorders.java +++ b/producers/src/main/java/dagger/producers/monitoring/TimingRecorders.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.monitoring; import com.google.common.collect.ImmutableList; diff --git a/producers/src/main/java/dagger/producers/monitoring/internal/Monitors.java b/producers/src/main/java/dagger/producers/monitoring/internal/Monitors.java index d0ad9441b2e..bc17a07952c 100644 --- a/producers/src/main/java/dagger/producers/monitoring/internal/Monitors.java +++ b/producers/src/main/java/dagger/producers/monitoring/internal/Monitors.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.monitoring.internal; import com.google.common.collect.ImmutableList; diff --git a/producers/src/main/java/dagger/producers/monitoring/package-info.java b/producers/src/main/java/dagger/producers/monitoring/package-info.java index b13c81db3dc..122df5d2c5e 100644 --- a/producers/src/main/java/dagger/producers/monitoring/package-info.java +++ b/producers/src/main/java/dagger/producers/monitoring/package-info.java @@ -20,4 +20,5 @@ *

The interfaces in this package are not stable. Do not use these interfaces unless you are * prepared to be broken. */ + package dagger.producers.monitoring; diff --git a/producers/src/main/java/dagger/producers/package-info.java b/producers/src/main/java/dagger/producers/package-info.java index ca6bd1aa851..01d261a87d3 100644 --- a/producers/src/main/java/dagger/producers/package-info.java +++ b/producers/src/main/java/dagger/producers/package-info.java @@ -25,4 +25,5 @@ * google.github.io/dagger/producers. * */ + package dagger.producers; diff --git a/producers/src/test/java/dagger/producers/ProducedTest.java b/producers/src/test/java/dagger/producers/ProducedTest.java index ed3729e19f3..01c4eab3fad 100644 --- a/producers/src/test/java/dagger/producers/ProducedTest.java +++ b/producers/src/test/java/dagger/producers/ProducedTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers; import com.google.common.testing.EqualsTester; diff --git a/producers/src/test/java/dagger/producers/internal/AbstractProducerTest.java b/producers/src/test/java/dagger/producers/internal/AbstractProducerTest.java index 5bb984f105d..6cbfb1ff795 100644 --- a/producers/src/test/java/dagger/producers/internal/AbstractProducerTest.java +++ b/producers/src/test/java/dagger/producers/internal/AbstractProducerTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.internal; import com.google.common.util.concurrent.Futures; diff --git a/producers/src/test/java/dagger/producers/internal/MapOfProducerProducerTest.java b/producers/src/test/java/dagger/producers/internal/MapOfProducerProducerTest.java index fe7d0f9d3be..d0a9eef4818 100644 --- a/producers/src/test/java/dagger/producers/internal/MapOfProducerProducerTest.java +++ b/producers/src/test/java/dagger/producers/internal/MapOfProducerProducerTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.internal; import dagger.producers.Producer; diff --git a/producers/src/test/java/dagger/producers/internal/MapProducerTest.java b/producers/src/test/java/dagger/producers/internal/MapProducerTest.java index f44188bc31b..7e7524c8ca2 100644 --- a/producers/src/test/java/dagger/producers/internal/MapProducerTest.java +++ b/producers/src/test/java/dagger/producers/internal/MapProducerTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.internal; import com.google.common.collect.ImmutableMap; diff --git a/producers/src/test/java/dagger/producers/internal/ProducersTest.java b/producers/src/test/java/dagger/producers/internal/ProducersTest.java index d6f59cd7da1..3f3fa2b8c14 100644 --- a/producers/src/test/java/dagger/producers/internal/ProducersTest.java +++ b/producers/src/test/java/dagger/producers/internal/ProducersTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.internal; import com.google.common.util.concurrent.Futures; diff --git a/producers/src/test/java/dagger/producers/internal/SetOfProducedProducerTest.java b/producers/src/test/java/dagger/producers/internal/SetOfProducedProducerTest.java index c01f8b5ae60..c2ab2dfce01 100644 --- a/producers/src/test/java/dagger/producers/internal/SetOfProducedProducerTest.java +++ b/producers/src/test/java/dagger/producers/internal/SetOfProducedProducerTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.internal; import com.google.common.collect.ImmutableSet; diff --git a/producers/src/test/java/dagger/producers/internal/SetProducerTest.java b/producers/src/test/java/dagger/producers/internal/SetProducerTest.java index c62f9920792..97ed5001247 100644 --- a/producers/src/test/java/dagger/producers/internal/SetProducerTest.java +++ b/producers/src/test/java/dagger/producers/internal/SetProducerTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.internal; import com.google.common.collect.ImmutableSet; diff --git a/producers/src/test/java/dagger/producers/monitoring/TimingProductionComponentMonitorTest.java b/producers/src/test/java/dagger/producers/monitoring/TimingProductionComponentMonitorTest.java index ffb74859181..60486b074dc 100644 --- a/producers/src/test/java/dagger/producers/monitoring/TimingProductionComponentMonitorTest.java +++ b/producers/src/test/java/dagger/producers/monitoring/TimingProductionComponentMonitorTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.monitoring; import com.google.common.testing.FakeTicker; diff --git a/producers/src/test/java/dagger/producers/monitoring/TimingRecordersTest.java b/producers/src/test/java/dagger/producers/monitoring/TimingRecordersTest.java index d4ecd33d4c4..f027d6d295e 100644 --- a/producers/src/test/java/dagger/producers/monitoring/TimingRecordersTest.java +++ b/producers/src/test/java/dagger/producers/monitoring/TimingRecordersTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.monitoring; import com.google.common.collect.ImmutableList; diff --git a/producers/src/test/java/dagger/producers/monitoring/internal/MonitorsTest.java b/producers/src/test/java/dagger/producers/monitoring/internal/MonitorsTest.java index dfdb4226625..ed661110234 100644 --- a/producers/src/test/java/dagger/producers/monitoring/internal/MonitorsTest.java +++ b/producers/src/test/java/dagger/producers/monitoring/internal/MonitorsTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package dagger.producers.monitoring.internal; import com.google.common.collect.ImmutableList; From e55f074b013e90d19ca75349c66fe3f42768a120 Mon Sep 17 00:00:00 2001 From: gak Date: Tue, 12 Jul 2016 15:36:42 -0700 Subject: [PATCH 10/17] Update Dagger to use Google's new standard import order: 1. static imports sorted lexicographically 2. blank line 3. non-static imports sorted lexicographically ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=127251030 --- .../src/main/java/test/SomeQualifier.java | 4 +- .../main/java/test/builder/MiddleScope.java | 4 +- .../src/main/java/test/cycle/Cycles.java | 2 - .../java/test/multipackage/a/AModule.java | 2 - .../test/multipackage/a/UsesInaccessible.java | 2 - .../java/test/nullables/NullComponent.java | 3 +- .../NullComponentWithDependency.java | 3 +- .../src/main/java/test/scope/BlueScope.java | 4 +- .../src/main/java/test/scope/GreenScope.java | 4 +- .../test/staticprovides/AllStaticModule.java | 1 - .../test/subcomponent/BoundAsSingleton.java | 4 +- .../MultibindingSubcomponents.java | 2 - .../java/test/subcomponent/ParentModule.java | 1 - .../main/java/test/subcomponent/Unbound.java | 4 +- .../src/test/java/test/BasicTest.java | 14 +-- .../java/test/DependsOnGeneratedCodeTest.java | 4 +- .../src/test/java/test/GenericTest.java | 6 +- .../src/test/java/test/MultibindingTest.java | 4 +- .../src/test/java/test/NestedTest.java | 4 +- .../java/test/NonComponentDependencyTest.java | 4 +- .../src/test/java/test/ReusableTest.java | 4 +- ...dsCollectionsWithoutMultibindingsTest.java | 4 +- .../src/test/java/test/binds/BindsTest.java | 4 +- .../test/java/test/builder/BuilderTest.java | 6 +- .../src/test/java/test/cycle/CycleTest.java | 4 +- .../test/java/test/cycle/LongCycleTest.java | 4 +- .../test/membersinject/MembersInjectTest.java | 4 +- .../java/test/nullables/NullabilityTest.java | 5 +- .../staticprovides/StaticProvidesTest.java | 6 +- .../SubcomponentMultibindingsTest.java | 4 +- .../test/subcomponent/SubcomponentTest.java | 6 +- .../hiding/SubcomponentHidingTest.java | 4 +- .../repeat/RepeatedModuleTest.java | 6 +- .../producerstest/DependentComponent.java | 1 - .../DependentProducerModule.java | 1 - .../multibindings/MultibindingModule.java | 2 +- .../MultibindingProducerModule.java | 2 +- .../multibindings/Qualifiers.java | 4 +- .../producerstest/provisions/Provisions.java | 3 +- .../java/producerstest/DependentTest.java | 4 +- .../producerstest/ProducerFactoryTest.java | 12 +-- .../test/java/producerstest/SimpleTest.java | 4 +- .../badexecutor/BadExecutorTest.java | 6 +- .../binds/BindsProducersTest.java | 4 +- .../ProductionComponentBuilderTest.java | 4 +- .../monitoring/MonitoringTest.java | 16 +-- .../multibindings/MultibindingTest.java | 6 +- .../provisions/ProvisionsTest.java | 4 +- .../java/producerstest/scope/ScopeTest.java | 4 +- .../MultiPackageSubcomponentTest.java | 4 +- .../SubcomponentWithBoundExecutorTest.java | 4 +- .../tck/src/main/java/test/tck/CarModule.java | 1 - .../tck/src/main/java/test/tck/CarShop.java | 2 +- .../src/main/java/test/tck/SeatModule.java | 1 - .../src/main/java/test/tck/TireModule.java | 4 +- .../codegen/AbstractComponentWriter.java | 98 +++++++++---------- .../internal/codegen/Accessibility.java | 10 +- .../java/dagger/internal/codegen/Binding.java | 4 +- .../internal/codegen/BindingDeclaration.java | 8 +- .../codegen/BindingDeclarationFormatter.java | 6 +- .../dagger/internal/codegen/BindingGraph.java | 41 ++++---- .../codegen/BindingGraphValidator.java | 84 ++++++++-------- .../codegen/BindingMethodValidator.java | 47 +++++---- .../codegen/BindingVariableNamer.java | 6 +- .../codegen/BindsMethodValidator.java | 20 ++-- .../internal/codegen/BuilderValidator.java | 14 +-- .../internal/codegen/ComponentDescriptor.java | 24 ++--- .../codegen/ComponentHierarchyValidator.java | 4 +- .../internal/codegen/ComponentProcessor.java | 6 +- .../internal/codegen/ComponentValidator.java | 20 ++-- .../internal/codegen/ComponentWriter.java | 16 +-- .../codegen/ConfigurationAnnotations.java | 8 +- .../internal/codegen/ContributionBinding.java | 17 ++-- .../internal/codegen/ContributionType.java | 4 +- .../internal/codegen/DelegateDeclaration.java | 8 +- .../internal/codegen/DependencyRequest.java | 18 ++-- .../codegen/DependencyRequestFormatter.java | 6 +- .../codegen/DependencyRequestMapper.java | 4 +- .../internal/codegen/FactoryGenerator.java | 46 ++++----- .../dagger/internal/codegen/Formatter.java | 4 +- .../internal/codegen/FrameworkDependency.java | 4 +- .../internal/codegen/FrameworkTypes.java | 4 +- .../codegen/InjectBindingRegistry.java | 16 +-- .../codegen/InjectProcessingStep.java | 2 - .../internal/codegen/InjectValidator.java | 42 ++++---- .../codegen/InjectionAnnotations.java | 4 +- .../java/dagger/internal/codegen/Key.java | 25 +++-- .../internal/codegen/MapKeyGenerator.java | 22 ++--- .../codegen/MapKeyProcessingStep.java | 8 +- .../internal/codegen/MapKeyValidator.java | 10 +- .../java/dagger/internal/codegen/MapKeys.java | 18 ++-- .../java/dagger/internal/codegen/MapType.java | 6 +- .../dagger/internal/codegen/MemberSelect.java | 20 ++-- .../codegen/MembersInjectionBinding.java | 14 +-- .../codegen/MembersInjectorGenerator.java | 38 +++---- .../internal/codegen/MethodSignature.java | 4 +- .../codegen/MethodSignatureFormatter.java | 6 +- .../internal/codegen/ModuleDescriptor.java | 22 ++--- .../codegen/ModuleProcessingStep.java | 10 +- .../internal/codegen/ModuleValidator.java | 36 +++---- .../codegen/MonitoringModuleGenerator.java | 18 ++-- .../codegen/MultibindingAnnotations.java | 4 +- ...MultibindingAnnotationsProcessingStep.java | 8 +- .../codegen/MultibindingDeclaration.java | 10 +- .../codegen/MultibindingsProcessingStep.java | 4 +- .../codegen/MultibindingsValidator.java | 20 ++-- .../codegen/MultibindsMethodValidator.java | 14 +-- .../codegen/ProducerFactoryGenerator.java | 40 ++++---- .../codegen/ProducesMethodValidator.java | 18 ++-- .../internal/codegen/ProductionBinding.java | 12 +-- .../ProductionExecutorModuleGenerator.java | 12 +-- .../codegen/ProvidesMethodValidator.java | 8 +- .../internal/codegen/ProvisionBinding.java | 24 ++--- .../internal/codegen/ResolvedBindings.java | 8 +- .../java/dagger/internal/codegen/Scope.java | 8 +- .../java/dagger/internal/codegen/SetType.java | 6 +- .../codegen/SimpleAnnotationMirror.java | 8 +- .../SourceFileGenerationException.java | 6 +- .../internal/codegen/SourceFileGenerator.java | 4 +- .../dagger/internal/codegen/SourceFiles.java | 12 +-- .../internal/codegen/SubcomponentWriter.java | 26 ++--- .../java/dagger/internal/codegen/Util.java | 16 +-- .../internal/codegen/ValidationReport.java | 8 +- .../internal/codegen/AccessibilityTest.java | 6 +- .../codegen/BindsMethodValidatorTest.java | 6 +- .../codegen/ComponentBuilderTest.java | 10 +- .../codegen/ComponentProcessorTest.java | 14 +-- .../codegen/DaggerModuleMethodSubject.java | 6 +- .../codegen/DependencyRequestMapperTest.java | 4 +- .../internal/codegen/ErrorMessagesTest.java | 4 +- .../internal/codegen/FrameworkFieldTest.java | 12 +-- .../codegen/GraphValidationScopingTest.java | 12 +-- .../internal/codegen/GraphValidationTest.java | 10 +- .../codegen/InaccessibleTypeTest.java | 8 +- ...InjectConstructorFactoryGeneratorTest.java | 14 +-- .../java/dagger/internal/codegen/KeyTest.java | 4 +- .../MapBindingComponentProcessorTest.java | 8 +- .../internal/codegen/MapKeyProcessorTest.java | 10 +- .../codegen/MembersInjectionTest.java | 14 +-- .../codegen/MethodSignatureFormatterTest.java | 6 +- .../MissingBindingSuggestionsTest.java | 6 +- .../codegen/ModuleFactoryGeneratorTest.java | 18 ++-- .../internal/codegen/MultibindingTest.java | 4 +- .../codegen/MultibindingsValidatorTest.java | 10 +- .../codegen/MultibindsValidatorTest.java | 6 +- .../internal/codegen/MultipleRequestTest.java | 6 +- .../ProducerModuleFactoryGeneratorTest.java | 18 ++-- .../ProductionComponentProcessorTest.java | 10 +- .../ProductionGraphValidationTest.java | 6 +- .../codegen/RepeatedModuleValidationTest.java | 6 +- .../SubcomponentBuilderValidationTest.java | 8 +- .../codegen/SubcomponentValidationTest.java | 8 +- .../codegen/ValidationReportTest.java | 8 +- .../operation/PrimitiveInjectionTest.java | 10 +- core/src/main/java/dagger/Binds.java | 6 +- core/src/main/java/dagger/Component.java | 6 +- core/src/main/java/dagger/MapKey.java | 6 +- core/src/main/java/dagger/Multibindings.java | 4 +- core/src/main/java/dagger/Provides.java | 6 +- core/src/main/java/dagger/Reusable.java | 4 +- core/src/main/java/dagger/Subcomponent.java | 6 +- core/src/main/java/dagger/internal/Beta.java | 4 +- .../java/dagger/internal/DoubleCheck.java | 4 +- .../main/java/dagger/internal/MapFactory.java | 6 +- .../dagger/internal/MapProviderFactory.java | 6 +- .../dagger/internal/MembersInjectors.java | 4 +- .../java/dagger/internal/ProviderOfLazy.java | 4 +- .../main/java/dagger/internal/SetFactory.java | 12 +-- .../java/dagger/internal/SingleCheck.java | 4 +- .../java/dagger/multibindings/ClassKey.java | 4 +- .../dagger/multibindings/ElementsIntoSet.java | 6 +- .../java/dagger/multibindings/IntKey.java | 4 +- .../java/dagger/multibindings/IntoMap.java | 6 +- .../java/dagger/multibindings/IntoSet.java | 6 +- .../java/dagger/multibindings/LongKey.java | 4 +- .../java/dagger/multibindings/Multibinds.java | 4 +- .../java/dagger/multibindings/StringKey.java | 4 +- .../java/dagger/internal/DoubleCheckTest.java | 8 +- .../dagger/internal/InstanceFactoryTest.java | 4 +- .../internal/MapProviderFactoryTest.java | 4 +- .../java/dagger/internal/SetFactoryTest.java | 4 +- .../java/dagger/internal/SingleCheckTest.java | 4 +- .../activitygraphs/DemoApplication.java | 1 - .../activitygraphs/DemoApplicationModule.java | 4 +- .../dagger/activitygraphs/PerActivity.java | 4 +- .../activitygraphs/ui/HomeFragment.java | 4 +- .../example/dagger/simple/AndroidModule.java | 4 +- .../dagger/simple/DemoApplication.java | 2 - .../example/dagger/simple/ForApplication.java | 4 +- .../main/java/dagger/producers/Produced.java | 4 +- .../main/java/dagger/producers/Producer.java | 3 +- .../java/dagger/producers/ProducerModule.java | 6 +- .../main/java/dagger/producers/Produces.java | 8 +- .../java/dagger/producers/Production.java | 4 +- .../dagger/producers/ProductionComponent.java | 4 +- .../dagger/producers/ProductionScope.java | 4 +- .../producers/ProductionSubcomponent.java | 6 +- .../producers/internal/AbstractProducer.java | 5 +- .../internal/MapOfProducerProducer.java | 6 +- .../dagger/producers/internal/Producers.java | 4 +- .../internal/ProductionImplementation.java | 4 +- .../internal/SetOfProducedProducer.java | 8 +- .../producers/internal/SetProducer.java | 8 +- .../producers/monitoring/ProducerToken.java | 4 +- .../monitoring/TimingProducerMonitor.java | 4 +- .../java/dagger/producers/ProducedTest.java | 6 +- .../internal/AbstractProducerTest.java | 14 +-- .../internal/MapOfProducerProducerTest.java | 6 +- .../producers/internal/MapProducerTest.java | 6 +- .../producers/internal/ProducersTest.java | 6 +- .../internal/SetOfProducedProducerTest.java | 4 +- .../producers/internal/SetProducerTest.java | 6 +- .../TimingProductionComponentMonitorTest.java | 10 +- .../monitoring/TimingRecordersTest.java | 14 +-- .../monitoring/internal/MonitorsTest.java | 14 +-- 215 files changed, 967 insertions(+), 998 deletions(-) diff --git a/compiler/src/it/functional-tests/src/main/java/test/SomeQualifier.java b/compiler/src/it/functional-tests/src/main/java/test/SomeQualifier.java index d95021d50e7..9ead648b3d5 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/SomeQualifier.java +++ b/compiler/src/it/functional-tests/src/main/java/test/SomeQualifier.java @@ -16,12 +16,12 @@ package test; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import java.lang.annotation.Documented; import java.lang.annotation.Retention; import javax.inject.Qualifier; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - @Documented @Retention(RUNTIME) @Qualifier diff --git a/compiler/src/it/functional-tests/src/main/java/test/builder/MiddleScope.java b/compiler/src/it/functional-tests/src/main/java/test/builder/MiddleScope.java index c71acca6ba8..8f0c8bb67cd 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/builder/MiddleScope.java +++ b/compiler/src/it/functional-tests/src/main/java/test/builder/MiddleScope.java @@ -16,11 +16,11 @@ package test.builder; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import java.lang.annotation.Retention; import javax.inject.Scope; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - @Scope @Retention(RUNTIME) @interface MiddleScope { diff --git a/compiler/src/it/functional-tests/src/main/java/test/cycle/Cycles.java b/compiler/src/it/functional-tests/src/main/java/test/cycle/Cycles.java index 412d3e4d045..db4b6b5e2c0 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/cycle/Cycles.java +++ b/compiler/src/it/functional-tests/src/main/java/test/cycle/Cycles.java @@ -24,9 +24,7 @@ import dagger.Subcomponent; import dagger.multibindings.IntoMap; import dagger.multibindings.StringKey; - import java.util.Map; - import javax.inject.Inject; import javax.inject.Provider; diff --git a/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/AModule.java b/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/AModule.java index 8b9cddb3d39..d3a46dddcb0 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/AModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/AModule.java @@ -23,10 +23,8 @@ import dagger.multibindings.IntoMap; import dagger.multibindings.IntoSet; import dagger.multibindings.StringKey; - import java.util.HashSet; import java.util.Set; - import javax.inject.Inject; @Module diff --git a/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/UsesInaccessible.java b/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/UsesInaccessible.java index 90146b991ce..19ca465103c 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/UsesInaccessible.java +++ b/compiler/src/it/functional-tests/src/main/java/test/multipackage/a/UsesInaccessible.java @@ -18,9 +18,7 @@ import java.util.Map; import java.util.Set; - import javax.inject.Inject; - import test.multipackage.a.AModule.Inaccessible; @SuppressWarnings("unused") diff --git a/compiler/src/it/functional-tests/src/main/java/test/nullables/NullComponent.java b/compiler/src/it/functional-tests/src/main/java/test/nullables/NullComponent.java index a53a415ece8..464b5a2a0fa 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/nullables/NullComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/nullables/NullComponent.java @@ -16,9 +16,8 @@ package test.nullables; -import javax.inject.Provider; - import dagger.Component; +import javax.inject.Provider; @Component(modules = NullModule.class) interface NullComponent { diff --git a/compiler/src/it/functional-tests/src/main/java/test/nullables/NullComponentWithDependency.java b/compiler/src/it/functional-tests/src/main/java/test/nullables/NullComponentWithDependency.java index fe7a8e414ac..b250af6f909 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/nullables/NullComponentWithDependency.java +++ b/compiler/src/it/functional-tests/src/main/java/test/nullables/NullComponentWithDependency.java @@ -16,9 +16,8 @@ package test.nullables; -import javax.inject.Provider; - import dagger.Component; +import javax.inject.Provider; @Component(dependencies = NullComponent.class) interface NullComponentWithDependency { diff --git a/compiler/src/it/functional-tests/src/main/java/test/scope/BlueScope.java b/compiler/src/it/functional-tests/src/main/java/test/scope/BlueScope.java index 83f2b65bd42..969a51ebd44 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/scope/BlueScope.java +++ b/compiler/src/it/functional-tests/src/main/java/test/scope/BlueScope.java @@ -16,12 +16,12 @@ package test.scope; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import java.lang.annotation.Documented; import java.lang.annotation.Retention; import javax.inject.Scope; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - @Documented @Retention(RUNTIME) @Scope diff --git a/compiler/src/it/functional-tests/src/main/java/test/scope/GreenScope.java b/compiler/src/it/functional-tests/src/main/java/test/scope/GreenScope.java index ab3a7173634..485b06bc30e 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/scope/GreenScope.java +++ b/compiler/src/it/functional-tests/src/main/java/test/scope/GreenScope.java @@ -16,12 +16,12 @@ package test.scope; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import java.lang.annotation.Documented; import java.lang.annotation.Retention; import javax.inject.Scope; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - @Documented @Retention(RUNTIME) @Scope diff --git a/compiler/src/it/functional-tests/src/main/java/test/staticprovides/AllStaticModule.java b/compiler/src/it/functional-tests/src/main/java/test/staticprovides/AllStaticModule.java index 632382578f7..89b3f0eb37a 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/staticprovides/AllStaticModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/staticprovides/AllStaticModule.java @@ -22,7 +22,6 @@ import dagger.Provides; import dagger.multibindings.ElementsIntoSet; import dagger.multibindings.IntoSet; - import java.util.Set; @Module diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/BoundAsSingleton.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/BoundAsSingleton.java index c9786707392..b11cadf7df8 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/BoundAsSingleton.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/BoundAsSingleton.java @@ -16,12 +16,12 @@ package test.subcomponent; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import java.lang.annotation.Documented; import java.lang.annotation.Retention; import javax.inject.Qualifier; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - @Documented @Retention(RUNTIME) @Qualifier diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/MultibindingSubcomponents.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/MultibindingSubcomponents.java index a32b0968bee..7857e3df0e0 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/MultibindingSubcomponents.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/MultibindingSubcomponents.java @@ -24,11 +24,9 @@ import dagger.multibindings.IntoMap; import dagger.multibindings.IntoSet; import dagger.multibindings.StringKey; - import java.util.Map; import java.util.Objects; import java.util.Set; - import javax.inject.Inject; final class MultibindingSubcomponents { diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentModule.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentModule.java index 5a21def0514..dce3eadfab6 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/ParentModule.java @@ -20,7 +20,6 @@ import dagger.Module; import dagger.Provides; import dagger.multibindings.IntoSet; - import javax.inject.Singleton; @Module diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/Unbound.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/Unbound.java index bf7a578fbb8..e4c2338d592 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/Unbound.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/Unbound.java @@ -16,12 +16,12 @@ package test.subcomponent; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import java.lang.annotation.Documented; import java.lang.annotation.Retention; import javax.inject.Qualifier; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - /** * A qualifier representing an unbound type, to verify that the compiler does not attempt to * generate code depending on it. diff --git a/compiler/src/it/functional-tests/src/test/java/test/BasicTest.java b/compiler/src/it/functional-tests/src/test/java/test/BasicTest.java index 56d98f45fb8..5b298e62051 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/BasicTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/BasicTest.java @@ -16,13 +16,6 @@ package test; -import dagger.Lazy; -import javax.inject.Provider; -import org.junit.experimental.theories.DataPoint; -import org.junit.experimental.theories.Theories; -import org.junit.experimental.theories.Theory; -import org.junit.runner.RunWith; - import static com.google.common.truth.Truth.assertThat; import static test.PrimitivesModule.BOUND_BOOLEAN; import static test.PrimitivesModule.BOUND_BOOLEAN_ARRAY; @@ -41,6 +34,13 @@ import static test.PrimitivesModule.BOUND_SHORT; import static test.PrimitivesModule.BOUND_SHORT_ARRAY; +import dagger.Lazy; +import javax.inject.Provider; +import org.junit.experimental.theories.DataPoint; +import org.junit.experimental.theories.Theories; +import org.junit.experimental.theories.Theory; +import org.junit.runner.RunWith; + @RunWith(Theories.class) public class BasicTest { @DataPoint diff --git a/compiler/src/it/functional-tests/src/test/java/test/DependsOnGeneratedCodeTest.java b/compiler/src/it/functional-tests/src/test/java/test/DependsOnGeneratedCodeTest.java index ceebd8b6dee..418f9f9fbd9 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/DependsOnGeneratedCodeTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/DependsOnGeneratedCodeTest.java @@ -16,12 +16,12 @@ package test; +import static com.google.common.truth.Truth.assertThat; + import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; - /** * @see Bug 19435358 */ diff --git a/compiler/src/it/functional-tests/src/test/java/test/GenericTest.java b/compiler/src/it/functional-tests/src/test/java/test/GenericTest.java index efe99a632e9..f62a1a80d85 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/GenericTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/GenericTest.java @@ -16,6 +16,9 @@ package test; +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.assertEquals; + import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -26,9 +29,6 @@ import test.sub.Exposed; import test.sub.PublicSubclass; -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.assertEquals; - @RunWith(JUnit4.class) public class GenericTest { diff --git a/compiler/src/it/functional-tests/src/test/java/test/MultibindingTest.java b/compiler/src/it/functional-tests/src/test/java/test/MultibindingTest.java index 21c9b377cdc..d06bb440762 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/MultibindingTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/MultibindingTest.java @@ -14,6 +14,8 @@ package test; +import static com.google.common.truth.Truth.assertThat; + import com.google.auto.value.AutoAnnotation; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -28,8 +30,6 @@ import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; -import static com.google.common.truth.Truth.assertThat; - @RunWith(Parameterized.class) public class MultibindingTest { diff --git a/compiler/src/it/functional-tests/src/test/java/test/NestedTest.java b/compiler/src/it/functional-tests/src/test/java/test/NestedTest.java index fcbe02ad414..09d2cbedf7a 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/NestedTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/NestedTest.java @@ -16,12 +16,12 @@ package test; +import static com.google.common.truth.Truth.assertThat; + import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; - @RunWith(JUnit4.class) public class NestedTest { @Test public void nestedFoo() { diff --git a/compiler/src/it/functional-tests/src/test/java/test/NonComponentDependencyTest.java b/compiler/src/it/functional-tests/src/test/java/test/NonComponentDependencyTest.java index ef9dba544dc..6ed6691a29c 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/NonComponentDependencyTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/NonComponentDependencyTest.java @@ -16,12 +16,12 @@ package test; +import static com.google.common.truth.Truth.assertThat; + import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; - @RunWith(JUnit4.class) public class NonComponentDependencyTest { @Test public void testThing() { diff --git a/compiler/src/it/functional-tests/src/test/java/test/ReusableTest.java b/compiler/src/it/functional-tests/src/test/java/test/ReusableTest.java index feed4c28d14..27aa425b603 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/ReusableTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/ReusableTest.java @@ -16,14 +16,14 @@ package test; +import static com.google.common.truth.Truth.assertThat; + import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import test.ComponentWithReusableBindings.ChildOne; import test.ComponentWithReusableBindings.ChildTwo; -import static com.google.common.truth.Truth.assertThat; - @RunWith(JUnit4.class) public class ReusableTest { @Test diff --git a/compiler/src/it/functional-tests/src/test/java/test/binds/BindsCollectionsWithoutMultibindingsTest.java b/compiler/src/it/functional-tests/src/test/java/test/binds/BindsCollectionsWithoutMultibindingsTest.java index 8279f3984ec..c9f5e93f6b2 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/binds/BindsCollectionsWithoutMultibindingsTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/binds/BindsCollectionsWithoutMultibindingsTest.java @@ -16,6 +16,8 @@ package test.binds; +import static com.google.common.truth.Truth.assertThat; + import com.google.common.collect.ImmutableMap; import dagger.Binds; import dagger.Component; @@ -29,8 +31,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; - @RunWith(JUnit4.class) public class BindsCollectionsWithoutMultibindingsTest { @Module diff --git a/compiler/src/it/functional-tests/src/test/java/test/binds/BindsTest.java b/compiler/src/it/functional-tests/src/test/java/test/binds/BindsTest.java index 258553c8deb..2341e1adec3 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/binds/BindsTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/binds/BindsTest.java @@ -16,14 +16,14 @@ package test.binds; +import static com.google.common.truth.Truth.assertThat; + import com.google.common.collect.ImmutableMap; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; - @RunWith(JUnit4.class) public class BindsTest { diff --git a/compiler/src/it/functional-tests/src/test/java/test/builder/BuilderTest.java b/compiler/src/it/functional-tests/src/test/java/test/builder/BuilderTest.java index 05427e8a68b..02ce6e43f11 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/builder/BuilderTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/builder/BuilderTest.java @@ -16,13 +16,13 @@ package test.builder; +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.fail; + import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.fail; - @RunWith(JUnit4.class) public class BuilderTest { diff --git a/compiler/src/it/functional-tests/src/test/java/test/cycle/CycleTest.java b/compiler/src/it/functional-tests/src/test/java/test/cycle/CycleTest.java index 0b230fc7cb7..1a62597ddf9 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/cycle/CycleTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/cycle/CycleTest.java @@ -16,6 +16,8 @@ package test.cycle; +import static com.google.common.truth.Truth.assertThat; + import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -27,8 +29,6 @@ import test.cycle.Cycles.S; import test.cycle.Cycles.SelfCycleComponent; -import static com.google.common.truth.Truth.assertThat; - @RunWith(JUnit4.class) public class CycleTest { @Test diff --git a/compiler/src/it/functional-tests/src/test/java/test/cycle/LongCycleTest.java b/compiler/src/it/functional-tests/src/test/java/test/cycle/LongCycleTest.java index 2ae97f266da..ce6293f93b7 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/cycle/LongCycleTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/cycle/LongCycleTest.java @@ -16,13 +16,13 @@ package test.cycle; +import static com.google.common.truth.Truth.assertThat; + import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import test.cycle.LongCycle.LongCycleComponent; -import static com.google.common.truth.Truth.assertThat; - @RunWith(JUnit4.class) public class LongCycleTest { diff --git a/compiler/src/it/functional-tests/src/test/java/test/membersinject/MembersInjectTest.java b/compiler/src/it/functional-tests/src/test/java/test/membersinject/MembersInjectTest.java index 84fb58dd62a..82c67e38141 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/membersinject/MembersInjectTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/membersinject/MembersInjectTest.java @@ -16,6 +16,8 @@ package test.membersinject; +import static com.google.common.truth.Truth.assertThat; + import dagger.MembersInjector; import javax.inject.Provider; import org.junit.Test; @@ -27,8 +29,6 @@ import test.multipackage.a.AParent; import test.multipackage.b.BChild; -import static com.google.common.truth.Truth.assertThat; - @RunWith(JUnit4.class) public class MembersInjectTest { @Test public void testMembersInject_arrays() { diff --git a/compiler/src/it/functional-tests/src/test/java/test/nullables/NullabilityTest.java b/compiler/src/it/functional-tests/src/test/java/test/nullables/NullabilityTest.java index be1ce51ce06..0bc859d09dd 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/nullables/NullabilityTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/nullables/NullabilityTest.java @@ -16,12 +16,13 @@ package test.nullables; +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.fail; + import javax.inject.Provider; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.fail; @RunWith(JUnit4.class) public class NullabilityTest { diff --git a/compiler/src/it/functional-tests/src/test/java/test/staticprovides/StaticProvidesTest.java b/compiler/src/it/functional-tests/src/test/java/test/staticprovides/StaticProvidesTest.java index 4b36e339131..76f3ba4853e 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/staticprovides/StaticProvidesTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/staticprovides/StaticProvidesTest.java @@ -16,6 +16,9 @@ package test.staticprovides; +import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.Truth.assertWithMessage; + import com.google.common.collect.ImmutableSet; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -27,9 +30,6 @@ import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; -import static com.google.common.truth.Truth.assertThat; -import static com.google.common.truth.Truth.assertWithMessage; - @RunWith(Parameterized.class) public class StaticProvidesTest { @Parameters diff --git a/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentMultibindingsTest.java b/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentMultibindingsTest.java index 5e3c88ab346..3d2c8e5d858 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentMultibindingsTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentMultibindingsTest.java @@ -16,6 +16,8 @@ package test.subcomponent; +import static com.google.common.truth.Truth.assertThat; + import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import org.junit.Before; @@ -31,8 +33,6 @@ import test.subcomponent.MultibindingSubcomponents.ParentWithoutProvisionHasChildWithoutProvision; import test.subcomponent.MultibindingSubcomponents.RequiresMultibindings; -import static com.google.common.truth.Truth.assertThat; - @RunWith(JUnit4.class) public class SubcomponentMultibindingsTest { diff --git a/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentTest.java b/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentTest.java index 18b03bee515..9c7b2118cf6 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentTest.java @@ -16,6 +16,9 @@ package test.subcomponent; +import static com.google.common.collect.Sets.intersection; +import static com.google.common.truth.Truth.assertThat; + import java.util.Arrays; import java.util.Collection; import java.util.Set; @@ -24,9 +27,6 @@ import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; -import static com.google.common.collect.Sets.intersection; -import static com.google.common.truth.Truth.assertThat; - @RunWith(Parameterized.class) public class SubcomponentTest { private static final ParentComponent parentComponent = DaggerParentComponent.create(); diff --git a/compiler/src/it/functional-tests/src/test/java/test/subcomponent/hiding/SubcomponentHidingTest.java b/compiler/src/it/functional-tests/src/test/java/test/subcomponent/hiding/SubcomponentHidingTest.java index 75847071de8..8b141fac097 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/subcomponent/hiding/SubcomponentHidingTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/subcomponent/hiding/SubcomponentHidingTest.java @@ -16,12 +16,12 @@ package test.subcomponent.hiding; +import static com.google.common.truth.Truth.assertThat; + import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; - @RunWith(JUnit4.class) public class SubcomponentHidingTest { @Test public void moduleNameHiding() { diff --git a/compiler/src/it/functional-tests/src/test/java/test/subcomponent/repeat/RepeatedModuleTest.java b/compiler/src/it/functional-tests/src/test/java/test/subcomponent/repeat/RepeatedModuleTest.java index d61d3aad19b..de8de4b97e7 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/subcomponent/repeat/RepeatedModuleTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/subcomponent/repeat/RepeatedModuleTest.java @@ -16,14 +16,14 @@ package test.subcomponent.repeat; +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.fail; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.fail; - @RunWith(JUnit4.class) public final class RepeatedModuleTest { private ParentComponent parentComponent; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependentComponent.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependentComponent.java index 114701123dd..0c8508eee6d 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependentComponent.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependentComponent.java @@ -18,7 +18,6 @@ import com.google.common.util.concurrent.ListenableFuture; import dagger.producers.ProductionComponent; - import java.util.List; @ProductionComponent( diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependentProducerModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependentProducerModule.java index ecfadb0a143..8467ee144b4 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependentProducerModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/DependentProducerModule.java @@ -22,7 +22,6 @@ import com.google.common.util.concurrent.ListenableFuture; import dagger.producers.ProducerModule; import dagger.producers.Produces; - import java.util.List; @ProducerModule diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingModule.java index 6ace5fc5f66..969cb9fad2b 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingModule.java @@ -28,8 +28,8 @@ import java.util.Map; import java.util.Set; import producerstest.multibindings.Qualifiers.EmptyButDeclaredInModule; -import producerstest.multibindings.Qualifiers.OnlyProvisionMultibindings; import producerstest.multibindings.Qualifiers.EmptyButDeclaredInModuleAndProducerModule; +import producerstest.multibindings.Qualifiers.OnlyProvisionMultibindings; @Module abstract class MultibindingModule { diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingProducerModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingProducerModule.java index 24c5bfe883f..3ffbcb37c39 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingProducerModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/MultibindingProducerModule.java @@ -29,8 +29,8 @@ import dagger.producers.Produces; import java.util.Map; import java.util.Set; -import producerstest.multibindings.Qualifiers.ObjCount; import producerstest.multibindings.Qualifiers.EmptyButDeclaredInModuleAndProducerModule; +import producerstest.multibindings.Qualifiers.ObjCount; import producerstest.multibindings.Qualifiers.PossiblyThrowingMap; import producerstest.multibindings.Qualifiers.PossiblyThrowingSet; diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/Qualifiers.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/Qualifiers.java index 6a3fad105ba..3a2f359e989 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/Qualifiers.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/multibindings/Qualifiers.java @@ -16,12 +16,12 @@ package producerstest.multibindings; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import java.lang.annotation.Documented; import java.lang.annotation.Retention; import javax.inject.Qualifier; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - final class Qualifiers { @Documented @Retention(RUNTIME) diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/provisions/Provisions.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/provisions/Provisions.java index d9020fc6221..779c7277e61 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/provisions/Provisions.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/provisions/Provisions.java @@ -22,9 +22,8 @@ import dagger.producers.Produces; import dagger.producers.ProductionComponent; import javax.inject.Inject; -import producerstest.ExecutorModule; - import javax.inject.Qualifier; +import producerstest.ExecutorModule; /** Tests for requesting provisions from producers. */ final class Provisions { diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/DependentTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/DependentTest.java index a3bcf01974f..7298a4258a6 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/DependentTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/DependentTest.java @@ -16,14 +16,14 @@ package producerstest; +import static com.google.common.truth.Truth.assertThat; + import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; - @RunWith(JUnit4.class) public class DependentTest { @Test public void dependentComponent() throws Exception { diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/ProducerFactoryTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/ProducerFactoryTest.java index 125737b108e..6da997702e5 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/ProducerFactoryTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/ProducerFactoryTest.java @@ -16,6 +16,12 @@ package producerstest; +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.when; + import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.SettableFuture; @@ -35,12 +41,6 @@ import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.when; - @RunWith(JUnit4.class) public class ProducerFactoryTest { @Mock private ProductionComponentMonitor componentMonitor; diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/SimpleTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/SimpleTest.java index 1e0d82ea39e..5c52e0382fd 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/SimpleTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/SimpleTest.java @@ -16,12 +16,12 @@ package producerstest; +import static com.google.common.truth.Truth.assertThat; + import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; - @RunWith(JUnit4.class) public class SimpleTest { @Test public void testSimpleComponent() throws Exception { diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/badexecutor/BadExecutorTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/badexecutor/BadExecutorTest.java index 1f0db70b2a8..39ff83e1202 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/badexecutor/BadExecutorTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/badexecutor/BadExecutorTest.java @@ -1,5 +1,8 @@ package producerstest.badexecutor; +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.fail; + import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListeningExecutorService; @@ -12,9 +15,6 @@ import org.junit.runners.JUnit4; import producerstest.ExecutorModule; -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.fail; - /** This test verifies behavior when the executor throws {@link RejectedExecutionException}. */ @RunWith(JUnit4.class) public final class BadExecutorTest { diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/binds/BindsProducersTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/binds/BindsProducersTest.java index cde5824e198..42ebe6889ab 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/binds/BindsProducersTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/binds/BindsProducersTest.java @@ -16,6 +16,8 @@ package producerstest.binds; +import static com.google.common.truth.Truth.assertThat; + import com.google.common.collect.ImmutableMap; import dagger.producers.Produced; import dagger.producers.Producer; @@ -25,8 +27,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; - @RunWith(JUnit4.class) public class BindsProducersTest { diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/builder/ProductionComponentBuilderTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/builder/ProductionComponentBuilderTest.java index e57e4d19f79..ece750fc7e0 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/builder/ProductionComponentBuilderTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/builder/ProductionComponentBuilderTest.java @@ -16,14 +16,14 @@ package producerstest.builder; +import static com.google.common.truth.Truth.assertThat; + import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; - /** Tests for {@link dagger.producers.ProductionComponent.Builder}. */ @RunWith(JUnit4.class) public final class ProductionComponentBuilderTest { diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/monitoring/MonitoringTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/monitoring/MonitoringTest.java index 1b94df479a1..57691f0804c 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/monitoring/MonitoringTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/monitoring/MonitoringTest.java @@ -16,6 +16,14 @@ package producerstest.monitoring; +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + import com.google.common.base.Throwables; import com.google.common.collect.ImmutableList; import com.google.common.util.concurrent.ListenableFuture; @@ -34,14 +42,6 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; - /** Tests for production components using monitoring. */ @RunWith(JUnit4.class) public final class MonitoringTest { diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/multibindings/MultibindingTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/multibindings/MultibindingTest.java index 668b3507ada..98b408633b8 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/multibindings/MultibindingTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/multibindings/MultibindingTest.java @@ -16,6 +16,9 @@ package producerstest.multibindings; +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.fail; + import com.google.common.collect.Iterables; import com.google.common.util.concurrent.ListenableFuture; import dagger.producers.Produced; @@ -28,9 +31,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.fail; - @RunWith(JUnit4.class) public class MultibindingTest { @Test diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/provisions/ProvisionsTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/provisions/ProvisionsTest.java index 7e1e4a11965..53543f96245 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/provisions/ProvisionsTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/provisions/ProvisionsTest.java @@ -16,6 +16,8 @@ package producerstest.provisions; +import static com.google.common.truth.Truth.assertThat; + import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -23,8 +25,6 @@ import producerstest.provisions.Provisions.Output; import producerstest.provisions.Provisions.TestComponent; -import static com.google.common.truth.Truth.assertThat; - @RunWith(JUnit4.class) public final class ProvisionsTest { diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/scope/ScopeTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/scope/ScopeTest.java index 436c4587a00..1cffdd3064f 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/scope/ScopeTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/scope/ScopeTest.java @@ -16,12 +16,12 @@ package producerstest.scope; +import static com.google.common.truth.Truth.assertThat; + import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; - @RunWith(JUnit4.class) public final class ScopeTest { diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/subcomponent/MultiPackageSubcomponentTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/subcomponent/MultiPackageSubcomponentTest.java index 3902a5477f7..aca8ea165f1 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/subcomponent/MultiPackageSubcomponentTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/subcomponent/MultiPackageSubcomponentTest.java @@ -18,11 +18,11 @@ import static com.google.common.truth.Truth.assertThat; -import producerstest.subcomponent.MultiPackageSubcomponents.ParentComponent; -import producerstest.subcomponent.sub.ChildComponent; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; +import producerstest.subcomponent.MultiPackageSubcomponents.ParentComponent; +import producerstest.subcomponent.sub.ChildComponent; @RunWith(JUnit4.class) public final class MultiPackageSubcomponentTest { diff --git a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/subcomponent/SubcomponentWithBoundExecutorTest.java b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/subcomponent/SubcomponentWithBoundExecutorTest.java index 2bd0ca49e60..14ae444c890 100644 --- a/compiler/src/it/producers-functional-tests/src/test/java/producerstest/subcomponent/SubcomponentWithBoundExecutorTest.java +++ b/compiler/src/it/producers-functional-tests/src/test/java/producerstest/subcomponent/SubcomponentWithBoundExecutorTest.java @@ -16,6 +16,8 @@ package producerstest.subcomponent; +import static com.google.common.truth.Truth.assertThat; + import java.util.concurrent.atomic.AtomicInteger; import org.junit.Before; import org.junit.Test; @@ -28,8 +30,6 @@ import producerstest.subcomponent.SubcomponentsWithBoundExecutor.ParentComponent; import producerstest.subcomponent.SubcomponentsWithBoundExecutor.ParentProductionComponent; -import static com.google.common.truth.Truth.assertThat; - @RunWith(JUnit4.class) public final class SubcomponentWithBoundExecutorTest { private ParentComponent parentComponent; diff --git a/compiler/src/it/tck/src/main/java/test/tck/CarModule.java b/compiler/src/it/tck/src/main/java/test/tck/CarModule.java index 5eda77c7858..6ef5d3811a7 100644 --- a/compiler/src/it/tck/src/main/java/test/tck/CarModule.java +++ b/compiler/src/it/tck/src/main/java/test/tck/CarModule.java @@ -18,7 +18,6 @@ import dagger.Binds; import dagger.Module; - import org.atinject.tck.auto.Car; import org.atinject.tck.auto.Convertible; diff --git a/compiler/src/it/tck/src/main/java/test/tck/CarShop.java b/compiler/src/it/tck/src/main/java/test/tck/CarShop.java index c47c850246e..73f326d672d 100644 --- a/compiler/src/it/tck/src/main/java/test/tck/CarShop.java +++ b/compiler/src/it/tck/src/main/java/test/tck/CarShop.java @@ -17,8 +17,8 @@ package test.tck; import dagger.Component; -import org.atinject.tck.auto.Car; import javax.inject.Singleton; +import org.atinject.tck.auto.Car; @Singleton @Component( diff --git a/compiler/src/it/tck/src/main/java/test/tck/SeatModule.java b/compiler/src/it/tck/src/main/java/test/tck/SeatModule.java index fecb278a479..e5a90c08e47 100644 --- a/compiler/src/it/tck/src/main/java/test/tck/SeatModule.java +++ b/compiler/src/it/tck/src/main/java/test/tck/SeatModule.java @@ -18,7 +18,6 @@ import dagger.Binds; import dagger.Module; - import org.atinject.tck.auto.Drivers; import org.atinject.tck.auto.DriversSeat; import org.atinject.tck.auto.Seat; diff --git a/compiler/src/it/tck/src/main/java/test/tck/TireModule.java b/compiler/src/it/tck/src/main/java/test/tck/TireModule.java index 66e63346251..8b668eda291 100644 --- a/compiler/src/it/tck/src/main/java/test/tck/TireModule.java +++ b/compiler/src/it/tck/src/main/java/test/tck/TireModule.java @@ -18,12 +18,10 @@ import dagger.Binds; import dagger.Module; - +import javax.inject.Named; import org.atinject.tck.auto.Tire; import org.atinject.tck.auto.accessories.SpareTire; -import javax.inject.Named; - @Module abstract class TireModule { @Binds diff --git a/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java b/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java index a9b75fde189..65bd4dbab84 100644 --- a/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java +++ b/compiler/src/main/java/dagger/internal/codegen/AbstractComponentWriter.java @@ -16,55 +16,6 @@ package dagger.internal.codegen; -import com.google.auto.common.MoreElements; -import com.google.auto.common.MoreTypes; -import com.google.common.base.Joiner; -import com.google.common.base.Optional; -import com.google.common.collect.FluentIterable; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import com.squareup.javapoet.ClassName; -import com.squareup.javapoet.CodeBlock; -import com.squareup.javapoet.FieldSpec; -import com.squareup.javapoet.MethodSpec; -import com.squareup.javapoet.TypeName; -import com.squareup.javapoet.TypeSpec; -import com.squareup.javapoet.TypeVariableName; -import dagger.internal.DelegateFactory; -import dagger.internal.MapFactory; -import dagger.internal.MapProviderFactory; -import dagger.internal.Preconditions; -import dagger.internal.SetFactory; -import dagger.internal.codegen.ComponentDescriptor.BuilderSpec; -import dagger.internal.codegen.ComponentDescriptor.ComponentMethodDescriptor; -import dagger.producers.Produced; -import dagger.producers.Producer; -import dagger.producers.internal.MapOfProducerProducer; -import dagger.producers.internal.MapProducer; -import dagger.producers.internal.SetOfProducedProducer; -import dagger.producers.internal.SetProducer; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import javax.inject.Provider; -import javax.lang.model.element.ExecutableElement; -import javax.lang.model.element.Name; -import javax.lang.model.element.TypeElement; -import javax.lang.model.element.VariableElement; -import javax.lang.model.type.DeclaredType; -import javax.lang.model.type.ExecutableType; -import javax.lang.model.type.TypeKind; -import javax.lang.model.type.TypeMirror; -import javax.lang.model.util.Elements; -import javax.lang.model.util.Types; -import javax.tools.Diagnostic; - import static com.google.common.base.CaseFormat.LOWER_CAMEL; import static com.google.common.base.CaseFormat.UPPER_CAMEL; import static com.google.common.base.Preconditions.checkState; @@ -120,6 +71,55 @@ import static javax.lang.model.type.TypeKind.DECLARED; import static javax.lang.model.type.TypeKind.VOID; +import com.google.auto.common.MoreElements; +import com.google.auto.common.MoreTypes; +import com.google.common.base.Joiner; +import com.google.common.base.Optional; +import com.google.common.collect.FluentIterable; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.squareup.javapoet.ClassName; +import com.squareup.javapoet.CodeBlock; +import com.squareup.javapoet.FieldSpec; +import com.squareup.javapoet.MethodSpec; +import com.squareup.javapoet.TypeName; +import com.squareup.javapoet.TypeSpec; +import com.squareup.javapoet.TypeVariableName; +import dagger.internal.DelegateFactory; +import dagger.internal.MapFactory; +import dagger.internal.MapProviderFactory; +import dagger.internal.Preconditions; +import dagger.internal.SetFactory; +import dagger.internal.codegen.ComponentDescriptor.BuilderSpec; +import dagger.internal.codegen.ComponentDescriptor.ComponentMethodDescriptor; +import dagger.producers.Produced; +import dagger.producers.Producer; +import dagger.producers.internal.MapOfProducerProducer; +import dagger.producers.internal.MapProducer; +import dagger.producers.internal.SetOfProducedProducer; +import dagger.producers.internal.SetProducer; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import javax.inject.Provider; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.Name; +import javax.lang.model.element.TypeElement; +import javax.lang.model.element.VariableElement; +import javax.lang.model.type.DeclaredType; +import javax.lang.model.type.ExecutableType; +import javax.lang.model.type.TypeKind; +import javax.lang.model.type.TypeMirror; +import javax.lang.model.util.Elements; +import javax.lang.model.util.Types; +import javax.tools.Diagnostic; + /** * Creates the implementation class for a component or subcomponent. */ diff --git a/compiler/src/main/java/dagger/internal/codegen/Accessibility.java b/compiler/src/main/java/dagger/internal/codegen/Accessibility.java index 4ea67b9e9d4..bdc921d2be5 100644 --- a/compiler/src/main/java/dagger/internal/codegen/Accessibility.java +++ b/compiler/src/main/java/dagger/internal/codegen/Accessibility.java @@ -16,6 +16,11 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.getPackage; +import static com.google.common.base.Preconditions.checkArgument; +import static javax.lang.model.element.Modifier.PRIVATE; +import static javax.lang.model.element.Modifier.PUBLIC; + import com.google.auto.common.MoreElements; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; @@ -35,11 +40,6 @@ import javax.lang.model.util.SimpleElementVisitor6; import javax.lang.model.util.SimpleTypeVisitor6; -import static com.google.auto.common.MoreElements.getPackage; -import static com.google.common.base.Preconditions.checkArgument; -import static javax.lang.model.element.Modifier.PRIVATE; -import static javax.lang.model.element.Modifier.PUBLIC; - /** * Utility methods for determining whether a {@linkplain TypeMirror type} or an {@linkplain Element * element} is accessible given the rules outlined in diff --git a/compiler/src/main/java/dagger/internal/codegen/Binding.java b/compiler/src/main/java/dagger/internal/codegen/Binding.java index dcbf7219265..569e9ceb6b6 100644 --- a/compiler/src/main/java/dagger/internal/codegen/Binding.java +++ b/compiler/src/main/java/dagger/internal/codegen/Binding.java @@ -16,6 +16,8 @@ package dagger.internal.codegen; +import static javax.lang.model.element.Modifier.PUBLIC; + import com.google.auto.common.MoreElements; import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; @@ -36,8 +38,6 @@ import javax.lang.model.util.SimpleTypeVisitor6; import javax.lang.model.util.Types; -import static javax.lang.model.element.Modifier.PUBLIC; - /** * An abstract type for classes representing a Dagger binding. Particularly, contains the * {@link Element} that generated the binding and the {@link DependencyRequest} instances that are diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java b/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java index 3d5dc81fea3..1c04441cdf1 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingDeclaration.java @@ -16,6 +16,10 @@ package dagger.internal.codegen; +import static dagger.internal.codegen.Util.ENCLOSING_TYPE_ELEMENT; +import static javax.lang.model.element.Modifier.ABSTRACT; +import static javax.lang.model.element.Modifier.STATIC; + import com.google.common.base.Function; import com.google.common.base.Optional; import com.google.common.base.Predicate; @@ -25,10 +29,6 @@ import javax.lang.model.element.Modifier; import javax.lang.model.element.TypeElement; -import static dagger.internal.codegen.Util.ENCLOSING_TYPE_ELEMENT; -import static javax.lang.model.element.Modifier.ABSTRACT; -import static javax.lang.model.element.Modifier.STATIC; - /** An object that declares or specifies a binding. */ abstract class BindingDeclaration implements HasKey { diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java b/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java index 64beaa74565..b88c7cbec85 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingDeclarationFormatter.java @@ -16,13 +16,13 @@ package dagger.internal.codegen; -import com.google.auto.common.MoreElements; -import javax.lang.model.element.Element; - import static com.google.common.base.Preconditions.checkArgument; import static dagger.internal.codegen.ErrorMessages.stripCommonTypePrefixes; import static dagger.internal.codegen.Util.AS_DECLARED_TYPE; +import com.google.auto.common.MoreElements; +import javax.lang.model.element.Element; + /** * Formats a {@link BindingDeclaration} into a {@link String} suitable for use in error messages. */ diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java b/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java index 7c06d0f8741..54a60087f28 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java @@ -16,6 +16,26 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.getAnnotationMirror; +import static com.google.auto.common.MoreElements.hasModifiers; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Predicates.in; +import static com.google.common.base.Predicates.not; +import static com.google.common.base.Verify.verify; +import static com.google.common.collect.Iterables.isEmpty; +import static dagger.internal.codegen.BindingType.isOfType; +import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodDescriptor.isOfKind; +import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodKind.PRODUCTION_SUBCOMPONENT_BUILDER; +import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodKind.SUBCOMPONENT_BUILDER; +import static dagger.internal.codegen.ComponentDescriptor.Kind.PRODUCTION_COMPONENT; +import static dagger.internal.codegen.ComponentDescriptor.isComponentContributionMethod; +import static dagger.internal.codegen.ComponentDescriptor.isComponentProductionMethod; +import static dagger.internal.codegen.ConfigurationAnnotations.getComponentDependencies; +import static dagger.internal.codegen.ContributionBinding.Kind.IS_SYNTHETIC_MULTIBINDING_KIND; +import static dagger.internal.codegen.Key.indexByKey; +import static dagger.internal.codegen.Scope.reusableScope; +import static javax.lang.model.element.Modifier.ABSTRACT; + import com.google.auto.common.MoreTypes; import com.google.auto.value.AutoValue; import com.google.common.base.Function; @@ -36,7 +56,6 @@ import com.google.common.util.concurrent.ListenableFuture; import dagger.Component; import dagger.Reusable; -import dagger.Subcomponent; import dagger.internal.codegen.ComponentDescriptor.ComponentMethodDescriptor; import dagger.internal.codegen.Key.HasKey; import dagger.producers.Produced; @@ -61,26 +80,6 @@ import javax.lang.model.util.ElementFilter; import javax.lang.model.util.Elements; -import static com.google.auto.common.MoreElements.getAnnotationMirror; -import static com.google.auto.common.MoreElements.hasModifiers; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Predicates.in; -import static com.google.common.base.Predicates.not; -import static com.google.common.base.Verify.verify; -import static com.google.common.collect.Iterables.isEmpty; -import static dagger.internal.codegen.BindingType.isOfType; -import static dagger.internal.codegen.ComponentDescriptor.isComponentContributionMethod; -import static dagger.internal.codegen.ComponentDescriptor.isComponentProductionMethod; -import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodDescriptor.isOfKind; -import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodKind.PRODUCTION_SUBCOMPONENT_BUILDER; -import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodKind.SUBCOMPONENT_BUILDER; -import static dagger.internal.codegen.ComponentDescriptor.Kind.PRODUCTION_COMPONENT; -import static dagger.internal.codegen.ConfigurationAnnotations.getComponentDependencies; -import static dagger.internal.codegen.ContributionBinding.Kind.IS_SYNTHETIC_MULTIBINDING_KIND; -import static dagger.internal.codegen.Key.indexByKey; -import static dagger.internal.codegen.Scope.reusableScope; -import static javax.lang.model.element.Modifier.ABSTRACT; - /** * The canonical representation of a full-resolved graph. * diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java b/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java index f6be78d24db..531845dcd6f 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java @@ -16,6 +16,48 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.getAnnotationMirror; +import static com.google.auto.common.MoreTypes.asDeclared; +import static com.google.auto.common.MoreTypes.asExecutable; +import static com.google.auto.common.MoreTypes.asTypeElements; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkState; +import static com.google.common.base.Predicates.equalTo; +import static com.google.common.base.Predicates.in; +import static com.google.common.base.Predicates.not; +import static com.google.common.base.Predicates.or; +import static com.google.common.base.Verify.verify; +import static com.google.common.collect.Iterables.getOnlyElement; +import static com.google.common.collect.Iterables.indexOf; +import static com.google.common.collect.Maps.filterKeys; +import static dagger.internal.codegen.BindingDeclaration.HAS_BINDING_ELEMENT; +import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodDescriptor.isOfKind; +import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodKind.PRODUCTION_SUBCOMPONENT; +import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodKind.SUBCOMPONENT; +import static dagger.internal.codegen.ConfigurationAnnotations.getComponentDependencies; +import static dagger.internal.codegen.ContributionBinding.Kind.INJECTION; +import static dagger.internal.codegen.ContributionBinding.Kind.SYNTHETIC_MULTIBOUND_MAP; +import static dagger.internal.codegen.ContributionBinding.indexMapBindingsByAnnotationType; +import static dagger.internal.codegen.ContributionBinding.indexMapBindingsByMapKey; +import static dagger.internal.codegen.ContributionType.indexByContributionType; +import static dagger.internal.codegen.ErrorMessages.CANNOT_INJECT_WILDCARD_TYPE; +import static dagger.internal.codegen.ErrorMessages.CONTAINS_DEPENDENCY_CYCLE_FORMAT; +import static dagger.internal.codegen.ErrorMessages.DUPLICATE_SIZE_LIMIT; +import static dagger.internal.codegen.ErrorMessages.INDENT; +import static dagger.internal.codegen.ErrorMessages.MEMBERS_INJECTION_WITH_UNBOUNDED_TYPE; +import static dagger.internal.codegen.ErrorMessages.MULTIPLE_CONTRIBUTION_TYPES_FOR_KEY_FORMAT; +import static dagger.internal.codegen.ErrorMessages.REQUIRES_AT_INJECT_CONSTRUCTOR_OR_PROVIDER_FORMAT; +import static dagger.internal.codegen.ErrorMessages.REQUIRES_AT_INJECT_CONSTRUCTOR_OR_PROVIDER_OR_PRODUCER_FORMAT; +import static dagger.internal.codegen.ErrorMessages.REQUIRES_PROVIDER_FORMAT; +import static dagger.internal.codegen.ErrorMessages.REQUIRES_PROVIDER_OR_PRODUCER_FORMAT; +import static dagger.internal.codegen.ErrorMessages.duplicateMapKeysError; +import static dagger.internal.codegen.ErrorMessages.inconsistentMapKeyAnnotationsError; +import static dagger.internal.codegen.ErrorMessages.nullableToNonNullable; +import static dagger.internal.codegen.ErrorMessages.stripCommonTypePrefixes; +import static dagger.internal.codegen.Scope.reusableScope; +import static dagger.internal.codegen.Util.componentCanMakeNewInstances; +import static javax.tools.Diagnostic.Kind.ERROR; + import com.google.auto.common.MoreElements; import com.google.auto.common.MoreTypes; import com.google.auto.value.AutoValue; @@ -69,48 +111,6 @@ import javax.lang.model.util.SimpleTypeVisitor6; import javax.lang.model.util.Types; -import static com.google.auto.common.MoreElements.getAnnotationMirror; -import static com.google.auto.common.MoreTypes.asDeclared; -import static com.google.auto.common.MoreTypes.asExecutable; -import static com.google.auto.common.MoreTypes.asTypeElements; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkState; -import static com.google.common.base.Predicates.equalTo; -import static com.google.common.base.Predicates.in; -import static com.google.common.base.Predicates.not; -import static com.google.common.base.Predicates.or; -import static com.google.common.base.Verify.verify; -import static com.google.common.collect.Iterables.getOnlyElement; -import static com.google.common.collect.Iterables.indexOf; -import static com.google.common.collect.Maps.filterKeys; -import static dagger.internal.codegen.BindingDeclaration.HAS_BINDING_ELEMENT; -import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodDescriptor.isOfKind; -import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodKind.PRODUCTION_SUBCOMPONENT; -import static dagger.internal.codegen.ComponentDescriptor.ComponentMethodKind.SUBCOMPONENT; -import static dagger.internal.codegen.ConfigurationAnnotations.getComponentDependencies; -import static dagger.internal.codegen.ContributionBinding.indexMapBindingsByAnnotationType; -import static dagger.internal.codegen.ContributionBinding.indexMapBindingsByMapKey; -import static dagger.internal.codegen.ContributionBinding.Kind.INJECTION; -import static dagger.internal.codegen.ContributionBinding.Kind.SYNTHETIC_MULTIBOUND_MAP; -import static dagger.internal.codegen.ContributionType.indexByContributionType; -import static dagger.internal.codegen.ErrorMessages.CANNOT_INJECT_WILDCARD_TYPE; -import static dagger.internal.codegen.ErrorMessages.CONTAINS_DEPENDENCY_CYCLE_FORMAT; -import static dagger.internal.codegen.ErrorMessages.DUPLICATE_SIZE_LIMIT; -import static dagger.internal.codegen.ErrorMessages.INDENT; -import static dagger.internal.codegen.ErrorMessages.MEMBERS_INJECTION_WITH_UNBOUNDED_TYPE; -import static dagger.internal.codegen.ErrorMessages.MULTIPLE_CONTRIBUTION_TYPES_FOR_KEY_FORMAT; -import static dagger.internal.codegen.ErrorMessages.REQUIRES_AT_INJECT_CONSTRUCTOR_OR_PROVIDER_FORMAT; -import static dagger.internal.codegen.ErrorMessages.REQUIRES_AT_INJECT_CONSTRUCTOR_OR_PROVIDER_OR_PRODUCER_FORMAT; -import static dagger.internal.codegen.ErrorMessages.REQUIRES_PROVIDER_FORMAT; -import static dagger.internal.codegen.ErrorMessages.REQUIRES_PROVIDER_OR_PRODUCER_FORMAT; -import static dagger.internal.codegen.ErrorMessages.duplicateMapKeysError; -import static dagger.internal.codegen.ErrorMessages.inconsistentMapKeyAnnotationsError; -import static dagger.internal.codegen.ErrorMessages.nullableToNonNullable; -import static dagger.internal.codegen.ErrorMessages.stripCommonTypePrefixes; -import static dagger.internal.codegen.Scope.reusableScope; -import static dagger.internal.codegen.Util.componentCanMakeNewInstances; -import static javax.tools.Diagnostic.Kind.ERROR; - /** Reports errors in the shape of the binding graph. */ final class BindingGraphValidator { diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingMethodValidator.java b/compiler/src/main/java/dagger/internal/codegen/BindingMethodValidator.java index cc3fad5a799..3b1c68bc2ca 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingMethodValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingMethodValidator.java @@ -16,30 +16,6 @@ package dagger.internal.codegen; -import com.google.common.base.Function; -import com.google.common.base.Joiner; -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.google.common.collect.FluentIterable; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Lists; -import dagger.MapKey; -import dagger.Provides; -import dagger.multibindings.ElementsIntoSet; -import dagger.multibindings.IntoMap; -import dagger.producers.Produces; -import java.lang.annotation.Annotation; -import javax.annotation.OverridingMethodsMustInvokeSuper; -import javax.annotation.processing.Messager; -import javax.inject.Qualifier; -import javax.lang.model.element.AnnotationMirror; -import javax.lang.model.element.ExecutableElement; -import javax.lang.model.type.TypeKind; -import javax.lang.model.type.TypeMirror; -import javax.lang.model.util.Elements; -import javax.lang.model.util.Types; - import static com.google.auto.common.MoreElements.getAnnotationMirror; import static dagger.internal.codegen.ErrorMessages.BINDING_METHOD_ABSTRACT; import static dagger.internal.codegen.ErrorMessages.BINDING_METHOD_MULTIPLE_QUALIFIERS; @@ -70,6 +46,29 @@ import static javax.lang.model.type.TypeKind.TYPEVAR; import static javax.lang.model.type.TypeKind.VOID; +import com.google.common.base.Function; +import com.google.common.base.Joiner; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import com.google.common.collect.FluentIterable; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import dagger.MapKey; +import dagger.Provides; +import dagger.multibindings.ElementsIntoSet; +import dagger.multibindings.IntoMap; +import dagger.producers.Produces; +import java.lang.annotation.Annotation; +import javax.annotation.OverridingMethodsMustInvokeSuper; +import javax.annotation.processing.Messager; +import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.type.TypeKind; +import javax.lang.model.type.TypeMirror; +import javax.lang.model.util.Elements; +import javax.lang.model.util.Types; + /** A validator for methods that represent binding declarations. */ abstract class BindingMethodValidator { diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingVariableNamer.java b/compiler/src/main/java/dagger/internal/codegen/BindingVariableNamer.java index be55b467b71..70df6d483e0 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingVariableNamer.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingVariableNamer.java @@ -16,14 +16,14 @@ package dagger.internal.codegen; +import static com.google.common.base.CaseFormat.LOWER_CAMEL; +import static com.google.common.base.CaseFormat.UPPER_CAMEL; + import java.util.Iterator; import javax.lang.model.type.DeclaredType; import javax.lang.model.type.TypeMirror; import javax.lang.model.util.SimpleTypeVisitor6; -import static com.google.common.base.CaseFormat.LOWER_CAMEL; -import static com.google.common.base.CaseFormat.UPPER_CAMEL; - /** * Suggests a variable name for a type based on a {@link Binding}. Prefer * {@link DependencyVariableNamer} for cases where a specific {@link DependencyRequest} is present. diff --git a/compiler/src/main/java/dagger/internal/codegen/BindsMethodValidator.java b/compiler/src/main/java/dagger/internal/codegen/BindsMethodValidator.java index e7564ee3c80..eba409ff6af 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindsMethodValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindsMethodValidator.java @@ -16,6 +16,15 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.isAnnotationPresent; +import static com.google.common.collect.Iterables.getOnlyElement; +import static dagger.internal.codegen.BindingMethodValidator.Abstractness.MUST_BE_ABSTRACT; +import static dagger.internal.codegen.BindingMethodValidator.ExceptionSuperclass.RUNTIME_EXCEPTION; +import static dagger.internal.codegen.ErrorMessages.BINDING_METHOD_NOT_MAP_HAS_MAP_KEY; +import static dagger.internal.codegen.ErrorMessages.BINDS_ELEMENTS_INTO_SET_METHOD_RETURN_SET; +import static dagger.internal.codegen.ErrorMessages.BINDS_METHOD_ONE_ASSIGNABLE_PARAMETER; +import static dagger.internal.codegen.MapKeys.getMapKeys; + import com.google.auto.common.MoreElements; import com.google.auto.common.MoreTypes; import com.google.common.collect.ImmutableList; @@ -31,21 +40,12 @@ import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; -import javax.lang.model.type.TypeMirror; import javax.lang.model.type.DeclaredType; +import javax.lang.model.type.TypeMirror; import javax.lang.model.util.ElementFilter; import javax.lang.model.util.Elements; import javax.lang.model.util.Types; -import static com.google.auto.common.MoreElements.isAnnotationPresent; -import static com.google.common.collect.Iterables.getOnlyElement; -import static dagger.internal.codegen.BindingMethodValidator.Abstractness.MUST_BE_ABSTRACT; -import static dagger.internal.codegen.BindingMethodValidator.ExceptionSuperclass.RUNTIME_EXCEPTION; -import static dagger.internal.codegen.ErrorMessages.BINDING_METHOD_NOT_MAP_HAS_MAP_KEY; -import static dagger.internal.codegen.ErrorMessages.BINDS_ELEMENTS_INTO_SET_METHOD_RETURN_SET; -import static dagger.internal.codegen.ErrorMessages.BINDS_METHOD_ONE_ASSIGNABLE_PARAMETER; -import static dagger.internal.codegen.MapKeys.getMapKeys; - /** * A validator for {@link Binds} methods. */ diff --git a/compiler/src/main/java/dagger/internal/codegen/BuilderValidator.java b/compiler/src/main/java/dagger/internal/codegen/BuilderValidator.java index 17e4074e702..cdc8d8f0942 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BuilderValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/BuilderValidator.java @@ -16,6 +16,13 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.isAnnotationPresent; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.collect.Iterables.getOnlyElement; +import static javax.lang.model.element.Modifier.ABSTRACT; +import static javax.lang.model.element.Modifier.PRIVATE; +import static javax.lang.model.element.Modifier.STATIC; + import com.google.auto.common.MoreTypes; import com.google.common.base.Equivalence; import com.google.common.collect.Iterables; @@ -37,13 +44,6 @@ import javax.lang.model.util.Elements; import javax.lang.model.util.Types; -import static com.google.auto.common.MoreElements.isAnnotationPresent; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.collect.Iterables.getOnlyElement; -import static javax.lang.model.element.Modifier.ABSTRACT; -import static javax.lang.model.element.Modifier.PRIVATE; -import static javax.lang.model.element.Modifier.STATIC; - /** * Validates {@link dagger.Component.Builder} annotations. * diff --git a/compiler/src/main/java/dagger/internal/codegen/ComponentDescriptor.java b/compiler/src/main/java/dagger/internal/codegen/ComponentDescriptor.java index 51604fbe129..401c647513d 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ComponentDescriptor.java +++ b/compiler/src/main/java/dagger/internal/codegen/ComponentDescriptor.java @@ -16,6 +16,18 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.getAnnotationMirror; +import static com.google.auto.common.MoreElements.isAnnotationPresent; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Verify.verify; +import static com.google.common.collect.Iterables.getOnlyElement; +import static dagger.internal.codegen.ConfigurationAnnotations.enclosedBuilders; +import static dagger.internal.codegen.ConfigurationAnnotations.getComponentDependencies; +import static dagger.internal.codegen.ConfigurationAnnotations.getComponentModules; +import static dagger.internal.codegen.InjectionAnnotations.getQualifier; +import static javax.lang.model.type.TypeKind.DECLARED; +import static javax.lang.model.type.TypeKind.VOID; + import com.google.auto.common.MoreElements; import com.google.auto.common.MoreTypes; import com.google.auto.value.AutoValue; @@ -54,18 +66,6 @@ import javax.lang.model.util.Elements; import javax.lang.model.util.Types; -import static com.google.auto.common.MoreElements.getAnnotationMirror; -import static com.google.auto.common.MoreElements.isAnnotationPresent; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Verify.verify; -import static com.google.common.collect.Iterables.getOnlyElement; -import static dagger.internal.codegen.ConfigurationAnnotations.enclosedBuilders; -import static dagger.internal.codegen.ConfigurationAnnotations.getComponentDependencies; -import static dagger.internal.codegen.ConfigurationAnnotations.getComponentModules; -import static dagger.internal.codegen.InjectionAnnotations.getQualifier; -import static javax.lang.model.type.TypeKind.DECLARED; -import static javax.lang.model.type.TypeKind.VOID; - /** * The logical representation of a {@link Component} or {@link ProductionComponent} definition. * diff --git a/compiler/src/main/java/dagger/internal/codegen/ComponentHierarchyValidator.java b/compiler/src/main/java/dagger/internal/codegen/ComponentHierarchyValidator.java index c9d10f332ba..217c5008b57 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ComponentHierarchyValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/ComponentHierarchyValidator.java @@ -16,6 +16,8 @@ package dagger.internal.codegen; +import static com.google.common.base.Functions.constant; + import com.google.auto.common.MoreTypes; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; @@ -25,8 +27,6 @@ import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; -import static com.google.common.base.Functions.constant; - /** * Validates the relationships between parent components and subcomponents. */ diff --git a/compiler/src/main/java/dagger/internal/codegen/ComponentProcessor.java b/compiler/src/main/java/dagger/internal/codegen/ComponentProcessor.java index c0c5aa11d47..c8ba5ba6d70 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ComponentProcessor.java +++ b/compiler/src/main/java/dagger/internal/codegen/ComponentProcessor.java @@ -16,6 +16,9 @@ package dagger.internal.codegen; +import static dagger.internal.codegen.ModuleProcessingStep.moduleProcessingStep; +import static dagger.internal.codegen.ModuleProcessingStep.producerModuleProcessingStep; + import com.google.auto.common.BasicAnnotationProcessor; import com.google.auto.service.AutoService; import com.google.common.collect.ImmutableList; @@ -27,9 +30,6 @@ import javax.lang.model.util.Elements; import javax.lang.model.util.Types; -import static dagger.internal.codegen.ModuleProcessingStep.moduleProcessingStep; -import static dagger.internal.codegen.ModuleProcessingStep.producerModuleProcessingStep; - /** * The annotation processor responsible for generating the classes that drive the Dagger 2.0 * implementation. diff --git a/compiler/src/main/java/dagger/internal/codegen/ComponentValidator.java b/compiler/src/main/java/dagger/internal/codegen/ComponentValidator.java index 56f5ea37d68..ed5a3479989 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ComponentValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/ComponentValidator.java @@ -16,6 +16,16 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.getAnnotationMirror; +import static dagger.internal.codegen.ConfigurationAnnotations.enclosedBuilders; +import static dagger.internal.codegen.ConfigurationAnnotations.getComponentModules; +import static dagger.internal.codegen.ConfigurationAnnotations.getTransitiveModules; +import static dagger.internal.codegen.ErrorMessages.COMPONENT_ANNOTATED_REUSABLE; +import static javax.lang.model.element.ElementKind.CLASS; +import static javax.lang.model.element.ElementKind.INTERFACE; +import static javax.lang.model.element.Modifier.ABSTRACT; +import static javax.lang.model.type.TypeKind.VOID; + import com.google.auto.common.MoreElements; import com.google.auto.common.MoreTypes; import com.google.auto.value.AutoValue; @@ -48,16 +58,6 @@ import javax.lang.model.util.SimpleTypeVisitor6; import javax.lang.model.util.Types; -import static com.google.auto.common.MoreElements.getAnnotationMirror; -import static dagger.internal.codegen.ConfigurationAnnotations.enclosedBuilders; -import static dagger.internal.codegen.ConfigurationAnnotations.getComponentModules; -import static dagger.internal.codegen.ConfigurationAnnotations.getTransitiveModules; -import static dagger.internal.codegen.ErrorMessages.COMPONENT_ANNOTATED_REUSABLE; -import static javax.lang.model.element.ElementKind.CLASS; -import static javax.lang.model.element.ElementKind.INTERFACE; -import static javax.lang.model.element.Modifier.ABSTRACT; -import static javax.lang.model.type.TypeKind.VOID; - /** * Performs superficial validation of the contract of the {@link Component} and * {@link ProductionComponent} annotations. diff --git a/compiler/src/main/java/dagger/internal/codegen/ComponentWriter.java b/compiler/src/main/java/dagger/internal/codegen/ComponentWriter.java index 3d0b43b4d35..1237643facf 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ComponentWriter.java +++ b/compiler/src/main/java/dagger/internal/codegen/ComponentWriter.java @@ -16,6 +16,14 @@ package dagger.internal.codegen; +import static com.squareup.javapoet.MethodSpec.methodBuilder; +import static com.squareup.javapoet.TypeSpec.classBuilder; +import static dagger.internal.codegen.TypeSpecs.addSupertype; +import static dagger.internal.codegen.Util.requiresAPassedInstance; +import static javax.lang.model.element.Modifier.FINAL; +import static javax.lang.model.element.Modifier.PUBLIC; +import static javax.lang.model.element.Modifier.STATIC; + import com.google.common.base.Function; import com.google.common.base.Joiner; import com.google.common.base.Predicate; @@ -37,14 +45,6 @@ import javax.lang.model.util.Elements; import javax.lang.model.util.Types; -import static com.squareup.javapoet.MethodSpec.methodBuilder; -import static com.squareup.javapoet.TypeSpec.classBuilder; -import static dagger.internal.codegen.TypeSpecs.addSupertype; -import static dagger.internal.codegen.Util.requiresAPassedInstance; -import static javax.lang.model.element.Modifier.FINAL; -import static javax.lang.model.element.Modifier.PUBLIC; -import static javax.lang.model.element.Modifier.STATIC; - /** * Creates the implementation class for a component. */ diff --git a/compiler/src/main/java/dagger/internal/codegen/ConfigurationAnnotations.java b/compiler/src/main/java/dagger/internal/codegen/ConfigurationAnnotations.java index 8774e471d6a..e66efd92425 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ConfigurationAnnotations.java +++ b/compiler/src/main/java/dagger/internal/codegen/ConfigurationAnnotations.java @@ -16,6 +16,10 @@ package dagger.internal.codegen; +import static com.google.auto.common.AnnotationMirrors.getAnnotationValue; +import static com.google.auto.common.MoreElements.getAnnotationMirror; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.auto.common.MoreElements; import com.google.auto.common.MoreTypes; import com.google.common.base.Function; @@ -46,10 +50,6 @@ import javax.lang.model.util.SimpleAnnotationValueVisitor6; import javax.lang.model.util.Types; -import static com.google.auto.common.AnnotationMirrors.getAnnotationValue; -import static com.google.auto.common.MoreElements.getAnnotationMirror; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Utility methods related to dagger configuration annotations (e.g.: {@link Component} * and {@link Module}). diff --git a/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java b/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java index c663e7f328c..24e788f48b5 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/ContributionBinding.java @@ -16,6 +16,14 @@ package dagger.internal.codegen; +import static com.google.common.collect.Sets.immutableEnumSet; +import static dagger.internal.codegen.ContributionBinding.FactoryCreationStrategy.CLASS_CONSTRUCTOR; +import static dagger.internal.codegen.ContributionBinding.FactoryCreationStrategy.DELEGATE; +import static dagger.internal.codegen.ContributionBinding.FactoryCreationStrategy.ENUM_INSTANCE; +import static dagger.internal.codegen.ContributionBinding.Kind.IS_SYNTHETIC_KIND; +import static dagger.internal.codegen.MapKeys.unwrapValue; +import static dagger.internal.codegen.MoreAnnotationMirrors.unwrapOptionalEquivalence; + import com.google.auto.common.MoreTypes; import com.google.common.base.Equivalence; import com.google.common.base.Equivalence.Wrapper; @@ -33,7 +41,6 @@ import dagger.Provides; import dagger.internal.codegen.ContributionType.HasContributionType; import dagger.producers.Produces; -import dagger.producers.ProductionComponent; import java.util.Set; import javax.inject.Inject; import javax.lang.model.element.AnnotationMirror; @@ -43,14 +50,6 @@ import javax.lang.model.type.DeclaredType; import javax.lang.model.type.TypeMirror; -import static com.google.common.collect.Sets.immutableEnumSet; -import static dagger.internal.codegen.ContributionBinding.FactoryCreationStrategy.CLASS_CONSTRUCTOR; -import static dagger.internal.codegen.ContributionBinding.FactoryCreationStrategy.DELEGATE; -import static dagger.internal.codegen.ContributionBinding.FactoryCreationStrategy.ENUM_INSTANCE; -import static dagger.internal.codegen.ContributionBinding.Kind.IS_SYNTHETIC_KIND; -import static dagger.internal.codegen.MapKeys.unwrapValue; -import static dagger.internal.codegen.MoreAnnotationMirrors.unwrapOptionalEquivalence; - /** * An abstract class for a value object representing the mechanism by which a {@link Key} can be * contributed to a dependency graph. diff --git a/compiler/src/main/java/dagger/internal/codegen/ContributionType.java b/compiler/src/main/java/dagger/internal/codegen/ContributionType.java index ec45c6df2d2..ebf26e91c17 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ContributionType.java +++ b/compiler/src/main/java/dagger/internal/codegen/ContributionType.java @@ -16,6 +16,8 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.isAnnotationPresent; + import com.google.common.base.Function; import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.Multimaps; @@ -26,8 +28,6 @@ import dagger.producers.Produces; import javax.lang.model.element.ExecutableElement; -import static com.google.auto.common.MoreElements.isAnnotationPresent; - /** * Whether a binding or declaration is for a unique contribution or a map or set multibinding. */ diff --git a/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java b/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java index e9cfc78a113..599c3c15fa4 100644 --- a/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java +++ b/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java @@ -16,6 +16,10 @@ package dagger.internal.codegen; +import static com.google.common.base.Preconditions.checkArgument; +import static dagger.internal.codegen.MapKeys.getMapKey; +import static dagger.internal.codegen.MoreAnnotationMirrors.wrapOptionalInEquivalence; + import com.google.auto.common.MoreElements; import com.google.auto.common.MoreTypes; import com.google.auto.value.AutoValue; @@ -31,10 +35,6 @@ import javax.lang.model.type.ExecutableType; import javax.lang.model.util.Types; -import static com.google.common.base.Preconditions.checkArgument; -import static dagger.internal.codegen.MapKeys.getMapKey; -import static dagger.internal.codegen.MoreAnnotationMirrors.wrapOptionalInEquivalence; - /** * The declaration for a delegate binding established by a {@link Binds} method. */ diff --git a/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java b/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java index e8be0963763..977221af45e 100644 --- a/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java +++ b/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java @@ -16,6 +16,15 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreTypes.asDeclared; +import static com.google.auto.common.MoreTypes.isType; +import static com.google.auto.common.MoreTypes.isTypeOf; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Preconditions.checkState; +import static com.google.common.collect.Iterables.getOnlyElement; +import static javax.lang.model.util.ElementFilter.constructorsIn; + import com.google.auto.common.MoreTypes; import com.google.auto.value.AutoValue; import com.google.common.base.Function; @@ -47,15 +56,6 @@ import javax.lang.model.util.Elements; import javax.lang.model.util.SimpleTypeVisitor7; -import static com.google.auto.common.MoreTypes.asDeclared; -import static com.google.auto.common.MoreTypes.isType; -import static com.google.auto.common.MoreTypes.isTypeOf; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; -import static com.google.common.collect.Iterables.getOnlyElement; -import static javax.lang.model.util.ElementFilter.constructorsIn; - /** * Represents a request for a key at an injection point. Parameters to {@link Inject} constructors * or {@link Provides} methods are examples of key requests. diff --git a/compiler/src/main/java/dagger/internal/codegen/DependencyRequestFormatter.java b/compiler/src/main/java/dagger/internal/codegen/DependencyRequestFormatter.java index dec1df97544..b0131883be8 100644 --- a/compiler/src/main/java/dagger/internal/codegen/DependencyRequestFormatter.java +++ b/compiler/src/main/java/dagger/internal/codegen/DependencyRequestFormatter.java @@ -16,6 +16,9 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.asExecutable; +import static dagger.internal.codegen.ErrorMessages.INDENT; + import com.google.auto.common.MoreElements; import com.google.common.base.Joiner; import com.google.common.base.Optional; @@ -35,9 +38,6 @@ import javax.lang.model.util.Elements; import javax.lang.model.util.Types; -import static com.google.auto.common.MoreElements.asExecutable; -import static dagger.internal.codegen.ErrorMessages.INDENT; - /** * Formats a {@link DependencyRequest} into a {@link String} suitable for an error message listing * a chain of dependencies. diff --git a/compiler/src/main/java/dagger/internal/codegen/DependencyRequestMapper.java b/compiler/src/main/java/dagger/internal/codegen/DependencyRequestMapper.java index e667e6d952a..1a8f644a153 100644 --- a/compiler/src/main/java/dagger/internal/codegen/DependencyRequestMapper.java +++ b/compiler/src/main/java/dagger/internal/codegen/DependencyRequestMapper.java @@ -16,6 +16,8 @@ package dagger.internal.codegen; +import static com.google.common.collect.Iterables.getOnlyElement; + import com.google.common.base.Function; import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableSet; @@ -23,8 +25,6 @@ import dagger.producers.Producer; import javax.inject.Provider; -import static com.google.common.collect.Iterables.getOnlyElement; - /** * A mapper for associating a {@link DependencyRequest} to a framework class, dependent on * the type of code to be generated (e.g., for {@link Provider} or {@link Producer}). diff --git a/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java b/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java index 9f748b924ce..21d4156b392 100644 --- a/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java @@ -16,29 +16,6 @@ package dagger.internal.codegen; -import com.google.common.base.Optional; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Lists; -import com.squareup.javapoet.ClassName; -import com.squareup.javapoet.CodeBlock; -import com.squareup.javapoet.FieldSpec; -import com.squareup.javapoet.MethodSpec; -import com.squareup.javapoet.ParameterSpec; -import com.squareup.javapoet.ParameterizedTypeName; -import com.squareup.javapoet.TypeName; -import com.squareup.javapoet.TypeSpec; -import com.squareup.javapoet.TypeVariableName; -import dagger.internal.Factory; -import dagger.internal.MembersInjectors; -import dagger.internal.Preconditions; -import java.util.List; -import javax.annotation.processing.Filer; -import javax.inject.Inject; -import javax.lang.model.element.Element; -import javax.lang.model.util.Elements; -import javax.tools.Diagnostic; - import static com.google.common.base.Preconditions.checkArgument; import static com.squareup.javapoet.MethodSpec.constructorBuilder; import static com.squareup.javapoet.MethodSpec.methodBuilder; @@ -62,6 +39,29 @@ import static javax.lang.model.element.Modifier.PUBLIC; import static javax.lang.model.element.Modifier.STATIC; +import com.google.common.base.Optional; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; +import com.squareup.javapoet.ClassName; +import com.squareup.javapoet.CodeBlock; +import com.squareup.javapoet.FieldSpec; +import com.squareup.javapoet.MethodSpec; +import com.squareup.javapoet.ParameterSpec; +import com.squareup.javapoet.ParameterizedTypeName; +import com.squareup.javapoet.TypeName; +import com.squareup.javapoet.TypeSpec; +import com.squareup.javapoet.TypeVariableName; +import dagger.internal.Factory; +import dagger.internal.MembersInjectors; +import dagger.internal.Preconditions; +import java.util.List; +import javax.annotation.processing.Filer; +import javax.inject.Inject; +import javax.lang.model.element.Element; +import javax.lang.model.util.Elements; +import javax.tools.Diagnostic; + /** * Generates {@link Factory} implementations from {@link ProvisionBinding} instances for * {@link Inject} constructors. diff --git a/compiler/src/main/java/dagger/internal/codegen/Formatter.java b/compiler/src/main/java/dagger/internal/codegen/Formatter.java index 9cd62d9bf20..714b63f5ff3 100644 --- a/compiler/src/main/java/dagger/internal/codegen/Formatter.java +++ b/compiler/src/main/java/dagger/internal/codegen/Formatter.java @@ -16,11 +16,11 @@ package dagger.internal.codegen; +import static dagger.internal.codegen.ErrorMessages.INDENT; + import com.google.common.base.Function; import com.google.common.collect.Iterables; -import static dagger.internal.codegen.ErrorMessages.INDENT; - /** * A formatter which transforms an instance of a particular type into a string * representation. diff --git a/compiler/src/main/java/dagger/internal/codegen/FrameworkDependency.java b/compiler/src/main/java/dagger/internal/codegen/FrameworkDependency.java index fd2c0fd20ac..0d69b5d3162 100644 --- a/compiler/src/main/java/dagger/internal/codegen/FrameworkDependency.java +++ b/compiler/src/main/java/dagger/internal/codegen/FrameworkDependency.java @@ -16,6 +16,8 @@ package dagger.internal.codegen; +import static com.google.common.collect.Iterables.getOnlyElement; + import com.google.auto.value.AutoValue; import com.google.common.base.Function; import com.google.common.base.Functions; @@ -29,8 +31,6 @@ import javax.inject.Provider; import javax.lang.model.element.Element; -import static com.google.common.collect.Iterables.getOnlyElement; - /** * The framework class and binding key for a resolved dependency of a binding. If a binding has * several dependencies for a key, then only one instance of this class will represent them all. diff --git a/compiler/src/main/java/dagger/internal/codegen/FrameworkTypes.java b/compiler/src/main/java/dagger/internal/codegen/FrameworkTypes.java index 377735a15fe..19d2eda2d32 100644 --- a/compiler/src/main/java/dagger/internal/codegen/FrameworkTypes.java +++ b/compiler/src/main/java/dagger/internal/codegen/FrameworkTypes.java @@ -16,6 +16,8 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreTypes.isType; + import com.google.auto.common.MoreTypes; import com.google.common.collect.ImmutableSet; import dagger.Lazy; @@ -26,8 +28,6 @@ import javax.inject.Provider; import javax.lang.model.type.TypeMirror; -import static com.google.auto.common.MoreTypes.isType; - /** * A collection of utility methods for dealing with Dagger framework types. A framework type is any * type that the framework itself defines. diff --git a/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java b/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java index 6fdd913b81f..b1b5bac4ce2 100644 --- a/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java +++ b/compiler/src/main/java/dagger/internal/codegen/InjectBindingRegistry.java @@ -16,6 +16,14 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.isAnnotationPresent; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Preconditions.checkState; +import static dagger.internal.codegen.MembersInjectionBinding.Strategy.INJECT_MEMBERS; +import static dagger.internal.codegen.SourceFiles.generatedClassNameForBinding; +import static javax.lang.model.util.ElementFilter.constructorsIn; + import com.google.auto.common.MoreElements; import com.google.auto.common.MoreTypes; import com.google.common.base.Optional; @@ -43,14 +51,6 @@ import javax.lang.model.util.Types; import javax.tools.Diagnostic.Kind; -import static com.google.auto.common.MoreElements.isAnnotationPresent; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; -import static dagger.internal.codegen.MembersInjectionBinding.Strategy.INJECT_MEMBERS; -import static dagger.internal.codegen.SourceFiles.generatedClassNameForBinding; -import static javax.lang.model.util.ElementFilter.constructorsIn; - /** * Maintains the collection of provision bindings from {@link Inject} constructors and members * injection bindings from {@link Inject} fields and methods known to the annotation processor. diff --git a/compiler/src/main/java/dagger/internal/codegen/InjectProcessingStep.java b/compiler/src/main/java/dagger/internal/codegen/InjectProcessingStep.java index 7556a4527b7..2343589f015 100644 --- a/compiler/src/main/java/dagger/internal/codegen/InjectProcessingStep.java +++ b/compiler/src/main/java/dagger/internal/codegen/InjectProcessingStep.java @@ -20,10 +20,8 @@ import com.google.auto.common.MoreElements; import com.google.common.collect.ImmutableSet; import com.google.common.collect.SetMultimap; - import java.lang.annotation.Annotation; import java.util.Set; - import javax.inject.Inject; import javax.lang.model.element.Element; import javax.lang.model.element.ExecutableElement; diff --git a/compiler/src/main/java/dagger/internal/codegen/InjectValidator.java b/compiler/src/main/java/dagger/internal/codegen/InjectValidator.java index b3c4428ccb1..c22e38a32fd 100644 --- a/compiler/src/main/java/dagger/internal/codegen/InjectValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/InjectValidator.java @@ -16,26 +16,6 @@ package dagger.internal.codegen; -import com.google.auto.common.MoreElements; -import com.google.auto.common.MoreTypes; -import com.google.common.base.Optional; -import com.google.common.base.Predicate; -import com.google.common.collect.FluentIterable; -import com.google.common.collect.ImmutableSet; -import java.util.Set; -import javax.inject.Inject; -import javax.lang.model.element.AnnotationMirror; -import javax.lang.model.element.ExecutableElement; -import javax.lang.model.element.Modifier; -import javax.lang.model.element.TypeElement; -import javax.lang.model.element.VariableElement; -import javax.lang.model.type.TypeKind; -import javax.lang.model.type.TypeMirror; -import javax.lang.model.util.ElementFilter; -import javax.lang.model.util.Elements; -import javax.lang.model.util.Types; -import javax.tools.Diagnostic; - import static com.google.auto.common.MoreElements.isAnnotationPresent; import static dagger.internal.codegen.Accessibility.isElementAccessibleFromOwnPackage; import static dagger.internal.codegen.ErrorMessages.ABSTRACT_INJECT_METHOD; @@ -51,11 +31,11 @@ import static dagger.internal.codegen.ErrorMessages.MULTIPLE_SCOPES; import static dagger.internal.codegen.ErrorMessages.PRIVATE_INJECT_FIELD; import static dagger.internal.codegen.ErrorMessages.PRIVATE_INJECT_METHOD; -import static dagger.internal.codegen.ErrorMessages.provisionMayNotDependOnProducerType; import static dagger.internal.codegen.ErrorMessages.QUALIFIER_ON_INJECT_CONSTRUCTOR; import static dagger.internal.codegen.ErrorMessages.SCOPE_ON_INJECT_CONSTRUCTOR; import static dagger.internal.codegen.ErrorMessages.STATIC_INJECT_FIELD; import static dagger.internal.codegen.ErrorMessages.STATIC_INJECT_METHOD; +import static dagger.internal.codegen.ErrorMessages.provisionMayNotDependOnProducerType; import static dagger.internal.codegen.InjectionAnnotations.getQualifiers; import static dagger.internal.codegen.InjectionAnnotations.getScopes; import static javax.lang.model.element.Modifier.ABSTRACT; @@ -64,6 +44,26 @@ import static javax.lang.model.element.Modifier.STATIC; import static javax.lang.model.type.TypeKind.DECLARED; +import com.google.auto.common.MoreElements; +import com.google.auto.common.MoreTypes; +import com.google.common.base.Optional; +import com.google.common.base.Predicate; +import com.google.common.collect.FluentIterable; +import com.google.common.collect.ImmutableSet; +import java.util.Set; +import javax.inject.Inject; +import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.Modifier; +import javax.lang.model.element.TypeElement; +import javax.lang.model.element.VariableElement; +import javax.lang.model.type.TypeKind; +import javax.lang.model.type.TypeMirror; +import javax.lang.model.util.ElementFilter; +import javax.lang.model.util.Elements; +import javax.lang.model.util.Types; +import javax.tools.Diagnostic; + /** * A {@linkplain ValidationReport validator} for {@link Inject}-annotated elements and the types * that contain them. diff --git a/compiler/src/main/java/dagger/internal/codegen/InjectionAnnotations.java b/compiler/src/main/java/dagger/internal/codegen/InjectionAnnotations.java index 13dd79e3e90..bfc9773dc65 100644 --- a/compiler/src/main/java/dagger/internal/codegen/InjectionAnnotations.java +++ b/compiler/src/main/java/dagger/internal/codegen/InjectionAnnotations.java @@ -16,6 +16,8 @@ package dagger.internal.codegen; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.auto.common.AnnotationMirrors; import com.google.common.base.Optional; import com.google.common.collect.ImmutableSet; @@ -24,8 +26,6 @@ import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.Element; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Utilities relating to annotations defined in the {@code javax.inject} package. * diff --git a/compiler/src/main/java/dagger/internal/codegen/Key.java b/compiler/src/main/java/dagger/internal/codegen/Key.java index 31de3a1a279..ce6cee6f0fe 100644 --- a/compiler/src/main/java/dagger/internal/codegen/Key.java +++ b/compiler/src/main/java/dagger/internal/codegen/Key.java @@ -16,6 +16,18 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.isAnnotationPresent; +import static com.google.auto.common.MoreTypes.asExecutable; +import static com.google.common.base.Optional.presentInstances; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; +import static dagger.internal.codegen.InjectionAnnotations.getQualifier; +import static dagger.internal.codegen.MapKeys.getMapKey; +import static dagger.internal.codegen.MapKeys.getUnwrappedMapKeyType; +import static dagger.internal.codegen.MoreAnnotationMirrors.unwrapOptionalEquivalence; +import static dagger.internal.codegen.MoreAnnotationMirrors.wrapOptionalInEquivalence; +import static javax.lang.model.element.ElementKind.METHOD; + import com.google.auto.common.AnnotationMirrors; import com.google.auto.common.MoreElements; import com.google.auto.common.MoreTypes; @@ -41,7 +53,6 @@ import java.util.Set; import java.util.concurrent.Executor; import javax.inject.Provider; -import javax.inject.Qualifier; import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.ElementKind; import javax.lang.model.element.ExecutableElement; @@ -56,18 +67,6 @@ import javax.lang.model.util.SimpleTypeVisitor6; import javax.lang.model.util.Types; -import static com.google.auto.common.MoreElements.isAnnotationPresent; -import static com.google.auto.common.MoreTypes.asExecutable; -import static com.google.common.base.Optional.presentInstances; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static dagger.internal.codegen.InjectionAnnotations.getQualifier; -import static dagger.internal.codegen.MapKeys.getMapKey; -import static dagger.internal.codegen.MapKeys.getUnwrappedMapKeyType; -import static dagger.internal.codegen.MoreAnnotationMirrors.unwrapOptionalEquivalence; -import static dagger.internal.codegen.MoreAnnotationMirrors.wrapOptionalInEquivalence; -import static javax.lang.model.element.ElementKind.METHOD; - /** * Represents a unique combination of {@linkplain TypeMirror type} and * {@linkplain Qualifier qualifier} to which binding can occur. diff --git a/compiler/src/main/java/dagger/internal/codegen/MapKeyGenerator.java b/compiler/src/main/java/dagger/internal/codegen/MapKeyGenerator.java index 5ff269b5a21..22c329b482b 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MapKeyGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/MapKeyGenerator.java @@ -16,6 +16,17 @@ package dagger.internal.codegen; +import static com.squareup.javapoet.MethodSpec.constructorBuilder; +import static com.squareup.javapoet.MethodSpec.methodBuilder; +import static com.squareup.javapoet.TypeSpec.classBuilder; +import static dagger.internal.codegen.CodeBlocks.makeParametersCodeBlock; +import static dagger.internal.codegen.MapKeys.getMapKeyCreatorClassName; +import static javax.lang.model.element.Modifier.FINAL; +import static javax.lang.model.element.Modifier.PRIVATE; +import static javax.lang.model.element.Modifier.PUBLIC; +import static javax.lang.model.element.Modifier.STATIC; +import static javax.lang.model.util.ElementFilter.methodsIn; + import com.google.auto.common.MoreTypes; import com.google.auto.value.AutoAnnotation; import com.google.auto.value.AutoValue; @@ -40,17 +51,6 @@ import javax.lang.model.util.Elements; import javax.lang.model.util.SimpleTypeVisitor6; -import static com.squareup.javapoet.MethodSpec.constructorBuilder; -import static com.squareup.javapoet.MethodSpec.methodBuilder; -import static com.squareup.javapoet.TypeSpec.classBuilder; -import static dagger.internal.codegen.CodeBlocks.makeParametersCodeBlock; -import static dagger.internal.codegen.MapKeys.getMapKeyCreatorClassName; -import static javax.lang.model.element.Modifier.FINAL; -import static javax.lang.model.element.Modifier.PRIVATE; -import static javax.lang.model.element.Modifier.PUBLIC; -import static javax.lang.model.element.Modifier.STATIC; -import static javax.lang.model.util.ElementFilter.methodsIn; - /** * Generates classes that create annotations required to instantiate {@link MapKey}s. * diff --git a/compiler/src/main/java/dagger/internal/codegen/MapKeyProcessingStep.java b/compiler/src/main/java/dagger/internal/codegen/MapKeyProcessingStep.java index 8eaceac993f..c59715b5043 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MapKeyProcessingStep.java +++ b/compiler/src/main/java/dagger/internal/codegen/MapKeyProcessingStep.java @@ -16,6 +16,10 @@ package dagger.internal.codegen; +import static dagger.internal.codegen.MapKeyGenerator.MapKeyCreatorSpecification.unwrappedMapKeyWithAnnotationValue; +import static dagger.internal.codegen.MapKeyGenerator.MapKeyCreatorSpecification.wrappedMapKey; +import static dagger.internal.codegen.MapKeys.getUnwrappedMapKeyType; + import com.google.auto.common.BasicAnnotationProcessor; import com.google.auto.common.MoreElements; import com.google.auto.common.MoreTypes; @@ -31,10 +35,6 @@ import javax.lang.model.type.DeclaredType; import javax.lang.model.util.Types; -import static dagger.internal.codegen.MapKeyGenerator.MapKeyCreatorSpecification.unwrappedMapKeyWithAnnotationValue; -import static dagger.internal.codegen.MapKeyGenerator.MapKeyCreatorSpecification.wrappedMapKey; -import static dagger.internal.codegen.MapKeys.getUnwrappedMapKeyType; - /** * The annotation processor responsible for validating the mapKey annotation and auto-generate * implementation of annotations marked with {@link MapKey @MapKey} where necessary. diff --git a/compiler/src/main/java/dagger/internal/codegen/MapKeyValidator.java b/compiler/src/main/java/dagger/internal/codegen/MapKeyValidator.java index 4b2b19f8aec..5d565dd1452 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MapKeyValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/MapKeyValidator.java @@ -16,6 +16,11 @@ package dagger.internal.codegen; +import static dagger.internal.codegen.ErrorMessages.MAPKEY_WITHOUT_MEMBERS; +import static dagger.internal.codegen.ErrorMessages.UNWRAPPED_MAP_KEY_WITH_ARRAY_MEMBER; +import static dagger.internal.codegen.ErrorMessages.UNWRAPPED_MAP_KEY_WITH_TOO_MANY_MEMBERS; +import static javax.lang.model.util.ElementFilter.methodsIn; + import dagger.MapKey; import java.util.List; import javax.lang.model.element.Element; @@ -23,11 +28,6 @@ import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeKind; -import static dagger.internal.codegen.ErrorMessages.MAPKEY_WITHOUT_MEMBERS; -import static dagger.internal.codegen.ErrorMessages.UNWRAPPED_MAP_KEY_WITH_ARRAY_MEMBER; -import static dagger.internal.codegen.ErrorMessages.UNWRAPPED_MAP_KEY_WITH_TOO_MANY_MEMBERS; -import static javax.lang.model.util.ElementFilter.methodsIn; - /** * A validator for {@link MapKey} annotations. * diff --git a/compiler/src/main/java/dagger/internal/codegen/MapKeys.java b/compiler/src/main/java/dagger/internal/codegen/MapKeys.java index e24f7ab56db..c086d14209d 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MapKeys.java +++ b/compiler/src/main/java/dagger/internal/codegen/MapKeys.java @@ -16,6 +16,15 @@ package dagger.internal.codegen; +import static com.google.auto.common.AnnotationMirrors.getAnnotatedAnnotations; +import static com.google.auto.common.AnnotationMirrors.getAnnotationValuesWithDefaults; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.collect.Iterables.getOnlyElement; +import static com.google.common.collect.Iterables.transform; +import static dagger.internal.codegen.CodeBlocks.makeParametersCodeBlock; +import static dagger.internal.codegen.SourceFiles.classFileName; +import static javax.lang.model.util.ElementFilter.methodsIn; + import com.google.auto.common.MoreTypes; import com.google.common.base.Function; import com.google.common.base.Optional; @@ -43,15 +52,6 @@ import javax.lang.model.util.SimpleTypeVisitor6; import javax.lang.model.util.Types; -import static com.google.auto.common.AnnotationMirrors.getAnnotatedAnnotations; -import static com.google.auto.common.AnnotationMirrors.getAnnotationValuesWithDefaults; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.collect.Iterables.getOnlyElement; -import static com.google.common.collect.Iterables.transform; -import static dagger.internal.codegen.CodeBlocks.makeParametersCodeBlock; -import static dagger.internal.codegen.SourceFiles.classFileName; -import static javax.lang.model.util.ElementFilter.methodsIn; - /** * Methods for extracting {@link MapKey} annotations and key code blocks from binding elements. */ diff --git a/compiler/src/main/java/dagger/internal/codegen/MapType.java b/compiler/src/main/java/dagger/internal/codegen/MapType.java index 6c38c244235..55c55eb1f4f 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MapType.java +++ b/compiler/src/main/java/dagger/internal/codegen/MapType.java @@ -16,6 +16,9 @@ package dagger.internal.codegen; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkState; + import com.google.auto.common.MoreTypes; import com.google.auto.value.AutoValue; import com.google.common.base.Equivalence; @@ -23,9 +26,6 @@ import javax.lang.model.type.DeclaredType; import javax.lang.model.type.TypeMirror; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkState; - /** * Information about a {@link Map} {@link TypeMirror}. */ diff --git a/compiler/src/main/java/dagger/internal/codegen/MemberSelect.java b/compiler/src/main/java/dagger/internal/codegen/MemberSelect.java index 546af2fee40..99f5ead6fa9 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MemberSelect.java +++ b/compiler/src/main/java/dagger/internal/codegen/MemberSelect.java @@ -16,16 +16,6 @@ package dagger.internal.codegen; -import com.google.common.collect.ImmutableList; -import com.squareup.javapoet.ClassName; -import com.squareup.javapoet.CodeBlock; -import dagger.MembersInjector; -import dagger.internal.MapProviderFactory; -import dagger.producers.internal.MapOfProducerProducer; -import java.util.List; -import java.util.Set; -import javax.lang.model.type.TypeMirror; - import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static dagger.internal.codegen.Accessibility.isTypeAccessibleFrom; @@ -38,6 +28,16 @@ import static dagger.internal.codegen.TypeNames.MEMBERS_INJECTORS; import static dagger.internal.codegen.TypeNames.SET; +import com.google.common.collect.ImmutableList; +import com.squareup.javapoet.ClassName; +import com.squareup.javapoet.CodeBlock; +import dagger.MembersInjector; +import dagger.internal.MapProviderFactory; +import dagger.producers.internal.MapOfProducerProducer; +import java.util.List; +import java.util.Set; +import javax.lang.model.type.TypeMirror; + /** * Represents a {@link com.sun.source.tree.MemberSelectTree} as a {@link CodeBlock}. */ diff --git a/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java b/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java index 070f2c80b7b..deb8d15be31 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/MembersInjectionBinding.java @@ -16,6 +16,13 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.isAnnotationPresent; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Preconditions.checkState; +import static javax.lang.model.element.Modifier.PRIVATE; +import static javax.lang.model.element.Modifier.STATIC; + import com.google.auto.common.MoreElements; import com.google.auto.common.MoreTypes; import com.google.auto.value.AutoValue; @@ -47,13 +54,6 @@ import javax.lang.model.util.Elements; import javax.lang.model.util.Types; -import static com.google.auto.common.MoreElements.isAnnotationPresent; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; -import static javax.lang.model.element.Modifier.PRIVATE; -import static javax.lang.model.element.Modifier.STATIC; - /** * Represents the full members injection of a particular type. * diff --git a/compiler/src/main/java/dagger/internal/codegen/MembersInjectorGenerator.java b/compiler/src/main/java/dagger/internal/codegen/MembersInjectorGenerator.java index d5a40628c60..936d88c91f2 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MembersInjectorGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/MembersInjectorGenerator.java @@ -16,6 +16,25 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.getPackage; +import static com.google.common.base.Preconditions.checkState; +import static com.google.common.collect.Iterables.getOnlyElement; +import static com.squareup.javapoet.MethodSpec.constructorBuilder; +import static com.squareup.javapoet.MethodSpec.methodBuilder; +import static com.squareup.javapoet.TypeSpec.classBuilder; +import static dagger.internal.codegen.AnnotationSpecs.SUPPRESS_WARNINGS_RAWTYPES; +import static dagger.internal.codegen.AnnotationSpecs.SUPPRESS_WARNINGS_UNCHECKED; +import static dagger.internal.codegen.CodeBlocks.makeParametersCodeBlock; +import static dagger.internal.codegen.SourceFiles.bindingTypeElementTypeVariableNames; +import static dagger.internal.codegen.SourceFiles.frameworkTypeUsageStatement; +import static dagger.internal.codegen.SourceFiles.membersInjectorNameForType; +import static dagger.internal.codegen.SourceFiles.parameterizedGeneratedTypeNameForBinding; +import static dagger.internal.codegen.TypeNames.membersInjectorOf; +import static javax.lang.model.element.Modifier.FINAL; +import static javax.lang.model.element.Modifier.PRIVATE; +import static javax.lang.model.element.Modifier.PUBLIC; +import static javax.lang.model.element.Modifier.STATIC; + import com.google.auto.common.MoreElements; import com.google.common.base.CaseFormat; import com.google.common.base.Optional; @@ -49,25 +68,6 @@ import javax.lang.model.util.Elements; import javax.lang.model.util.SimpleTypeVisitor7; -import static com.google.auto.common.MoreElements.getPackage; -import static com.google.common.base.Preconditions.checkState; -import static com.google.common.collect.Iterables.getOnlyElement; -import static com.squareup.javapoet.MethodSpec.constructorBuilder; -import static com.squareup.javapoet.MethodSpec.methodBuilder; -import static com.squareup.javapoet.TypeSpec.classBuilder; -import static dagger.internal.codegen.AnnotationSpecs.SUPPRESS_WARNINGS_RAWTYPES; -import static dagger.internal.codegen.AnnotationSpecs.SUPPRESS_WARNINGS_UNCHECKED; -import static dagger.internal.codegen.CodeBlocks.makeParametersCodeBlock; -import static dagger.internal.codegen.SourceFiles.bindingTypeElementTypeVariableNames; -import static dagger.internal.codegen.SourceFiles.frameworkTypeUsageStatement; -import static dagger.internal.codegen.SourceFiles.membersInjectorNameForType; -import static dagger.internal.codegen.SourceFiles.parameterizedGeneratedTypeNameForBinding; -import static dagger.internal.codegen.TypeNames.membersInjectorOf; -import static javax.lang.model.element.Modifier.FINAL; -import static javax.lang.model.element.Modifier.PRIVATE; -import static javax.lang.model.element.Modifier.PUBLIC; -import static javax.lang.model.element.Modifier.STATIC; - /** * Generates {@link MembersInjector} implementations from {@link MembersInjectionBinding} instances. * diff --git a/compiler/src/main/java/dagger/internal/codegen/MethodSignature.java b/compiler/src/main/java/dagger/internal/codegen/MethodSignature.java index 447ed24ef39..c510e091ceb 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MethodSignature.java +++ b/compiler/src/main/java/dagger/internal/codegen/MethodSignature.java @@ -1,5 +1,7 @@ package dagger.internal.codegen; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.auto.common.MoreTypes; import com.google.auto.value.AutoValue; import com.google.common.base.Equivalence; @@ -7,8 +9,6 @@ import javax.lang.model.type.ExecutableType; import javax.lang.model.type.TypeMirror; -import static com.google.common.base.Preconditions.checkNotNull; - @AutoValue abstract class MethodSignature { abstract String name(); diff --git a/compiler/src/main/java/dagger/internal/codegen/MethodSignatureFormatter.java b/compiler/src/main/java/dagger/internal/codegen/MethodSignatureFormatter.java index 8586314a21c..9e553045857 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MethodSignatureFormatter.java +++ b/compiler/src/main/java/dagger/internal/codegen/MethodSignatureFormatter.java @@ -16,6 +16,9 @@ package dagger.internal.codegen; +import static com.google.common.base.Preconditions.checkState; +import static dagger.internal.codegen.ErrorMessages.stripCommonTypePrefixes; + import com.google.auto.common.MoreElements; import com.google.auto.common.MoreTypes; import com.google.common.base.Optional; @@ -30,9 +33,6 @@ import javax.lang.model.type.TypeMirror; import javax.lang.model.util.Types; -import static com.google.common.base.Preconditions.checkState; -import static dagger.internal.codegen.ErrorMessages.stripCommonTypePrefixes; - /** * Formats the signature of an {@link ExecutableElement} suitable for use in error messages. * diff --git a/compiler/src/main/java/dagger/internal/codegen/ModuleDescriptor.java b/compiler/src/main/java/dagger/internal/codegen/ModuleDescriptor.java index 27f769e687e..bda1fb58466 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ModuleDescriptor.java +++ b/compiler/src/main/java/dagger/internal/codegen/ModuleDescriptor.java @@ -16,6 +16,17 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.getAnnotationMirror; +import static com.google.auto.common.MoreElements.isAnnotationPresent; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkState; +import static com.google.common.base.Verify.verify; +import static dagger.internal.codegen.ConfigurationAnnotations.getModuleIncludes; +import static javax.lang.model.type.TypeKind.DECLARED; +import static javax.lang.model.type.TypeKind.NONE; +import static javax.lang.model.util.ElementFilter.methodsIn; +import static javax.lang.model.util.ElementFilter.typesIn; + import com.google.auto.common.MoreElements; import com.google.auto.common.MoreTypes; import com.google.auto.value.AutoValue; @@ -41,17 +52,6 @@ import javax.lang.model.type.TypeMirror; import javax.lang.model.util.Elements; -import static com.google.auto.common.MoreElements.getAnnotationMirror; -import static com.google.auto.common.MoreElements.isAnnotationPresent; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkState; -import static com.google.common.base.Verify.verify; -import static dagger.internal.codegen.ConfigurationAnnotations.getModuleIncludes; -import static javax.lang.model.type.TypeKind.DECLARED; -import static javax.lang.model.type.TypeKind.NONE; -import static javax.lang.model.util.ElementFilter.methodsIn; -import static javax.lang.model.util.ElementFilter.typesIn; - @AutoValue abstract class ModuleDescriptor { static final Function getModuleElement() { diff --git a/compiler/src/main/java/dagger/internal/codegen/ModuleProcessingStep.java b/compiler/src/main/java/dagger/internal/codegen/ModuleProcessingStep.java index 9a03b976e5c..2d99ece96a6 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ModuleProcessingStep.java +++ b/compiler/src/main/java/dagger/internal/codegen/ModuleProcessingStep.java @@ -16,6 +16,11 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.isAnnotationPresent; +import static dagger.internal.codegen.Util.elementsWithAnnotation; +import static javax.lang.model.util.ElementFilter.methodsIn; +import static javax.lang.model.util.ElementFilter.typesIn; + import com.google.auto.common.BasicAnnotationProcessor.ProcessingStep; import com.google.common.collect.ImmutableSet; import com.google.common.collect.SetMultimap; @@ -32,11 +37,6 @@ import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; -import static com.google.auto.common.MoreElements.isAnnotationPresent; -import static dagger.internal.codegen.Util.elementsWithAnnotation; -import static javax.lang.model.util.ElementFilter.methodsIn; -import static javax.lang.model.util.ElementFilter.typesIn; - /** * A {@link ProcessingStep} that validates module classes and generates factories for binding * methods. diff --git a/compiler/src/main/java/dagger/internal/codegen/ModuleValidator.java b/compiler/src/main/java/dagger/internal/codegen/ModuleValidator.java index e9845c215d7..41ce7a874d3 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ModuleValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/ModuleValidator.java @@ -16,6 +16,24 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.getAnnotationMirror; +import static com.google.auto.common.MoreElements.isAnnotationPresent; +import static com.google.auto.common.Visibility.PRIVATE; +import static com.google.auto.common.Visibility.PUBLIC; +import static com.google.auto.common.Visibility.effectiveVisibilityOfElement; +import static com.google.common.collect.Iterables.any; +import static dagger.internal.codegen.ConfigurationAnnotations.getModuleIncludes; +import static dagger.internal.codegen.ErrorMessages.BINDING_METHOD_WITH_SAME_NAME; +import static dagger.internal.codegen.ErrorMessages.INCOMPATIBLE_MODULE_METHODS; +import static dagger.internal.codegen.ErrorMessages.METHOD_OVERRIDES_PROVIDES_METHOD; +import static dagger.internal.codegen.ErrorMessages.MODULES_WITH_TYPE_PARAMS_MUST_BE_ABSTRACT; +import static dagger.internal.codegen.ErrorMessages.PROVIDES_METHOD_OVERRIDES_ANOTHER; +import static dagger.internal.codegen.ErrorMessages.REFERENCED_MODULE_MUST_NOT_HAVE_TYPE_PARAMS; +import static dagger.internal.codegen.ErrorMessages.REFERENCED_MODULE_NOT_ANNOTATED; +import static dagger.internal.codegen.Util.isAnyAnnotationPresent; +import static javax.lang.model.element.Modifier.ABSTRACT; +import static javax.lang.model.element.Modifier.STATIC; + import com.google.auto.common.MoreElements; import com.google.auto.common.Visibility; import com.google.common.base.Function; @@ -49,24 +67,6 @@ import javax.lang.model.util.SimpleTypeVisitor6; import javax.lang.model.util.Types; -import static com.google.auto.common.MoreElements.getAnnotationMirror; -import static com.google.auto.common.MoreElements.isAnnotationPresent; -import static com.google.auto.common.Visibility.PRIVATE; -import static com.google.auto.common.Visibility.PUBLIC; -import static com.google.auto.common.Visibility.effectiveVisibilityOfElement; -import static com.google.common.collect.Iterables.any; -import static dagger.internal.codegen.ConfigurationAnnotations.getModuleIncludes; -import static dagger.internal.codegen.ErrorMessages.BINDING_METHOD_WITH_SAME_NAME; -import static dagger.internal.codegen.ErrorMessages.INCOMPATIBLE_MODULE_METHODS; -import static dagger.internal.codegen.ErrorMessages.METHOD_OVERRIDES_PROVIDES_METHOD; -import static dagger.internal.codegen.ErrorMessages.MODULES_WITH_TYPE_PARAMS_MUST_BE_ABSTRACT; -import static dagger.internal.codegen.ErrorMessages.PROVIDES_METHOD_OVERRIDES_ANOTHER; -import static dagger.internal.codegen.ErrorMessages.REFERENCED_MODULE_MUST_NOT_HAVE_TYPE_PARAMS; -import static dagger.internal.codegen.ErrorMessages.REFERENCED_MODULE_NOT_ANNOTATED; -import static dagger.internal.codegen.Util.isAnyAnnotationPresent; -import static javax.lang.model.element.Modifier.ABSTRACT; -import static javax.lang.model.element.Modifier.STATIC; - /** * A {@linkplain ValidationReport validator} for {@link Module}s or {@link ProducerModule}s. * diff --git a/compiler/src/main/java/dagger/internal/codegen/MonitoringModuleGenerator.java b/compiler/src/main/java/dagger/internal/codegen/MonitoringModuleGenerator.java index 1ead2435068..4a489aab793 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MonitoringModuleGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/MonitoringModuleGenerator.java @@ -16,6 +16,15 @@ package dagger.internal.codegen; +import static com.squareup.javapoet.MethodSpec.methodBuilder; +import static com.squareup.javapoet.TypeSpec.classBuilder; +import static dagger.internal.codegen.TypeNames.SET_OF_FACTORIES; +import static dagger.internal.codegen.TypeNames.providerOf; +import static javax.lang.model.element.Modifier.ABSTRACT; +import static javax.lang.model.element.Modifier.FINAL; +import static javax.lang.model.element.Modifier.PUBLIC; +import static javax.lang.model.element.Modifier.STATIC; + import com.google.common.base.Optional; import com.squareup.javapoet.AnnotationSpec; import com.squareup.javapoet.ClassName; @@ -32,15 +41,6 @@ import javax.lang.model.element.TypeElement; import javax.lang.model.util.Elements; -import static com.squareup.javapoet.MethodSpec.methodBuilder; -import static com.squareup.javapoet.TypeSpec.classBuilder; -import static dagger.internal.codegen.TypeNames.SET_OF_FACTORIES; -import static dagger.internal.codegen.TypeNames.providerOf; -import static javax.lang.model.element.Modifier.ABSTRACT; -import static javax.lang.model.element.Modifier.FINAL; -import static javax.lang.model.element.Modifier.PUBLIC; -import static javax.lang.model.element.Modifier.STATIC; - /** Generates a monitoring module for use with production components. */ final class MonitoringModuleGenerator extends SourceFileGenerator { diff --git a/compiler/src/main/java/dagger/internal/codegen/MultibindingAnnotations.java b/compiler/src/main/java/dagger/internal/codegen/MultibindingAnnotations.java index 4fb49f52ffd..cfd708331da 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MultibindingAnnotations.java +++ b/compiler/src/main/java/dagger/internal/codegen/MultibindingAnnotations.java @@ -16,6 +16,8 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.getAnnotationMirror; + import com.google.common.collect.ImmutableSet; import dagger.multibindings.ElementsIntoSet; import dagger.multibindings.IntoMap; @@ -23,8 +25,6 @@ import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.ExecutableElement; -import static com.google.auto.common.MoreElements.getAnnotationMirror; - /** * Utility methods related to processing {@link IntoSet}, {@link ElementsIntoSet}, and {@link * IntoMap}. diff --git a/compiler/src/main/java/dagger/internal/codegen/MultibindingAnnotationsProcessingStep.java b/compiler/src/main/java/dagger/internal/codegen/MultibindingAnnotationsProcessingStep.java index f36d01c3f81..26a4a36f2d1 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MultibindingAnnotationsProcessingStep.java +++ b/compiler/src/main/java/dagger/internal/codegen/MultibindingAnnotationsProcessingStep.java @@ -16,6 +16,10 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.getAnnotationMirror; +import static dagger.internal.codegen.ErrorMessages.MULTIBINDING_ANNOTATION_NOT_ON_BINDING_METHOD; +import static dagger.internal.codegen.Util.isAnyAnnotationPresent; + import com.google.auto.common.BasicAnnotationProcessor.ProcessingStep; import com.google.common.collect.ImmutableSet; import com.google.common.collect.SetMultimap; @@ -33,10 +37,6 @@ import javax.lang.model.element.Element; import javax.tools.Diagnostic.Kind; -import static com.google.auto.common.MoreElements.getAnnotationMirror; -import static dagger.internal.codegen.ErrorMessages.MULTIBINDING_ANNOTATION_NOT_ON_BINDING_METHOD; -import static dagger.internal.codegen.Util.isAnyAnnotationPresent; - /** * Processing step which verifies that {@link IntoSet @IntoSet}, {@link ElementsIntoSet * @ElementsIntoSet} and {@link IntoMap @IntoMap} are not present on invalid elements. diff --git a/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java b/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java index 072cd4db927..c7b769f2bed 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java +++ b/compiler/src/main/java/dagger/internal/codegen/MultibindingDeclaration.java @@ -16,6 +16,11 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.getLocalAndInheritedMethods; +import static com.google.auto.common.MoreElements.isAnnotationPresent; +import static com.google.common.base.Preconditions.checkArgument; +import static javax.lang.model.element.ElementKind.INTERFACE; + import com.google.auto.common.MoreTypes; import com.google.auto.value.AutoValue; import com.google.common.base.Optional; @@ -39,11 +44,6 @@ import javax.lang.model.util.Elements; import javax.lang.model.util.Types; -import static com.google.auto.common.MoreElements.getLocalAndInheritedMethods; -import static com.google.auto.common.MoreElements.isAnnotationPresent; -import static com.google.common.base.Preconditions.checkArgument; -import static javax.lang.model.element.ElementKind.INTERFACE; - /** * A declaration that a multibinding with a certain key is available to be injected in a component * even if the component has no multibindings for that key. Identified by a map- or set-returning diff --git a/compiler/src/main/java/dagger/internal/codegen/MultibindingsProcessingStep.java b/compiler/src/main/java/dagger/internal/codegen/MultibindingsProcessingStep.java index 7108de52de5..24d72a26221 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MultibindingsProcessingStep.java +++ b/compiler/src/main/java/dagger/internal/codegen/MultibindingsProcessingStep.java @@ -16,6 +16,8 @@ package dagger.internal.codegen; +import static javax.lang.model.util.ElementFilter.typesIn; + import com.google.auto.common.BasicAnnotationProcessor.ProcessingStep; import com.google.common.collect.ImmutableSet; import com.google.common.collect.SetMultimap; @@ -26,8 +28,6 @@ import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; -import static javax.lang.model.util.ElementFilter.typesIn; - /** * Processes elements annotated with {@link Multibindings @Multibindings}. */ diff --git a/compiler/src/main/java/dagger/internal/codegen/MultibindingsValidator.java b/compiler/src/main/java/dagger/internal/codegen/MultibindingsValidator.java index 22fd7e2061a..74fe9a1fd7d 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MultibindingsValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/MultibindingsValidator.java @@ -16,6 +16,16 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.getLocalAndInheritedMethods; +import static com.google.auto.common.MoreElements.isAnnotationPresent; +import static com.google.auto.common.MoreTypes.asExecutable; +import static dagger.internal.codegen.ErrorMessages.DUPLICATE_SIZE_LIMIT; +import static dagger.internal.codegen.ErrorMessages.MultibindingsMessages.MUST_BE_INTERFACE; +import static dagger.internal.codegen.ErrorMessages.MultibindingsMessages.MUST_BE_IN_MODULE; +import static dagger.internal.codegen.ErrorMessages.MultibindingsMessages.MUST_NOT_HAVE_TYPE_PARAMETERS; +import static dagger.internal.codegen.ErrorMessages.MultibindingsMessages.tooManyMethodsForKey; +import static javax.lang.model.element.ElementKind.INTERFACE; + import com.google.common.base.Optional; import com.google.common.collect.ImmutableListMultimap; import dagger.Module; @@ -27,16 +37,6 @@ import javax.lang.model.element.TypeElement; import javax.lang.model.util.Elements; -import static com.google.auto.common.MoreElements.getLocalAndInheritedMethods; -import static com.google.auto.common.MoreElements.isAnnotationPresent; -import static com.google.auto.common.MoreTypes.asExecutable; -import static dagger.internal.codegen.ErrorMessages.DUPLICATE_SIZE_LIMIT; -import static dagger.internal.codegen.ErrorMessages.MultibindingsMessages.MUST_BE_INTERFACE; -import static dagger.internal.codegen.ErrorMessages.MultibindingsMessages.MUST_BE_IN_MODULE; -import static dagger.internal.codegen.ErrorMessages.MultibindingsMessages.MUST_NOT_HAVE_TYPE_PARAMETERS; -import static dagger.internal.codegen.ErrorMessages.MultibindingsMessages.tooManyMethodsForKey; -import static javax.lang.model.element.ElementKind.INTERFACE; - /** * A {@linkplain ValidationReport validator} for {@link Multibindings @Multibindings}-annotated * types. diff --git a/compiler/src/main/java/dagger/internal/codegen/MultibindsMethodValidator.java b/compiler/src/main/java/dagger/internal/codegen/MultibindsMethodValidator.java index ec99ec4f7fc..f247124334b 100644 --- a/compiler/src/main/java/dagger/internal/codegen/MultibindsMethodValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/MultibindsMethodValidator.java @@ -16,6 +16,13 @@ package dagger.internal.codegen; +import static dagger.internal.codegen.BindingMethodValidator.Abstractness.MUST_BE_ABSTRACT; +import static dagger.internal.codegen.ErrorMessages.MultibindsMessages.METHOD_MUST_RETURN_MAP_OR_SET; +import static dagger.internal.codegen.ErrorMessages.MultibindsMessages.NO_MAP_KEY; +import static dagger.internal.codegen.ErrorMessages.MultibindsMessages.PARAMETERS; +import static dagger.internal.codegen.FrameworkTypes.isFrameworkType; +import static dagger.internal.codegen.MapKeys.getMapKeys; + import com.google.auto.common.MoreTypes; import com.google.common.collect.ImmutableSet; import dagger.MapKey; @@ -33,13 +40,6 @@ import javax.lang.model.util.Elements; import javax.lang.model.util.Types; -import static dagger.internal.codegen.BindingMethodValidator.Abstractness.MUST_BE_ABSTRACT; -import static dagger.internal.codegen.ErrorMessages.MultibindsMessages.METHOD_MUST_RETURN_MAP_OR_SET; -import static dagger.internal.codegen.ErrorMessages.MultibindsMessages.NO_MAP_KEY; -import static dagger.internal.codegen.ErrorMessages.MultibindsMessages.PARAMETERS; -import static dagger.internal.codegen.FrameworkTypes.isFrameworkType; -import static dagger.internal.codegen.MapKeys.getMapKeys; - /** * A validator for {@link Multibinds @Multibinds} methods or methods in {@link Multibindings * @Multibindings} interfaces. diff --git a/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java b/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java index 93616f5397a..7e362d7ba35 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java @@ -16,26 +16,6 @@ package dagger.internal.codegen; -import com.google.common.base.Function; -import com.google.common.base.Joiner; -import com.google.common.base.Optional; -import com.google.common.base.Predicate; -import com.google.common.collect.FluentIterable; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Iterables; -import com.squareup.javapoet.ClassName; -import com.squareup.javapoet.CodeBlock; -import com.squareup.javapoet.MethodSpec; -import com.squareup.javapoet.ParameterizedTypeName; -import com.squareup.javapoet.TypeName; -import com.squareup.javapoet.TypeSpec; -import dagger.producers.Producer; -import javax.annotation.processing.Filer; -import javax.lang.model.element.Element; -import javax.lang.model.type.TypeMirror; -import javax.lang.model.util.Elements; - import static com.google.common.base.Preconditions.checkArgument; import static com.squareup.javapoet.ClassName.OBJECT; import static com.squareup.javapoet.MethodSpec.constructorBuilder; @@ -59,6 +39,26 @@ import static javax.lang.model.element.Modifier.PROTECTED; import static javax.lang.model.element.Modifier.PUBLIC; +import com.google.common.base.Function; +import com.google.common.base.Joiner; +import com.google.common.base.Optional; +import com.google.common.base.Predicate; +import com.google.common.collect.FluentIterable; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Iterables; +import com.squareup.javapoet.ClassName; +import com.squareup.javapoet.CodeBlock; +import com.squareup.javapoet.MethodSpec; +import com.squareup.javapoet.ParameterizedTypeName; +import com.squareup.javapoet.TypeName; +import com.squareup.javapoet.TypeSpec; +import dagger.producers.Producer; +import javax.annotation.processing.Filer; +import javax.lang.model.element.Element; +import javax.lang.model.type.TypeMirror; +import javax.lang.model.util.Elements; + /** * Generates {@link Producer} implementations from {@link ProductionBinding} instances. * diff --git a/compiler/src/main/java/dagger/internal/codegen/ProducesMethodValidator.java b/compiler/src/main/java/dagger/internal/codegen/ProducesMethodValidator.java index 49469174eee..aca2f356fed 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProducesMethodValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProducesMethodValidator.java @@ -16,6 +16,15 @@ package dagger.internal.codegen; +import static com.google.common.collect.Iterables.getOnlyElement; +import static dagger.internal.codegen.BindingMethodValidator.Abstractness.MUST_BE_CONCRETE; +import static dagger.internal.codegen.BindingMethodValidator.ExceptionSuperclass.EXCEPTION; +import static dagger.internal.codegen.ErrorMessages.PRODUCES_METHOD_NULLABLE; +import static dagger.internal.codegen.ErrorMessages.PRODUCES_METHOD_RAW_FUTURE; +import static dagger.internal.codegen.ErrorMessages.PRODUCES_METHOD_RETURN_TYPE; +import static dagger.internal.codegen.ErrorMessages.PRODUCES_METHOD_SCOPE; +import static dagger.internal.codegen.ErrorMessages.PRODUCES_METHOD_SET_VALUES_RETURN_SET; + import com.google.auto.common.MoreTypes; import com.google.common.base.Optional; import com.google.common.util.concurrent.ListenableFuture; @@ -29,15 +38,6 @@ import javax.lang.model.util.Elements; import javax.lang.model.util.Types; -import static com.google.common.collect.Iterables.getOnlyElement; -import static dagger.internal.codegen.BindingMethodValidator.Abstractness.MUST_BE_CONCRETE; -import static dagger.internal.codegen.BindingMethodValidator.ExceptionSuperclass.EXCEPTION; -import static dagger.internal.codegen.ErrorMessages.PRODUCES_METHOD_NULLABLE; -import static dagger.internal.codegen.ErrorMessages.PRODUCES_METHOD_RAW_FUTURE; -import static dagger.internal.codegen.ErrorMessages.PRODUCES_METHOD_RETURN_TYPE; -import static dagger.internal.codegen.ErrorMessages.PRODUCES_METHOD_SCOPE; -import static dagger.internal.codegen.ErrorMessages.PRODUCES_METHOD_SET_VALUES_RETURN_SET; - /** * A validator for {@link Produces} methods. * diff --git a/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java b/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java index c3c7a04c87e..94ae5cfe9f8 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProductionBinding.java @@ -16,6 +16,12 @@ package dagger.internal.codegen; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; +import static dagger.internal.codegen.MapKeys.getMapKey; +import static dagger.internal.codegen.MoreAnnotationMirrors.wrapOptionalInEquivalence; +import static javax.lang.model.element.ElementKind.METHOD; + import com.google.auto.common.MoreTypes; import com.google.auto.value.AutoValue; import com.google.common.base.Optional; @@ -33,12 +39,6 @@ import javax.lang.model.type.TypeMirror; import javax.lang.model.util.Types; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static dagger.internal.codegen.MapKeys.getMapKey; -import static dagger.internal.codegen.MoreAnnotationMirrors.wrapOptionalInEquivalence; -import static javax.lang.model.element.ElementKind.METHOD; - /** * A value object representing the mechanism by which a {@link Key} can be produced. New instances * should be created using an instance of the {@link Factory}. diff --git a/compiler/src/main/java/dagger/internal/codegen/ProductionExecutorModuleGenerator.java b/compiler/src/main/java/dagger/internal/codegen/ProductionExecutorModuleGenerator.java index b5559757080..413bd1a90aa 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProductionExecutorModuleGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProductionExecutorModuleGenerator.java @@ -16,6 +16,11 @@ package dagger.internal.codegen; +import static com.squareup.javapoet.MethodSpec.methodBuilder; +import static com.squareup.javapoet.TypeSpec.classBuilder; +import static javax.lang.model.element.Modifier.FINAL; +import static javax.lang.model.element.Modifier.STATIC; + import com.google.common.base.Optional; import com.squareup.javapoet.AnnotationSpec; import com.squareup.javapoet.ClassName; @@ -26,19 +31,12 @@ import dagger.producers.Production; import dagger.producers.ProductionScope; import dagger.producers.internal.ProductionImplementation; - import java.util.concurrent.Executor; - import javax.annotation.processing.Filer; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; import javax.lang.model.util.Elements; -import static com.squareup.javapoet.MethodSpec.methodBuilder; -import static com.squareup.javapoet.TypeSpec.classBuilder; -import static javax.lang.model.element.Modifier.STATIC; -import static javax.lang.model.element.Modifier.FINAL; - /** Generates a producer executor module for use with production components. */ // TODO(beder): Replace this with a single class when the producers client library exists. final class ProductionExecutorModuleGenerator extends SourceFileGenerator { diff --git a/compiler/src/main/java/dagger/internal/codegen/ProvidesMethodValidator.java b/compiler/src/main/java/dagger/internal/codegen/ProvidesMethodValidator.java index 68959d19046..3c2bd155509 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProvidesMethodValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProvidesMethodValidator.java @@ -16,6 +16,10 @@ package dagger.internal.codegen; +import static dagger.internal.codegen.BindingMethodValidator.Abstractness.MUST_BE_CONCRETE; +import static dagger.internal.codegen.BindingMethodValidator.ExceptionSuperclass.RUNTIME_EXCEPTION; +import static dagger.internal.codegen.ErrorMessages.provisionMayNotDependOnProducerType; + import com.google.common.collect.ImmutableSet; import dagger.Module; import dagger.Provides; @@ -25,10 +29,6 @@ import javax.lang.model.util.Elements; import javax.lang.model.util.Types; -import static dagger.internal.codegen.BindingMethodValidator.Abstractness.MUST_BE_CONCRETE; -import static dagger.internal.codegen.BindingMethodValidator.ExceptionSuperclass.RUNTIME_EXCEPTION; -import static dagger.internal.codegen.ErrorMessages.provisionMayNotDependOnProducerType; - /** * A validator for {@link Provides} methods. * diff --git a/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java b/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java index 4be7bec5795..13011fc299a 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProvisionBinding.java @@ -16,6 +16,18 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.isAnnotationPresent; +import static com.google.auto.common.MoreTypes.asDeclared; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Preconditions.checkState; +import static dagger.internal.codegen.InjectionAnnotations.getQualifier; +import static dagger.internal.codegen.MapKeys.getMapKey; +import static dagger.internal.codegen.MoreAnnotationMirrors.wrapOptionalInEquivalence; +import static javax.lang.model.element.ElementKind.CONSTRUCTOR; +import static javax.lang.model.element.ElementKind.FIELD; +import static javax.lang.model.element.ElementKind.METHOD; + import com.google.auto.common.MoreElements; import com.google.auto.common.MoreTypes; import com.google.auto.value.AutoValue; @@ -36,18 +48,6 @@ import javax.lang.model.util.Elements; import javax.lang.model.util.Types; -import static com.google.auto.common.MoreElements.isAnnotationPresent; -import static com.google.auto.common.MoreTypes.asDeclared; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; -import static dagger.internal.codegen.InjectionAnnotations.getQualifier; -import static dagger.internal.codegen.MapKeys.getMapKey; -import static dagger.internal.codegen.MoreAnnotationMirrors.wrapOptionalInEquivalence; -import static javax.lang.model.element.ElementKind.CONSTRUCTOR; -import static javax.lang.model.element.ElementKind.FIELD; -import static javax.lang.model.element.ElementKind.METHOD; - /** * A value object representing the mechanism by which a {@link Key} can be provided. New instances * should be created using an instance of the {@link Factory}. diff --git a/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java b/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java index d48a2447f02..95a8cc281a6 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java +++ b/compiler/src/main/java/dagger/internal/codegen/ResolvedBindings.java @@ -16,6 +16,10 @@ package dagger.internal.codegen; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkState; +import static com.google.common.collect.Iterables.getOnlyElement; + import com.google.auto.value.AutoValue; import com.google.common.base.Function; import com.google.common.base.Optional; @@ -32,10 +36,6 @@ import java.util.Map; import java.util.Set; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkState; -import static com.google.common.collect.Iterables.getOnlyElement; - /** * The collection of bindings that have been resolved for a binding key. For valid graphs, contains * exactly one binding. diff --git a/compiler/src/main/java/dagger/internal/codegen/Scope.java b/compiler/src/main/java/dagger/internal/codegen/Scope.java index 361729821cc..a765858534e 100644 --- a/compiler/src/main/java/dagger/internal/codegen/Scope.java +++ b/compiler/src/main/java/dagger/internal/codegen/Scope.java @@ -16,6 +16,10 @@ package dagger.internal.codegen; +import static com.google.common.base.Preconditions.checkNotNull; +import static dagger.internal.codegen.ErrorMessages.stripCommonTypePrefixes; +import static dagger.internal.codegen.InjectionAnnotations.getScopes; + import com.google.auto.common.AnnotationMirrors; import com.google.auto.common.MoreTypes; import com.google.common.base.Function; @@ -32,10 +36,6 @@ import javax.lang.model.element.TypeElement; import javax.lang.model.util.Elements; -import static com.google.common.base.Preconditions.checkNotNull; -import static dagger.internal.codegen.ErrorMessages.stripCommonTypePrefixes; -import static dagger.internal.codegen.InjectionAnnotations.getScopes; - /** * A representation of the scope (or lack of it) associated with a component, providing method * or injection location. diff --git a/compiler/src/main/java/dagger/internal/codegen/SetType.java b/compiler/src/main/java/dagger/internal/codegen/SetType.java index 9407933c63d..0c59583fb16 100644 --- a/compiler/src/main/java/dagger/internal/codegen/SetType.java +++ b/compiler/src/main/java/dagger/internal/codegen/SetType.java @@ -16,6 +16,9 @@ package dagger.internal.codegen; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkState; + import com.google.auto.common.MoreTypes; import com.google.auto.value.AutoValue; import com.google.common.base.Equivalence; @@ -23,9 +26,6 @@ import javax.lang.model.type.DeclaredType; import javax.lang.model.type.TypeMirror; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkState; - /** * Information about a {@link Set} {@link TypeMirror}. */ diff --git a/compiler/src/main/java/dagger/internal/codegen/SimpleAnnotationMirror.java b/compiler/src/main/java/dagger/internal/codegen/SimpleAnnotationMirror.java index c381f4732dd..318ef7eef64 100644 --- a/compiler/src/main/java/dagger/internal/codegen/SimpleAnnotationMirror.java +++ b/compiler/src/main/java/dagger/internal/codegen/SimpleAnnotationMirror.java @@ -16,6 +16,10 @@ package dagger.internal.codegen; +import static com.google.common.base.Preconditions.checkArgument; +import static dagger.internal.codegen.Util.ELEMENT_SIMPLE_NAME; +import static javax.lang.model.util.ElementFilter.methodsIn; + import com.google.auto.common.MoreTypes; import com.google.common.base.Functions; import com.google.common.base.Joiner; @@ -30,10 +34,6 @@ import javax.lang.model.element.TypeElement; import javax.lang.model.type.DeclaredType; -import static com.google.common.base.Preconditions.checkArgument; -import static dagger.internal.codegen.Util.ELEMENT_SIMPLE_NAME; -import static javax.lang.model.util.ElementFilter.methodsIn; - /** A representation of an annotation. */ final class SimpleAnnotationMirror implements AnnotationMirror { private final TypeElement annotationType; diff --git a/compiler/src/main/java/dagger/internal/codegen/SourceFileGenerationException.java b/compiler/src/main/java/dagger/internal/codegen/SourceFileGenerationException.java index 202440a9069..96926ee52d2 100644 --- a/compiler/src/main/java/dagger/internal/codegen/SourceFileGenerationException.java +++ b/compiler/src/main/java/dagger/internal/codegen/SourceFileGenerationException.java @@ -16,14 +16,14 @@ package dagger.internal.codegen; +import static com.google.common.base.Preconditions.checkNotNull; +import static javax.tools.Diagnostic.Kind.ERROR; + import com.google.common.base.Optional; import com.squareup.javapoet.ClassName; import javax.annotation.processing.Messager; import javax.lang.model.element.Element; -import static com.google.common.base.Preconditions.checkNotNull; -import static javax.tools.Diagnostic.Kind.ERROR; - /** * An exception thrown to indicate that a source file could not be generated. * diff --git a/compiler/src/main/java/dagger/internal/codegen/SourceFileGenerator.java b/compiler/src/main/java/dagger/internal/codegen/SourceFileGenerator.java index 3494bfa10bd..7c41b1c533d 100644 --- a/compiler/src/main/java/dagger/internal/codegen/SourceFileGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/SourceFileGenerator.java @@ -16,6 +16,8 @@ package dagger.internal.codegen; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.base.Optional; import com.google.common.base.Throwables; import com.google.common.collect.Iterables; @@ -35,8 +37,6 @@ import javax.lang.model.util.Elements; import javax.tools.JavaFileObject; -import static com.google.common.base.Preconditions.checkNotNull; - /** * A template class that provides a framework for properly handling IO while generating source files * from an annotation processor. Particularly, it makes a best effort to ensure that files that diff --git a/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java b/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java index 78b18dcd610..ff362422c16 100644 --- a/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java +++ b/compiler/src/main/java/dagger/internal/codegen/SourceFiles.java @@ -14,6 +14,12 @@ package dagger.internal.codegen; +import static com.google.common.base.CaseFormat.UPPER_CAMEL; +import static com.google.common.base.Preconditions.checkArgument; +import static dagger.internal.codegen.FrameworkDependency.frameworkDependenciesForBinding; +import static dagger.internal.codegen.TypeNames.DOUBLE_CHECK; +import static dagger.internal.codegen.TypeNames.PROVIDER_OF_LAZY; + import com.google.common.base.CaseFormat; import com.google.common.base.Joiner; import com.google.common.base.Optional; @@ -34,12 +40,6 @@ import javax.lang.model.element.TypeParameterElement; import javax.lang.model.type.TypeMirror; -import static com.google.common.base.CaseFormat.UPPER_CAMEL; -import static com.google.common.base.Preconditions.checkArgument; -import static dagger.internal.codegen.FrameworkDependency.frameworkDependenciesForBinding; -import static dagger.internal.codegen.TypeNames.DOUBLE_CHECK; -import static dagger.internal.codegen.TypeNames.PROVIDER_OF_LAZY; - /** * Utilities for generating files. * diff --git a/compiler/src/main/java/dagger/internal/codegen/SubcomponentWriter.java b/compiler/src/main/java/dagger/internal/codegen/SubcomponentWriter.java index ba223603546..5aee50317a2 100644 --- a/compiler/src/main/java/dagger/internal/codegen/SubcomponentWriter.java +++ b/compiler/src/main/java/dagger/internal/codegen/SubcomponentWriter.java @@ -16,6 +16,19 @@ package dagger.internal.codegen; +import static com.google.common.base.CaseFormat.LOWER_CAMEL; +import static com.google.common.base.Verify.verify; +import static com.google.common.collect.Sets.difference; +import static com.squareup.javapoet.MethodSpec.methodBuilder; +import static com.squareup.javapoet.TypeSpec.classBuilder; +import static dagger.internal.codegen.AbstractComponentWriter.InitializationState.UNINITIALIZED; +import static dagger.internal.codegen.CodeBlocks.makeParametersCodeBlock; +import static dagger.internal.codegen.MemberSelect.localField; +import static dagger.internal.codegen.TypeSpecs.addSupertype; +import static javax.lang.model.element.Modifier.FINAL; +import static javax.lang.model.element.Modifier.PRIVATE; +import static javax.lang.model.element.Modifier.PUBLIC; + import com.google.auto.common.MoreTypes; import com.google.common.base.CaseFormat; import com.google.common.base.Optional; @@ -36,19 +49,6 @@ import javax.lang.model.type.ExecutableType; import javax.lang.model.type.TypeMirror; -import static com.google.common.base.CaseFormat.LOWER_CAMEL; -import static com.google.common.base.Verify.verify; -import static com.google.common.collect.Sets.difference; -import static com.squareup.javapoet.MethodSpec.methodBuilder; -import static com.squareup.javapoet.TypeSpec.classBuilder; -import static dagger.internal.codegen.AbstractComponentWriter.InitializationState.UNINITIALIZED; -import static dagger.internal.codegen.CodeBlocks.makeParametersCodeBlock; -import static dagger.internal.codegen.MemberSelect.localField; -import static dagger.internal.codegen.TypeSpecs.addSupertype; -import static javax.lang.model.element.Modifier.FINAL; -import static javax.lang.model.element.Modifier.PRIVATE; -import static javax.lang.model.element.Modifier.PUBLIC; - /** * Creates the nested implementation class for a subcomponent. */ diff --git a/compiler/src/main/java/dagger/internal/codegen/Util.java b/compiler/src/main/java/dagger/internal/codegen/Util.java index 44e6a99575e..9b66577cdd6 100644 --- a/compiler/src/main/java/dagger/internal/codegen/Util.java +++ b/compiler/src/main/java/dagger/internal/codegen/Util.java @@ -16,6 +16,14 @@ package dagger.internal.codegen; +import static com.google.auto.common.MoreElements.getLocalAndInheritedMethods; +import static com.google.auto.common.MoreElements.hasModifiers; +import static com.google.auto.common.MoreElements.isAnnotationPresent; +import static javax.lang.model.element.ElementKind.CONSTRUCTOR; +import static javax.lang.model.element.Modifier.ABSTRACT; +import static javax.lang.model.element.Modifier.PRIVATE; +import static javax.lang.model.element.Modifier.STATIC; + import com.google.auto.common.MoreElements; import com.google.auto.common.MoreTypes; import com.google.common.base.Function; @@ -35,14 +43,6 @@ import javax.lang.model.util.Elements; import javax.lang.model.util.SimpleElementVisitor6; -import static com.google.auto.common.MoreElements.getLocalAndInheritedMethods; -import static com.google.auto.common.MoreElements.hasModifiers; -import static com.google.auto.common.MoreElements.isAnnotationPresent; -import static javax.lang.model.element.ElementKind.CONSTRUCTOR; -import static javax.lang.model.element.Modifier.ABSTRACT; -import static javax.lang.model.element.Modifier.PRIVATE; -import static javax.lang.model.element.Modifier.STATIC; - /** * Utilities for handling types in annotation processors */ diff --git a/compiler/src/main/java/dagger/internal/codegen/ValidationReport.java b/compiler/src/main/java/dagger/internal/codegen/ValidationReport.java index 67885e72794..de060d603dc 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ValidationReport.java +++ b/compiler/src/main/java/dagger/internal/codegen/ValidationReport.java @@ -16,6 +16,10 @@ package dagger.internal.codegen; +import static javax.tools.Diagnostic.Kind.ERROR; +import static javax.tools.Diagnostic.Kind.NOTE; +import static javax.tools.Diagnostic.Kind.WARNING; + import com.google.auto.value.AutoValue; import com.google.common.base.Optional; import com.google.common.collect.ImmutableSet; @@ -29,10 +33,6 @@ import javax.tools.Diagnostic; import javax.tools.Diagnostic.Kind; -import static javax.tools.Diagnostic.Kind.ERROR; -import static javax.tools.Diagnostic.Kind.NOTE; -import static javax.tools.Diagnostic.Kind.WARNING; - /** * A collection of items describing contractual issues with the code as presented to an annotation * processor. A "clean" report (i.e. with no issues) is a report with no {@linkplain Item items} diff --git a/compiler/src/test/java/dagger/internal/codegen/AccessibilityTest.java b/compiler/src/test/java/dagger/internal/codegen/AccessibilityTest.java index 394d1a31610..bfe73f31ccd 100644 --- a/compiler/src/test/java/dagger/internal/codegen/AccessibilityTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/AccessibilityTest.java @@ -16,6 +16,9 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertThat; +import static dagger.internal.codegen.Accessibility.isElementAccessibleFrom; + import com.google.testing.compile.CompilationRule; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; @@ -26,9 +29,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; -import static dagger.internal.codegen.Accessibility.isElementAccessibleFrom; - @RunWith(JUnit4.class) @SuppressWarnings("unused") // contains a variety things used by the compilation rule for testing public class AccessibilityTest { diff --git a/compiler/src/test/java/dagger/internal/codegen/BindsMethodValidatorTest.java b/compiler/src/test/java/dagger/internal/codegen/BindsMethodValidatorTest.java index 8f9868d0ae8..34eedcacd97 100644 --- a/compiler/src/test/java/dagger/internal/codegen/BindsMethodValidatorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/BindsMethodValidatorTest.java @@ -16,6 +16,9 @@ package dagger.internal.codegen; +import static dagger.internal.codegen.DaggerModuleMethodSubject.Factory.assertThatMethodInUnannotatedClass; +import static dagger.internal.codegen.DaggerModuleMethodSubject.Factory.assertThatModuleMethod; + import com.google.common.collect.ImmutableList; import dagger.Module; import dagger.producers.ProducerModule; @@ -29,9 +32,6 @@ import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; -import static dagger.internal.codegen.DaggerModuleMethodSubject.Factory.assertThatMethodInUnannotatedClass; -import static dagger.internal.codegen.DaggerModuleMethodSubject.Factory.assertThatModuleMethod; - @RunWith(Parameterized.class) public class BindsMethodValidatorTest { @Parameters diff --git a/compiler/src/test/java/dagger/internal/codegen/ComponentBuilderTest.java b/compiler/src/test/java/dagger/internal/codegen/ComponentBuilderTest.java index 19be954d51e..6735fd25c5d 100644 --- a/compiler/src/test/java/dagger/internal/codegen/ComponentBuilderTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/ComponentBuilderTest.java @@ -16,6 +16,11 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertAbout; +import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource; +import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; +import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; + import com.google.common.collect.ImmutableList; import com.google.testing.compile.JavaFileObjects; import javax.tools.JavaFileObject; @@ -23,11 +28,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertAbout; -import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource; -import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; -import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; - /** Tests for {@link dagger.Component.Builder} */ @RunWith(JUnit4.class) public class ComponentBuilderTest { diff --git a/compiler/src/test/java/dagger/internal/codegen/ComponentProcessorTest.java b/compiler/src/test/java/dagger/internal/codegen/ComponentProcessorTest.java index 70609b63526..ed2d68f1885 100644 --- a/compiler/src/test/java/dagger/internal/codegen/ComponentProcessorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/ComponentProcessorTest.java @@ -16,6 +16,13 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertAbout; +import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource; +import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; +import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; +import static java.util.Arrays.asList; +import static javax.tools.StandardLocation.SOURCE_OUTPUT; + import com.google.auto.common.MoreElements; import com.google.common.base.Joiner; import com.google.common.base.Predicate; @@ -44,13 +51,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertAbout; -import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource; -import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; -import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; -import static java.util.Arrays.asList; -import static javax.tools.StandardLocation.SOURCE_OUTPUT; - @RunWith(JUnit4.class) public class ComponentProcessorTest { private static final CodeBlock NPE_LITERAL = diff --git a/compiler/src/test/java/dagger/internal/codegen/DaggerModuleMethodSubject.java b/compiler/src/test/java/dagger/internal/codegen/DaggerModuleMethodSubject.java index 2ca0906ac85..61a54d8eac3 100644 --- a/compiler/src/test/java/dagger/internal/codegen/DaggerModuleMethodSubject.java +++ b/compiler/src/test/java/dagger/internal/codegen/DaggerModuleMethodSubject.java @@ -16,6 +16,9 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertAbout; +import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; + import com.google.common.base.Function; import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableList; @@ -33,9 +36,6 @@ import java.util.Arrays; import javax.tools.JavaFileObject; -import static com.google.common.truth.Truth.assertAbout; -import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; - /** A {@link Truth} subject for testing Dagger module methods. */ final class DaggerModuleMethodSubject extends Subject { diff --git a/compiler/src/test/java/dagger/internal/codegen/DependencyRequestMapperTest.java b/compiler/src/test/java/dagger/internal/codegen/DependencyRequestMapperTest.java index d75ca88eae2..cd6e5a32512 100644 --- a/compiler/src/test/java/dagger/internal/codegen/DependencyRequestMapperTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/DependencyRequestMapperTest.java @@ -16,6 +16,8 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertThat; + import com.google.common.collect.Iterables; import com.google.testing.compile.CompilationRule; import dagger.Lazy; @@ -40,8 +42,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; - /** * Test case for {@link DependencyRequestMapper}. */ diff --git a/compiler/src/test/java/dagger/internal/codegen/ErrorMessagesTest.java b/compiler/src/test/java/dagger/internal/codegen/ErrorMessagesTest.java index 6aafc3550d2..e7c392150e4 100644 --- a/compiler/src/test/java/dagger/internal/codegen/ErrorMessagesTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/ErrorMessagesTest.java @@ -16,12 +16,12 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertThat; + import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; - @RunWith(JUnit4.class) public class ErrorMessagesTest { @Test public void stripCommonTypePrefixes() { diff --git a/compiler/src/test/java/dagger/internal/codegen/FrameworkFieldTest.java b/compiler/src/test/java/dagger/internal/codegen/FrameworkFieldTest.java index 072a6c3480e..6905f6ae99b 100644 --- a/compiler/src/test/java/dagger/internal/codegen/FrameworkFieldTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/FrameworkFieldTest.java @@ -16,6 +16,12 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertThat; +import static dagger.internal.codegen.TypeNames.MEMBERS_INJECTOR; +import static dagger.internal.codegen.TypeNames.PROVIDER; +import static dagger.internal.codegen.TypeNames.membersInjectorOf; +import static dagger.internal.codegen.TypeNames.providerOf; + import com.google.testing.compile.CompilationRule; import com.squareup.javapoet.ClassName; import javax.inject.Inject; @@ -25,12 +31,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; -import static dagger.internal.codegen.TypeNames.MEMBERS_INJECTOR; -import static dagger.internal.codegen.TypeNames.PROVIDER; -import static dagger.internal.codegen.TypeNames.membersInjectorOf; -import static dagger.internal.codegen.TypeNames.providerOf; - /** * Test case for {@link FrameworkField}. */ diff --git a/compiler/src/test/java/dagger/internal/codegen/GraphValidationScopingTest.java b/compiler/src/test/java/dagger/internal/codegen/GraphValidationScopingTest.java index 4705304705e..9a63c13526d 100644 --- a/compiler/src/test/java/dagger/internal/codegen/GraphValidationScopingTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/GraphValidationScopingTest.java @@ -16,18 +16,18 @@ package dagger.internal.codegen; -import com.google.testing.compile.JavaFileObjects; -import javax.tools.JavaFileObject; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - import static com.google.common.truth.Truth.assertAbout; import static com.google.common.truth.Truth.assert_; import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource; import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; import static java.util.Arrays.asList; +import com.google.testing.compile.JavaFileObjects; +import javax.tools.JavaFileObject; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + @RunWith(JUnit4.class) public class GraphValidationScopingTest { @Test public void componentWithoutScopeIncludesScopedBindings_Fail() { diff --git a/compiler/src/test/java/dagger/internal/codegen/GraphValidationTest.java b/compiler/src/test/java/dagger/internal/codegen/GraphValidationTest.java index 9209c711d15..32b30c8c91b 100644 --- a/compiler/src/test/java/dagger/internal/codegen/GraphValidationTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/GraphValidationTest.java @@ -16,6 +16,11 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertAbout; +import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource; +import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; +import static dagger.internal.codegen.ErrorMessages.nullableToNonNullable; + import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import com.google.testing.compile.JavaFileObjects; @@ -25,11 +30,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertAbout; -import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource; -import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; -import static dagger.internal.codegen.ErrorMessages.nullableToNonNullable; - @RunWith(JUnit4.class) public class GraphValidationTest { private static final JavaFileObject NULLABLE = diff --git a/compiler/src/test/java/dagger/internal/codegen/InaccessibleTypeTest.java b/compiler/src/test/java/dagger/internal/codegen/InaccessibleTypeTest.java index 4008630de74..e83d5a5e563 100644 --- a/compiler/src/test/java/dagger/internal/codegen/InaccessibleTypeTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/InaccessibleTypeTest.java @@ -16,6 +16,10 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertAbout; +import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; +import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; + import com.google.common.collect.ImmutableList; import com.google.testing.compile.JavaFileObjects; import javax.tools.JavaFileObject; @@ -23,10 +27,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertAbout; -import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; -import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; - @RunWith(JUnit4.class) public class InaccessibleTypeTest { @Test public void basicInjectedType() { diff --git a/compiler/src/test/java/dagger/internal/codegen/InjectConstructorFactoryGeneratorTest.java b/compiler/src/test/java/dagger/internal/codegen/InjectConstructorFactoryGeneratorTest.java index 1f319954e2c..6382d8d2730 100644 --- a/compiler/src/test/java/dagger/internal/codegen/InjectConstructorFactoryGeneratorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/InjectConstructorFactoryGeneratorTest.java @@ -16,13 +16,6 @@ package dagger.internal.codegen; -import com.google.common.collect.ImmutableList; -import com.google.testing.compile.JavaFileObjects; -import javax.tools.JavaFileObject; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - import static com.google.common.truth.Truth.assertAbout; import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource; import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; @@ -44,6 +37,13 @@ import static dagger.internal.codegen.ErrorMessages.STATIC_INJECT_METHOD; import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; +import com.google.common.collect.ImmutableList; +import com.google.testing.compile.JavaFileObjects; +import javax.tools.JavaFileObject; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + @RunWith(JUnit4.class) // TODO(gak): add tests for generation in the default package. public final class InjectConstructorFactoryGeneratorTest { diff --git a/compiler/src/test/java/dagger/internal/codegen/KeyTest.java b/compiler/src/test/java/dagger/internal/codegen/KeyTest.java index 50d1c18efc3..82d0dd196ea 100644 --- a/compiler/src/test/java/dagger/internal/codegen/KeyTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/KeyTest.java @@ -16,6 +16,8 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertThat; + import com.google.auto.common.MoreTypes; import com.google.common.base.Equivalence; import com.google.common.base.Optional; @@ -46,8 +48,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; - /** * Tests {@link Key}. */ diff --git a/compiler/src/test/java/dagger/internal/codegen/MapBindingComponentProcessorTest.java b/compiler/src/test/java/dagger/internal/codegen/MapBindingComponentProcessorTest.java index 4b3ad45275d..46ffa2f60b0 100644 --- a/compiler/src/test/java/dagger/internal/codegen/MapBindingComponentProcessorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/MapBindingComponentProcessorTest.java @@ -16,6 +16,10 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertAbout; +import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; +import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; + import com.google.auto.value.processor.AutoAnnotationProcessor; import com.google.common.collect.ImmutableList; import com.google.testing.compile.JavaFileObjects; @@ -24,10 +28,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertAbout; -import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; -import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; - @RunWith(JUnit4.class) public class MapBindingComponentProcessorTest { diff --git a/compiler/src/test/java/dagger/internal/codegen/MapKeyProcessorTest.java b/compiler/src/test/java/dagger/internal/codegen/MapKeyProcessorTest.java index 98e3d67f817..0cea3c2ab91 100644 --- a/compiler/src/test/java/dagger/internal/codegen/MapKeyProcessorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/MapKeyProcessorTest.java @@ -16,6 +16,11 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertAbout; +import static com.google.testing.compile.JavaSourcesSubject.assertThat; +import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; +import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; + import com.google.auto.value.processor.AutoAnnotationProcessor; import com.google.common.collect.ImmutableList; import com.google.testing.compile.JavaFileObjects; @@ -24,11 +29,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertAbout; -import static com.google.testing.compile.JavaSourcesSubject.assertThat; -import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; -import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; - @RunWith(JUnit4.class) public class MapKeyProcessorTest { @Test diff --git a/compiler/src/test/java/dagger/internal/codegen/MembersInjectionTest.java b/compiler/src/test/java/dagger/internal/codegen/MembersInjectionTest.java index 9f58ec0f6e8..1eee259c520 100644 --- a/compiler/src/test/java/dagger/internal/codegen/MembersInjectionTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/MembersInjectionTest.java @@ -16,6 +16,13 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertAbout; +import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource; +import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; +import static dagger.internal.codegen.ErrorMessages.INJECT_INTO_PRIVATE_CLASS; +import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; +import static javax.tools.StandardLocation.CLASS_OUTPUT; + import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; @@ -31,13 +38,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertAbout; -import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource; -import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; -import static dagger.internal.codegen.ErrorMessages.INJECT_INTO_PRIVATE_CLASS; -import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; -import static javax.tools.StandardLocation.CLASS_OUTPUT; - @RunWith(JUnit4.class) public class MembersInjectionTest { @Test diff --git a/compiler/src/test/java/dagger/internal/codegen/MethodSignatureFormatterTest.java b/compiler/src/test/java/dagger/internal/codegen/MethodSignatureFormatterTest.java index 0b09e359259..224967faf11 100644 --- a/compiler/src/test/java/dagger/internal/codegen/MethodSignatureFormatterTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/MethodSignatureFormatterTest.java @@ -16,6 +16,9 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertThat; +import static javax.lang.model.util.ElementFilter.methodsIn; + import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import com.google.testing.compile.CompilationRule; @@ -29,9 +32,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; -import static javax.lang.model.util.ElementFilter.methodsIn; - @RunWith(JUnit4.class) public class MethodSignatureFormatterTest { @Rule public CompilationRule compilationRule = new CompilationRule(); diff --git a/compiler/src/test/java/dagger/internal/codegen/MissingBindingSuggestionsTest.java b/compiler/src/test/java/dagger/internal/codegen/MissingBindingSuggestionsTest.java index 136dd84a492..f63771743d0 100644 --- a/compiler/src/test/java/dagger/internal/codegen/MissingBindingSuggestionsTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/MissingBindingSuggestionsTest.java @@ -16,6 +16,9 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertAbout; +import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; + import com.google.common.collect.ImmutableList; import com.google.testing.compile.JavaFileObjects; import javax.tools.JavaFileObject; @@ -23,9 +26,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertAbout; -import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; - @RunWith(JUnit4.class) public class MissingBindingSuggestionsTest { private static JavaFileObject injectable(String className, String constructorParams) { diff --git a/compiler/src/test/java/dagger/internal/codegen/ModuleFactoryGeneratorTest.java b/compiler/src/test/java/dagger/internal/codegen/ModuleFactoryGeneratorTest.java index f4796d6ff0c..e21df157a69 100644 --- a/compiler/src/test/java/dagger/internal/codegen/ModuleFactoryGeneratorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/ModuleFactoryGeneratorTest.java @@ -16,15 +16,6 @@ package dagger.internal.codegen; -import com.google.common.collect.ImmutableList; -import com.google.testing.compile.CompileTester; -import com.google.testing.compile.JavaFileObjects; -import com.squareup.javapoet.CodeBlock; -import javax.tools.JavaFileObject; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - import static com.google.common.truth.Truth.assertAbout; import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource; import static com.google.testing.compile.JavaSourcesSubject.assertThat; @@ -46,6 +37,15 @@ import static dagger.internal.codegen.ErrorMessages.MODULES_WITH_TYPE_PARAMS_MUST_BE_ABSTRACT; import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; +import com.google.common.collect.ImmutableList; +import com.google.testing.compile.CompileTester; +import com.google.testing.compile.JavaFileObjects; +import com.squareup.javapoet.CodeBlock; +import javax.tools.JavaFileObject; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + @RunWith(JUnit4.class) public class ModuleFactoryGeneratorTest { diff --git a/compiler/src/test/java/dagger/internal/codegen/MultibindingTest.java b/compiler/src/test/java/dagger/internal/codegen/MultibindingTest.java index 6e53ce1e3fc..e22ffaba2f3 100644 --- a/compiler/src/test/java/dagger/internal/codegen/MultibindingTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/MultibindingTest.java @@ -16,14 +16,14 @@ package dagger.internal.codegen; +import static com.google.testing.compile.JavaSourcesSubject.assertThat; + import com.google.testing.compile.JavaFileObjects; import javax.tools.JavaFileObject; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.testing.compile.JavaSourcesSubject.assertThat; - @RunWith(JUnit4.class) public class MultibindingTest { @Test diff --git a/compiler/src/test/java/dagger/internal/codegen/MultibindingsValidatorTest.java b/compiler/src/test/java/dagger/internal/codegen/MultibindingsValidatorTest.java index 6eb55a1b656..1be3658ba19 100644 --- a/compiler/src/test/java/dagger/internal/codegen/MultibindingsValidatorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/MultibindingsValidatorTest.java @@ -16,6 +16,11 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertAbout; +import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; +import static dagger.internal.codegen.DaggerModuleMethodSubject.Factory.assertThatMultibindingsMethod; +import static java.util.Arrays.asList; + import com.google.testing.compile.JavaFileObjects; import javax.inject.Qualifier; import javax.tools.JavaFileObject; @@ -23,11 +28,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertAbout; -import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; -import static dagger.internal.codegen.DaggerModuleMethodSubject.Factory.assertThatMultibindingsMethod; -import static java.util.Arrays.asList; - @RunWith(JUnit4.class) public class MultibindingsValidatorTest { diff --git a/compiler/src/test/java/dagger/internal/codegen/MultibindsValidatorTest.java b/compiler/src/test/java/dagger/internal/codegen/MultibindsValidatorTest.java index 286b6cf2084..6f642f603da 100644 --- a/compiler/src/test/java/dagger/internal/codegen/MultibindsValidatorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/MultibindsValidatorTest.java @@ -16,6 +16,9 @@ package dagger.internal.codegen; +import static dagger.internal.codegen.DaggerModuleMethodSubject.Factory.assertThatMethodInUnannotatedClass; +import static dagger.internal.codegen.DaggerModuleMethodSubject.Factory.assertThatModuleMethod; + import com.google.common.collect.ImmutableList; import dagger.Module; import dagger.producers.ProducerModule; @@ -27,9 +30,6 @@ import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; -import static dagger.internal.codegen.DaggerModuleMethodSubject.Factory.assertThatMethodInUnannotatedClass; -import static dagger.internal.codegen.DaggerModuleMethodSubject.Factory.assertThatModuleMethod; - @RunWith(Parameterized.class) public class MultibindsValidatorTest { diff --git a/compiler/src/test/java/dagger/internal/codegen/MultipleRequestTest.java b/compiler/src/test/java/dagger/internal/codegen/MultipleRequestTest.java index 0434efc06ef..87a24c16801 100644 --- a/compiler/src/test/java/dagger/internal/codegen/MultipleRequestTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/MultipleRequestTest.java @@ -16,6 +16,9 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assert_; +import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; + import com.google.common.collect.ImmutableList; import com.google.testing.compile.JavaFileObjects; import javax.tools.JavaFileObject; @@ -23,9 +26,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assert_; -import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; - @RunWith(JUnit4.class) public class MultipleRequestTest { private static final JavaFileObject DEP_FILE = JavaFileObjects.forSourceLines("test.Dep", diff --git a/compiler/src/test/java/dagger/internal/codegen/ProducerModuleFactoryGeneratorTest.java b/compiler/src/test/java/dagger/internal/codegen/ProducerModuleFactoryGeneratorTest.java index 347f75b1673..733e1671728 100644 --- a/compiler/src/test/java/dagger/internal/codegen/ProducerModuleFactoryGeneratorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/ProducerModuleFactoryGeneratorTest.java @@ -16,15 +16,6 @@ // TODO(beder): Merge the error-handling tests with the ModuleFactoryGeneratorTest. package dagger.internal.codegen; -import com.google.common.collect.ImmutableList; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.testing.compile.JavaFileObjects; -import javax.inject.Qualifier; -import javax.tools.JavaFileObject; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - import static com.google.common.truth.Truth.assertAbout; import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource; import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; @@ -45,6 +36,15 @@ import static dagger.internal.codegen.ErrorMessages.PRODUCES_METHOD_SET_VALUES_RETURN_SET; import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; +import com.google.common.collect.ImmutableList; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.testing.compile.JavaFileObjects; +import javax.inject.Qualifier; +import javax.tools.JavaFileObject; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + @RunWith(JUnit4.class) public class ProducerModuleFactoryGeneratorTest { diff --git a/compiler/src/test/java/dagger/internal/codegen/ProductionComponentProcessorTest.java b/compiler/src/test/java/dagger/internal/codegen/ProductionComponentProcessorTest.java index 0edfc797e6c..1ad716b58df 100644 --- a/compiler/src/test/java/dagger/internal/codegen/ProductionComponentProcessorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/ProductionComponentProcessorTest.java @@ -16,6 +16,11 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertAbout; +import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource; +import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; +import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; + import com.google.common.collect.ImmutableList; import com.google.testing.compile.JavaFileObjects; import javax.tools.JavaFileObject; @@ -23,11 +28,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertAbout; -import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource; -import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; -import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; - @RunWith(JUnit4.class) public class ProductionComponentProcessorTest { @Test public void componentOnConcreteClass() { diff --git a/compiler/src/test/java/dagger/internal/codegen/ProductionGraphValidationTest.java b/compiler/src/test/java/dagger/internal/codegen/ProductionGraphValidationTest.java index 600ed909074..2c4ee102c5e 100644 --- a/compiler/src/test/java/dagger/internal/codegen/ProductionGraphValidationTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/ProductionGraphValidationTest.java @@ -16,6 +16,9 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertAbout; +import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; + import com.google.common.collect.ImmutableList; import com.google.testing.compile.JavaFileObjects; import javax.tools.JavaFileObject; @@ -23,9 +26,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertAbout; -import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; - /** * Unit tests for {@link BindingGraphValidator} that exercise producer-specific logic. */ diff --git a/compiler/src/test/java/dagger/internal/codegen/RepeatedModuleValidationTest.java b/compiler/src/test/java/dagger/internal/codegen/RepeatedModuleValidationTest.java index dddda0e8190..978dc6b3e37 100644 --- a/compiler/src/test/java/dagger/internal/codegen/RepeatedModuleValidationTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/RepeatedModuleValidationTest.java @@ -1,5 +1,8 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertAbout; +import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; + import com.google.common.collect.ImmutableList; import com.google.testing.compile.JavaFileObjects; import javax.tools.JavaFileObject; @@ -7,9 +10,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertAbout; -import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; - @RunWith(JUnit4.class) public class RepeatedModuleValidationTest { private static final JavaFileObject MODULE_FILE = diff --git a/compiler/src/test/java/dagger/internal/codegen/SubcomponentBuilderValidationTest.java b/compiler/src/test/java/dagger/internal/codegen/SubcomponentBuilderValidationTest.java index 31fe74c3ec3..0e8e61cf054 100644 --- a/compiler/src/test/java/dagger/internal/codegen/SubcomponentBuilderValidationTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/SubcomponentBuilderValidationTest.java @@ -16,6 +16,10 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertAbout; +import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource; +import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; + import com.google.common.collect.ImmutableList; import com.google.testing.compile.JavaFileObjects; import javax.tools.JavaFileObject; @@ -23,10 +27,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertAbout; -import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource; -import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; - /** Tests for {@link dagger.Subcomponent.Builder} validation. */ @RunWith(JUnit4.class) public class SubcomponentBuilderValidationTest { diff --git a/compiler/src/test/java/dagger/internal/codegen/SubcomponentValidationTest.java b/compiler/src/test/java/dagger/internal/codegen/SubcomponentValidationTest.java index 49e950849d0..da8e013b89b 100644 --- a/compiler/src/test/java/dagger/internal/codegen/SubcomponentValidationTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/SubcomponentValidationTest.java @@ -16,6 +16,10 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertAbout; +import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; +import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; + import com.google.common.collect.ImmutableList; import com.google.testing.compile.JavaFileObjects; import javax.tools.JavaFileObject; @@ -23,10 +27,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertAbout; -import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; -import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; - @RunWith(JUnit4.class) public final class SubcomponentValidationTest { @Test public void factoryMethod_missingModulesWithParameters() { diff --git a/compiler/src/test/java/dagger/internal/codegen/ValidationReportTest.java b/compiler/src/test/java/dagger/internal/codegen/ValidationReportTest.java index 67c63eb4a21..2ca4ce75faa 100644 --- a/compiler/src/test/java/dagger/internal/codegen/ValidationReportTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/ValidationReportTest.java @@ -16,6 +16,10 @@ package dagger.internal.codegen; +import static com.google.common.truth.Truth.assertAbout; +import static com.google.common.truth.Truth.assertThat; +import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource; + import com.google.common.collect.ImmutableSet; import com.google.testing.compile.JavaFileObjects; import dagger.internal.codegen.ValidationReport.Builder; @@ -28,10 +32,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertAbout; -import static com.google.common.truth.Truth.assertThat; -import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource; - @RunWith(JUnit4.class) public class ValidationReportTest { private static final JavaFileObject TEST_CLASS_FILE = diff --git a/compiler/src/test/java/dagger/tests/integration/operation/PrimitiveInjectionTest.java b/compiler/src/test/java/dagger/tests/integration/operation/PrimitiveInjectionTest.java index ee5dd2b1487..4befaf1d1e3 100644 --- a/compiler/src/test/java/dagger/tests/integration/operation/PrimitiveInjectionTest.java +++ b/compiler/src/test/java/dagger/tests/integration/operation/PrimitiveInjectionTest.java @@ -16,6 +16,11 @@ package dagger.tests.integration.operation; +import static com.google.common.truth.Truth.assert_; +import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; +import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; +import static java.util.Arrays.asList; + import com.google.testing.compile.JavaFileObjects; import dagger.internal.codegen.ComponentProcessor; import javax.tools.JavaFileObject; @@ -23,11 +28,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assert_; -import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources; -import static dagger.internal.codegen.GeneratedLines.GENERATED_ANNOTATION; -import static java.util.Arrays.asList; - @RunWith(JUnit4.class) public final class PrimitiveInjectionTest { diff --git a/core/src/main/java/dagger/Binds.java b/core/src/main/java/dagger/Binds.java index c61a81fbfe2..00d1a0c8a60 100644 --- a/core/src/main/java/dagger/Binds.java +++ b/core/src/main/java/dagger/Binds.java @@ -16,13 +16,13 @@ package dagger; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - /** * Annotates abstract methods of a {@link Module} that delegate bindings. For example, to * bind {@link java.util.Random} to {@link java.security.SecureRandom} a module could declare the diff --git a/core/src/main/java/dagger/Component.java b/core/src/main/java/dagger/Component.java index 26730ce74db..fffcf5ebb76 100644 --- a/core/src/main/java/dagger/Component.java +++ b/core/src/main/java/dagger/Component.java @@ -16,6 +16,9 @@ package dagger; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; @@ -25,9 +28,6 @@ import javax.inject.Scope; import javax.inject.Singleton; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - /** * Annotates an interface or abstract class for which a fully-formed, dependency-injected * implementation is to be generated from a set of {@linkplain #modules}. The generated class will diff --git a/core/src/main/java/dagger/MapKey.java b/core/src/main/java/dagger/MapKey.java index 33d12d348e6..7440ea30c97 100644 --- a/core/src/main/java/dagger/MapKey.java +++ b/core/src/main/java/dagger/MapKey.java @@ -16,15 +16,15 @@ package dagger; +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import dagger.internal.Beta; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; import java.util.Map; -import static java.lang.annotation.ElementType.ANNOTATION_TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - /** * Identifies annotation types that are used to associate keys with values returned by * {@linkplain Provides provider methods} in order to compose a {@linkplain diff --git a/core/src/main/java/dagger/Multibindings.java b/core/src/main/java/dagger/Multibindings.java index ecf38535817..c544e092fee 100644 --- a/core/src/main/java/dagger/Multibindings.java +++ b/core/src/main/java/dagger/Multibindings.java @@ -16,12 +16,12 @@ package dagger; +import static java.lang.annotation.ElementType.TYPE; + import dagger.internal.Beta; import java.lang.annotation.Documented; import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.TYPE; - /** * Annotates interfaces that declare multibindings. * diff --git a/core/src/main/java/dagger/Provides.java b/core/src/main/java/dagger/Provides.java index f46249fbb45..cbd4e29b21e 100644 --- a/core/src/main/java/dagger/Provides.java +++ b/core/src/main/java/dagger/Provides.java @@ -16,14 +16,14 @@ package dagger; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import dagger.internal.Beta; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - /** * Annotates methods of a {@linkplain Module module} to create a provider method binding. The * method's return type is bound to its returned value. The {@linkplain Component component} diff --git a/core/src/main/java/dagger/Reusable.java b/core/src/main/java/dagger/Reusable.java index 80bc90546a4..34610e5a49e 100644 --- a/core/src/main/java/dagger/Reusable.java +++ b/core/src/main/java/dagger/Reusable.java @@ -16,13 +16,13 @@ package dagger; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import dagger.internal.Beta; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import javax.inject.Scope; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - /** * A scope that indicates that the object returned by a binding may be (but might not be) reused. * diff --git a/core/src/main/java/dagger/Subcomponent.java b/core/src/main/java/dagger/Subcomponent.java index 857a23bd955..262327e5d01 100644 --- a/core/src/main/java/dagger/Subcomponent.java +++ b/core/src/main/java/dagger/Subcomponent.java @@ -16,13 +16,13 @@ package dagger; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - /** * A subcomponent that inherits the bindings from a parent {@link Component} or * {@link Subcomponent}. The details of how to associate a subcomponent with a parent are described diff --git a/core/src/main/java/dagger/internal/Beta.java b/core/src/main/java/dagger/internal/Beta.java index 089b0873a13..2e97f058e91 100644 --- a/core/src/main/java/dagger/internal/Beta.java +++ b/core/src/main/java/dagger/internal/Beta.java @@ -16,11 +16,11 @@ package dagger.internal; +import static java.lang.annotation.RetentionPolicy.SOURCE; + import java.lang.annotation.Documented; import java.lang.annotation.Retention; -import static java.lang.annotation.RetentionPolicy.SOURCE; - /** * Signifies that a public API (public class, method or field) is subject to * incompatible changes, or even removal, in a future release. An API bearing diff --git a/core/src/main/java/dagger/internal/DoubleCheck.java b/core/src/main/java/dagger/internal/DoubleCheck.java index ba94aa24405..04630d8b15a 100644 --- a/core/src/main/java/dagger/internal/DoubleCheck.java +++ b/core/src/main/java/dagger/internal/DoubleCheck.java @@ -16,11 +16,11 @@ package dagger.internal; +import static dagger.internal.Preconditions.checkNotNull; + import dagger.Lazy; import javax.inject.Provider; -import static dagger.internal.Preconditions.checkNotNull; - /** * A {@link Lazy} and {@link Provider} implementation that memoizes the value returned from a * delegate using the double-check idiom described in Item 71 of Effective Java 2. diff --git a/core/src/main/java/dagger/internal/MapFactory.java b/core/src/main/java/dagger/internal/MapFactory.java index 81c1d53d642..d4b91892481 100644 --- a/core/src/main/java/dagger/internal/MapFactory.java +++ b/core/src/main/java/dagger/internal/MapFactory.java @@ -16,13 +16,13 @@ package dagger.internal; +import static dagger.internal.DaggerCollections.newLinkedHashMapWithExpectedSize; +import static java.util.Collections.unmodifiableMap; + import java.util.Map; import java.util.Map.Entry; import javax.inject.Provider; -import static dagger.internal.DaggerCollections.newLinkedHashMapWithExpectedSize; -import static java.util.Collections.unmodifiableMap; - /** * A {@link Factory} implementation used to implement {@link Map} bindings. This factory returns a * {@code Map} when calling {@link #get} (as specified by {@link Factory}). diff --git a/core/src/main/java/dagger/internal/MapProviderFactory.java b/core/src/main/java/dagger/internal/MapProviderFactory.java index fe712b3e8b8..3ee7c5ffe48 100644 --- a/core/src/main/java/dagger/internal/MapProviderFactory.java +++ b/core/src/main/java/dagger/internal/MapProviderFactory.java @@ -16,14 +16,14 @@ package dagger.internal; +import static dagger.internal.DaggerCollections.newLinkedHashMapWithExpectedSize; +import static java.util.Collections.unmodifiableMap; + import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; import javax.inject.Provider; -import static dagger.internal.DaggerCollections.newLinkedHashMapWithExpectedSize; -import static java.util.Collections.unmodifiableMap; - /** * A {@link Factory} implementation used to implement {@link Map} bindings. This factory returns a * {@code Map>} when calling {@link #get} (as specified by {@link Factory}). diff --git a/core/src/main/java/dagger/internal/MembersInjectors.java b/core/src/main/java/dagger/internal/MembersInjectors.java index b93a6496234..44d37af12ad 100644 --- a/core/src/main/java/dagger/internal/MembersInjectors.java +++ b/core/src/main/java/dagger/internal/MembersInjectors.java @@ -16,11 +16,11 @@ package dagger.internal; +import static dagger.internal.Preconditions.checkNotNull; + import dagger.MembersInjector; import javax.inject.Inject; -import static dagger.internal.Preconditions.checkNotNull; - /** * Basic {@link MembersInjector} implementations used by the framework. * diff --git a/core/src/main/java/dagger/internal/ProviderOfLazy.java b/core/src/main/java/dagger/internal/ProviderOfLazy.java index 1f6fe003828..23b6afd7514 100644 --- a/core/src/main/java/dagger/internal/ProviderOfLazy.java +++ b/core/src/main/java/dagger/internal/ProviderOfLazy.java @@ -16,11 +16,11 @@ package dagger.internal; +import static dagger.internal.Preconditions.checkNotNull; + import dagger.Lazy; import javax.inject.Provider; -import static dagger.internal.Preconditions.checkNotNull; - /** * A {@link Provider} of {@link Lazy} instances that each delegate to a given {@link Provider}. */ diff --git a/core/src/main/java/dagger/internal/SetFactory.java b/core/src/main/java/dagger/internal/SetFactory.java index c2e292ed3fa..618df1b6ed4 100644 --- a/core/src/main/java/dagger/internal/SetFactory.java +++ b/core/src/main/java/dagger/internal/SetFactory.java @@ -16,12 +16,6 @@ package dagger.internal; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Set; -import javax.inject.Provider; - import static dagger.internal.DaggerCollections.hasDuplicates; import static dagger.internal.DaggerCollections.newHashSetWithExpectedSize; import static dagger.internal.DaggerCollections.presizedList; @@ -29,6 +23,12 @@ import static java.util.Collections.emptySet; import static java.util.Collections.unmodifiableSet; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Set; +import javax.inject.Provider; + /** * A {@link Factory} implementation used to implement {@link Set} bindings. This factory always * returns a new {@link Set} instance for each call to {@link #get} (as required by {@link Factory}) diff --git a/core/src/main/java/dagger/internal/SingleCheck.java b/core/src/main/java/dagger/internal/SingleCheck.java index b356dea9070..4f38bc222a6 100644 --- a/core/src/main/java/dagger/internal/SingleCheck.java +++ b/core/src/main/java/dagger/internal/SingleCheck.java @@ -16,11 +16,11 @@ package dagger.internal; +import static dagger.internal.Preconditions.checkNotNull; + import dagger.Lazy; import javax.inject.Provider; -import static dagger.internal.Preconditions.checkNotNull; - /** * A {@link Provider} implementation that memoizes the result of a {@link Factory} instance using * simple lazy initialization, not the double-checked lock pattern. diff --git a/core/src/main/java/dagger/multibindings/ClassKey.java b/core/src/main/java/dagger/multibindings/ClassKey.java index b6e0f48b763..4e4e7183e4e 100644 --- a/core/src/main/java/dagger/multibindings/ClassKey.java +++ b/core/src/main/java/dagger/multibindings/ClassKey.java @@ -16,13 +16,13 @@ package dagger.multibindings; +import static java.lang.annotation.ElementType.METHOD; + import dagger.MapKey; import dagger.internal.Beta; import java.lang.annotation.Documented; import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.METHOD; - /** * A {@link MapKey} annotation for maps with {@code Class} keys. * diff --git a/core/src/main/java/dagger/multibindings/ElementsIntoSet.java b/core/src/main/java/dagger/multibindings/ElementsIntoSet.java index 1ce136e33a0..84ae395d300 100644 --- a/core/src/main/java/dagger/multibindings/ElementsIntoSet.java +++ b/core/src/main/java/dagger/multibindings/ElementsIntoSet.java @@ -16,13 +16,13 @@ package dagger.multibindings; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - /** * The method's return type is {@code Set} and all values are contributed to the set. The {@code * Set} produced from the accumulation of values will be immutable. An example use is to provide diff --git a/core/src/main/java/dagger/multibindings/IntKey.java b/core/src/main/java/dagger/multibindings/IntKey.java index c9d343115c7..b21967b76d5 100644 --- a/core/src/main/java/dagger/multibindings/IntKey.java +++ b/core/src/main/java/dagger/multibindings/IntKey.java @@ -16,13 +16,13 @@ package dagger.multibindings; +import static java.lang.annotation.ElementType.METHOD; + import dagger.MapKey; import dagger.internal.Beta; import java.lang.annotation.Documented; import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.METHOD; - /** A {@link MapKey} annotation for maps with {@code int} keys. */ @Beta @Documented diff --git a/core/src/main/java/dagger/multibindings/IntoMap.java b/core/src/main/java/dagger/multibindings/IntoMap.java index 7b47caf4014..7a2619c8f52 100644 --- a/core/src/main/java/dagger/multibindings/IntoMap.java +++ b/core/src/main/java/dagger/multibindings/IntoMap.java @@ -16,14 +16,14 @@ package dagger.multibindings; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import dagger.internal.Beta; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - /** * The method's return type forms the type argument for the value of a * {@code Map>}, and the combination of the annotated key and the returned value diff --git a/core/src/main/java/dagger/multibindings/IntoSet.java b/core/src/main/java/dagger/multibindings/IntoSet.java index b784a527bc9..08dc2c82b21 100644 --- a/core/src/main/java/dagger/multibindings/IntoSet.java +++ b/core/src/main/java/dagger/multibindings/IntoSet.java @@ -16,13 +16,13 @@ package dagger.multibindings; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - /** * The method's return type forms the generic type argument of a {@code Set}, and the * returned value is contributed to the set. The object graph will pass dependencies to the diff --git a/core/src/main/java/dagger/multibindings/LongKey.java b/core/src/main/java/dagger/multibindings/LongKey.java index 748b31ab2c7..a5ed6b7aab9 100644 --- a/core/src/main/java/dagger/multibindings/LongKey.java +++ b/core/src/main/java/dagger/multibindings/LongKey.java @@ -16,13 +16,13 @@ package dagger.multibindings; +import static java.lang.annotation.ElementType.METHOD; + import dagger.MapKey; import dagger.internal.Beta; import java.lang.annotation.Documented; import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.METHOD; - /** A {@link MapKey} annotation for maps with {@code long} keys. */ @Beta @Documented diff --git a/core/src/main/java/dagger/multibindings/Multibinds.java b/core/src/main/java/dagger/multibindings/Multibinds.java index 3731ae05c1c..545d451d7c3 100644 --- a/core/src/main/java/dagger/multibindings/Multibinds.java +++ b/core/src/main/java/dagger/multibindings/Multibinds.java @@ -16,12 +16,12 @@ package dagger.multibindings; +import static java.lang.annotation.ElementType.METHOD; + import dagger.internal.Beta; import java.lang.annotation.Documented; import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.METHOD; - /** * Annotates abstract module methods that declare multibindings. * diff --git a/core/src/main/java/dagger/multibindings/StringKey.java b/core/src/main/java/dagger/multibindings/StringKey.java index 1b4bda58ba2..56c42a633c9 100644 --- a/core/src/main/java/dagger/multibindings/StringKey.java +++ b/core/src/main/java/dagger/multibindings/StringKey.java @@ -16,13 +16,13 @@ package dagger.multibindings; +import static java.lang.annotation.ElementType.METHOD; + import dagger.MapKey; import dagger.internal.Beta; import java.lang.annotation.Documented; import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.METHOD; - /** A {@link MapKey} annotation for maps with {@link String} keys. */ @Beta @Documented diff --git a/core/src/test/java/dagger/internal/DoubleCheckTest.java b/core/src/test/java/dagger/internal/DoubleCheckTest.java index 635b600caa7..c5c223e8acb 100644 --- a/core/src/test/java/dagger/internal/DoubleCheckTest.java +++ b/core/src/test/java/dagger/internal/DoubleCheckTest.java @@ -16,6 +16,10 @@ package dagger.internal; +import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.Truth.assert_; +import static org.junit.Assert.fail; + import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.google.common.util.concurrent.Uninterruptibles; @@ -34,10 +38,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; -import static com.google.common.truth.Truth.assert_; -import static org.junit.Assert.fail; - @RunWith(JUnit4.class) public class DoubleCheckTest { @Test diff --git a/core/src/test/java/dagger/internal/InstanceFactoryTest.java b/core/src/test/java/dagger/internal/InstanceFactoryTest.java index 6f94fb9291c..b89aa0792ba 100644 --- a/core/src/test/java/dagger/internal/InstanceFactoryTest.java +++ b/core/src/test/java/dagger/internal/InstanceFactoryTest.java @@ -16,14 +16,14 @@ package dagger.internal; +import static com.google.common.truth.Truth.assert_; + import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assert_; - @RunWith(JUnit4.class) public final class InstanceFactoryTest { @Rule public final ExpectedException thrown = ExpectedException.none(); diff --git a/core/src/test/java/dagger/internal/MapProviderFactoryTest.java b/core/src/test/java/dagger/internal/MapProviderFactoryTest.java index b1c9e94270e..1c3c80154fe 100644 --- a/core/src/test/java/dagger/internal/MapProviderFactoryTest.java +++ b/core/src/test/java/dagger/internal/MapProviderFactoryTest.java @@ -16,6 +16,8 @@ package dagger.internal; +import static com.google.common.truth.Truth.assert_; + import java.util.LinkedHashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; @@ -26,8 +28,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assert_; - @RunWith(JUnit4.class) @SuppressWarnings("unchecked") public class MapProviderFactoryTest { diff --git a/core/src/test/java/dagger/internal/SetFactoryTest.java b/core/src/test/java/dagger/internal/SetFactoryTest.java index fd7c8f8deda..575292e23dd 100644 --- a/core/src/test/java/dagger/internal/SetFactoryTest.java +++ b/core/src/test/java/dagger/internal/SetFactoryTest.java @@ -16,6 +16,8 @@ package dagger.internal; +import static com.google.common.truth.Truth.assertThat; + import com.google.common.collect.ImmutableSet; import java.util.Arrays; import java.util.LinkedHashSet; @@ -28,8 +30,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; - @RunWith(JUnit4.class) @SuppressWarnings("unchecked") public class SetFactoryTest { diff --git a/core/src/test/java/dagger/internal/SingleCheckTest.java b/core/src/test/java/dagger/internal/SingleCheckTest.java index 20dd138e830..bcb6d996bf1 100644 --- a/core/src/test/java/dagger/internal/SingleCheckTest.java +++ b/core/src/test/java/dagger/internal/SingleCheckTest.java @@ -16,13 +16,13 @@ package dagger.internal; +import static com.google.common.truth.Truth.assertThat; + import javax.inject.Provider; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; - /** * Tests {@link SingleCheck}. */ diff --git a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/DemoApplication.java b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/DemoApplication.java index 5a9ab0771fc..1174a62bf83 100644 --- a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/DemoApplication.java +++ b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/DemoApplication.java @@ -18,7 +18,6 @@ import android.app.Application; import android.location.LocationManager; -import javax.inject.Singleton; import javax.inject.Inject; public class DemoApplication extends Application { diff --git a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/DemoApplicationModule.java b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/DemoApplicationModule.java index 4807b35c3ce..e3f4634aded 100644 --- a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/DemoApplicationModule.java +++ b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/DemoApplicationModule.java @@ -16,14 +16,14 @@ package com.example.dagger.activitygraphs; +import static android.content.Context.LOCATION_SERVICE; + import android.app.Application; import android.location.LocationManager; import dagger.Module; import dagger.Provides; import javax.inject.Singleton; -import static android.content.Context.LOCATION_SERVICE; - /** * A module for Android-specific dependencies which require a {@link Context} or * {@link android.app.Application} to create. diff --git a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/PerActivity.java b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/PerActivity.java index 7577aafcc0b..f4700161c8e 100644 --- a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/PerActivity.java +++ b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/PerActivity.java @@ -16,11 +16,11 @@ package com.example.dagger.activitygraphs; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import java.lang.annotation.Retention; import javax.inject.Scope; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - /** * A scoping annotation to permit objects whose lifetime should * conform to the life of the activity to be memoized in the diff --git a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/HomeFragment.java b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/HomeFragment.java index 3207c5208d5..37d6383c27c 100644 --- a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/HomeFragment.java +++ b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ui/HomeFragment.java @@ -16,6 +16,8 @@ package com.example.dagger.activitygraphs.ui; +import static android.view.Gravity.CENTER; + import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; @@ -24,8 +26,6 @@ import android.widget.TextView; import javax.inject.Inject; -import static android.view.Gravity.CENTER; - public class HomeFragment extends Fragment { @Inject ActivityTitleController titleController; diff --git a/examples/android-simple/src/main/java/com/example/dagger/simple/AndroidModule.java b/examples/android-simple/src/main/java/com/example/dagger/simple/AndroidModule.java index dc5922300b6..574fa727c4a 100644 --- a/examples/android-simple/src/main/java/com/example/dagger/simple/AndroidModule.java +++ b/examples/android-simple/src/main/java/com/example/dagger/simple/AndroidModule.java @@ -16,14 +16,14 @@ package com.example.dagger.simple; +import static android.content.Context.LOCATION_SERVICE; + import android.content.Context; import android.location.LocationManager; import dagger.Module; import dagger.Provides; import javax.inject.Singleton; -import static android.content.Context.LOCATION_SERVICE; - /** * A module for Android-specific dependencies which require a {@link Context} or * {@link android.app.Application} to create. diff --git a/examples/android-simple/src/main/java/com/example/dagger/simple/DemoApplication.java b/examples/android-simple/src/main/java/com/example/dagger/simple/DemoApplication.java index 630128de97e..d6b3868f5ff 100644 --- a/examples/android-simple/src/main/java/com/example/dagger/simple/DemoApplication.java +++ b/examples/android-simple/src/main/java/com/example/dagger/simple/DemoApplication.java @@ -20,8 +20,6 @@ import android.location.LocationManager; import com.example.dagger.simple.ui.HomeActivity; import dagger.Component; -import java.util.Arrays; -import java.util.List; import javax.inject.Inject; import javax.inject.Singleton; diff --git a/examples/android-simple/src/main/java/com/example/dagger/simple/ForApplication.java b/examples/android-simple/src/main/java/com/example/dagger/simple/ForApplication.java index 2cad1ce8138..517843efd9a 100644 --- a/examples/android-simple/src/main/java/com/example/dagger/simple/ForApplication.java +++ b/examples/android-simple/src/main/java/com/example/dagger/simple/ForApplication.java @@ -16,11 +16,11 @@ package com.example.dagger.simple; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import java.lang.annotation.Retention; import javax.inject.Qualifier; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - @Qualifier @Retention(RUNTIME) public @interface ForApplication { } diff --git a/producers/src/main/java/dagger/producers/Produced.java b/producers/src/main/java/dagger/producers/Produced.java index c87732ca04b..1f5dba073af 100644 --- a/producers/src/main/java/dagger/producers/Produced.java +++ b/producers/src/main/java/dagger/producers/Produced.java @@ -16,14 +16,14 @@ package dagger.producers; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.base.Objects; import dagger.internal.Beta; import java.util.concurrent.ExecutionException; import javax.annotation.CheckReturnValue; import javax.annotation.Nullable; -import static com.google.common.base.Preconditions.checkNotNull; - /** * An interface that represents the result of a {@linkplain Producer production} of type {@code T}, * or an exception that was thrown during that production. For any type {@code T} that can be diff --git a/producers/src/main/java/dagger/producers/Producer.java b/producers/src/main/java/dagger/producers/Producer.java index 978f3ad84f4..22513838eb6 100644 --- a/producers/src/main/java/dagger/producers/Producer.java +++ b/producers/src/main/java/dagger/producers/Producer.java @@ -16,9 +16,8 @@ package dagger.producers; -import dagger.internal.Beta; import com.google.common.util.concurrent.ListenableFuture; - +import dagger.internal.Beta; import javax.annotation.CheckReturnValue; /** diff --git a/producers/src/main/java/dagger/producers/ProducerModule.java b/producers/src/main/java/dagger/producers/ProducerModule.java index d5ce4a570bc..ae23c2ef443 100644 --- a/producers/src/main/java/dagger/producers/ProducerModule.java +++ b/producers/src/main/java/dagger/producers/ProducerModule.java @@ -16,15 +16,15 @@ package dagger.producers; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import dagger.Module; import dagger.internal.Beta; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - /** * Annotates a class that contributes {@link Produces} bindings to the production component. * diff --git a/producers/src/main/java/dagger/producers/Produces.java b/producers/src/main/java/dagger/producers/Produces.java index f388bec001c..a417a0535c4 100644 --- a/producers/src/main/java/dagger/producers/Produces.java +++ b/producers/src/main/java/dagger/producers/Produces.java @@ -16,15 +16,15 @@ package dagger.producers; -import dagger.internal.Beta; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import com.google.common.util.concurrent.ListenableFuture; +import dagger.internal.Beta; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - /** * Annotates methods of a producer module to create a production binding. If the method returns * a {@link ListenableFuture}, then the parameter type of the future is bound to the value that the diff --git a/producers/src/main/java/dagger/producers/Production.java b/producers/src/main/java/dagger/producers/Production.java index a65c0eb48cd..563fc166a91 100644 --- a/producers/src/main/java/dagger/producers/Production.java +++ b/producers/src/main/java/dagger/producers/Production.java @@ -16,13 +16,13 @@ package dagger.producers; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import dagger.internal.Beta; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import javax.inject.Qualifier; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - /** * Qualifies a type that will be provided to the framework for use internally. * diff --git a/producers/src/main/java/dagger/producers/ProductionComponent.java b/producers/src/main/java/dagger/producers/ProductionComponent.java index a93f049db17..77e3056765a 100644 --- a/producers/src/main/java/dagger/producers/ProductionComponent.java +++ b/producers/src/main/java/dagger/producers/ProductionComponent.java @@ -16,6 +16,8 @@ package dagger.producers; +import static java.lang.annotation.ElementType.TYPE; + import com.google.common.util.concurrent.ListenableFuture; import dagger.Module; import dagger.Provides; @@ -25,8 +27,6 @@ import javax.inject.Inject; import javax.inject.Qualifier; -import static java.lang.annotation.ElementType.TYPE; - /** * Annotates an interface or abstract class for which a fully-formed, dependency-injected * implementation is to be generated from a set of {@linkplain #modules}. The generated class will diff --git a/producers/src/main/java/dagger/producers/ProductionScope.java b/producers/src/main/java/dagger/producers/ProductionScope.java index 90e044b95c6..393c24071d5 100644 --- a/producers/src/main/java/dagger/producers/ProductionScope.java +++ b/producers/src/main/java/dagger/producers/ProductionScope.java @@ -16,12 +16,12 @@ package dagger.producers; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import java.lang.annotation.Documented; import java.lang.annotation.Retention; import javax.inject.Scope; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - /** * A scope annotation for provision bindings that are tied to the lifetime of a * {@link ProductionComponent} or {@link ProductionSubcomponent}. diff --git a/producers/src/main/java/dagger/producers/ProductionSubcomponent.java b/producers/src/main/java/dagger/producers/ProductionSubcomponent.java index c8a41639b82..4fc453af1cb 100644 --- a/producers/src/main/java/dagger/producers/ProductionSubcomponent.java +++ b/producers/src/main/java/dagger/producers/ProductionSubcomponent.java @@ -16,6 +16,9 @@ package dagger.producers; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import dagger.Component; import dagger.Module; import dagger.Subcomponent; @@ -23,9 +26,6 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - /** * A subcomponent that inherits the bindings from a parent {@link Component}, {@link Subcomponent}, * {@link ProductionComponent}, or {@link ProductionSubcomponent}. The details of how to associate a diff --git a/producers/src/main/java/dagger/producers/internal/AbstractProducer.java b/producers/src/main/java/dagger/producers/internal/AbstractProducer.java index c44033e61c4..d7fa6aec255 100644 --- a/producers/src/main/java/dagger/producers/internal/AbstractProducer.java +++ b/producers/src/main/java/dagger/producers/internal/AbstractProducer.java @@ -16,15 +16,14 @@ package dagger.producers.internal; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.util.concurrent.ListenableFuture; import dagger.producers.Producer; import dagger.producers.monitoring.ProducerMonitor; import dagger.producers.monitoring.ProducerToken; import dagger.producers.monitoring.ProductionComponentMonitor; import dagger.producers.monitoring.internal.Monitors; - -import static com.google.common.base.Preconditions.checkNotNull; - import javax.annotation.Nullable; import javax.inject.Provider; diff --git a/producers/src/main/java/dagger/producers/internal/MapOfProducerProducer.java b/producers/src/main/java/dagger/producers/internal/MapOfProducerProducer.java index f06792a2430..673498ffcf0 100644 --- a/producers/src/main/java/dagger/producers/internal/MapOfProducerProducer.java +++ b/producers/src/main/java/dagger/producers/internal/MapOfProducerProducer.java @@ -16,6 +16,9 @@ package dagger.producers.internal; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.collect.Maps.newLinkedHashMapWithExpectedSize; + import com.google.common.collect.ImmutableMap; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; @@ -23,9 +26,6 @@ import dagger.producers.Producer; import java.util.Map; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.collect.Maps.newLinkedHashMapWithExpectedSize; - /** * A {@link Producer} implementation used to implement {@link Map} bindings. This factory returns an * immediate future of {@code Map>} when calling {@link #get}. diff --git a/producers/src/main/java/dagger/producers/internal/Producers.java b/producers/src/main/java/dagger/producers/internal/Producers.java index 41210b40b60..bf24784dffa 100644 --- a/producers/src/main/java/dagger/producers/internal/Producers.java +++ b/producers/src/main/java/dagger/producers/internal/Producers.java @@ -16,6 +16,8 @@ package dagger.producers.internal; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.base.Function; import com.google.common.collect.ImmutableSet; import com.google.common.util.concurrent.AsyncFunction; @@ -26,8 +28,6 @@ import java.util.Set; import javax.inject.Provider; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Utility methods for use in generated producer code. * diff --git a/producers/src/main/java/dagger/producers/internal/ProductionImplementation.java b/producers/src/main/java/dagger/producers/internal/ProductionImplementation.java index 0391274426e..8a0149c17ad 100644 --- a/producers/src/main/java/dagger/producers/internal/ProductionImplementation.java +++ b/producers/src/main/java/dagger/producers/internal/ProductionImplementation.java @@ -16,13 +16,13 @@ package dagger.producers.internal; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import dagger.internal.Beta; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import javax.inject.Qualifier; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - /** * Qualifies a type that will be used as an internal implementation detail in the framework. * diff --git a/producers/src/main/java/dagger/producers/internal/SetOfProducedProducer.java b/producers/src/main/java/dagger/producers/internal/SetOfProducedProducer.java index bb1e49c3f1f..a7e060d9505 100644 --- a/producers/src/main/java/dagger/producers/internal/SetOfProducedProducer.java +++ b/producers/src/main/java/dagger/producers/internal/SetOfProducedProducer.java @@ -16,6 +16,10 @@ package dagger.producers.internal; +import static com.google.common.base.Preconditions.checkNotNull; +import static dagger.internal.DaggerCollections.hasDuplicates; +import static dagger.internal.DaggerCollections.presizedList; + import com.google.common.base.Function; import com.google.common.collect.ImmutableSet; import com.google.common.util.concurrent.Futures; @@ -28,10 +32,6 @@ import java.util.Set; import java.util.concurrent.ExecutionException; -import static com.google.common.base.Preconditions.checkNotNull; -import static dagger.internal.DaggerCollections.hasDuplicates; -import static dagger.internal.DaggerCollections.presizedList; - /** * A {@link Producer} implementation used to implement {@link Set} bindings. This producer returns a * future {@code Set>} whose elements are populated by subsequent calls to the delegate diff --git a/producers/src/main/java/dagger/producers/internal/SetProducer.java b/producers/src/main/java/dagger/producers/internal/SetProducer.java index 29b66242aa7..c8d75b3e6b2 100644 --- a/producers/src/main/java/dagger/producers/internal/SetProducer.java +++ b/producers/src/main/java/dagger/producers/internal/SetProducer.java @@ -16,6 +16,10 @@ package dagger.producers.internal; +import static com.google.common.base.Preconditions.checkNotNull; +import static dagger.internal.DaggerCollections.hasDuplicates; +import static dagger.internal.DaggerCollections.presizedList; + import com.google.common.base.Function; import com.google.common.collect.ImmutableSet; import com.google.common.util.concurrent.Futures; @@ -26,10 +30,6 @@ import java.util.List; import java.util.Set; -import static com.google.common.base.Preconditions.checkNotNull; -import static dagger.internal.DaggerCollections.hasDuplicates; -import static dagger.internal.DaggerCollections.presizedList; - /** * A {@link Producer} implementation used to implement {@link Set} bindings. This producer returns * a future {@link Set} whose elements are populated by subsequent calls to the delegate diff --git a/producers/src/main/java/dagger/producers/monitoring/ProducerToken.java b/producers/src/main/java/dagger/producers/monitoring/ProducerToken.java index 50281074ff2..923449025c9 100644 --- a/producers/src/main/java/dagger/producers/monitoring/ProducerToken.java +++ b/producers/src/main/java/dagger/producers/monitoring/ProducerToken.java @@ -16,12 +16,12 @@ package dagger.producers.monitoring; +import static com.google.common.base.Preconditions.checkNotNull; + import dagger.producers.Produces; import java.util.Objects; import javax.annotation.Nullable; -import static com.google.common.base.Preconditions.checkNotNull; - /** A token that represents an individual {@linkplain Produces producer method}. */ public final class ProducerToken { @Nullable private final Class classToken; diff --git a/producers/src/main/java/dagger/producers/monitoring/TimingProducerMonitor.java b/producers/src/main/java/dagger/producers/monitoring/TimingProducerMonitor.java index 1b7a6668c6a..c63e10822e5 100644 --- a/producers/src/main/java/dagger/producers/monitoring/TimingProducerMonitor.java +++ b/producers/src/main/java/dagger/producers/monitoring/TimingProducerMonitor.java @@ -16,11 +16,11 @@ package dagger.producers.monitoring; +import static java.util.concurrent.TimeUnit.NANOSECONDS; + import com.google.common.base.Stopwatch; import com.google.common.base.Ticker; -import static java.util.concurrent.TimeUnit.NANOSECONDS; - /** * A monitor that measures the timing of the execution of a producer method, and logs those timings * with the given recorder. diff --git a/producers/src/test/java/dagger/producers/ProducedTest.java b/producers/src/test/java/dagger/producers/ProducedTest.java index 01c4eab3fad..f344f9dc7f8 100644 --- a/producers/src/test/java/dagger/producers/ProducedTest.java +++ b/producers/src/test/java/dagger/producers/ProducedTest.java @@ -16,6 +16,9 @@ package dagger.producers; +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.fail; + import com.google.common.testing.EqualsTester; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; @@ -23,9 +26,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.fail; - /** * Tests {@link Produced}. */ diff --git a/producers/src/test/java/dagger/producers/internal/AbstractProducerTest.java b/producers/src/test/java/dagger/producers/internal/AbstractProducerTest.java index 6cbfb1ff795..0e2fca49534 100644 --- a/producers/src/test/java/dagger/producers/internal/AbstractProducerTest.java +++ b/producers/src/test/java/dagger/producers/internal/AbstractProducerTest.java @@ -16,6 +16,13 @@ package dagger.producers.internal; +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; @@ -33,13 +40,6 @@ import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; - /** * Tests {@link AbstractProducer}. */ diff --git a/producers/src/test/java/dagger/producers/internal/MapOfProducerProducerTest.java b/producers/src/test/java/dagger/producers/internal/MapOfProducerProducerTest.java index d0a9eef4818..fe285ed5c5e 100644 --- a/producers/src/test/java/dagger/producers/internal/MapOfProducerProducerTest.java +++ b/producers/src/test/java/dagger/producers/internal/MapOfProducerProducerTest.java @@ -16,6 +16,9 @@ package dagger.producers.internal; +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.fail; + import dagger.producers.Producer; import java.util.Map; import java.util.concurrent.ExecutionException; @@ -23,9 +26,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.fail; - @RunWith(JUnit4.class) public final class MapOfProducerProducerTest { @Test diff --git a/producers/src/test/java/dagger/producers/internal/MapProducerTest.java b/producers/src/test/java/dagger/producers/internal/MapProducerTest.java index 7e7524c8ca2..3a8f19ddc55 100644 --- a/producers/src/test/java/dagger/producers/internal/MapProducerTest.java +++ b/producers/src/test/java/dagger/producers/internal/MapProducerTest.java @@ -16,6 +16,9 @@ package dagger.producers.internal; +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.fail; + import com.google.common.collect.ImmutableMap; import dagger.producers.Producer; import java.util.Map; @@ -24,9 +27,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.fail; - @RunWith(JUnit4.class) public final class MapProducerTest { @Test diff --git a/producers/src/test/java/dagger/producers/internal/ProducersTest.java b/producers/src/test/java/dagger/producers/internal/ProducersTest.java index 3f3fa2b8c14..141e174c455 100644 --- a/producers/src/test/java/dagger/producers/internal/ProducersTest.java +++ b/producers/src/test/java/dagger/producers/internal/ProducersTest.java @@ -16,6 +16,9 @@ package dagger.producers.internal; +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.fail; + import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; @@ -29,9 +32,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.fail; - /** * Tests {@link Producers}. */ diff --git a/producers/src/test/java/dagger/producers/internal/SetOfProducedProducerTest.java b/producers/src/test/java/dagger/producers/internal/SetOfProducedProducerTest.java index c2ab2dfce01..8588bf485d9 100644 --- a/producers/src/test/java/dagger/producers/internal/SetOfProducedProducerTest.java +++ b/producers/src/test/java/dagger/producers/internal/SetOfProducedProducerTest.java @@ -16,6 +16,8 @@ package dagger.producers.internal; +import static com.google.common.truth.Truth.assertThat; + import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.collect.Sets; @@ -29,8 +31,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; - /** * Tests {@link SetOfProducedProducer}. */ diff --git a/producers/src/test/java/dagger/producers/internal/SetProducerTest.java b/producers/src/test/java/dagger/producers/internal/SetProducerTest.java index 97ed5001247..12d293ce196 100644 --- a/producers/src/test/java/dagger/producers/internal/SetProducerTest.java +++ b/producers/src/test/java/dagger/producers/internal/SetProducerTest.java @@ -16,6 +16,9 @@ package dagger.producers.internal; +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.fail; + import com.google.common.collect.ImmutableSet; import com.google.common.util.concurrent.ListenableFuture; import dagger.producers.Producer; @@ -26,9 +29,6 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.fail; - /** * Tests {@link SetProducer}. */ diff --git a/producers/src/test/java/dagger/producers/monitoring/TimingProductionComponentMonitorTest.java b/producers/src/test/java/dagger/producers/monitoring/TimingProductionComponentMonitorTest.java index 60486b074dc..449b5a6e76c 100644 --- a/producers/src/test/java/dagger/producers/monitoring/TimingProductionComponentMonitorTest.java +++ b/producers/src/test/java/dagger/producers/monitoring/TimingProductionComponentMonitorTest.java @@ -16,6 +16,11 @@ package dagger.producers.monitoring; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + import com.google.common.testing.FakeTicker; import org.junit.Before; import org.junit.Test; @@ -24,11 +29,6 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; - @RunWith(JUnit4.class) public final class TimingProductionComponentMonitorTest { private static final class ProducerClassA {} diff --git a/producers/src/test/java/dagger/producers/monitoring/TimingRecordersTest.java b/producers/src/test/java/dagger/producers/monitoring/TimingRecordersTest.java index f027d6d295e..c0c7eb6c55f 100644 --- a/producers/src/test/java/dagger/producers/monitoring/TimingRecordersTest.java +++ b/producers/src/test/java/dagger/producers/monitoring/TimingRecordersTest.java @@ -16,6 +16,13 @@ package dagger.producers.monitoring; +import static com.google.common.truth.Truth.assertThat; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + import com.google.common.collect.ImmutableList; import org.junit.Before; import org.junit.Test; @@ -25,13 +32,6 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import static com.google.common.truth.Truth.assertThat; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; - @RunWith(JUnit4.class) public final class TimingRecordersTest { @Mock diff --git a/producers/src/test/java/dagger/producers/monitoring/internal/MonitorsTest.java b/producers/src/test/java/dagger/producers/monitoring/internal/MonitorsTest.java index ed661110234..5ed6b9d6ec4 100644 --- a/producers/src/test/java/dagger/producers/monitoring/internal/MonitorsTest.java +++ b/producers/src/test/java/dagger/producers/monitoring/internal/MonitorsTest.java @@ -16,6 +16,13 @@ package dagger.producers.monitoring.internal; +import static com.google.common.truth.Truth.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + import com.google.common.collect.ImmutableList; import dagger.producers.monitoring.ProducerMonitor; import dagger.producers.monitoring.ProducerToken; @@ -28,13 +35,6 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import static com.google.common.truth.Truth.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; - @RunWith(JUnit4.class) public final class MonitorsTest { @Mock private ProductionComponentMonitor.Factory mockProductionComponentMonitorFactory; From 90263a5a44e11865ab1d30abb32bc41223082013 Mon Sep 17 00:00:00 2001 From: dpb Date: Wed, 13 Jul 2016 07:52:41 -0700 Subject: [PATCH 11/17] Don't use strings in the multibinding contribution identifier in Key, since they aren't guaranteed to be unique. Rename types and methods for clarity. Inline KeyFormatter into Key.toString(). Make the string form of a key simply "@Qualfier Type MultibindingContributionIdentifier", with absent parts skipped. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=127316588 --- .../dagger/internal/codegen/BindingGraph.java | 27 ++-- .../codegen/BindingGraphValidator.java | 39 +++--- .../internal/codegen/ComponentProcessor.java | 4 +- .../internal/codegen/DependencyRequest.java | 4 +- .../java/dagger/internal/codegen/Key.java | 124 +++++++++++------- .../dagger/internal/codegen/KeyFormatter.java | 26 +--- .../codegen/DependencyRequestMapperTest.java | 2 +- .../java/dagger/internal/codegen/KeyTest.java | 65 +++++---- .../ProductionGraphValidationTest.java | 5 +- 9 files changed, 164 insertions(+), 132 deletions(-) diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java b/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java index 54a60087f28..a71d2e36926 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java @@ -315,9 +315,9 @@ private final class Resolver { this.delegateDeclarations = delegateDeclarations; this.resolvedBindings = Maps.newLinkedHashMap(); this.explicitMultibindings = - multibindingsKeyedWithoutBindingIdentifiers(explicitBindingsSet); + multibindingContributionsByMultibindingKey(explicitBindingsSet); this.delegateMultibindingDeclarations = - multibindingsKeyedWithoutBindingIdentifiers(delegateDeclarations.values()); + multibindingContributionsByMultibindingKey(delegateDeclarations.values()); } /** @@ -684,9 +684,8 @@ private ImmutableSet getExplicitBindings(Key requestKey) { } /** - * Returns the explicit multibinding contributions whose key (minus its - * {@link Key#bindingIdentifier()}) matches the {@code requestKey} from this and all ancestor - * resolvers. + * Returns the explicit multibinding contributions that contribute to the map or set requested + * by {@code requestKey} from this and all ancestor resolvers. */ private ImmutableSet getExplicitMultibindingContributions( Key requestKey) { @@ -721,6 +720,10 @@ private ImmutableSet getDelegateBindings(Key requestKey) { return delegateBindings.build(); } + /** + * Returns the delegate multibinding contribution declarations that contribute to the map or + * set requested by {@code requestKey} from this and all ancestor resolvers. + */ private ImmutableSet getDelegateMultibindingContributions( Key requestKey) { if (MapType.isMap(requestKey) && !MapType.from(requestKey).valuesAreFrameworkType()) { @@ -931,16 +934,16 @@ private boolean isMultibindingsWithLocalContributions(ResolvedBindings resolvedB } /** - * Selects each item in {@code haveKeys} that has a {@link Key#bindingIdentifier()} and indexes - * them by its {@link HasKey#key()}, where each key has its binding identifier removed. + * A multimap of those {@code declarations} that are multibinding contribution declarations, + * indexed by the key of the set or map to which they contribute. */ static - ImmutableSetMultimap multibindingsKeyedWithoutBindingIdentifiers( - Iterable haveKeys) { + ImmutableSetMultimap multibindingContributionsByMultibindingKey( + Iterable declarations) { ImmutableSetMultimap.Builder builder = ImmutableSetMultimap.builder(); - for (T hasKey : haveKeys) { - if (hasKey.key().bindingIdentifier().isPresent()) { - builder.put(hasKey.key().withoutBindingIdentifier(), hasKey); + for (T declaration : declarations) { + if (declaration.key().multibindingContributionIdentifier().isPresent()) { + builder.put(declaration.key().withoutMultibindingContributionIdentifier(), declaration); } } return builder.build(); diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java b/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java index 531845dcd6f..6e3f23741d9 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingGraphValidator.java @@ -42,10 +42,14 @@ import static dagger.internal.codegen.ContributionType.indexByContributionType; import static dagger.internal.codegen.ErrorMessages.CANNOT_INJECT_WILDCARD_TYPE; import static dagger.internal.codegen.ErrorMessages.CONTAINS_DEPENDENCY_CYCLE_FORMAT; +import static dagger.internal.codegen.ErrorMessages.DEPENDS_ON_PRODUCTION_EXECUTOR_FORMAT; +import static dagger.internal.codegen.ErrorMessages.DUPLICATE_BINDINGS_FOR_KEY_FORMAT; import static dagger.internal.codegen.ErrorMessages.DUPLICATE_SIZE_LIMIT; import static dagger.internal.codegen.ErrorMessages.INDENT; import static dagger.internal.codegen.ErrorMessages.MEMBERS_INJECTION_WITH_UNBOUNDED_TYPE; import static dagger.internal.codegen.ErrorMessages.MULTIPLE_CONTRIBUTION_TYPES_FOR_KEY_FORMAT; +import static dagger.internal.codegen.ErrorMessages.PROVIDER_ENTRY_POINT_MAY_NOT_DEPEND_ON_PRODUCER_FORMAT; +import static dagger.internal.codegen.ErrorMessages.PROVIDER_MAY_NOT_DEPEND_ON_PRODUCER_FORMAT; import static dagger.internal.codegen.ErrorMessages.REQUIRES_AT_INJECT_CONSTRUCTOR_OR_PROVIDER_FORMAT; import static dagger.internal.codegen.ErrorMessages.REQUIRES_AT_INJECT_CONSTRUCTOR_OR_PROVIDER_OR_PRODUCER_FORMAT; import static dagger.internal.codegen.ErrorMessages.REQUIRES_PROVIDER_FORMAT; @@ -957,15 +961,17 @@ private void reportProviderMayNotDependOnProducer(DependencyPath path) { if (path.size() == 1) { new Formatter(errorMessage) .format( - ErrorMessages.PROVIDER_ENTRY_POINT_MAY_NOT_DEPEND_ON_PRODUCER_FORMAT, - formatRootRequestKey(path)); + PROVIDER_ENTRY_POINT_MAY_NOT_DEPEND_ON_PRODUCER_FORMAT, + formatCurrentDependencyRequestKey(path)); } else { ImmutableSet dependentProvisions = provisionsDependingOnLatestRequest(path); // TODO(beder): Consider displaying all dependent provisions in the error message. If we do // that, should we display all productions that depend on them also? - new Formatter(errorMessage).format(ErrorMessages.PROVIDER_MAY_NOT_DEPEND_ON_PRODUCER_FORMAT, - keyFormatter.format(dependentProvisions.iterator().next().key())); + new Formatter(errorMessage) + .format( + PROVIDER_MAY_NOT_DEPEND_ON_PRODUCER_FORMAT, + dependentProvisions.iterator().next().key()); } reportBuilder.addError(errorMessage.toString(), path.entryPointElement()); } @@ -993,8 +999,9 @@ private StringBuilder requiresErrorMessageBase(DependencyPath path) { : REQUIRES_AT_INJECT_CONSTRUCTOR_OR_PROVIDER_OR_PRODUCER_FORMAT; } } - StringBuilder errorMessage = new StringBuilder( - String.format(requiresErrorMessageFormat, keyFormatter.format(key))); + StringBuilder errorMessage = + new StringBuilder( + String.format(requiresErrorMessageFormat, formatCurrentDependencyRequestKey(path))); if (key.isValidMembersInjectionKey()) { Optional membersInjectionBinding = injectBindingRegistry.getOrFindMembersInjectionBinding(key); @@ -1020,10 +1027,10 @@ private void reportMissingBinding(DependencyPath path) { @SuppressWarnings("resource") // Appendable is a StringBuilder. private void reportDependsOnProductionExecutor(DependencyPath path) { - StringBuilder builder = new StringBuilder(); - new Formatter(builder) - .format(ErrorMessages.DEPENDS_ON_PRODUCTION_EXECUTOR_FORMAT, formatRootRequestKey(path)); - reportBuilder.addError(builder.toString(), path.entryPointElement()); + reportBuilder.addError( + String.format( + DEPENDS_ON_PRODUCTION_EXECUTOR_FORMAT, formatCurrentDependencyRequestKey(path)), + path.entryPointElement()); } @SuppressWarnings("resource") // Appendable is a StringBuilder. @@ -1040,7 +1047,7 @@ private void reportDuplicateBindings(DependencyPath path) { } StringBuilder builder = new StringBuilder(); new Formatter(builder) - .format(ErrorMessages.DUPLICATE_BINDINGS_FOR_KEY_FORMAT, formatRootRequestKey(path)); + .format(DUPLICATE_BINDINGS_FOR_KEY_FORMAT, formatCurrentDependencyRequestKey(path)); ImmutableSet duplicateBindings = inlineContributionsWithoutBindingElements(resolvedBindings).contributionBindings(); bindingDeclarationFormatter.formatIndentedList( @@ -1088,7 +1095,8 @@ private ImmutableList validationPath() { private void reportMultipleContributionTypes(DependencyPath path) { StringBuilder builder = new StringBuilder(); new Formatter(builder) - .format(MULTIPLE_CONTRIBUTION_TYPES_FOR_KEY_FORMAT, formatRootRequestKey(path)); + .format( + MULTIPLE_CONTRIBUTION_TYPES_FOR_KEY_FORMAT, formatCurrentDependencyRequestKey(path)); ResolvedBindings resolvedBindings = path.currentResolvedBindings(); ImmutableListMultimap declarationsByType = declarationsByType(resolvedBindings); @@ -1112,7 +1120,7 @@ private void reportMultipleContributionTypes(DependencyPath path) { private void reportDuplicateMapKeys( DependencyPath path, Collection mapBindings) { StringBuilder builder = new StringBuilder(); - builder.append(duplicateMapKeysError(formatRootRequestKey(path))); + builder.append(duplicateMapKeysError(formatCurrentDependencyRequestKey(path))); bindingDeclarationFormatter.formatIndentedList(builder, mapBindings, 1, DUPLICATE_SIZE_LIMIT); reportBuilder.addError(builder.toString(), path.entryPointElement()); } @@ -1122,7 +1130,8 @@ private void reportInconsistentMapKeyAnnotations( Multimap, ContributionBinding> mapBindingsByAnnotationType) { StringBuilder builder = - new StringBuilder(inconsistentMapKeyAnnotationsError(formatRootRequestKey(path))); + new StringBuilder( + inconsistentMapKeyAnnotationsError(formatCurrentDependencyRequestKey(path))); for (Map.Entry, Collection> entry : mapBindingsByAnnotationType.asMap().entrySet()) { DeclaredType annotationType = entry.getKey().get(); @@ -1285,7 +1294,7 @@ private String formatContributionType(ContributionType type) { } } - private String formatRootRequestKey(DependencyPath path) { + private String formatCurrentDependencyRequestKey(DependencyPath path) { return keyFormatter.format(path.currentDependencyRequest().key()); } diff --git a/compiler/src/main/java/dagger/internal/codegen/ComponentProcessor.java b/compiler/src/main/java/dagger/internal/codegen/ComponentProcessor.java index c8ba5ba6d70..6c60484f634 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ComponentProcessor.java +++ b/compiler/src/main/java/dagger/internal/codegen/ComponentProcessor.java @@ -69,7 +69,7 @@ protected Iterable initSteps() { new BindingDeclarationFormatter(methodSignatureFormatter); DependencyRequestFormatter dependencyRequestFormatter = new DependencyRequestFormatter(types, elements); - KeyFormatter keyFormatter = new KeyFormatter(methodSignatureFormatter); + KeyFormatter keyFormatter = new KeyFormatter(); InjectValidator injectValidator = new InjectValidator(types, elements, compilerOptions); InjectValidator injectValidatorWhenGeneratingCode = injectValidator.whenGeneratingCode(); @@ -91,7 +91,7 @@ protected Iterable initSteps() { MultibindingsMethodValidator multibindingsMethodValidator = new MultibindingsMethodValidator(elements, types); - Key.Factory keyFactory = new Key.Factory(types, elements, methodSignatureFormatter); + Key.Factory keyFactory = new Key.Factory(types, elements); MultibindingsValidator multibindingsValidator = new MultibindingsValidator( diff --git a/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java b/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java index 977221af45e..e11344c2965 100644 --- a/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java +++ b/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java @@ -225,8 +225,8 @@ DependencyRequest forImplicitMapBinding( DependencyRequest forMultibindingContribution( DependencyRequest request, ContributionBinding multibindingContribution) { checkArgument( - multibindingContribution.key().bindingIdentifier().isPresent(), - "multibindingContribution's key must have a binding identifier: %s", + multibindingContribution.key().multibindingContributionIdentifier().isPresent(), + "multibindingContribution's key must have a multibinding contribution identifier: %s", multibindingContribution); return new AutoValue_DependencyRequest( multibindingContributionRequestKind(multibindingContribution), diff --git a/compiler/src/main/java/dagger/internal/codegen/Key.java b/compiler/src/main/java/dagger/internal/codegen/Key.java index ce6cee6f0fe..7745ab5d7f7 100644 --- a/compiler/src/main/java/dagger/internal/codegen/Key.java +++ b/compiler/src/main/java/dagger/internal/codegen/Key.java @@ -34,7 +34,7 @@ import com.google.auto.value.AutoValue; import com.google.common.base.Equivalence; import com.google.common.base.Function; -import com.google.common.base.MoreObjects; +import com.google.common.base.Joiner; import com.google.common.base.Optional; import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableList; @@ -101,29 +101,55 @@ interface HasKey { abstract Equivalence.Wrapper wrappedType(); /** - * Absent except for multibinding contributions. Each multibound map and set is represented by a - * {@linkplain ProvisionBinding.Factory#syntheticMultibinding(DependencyRequest, Iterable) - * synthetic binding} that depends on the specific contributions to that map or set. Each such - * contribution binding therefore needs a key that identifies the specific binding, and not only - * the qualified type that is bound. + * Distinguishes keys for multibinding contributions that share a {@link #type()} and {@link + * #qualifier()}. * - *

For nonsynthetic multibinding contributions, this should be a human-readable string that - * identifies the method and contributing module. + *

Each multibound map and set has a {@linkplain + * ProvisionBinding.Factory#syntheticMultibinding(DependencyRequest, Iterable) synthetic + * multibinding} that depends on the specific contributions to that map or set using keys that + * identify those multibinding contributions. + * + *

Absent except for multibinding contributions. + */ + abstract Optional multibindingContributionIdentifier(); + + /** + * An object that identifies a multibinding contribution method and the module class that + * contributes it to the graph. + * + * @see Key#multibindingContributionIdentifier() */ - abstract Optional bindingIdentifier(); + static final class MultibindingContributionIdentifier { + private final String identifierString; - /** An object that uniquely identifies a multibinding contribution binding. */ - @AutoValue - abstract static class BindingIdentifier { - abstract String string(); + MultibindingContributionIdentifier( + ExecutableElement bindingMethod, TypeElement contributingModule) { + this.identifierString = + String.format( + "%s#%s", contributingModule.getQualifiedName(), bindingMethod.getSimpleName()); + } + + /** + * {@inheritDoc} + * + *

The returned string is human-readable and distinguishes the keys in the same way as the + * whole object. + */ + @Override + public String toString() { + return identifierString; + } @Override - public final String toString() { - return string(); + public boolean equals(Object obj) { + return obj instanceof MultibindingContributionIdentifier + && ((MultibindingContributionIdentifier) obj) + .identifierString.equals(this.identifierString); } - static BindingIdentifier create(String string) { - return new AutoValue_Key_BindingIdentifier(string); + @Override + public int hashCode() { + return identifierString.hashCode(); } } @@ -148,34 +174,32 @@ private static TypeMirror normalize(Types types, TypeMirror type) { } /** - * A key whose {@link #qualifier()} and {@link #bindingIdentifier()} are equivalent to this - * one's, but with {@code newType} (normalized) as its {@link #type()}. + * A key whose {@link #qualifier()} and {@link #multibindingContributionIdentifier()} are + * equivalent to this one's, but with {@code newType} (normalized) as its {@link #type()}. */ private Key withType(Types types, TypeMirror newType) { return new AutoValue_Key( wrappedQualifier(), MoreTypes.equivalence().wrap(normalize(types, newType)), - bindingIdentifier()); + multibindingContributionIdentifier()); } /** * A key whose {@link #qualifier()} and {@link #type()} are equivalent to this one's, but with - * {@code bindingIdentifier} as its {@link #bindingIdentifier()}. + * {@code identifier} as its {@link #multibindingContributionIdentifier()}. */ - private Key withBindingIdentifier(String bindingIdentifier) { - return new AutoValue_Key( - wrappedQualifier(), - wrappedType(), - Optional.of(BindingIdentifier.create(bindingIdentifier))); + private Key withMultibindingContributionIdentifier( + MultibindingContributionIdentifier identifier) { + return new AutoValue_Key(wrappedQualifier(), wrappedType(), Optional.of(identifier)); } /** - * A key whose {@link #qualifier()} and {@link #type()} are equivalent to this one's, but with an - * absent {@link #bindingIdentifier()}. + * A key whose {@link #qualifier()} and {@link #type()} are equivalent to this one's, but without + * a {@link #multibindingContributionIdentifier()}. */ - Key withoutBindingIdentifier() { + Key withoutMultibindingContributionIdentifier() { return new AutoValue_Key( - wrappedQualifier(), wrappedType(), Optional.absent()); + wrappedQualifier(), wrappedType(), Optional.absent()); } boolean isValidMembersInjectionKey() { @@ -224,14 +248,17 @@ boolean isValidImplicitProvisionKey(final Types types) { }, null); } + /** + * {@inheritDoc} + * + *

The returned string is equal to another key's if and only if this key is {@link + * #equal(Object)} to it. + */ @Override public String toString() { - return MoreObjects.toStringHelper(Key.class) - .omitNullValues() - .add("qualifier", qualifier().orNull()) - .add("type", type()) - .add("bindingIdentifier", bindingIdentifier().orNull()) - .toString(); + return Joiner.on(' ') + .skipNulls() + .join(qualifier().orNull(), type(), multibindingContributionIdentifier().orNull()); } /** @@ -252,12 +279,10 @@ public Key apply(HasKey hasKey) { static final class Factory { private final Types types; private final Elements elements; - private final MethodSignatureFormatter methodSignatureFormatter; - Factory(Types types, Elements elements, MethodSignatureFormatter methodSignatureFormatter) { + Factory(Types types, Elements elements) { this.types = checkNotNull(types); this.elements = checkNotNull(elements); - this.methodSignatureFormatter = checkNotNull(methodSignatureFormatter); } private DeclaredType setOf(TypeMirror elementType) { @@ -335,7 +360,8 @@ private Key forProvidesOrProducesMethod( Key key = forMethod(method, keyType); return contributionType.equals(ContributionType.UNIQUE) ? key - : key.withBindingIdentifier(bindingIdentifier(method, contributingModule)); + : key.withMultibindingContributionIdentifier( + new MultibindingContributionIdentifier(method, contributingModule)); } /** @@ -377,12 +403,8 @@ Key forBindsMethod(ExecutableElement method, TypeElement contributingModule) { Key key = forMethod(method, keyType); return contributionType.equals(ContributionType.UNIQUE) ? key - : key.withBindingIdentifier(bindingIdentifier(method, contributingModule)); - } - - private String bindingIdentifier(ExecutableElement method, TypeElement contributingModule) { - return methodSignatureFormatter.format( - method, Optional.of(MoreTypes.asDeclared(contributingModule.asType()))); + : key.withMultibindingContributionIdentifier( + new MultibindingContributionIdentifier(method, contributingModule)); } private TypeMirror bindingMethodKeyType( @@ -443,35 +465,35 @@ private Key forMethod(ExecutableElement method, TypeMirror keyType) { return new AutoValue_Key( wrapOptionalInEquivalence(getQualifier(method)), MoreTypes.equivalence().wrap(keyType), - Optional.absent()); + Optional.absent()); } Key forInjectConstructorWithResolvedType(TypeMirror type) { return new AutoValue_Key( Optional.>absent(), MoreTypes.equivalence().wrap(type), - Optional.absent()); + Optional.absent()); } Key forComponent(TypeMirror type) { return new AutoValue_Key( Optional.>absent(), MoreTypes.equivalence().wrap(normalize(types, type)), - Optional.absent()); + Optional.absent()); } Key forMembersInjectedType(TypeMirror type) { return new AutoValue_Key( Optional.>absent(), MoreTypes.equivalence().wrap(normalize(types, type)), - Optional.absent()); + Optional.absent()); } Key forQualifiedType(Optional qualifier, TypeMirror type) { return new AutoValue_Key( wrapOptionalInEquivalence(qualifier), MoreTypes.equivalence().wrap(normalize(types, type)), - Optional.absent()); + Optional.absent()); } Key forProductionExecutor() { diff --git a/compiler/src/main/java/dagger/internal/codegen/KeyFormatter.java b/compiler/src/main/java/dagger/internal/codegen/KeyFormatter.java index b14869fafaa..e5d391f63dc 100644 --- a/compiler/src/main/java/dagger/internal/codegen/KeyFormatter.java +++ b/compiler/src/main/java/dagger/internal/codegen/KeyFormatter.java @@ -16,32 +16,10 @@ package dagger.internal.codegen; -/** - * Formats a {@link Key} into a {@link String} suitable for use in error messages and JSON keys. - * - * @author Christian Gruber - * @since 2.0 - */ +/** Formats a {@link Key} into a {@link String} suitable for use in error messages. */ final class KeyFormatter extends Formatter { - - final MethodSignatureFormatter methodSignatureFormatter; - - KeyFormatter(MethodSignatureFormatter methodSignatureFormatter) { - this.methodSignatureFormatter = methodSignatureFormatter; - } - @Override public String format(Key key) { - if (key.bindingIdentifier().isPresent()) { - // If there's a binding identifier, use that. - return key.bindingIdentifier().get().toString(); - } - StringBuilder builder = new StringBuilder(); - if (key.qualifier().isPresent()) { - builder.append(key.qualifier().get()); - builder.append(' '); - } - builder.append(key.type()); - return builder.toString(); + return key.toString(); } } diff --git a/compiler/src/test/java/dagger/internal/codegen/DependencyRequestMapperTest.java b/compiler/src/test/java/dagger/internal/codegen/DependencyRequestMapperTest.java index cd6e5a32512..162305408c6 100644 --- a/compiler/src/test/java/dagger/internal/codegen/DependencyRequestMapperTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/DependencyRequestMapperTest.java @@ -57,7 +57,7 @@ public class DependencyRequestMapperTest { @Before public void setUp() { this.types = compilationRule.getTypes(); this.elements = compilationRule.getElements(); - this.keyFactory = new Key.Factory(types, elements, new MethodSignatureFormatter(types)); + this.keyFactory = new Key.Factory(types, elements); this.dependencyRequestFactory = new DependencyRequest.Factory(elements, keyFactory); } diff --git a/compiler/src/test/java/dagger/internal/codegen/KeyTest.java b/compiler/src/test/java/dagger/internal/codegen/KeyTest.java index 82d0dd196ea..80a1bc3e331 100644 --- a/compiler/src/test/java/dagger/internal/codegen/KeyTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/KeyTest.java @@ -26,7 +26,7 @@ import com.google.testing.compile.CompilationRule; import dagger.Module; import dagger.Provides; -import dagger.internal.codegen.Key.BindingIdentifier; +import dagger.internal.codegen.Key.MultibindingContributionIdentifier; import dagger.multibindings.ElementsIntoSet; import dagger.multibindings.IntoSet; import dagger.producers.ProducerModule; @@ -57,14 +57,12 @@ public class KeyTest { private Elements elements; private Types types; - private MethodSignatureFormatter methodSignatureFormatter; private Key.Factory keyFactory; @Before public void setUp() { this.types = compilationRule.getTypes(); this.elements = compilationRule.getElements(); - this.methodSignatureFormatter = new MethodSignatureFormatter(types); - this.keyFactory = new Key.Factory(types, elements, methodSignatureFormatter); + this.keyFactory = new Key.Factory(types, elements); } @Test public void forInjectConstructorWithResolvedType() { @@ -72,14 +70,15 @@ public class KeyTest { compilationRule.getElements().getTypeElement(InjectedClass.class.getCanonicalName()); ExecutableElement constructor = Iterables.getOnlyElement(ElementFilter.constructorsIn(typeElement.getEnclosedElements())); - assertThat( - keyFactory.forInjectConstructorWithResolvedType( - constructor.getEnclosingElement().asType())) + Key key = + keyFactory.forInjectConstructorWithResolvedType(constructor.getEnclosingElement().asType()); + assertThat(key) .isEqualTo( new AutoValue_Key( Optional.>absent(), MoreTypes.equivalence().wrap(typeElement.asType()), - Optional.absent())); + Optional.absent())); + assertThat(key.toString()).isEqualTo("dagger.internal.codegen.KeyTest.InjectedClass"); } static final class InjectedClass { @@ -93,12 +92,14 @@ static final class InjectedClass { elements.getTypeElement(ProvidesMethodModule.class.getCanonicalName()); ExecutableElement providesMethod = Iterables.getOnlyElement(ElementFilter.methodsIn(moduleElement.getEnclosedElements())); - assertThat(keyFactory.forProvidesMethod(providesMethod, moduleElement)) + Key key = keyFactory.forProvidesMethod(providesMethod, moduleElement); + assertThat(key) .isEqualTo( new AutoValue_Key( Optional.>absent(), MoreTypes.equivalence().wrap(stringType), - Optional.absent())); + Optional.absent())); + assertThat(key.toString()).isEqualTo("java.lang.String"); } @Module @@ -120,6 +121,10 @@ static final class ProvidesMethodModule { assertThat(MoreTypes.equivalence().wrap(key.qualifier().get().getAnnotationType())) .isEqualTo(MoreTypes.equivalence().wrap(qualifierElement.asType())); assertThat(key.wrappedType()).isEqualTo(MoreTypes.equivalence().wrap(stringType)); + assertThat(key.toString()) + .isEqualTo( + "@dagger.internal.codegen.KeyTest.TestQualifier(" + + "{@dagger.internal.codegen.KeyTest.InnerAnnotation}) java.lang.String"); } @Test public void qualifiedKeyEquivalents() { @@ -138,6 +143,10 @@ static final class ProvidesMethodModule { Key injectionKey = keyFactory.forQualifiedType(Optional.of(qualifier), type); assertThat(provisionKey).isEqualTo(injectionKey); + assertThat(injectionKey.toString()) + .isEqualTo( + "@dagger.internal.codegen.KeyTest.TestQualifier(" + + "{@dagger.internal.codegen.KeyTest.InnerAnnotation}) java.lang.String"); } @Module @@ -168,16 +177,20 @@ static final class QualifiedFieldHolder { elements.getTypeElement(SetProvidesMethodsModule.class.getCanonicalName()); for (ExecutableElement providesMethod : ElementFilter.methodsIn(moduleElement.getEnclosedElements())) { - assertThat(keyFactory.forProvidesMethod(providesMethod, moduleElement)) + Key key = keyFactory.forProvidesMethod(providesMethod, moduleElement); + assertThat(key) .isEqualTo( new AutoValue_Key( Optional.>absent(), MoreTypes.equivalence().wrap(setOfStringsType), Optional.of( - BindingIdentifier.create( - methodSignatureFormatter.format( - providesMethod, - Optional.of(MoreTypes.asDeclared(moduleElement.asType()))))))); + new MultibindingContributionIdentifier(providesMethod, moduleElement)))); + assertThat(key.toString()) + .isEqualTo( + String.format( + "java.util.Set " + + "dagger.internal.codegen.KeyTest.SetProvidesMethodsModule#%s", + providesMethod.getSimpleName())); } } @@ -224,6 +237,8 @@ static final class BoxedPrimitiveTypes { Key intKey = keyFactory.forProvidesMethod(intMethod, primitiveHolder); Key integerKey = keyFactory.forProvidesMethod(integerMethod, boxedPrimitiveHolder); assertThat(intKey).isEqualTo(integerKey); + assertThat(intKey.toString()).isEqualTo("java.lang.Integer"); + assertThat(integerKey.toString()).isEqualTo("java.lang.Integer"); } @Test public void forProducesMethod() { @@ -232,12 +247,14 @@ static final class BoxedPrimitiveTypes { elements.getTypeElement(ProducesMethodsModule.class.getCanonicalName()); for (ExecutableElement producesMethod : ElementFilter.methodsIn(moduleElement.getEnclosedElements())) { - assertThat(keyFactory.forProducesMethod(producesMethod, moduleElement)) + Key key = keyFactory.forProducesMethod(producesMethod, moduleElement); + assertThat(key) .isEqualTo( new AutoValue_Key( Optional.>absent(), MoreTypes.equivalence().wrap(stringType), - Optional.absent())); + Optional.absent())); + assertThat(key.toString()).isEqualTo("java.lang.String"); } } @@ -260,16 +277,20 @@ static final class ProducesMethodsModule { elements.getTypeElement(SetProducesMethodsModule.class.getCanonicalName()); for (ExecutableElement producesMethod : ElementFilter.methodsIn(moduleElement.getEnclosedElements())) { - assertThat(keyFactory.forProducesMethod(producesMethod, moduleElement)) + Key key = keyFactory.forProducesMethod(producesMethod, moduleElement); + assertThat(key) .isEqualTo( new AutoValue_Key( Optional.>absent(), MoreTypes.equivalence().wrap(setOfStringsType), Optional.of( - BindingIdentifier.create( - methodSignatureFormatter.format( - producesMethod, - Optional.of(MoreTypes.asDeclared(moduleElement.asType()))))))); + new MultibindingContributionIdentifier(producesMethod, moduleElement)))); + assertThat(key.toString()) + .isEqualTo( + String.format( + "java.util.Set " + + "dagger.internal.codegen.KeyTest.SetProducesMethodsModule#%s", + producesMethod.getSimpleName())); } } diff --git a/compiler/src/test/java/dagger/internal/codegen/ProductionGraphValidationTest.java b/compiler/src/test/java/dagger/internal/codegen/ProductionGraphValidationTest.java index 2c4ee102c5e..e47178faa0a 100644 --- a/compiler/src/test/java/dagger/internal/codegen/ProductionGraphValidationTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/ProductionGraphValidationTest.java @@ -337,9 +337,8 @@ public void monitoringDependsOnProduction() { " }", "}"); String expectedError = - "@Provides @dagger.multibindings.IntoSet" - + " dagger.producers.monitoring.ProductionComponentMonitor.Factory" - + " test.TestClass.MonitoringModule.monitorFactory(test.TestClass.A) is a provision," + "java.util.Set" + + " test.TestClass.MonitoringModule#monitorFactory is a provision," + " which cannot depend on a production."; assertAbout(javaSources()).that(ImmutableList.of(EXECUTOR_MODULE, component)) .processedWith(new ComponentProcessor()) From 02dfceab2ead8402b9e90ce21d18d70c19f18f81 Mon Sep 17 00:00:00 2001 From: dpb Date: Wed, 13 Jul 2016 09:31:16 -0700 Subject: [PATCH 12/17] Fix binding graph error reporting for Provider> entry points. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=127325410 --- .../codegen/DependencyRequestFormatter.java | 1 + .../internal/codegen/GraphValidationTest.java | 61 ++++++++++++------- 2 files changed, 40 insertions(+), 22 deletions(-) diff --git a/compiler/src/main/java/dagger/internal/codegen/DependencyRequestFormatter.java b/compiler/src/main/java/dagger/internal/codegen/DependencyRequestFormatter.java index b0131883be8..74d57469a51 100644 --- a/compiler/src/main/java/dagger/internal/codegen/DependencyRequestFormatter.java +++ b/compiler/src/main/java/dagger/internal/codegen/DependencyRequestFormatter.java @@ -210,6 +210,7 @@ private String componentMethodRequestVerb(DependencyRequest request) { case INSTANCE: case LAZY: case PROVIDER: + case PROVIDER_OF_LAZY: return "provided"; case MEMBERS_INJECTOR: diff --git a/compiler/src/test/java/dagger/internal/codegen/GraphValidationTest.java b/compiler/src/test/java/dagger/internal/codegen/GraphValidationTest.java index 32b30c8c91b..8a2eb5bc6da 100644 --- a/compiler/src/test/java/dagger/internal/codegen/GraphValidationTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/GraphValidationTest.java @@ -922,10 +922,12 @@ public void duplicateExplicitBindings_UniqueBindingAndMultibindingDeclaration() "package test;", "", "import dagger.Component;", + "import dagger.Lazy;", "import dagger.Module;", "import dagger.Provides;", "import javax.inject.Inject;", "import javax.inject.Named;", + "import javax.inject.Provider;", "", "final class TestClass {", " interface A {}", @@ -958,44 +960,59 @@ public void duplicateExplicitBindings_UniqueBindingAndMultibindingDeclaration() " interface AComponent {", " @Named(\"slim shady\") D getFoo();", " C injectC(C c);", + " Provider cProvider();", + " Lazy lazyC();", + " Provider> lazyCProvider();", " }", "}"); String errorText = "test.TestClass.A cannot be provided without an @Provides-annotated method."; String firstError = - Joiner.on('\n') + Joiner.on("\n ") .join( errorText, - " test.TestClass.A is injected at", - " test.TestClass.B.(a)", - " test.TestClass.B is injected at", - " test.TestClass.C.b", - " test.TestClass.C is injected at", - " test.TestClass.DImpl.(c, …)", - " test.TestClass.DImpl is injected at", - " test.TestClass.DModule.d(…, impl, …)", - " @javax.inject.Named(\"slim shady\") test.TestClass.D is provided at", - " test.TestClass.AComponent.getFoo()"); - String secondError = - Joiner.on('\n') + "test.TestClass.A is injected at", + " test.TestClass.B.(a)", + "test.TestClass.B is injected at", + " test.TestClass.C.b", + "test.TestClass.C is injected at", + " test.TestClass.DImpl.(c, …)", + "test.TestClass.DImpl is injected at", + " test.TestClass.DModule.d(…, impl, …)", + "@javax.inject.Named(\"slim shady\") test.TestClass.D is provided at", + " test.TestClass.AComponent.getFoo()"); + String otherErrorFormat = + Joiner.on("\n ") .join( errorText, - " test.TestClass.A is injected at", - " test.TestClass.B.(a)", - " test.TestClass.B is injected at", - " test.TestClass.C.b", - " test.TestClass.C is injected at", - " test.TestClass.AComponent.injectC(c)"); + "test.TestClass.A is injected at", + " test.TestClass.B.(a)", + "test.TestClass.B is injected at", + " test.TestClass.C.b", + "test.TestClass.C is %s at", + " test.TestClass.AComponent.%s"); assertAbout(javaSource()) .that(component) .processedWith(new ComponentProcessor()) .failsToCompile() .withErrorContaining(firstError) .in(component) - .onLine(38) + .onLine(40) + .and() + .withErrorContaining(String.format(otherErrorFormat, "injected", "injectC(c)")) + .in(component) + .onLine(41) + .and() + .withErrorContaining(String.format(otherErrorFormat, "provided", "cProvider()")) + .in(component) + .onLine(42) + .and() + .withErrorContaining(String.format(otherErrorFormat, "provided", "lazyC()")) + .in(component) + .onLine(43) .and() - .withErrorContaining(secondError) + .withErrorContaining(String.format(otherErrorFormat, "provided", "lazyCProvider()")) .in(component) - .onLine(39); + .onLine(44); } @Test From 22b2b8cc7561f011bd829ca3c6186c153795b9e2 Mon Sep 17 00:00:00 2001 From: dpb Date: Wed, 13 Jul 2016 13:36:40 -0700 Subject: [PATCH 13/17] Fix bug when @Reusable is applied to a @Binds declaration. Also don't bother caching if a @Reusable @Binds delegates to a binding that is already scoped. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=127353416 --- .../java/test/binds/SimpleBindingModule.java | 6 ++++ .../main/java/test/binds/TestComponent.java | 3 ++ .../java/dagger/internal/SingleCheck.java | 34 +++++++++++-------- 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/compiler/src/it/functional-tests/src/main/java/test/binds/SimpleBindingModule.java b/compiler/src/it/functional-tests/src/main/java/test/binds/SimpleBindingModule.java index 1482e984fbb..34c46076324 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/binds/SimpleBindingModule.java +++ b/compiler/src/it/functional-tests/src/main/java/test/binds/SimpleBindingModule.java @@ -19,6 +19,7 @@ import dagger.Binds; import dagger.Module; import dagger.Provides; +import dagger.Reusable; import dagger.multibindings.ElementsIntoSet; import dagger.multibindings.IntKey; import dagger.multibindings.IntoMap; @@ -37,6 +38,11 @@ abstract class SimpleBindingModule { @Binds abstract Object bindObject(FooOfStrings impl); + @Binds + @Reusable + @SomeQualifier + abstract Object bindReusableObject(FooOfStrings impl); + @Binds abstract Foo bindFooOfStrings(FooOfStrings impl); diff --git a/compiler/src/it/functional-tests/src/main/java/test/binds/TestComponent.java b/compiler/src/it/functional-tests/src/main/java/test/binds/TestComponent.java index d3a4e9635a6..bada4b16451 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/binds/TestComponent.java +++ b/compiler/src/it/functional-tests/src/main/java/test/binds/TestComponent.java @@ -28,6 +28,9 @@ public interface TestComponent { Object object(); + @SomeQualifier + Object reusableObject(); + Foo fooOfStrings(); Foo fooOfObjects(); diff --git a/core/src/main/java/dagger/internal/SingleCheck.java b/core/src/main/java/dagger/internal/SingleCheck.java index 4f38bc222a6..45b1bd793d1 100644 --- a/core/src/main/java/dagger/internal/SingleCheck.java +++ b/core/src/main/java/dagger/internal/SingleCheck.java @@ -22,39 +22,43 @@ import javax.inject.Provider; /** - * A {@link Provider} implementation that memoizes the result of a {@link Factory} instance using + * A {@link Provider} implementation that memoizes the result of another {@link Provider} using * simple lazy initialization, not the double-checked lock pattern. */ public final class SingleCheck implements Provider, Lazy { private static final Object UNINITIALIZED = new Object(); - private volatile Factory factory; + private volatile Provider provider; private volatile Object instance = UNINITIALIZED; - private SingleCheck(Factory factory) { - assert factory != null; - this.factory = factory; + private SingleCheck(Provider provider) { + assert provider != null; + this.provider = provider; } - @SuppressWarnings("unchecked") // cast only happens when result comes from the factory + @SuppressWarnings("unchecked") // cast only happens when result comes from the delegate provider @Override public T get() { - // factory is volatile and might become null afer the check to instance == UNINITIALIZED - // retrieve the factory first, which should not be null if instance is UNINITIALIZED. + // provider is volatile and might become null after the check to instance == UNINITIALIZED, so + // retrieve the provider first, which should not be null if instance is UNINITIALIZED. // This relies upon instance also being volatile so that the reads and writes of both variables // cannot be reordered. - Factory factoryReference = factory; + Provider providerReference = provider; if (instance == UNINITIALIZED) { - instance = factoryReference.get(); + instance = providerReference.get(); // Null out the reference to the provider. We are never going to need it again, so we can make - // it eligble for GC. - factory = null; + // it eligible for GC. + provider = null; } return (T) instance; } - /** Returns a new provider for the given factory. */ - public static Provider provider(Factory factory) { - return new SingleCheck(checkNotNull(factory)); + /** Returns a {@link Provider} that caches the value from the given delegate provider. */ + public static Provider provider(Provider provider) { + // If a scoped @Binds delegates to a scoped binding, don't cache the value again. + if (provider instanceof SingleCheck || provider instanceof DoubleCheck) { + return provider; + } + return new SingleCheck(checkNotNull(provider)); } } From ab482f981e0a55b30a1371f5d5b6e859af9e4b98 Mon Sep 17 00:00:00 2001 From: dpb Date: Tue, 19 Jul 2016 11:19:36 -0700 Subject: [PATCH 14/17] Fix problem with factories with conflicting field/parameter names. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=127852321 --- .../java/test/ModuleWithConflictingNames.java | 48 +++++++++ .../producerstest/SimpleProducerModule.java | 9 ++ .../internal/codegen/FactoryGenerator.java | 36 ++++--- .../codegen/ProducerFactoryGenerator.java | 98 ++++++++++++------- 4 files changed, 141 insertions(+), 50 deletions(-) create mode 100644 compiler/src/it/functional-tests/src/main/java/test/ModuleWithConflictingNames.java diff --git a/compiler/src/it/functional-tests/src/main/java/test/ModuleWithConflictingNames.java b/compiler/src/it/functional-tests/src/main/java/test/ModuleWithConflictingNames.java new file mode 100644 index 00000000000..2ec4f387dfd --- /dev/null +++ b/compiler/src/it/functional-tests/src/main/java/test/ModuleWithConflictingNames.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2016 The Dagger Authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package test; + +import dagger.Module; +import dagger.Provides; +import javax.inject.Inject; +import javax.inject.Provider; + +/** + * Module with bindings that might result in generated factories with conflicting field and + * parameter names. + */ +@Module +final class ModuleWithConflictingNames { + @Provides + static Object object(int foo, Provider fooProvider) { + return foo + fooProvider.get(); + } + + /** + * A class that might result in a generated factory with conflicting field and parameter names. + */ + static class InjectedClassWithConflictingNames { + final int foo; + final Provider fooProvider; + + @Inject + InjectedClassWithConflictingNames(int foo, Provider fooProvider) { + this.foo = foo; + this.fooProvider = fooProvider; + } + } +} diff --git a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/SimpleProducerModule.java b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/SimpleProducerModule.java index 0485075e6ce..a06c059a952 100644 --- a/compiler/src/it/producers-functional-tests/src/main/java/producerstest/SimpleProducerModule.java +++ b/compiler/src/it/producers-functional-tests/src/main/java/producerstest/SimpleProducerModule.java @@ -269,4 +269,13 @@ static ListenableFuture> setOfStrFutureValuesWithArgThrowingExceptio return Futures.>immediateFuture( ImmutableSet.of("set of str with arg 1", "set of str with arg 2 throwing exception")); } + + /** + * A binding method that might result in a generated factory with conflicting field and parameter + * names. + */ + @Produces + static Object object(int foo, Provider fooProvider) { + return foo + fooProvider.get(); + } } diff --git a/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java b/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java index 21d4156b392..0796afb42c8 100644 --- a/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/FactoryGenerator.java @@ -43,6 +43,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.FieldSpec; @@ -56,6 +57,7 @@ import dagger.internal.MembersInjectors; import dagger.internal.Preconditions; import java.util.List; +import java.util.Map; import javax.annotation.processing.Filer; import javax.inject.Inject; import javax.lang.model.element.Element; @@ -111,7 +113,9 @@ Optional write(ClassName generatedTypeName, ProvisionBinding b TypeSpec.Builder factoryBuilder; Optional constructorBuilder = Optional.absent(); ImmutableList typeParameters = bindingTypeElementTypeVariableNames(binding); - ImmutableMap fields = generateBindingFieldsForDependencies(binding); + UniqueNameSet uniqueFieldNames = new UniqueNameSet(); + ImmutableMap.Builder fieldsBuilder = ImmutableMap.builder(); + boolean useRawType = binding.factoryCreationStrategy() == ENUM_INSTANCE && binding.bindingKind() == INJECTION @@ -139,12 +143,17 @@ Optional write(ClassName generatedTypeName, ProvisionBinding b factoryBuilder, constructorBuilder.get()); } - for (FrameworkField bindingField : fields.values()) { - addConstructorParameterAndTypeField( - bindingField.type(), - bindingField.name(), - factoryBuilder, - constructorBuilder.get()); + for (Map.Entry entry : + generateBindingFieldsForDependencies(binding).entrySet()) { + BindingKey bindingKey = entry.getKey(); + FrameworkField bindingField = entry.getValue(); + FieldSpec field = + addConstructorParameterAndTypeField( + bindingField.type(), + uniqueFieldNames.getUniqueName(bindingField.name()), + factoryBuilder, + constructorBuilder.get()); + fieldsBuilder.put(bindingKey, field); } break; case DELEGATE: @@ -152,6 +161,7 @@ Optional write(ClassName generatedTypeName, ProvisionBinding b default: throw new AssertionError(); } + ImmutableMap fields = fieldsBuilder.build(); factoryBuilder .addModifiers(PUBLIC) @@ -214,8 +224,7 @@ Optional write(ClassName generatedTypeName, ProvisionBinding b for (DependencyRequest dependency : binding.dependencies()) { parameters.add( frameworkTypeUsageStatement( - CodeBlock.of("$L", fields.get(dependency.bindingKey()).name()), - dependency.kind())); + CodeBlock.of("$N", fields.get(dependency.bindingKey())), dependency.kind())); } CodeBlock parametersCodeBlock = makeParametersCodeBlock(parameters); @@ -250,9 +259,10 @@ Optional write(ClassName generatedTypeName, ProvisionBinding b CANNOT_RETURN_NULL_FROM_NON_NULLABLE_PROVIDES_METHOD); } } else if (binding.membersInjectionRequest().isPresent()) { - getMethodBuilder.addStatement("return $T.injectMembers($L, new $T($L))", + getMethodBuilder.addStatement( + "return $T.injectMembers($N, new $T($L))", MembersInjectors.class, - fields.get(binding.membersInjectionRequest().get().bindingKey()).name(), + fields.get(binding.membersInjectionRequest().get().bindingKey()), providedTypeName, parametersCodeBlock); } else { @@ -268,7 +278,8 @@ Optional write(ClassName generatedTypeName, ProvisionBinding b return Optional.of(factoryBuilder); } - private void addConstructorParameterAndTypeField( + @CanIgnoreReturnValue + private FieldSpec addConstructorParameterAndTypeField( TypeName typeName, String variableName, TypeSpec.Builder factoryBuilder, @@ -278,5 +289,6 @@ private void addConstructorParameterAndTypeField( ParameterSpec parameter = ParameterSpec.builder(typeName, variableName).build(); constructorBuilder.addParameter(parameter); constructorBuilder.addCode("assert $1N != null; this.$2N = $1N;", parameter, field); + return field; } } diff --git a/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java b/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java index 7e362d7ba35..1921b6bafc9 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java +++ b/compiler/src/main/java/dagger/internal/codegen/ProducerFactoryGenerator.java @@ -24,6 +24,7 @@ import static dagger.internal.codegen.AnnotationSpecs.SUPPRESS_WARNINGS_UNCHECKED; import static dagger.internal.codegen.CodeBlocks.makeParametersCodeBlock; import static dagger.internal.codegen.SourceFiles.frameworkTypeUsageStatement; +import static dagger.internal.codegen.SourceFiles.generateBindingFieldsForDependencies; import static dagger.internal.codegen.SourceFiles.generatedClassNameForBinding; import static dagger.internal.codegen.TypeNames.ASYNC_FUNCTION; import static dagger.internal.codegen.TypeNames.FUTURES; @@ -49,11 +50,13 @@ import com.google.common.collect.Iterables; import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; +import com.squareup.javapoet.FieldSpec; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; import dagger.producers.Producer; +import java.util.Map; import javax.annotation.processing.Filer; import javax.lang.model.element.Element; import javax.lang.model.type.TypeMirror; @@ -95,25 +98,46 @@ Optional write(ClassName generatedTypeName, ProductionBinding .addModifiers(PUBLIC, FINAL) .superclass(abstractProducerOf(providedTypeName)); - ImmutableMap fields = - SourceFiles.generateBindingFieldsForDependencies(binding); + UniqueNameSet uniqueFieldNames = new UniqueNameSet(); + ImmutableMap.Builder fieldsBuilder = ImmutableMap.builder(); + + MethodSpec.Builder constructorBuilder = constructorBuilder().addModifiers(PUBLIC); + + Optional moduleField = + binding.requiresModuleInstance() + ? Optional.of( + addFieldAndConstructorParameter( + factoryBuilder, + constructorBuilder, + uniqueFieldNames.getUniqueName("module"), + TypeName.get(binding.bindingTypeElement().get().asType()))) + : Optional.absent(); + + for (Map.Entry entry : + generateBindingFieldsForDependencies(binding).entrySet()) { + BindingKey bindingKey = entry.getKey(); + FrameworkField bindingField = entry.getValue(); + FieldSpec field = + addFieldAndConstructorParameter( + factoryBuilder, + constructorBuilder, + uniqueFieldNames.getUniqueName(bindingField.name()), + bindingField.type()); + fieldsBuilder.put(bindingKey, field); + } + ImmutableMap fields = fieldsBuilder.build(); - MethodSpec.Builder constructorBuilder = - constructorBuilder() - .addModifiers(PUBLIC) - .addStatement( - "super($L, $L)", - fields.get(binding.monitorRequest().get().bindingKey()).name(), - producerTokenConstruction(generatedTypeName, binding)); + constructorBuilder.addStatement( + "super($N, $L)", + fields.get(binding.monitorRequest().get().bindingKey()), + producerTokenConstruction(generatedTypeName, binding)); if (binding.requiresModuleInstance()) { - TypeName moduleType = TypeName.get(binding.bindingTypeElement().get().asType()); - addFieldAndConstructorParameter(factoryBuilder, constructorBuilder, "module", moduleType); + assignField(constructorBuilder, moduleField.get()); } - - for (FrameworkField bindingField : fields.values()) { - addFieldAndConstructorParameter( - factoryBuilder, constructorBuilder, bindingField.name(), bindingField.type()); + + for (FieldSpec field : fields.values()) { + assignField(constructorBuilder, field); } MethodSpec.Builder computeMethodBuilder = @@ -125,8 +149,7 @@ Optional write(ClassName generatedTypeName, ProductionBinding ImmutableList asyncDependencies = asyncDependencies(binding); for (DependencyRequest dependency : asyncDependencies) { TypeName futureType = listenableFutureOf(asyncDependencyType(dependency)); - CodeBlock futureAccess = - CodeBlock.of("$L.get()", fields.get(dependency.bindingKey()).name()); + CodeBlock futureAccess = CodeBlock.of("$N.get()", fields.get(dependency.bindingKey())); computeMethodBuilder.addStatement( "$T $L = $L", futureType, @@ -178,16 +201,21 @@ Optional write(ClassName generatedTypeName, ProductionBinding } // TODO(ronshapiro): consolidate versions of these - private static void addFieldAndConstructorParameter( + private static FieldSpec addFieldAndConstructorParameter( TypeSpec.Builder typeBuilder, MethodSpec.Builder constructorBuilder, String variableName, TypeName variableType) { - typeBuilder.addField(variableType, variableName, PRIVATE, FINAL); + FieldSpec field = FieldSpec.builder(variableType, variableName, PRIVATE, FINAL).build(); + typeBuilder.addField(field); + constructorBuilder.addParameter(field.type, field.name); + return field; + } + + private static void assignField(MethodSpec.Builder constructorBuilder, FieldSpec field) { constructorBuilder - .addParameter(variableType, variableName) - .addStatement("assert $L != null", variableName) - .addStatement("this.$1L = $1L", variableName); + .addStatement("assert $N != null", field) + .addStatement("this.$1N = $1N", field); } /** Returns a list of dependencies that are generated asynchronously. */ @@ -231,10 +259,10 @@ private static String dependencyFutureName(DependencyRequest dependency) { /** Represents the transformation of an input future by a producer method. */ abstract static class FutureTransform { - protected final ImmutableMap fields; + protected final ImmutableMap fields; protected final ProductionBinding binding; - FutureTransform(ImmutableMap fields, ProductionBinding binding) { + FutureTransform(ImmutableMap fields, ProductionBinding binding) { this.fields = fields; this.binding = binding; } @@ -257,7 +285,7 @@ boolean hasUncheckedCast() { } static FutureTransform create( - ImmutableMap fields, + ImmutableMap fields, ProductionBinding binding, ImmutableList asyncDependencies) { if (asyncDependencies.isEmpty()) { @@ -272,8 +300,7 @@ static FutureTransform create( } static final class NoArgFutureTransform extends FutureTransform { - NoArgFutureTransform( - ImmutableMap fields, ProductionBinding binding) { + NoArgFutureTransform(ImmutableMap fields, ProductionBinding binding) { super(fields, binding); } @@ -298,8 +325,7 @@ ImmutableList parameterCodeBlocks() { for (DependencyRequest dependency : binding.dependencies()) { parameterCodeBlocks.add( frameworkTypeUsageStatement( - CodeBlock.of("$L", fields.get(dependency.bindingKey()).name()), - dependency.kind())); + CodeBlock.of("$N", fields.get(dependency.bindingKey())), dependency.kind())); } return parameterCodeBlocks.build(); } @@ -309,7 +335,7 @@ static final class SingleArgFutureTransform extends FutureTransform { private final DependencyRequest asyncDependency; SingleArgFutureTransform( - ImmutableMap fields, + ImmutableMap fields, ProductionBinding binding, DependencyRequest asyncDependency) { super(fields, binding); @@ -343,8 +369,7 @@ ImmutableList parameterCodeBlocks() { parameterCodeBlocks.add( // TODO(ronshapiro) extract this into a method shared by FutureTransform subclasses frameworkTypeUsageStatement( - CodeBlock.of("$L", fields.get(dependency.bindingKey()).name()), - dependency.kind())); + CodeBlock.of("$N", fields.get(dependency.bindingKey())), dependency.kind())); } } return parameterCodeBlocks.build(); @@ -355,7 +380,7 @@ static final class MultiArgFutureTransform extends FutureTransform { private final ImmutableList asyncDependencies; MultiArgFutureTransform( - ImmutableMap fields, + ImmutableMap fields, ProductionBinding binding, ImmutableList asyncDependencies) { super(fields, binding); @@ -423,9 +448,7 @@ private static TypeName asyncDependencyType(DependencyRequest dependency) { } private static ImmutableList getParameterCodeBlocks( - ProductionBinding binding, - ImmutableMap fields, - String listArgName) { + ProductionBinding binding, ImmutableMap fields, String listArgName) { int argIndex = 0; ImmutableList.Builder codeBlocks = ImmutableList.builder(); for (DependencyRequest dependency : binding.dependencies()) { @@ -437,8 +460,7 @@ private static ImmutableList getParameterCodeBlocks( } else { codeBlocks.add( frameworkTypeUsageStatement( - CodeBlock.of("$L", fields.get(dependency.bindingKey()).name()), - dependency.kind())); + CodeBlock.of("$N", fields.get(dependency.bindingKey())), dependency.kind())); } } return codeBlocks.build(); From 8b0c281f10ac1fa30675dc031272b0254da7b3a7 Mon Sep 17 00:00:00 2001 From: ronshapiro Date: Tue, 19 Jul 2016 14:40:36 -0700 Subject: [PATCH 15/17] Validate @Binds @IntoMap map-keys like any other @IntoMap method with map-keys ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=127875797 --- .../internal/codegen/BindingMethodValidator.java | 4 ++-- .../internal/codegen/BindsMethodValidator.java | 9 --------- .../dagger/internal/codegen/ErrorMessages.java | 2 +- .../codegen/BindsMethodValidatorTest.java | 16 ++++++++++++++++ 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingMethodValidator.java b/compiler/src/main/java/dagger/internal/codegen/BindingMethodValidator.java index 3b1c68bc2ca..8b6d197655b 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingMethodValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingMethodValidator.java @@ -32,7 +32,7 @@ import static dagger.internal.codegen.ErrorMessages.BINDING_METHOD_THROWS_ANY; import static dagger.internal.codegen.ErrorMessages.BINDING_METHOD_THROWS_CHECKED; import static dagger.internal.codegen.ErrorMessages.BINDING_METHOD_TYPE_PARAMETER; -import static dagger.internal.codegen.ErrorMessages.BINDING_METHOD_WITH_MULTIPLE_MAP_KEY; +import static dagger.internal.codegen.ErrorMessages.BINDING_METHOD_WITH_MULTIPLE_MAP_KEYS; import static dagger.internal.codegen.ErrorMessages.BINDING_METHOD_WITH_NO_MAP_KEY; import static dagger.internal.codegen.ErrorMessages.MULTIBINDING_ANNOTATION_CONFLICTS_WITH_BINDING_ANNOTATION_ENUM; import static dagger.internal.codegen.ErrorMessages.MULTIPLE_MULTIBINDING_ANNOTATIONS_ON_METHOD; @@ -346,7 +346,7 @@ protected void checkMapKeys(ValidationReport.Builder builder) case 1: break; default: - builder.addError(formatErrorMessage(BINDING_METHOD_WITH_MULTIPLE_MAP_KEY)); + builder.addError(formatErrorMessage(BINDING_METHOD_WITH_MULTIPLE_MAP_KEYS)); break; } } else if (!mapKeys.isEmpty()) { diff --git a/compiler/src/main/java/dagger/internal/codegen/BindsMethodValidator.java b/compiler/src/main/java/dagger/internal/codegen/BindsMethodValidator.java index eba409ff6af..e2555664339 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindsMethodValidator.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindsMethodValidator.java @@ -71,15 +71,6 @@ protected void checkMethod(ValidationReport.Builder builder) checkParameters(builder); } - @Override // TODO(dpb, ronshapiro): When @Binds methods support @IntoMap, stop overriding. - protected void checkMapKeys(ValidationReport.Builder builder) { - if (!isAnnotationPresent(builder.getSubject(), IntoMap.class)) { - for (AnnotationMirror mapKey : getMapKeys(builder.getSubject())) { - builder.addError(BINDING_METHOD_NOT_MAP_HAS_MAP_KEY, builder.getSubject(), mapKey); - } - } - } - private void checkParameters(ValidationReport.Builder builder) { ExecutableElement method = builder.getSubject(); List parameters = method.getParameters(); diff --git a/compiler/src/main/java/dagger/internal/codegen/ErrorMessages.java b/compiler/src/main/java/dagger/internal/codegen/ErrorMessages.java index 66385681591..287409bee78 100644 --- a/compiler/src/main/java/dagger/internal/codegen/ErrorMessages.java +++ b/compiler/src/main/java/dagger/internal/codegen/ErrorMessages.java @@ -193,7 +193,7 @@ static String inconsistentMapKeyAnnotationsError(String key) { static final String BINDING_METHOD_WITH_NO_MAP_KEY = "@%s methods of type map must declare a map key"; - static final String BINDING_METHOD_WITH_MULTIPLE_MAP_KEY = + static final String BINDING_METHOD_WITH_MULTIPLE_MAP_KEYS = "@%s methods may not have more than one @MapKey-marked annotation"; static final String BINDING_METHOD_WITH_SAME_NAME = diff --git a/compiler/src/test/java/dagger/internal/codegen/BindsMethodValidatorTest.java b/compiler/src/test/java/dagger/internal/codegen/BindsMethodValidatorTest.java index 34eedcacd97..a8567173d91 100644 --- a/compiler/src/test/java/dagger/internal/codegen/BindsMethodValidatorTest.java +++ b/compiler/src/test/java/dagger/internal/codegen/BindsMethodValidatorTest.java @@ -21,6 +21,8 @@ import com.google.common.collect.ImmutableList; import dagger.Module; +import dagger.multibindings.IntKey; +import dagger.multibindings.LongKey; import dagger.producers.ProducerModule; import java.io.IOException; import java.lang.annotation.Annotation; @@ -119,6 +121,20 @@ public void elementsIntoSet_withRawSets() { .hasError("cannot return a raw Set"); } + @Test + public void intoMap_noMapKey() { + assertThatMethod("@Binds @IntoMap abstract Object bindNoMapKey(String string);") + .hasError("methods of type map must declare a map key"); + } + + @Test + public void intoMap_multipleMapKeys() { + assertThatMethod( + "@Binds @IntoMap @IntKey(1) @LongKey(2L) abstract Object manyMapKeys(String string);") + .importing(IntKey.class, LongKey.class) + .hasError("may not have more than one @MapKey-marked annotation"); + } + private DaggerModuleMethodSubject assertThatMethod(String method) { return assertThatModuleMethod(method).withDeclaration(moduleDeclaration); } From 4938083d25c1eee3ec8796adfce700ef2d7b322b Mon Sep 17 00:00:00 2001 From: ronshapiro Date: Wed, 20 Jul 2016 15:04:52 -0700 Subject: [PATCH 16/17] Add DependencyRequest.Builder; clarify a parameter to DelegateDeclaration. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=127993326 --- .../internal/codegen/DelegateDeclaration.java | 8 +- .../internal/codegen/DependencyRequest.java | 121 ++++++++++-------- 2 files changed, 75 insertions(+), 54 deletions(-) diff --git a/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java b/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java index 599c3c15fa4..b845f90c280 100644 --- a/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java +++ b/compiler/src/main/java/dagger/internal/codegen/DelegateDeclaration.java @@ -57,20 +57,20 @@ static final class Factory { } DelegateDeclaration create( - ExecutableElement bindsMethod, TypeElement contributingElement) { + ExecutableElement bindsMethod, TypeElement contributingModule) { checkArgument(MoreElements.isAnnotationPresent(bindsMethod, Binds.class)); ExecutableType resolvedMethod = MoreTypes.asExecutable( - types.asMemberOf(MoreTypes.asDeclared(contributingElement.asType()), bindsMethod)); + types.asMemberOf(MoreTypes.asDeclared(contributingModule.asType()), bindsMethod)); DependencyRequest delegateRequest = dependencyRequestFactory.forRequiredResolvedVariable( Iterables.getOnlyElement(bindsMethod.getParameters()), Iterables.getOnlyElement(resolvedMethod.getParameterTypes())); return new AutoValue_DelegateDeclaration( ContributionType.fromBindingMethod(bindsMethod), - keyFactory.forBindsMethod(bindsMethod, contributingElement), + keyFactory.forBindsMethod(bindsMethod, contributingModule), Optional.of(bindsMethod), - Optional.of(contributingElement), + Optional.of(contributingModule), delegateRequest, wrapOptionalInEquivalence(getMapKey(bindsMethod))); } diff --git a/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java b/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java index e11344c2965..70886d0f4fe 100644 --- a/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java +++ b/compiler/src/main/java/dagger/internal/codegen/DependencyRequest.java @@ -33,6 +33,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.util.concurrent.ListenableFuture; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import dagger.Lazy; import dagger.MembersInjector; import dagger.Provides; @@ -41,6 +42,7 @@ import dagger.producers.Producer; import dagger.producers.internal.AbstractProducer; import java.util.List; +import javax.annotation.CheckReturnValue; import javax.inject.Inject; import javax.inject.Provider; import javax.lang.model.element.AnnotationMirror; @@ -173,6 +175,35 @@ public boolean apply(DependencyRequest request) { } }; + private static DependencyRequest.Builder builder() { + return new AutoValue_DependencyRequest.Builder() + .isNullable(false) + .isSynthetic(false); + } + + @CanIgnoreReturnValue + @AutoValue.Builder + abstract static class Builder { + abstract Builder kind(Kind kind); + + abstract Builder key(Key key); + + abstract Builder requestElement(Element element); + + abstract Builder isNullable(boolean isNullable); + + abstract Builder overriddenVariableName(Optional overriddenVariableName); + + abstract Builder isSynthetic(boolean isSynthetic); + + Builder isSynthetic() { + return isSynthetic(true); + } + + @CheckReturnValue + abstract DependencyRequest build(); + } + /** * Factory for {@link DependencyRequest}s. * @@ -209,13 +240,12 @@ ImmutableSet forRequiredResolvedVariables( DependencyRequest forImplicitMapBinding( DependencyRequest mapOfValueRequest, Key mapOfFactoryKey) { checkNotNull(mapOfValueRequest); - return new AutoValue_DependencyRequest( - Kind.PROVIDER, - mapOfFactoryKey, - mapOfValueRequest.requestElement(), - false /* doesn't allow null */, - Optional.absent(), - true /* synthetic */); + return DependencyRequest.builder() + .kind(Kind.PROVIDER) + .key(mapOfFactoryKey) + .requestElement(mapOfValueRequest.requestElement()) + .isSynthetic() + .build(); } /** @@ -228,13 +258,12 @@ DependencyRequest forMultibindingContribution( multibindingContribution.key().multibindingContributionIdentifier().isPresent(), "multibindingContribution's key must have a multibinding contribution identifier: %s", multibindingContribution); - return new AutoValue_DependencyRequest( - multibindingContributionRequestKind(multibindingContribution), - multibindingContribution.key(), - request.requestElement(), - false /* doesn't allow null */, - Optional.absent(), - true /* synthetic */); + return DependencyRequest.builder() + .kind(multibindingContributionRequestKind(multibindingContribution)) + .key(multibindingContribution.key()) + .requestElement(request.requestElement()) + .isSynthetic() + .build(); } private Kind multibindingContributionRequestKind(ContributionBinding multibindingContribution) { @@ -314,14 +343,12 @@ DependencyRequest forComponentProductionMethod(ExecutableElement productionMetho // Only a component production method can be a request for a ListenableFuture, so we // special-case it here. if (isTypeOf(ListenableFuture.class, type)) { - return new AutoValue_DependencyRequest( - Kind.FUTURE, - keyFactory.forQualifiedType( - qualifier, Iterables.getOnlyElement(((DeclaredType) type).getTypeArguments())), - productionMethod, - false /* doesn't allow null */, - Optional.absent(), - false /* not synthetic */); + return DependencyRequest.builder() + .kind(Kind.FUTURE) + .key(keyFactory.forQualifiedType( + qualifier, Iterables.getOnlyElement(((DeclaredType) type).getTypeArguments()))) + .requestElement(productionMethod) + .build(); } else { return newDependencyRequest(productionMethod, type, qualifier, Optional.absent()); } @@ -339,34 +366,28 @@ DependencyRequest forComponentMembersInjectionMethod(ExecutableElement membersIn MoreTypes.isType(returnType) && MoreTypes.isTypeOf(MembersInjector.class, returnType) ? getOnlyElement(MoreTypes.asDeclared(returnType).getTypeArguments()) : getOnlyElement(membersInjectionMethodType.getParameterTypes()); - return new AutoValue_DependencyRequest( - Kind.MEMBERS_INJECTOR, - keyFactory.forMembersInjectedType(membersInjectedType), - membersInjectionMethod, - false /* doesn't allow null */, - Optional.absent(), - false /* not synthetic */); + return DependencyRequest.builder() + .kind(Kind.MEMBERS_INJECTOR) + .key(keyFactory.forMembersInjectedType(membersInjectedType)) + .requestElement(membersInjectionMethod) + .build(); } DependencyRequest forMembersInjectedType(DeclaredType type) { - return new AutoValue_DependencyRequest( - Kind.MEMBERS_INJECTOR, - keyFactory.forMembersInjectedType(type), - type.asElement(), - false /* doesn't allow null */, - Optional.absent(), - false /* not synthetic */); + return DependencyRequest.builder() + .kind(Kind.MEMBERS_INJECTOR) + .key(keyFactory.forMembersInjectedType(type)) + .requestElement(type.asElement()) + .build(); } DependencyRequest forProductionImplementationExecutor() { Key key = keyFactory.forProductionImplementationExecutor(); - return new AutoValue_DependencyRequest( - Kind.PROVIDER, - key, - MoreTypes.asElement(key.type()), - false /* doesn't allow null */, - Optional.absent(), - false /* not synthetic */); + return DependencyRequest.builder() + .kind(Kind.PROVIDER) + .key(key) + .requestElement(MoreTypes.asElement(key.type())) + .build(); } DependencyRequest forProductionComponentMonitorProvider() { @@ -394,13 +415,13 @@ private DependencyRequest newDependencyRequest( // TODO(sameb): should Produced/Producer always require non-nullable? boolean allowsNull = !kindAndType.kind().equals(Kind.INSTANCE) || ConfigurationAnnotations.getNullableType(requestElement).isPresent(); - return new AutoValue_DependencyRequest( - kindAndType.kind(), - keyFactory.forQualifiedType(qualifier, kindAndType.type()), - requestElement, - allowsNull, - name, - false /* not synthetic */); + return DependencyRequest.builder() + .kind(kindAndType.kind()) + .key(keyFactory.forQualifiedType(qualifier, kindAndType.type())) + .requestElement(requestElement) + .isNullable(allowsNull) + .overriddenVariableName(name) + .build(); } @AutoValue From d69732715ee05245f0b7d30ec5378c9318588499 Mon Sep 17 00:00:00 2001 From: ronshapiro Date: Wed, 20 Jul 2016 15:41:23 -0700 Subject: [PATCH 17/17] Detect local multibinding contributions from @Binds methods too. Also stop distinguishing between explicit bindings and delegate declarations during resolution time; it's confusing and unnecessary. Github: Fixes #401 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=127997438 --- .../MultibindingSubcomponents.java | 40 +++++++++ .../SubcomponentMultibindingsTest.java | 7 ++ .../dagger/internal/codegen/BindingGraph.java | 90 +++++++------------ 3 files changed, 78 insertions(+), 59 deletions(-) diff --git a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/MultibindingSubcomponents.java b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/MultibindingSubcomponents.java index 7857e3df0e0..fa53807cb8f 100644 --- a/compiler/src/it/functional-tests/src/main/java/test/subcomponent/MultibindingSubcomponents.java +++ b/compiler/src/it/functional-tests/src/main/java/test/subcomponent/MultibindingSubcomponents.java @@ -152,6 +152,37 @@ static BoundInChild onlyInChildEntry() { } } + @Module + abstract static class ChildMultibindingModuleWithOnlyBindsMultibindings { + @Provides + static BoundInParentAndChild provideBoundInParentAndChildForBinds() { + return BoundInParentAndChild.IN_CHILD; + } + + @Binds + @IntoSet + abstract BoundInParentAndChild bindsLocalContribution(BoundInParentAndChild instance); + + @Binds + @IntoMap + @StringKey("child key") + abstract BoundInParentAndChild inParentAndChildEntry(BoundInParentAndChild instance); + + @Provides + static BoundInChild provideBoundInChildForBinds() { + return BoundInChild.INSTANCE; + } + + @Binds + @IntoSet + abstract BoundInChild inChild(BoundInChild instance); + + @Binds + @IntoMap + @StringKey("child key") + abstract BoundInChild inChildEntry(BoundInChild instance); + } + interface ProvidesBoundInParent { RequiresMultibindings requiresMultibindingsBoundInParent(); } @@ -211,4 +242,13 @@ interface ChildWithProvision interface Grandchild extends ProvidesBoundInParent, ProvidesBoundInParentAndChild, ProvidesBoundInChild, ProvidesSetOfRequiresMultibindings {} + + @Component(modules = ParentMultibindingModule.class) + interface ParentWithProvisionHasChildWithBinds extends ParentWithProvision { + ChildWithBinds childWithBinds(); + } + + @Subcomponent(modules = ChildMultibindingModuleWithOnlyBindsMultibindings.class) + interface ChildWithBinds extends ChildWithProvision {} + } diff --git a/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentMultibindingsTest.java b/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentMultibindingsTest.java index 3d2c8e5d858..3e0e52702ae 100644 --- a/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentMultibindingsTest.java +++ b/compiler/src/it/functional-tests/src/test/java/test/subcomponent/SubcomponentMultibindingsTest.java @@ -225,6 +225,13 @@ public void testParentWithProvisionHasChildWithProvision() { .requiresMultibindingsBoundInParentAndChild()) .isEqualTo(BOUND_IN_PARENT_AND_CHILD); + // https://github.com/google/dagger/issues/401 + assertThat( + DaggerMultibindingSubcomponents_ParentWithProvisionHasChildWithBinds.create() + .childWithBinds() + .requiresMultibindingsBoundInParentAndChild()) + .isEqualTo(BOUND_IN_PARENT_AND_CHILD); + /* * Even though the multibinding for Set does not itself have a * contribution from the child, it must be pushed down to (not duplicated in) the child because diff --git a/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java b/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java index a71d2e36926..e880aa0094a 100644 --- a/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java +++ b/compiler/src/main/java/dagger/internal/codegen/BindingGraph.java @@ -19,6 +19,7 @@ import static com.google.auto.common.MoreElements.getAnnotationMirror; import static com.google.auto.common.MoreElements.hasModifiers; import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Predicates.in; import static com.google.common.base.Predicates.not; import static com.google.common.base.Verify.verify; @@ -302,17 +303,12 @@ private final class Resolver { ImmutableSetMultimap explicitBindings, ImmutableSetMultimap multibindingDeclarations, ImmutableSetMultimap delegateDeclarations) { - assert parentResolver != null; - this.parentResolver = parentResolver; - assert componentDescriptor != null; - this.componentDescriptor = componentDescriptor; - assert explicitBindings != null; - this.explicitBindings = explicitBindings; + this.parentResolver = checkNotNull(parentResolver); + this.componentDescriptor = checkNotNull(componentDescriptor); + this.explicitBindings = checkNotNull(explicitBindings); this.explicitBindingsSet = ImmutableSet.copyOf(explicitBindings.values()); - assert multibindingDeclarations != null; - this.multibindingDeclarations = multibindingDeclarations; - assert delegateDeclarations != null; - this.delegateDeclarations = delegateDeclarations; + this.multibindingDeclarations = checkNotNull(multibindingDeclarations); + this.delegateDeclarations = checkNotNull(delegateDeclarations); this.resolvedBindings = Maps.newLinkedHashMap(); this.explicitMultibindings = multibindingContributionsByMultibindingKey(explicitBindingsSet); @@ -361,11 +357,7 @@ ResolvedBindings lookUpBindings(DependencyRequest request) { for (Key key : keysMatchingRequest(requestKey)) { contributionBindings.addAll(getExplicitBindings(key)); - contributionBindings.addAll(getDelegateBindings(key)); - - multibindingContributionsBuilder.addAll(getExplicitMultibindingContributions(key)); - multibindingContributionsBuilder.addAll(getDelegateMultibindingContributions(key)); - + multibindingContributionsBuilder.addAll(getExplicitMultibindings(key)); multibindingDeclarationsBuilder.addAll(getMultibindingDeclarations(key)); } @@ -463,9 +455,7 @@ private FluentIterable multibindingContributionsForValueMap new Function>() { @Override public Iterable apply(Key key) { - return Iterables.concat( - getExplicitMultibindingContributions(key), - getDelegateMultibindingContributions(key)); + return getExplicitMultibindings(key); } }); } @@ -676,25 +666,36 @@ private ImmutableList getResolverLineage() { * this and all ancestor resolvers. */ private ImmutableSet getExplicitBindings(Key requestKey) { - ImmutableSet.Builder explicitBindingsForKey = ImmutableSet.builder(); + ImmutableSet.Builder bindings = ImmutableSet.builder(); + Key delegateDeclarationKey = keyFactory.convertToDelegateKey(requestKey); for (Resolver resolver : getResolverLineage()) { - explicitBindingsForKey.addAll(resolver.explicitBindings.get(requestKey)); + bindings + .addAll(resolver.explicitBindings.get(requestKey)) + .addAll( + createDelegateBindings( + resolver.delegateDeclarations.get(delegateDeclarationKey))); } - return explicitBindingsForKey.build(); + return bindings.build(); } /** * Returns the explicit multibinding contributions that contribute to the map or set requested * by {@code requestKey} from this and all ancestor resolvers. */ - private ImmutableSet getExplicitMultibindingContributions( - Key requestKey) { - ImmutableSet.Builder explicitMultibindingsForKey = - ImmutableSet.builder(); + private ImmutableSet getExplicitMultibindings(Key requestKey) { + ImmutableSet.Builder multibindings = ImmutableSet.builder(); + Key delegateDeclarationKey = keyFactory.convertToDelegateKey(requestKey); for (Resolver resolver : getResolverLineage()) { - explicitMultibindingsForKey.addAll(resolver.explicitMultibindings.get(requestKey)); + multibindings.addAll(resolver.explicitMultibindings.get(requestKey)); + if (!MapType.isMap(requestKey) || MapType.from(requestKey).valuesAreFrameworkType()) { + // There are no @Binds @IntoMap delegate declarations for Map requests. All + // @IntoMap requests must be for Map>. + multibindings.addAll( + createDelegateBindings( + resolver.delegateMultibindingDeclarations.get(delegateDeclarationKey))); + } } - return explicitMultibindingsForKey.build(); + return multibindings.build(); } /** @@ -710,37 +711,6 @@ private ImmutableSet getMultibindingDeclarations(Key ke return multibindingDeclarations.build(); } - private ImmutableSet getDelegateBindings(Key requestKey) { - Key delegateDeclarationKey = keyFactory.convertToDelegateKey(requestKey); - ImmutableSet.Builder delegateBindings = ImmutableSet.builder(); - for (Resolver resolver : getResolverLineage()) { - delegateBindings.addAll( - createDelegateBindings(resolver.delegateDeclarations.get(delegateDeclarationKey))); - } - return delegateBindings.build(); - } - - /** - * Returns the delegate multibinding contribution declarations that contribute to the map or - * set requested by {@code requestKey} from this and all ancestor resolvers. - */ - private ImmutableSet getDelegateMultibindingContributions( - Key requestKey) { - if (MapType.isMap(requestKey) && !MapType.from(requestKey).valuesAreFrameworkType()) { - // There are no @Binds @IntoMap delegate declarations for Map requests. All @IntoMap - // requests must be for Map>. - return ImmutableSet.of(); - } - Key delegateDeclarationKey = keyFactory.convertToDelegateKey(requestKey); - ImmutableSet.Builder delegateMultibindings = ImmutableSet.builder(); - for (Resolver resolver : getResolverLineage()) { - delegateMultibindings.addAll( - createDelegateBindings( - resolver.delegateMultibindingDeclarations.get(delegateDeclarationKey))); - } - return delegateMultibindings.build(); - } - private Optional getPreviouslyResolvedBindings( final BindingKey bindingKey) { Optional result = Optional.fromNullable(resolvedBindings.get(bindingKey)); @@ -925,10 +895,12 @@ public Boolean call() { } private boolean isMultibindingsWithLocalContributions(ResolvedBindings resolvedBindings) { + Key key = resolvedBindings.key(); return FluentIterable.from(resolvedBindings.contributionBindings()) .transform(ContributionBinding.KIND) .anyMatch(IS_SYNTHETIC_MULTIBINDING_KIND) - && explicitMultibindings.containsKey(resolvedBindings.key()); + && !getExplicitMultibindings(key) + .equals(parentResolver.get().getExplicitMultibindings(key)); } } }