Java Code Examples for javax.lang.model.SourceVersion#RELEASE_5
The following examples show how to use
javax.lang.model.SourceVersion#RELEASE_5 .
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: JavadocUtilities.java From netbeans with Apache License 2.0 | 6 votes |
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 2
Source File: SourceVersionUtils.java From buck with Apache License 2.0 | 6 votes |
/** 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 3
Source File: SerialFilterTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 4
Source File: SerialFilterTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 5
Source File: SerialFilterTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 6
Source File: SerialFilterTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 7
Source File: SerialFilterTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 8
Source File: SerialFilterTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 9
Source File: BaseProcessingEnvImpl.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public SourceVersion getSourceVersion() { if (this._compiler.options.sourceLevel <= ClassFileConstants.JDK1_5) { return SourceVersion.RELEASE_5; } if (this._compiler.options.sourceLevel == ClassFileConstants.JDK1_6) { return SourceVersion.RELEASE_6; } try { return SourceVersion.valueOf("RELEASE_7"); //$NON-NLS-1$ } catch(IllegalArgumentException e) { // handle call on a JDK 6 return SourceVersion.RELEASE_6; } }
Example 10
Source File: SourceVersionUtils.java From buck with Apache License 2.0 | 5 votes |
/** 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); } }
Example 11
Source File: AddOverrideAnnotation.java From netbeans with Apache License 2.0 | 4 votes |
@TriggerTreeKind(Kind.METHOD) public static ErrorDescription run(HintContext ctx) { CompilationInfo compilationInfo = ctx.getInfo(); TreePath treePath = ctx.getPath(); TypeElement el = compilationInfo.getElements().getTypeElement("java.lang.Override"); //NOI18N if (el == null || !GeneratorUtils.supportsOverride(compilationInfo)) return null; Element e = compilationInfo.getTrees().getElement(treePath); if (e != null && e.getKind() == ElementKind.METHOD) { ExecutableElement ee = (ExecutableElement) e; List<ElementDescription> result = new ArrayList<ElementDescription>(); Element enclEl = ee.getEnclosingElement(); if (!enclEl.getKind().isClass() && !enclEl.getKind().isInterface()) return null; AnnotationType type = ComputeOverriding.detectOverrides(compilationInfo, (TypeElement) enclEl, ee, result); boolean hasOverriddenAnnotation = false; for (AnnotationMirror am : ee.getAnnotationMirrors()) { if (compilationInfo.getTypes().isSameType(am.getAnnotationType(), el.asType())) { hasOverriddenAnnotation = true; break; } } if (hasOverriddenAnnotation) { return null; } boolean addHint = false; if (type == AnnotationType.OVERRIDES) { addHint = true; } else { if (type == AnnotationType.IMPLEMENTS) { addHint = compilationInfo.getSourceVersion() != SourceVersion.RELEASE_5; } } if (addHint) { String desc = NbBundle.getMessage(AddOverrideAnnotation.class, "HINT_AddOverrideAnnotation"); return ErrorDescriptionFactory.forName(ctx, treePath, desc, new FixImpl(compilationInfo, treePath).toEditorFix()); } } return null; }