void (@NotNull List<Tools> enabledInspectionTools, String @NotNull [] fieldNames, boolean flag) { if (enabledInspectionTools.size() == 1) { InspectionProfileEntry inspection = enabledInspectionTools.get(0).getTool().getTool(); Class<? extends InspectionProfileEntry> inspectionClass = inspection.getClass(); for (String inspectionFieldName : fieldNames) { try { Field field = inspectionClass.getField(inspectionFieldName); field.setBoolean(inspection, flag); } catch (NoSuchFieldException | IllegalAccessException e) { LOGGER.error(e); } } } else { LOGGER.error("Cannot set true flags for more than one inspection"); } }