本文整理汇总了Java中javax.lang.model.SourceVersion.latest方法的典型用法代码示例。如果您正苦于以下问题:Java SourceVersion.latest方法的具体用法?Java SourceVersion.latest怎么用?Java SourceVersion.latest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.lang.model.SourceVersion
的用法示例。
在下文中一共展示了SourceVersion.latest方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveSourceVersion
import javax.lang.model.SourceVersion; //导入方法依赖的package包/类
public static SourceVersion resolveSourceVersion(FileObject file) {
String sourceLevel = SourceLevelQuery.getSourceLevel(file);
if (sourceLevel == null) {
return SourceVersion.latest();
} else if (sourceLevel.startsWith("1.6")) {
return SourceVersion.RELEASE_6;
} else if (sourceLevel.startsWith("1.5")) {
return SourceVersion.RELEASE_5;
} else if (sourceLevel.startsWith("1.4")) {
return SourceVersion.RELEASE_4;
} else if (sourceLevel.startsWith("1.3")) {
return SourceVersion.RELEASE_3;
} else if (sourceLevel.startsWith("1.2")) {
return SourceVersion.RELEASE_2;
} else if (sourceLevel.startsWith("1.1")) {
return SourceVersion.RELEASE_1;
} else if (sourceLevel.startsWith("1.0")) {
return SourceVersion.RELEASE_0;
}
return SourceVersion.latest();
}
示例2: getSupportedSourceVersion
import javax.lang.model.SourceVersion; //导入方法依赖的package包/类
@Override
public SourceVersion getSupportedSourceVersion() {
/*
* Return latest source version instead of a fixed version
* like RELEASE_9. To return a fixed version, this class could
* be annotated with a SupportedSourceVersion annotation.
*
* Warnings will be issued if any unknown language constructs
* are encountered.
*/
return SourceVersion.latest();
}
示例3: sourceVersion
import javax.lang.model.SourceVersion; //导入方法依赖的package包/类
public @NonNull SourceVersion sourceVersion() {
String sourceLevel = SourceLevelQuery.getSourceLevel(ctx.getInfo().getFileObject());
if (sourceLevel == null) {
return SourceVersion.latest(); //TODO
}
String[] splited = sourceLevel.split("\\.");
String spec = splited[1];
return SourceVersion.valueOf("RELEASE_"+ spec);//!!!
}
示例4: getSupportedSourceVersion
import javax.lang.model.SourceVersion; //导入方法依赖的package包/类
@Override
public SourceVersion getSupportedSourceVersion() {
/*
* Return latest source version instead of a fixed version
* like RELEASE_8. To return a fixed version, this class
* could be annotated with a SupportedSourceVersion
* annotation.
*
* Warnings will be issued if any unknown language constructs
* are encountered.
*/
return SourceVersion.latest();
}
示例5: getSupportedSourceVersion
import javax.lang.model.SourceVersion; //导入方法依赖的package包/类
@Override
public SourceVersion getSupportedSourceVersion() {
return SourceVersion.latest();
}