Class HiltCompilerOptions

java.lang.Object
dagger.hilt.processor.internal.HiltCompilerOptions

public final class HiltCompilerOptions extends Object
Hilt annotation processor options.
  • Constructor Details

    • HiltCompilerOptions

      public HiltCompilerOptions()
  • Method Details

    • isAndroidSuperClassValidationDisabled

      public static boolean isAndroidSuperClassValidationDisabled(androidx.room.compiler.processing.XTypeElement element)
      Returns true if the superclass validation is disabled for dagger.hilt.android.AndroidEntryPoint-annotated classes.

      This flag is for internal use only! The superclass validation checks that the super class is a generated Hilt_ class. This flag is disabled by the Hilt Gradle plugin to enable bytecode transformation to change the superclass.

    • isCrossCompilationRootValidationDisabled

      public static boolean isCrossCompilationRootValidationDisabled(com.google.common.collect.ImmutableSet<androidx.room.compiler.processing.XTypeElement> rootElements, androidx.room.compiler.processing.XProcessingEnv env)
      Returns true if cross-compilation root validation is disabled.

      This flag should rarely be needed, but may be used for legacy/migration purposes if tests require the use of dagger.hilt.android.HiltAndroidApp rather than dagger.hilt.android.testing.HiltAndroidTest.

      Note that Hilt still does validation within a single compilation unit. In particular, a compilation unit that contains a HiltAndroidApp usage cannot have other HiltAndroidApp or HiltAndroidTest usages in the same compilation unit.

    • isModuleInstallInCheckDisabled

      public static boolean isModuleInstallInCheckDisabled(androidx.room.compiler.processing.XProcessingEnv env)
      Returns true if the check for dagger.hilt.InstallIn is disabled.
    • isSharedTestComponentsEnabled

      public static boolean isSharedTestComponentsEnabled(androidx.room.compiler.processing.XProcessingEnv env)
      Returns true of unit tests should try to share generated components, rather than using separate generated components per Hilt test root.

      Tests that provide their own test bindings (e.g. using dagger.hilt.android.testing.BindValue or a test Module) cannot use the shared component. In these cases, a component will be generated for the test.

    • useAggregatingRootProcessor

      public static boolean useAggregatingRootProcessor(androidx.room.compiler.processing.XProcessingEnv env)
      Returns true if the aggregating processor is enabled (default is true).

      Note:This is for internal use only!

    • getGradleProjectType

      public static GradleProjectType getGradleProjectType(androidx.room.compiler.processing.XProcessingEnv env)
      Returns project type or null if Hilt Gradle Plugin is not applied.

      Note:This is for internal use only!

    • isAssistedInjectViewModelsEnabled

      public static boolean isAssistedInjectViewModelsEnabled(androidx.room.compiler.processing.XTypeElement viewModelElement)
    • checkWrongAndDeprecatedOptions

      public static void checkWrongAndDeprecatedOptions(androidx.room.compiler.processing.XProcessingEnv env)
    • getProcessorOptions

      public static Set<String> getProcessorOptions()