Skip to content

Commit

Permalink
[hilt] Restore backwards compatibilty for receiver codegen.
Browse files Browse the repository at this point in the history
  • Loading branch information
inazaruk committed Dec 5, 2023
1 parent dd64ca2 commit 1972a1e
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@
import androidx.room.compiler.processing.XTypeElement;
import androidx.room.compiler.processing.XTypeParameterElement;
import com.google.common.collect.ImmutableSet;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterSpec;
import com.squareup.javapoet.TypeSpec;
import com.squareup.javapoet.*;
import dagger.hilt.android.processor.internal.AndroidClassNames;
import dagger.hilt.processor.internal.ClassNames;
import dagger.hilt.processor.internal.Processors;
Expand Down Expand Up @@ -73,6 +69,15 @@ public void generate() throws IOException {
// onReceive call is implemented in any of the super classes.
if (metadata.requiresBytecodeInjection() && !isOnReceiveImplemented(metadata.baseElement())) {
builder.addAnnotation(ClassNames.ON_RECEIVE_BYTECODE_INJECTION_MARKER);

builder.addField(
FieldSpec.builder(
TypeName.BOOLEAN,
"onReceiveBytecodeInjectionMarker",
Modifier.PRIVATE,
Modifier.FINAL)
.initializer("false")
.build());
}

JavaPoetExtKt.addOriginatingElement(builder, metadata.element());
Expand Down

0 comments on commit 1972a1e

Please sign in to comment.