mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-02 22:55:26 +02:00
[240997] Changed the return type of IMIDMEvent.getMIEvent() to Object to avoid future compiler errors.
This commit is contained in:
parent
1253a42f62
commit
67b41fa70e
5 changed files with 40 additions and 33 deletions
|
@ -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
|
||||
|
|
|
@ -139,23 +139,23 @@ public class MIRunControl extends AbstractDsfService implements IRunControl, ICa
|
|||
* @see MIRunControl
|
||||
*/
|
||||
@Immutable
|
||||
protected static class RunControlEvent<V extends IDMContext, T extends IDMContext> extends AbstractDMEvent<V>
|
||||
implements IDMEvent<V>, IMIDMEvent<T>
|
||||
protected static class RunControlEvent<V extends IDMContext, T extends MIEvent<? extends IDMContext>> extends AbstractDMEvent<V>
|
||||
implements IDMEvent<V>, IMIDMEvent
|
||||
{
|
||||
final private MIEvent<T> fMIInfo;
|
||||
public RunControlEvent(V dmc, MIEvent<T> miInfo) {
|
||||
final private T fMIInfo;
|
||||
public RunControlEvent(V dmc, T miInfo) {
|
||||
super(dmc);
|
||||
fMIInfo = miInfo;
|
||||
}
|
||||
|
||||
public MIEvent<T> getMIEvent() { return fMIInfo; }
|
||||
public T getMIEvent() { return fMIInfo; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates that the given thread has been suspended.
|
||||
*/
|
||||
@Immutable
|
||||
protected static class SuspendedEvent extends RunControlEvent<IExecutionDMContext, IExecutionDMContext>
|
||||
protected static class SuspendedEvent extends RunControlEvent<IExecutionDMContext, MIStoppedEvent>
|
||||
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<IExecutionDMContext, IExecutionDMContext>
|
||||
protected static class ResumedEvent extends RunControlEvent<IExecutionDMContext, MIRunningEvent>
|
||||
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<IExecutionDMContext, IContainerDMContext>
|
||||
protected static class StartedDMEvent extends RunControlEvent<IExecutionDMContext,MIThreadCreatedEvent>
|
||||
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<IExecutionDMContext, IContainerDMContext>
|
||||
protected static class ExitedDMEvent extends RunControlEvent<IExecutionDMContext,MIThreadExitEvent>
|
||||
implements IExitedDMEvent
|
||||
{
|
||||
ExitedDMEvent(IMIExecutionDMContext executionDmc, MIThreadExitEvent miInfo) {
|
||||
|
|
|
@ -91,23 +91,23 @@ public class MIRunControlNS extends AbstractDsfService implements IRunControl, I
|
|||
* @see MIRunControl
|
||||
*/
|
||||
@Immutable
|
||||
private static class RunControlEvent<V extends IDMContext, T extends IDMContext> extends AbstractDMEvent<V>
|
||||
implements IDMEvent<V>, IMIDMEvent<T>
|
||||
private static class RunControlEvent<V extends IDMContext, T extends MIEvent<? extends IDMContext>> extends AbstractDMEvent<V>
|
||||
implements IDMEvent<V>, IMIDMEvent
|
||||
{
|
||||
final private MIEvent<T> fMIInfo;
|
||||
public RunControlEvent(V dmc, MIEvent<T> miInfo) {
|
||||
final private T fMIInfo;
|
||||
public RunControlEvent(V dmc, T miInfo) {
|
||||
super(dmc);
|
||||
fMIInfo = miInfo;
|
||||
}
|
||||
|
||||
public MIEvent<T> getMIEvent() { return fMIInfo; }
|
||||
public T getMIEvent() { return fMIInfo; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates that the given thread has been suspended.
|
||||
*/
|
||||
@Immutable
|
||||
private static class SuspendedEvent extends RunControlEvent<IExecutionDMContext, IExecutionDMContext>
|
||||
private static class SuspendedEvent extends RunControlEvent<IExecutionDMContext, MIStoppedEvent>
|
||||
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<IExecutionDMContext, IExecutionDMContext>
|
||||
private static class ResumedEvent extends RunControlEvent<IExecutionDMContext, MIRunningEvent>
|
||||
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<IExecutionDMContext, IContainerDMContext>
|
||||
private static class StartedDMEvent extends RunControlEvent<IExecutionDMContext,MIThreadCreatedEvent>
|
||||
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<IExecutionDMContext, IContainerDMContext>
|
||||
private static class ExitedDMEvent extends RunControlEvent<IExecutionDMContext,MIThreadExitEvent>
|
||||
implements IExitedDMEvent
|
||||
{
|
||||
ExitedDMEvent(IMIExecutionDMContext executionDmc, MIThreadExitEvent miInfo) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<V extends IDMContext> {
|
||||
public MIEvent<V> getMIEvent();
|
||||
public interface IMIDMEvent {
|
||||
|
||||
/**
|
||||
* Returns the underlying MI event that triggered this event.
|
||||
* <p>
|
||||
* 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)
|
||||
* </p>
|
||||
* @see MIEvent
|
||||
*/
|
||||
public Object getMIEvent();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue