| 647 | * ══════════════════════════════════════════════════════════════════ */ |
| 648 | |
| 649 | static void java_process_call(CBMExtractCtx *ctx, TSNode call) { |
| 650 | TSNode func = ts_node_child_by_field_name(call, TS_FIELD("name")); |
| 651 | TSNode object = ts_node_child_by_field_name(call, TS_FIELD("object")); |
| 652 | if (ts_node_is_null(func)) { |
| 653 | return; |
| 654 | } |
| 655 | |
| 656 | char *method = cbm_node_text(ctx->arena, func, ctx->source); |
| 657 | if (!method) { |
| 658 | return; |
| 659 | } |
| 660 | |
| 661 | /* Spring STOMP: template.convertAndSend("/topic/...", msg) */ |
| 662 | if (strcmp(method, "convertAndSend") == 0 || strcmp(method, "convertAndSendToUser") == 0) { |
| 663 | TSNode args = ts_node_child_by_field_name(call, TS_FIELD("arguments")); |
| 664 | if (ts_node_is_null(args)) { |
| 665 | return; |
| 666 | } |
| 667 | const char *channel_name = extract_channel_name(ctx, args, NULL); |
| 668 | if (channel_name) { |
| 669 | push_channel(ctx, channel_name, "spring_websocket", CBM_CHANNEL_EMIT, call); |
| 670 | } |
| 671 | return; |
| 672 | } |
| 673 | |
| 674 | /* JSR 356: session.getBasicRemote().sendText(msg) — detect sendText/sendObject */ |
| 675 | if (strcmp(method, "sendText") == 0 || strcmp(method, "sendObject") == 0 || |
| 676 | strcmp(method, "sendBinary") == 0) { |
| 677 | const char *func_name = enclosing_function_qn(ctx, call); |
| 678 | const char *channel_name = func_name ? func_name : "(websocket)"; |
| 679 | push_channel(ctx, channel_name, "websocket", CBM_CHANNEL_EMIT, call); |
| 680 | return; |
| 681 | } |
| 682 | |
| 683 | (void)object; |
| 684 | } |
| 685 | |
| 686 | /* Detect Java annotation-based WebSocket listeners: @OnMessage, @MessageMapping */ |
| 687 | static void java_process_annotation(CBMExtractCtx *ctx, TSNode annotation) { |
no test coverage detected