Coverage Report - org.apache.tapestry.enhance.EnhancementOperationImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
EnhancementOperationImpl
96% 
97% 
2.432
 
 1  
 // Copyright 2004, 2005 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 
 15  
 package org.apache.tapestry.enhance;
 16  
 
 17  
 import org.apache.commons.logging.Log;
 18  
 import org.apache.hivemind.ApplicationRuntimeException;
 19  
 import org.apache.hivemind.ClassResolver;
 20  
 import org.apache.hivemind.HiveMind;
 21  
 import org.apache.hivemind.Location;
 22  
 import org.apache.hivemind.service.BodyBuilder;
 23  
 import org.apache.hivemind.service.ClassFab;
 24  
 import org.apache.hivemind.service.ClassFactory;
 25  
 import org.apache.hivemind.service.MethodSignature;
 26  
 import org.apache.hivemind.util.Defense;
 27  
 import org.apache.hivemind.util.ToStringBuilder;
 28  
 import org.apache.tapestry.services.ComponentConstructor;
 29  
 import org.apache.tapestry.spec.IComponentSpecification;
 30  
 import org.apache.tapestry.util.IdAllocator;
 31  
 import org.apache.tapestry.util.ObjectIdentityMap;
 32  
 
 33  
 import java.beans.BeanInfo;
 34  
 import java.beans.IntrospectionException;
 35  
 import java.beans.Introspector;
 36  
 import java.beans.PropertyDescriptor;
 37  
 import java.lang.reflect.Constructor;
 38  
 import java.lang.reflect.Method;
 39  
 import java.lang.reflect.Modifier;
 40  
 import java.util.*;
 41  
 
 42  
 /**
 43  
  * Implementation of {@link org.apache.tapestry.enhance.EnhancementOperation}that
 44  
  * knows how to collect class changes from enhancements. The method
 45  
  * {@link #getConstructor()} finalizes the enhancement into a
 46  
  * {@link org.apache.tapestry.services.ComponentConstructor}.
 47  
  * 
 48  
  * @author Howard M. Lewis Ship
 49  
  * @since 4.0
 50  
  */
 51  
 public class EnhancementOperationImpl implements EnhancementOperation
 52  
 {
 53  1
     static int _uid = 0;
 54  
     
 55  
     private ClassResolver _resolver;
 56  
 
 57  
     private IComponentSpecification _specification;
 58  
 
 59  
     private Class _baseClass;
 60  
 
 61  
     private ClassFab _classFab;
 62  
 
 63  138
     private final Set _claimedProperties = new HashSet();
 64  
 
 65  138
     private final JavaClassMapping _javaClassMapping = new JavaClassMapping();
 66  
 
 67  138
     private final List _constructorTypes = new ArrayList();
 68  
 
 69  138
     private final List _constructorArguments = new ArrayList();
 70  
 
 71  138
     private final ObjectIdentityMap _finalFields = new ObjectIdentityMap();
 72  
 
 73  
     /**
 74  
      * Set of interfaces added to the enhanced class.
 75  
      */
 76  
 
 77  138
     private Set _addedInterfaces = new HashSet();
 78  
 
 79  
     /**
 80  
      * Map of {@link BodyBuilder}, keyed on {@link MethodSignature}.
 81  
      */
 82  
 
 83  138
     private Map _incompleteMethods = new HashMap();
 84  
 
 85  
     /**
 86  
      * Map of property names to {@link PropertyDescriptor}.
 87  
      */
 88  
 
 89  138
     private Map _properties = new HashMap();
 90  
 
 91  
     /**
 92  
      * Used to incrementally assemble the constructor for the enhanced class.
 93  
      */
 94  
 
 95  
     private BodyBuilder _constructorBuilder;
 96  
 
 97  
     /**
 98  
      * Makes sure that names created by
 99  
      * {@link #addInjectedField(String, Class, Object)} have unique names.
 100  
      */
 101  
 
 102  138
     private final IdAllocator _idAllocator = new IdAllocator();
 103  
 
 104  
     /**
 105  
      * Map keyed on MethodSignature, value is Location. Used to track which
 106  
      * methods have been created, based on which location data (identified
 107  
      * conflicts).
 108  
      */
 109  
 
 110  138
     private final Map _methods = new HashMap();
 111  
 
 112  
     // May be null
 113  
 
 114  
     private final Log _log;
 115  
 
 116  
     /**
 117  
      * Alternate package private constructor used by the test suite, to bypass
 118  
      * the defense checks above.
 119  
      */
 120  
 
 121  
     EnhancementOperationImpl()
 122  1
     {
 123  1
         _log = null;
 124  1
     }
 125  
     
 126  
     public EnhancementOperationImpl(ClassResolver classResolver,
 127  
             IComponentSpecification specification, Class baseClass,
 128  
             ClassFactory classFactory, Log log)
 129  137
     {
 130  137
         Defense.notNull(classResolver, "classResolver");
 131  137
         Defense.notNull(specification, "specification");
 132  137
         Defense.notNull(baseClass, "baseClass");
 133  137
         Defense.notNull(classFactory, "classFactory");
 134  
 
 135  137
         _resolver = classResolver;
 136  137
         _specification = specification;
 137  137
         _baseClass = baseClass;
 138  
 
 139  137
         introspectBaseClass();
 140  
 
 141  137
         String name = newClassName();
 142  
 
 143  137
         _classFab = classFactory.newClass(name, _baseClass);
 144  137
         _log = log;
 145  137
     }
 146  
 
 147  
     public String toString()
 148  
     {
 149  0
         ToStringBuilder builder = new ToStringBuilder(this);
 150  
 
 151  0
         builder.append("baseClass", _baseClass.getName());
 152  0
         builder.append("claimedProperties", _claimedProperties);
 153  0
         builder.append("classFab", _classFab);
 154  
 
 155  0
         return builder.toString();
 156  
     }
 157  
 
 158  
     /**
 159  
      * We want to find the properties of the class, but in many cases, the class
 160  
      * is abstract. Some JDK's (Sun) will include public methods from interfaces
 161  
      * implemented by the class in the public declared methods for the class
 162  
      * (which is used by the Introspector). Eclipse's built-in compiler does not
 163  
      * appear to (this may have to do with compiler options I've been unable to
 164  
      * track down). The solution is to augment the information provided directly
 165  
      * by the Introspector with additional information compiled by Introspecting
 166  
      * the interfaces directly or indirectly implemented by the class.
 167  
      */
 168  
     private void introspectBaseClass()
 169  
     {
 170  
         try
 171  
         {
 172  137
             synchronized(HiveMind.INTROSPECTOR_MUTEX)
 173  
             {
 174  137
                 addPropertiesDeclaredInBaseClass();
 175  137
             }
 176  
         }
 177  0
         catch (IntrospectionException ex)
 178  
         {
 179  0
             throw new ApplicationRuntimeException(EnhanceMessages.unabelToIntrospectClass(_baseClass, ex), ex);
 180  137
         }
 181  
 
 182  137
     }
 183  
 
 184  
     private void addPropertiesDeclaredInBaseClass()
 185  
         throws IntrospectionException
 186  
     {
 187  137
         Class introspectClass = _baseClass;
 188  
 
 189  137
         addPropertiesDeclaredInClass(introspectClass);
 190  
 
 191  137
         List interfaceQueue = new ArrayList();
 192  
 
 193  807
         while(introspectClass != null)
 194  
         {
 195  670
             addInterfacesToQueue(introspectClass, interfaceQueue);
 196  
 
 197  670
             introspectClass = introspectClass.getSuperclass();
 198  
         }
 199  
 
 200  2305
         while(!interfaceQueue.isEmpty())
 201  
         {
 202  2168
             Class interfaceClass = (Class) interfaceQueue.remove(0);
 203  
 
 204  2168
             addPropertiesDeclaredInClass(interfaceClass);
 205  
 
 206  2168
             addInterfacesToQueue(interfaceClass, interfaceQueue);
 207  2168
         }
 208  137
     }
 209  
 
 210  
     private void addInterfacesToQueue(Class introspectClass, List interfaceQueue)
 211  
     {
 212  2838
         Class[] interfaces = introspectClass.getInterfaces();
 213  
 
 214  5006
         for(int i = 0; i < interfaces.length; i++)
 215  2168
             interfaceQueue.add(interfaces[i]);
 216  2838
     }
 217  
 
 218  
     private void addPropertiesDeclaredInClass(Class introspectClass)
 219  
         throws IntrospectionException
 220  
     {
 221  
         
 222  2305
         BeanInfo bi = Introspector.getBeanInfo(introspectClass);
 223  
 
 224  2305
         PropertyDescriptor[] pds = bi.getPropertyDescriptors();
 225  
 
 226  14477
         for(int i = 0; i < pds.length; i++)
 227  
         {
 228  12172
             PropertyDescriptor pd = pds[i];
 229  
 
 230  12172
             String name = pd.getName();
 231  
 
 232  12172
             if (!_properties.containsKey(name)) 
 233  4894
                 _properties.put(name, pd);
 234  
         }
 235  2305
     }
 236  
 
 237  
     public void claimProperty(String propertyName)
 238  
     {
 239  1274
         Defense.notNull(propertyName, "propertyName");
 240  
 
 241  1274
         if (_claimedProperties.contains(propertyName))
 242  2
             throw new ApplicationRuntimeException(EnhanceMessages.claimedProperty(propertyName));
 243  
 
 244  1272
         _claimedProperties.add(propertyName);
 245  1272
     }
 246  
     
 247  
     /** 
 248  
      * {@inheritDoc}
 249  
      */
 250  
     public boolean canClaimAsReadOnlyProperty(String propertyName)
 251  
     {
 252  2
         if(_claimedProperties.contains(propertyName)) 
 253  1
             return false;
 254  
         
 255  1
         PropertyDescriptor pd = getPropertyDescriptor(propertyName);
 256  
         
 257  1
         if (pd == null) 
 258  1
             return false;
 259  
         
 260  0
         return pd.getWriteMethod() == null ? true : false;
 261  
     }
 262  
 
 263  
     public void claimReadonlyProperty(String propertyName)
 264  
     {
 265  134
         claimProperty(propertyName);
 266  
         
 267  134
         PropertyDescriptor pd = getPropertyDescriptor(propertyName);
 268  
         
 269  134
         if (pd != null && pd.getWriteMethod() != null)
 270  1
             throw new ApplicationRuntimeException(EnhanceMessages.readonlyProperty(propertyName, pd.getWriteMethod()));
 271  133
     }
 272  
 
 273  
     public void addField(String name, Class type)
 274  
     {
 275  2109
         _classFab.addField(name, type);
 276  2109
     }
 277  
 
 278  
     public String addInjectedField(String fieldName, Class fieldType, Object value)
 279  
     {
 280  134
         Defense.notNull(fieldName, "fieldName");
 281  134
         Defense.notNull(fieldType, "fieldType");
 282  134
         Defense.notNull(value, "value");
 283  
 
 284  134
         String existing = (String) _finalFields.get(value);
 285  
 
 286  
         // See if this object has been previously added.
 287  
 
 288  134
         if (existing != null) 
 289  0
             return existing;
 290  
 
 291  
         // TODO: Should be ensure that the name is unique?
 292  
 
 293  
         // Make sure that the field has a unique name (at least, among anything
 294  
         // added
 295  
         // via addFinalField().
 296  
 
 297  134
         String uniqueName = _idAllocator.allocateId(fieldName);
 298  
 
 299  
         // ClassFab doesn't have an option for saying the field should be final,
 300  
         // just private.
 301  
         // Doesn't make a huge difference.
 302  
 
 303  134
         _classFab.addField(uniqueName, fieldType);
 304  
 
 305  134
         int parameterIndex = addConstructorParameter(fieldType, value);
 306  
 
 307  134
         constructorBuilder().addln("{0} = ${1};", uniqueName, Integer.toString(parameterIndex));
 308  
 
 309  
         // Remember the mapping from the value to the field name.
 310  
 
 311  134
         _finalFields.put(value, uniqueName);
 312  
 
 313  134
         return uniqueName;
 314  
     }
 315  
 
 316  
     public Class convertTypeName(String type)
 317  
     {
 318  6
         Defense.notNull(type, "type");
 319  
 
 320  6
         Class result = _javaClassMapping.getType(type);
 321  
 
 322  6
         if (result == null)
 323  
         {
 324  4
             result = _resolver.findClass(type);
 325  
 
 326  3
             _javaClassMapping.recordType(type, result);
 327  
         }
 328  
 
 329  5
         return result;
 330  
     }
 331  
 
 332  
     public Class getPropertyType(String name)
 333  
     {
 334  1138
         Defense.notNull(name, "name");
 335  
 
 336  1138
         PropertyDescriptor pd = getPropertyDescriptor(name);
 337  
 
 338  1138
         return pd == null ? null : pd.getPropertyType();
 339  
     }
 340  
 
 341  
     public void validateProperty(String name, Class expectedType)
 342  
     {
 343  3
         Defense.notNull(name, "name");
 344  3
         Defense.notNull(expectedType, "expectedType");
 345  
 
 346  3
         PropertyDescriptor pd = getPropertyDescriptor(name);
 347  
 
 348  3
         if (pd == null) 
 349  1
             return;
 350  
 
 351  2
         Class propertyType = pd.getPropertyType();
 352  
 
 353  2
         if (propertyType.equals(expectedType)) 
 354  1
             return;
 355  
 
 356  1
         throw new ApplicationRuntimeException(EnhanceMessages.propertyTypeMismatch(_baseClass, name, propertyType, expectedType));
 357  
     }
 358  
     
 359  
     PropertyDescriptor getPropertyDescriptor(String name)
 360  
     {
 361  2524
         return (PropertyDescriptor) _properties.get(name);
 362  
     }
 363  
 
 364  
     public String getAccessorMethodName(String propertyName)
 365  
     {
 366  1248
         Defense.notNull(propertyName, "propertyName");
 367  
 
 368  1248
         PropertyDescriptor pd = getPropertyDescriptor(propertyName);
 369  
 
 370  1248
         if (pd != null && pd.getReadMethod() != null)
 371  1186
             return pd.getReadMethod().getName();
 372  
 
 373  62
         return EnhanceUtils.createAccessorMethodName(propertyName);
 374  
     }
 375  
 
 376  
     public void addMethod(int modifier, MethodSignature sig, String methodBody, Location location)
 377  
     {
 378  2402
         Defense.notNull(sig, "sig");
 379  2402
         Defense.notNull(methodBody, "methodBody");
 380  2402
         Defense.notNull(location, "location");
 381  
 
 382  2402
         Location existing = (Location) _methods.get(sig);
 383  2402
         if (existing != null)
 384  1
             throw new ApplicationRuntimeException(EnhanceMessages.methodConflict(sig, existing), location, null);
 385  
 
 386  2401
         _methods.put(sig, location);
 387  
 
 388  2401
         _classFab.addMethod(modifier, sig, methodBody);
 389  2401
     }
 390  
 
 391  
     public Class getBaseClass()
 392  
     {
 393  1
         return _baseClass;
 394  
     }
 395  
 
 396  
     public String getClassReference(Class clazz)
 397  
     {
 398  3
         Defense.notNull(clazz, "clazz");
 399  
 
 400  3
         String result = (String) _finalFields.get(clazz);
 401  
 
 402  3
         if (result == null) 
 403  2
             result = addClassReference(clazz);
 404  
 
 405  3
         return result;
 406  
     }
 407  
 
 408  
     private String addClassReference(Class clazz)
 409  
     {
 410  2
         StringBuffer buffer = new StringBuffer("_class$");
 411  
 
 412  2
         Class c = clazz;
 413  
 
 414  3
         while(c.isArray())
 415  
         {
 416  1
             buffer.append("array$");
 417  1
             c = c.getComponentType();
 418  
         }
 419  
 
 420  2
         buffer.append(c.getName().replace('.', '$'));
 421  
 
 422  2
         String fieldName = buffer.toString();
 423  
 
 424  4
         return addInjectedField(fieldName, Class.class, clazz);
 425  
     }
 426  
 
 427  
     /**
 428  
      * Adds a new constructor parameter, returning the new count. This is
 429  
      * convienient, because the first element added is accessed as $1, etc.
 430  
      */
 431  
 
 432  
     private int addConstructorParameter(Class type, Object value)
 433  
     {
 434  134
         _constructorTypes.add(type);
 435  134
         _constructorArguments.add(value);
 436  
 
 437  134
         return _constructorArguments.size();
 438  
     }
 439  
 
 440  
     private BodyBuilder constructorBuilder()
 441  
     {
 442  134
         if (_constructorBuilder == null)
 443  
         {
 444  113
             _constructorBuilder = new BodyBuilder();
 445  113
             _constructorBuilder.begin();
 446  
         }
 447  
 
 448  134
         return _constructorBuilder;
 449  
     }
 450  
 
 451  
     /**
 452  
      * Returns an object that can be used to construct instances of the enhanced
 453  
      * component subclass. This should only be called once.
 454  
      */
 455  
 
 456  
     public ComponentConstructor getConstructor()
 457  
     {
 458  
         try
 459  
         {
 460  116
             finalizeEnhancedClass();
 461  
 
 462  116
             Constructor c = findConstructor();
 463  
 
 464  115
             Object[] params = _constructorArguments.toArray();
 465  
 
 466  115
             return new ComponentConstructorImpl(c, params,
 467  
                     _classFab.toString(), _specification.getLocation());
 468  
         }
 469  1
         catch (Throwable t)
 470  
         {
 471  1
             throw new ApplicationRuntimeException(EnhanceMessages.classEnhancementFailure(_baseClass, t), _classFab, null, t);
 472  
         }
 473  
     }
 474  
 
 475  
     void finalizeEnhancedClass()
 476  
     {
 477  117
         finalizeIncompleteMethods();
 478  
 
 479  117
         if (_constructorBuilder != null)
 480  
         {
 481  112
             _constructorBuilder.end();
 482  
             
 483  112
             Class[] types = (Class[]) _constructorTypes.toArray(new Class[_constructorTypes.size()]);
 484  
             
 485  112
             _classFab.addConstructor(types, null, _constructorBuilder.toString());
 486  
         }
 487  
 
 488  117
         if (_log != null && _log.isDebugEnabled()) 
 489  0
             _log.debug("Creating class:\n\n" + _classFab);
 490  117
     }
 491  
 
 492  
     private void finalizeIncompleteMethods()
 493  
     {
 494  117
         Iterator i = _incompleteMethods.entrySet().iterator();
 495  299
         while(i.hasNext())
 496  
         {
 497  182
             Map.Entry e = (Map.Entry) i.next();
 498  182
             MethodSignature sig = (MethodSignature) e.getKey();
 499  182
             BodyBuilder builder = (BodyBuilder) e.getValue();
 500  
 
 501  
             // Each BodyBuilder is created and given a begin(), this is
 502  
             // the matching end()
 503  
 
 504  182
             builder.end();
 505  
 
 506  182
             _classFab.addMethod(Modifier.PUBLIC, sig, builder.toString());
 507  182
         }
 508  117
     }
 509  
 
 510  
     private Constructor findConstructor()
 511  
     {
 512  116
         Class componentClass = _classFab.createClass();
 513  
         
 514  
         // The fabricated base class always has exactly one constructor
 515  
 
 516  115
         return componentClass.getConstructors()[0];
 517  
     }
 518  
 
 519  
     private String newClassName()
 520  
     {
 521  137
         String baseName = _baseClass.getName();
 522  137
         int dotx = baseName.lastIndexOf('.');
 523  
 
 524  137
         return "$" + baseName.substring(dotx + 1) + "_" + _uid++;
 525  
     }
 526  
 
 527  
     public void extendMethodImplementation(Class interfaceClass, MethodSignature methodSignature, String code)
 528  
     {
 529  1915
         addInterfaceIfNeeded(interfaceClass);
 530  
 
 531  1915
         BodyBuilder builder = (BodyBuilder) _incompleteMethods.get(methodSignature);
 532  
 
 533  1915
         if (builder == null)
 534  
         {
 535  184
             builder = createIncompleteMethod(methodSignature);
 536  
 
 537  184
             _incompleteMethods.put(methodSignature, builder);
 538  
         }
 539  
 
 540  1915
         builder.addln(code);
 541  1915
     }
 542  
 
 543  
     private void addInterfaceIfNeeded(Class interfaceClass)
 544  
     {
 545  1915
         if (implementsInterface(interfaceClass)) 
 546  1816
             return;
 547  
 
 548  99
         _classFab.addInterface(interfaceClass);
 549  99
         _addedInterfaces.add(interfaceClass);
 550  99
     }
 551  
 
 552  
     public boolean implementsInterface(Class interfaceClass)
 553  
     {
 554  1919
         if (interfaceClass.isAssignableFrom(_baseClass)) 
 555  950
             return true;
 556  
 
 557  969
         Iterator i = _addedInterfaces.iterator();
 558  978
         while(i.hasNext())
 559  
         {
 560  877
             Class addedInterface = (Class) i.next();
 561  
 
 562  877
             if (interfaceClass.isAssignableFrom(addedInterface)) 
 563  868
                 return true;
 564  9
         }
 565  
 
 566  101
         return false;
 567  
     }
 568  
 
 569  
     private BodyBuilder createIncompleteMethod(MethodSignature sig)
 570  
     {
 571  184
         BodyBuilder result = new BodyBuilder();
 572  
 
 573  
         // Matched inside finalizeIncompleteMethods()
 574  
 
 575  184
         result.begin();
 576  
 
 577  184
         if (existingImplementation(sig))
 578  84
             result.addln("super.{0}($$);", sig.getName());
 579  
 
 580  184
         return result;
 581  
     }
 582  
 
 583  
     /**
 584  
      * Returns true if the base class implements the provided method as either a
 585  
      * public or a protected method.
 586  
      */
 587  
 
 588  
     private boolean existingImplementation(MethodSignature sig)
 589  
     {
 590  184
         Method m = findMethod(sig);
 591  
 
 592  184
         return m != null && !Modifier.isAbstract(m.getModifiers());
 593  
     }
 594  
 
 595  
     /**
 596  
      * Finds a public or protected method in the base class.
 597  
      */
 598  
     private Method findMethod(MethodSignature sig)
 599  
     {
 600  
         // Finding a public method is easy:
 601  
 
 602  
         try
 603  
         {
 604  184
             return _baseClass.getMethod(sig.getName(), sig.getParameterTypes());
 605  
 
 606  
         }
 607  100
         catch (NoSuchMethodException ex)
 608  
         {
 609  
             // Good; no super-implementation to invoke.
 610  
         }
 611  
 
 612  100
         Class c = _baseClass;
 613  
 
 614  474
         while(c != Object.class)
 615  
         {
 616  
             try
 617  
             {
 618  375
                 return c.getDeclaredMethod(sig.getName(), sig
 619  
                         .getParameterTypes());
 620  
             }
 621  374
             catch (NoSuchMethodException ex)
 622  
             {
 623  
                 // Ok, continue loop up to next base class.
 624  
             }
 625  
 
 626  374
             c = c.getSuperclass();
 627  
         }
 628  
 
 629  99
         return null;
 630  
     }
 631  
 
 632  
     public List findUnclaimedAbstractProperties()
 633  
     {
 634  93
         List result = new ArrayList();
 635  
 
 636  93
         Iterator i = _properties.values().iterator();
 637  
 
 638  3532
         while(i.hasNext())
 639  
         {
 640  3439
             PropertyDescriptor pd = (PropertyDescriptor) i.next();
 641  
 
 642  3439
             String name = pd.getName();
 643  
 
 644  3439
             if (_claimedProperties.contains(name)) 
 645  249
                 continue;
 646  
 
 647  3190
             if (isAbstractProperty(pd)) 
 648  957
                 result.add(name);
 649  3190
         }
 650  
 
 651  93
         return result;
 652  
     }
 653  
 
 654  
     /**
 655  
      * A property is abstract if either its read method or it write method is
 656  
      * abstract. We could do some additional checking to ensure that both are
 657  
      * abstract if either is. Note that in many cases, there will only be one
 658  
      * accessor (a reader or a writer).
 659  
      */
 660  
     private boolean isAbstractProperty(PropertyDescriptor pd)
 661  
     {
 662  3190
         return isExistingAbstractMethod(pd.getReadMethod())
 663  
                 || isExistingAbstractMethod(pd.getWriteMethod());
 664  
     }
 665  
 
 666  
     private boolean isExistingAbstractMethod(Method m)
 667  
     {
 668  5462
         return m != null && Modifier.isAbstract(m.getModifiers());
 669  
     }
 670  
 }