Java Code Examples for com.sun.tools.javac.code.TypeTags#CLASS
The following examples show how to use
com.sun.tools.javac.code.TypeTags#CLASS .
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: JCTree.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
public Kind getKind() { switch (typetag) { case TypeTags.INT: return Kind.INT_LITERAL; case TypeTags.LONG: return Kind.LONG_LITERAL; case TypeTags.FLOAT: return Kind.FLOAT_LITERAL; case TypeTags.DOUBLE: return Kind.DOUBLE_LITERAL; case TypeTags.BOOLEAN: return Kind.BOOLEAN_LITERAL; case TypeTags.CHAR: return Kind.CHAR_LITERAL; case TypeTags.CLASS: return Kind.STRING_LITERAL; case TypeTags.BOT: return Kind.NULL_LITERAL; default: throw new AssertionError("unknown literal kind " + this); } }
Example 2
Source File: JavacElements.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
/** * An internal-use utility that creates a reified annotation. * This overloaded version take annotation inheritance into account. */ public static <A extends Annotation> A getAnnotation(ClassSymbol annotated, Class<A> annoType) { boolean inherited = annoType.isAnnotationPresent(Inherited.class); A result = null; while (annotated.name != annotated.name.table.names.java_lang_Object) { result = getAnnotation((Symbol)annotated, annoType); if (result != null || !inherited) break; Type sup = annotated.getSuperclass(); if (sup.tag != TypeTags.CLASS || sup.isErroneous()) break; annotated = (ClassSymbol) sup.tsym; } return result; }
Example 3
Source File: JavacElements.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
/** * Returns all annotations of an element, whether * inherited or directly present. * * @param e the element being examined * @return all annotations of the element */ public List<Attribute.Compound> getAllAnnotationMirrors(Element e) { Symbol sym = cast(Symbol.class, e); List<Attribute.Compound> annos = sym.getAnnotationMirrors(); while (sym.getKind() == ElementKind.CLASS) { Type sup = ((ClassSymbol) sym).getSuperclass(); if (sup.tag != TypeTags.CLASS || sup.isErroneous() || sup.tsym == syms.objectType.tsym) { break; } sym = sup.tsym; List<Attribute.Compound> oldAnnos = annos; for (Attribute.Compound anno : sym.getAnnotationMirrors()) { if (isInherited(anno.type) && !containsAnnoOfType(oldAnnos, anno.type)) { annos = annos.prepend(anno); } } } return annos; }
Example 4
Source File: JCTree.java From javaide with GNU General Public License v3.0 | 6 votes |
public Kind getKind() { switch (typetag) { case TypeTags.INT: return Kind.INT_LITERAL; case TypeTags.LONG: return Kind.LONG_LITERAL; case TypeTags.FLOAT: return Kind.FLOAT_LITERAL; case TypeTags.DOUBLE: return Kind.DOUBLE_LITERAL; case TypeTags.BOOLEAN: return Kind.BOOLEAN_LITERAL; case TypeTags.CHAR: return Kind.CHAR_LITERAL; case TypeTags.CLASS: return Kind.STRING_LITERAL; case TypeTags.BOT: return Kind.NULL_LITERAL; default: throw new AssertionError("unknown literal kind " + this); } }
Example 5
Source File: JavacElements.java From javaide with GNU General Public License v3.0 | 6 votes |
/** * An internal-use utility that creates a reified annotation. * This overloaded version take annotation inheritance into account. */ public static <A extends Annotation> A getAnnotation(ClassSymbol annotated, Class<A> annoType) { boolean inherited = annoType.isAnnotationPresent(Inherited.class); A result = null; while (annotated.name != annotated.name.table.names.java_lang_Object) { result = getAnnotation((Symbol)annotated, annoType); if (result != null || !inherited) break; Type sup = annotated.getSuperclass(); if (sup.tag != TypeTags.CLASS || sup.isErroneous()) break; annotated = (ClassSymbol) sup.tsym; } return result; }
Example 6
Source File: JavacElements.java From javaide with GNU General Public License v3.0 | 6 votes |
/** * Returns all annotations of an element, whether * inherited or directly present. * * @param e the element being examined * @return all annotations of the element */ public List<Attribute.Compound> getAllAnnotationMirrors(Element e) { Symbol sym = cast(Symbol.class, e); List<Attribute.Compound> annos = sym.getAnnotationMirrors(); while (sym.getKind() == ElementKind.CLASS) { Type sup = ((ClassSymbol) sym).getSuperclass(); if (sup.tag != TypeTags.CLASS || sup.isErroneous() || sup.tsym == syms.objectType.tsym) { break; } sym = sup.tsym; List<Attribute.Compound> oldAnnos = annos; for (Attribute.Compound anno : sym.getAnnotationMirrors()) { if (isInherited(anno.type) && !containsAnnoOfType(oldAnnos, anno.type)) { annos = annos.prepend(anno); } } } return annos; }