mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-23 16:23:52 +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
|
// HACK figure out the thread and the group ids
|
||||||
// I had to HACK GDB for this
|
// I had to HACK GDB for this
|
||||||
if (e instanceof IMIDMEvent) {
|
if (e instanceof IMIDMEvent) {
|
||||||
MIThreadCreatedEvent miEvent = (MIThreadCreatedEvent)((IMIDMEvent<?>)e).getMIEvent();
|
String threadId = ((MIThreadCreatedEvent)((IMIDMEvent)e).getMIEvent()).getStrId();
|
||||||
String threadId = miEvent.getStrId();
|
IContainerDMContext ctx = ((MIThreadCreatedEvent)((IMIDMEvent)e).getMIEvent()).getDMContext();
|
||||||
IContainerDMContext ctx = miEvent.getDMContext();
|
|
||||||
if (ctx instanceof IMIExecutionGroupDMContext) {
|
if (ctx instanceof IMIExecutionGroupDMContext) {
|
||||||
String groupId = ((IMIExecutionGroupDMContext)ctx).getGroupId();
|
String groupId = ((IMIExecutionGroupDMContext)ctx).getGroupId();
|
||||||
fGroupIdMap.put(threadId, groupId);
|
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
|
// HACK figure out the thread and the group ids
|
||||||
// I had to HACK GDB for this
|
// I had to HACK GDB for this
|
||||||
if (e instanceof IMIDMEvent) {
|
if (e instanceof IMIDMEvent) {
|
||||||
String threadId = ((MIThreadCreatedEvent)((IMIDMEvent<?>)e).getMIEvent()).getStrId();
|
String threadId = ((MIThreadCreatedEvent)((IMIDMEvent)e).getMIEvent()).getStrId();
|
||||||
fGroupIdMap.remove(threadId);
|
fGroupIdMap.remove(threadId);
|
||||||
}
|
}
|
||||||
// END HACK
|
// END HACK
|
||||||
|
|
|
@ -139,23 +139,23 @@ public class MIRunControl extends AbstractDsfService implements IRunControl, ICa
|
||||||
* @see MIRunControl
|
* @see MIRunControl
|
||||||
*/
|
*/
|
||||||
@Immutable
|
@Immutable
|
||||||
protected static class RunControlEvent<V extends IDMContext, T extends IDMContext> extends AbstractDMEvent<V>
|
protected static class RunControlEvent<V extends IDMContext, T extends MIEvent<? extends IDMContext>> extends AbstractDMEvent<V>
|
||||||
implements IDMEvent<V>, IMIDMEvent<T>
|
implements IDMEvent<V>, IMIDMEvent
|
||||||
{
|
{
|
||||||
final private MIEvent<T> fMIInfo;
|
final private T fMIInfo;
|
||||||
public RunControlEvent(V dmc, MIEvent<T> miInfo) {
|
public RunControlEvent(V dmc, T miInfo) {
|
||||||
super(dmc);
|
super(dmc);
|
||||||
fMIInfo = miInfo;
|
fMIInfo = miInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MIEvent<T> getMIEvent() { return fMIInfo; }
|
public T getMIEvent() { return fMIInfo; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates that the given thread has been suspended.
|
* Indicates that the given thread has been suspended.
|
||||||
*/
|
*/
|
||||||
@Immutable
|
@Immutable
|
||||||
protected static class SuspendedEvent extends RunControlEvent<IExecutionDMContext, IExecutionDMContext>
|
protected static class SuspendedEvent extends RunControlEvent<IExecutionDMContext, MIStoppedEvent>
|
||||||
implements ISuspendedDMEvent
|
implements ISuspendedDMEvent
|
||||||
{
|
{
|
||||||
SuspendedEvent(IExecutionDMContext ctx, MIStoppedEvent miInfo) {
|
SuspendedEvent(IExecutionDMContext ctx, MIStoppedEvent miInfo) {
|
||||||
|
@ -198,7 +198,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl, ICa
|
||||||
}
|
}
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
protected static class ResumedEvent extends RunControlEvent<IExecutionDMContext, IExecutionDMContext>
|
protected static class ResumedEvent extends RunControlEvent<IExecutionDMContext, MIRunningEvent>
|
||||||
implements IResumedDMEvent
|
implements IResumedDMEvent
|
||||||
{
|
{
|
||||||
ResumedEvent(IExecutionDMContext ctx, MIRunningEvent miInfo) {
|
ResumedEvent(IExecutionDMContext ctx, MIRunningEvent miInfo) {
|
||||||
|
@ -206,7 +206,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl, ICa
|
||||||
}
|
}
|
||||||
|
|
||||||
public StateChangeReason getReason() {
|
public StateChangeReason getReason() {
|
||||||
switch(((MIRunningEvent)getMIEvent()).getType()) {
|
switch(getMIEvent().getType()) {
|
||||||
case MIRunningEvent.CONTINUE:
|
case MIRunningEvent.CONTINUE:
|
||||||
return StateChangeReason.USER_REQUEST;
|
return StateChangeReason.USER_REQUEST;
|
||||||
case MIRunningEvent.NEXT:
|
case MIRunningEvent.NEXT:
|
||||||
|
@ -243,7 +243,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl, ICa
|
||||||
}
|
}
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
protected static class StartedDMEvent extends RunControlEvent<IExecutionDMContext, IContainerDMContext>
|
protected static class StartedDMEvent extends RunControlEvent<IExecutionDMContext,MIThreadCreatedEvent>
|
||||||
implements IStartedDMEvent
|
implements IStartedDMEvent
|
||||||
{
|
{
|
||||||
StartedDMEvent(IMIExecutionDMContext executionDmc, MIThreadCreatedEvent miInfo) {
|
StartedDMEvent(IMIExecutionDMContext executionDmc, MIThreadCreatedEvent miInfo) {
|
||||||
|
@ -252,7 +252,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl, ICa
|
||||||
}
|
}
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
protected static class ExitedDMEvent extends RunControlEvent<IExecutionDMContext, IContainerDMContext>
|
protected static class ExitedDMEvent extends RunControlEvent<IExecutionDMContext,MIThreadExitEvent>
|
||||||
implements IExitedDMEvent
|
implements IExitedDMEvent
|
||||||
{
|
{
|
||||||
ExitedDMEvent(IMIExecutionDMContext executionDmc, MIThreadExitEvent miInfo) {
|
ExitedDMEvent(IMIExecutionDMContext executionDmc, MIThreadExitEvent miInfo) {
|
||||||
|
|
|
@ -91,23 +91,23 @@ public class MIRunControlNS extends AbstractDsfService implements IRunControl, I
|
||||||
* @see MIRunControl
|
* @see MIRunControl
|
||||||
*/
|
*/
|
||||||
@Immutable
|
@Immutable
|
||||||
private static class RunControlEvent<V extends IDMContext, T extends IDMContext> extends AbstractDMEvent<V>
|
private static class RunControlEvent<V extends IDMContext, T extends MIEvent<? extends IDMContext>> extends AbstractDMEvent<V>
|
||||||
implements IDMEvent<V>, IMIDMEvent<T>
|
implements IDMEvent<V>, IMIDMEvent
|
||||||
{
|
{
|
||||||
final private MIEvent<T> fMIInfo;
|
final private T fMIInfo;
|
||||||
public RunControlEvent(V dmc, MIEvent<T> miInfo) {
|
public RunControlEvent(V dmc, T miInfo) {
|
||||||
super(dmc);
|
super(dmc);
|
||||||
fMIInfo = miInfo;
|
fMIInfo = miInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MIEvent<T> getMIEvent() { return fMIInfo; }
|
public T getMIEvent() { return fMIInfo; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates that the given thread has been suspended.
|
* Indicates that the given thread has been suspended.
|
||||||
*/
|
*/
|
||||||
@Immutable
|
@Immutable
|
||||||
private static class SuspendedEvent extends RunControlEvent<IExecutionDMContext, IExecutionDMContext>
|
private static class SuspendedEvent extends RunControlEvent<IExecutionDMContext, MIStoppedEvent>
|
||||||
implements ISuspendedDMEvent
|
implements ISuspendedDMEvent
|
||||||
{
|
{
|
||||||
SuspendedEvent(IExecutionDMContext ctx, MIStoppedEvent miInfo) {
|
SuspendedEvent(IExecutionDMContext ctx, MIStoppedEvent miInfo) {
|
||||||
|
@ -150,7 +150,7 @@ public class MIRunControlNS extends AbstractDsfService implements IRunControl, I
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
private static class ResumedEvent extends RunControlEvent<IExecutionDMContext, IExecutionDMContext>
|
private static class ResumedEvent extends RunControlEvent<IExecutionDMContext, MIRunningEvent>
|
||||||
implements IResumedDMEvent
|
implements IResumedDMEvent
|
||||||
{
|
{
|
||||||
ResumedEvent(IExecutionDMContext ctx, MIRunningEvent miInfo) {
|
ResumedEvent(IExecutionDMContext ctx, MIRunningEvent miInfo) {
|
||||||
|
@ -158,7 +158,7 @@ public class MIRunControlNS extends AbstractDsfService implements IRunControl, I
|
||||||
}
|
}
|
||||||
|
|
||||||
public StateChangeReason getReason() {
|
public StateChangeReason getReason() {
|
||||||
switch(((MIRunningEvent)getMIEvent()).getType()) {
|
switch(getMIEvent().getType()) {
|
||||||
case MIRunningEvent.CONTINUE:
|
case MIRunningEvent.CONTINUE:
|
||||||
return StateChangeReason.USER_REQUEST;
|
return StateChangeReason.USER_REQUEST;
|
||||||
case MIRunningEvent.NEXT:
|
case MIRunningEvent.NEXT:
|
||||||
|
@ -195,7 +195,7 @@ public class MIRunControlNS extends AbstractDsfService implements IRunControl, I
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
private static class StartedDMEvent extends RunControlEvent<IExecutionDMContext, IContainerDMContext>
|
private static class StartedDMEvent extends RunControlEvent<IExecutionDMContext,MIThreadCreatedEvent>
|
||||||
implements IStartedDMEvent
|
implements IStartedDMEvent
|
||||||
{
|
{
|
||||||
StartedDMEvent(IMIExecutionDMContext executionDmc, MIThreadCreatedEvent miInfo) {
|
StartedDMEvent(IMIExecutionDMContext executionDmc, MIThreadCreatedEvent miInfo) {
|
||||||
|
@ -204,7 +204,7 @@ public class MIRunControlNS extends AbstractDsfService implements IRunControl, I
|
||||||
}
|
}
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
private static class ExitedDMEvent extends RunControlEvent<IExecutionDMContext, IContainerDMContext>
|
private static class ExitedDMEvent extends RunControlEvent<IExecutionDMContext,MIThreadExitEvent>
|
||||||
implements IExitedDMEvent
|
implements IExitedDMEvent
|
||||||
{
|
{
|
||||||
ExitedDMEvent(IMIExecutionDMContext executionDmc, MIThreadExitEvent miInfo) {
|
ExitedDMEvent(IMIExecutionDMContext executionDmc, MIThreadExitEvent miInfo) {
|
||||||
|
|
|
@ -658,12 +658,9 @@ public class MIStack extends AbstractDsfService
|
||||||
}
|
}
|
||||||
|
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void eventDispatched(IMIDMEvent<?> e) {
|
public void eventDispatched(IMIDMEvent e) {
|
||||||
// Note: the e.getMIEvent() is cast to an object as a workaround
|
if (e.getMIEvent() instanceof MIStoppedEvent) {
|
||||||
// for a compiler error generated by javac (bug 240997).
|
fCachedStoppedEvent = (MIStoppedEvent)e.getMIEvent();
|
||||||
Object miEvent = e.getMIEvent();
|
|
||||||
if (miEvent instanceof MIStoppedEvent) {
|
|
||||||
fCachedStoppedEvent = (MIStoppedEvent)miEvent;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,22 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.mi.service.command.events;
|
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.
|
* Common interface for events that are directly caused by some MI event.
|
||||||
|
*
|
||||||
|
* @since 1.1
|
||||||
*/
|
*/
|
||||||
public interface IMIDMEvent<V extends IDMContext> {
|
public interface IMIDMEvent {
|
||||||
public MIEvent<V> getMIEvent();
|
|
||||||
|
/**
|
||||||
|
* 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