Search in sources :

Example 1 with AutoValueSupport

use of org.checkerframework.checker.calledmethods.builder.AutoValueSupport in project checker-framework by typetools.

the class CalledMethodsAnnotatedTypeFactory method enableFrameworks.

/**
 * Enables support for the default builder-generation frameworks, except those listed in the
 * disabled builder frameworks parsed from the -AdisableBuilderFrameworkSupport option's
 * arguments. Throws a UserError if the user included an unsupported framework in the list of
 * frameworks to be disabled.
 *
 * @param disabledFrameworks the disabled builder frameworks
 */
private void enableFrameworks(String[] disabledFrameworks) {
    boolean enableAutoValueSupport = true;
    boolean enableLombokSupport = true;
    for (String framework : disabledFrameworks) {
        switch(framework) {
            case "autovalue":
                enableAutoValueSupport = false;
                break;
            case "lombok":
                enableLombokSupport = false;
                break;
            default:
                throw new UserError("Unsupported builder framework in -AdisableBuilderFrameworkSupports: " + framework);
        }
    }
    if (enableAutoValueSupport) {
        builderFrameworkSupports.add(new AutoValueSupport(this));
    }
    if (enableLombokSupport) {
        builderFrameworkSupports.add(new LombokSupport(this));
    }
}
Also used : UserError(org.checkerframework.javacutil.UserError) AutoValueSupport(org.checkerframework.checker.calledmethods.builder.AutoValueSupport) LombokSupport(org.checkerframework.checker.calledmethods.builder.LombokSupport)

Aggregations

AutoValueSupport (org.checkerframework.checker.calledmethods.builder.AutoValueSupport)1 LombokSupport (org.checkerframework.checker.calledmethods.builder.LombokSupport)1 UserError (org.checkerframework.javacutil.UserError)1