當前位置: 首頁>>代碼示例>>Java>>正文


Java JavaFileObject.isNameCompatible方法代碼示例

本文整理匯總了Java中javax.tools.JavaFileObject.isNameCompatible方法的典型用法代碼示例。如果您正苦於以下問題:Java JavaFileObject.isNameCompatible方法的具體用法?Java JavaFileObject.isNameCompatible怎麽用?Java JavaFileObject.isNameCompatible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.tools.JavaFileObject的用法示例。


在下文中一共展示了JavaFileObject.isNameCompatible方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: extraFileActions

import javax.tools.JavaFileObject; //導入方法依賴的package包/類
/**
 * Override extraFileActions to check for package documentation
 */
@Override
protected void extraFileActions(PackageSymbol pack, JavaFileObject fo) {
    if (fo.isNameCompatible("package", JavaFileObject.Kind.HTML)) {
        pack.sourcefile = fo;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:10,代碼來源:JavadocClassFinder.java

示例2: isPkgInfo

import javax.tools.JavaFileObject; //導入方法依賴的package包/類
private boolean isPkgInfo(JavaFileObject fo, JavaFileObject.Kind kind) {
    return fo.isNameCompatible("package-info", kind);
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:4,代碼來源:JavacProcessingEnvironment.java

示例3: scan

import javax.tools.JavaFileObject; //導入方法依賴的package包/類
public Void scan(DocCommentTree tree, TreePath p) {
    env.setCurrent(p, tree);

    boolean isOverridingMethod = !env.currOverriddenMethods.isEmpty();

    if (p.getLeaf() == p.getCompilationUnit()) {
        // If p points to a compilation unit, the implied declaration is the
        // package declaration (if any) for the compilation unit.
        // Handle this case specially, because doc comments are only
        // expected in package-info files.
        JavaFileObject fo = p.getCompilationUnit().getSourceFile();
        boolean isPkgInfo = fo.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE);
        if (tree == null) {
            if (isPkgInfo)
                reportMissing("dc.missing.comment");
            return null;
        } else {
            if (!isPkgInfo)
                reportReference("dc.unexpected.comment");
        }
    } else {
        if (tree == null) {
            if (!isSynthetic() && !isOverridingMethod)
                reportMissing("dc.missing.comment");
            return null;
        }
    }

    tagStack.clear();
    currHeaderTag = null;

    foundParams.clear();
    foundThrows.clear();
    foundInheritDoc = false;
    foundReturn = false;

    scan(new DocTreePath(p, tree), null);

    if (!isOverridingMethod) {
        switch (env.currElement.getKind()) {
            case METHOD:
            case CONSTRUCTOR: {
                ExecutableElement ee = (ExecutableElement) env.currElement;
                checkParamsDocumented(ee.getTypeParameters());
                checkParamsDocumented(ee.getParameters());
                switch (ee.getReturnType().getKind()) {
                    case VOID:
                    case NONE:
                        break;
                    default:
                        if (!foundReturn
                                && !foundInheritDoc
                                && !env.types.isSameType(ee.getReturnType(), env.java_lang_Void)) {
                            reportMissing("dc.missing.return");
                        }
                }
                checkThrowsDocumented(ee.getThrownTypes());
            }
        }
    }

    return null;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:64,代碼來源:Checker.java

示例4: extraFileActions

import javax.tools.JavaFileObject; //導入方法依賴的package包/類
/**
 * Override extraFileActions to check for package documentation
 */
@Override
protected void extraFileActions(PackageSymbol pack, JavaFileObject fo) {
    if (fo.isNameCompatible("package", JavaFileObject.Kind.HTML))
        docenv.getPackageDoc(pack).setDocPath(fo);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:9,代碼來源:JavadocClassReader.java

示例5: scan

import javax.tools.JavaFileObject; //導入方法依賴的package包/類
public Void scan(DocCommentTree tree, TreePath p) {
    env.initTypes();
    env.setCurrent(p, tree);

    boolean isOverridingMethod = !env.currOverriddenMethods.isEmpty();
    JavaFileObject fo = p.getCompilationUnit().getSourceFile();

    if (p.getLeaf().getKind() == Tree.Kind.PACKAGE) {
        // If p points to a package, the implied declaration is the
        // package declaration (if any) for the compilation unit.
        // Handle this case specially, because doc comments are only
        // expected in package-info files.
        boolean isPkgInfo = fo.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE);
        if (tree == null) {
            if (isPkgInfo)
                reportMissing("dc.missing.comment");
            return null;
        } else {
            if (!isPkgInfo)
                reportReference("dc.unexpected.comment");
        }
    } else if (tree != null && fo.isNameCompatible("package", JavaFileObject.Kind.HTML)) {
        // a package.html file with a DocCommentTree
        if (tree.getFullBody().isEmpty()) {
            reportMissing("dc.missing.comment");
            return null;
        }
    } else {
        if (tree == null) {
            if (!isSynthetic() && !isOverridingMethod)
                reportMissing("dc.missing.comment");
            return null;
        }
    }

    tagStack.clear();
    currHeaderTag = null;

    foundParams.clear();
    foundThrows.clear();
    foundInheritDoc = false;
    foundReturn = false;
    hasNonWhitespaceText = false;

    scan(new DocTreePath(p, tree), null);

    if (!isOverridingMethod) {
        switch (env.currElement.getKind()) {
            case METHOD:
            case CONSTRUCTOR: {
                ExecutableElement ee = (ExecutableElement) env.currElement;
                checkParamsDocumented(ee.getTypeParameters());
                checkParamsDocumented(ee.getParameters());
                switch (ee.getReturnType().getKind()) {
                    case VOID:
                    case NONE:
                        break;
                    default:
                        if (!foundReturn
                                && !foundInheritDoc
                                && !env.types.isSameType(ee.getReturnType(), env.java_lang_Void)) {
                            reportMissing("dc.missing.return");
                        }
                }
                checkThrowsDocumented(ee.getThrownTypes());
            }
        }
    }

    return null;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:72,代碼來源:Checker.java

示例6: isModuleInfo

import javax.tools.JavaFileObject; //導入方法依賴的package包/類
private boolean isModuleInfo(JavaFileObject fo, JavaFileObject.Kind kind) {
    return fo.isNameCompatible("module-info", kind);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:4,代碼來源:JavacProcessingEnvironment.java


注:本文中的javax.tools.JavaFileObject.isNameCompatible方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。