File size: 5,118 Bytes
e00f999 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | # Annotation guidelines
These are the rules the role labels of ModuleMap-Bench follow. A second annotator
uses them unchanged (see `annotation/README.md`).
## 1. Unit
One **top-level Java type** — class, abstract class, interface, enum, record or
annotation — declared in a Maven module’s `src/main/java`, at the commit given
for its project. Nested types belong to their outer type. Test code is out of
scope.
## 2. What to decide
Exactly **one role**: what the type *does* when the application runs. Choose
from the eight values below. Decide from the source file at the given commit;
you may open other files of the repository (its supertypes, its users, the
`pom.xml`). **Never look at the output of a tool** that assigns roles,
agentkit included.
Write a short **note** whenever the decision is not obvious, and name the
runner-up when there is one (“could be read as persistence”).
Who *uses* a type — another module importing it, two classes implementing it —
is **not** labelled: it is a structural fact, computed and published beside
the label (`structure.imported_by`, `structure.implementations`,
`structure.derived_marks`).
## 3. Roles
| Role | The type… | Typical forms | Not this role |
|---|---|---|---|
| `entry` | is invoked by a framework as the **start of a unit of work** from outside the application code | `@RestController`/`@Controller` with at least one request mapping; message listeners (`@KafkaListener`, `@RabbitListener`, `@JmsListener`, RocketMQ, Redis Stream); scheduled jobs (`@Scheduled`, Quartz/xxl-job handlers); `@EventListener`, `ApplicationListener`; workflow delegates and listeners (`JavaDelegate`, `ExecutionListener`, `TaskListener`, external-task handlers, Camunda 8 job workers); the `@SpringBootApplication` class | `@ControllerAdvice`/`@RestControllerAdvice` exception handlers; servlet and gateway filters, interceptors; parse-time hooks; a controller with no mapping; LLM tool callbacks |
| `client` | **calls another system** over the network | Feign clients, Spring HTTP interfaces (`@HttpExchange`); a class whose main purpose is calling a remote HTTP API (`RestTemplate`, `WebClient`, `OkHttpClient`); readers/writers of a remote configuration store | Feign fallbacks and fallback factories; clients of an in-process engine; storage adapters that write to the application’s own database (→ `persistence`) |
| `service` | holds **business logic** | `@Service` classes; service interfaces and facades (`*Service`, `*Api`) implemented by a service; components doing business work; message publishers | thin framework adapters (→ `none`); utilities (→ `none`) |
| `domain` | is **persisted business data** | JPA entities, `@Embeddable`, `@MappedSuperclass` and base entities; MyBatis-Plus `@TableName` classes; Mongo `@Document`s; records stored in a configuration or rule store | DTOs, VOs, request and response objects, non-persisted aggregates (→ `none`) |
| `persistence` | **reads or writes the application’s data store** | Spring Data repositories, MyBatis mappers, DAOs, classes upserting records | generator `*Example` criteria classes (→ `none`); Excel or object “mappers” that are converters (→ `none`) |
| `event` | **is an event**, not a handler | classes extending `ApplicationEvent`; event payload classes (`*Event`) that are not persisted | persisted notifications (→ `domain`) |
| `config` | **configures** the application | `@Configuration`, `@AutoConfiguration`, `@ConfigurationProperties` | `@Component`s that validate settings or customise error output (→ `none`); plain value classes named `*Config` (→ `none`) |
| `none` | none of the above | DTOs, enums, constants, utilities, exceptions, annotations, interceptors and filters, framework SPI adapters, test bases shipped in main code | |
## 4. When two roles seem to apply
1. **What it does at run time wins over what it is called.** A `KongAdapterService`
that calls the Kong admin API is a `client`; a `JobRegistryHelper` running
registry logic on its own thread is a `service`.
2. **Being invoked by the framework wins.** A `@Service` or a `@Configuration`
whose main method is an `@EventListener` is an `entry`.
3. **Persisted data wins over event.** A stored notification is `domain`.
4. **An abstract base takes the role of what its subclasses are**, when all of
them are one thing (an abstract stream listener is an `entry`).
5. **An interface takes the role of its implementations** when they agree
(a service interface is a `service`), and is `none` when it has no
implementation and no other evidence.
6. Still undecided: pick the closer role and say so in the note.
## 5. Quality
- Each project’s types were sampled from its files only (stratified by the last
word of the type name), so the labels do not depend on any tool.
- Round 1: one pass by an LLM coding assistant following these rules, 2026-11-08,
all 620 labels; notes record every non-obvious decision.
- Round 2: an independent annotator labels a blinded sample of 150
(`annotation/round-2/sample.csv`); agreement is reported as Cohen’s κ.
|