Bug 14194 - Java source files shouldn't show errors when in src dir, but not java resource
Summary: Java source files shouldn't show errors when in src dir, but not java resource
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Linux-Motif
: P3 normal (vote)
Target Milestone: 2.1 M2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-19 01:41 EDT by Rich Dougherty CLA
Modified: 2002-10-22 06:28 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rich Dougherty CLA 2002-04-19 01:41:43 EDT
This is probably related to bug 3245. I experience the problem on the Linux
Motif M5 release.

The JDT shouldn't attempt to compile Java files which aren't "Java resources".
If I create a file ending in .java outside the source directory it doesn't
attempt to compile it. If I create a file ending in .java inside the source
directory it does. I think this behaviour is correct.

If I place a file ending in .java inside the the source directory in a directory
with a dot (".") in the directory name then this file is not a Java resource
(according to bug 3245). However, the JDT still attempts to compile it. (It
never succeeds because the compiler doesn't seem to handle the directory name.)
This results in errors being attached to the Java file when I don't think they
should be.

Here is an example directory structure which demonstrates the problem:

/
+-- src/
    +-- Compile.java <-- should compile
    +-- dont.compile/
        +-- ShouldntHaveErrors.java <-- shouldn't try to compile this

My problem with this is a little more complicated. I have files ending in
'.java' which are stored throughout the source directory in directories called
'.svn'. These are artifacts of the Subversion version control system
(http://subversion.tigris.org/), analagous to 'CVS' directories, so I can't
avoid them!

Especially strange for me is the fact that I get errors reported for the '.java'
files stored inside each '.svn' directory, but the directories aren't visible in
the Java perspective. I'm not sure if this is a bug or not... should I file a
report?
Comment 1 Philipe Mulet CLA 2002-04-19 09:29:10 EDT
If you turn off the default filter in the Java perpsective (see the little 
triangle at the top of the package view) you would see them.

Now for the behavior of the Java builder with respect to such folder names, I 
am not sure I do not want these to be flagged as being located in wrong package 
name. Usually this scenario is rather a mistake.

Will defer, and may revisit post 2.0 if willing to introduce some filters on 
Java resources for building...

Comment 2 Philipe Mulet CLA 2002-04-19 09:29:23 EDT
Deferring
Comment 3 Philipe Mulet CLA 2002-04-23 05:39:51 EDT
Will reconsider post 2.0
Comment 4 Rich Dougherty CLA 2002-10-08 22:43:18 EDT
Thanks for the pointer on filtering resources in the Package view. I was a bit
confused about why the packages were being built if they couldn't be "seen" by
Eclipse. This makes Eclipse's behaviour fine, in my view.

Also, I think you are right that it should be an error to place Java files
inside packages with dots in their name. Therefore I think Eclipse is correct to
report the error. As an enhancement, you could consider mentioning the illegal
directory name in the error message. For example, "Java file cannot be compiled
in a directory with a dot in its name". I wouldn't consider this a big issue,
however.

Finally, my problem with Java files inside the .svn directory has been resolved.
As of Subversion 0.14.3 the locally cached resources have ".svn-work" or
".svn-base" appended to their names. For example, a locally cached Java file
might be stored under the filename "Class.java.svn-work". This works around the
difficulties I had with the Eclipse builder.

In conclusion, I am happy with the Eclipse's behaviour. Unless you wish to make
either of the enhancements that have been mentioned in this report (filtering
resources for the Java builder, changing the error message) you may wish to
close it.
Comment 5 Philipe Mulet CLA 2002-10-09 06:03:35 EDT
Excellent. Note also that you can tell the JavaBuilder to ignore the *.svn-* 
files alltogether. This means it won't attempt to copy them as attached 
resources (as it usually does). See the preference:
Window>Preferences>Java>Compiler>Other>Filtered resources

Also, for the dot package reporting, you currently will get an error message 
indicating that the package name doesn't match the expectation. The message 
isn't perfect in this scenario, but at least you get a notification that 
something is wrong with this very file around the package name.

Closing following your advice
Comment 6 Philipe Mulet CLA 2002-10-22 06:27:46 EDT
Reopening to close properly.
Comment 7 Philipe Mulet CLA 2002-10-22 06:28:24 EDT
Closing