Skip to content

Commit

Permalink
[wip] Fix throws
Browse files Browse the repository at this point in the history
  • Loading branch information
jkschneider committed Feb 12, 2016
1 parent d6c2b93 commit 8c91cde
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class DependencyClassVisitor extends ClassVisitor {
Type.getArgumentTypes(desc).each { readType(it.descriptor) }
readType(Type.getReturnType(desc).descriptor)
readSignature(signature)
exceptions.each { readType(it) }
return new DependencyMethodVisitor()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,42 @@ class DependencyClassVisitorSpec extends Specification {
java.compile("""
package b;
import a.*;
import java.util.*;
@AAnnot
public class B {
}
""")
java.traceClass('b.B')
def a1 = gav('netflix', 'a', '1')
then:
java.containsReferenceTo('b.B', ['a/AAnnot': [a1].toSet()], a1)
}
def 'references are found on throws'() {
setup:
java.compile('''
package a;

public class AException extends Exception {
}
''')
when:
java.compile("""
package b;
import a.*;
public class B {
public void foo() throws AException {}
}
""")
def a1 = gav('netflix', 'a', '1')
then:
java.containsReferenceTo('b.B', ['a/AException': [a1].toSet()], a1)
}
ModuleVersionIdentifier gav(String g, String a, String v) { [version: v, group: g, name: a] as ModuleVersionIdentifier }
}

0 comments on commit 8c91cde

Please sign in to comment.