Bugs item #1170313, was opened at 2005-03-24 21:08
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=438935&aid=1170313&group_id=44253
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Elspeth Simpson (ejspe)
Assigned to: Nobody/Anonymous (nobody)
Summary: Uncaught Exception when Compiling Single File in Bad Package
Initial Comment:
I first noticed this bug when trying to compile an
Intermediate Language Level file, but I have been able
to repeat the same bug with a .java file. The behavior
is not tied to language level / full java.
I am trying to compile a class with a bad package
statement--i.e., the file is in my home directory
(elspeth) but I have a statement at the top of the file
that says "package bob;" Javac should catch this mistake.
However, when I "Compile Current Document", the
compiler output reports 1 error that is not a javac
error but instead an exception thrown from within
DrJava. The text of the error is "The source file
/home/elspeth/MyClass.java is in the wrong directory or
the wrong package. The directory name elspeth does not
match the package component bob." I did a search of
the DrJava code base and found this error to be thrown
in some methods in DefaultGlobalModel.
If I instead "Compile All" I get the expected javac error.
This error is bad for two reasons. The first is that
because it's an exception instead of a javac error, the
user isn't given line number feedback. Perhaps more
seriously, this interferes with the fact that we don't
allow package statements at the Elementary and
Intermediate level--this execption shows up *instead*
of the correct Langauge Level error because it is
thrown before the language levels pass can start.
I have attached the file.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=438935&aid=1170313&group_id=44253
|