Skip to content

Commit

Permalink
refactor: live insight kotlin support needs work
Browse files Browse the repository at this point in the history
  • Loading branch information
BFergerson committed Oct 16, 2023
1 parent d8da26c commit 9df5f56
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ class SkywalkingTraceEndpoint : JVMEndpointNameDetector {
override fun determineEndpointName(element: KtNamedFunction): Future<List<DetectedEndpoint>> {
val promise = Promise.promise<List<DetectedEndpoint>>()
DumbService.getInstance(element.project).runReadActionInSmartMode {
val annotation = element.findAnnotation(FqName(skywalkingTraceAnnotation))
val annotation = try {
element.findAnnotation(FqName(skywalkingTraceAnnotation))
} catch (ignored: Exception) {
null
}
if (annotation != null) {
val operationNameExpr = getAttributeValue(annotation, "operationName")
val value = if (operationNameExpr is KtStringTemplateExpression) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ class SpringMVCEndpoint : JVMEndpointNameDetector {
val promise = Promise.promise<List<DetectedEndpoint>>()
ApplicationManager.getApplication().runReadAction {
for (annotationName in qualifiedNameSet) {
val annotation = element.findAnnotation(FqName(annotationName))
val annotation = try {
element.findAnnotation(FqName(annotationName))
} catch (ignored: Exception) {
null
}
if (annotation != null) {
val detectedEndpoint = handleAnnotation(false, annotation, annotationName)
val classRequestMapping = element.containingClass()
Expand Down

0 comments on commit 9df5f56

Please sign in to comment.