title: Converting java class to groovy: Groovy:No expression for the array constructor call
body: <p>For testing purposes I would like to try and use the below java class. But I need it to be ported to groovy.</p>
  
  <p>The java class:</p>
  
  <pre><code>public class HttpsTrustManager implements X509TrustManager {
      private static TrustManager[] trustManagers;
      private static final X509Certificate[] _AcceptedIssuers = new X509Certificate[]{};
  
      @Override
      public void checkClientTrusted(
              X509Certificate[] x509Certificates, String s)
              throws java.security.cert.CertificateException {
  
      }
  
      @Override
      public void checkServerTrusted(
              X509Certificate[] x509Certificates, String s)
              throws java.security.cert.CertificateException {
  
      }
  
      public boolean isClientTrusted(X509Certificate[] chain) {
          return true;
      }
  
      public boolean isServerTrusted(X509Certificate[] chain) {
          return true;
      }
  
      @Override
      public X509Certificate[] getAcceptedIssuers() {
          return _AcceptedIssuers;
      }
  
      public static void allowAllSSL() {
          HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
  
              @Override
              public boolean verify(String arg0, SSLSession arg1) {
                  return true;
              }
  
          });
  
          SSLContext context = null;
          if (trustManagers == null) {
              trustManagers = new TrustManager[]{new HttpsTrustManager()};
          }
  
          try {
              context = SSLContext.getInstance("TLS");
              context.init(null, trustManagers, new SecureRandom());
          } catch (NoSuchAlgorithmException | KeyManagementException e) {
              e.printStackTrace();
          }
  
          HttpsURLConnection.setDefaultSSLSocketFactory(context != null ? context.getSocketFactory() : null);
      }
  }
  </code></pre>
  
  <p>When I just move that to a .groovy file I get the following errors on this line:</p>
  
  <pre><code>private static final X509Certificate[] _AcceptedIssuers = new X509Certificate[]{};
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Groovy:No expression for the array constructor call at line:
  </code></pre>
  
  <p>And this line:</p>
  
  <pre><code>if (trustManagers == null) {
      trustManagers = new TrustManager[]{new HttpsTrustManager()}; 
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Groovy:No expression for the array constructor call at line:
  </code></pre>
  
  <p>This first line I have ported like this:</p>
  
  <pre><code>  private static final X509Certificate[] _AcceptedIssuers = [ new X509Certificate(){} ] as X509Certificate[]
  </code></pre>
  
  <p>Not 100% sure its correct though. But I still have an error on the second line:</p>
  
  <pre><code>    trustManagers = new TrustManager[]{new HttpsTrustManager()};
  </code></pre>
  
  <p>Any ideas?</p>