Skip to content

Commit 8ac7f0f

Browse files
committed
fix: improve annotation processing logic and update Javadoc comments for clarity
1 parent 6400036 commit 8ac7f0f

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/main/java/com/github/thought2code/mcp/annotated/server/component/AnnotationProcessor.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
* Compile-time processor that turns MCP component annotations into a generated {@link
4848
* ComponentProvider}.
4949
*
50-
* <p>During each compilation round the processor collects annotated methods, validates naming and
51-
* signatures, and on the final round emits:
50+
* <p>During annotation processing the processor collects annotated methods, validates naming and
51+
* signatures, and emits:
5252
*
5353
* <ul>
5454
* <li>A {@code GeneratedComponentProvider_*} class with tool, prompt, resource, and completion
@@ -108,7 +108,7 @@ public synchronized void init(ProcessingEnvironment processingEnv) {
108108
}
109109

110110
/**
111-
* Collects annotated elements each round; generates the provider on the final round when at least
111+
* Collects annotated elements and generates the provider during a non-final round when at least
112112
* one component method was discovered.
113113
*
114114
* @param annotations supported annotation types present in this round (unused)
@@ -117,12 +117,14 @@ public synchronized void init(ProcessingEnvironment processingEnv) {
117117
*/
118118
@Override
119119
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
120+
if (roundEnv.processingOver()) {
121+
return false;
122+
}
120123
collectTools(roundEnv);
121124
collectPrompts(roundEnv);
122125
collectResources(roundEnv);
123126
collectCompletions(roundEnv);
124-
if (!roundEnv.processingOver()
125-
|| generated
127+
if (generated
126128
|| (tools.isEmpty() && prompts.isEmpty() && resources.isEmpty() && completions.isEmpty())) {
127129
return false;
128130
}

0 commit comments

Comments
 (0)