Skip to content

Java @XxlJob(CONSTANT) annotations are not extracted into scheduler-facts #2035

@LvYiguang

Description

@LvYiguang

Area

gitnexus (CLI / core / indexing / MCP server)

Summary

GitNexus misses XXL-JOB handlers when the @xxljob annotation value is provided via a class constant instead of a string literal.

String literal annotations are extracted correctly:
@xxljob("finConfigProductSync")
public ReturnT finConfigProductSync(String param) {
...
}

But constant-based annotations are omitted:
private static final String JOB_NAME = "TradeStructureTemplateSync";

@xxljob(JOB_NAME)
public ReturnT tradeStructureTemplateSync(String param) {
...
}

Context

scheduler-facts.json contains 16 xxlJobs, while source scan finds 17 @xxljob annotations.

The missing job is:
TradeStructureTemplateSync

Expected behavior

GitNexus should resolve same-class static final String constants used as annotation values and include the job:
tradeStructureTemplateSync

Actual behavior

The missing job is:
TradeStructureTemplateSync

Steps to reproduce

package demo;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;

public class DemoJob {
private static final String JOB_NAME = "demoJob";

@XxlJob(JOB_NAME)
public ReturnT<String> run(String param) {
    return ReturnT.SUCCESS;
}

}

Run GitNexus analyze/facts generation and inspect scheduler-facts.json.

Likely Cause
The scheduler facts extractor appears to handle annotation string literals, but not identifier references that resolve to private static final String constants in the same class.

Acceptance Criteria

@xxljob("demoJob") is still extracted.
@xxljob(JOB_NAME) is extracted when JOB_NAME is a same-class static final String.
The extracted job name should be the constant value, not the identifier name.
Existing scheduler facts output shape remains unchanged.

Environment

gitnexus 1.6.5

Logs / screenshots

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions