API change request (RT-23413)
Richard.Bair at oracle.com
Fri Jul 20 11:28:20 PDT 2012
>>>> One other thing I just thought of right this moment -- what if we auto-cleared the imports when calling load on a different URL than was used the last time?
>>> That would work, but I don't think there's much harm in simply preserving the imports. If you really want to make sure they are cleared, you can either use a new loader instance or call clearImports().
>> I'm just wondering if we can get the best behavior by default without the developer having to do anything special. That is, the behavior would still be correct (even those edge cases mentioned above wouldn't occur) but when a single FXMLLoader is used to load multiple instances of the same document all the imports are already cached.
> I agree that it would be ideal if we could optimize the load behavior transparently. However, it occurred to me that clearing the cache based on URL might not always work either. If the caller is using the same FXMLLoader instance to load content from a URL that refers to a web site, the document's content could easily be different for each invocation of load().
> If we don't want to introduce any potentially confusing behavior, then Steve's suggestion is probably the way to go (allow the user to configure the behavior using a flag).
Would you need this method in that case, or is the flag sufficient? I kind of like the flag idea in that nobody gets burned, they opt into this behavior when they know they have a situation that it works for. The downside is that since it isn't enabled by default (?) people first run into a performance problem and then investigate it and then flip the flag. Of course libraries / frameworks like ZenJava could handle this by default.
More information about the openjfx-dev