Skip to content

Commit

Permalink
Possibly realistic report
Browse files Browse the repository at this point in the history
  • Loading branch information
avantgardnerio committed Oct 31, 2018
1 parent 87e8564 commit 0004ec1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/net/squarelabs/depends/Reporter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.fasterxml.jackson.databind.SerializationFeature
import net.squarelabs.depends.models.Artifact
import java.io.File

fun fqmns(a: Artifact): HashSet<String> = HashSet(a.classes.values.flatMap { c -> c.methods.values.map { m -> "${c.name}:${m.name}${m.descriptor}" } })
fun fqmns(a: Artifact): HashSet<String> = HashSet(a.classes.values.flatMap { c -> c.methods.values.map { m -> "${c.name}.${m.name}${m.descriptor}" } })

fun allMethods(artifacts: Collection<Artifact>): HashSet<String> {
val reducer = { acc: HashSet<String>, cur: Artifact ->
Expand Down Expand Up @@ -40,7 +40,7 @@ fun apiMethods(state: State): Set<String> {
artifact.classes.values.forEach { clazz ->
clazz.methods.values.forEach { method ->
method.invocations.forEach { call ->
val callee = "${call.fqcn.replace("/", ".")}.${call.methodName}${call.descriptor}"
val callee = "${call.fqcn}.${call.methodName}${call.descriptor}"
//println("${state.artifactsByMethod.size} callee: $callee example: ${state.artifactsByMethod.keys.first()}")
val providers:MutableSet<String>? = state.artifactsByMethod.get(callee)
if(providers != null) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/net/squarelabs/depends/Resolver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fun methodsFromClass(stream: InputStream): Map<String, Method> {
val instMv = object : InstructionAdapter(Opcodes.ASM7, oriMv) {
override fun visitMethodInsn(opcode: Int, owner: String, name: String, descriptor: String, isInterface: Boolean) {
invocationCount++
method.invocations.add(Invocation(owner, name, descriptor))
method.invocations.add(Invocation(owner.replace("/", "."), name, descriptor))
//println("invoke $owner.$name from ${clazz.name}.$methodName()")
super.visitMethodInsn(opcode, owner, name, descriptor, isInterface)
}
Expand Down

0 comments on commit 0004ec1

Please sign in to comment.