Bug 176321 - Test failures in MethodParameterGuessingCompletionTest
Summary: Test failures in MethodParameterGuessingCompletionTest
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M6   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-04 17:33 EST by Markus Keller CLA
Modified: 2007-03-20 10:23 EDT (History)
3 users (show)

See Also:


Attachments
Proposed fix (6.39 KB, patch)
2007-03-05 12:34 EST, David Audel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2007-03-04 17:33:23 EST
N20070303-0010 and N20070304-0010

In latest N-builds, there are 4 test failures in org.eclipse.jdt.text.tests.contentassist.MethodParameterGuessingCompletionTest

With jdt.core v_739 (remove JME from IClassFile#getType()), the tests are passing.


First failure trace:

expected:<... null; fList.add([obj])bar } private ja...> but was:<... null; fList.add([bar])bar } private ja...>

junit.framework.ComparisonFailure: expected:<... null;

fList.add([obj])bar
}

private ja...> but was:<... null;

fList.add([bar])bar
}

private ja...>
at org.eclipse.jdt.text.tests.contentassist.AbstractCompletionTest.assertProposal(AbstractCompletionTest.java:300)
at org.eclipse.jdt.text.tests.contentassist.AbstractCompletionTest.assertMethodBodyProposal(AbstractCompletionTest.java:194)
at org.eclipse.jdt.text.tests.contentassist.MethodParameterGuessingCompletionTest.testInsertMethodWithParam1(MethodParameterGuessingCompletionTest.java:57)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
at junit.extensions.TestSetup.run(TestSetup.java:25)
at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:332)
at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:202)
at org.eclipse.test.UITestApplication$3.run(UITestApplication.java:195)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3644)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3284)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2306)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2270)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2145)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:460)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:455)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:101)
at org.eclipse.test.UITestApplication.runApplication(UITestApplication.java:138)
at org.eclipse.test.UITestApplication.run(UITestApplication.java:60)
at org.eclipse.test.UITestApplication.start(UITestApplication.java:210)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:146)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:169)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:476)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:416)
at org.eclipse.equinox.launcher.Main.run(Main.java:1124)
at org.eclipse.equinox.launcher.Main.main(Main.java:1099)
at org.eclipse.core.launcher.Main.main(Main.java:24)
Comment 1 David Audel CLA 2007-03-05 09:36:28 EST
These failures are caused by the fix for bug 162865.
I forgot to run jdt/text tests before release the fix and i didn't see the bug in my fix.

To guess parameters jdt/txt call jdt/core code assist at the beginning of the completed line.

eg.
package test1;

public class Completion_testInsertMethodWithParam1<T> {
	public void testMethod(int param) {

		int foo= 3; Object obj= null;

|		fList.bar //code assist called at |
	}

	private java.util.List fList;
}

In this case jdt/core code assist has a bug and propose 'bar' as an unresolved simple name (bug 162865) but 'bar' is preceded by '.' so isn't a simple name.

A simpler test case is

public class X {
  void foo() {
    |   zzz1.zzz2 //do ctrl+space at |
  }
}

zzz2 is proposed and should not.
Comment 2 David Audel CLA 2007-03-05 12:34:51 EST
Created attachment 60275 [details]
Proposed fix
Comment 3 David Audel CLA 2007-03-05 12:37:32 EST
Released for 3.3M6.

Test added
  CompletionTests#testNameWithUnresolvedReferences011()
Comment 4 Maxime Daniel CLA 2007-03-20 10:23:43 EDT
Verified for 3.3 M6 using build I20070320-0010.