Refactoring a Java project causes hundreds of "X not public" errors

I’m busy upgrading an ancient java app, and after getting it compiling I set about reorganizing the code structure. There are currently 500 files in ONE massive folder, so I need to split it into a neater folder structure. The moment I moved some files, the compiler generates heaps of "X() is not public in <BaseClass>" errors. Yes, the refactoring tool added package statements and imports to both sides,

Apparently every class has all its members with implicit visibility, ie:

 void setSelection(int x){...}

Apart from manually adding visibility attributes, is there a faster way to resolve the mess with less editing?

 public void setSelection(int x){...} /// Yay! only 5000 more occurrences to go!

Source: java

Leave a Reply