DEV Community 👩‍💻👨‍💻

Eric Ahnell
Eric Ahnell

Posted on

Java compiler error cascades... and fixing them

So you know how, when programming, in a sudden realization of the power of code reuse, you decide to merge two prior programs you wrote into one, not realizing all the complexity and compiler error fixing this entails? This is my tale of exactly this experience...

I am working on a game called Fantastle Reboot - as the name might imply, it's a reboot of an earlier game of mine called Fantastle. I decided to merge the bits from TallerTower, another game I made, into Fantastle Reboot. It was at this point, after I started refactoring, that the compiler errors popped up... at one point I had 2.5k errors staring me in the face!

The good news is that a little over half of these are easily fixed by find-and-replace (or IDE tools) to fix the references that broke during the renaming. The rest required some deep thought about how to merge two similar but distinct implementations of things, and dealing with MORE broken references after merging... and inevitable dependency chain violations causing another thing to need merging.

Twenty or so iterations of this, and the error count slowly decreased... from 2.5k to 1.2k, then 800, 600, ... 10, 6, 2, and finally 0! The compiler is happy, but... of course, the program doesn't run, because of a runtime check that is unsatisfied. My work is therefore far from done.

Let this be an important lesson: refactoring can be very much an iterative grind, but when combined with a divide and conquer approach, and the knowledge that some fixes will add new errors, you will eventually get there, as I did.

Top comments (0)

Take a look at this:


Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. 🛠