-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
1.2.2
-
generic
-
generic
Name: skT88420 Date: 08/18/99
When I have another (2nd) class (scope=default) (dbRule) in a .java file (containing another public class), which gets used by other classes where all reside in the default package, compilation goes fine when I compile one java file at a time. If I use javac *.java, then I get the following warning:
servl.java:3: class dbRule is defined in DataBase.java. Because it is used outside of its source file, it should be defined in a file called "dbRule.java".
public dbRule getRule() { dbRule rule = new dbRule(); return rule; }
^
1 warning
It seems that the compiler is inconsistant, and the warning is meaningless as far as the visibility rules are concerned.
If you need source code, please send me an E-Mail, I have created a sample code to recreate this.
Thanks,
Husni Salka
Test Case:
DataBase.java:
--------------------
public class DataBase
{
private String name;
public DataBase() {;}
public void Open() {;}
public void Close() {;}
}
class dbRule
{
private String description;
public String getDesc() { return description; }
public void setDescription(String desc) { description = desc; }
}
servl.java:
--------------
public class servl
{
public dbRule getRule() { dbRule rule = new dbRule(); return rule; }
public static void main(String args[])
{
DataBase db = new DataBase();
dbRule rule = new dbRule();
servl s = new servl();
rule = s.getRule();
db.Open();
db.Close();
}
}
(Review ID: 94065)
======================================================================