Repository navigation
feat(plugins): incremental linter with Hibernate eager bootstrap and JSON metrics reporting - #95
Merged
Conversation
…ootstrap - Refactor `JakartaNamedObjectParser` to instantiate the Hibernate `SessionFactory` exactly once during the `from()` factory bootstrap phase. - Streamline `LintNamedQueriesWorker` to delegate deep JPQL syntax and placeholder checks to Hibernate's eager query validation observer. - Focus the worker task's responsibility exclusively on bytecode annotation sweeping, parameter name style governance, and task coordination. - Update the Spock functional testing suite to utilize regex stacktrace extraction for asserting the root `NamedQueryValidationException` type and error attribute matrix size. - Ensure all resources are cleanly disposed of via try-with-resources blocks to prevent persistent classloader leaks on TestKit daemons.
…nd separate incremental source tracking Replace the compiled classes input from a ConfigurableFileTree (compiledClasses) to a DirectoryProperty (compiledClassesDir) and introduce a dedicated ConfigurableFileCollection (sourceFiles) for incremental source file change tracking. - Switch @incremental annotation from compiled classes to source files so delta tracking operates on .java inputs instead of .class outputs - Translate source-level file changes to their bytecode counterparts during incremental passes - Add build directory exclusion filter when wiring source files in the plugin registration - Remove explicit dependsOn for compileJava in favor of mustRunAfter - Simplify functional test runner setup by reusing shared GradleRunner instance
…xing Add a precondition assertion in SchemaValidationWorker to verify that the parsed tenant profile token array contains more than 3 elements before accessing individual fields, preventing potential ArrayIndexOutOfBoundsException on malformed input.
|
|
1 task
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
Refactor the
lintNamedQueriesGradle task to delegate deep JPQL/HQL semantic validation toHibernate's eager
SessionFactorybootstrap, introduce incremental compilation support viasource-level delta tracking, and produce a structured JSON execution metrics report.
This PR modifies 11 files in the
pluginsmodule across three focused commits.Changes
Hibernate Eager Bootstrap Delegation (
0b4e90d)LintNamedQueriesWorkerno longer manually iterates over discovered queries/proceduresfor ANTLR4 validation inline. Instead, semantic query validation is delegated to Hibernate's
eager query validation observer during
SessionFactorybootstrap.Helper.validateDiscoveredQueries()andHelper.validateDiscoveredStoredProcedures()static methods to encapsulate query and stored procedure validation loops with proper error
counting and parameter naming style governance.
NamedObjectParseris wrapped in awithCloseableblock to ensure proper HibernateSessionFactoryresource cleanup and prevent classloader leaks on TestKit daemons.NamedQueryValidationExceptiontype and error attribute matrix size.Incremental Source Tracking Refactoring (
c36f253)LintNamedQueriestask replaces theConfigurableFileTree(compiledClasses) input witha
DirectoryProperty(compiledClassesDir) and introduces a dedicatedConfigurableFileCollection(
sourceFiles) annotated with@Incrementalfor source-level.javafile change tracking..classbytecode counterpartsduring incremental passes, so only affected classes are routed through the ASM sweep.
@OutputFilelintReportFileproperty for a JSON execution metrics report(timestamp, incremental status, detected files, error count), routed to
build/reports/lintNamedQueries/validation-report.jsonfor Gradle cache compatibility.sourceFilesfromjava.sourceSets.mainwith builddirectory exclusion filter; replaces
dependsOn(compileJava)withmustRunAfter(compileJava).GradleRunnerinstance.Tenant Profile Token Assertion (
9efc65e)SchemaValidationWorkeradds a precondition assertion verifying that the parsed tenantprofile token array contains more than 3 elements before accessing individual fields,
preventing a potential
ArrayIndexOutOfBoundsExceptionon malformed input.Documentation
plugins/README.mdupdated: version bump to1.7.0, plugin description reflects incrementallinting and JSON metrics, architecture tree updated.
jakarta-plugin.adocupdated with incremental compilation details, new task properties(
compiledClasses,lintReportFile), andwithCloseableresource management notes.overview.htmlrelease notes added for v1.7.0 features.plugin,task, andworkerpackages.How to Verify
lintNamedQueriestwice, and confirm the secondrun performs an incremental pass (check console output and the generated JSON report).
SessionFactoryleak warnings appear in daemon logs.