Improve public API and restore 2.x backward compatibility#40
Open
Improve public API and restore 2.x backward compatibility#40
Conversation
- Restore missing PugTemplate.process(PugModel, Writer) method as deprecated to maintain backward compatibility with 2.4.1 - Fix resource leak in templateExists() (PugEngine and PugConfiguration) where Reader was never closed - Add convenience render(String, Map) methods to PugEngine for combined getTemplate + render in a single call - Remove duplicate caching in PugConfiguration by delegating entirely to PugEngine (was maintaining its own Caffeine cache separately) - Simplify expressionCacheSize handling to work with all expression handlers, not just JexlExpressionHandler Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add validation for negative expressionCacheSize in PugConfiguration - Restore testSetExpressionCacheSizeNegative test - Remove redundant expressionHandler.setCache() call in setCaching() - Add thread-safety note to class comment - Remove stray blank line Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use volatile + double-checked locking for the cached PugEngine instance instead of just documenting the race condition. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use pattern matching instanceof across compiler, parser, and utilities - Convert Attr and AttributeValueResponse to records - Replace mutable HashMap with Map.of() in Doctypes - Fix StringBuffer -> StringBuilder in PugException - Optimize StringBuilder initialization in Compiler - Add TODO for sealed Token hierarchy when migrating to Java 21 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…an guards Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
PugTemplate.process(PugModel, Writer)method (deprecated) that was removed but still used by 2.4.1 consumerstemplateExists()in bothPugEngineandPugConfigurationnow properly closes theReadervia try-with-resourcesPugEngine.render(String templateName, Map model)methods that combinegetTemplate()+render()in a single callPugConfigurationno longer maintains its own Caffeine cache — it delegates entirely toPugEngine, eliminating double-caching and simplifying the codeJexlExpressionHandler), removing theIllegalStateExceptionfor GraalJS usersTest plan
mvn test)PugConfiguration-based code paths still work end-to-end🤖 Generated with Claude Code