Java Code Examples for javax.lang.model.SourceVersion#RELEASE_6
The following examples show how to use
javax.lang.model.SourceVersion#RELEASE_6 .
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: TestSourceVersionWarnings.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@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); } }
Example 3
Source File: AbstractProcessor.java From Java8CN with Apache License 2.0 | 5 votes |
/** * 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; }
Example 4
Source File: SchemaGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public SourceVersion getSupportedSourceVersion() { if (SourceVersion.latest().compareTo(SourceVersion.RELEASE_6) > 0) return SourceVersion.valueOf("RELEASE_7"); else return SourceVersion.RELEASE_6; }
Example 5
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 6
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 7
Source File: TestSourceVersionWarnings.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@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); } }
Example 8
Source File: AbstractProcessor.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 9
Source File: AbstractProcessor.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
/** * 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; }
Example 10
Source File: AbstractProcessor.java From preferencebinder with Apache License 2.0 | 5 votes |
/** * 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; }
Example 11
Source File: AbstractProcessor.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * 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; }
Example 12
Source File: AnnotationParser.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public SourceVersion getSupportedSourceVersion() { if (SourceVersion.latest().compareTo(SourceVersion.RELEASE_6) > 0) return SourceVersion.valueOf("RELEASE_7"); else return SourceVersion.RELEASE_6; }
Example 13
Source File: AbstractProcessor.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 14
Source File: SchemaGenerator.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public SourceVersion getSupportedSourceVersion() { if (SourceVersion.latest().compareTo(SourceVersion.RELEASE_6) > 0) return SourceVersion.valueOf("RELEASE_7"); else return SourceVersion.RELEASE_6; }
Example 15
Source File: AbstractProcessor.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 16
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 17
Source File: TestSourceVersionWarnings.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@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); } }
Example 18
Source File: SchemaGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override public SourceVersion getSupportedSourceVersion() { if (SourceVersion.latest().compareTo(SourceVersion.RELEASE_6) > 0) return SourceVersion.valueOf("RELEASE_7"); else return SourceVersion.RELEASE_6; }
Example 19
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 20
Source File: BaseProcessor.java From utils with Apache License 2.0 | 4 votes |
@Override public SourceVersion getSupportedSourceVersion() { return SourceVersion.RELEASE_6; }