spatial4j icon indicating copy to clipboard operation
spatial4j copied to clipboard

Split packages between spatial4j and spatial4j-*-tests

Open dweiss opened this issue 3 years ago • 3 comments
trafficstars

These artifacts have classes in the same package which causes major headaches if one wants to use them together with the module system. Would it be at all possible to separate packages between these two modules?

dweiss avatar Dec 22 '21 18:12 dweiss

To put tests in a different package from the code they are testing? That sounds unusual but yeah, possible. It's useful to use "package" visibility to expose methods to a a test that you would otherwise not want to expose.

Disclaimer: I'm only vaguely familiar with "split package" notions in the module system. I'd like to think tests need not adhere to this rule.

dsmiley avatar Dec 22 '21 20:12 dsmiley

spatial-extras requires a module:

moduleApi 'org.locationtech.spatial4j:spatial4j'

and the tests of that project require this:

testImplementation 'org.locationtech.spatial4j:spatial4j::tests'

both can't live as separate public modules with the same packages - this situation is really difficult to work around in consumer projects without all sorts of command-line JVM hackery. If it's a public module meant for consumption, it should use a separate package.

dweiss avatar Dec 22 '21 20:12 dweiss

It's useful to use "package" visibility to expose methods to a a test that you would otherwise not want to expose.

Yeah, this trick simply no longer works with the module system. module patching is a substitute for this, but it's hell in my opinion.

dweiss avatar Dec 22 '21 20:12 dweiss