API change request (RT-23413)
greg.x.brown at oracle.com
Fri Jul 20 11:08:09 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).
More information about the openjfx-dev