Bug 18042

Summary: AST: Resolving failes with semicolon while loop body
Product: [Eclipse Project] JDT Reporter: Martin Aeschlimann <martinae>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED WORKSFORME QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.0 F2   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Martin Aeschlimann CLA 2002-05-28 09:55:29 EDT
F1
1. create the folling code, try an organize inport on it.
2. The simple name 'InputStream' can not be resolved
3. Change the while loop body to i= null; -> resolving works


public class Test {
	void foo() {
		InputStream i= null;
		while(true) 
			;
	}
}
Comment 1 Olivier Thomann CLA 2002-05-28 12:24:03 EDT
I cannot reproduce in latest. Could you please give it a try with tomorrow's build and let me know if 
it is still boggus?
Comment 2 Martin Aeschlimann CLA 2002-05-29 05:38:03 EDT
it's still there in 20020528

I can reproduce it with the given code.

Add "import java.io.InputStream;"
Do an organize import on it and you will still ask you which InputStream
Set a breakpoint in OrganizeImportsOperation.process
and you will see that the simplename for 'InputStream' has no binding.
Comment 3 Martin Aeschlimann CLA 2002-05-29 05:49:51 EDT
I'm using jdk 1.4 that's why InputStream exists more than once.
Try List instead.
Comment 4 Olivier Thomann CLA 2002-05-29 19:26:29 EDT
I tried what you said.
1) I defined this class:
public class Test {
   void foo() {
      
InputStream i= null;
      while(true);
   }
}
2) I organized imports and I got several 
InputStream (I am using 1.4 also).
3) I choose java.io.InputStream and I got:
import 
java.io.InputStream;

public class Test {
   void foo() {
      InputStream i= null;
      
while(true);
   }
}
4) I tried again "Organize imports..." and I didn't have to choose again an 
"InputStream" class.

Then I tried the following test case:

package 
test0353;

import java.io.InputStream;

public class Test {
        void foo() {
                
InputStream i = null;
                while (true);
        }
}

I resolve the simple name "InputStream" and the 
simple type corresponding to this simple name and both resolution replied 
"java.io.InputStream". So I guess this has been fixed with the latest changes for 18255 or 
18138.
Let me know if you can still reproduce it when the fixes for these two bugs are in the build.
Comment 5 Olivier Thomann CLA 2002-05-29 19:28:34 EDT
I tried directly in 0529 and I couldn't reproduce it.
Please reopen if you can reproduce it on 
your side with latest build.
Comment 6 Philipe Mulet CLA 2002-06-03 09:51:14 EDT
This one is verified, found new bug 18708.
Verified