Skip to content

Commit

Permalink
Rollback of 2cce0be
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 463883860
  • Loading branch information
bcorso authored and Dagger Team committed Jul 28, 2022
1 parent 2cce0be commit b9413ba
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 1 addition & 2 deletions java/dagger/internal/codegen/writing/GwtCompatibility.java
Expand Up @@ -18,7 +18,6 @@

import static com.google.common.base.Preconditions.checkArgument;

import androidx.room.compiler.processing.JavaPoetExtKt;
import androidx.room.compiler.processing.XAnnotation;
import androidx.room.compiler.processing.XElement;
import com.squareup.javapoet.AnnotationSpec;
Expand All @@ -39,7 +38,7 @@ static Optional<AnnotationSpec> gwtIncompatibleAnnotation(Binding binding) {
Optional<AnnotationSpec> gwtIncompatible =
element.getAllAnnotations().stream()
.filter(GwtCompatibility::isGwtIncompatible)
.map(JavaPoetExtKt::toAnnotationSpec)
.map(XAnnotations::getAnnotationSpec)
.findFirst();
if (gwtIncompatible.isPresent()) {
return gwtIncompatible;
Expand Down
4 changes: 2 additions & 2 deletions java/dagger/internal/codegen/writing/InjectionMethods.java
Expand Up @@ -52,7 +52,6 @@
import static javax.lang.model.element.Modifier.PUBLIC;
import static javax.lang.model.element.Modifier.STATIC;

import androidx.room.compiler.processing.JavaPoetExtKt;
import androidx.room.compiler.processing.XAnnotation;
import androidx.room.compiler.processing.XConstructorElement;
import androidx.room.compiler.processing.XExecutableElement;
Expand All @@ -79,6 +78,7 @@
import dagger.internal.codegen.compileroption.CompilerOptions;
import dagger.internal.codegen.extension.DaggerCollectors;
import dagger.internal.codegen.javapoet.TypeNames;
import dagger.internal.codegen.xprocessing.XAnnotations;
import dagger.spi.model.DaggerAnnotation;
import dagger.spi.model.DependencyRequest;
import java.util.List;
Expand Down Expand Up @@ -434,7 +434,7 @@ private static MethodSpec fieldProxy(
.build())
.addTypeVariables(typeVariableNames(enclosingType));

qualifier.map(JavaPoetExtKt::toAnnotationSpec).ifPresent(builder::addAnnotation);
qualifier.map(XAnnotations::getAnnotationSpec).ifPresent(builder::addAnnotation);

boolean useObject = !isRawTypePubliclyAccessible(enclosingType.getType());
UniqueNameSet parameterNameSet = new UniqueNameSet();
Expand Down
6 changes: 6 additions & 0 deletions java/dagger/internal/codegen/xprocessing/XAnnotations.java
Expand Up @@ -21,13 +21,19 @@
import androidx.room.compiler.processing.XAnnotation;
import com.google.auto.common.AnnotationMirrors;
import com.google.common.base.Equivalence;
import com.squareup.javapoet.AnnotationSpec;
import com.squareup.javapoet.ClassName;
import java.util.Arrays;

// TODO(bcorso): Consider moving these methods into XProcessing library.
/** A utility class for {@link XAnnotation} helper methods. */
public final class XAnnotations {

/** Returns the {@link AnnotationSpec} for the given annotation */
public static AnnotationSpec getAnnotationSpec(XAnnotation annotation) {
return AnnotationSpec.get(toJavac(annotation));
}

/** Returns the string representation of the given annotation. */
public static String toString(XAnnotation annotation) {
return AnnotationMirrors.toString(toJavac(annotation));
Expand Down

0 comments on commit b9413ba

Please sign in to comment.