@ file : Suppress (" Un stable Api Usage ") Ċ Ċ package Ġcom . aut onomous apps . tasks Ċ Ċ import Ġcom . aut onomous apps . internal . Component Ċ import Ġcom . aut onomous apps . ad vice . Dependency Ċ import Ġcom . aut onomous apps . internal . Trans itive Component Ċ import Ġcom . aut onomous apps . ad vice . Component With Transit ives Ċ import Ġcom . aut onomous apps . internal . utils . fromJson Set Ċ import Ġcom . aut onomous apps . stubs . Dependencies Ċ import Ġcom . aut onomous apps . stubs . Results Ċ import Ġcom . aut onomous apps . stubs . Stub Resolved Component Result Ċ import Ġcom . aut onomous apps . stubs . Stub Resolved Component Result . Stub Project Component Identifier Ċ import Ġcom . aut onomous apps . tasks . Mis used Dependency Detector . Dependency Report Ċ import Ġcom . aut onomous apps . utils . file From Resource Ċ import Ġorg . junit . Test Ċ import Ġkotlin . test . assertTrue Ċ Ċ class ĠMis used Dependency Detector Test Ġ{ ĊĊĠ Ġ@ Test Ġfun Ġ` project Ġwith Ġdependency Ġissues `() Ġ{ ĊĠĠĠ Ġ// ĠGiven ĊĠĠĠ Ġval Ġdeclared Components Ġ= Ġcomponents () ĊĠĠĠ Ġval Ġall Component With Transit ives Ġ= Ġset Of ( ĊĠĠĠĠĠĠĠ ĠComponent With Transit ives ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDependencies . javax Inject . copy ( configuration Name Ġ= Ġ" implementation "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmutable Set Of () ĊĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠ ĠComponent With Transit ives ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDependencies . kotlin Std lib J dk 7 . copy ( configuration Name Ġ= Ġ" implementation "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmutable Set Of ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ// Ġkotlin . Metadata ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠDependencies . kotlin Std lib , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ// Ġ` org . intellij . lang . annotations . Flow ` ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠDependencies . jetbrains Annotations ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĠĠĠ Ġval Ġunused Component With Transit ives Ġ= Ġall Component With Transit ives Ġ// ĠTODO ĊĠĠĠ Ġval Ġused Classes Ġ= ĠlistOf ( ĊĠĠĠĠĠ Ġ// ĠBro ught Ġin Ġtransit ively Ġat Ġ` org . jetbrains : annotations `, Ġfrom Ġ` org . jetbrains . kotlin : kotlin - stdlib `, Ġfrom Ġ` org . jetbrains . kotlin : kotlin - stdlib - jdk 7 ` ĊĠĠĠĠĠ Ġ" org . intellij . lang . annotations . Flow ", ĊĠĠĠĠĠ Ġ// ĠBro ught Ġin Ġtransit ively Ġat Ġ` org . jetbrains . kotlin : kotlin - stdlib `, Ġfrom Ġ` org . jetbrains . kotlin : kotlin - stdlib - jdk 7 ` ĊĠĠĠĠĠ Ġ" kotlin . Metadata " ĊĠĠĠ Ġ) ĊĠĠĠ Ġval Ġused Inline Dependencies Ġ= Ġempty Set < Dependency >() ĊĊĠĠĠ Ġval Ġroot Ġ= ĠStub Resolved Component Result ( ĊĠĠĠĠĠ Ġdependencies Ġ= Ġset Of ( Results . javax Inject , ĠResults . kotlin Std lib J dk 7 ), ĊĠĠĠĠĠ Ġcomponent Identifier Ġ= ĠStub Project Component Identifier (": root ") ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġ// ĠWhen ĊĠĠĠ Ġ// ĠTODO Ġadd Ġtest Ġwith Ġused Android Dependencies Ġnot - null ĊĠĠĠ Ġ// ĠTODO Ġadd Ġtest Ġwith Ġused Constant Dependencies Ġnot - null ĊĠĠĠ Ġ// ĠTODO Ġadd Ġtest Ġwith Ġmanifest s Ġnot - null ĊĠĠĠ Ġval Ġactual Ġ= ĠMis used Dependency Detector ( ĊĠĠĠĠĠ Ġdeclared Components Ġ= Ġdeclared Components , ĊĠĠĠĠĠ Ġused Classes Ġ= Ġused Classes , ĊĠĠĠĠĠ Ġused Inline Dependencies Ġ= Ġused Inline Dependencies , ĊĠĠĠĠĠ Ġused Constant Dependencies Ġ= Ġempty Set (), ĊĠĠĠĠĠ Ġmanifest s Ġ= Ġnull , ĊĠĠĠĠĠ Ġused Android Res By Source Dependencies Ġ= Ġnull , ĊĠĠĠĠĠ Ġused Android Res By Res Dependencies Ġ= Ġnull , ĊĠĠĠĠĠ Ġroot Ġ= Ġroot ĊĠĠĠ Ġ). detect () ĊĊĠĠĠ Ġ// ĠThen ĊĠĠĠ Ġval Ġexpected Ġ= ĠDependency Report ( ĊĠĠĠĠĠ Ġall Components With Transit ives Ġ= Ġall Component With Transit ives , ĊĠĠĠĠĠ Ġunused Components With Transit ives Ġ= Ġunused Component With Transit ives , ĊĠĠĠĠĠ Ġused Transit ives Ġ= Ġset Of ( ĊĠĠĠĠĠĠĠ ĠTrans itive Component ( Dependencies . kotlin Std lib , Ġset Of (" kotlin . Metadata ")), ĊĠĠĠĠĠĠĠ ĠTrans itive Component ( Dependencies . jetbrains Annotations , Ġset Of (" org . intellij . lang . annotations . Flow ")) ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġactual Ġexpect Ġexpected ĊĠ Ġ} ĊĊĠ Ġprivate Ġin fix Ġfun ĠDependency Report . expect ( expected : ĠDependency Report ) Ġ{ ĊĠĠĠ ĠassertTrue (" Was ĠĠĠĠĠ Ġ$ unused Components With Transit ives \ n expected Ġ${ expected . unused Components With Transit ives }\ n ") Ġ{ ĊĠĠĠĠĠ Ġunused Components With Transit ives Ġ== Ġexpected . unused Components With Transit ives ĊĠĠĠ Ġ} ĊĠĠĠ ĠassertTrue (" Was ĠĠĠĠĠ Ġ$ used Transit ives \ n expected Ġ${ expected . used Transit ives }\ n ") Ġ{ ĊĠĠĠĠĠ Ġused Transit ives Ġ== Ġexpected . used Transit ives ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ// ĠA Ġcollection Ġof Ġdirect Ġand Ġtrans itive Ġcomponents ĊĠ Ġprivate Ġfun Ġcomponents () Ġ= Ġfile From Resource (" components . json "). read Text (). fromJson Set < Component >() Ċ } ĊĊĊ