本文整理匯總了Java中com.sun.tools.javac.code.Flags.INTERFACE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Flags.INTERFACE屬性的具體用法?Java Flags.INTERFACE怎麽用?Java Flags.INTERFACE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.sun.tools.javac.code.Flags
的用法示例。
在下文中一共展示了Flags.INTERFACE屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: visitClass
@Override
public Void visitClass(ClassTree node, Void aVoid) {
String className = node.getSimpleName().toString();
if (className.isEmpty()) {
className = "$" + ++anonymousClassCounter;
}
ModifiersTree modifiers = node.getModifiers();
final boolean processingInterface;
if (modifiers instanceof JCTree.JCModifiers) {
processingInterface = (((JCTree.JCModifiers) modifiers).flags & Flags.INTERFACE) != 0;
} else {
processingInterface = modifiers.toString().contains("interface");
}
classNames.push(className);
this.processingInterface.push(processingInterface);
try {
return withDefaultNotNullAnnotations(modifiers,
className + " class",
() -> super.visitClass(node, aVoid));
} finally {
classNames.pop();
this.processingInterface.pop();
}
}
示例2: visitMethodDef
/**
* methods: remove method bodies, make methods native
*/
@Override
public void visitMethodDef(JCMethodDecl tree) {
tree.mods = translate(tree.mods);
tree.restype = translate(tree.restype);
tree.typarams = translateTypeParams(tree.typarams);
tree.params = translateVarDefs(tree.params);
tree.thrown = translate(tree.thrown);
if (tree.body != null) {
if ((currClassMods & Flags.INTERFACE) != 0) {
tree.mods.flags &= ~(Flags.DEFAULT | Flags.STATIC);
} else {
tree.mods.flags |= Flags.NATIVE;
}
tree.body = null;
}
result = tree;
}
示例3: Interface
public ClassTree Interface(ModifiersTree modifiers,
CharSequence simpleName,
List<? extends TypeParameterTree> typeParameters,
List<? extends Tree> extendsClauses,
List<? extends Tree> memberDecls)
{
long flags = getBitFlags(modifiers.getFlags()) | Flags.INTERFACE;
return Class(flags, (com.sun.tools.javac.util.List<JCAnnotation>) modifiers.getAnnotations(), simpleName, typeParameters, null, extendsClauses, memberDecls);
}
示例4: getKind
public Kind getKind() {
if ((mods.flags & Flags.ANNOTATION) != 0)
return Kind.ANNOTATION_TYPE;
else if ((mods.flags & Flags.INTERFACE) != 0)
return Kind.INTERFACE;
else if ((mods.flags & Flags.ENUM) != 0)
return Kind.ENUM;
else
return Kind.CLASS;
}
示例5: getExpectedName
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;
}
示例6: isClass
/**Checks whether the given tree represents a class.
* @deprecated since 0.67, <code>Tree.getKind() == Kind.CLASS</code> should be used instead.
*/
@Deprecated
public boolean isClass(ClassTree tree) {
return (((JCTree.JCModifiers)tree.getModifiers()).flags & (Flags.INTERFACE | Flags.ENUM | Flags.ANNOTATION)) == 0;
}
示例7: isInterface
/**Checks whether the given tree represents an interface.
* @deprecated since 0.67, <code>Tree.getKind() == Kind.INTERFACE</code> should be used instead.
*/
@Deprecated
public boolean isInterface(ClassTree tree) {
final long flags = ((JCTree.JCModifiers) tree.getModifiers()).flags;
return (flags & Flags.INTERFACE) != 0 && (flags & Flags.ANNOTATION) == 0;
}
示例8: 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));
Symtab syms = Symtab.instance(ctx);
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 = syms.enterClass(syms.noModule, names.table.fromString(classname));
sym.complete();
if ((sym.flags() & Flags.INTERFACE) != 0 && !testInterfaces)
continue;
for (Symbol s : sym.members_field.getSymbols(NON_RECURSIVE)) {
System.err.println("Checking member " + s);
switch (s.kind) {
case TYP: {
String name = s.flatName().toString();
if (!classes.contains(name)) {
classes.add(name);
work.add(name);
}
break;
}
case MTH:
verify((MethodSymbol) s, expectNames);
break;
}
}
}
}