Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jdeps recursion tests #488

Merged
merged 1 commit into from
Apr 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,48 @@ class KotlinBuilderJvmJdepsTest {
assertIncomplete(jdeps).isEmpty()
}

@Test
fun `cyclic generic type references`() {

val dependentTarget = ctx.runCompileTask(Consumer { c: KotlinJvmTestBuilder.TaskBuilder ->
c.addSource("AbstractObjectAssert.java",
"""
package pkg.assertion;

public class AbstractObjectAssert<SELF extends AbstractObjectAssert<SELF, ACTUAL>, ACTUAL> {
}
""")
c.outputJar()
c.outputJavaJdeps()
c.compileJava()
})

val dependingTarget = ctx.runCompileTask(Consumer { c: KotlinJvmTestBuilder.TaskBuilder ->
c.addSource("FooAssert.kt",
"""
package something.other

import pkg.assertion.AbstractObjectAssert

class FooAssert : AbstractObjectAssert<FooAssert, String>()

fun fooAssert(): AbstractObjectAssert<*, String> = AbstractObjectAssert<FooAssert, String>()
""")
c.outputJar()
c.compileKotlin()
c.outputJdeps()
c.addDirectDependencies(dependentTarget)
})
val jdeps = depsProto(dependingTarget)

assertThat(jdeps.ruleLabel).isEqualTo(dependingTarget.label())

assertExplicit(jdeps).contains(dependentTarget.singleCompileJar())
assertImplicit(jdeps).isEmpty()
assertUnused(jdeps).isEmpty()
assertIncomplete(jdeps).isEmpty()
}

@Test
fun `java annotation on property is an explict dep`() {

Expand Down