JDK-4419699 : import class/interface bugs
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 1.3.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2001-02-27
  • Updated: 2001-03-06
  • Resolved: 2001-03-06
Related Reports
Duplicate :  
Description

Name: ssT124754			Date: 02/27/2001


In windows 2000
---------------

java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

In solaris 2.7
--------------
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
Java HotSpot(TM) Client VM (build 1.3.0, mixed mode)


(Sorry by my english :-)

1) There are three directory/packages:
 - NewsCommon : with an interface called News.java
 - News : Three class that implements NewsCommon.News,
          theses class are called MusicNews.java, VideoNews.java
          and SportNews.java
 - NewsServer : with a class called NewsServer.java. This
          class do the import of the class and interface
          name above:
------------------------start NewsSever.NewsServer ------------
package NewsServer;

import NewsCommon.News; // <--- The problem :-(
import News.MusicNews;
import News.VideoNews;
import News.SportNews;

class NewsServer
{
    public NewsServer()
    {
    }
}
------------------------END NewsServer.NewsServer-----------

I compile the NewsCommon.News interface and the
class placed in the News directory without problems, but
if I try to complie the NewsServer.NewsServer class
this messages appears:

(the tree packages are placed in the Example directory)
% pwd
Example
% ls/dir
News NewsCommon NewsServer
%cd NewsServer

- Unix command:
/Example/NewsServer% javac -classpath .:.. NewsServer.java
- Window command
C:\Example\NewsServer> javac -classpath .;.. NewsServer.java

--------- START ERROR------------
NewsServer.java:4: cannot resolve symbol
symbol  : class MusicNews
location: interface NewsCommon.News
import News.MusicNews;
            ^
NewsServer.java:5: cannot resolve symbol
symbol  : class VideoNews
location: interface NewsCommon.News
import News.VideoNews;
            ^
NewsServer.java:6: cannot resolve symbol
symbol  : class SportNews
location: interface NewsCommon.News
import News.SportNews;
            ^
3 errors

-------- END ERROR --------------


Remark @-) (A solution ?)
----------
If the next change is do it in the file NewsServer.java
the compilation run:

Before:
import NewsCommon.News; // <--- The problem :-(
import News.MusicNews;
import News.VideoNews;
import News.SportNews;

After:
import News.MusicNews;
import News.VideoNews;
import News.SportNews;
import NewsCommon.News; // <--- The problem :-(

The change do it place the import of NewsCommon.News
interface below of the imports of the class (News.*).

The files source code:
------------------------------------
File: NewsCommon.News
-------------START------------------
package NewsCommon;

public interface News
{
    public void m();
}
-------------END--------------------

------------------------------------
File: News.MusicNews
-------------START------------------
package News;

import NewsCommon.News;

public class MusicNews implements News
{
    public void m()
    {
    }
}
-------------END--------------------

------------------------------------
File: News.SportNews
-------------START------------------
package News;

import NewsCommon.News;

public class SportNews implements News
{
    public void m()
    {
    }
}
-------------END--------------------

------------------------------------
File: News.VideoNews
-------------START------------------
package News;

import NewsCommon.News;

public class VideoNews implements News
{
    public void m()
    {
    }
}
-------------END--------------------

------------------------------------
File: NewsServer.NewsServer
-------------START------------------
package NewsServer;

import NewsCommon.News; // <--- The problem :-(
import News.MusicNews;
import News.VideoNews;
import News.SportNews;

class NewsServer
{
    public NewsServer()
    {
    }
}
-------------END--------------------


The problem it found in solaris and windows

Patricio Inostroza
###@###.###
(Review ID: 117737) 
======================================================================

Comments
WORK AROUND Name: ssT124754 Date: 02/27/2001 Copied from text text above: If the next change is do it in the file NewsServer.java the compilation run: Before: import NewsCommon.News; // <--- The problem :-( import News.MusicNews; import News.VideoNews; import News.SportNews; After: import News.MusicNews; import News.VideoNews; import News.SportNews; import NewsCommon.News; // <--- The problem :-( The change do it place the import of NewsCommon.News interface below of the imports of the class (News.*). Patricio Inostroza ======================================================================
11-06-2004

PUBLIC COMMENTS .
10-06-2004