Repository navigation
feat: incremental AST processing with AutoCloseable resource management - #93
Merged
Merged
Conversation
…urce leaks Make NamedObjectParser extend AutoCloseable so that the underlying Hibernate SessionFactory and ServiceRegistry are properly released after use. - Extend NamedObjectParser SPI with AutoCloseable - Add close() to JakartaNamedObjectParser to destroy SessionFactory and ServiceRegistry; reuse a single SessionFactory and HqlTranslator across parseQuery calls instead of rebuilding per invocation - Add close() to LegacyNamedObjectParser with equivalent cleanup - Refactor JakartaSchemaValidator to use try-with-resources for BootstrapServiceRegistry and StandardServiceRegistry - Update LegacySchemaValidator with matching resource management - Update NamedObjectParserFactory Javadoc to document caller responsibility for closing - Update README with try-with-resources usage examples
…up to linter task Refactor LintNamedQueries to leverage Gradle's InputChanges API for incremental builds, and adopt try-with-resources for the NamedObjectParser to prevent Hibernate resource leaks. - Replace DirectoryProperty input with @incremental ConfigurableFileTree to enable delta-aware class file tracking - Add incremental/affected/removed file parameters to the worker and route only changed bytecodes through the ASM sweep on delta passes - Wrap NamedObjectParser in withCloseable to match the new AutoCloseable SPI contract and ensure SessionFactory cleanup - Add @OutputFile JSON execution metrics report for Gradle cache compatibility - Extract Helper.sweepClassFile() to deduplicate ASM scanning logic - Wire explicit dependsOn(compileJava) and route lint report output to build/reports layout in plugin registration - Update functional tests: adjust error assertion to match eager metamodel validation, add three incremental compilation scenarios (new entity, no-op modification, entity deletion)
|
2 tasks
|
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.





Summary
Add incremental compilation support to the Jakarta Persistence Gradle linter task and make
NamedObjectParserAutoCloseableto prevent Hibernate resource leaks.This PR touches 20 files across both the
librariesandpluginsmodules, delivering two tightly coupled improvements: a resource-safe parser SPI and a delta-aware Gradle task that leverages it.Libraries — AutoCloseable
NamedObjectParserNamedObjectParserSPI now extendsAutoCloseable, giving callers a clear lifecycle contract for releasing Hibernate internals.JakartaNamedObjectParserreuses a singleSessionFactoryandHqlTranslatoracrossparseQuerycalls instead of rebuilding per invocation;close()destroys both theSessionFactoryandServiceRegistry.LegacyNamedObjectParserreceives equivalentclose()cleanup logic.JakartaSchemaValidator/LegacySchemaValidatorrefactored to use try-with-resources forBootstrapServiceRegistryandStandardServiceRegistry.NamedObjectParserFactoryJavadoc updated to document the caller's responsibility for closing.AutoCloseablebehaviour.libraries/README.mdupdated with try-with-resources usage examples.Plugins — Incremental Compilation & Worker Refactoring
LintNamedQueriestask now uses Gradle'sInputChangesAPI with an@IncrementalConfigurableFileTreeinput, enabling delta-aware class-file tracking instead of full rescans.@OutputFileJSON execution-metrics report for Gradle build-cache compatibility.LintNamedQueriesWorkerreceivesincrementalPass,affectedClassFiles, andremovedClassFilesparameters; only changed bytecodes are routed through the ASM sweep on delta passes.Helper.sweepClassFile()utility to deduplicate ASM scanning logic.NamedObjectParserwrapped inwithCloseableto honour the newAutoCloseableSPI contract.dependsOn(compileJava)dependency and routes the lint report output to thebuild/reportslayout.plugins/README.md, AsciiDoc, andoverview.htmldocumentation updated to reflect the new features.Other
lint-persistenceversion from2.1.0→2.2.0ingradle/libs.versions.toml.How to Verify