Understanding internally generated code

Many configuration resources are defined in XML. To improve runtime performance, Guidewire Studio generates Java or Gosu code that implements the behavior defined by these XML resources. When debugging your application, the Studio debugger may step you into this internal code.

In Studio, the generated code is stored in the configuration > generated folder. You will typically not need to browse this code on your own. Do not directly modify this generated code, as any changes will be overwritten when Studio generates it again.

Generate code for configuration resources

About this task

Guidewire Studio generates internal Java or Gosu code automatically for all necessary configuration resources whenever they are modified. If code generation has never been run before, Studio runs it automatically the first time that you run gwb studio.

  • To generate the internal code manually, select one of the items in the Codegen menu.

Enable or disable code generation

About this task

If you are making changes that affect many configuration resources, then you may want to defer code generation in Guidewire Studio until your changes are complete. For example, if you modify an XSD file, then Studio would regenerate all types defined in that XSD file, and also any classes that use the modified types. In this case, you can disable code generation while you make the changes, and then enable it again when you are finished.

While code generation is disabled, Studio keeps a list of all changes that you make to configuration resources, but does not generate internal code for them. When you enable code generation again, Studio prompts you to run code generation for the resources in the list. If you do not choose to immediately run code generation for the changes, then you will need to rebuild the project later.

If you exit Studio while code generation is disabled, then Studio discards the list of changed resources, and you will need to rebuild the project later.

Code generation in Guidewire Studio is enabled by default.

Procedure

  1. In Guidewire Studio, click File > Settings.
  2. In the Settings dialog, in the navigation list, expand Guidewire Studio, and then click Project Settings.
  3. Do one of the following:
    • To disable code generation, clear the Enable Automatic Code Generation check box.
    • To enable code generation, set the Enable Automatic Code Generation check box.

Change PCF code generation error behavior

About this task

During a product upgrade, the configuration will contain a large number of errors that prevent the application from building successfully. Many of these errors are likely to be in the code generation of PCF files. To help you successfully build the application as quickly as possible, you can instruct Guidewire Studio to treat PCF errors as warnings instead. Warnings during a build do not cause the build to fail, and so you can focus on fixing other configuration files and producing a build that Studio considers successful.

Once you have a successful build, you can then run Build > Make Project to build only changed resources rather than the entire project.

Procedure

  1. In Guidewire Studio, click File > Settings.
  2. In the Settings dialog, in the navigation list, expand Build, Execution, Deployment, then expand Compiler, and then click Gosu Compiler.
  3. To treat PCF errors as warnings that do not cause a build to fail, set Treat PCF code generation errors as warnings.

Set compilation behavior after PCF code generation

Set an option to compile PCF files after code generation.

Procedure

  1. In Guidewire Studio, click File > Settings.
  2. In the Settings dialog, in the navigation list, click Guidewire Studio.
  3. To set the PCF files to compile after completing code generation, set the Compile after PCF Codegen check box.