On 23 March 2016 at 12:51, Alan Bateman <alan.bate...@oracle.com> wrote: > If types T1 and T2 have the same defining loader and both types are in the > same package then they are in the same module. T1 can't be module M1 and T2 > in a different module M2. > (I shudder the thought of it being different or attempting to change what > default/package access means after all these years.)
I'm not asking for package scope to change meaning. It is Jigsaw that is trying to change its meaning wrt tests. Discussion of white vs black box testing is all very well and good, but its completely impractical. There are tens of thousands of existing projects out there, in open source and private, that rely on tests being in the same package. It is in essence a fundamental part of common approaches to testing. Making it hard to test code in the same package, as seems to be proposed, would be a nightmare for migration. (Many open source projects are for fun in spare time. Who is going to want to refactor all their tests to meet what amounts to an artificial limitation? Not me.) I don't particularly care what the mechanism is for this, but at the requirements level: - there are two modules - main and test - each has its own source tree - each has its own dependencies - each is released separately - each could be hosted on a central repo - the test module needs to be able to contain the same packages as the main module - the test module needs to be able to invoke package-scoped code in the same package in the main module To clarify further consider 4 modules, A, B, A-test and B-test where B depends on A. Module A-test may have a method foo() that uses package scope to access something in A. Module B-test will depend on A-test and rely on foo() to get access to that internal object. One apparent option would appear to be to merge the two modules dynamically at load time. However, they do need to be released and published separately (Note that I view the thread discussion of references to test classes on the classpath as another hack. The release and dependency elements clearly show tests to be modules, just ones with special access.) Stephen