Java Code Examples for com.sun.tools.javac.code.Source#DEFAULT

The following examples show how to use com.sun.tools.javac.code.Source#DEFAULT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseFileManager.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected Source getSource() {
    String sourceName = options.get(Option.SOURCE);
    Source source = null;
    if (sourceName != null)
        source = Source.lookup(sourceName);
    return (source != null ? source : Source.DEFAULT);
}
 
Example 2
Source File: BaseFileManager.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected Source getSource() {
    String sourceName = options.get(Option.SOURCE);
    Source source = null;
    if (sourceName != null)
        source = Source.lookup(sourceName);
    return (source != null ? source : Source.DEFAULT);
}
 
Example 3
Source File: BaseFileManager.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
protected Source getSource() {
    String sourceName = options.get(OptionName.SOURCE);
    Source source = null;
    if (sourceName != null)
        source = Source.lookup(sourceName);
    return (source != null ? source : Source.DEFAULT);
}
 
Example 4
Source File: BaseFileManager.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected Source getSource() {
    String sourceName = options.get(Option.SOURCE);
    Source source = null;
    if (sourceName != null)
        source = Source.lookup(sourceName);
    return (source != null ? source : Source.DEFAULT);
}
 
Example 5
Source File: BaseFileManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected Source getSource() {
    String sourceName = options.get(Option.SOURCE);
    Source source = null;
    if (sourceName != null)
        source = Source.lookup(sourceName);
    return (source != null ? source : Source.DEFAULT);
}
 
Example 6
Source File: BaseFileManager.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
protected Source getSource() {
    String sourceName = options.get(OptionName.SOURCE);
    Source source = null;
    if (sourceName != null)
        source = Source.lookup(sourceName);
    return (source != null ? source : Source.DEFAULT);
}
 
Example 7
Source File: BaseFileManager.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected Source getSource() {
    String sourceName = options.get(Option.SOURCE);
    Source source = null;
    if (sourceName != null)
        source = Source.lookup(sourceName);
    return (source != null ? source : Source.DEFAULT);
}
 
Example 8
Source File: BaseFileManager.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected Source getSource() {
    String sourceName = options.get(Option.SOURCE);
    Source source = null;
    if (sourceName != null)
        source = Source.lookup(sourceName);
    return (source != null ? source : Source.DEFAULT);
}
 
Example 9
Source File: BaseFileManager.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected Source getSource() {
    String sourceName = options.get(Option.SOURCE);
    Source source = null;
    if (sourceName != null)
        source = Source.lookup(sourceName);
    return (source != null ? source : Source.DEFAULT);
}
 
Example 10
Source File: Main.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public Collection<File> processArgs(String[] flags, String[] classNames) { // XXX sb protected
    int ac = 0;
    while (ac < flags.length) {
        String flag = flags[ac];
        ac++;

        Option option = null;

        if (flag.length() > 0) {
            // quick hack to speed up file processing:
            // if the option does not begin with '-', there is no need to check
            // most of the compiler options.
            int firstOptionToCheck = flag.charAt(0) == '-' ? 0 : recognizedOptions.length - 1;
            for (int j = firstOptionToCheck; j < recognizedOptions.length; j++) {
                if (recognizedOptions[j].matches(flag)) {
                    option = recognizedOptions[j];
                    break;
                }
            }
        }

        if (option == null) {
            error("err.invalid.flag", flag);
            return null;
        }

        if (option.hasArg()) {
            if (ac == flags.length) {
                error("err.req.arg", flag);
                return null;
            }
            String operand = flags[ac];
            ac++;
            if (option.process(options, flag, operand))
                return null;
        } else {
            if (option.process(options, flag))
                return null;
        }
    }

    if (this.classnames != null && classNames != null) {
        this.classnames.addAll(Arrays.asList(classNames));
    }

    if (!checkDirectory(D))
        return null;
    if (!checkDirectory(S))
        return null;

    String sourceString = options.get(SOURCE);
    Source source = (sourceString != null)
            ? Source.lookup(sourceString)
            : Source.DEFAULT;
    String targetString = options.get(TARGET);
    Target target = (targetString != null)
            ? Target.lookup(targetString)
            : Target.DEFAULT;
    // We don't check source/target consistency for CLDC, as J2ME
    // profiles are not aligned with J2SE targets; moreover, a
    // single CLDC target may have many profiles.  In addition,
    // this is needed for the continued functioning of the JSR14
    // prototype.
    if (Character.isDigit(target.name.charAt(0))) {
        if (target.compareTo(source.requiredTarget()) < 0) {
            if (targetString != null) {
                if (sourceString == null) {
                    warning("warn.target.default.source.conflict",
                            targetString,
                            source.requiredTarget().name);
                } else {
                    warning("warn.source.target.conflict",
                            sourceString,
                            source.requiredTarget().name);
                }
                return null;
            } else {
                target = source.requiredTarget();
                options.put("-target", target.name);
            }
        } else {
            if (targetString == null && !source.allowGenerics()) {
                target = Target.JDK1_4;
                options.put("-target", target.name);
            }
        }
    }

    // handle this here so it works even if no other options given
    String showClass = options.get("showClass");
    if (showClass != null) {
        if (showClass.equals("showClass")) // no value given for option
            showClass = "com.sun.tools.javac.Main";
        showClass(showClass);
    }

    return filenames;
}
 
Example 11
Source File: Main.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
public Collection<File> processArgs(String[] flags, String[] classNames) { // XXX sb protected
    int ac = 0;
    while (ac < flags.length) {
        String flag = flags[ac];
        ac++;

        Option option = null;

        if (flag.length() > 0) {
            // quick hack to speed up file processing:
            // if the option does not begin with '-', there is no need to check
            // most of the compiler options.
            int firstOptionToCheck = flag.charAt(0) == '-' ? 0 : recognizedOptions.length - 1;
            for (int j = firstOptionToCheck; j < recognizedOptions.length; j++) {
                if (recognizedOptions[j].matches(flag)) {
                    option = recognizedOptions[j];
                    break;
                }
            }
        }

        if (option == null) {
            error("err.invalid.flag", flag);
            return null;
        }

        if (option.hasArg()) {
            if (ac == flags.length) {
                error("err.req.arg", flag);
                return null;
            }
            String operand = flags[ac];
            ac++;
            if (option.process(options, flag, operand))
                return null;
        } else {
            if (option.process(options, flag))
                return null;
        }
    }

    if (this.classnames != null && classNames != null) {
        this.classnames.addAll(Arrays.asList(classNames));
    }

    if (!checkDirectory(D))
        return null;
    if (!checkDirectory(S))
        return null;

    String sourceString = options.get(SOURCE);
    Source source = (sourceString != null)
            ? Source.lookup(sourceString)
            : Source.DEFAULT;
    String targetString = options.get(TARGET);
    Target target = (targetString != null)
            ? Target.lookup(targetString)
            : Target.DEFAULT;
    // We don't check source/target consistency for CLDC, as J2ME
    // profiles are not aligned with J2SE targets; moreover, a
    // single CLDC target may have many profiles.  In addition,
    // this is needed for the continued functioning of the JSR14
    // prototype.
    if (Character.isDigit(target.name.charAt(0))) {
        if (target.compareTo(source.requiredTarget()) < 0) {
            if (targetString != null) {
                if (sourceString == null) {
                    warning("warn.target.default.source.conflict",
                            targetString,
                            source.requiredTarget().name);
                } else {
                    warning("warn.source.target.conflict",
                            sourceString,
                            source.requiredTarget().name);
                }
                return null;
            } else {
                target = source.requiredTarget();
                options.put("-target", target.name);
            }
        } else {
            if (targetString == null && !source.allowGenerics()) {
                target = Target.JDK1_4;
                options.put("-target", target.name);
            }
        }
    }

    // handle this here so it works even if no other options given
    String showClass = options.get("showClass");
    if (showClass != null) {
        if (showClass.equals("showClass")) // no value given for option
            showClass = "com.sun.tools.javac.Main";
        showClass(showClass);
    }

    return filenames;
}