-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Predict specific object type in EhCacheFactoryBean #41
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
Conversation
Hi Stevo, thanks for the submission (and thanks for all the others, too!). We've just worked up a contributor guidelines doc. Please read this over and touch up these pull requests accordingly. This should streamline things going forward. Cheers! |
Amended and force pushed changed commit for this pull request - fixed broken test, formatted commit message, added note on ICLA. |
This is looking great, Stevo. Thanks for taking the time to polish this up. Just a couple additional things to change. Regarding the subject line: Instead of
Consider the following
From the "Format commit messages" section of the guidelines:
The body of the commit comment looks good, though one line comes in at 74 characters instead of 72 (5.), and recognition of the CLA should actually go in the pull request comments, not the commit comment (4. from "Submit your pull request"). Note that I haven't reviewed deeply the actual substance of the commit (though at a glance it looks good). I just wanted to get these corrections in here as quickly as possible as I know you have other pull requests that you may be polishing up in the meantime. Thanks again! |
Prior to this change, before bean gets created by EhCacheFactoryBean, its getObjectType would return only Ehcache interface. This caused unwanted wiring issues like one described in related JIRA issue. This fix makes use of EhCacheFactoryBean configuration to determine object type even before it's created, so that container is provided with as specific as possible object type when resolving dependencies. Nevertheless, users are advised to code to Ehcache interface. Issue: SPR-7843
Chris, I've amended 3 out of 4 of my current pull requests - hopefully I got them OK this time. Anyway, thanks for your patience and support. Remaining one (36) is javadoc related. Among other things, have to check javadoc line lengths there. While working on the issue I've noticed several approaches being used in javadoc for linking to annotations. Here are examples: @{@link foo.bar.Inject} import foo.bar.Inject; {@link foo.bar.Inject @Inject} import foo.bar.Inject; Maybe it would be wise to use one only, consistently. Is there agreement among Spring developers, which approach is preferred? Or is mixup of different approaches OK? Personally, I prefer ones (2, 4) with import statements (even when annotation is not actually used in the type) as they make javadoc compact, and refactoring packages will update references (so "typesafe"). Difference between the two is whether @ is or isn't part of the link (so different font colour for @ and annotation type in the link), and compactness. In pull request 36 (which I'll amend) I used more 4 and 3, but thinking now, 2 seems best of all. |
* SPR-7843: Predict specific object type in EhCacheFactoryBean
Stevo, I've committed the pull request, with a few changes:
With that said, the implementation itself looks really good, and Author: attribution is retained as the substance of your changes are intact. Congrats on your first commit, and thanks so much for taking the time with this and all the other issues lately! |
Regarding {@link ...} tags in Javadoc, it's a good question. This is one area of the framework where there are definitely different styles as you point out. 2 and 4 require importing the type in order to save space in the {@link ...} tag. There is nothing fundamentally 'wrong' with doing this, but we don't do it in the framework for a couple of reasons: First and most importantly, the set of imports in a given file has real significance to us as maintainers. It's a quick way of reasoning about this class and its relationships without a full static analysis. When documentation-only imports creep in, it makes this less meaningful. Second, it is not a complete solution. There are many cases where we refer in {@link} and {@see} tags to classes that cannot be imported due to being in higher-level packages. Because of the way we generate our Javadoc, this is not a problem for the rolled up public API documentation (i.e. the links all work there), but it would be impossible to import these classes at the source level. So for the reasons above, the best approach is to go with 2 if the type has already been imported, i.e. is already actually used in the class at the source level:
the benefit here is that this requires as little duplication as possible, and is quite refactoring-friendly. if the type in question is not used at the source level, then go with 3:
this avoids the need to import and renders the link as a short name instead of fully-qualified. As you mention above, this does create a slight inconsistency in the rendered Javadoc, because in 3 the ampersand is not part of the hyperlink, whereas in 4 it is. This is basically a compromise worth making because of the brevity and refactoring friendliness of 2 and the fact that when using 3, the fully-qualified names can get quite long, meaning that due to line breaks, the {@link} can end up being the first character of that line of javadoc, and it is illegal to lead with a '@' character, unless you're dealing with a legal javadoc param like 'see', 'author', 'param', etc. It's not perfect, but that's more due to idiosyncrasies of Javadoc than anything else. Thanks for asking! |
Prior to this change, before bean gets created by EhCacheFactoryBean,
its getObjectType would return only Ehcache interface. This caused
unwanted wiring issues like one described in related JIRA issue.
This fix makes use of EhCacheFactoryBean configuration to determine
object type even before it's created, so that container is provided
with as specific as possible object type when resolving dependencies.
Nevertheless, users are advised to code to Ehcache interface.
Issue: SPR-7843
I have signed and agree to the terms of SpringSource Individual Contributor License Agreement.