use of com.sun.tools.javac.util.Names in project ceylon-compiler by ceylon.
the class AnnotationTypeDocImpl method elements.
/**
* Returns the elements of this annotation type.
* Returns an empty array if there are none.
* Elements are always public, so no need to filter them.
*/
public AnnotationTypeElementDoc[] elements() {
Names names = tsym.name.table.names;
List<AnnotationTypeElementDoc> elements = List.nil();
for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) {
if (e.sym != null && e.sym.kind == Kinds.MTH) {
MethodSymbol s = (MethodSymbol) e.sym;
elements = elements.prepend(env.getAnnotationTypeElementDoc(s));
}
}
return elements.toArray(new AnnotationTypeElementDoc[elements.length()]);
}
use of com.sun.tools.javac.util.Names in project ceylon-compiler by ceylon.
the class ClassDocImpl method importedPackages.
/**
* Get the list of packages declared as imported.
* These are called "type-import-on-demand declarations" in the JLS.
* This method is deprecated in the ClassDoc interface.
*
* @return an array of PackageDocImpl representing the imported packages.
*
* ###NOTE: the syntax supports importing all inner classes from a class as well.
* @deprecated Import declarations are implementation details that
* should not be exposed here. In addition, this method's
* return type does not allow for all type-import-on-demand
* declarations to be returned.
*/
@Deprecated
public PackageDoc[] importedPackages() {
// information is not available for binary classfiles
if (tsym.sourcefile == null)
return new PackageDoc[0];
ListBuffer<PackageDocImpl> importedPackages = new ListBuffer<PackageDocImpl>();
//### Add the implicit "import java.lang.*" to the result
Names names = tsym.name.table.names;
importedPackages.append(env.getPackageDoc(env.reader.enterPackage(names.java_lang)));
Env<AttrContext> compenv = env.enter.getEnv(tsym);
if (compenv == null)
return new PackageDocImpl[0];
for (JCTree t : compenv.toplevel.defs) {
if (t.getTag() == JCTree.IMPORT) {
JCTree imp = ((JCImport) t).qualid;
if (TreeInfo.name(imp) == names.asterisk) {
JCFieldAccess sel = (JCFieldAccess) imp;
Symbol s = sel.selected.type.tsym;
PackageDocImpl pdoc = env.getPackageDoc(s.packge());
if (!importedPackages.contains(pdoc))
importedPackages.append(pdoc);
}
}
}
return importedPackages.toArray(new PackageDocImpl[importedPackages.length()]);
}
use of com.sun.tools.javac.util.Names in project ceylon-compiler by ceylon.
the class ClassDocImpl method constructors.
/**
* Return constructors in class.
*
* @param filter include only the included constructors if filter==true
* @return an array of ConstructorDocImpl for representing the visible
* constructors in this class.
*/
public ConstructorDoc[] constructors(boolean filter) {
Names names = tsym.name.table.names;
List<ConstructorDocImpl> constructors = List.nil();
for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) {
if (e.sym != null && e.sym.kind == Kinds.MTH && e.sym.name == names.init) {
MethodSymbol s = (MethodSymbol) e.sym;
if (!filter || env.shouldDocument(s)) {
constructors = constructors.prepend(env.getConstructorDoc(s));
}
}
}
//### Cache constructors here?
return constructors.toArray(new ConstructorDocImpl[constructors.length()]);
}
use of com.sun.tools.javac.util.Names in project ceylon-compiler by ceylon.
the class SerializedForm method mapSerialFieldTagImplsToFieldDocImpls.
/*
* Associate serialField tag fieldName with FieldDocImpl member.
* Note: A serialField tag does not have to map an existing field
* of a class.
*/
private void mapSerialFieldTagImplsToFieldDocImpls(FieldDocImpl spfDoc, DocEnv env, ClassSymbol def) {
Names names = def.name.table.names;
SerialFieldTag[] sfTag = spfDoc.serialFieldTags();
for (int i = 0; i < sfTag.length; i++) {
Name fieldName = names.fromString(sfTag[i].fieldName());
// Look for a FieldDocImpl that is documented by serialFieldTagImpl.
for (Scope.Entry e = def.members().lookup(fieldName); e.scope != null; e = e.next()) {
if (e.sym.kind == Kinds.VAR) {
VarSymbol f = (VarSymbol) e.sym;
FieldDocImpl fdi = env.getFieldDoc(f);
((SerialFieldTagImpl) (sfTag[i])).mapToFieldDocImpl(fdi);
break;
}
}
}
}
use of com.sun.tools.javac.util.Names in project ceylon-compiler by ceylon.
the class TypeVariableImpl method 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);
}
}
Aggregations