Skip to content

Commit

Permalink
plugin3 (bazelbuild#986)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie5 authored and Andre Rocha committed Jul 6, 2020
1 parent 1042a66 commit d6457c8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,23 @@ class AstUsedJarFinder(
case _ =>
}

if (tree.hasSymbolField) {
tree.symbol.annotations.foreach { annot =>
annot.tree.foreach(fullyExploreTree)
val shouldExamine =
tree match {
case select: Select if select.symbol.isDefaultGetter =>
false
case _ =>
true
}

if (shouldExamine) {
if (tree.hasSymbolField) {
tree.symbol.annotations.foreach { annot =>
annot.tree.foreach(fullyExploreTree)
}
}
if (tree.tpe != null) {
exploreType(tree.tpe)
}
}
if (tree.tpe != null) {
exploreType(tree.tpe)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,19 @@ class AstUsedJarFinderTest extends FunSuite {
)
}

test("unspecified default argument type is indirect") {
checkIndirectDependencyDetected(
aCode = "class A",
bCode = "class B(a: A = new A())",
cCode =
s"""
|class C {
| new B()
|}
|""".stripMargin
)
}

test("java interface method argument is direct") {
withSandbox { sandbox =>
sandbox.compileJava(
Expand Down

0 comments on commit d6457c8

Please sign in to comment.