Lookups and positions

Javier Ortiz <[email protected]>
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Message-ID <CAP3=pbP2CFc1uX=HkNjT5KZ_NusOyn5+Y3Ad5rbWWwRKVN0eCw@mail.gmail.com>
I'm facing an issue and I want to know if I'm alone here. Based on the spec
of ServiceProvider
<http://bits.netbeans.org/8.0/javadoc/org-openide-util-lookup/org/openide/util/lookup/ServiceProvider.html>,
the lower the position attribute is, the higher it shows on the lookup.

This seems to be true within a project, but having dependencies seems not
always stays true.

I have a hierarchy of projects:


   - Project 1
   - Dependency 1
   - Dependency 2

Project 1 depends on Dependency 1 which depends on Dependency 2. Each one
have items on the lookup.

Here are the relevant ones in Dependency 2:

simple.server.core.entity.Entity
#position=1
simple.server.core.entity.RPEntity
#position=2
simple.server.core.entity.item.Item
#position=3
simple.server.core.entity.clientobject.ClientObject
#position=100

Dependency 1:

games.jwrestling.server.core.NPC
#position=100

Project 1:

games.jwrestling.server.trainer.Trainer

I'm expecting to see Trainer class show up later than the others because it
has not position specified, but it's showing up first!

I did some debugging and it indeed shows up first, followed with the
ordered dependencies.

Here's what I would expect:

   1. Entity
   2. RPEntity
   3. Item
   4. ClientObject
   5. NPC
   6. Trainer

Here's what I got:

   1. Trainer
   2. Entity
   3. RPEntity
   4. Item
   5. ClientObject
   6. NPC

Any ideas?

You might think Trainer has something peculiar and it does, it's registered
as two different services, but it shouldn't matter right? At least the spec
mentions nothing about this.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.