private boolean isIncompleteClassPath() { return cpInfo.getClassPath(ClasspathInfo.PathKind.BOOT).getFlags().contains(ClassPath.Flag.INCOMPLETE) || cpInfo.getClassPath(ClasspathInfo.PathKind.COMPILE).getFlags().contains(ClassPath.Flag.INCOMPLETE) || cpInfo.getClassPath(ClasspathInfo.PathKind.SOURCE).getFlags().contains(ClassPath.Flag.INCOMPLETE); }
public static String getCommandLine(ClasspathInfo cpInfo) { ClassPath sourceCP = cpInfo.getClassPath(PathKind.SOURCE); FileObject[] roots = sourceCP != null ? sourceCP.getRoots() : new FileObject[0]; FileObject file = roots.length > 0 ? roots[0] : null; for (CompilerSettings cs : Lookup.getDefault().lookupAll(CompilerSettings.class)) { String cl = cs.buildCommandLine(file); if (cl != null) return cl; } return ""; }
public void run(CompilationController controller) throws Exception { ClassPath cp = info.getClassPath(ClasspathInfo.PathKind.BOOT); PropertyChangeListener wcl = WeakListeners.propertyChange(PaletteMap.this, cp); cp.addPropertyChangeListener(wcl); } }
public void run(CompilationController cc) throws Exception { ClassPath cp = info.getClassPath(ClasspathInfo.PathKind.BOOT); PropertyChangeListener wcl = WeakListeners.propertyChange(MidpJavaSupport.this, cp); cp.addPropertyChangeListener(wcl); } };
private void preinitJavaInfrastructure() throws IOException { if (needClassPathInit) { try { ClasspathInfo cpInfo = mappings.runReadActionWhenReady(new MetadataModelAction<EntityMappingsMetadata, ClasspathInfo>() { @Override public ClasspathInfo run(EntityMappingsMetadata metadata) { return metadata.createJavaSource().getClasspathInfo(); } }).get(); GlobalPathRegistry.getDefault().register(ClassPath.BOOT, new ClassPath[] { cpInfo.getClassPath(PathKind.BOOT) }); GlobalPathRegistry.getDefault().register(ClassPath.COMPILE, new ClassPath[] { cpInfo.getClassPath(PathKind.COMPILE) }); GlobalPathRegistry.getDefault().register(ClassPath.SOURCE, new ClassPath[] { cpInfo.getClassPath(PathKind.SOURCE) }); } catch (InterruptedException ex) { Logger.getLogger(getClass().getName()).log(Level.INFO, ex.getMessage(), ex); } catch (ExecutionException ex) { Logger.getLogger(getClass().getName()).log(Level.INFO, ex.getMessage(), ex); } catch (MetadataModelException ex) { Logger.getLogger(getClass().getName()).log(Level.INFO, ex.getMessage(), ex); } } }
private void refreshLocation(String fqn) { String cpBase = fqn.replace('.', '/'); //NOI18N ClassPath sourceCP = getHelper().getClasspathInfo().getClassPath(ClasspathInfo.PathKind.SOURCE); FileObject classFO = sourceCP.findResource(cpBase + ".java"); //NOI18N if (classFO == null) { ClassPath compileCP = getHelper().getClasspathInfo().getClassPath(ClasspathInfo.PathKind.COMPILE); classFO = searchForFile(compileCP, cpBase); } if (classFO != null) { location = new SpringAnnotatedBeanLocation(classFO); } }
/** * Creates a {@link ReferencesCount} for source classpath represented by given * {@link ClasspathInfo}. * @param cpInfo the {@link ClasspathInfo} to create {@link ReferencesCount} for. * @return the {@link ReferencesCount} */ @NonNull public static ReferencesCount get(@NonNull final ClasspathInfo cpInfo) { Parameters.notNull("cpInfo", cpInfo); //NOI18N final List<? extends ClassPath.Entry> scp = cpInfo.getClassPath(ClasspathInfo.PathKind.SOURCE).entries(); final List<URL> roots = new ArrayList<URL>(scp.size()); for (ClassPath.Entry e : scp) { roots.add(e.getURL()); } return new ReferencesCount(roots); }
writer.println("----- Classpath: ---------------------------------------------"); // NOI18N final ClassPath bootPath = info.getClasspathInfo().getClassPath(ClasspathInfo.PathKind.BOOT); final ClassPath classPath = info.getClasspathInfo().getClassPath(ClasspathInfo.PathKind.COMPILE); final ClassPath sourcePath = info.getClasspathInfo().getClassPath(ClasspathInfo.PathKind.SOURCE);
final ClasspathInfo cpInfo = info.getClasspathInfo(); if (cpInfo != null) { final ClassPath src = cpInfo.getClassPath(PathKind.SOURCE); final ClassPath boot = cpInfo.getClassPath(PathKind.BOOT); final ClassPath compile = cpInfo.getClassPath(PathKind.COMPILE); if (!isIncomplete(src, boot, compile)) { final ClassPath cachedSrc = ClasspathInfoAccessor.getINSTANCE().getCachedClassPath(cpInfo, PathKind.SOURCE);
for (ClassPath.Entry entry : cpInfo.getClassPath(PathKind.SOURCE).entries()) { final Iterable<? extends URL> mainClasses = ExecutableFilesIndex.DEFAULT.getMainClasses(entry.getURL()); try { final String ffqn = FileObjects.convertFolder2Package(resourceNameNoExt,'/'); //NOI18N if (qualifiedName.equals(ffqn)) { final ClassPath bootCp = cpInfo.getClassPath(PathKind.BOOT); if (bootCp.findResource(resourceNameNoExt + '.' + FileObjects.CLASS)!=null) {
static @NonNull com.sun.tools.javac.code.Source validateSourceLevel( @NullAllowed String sourceLevel, @NonNull final ClasspathInfo cpInfo) { ClassPath bootClassPath = cpInfo.getClassPath(PathKind.BOOT); ClassPath classPath = null; ClassPath srcClassPath = cpInfo.getClassPath(PathKind.SOURCE); com.sun.tools.javac.code.Source[] sources = com.sun.tools.javac.code.Source.values(); Level warnLevel; classPath = cpInfo.getClassPath(PathKind.COMPILE); "Even though the source level of {0} is set to: {1}, java.lang.AssertionError cannot be found on the bootclasspath: {2}\n" + "Changing source level to 1.3", new Object[]{cpInfo.getClassPath(PathKind.SOURCE), sourceLevel, bootClassPath}); //NOI18N return com.sun.tools.javac.code.Source.JDK1_3; "Even though the source level of {0} is set to: {1}, java.lang.StringBuilder cannot be found on the bootclasspath: {2}\n" + "Changing source level to 1.4", new Object[]{cpInfo.getClassPath(PathKind.SOURCE), sourceLevel, bootClassPath}); //NOI18N return com.sun.tools.javac.code.Source.JDK1_4; "Even though the source level of {0} is set to: {1}, java.lang.AutoCloseable cannot be found on the bootclasspath: {2}\n" + //NOI18N "Try with resources is unsupported.", //NOI18N new Object[]{cpInfo.getClassPath(PathKind.SOURCE), sourceLevel, bootClassPath}); //NOI18N "Even though the source level of {0} is set to: {1}, java.util.stream.Streams cannot be found on the bootclasspath: {2}\n" + //NOI18N "Changing source level to 1.7", //NOI18N new Object[]{cpInfo.getClassPath(PathKind.SOURCE), sourceLevel, bootClassPath}); //NOI18N return com.sun.tools.javac.code.Source.JDK1_7;
@Override public void run (final CompilationController controller) { try { if (controller.toPhase(Phase.RESOLVED).compareTo(Phase.RESOLVED)<0) { return; } try { final SourceAnalyzerFactory.SimpleAnalyzer sa = SourceAnalyzerFactory.createSimpleAnalyzer(); dataHolder[0] = sa.analyseUnit( controller.getCompilationUnit(), JavaSourceAccessor.getINSTANCE().getJavacTask(controller)); } catch (IllegalArgumentException ia) { //Debug info for issue #187344 //seems that invalid dirty class index is used final ClassPath scp = controller.getClasspathInfo().getClassPath(PathKind.SOURCE); throw new IllegalArgumentException( String.format("Provided source path: %s root: %s", //NOI18N scp == null ? "<null>" : scp.toString(), //NOI18N root.toExternalForm()), ia); } } catch (IOException ioe) { Exceptions.printStackTrace(ioe); } } }, true);
private static boolean isIncluded (final ElementHandle<TypeElement> element, final ClasspathInfo cpInfo) { FileObject fobj = getFile (element,cpInfo); if (fobj == null) { //Not source return true; } ClassPath sourcePath = cpInfo.getClassPath(ClasspathInfo.PathKind.SOURCE); for (ClassPath.Entry e : sourcePath.entries()) { FileObject root = e.getRoot (); if (root != null && FileUtil.isParentOf(root,fobj)) { return e.includes(fobj); } } return true; }
ClassPath cp = info.getClasspathInfo().getClassPath(ClasspathInfo.PathKind.SOURCE); FileObject fileObject = info.getFileObject(); if(!fileObject.isValid()) { //File is probably deleted
ClassPath cp = info.getClasspathInfo().getClassPath(ClasspathInfo.PathKind.SOURCE); FileObject fileObject = info.getFileObject(); if(!fileObject.isValid()) { //File is probably deleted
cpInfo = ClasspathInfo.create(sourceFile); final ClassPath cp = cpInfo.getClassPath(PathKind.SOURCE); assert cp != null; this.root = cp.findOwnerRoot(sourceFile); scp = ClassPath.EMPTY; if (scp != cpInfo.getClassPath(PathKind.SOURCE)) { new Object[]{ this.file, owner == null ? "null" : (FileUtil.getFileDisplayName(owner.getProjectDirectory())+" ("+owner.getClass()+")"), cpInfo.getClassPath(PathKind.SOURCE), //NOI18N scp }); final ClassPath cp = cpInfo.getClassPath(PathKind.SOURCE); assert cp != null; this.root = cp.findOwnerRoot(this.file);
.getClassPath(PathKind.SOURCE) .findOwnerRoot(myInfo.getFileObject()); FileObject pakage = FileUtil.createFolder(root, getPackage().replace('.', '/'));
final ClassPath[] cps = new ClassPath[] { cpInfo.getClassPath(ClasspathInfo.PathKind.SOURCE), createClassPath(cpInfo,ClasspathInfo.PathKind.OUTPUT), createClassPath(cpInfo,ClasspathInfo.PathKind.BOOT),
info.addChangeListener(wl=WeakListeners.change(this.cpInfoListener, info)); final ClassPath bootPath = info.getClassPath(ClasspathInfo.PathKind.BOOT); final ClassPath compilePath = info.getClassPath(ClasspathInfo.PathKind.COMPILE); final ClassPath srcPath = info.getClassPath(ClasspathInfo.PathKind.SOURCE); final FileObject root = ClassPathSupport.createProxyClassPath( ClassPathSupport.createClassPath(CachingArchiveProvider.getDefault().ctSymRootsFor(bootPath)),
String qualifiedName = handle.getQualifiedName(); String relPath = qualifiedName.replace('.', '/') + ".class"; //NOI18N ClassPath classPath = js.getClasspathInfo().getClassPath(ClasspathInfo.PathKind.COMPILE); for (ClassPath.Entry entry : classPath.entries()) { FileObject[] roots;