本文整理汇总了Java中javax.lang.model.SourceVersion.RELEASE_6属性的典型用法代码示例。如果您正苦于以下问题:Java SourceVersion.RELEASE_6属性的具体用法?Java SourceVersion.RELEASE_6怎么用?Java SourceVersion.RELEASE_6使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.lang.model.SourceVersion
的用法示例。
在下文中一共展示了SourceVersion.RELEASE_6属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveSourceVersion
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
/**
* If the processor class is annotated with {@link
* SupportedSourceVersion}, return the source version in the
* annotation. If the class is not so annotated, {@link
* SourceVersion#RELEASE_6} is returned.
*
* @return the latest source version supported by this processor
*/
public SourceVersion getSupportedSourceVersion() {
SupportedSourceVersion ssv = this.getClass().getAnnotation(SupportedSourceVersion.class);
SourceVersion sv = null;
if (ssv == null) {
sv = SourceVersion.RELEASE_6;
if (isInitialized())
processingEnv.getMessager().printMessage(Diagnostic.Kind.WARNING,
"No SupportedSourceVersion annotation " +
"found on " + this.getClass().getName() +
", returning " + sv + ".");
} else
sv = ssv.value();
return sv;
}
示例3: getSupportedSourceVersion
@Override
public SourceVersion getSupportedSourceVersion() {
if (SourceVersion.latest().compareTo(SourceVersion.RELEASE_6) > 0)
return SourceVersion.valueOf("RELEASE_7");
else
return SourceVersion.RELEASE_6;
}
示例4: genTestObjectWildcard
/**
* Generate an object to be used with the various wildcard pattern forms.
* Explicitly supports only specific package wildcards with specific objects.
* @param pattern a wildcard pattern ending in "*"
* @param allowed a boolean indicating to generate the allowed or disallowed case
* @return an object within or outside the wildcard
*/
static Object genTestObjectWildcard(String pattern, boolean allowed) {
if (pattern.endsWith(".**")) {
// package hierarchy wildcard
if (pattern.startsWith("javax.lang.")) {
return SourceVersion.RELEASE_5;
}
if (pattern.startsWith("java.")) {
return 4;
}
if (pattern.startsWith("javax.")) {
return SourceVersion.RELEASE_6;
}
return otherObject;
} else if (pattern.endsWith(".*")) {
// package wildcard
if (pattern.startsWith("javax.lang.model")) {
return SourceVersion.RELEASE_6;
}
} else {
// class wildcard
if (pattern.equals("*")) {
return otherObject; // any object will do
}
if (pattern.startsWith("java.util.Hash")) {
return new Hashtable<String, String>();
}
}
Assert.fail("Object could not be generated for pattern: "
+ pattern
+ ", allowed: " + allowed);
return null;
}
示例5: getSupportedSourceVersion
@Override
public SourceVersion getSupportedSourceVersion() {
String sourceVersion = processingEnv.getOptions().get("SourceVersion");
if (sourceVersion == null) {
processingEnv.getMessager().printMessage(WARNING,
"No SourceVersion option given");
return SourceVersion.RELEASE_6;
} else {
return SourceVersion.valueOf(sourceVersion);
}
}
示例6: getSupportedSourceVersion
@Override public SourceVersion getSupportedSourceVersion() {
return SourceVersion.RELEASE_6;// SourceVersion.latestSupported();
}