Package com.sun.tools.javac.util

Examples of com.sun.tools.javac.util.Options


                                       Iterable<String> options)
    {
        if (options == null)
            return;

        Options optionTable = Options.instance(context);

        JavacOption[] recognizedOptions =
            RecognizedOptions.getJavacToolOptions(new GrumpyHelper());
        Iterator<String> flags = options.iterator();
        while (flags.hasNext()) {
View Full Code Here


      exit();
    }
    setDocletInvoker(as);
    ListBuffer listbuffer1 = new ListBuffer();
    ListBuffer listbuffer2 = new ListBuffer();
    Options options1 = Options.instance(context);
    boolean flag = false;
    for (int i = 0; i < as.length; i++) {
      String s = as[i];
      if (s.equals("-subpackages")) {
        oneArg(as, i++);
        addToList(listbuffer1, as[i]);
        continue;
      }
      if (s.equals("-exclude")) {
        oneArg(as, i++);
        addToList(listbuffer2, as[i]);
        continue;
      }
      if (s.equals("-verbose")) {
        setOption(s);
        options1.put("-verbose", "");
        continue;
      }
      if (s.equals("-encoding")) {
        oneArg(as, i++);
        encoding = as[i];
        options1.put("-encoding", as[i]);
        continue;
      }
      if (s.equals("-breakiterator")) {
        breakiterator = true;
        setOption("-breakiterator");
        continue;
      }
      if (s.equals("-help")) {
        usage();
        exit();
        continue;
      }
      if (s.equals("-Xclasses")) {
        setOption(s);
        flag = true;
        continue;
      }
      if (s.equals("-Xwerror")) {
        setOption(s);
        rejectWarnings = true;
        continue;
      }
      if (s.equals("-private")) {
        setOption(s);
        setFilter(-9223372036854775801L);
        continue;
      }
      if (s.equals("-package")) {
        setOption(s);
        setFilter(-9223372036854775803L);
        continue;
      }
      if (s.equals("-protected")) {
        setOption(s);
        setFilter(5L);
        continue;
      }
      if (s.equals("-public")) {
        setOption(s);
        setFilter(1L);
        continue;
      }
      if (s.equals("-source")) {
        oneArg(as, i++);
        if (options1.get("-source") != null)
          usageError("main.option.already.seen", s);
        options1.put("-source", as[i]);
        continue;
      }
      if (s.equals("-gj")) {
        options1.put("-gj", "-gj");
        continue;
      }
      if (s.equals("-prompt")) {
        options1.put("-prompt", "-prompt");
        messager.promptOnError = true;
        continue;
      }
      if (s.equals("-sourcepath")) {
        oneArg(as, i++);
        if (options1.get("-sourcepath") != null)
          usageError("main.option.already.seen", s);
        options1.put("-sourcepath", as[i]);
        continue;
      }
      if (s.equals("-classpath")) {
        oneArg(as, i++);
        if (options1.get("-classpath") != null)
          usageError("main.option.already.seen", s);
        options1.put("-classpath", as[i]);
        continue;
      }
      if (s.equals("-sysclasspath")) {
        oneArg(as, i++);
        if (options1.get("-bootclasspath") != null)
          usageError("main.option.already.seen", s);
        options1.put("-bootclasspath", as[i]);
        continue;
      }
      if (s.equals("-bootclasspath")) {
        oneArg(as, i++);
        if (options1.get("-bootclasspath") != null)
          usageError("main.option.already.seen", s);
        options1.put("-bootclasspath", as[i]);
        continue;
      }
      if (s.equals("-extdirs")) {
        oneArg(as, i++);
        if (options1.get("-extdirs") != null)
          usageError("main.option.already.seen", s);
        options1.put("-extdirs", as[i]);
        continue;
      }
      if (s.equals("-overview")) {
        oneArg(as, i++);
        continue;
      }
      if (s.equals("-doclet")) {
        i++;
        continue;
      }
      if (s.equals("-docletpath")) {
        i++;
        continue;
      }
      if (s.equals("-locale")) {
        if (i != 0)
          usageError("main.locale_first");
        oneArg(as, i++);
        docLocale = as[i];
        continue;
      }
      if (s.startsWith("-XD")) {
        String s1 = s.substring("-XD".length());
        int k = s1.indexOf('=');
        String s2 = k >= 0 ? s1.substring(0, k) : s1;
        String s3 = k >= 0 ? s1.substring(k + 1) : s1;
        options1.put(s2, s3);
        continue;
      }
      if (s.startsWith("-")) {
        int j = docletInvoker.optionLength(s);
        if (j < 0) {
          exit();
          continue;
        }
        if (j == 0) {
          usageError("main.invalid_flag", s);
          continue;
        }
        if (i + j > as.length)
          usageError("main.requires_argument", s);
        ListBuffer listbuffer3 = new ListBuffer();
        for (int i1 = 0; i1 < j - 1; i1++)
          listbuffer3.append(as[++i]);

        setOption(s, listbuffer3.toList());
      } else {
        listbuffer.append(s);
      }
    }

    if (listbuffer.isEmpty() && listbuffer1.isEmpty())
      usageError("main.No_packages_or_classes_specified");
    if (!docletInvoker.validOptions(options.toList()))
      exit();
    JoodocTool joodocTool = new JoodocTool(messager);
    if (joodocTool == null)
      return false;
    if (showAccess == null)
      setFilter(defaultFilter);
    net.jangaroo.joodoc.RootDocImpl rootdocimpl = joodocTool.getRootDocImpl(docLocale, encoding, showAccess, listbuffer.toList(), options.toList(), breakiterator, listbuffer1.toList(), listbuffer2.toList(), flag);
    boolean flag1 = rootdocimpl != null;
    if (flag1)
      flag1 = docletInvoker.start(rootdocimpl);
    if (options1.get("-verbose") != null) {
      l = System.currentTimeMillis() - l;
      messager.notice("main.done_in", Long.toString(l));
    }
    return flag1;
  }
View Full Code Here

                                       Iterable<String> options)
    {
        if (options == null)
            return;

        final Options optionTable = Options.instance(context);
        Log log = Log.instance(context);

        Option[] recognizedOptions =
                Option.getJavacToolOptions().toArray(new Option[0]);
        OptionHelper optionHelper = new GrumpyHelper(log) {
            @Override
            public String get(Option option) {
                return optionTable.get(option.getText());
            }

            @Override
            public void put(String name, String value) {
                optionTable.put(name, value);
            }

            @Override
            public void remove(String name) {
                optionTable.remove(name);
            }
        };

        Iterator<String> flags = options.iterator();
        while (flags.hasNext()) {
            String flag = flags.next();
            int j;
            for (j=0; j<recognizedOptions.length; j++)
                if (recognizedOptions[j].matches(flag))
                    break;

            if (j == recognizedOptions.length) {
                if (fileManager.handleOption(flag, flags)) {
                    continue;
                } else {
                    String msg = log.localize(PrefixKind.JAVAC, "err.invalid.flag", flag);
                    throw new IllegalArgumentException(msg);
                }
            }

            Option option = recognizedOptions[j];
            if (option.hasArg()) {
                if (!flags.hasNext()) {
                    String msg = log.localize(PrefixKind.JAVAC, "err.req.arg", flag);
                    throw new IllegalArgumentException(msg);
                }
                String operand = flags.next();
                if (option.process(optionHelper, flag, operand))
                    // should not happen as the GrumpyHelper will throw exceptions
                    // in case of errors
                    throw new IllegalArgumentException(flag + " " + operand);
            } else {
                if (option.process(optionHelper, flag))
                    // should not happen as the GrumpyHelper will throw exceptions
                    // in case of errors
                    throw new IllegalArgumentException(flag);
            }
        }

        optionTable.notifyListeners();
    }
View Full Code Here

        names = fac.names;
        m = fac.docTreeMaker;

        Locale locale = (fac.locale == null) ? Locale.getDefault() : fac.locale;

        Options options = fac.options;
        boolean useBreakIterator = options.isSet("breakIterator");
        if (useBreakIterator || !locale.getLanguage().equals(Locale.ENGLISH.getLanguage()))
            sentenceBreaker = BreakIterator.getSentenceInstance(locale);

        initTagParsers();
    }
View Full Code Here

    private static final Map<String, LintCategory> map =
            new java.util.concurrent.ConcurrentHashMap<String, LintCategory>(20);

    protected Lint(Context context) {
        // initialize values according to the lint options
        Options options = Options.instance(context);
        values = EnumSet.noneOf(LintCategory.class);
        for (Map.Entry<String, LintCategory> e: map.entrySet()) {
            if (options.lint(e.getKey()))
                values.add(e.getValue());
        }

        suppressedValues = EnumSet.noneOf(LintCategory.class);
View Full Code Here

        names = Names.instance(context);
        log = Log.instance(context);
        syms = Symtab.instance(context);
        annotate = Annotate.instance(context);
        attr = Attr.instance(context);
        Options options = Options.instance(context);
    }
View Full Code Here

    private JNIWriter(Context context) {
        context.put(jniWriterKey, this);
        fileManager = context.get(JavaFileManager.class);
        log = Log.instance(context);

        Options options = Options.instance(context);
        verbose = options.isSet(VERBOSE);
        checkAll = options.isSet("javah:full");

        this.context = context; // for lazyInit()
        syms = Symtab.instance(context);

        lineSep = System.getProperty("line.separator");
View Full Code Here

    public boolean atLeastOneProcessor() {
        return discoveredProcs.iterator().hasNext();
    }

    private Map<String, String> initProcessorOptions(Context context) {
        Options options = Options.instance(context);
        Set<String> keySet = options.keySet();
        Map<String, String> tempOptions = new LinkedHashMap<String, String>();

        for(String key : keySet) {
            if (key.startsWith("-A") && key.length() > 2) {
                int sepIndex = key.indexOf('=');
View Full Code Here

         * other values are implicitly reset.
         */
        private Context nextContext() {
            Context next = new Context(context);

            Options options = Options.instance(context);
            Assert.checkNonNull(options);
            next.put(Options.optionsKey, options);

            Locale locale = context.get(Locale.class);
            if (locale != null)
View Full Code Here

   */
  public static RootDoc createJavadoc(File sourcedir, ListBuffer<String> javaNames, ListBuffer<String> subPackages, Map<String,String> simpleOptions) throws Exception{

    Context context = new Context();
   
      Options options = Options.instance(context);
      options.put(OPTION_SOURCEPATH, sourcedir.getAbsolutePath());
      ListBuffer<String[]> optionList = new ListBuffer<String[]>();
      optionList.append(new String[]{OPTION_SOURCEPATH, sourcedir.getAbsolutePath()});
     
      if (simpleOptions!= null){
        for (Entry<String, String>option: simpleOptions.entrySet()){
View Full Code Here

TOP

Related Classes of com.sun.tools.javac.util.Options

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.