com.sun.tools.javac.code.TypeTag Java Examples
The following examples show how to use
com.sun.tools.javac.code.TypeTag.
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: TreeConverter.java From j2objc with Apache License 2.0 | 6 votes |
private Type convertType(TypeMirror typeMirror) { com.sun.tools.javac.code.Type type = (com.sun.tools.javac.code.Type) typeMirror; if (type.getKind() == TypeKind.EXECUTABLE) { Type returnType = Type.newType(type.getReturnType()); if (type.hasTag(TypeTag.FORALL)) { return new ParameterizedType().setType(returnType).setTypeMirror(type.getReturnType()); } else { return returnType; } } if (type.getKind() == TypeKind.DECLARED) { List<? extends TypeMirror> typeArgs = ((DeclaredType) type).getTypeArguments(); if (!typeArgs.isEmpty()) { return new ParameterizedType().setType(Type.newType(typeMirror)).setTypeMirror(typeMirror); } } return Type.newType(type); }
Example #2
Source File: InferenceContext.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public Void visitUndetVar(UndetVar t, Void _unused) { if (min.add(t.qtype)) { Set<Type> deps = Maps.getOrDefault(minMap,t.qtype, new HashSet<>(Collections.singleton(t.qtype))); for (InferenceBound boundKind : InferenceBound.values()) { for (Type b : t.getBounds(boundKind)) { Type undet = asUndetVar(b); if (!undet.hasTag(TypeTag.UNDETVAR)) { visit(undet); } else if (isEquiv(t, b, boundKind)) { deps.add(b); equiv.add(b); } else { visit(undet); } } } minMap.put(t.qtype, deps); } return null; }
Example #3
Source File: SampleJavacPlugin.java From tutorials with MIT License | 6 votes |
private static JCTree.JCBlock createIfBlock(TreeMaker factory, Names symbolsTable, VariableTree parameter) { String parameterName = parameter.getName().toString(); Name parameterId = symbolsTable.fromString(parameterName); String errorMessagePrefix = String.format("Argument '%s' of type %s is marked by @%s but got '", parameterName, parameter.getType(), Positive.class.getSimpleName()); String errorMessageSuffix = "' for it"; return factory.Block(0, com.sun.tools.javac.util.List.of( factory.Throw( factory.NewClass(null, nil(), factory.Ident(symbolsTable.fromString(IllegalArgumentException.class.getSimpleName())), com.sun.tools.javac.util.List.of(factory.Binary(JCTree.Tag.PLUS, factory.Binary(JCTree.Tag.PLUS, factory.Literal(TypeTag.CLASS, errorMessagePrefix), factory.Ident(parameterId)), factory.Literal(TypeTag.CLASS, errorMessageSuffix))), null)))); }
Example #4
Source File: MemberEnter.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 6 votes |
void checkReceiver(JCVariableDecl tree, Env<AttrContext> localEnv) { attr.attribExpr(tree.nameexpr, localEnv); MethodSymbol m = localEnv.enclMethod.sym; if (m.isConstructor()) { Type outertype = m.owner.owner.type; if (outertype.hasTag(TypeTag.METHOD)) { // we have a local inner class outertype = m.owner.owner.owner.type; } if (outertype.hasTag(TypeTag.CLASS)) { checkType(tree.vartype, outertype, "incorrect.constructor.receiver.type"); checkType(tree.nameexpr, outertype, "incorrect.constructor.receiver.name"); } else { log.error(tree, Errors.ReceiverParameterNotApplicableConstructorToplevelClass); } } else { checkType(tree.vartype, m.owner.type, "incorrect.receiver.type"); checkType(tree.nameexpr, m.owner.type, "incorrect.receiver.name"); } }
Example #5
Source File: Operators.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Perform binary promotion of a pair of types; this routine implements JLS 5.6.2. * If the input types are not supported by unary promotion, if such types are identical to * a type C, then C is returned, otherwise Object is returned. */ Type binaryPromotion(Type t1, Type t2) { Type unboxedT1 = types.unboxedTypeOrType(t1); Type unboxedT2 = types.unboxedTypeOrType(t2); if (unboxedT1.isNumeric() && unboxedT2.isNumeric()) { if (unboxedT1.hasTag(TypeTag.DOUBLE) || unboxedT2.hasTag(TypeTag.DOUBLE)) { return syms.doubleType; } else if (unboxedT1.hasTag(TypeTag.FLOAT) || unboxedT2.hasTag(TypeTag.FLOAT)) { return syms.floatType; } else if (unboxedT1.hasTag(TypeTag.LONG) || unboxedT2.hasTag(TypeTag.LONG)) { return syms.longType; } else { return syms.intType; } } else if (types.isSameType(unboxedT1, unboxedT2)) { return unboxedT1; } else { return syms.objectType; } }
Example #6
Source File: MakeLiteralTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
void test(Object value, TypeTag tag, Type type, Object constValue) { JCLiteral l = maker.Literal(value); if (!l.type.hasTag(tag)) error("unexpected tag: " + l.getTag() + ": expected: " + tag); if (!types.isSameType(l.type, type)) error("unexpected type: " + l.type + ": expected: " + type); if (l.type.constValue().getClass() != constValue.getClass() || !constValue.equals(l.type.constValue())) { error("unexpected const value: " + l.type.constValue().getClass() + " " + l.type.constValue() + ": expected:" + constValue.getClass() + " " + constValue); } if (l.getValue().getClass() != value.getClass() || !value.equals(l.getValue())) { error("unexpected const value: " + l.getValue().getClass() + " " + l.type.constValue() + ": expected:" + value.getClass() + " " + value); } }
Example #7
Source File: TreeFactory.java From netbeans with Apache License 2.0 | 6 votes |
public LiteralTree Literal(Object value) { try { if (value instanceof Boolean) // workaround for javac issue 6504896 return make.at(NOPOS).Literal(TypeTag.BOOLEAN, value == Boolean.FALSE ? 0 : 1); if (value instanceof Character) // looks like world championship in workarounds here ;-) return make.at(NOPOS).Literal(TypeTag.CHAR, Integer.valueOf((Character) value)); if (value instanceof Byte) // #119143: Crystal ball no. 4 return make.at(NOPOS).Literal(TypeTag.INT, ((Byte) value).intValue()); if (value instanceof Short) return make.at(NOPOS).Literal(TypeTag.INT, ((Short) value).intValue()); if (value instanceof String[]) return make.at(NOPOS).Literal(TypeTag.CLASS, value); // workaround for making NULL_LITERAL kind. if (value == null) { return make.at(NOPOS).Literal(TypeTag.BOT, value); } return make.at(NOPOS).Literal(value); } catch (AssertionError e) { throw new IllegalArgumentException(e.getMessage()); } }
Example #8
Source File: Operators.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Perform binary promotion of a pair of types; this routine implements JLS 5.6.2. * If the input types are not supported by unary promotion, if such types are identical to * a type C, then C is returned, otherwise Object is returned. */ Type binaryPromotion(Type t1, Type t2) { Type unboxedT1 = types.unboxedTypeOrType(t1); Type unboxedT2 = types.unboxedTypeOrType(t2); if (unboxedT1.isNumeric() && unboxedT2.isNumeric()) { if (unboxedT1.hasTag(TypeTag.DOUBLE) || unboxedT2.hasTag(TypeTag.DOUBLE)) { return syms.doubleType; } else if (unboxedT1.hasTag(TypeTag.FLOAT) || unboxedT2.hasTag(TypeTag.FLOAT)) { return syms.floatType; } else if (unboxedT1.hasTag(TypeTag.LONG) || unboxedT2.hasTag(TypeTag.LONG)) { return syms.longType; } else { return syms.intType; } } else if (types.isSameType(unboxedT1, unboxedT2)) { return unboxedT1; } else { return syms.objectType; } }
Example #9
Source File: ElementsService.java From netbeans with Apache License 2.0 | 6 votes |
/** * Returns true if this element represents a method which overrides a * method in one of its superclasses. */ public boolean overridesMethod(ExecutableElement element) { MethodSymbol m = (MethodSymbol)element; if ((m.flags() & Flags.STATIC) == 0) { ClassSymbol owner = (ClassSymbol) m.owner; for (Type sup = jctypes.supertype(m.owner.type); sup.hasTag(TypeTag.CLASS); sup = jctypes.supertype(sup)) { for (Symbol sym : sup.tsym.members().getSymbolsByName(m.name)) { if (m.overrides(sym, owner, jctypes, true)) return true; } } } return false; }
Example #10
Source File: InferenceContext.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public Void visitUndetVar(UndetVar t, Void _unused) { if (min.add(t.qtype)) { Set<Type> deps = minMap.getOrDefault(t.qtype, new HashSet<>(Collections.singleton(t.qtype))); for (InferenceBound boundKind : InferenceBound.values()) { for (Type b : t.getBounds(boundKind)) { Type undet = asUndetVar(b); if (!undet.hasTag(TypeTag.UNDETVAR)) { visit(undet); } else if (isEquiv(t, b, boundKind)) { deps.add(b); equiv.add(b); } else { visit(undet); } } } minMap.put(t.qtype, deps); } return null; }
Example #11
Source File: Pool.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
Object makePoolValue(Object o) { if (o instanceof DynamicMethodSymbol) { return new DynamicMethod((DynamicMethodSymbol)o, types); } else if (o instanceof MethodSymbol) { return new Method((MethodSymbol)o, types); } else if (o instanceof VarSymbol) { return new Variable((VarSymbol)o, types); } else if (o instanceof Type) { Type t = (Type)o; // ClassRefs can come from ClassSymbols or from Types. // Return the symbol for these types to avoid duplicates // in the constant pool if (t.hasTag(TypeTag.CLASS)) return t.tsym; else return new UniqueType(t, types); } else { return o; } }
Example #12
Source File: JVMNames.java From annotation-tools with MIT License | 6 votes |
/** * Converts a method element into a JVML format method signature. * There is probably an API to do this, but I couldn't find it. * * @param methodElement the method element to convert * @return a String signature of methodElement in JVML format */ public static String getJVMMethodSignature(ExecutableElement methodElement) { StringBuilder builder = new StringBuilder(); String returnTypeStr; builder.append(methodElement.getSimpleName()); builder.append("("); TypeMirror returnType = methodElement.getReturnType(); returnTypeStr = typeToJvmlString((Type)returnType); for (VariableElement ve : methodElement.getParameters()) { Type vt = (Type) ve.asType(); if (vt.getTag() == TypeTag.TYPEVAR) { vt = vt.getUpperBound(); } builder.append(typeToJvmlString(vt)); } builder.append(")"); builder.append(returnTypeStr); return builder.toString(); }
Example #13
Source File: JVMNames.java From annotation-tools with MIT License | 5 votes |
/** * Converts a MethodTree into a JVML format method signature. * There is probably an API to do this, but I couldn't find it. * * @param methodTree the tree to convert * @return a String signature of methodTree in JVML format */ public static String getJVMMethodSignature(MethodTree methodTree) { ExecutableElement methodElement = ((JCMethodDecl) methodTree).sym; StringBuilder builder = new StringBuilder(); String returnTypeStr; builder.append(methodTree.getName()); builder.append("("); if (methodElement == null) { // use source AST in lieu of symbol table List<JCVariableDecl> params = ((JCMethodDecl) methodTree).params; JCVariableDecl param = params.head; JCExpression typeTree = ((JCMethodDecl) methodTree).restype; returnTypeStr = treeToJVMLString(typeTree); while (param != null) { builder.append(treeToJVMLString(param.vartype)); params = params.tail; param = params.head; } } else { TypeMirror returnType = methodElement.getReturnType(); returnTypeStr = typeToJvmlString((Type)returnType); for (VariableElement ve : methodElement.getParameters()) { Type vt = (Type) ve.asType(); if (vt.getTag() == TypeTag.TYPEVAR) { vt = vt.getUpperBound(); } builder.append(typeToJvmlString(vt)); } } builder.append(")"); builder.append(returnTypeStr); return builder.toString(); }
Example #14
Source File: DPrinter.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public Void visitTypeVar(TypeVar type, Void ignore) { // For TypeVars (and not subtypes), the bound should always be // null or bot. So, only print the bound for subtypes of TypeVar, // or if the bound is (erroneously) not null or bot. if (!type.hasTag(TypeTag.TYPEVAR) || !(type.bound == null || type.bound.hasTag(TypeTag.BOT))) { printType("bound", type.bound, Details.FULL); } printType("lower", type.lower, Details.FULL); return visitType(type, null); }
Example #15
Source File: ClassDocImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Return the superclass of this class. Return null if this is an * interface. A superclass is represented by either a * <code>ClassDoc</code> or a <code>ParameterizedType</code>. */ public com.sun.javadoc.Type superclassType() { if (isInterface() || isAnnotationType() || (tsym == env.syms.objectType.tsym)) return null; Type sup = env.types.supertype(type); return TypeMaker.getType(env, (sup.hasTag(TypeTag.NONE)) ? env.syms.objectType : sup); }
Example #16
Source File: GenStubs.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * field definitions: replace initializers with 0, 0.0, false etc * when possible -- i.e. leave public, protected initializers alone */ @Override public void visitVarDef(JCVariableDecl tree) { tree.mods = translate(tree.mods); tree.vartype = translate(tree.vartype); if (tree.init != null) { if ((tree.mods.flags & (Flags.PUBLIC | Flags.PROTECTED)) != 0) tree.init = translate(tree.init); else { String t = tree.vartype.toString(); if (t.equals("boolean")) tree.init = new JCLiteral(TypeTag.BOOLEAN, 0) { }; else if (t.equals("byte")) tree.init = new JCLiteral(TypeTag.BYTE, 0) { }; else if (t.equals("char")) tree.init = new JCLiteral(TypeTag.CHAR, 0) { }; else if (t.equals("double")) tree.init = new JCLiteral(TypeTag.DOUBLE, 0.d) { }; else if (t.equals("float")) tree.init = new JCLiteral(TypeTag.FLOAT, 0.f) { }; else if (t.equals("int")) tree.init = new JCLiteral(TypeTag.INT, 0) { }; else if (t.equals("long")) tree.init = new JCLiteral(TypeTag.LONG, 0) { }; else if (t.equals("short")) tree.init = new JCLiteral(TypeTag.SHORT, 0) { }; else tree.init = new JCLiteral(TypeTag.BOT, null) { }; } } result = tree; }
Example #17
Source File: JavaParserVisitor.java From rewrite with Apache License 2.0 | 5 votes |
private JavaType.Primitive primitive(TypeTag tag) { switch (tag) { case BOOLEAN: return JavaType.Primitive.Boolean; case BYTE: return JavaType.Primitive.Byte; case CHAR: return JavaType.Primitive.Char; case DOUBLE: return JavaType.Primitive.Double; case FLOAT: return JavaType.Primitive.Float; case INT: return JavaType.Primitive.Int; case LONG: return JavaType.Primitive.Long; case SHORT: return JavaType.Primitive.Short; case VOID: return JavaType.Primitive.Void; case NONE: return JavaType.Primitive.None; case CLASS: return JavaType.Primitive.String; case BOT: return JavaType.Primitive.Null; default: throw new IllegalArgumentException("Unknown type tag " + tag); } }
Example #18
Source File: DPrinter.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public Void visitTypeVar(TypeVar type, Void ignore) { // For TypeVars (and not subtypes), the bound should always be // null or bot. So, only print the bound for subtypes of TypeVar, // or if the bound is (erroneously) not null or bot. if (!type.hasTag(TypeTag.TYPEVAR) || !(type.bound == null || type.bound.hasTag(TypeTag.BOT))) { printType("bound", type.bound, Details.FULL); } printType("lower", type.lower, Details.FULL); return visitType(type, null); }
Example #19
Source File: Insertions.java From annotation-tools with MIT License | 5 votes |
/** Create a TypeTree from a scene-lib Type. */ static TypeTree fromType(final Type type) { switch (type.getKind()) { case ARRAY: final ArrayType atype = (ArrayType) type; final TypeTree componentType = fromType(atype.getComponentType()); return new ArrayTT(componentType); case BOUNDED: final BoundedType btype = (BoundedType) type; final BoundedType.BoundKind bk = btype.getBoundKind(); final String bname = btype.getName().getName(); final TypeTree bound = fromType(btype.getBound()); return new TypeParameterTT(bname, bk, bound); case DECLARED: final DeclaredType dtype = (DeclaredType) type; if (dtype.isWildcard()) { return new WildcardTT(); } else { final String dname = dtype.getName(); TypeTag typeTag = primTags.get(dname); if (typeTag == null) { final TypeTree base = new IdentifierTT(dname); TypeTree ret = base; List<Type> params = dtype.getTypeParameters(); DeclaredType inner = dtype.getInnerType(); if (!params.isEmpty()) { final List<Tree> typeArgs = new ArrayList<>(params.size()); for (Type t : params) { typeArgs.add(fromType(t)); } ret = new ParameterizedTypeTT(base, typeArgs); } return inner == null ? ret : addPrefix(fromType(inner), ret); } else { final TypeKind typeKind = typeTag.getPrimitiveTypeKind(); return new PrimitiveTypeTT(typeKind); } } default: throw new RuntimeException("unknown type kind " + type.getKind()); } }
Example #20
Source File: DPrinter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public Void visitTypeVar(TypeVar type, Void ignore) { // For TypeVars (and not subtypes), the bound should always be // null or bot. So, only print the bound for subtypes of TypeVar, // or if the bound is (erroneously) not null or bot. if (!type.hasTag(TypeTag.TYPEVAR) || !(type.bound == null || type.bound.hasTag(TypeTag.BOT))) { printType("bound", type.bound, Details.FULL); } printType("lower", type.lower, Details.FULL); return visitType(type, null); }
Example #21
Source File: MakeLiteralTest.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
void test(Object value, TypeTag tag, Type type, Object constValue) { JCLiteral l = maker.Literal(value); if (!l.type.hasTag(tag)) error("unexpected tag: " + l.getTag() + ": expected: " + tag); if (!types.isSameType(l.type, type)) error("unexpected type: " + l.type + ": expected: " + type); if (l.type.constValue().getClass() != constValue.getClass() || !constValue.equals(l.type.constValue())) { error("unexpected const value: " + l.type.constValue().getClass() + " " + l.type.constValue() + ": expected:" + constValue.getClass() + " " + constValue); } }
Example #22
Source File: T6889255.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
String getExpectedName(VarSymbol v, int i) { // special cases: // synthetic method if (((v.owner.owner.flags() & Flags.ENUM) != 0) && v.owner.name.toString().equals("valueOf")) return "name"; // interfaces don't have saved names // -- no Code attribute for the LocalVariableTable attribute if ((v.owner.owner.flags() & Flags.INTERFACE) != 0) return "arg" + (i - 1); // abstract methods don't have saved names // -- no Code attribute for the LocalVariableTable attribute if ((v.owner.flags() & Flags.ABSTRACT) != 0) return "arg" + (i - 1); // bridge methods use argN. No LVT for them anymore if ((v.owner.flags() & Flags.BRIDGE) != 0) return "arg" + (i - 1); // The rest of this method assumes the local conventions in the test program Type t = v.type; String s; if (t.hasTag(TypeTag.CLASS)) s = ((ClassType) t).tsym.name.toString(); else s = t.toString(); return String.valueOf(Character.toLowerCase(s.charAt(0))) + i; }
Example #23
Source File: T6889255.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
String getExpectedName(VarSymbol v, int i) { // special cases: // synthetic method if (((v.owner.owner.flags() & Flags.ENUM) != 0) && v.owner.name.toString().equals("valueOf")) return "name"; // interfaces don't have saved names // -- no Code attribute for the LocalVariableTable attribute if ((v.owner.owner.flags() & Flags.INTERFACE) != 0) return "arg" + (i - 1); // abstract methods don't have saved names // -- no Code attribute for the LocalVariableTable attribute if ((v.owner.flags() & Flags.ABSTRACT) != 0) return "arg" + (i - 1); // bridge methods use argN. No LVT for them anymore if ((v.owner.flags() & Flags.BRIDGE) != 0) return "arg" + (i - 1); // The rest of this method assumes the local conventions in the test program Type t = v.type; String s; if (t.hasTag(TypeTag.CLASS)) s = ((ClassType) t).tsym.name.toString(); else s = t.toString(); return String.valueOf(Character.toLowerCase(s.charAt(0))) + i; }
Example #24
Source File: ClassDocImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Return the superclass of this class. Return null if this is an * interface. A superclass is represented by either a * <code>ClassDoc</code> or a <code>ParameterizedType</code>. */ public com.sun.javadoc.Type superclassType() { if (isInterface() || isAnnotationType() || (tsym == env.syms.objectType.tsym)) return null; Type sup = env.types.supertype(type); return TypeMaker.getType(env, (sup.hasTag(TypeTag.NONE)) ? env.syms.objectType : sup); }
Example #25
Source File: Operators.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public boolean test(Type arg1, Type arg2) { TypeTag op1 = unaryPromotion(arg1).getTag(); TypeTag op2 = unaryPromotion(arg2).getTag(); return (op1 == TypeTag.LONG || op1 == TypeTag.INT) && (op2 == TypeTag.LONG || op2 == TypeTag.INT); }
Example #26
Source File: Operators.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * This routine applies following mappings: * - if input type is primitive, apply numeric promotion * - if input type is either 'void', 'null' or 'String' leave it untouched * - otherwise return 'Object' */ private Type stringPromotion(Type t) { if (t.isPrimitive()) { return unaryPromotion(t); } else if (t.hasTag(TypeTag.VOID) || t.hasTag(TypeTag.BOT) || types.isSameType(t, syms.stringType)) { return t; } else if (t.hasTag(TypeTag.TYPEVAR)) { return stringPromotion(t.getUpperBound()); } else { return syms.objectType; } }
Example #27
Source File: Operators.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public boolean test(Type arg1, Type arg2) { boolean hasStringOp = types.isSameType(arg1, syms.stringType) || types.isSameType(arg2, syms.stringType); boolean hasVoidOp = arg1.hasTag(TypeTag.VOID) || arg2.hasTag(TypeTag.VOID); return hasStringOp && !hasVoidOp; }
Example #28
Source File: InferenceContext.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public Void visitTypeVar(TypeVar t, Void aVoid) { Type undet = asUndetVar(t); if (undet.hasTag(TypeTag.UNDETVAR)) { visitUndetVar((UndetVar)undet, null); } return null; }
Example #29
Source File: GenStubs.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * field definitions: replace initializers with 0, 0.0, false etc * when possible -- i.e. leave public, protected initializers alone */ @Override public void visitVarDef(JCVariableDecl tree) { tree.mods = translate(tree.mods); tree.vartype = translate(tree.vartype); if (tree.init != null) { if ((tree.mods.flags & (Flags.PUBLIC | Flags.PROTECTED)) != 0) tree.init = translate(tree.init); else { String t = tree.vartype.toString(); if (t.equals("boolean")) tree.init = new JCLiteral(TypeTag.BOOLEAN, 0) { }; else if (t.equals("byte")) tree.init = new JCLiteral(TypeTag.BYTE, 0) { }; else if (t.equals("char")) tree.init = new JCLiteral(TypeTag.CHAR, 0) { }; else if (t.equals("double")) tree.init = new JCLiteral(TypeTag.DOUBLE, 0.d) { }; else if (t.equals("float")) tree.init = new JCLiteral(TypeTag.FLOAT, 0.f) { }; else if (t.equals("int")) tree.init = new JCLiteral(TypeTag.INT, 0) { }; else if (t.equals("long")) tree.init = new JCLiteral(TypeTag.LONG, 0) { }; else if (t.equals("short")) tree.init = new JCLiteral(TypeTag.SHORT, 0) { }; else tree.init = new JCLiteral(TypeTag.BOT, null) { }; } } result = tree; }
Example #30
Source File: ClassDocImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Return the superclass of this class. Return null if this is an * interface. A superclass is represented by either a * <code>ClassDoc</code> or a <code>ParameterizedType</code>. */ public com.sun.javadoc.Type superclassType() { if (isInterface() || isAnnotationType() || (tsym == env.syms.objectType.tsym)) return null; Type sup = env.types.supertype(type); return TypeMaker.getType(env, (sup.hasTag(TypeTag.NONE)) ? env.syms.objectType : sup); }