1 /* 2 * Copyright (C) 2019 The Dagger Authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package dagger.internal.codegen.javac; 18 19 import static dagger.internal.codegen.compileroption.ValidationType.NONE; 20 import static javax.tools.Diagnostic.Kind.NOTE; 21 22 import androidx.room.compiler.processing.XTypeElement; 23 import dagger.internal.codegen.compileroption.CompilerOptions; 24 import dagger.internal.codegen.compileroption.ValidationType; 25 import javax.inject.Inject; 26 import javax.tools.Diagnostic; 27 28 /** {@link CompilerOptions} for Javac plugins (e.g. for Dagger statistics or Kythe). */ 29 final class JavacPluginCompilerOptions extends CompilerOptions { 30 31 @Inject JavacPluginCompilerOptions()32 JavacPluginCompilerOptions() {} 33 34 @Override usesProducers()35 public boolean usesProducers() { 36 return true; 37 } 38 39 @Override fastInit(XTypeElement element)40 public boolean fastInit(XTypeElement element) { 41 return false; 42 } 43 44 @Override formatGeneratedSource()45 public boolean formatGeneratedSource() { 46 return false; 47 } 48 49 @Override writeProducerNameInToken()50 public boolean writeProducerNameInToken() { 51 return true; 52 } 53 54 @Override nullableValidationKind()55 public Diagnostic.Kind nullableValidationKind() { 56 return NOTE; 57 } 58 59 @Override privateMemberValidationKind()60 public Diagnostic.Kind privateMemberValidationKind() { 61 return NOTE; 62 } 63 64 @Override staticMemberValidationKind()65 public Diagnostic.Kind staticMemberValidationKind() { 66 return NOTE; 67 } 68 69 @Override includeStacktraceWithDeferredErrorMessages()70 public boolean includeStacktraceWithDeferredErrorMessages() { 71 return false; 72 } 73 74 @Override ignorePrivateAndStaticInjectionForComponent()75 public boolean ignorePrivateAndStaticInjectionForComponent() { 76 return false; 77 } 78 79 @Override scopeCycleValidationType()80 public ValidationType scopeCycleValidationType() { 81 return NONE; 82 } 83 84 @Override validateTransitiveComponentDependencies()85 public boolean validateTransitiveComponentDependencies() { 86 return true; 87 } 88 89 @Override warnIfInjectionFactoryNotGeneratedUpstream()90 public boolean warnIfInjectionFactoryNotGeneratedUpstream() { 91 return false; 92 } 93 94 @Override headerCompilation()95 public boolean headerCompilation() { 96 return false; 97 } 98 99 @Override fullBindingGraphValidationType()100 public ValidationType fullBindingGraphValidationType() { 101 return NONE; 102 } 103 104 @Override pluginsVisitFullBindingGraphs(XTypeElement element)105 public boolean pluginsVisitFullBindingGraphs(XTypeElement element) { 106 return false; 107 } 108 109 @Override moduleHasDifferentScopesDiagnosticKind()110 public Diagnostic.Kind moduleHasDifferentScopesDiagnosticKind() { 111 return NOTE; 112 } 113 114 @Override explicitBindingConflictsWithInjectValidationType()115 public ValidationType explicitBindingConflictsWithInjectValidationType() { 116 return NONE; 117 } 118 119 @Override experimentalDaggerErrorMessages()120 public boolean experimentalDaggerErrorMessages() { 121 return false; 122 } 123 124 @Override strictMultibindingValidation()125 public boolean strictMultibindingValidation() { 126 return false; 127 } 128 129 @Override strictSuperficialValidation()130 public boolean strictSuperficialValidation() { 131 return true; 132 } 133 134 @Override generatedClassExtendsComponent()135 public boolean generatedClassExtendsComponent() { 136 return false; 137 } 138 139 @Override ignoreProvisionKeyWildcards()140 public boolean ignoreProvisionKeyWildcards() { 141 return false; 142 } 143 } 144