Looking at this at the moment, and there is an "interesting" tradeoff, that we should probably discuss.
A fair bit of deferred work is going on, i.e. delaying the work until it is needed, in case it is not needed, which will improve start up time quite a lot. The down-side is that the structural problem is not showing up until any time later, possibly in production. I think we should remove this "lazy loading" of classes, and check everything possible at boot time. WDAYT? Niclas On Fri, Mar 24, 2017 at 5:30 PM, Niclas Hedhman <[email protected]> wrote: > Gang, > I was just thinking; > > We want it to become more efficient to find the runtime problems. One of > the major problems is that one gets an exception after exception the first > time we try to get going with a new project or a new subsystem in an > existing project. And this start->exception->edit->compile cycle is > tedious and not fun. > > Suggestion; > 1. Introduce a "bootstrapPhase" somewhere. > 2. Enhance ConstructionException with exact details of everything going on. > 3. Make the ConstructionException constructor private and introduce a > public static method to be called. > 4. If Application.mode() is development or test, and bootstrapPhase is > true, then add the Exception to a ThreadLocal list, otherwise throw > exception as previously. > 5. Figure out when bootstrap phase is "over", check if there are any > Excepitons in the list, if so, generate an elaborate, machine readable > report (for tooling) and abort. Otherwise clear bootstrapPhase and continue > as normal. > > I am not sure if all structural problems can be caught in one swoop or > not, but I am sure it would be a big improvement. Also, there might be > other Exceptions that should be involved in this as well. > > WDYT? > > Cheers > -- > Niclas Hedhman, Software Developer > http://polygene.apache.org <http://zest.apache.org> - New Energy for Java > -- Niclas Hedhman, Software Developer http://polygene.apache.org - New Energy for Java
