当前位置: 首页>>代码示例>>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;未经允许,请勿转载。