Class MixedLanguageNotSupportedException

All Implemented Interfaces:
CopilotErrorCode, Serializable

public class MixedLanguageNotSupportedException extends CopilotException implements CopilotErrorCode
Thrown when a single operation would have to rewrite files in more than one language at once.

The common cases are safe and stay supported, because an operation resolves to the files holding the selected component's own create and attach locations: a Kotlin view under a Java @Layout, or a Java custom component used inside a Kotlin view. Only a component created in one language and attached in another is refused, since operations like move, wrap and extract rewrite both files and would need a coordinated two-language transaction.

The message names the files, because "created here, attached there" is the part the user needs in order to understand the refusal.

See Also:
  • Field Details

  • Constructor Details

    • MixedLanguageNotSupportedException

      public MixedLanguageNotSupportedException(String operation, Collection<File> files)
      Parameters:
      operation - the operation that was declined, typically the wire command name
      files - the source files involved, spanning more than one language
  • Method Details

    • getOperation

      public String getOperation()
      Returns:
      the declined operation
    • getFiles

      public Set<File> getFiles()
      Returns:
      the source files involved
    • getErrorCode

      public String getErrorCode()
      Description copied from interface: CopilotErrorCode
      A stable, kebab-case identifier for this kind of failure. Sent to the frontend as error.code.
      Specified by:
      getErrorCode in interface CopilotErrorCode
      Returns:
      the error code
    • getErrorDetails

      public Map<String,String> getErrorDetails()
      Description copied from interface: CopilotErrorCode
      Extra machine-readable context, merged into the error object sent to the frontend. Keys must not collide with the error object's own fields (message, code, and the exception keys).
      Specified by:
      getErrorDetails in interface CopilotErrorCode
      Returns:
      the details, empty by default