本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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));
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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;
}
}
}
}
示例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;
}
}
}
}