Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FREEMARKER-218: Jakarta support #104

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

kelemen
Copy link
Contributor

@kelemen kelemen commented Dec 30, 2023

Added new generated sources created from freemarker-javax-servlet where javax references are replaced with jakarta references. Tests are also copied (with similar adjustments).

The main remaining question is freemarker.cache.WebappTemplateLoader. For now, I have left it in the same package renamed to JakartaWebappTemplateLoader. There are two reasons for this:

  • freemarker.cache is a split package, and it is awkward to deal with this, if we move this class to a new package.
  • This class refers to package private classes and methods from freemarker.cache (URLTemplateSource and TemplateLoaderUtils), and making them public is an obvious detriment.

That said, I do have a variant of this change where I moved this class into another package (in my local copy), so moving to a new package is definitely doable, if the used classes (and their methods) are made public.

@ddekany
Copy link
Contributor

ddekany commented Dec 30, 2023

My preference is to copy freemarker.cache.WebappTemplateLoader into freemarker.ext.jakarta.servlet.WebappTemplateLoader, and make URLTemplateSource (and most of its methods) and TemplateLoaderUtils public. (These are very old classes, and it's not likely that we will want to change then in an incompatible way, so we might as well let others use them for their own TemplateLoader-s.) My reason is exactly to move away from the split-package style. One day the whole javax.serlvet support will be removed, and only jakarta.servlet will remain, and at that point we will delete freemarker.cache.WebappTemplateLoader, and then the whole servlet support can be separated without spit-package issues.

@kelemen
Copy link
Contributor Author

kelemen commented Dec 30, 2023

Ok, I have pushed the variant moving it to another package.

I have made the least amount of changes to the two classes necessary. I'm assuming that if you want to make some adjustments to them you will do that after merging this PR (e.g.: making URLTemplateSource final).

@ddekany ddekany changed the title Jakarta support FREEMARKER-218: Jakarta support Jan 9, 2024
@ddekany ddekany merged commit babdccb into apache:2.3-gae Jan 23, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants