extra frame variables provider

This commit is contained in:
Nikolay Tropin
2014-12-01 19:36:13 +03:00
committed by Egor.Ushakov
parent cd5e327ad9
commit a449fe1158
8 changed files with 75 additions and 12 deletions
@@ -0,0 +1,31 @@
/*
* Copyright 2000-2014 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.debugger.engine;
import com.sun.jdi.TypeComponent;
import com.sun.jdi.VirtualMachine;
/**
* Nikolay.Tropin
* 2014-11-27
*/
public class DefaultSyntheticProvider implements SyntheticTypeComponentProvider {
@Override
public boolean isSynthetic(TypeComponent typeComponent) {
VirtualMachine machine = typeComponent.virtualMachine();
return machine != null && machine.canGetSyntheticAttribute() && typeComponent.isSynthetic();
}
}
@@ -216,9 +216,8 @@ public class JavaStackFrame extends XStackFrame {
final ReferenceType thisRefType = thisObjectReference.referenceType();
if (thisRefType instanceof ClassType && thisRefType.equals(location.declaringType()) && thisRefType.name().contains("$")) { // makes sense for nested classes only
final ClassType clsType = (ClassType)thisRefType;
final VirtualMachineProxyImpl vm = debugProcess.getVirtualMachineProxy();
for (Field field : clsType.fields()) {
if ((!vm.canGetSyntheticAttribute() || field.isSynthetic()) && StringUtil
if (!DebuggerUtils.isSynthetic(field) && StringUtil
.startsWith(field.name(), FieldDescriptorImpl.OUTER_LOCAL_VAR_FIELD_PREFIX)) {
final FieldDescriptorImpl fieldDescriptor = myNodeManager.getFieldDescriptor(myDescriptor, thisObjectReference, field);
children.add(JavaValue.create(fieldDescriptor, evaluationContext, myNodeManager));
@@ -353,7 +353,6 @@ public class PositionManagerImpl implements PositionManager {
return null;
}
final boolean canGetSynthetic = vmProxy.canGetSyntheticAttribute();
int rangeBegin = Integer.MAX_VALUE;
int rangeEnd = Integer.MIN_VALUE;
for (Location location : fromClass.allLineLocations()) {
@@ -365,7 +364,7 @@ public class PositionManagerImpl implements PositionManager {
continue;
}
final Method method = location.method();
if (method == null || (canGetSynthetic && method.isSynthetic()) || method.isBridge()) {
if (method == null || DebuggerUtils.isSynthetic(method) || method.isBridge()) {
// do not take into account synthetic stuff
continue;
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -210,7 +210,7 @@ public class RequestHint {
if (location != null) {
final Method method = location.method();
if (method != null) {
if (myVirtualMachineProxy.canGetSyntheticAttribute() ? method.isSynthetic() : method.name().indexOf('$') >= 0) {
if (myVirtualMachineProxy.canGetSyntheticAttribute() ? DebuggerUtils.isSynthetic(method) : method.name().indexOf('$') >= 0) {
// step into lambda methods
if (!method.name().startsWith(LambdaMethodFilter.LAMBDA_METHOD_PREFIX)) {
return myDepth;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -23,6 +23,7 @@ package com.intellij.debugger.ui.impl.watch;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.DebuggerInvocationUtil;
import com.intellij.debugger.engine.DebugProcessImpl;
import com.intellij.debugger.engine.DebuggerUtils;
import com.intellij.debugger.engine.SuspendContextImpl;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
@@ -472,10 +473,8 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
final ReferenceType thisRefType = thisObjectReference.referenceType();
if (thisRefType instanceof ClassType && thisRefType.equals(location.declaringType()) && thisRefType.name().contains("$")) { // makes sense for nested classes only
final ClassType clsType = (ClassType)thisRefType;
final DebugProcessImpl debugProcess = getDebuggerContext().getDebugProcess();
final VirtualMachineProxyImpl vm = debugProcess.getVirtualMachineProxy();
for (Field field : clsType.fields()) {
if ((!vm.canGetSyntheticAttribute() || field.isSynthetic()) && StringUtil.startsWith(field.name(), FieldDescriptorImpl.OUTER_LOCAL_VAR_FIELD_PREFIX)) {
if ((!DebuggerUtils.isSynthetic(field)) && StringUtil.startsWith(field.name(), FieldDescriptorImpl.OUTER_LOCAL_VAR_FIELD_PREFIX)) {
final FieldDescriptorImpl fieldDescriptor = myNodeManager.getFieldDescriptor(stackDescriptor, thisObjectReference, field);
myChildren.add(myNodeManager.createNode(fieldDescriptor, evaluationContext));
}
@@ -485,8 +485,10 @@ public abstract class DebuggerUtils {
if (typeComponent == null) {
return false;
}
VirtualMachine machine = typeComponent.virtualMachine();
return machine != null && machine.canGetSyntheticAttribute() && typeComponent.isSynthetic();
for (SyntheticTypeComponentProvider provider : SyntheticTypeComponentProvider.EP_NAME.getExtensions()) {
if (provider.isSynthetic(typeComponent)) return true;
}
return false;
}
public static boolean isSimpleGetter(PsiMethod method) {
@@ -0,0 +1,29 @@
/*
* Copyright 2000-2014 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.debugger.engine;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.sun.jdi.TypeComponent;
/**
* Nikolay.Tropin
* 2014-11-27
*/
public interface SyntheticTypeComponentProvider {
ExtensionPointName<SyntheticTypeComponentProvider> EP_NAME = ExtensionPointName.create("com.intellij.debugger.syntheticProvider");
boolean isSynthetic(TypeComponent typeComponent);
}
+4
View File
@@ -118,6 +118,9 @@
<extensionPoint name="debugger.simpleGetterProvider"
interface="com.intellij.debugger.engine.SimpleGetterProvider"/>
<extensionPoint name="debugger.syntheticProvider"
interface="com.intellij.debugger.engine.SyntheticTypeComponentProvider"/>
<extensionPoint name="allOverridingMethodsSearch" interface="com.intellij.util.QueryExecutor"/>
<extensionPoint name="annotatedElementsSearch" interface="com.intellij.util.QueryExecutor"/>
<extensionPoint name="annotatedPackagesSearch" interface="com.intellij.util.QueryExecutor"/>
@@ -1459,6 +1462,7 @@
<xdebugger.breakpointType implementation="com.intellij.debugger.ui.breakpoints.JavaLineBreakpointType"/>
<debugger.jvmSmartStepIntoHandler implementation="com.intellij.debugger.actions.JavaSmartStepIntoHandler"/>
<debugger.simpleGetterProvider implementation="com.intellij.debugger.engine.JavaSimpleGetterProvider"/>
<debugger.syntheticProvider implementation="com.intellij.debugger.engine.DefaultSyntheticProvider"/>
<applicationService serviceInterface="com.intellij.remoteServer.runtime.deployment.debug.JavaDebuggerLauncher"
serviceImplementation="com.intellij.remoteServer.impl.runtime.deployment.debug.JavaDebuggerLauncherImpl"/>