Skip to content

Conversation

@rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Nov 26, 2025

When jsii is used to emit a type name "Object", the definition of the equals() method that jsii-pacmak generates changes meaning:

// This is meant to reference the built-in Object class
@Override
public final boolean equals(final Object o) {
}

// But with a local "Object" class present, this now references
// the local class.

We then get the errors:

error: method does not override or implement a method from a supertype
error: incomparable types: Jsii$Proxy and Object
...

And a bunch more.

Instead, emit the equals() method with a fully qualified reference to java.lang.Object so the aliasing can't happen.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

When jsii is used to emit a type name `"Object"`, the definition of the
`equals()` method that `jsii-pacmak` generates changes meaning:

```java
// This is meant to reference the built-in Object class
@OverRide
public final boolean equals(final Object o) {
}

// But with a local "Object" class present, this now references
// the local class.
```

We then get the errors:

```
error: method does not override or implement a method from a supertype
error: incomparable types: Jsii$Proxy and Object
...
```

And a bunch more.

Instead, emit the `equals()` method with a fully qualified reference
to `java.lang.Object` so the aliasing can't happen.
@rix0rrr rix0rrr requested a review from a team November 26, 2025 11:06
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Nov 26, 2025
@mergify
Copy link
Contributor

mergify bot commented Nov 26, 2025

Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it!

@mergify mergify bot added the pr/ready-to-merge This PR is ready to be merged. label Nov 26, 2025
@mergify
Copy link
Contributor

mergify bot commented Nov 26, 2025

Merge Queue Status Beta

✅ The pull request has been merged

This pull request spent 6 seconds in the queue, with no time waiting for CI.
The checks were run in-place.

Required conditions to merge
  • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • status-success=Integration test (jsii-pacmak)
  • status-success=Unit Tests
  • any of [🛡 GitHub branch protection]:
    • check-success = Integration test (jsii-pacmak)
    • check-neutral = Integration test (jsii-pacmak)
    • check-skipped = Integration test (jsii-pacmak)
  • any of [🛡 GitHub branch protection]:
    • check-success = Build
    • check-neutral = Build
    • check-skipped = Build
  • any of [🛡 GitHub branch protection]:
    • check-success = Unit Tests
    • check-neutral = Unit Tests
    • check-skipped = Unit Tests

@mergify
Copy link
Contributor

mergify bot commented Nov 26, 2025

Merging (with squash)...

@mergify mergify bot added the queued label Nov 26, 2025
@mergify mergify bot merged commit 6a5fc58 into main Nov 26, 2025
39 checks passed
@mergify mergify bot deleted the huijbers/object-name branch November 26, 2025 11:40
@mergify mergify bot removed pr/ready-to-merge This PR is ready to be merged. queued labels Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution/core This is a PR that came from AWS.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants