public void extractFromProjectSource(Collection<CompilationUnitDeclaration> units) { TypedefCollector collector = new TypedefCollector(units, false /*requireHide*/, true /*requireSourceRetention*/); typedefs = collector.getTypedefs(); typedefsToRemove = collector.getPrivateTypedefClasses(); for (CompilationUnitDeclaration unit : units) { analyze(unit); } }
@Override public boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope scope) { return recordTypedefs(typeDeclaration); }
public void extractFromProjectSource(Collection<CompilationUnitDeclaration> units) { TypedefCollector collector = new TypedefCollector(units, false /*requireHide*/, true /*requireSourceRetention*/); typedefs = collector.getTypedefs(); typedefClasses = collector.getNonPublicTypedefClasses(); for (CompilationUnitDeclaration unit : units) { analyze(unit); } }
if (mRequireHide && !javadocContainsHide(declaration.javadoc)) { Extractor.warning(getFileName() + ": The typedef annotation " + fqn + " should specify @hide in a doc comment"); Extractor.warning(getFileName() + ": The typedef annotation " + fqn + " should have @Retention(RetentionPolicy.SOURCE)"); if (declaration.binding != null && isHiddenTypeDef(declaration)) { StringBuilder sb = new StringBuilder(100); for (char c : declaration.binding.qualifiedPackageName()) {
String documentation = stringBuffer.toString(); if (!documentation.contains("@hide")) { Extractor.warning(getFileName() + ": The typedef annotation " + fqn + " should specify @hide in a doc comment"); Extractor.warning(getFileName() + ": The typedef annotation " + fqn + " should have @Retention(RetentionPolicy.SOURCE)");
@Override public boolean visit(TypeDeclaration localTypeDeclaration, BlockScope scope) { Annotation[] annotations = localTypeDeclaration.annotations; if (hasRelevantAnnotations(annotations)) { SourceTypeBinding binding = localTypeDeclaration.binding; if (binding == null) { return true; } if (binding.isAnnotationType() // Public typedef annotation need to be kept; they're not // removed by TypedefCollector#recordTypedefs so users may // end up referencing the typedef annotation itself && TypedefCollector.isHiddenTypeDef(localTypeDeclaration)) { return true; } String fqn = getFqn(scope); if (fqn == null) { fqn = new String(localTypeDeclaration.binding.readableName()); } Item item = ClassItem.create(fqn, ClassKind.forType(localTypeDeclaration)); addItem(fqn, item); addAnnotations(annotations, item); } return true; }
/** * Returns true if this type declaration for a typedef is hidden (e.g. should not * be extracted into an external annotation database) * * @param declaration the type declaration * @return true if the type is hidden */ @SuppressWarnings("RedundantIfStatement") public static boolean isHiddenTypeDef(@NonNull TypeDeclaration declaration) { if ((declaration.modifiers & ClassFileConstants.AccPublic) == 0) { return true; } if (Extractor.REMOVE_HIDDEN_TYPEDEFS && javadocContainsHide(declaration.javadoc)) { return true; } return false; }
@Override public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope scope) { Annotation[] annotations = memberTypeDeclaration.annotations; if (hasRelevantAnnotations(annotations)) { SourceTypeBinding binding = memberTypeDeclaration.binding; if (!(binding instanceof MemberTypeBinding)) { return true; } if (binding.isAnnotationType() && TypedefCollector.isHiddenTypeDef(memberTypeDeclaration) || binding.isAnonymousType()) { return true; } String fqn = new String(memberTypeDeclaration.binding.readableName()); Item item = ClassItem.create(fqn, ClassKind.forType(memberTypeDeclaration)); addItem(fqn, item); addAnnotations(annotations, item); } return true; }
@Override public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope scope) { return recordTypedefs(memberTypeDeclaration); }
@Override public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope scope) { return recordTypedefs(memberTypeDeclaration); }
@Override public boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope scope) { return recordTypedefs(typeDeclaration); }