T1002281 class cast ex - #67
Conversation
Fixes #1002281
Add public return types, add override keywords, remove trailing whitespace
|
Test PASSed. See Console Output in the link below for an update site containing this PR binary artefacts. Refer to this link for build results: https://jenkins.scala-ide.org:8496/jenkins/job/ghprb-scala-refactoring-validator/42/ |
There was a problem hiding this comment.
IIUC, you really need a RangePosition there. Why not throw as well on OffsetPosition, rather than giving a RangePosition which has high chances of being false ( I expect callers will want the word at point) ?
There was a problem hiding this comment.
I agree, and I wonder why we get an OffsetPosition in the first place...
There was a problem hiding this comment.
What could go wrong if OffsetPosition is treated as RangePosition? This way we need to ensure that no OffsetPosition is passed into scala-refactoring otherwise it blows up. Maybe that is the right thing to do, then I just need to fix the ticket on the IDE side.
There was a problem hiding this comment.
There just shouldn't be a reason to use an OffsetPosition. Remember, they're only used for compiler generated trees, so if a refactoring is started from the editor, there should always be a better suited RangePosition available.
There was a problem hiding this comment.
Yup, and having an exception on OffsetPositions works as a canary.
|
Test FAILed. |
Instead of doing an unsafe cast, an exception is thrown directly (or a conversion if possible).
Second commit contains cleanups.