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

Fix to navigate signatures when package names start with a single prefix #104

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion run-agent.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

./gradlew build -p scavenger-agent-java -x test
./gradlew build -p scavenger-agent-java -x test -x integrationTest
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

integrationTest was slowing down the build, so it was excluded.

./gradlew build -p scavenger-demo -x test

java -Dscavenger.configuration=./scavenger-demo/scavenger.conf \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.example.demo.service.BridgeService
import com.example.demo.service.CglibProxyService
import com.example.demo.service.DynamicProxyService
import com.example.demo.service.PojoService
import com.example.demo.service2.TestService
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController

Expand All @@ -14,13 +15,14 @@ class MyController(
private val myService: BridgeService,
private val dynamicProxyService: DynamicProxyService,
private val cglibProxyService: CglibProxyService,
private val asyncService: AsyncService
private val asyncService: AsyncService,
private val testService: TestService
): BaseController() {
@GetMapping("")
fun hello(): String {
dynamicProxyService.aspect()
cglibProxyService.aspect()
return "myservice called ${myService.doSth()} / pojoService called ${PojoService().pojoHello()}"
return "myservice called ${myService.doSth()} / pojoService called ${PojoService().pojoHello()} / myService2 called ${testService.call()}"
}

@GetMapping("/additional")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.demo.service2

import com.example.demo.annotation.ScavengerEnabled
import com.example.demo.service.MyInterface
import com.example.demo.service.MyParentService
import org.springframework.stereotype.Service

@ScavengerEnabled
@Service
class TestService : MyParentService(), MyInterface {
fun call(): String {
return "test"
}
}
13 changes: 12 additions & 1 deletion scavenger-frontend/src/components/snapshot/SnapshotDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export default {
signature = candidate.signature;
} else {
signature = this.snapshotData.children
.find(child => querySignature.startsWith(child.signature)).signature;
.find(child => this.isStartsWithSignature(querySignature, child.signature)).signature;
}
await this.updateSnapshotData(signature);
}
Expand Down Expand Up @@ -328,6 +328,17 @@ export default {
resizeHorizontal(size) {
localStorage.setItem("scavenger.snapshot.horizontal-size", size);
},
isStartsWithSignature(querySignature, signature) {
if (!querySignature.startsWith(signature)) {
return false;
}

if (querySignature === signature) {
Copy link
Contributor Author

@taeyeon-Kim taeyeon-Kim Nov 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition is true when searching for a class.

return true;
}

return querySignature.substring(signature.length).startsWith(".");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this line means?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package must be followed by a class, so check for a . as well.

},
},
};
</script>
Loading