-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
remove unnecessary casts and tests for null, discovered using NetBeans #1285
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
Conversation
|
Removal of unnecessary casts has been added to this PR. If there's no comment in 72 hours, I'll consider this approved for integration. |
MeFisto94
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I finally made it through all of 136 files :)
Thanks for that patch, Stephen.
I hope I didn't overlook some of the float calculations, but I guess the IDE doesn't make mistakes there, usually.
Looks fine, if my comments are addressed (most of them could be a separate PR, as they are suspicious code that I stumbled over while looking through that code snippets, but since this is a cleanup PR I wouldn't mind having them addressed here).
| } | ||
| } | ||
|
|
||
| if (vertexGroups != null && vertexGroups.size() > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The IDE suggested this, because an Exception would be thrown in Line 222.
That being said, can we verify if vertexGroups should be non null? If not, that if belongs in Line 222, much like it is in Line 219.
I suspect that only the Vertex Colors are optional, though, and thus the author just wanted to be sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmm... blender importer. Took me a sec to figure out what the heck was going on here but it all makes sense now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If vertexGroups can be null, then I think fixing the resulting NPE should be a separate PR, right?
| } | ||
| }); | ||
| ((SphereProbeArea) probe.getArea()).setRadius(100); | ||
| probe.getArea().setRadius(100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about this one.
IIRC getArea() is a deprecated helper and the future is to have multiple area types, so here we'd introduce a Deprecated Method in exchange for the correct approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, the removal of the cast or not doesn't change that. It was using the deprecated method before, too. I wonder what the alternative should be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd need to find nehon's comment on that, but basically something like if (probe.getArea() instanceof SphereProbeArea) etc.
Or here specifically keeping the cast, as getArea is not deprecated, but the assumption that it can only return a SphereProbeArea is
But we should double check that again with the reality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LightProbe.getArea() is not deprecated. Perhaps you were thinking of LightProbe.getBounds()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, I meant getBounds(), that was my source of confusion!
I wonder why we have a separate class "SphereProbeArea" though, for something that could be a float, when we don't plan to have multiple Area Types.
remove unnecessary tests for null, discovered using NetBeans