Skip to content

Commit ce97b82

Browse files
authored
plugin3 (#986)
1 parent 0c220fe commit ce97b82

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

third_party/dependency_analyzer/src/main/io/bazel/rulesscala/dependencyanalyzer/AstUsedJarFinder.scala

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,23 @@ class AstUsedJarFinder(
4545
case _ =>
4646
}
4747

48-
if (tree.hasSymbolField) {
49-
tree.symbol.annotations.foreach { annot =>
50-
annot.tree.foreach(fullyExploreTree)
48+
val shouldExamine =
49+
tree match {
50+
case select: Select if select.symbol.isDefaultGetter =>
51+
false
52+
case _ =>
53+
true
54+
}
55+
56+
if (shouldExamine) {
57+
if (tree.hasSymbolField) {
58+
tree.symbol.annotations.foreach { annot =>
59+
annot.tree.foreach(fullyExploreTree)
60+
}
61+
}
62+
if (tree.tpe != null) {
63+
exploreType(tree.tpe)
5164
}
52-
}
53-
if (tree.tpe != null) {
54-
exploreType(tree.tpe)
5565
}
5666
}
5767

third_party/dependency_analyzer/src/test/io/bazel/rulesscala/dependencyanalyzer/AstUsedJarFinderTest.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,19 @@ class AstUsedJarFinderTest extends FunSuite {
302302
)
303303
}
304304

305+
test("unspecified default argument type is indirect") {
306+
checkIndirectDependencyDetected(
307+
aCode = "class A",
308+
bCode = "class B(a: A = new A())",
309+
cCode =
310+
s"""
311+
|class C {
312+
| new B()
313+
|}
314+
|""".stripMargin
315+
)
316+
}
317+
305318
test("java interface method argument is direct") {
306319
withSandbox { sandbox =>
307320
sandbox.compileJava(

0 commit comments

Comments
 (0)