Re: [Codenarc-developer] ExplicitHashMapInstantiation - copy of Map
Brought to you by:
chrismair
From: Hamlet D. <ham...@ca...> - 2011-01-17 06:33:39
|
> For ExplicitHashMapInstantiation , should there be a violation if you > pass in a Map (or any variable) to the constructor of HashMap? I'm > thinking not. Is there a better, idiomatic way to make a copy of a > Map? Hmmm. You are right. That sucks. I guess we should limit the rule to look for only parameterless instantiations. -- Hamlet D'Arcy ham...@ca... ----- Original Message ----- > Hamlet, > > For ExplicitHashMapInstantiation , should there be a violation if you > pass in a Map (or any variable) to the constructor of HashMap? I'm > thinking not. Is there a better, idiomatic way to make a copy of a > Map? > > > > Rule Name > Priority > Line # > Source Line / Message > ExplicitHashMapInstantiation > 4 > 24 [SRC] def copyOfMap = new HashMap(map) > > > def myMethod(Map map) { > def copyOfMap = new HashMap(map) > // ... > } > > > ------------------------------------------------------------------------------ > Protect Your Site and Customers from Malware Attacks > Learn about various malware tactics and how to avoid them. Understand > malware threats, the impact they can have on your business, and how > you > can protect your company and customers by using code signing. > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > Codenarc-developer mailing list > Cod...@li... > https://lists.sourceforge.net/lists/listinfo/codenarc-developer |