boolean (DebugProcessImpl debugProcess, String className) { final SourcePosition position = getSourcePosition(); if (position != null) { final VirtualFile breakpointFile = position.getFile().getVirtualFile(); final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex(); if (breakpointFile != null && fileIndex.isUnderSourceRootOfType(breakpointFile, JavaModuleSourceRootTypes.SOURCES)) { if (debugProcess.getSearchScope().contains(breakpointFile)) { return true; } // apply filtering to breakpoints from content sources only, not for sources attached to libraries final Collection<VirtualFile> candidates = findClassCandidatesInSourceContent(className, debugProcess.getSearchScope(), fileIndex); if (LOG.isDebugEnabled()) { LOG.debug("Found " + (candidates == null ? "null" : candidates.size()) + " candidate containing files for class " + className); } if (candidates == null) { // If no candidates are found in scope then assume that class is loaded dynamically and allow breakpoint return true; } // breakpointFile is not in scope here and there are some candidates in scope //for (VirtualFile classFile : candidates) { // if (LOG.isDebugEnabled()) { // LOG.debug("Breakpoint file: " + breakpointFile.getPath()+ "; candidate file: " + classFile.getPath()); // } // if (breakpointFile.equals(classFile)) { // return true; // } //} if (LOG.isDebugEnabled()) { final GlobalSearchScope scope = debugProcess.getSearchScope(); final boolean contains = scope.contains(breakpointFile); List<VirtualFile> files = ContainerUtil.map( JavaPsiFacade.getInstance(myProject).findClasses(className, scope), aClass -> aClass.getContainingFile().getVirtualFile()); List<VirtualFile> allFiles = ContainerUtil.map( JavaPsiFacade.getInstance(myProject).findClasses(className, GlobalSearchScope.everythingScope(myProject)), aClass -> aClass.getContainingFile().getVirtualFile()); final VirtualFile contentRoot = fileIndex.getContentRootForFile(breakpointFile); final Module module = fileIndex.getModuleForFile(breakpointFile); LOG.debug("Did not find '" + className + "' in " + scope + "; contains=" + contains + "; contentRoot=" + contentRoot + "; module = " + module + "; all files in index are: " + files + "; all possible files are: " + allFiles ); } return false; } } return true; }