当前位置: 首页>>代码示例>>Java>>正文


Java SourceVersion.compareTo方法代码示例

本文整理汇总了Java中javax.lang.model.SourceVersion.compareTo方法的典型用法代码示例。如果您正苦于以下问题:Java SourceVersion.compareTo方法的具体用法?Java SourceVersion.compareTo怎么用?Java SourceVersion.compareTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.lang.model.SourceVersion的用法示例。


在下文中一共展示了SourceVersion.compareTo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: computeHints

import javax.lang.model.SourceVersion; //导入方法依赖的package包/类
@CheckForNull
public Map<HintDescription, List<ErrorDescription>> computeHints(CompilationInfo info,
                                    TreePath startAt,
                                    boolean recursive,
                                    Iterable<? extends HintDescription> hints,
                                    Collection<? super MessageImpl> problems) {
    Map<Class, List<HintDescription>> triggerKind2Hints = new HashMap<Class, List<HintDescription>>();

    for (Class<? extends Trigger> c : TRIGGER_KINDS) {
        triggerKind2Hints.put(c, new ArrayList<HintDescription>());
    }
    SourceVersion srcVersion = info.getSourceVersion();
    for (HintDescription hd : hints) {
        SourceVersion hVersion = hd.getMetadata().sourceVersion;
        if (hVersion != null &&
            (srcVersion.compareTo(hVersion) < 0)) {
            continue;
        }
        List<HintDescription> sorted = triggerKind2Hints.get(hd.getTrigger().getClass());

        sorted.add(hd);
    }

    if (caret != -1) {
        TreePath tp = info.getTreeUtilities().pathFor(caret);
        return computeSuggestions(info, tp, true, triggerKind2Hints, problems);
    } else {
        if (from != (-1) && to != (-1)) {
            return computeHintsInSpan(info, triggerKind2Hints, problems);
        } else if (!recursive) {
            return computeSuggestions(info, startAt, false, triggerKind2Hints, problems);
        } else {
            return computeHintsImpl(info, startAt, triggerKind2Hints, problems);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:HintsInvoker.java

示例2: checkSourceVersionCompatibility

import javax.lang.model.SourceVersion; //导入方法依赖的package包/类
/**
 * Checks whether or not a processor's source version is
 * compatible with the compilation source version.  The
 * processor's source version needs to be greater than or
 * equal to the source version of the compile.
 */
private void checkSourceVersionCompatibility(Source source, Log log) {
    SourceVersion procSourceVersion = processor.getSupportedSourceVersion();

    if (procSourceVersion.compareTo(Source.toSourceVersion(source)) < 0 )  {
        log.warning("proc.processor.incompatible.source.version",
                    procSourceVersion,
                    processor.getClass().getName(),
                    source.name);
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:17,代码来源:JavacProcessingEnvironment.java

示例3: checkSourceVersionCompatibility

import javax.lang.model.SourceVersion; //导入方法依赖的package包/类
/**
 * Checks whether or not a processor's source version is
 * compatible with the compilation source version.  The
 * processor's source version needs to be greater than or
 * equal to the source version of the compile.
 */
private void checkSourceVersionCompatibility(Source source, Log log) {
    SourceVersion procSourceVersion = processor.getSupportedSourceVersion();

    if (procSourceVersion.compareTo(Source.toSourceVersion(source)) < 0 )  {
        log.warning(Warnings.ProcProcessorIncompatibleSourceVersion(procSourceVersion,
                                                                    processor.getClass().getName(),
                                                                    source.name));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:JavacProcessingEnvironment.java

示例4: testEnclosingElement

import javax.lang.model.SourceVersion; //导入方法依赖的package包/类
void testEnclosingElement(PackageElement javaLang) {
    SourceVersion version = processingEnv.getSourceVersion();
    Element enclosing = javaLang.getEnclosingElement();
    Element expectedEnclosing =
        (version.compareTo(RELEASE_9) < 0) ?  // No modules
        null :
        eltUtils.getModuleElement("java.base");

    if (!Objects.equals(enclosing, expectedEnclosing))
        throw new RuntimeException("Unexpected enclosing element under source version " +
                                   version);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:TestPackageElement.java

示例5: isJava8

import javax.lang.model.SourceVersion; //导入方法依赖的package包/类
public boolean isJava8() {
  SourceVersion sourceVersion = StaticEnvironment.processing().getSourceVersion();
  return sourceVersion.compareTo(SourceVersion.RELEASE_7) > 0;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:ClasspathAvailability.java


注:本文中的javax.lang.model.SourceVersion.compareTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。