locationtech / geotrellis

GeoTrellis is a geographic data processing engine for high performance applications.
http://geotrellis.io
Other
1.33k stars 360 forks source link

resolve amgiguity in spark and raster Implicits classes with explicit imports shadowing local identifiers #3354

Closed philvarner closed 3 years ago

philvarner commented 3 years ago

Overview

First off, this doesn't actually have anything to do with implicits -- it just happens to be a problem with spark and raster Implicits class and how it references all the other classes it extends.

The core of this is that prior to 2.13, the resolution between local identifiers (in this case, a relative reference to a class) and imported identifiers did not conform to the spec. The references to several classes resolved to the local package rather than an imported package. This was fixed in 2.13, so these two files no longer compile because the class identifiers resolve differently now.

For example, interpolation.Implicits resolved to the local geotrellis.raster.interpolation.Implicits rather than what it should have resolved to according to the spec, which is that the existence of import geotrellis.vector._ results in it being geotrellis.vector.interpolation.Implicits -- this is a problem, because the package geotrellis.vector.interpolation exists, but not geotrellis.vector.interpolation.Implicits, so compilation fails.

I thought through a few solutions to this, including explicitly importing only what's actually needed from other packages instead of _, but just changing this to the fqn of the Implicits classes seems the most obvious option.

Also, fixed a couple of instances of unnecessary new with case classes.

Checklist

Demo

none

Notes

Discussion: https://github.com/scala/bug/issues/11593

Bug(s):

https://github.com/scala/bug/issues/9552 https://github.com/scala/bug/issues/2458

Fix for Bug: https://github.com/scala/scala/pull/6589