Bug 31476 - CU is on build path also it is located in a excluded folder
Summary: CU is on build path also it is located in a excluded folder
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 critical (vote)
Target Milestone: 2.1 RC1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-10 12:18 EST by Dirk Baeumer CLA
Modified: 2003-02-24 04:56 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Baeumer CLA 2003-02-10 12:18:53 EST
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.
Comment 1 Philipe Mulet CLA 2003-02-10 12:24:46 EST
Did you properly exclude the folder ? (trailing '/')
Comment 2 Dirk Baeumer CLA 2003-02-10 12:42:47 EST
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.
Comment 3 Philipe Mulet CLA 2003-02-10 18:16:38 EST
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
Comment 4 Kent Johnson CLA 2003-02-11 15:42:57 EST
What does it mean to exclude a folder but not its children?

Or should I only check files to see if they're excluded?
Comment 5 Philipe Mulet CLA 2003-02-12 05:16:24 EST
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.
Comment 6 Kent Johnson CLA 2003-02-12 15:56:29 EST
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.
Comment 7 Jerome Lanneluc CLA 2003-02-13 06:38:00 EST
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)
Comment 8 David Audel CLA 2003-02-24 04:56:02 EST
Verified.