DEV Community

Eric Ahnell
Eric Ahnell

Posted on

2 1

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.

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay