class

Analyzer::Java::Spring

Inherits Analyzer < FileHelper < Reference < Object

Constants

ANY_BINDING_RE = Regex.union(SPRING_WEB_BIND_PACKAGE, FEIGN_CLIENT_PACKAGE, "@FeignClient", SPRING_HTTP_EXCHANGE_PACKAGE, "@HttpExchange", "@GetExchange", "@PostExchange", "@PutExchange", "@PatchExchange", "@DeleteExchange", "RouteLocatorBuilder", "PredicateSpec", "org.springframework.cloud.gateway", "org.springframework.web.socket.config.annotation", "WebSocketMessageBrokerConfigurer", "@EnableWebSocketMessageBroker", "org.springframework.messaging.handler.annotation", "@MessageMapping", "@SubscribeMapping", "ResourceHandlerRegistry", "addResourceHandler")

The OR of every marker the annotation branch keys off. A file that misses this cannot set any of the individual flags, so the per-flag scans only run for the handful of files that get past it.

FEIGN_CLIENT_PACKAGE = "org.springframework.cloud.openfeign.FeignClient"
INTERFACE_OR_ABSTRACT_RE = Regex.union("interface", "abstract")

collect_interface_route_index gates.

INTERFACE_ROUTE_MARKER_RE = Regex.union(SPRING_WEB_BIND_PACKAGE, SPRING_HTTP_EXCHANGE_PACKAGE, "@HttpExchange", "@GetExchange", "@PostExchange", "@PutExchange", "@PatchExchange", "@DeleteExchange", "@RequestMapping", "@GetMapping", "@PostMapping")
MESSAGE_MAPPING_BINDING_RE = Regex.union("org.springframework.messaging.handler.annotation", "@MessageMapping", "@SubscribeMapping")
META_ANNOTATION_RE = Regex.union("@interface")
REGEX_ROUTE_CALL = /((?:andRoute|route)\s*\(|\.)\s*(?:RequestPredicates\.)?(GET|POST|DELETE|PUT|PATCH|HEAD|OPTIONS)\s*\(/
REGEX_ROUTER_CODE_BLOCK = /route\(\)?.*?\);/m
RESOURCE_HANDLER_BINDING_RE = Regex.union("ResourceHandlerRegistry", "addResourceHandler")
SPLIT_CONCAT_RULES = Noir::TopLevelSplit::Rules.new(nest: (Noir::TopLevelSplit::Nest::Paren | Noir::TopLevelSplit::Nest::Bracket) | Noir::TopLevelSplit::Nest::Brace, quotes: "\"", escape: Noir::TopLevelSplit::Escape::InQuotes, strip: true, empties: Noir::TopLevelSplit::Empties::DropAll, per_kind: false, clamp: true)

Rules::JAVA minus the single-quote quote style, and dropping EVERY empty part rather than only a trailing one — the old body ended in .map(&.strip).reject(&.empty?), so "a" + + "b" yielded two terms, not three. Both matter to the caller, which concatenates the terms it gets back into a route path. File-local because spring is the only splitter with this combination.

SPRING_HTTP_EXCHANGE_PACKAGE = "org.springframework.web.service.annotation."
SPRING_INDEX_PRESCREEN_RE = Regex.union("setApplicationDestinationPrefixes", SPRING_WEB_BIND_PACKAGE)
SPRING_WEB_BIND_PACKAGE = "org.springframework.web.bind.annotation."
SPRING_WEB_BIND_RE = Regex.union(SPRING_WEB_BIND_PACKAGE)
STOMP_PREFIX_RE = Regex.union("setApplicationDestinationPrefixes")

build_spring_indexes gate: neither index can want a file that mentions neither marker.

WEBSOCKET_BINDING_RE = Regex.union("org.springframework.web.socket.config.annotation", "WebSocketMessageBrokerConfigurer", "@EnableWebSocketMessageBroker")

Every content.includes?(...) below used to be its own Rabin-Karp pass over the whole file. This analyzer asks ~30 such questions per .java file across three walks, and on a monorepo the overwhelming majority of files answer "no" to all of them. One precompiled Regex.union (PCRE2 JIT, via content_matches?) is the same predicate in a single pass — see the note on Analyzer#content_matches?.

Class methods

tech_name
Source

Instance methods

analyze
Source
tech

Instance-side view of the same declaration. The per-file rescues live on this base class, which has no way to name the analyzer that is running inside them, so a skipped file could not be attributed to a tech. Deriving it from analyzer_for keeps the name written exactly once.

Source

Nested types