function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
cropzimcropzim 

Winter 13 break? APEX mySet.remove(null)

I just reran my regression scripts on Winter 13 and oops, existing APEX code no longer works.  Anyone else seeing this?

 

Specific scenario is this code:

Set<String> aSet = new Set<String> {null, 'abc','def'};
System.debug(LoggingLevel.INFO,'aSet before remove <abc>:' + aSet);
aSet.remove('abc');
System.debug(LoggingLevel.INFO,'aSet after remove <abc>:' + aSet);
aSet.remove(null);
System.debug(LoggingLevel.INFO,'aSet  after remove <null>:' + aSet);

First debug statement displays {null,'abc','def'} as expected

Second debug statement, after removing element 'abc' displays {null,'def'} as expected

 

BUT...

We never get to the tihrd debug statement because a runtime error is thrown on aSet.remove(null) - "Argument 1 may not be null"

 

This used to work in Summer 12.  I don't see anything in the release notes indicating this functionality has been changed

Best Answer chosen by Admin (Salesforce Developers)