Skip to content

Conversation

@twisti-dev
Copy link
Contributor

…anion object

Copilot AI review requested due to automatic review settings January 17, 2026 18:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request attempts to add delegation to the SurfHytaleApi companion object by making it implement the SurfHytaleApi interface through delegation to the surfHytaleApi top-level property.

Changes:

  • Modified the companion object declaration in SurfHytaleApi to implement SurfHytaleApi via delegation to surfHytaleApi

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


interface SurfHytaleApi : SurfCoreApi {
companion object {
companion object : SurfHytaleApi by surfHytaleApi {
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code introduces a circular dependency that will cause a runtime error. The companion object delegates to surfHytaleApi on line 7, but surfHytaleApi is defined on line 12 as SurfHytaleApi.instance, which in turn references instance on line 8. This creates a cycle where:

  1. Accessing SurfHytaleApi.companion tries to resolve the delegate surfHytaleApi
  2. surfHytaleApi getter calls SurfHytaleApi.instance
  3. SurfHytaleApi.instance is a property of the companion object being initialized

This will result in initialization errors or infinite recursion. The companion object should not delegate to the interface; instead, it should simply provide access to the instance, as seen in the other API implementations (SurfVelocityApi, SurfCoreApi). Remove the delegation pattern and keep the original companion object structure.

Suggested change
companion object : SurfHytaleApi by surfHytaleApi {
companion object {

Copilot uses AI. Check for mistakes.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6c81dc6453

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


interface SurfHytaleApi : SurfCoreApi {
companion object {
companion object : SurfHytaleApi by surfHytaleApi {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid delegating companion to instance before init

The companion object now delegates SurfHytaleApi to surfHytaleApi, but that getter returns SurfHytaleApi.instance, which is initialized after the delegate expression runs. During companion object construction the delegate is therefore resolved before instance is set, so it becomes null (or triggers an init-time error) and any call to a delegated SurfHytaleApi method on the companion will throw at runtime. This happens on first access to the companion object (class init) and breaks any code that uses the new static delegation.

Useful? React with 👍 / 👎.

@github-actions
Copy link

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateLegacyAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

@github-actions
Copy link

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateLegacyAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

1 similar comment
@github-actions
Copy link

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateLegacyAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants