I am getting a “useless assignment” for this chunk of code (class names have been renamed) on path which is clearly wrong:
try
{
Path path = pathGenerator.get();
return new AutoDeletingData(path, DataFactory.getData(path));
}
catch (IOException e)
{
throw e;
}
catch (Exception e)
{
throw new IOException("Unable to create path containing data", e);
}
This was in IDEA 2019.3 with SonarLint 4.11.0.20867.
I also see this on code like this as well for existingData.
Data existingData = getData(itemPath);
if (existingData != null)
{
// Binary exists.
return existingData;
}