@Override
 @SuppressWarnings("unchecked")
 // doPrivileged() returns the correct type
 public <T extends Servlet> T createServlet(Class<T> c) throws ServletException {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     try {
       return (T) invokeMethod(context, "createServlet", new Object[] {c});
     } catch (Throwable t) {
       handleThrowable(t);
       if (t instanceof ServletException) {
         throw (ServletException) t;
       }
       return null;
     }
   } else {
     return context.createServlet(c);
   }
 }