harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nellya Udovichenko (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-3362) [classlib][EUT] 3 tests fail in org.eclipse.jface.tests.databinding suit
Date Tue, 29 May 2007 09:12:16 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-3362?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499736
] 

Nellya Udovichenko commented on HARMONY-3362:
---------------------------------------------

I have investigated the issue. The eclipse test invokes the same two methods handleChange()
(2 objects of java.lang.reflect.Method) 
and writes them to ArrayList. The Method objects are created by dynamic class $Proxy (java.lang.reflect.Proxy).
Then 
the method handleChange() is invoked again and we try to find it in the filled ArrayList.

The problem appears at method equals() of internal class MethodCall when 
2 objects of Method are compared by references ("=="). The RI result is true but Harmony one
is false. 

The test below shows that at the same methods invocation the dynamic class $Proxy generates

the different Method objects (the different references) at Harmony but returns the same once
at RI.

Any ideas, is it correct in the eclipse test to compare two Method objects by references ("==")
or we have to use Method.equals()? 
Or we have the bug in Harmony reflection API?

// Internal class MethodCall is replaced in internal one MockInvocationHandler of the
// class org.eclipse.jface.tests.databinding.util.Mocks.

Test:

public interface TestInterface {
    public void f();
}
-----------------------------------------------------------------------------------------------------
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class TestInvocationHandler implements InvocationHandler {
    private Method oldMethod = null;

   public Object invoke(Object proxy, Method method, Object[] args) {
       if (oldMethod == null) {
           oldMethod = method;
       } else {
           System.out.println("oldMethod == method: " + (oldMethod == method));
           System.out.println("oldMethod.equals(method): " + (oldMethod.equals(method)));
       }
       return null;
   }
}
-----------------------------------------------------------------------------------------------------
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

public class Main {
	
	public static void main(String[] args) throws Exception {
        TestInterface obj = (TestInterface) Proxy.newProxyInstance(
	                           TestInterface.class.getClassLoader(), 
	                           new Class[] {TestInterface.class}, 
	                           (InvocationHandler)new TestInvocationHandler());
	    obj.f();
	    obj.f();
	}
}



RI: 
oldMethod == method: true
oldMethod.equals(method): true

Harmony + J9:
oldMethod == method: false
oldMethod.equals(method): true


> [classlib][EUT] 3 tests fail in org.eclipse.jface.tests.databinding suit
> ------------------------------------------------------------------------
>
>                 Key: HARMONY-3362
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3362
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Aleksey Ignatenko
>
> 3 tests fail in org.eclipse.jface.tests.databinding suit.
> 1. testAddChangeListener
> unexpected method call: handleChange 
> junit.framework.AssertionFailedError: unexpected method call: handleChange
> at org.eclipse.jface.tests.databinding.util.Mocks$MockInvocationHandler.invoke(Mocks.java:136)
> at org.eclipse.jface.tests.databinding.util.$Proxy0.handleChange(Unknown Source)
> at org.eclipse.jface.internal.databinding.provisional.observable.AbstractObservable.fireChange(AbstractObservable.java:142)
> at org.eclipse.jface.internal.databinding.provisional.observable.value.AbstractObservableValue.fireValueChange(AbstractObservableValue.java)
> at org.eclipse.jface.tests.databinding.ObservableTest$MyObservable.fireChange(ObservableTest.java:31)
> at org.eclipse.jface.tests.databinding.ObservableTest.testAddChangeListener(ObservableTest.java:72)
> at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
> at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:326)
> at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:203)
> at org.eclipse.test.CoreTestApplication.runTests(CoreTestApplication.java)
> at org.eclipse.test.CoreTestApplication.run(CoreTestApplication.java:31)
> at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:77)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:66)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:396)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
> at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
> at org.eclipse.core.launcher.Main.run(Main.java:975)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
> at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
> at org.apache.harmony.vm.JarRunner.main(JarRunner.java:80)
> 2-3. testBindValueModel,  testBindValueTarget
> unexpected method call: getValueType 
> junit.framework.AssertionFailedError: unexpected method call: getValueType
> at org.eclipse.jface.tests.databinding.util.Mocks$MockInvocationHandler.invoke(Mocks.java:136)
> at org.eclipse.jface.tests.databinding.util.$Proxy1.getValueType(Unknown Source)
> at org.eclipse.jface.internal.databinding.provisional.factories.DefaultBindingFactory.createBinding(DefaultBindingFactory.java:49)
> at org.eclipse.jface.internal.databinding.provisional.DataBindingContext.doCreateBinding(DataBindingContext.java:263)
> at org.eclipse.jface.internal.databinding.provisional.DataBindingContext.bind(DataBindingContext.java)
> at org.eclipse.jface.tests.databinding.DatabindingContextTest.testBindValueModel(DatabindingContextTest.java:183)
> at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
> at org.eclipse.jface.tests.databinding.DatabindingContextTest.runTest(DatabindingContextTest.java)
> at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:326)
> at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:203)
> at org.eclipse.test.CoreTestApplication.runTests(CoreTestApplication.java)
> at org.eclipse.test.CoreTestApplication.run(CoreTestApplication.java:31)
> at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:77)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:66)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:396)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
> at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
> at org.eclipse.core.launcher.Main.run(Main.java:975)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
> at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
> at org.apache.harmony.vm.JarRunner.main(JarRunner.java:80)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message