static Field getDeclaredField(final Class<?> c, final String name)
      throws NoSuchFieldException
   {
      if (System.getSecurityManager() == null)
         return c.getDeclaredField(name);

      Field result = AccessController.doPrivileged(new PrivilegedAction<Field>()
      {
         public Field run()
         {
            try
            {
               return c.getDeclaredField(name);
            }
            catch (NoSuchFieldException e)
            {
               return null;
            }
         }
      });

      if (result != null)
         return result;

      throw new NoSuchFieldException();
   }
static Field getDeclaredField ( final Class < ? > c , final String name ) throws NoSuchFieldException { if ( System . getSecurityManager ( ) == null ) return c . getDeclaredField ( name ) ; Field result = AccessController . doPrivileged ( new PrivilegedAction < Field > ( ) { public Field run ( ) { try { return c . getDeclaredField ( name ) ; } catch ( NoSuchFieldException e ) { return null ; } } } ) ; if ( result != null ) return result ; throw new NoSuchFieldException ( ) ; }
Get the declared field
@param c The class
@param name The name
@return The field
@exception NoSuchFieldException If a matching field is not found.