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.compileroption; 18 19 import static dagger.internal.codegen.compileroption.ValidationType.NONE; 20 import static javax.tools.Diagnostic.Kind.NOTE; 21 22 import javax.inject.Inject; 23 import javax.lang.model.element.TypeElement; 24 import javax.tools.Diagnostic; 25 26 /** {@link CompilerOptions} for Javac plugins (e.g. for Dagger statistics or Kythe). */ 27 public final class JavacPluginCompilerOptions extends CompilerOptions { 28 29 @Inject JavacPluginCompilerOptions()30 JavacPluginCompilerOptions() {} 31 32 @Override usesProducers()33 public boolean usesProducers() { 34 return true; 35 } 36 37 @Override fastInit(TypeElement element)38 public boolean fastInit(TypeElement element) { 39 return false; 40 } 41 42 @Override formatGeneratedSource()43 public boolean formatGeneratedSource() { 44 return false; 45 } 46 47 @Override writeProducerNameInToken()48 public boolean writeProducerNameInToken() { 49 return true; 50 } 51 52 @Override nullableValidationKind()53 public Diagnostic.Kind nullableValidationKind() { 54 return NOTE; 55 } 56 57 @Override privateMemberValidationKind()58 public Diagnostic.Kind privateMemberValidationKind() { 59 return NOTE; 60 } 61 62 @Override staticMemberValidationKind()63 public Diagnostic.Kind staticMemberValidationKind() { 64 return NOTE; 65 } 66 67 @Override ignorePrivateAndStaticInjectionForComponent()68 public boolean ignorePrivateAndStaticInjectionForComponent() { 69 return false; 70 } 71 72 @Override scopeCycleValidationType()73 public ValidationType scopeCycleValidationType() { 74 return NONE; 75 } 76 77 @Override validateTransitiveComponentDependencies()78 public boolean validateTransitiveComponentDependencies() { 79 return true; 80 } 81 82 @Override warnIfInjectionFactoryNotGeneratedUpstream()83 public boolean warnIfInjectionFactoryNotGeneratedUpstream() { 84 return false; 85 } 86 87 @Override headerCompilation()88 public boolean headerCompilation() { 89 return false; 90 } 91 92 @Override fullBindingGraphValidationType()93 public ValidationType fullBindingGraphValidationType() { 94 return NONE; 95 } 96 97 @Override pluginsVisitFullBindingGraphs(TypeElement element)98 public boolean pluginsVisitFullBindingGraphs(TypeElement element) { 99 return false; 100 } 101 102 @Override moduleHasDifferentScopesDiagnosticKind()103 public Diagnostic.Kind moduleHasDifferentScopesDiagnosticKind() { 104 return NOTE; 105 } 106 107 @Override explicitBindingConflictsWithInjectValidationType()108 public ValidationType explicitBindingConflictsWithInjectValidationType() { 109 return NONE; 110 } 111 112 @Override experimentalDaggerErrorMessages()113 public boolean experimentalDaggerErrorMessages() { 114 return false; 115 } 116 117 @Override strictMultibindingValidation()118 public boolean strictMultibindingValidation() { 119 return false; 120 } 121 } 122