mmmm I've made a mistake ... sorry !
Anyway the problem was that the EA spec. states that properties must not be mutable, while in the new UPnP spec. the upnp.events property is a mutable dictionary. Thus Karl has used in the Bridge the following final Dictionary implementation instead of doing a copy.
------------------------------------------------------------------------
                   final Dictionary immutableEvents = new Dictionary(){

                        public int size()
                        {
                            return events.size();
                        }

                        .....

                        public Object get(Object arg0)
                        {
                            return events.get(arg0);
                        }

                        public Object put(Object arg0, Object arg1)
                        {
throw new IllegalStateException("Event Properties may not be changed");
                        }

                        public Object remove(Object arg0)
                        {
throw new IllegalStateException("Event Properties may not be changed");
                        }

                        .....

                    };
--------------------------------------------------------------------

I was wondering if the same approach could be used for the general Event class. But I figured out just now that it is not a correct solution. In fact a client can always get() a reference of a mutable object and modifies its value. :(

so forget the question that I have raised !! sorry again.

francesco



Richard S. Hall wrote:
Karl Pauls wrote:
There are three issues with this. First, I don't think we can provide
a different implementation of org.osgi.service.event.Event; It's a
given and changing it is out of the question (unless I'm very much
mistaken).

We can provide a different implementation as long as it doesn't change the semantics in such a way that it would violate spec compliance. There are already some classes we provide different implementations for, such as AdminPermission and FrameworkUtil.

Of course, I cannot say that I totally understand what is at issue here.

-> richard

Reply via email to