huybuidac20593 / yakindu

Automatically exported from code.google.com/p/yakindu
0 stars 0 forks source link

Simulating Operations With Custom Java Code is not working as intended #64

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
* What steps will reproduce the problem?
1. define a new statechart with a single state A.
2. define an operation in a named interface (e.g ABC.add(param1:integer, 
param2:integer)), such as in the example given in the help; and call it at the 
entry in state A (entry/result=ABC.add(1,1)). 
3. add a new java class with the custom code for the add operation and puth it 
in the same folder where the statechart file is located; pass it to the run 
configuration as an operation class, such as it is done with the custom java 
class "Calculator" and the operation add(param1:integer, param2:integer) given 
in the help.
4. run the model with the run configuration just defined.

* What is the expected output? What do you see instead?

Expected:
 State A active:
   result = 2

Seen:
State A is entered, but the ABC.add(1,1) operation is not done:
 State A active:
   result = 0

* What version of the product are you using? On what operating system?

Yakindu 2.3 for eclipse Luna

OS: (ubuntu 14.04)
   3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
java version: "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.2) (7u65-2.5.2-3~14.04)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

* Please provide any additional information below.

- When the operation is defined in an internal block, it works.
- defining an operation with parametes and result of type "integer" in yakindu 
and "int" in the java class code, as shown in the calculator example, does not 
work, they must be defined as "long" to work.

Original issue reported on code.google.com by camilo.l...@gmail.com on 28 Oct 2014 at 10:16

GoogleCodeExporter commented 9 years ago

Original comment by A.Muel...@googlemail.com on 30 Oct 2014 at 1:00

GoogleCodeExporter commented 9 years ago
Dublicate of Issue 65. Adding files to reproduce:

Start the attached statechart (run as "Statechart Simulation") and trigger the 
"keypress" event in the default package. (the also attached JavaClass must be 
configured to be used).

You will get following Exception:

!ENTRY org.eclipse.ui 4 0 2014-10-28 10:58:20.004
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable 
(java.lang.ClassCastException: 
org.yakindu.sct.simulation.core.sexec.container.CycleBasedSimulationEngine 
cannot be cast to org.eclipse.debug.core.model.IDebugTarget)
    at org.eclipse.swt.SWT.error(SWT.java:4441)
    at org.eclipse.swt.SWT.error(SWT.java:4356)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:139)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4147)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3764)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:236)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Caused by: java.lang.ClassCastException: 
org.yakindu.sct.simulation.core.sexec.container.CycleBasedSimulationEngine 
cannot be cast to org.eclipse.debug.core.model.IDebugTarget
    at org.yakindu.sct.simulation.ui.handler.TerminateLaunchStatusHandler$1.run(TerminateLaunchStatusHandler.java:40)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
    ... 24 more

Original comment by malkne...@gmail.com on 30 Oct 2014 at 1:03

Attachments:

GoogleCodeExporter commented 9 years ago
For the class cast Issue 63 is already created.

Original comment by markus.muehlbrandt on 30 Oct 2014 at 1:07

GoogleCodeExporter commented 9 years ago
For the upcoming release I updated the documentation with a Type System Mapping 
from SCT Types to Java types.

Original comment by A.Muel...@googlemail.com on 30 Oct 2014 at 3:21

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r6323.

Original comment by A.Muel...@googlemail.com on 30 Oct 2014 at 3:21