Java Code Examples for javax.lang.model.SourceVersion#RELEASE_3

The following examples show how to use javax.lang.model.SourceVersion#RELEASE_3 . 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: HintMetadata.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public Builder setSourceVersion(String version) {
    if (version == null || version.isEmpty()) {
        this.sourceVersion = SourceVersion.RELEASE_3;
    } else {
        if (version.startsWith("1.")) {
            version = version.substring(2);
        }
        try {
            this.sourceVersion = SourceVersion.valueOf("RELEASE_" + version);
        } catch (IllegalArgumentException ex) {
            this.sourceVersion = SourceVersion.RELEASE_3;
            setEnabled(false);
        }
    }
    return this;
}
 
Example 2
Source File: JavadocUtilities.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example 3
Source File: SourceVersionUtils.java    From buck with Apache License 2.0 6 votes vote down vote up
/** Gets the source version corresponding to the given target string. */
public static SourceVersion getSourceVersionFromTarget(String target) {
  switch (target) {
    case "1.3":
      return SourceVersion.RELEASE_3;
    case "1.4":
      return SourceVersion.RELEASE_4;
    case "1.5":
    case "5":
      return SourceVersion.RELEASE_5;
    case "1.6":
    case "6":
      return SourceVersion.RELEASE_6;
    case "1.7":
    case "7":
      return SourceVersion.RELEASE_7;
    case "1.8":
    case "8":
      return SourceVersion.RELEASE_8;
    default:
      throw new HumanReadableException("target %s not supported", target);
  }
}
 
Example 4
Source File: SourceVersionUtils.java    From buck with Apache License 2.0 5 votes vote down vote up
/** Gets the source version corresponding to the given target string. */
public static SourceVersion getSourceVersionFromTarget(String target) {
  switch (target) {
    case "1.3":
      return SourceVersion.RELEASE_3;
    case "1.4":
      return SourceVersion.RELEASE_4;
    case "1.5":
    case "5":
      return SourceVersion.RELEASE_5;
    case "1.6":
    case "6":
      return SourceVersion.RELEASE_6;
    case "1.7":
    case "7":
      return SourceVersion.RELEASE_7;
    case "1.8":
    case "8":
      return SourceVersion.RELEASE_8;
    case "9":
      return SourceVersion.RELEASE_9;
    case "10":
      return SourceVersion.RELEASE_10;
    case "11":
      return SourceVersion.RELEASE_11;
    default:
      throw new HumanReadableException("target %s not supported", target);
  }
}