Send help! I’m currently stuck in compiler hell!
My original development plan was to produce the alpha version then move onto the warm-ups viewer then the editor mode stuff then, finally, the language strings editors. However, in a moment of law studies induced delirium (it’s the excuse I’m sticking with), I bypassed the warm-ups viewer and went onto the editor mode changes. This has caused me to be stuck in compiler hell for the past few months.
What is compiler hell?
When you write Java code it needs to be ‘compiled’. This means that there is a piece of software, called a compiler, that takes your code and converts it to a format that can be run by the Java ‘Runtime-Environment’ (JRE). Essentially it translates the code into a more digestible format. In theory this makes the code faster and easier to run. The main issue is that the JRE is ONLY able to run this digested format. It can’t take the normal code I produce and just ‘run it’ and, importantly, when you ‘compile’ the code, if it finds anything it doesn’t like it spits out an error, crosses it’s arms and then refuses to do anything else. Think of it as a 3 year old bouncer on the door to that fancy restaurant you really want to go to that won’t let you in unless everything about you is perfect.
The practical upshot of this is that if, like me, you are converting your code from one technology (Java Swing) to another (JavaFX) when you start making changes the compiler spits out a metric tonne of errors and you have to slowly and methodically grind your way through. Carefully fixing each one and hoping you haven’t got the fix wrong thus causing more errors.
I made a single line change yesterday and the error count jumped up from 384 to 566. The errors are also quite difficult to read, for example:
D:\development\github\quollwriterv3\src\main\java\com\quollwriter\ui\fx\components\Viewer.java:171: error: titleProperty() in Viewer cannot override titleProperty() in Stage
public StringProperty titleProperty ()
overridden method is final
D:\development\github\quollwriterv3\src\main\java\com\quollwriter\ui\fx\sidebars\EditorsSideBar.java:459: error: incompatible types: incompatible parameter types in lambda expression
D:\development\github\quollwriterv3\src\main\java\com\quollwriter\editors\ui\EditorProjectViewer.java:40: error: EditorProjectViewer is not abstract and does not override abstract method getMainSideBar() in AbstractViewer
public class EditorProjectViewer extends AbstractProjectViewer
D:\development\github\quollwriterv3\src\main\java\com\quollwriter\editors\ui\EditorProjectViewer.java:168: error: getMainSideBar() in EditorProjectViewer cannot override getMainSideBar() in AbstractViewer
public EditorProjectSideBar getMainSideBar ()
return type EditorProjectSideBar is not compatible with SideBar
D:\development\github\quollwriterv3\src\main\java\com\quollwriter\editors\ui\EditorProjectViewer.java:167: error: method does not override or implement a method from a supertype
And these are just some of the more intelligble ones, when you get into generics and functions the errors become even stranger. You get used to it after a while but it does make your head hurt after a few hours.
I haven’t had a ‘clean’ compile, i.e. zero errors, for over two months now. The number of errors was so unmanageable I’ve had to tell the compiler to only show ten at a time. I can then laboriously trudge my way through them, fixing a few then recompile, fix a few then recompile and on and on. Worse still some errors can hide other errors or fixing one error can lead to a slew of others appearing. In coding terms, it’s akin to cleaning the public toilets outside that dodgy kebab shop at 2 am while the patrons are busy using them.
But, I am getting there although things are compounded by the fact I have to also implement the existing functionality in JavaFX, this requires carefully examining the current code then translating it to the new paradigms (and having to do it all in my head since I don’t have reference pictures to call on).
Currently I’m at 304 errors in total, earlier I was at around 260. I’m not sure how long this visit to hell will go on for, hopefully not too much longer… I really hate compilers.