当前位置: 首页>>代码示例>>Java>>正文


Java Kinds.TYP属性代码示例

本文整理汇总了Java中com.sun.tools.javac.code.Kinds.TYP属性的典型用法代码示例。如果您正苦于以下问题:Java Kinds.TYP属性的具体用法?Java Kinds.TYP怎么用?Java Kinds.TYP使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.sun.tools.javac.code.Kinds的用法示例。


在下文中一共展示了Kinds.TYP属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: needsHeader

private boolean needsHeader(ClassSymbol c, boolean checkNestedClasses) {
    if (c.isLocal() || (c.flags() & Flags.SYNTHETIC) != 0)
        return false;

    for (Scope.Entry i = c.members_field.elems; i != null; i = i.sibling) {
        if (i.sym.kind == Kinds.MTH && (i.sym.flags() & Flags.NATIVE) != 0)
            return true;
        for (Attribute.Compound a: i.sym.getDeclarationAttributes()) {
            if (a.type.tsym == syms.nativeHeaderType.tsym)
                return true;
        }
    }
    if (checkNestedClasses) {
        for (Scope.Entry i = c.members_field.elems; i != null; i = i.sibling) {
            if ((i.sym.kind == Kinds.TYP) && needsHeader(((ClassSymbol) i.sym), true))
                return true;
        }
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:JNIWriter.java

示例2: visitVarDef

@Override
public void visitVarDef(JCVariableDecl tree) {
    boolean isJavacPack = tree.sym.outermostClass().fullname.toString()
            .contains(packageToCheck);
    if (isJavacPack &&
        (tree.sym.flags() & SYNTHETIC) == 0 &&
        tree.sym.owner.kind == Kinds.TYP) {
        if (!ignoreField(tree.sym.owner.flatName().toString(),
                tree.getName().toString())) {
            boolean enumClass = (tree.sym.owner.flags() & ENUM) != 0;
            boolean nonFinalStaticEnumField =
                    (tree.sym.flags() & (ENUM | FINAL)) == 0;
            boolean nonFinalStaticField =
                    (tree.sym.flags() & STATIC) != 0 &&
                    (tree.sym.flags() & FINAL) == 0;
            if (enumClass ? nonFinalStaticEnumField : nonFinalStaticField) {
                messages.error(tree, "crules.err.var.must.be.final", tree);
            }
        }
    }
    super.visitVarDef(tree);
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:22,代码来源:MutableFieldsAnalyzer.java

示例3: simplify

public String simplify(Symbol s) {
    String name = s.getQualifiedName().toString();
    if (!s.type.isCompound()) {
        List<Symbol> conflicts = nameClashes.get(s.getSimpleName());
        if (conflicts == null ||
                (conflicts.size() == 1 &&
                        conflicts.contains(s))) {
            List<Name> l = List.nil();
            Symbol s2 = s;
            while (s2.type.getEnclosingType().tag == CLASS
                    && s2.owner.kind == Kinds.TYP) {
                l = l.prepend(s2.getSimpleName());
                s2 = s2.owner;
            }
            l = l.prepend(s2.getSimpleName());
            StringBuilder buf = new StringBuilder();
            String sep = "";
            for (Name n2 : l) {
                buf.append(sep);
                buf.append(n2);
                sep = ".";
            }
            name = buf.toString();
        }
    }
    return name;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:27,代码来源:RichDiagnosticFormatter.java

示例4: visitClassDef

@Override
public void visitClassDef(JCClassDecl tree) {
    super.visitClassDef(tree);
    if (tree.sym == null) return;
    if (tree.sym.kind == Kinds.TYP || tree.sym.kind == Kinds.ERR) {
        ClassSymbol c = tree.sym;
        docenv.makeClassDoc(c, docenv.getTreePath(env.toplevel, tree));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:JavadocEnter.java

示例5: owner

/**
 * Return the class, interface, method, or constructor within
 * which this type variable is declared.
 */
public ProgramElementDoc owner() {
    Symbol osym = type.tsym.owner;
    if ((osym.kind & Kinds.TYP) != 0) {
        return env.getClassDoc((ClassSymbol)osym);
    }
    Names names = osym.name.table.names;
    if (osym.name == names.init) {
        return env.getConstructorDoc((MethodSymbol)osym);
    } else {
        return env.getMethodDoc((MethodSymbol)osym);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:TypeVariableImpl.java

示例6: simplify

public String simplify(Symbol s) {
    String name = s.getQualifiedName().toString();
    if (!s.type.isCompound() && !s.type.isPrimitive()) {
        List<Symbol> conflicts = nameClashes.get(s.getSimpleName());
        if (conflicts == null ||
            (conflicts.size() == 1 &&
            conflicts.contains(s))) {
            List<Name> l = List.nil();
            Symbol s2 = s;
            while (s2.type.hasTag(CLASS) &&
                    s2.type.getEnclosingType().hasTag(CLASS) &&
                    s2.owner.kind == Kinds.TYP) {
                l = l.prepend(s2.getSimpleName());
                s2 = s2.owner;
            }
            l = l.prepend(s2.getSimpleName());
            StringBuilder buf = new StringBuilder();
            String sep = "";
            for (Name n2 : l) {
                buf.append(sep);
                buf.append(n2);
                sep = ".";
            }
            name = buf.toString();
        }
    }
    return name;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:RichDiagnosticFormatter.java

示例7: visitClassDef

public void visitClassDef(JCClassDecl tree) {
    super.visitClassDef(tree);
    if (tree.sym != null && tree.sym.kind == Kinds.TYP) {
        if (tree.sym == null) return;
        String comment = env.toplevel.docComments.get(tree);
        ClassSymbol c = (ClassSymbol)tree.sym;
        docenv.makeClassDoc(c, comment, tree, env.toplevel.lineMap);
    }
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:9,代码来源:JavadocEnter.java

示例8: owner

/**
 * Return the class, interface, method, or constructor within
 * which this type variable is declared.
 */
public ProgramElementDoc owner() {
    Symbol osym = type.tsym.owner;
    if ((osym.kind & Kinds.TYP) != 0) {
        return env.getClassDoc((ClassSymbol)osym);
    }
    Name.Table names = osym.name.table;
    if (osym.name == names.init) {
        return env.getConstructorDoc((MethodSymbol)osym);
    } else {
        return env.getMethodDoc((MethodSymbol)osym);
    }
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:16,代码来源:TypeVariableImpl.java

示例9: visitClassDef

public void visitClassDef(JCClassDecl tree) {
    super.visitClassDef(tree);
    if (tree.sym != null && tree.sym.kind == Kinds.TYP) {
        if (tree.sym == null) return;
        String comment = env.toplevel.docComments.get(tree);
        ClassSymbol c = tree.sym;
        docenv.makeClassDoc(c, comment, tree, env.toplevel.lineMap);
    }
}
 
开发者ID:aducode,项目名称:openjdk-source-code-learn,代码行数:9,代码来源:JavadocEnter.java

示例10: simplify

public String simplify(Symbol s) {
    String name = s.getQualifiedName().toString();
    if (!s.type.isCompound()) {
        List<Symbol> conflicts = nameClashes.get(s.getSimpleName());
        if (conflicts == null ||
            (conflicts.size() == 1 &&
            conflicts.contains(s))) {
            List<Name> l = List.nil();
            Symbol s2 = s;
            while (s2.type.getEnclosingType().tag == CLASS
                    && s2.owner.kind == Kinds.TYP) {
                l = l.prepend(s2.getSimpleName());
                s2 = s2.owner;
            }
            l = l.prepend(s2.getSimpleName());
            StringBuilder buf = new StringBuilder();
            String sep = "";
            for (Name n2 : l) {
                buf.append(sep);
                buf.append(n2);
                sep = ".";
            }
            name = buf.toString();
        }
    }
    return name;
}
 
开发者ID:aducode,项目名称:openjdk-source-code-learn,代码行数:27,代码来源:RichDiagnosticFormatter.java

示例11: visitClassDef

@Override
public void visitClassDef(JCClassDecl tree) {
    super.visitClassDef(tree);
    if (tree.sym == null) return;
    if (tree.sym.kind == Kinds.TYP || tree.sym.kind == Kinds.ERR) {
        String comment = env.toplevel.docComments.get(tree);
        ClassSymbol c = tree.sym;
        docenv.makeClassDoc(c, comment, tree, env.toplevel.lineMap);
    }
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:10,代码来源:JavadocEnter.java

示例12: test

void test(String testName, boolean expectNames, String... opts) throws Exception {
    System.err.println("Test " + testName
            + ": expectNames:" + expectNames
            + " javacOpts:" + Arrays.asList(opts));

    File outDir = new File(testName);
    outDir.mkdirs();
    compile(outDir, opts);

    Context ctx = new Context();
    JavacFileManager fm = new JavacFileManager(ctx, true, null);
    fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(outDir));
    ClassReader cr = ClassReader.instance(ctx);
    cr.saveParameterNames = true;
    Names names = Names.instance(ctx);

    Set<String> classes = getTopLevelClasses(outDir);
    Deque<String> work = new LinkedList<String>(classes);
    String classname;
    while ((classname = work.poll()) != null) {
        System.err.println("Checking class " + classname);
        ClassSymbol sym = cr.enterClass(names.table.fromString(classname));
        sym.complete();

        if ((sym.flags() & Flags.INTERFACE) != 0 && !testInterfaces)
            continue;

        for (Scope.Entry e = sym.members_field.elems; e != null; e = e.sibling) {
            System.err.println("Checking member " + e.sym);
            switch (e.sym.kind) {
                case Kinds.TYP: {
                    String name = e.sym.flatName().toString();
                    if (!classes.contains(name)) {
                        classes.add(name);
                        work.add(name);
                    }
                    break;
                }
                case Kinds.MTH:
                    verify((MethodSymbol) e.sym, expectNames);
                    break;
            }

        }
    }
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:46,代码来源:T6889255.java

示例13: test

void test(String testName, boolean expectNames, String... opts) throws Exception {
    System.err.println("Test " + testName
            + ": expectNames:" + expectNames
            + " javacOpts:" + Arrays.asList(opts));

    File outDir = new File(testName);
    outDir.mkdirs();
    compile(outDir, opts);

    Context ctx = new Context();
    JavacFileManager fm = new JavacFileManager(ctx, true, null);
    fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(outDir));
    ClassReader cr = ClassReader.instance(ctx);
    cr.saveParameterNames = true;
    Name.Table names = Name.Table.instance(ctx);

    Set<String> classes = getTopLevelClasses(outDir);
    Deque<String> work = new LinkedList<String>(classes);
    String classname;
    while ((classname = work.poll()) != null) {
        System.err.println("Checking class " + classname);
        ClassSymbol sym = cr.enterClass(names.fromString(classname));
        sym.complete();

        if ((sym.flags() & Flags.INTERFACE) != 0 && !testInterfaces)
            continue;

        for (Scope.Entry e = sym.members_field.elems; e != null; e = e.sibling) {
            System.err.println("Checking member " + e.sym);
            switch (e.sym.kind) {
                case Kinds.TYP: {
                    String name = e.sym.flatName().toString();
                    if (!classes.contains(name)) {
                        classes.add(name);
                        work.add(name);
                    }
                    break;
                }
                case Kinds.MTH:
                    verify((MethodSymbol) e.sym, expectNames);
                    break;
            }

        }
    }
}
 
开发者ID:lucasicf,项目名称:metricgenerator-jdk-compiler,代码行数:46,代码来源:T6889255.java


注:本文中的com.sun.tools.javac.code.Kinds.TYP属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。