Bug 22418 - Should not complain about package for empty units
Summary: Should not complain about package for empty units
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0.1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-08-14 09:02 EDT by Philipe Mulet CLA
Modified: 2002-10-09 08:54 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2002-08-14 09:02:59 EDT
Build 2.0

From user:

Some developer complained that the Eclipse Java compiler
treats an empty '.java' file as an error.  They can run into this scenario
when adding new '.java' files to source control.  If they check in the
directory version such that the new '.java' file is visible to other users
but they don't check in the first version of the '.java' file itself, the
'.java' file shows up as an empty file to all other users.  Thus, this
breaks the builds of everyone else.
		 Is this the spec'ed behavior for Java compilers.  I 
tried 'javac'
from the Sun JDK and it silently skipped empty '.java' files...
Comment 1 Philipe Mulet CLA 2002-08-14 09:05:31 EDT
This is a valid usecase, will turn off the check for empty units.

We might also consider turning this error into a configurable problem 
(error/warning/ignore), but this might induce confusion down the road.

Note that our batch compiler will behave like javac, but the check occurs when 
the Eclipse Java builder is triggered so as to maintain the source tree 
consistency (and allow incremental compilation to perform in a predictable 
fashion).
Comment 2 Philipe Mulet CLA 2002-08-14 10:33:53 EDT
Backporting to 2.0.1. We will only avoid complaining for empty units (contents 
length == 0). If containing one space, we will start complaining.
Comment 3 Jerome Lanneluc CLA 2002-08-19 07:28:14 EDT
Verified
Comment 4 David Audel CLA 2002-08-19 11:15:36 EDT
Verified.
Comment 5 John Arthorne CLA 2002-08-22 15:17:09 EDT
Testing in 2.0.1 build 20020821, I noticed it now does NOT complain even if the
file contains only whitespace.  This is different behaviour from Philippe's last
comment.
Comment 6 Philipe Mulet CLA 2002-09-03 04:20:17 EDT
John, 

I am observing the behavior I described in my previous comment. As soon as a 
space is added, the package error is reported.

Can you provide steps to reproduce what you are seeing ?
Comment 7 John Arthorne CLA 2002-09-03 10:33:03 EDT
Create a .java file in the default package.  If it contains only whitespace
there are no build problems reported.
Comment 8 David Audel CLA 2002-09-20 09:36:37 EDT
Verified in 2.1 M1
Comment 9 Philipe Mulet CLA 2002-10-09 08:54:36 EDT
Also see bug 24529. We made the rule more permissive. No complaint will be 
issued until some actual structure is added to the unit (package, import or 
type).