Conversation
…d type is unknown DataRepositoryAotMetadataService finds a repository's AOT metadata file by switching on the project's build type. That type is null whenever the build cannot be classified: the invisible project the language server creates for a plain folder has no build file, and neither does a project contributed by an importer that is neither Maven nor Gradle, so ClasspathUtil.createProjectBuild reports a build whose type is null - and switching on null throws. The caller is the Spring Data repository indexer, reached for every query method that carries no @query, and SpringIndexerJavaAstScanner catches per type declaration. The whole repository interface then contributes nothing at all - no repository bean, none of its query methods - while the rest of the index is built normally, so the index looks healthy and the repositories are simply absent from it. Both switches in the class now read the type through a null-safe helper and answer Optional.empty(), which is what they already do for a type they do not recognise. Adds a test for a build with no type and for a project with no build. Signed-off-by: Artem <sorteam@users.noreply.github.com>
sorteam
force-pushed
the
data-repository-unknown-build-type
branch
from
September 22, 2026 15:10
eaf20a6 to
a6c2486
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2002.
DataRepositoryAotMetadataServiceswitches onproject.getProjectBuild().getType()in two places.That type is null whenever the build cannot be classified - the invisible project the language server
creates for a plain folder, or a project contributed by an importer that is neither Maven nor Gradle -
and switching on null throws.
The throw lands on the indexing path.
DataRepositoryIndexer.identifyQueryStringreaches this servicefor every query method that carries no
@Query, andSpringIndexerJavaAstScanner.extractSafelycatches per type declaration, so the whole repository interface contributes nothing to the index:
no repository bean, none of its query methods. Everything else indexes normally, which is what makes
it easy to miss - the index looks healthy and the repositories are simply not in it. Measured on the
workspace where I hit this (116 projects, ~10.7k java files): 802 interfaces extend a Spring Data
repository, 391 of them declare at least one method without
@Query, and the running server's heapheld 5023 beans with those repositories absent.
Change
A null-safe
buildType(IJavaProject)used by bothgetRepositoryMetadataandregenerateMetadataCommand; an unreadable type answersOptional.empty(), which is what both methodsalready do for a type that is neither maven nor gradle. Behaviour for Maven and Gradle projects is
unchanged.
DataRepositoryAotMetadataServiceBuildTypeTestcovers a build whose type is null and a project withno build at all. Both fail with an NPE against the previous implementation.
Verification
I compiled the modified class and the test against the language server jar shipped in
vmware.vscode-spring-boot2.5.2026092200 and read the emitted bytecode:getRepositoryMetadatanowreturns
Optional.empty()before it reachesString.hashCode(). I have not run the project's ownMaven build or test suite, so please treat the change as needing your CI.
RewriteRecipeRepository.createRewriteProjectParserswitches on the same value and itsdefaultalready throws
IllegalStateException("The project is neither Maven nor Gradle!"); a null type therereplaces that message with an NPE. Not touched here - say the word and I will add it.