diff --git a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/GDBProcesses_7_0.java b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/GDBProcesses_7_0.java index 5a8ce01e3e3..49e2737bfb8 100644 --- a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/GDBProcesses_7_0.java +++ b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/GDBProcesses_7_0.java @@ -739,9 +739,8 @@ public class GDBProcesses_7_0 extends AbstractDsfService implements IMIProcesses // HACK figure out the thread and the group ids // I had to HACK GDB for this if (e instanceof IMIDMEvent) { - MIThreadCreatedEvent miEvent = (MIThreadCreatedEvent)((IMIDMEvent)e).getMIEvent(); - String threadId = miEvent.getStrId(); - IContainerDMContext ctx = miEvent.getDMContext(); + String threadId = ((MIThreadCreatedEvent)((IMIDMEvent)e).getMIEvent()).getStrId(); + IContainerDMContext ctx = ((MIThreadCreatedEvent)((IMIDMEvent)e).getMIEvent()).getDMContext(); if (ctx instanceof IMIExecutionGroupDMContext) { String groupId = ((IMIExecutionGroupDMContext)ctx).getGroupId(); fGroupIdMap.put(threadId, groupId); @@ -761,7 +760,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService implements IMIProcesses // HACK figure out the thread and the group ids // I had to HACK GDB for this if (e instanceof IMIDMEvent) { - String threadId = ((MIThreadCreatedEvent)((IMIDMEvent)e).getMIEvent()).getStrId(); + String threadId = ((MIThreadCreatedEvent)((IMIDMEvent)e).getMIEvent()).getStrId(); fGroupIdMap.remove(threadId); } // END HACK diff --git a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIRunControl.java b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIRunControl.java index 529567a4cf4..226cd13bdba 100644 --- a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIRunControl.java +++ b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIRunControl.java @@ -139,23 +139,23 @@ public class MIRunControl extends AbstractDsfService implements IRunControl, ICa * @see MIRunControl */ @Immutable - protected static class RunControlEvent extends AbstractDMEvent - implements IDMEvent, IMIDMEvent + protected static class RunControlEvent> extends AbstractDMEvent + implements IDMEvent, IMIDMEvent { - final private MIEvent fMIInfo; - public RunControlEvent(V dmc, MIEvent miInfo) { + final private T fMIInfo; + public RunControlEvent(V dmc, T miInfo) { super(dmc); fMIInfo = miInfo; } - public MIEvent getMIEvent() { return fMIInfo; } + public T getMIEvent() { return fMIInfo; } } /** * Indicates that the given thread has been suspended. */ @Immutable - protected static class SuspendedEvent extends RunControlEvent + protected static class SuspendedEvent extends RunControlEvent implements ISuspendedDMEvent { SuspendedEvent(IExecutionDMContext ctx, MIStoppedEvent miInfo) { @@ -198,7 +198,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl, ICa } @Immutable - protected static class ResumedEvent extends RunControlEvent + protected static class ResumedEvent extends RunControlEvent implements IResumedDMEvent { ResumedEvent(IExecutionDMContext ctx, MIRunningEvent miInfo) { @@ -206,7 +206,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl, ICa } public StateChangeReason getReason() { - switch(((MIRunningEvent)getMIEvent()).getType()) { + switch(getMIEvent().getType()) { case MIRunningEvent.CONTINUE: return StateChangeReason.USER_REQUEST; case MIRunningEvent.NEXT: @@ -243,7 +243,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl, ICa } @Immutable - protected static class StartedDMEvent extends RunControlEvent + protected static class StartedDMEvent extends RunControlEvent implements IStartedDMEvent { StartedDMEvent(IMIExecutionDMContext executionDmc, MIThreadCreatedEvent miInfo) { @@ -252,7 +252,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl, ICa } @Immutable - protected static class ExitedDMEvent extends RunControlEvent + protected static class ExitedDMEvent extends RunControlEvent implements IExitedDMEvent { ExitedDMEvent(IMIExecutionDMContext executionDmc, MIThreadExitEvent miInfo) { diff --git a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIRunControlNS.java b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIRunControlNS.java index 2cf99a6cea6..a90849c1d9a 100644 --- a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIRunControlNS.java +++ b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIRunControlNS.java @@ -91,23 +91,23 @@ public class MIRunControlNS extends AbstractDsfService implements IRunControl, I * @see MIRunControl */ @Immutable - private static class RunControlEvent extends AbstractDMEvent - implements IDMEvent, IMIDMEvent + private static class RunControlEvent> extends AbstractDMEvent + implements IDMEvent, IMIDMEvent { - final private MIEvent fMIInfo; - public RunControlEvent(V dmc, MIEvent miInfo) { + final private T fMIInfo; + public RunControlEvent(V dmc, T miInfo) { super(dmc); fMIInfo = miInfo; } - public MIEvent getMIEvent() { return fMIInfo; } + public T getMIEvent() { return fMIInfo; } } /** * Indicates that the given thread has been suspended. */ @Immutable - private static class SuspendedEvent extends RunControlEvent + private static class SuspendedEvent extends RunControlEvent implements ISuspendedDMEvent { SuspendedEvent(IExecutionDMContext ctx, MIStoppedEvent miInfo) { @@ -150,7 +150,7 @@ public class MIRunControlNS extends AbstractDsfService implements IRunControl, I // } @Immutable - private static class ResumedEvent extends RunControlEvent + private static class ResumedEvent extends RunControlEvent implements IResumedDMEvent { ResumedEvent(IExecutionDMContext ctx, MIRunningEvent miInfo) { @@ -158,7 +158,7 @@ public class MIRunControlNS extends AbstractDsfService implements IRunControl, I } public StateChangeReason getReason() { - switch(((MIRunningEvent)getMIEvent()).getType()) { + switch(getMIEvent().getType()) { case MIRunningEvent.CONTINUE: return StateChangeReason.USER_REQUEST; case MIRunningEvent.NEXT: @@ -195,7 +195,7 @@ public class MIRunControlNS extends AbstractDsfService implements IRunControl, I // } @Immutable - private static class StartedDMEvent extends RunControlEvent + private static class StartedDMEvent extends RunControlEvent implements IStartedDMEvent { StartedDMEvent(IMIExecutionDMContext executionDmc, MIThreadCreatedEvent miInfo) { @@ -204,7 +204,7 @@ public class MIRunControlNS extends AbstractDsfService implements IRunControl, I } @Immutable - private static class ExitedDMEvent extends RunControlEvent + private static class ExitedDMEvent extends RunControlEvent implements IExitedDMEvent { ExitedDMEvent(IMIExecutionDMContext executionDmc, MIThreadExitEvent miInfo) { diff --git a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIStack.java b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIStack.java index d085f1c37f9..07e52d24a5c 100644 --- a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIStack.java +++ b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIStack.java @@ -658,12 +658,9 @@ public class MIStack extends AbstractDsfService } @DsfServiceEventHandler - public void eventDispatched(IMIDMEvent e) { - // Note: the e.getMIEvent() is cast to an object as a workaround - // for a compiler error generated by javac (bug 240997). - Object miEvent = e.getMIEvent(); - if (miEvent instanceof MIStoppedEvent) { - fCachedStoppedEvent = (MIStoppedEvent)miEvent; + public void eventDispatched(IMIDMEvent e) { + if (e.getMIEvent() instanceof MIStoppedEvent) { + fCachedStoppedEvent = (MIStoppedEvent)e.getMIEvent(); } } diff --git a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/events/IMIDMEvent.java b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/events/IMIDMEvent.java index 968176f6bd7..a0c1e982641 100644 --- a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/events/IMIDMEvent.java +++ b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/events/IMIDMEvent.java @@ -10,11 +10,22 @@ *******************************************************************************/ package org.eclipse.dd.mi.service.command.events; -import org.eclipse.dd.dsf.datamodel.IDMContext; /** * Common interface for events that are directly caused by some MI event. + * + * @since 1.1 */ -public interface IMIDMEvent { - public MIEvent getMIEvent(); +public interface IMIDMEvent { + + /** + * Returns the underlying MI event that triggered this event. + *

+ * Note: the return type is an object which can be safely cast to + * an MIEvent. However returning a parametrized MIEvent type here + * leads to compiler warnings related to generics (see bug 240997) + *

+ * @see MIEvent + */ + public Object getMIEvent(); }