Index: src/main/org/exolab/castor/persist/FieldMolder.java =================================================================== RCS file: /scm/castor/castor/src/main/org/exolab/castor/persist/FieldMolder.java,v retrieving revision 1.13 diff -u -r1.13 FieldMolder.java --- src/main/org/exolab/castor/persist/FieldMolder.java 30 May 2005 12:55:10 -0000 1.13 +++ src/main/org/exolab/castor/persist/FieldMolder.java 6 Jun 2005 07:52:35 -0000 @@ -790,6 +790,15 @@ throw new MappingException( "_field or _setMethod can't be created" ); } + if (_defaultReflectService._addMethod != null && _colClass != null) { + String methodName = METHOD_SET_PREFIX + capitalize(fieldMap.getName()); + _defaultReflectService._setMethod = findAccessor( javaClass, methodName, _colClass, false ); + } + + if (_defaultReflectService._addMethod != null && _defaultReflectService._setMethod == null && _colClass != null) { + throw new MappingException ("When specifying an add* method for field '" + fieldMap.getName() + "' of type '" + fieldType + "' for class '" + javaClass + "', you are required to declare a setter as well."); + } + ds.pairFieldClass( this, _fType ); } catch ( NullPointerException e ) { _log.fatal("Caught unexpected NullPointerException: ", e); Index: src/tests/jdo/TestColAdd.java =================================================================== RCS file: /scm/castor/castor/src/tests/jdo/TestColAdd.java,v retrieving revision 1.1 diff -u -r1.1 TestColAdd.java --- src/tests/jdo/TestColAdd.java 30 May 2005 12:53:33 -0000 1.1 +++ src/tests/jdo/TestColAdd.java 6 Jun 2005 07:52:42 -0000 @@ -52,6 +52,10 @@ return _item; } + public void setItem(ArrayList items) { + _item = items; + } + public void addItem( TestItem item ) { if ( _item == null ) _item = new ArrayList();