[modules-dev] [Fwd: [Fwd: Review request: 6563535, URLRepository.install]]

Stanley M. Ho Stanley.Ho at Sun.COM
Wed Aug 15 15:59:50 PDT 2007


Dave Bristor wrote:
> Because ModuleArchiveInfo.equals() is asymmetric with respect to 
> ModuleArchiveInfo.hashCode().  The former is based on equality of 
> references and the latter on equality of hashcodes of a a subset of the 
> instance's fields.  Here's the use case that necessitates this: From 
> JRepo's uninstall command, URLRepository.uninstall(ModuleArchiveInfo) is 
> given an instance that is created based on information from the command 
> line, therefore the ModuleArchiveInfo instance is not the one returned 
> by an earlier URLRepository.install().

The way I expected this to work is that Repository.list() will be used 
to obtain a list of ModuleArchiveInfo, then we'll find the one we want 
and pass it to uninstall(). I don't think the repository implementation 
should attempt to recognize any arbitrary ModuleArchiveInfo that is 
passed in. In other words, it should only recognize the ones that it 
created.

> Now I understand.  Fixed, hopefully better, let me know what you think; 
> I updated the webrev:
>     http://analemma.sfbay.sun.com/java/jdk/ws/libs/rev/6563535-b/

Better. Note that the code uses writeRepositoryMetadata to write the 
metadata. However, writeRepositoryMetadata() assumes that the new 
ModuleArchiveInfo is in contents, and it simply iterates the contents 
and writes the metadata out. Now we no longer update the contents 
prematurely, so writeRepositoryMetadata() will need to call 
writeModule() on the "mai" that is passed in.

- Stanley



More information about the modules-dev mailing list