org.netbeans.spi.java.classpath.support.ClassPathSupport Java Examples

The following examples show how to use org.netbeans.spi.java.classpath.support.ClassPathSupport. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultClassPathProviderTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testCycle () throws Exception {
    GlobalPathRegistry regs = GlobalPathRegistry.getDefault();
    Set<ClassPath> toCleanUp = regs.getPaths(ClassPath.COMPILE);        
    regs.unregister(ClassPath.COMPILE, toCleanUp.toArray(new ClassPath[toCleanUp.size()]));
    toCleanUp = regs.getPaths(ClassPath.EXECUTE);        
    regs.unregister(ClassPath.EXECUTE, toCleanUp.toArray(new ClassPath[toCleanUp.size()]));
    File wdf = getWorkDir();
    FileObject wd = FileUtil.toFileObject(wdf);
    FileObject root1 = wd.createFolder("root1");
    FileObject root2 = wd.createFolder("root2");
    ClassPathProvider cpp = new DefaultClassPathProvider ();
    ClassPath dcp = cpp.findClassPath(root2, ClassPath.COMPILE);
    ClassPath cp = ClassPathSupport.createClassPath(new FileObject[] {root1});
    regs.register(ClassPath.COMPILE, new ClassPath[] {cp});        
    assertNotNull(dcp);
    FileObject[] roots = dcp.getRoots();
    assertEquals(1, roots.length);
    assertEquals(root1, roots[0]);
    
    regs.register(ClassPath.COMPILE, new ClassPath[] {dcp});
    roots = dcp.getRoots();
    assertEquals(1, roots.length);        
}
 
Example #2
Source File: ProjectClassPathImplementation.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private List<PathResourceImplementation> getPath() {
    List<PathResourceImplementation> result = new ArrayList<>();
    for (String p : propertyNames) {
        String prop = evaluator.getProperty(p);
        if (prop != null) {
            for (String piece : PropertyUtils.tokenizePath(prop)) {
                File f = PropertyUtils.resolveFile(projectFolder, piece);
                URL entry = FileUtil.urlForArchiveOrDir(f);
                if (entry != null) {
                    result.add(ClassPathSupport.createResource(entry));
                } else {
                    Logger.getLogger(ProjectClassPathImplementation.class.getName()).log(Level.WARNING, "{0} does not look like a valid archive file", f);
                }
            }
        }
    }
    return Collections.unmodifiableList(result);
}
 
Example #3
Source File: J2SEPlatformImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * This implementation simply reads and parses `java.class.path' property and creates a ClassPath
 * out of it.
 * @return  ClassPath that represents contents of system property java.class.path.
 */
@Override
public ClassPath getStandardLibraries() {
    synchronized (this) {
        ClassPath cp = (standardLibs == null ? null : standardLibs.get());
        if (cp != null)
            return cp;
        final String pathSpec = getSystemProperties().get(SYSPROP_JAVA_CLASS_PATH);
        if (pathSpec == null) {
            cp = ClassPathSupport.createClassPath(new URL[0]);
        }
        else {
            cp = Util.createClassPath (pathSpec);
        }
        standardLibs = new SoftReference<>(cp);
        return cp;
    }
}
 
Example #4
Source File: ShellProjectUtils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public static ClassPath projecRuntimeClassPath(Project project) {
    if (project == null) {
        return null;
    }
    boolean modular = isModularProject(project);
    List<ClassPath> delegates = new ArrayList<>();
    for (SourceGroup sg : org.netbeans.api.project.ProjectUtils.getSources(project).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA)) {
        if (!isNormalRoot(sg)) {
            continue;
        }
        ClassPath del; 
        if (modular) {
            del = ClassPath.getClassPath(sg.getRootFolder(), JavaClassPathConstants.MODULE_EXECUTE_CLASS_PATH);
        } else {
            del = ClassPath.getClassPath(sg.getRootFolder(), ClassPath.EXECUTE); 
        }
        if (del != null && !del.entries().isEmpty()) {
            delegates.add(del);
        }
    }
    return ClassPathSupport.createProxyClassPath(delegates.toArray(new ClassPath[delegates.size()]));
}
 
Example #5
Source File: RestSupport.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static ClassPath extendClassPathWithJaxRsApisIfNecessary(ClassPath classPath) {
    if (classPath.findResource("javax/ws/rs/core/Application.class") != null) {
        return classPath;
    }
    File jerseyRoot = InstalledFileLocator.getDefault().locate(JERSEY_API_LOCATION, "org.netbeans.modules.websvc.restlib", false);
    if (jerseyRoot != null && jerseyRoot.isDirectory()) {
        File[] jsr311Jars = jerseyRoot.listFiles(new MiscPrivateUtilities.JerseyFilter(JSR311_JAR_PATTERN));
        if (jsr311Jars != null && jsr311Jars.length>0) {
            FileObject fo = FileUtil.toFileObject(jsr311Jars[0]);
            if (fo != null) {
                fo = FileUtil.getArchiveRoot(fo);
                if (fo != null) {
                    return ClassPathSupport.createProxyClassPath(classPath,
                            ClassPathSupport.createClassPath(fo));
                }
            }
        }
    }
    return classPath;
}
 
Example #6
Source File: HintTestBase.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public ClassPath findClassPath(FileObject file, String type) {
    try {
    if (ClassPath.BOOT == type) {
        // XXX simpler to use JavaPlatformManager.getDefault().getDefaultPlatform().getBootstrapLibraries()
        return ClassPathSupport.createClassPath(getBootClassPath().toArray(new URL[0]));
    }

    if (ClassPath.SOURCE == type) {
        return sourcePath;
    }

    if (ClassPath.COMPILE == type) {
        return compileClassPath;
    }

    if (ClassPath.EXECUTE == type) {
        return ClassPathSupport.createClassPath(new FileObject[] {
            buildRoot
        });
    }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
Example #7
Source File: IndexerOrderingTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testEmbeddingIndexerOrdering() throws InterruptedException {
    assertTrue(GlobalPathRegistry.getDefault().getPaths(SRC_EMB).isEmpty());
    final RepositoryUpdaterTest.TestHandler handler = new RepositoryUpdaterTest.TestHandler();
    final Logger logger = Logger.getLogger(RepositoryUpdater.class.getName()+".tests"); //NOI18N
    logger.setLevel (Level.FINEST);
    logger.addHandler(handler);
    try {
        final ClassPath cp = ClassPathSupport.createClassPath(eroot);
        calls.clear();
        globalPathRegistry_register(SRC_EMB, new ClassPath[]{cp});
        assertTrue (handler.await());
        assertEquals(5, calls.size());
        final Iterator<SourceIndexerFactory> callsIt = calls.iterator();
        for (int i=1; i<=5; i++) {
            assertEquals(
                String.format("EI%d",i),    //NOI18N
                callsIt.next().getIndexerName());
        }
        
    } finally {
        logger.removeHandler(handler);
    }
}
 
Example #8
Source File: GlobalAndroidClassPathRegistry.java    From NBANDROID-V2 with Apache License 2.0 6 votes vote down vote up
public synchronized static final ClassPath getClassPath(final String id, URL[] urls) {
    if (urls.length == 0) {
        return ClassPath.EMPTY;
    } else {
        ClassPath tmp[] = new ClassPath[urls.length];
        for (int i = 0; i < urls.length; i++) {
            ClassPath classPath = cache.get(urls[i]);
            if (classPath == null) {
                classPath = ClassPathSupport.createClassPath(urls[i]);
                cache.put(urls[i], classPath);
            }
            tmp[i] = classPath;
        }
        return ClassPathSupport.createProxyClassPath(tmp);
    }

}
 
Example #9
Source File: TypeMirrorHandleTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void DISABLEDtestTypeMirrorHandle196070() throws Exception {
    prepareTest();
    writeIntoFile(testSource, "package test; public class Test<T extends IA & IB> {} interface IA {} interface IB {}");
    ClassPath empty = ClassPathSupport.createClassPath(new URL[0]);
    JavaSource js = JavaSource.create(ClasspathInfo.create(ClassPathSupport.createClassPath(SourceUtilsTestUtil.getBootClassPath().toArray(new URL[0])), empty, empty), testSource);
    final boolean[] finished = new boolean[1];

    js.runUserActionTask(new Task<CompilationController>() {
        public void run(CompilationController info) throws Exception {
            info.toPhase(Phase.RESOLVED);
            TypeMirror tm = info.getTreeUtilities().parseType("T", info.getTopLevelElements().get(0));
            assertTrue(info.getTypes().isSameType(tm, TypeMirrorHandle.create(tm).resolve(info)));
            finished[0] = true;
        }
    }, true);

    assertTrue(finished[0]);
}
 
Example #10
Source File: JsfModelProviderImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static ClassPath getClassPath(Project project, String type) {
    ClassPathProvider provider = project.getLookup().lookup(
            ClassPathProvider.class);
    if (provider == null) {
        return null;
    }
    Sources sources = ProjectUtils.getSources(project);
    if (sources == null) {
        return null;
    }
    SourceGroup[] sourceGroups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
    for (SourceGroup sourceGroup : sourceGroups) {
        FileObject rootFolder = sourceGroup.getRootFolder();
        ClassPath path = provider.findClassPath(rootFolder, type);
        // return classpath of the first source group, that is ignore test source roots:
        return ClassPathSupport.createProxyClassPath(path);
    }
    return null;
}
 
Example #11
Source File: IndexerOrderingTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testCustomIndexerOrdering() throws InterruptedException {
    assertTrue(GlobalPathRegistry.getDefault().getPaths(SRC_FOO).isEmpty());
    final RepositoryUpdaterTest.TestHandler handler = new RepositoryUpdaterTest.TestHandler();
    final Logger logger = Logger.getLogger(RepositoryUpdater.class.getName()+".tests"); //NOI18N
    logger.setLevel (Level.FINEST);
    logger.addHandler(handler);
    try {
        final ClassPath cp = ClassPathSupport.createClassPath(froot);
        calls.clear();
        globalPathRegistry_register(SRC_FOO, new ClassPath[]{cp});
        assertTrue (handler.await());
        assertEquals(5, calls.size());
        final Iterator<SourceIndexerFactory> callsIt = calls.iterator();
        for (int i=1; i<=5; i++) {
            assertEquals(
                String.format("CI%d",i),    //NOI18N
                callsIt.next().getIndexerName());
        }
    } finally {
        logger.removeHandler(handler);
    }
}
 
Example #12
Source File: JavadocRegistry.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Returns Array of the Javadoc Index roots
 */
public URL[] getDocRoots() {
    synchronized (this) {
        if (this.docRoots != null) {
            return docRoots();
        }
    }        
    //XXX must be called out of synchronized block to prevent
    // deadlock. throwCache is called under the ProjectManager.mutex
    // write lock and Project's SFBQI requires the ProjectManager.mutex readLock
    Set<ClassPath> _classpaths = new HashSet<ClassPath>();
    Set<JavadocForBinaryQuery.Result> _results = new HashSet<JavadocForBinaryQuery.Result>();
    Set<URL> s = readRoots(this, _classpaths, _results);
    synchronized (this) {
        if (this.docRoots == null) {
            this.docRoots = ClassPathSupport.createClassPath(s.toArray(new URL[s.size()]));
            this.classpaths = _classpaths;
            this.results = _results;
            registerListeners(this, _classpaths, _results, this.docRoots);
        }
        return docRoots();
    }
}
 
Example #13
Source File: Utils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@CheckForNull
public static FileObject getFile(
        @NonNull final ElementHandle<TypeElement> toResolve,
        @NonNull final ClasspathInfo cpInfo) {
    FileObject res = SourceUtils.getFile(toResolve, cpInfo);
    if (res == null) {
        final ClassPath cp = ClassPathSupport.createProxyClassPath(
                cpInfo.getClassPath(ClasspathInfo.PathKind.BOOT),
                cpInfo.getClassPath(ClasspathInfo.PathKind.COMPILE));
        res = cp.findResource(String.format(
                "%s.%s",    //NOI18N
                toResolve.getBinaryName().replace('.', '/'),    //NOI18N
                CLASS_EXTENSION));
    }
    return res;
}
 
Example #14
Source File: JPDAStart.java    From netbeans with Apache License 2.0 6 votes vote down vote up
static ClassPath createJDKSourcePath (
    Project project,
    Path bootclasspath
) {
    if (bootclasspath == null) {
        // if current platform is default one, bootclasspath is set to null
        JavaPlatform jp = JavaPlatform.getDefault();
        if (jp != null) {
            return jp.getSourceFolders ();
        } else {
            return ClassPathSupport.createClassPath(java.util.Collections.EMPTY_LIST);
        }
    } else {
        return convertToSourcePath (project, bootclasspath, false);
    }
}
 
Example #15
Source File: PHPCodeCompletion204847Test.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Map<String, ClassPath> createClassPathsForTest() {
    return Collections.singletonMap(
        PhpSourcePath.SOURCE_CP,
        ClassPathSupport.createClassPath(new FileObject[] {
            FileUtil.toFileObject(new File(getDataDir(), "/testfiles/completion/lib/test204847/"))
        })
    );
}
 
Example #16
Source File: ClassPathProviderImplTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void setUp() throws Exception {
    // setup some platforms -- needed for testing findClassPath(FileObject, ClassPath.BOOT)
    FileObject scratch = TestUtil.makeScratchDir(this);

    FileObject defaultPlatformBootRoot = scratch.createFolder(DEFAULT_PLATFORM_ROOT);
    ClassPath defBCP = ClassPathSupport.createClassPath(new URL[] { defaultPlatformBootRoot.getURL() });

    MockLookup.setLayersAndInstances(new TestPlatformProvider(defBCP, defBCP));

    assertTrue("No Java platforms found.", JavaPlatformManager.getDefault().getInstalledPlatforms().length >= 2);
    
    // setup the project
    File f = new File(getDataDir().getAbsolutePath(), "projects/ApplicationClient1");
    project = (Project) ProjectSupport.openProject(f);
    Sources src = project.getLookup().lookup(Sources.class);
    SourceGroup[] groups = src.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
    
    sourceRoot = findSourceRoot(groups, "${src.dir}");
    assertNotNull(sourceRoot);
    testRoot = findSourceRoot(groups, "${test.src.dir}");
    assertNotNull(testRoot);
    
    sourceClass = sourceRoot.getFileObject("applicationclient1/NewClass.java");
    assertNotNull(sourceClass);
    testClass = testRoot.getFileObject("applicationclient1/NewClassTest.java");
    assertNotNull(testClass);
}
 
Example #17
Source File: PHPCodeCompletion236184Test.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Map<String, ClassPath> createClassPathsForTest() {
    return Collections.singletonMap(
        PhpSourcePath.SOURCE_CP,
        ClassPathSupport.createClassPath(new FileObject[] {
            FileUtil.toFileObject(new File(getDataDir(), "/testfiles/completion/lib/tests236184/"))
        })
    );
}
 
Example #18
Source File: PHPCodeCompletion270237Test.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Map<String, ClassPath> createClassPathsForTest() {
    return Collections.singletonMap(
        PhpSourcePath.SOURCE_CP,
        ClassPathSupport.createClassPath(new FileObject[]{
            FileUtil.toFileObject(new File(getDataDir(), "/testfiles/completion/lib/tests270237/"))
        })
    );
}
 
Example #19
Source File: PHPCodeCompletion240523Test.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Map<String, ClassPath> createClassPathsForTest() {
    return Collections.singletonMap(
        PhpSourcePath.SOURCE_CP,
        ClassPathSupport.createClassPath(new FileObject[] {
            FileUtil.toFileObject(new File(getDataDir(), "/testfiles/completion/lib/tests240523/"))
        })
    );
}
 
Example #20
Source File: JsCodeCompletionParamTypesTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Map<String, ClassPath> createClassPathsForTest() {
    List<FileObject> cpRoots = new LinkedList<FileObject>(ClasspathProviderImplAccessor.getJsStubs());
    cpRoots.add(FileUtil.toFileObject(new File(getDataDir(), "/testfiles/completion/paramTypes")));
    cpRoots.add(FileUtil.toFileObject(new File(getDataDir(), "/testfiles/completion/lib")));
    return Collections.singletonMap(
        JS_SOURCE_ID,
        ClassPathSupport.createClassPath(cpRoots.toArray(new FileObject[cpRoots.size()]))
    );
}
 
Example #21
Source File: PSR0HintTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Map<String, ClassPath> createClassPathsForTest() {
    return Collections.singletonMap(
        PhpSourcePath.SOURCE_CP,
        ClassPathSupport.createClassPath(new FileObject[] {
            FileUtil.toFileObject(new File(getDataDir(), "/" + TEST_DIRECTORY + getTestDir()))
        })
    );
}
 
Example #22
Source File: PHPCodeCompletion267226_02Test.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Map<String, ClassPath> createClassPathsForTest() {
    return Collections.singletonMap(
        PhpSourcePath.SOURCE_CP,
        ClassPathSupport.createClassPath(new FileObject[]{
            FileUtil.toFileObject(new File(getDataDir(), "/testfiles/completion/lib/tests267226_02/"))
        })
    );
}
 
Example #23
Source File: MultiModule.java    From netbeans with Apache License 2.0 5 votes vote down vote up
CPImpl(final Collection<? extends URL> roots) {
    this.cache = new AtomicReference<>(Collections.unmodifiableList(
            roots.stream()
                    .map((root) -> ClassPathSupport.createResource(root))
                    .collect(Collectors.toList())));
    this.listeners = new PropertyChangeSupport(this);
}
 
Example #24
Source File: PHPArrayCodeCompletionTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Map<String, ClassPath> createClassPathsForTest() {
    return Collections.singletonMap(
        PhpSourcePath.SOURCE_CP,
        ClassPathSupport.createClassPath(new FileObject[] {
            FileUtil.toFileObject(new File(getDataDir(), "/testfiles/completion/lib/arrays/"))
        })
    );
}
 
Example #25
Source File: ClassIndexTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testFindSymbols() throws Exception {
    final FileObject wd = FileUtil.toFileObject(getWorkDir());
    final FileObject root = FileUtil.createFolder(wd,"src");    //NOI18N
    sourcePath = ClassPathSupport.createClassPath(root);
    compilePath = ClassPathSupport.createClassPath(new URL[0]);
    bootPath = JavaPlatformManager.getDefault().getDefaultPlatform().getBootstrapLibraries();
    final FileObject t1 = createJavaFile(
            root,
            "test",                                          //NOI18N
            "Test",                                          //NOI18N
            "package test;\n"+                               //NOI18N
            "public class Test { private void foo() { } }"); //NOI18N
    final FileObject t2 = createJavaFile(
            root,
            "test",                                          //NOI18N
            "foo",                                           //NOI18N
            "package test;\n"+                               //NOI18N
            "public class foo {\n"+                          //NOI18N
            "}");                                            //NOI18N
    IndexingManager.getDefault().refreshIndexAndWait(root.toURL(), null);
    final ClassIndex ci = ClasspathInfo.create(bootPath, compilePath, sourcePath).getClassIndex();
    assertNotNull(ci);
    Iterable<Symbols> result = ci.getDeclaredSymbols("foo", NameKind.SIMPLE_NAME,
        EnumSet.<ClassIndex.SearchScope>of(ClassIndex.SearchScope.SOURCE));
    Set<String> actualResult = new HashSet<String>();
    for (Symbols s : result) {
        actualResult.add(s.getEnclosingType().getQualifiedName() + ":" + s.getSymbols().toString());
    }
    assertEquals(new HashSet<String>(Arrays.asList("test.foo:[foo]", "test.Test:[foo]")), actualResult);
}
 
Example #26
Source File: HintTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public ClassPath findClassPath(FileObject file, String type) {
    try {
    if (ClassPath.BOOT == type) {
        return BootClassPathUtil.getBootClassPath();
    }

    if (JavaClassPathConstants.MODULE_BOOT_PATH == type) {
        return BootClassPathUtil.getModuleBootPath();
    }

    if (ClassPath.SOURCE == type) {
        return sourcePath;
    }

    if (ClassPath.COMPILE == type) {
        return compileClassPath;
    }

    if (ClassPath.EXECUTE == type) {
        return ClassPathSupport.createClassPath(new FileObject[] {
            buildRoot
        });
    }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
Example #27
Source File: ParamDeclTypes68Test.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Map<String, ClassPath> createClassPathsForTest() {
    return Collections.singletonMap(
            PhpSourcePath.SOURCE_CP,
            ClassPathSupport.createClassPath(new FileObject[]{
                FileUtil.toFileObject(new File(getDataDir(), "/testfiles/completion/lib/netbeans68version/paramdecltypes"))
            }));
}
 
Example #28
Source File: PHPCodeCompletion225687Test.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Map<String, ClassPath> createClassPathsForTest() {
    return Collections.singletonMap(
        PhpSourcePath.SOURCE_CP,
        ClassPathSupport.createClassPath(new FileObject[] {
            FileUtil.toFileObject(new File(getDataDir(), "/testfiles/completion/lib/tests225687/"))
        })
    );
}
 
Example #29
Source File: J2SELibraryClassPathProvider.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private ClassPath[] findClassPathOrNull(
        @NonNull final FileObject file,
        @NonNull final String type,
        @NonNull final Library lib) {
    if (lib.getType().equals(J2SELibraryTypeProvider.LIBRARY_TYPE)) {
        List<URL> resources = lib.getContent(J2SELibraryTypeProvider.VOLUME_TYPE_SRC);
        try {                
            FileObject root = getOwnerRoot(file,resources);
            if (root != null) {
                final JavaPlatform defPlatform = JavaPlatformManager.getDefault().getDefaultPlatform();
                setLastUsedLibrary(root, lib);
                if (ClassPath.SOURCE.equals(type)) {
                    return new ClassPath[] {ClassPathSupport.createClassPath(resources.toArray(new URL[resources.size()]))};
                } else if (ClassPath.COMPILE.equals(type)) {
                    resources = lib.getContent(J2SELibraryTypeProvider.VOLUME_TYPE_CLASSPATH);
                    return new ClassPath[] {ClassPathSupport.createClassPath(resources.toArray(new URL[resources.size()]))};
                } else if (ClassPath.BOOT.equals(type)) {
                    return new ClassPath[] {defPlatform.getBootstrapLibraries()};
                } else if (JavaClassPathConstants.MODULE_BOOT_PATH.equals(type) &&
                        Util.JDK9.compareTo(defPlatform.getSpecification().getVersion()) <= 0) {
                    return new ClassPath[] {defPlatform.getBootstrapLibraries()};
                } else {
                    return new ClassPath[] {null};
                }
            }
        } catch (final IllegalArgumentException e) {
            final IllegalArgumentException ne = new IllegalArgumentException("LibraryImplementation:["+getImplClassName(lib)+"] returned wrong root:" + e.getMessage());
            Exceptions.printStackTrace(ne.initCause(e));
        }
    }
    return null;
}
 
Example #30
Source File: PHPCodeCompletion171178Test.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Map<String, ClassPath> createClassPathsForTest() {
    return Collections.singletonMap(
        PhpSourcePath.SOURCE_CP,
        ClassPathSupport.createClassPath(new FileObject[] {
            FileUtil.toFileObject(new File(getDataDir(), "testfiles/completion/lib/test171178"))
        })
    );
}