question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TRUE/FALSE_RETURNS at odds with NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION from fb-contrib

See original GitHub issue

With Pitest 1.7.2:

Given

Boolean getValue() {
  return Boolean.TRUE;
}

the TRUE_RETURNS mutator will produce the mutation

Boolean getValue() {
  return true;
}

which will always survive as the true will be auto-boxed to a Boolean instance (unless we’re testing Boolean instance identity, which seems pointless). The problem is that changing the production code to match the mutation is at odds with the NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION bug type from fb-contrib (See http://fb-contrib.sourceforge.net/bugdescriptions.html).

I might be missing some edge case here, but I think that the TRUE_RETURNS mutator shouldn’t try to return true in lieu of Boolean.TRUE, due to the auto-boxing. I’d be happy to understand if it is indeed a relevant case.

The corresponding argument can be made for FALSE_RETURNS, of course.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
hcolescommented, Nov 9, 2021

This repo has 2 response times: 3 years or 3 days.

0reactions
davidburstromcommented, Nov 9, 2021

I think you decreased the average response time with this one 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Booleans - Manual - PHP
The bool type only has two values, and is used to express a truth value. It can be either true or false ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found