[gant-scm] [10446] gant/trunk/src/main/groovy/org/codehaus/gant: Move the SuppressWarnings annotations to statement where it happens rather than methods.

View: New views
1 Messages — Rating Filter:   Alert me  

[gant-scm] [10446] gant/trunk/src/main/groovy/org/codehaus/gant: Move the SuppressWarnings annotations to statement where it happens rather than methods.

by russel-9 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
[10446] gant/trunk/src/main/groovy/org/codehaus/gant: Move the SuppressWarnings annotations to statement where it happens rather than methods.
Revision
10446
Author
russel
Date
2009-11-09 11:42:07 -0600 (Mon, 09 Nov 2009)

Log Message

Move the SuppressWarnings annotations to statement where it happens rather than methods.

Modified Paths

Diff

Modified: gant/trunk/src/main/groovy/org/codehaus/gant/GantBuilder.java (10445 => 10446)

--- gant/trunk/src/main/groovy/org/codehaus/gant/GantBuilder.java	2009-11-09 17:41:29 UTC (rev 10445)
+++ gant/trunk/src/main/groovy/org/codehaus/gant/GantBuilder.java	2009-11-09 17:42:07 UTC (rev 10446)
@@ -60,7 +60,6 @@
    *  @param arguments The parameters to the method call.
    *  @return The value returned by the method call or null if no value is returned.
    */
-  @SuppressWarnings ( "unchecked" )
   @Override public Object invokeMethod ( final String name , final Object arguments ) {
     if ( GantState.dryRun ) {
       if ( GantState.verbosity > GantState.SILENT ) {
@@ -70,9 +69,13 @@
         sb.append ( "         ".substring ( 0 , padding ) + '[' + name + "] ") ;
         final Object[] args = (Object[]) arguments ;
         if ( args[0] instanceof Map ) {
-          // NB IntelliJ IDEA complains that (Map) is not a proper cast but using the cast (Map<?,?>) here
+          //
+          // IntelliJ IDEA complains that (Map) is not a proper cast but using the cast (Map<?,?>) here
           // causes a type check error.
-          final Iterator<Map.Entry<?,?>> i = ( (Map) args[0] ).entrySet ( ).iterator ( ) ; // Unchecked conversion here.
+          //
+          //  TODO : Fix this.
+          //
+          @SuppressWarnings ( "unchecked" ) final Iterator<Map.Entry<?,?>> i = ( (Map) args[0] ).entrySet ( ).iterator ( ) ;
           while ( i.hasNext ( ) ) {
             final Map.Entry<?,?> e = i.next ( ) ;
             sb.append ( e.getKey ( ) + " : '" + e.getValue ( ) + '\'' ) ;
@@ -94,9 +97,8 @@
    *
    *  @return The <code>BuildLogger</code>.
    */
-  @SuppressWarnings ( "unchecked" )
   public BuildLogger getLogger ( ) {
-    final List<? extends BuildListener> listeners = getProject ( ).getBuildListeners ( ) ; // Unchecked conversion here.
+    @SuppressWarnings ( "unchecked" ) final List<? extends BuildListener> listeners = getProject ( ).getBuildListeners ( ) ;
     assert listeners.size ( ) > 0 ;
     return (BuildLogger) listeners.get ( 0 ) ;
   }

Modified: gant/trunk/src/main/groovy/org/codehaus/gant/ant/Gant.java (10445 => 10446)

--- gant/trunk/src/main/groovy/org/codehaus/gant/ant/Gant.java	2009-11-09 17:41:29 UTC (rev 10445)
+++ gant/trunk/src/main/groovy/org/codehaus/gant/ant/Gant.java	2009-11-09 17:42:07 UTC (rev 10446)
@@ -202,8 +202,7 @@
    */
   //  Russel Winder rehacked the code provided by Eric Van Dewoestine.
   private void addAlmostAll ( final Project newProject , final Project oldProject ) {
-    @SuppressWarnings ( "unchecked" )
-     final Hashtable<String,String> properties = oldProject.getProperties ( ) ;
+    @SuppressWarnings ( "unchecked" ) final Hashtable<String,String> properties = oldProject.getProperties ( ) ;
     final Enumeration<String> e = properties.keys ( ) ;
     while ( e.hasMoreElements ( ) ) {
       final String key = e.nextElement ( ) ;

Modified: gant/trunk/src/test/groovy/org/codehaus/gant/ant/tests/Gant_Test.java (10445 => 10446)

--- gant/trunk/src/test/groovy/org/codehaus/gant/ant/tests/Gant_Test.java	2009-11-09 17:41:29 UTC (rev 10445)
+++ gant/trunk/src/test/groovy/org/codehaus/gant/ant/tests/Gant_Test.java	2009-11-09 17:42:07 UTC (rev 10446)
@@ -387,8 +387,7 @@
 
   public void testInheritAll ( ) {
     List<String> result = runAnt ( antFile.getPath ( ) , "gantTestInheritAll" , 0 , true ) ;
-    @SuppressWarnings("unchecked")
-     List<String> output = (List<String>) StringUtils.lineSplit ( result.get ( 0 ) ) ;
+    @SuppressWarnings("unchecked") List<String> output = StringUtils.lineSplit ( result.get ( 0 ) ) ;
     assertEquals ( "     [echo] ${gant.test.inheritAll}" , output.get ( 12 ) ) ;
     assertEquals ( "     [echo] ${gant.test.inheritAll}" , output.get ( 15 ) ) ;
     assertEquals ( "     [echo] gantInheritAllWorks" , output.get ( 18 ) ) ;


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email