Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: widening return types is not breaking #187

Closed
wants to merge 5 commits into from

Conversation

devmil
Copy link
Member

@devmil devmil commented Oct 9, 2024

Description

Widening the return type was not treated as breaking but consider this scenario:

// old signature
String someMethod();

// new signature
Object someMethod();

//-- breaks those consumer code situations:
// 1
String someVar = someMethod();
// 2
final someVar = someMethod();
final len = someVar.length;

So every change in return type needs to be breaking!

Fixes #186

Type of Change

  • 🚀 New feature (non-breaking change)
  • 🛠️ Bug fix (non-breaking change)
  • ⚠️ Breaking change (feature or bug fix which breaks existing behaviors/APIs)
  • 🏗️ Code refactor
  • ⚙️ Build configuration change
  • 📝 Documentation
  • 🧹 Chore / Housekeeping

@devmil
Copy link
Member Author

devmil commented Oct 10, 2024

the current version already should treat widening return types as breaking and narrowing should not be breaking (at least we were not able to come up with use cases that narrow the return type and are breaking)

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

Successfully merging this pull request may close these issues.

JSON report should properly contain "major" as change type for breaking changes
1 participant