当前位置: 首页>>代码示例>>Java>>正文


Java StandardLocation.CLASS_PATH属性代码示例

本文整理汇总了Java中javax.tools.StandardLocation.CLASS_PATH属性的典型用法代码示例。如果您正苦于以下问题:Java StandardLocation.CLASS_PATH属性的具体用法?Java StandardLocation.CLASS_PATH怎么用?Java StandardLocation.CLASS_PATH使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.tools.StandardLocation的用法示例。


在下文中一共展示了StandardLocation.CLASS_PATH属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: searchSubPackages

/**
 * Recursively search all directories in path for subdirectory name.
 * Add all packages found in such a directory to packages list.
 */
private Map<String,List<JavaFileObject>> searchSubPackages(
        List<String> subPackages,
        ListBuffer<String> packages,
        List<String> excludedPackages)
        throws IOException {
    Map<String,List<JavaFileObject>> packageFiles =
            new HashMap<String,List<JavaFileObject>>();

    Map<String,Boolean> includedPackages = new HashMap<String,Boolean>();
    includedPackages.put("", true);
    for (String p: excludedPackages)
        includedPackages.put(p, false);

    StandardLocation path = docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH)
            ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH;

    searchSubPackages(subPackages,
            includedPackages,
            packages, packageFiles,
            path,
            EnumSet.of(JavaFileObject.Kind.SOURCE));

    return packageFiles;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:JavadocTool.java

示例2: list

@Override
Iterable<DocFile> list(Location location, DocPath path) {
    Location l = ((location == StandardLocation.SOURCE_PATH)
            && !fileManager.hasLocation(StandardLocation.SOURCE_PATH))
            ? StandardLocation.CLASS_PATH
            : location;

    Set<DocFile> files = new LinkedHashSet<>();
    for (Path f: fileManager.getLocationAsPaths(l)) {
        if (Files.isDirectory(f)) {
            f = f.resolve(path.getPath());
            if (Files.exists(f))
                files.add(new StandardDocFile(f));
        }
    }
    return files;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:StandardDocFileFactory.java

示例3: testBasic

@Test
public void testBasic(Path base) throws IOException {
    try (StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
        Location[] locns = {
            StandardLocation.SOURCE_PATH,
            StandardLocation.CLASS_PATH,
            StandardLocation.PLATFORM_CLASS_PATH,
        };
        // set a value
        Path out = Files.createDirectories(base.resolve("out"));
        for (Location locn : locns) {
            checkException("unsupported for location",
                    IllegalArgumentException.class,
                    "location is not an output location or a module-oriented location: " + locn,
                    () -> fm.setLocationForModule(locn, "m", List.of(out)));
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:SetLocationForModule.java

示例4: getLocation

@Override
public Iterable<? extends File> getLocation(Location location) {
    org.openide.filesystems.FileObject[] roots;
    ClassPath cp = null;
    if (location == StandardLocation.SOURCE_PATH) {
        cp = cpInfo.getClassPath(ClasspathInfo.PathKind.SOURCE);
    } else if (location == StandardLocation.CLASS_PATH) {
        cp = cpInfo.getClassPath(ClasspathInfo.PathKind.COMPILE);
    } else if (location == StandardLocation.PLATFORM_CLASS_PATH) {
        cp = cpInfo.getClassPath(ClasspathInfo.PathKind.BOOT);
    }
    if (cp == null) {
        return null;
    }
    roots = cp.getRoots();
    if (roots == null || roots.length == 0) {
        return null;
    }
    List<File> res = new ArrayList<>(roots.length);
    for (org.openide.filesystems.FileObject f : roots) {
        File x = FileUtil.toFile(f);
        if (x != null) {
            res.add(x);
        }
    }
    return res;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:SwitchingJavaFileManger.java

示例5: fillIn

/** Load directory of package into members scope.
 */
private void fillIn(PackageSymbol p) throws IOException {
    if (p.members_field == null)
        p.members_field = WriteableScope.create(p);

    ModuleSymbol msym = p.modle;

    Assert.checkNonNull(msym, p::toString);

    msym.complete();

    if (msym == syms.noModule) {
        preferCurrent = false;
        if (userPathsFirst) {
            scanUserPaths(p, true);
            preferCurrent = true;
            scanPlatformPath(p);
        } else {
            scanPlatformPath(p);
            scanUserPaths(p, true);
        }
    } else if (msym.classLocation == StandardLocation.CLASS_PATH) {
        scanUserPaths(p, msym.sourceLocation == StandardLocation.SOURCE_PATH);
    } else {
        scanModulePaths(p, msym);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:ClassFinder.java

示例6: collectPubApisOfDependencies

private void collectPubApisOfDependencies(Context context,
                                          Collection<JavaFileObject> explicitJFOs) {
    PubAPIs pubApis = PubAPIs.instance(context);
    for (CompletionNode cDepNode : getDependencyNodes(context, explicitJFOs, false)) {
        ClassSymbol cs = cDepNode.getClassSymbol().outermostClass();
        Location loc = getLocationOf(cs);
        // We're completely ignorant of PLATFORM_CLASS_PATH classes
        if (loc == StandardLocation.CLASS_PATH || loc == StandardLocation.SOURCE_PATH)
            pubApis.visitPubapi(cs);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:NewDependencyCollector.java

示例7: hasLocation

@Override
public boolean hasLocation(Location location) {
    return location == StandardLocation.CLASS_PATH || location == StandardLocation.PLATFORM_CLASS_PATH;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:AsyncJavaSymbolDescriptor.java

示例8: containingPackage

/**
 * Return the package that this class is contained in.
 */
@Override
public PackageDoc containingPackage() {
    PackageDocImpl p = env.getPackageDoc(tsym.packge());
    if (p.setDocPath == false) {
        FileObject docPath;
        try {
            Location location = env.fileManager.hasLocation(StandardLocation.SOURCE_PATH)
                ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH;

            docPath = env.fileManager.getFileForInput(
                    location, p.qualifiedName(), "package.html");
        } catch (IOException e) {
            docPath = null;
        }

        if (docPath == null) {
            // fall back on older semantics of looking in same directory as
            // source file for this class
            SourcePosition po = position();
            if (env.fileManager instanceof StandardJavaFileManager &&
                    po instanceof SourcePositionImpl) {
                URI uri = ((SourcePositionImpl) po).filename.toUri();
                if ("file".equals(uri.getScheme())) {
                    File f = new File(uri);
                    File dir = f.getParentFile();
                    if (dir != null) {
                        File pf = new File(dir, "package.html");
                        if (pf.exists()) {
                            StandardJavaFileManager sfm = (StandardJavaFileManager) env.fileManager;
                            docPath = sfm.getJavaFileObjects(pf).iterator().next();
                        }
                    }

                }
            }
        }

        p.setDocPath(docPath);
    }
    return p;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:44,代码来源:ClassDocImpl.java

示例9: ClassPathLocationHandler

ClassPathLocationHandler() {
    super(StandardLocation.CLASS_PATH,
            Option.CLASSPATH, Option.CP);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:Locations.java

示例10: ClassPathLocationHandler

ClassPathLocationHandler() {
    super(StandardLocation.CLASS_PATH, Option.CLASS_PATH);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:3,代码来源:Locations.java

示例11: isSymbolRelevant

public boolean isSymbolRelevant(boolean cp, ClassSymbol cs) {
    Location csLoc = getLocationOf(cs);
    Location relevantLocation = cp ? StandardLocation.CLASS_PATH : StandardLocation.SOURCE_PATH;
    return csLoc == relevantLocation;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:NewDependencyCollector.java

示例12: defaultLocation

private Location defaultLocation() {
    JavaFileManager fm = configuration.docEnv.getJavaFileManager();
    return fm.hasLocation(StandardLocation.SOURCE_PATH)
            ? StandardLocation.SOURCE_PATH
            : StandardLocation.CLASS_PATH;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:6,代码来源:Utils.java


注:本文中的javax.tools.StandardLocation.CLASS_PATH属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。