1 /* 2 * Copyright (C) 2020 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.hilt.android.processor.internal; 18 19 import androidx.room.compiler.processing.XProcessingEnv.Backend; 20 import androidx.room.compiler.processing.util.Source; 21 import com.google.common.base.Joiner; 22 import com.google.common.truth.StringSubject; 23 import dagger.hilt.android.testing.compile.HiltCompilerTests; 24 import org.junit.Test; 25 import org.junit.runner.RunWith; 26 import org.junit.runners.JUnit4; 27 28 @RunWith(JUnit4.class) 29 public final class GeneratorsTest { 30 private static final Joiner JOINER = Joiner.on("\n"); 31 32 @Test copyConstructorParametersCopiesExternalNullables()33 public void copyConstructorParametersCopiesExternalNullables() { 34 Source baseActivity = 35 HiltCompilerTests.javaSource( 36 "test.BaseActivity", 37 "package test;", 38 "", 39 "import androidx.fragment.app.FragmentActivity;", 40 "", 41 "public abstract class BaseActivity extends FragmentActivity {", 42 " protected BaseActivity(", 43 " @androidx.annotation.Nullable String supportNullable,", 44 " @androidx.annotation.Nullable String androidxNullable,", 45 " @javax.annotation.Nullable String javaxNullable) { }", 46 "}"); 47 Source myActivity = 48 HiltCompilerTests.javaSource( 49 "test.MyActivity", 50 "package test;", 51 "", 52 "import dagger.hilt.android.AndroidEntryPoint;", 53 "", 54 "@AndroidEntryPoint(BaseActivity.class)", 55 "public class MyActivity extends Hilt_MyActivity {", 56 " public MyActivity(", 57 " String supportNullable,", 58 " String androidxNullable,", 59 " String javaxNullable) {", 60 " super(supportNullable, androidxNullable, javaxNullable);", 61 " }", 62 "}"); 63 HiltCompilerTests.hiltCompiler(baseActivity, myActivity) 64 .compile( 65 subject -> { 66 subject.hasErrorCount(0); 67 StringSubject stringSubject = 68 subject.generatedSourceFileWithPath("test/Hilt_MyActivity.java"); 69 stringSubject.contains("package test;"); 70 stringSubject.contains("import androidx.annotation.Nullable;"); 71 stringSubject.contains( 72 JOINER.join( 73 "@Generated(\"dagger.hilt.android.processor.internal.androidentrypoint.ActivityGenerator\")", 74 "abstract class Hilt_MyActivity extends BaseActivity implements " 75 + "GeneratedComponentManagerHolder {")); 76 stringSubject.contains( 77 JOINER.join( 78 " Hilt_MyActivity(@Nullable String supportNullable," 79 + " @Nullable String androidxNullable,", 80 " @javax.annotation.Nullable String javaxNullable) {", 81 " super(supportNullable, androidxNullable, javaxNullable);", 82 " _initHiltInternal();", 83 " }")); 84 }); 85 } 86 87 @Test copyConstructorParametersConvertsAndroidInternalNullableToExternal()88 public void copyConstructorParametersConvertsAndroidInternalNullableToExternal() { 89 // Relies on View(Context, AttributeSet), which has android-internal 90 // @android.annotation.Nullable on AttributeSet. 91 Source myView = 92 HiltCompilerTests.javaSource( 93 "test.MyView", 94 "package test;", 95 "", 96 "import android.content.Context;", 97 "import android.util.AttributeSet;", 98 "import android.view.View;", 99 "import dagger.hilt.android.AndroidEntryPoint;", 100 "", 101 "@AndroidEntryPoint(View.class)", 102 "public class MyView extends Hilt_MyView {", 103 " public MyView(Context context, AttributeSet attrs) {", 104 " super(context, attrs);", 105 " }", 106 "}"); 107 HiltCompilerTests.hiltCompiler(myView) 108 .compile( 109 subject -> { 110 subject.hasErrorCount(0); 111 StringSubject stringSubject = 112 subject.generatedSourceFileWithPath("test/Hilt_MyView.java"); 113 stringSubject.contains("import androidx.annotation.Nullable;"); 114 stringSubject.contains( 115 JOINER.join( 116 "@Generated(\"dagger.hilt.android.processor.internal.androidentrypoint.ViewGenerator\")", 117 "abstract class Hilt_MyView extends View implements" 118 + " GeneratedComponentManagerHolder {")); 119 // TODO(kuanyingchou): Remove the condition once 120 // https://github.com/google/ksp/issues/1459 is fixed 121 if (HiltCompilerTests.backend(subject) == Backend.KSP) { 122 stringSubject.contains( 123 JOINER.join( 124 " Hilt_MyView(Context p0, @Nullable AttributeSet p1) {", 125 " super(p0, p1);", 126 " inject();", 127 " }")); 128 } else { 129 stringSubject.contains( 130 JOINER.join( 131 " Hilt_MyView(Context context, @Nullable AttributeSet attrs) {", 132 " super(context, attrs);", 133 " inject();", 134 " }")); 135 } 136 }); 137 } 138 139 // This is a regression test for https://github.com/google/dagger/issues/3296 140 @Test isRestrictedApiConstructorWithPrimitiveParameterTest()141 public void isRestrictedApiConstructorWithPrimitiveParameterTest() { 142 Source baseView = 143 HiltCompilerTests.javaSource( 144 "test.BaseView", 145 "package test;", 146 "", 147 "import android.content.Context;", 148 "import android.util.AttributeSet;", 149 "import android.view.View;", 150 "", 151 "public class BaseView extends View {", 152 " public BaseView(int i, int j, Context context, AttributeSet attrs) {", 153 " super(context, attrs);", 154 " }", 155 "}"); 156 Source myView = 157 HiltCompilerTests.javaSource( 158 "test.MyView", 159 "package test;", 160 "", 161 "import android.content.Context;", 162 "import android.util.AttributeSet;", 163 "import android.view.View;", 164 "import dagger.hilt.android.AndroidEntryPoint;", 165 "", 166 "@AndroidEntryPoint(BaseView.class)", 167 "public class MyView extends Hilt_MyView {", 168 " public MyView(int i, int j, Context context, AttributeSet attrs) {", 169 " super(i, j, context, attrs);", 170 " }", 171 "}"); 172 HiltCompilerTests.hiltCompiler(baseView, myView).compile(subject -> subject.hasErrorCount(0)); 173 } 174 175 // This is a regression test for https://github.com/google/dagger/issues/3296 176 @Test isRestrictedApiConstructorWithArrayParameterTest()177 public void isRestrictedApiConstructorWithArrayParameterTest() { 178 Source baseView = 179 HiltCompilerTests.javaSource( 180 "test.BaseView", 181 "package test;", 182 "", 183 "import android.content.Context;", 184 "import android.util.AttributeSet;", 185 "import android.view.View;", 186 "", 187 "public class BaseView extends View {", 188 " public BaseView(String[] strs, int i, Context context, AttributeSet attrs) {", 189 " super(context, attrs);", 190 " }", 191 "}"); 192 Source myView = 193 HiltCompilerTests.javaSource( 194 "test.MyView", 195 "package test;", 196 "", 197 "import android.content.Context;", 198 "import android.util.AttributeSet;", 199 "import android.view.View;", 200 "import dagger.hilt.android.AndroidEntryPoint;", 201 "", 202 "@AndroidEntryPoint(BaseView.class)", 203 "public class MyView extends Hilt_MyView {", 204 " public MyView(String[] strs, int i, Context context, AttributeSet attrs) {", 205 " super(strs, i, context, attrs);", 206 " }", 207 "}"); 208 HiltCompilerTests.hiltCompiler(baseView, myView).compile(subject -> subject.hasErrorCount(0)); 209 } 210 211 // This is a regression test for https://github.com/google/dagger/issues/3296 212 @Test isRestrictedApiConstructorWithTypeParameterTest()213 public void isRestrictedApiConstructorWithTypeParameterTest() { 214 Source baseView = 215 HiltCompilerTests.javaSource( 216 "test.BaseView", 217 "package test;", 218 "", 219 "import android.content.Context;", 220 "import android.util.AttributeSet;", 221 "import android.view.View;", 222 "", 223 "public class BaseView<T> extends View {", 224 " public BaseView(T t, int i, Context context, AttributeSet attrs) {", 225 " super(context, attrs);", 226 " }", 227 "}"); 228 Source myView = 229 HiltCompilerTests.javaSource( 230 "test.MyView", 231 "package test;", 232 "", 233 "import android.content.Context;", 234 "import android.util.AttributeSet;", 235 "import android.view.View;", 236 "import dagger.hilt.android.AndroidEntryPoint;", 237 "", 238 "@AndroidEntryPoint(BaseView.class)", 239 "public class MyView extends Hilt_MyView<String> {", 240 " public MyView(String str, int i, Context context, AttributeSet attrs) {", 241 " super(str, i, context, attrs);", 242 " }", 243 "}"); 244 HiltCompilerTests.hiltCompiler(baseView, myView).compile(subject -> subject.hasErrorCount(0)); 245 } 246 247 @Test copyTargetApiAnnotationActivity()248 public void copyTargetApiAnnotationActivity() { 249 Source myActivity = 250 HiltCompilerTests.javaSource( 251 "test.MyActivity", 252 "package test;", 253 "", 254 "import android.annotation.TargetApi;", 255 "import androidx.fragment.app.FragmentActivity;", 256 "import dagger.hilt.android.AndroidEntryPoint;", 257 "", 258 "@TargetApi(24)", 259 "@AndroidEntryPoint(FragmentActivity.class)", 260 "public class MyActivity extends Hilt_MyActivity {}"); 261 HiltCompilerTests.hiltCompiler(myActivity) 262 .compile( 263 subject -> { 264 subject.hasErrorCount(0); 265 StringSubject stringSubject = 266 subject.generatedSourceFileWithPath("test/Hilt_MyActivity.java"); 267 stringSubject.contains( 268 JOINER.join( 269 "@Generated(\"dagger.hilt.android.processor.internal.androidentrypoint.ActivityGenerator\")", 270 "@TargetApi(24)", 271 "abstract class Hilt_MyActivity extends FragmentActivity" 272 + " implements GeneratedComponentManagerHolder {")); 273 }); 274 } 275 276 @Test copyTargetApiAnnotationOverView()277 public void copyTargetApiAnnotationOverView() { 278 Source myView = 279 HiltCompilerTests.javaSource( 280 "test.MyView", 281 "package test;", 282 "", 283 "import android.annotation.TargetApi;", 284 "import android.widget.LinearLayout;", 285 "import android.content.Context;", 286 "import android.util.AttributeSet;", 287 "import dagger.hilt.android.AndroidEntryPoint;", 288 "", 289 "@TargetApi(24)", 290 "@AndroidEntryPoint(LinearLayout.class)", 291 "public class MyView extends Hilt_MyView {", 292 " public MyView(Context context, AttributeSet attributeSet){", 293 " super(context, attributeSet);", 294 " }", 295 "}"); 296 HiltCompilerTests.hiltCompiler(myView) 297 .compile( 298 subject -> { 299 subject.hasErrorCount(0); 300 StringSubject stringSubject = 301 subject.generatedSourceFileWithPath("test/Hilt_MyView.java"); 302 stringSubject.contains("package test;"); 303 stringSubject.contains( 304 JOINER.join( 305 "@Generated(\"dagger.hilt.android.processor.internal.androidentrypoint.ViewGenerator\")", 306 "@TargetApi(24)", 307 "abstract class Hilt_MyView extends LinearLayout implements" 308 + " GeneratedComponentManagerHolder {")); 309 }); 310 } 311 312 @Test copyTargetApiAnnotationApplication()313 public void copyTargetApiAnnotationApplication() { 314 Source myApplication = 315 HiltCompilerTests.javaSource( 316 "test.MyApplication", 317 "package test;", 318 "", 319 "import android.annotation.TargetApi;", 320 "import android.app.Application;", 321 "import dagger.hilt.android.HiltAndroidApp;", 322 "", 323 "@TargetApi(24)", 324 "@HiltAndroidApp(Application.class)", 325 "public class MyApplication extends Hilt_MyApplication {}"); 326 HiltCompilerTests.hiltCompiler(myApplication) 327 .compile( 328 subject -> { 329 subject.hasErrorCount(0); 330 StringSubject stringSubject = 331 subject.generatedSourceFileWithPath("test/Hilt_MyApplication.java"); 332 stringSubject.contains("package test;"); 333 stringSubject.contains( 334 JOINER.join( 335 "@Generated(\"dagger.hilt.android.processor.internal.androidentrypoint." 336 + "ApplicationGenerator\")", 337 "@TargetApi(24)", 338 "abstract class Hilt_MyApplication extends Application implements" 339 + " GeneratedComponentManagerHolder {")); 340 }); 341 } 342 343 @Test copyTargetApiAnnotationFragment()344 public void copyTargetApiAnnotationFragment() { 345 Source myApplication = 346 HiltCompilerTests.javaSource( 347 "test.MyFragment", 348 "package test;", 349 "", 350 "import android.annotation.TargetApi;", 351 "import androidx.fragment.app.Fragment;", 352 "import dagger.hilt.android.AndroidEntryPoint;", 353 "", 354 "@TargetApi(24)", 355 "@AndroidEntryPoint(Fragment.class)", 356 "public class MyFragment extends Hilt_MyFragment {}"); 357 HiltCompilerTests.hiltCompiler(myApplication) 358 .compile( 359 subject -> { 360 subject.hasErrorCount(0); 361 StringSubject stringSubject = 362 subject.generatedSourceFileWithPath("test/Hilt_MyFragment.java"); 363 stringSubject.contains("package test;"); 364 stringSubject.contains( 365 JOINER.join( 366 "@Generated(\"dagger.hilt.android.processor.internal.androidentrypoint.FragmentGenerator\")", 367 "@TargetApi(24)", 368 "abstract class Hilt_MyFragment extends Fragment implements" 369 + " GeneratedComponentManagerHolder {")); 370 }); 371 } 372 373 @Test copyTargetApiBroadcastRecieverGenerator()374 public void copyTargetApiBroadcastRecieverGenerator() { 375 Source myBroadcastReceiver = 376 HiltCompilerTests.javaSource( 377 "test.MyBroadcastReceiver", 378 "package test;", 379 "", 380 "import android.content.BroadcastReceiver;", 381 "import android.annotation.TargetApi;", 382 "import dagger.hilt.android.AndroidEntryPoint;", 383 "", 384 "@TargetApi(24)", 385 "@AndroidEntryPoint(BroadcastReceiver.class)", 386 "public class MyBroadcastReceiver extends Hilt_MyBroadcastReceiver {}"); 387 HiltCompilerTests.hiltCompiler(myBroadcastReceiver) 388 .compile( 389 subject -> { 390 subject.hasErrorCount(0); 391 StringSubject stringSubject = 392 subject.generatedSourceFileWithPath("test/Hilt_MyBroadcastReceiver.java"); 393 stringSubject.contains("package test;"); 394 stringSubject.contains( 395 JOINER.join( 396 "@Generated(\"dagger.hilt.android.processor.internal.androidentrypoint.BroadcastReceiverGenerator\")", 397 "@TargetApi(24)", 398 "abstract class Hilt_MyBroadcastReceiver extends BroadcastReceiver {")); 399 }); 400 } 401 402 @Test copyTargetApiServiceGenerator()403 public void copyTargetApiServiceGenerator() { 404 Source myService = 405 HiltCompilerTests.javaSource( 406 "test.MyService", 407 "package test;", 408 "", 409 "import android.annotation.TargetApi;", 410 "import android.content.Intent;", 411 "import android.app.Service;", 412 "import android.os.IBinder;", 413 "import dagger.hilt.android.AndroidEntryPoint;", 414 "", 415 "@TargetApi(24)", 416 "@AndroidEntryPoint(Service.class)", 417 "public class MyService extends Hilt_MyService {", 418 " @Override", 419 " public IBinder onBind(Intent intent){", 420 " return null;", 421 " }", 422 "}"); 423 HiltCompilerTests.hiltCompiler(myService) 424 .compile( 425 subject -> { 426 subject.hasErrorCount(0); 427 StringSubject stringSubject = 428 subject.generatedSourceFileWithPath("test/Hilt_MyService.java"); 429 stringSubject.contains("package test;"); 430 stringSubject.contains( 431 JOINER.join( 432 "@Generated(\"dagger.hilt.android.processor.internal.androidentrypoint.ServiceGenerator\")", 433 "@TargetApi(24)", 434 "abstract class Hilt_MyService extends Service implements" 435 + " GeneratedComponentManagerHolder {")); 436 }); 437 } 438 439 @Test copySuppressWarningsAnnotationActivity_annotationCopied()440 public void copySuppressWarningsAnnotationActivity_annotationCopied() { 441 Source myActivity = 442 HiltCompilerTests.javaSource( 443 "test.MyActivity", 444 "package test;", 445 "", 446 "import android.annotation.TargetApi;", 447 "import androidx.fragment.app.FragmentActivity;", 448 "import dagger.hilt.android.AndroidEntryPoint;", 449 "", 450 "@SuppressWarnings(\"deprecation\")", 451 "@AndroidEntryPoint(FragmentActivity.class)", 452 "public class MyActivity extends Hilt_MyActivity {}"); 453 HiltCompilerTests.hiltCompiler(myActivity) 454 .compile( 455 subject -> { 456 subject.hasErrorCount(0); 457 StringSubject stringSubject = 458 subject.generatedSourceFileWithPath("test/Hilt_MyActivity.java"); 459 stringSubject.contains("package test;"); 460 stringSubject.contains( 461 JOINER.join( 462 "@Generated(\"dagger.hilt.android.processor.internal.androidentrypoint.ActivityGenerator\")", 463 "@SuppressWarnings(\"deprecation\")", 464 "abstract class Hilt_MyActivity extends FragmentActivity " 465 + "implements GeneratedComponentManagerHolder {")); 466 }); 467 } 468 469 @Test copySuppressWarningsAnnotation_onView_annotationCopied()470 public void copySuppressWarningsAnnotation_onView_annotationCopied() { 471 Source myView = 472 HiltCompilerTests.javaSource( 473 "test.MyView", 474 "package test;", 475 "", 476 "import android.annotation.TargetApi;", 477 "import android.widget.LinearLayout;", 478 "import android.content.Context;", 479 "import android.util.AttributeSet;", 480 "import dagger.hilt.android.AndroidEntryPoint;", 481 "", 482 "@SuppressWarnings(\"deprecation\")", 483 "@AndroidEntryPoint(LinearLayout.class)", 484 "public class MyView extends Hilt_MyView {", 485 " public MyView(Context context, AttributeSet attributeSet){", 486 " super(context, attributeSet);", 487 " }", 488 "}"); 489 HiltCompilerTests.hiltCompiler(myView) 490 .compile( 491 subject -> { 492 subject.hasErrorCount(0); 493 StringSubject stringSubject = 494 subject.generatedSourceFileWithPath("test/Hilt_MyView.java"); 495 stringSubject.contains("package test;"); 496 stringSubject.contains( 497 JOINER.join( 498 "@Generated(\"dagger.hilt.android.processor.internal.androidentrypoint.ViewGenerator\")", 499 "@SuppressWarnings(\"deprecation\")", 500 "abstract class Hilt_MyView extends LinearLayout implements" 501 + " GeneratedComponentManagerHolder {")); 502 }); 503 } 504 505 @Test copySuppressWarningsAnnotation_onApplication_annotationCopied()506 public void copySuppressWarningsAnnotation_onApplication_annotationCopied() { 507 Source myApplication = 508 HiltCompilerTests.javaSource( 509 "test.MyApplication", 510 "package test;", 511 "", 512 "import android.annotation.TargetApi;", 513 "import android.app.Application;", 514 "import dagger.hilt.android.HiltAndroidApp;", 515 "", 516 "@SuppressWarnings(\"deprecation\")", 517 "@HiltAndroidApp(Application.class)", 518 "public class MyApplication extends Hilt_MyApplication {}"); 519 HiltCompilerTests.hiltCompiler(myApplication) 520 .compile( 521 subject -> { 522 subject.hasErrorCount(0); 523 StringSubject stringSubject = 524 subject.generatedSourceFileWithPath("test/Hilt_MyApplication.java"); 525 stringSubject.contains("package test;"); 526 stringSubject.contains( 527 JOINER.join( 528 "@Generated(\"dagger.hilt.android.processor.internal.androidentrypoint.ApplicationGenerator\")", 529 "@SuppressWarnings(\"deprecation\")", 530 "abstract class Hilt_MyApplication extends Application implements" 531 + " GeneratedComponentManagerHolder {")); 532 }); 533 } 534 535 @Test copySuppressWarningsAnnotation_onFragment_annotationCopied()536 public void copySuppressWarningsAnnotation_onFragment_annotationCopied() { 537 Source myApplication = 538 HiltCompilerTests.javaSource( 539 "test.MyFragment", 540 "package test;", 541 "", 542 "import android.annotation.TargetApi;", 543 "import androidx.fragment.app.Fragment;", 544 "import dagger.hilt.android.AndroidEntryPoint;", 545 "", 546 "@SuppressWarnings(\"rawtypes\")", 547 "@AndroidEntryPoint(Fragment.class)", 548 "public class MyFragment extends Hilt_MyFragment {}"); 549 HiltCompilerTests.hiltCompiler(myApplication) 550 .compile( 551 subject -> { 552 subject.hasErrorCount(0); 553 StringSubject stringSubject = 554 subject.generatedSourceFileWithPath("test/Hilt_MyFragment.java"); 555 stringSubject.contains("package test;"); 556 stringSubject.contains( 557 JOINER.join( 558 "@Generated(\"dagger.hilt.android.processor.internal.androidentrypoint.FragmentGenerator\")", 559 "@SuppressWarnings(\"rawtypes\")", 560 "abstract class Hilt_MyFragment extends Fragment implements" 561 + " GeneratedComponentManagerHolder {")); 562 }); 563 } 564 565 @Test copySuppressWarnings_onBroadcastRecieverGenerator_annotationCopied()566 public void copySuppressWarnings_onBroadcastRecieverGenerator_annotationCopied() { 567 Source myBroadcastReceiver = 568 HiltCompilerTests.javaSource( 569 "test.MyBroadcastReceiver", 570 "package test;", 571 "", 572 "import android.content.BroadcastReceiver;", 573 "import android.annotation.TargetApi;", 574 "import dagger.hilt.android.AndroidEntryPoint;", 575 "", 576 "@SuppressWarnings(\"deprecation\")", 577 "@AndroidEntryPoint(BroadcastReceiver.class)", 578 "public class MyBroadcastReceiver extends Hilt_MyBroadcastReceiver {}"); 579 HiltCompilerTests.hiltCompiler(myBroadcastReceiver) 580 .compile( 581 subject -> { 582 subject.hasErrorCount(0); 583 StringSubject stringSubject = 584 subject.generatedSourceFileWithPath("test/Hilt_MyBroadcastReceiver.java"); 585 stringSubject.contains("package test;"); 586 stringSubject.contains( 587 JOINER.join( 588 "@Generated(\"dagger.hilt.android.processor.internal.androidentrypoint." 589 + "BroadcastReceiverGenerator\")", 590 "@SuppressWarnings(\"deprecation\")", 591 "abstract class Hilt_MyBroadcastReceiver extends BroadcastReceiver {")); 592 }); 593 } 594 595 @Test copySuppressWarnings_onServiceGenerator_annotationCopied()596 public void copySuppressWarnings_onServiceGenerator_annotationCopied() { 597 Source myService = 598 HiltCompilerTests.javaSource( 599 "test.MyService", 600 "package test;", 601 "", 602 "import android.annotation.TargetApi;", 603 "import android.content.Intent;", 604 "import android.app.Service;", 605 "import android.os.IBinder;", 606 "import dagger.hilt.android.AndroidEntryPoint;", 607 "", 608 "@SuppressWarnings(\"deprecation\")", 609 "@AndroidEntryPoint(Service.class)", 610 "public class MyService extends Hilt_MyService {", 611 " @Override", 612 " public IBinder onBind(Intent intent){", 613 " return null;", 614 " }", 615 "}"); 616 HiltCompilerTests.hiltCompiler(myService) 617 .compile( 618 subject -> { 619 subject.hasErrorCount(0); 620 StringSubject stringSubject = 621 subject.generatedSourceFileWithPath("test/Hilt_MyService.java"); 622 stringSubject.contains("package test;"); 623 stringSubject.contains( 624 JOINER.join( 625 "@Generated(\"dagger.hilt.android.processor.internal.androidentrypoint." 626 + "ServiceGenerator\")", 627 "@SuppressWarnings(\"deprecation\")", 628 "abstract class Hilt_MyService extends Service implements" 629 + " GeneratedComponentManagerHolder {")); 630 }); 631 } 632 } 633