News for hackers. Stuff that matters.
Re:JEP 443: Unnamed Patterns and Variables (Preview) by illiarian on Wednesday March 22, 2023 @03:04AM (#35257745)
> We can write: q.remove();

If that method returns, many tools will complain that the returned value is ignored

Re:JEP 443: Unnamed Patterns and Variables (Preview) by invalidname on Wednesday March 22, 2023 @03:07AM (#35257766)
That's a bug in the tools. IntelliJ doesn't and neither does Sonar Cloud.
Re:JEP 443: Unnamed Patterns and Variables (Preview) by brabel on Wednesday March 22, 2023 @03:18AM (#35257837)
IntelliJ complains if you don't check certain values (e.g. `file.delete()`). It's not a bug, it's extremely helpful.
Re:JEP 443: Unnamed Patterns and Variables (Preview) by invalidname on Wednesday March 22, 2023 @03:26AM (#35257879)
Interesting. It does do that for file.delete() but not for remove(). That's because it's smart enough to know which values are important.

In the case of delete() you would want to check the result. So the warning is good and using an underscore to ignore it would actually be a problem.

In the case of remove() we don't really need the result.