<commit_before>/* DO NOT EDIT: File is auto-generated */
package <%= data_module.gwt.gin_package %>;

<%= description_javadoc_for(data_module, "") %>@javax.annotation.Generated( "Domgen" )
@SuppressWarnings( { "UnusedDeclaration", "JavaDoc" } )
public class <%= data_module.gwt.gin_module_name %>
  extends com.google.gwt.inject.client.AbstractGinModule
{
  private static com.google.gwt.user.client.rpc.XsrfToken _xsrfToken;

  private static com.google.gwt.user.client.rpc.XsrfToken getXsrfToken()
  {
    if( null == _xsrfToken )
    {
      throw new IllegalStateException( "Attempting to construct service requiring XsrfToken without specifying toke." );
    }
    return _xsrfToken;
  }

  public static void setXsrfToken( final com.google.gwt.user.client.rpc.XsrfToken xsrfToken )
  {
    _xsrfToken = xsrfToken;
  }

  @Override
  protected void configure()
  {
    if( !com.google.gwt.core.client.GWT.getModuleName().equals( "<%= data_module.gwt.module_name %>" ) )
    {
      throw new IllegalStateException( "Actual GWT module name '" + com.google.gwt.core.client.GWT.getModuleName() + "' does not match module name '<%= data_module.gwt.module_name %>' used during compilation." );
    }
  }

<%
   data_module.services.each do |service|
%>
  @com.google.inject.Provides
  @javax.inject.Singleton
  public <%= service.gwt.qualified_async_service_name %> get<%= service.name %>()
  {
    final <%= service.gwt.qualified_async_service_name %> service = com.google.gwt.core.client.GWT.create( <%= service.gwt.qualified_service_name %>.class );
<% if service.gwt.xsrf_protected? %>
    ( (com.google.gwt.user.client.rpc.HasRpcToken) service ).setRpcToken( getXsrfToken() );
<% end %>
    return service;
  }
<%
  end
%>}
<commit_msg>Refactor the way the way the gin module is initialized so that it can check the module name at the same time as receiving the xsrf token<commit_after>/* DO NOT EDIT: File is auto-generated */
package <%= data_module.gwt.gin_package %>;

<%= description_javadoc_for(data_module, "") %>@javax.annotation.Generated( "Domgen" )
@SuppressWarnings( { "UnusedDeclaration", "JavaDoc" } )
public class <%= data_module.gwt.gin_module_name %>
  extends com.google.gwt.inject.client.AbstractGinModule
{
  private static com.google.gwt.user.client.rpc.XsrfToken c_xsrfToken;
  private static boolean c_initialized;

  private static com.google.gwt.user.client.rpc.XsrfToken getXsrfToken()
  {
    if( null == c_xsrfToken )
    {
      throw new IllegalStateException( "Attempting to construct service requiring XsrfToken without specifying toke." );
    }
    return c_xsrfToken;
  }

  public static void initialize( final String moduleName, final com.google.gwt.user.client.rpc.XsrfToken xsrfToken )
  {
    initialize( moduleName );
    c_xsrfToken = xsrfToken;
  }

  public static void initialize( final String moduleName )
  {
    if( !c_initialized && !moduleName.equals( "<%= data_module.gwt.module_name %>" ) )
    {
      throw new IllegalStateException( "Actual GWT module name '" + com.google.gwt.core.client.GWT.getModuleName() + "' does not match module name '<%= data_module.gwt.module_name %>' used during compilation." );
    }
    c_initialized = true;
  }

  @Override
  protected void configure()
  {
  }

<%
   data_module.services.each do |service|
%>
  @com.google.inject.Provides
  @javax.inject.Singleton
  public <%= service.gwt.qualified_async_service_name %> get<%= service.name %>()
  {
    if( !c_initialized ) throw new IllegalStateException();
    final <%= service.gwt.qualified_async_service_name %> service = com.google.gwt.core.client.GWT.create( <%= service.gwt.qualified_service_name %>.class );
<% if service.gwt.xsrf_protected? %>
    ( (com.google.gwt.user.client.rpc.HasRpcToken) service ).setRpcToken( getXsrfToken() );
<% end %>
    return service;
  }
<%
  end
%>}

{'fraction_non_alphanumeric': 0.13236060448150078, 'fraction_numerical': 0.0, 'mean_word_length': 4.071334214002642, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7543877', 'n_tokens_mistral': 1330, 'n_tokens_neox': 1277, 'n_words': 256}