Source:
<code>private List<IClasspathEntry> collectGradleSourceFolders() throws JavaModelException { final List<IClasspathEntry> rawClasspath = ImmutableList.copyOf(this.project.getRawClasspath()); List<IClasspathEntry> sourceFolders = FluentIterable.from(this.sourceFolders).transform(new Function<OmniEclipseSourceDirectory, IClasspathEntry>() { @Override public IClasspathEntry apply(OmniEclipseSourceDirectory directory) { IFolder sourceDirectory = SourceFolderUpdater.this.project.getProject().getFolder(Path.fromOSString(directory.getPath())); FileUtils.ensureFolderHierarchyExists(sourceDirectory); final IPackageFragmentRoot root = SourceFolderUpdater.this.project.getPackageFragmentRoot(sourceDirectory); IClasspathAttribute fromGradleModel = JavaCore.newClasspathAttribute(CLASSPATH_ATTRIBUTE_FROM_GRADLE_MODEL, "true"); IPath[] includes = new IPath[] {}; <START> IPath[] excludes = new IPath[] {}; <END> Optional<IClasspathEntry> userDefinedClasspathEntry = FluentIterable.from(rawClasspath).firstMatch(new Predicate<IClasspathEntry>() { @Override public boolean apply(IClasspathEntry entry) { return root.getPath().toString().equals(entry.getPath().toString()); } }); if (userDefinedClasspathEntry.isPresent()) { includes = userDefinedClasspathEntry.get().getInclusionPatterns(); excludes = userDefinedClasspathEntry.get().getExclusionPatterns(); } return JavaCore.newSourceEntry(root.getPath(), includes, excludes, null, new IClasspathAttribute[]{fromGradleModel} ); } }).toList(); return ImmutableSet.copyOf(sourceFolders).asList(); }</code><technical_language>a bit more compact: IPath[] includes = userDefinedClasspathEntry.isPresent() ? userDefinedClasspathEntry.get().getInclusionPatterns() : new IPath[] {}; IPath[] excludes = userDefinedClasspathEntry.isPresent() ? userDefinedClasspathEntry.get().getExclusionPatterns() : new IPath[] {};</technical_language>

Target:
private List<IClasspathEntry> collectGradleSourceFolders() throws JavaModelException { final List<IClasspathEntry> rawClasspath = ImmutableList.copyOf(this.project.getRawClasspath()); List<IClasspathEntry> sourceFolders = FluentIterable.from(this.sourceFolders).transform(new Function<OmniEclipseSourceDirectory, IClasspathEntry>() { @Override public IClasspathEntry apply(OmniEclipseSourceDirectory directory) { IFolder sourceDirectory = SourceFolderUpdater.this.project.getProject().getFolder(Path.fromOSString(directory.getPath())); FileUtils.ensureFolderHierarchyExists(sourceDirectory); final IPackageFragmentRoot root = SourceFolderUpdater.this.project.getPackageFragmentRoot(sourceDirectory); IClasspathAttribute fromGradleModel = JavaCore.newClasspathAttribute(CLASSPATH_ATTRIBUTE_FROM_GRADLE_MODEL, "true"); Optional<IClasspathEntry> userDefinedClasspathEntry = FluentIterable.from(rawClasspath).firstMatch(new Predicate<IClasspathEntry>() { @Override public boolean apply(IClasspathEntry entry) { return root.getPath().equals(entry.getPath()); } }); IPath[] includes = userDefinedClasspathEntry.isPresent() ? userDefinedClasspathEntry.get().getInclusionPatterns() : new IPath[] {}; IPath[] excludes = userDefinedClasspathEntry.isPresent() ? userDefinedClasspathEntry.get().getExclusionPatterns() : new IPath[] {}; return JavaCore.newSourceEntry(root.getPath(), includes, excludes, null, new IClasspathAttribute[]{fromGradleModel} ); } }).toList(); return ImmutableSet.copyOf(sourceFolders).asList(); }