Bug 33885 - packages with javax in their name don't import properly
Summary: packages with javax in their name don't import properly
Status: RESOLVED DUPLICATE of bug 35128
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 RC3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-05 13:45 EST by Eric M. Smith CLA
Modified: 2003-03-17 11:04 EST (History)
0 users

See Also:


Attachments
Test case (560 bytes, application/octet-stream)
2003-03-07 17:03 EST, Olivier Thomann CLA
no flags Details
Test case generator (2.66 KB, text/plain)
2003-03-11 11:16 EST, Olivier Thomann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric M. Smith CLA 2003-03-05 13:45:32 EST
We have a package that contains extensions to javax called
com.ourstuff.gui.javax...

A build all or build project under Eclipse generates errors for all classes that import classes within this package.

For each import statement within the ...javax... package, we receive an unknown import error.

For each reference to the class being imported we get an unknown or undefined class error.

Touching the individual file that imports from the ...javax... package (add a space then save) allows a successful compile.

Any complete rebuild of the source requires the repetition of these steps for each file importing from ...javax....
Comment 1 Olivier Thomann CLA 2003-03-05 16:22:03 EST
Could you please provide a reproducable test case and specify the build you are
using?

I tried the following test case with no success:
1) Start a fresh workspace
2) Create a Java project P
3) Create a package called p1.p2.javax.p3
4) Create a class A in this package that looks like:
package p1.p2.javax.p3;

public class A {

	public int foo() {
		return 0;
	}
}

5) Create a package p4.
6) Create a class B in p4 that looks like this:
package p4;

import p1.p2.javax.p3.A;

public class B {
	
	int j;
	B() {
		j = new A().foo();
	}
}

7) This code compiles fine without any error related to the package name
containing javax.

Anything wrong in my steps?
Comment 2 Olivier Thomann CLA 2003-03-05 16:27:25 EST
I used JDK1.4.1 for my test case. What JDK/JRE are you using?
Comment 3 Olivier Thomann CLA 2003-03-05 16:35:00 EST
I tried with a JDK 1.3.1, different package names containing javax without being
able to reproduce this problem.
Comment 4 Olivier Thomann CLA 2003-03-06 08:55:01 EST
Need steps to reproduce and investigate further.
Comment 5 Philipe Mulet CLA 2003-03-06 17:49:08 EST
Eric - can you provide us with the offending library for testing purpose ? 
Comment 6 Jason Wambach CLA 2003-03-07 14:55:52 EST
The following class cannot be referenced from an outside package

/*ListPanel.java*/
package com.infostructuresys.edge.core.javax.list;

import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;

public class ListPanel extends JPanel {
}

/*Referencing class*/
import com.infostructuresys.edge.core.javax.list.*; <-import not resolved

public class foo 
{
   private ListPanel pnlList;  <-task error indicates this is unresolvable
   ...
}


One error in the task list indicates the package 
com.infostructuresys.edge.core.javax cannot be resolved *NOT* 
com.infostructuresys.edge.core.javax.list as the import declaration indicates.  
This error does not occur in the 2.0.2 version of eclipse, I do get this error 
in eclipse build 200302141436, others have seen it in M4, M5 and RC1 of 2.1 
tree.  I was using both java versions 1.3.1_02 and 1.3.1_07 if that helps.

Thanks.
Comment 7 Olivier Thomann CLA 2003-03-07 17:03:33 EST
Created attachment 3922 [details]
Test case

I tried the following classes in RC1. Unzip the attachement in a source folder
and refresh the source folder. I could not reproduce.
Comment 8 Jason Wambach CLA 2003-03-07 20:04:31 EST
The only other thing I can think of that differs, is that this problem only 
showed up when our source count went over 2500 (we have somewhere around 2600 
java files in our project in various packages).  
Comment 9 Jason Wambach CLA 2003-03-07 22:37:29 EST
I've been experimenting further with this problem.  I renamed the packages 
com.infostructuresys.edge.core.javax.* plus all package declarations of classes 
in those packages to com.infostructuresys.edge.core.other.* and the problem 
went away.  IMO not a real good workaround, but...

More info that may or may not be of help.

We have another package in our heirarchy called 
com.infostructuresys.edge.javax.*.
These classes have existed for months without incident until recently when the 
java file count went from ~2000 to ~2500 suddenly.

BTW the problem still exists in RC2, and this workaround was tested in RC2.

Thanks again.
Comment 10 Olivier Thomann CLA 2003-03-09 23:11:43 EST
Could you please provide the complete test case with all the source files il a
zipped file if it is not too big?
We need to be able to reproduce this situation if we want to be able to fix it.
Thanks for your help.
Comment 11 Olivier Thomann CLA 2003-03-10 11:17:17 EST
Do you have any error in your code except these import problems?
Comment 12 Eric M. Smith CLA 2003-03-10 15:02:07 EST
In my most recent build of our source, the only outstanding errors are all 
derived from the 10 failures to resolve the 
com.infostructuresys.edge.core.javax...* packages.  

There are about 500 "errors", but 10 are unknown import errors while the rest 
are unresolved references to the classes in the failed imports.
Comment 13 Olivier Thomann CLA 2003-03-11 10:56:27 EST
I tried to create test cases with 3000 files in packages containing javax, but I
cannot reproduce the problem.
I will attach the test case here. Could you please try it to see if you see the
problem with it?
Thanks.
Comment 14 Olivier Thomann CLA 2003-03-11 11:16:09 EST
Created attachment 3989 [details]
Test case generator

Use a fresh workspace to test this code.
Save the contents of this attachement in a compilation unit and run it in
Eclipse and copy the contents of d:/temp/src into a source folder.
I tried to attach the result, but it takes too long (The zip file was closed to
1Mb).
Let me know if you can reproduce your problem.
Comment 15 Olivier Thomann CLA 2003-03-13 09:50:26 EST
Could you please try to reproduce the problem on your side using the test case I
provided? It doesn't work for me, but I'd like to find out what is wrong. We
need your help since you seem to be the only one you got this problem and we
cannot get your workspace to investigate. RC3 is next week. So if we don't find
before this date, we won't be able to fix it for 2.1.
Comment 16 Philipe Mulet CLA 2003-03-17 11:04:38 EST
Suspect this is a duplicate of bug 35128, please give a try to patch posted at:

http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/jdt-core-
home/patches/org.eclipse.jdt.core_2.1.0.zip


*** This bug has been marked as a duplicate of 35128 ***