[NUCCORE-1219] Add compileGeneric method to AbstractJavaQuery