[BZ-995018] raise a compilation error if a java class doesn't declare a package
(cherry picked from commit b9ff47c815714d2c5b1840b8e9a4ccaf2a3d3e24)