Community
Participate
Working Groups
20030206 - JUnit setup - create folder resource - exclude that folder from the build path - copy TestCase.java to resource - open TestCase.java Observe: the editor shows error markers. When asking TestCase.java if it is on the build path then true gets returned. For a setup with a source folder src and a folder resource the above scenario returns false for isOnClasspath.
Did you properly exclude the folder ? (trailing '/')
Adding a slash did the trick. But why does it work without a slash in the case where I have source folder src and normal folder resources.
Only the folder gets excluded (and I suspect we don't enter the children from thereon during resource copying - which sounds wrong, given they aren't excluded). Need to double checl
What does it mean to exclude a folder but not its children? Or should I only check files to see if they're excluded?
This is the Ant pattern rules which we conform to. We provide a warning when a folder isn't fully excluded (lacking trailing '/' in pattern), but if this is what user wants, he should get a consistent behavior. Just double check our behavior, I am not convinced we are indeed wrong.
Jerome: Philippe & I discussed changing the JDT behaviour to ignore patterns which exclude only a folder but not its children. In other words, a folder named x will only think its excluded if a pattern 'x\' exists, and not just 'x'. We cannot support excluding a folder only since it would be meaningless to report a compile error against an import statement, because the package a.b was excluded and then compile the source files found in the same package a.b. I changed the existing helper method Util.isExcluded(IResource, char[][]) to add another segment "*" onto a folder's path (a file's path was left as is). This does the trick, but there were several tests checking explicitly for excluded folders only. I've changed these tests too, please double check. Plus there are a dozen senders of isExcluded() in the JavaModel which need to be checked to see if they are correct or should be improved, since there is no reason to walk inside a folder if its excluded.
Also changed JavaProject.isOnClasspath(IJavaElement) and JavaProject.isOnClasspath(IResource) to reflect this change. Other senders of the helper are ok (in particular the DeltaProcessor needs to walk the subtree even if the folder is excluded, in case another package fragment root corresponds to a subfolder)
Verified.