本文整理汇总了Java中com.sun.jdi.Location.method方法的典型用法代码示例。如果您正苦于以下问题:Java Location.method方法的具体用法?Java Location.method怎么用?Java Location.method使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jdi.Location
的用法示例。
在下文中一共展示了Location.method方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldDoExtraStepInto
import com.sun.jdi.Location; //导入方法依赖的package包/类
/**
* Check if the current top stack is same as the original top stack.
*
* @throws IncompatibleThreadStateException
* if the thread is not suspended in the target VM.
*/
private boolean shouldDoExtraStepInto(int originalStackDepth, Location originalLocation, int currentStackDepth, Location currentLocation)
throws IncompatibleThreadStateException {
if (originalStackDepth != currentStackDepth) {
return false;
}
if (originalLocation == null) {
return false;
}
Method originalMethod = originalLocation.method();
Method currentMethod = currentLocation.method();
if (!originalMethod.equals(currentMethod)) {
return false;
}
if (originalLocation.lineNumber() != currentLocation.lineNumber()) {
return false;
}
return true;
}
示例2: convertDebuggerStackFrameToClient
import com.sun.jdi.Location; //导入方法依赖的package包/类
private Types.StackFrame convertDebuggerStackFrameToClient(StackFrame stackFrame, int frameId, IDebugAdapterContext context)
throws URISyntaxException, AbsentInformationException {
Location location = stackFrame.location();
Method method = location.method();
Types.Source clientSource = this.convertDebuggerSourceToClient(location, context);
String methodName = formatMethodName(method, true, true);
int lineNumber = AdapterUtils.convertLineNumber(location.lineNumber(), context.isDebuggerLinesStartAt1(), context.isClientLinesStartAt1());
// Line number returns -1 if the information is not available; specifically, always returns -1 for native methods.
if (lineNumber < 0) {
if (method.isNative()) {
// For native method, display a tip text "native method" in the Call Stack View.
methodName += "[native method]";
} else {
// For other unavailable method, such as lambda expression's built-in methods run/accept/apply,
// display "Unknown Source" in the Call Stack View.
clientSource = null;
}
}
return new Types.StackFrame(frameId, methodName, clientSource, lineNumber, 0);
}
示例3: getContextKeyForFrame
import com.sun.jdi.Location; //导入方法依赖的package包/类
@Nullable
public static String getContextKeyForFrame(final StackFrameProxyImpl frame) {
if (frame == null) {
return null;
}
try {
final Location location = frame.location();
final Method method = location.method();
final ReferenceType referenceType = location.declaringType();
final StringBuilder builder = StringBuilderSpinAllocator.alloc();
try {
return builder.append(referenceType.signature()).append("#").append(method.name()).append(method.signature()).toString();
}
finally {
StringBuilderSpinAllocator.dispose(builder);
}
}
catch (EvaluateException e) {
return null;
}
}
示例4: handleNewObject
import com.sun.jdi.Location; //导入方法依赖的package包/类
/**
* Instance processing creates all the necessary static and instance schemas, dispatches any
* number of type load events followed by at most one new object event, if necessary.
*/
void handleNewObject(final StackFrame frame, final ThreadReference thread)
{
final Location location = frame.location();
if (location == null)
{
return;
}
final Method method = location.method();
if (method == null)
{
return;
}
handleTypeLoad(method.declaringType(), thread);
final ObjectReference object = frame.thisObject();
handleNewObject(object, thread);
}
示例5: AbstractBreakpointValue
import com.sun.jdi.Location; //导入方法依赖的package包/类
/**
* Contructs a nwe {@link AbstractBreakpointValue}
* @param value the value that the watchpoint took at the corresponding timestamp
* @param object the instance to which the value belong
* @param location the method, source file and line number of the caller
* @param timestamp the timestamp at which the watchpoint's variable took the corresponding value
* @param thread the thread which set the value
*/
public AbstractBreakpointValue(int timestamp, ThreadReference thread) {
try {
@SuppressWarnings("unchecked")
List<StackFrame> frames = thread.frames();
int frameSize = frames.size();
sourceNames = new ArrayList<String>(frameSize);
methodNames = new ArrayList<String>(frameSize);
lineNumbers = new ArrayList<Integer>(frameSize);
for (StackFrame frame : frames) {
Location location = frame.location();
Method method = location.method();
sourceNames.add(location.sourcePath());
methodNames.add(method.name() + method.signature());
lineNumbers.add(location.lineNumber());
}
} catch (Exception e) {
}
this.timestamp = timestamp;
this.threadName = thread.name();
}
示例6: locationMatches
import com.sun.jdi.Location; //导入方法依赖的package包/类
public boolean locationMatches(DebugProcessImpl process, Location location) throws EvaluateException {
final Method method = location.method();
if (!myTargetMethodName.equals(method.name())) {
return false;
}
if (myTargetMethodSignature != null) {
if (!signatureMatches(method, myTargetMethodSignature.getName(process))) {
return false;
}
}
return DebuggerUtilsEx.isAssignableFrom(myDeclaringClassName.getName(process), location.declaringType());
}
示例7: locationMatches
import com.sun.jdi.Location; //导入方法依赖的package包/类
public boolean locationMatches(DebugProcessImpl process, Location location) throws EvaluateException {
final VirtualMachineProxyImpl vm = process.getVirtualMachineProxy();
final Method method = location.method();
return isLambdaName(method.name()) && (!vm.canGetSyntheticAttribute() || method.isSynthetic());
}
示例8: findNested
import com.sun.jdi.Location; //导入方法依赖的package包/类
@Nullable
private ReferenceType findNested(final ReferenceType fromClass, final int currentDepth, final PsiClass classToFind, final int requiredDepth, final SourcePosition position) {
final VirtualMachineProxyImpl vmProxy = myDebugProcess.getVirtualMachineProxy();
if (fromClass.isPrepared()) {
try {
if (currentDepth < requiredDepth) {
final List<ReferenceType> nestedTypes = vmProxy.nestedTypes(fromClass);
for (ReferenceType nested : nestedTypes) {
final ReferenceType found = findNested(nested, currentDepth + 1, classToFind, requiredDepth, position);
if (found != null) {
return found;
}
}
return null;
}
int rangeBegin = Integer.MAX_VALUE;
int rangeEnd = Integer.MIN_VALUE;
for (Location location : fromClass.allLineLocations()) {
final int lnumber = location.lineNumber();
if (lnumber <= 1) {
// should be a native method, skipping
// sometimes compiler generates location where line number is exactly 1 (e.g. GWT)
// such locations are hardly correspond to real lines in code, so skipping them too
continue;
}
final Method method = location.method();
if (method == null || DebuggerUtils.isSynthetic(method) || method.isBridge()) {
// do not take into account synthetic stuff
continue;
}
int locationLine = lnumber - 1;
PsiFile psiFile = position.getFile().getOriginalFile();
if (psiFile instanceof PsiCompiledFile) {
locationLine = bytecodeToSourceLine(psiFile, locationLine);
if (locationLine < 0) continue;
}
rangeBegin = Math.min(rangeBegin, locationLine);
rangeEnd = Math.max(rangeEnd, locationLine);
}
final int positionLine = position.getLine();
if (positionLine >= rangeBegin && positionLine <= rangeEnd) {
// choose the second line to make sure that only this class' code exists on the line chosen
// Otherwise the line (depending on the offset in it) can contain code that belongs to different classes
// and JVMNameUtil.getClassAt(candidatePosition) will return the wrong class.
// Example of such line:
// list.add(new Runnable(){......
// First offsets belong to parent class, and offsets inside te substring "new Runnable(){" belong to anonymous runnable.
final int finalRangeBegin = rangeBegin;
final int finalRangeEnd = rangeEnd;
return ApplicationManager.getApplication().runReadAction(new NullableComputable<ReferenceType>() {
public ReferenceType compute() {
if (!classToFind.isValid()) {
return null;
}
final int line = Math.min(finalRangeBegin + 1, finalRangeEnd);
Set<PsiClass> lineClasses = getLineClasses(position.getFile(), line);
if (lineClasses.size() > 1) {
// if there's more than one class on the line - try to match by name
for (PsiClass aClass : lineClasses) {
if (classToFind.equals(aClass)) {
return fromClass;
}
}
}
else if (!lineClasses.isEmpty()){
return classToFind.equals(lineClasses.iterator().next())? fromClass : null;
}
return null;
}
});
}
}
catch (AbsentInformationException ignored) {
}
}
return null;
}
示例9: acceptsLocation
import com.sun.jdi.Location; //导入方法依赖的package包/类
private boolean acceptsLocation(final Location location)
{
return location == null
|| ((location.method() == null && acceptsType(location.declaringType())) || acceptsType(location
.method().declaringType()));
}