harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shipilov, Alexander D" <alexander.d.shipi...@intel.com>
Subject RE: [classlib][awt] RenderingHints.Key.isCompatibleValue(). Method sence.
Date Tue, 12 Dec 2006 09:54:38 GMT
Hi, Andrey,

 I'm agreeing that in the Harmony implementation a value have to be an
instance of KeyValue. I'm also agreeing that straight invocation of
method isCompatibleValue() on RI gets correct results. But in case of
RenderingHints creation (like in bug) we have incorrect results on RI:
        RenderingHints localRenderingHints = new RenderingHints( 
                RenderingHints.KEY_ANTIALIASING, new Object()); 
	        System.out.println("passed");
        RenderingHints localRenderingHints = new RenderingHints( 
                RenderingHints.KEY_ANTIALIASING, null); 
      	  System.out.println("passed");
        RenderingHints localRenderingHints = new RenderingHints( 
                RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON); 
      	  System.out.println("passed");

The results on RI are:
passed
passed
passed

The results on Harmony are:
java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
passed

Is that means that RI has incorrect behavior? I see that you have
already added similar comment to the bug :)

Thanks,
Alexander Shipilov

>-----Original Message-----
>From: Pavlenko, Andrey A [mailto:andrey.a.pavlenko@intel.com]
>Sent: Monday, December 11, 2006 8:02 PM
>To: dev@harmony.apache.org
>Subject: RE: [classlib][awt] RenderingHints.Key.isCompatibleValue().
Method
>sence.
>
>Hi, Alexander,
>
>In the Harmony implementation a value have to be an instance of
>KeyValue, but not Value. See the implementation of the
isCompatibleValue
>method.
>
>        public boolean isCompatibleValue(Object val) {
>            if (!(val instanceof KeyValue)) {
>                return false;
>            }
>
>            return ((KeyValue)val).key == this;
>        }
>
>RI also does not return true in any case, see the following example.
>
>        System.out.println(RenderingHints.KEY_ANTIALIASING
>                .isCompatibleValue(new Object()));
>        System.out.println(RenderingHints.KEY_ANTIALIASING
>                .isCompatibleValue(null));
>        System.out.println(RenderingHints.KEY_ANTIALIASING
>                .isCompatibleValue(RenderingHints.VALUE_ANTIALIAS_ON));
>
>Output:
>false
>false
>true
>

Mime
View raw message