@Override
    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
        logger.info("Entered process, processingOver=" + roundEnv.processingOver());

        IFactory factory = null; //new NullFactory();
        Map<Element, CommandSpec> commands = new LinkedHashMap<Element, CommandSpec>();
        Map<TypeMirror, List<CommandSpec>> commandTypes = new LinkedHashMap<TypeMirror, List<CommandSpec>>();
        Map<Element, OptionSpec.Builder> options = new LinkedHashMap<Element, OptionSpec.Builder>();
        Map<Element, PositionalParamSpec.Builder> parameters = new LinkedHashMap<Element, PositionalParamSpec.Builder>();
        List<MixinInfo> mixinInfoList = new ArrayList<MixinInfo>();
        Map<Element, IAnnotatedElement> parentCommands = new LinkedHashMap<Element, IAnnotatedElement>();
        Map<Element, IAnnotatedElement> specs = new LinkedHashMap<Element, IAnnotatedElement>();
        Map<Element, IAnnotatedElement> unmatched = new LinkedHashMap<Element, IAnnotatedElement>();

        logger.fine("Building commands...");
        buildCommands(roundEnv, factory, commands, commandTypes, options, parameters);

        logger.fine("Building mixins...");
        buildMixins(roundEnv, factory, commands, mixinInfoList, commandTypes, options, parameters);

        logger.fine("Building options...");
        buildOptions(roundEnv, factory, options);

        logger.fine("Building parameters...");
        buildParameters(roundEnv, factory, parameters);

        logger.fine("Building parentCommands...");
        buildParentCommands(roundEnv, factory, parentCommands);

        logger.fine("Building specs...");
        buildSpecs(roundEnv, factory, specs);

        logger.fine("Building unmatched...");
        buildUnmatched(roundEnv, factory, unmatched);

        logger.fine("---------------------------");
        logger.fine("Known commands...");
        for (Map.Entry<Element, CommandSpec> cmd : commands.entrySet()) {
            logger.fine(String.format("%s has CommandSpec[name=%s]", cmd.getKey(), cmd.getValue().name()));
        }
        logger.fine("Known mixins...");
        for (MixinInfo mixinInfo : mixinInfoList) {
            logger.fine(String.format("%s is mixin for %s", mixinInfo.mixin.userObject(), mixinInfo.mixee.userObject()));
        }

        for (Map.Entry<Element, OptionSpec.Builder> option : options.entrySet()) {
            CommandSpec commandSpec = getOrCreateCommandSpecForArg(option, commands);
            logger.fine("Building OptionSpec for " + option + " in spec " + commandSpec);
            commandSpec.addOption(option.getValue().build());
        }
        for (Map.Entry<Element, PositionalParamSpec.Builder> parameter : parameters.entrySet()) {
            CommandSpec commandSpec = getOrCreateCommandSpecForArg(parameter, commands);
            logger.fine("Building PositionalParamSpec for " + parameter);
            commandSpec.addPositional(parameter.getValue().build());
        }
        for (MixinInfo mixinInfo : mixinInfoList) {
            mixinInfo.addMixin();
        }

        logger.fine("Found annotations: " + annotations);
        //processingEnv.getMessager().printMessage(Diagnostic.Kind.MANDATORY_WARNING, "Found annotations: " + annotations);
        for (TypeElement annotation : annotations) {
            Set<? extends Element> annotatedElements = roundEnv.getElementsAnnotatedWith(annotation);
            //processingEnv.getMessager().printMessage(Diagnostic.Kind.WARNING, annotatedElements + " is annotated with " + annotation);
            logger.finest(annotatedElements + " is annotated with " + annotation);
            // …
        }

        validateNoAnnotationsOnInterfaceField(roundEnv);
        validateInvalidCombination(roundEnv, Mixin.class, Option.class);
        validateInvalidCombination(roundEnv, Mixin.class, Parameters.class);
        validateInvalidCombination(roundEnv, Mixin.class, Unmatched.class);
        validateInvalidCombination(roundEnv, Mixin.class, Spec.class);
        validateInvalidCombination(roundEnv, Unmatched.class, Option.class);
        validateInvalidCombination(roundEnv, Unmatched.class, Parameters.class);
        validateInvalidCombination(roundEnv, Spec.class, Option.class);
        validateInvalidCombination(roundEnv, Spec.class, Parameters.class);
        validateInvalidCombination(roundEnv, Spec.class, Unmatched.class);
        validateInvalidCombination(roundEnv, Option.class, Parameters.class);

        // TODO
        //validateSpecFieldTypeIsCommandSpec(roundEnv);
        //validateOptionOrParametersIsNotFinalPrimitiveOrFinalString(roundEnv);
        //validateUnmatchedFieldTypeIsStringArrayOrListOfString(roundEnv);

        return handleCommands(commands, annotations, roundEnv);
    }
@ Override public boolean process ( Set < ? extends TypeElement > annotations , RoundEnvironment roundEnv ) { logger . info ( "Entered process, processingOver=" + roundEnv . processingOver ( ) ) ; IFactory factory = null ; Map < Element , CommandSpec > commands = new LinkedHashMap < Element , CommandSpec > ( ) ; Map < TypeMirror , List < CommandSpec > > commandTypes = new LinkedHashMap < TypeMirror , List < CommandSpec > > ( ) ; Map < Element , OptionSpec . Builder > options = new LinkedHashMap < Element , OptionSpec . Builder > ( ) ; Map < Element , PositionalParamSpec . Builder > parameters = new LinkedHashMap < Element , PositionalParamSpec . Builder > ( ) ; List < MixinInfo > mixinInfoList = new ArrayList < MixinInfo > ( ) ; Map < Element , IAnnotatedElement > parentCommands = new LinkedHashMap < Element , IAnnotatedElement > ( ) ; Map < Element , IAnnotatedElement > specs = new LinkedHashMap < Element , IAnnotatedElement > ( ) ; Map < Element , IAnnotatedElement > unmatched = new LinkedHashMap < Element , IAnnotatedElement > ( ) ; logger . fine ( "Building commands..." ) ; buildCommands ( roundEnv , factory , commands , commandTypes , options , parameters ) ; logger . fine ( "Building mixins..." ) ; buildMixins ( roundEnv , factory , commands , mixinInfoList , commandTypes , options , parameters ) ; logger . fine ( "Building options..." ) ; buildOptions ( roundEnv , factory , options ) ; logger . fine ( "Building parameters..." ) ; buildParameters ( roundEnv , factory , parameters ) ; logger . fine ( "Building parentCommands..." ) ; buildParentCommands ( roundEnv , factory , parentCommands ) ; logger . fine ( "Building specs..." ) ; buildSpecs ( roundEnv , factory , specs ) ; logger . fine ( "Building unmatched..." ) ; buildUnmatched ( roundEnv , factory , unmatched ) ; logger . fine ( "---------------------------" ) ; logger . fine ( "Known commands..." ) ; for ( Map . Entry < Element , CommandSpec > cmd : commands . entrySet ( ) ) { logger . fine ( String . format ( "%s has CommandSpec[name=%s]" , cmd . getKey ( ) , cmd . getValue ( ) . name ( ) ) ) ; } logger . fine ( "Known mixins..." ) ; for ( MixinInfo mixinInfo : mixinInfoList ) { logger . fine ( String . format ( "%s is mixin for %s" , mixinInfo . mixin . userObject ( ) , mixinInfo . mixee . userObject ( ) ) ) ; } for ( Map . Entry < Element , OptionSpec . Builder > option : options . entrySet ( ) ) { CommandSpec commandSpec = getOrCreateCommandSpecForArg ( option , commands ) ; logger . fine ( "Building OptionSpec for " + option + " in spec " + commandSpec ) ; commandSpec . addOption ( option . getValue ( ) . build ( ) ) ; } for ( Map . Entry < Element , PositionalParamSpec . Builder > parameter : parameters . entrySet ( ) ) { CommandSpec commandSpec = getOrCreateCommandSpecForArg ( parameter , commands ) ; logger . fine ( "Building PositionalParamSpec for " + parameter ) ; commandSpec . addPositional ( parameter . getValue ( ) . build ( ) ) ; } for ( MixinInfo mixinInfo : mixinInfoList ) { mixinInfo . addMixin ( ) ; } logger . fine ( "Found annotations: " + annotations ) ; for ( TypeElement annotation : annotations ) { Set < ? extends Element > annotatedElements = roundEnv . getElementsAnnotatedWith ( annotation ) ; logger . finest ( annotatedElements + " is annotated with " + annotation ) ; } validateNoAnnotationsOnInterfaceField ( roundEnv ) ; validateInvalidCombination ( roundEnv , Mixin . class , Option . class ) ; validateInvalidCombination ( roundEnv , Mixin . class , Parameters . class ) ; validateInvalidCombination ( roundEnv , Mixin . class , Unmatched . class ) ; validateInvalidCombination ( roundEnv , Mixin . class , Spec . class ) ; validateInvalidCombination ( roundEnv , Unmatched . class , Option . class ) ; validateInvalidCombination ( roundEnv , Unmatched . class , Parameters . class ) ; validateInvalidCombination ( roundEnv , Spec . class , Option . class ) ; validateInvalidCombination ( roundEnv , Spec . class , Parameters . class ) ; validateInvalidCombination ( roundEnv , Spec . class , Unmatched . class ) ; validateInvalidCombination ( roundEnv , Option . class , Parameters . class ) ; return handleCommands ( commands , annotations , roundEnv ) ; }
inherit doc