blob: 42bb4d338d3caa4852ff476aa0b72b9fcc76b8f7 [file] [log] [blame]
Move cu to another package (same project)
/SIMPLEST POSSIBLE IMPLEMENTATION - NO SMARTNESS INVOLVED/
arguments:
cu,
newNackage
preconditions:
1. cu.name must not exist in newPackage
2. none of the cu.topLevelTypes must exist in newPackage
3. there must not be a main method in any of the cu.topLevelTypes
(or is cu.publicType enough?)
4. there must not be a native method declared in _any_ of the types declared
in cu.
5. none of cu.topLevelTypes must be used os a parameter of a native method
6. this could be more smart (i'll be more restrictive for a start):
- in new package there can be no type (toplevel or nested) with any of cu.types names
7. there must no be references (outside of cu) to package-visibles members in cu
8. inside the cu there must not be any references to package-visible java elements from other cus
9. inside the cu all references to protected java elements from other cus in this package must be
visible from other packages
10. other cus in the same package can reference protected java elements from cu only if these references
are in corresponding sub-hierarchies (blah, blah - rewrite)
changes:
1. move the cu
- java model does: package declaration change
2. remove imports of types from newPackage (optional)
3. add import cu.package; to cu (if it's not already there)
possible improvement: check if this import is really needed
/however, imports on demand *almost* never harmful/
4. change all fully qualified references to types in cu to the new ones.
(this, of course, does not solve the problem with non-uniqueness of fully
qualified type names)
5. add import newPackage.*; to all cus (outside of cu.package) that referenced cu.publicType
. only add the import if it's not already there