Index: src/main/groovy/lang/MetaClassImpl.java =================================================================== --- src/main/groovy/lang/MetaClassImpl.java (revision 19149) +++ src/main/groovy/lang/MetaClassImpl.java (working copy) @@ -2280,6 +2280,11 @@ return; } + if (name == null && !isStatic && this.isMap) { + ((Map) object).put(name, newValue); + return; + } + //---------------------------------------------------------------------- // Unwrap wrapped values fo now - the new MOP will handle them properly //---------------------------------------------------------------------- Index: src/test/groovy/bugs/Groovy4029Bug.groovy =================================================================== --- src/test/groovy/bugs/Groovy4029Bug.groovy (revision 0) +++ src/test/groovy/bugs/Groovy4029Bug.groovy (revision 0) @@ -0,0 +1,9 @@ +package groovy.bugs + +class Groovy4029Bug extends GroovyTestCase { + void testAddNullKeyEntryInMapUsingSubscriptNotation() { + Map m = [:] + m[null] = null + assert m.size() == 1 + } +}