Change error detection for custom JavaMode

I’m currently developing a framework for Java-Based modes.

This currently has a few problems but the currently most pressing one would be fixing the issue of the error detection marking code as wrong that can be compiled by the mode.

Does anyone know how the error detection works and how to interfer with it.
Currently it only changes the Sketch-Code while compiling however I’d like to create an option for the user of the framework to provide a way to configure the error detection or to disable it.

Has anyone experience with the error detection and how to use it in a custom mode?