refactoring to avoid red and possibly not compilable code

This commit is contained in:
Egor.Ushakov
2016-02-18 17:36:51 +03:00
parent 237e989b6c
commit 445b6c6cee
3 changed files with 8 additions and 8 deletions
@@ -178,7 +178,7 @@ public class BreakpointManager {
typeCls = JavaExceptionBreakpointType.class;
}
if (typeCls != null) {
XBreakpointType<XBreakpoint<?>, ?> type = XDebuggerUtil.getInstance().findBreakpointType(typeCls);
XBreakpointType type = XDebuggerUtil.getInstance().findBreakpointType(typeCls);
((XBreakpointManagerImpl)getXBreakpointManager()).getBreakpointDefaults(type).setSuspendPolicy(Breakpoint.transformSuspendPolicy(defaults.getSuspendPolicy()));
}
}
@@ -241,7 +241,7 @@ public class BreakpointManager {
@NotNull
public ExceptionBreakpoint addExceptionBreakpoint(@NotNull final String exceptionClassName, final String packageName) {
ApplicationManager.getApplication().assertIsDispatchThread();
final JavaExceptionBreakpointType type = (JavaExceptionBreakpointType)XDebuggerUtil.getInstance().findBreakpointType(JavaExceptionBreakpointType.class);
final JavaExceptionBreakpointType type = XDebuggerUtil.getInstance().findBreakpointType(JavaExceptionBreakpointType.class);
return ApplicationManager.getApplication().runWriteAction(new Computable<ExceptionBreakpoint>() {
@Override
public ExceptionBreakpoint compute() {
@@ -370,7 +370,7 @@ public class BreakpointManager {
final Element breakpointElement = group.getChild("breakpoint");
if (breakpointElement != null) {
XBreakpointManager manager = XDebuggerManager.getInstance(myProject).getBreakpointManager();
JavaExceptionBreakpointType type = (JavaExceptionBreakpointType)XDebuggerUtil.getInstance().findBreakpointType(JavaExceptionBreakpointType.class);
JavaExceptionBreakpointType type = XDebuggerUtil.getInstance().findBreakpointType(JavaExceptionBreakpointType.class);
XBreakpoint<JavaExceptionBreakpointProperties> xBreakpoint = manager.getDefaultBreakpoint(type);
Breakpoint breakpoint = getJavaBreakpoint(xBreakpoint);
if (breakpoint != null) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,7 +70,7 @@ public abstract class XDebuggerUtil {
public abstract void removeBreakpoint(Project project, XBreakpoint<?> breakpoint);
public abstract <B extends XBreakpoint<?>> XBreakpointType<B, ?> findBreakpointType(@NotNull Class<? extends XBreakpointType<B, ?>> typeClass);
public abstract <T extends XBreakpointType> T findBreakpointType(@NotNull Class<T> typeClass);
/**
* Create {@link XSourcePosition} instance by line number
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -282,7 +282,7 @@ public class XDebuggerUtilImpl extends XDebuggerUtil {
}
@Override
public <B extends XBreakpoint<?>> XBreakpointType<B, ?> findBreakpointType(@NotNull Class<? extends XBreakpointType<B, ?>> typeClass) {
public <T extends XBreakpointType> T findBreakpointType(@NotNull Class<T> typeClass) {
if (myBreakpointTypeByClass == null) {
myBreakpointTypeByClass = new THashMap<Class<? extends XBreakpointType>, XBreakpointType<?, ?>>();
for (XBreakpointType<?, ?> breakpointType : XBreakpointUtil.getBreakpointTypes()) {
@@ -291,7 +291,7 @@ public class XDebuggerUtilImpl extends XDebuggerUtil {
}
XBreakpointType<?, ?> type = myBreakpointTypeByClass.get(typeClass);
//noinspection unchecked
return (XBreakpointType<B, ?>)type;
return (T)type;
}
@Override