Java 类com.sun.jdi.Location 实例源码

项目:openjdk-source-code-learn    文件:SourceMapper.java   
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
项目:jive    文件:JiveThread.java   
protected boolean shouldHandleStepInto(final Location location)
{
  try
  {
    if (getOriginalStepStackDepth() != getUnderlyingFrameCount())
    {
      return true;
    }
    if (getOriginalStepLocation().lineNumber() != location.lineNumber())
    {
      return true;
    }
    return false;
  }
  catch (final DebugException e)
  {
    // TODO log error
    return false;
  }
}
项目:jive    文件:StaticModelDelegateForJDI.java   
private void computeLineRange(final int[] lineRange, final List<?> locations)
{
  int lineFrom = -1;
  int lineTo = -1;
  for (final Object o : locations)
  {
    final Location location = (Location) o;
    if (lineFrom == -1 || lineFrom > location.lineNumber())
    {
      lineFrom = location.lineNumber();
    }
    if (lineTo == -1 || lineTo < location.lineNumber())
    {
      lineTo = location.lineNumber();
    }
  }
  lineRange[0] = lineFrom;
  lineRange[1] = lineTo;
}
项目:jive    文件:JDIEventHandlerDelegate.java   
boolean handleNewArray(final ArrayReference array, final Location location, final StackFrame frame)
{
  if (array == null || !manager().generateArrayEvents())
  {
    return false;
  }
  // handle the instantiation of of small arrays
  if (array != null && array.length() <= EventFactoryAdapter.SMALL_ARRAY_SIZE
      && contourFactory().lookupInstanceContour(array.type().name(), array.uniqueID()) == null)
  {
    handleTypeLoad((ReferenceType) array.type(), frame.thread());
    // a specialized new event handles the immutable length of the array
    manager().jiveDispatcher().dispatchNewEvent(array, frame.thread(), array.length());
    visitArrayCells(location, frame, array);
    return true;
  }
  return false;
}
项目:incubator-netbeans    文件:JPDAThreadImpl.java   
private void submitCheckForMonitorEntered(ObjectReference waitingMonitor) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper, ObjectCollectedExceptionWrapper, IllegalThreadStateExceptionWrapper {
    try {
        ThreadReferenceWrapper.suspend(threadReference);
        logger.fine("submitCheckForMonitorEntered(): suspending "+threadName);
        ObjectReference monitor = ThreadReferenceWrapper.currentContendedMonitor(threadReference);
        if (monitor == null) return ;
        Location loc = StackFrameWrapper.location(ThreadReferenceWrapper.frame(threadReference, 0));
        loc = MethodWrapper.locationOfCodeIndex(LocationWrapper.method(loc), LocationWrapper.codeIndex(loc) + 1);
        if (loc == null) return;
        BreakpointRequest br = EventRequestManagerWrapper.createBreakpointRequest(
                VirtualMachineWrapper.eventRequestManager(MirrorWrapper.virtualMachine(threadReference)), loc);
        BreakpointRequestWrapper.addThreadFilter(br, threadReference);
        submitMonitorEnteredRequest(br);
    } catch (IncompatibleThreadStateException itex) {
        Exceptions.printStackTrace(itex);
    } catch (InvalidStackFrameExceptionWrapper isex) {
        Exceptions.printStackTrace(isex);
    } finally {
        logger.fine("submitCheckForMonitorEntered(): resuming "+threadName);
        ThreadReferenceWrapper.resume(threadReference);
    }
}
项目:incubator-netbeans    文件:JPDAMethodChooserUtils.java   
public static void doStepInto(final JPDADebuggerImpl debugger,
                              final EditorContext.Operation operation,
                              final Location location,
                              final ExpressionPool.Interval expressionLines) {
    final String name = operation.getMethodName();
    final boolean isNative = operation.isNative();
    final String methodClassType = operation.getMethodClassType();
    debugger.getRequestProcessor().post(new Runnable() {
        @Override
        public void run() {
            RunIntoMethodActionSupport.doAction(debugger, name, methodClassType, isNative,
                                                location, expressionLines, true,
                                                MethodEntry.SELECTED);
        }
    });
}
项目:incubator-netbeans    文件:JPDAStepImpl.java   
/**
 * Test whether the method is considered to be synthetic
 * @param m The method
 * @param loc The current location in that method
 * @return  0 when not synthetic
 *          positive when suggested step depth is returned
 *          negative when is synthetic and no further step depth is suggested.
 */
public static int isSyntheticMethod(Method m, Location loc) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper {
    String name = TypeComponentWrapper.name(m);
    if (name.startsWith("lambda$")) {                                       // NOI18N
        int lineNumber = LocationWrapper.lineNumber(loc);
        if (lineNumber == 1) {
            // We're in the initialization of the Lambda. We need to step over it.
            return StepRequest.STEP_OVER;
        }
        return 0; // Do not treat Lambda methods as synthetic, because they contain user code.
    } else {
        // Do check the class for being Lambda synthetic class:
        ReferenceType declaringType = LocationWrapper.declaringType(loc);
        try {
            String className = ReferenceTypeWrapper.name(declaringType);
            if (className.contains("$$Lambda$")) {                          // NOI18N
                // Lambda synthetic class
                return -1;
            }
        } catch (ObjectCollectedExceptionWrapper ex) {
        }
    }
    return TypeComponentWrapper.isSynthetic(m) ? -1 : 0;
}
项目:OpenJSharp    文件:SourceMapper.java   
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
项目:jdk8u-jdk    文件:SourceMapper.java   
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
项目:openjdk-jdk10    文件:GetObjectLockCount.java   
private static void addBreakpoint(VirtualMachine vm, ReferenceType refType) {
    Location breakpointLocation = null;
    List<Location> locs;
    try {
        locs = refType.allLineLocations();
        for (Location loc: locs) {
            if (loc.method().name().equals(METHOD_NAME)) {
                breakpointLocation = loc;
                break;
            }
        }
    } catch (AbsentInformationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    if (breakpointLocation != null) {
        EventRequestManager evtReqMgr = vm.eventRequestManager();
        BreakpointRequest bReq = evtReqMgr.createBreakpointRequest(breakpointLocation);
        bReq.setSuspendPolicy(BreakpointRequest.SUSPEND_ALL);
        bReq.enable();
    }
}
项目:openjdk-jdk10    文件:SourceMapper.java   
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
项目:openjdk-jdk10    文件:ThreadReferenceImpl.java   
public boolean isAtBreakpoint() {
    /*
     * TO DO: This fails to take filters into account.
     */
    try {
        StackFrame frame = frame(0);
        Location location = frame.location();
        List<BreakpointRequest> requests = vm.eventRequestManager().breakpointRequests();
        Iterator<BreakpointRequest> iter = requests.iterator();
        while (iter.hasNext()) {
            BreakpointRequest request = iter.next();
            if (location.equals(request.location())) {
                return true;
            }
        }
        return false;
    } catch (IndexOutOfBoundsException iobe) {
        return false;  // no frames on stack => not at breakpoint
    } catch (IncompatibleThreadStateException itse) {
        // Per the javadoc, not suspended => return false
        return false;
    }
}
项目:openjdk-jdk10    文件:LocalVariableImpl.java   
LocalVariableImpl(VirtualMachine vm, Method method,
                  int slot, Location scopeStart, Location scopeEnd,
                  String name, String signature,
                  String genericSignature) {
    super(vm);
    this.method = method;
    this.slot = slot;
    this.scopeStart = scopeStart;
    this.scopeEnd = scopeEnd;
    this.name = name;
    this.signature = signature;
    if (genericSignature != null && genericSignature.length() > 0) {
        this.genericSignature = genericSignature;
    } else {
        // The Spec says to return null for non-generic types
        this.genericSignature = null;
    }
}
项目:openjdk-jdk10    文件:PacketStream.java   
void writeLocation(Location location) {
    ReferenceTypeImpl refType = (ReferenceTypeImpl)location.declaringType();
    byte tag;
    if (refType instanceof ClassType) {
        tag = JDWP.TypeTag.CLASS;
    } else if (refType instanceof InterfaceType) {
        // It's possible to have executable code in an interface
        tag = JDWP.TypeTag.INTERFACE;
    } else {
        throw new InternalException("Invalid Location");
    }
    writeByte(tag);
    writeClassRef(refType.ref());
    writeMethodRef(((MethodImpl)location.method()).ref());
    writeLong(location.codeIndex());
}
项目:openjdk-jdk10    文件:ConcreteMethodImpl.java   
List<Location> sourceNameFilter(List<Location> list,
                                SDE.Stratum stratum,
                                String sourceName)
                        throws AbsentInformationException {
    if (sourceName == null) {
        return list;
    } else {
        /* needs sourceName filteration */
        List<Location> locs = new ArrayList<>();
        for (Location loc : list) {
            if (((LocationImpl)loc).sourceName(stratum).equals(sourceName)) {
                locs.add(loc);
            }
        }
        return locs;
    }
}
项目:openjdk-jdk10    文件:ConcreteMethodImpl.java   
List<Location> locationsOfLine(SDE.Stratum stratum,
                               String sourceName,
                               int lineNumber)
                        throws AbsentInformationException {
    SoftLocationXRefs info = getLocations(stratum);

    if (info.lineLocations.size() == 0) {
        throw new AbsentInformationException();
    }

    /*
     * Find the locations which match the line number
     * passed in.
     */
    List<Location> list = info.lineMapper.get(lineNumber);

    if (list == null) {
        list = new ArrayList<>(0);
    }
    return Collections.unmodifiableList(
        sourceNameFilter(list, stratum, sourceName));
}
项目:openjdk-jdk10    文件:ReferenceTypeImpl.java   
public List<Location> allLineLocations(String stratumID, String sourceName)
                        throws AbsentInformationException {
    boolean someAbsent = false; // A method that should have info, didn't
    SDE.Stratum stratum = stratum(stratumID);
    List<Location> list = new ArrayList<Location>();  // location list

    for (Iterator<Method> iter = methods().iterator(); iter.hasNext(); ) {
        MethodImpl method = (MethodImpl)iter.next();
        try {
            list.addAll(
               method.allLineLocations(stratum, sourceName));
        } catch(AbsentInformationException exc) {
            someAbsent = true;
        }
    }

    // If we retrieved no line info, and at least one of the methods
    // should have had some (as determined by an
    // AbsentInformationException being thrown) then we rethrow
    // the AbsentInformationException.
    if (someAbsent && list.size() == 0) {
        throw new AbsentInformationException();
    }
    return list;
}
项目:java-debug    文件:StepRequestHandler.java   
/**
 * 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;
}
项目:java-debug    文件:StackTraceRequestHandler.java   
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);
}
项目:java-debug    文件:JdtUtils.java   
/**
 * Given a stack frame, find the target project that the associated source file belongs to.
 *
 * @param stackFrame
 *                  the stack frame.
 * @param containers
 *                  the source container list.
 * @return the context project.
 */
public static IProject findProject(StackFrame stackFrame, ISourceContainer[] containers) {
    Location location = stackFrame.location();
    try {
        Object sourceElement = findSourceElement(location.sourcePath(), containers);
        if (sourceElement instanceof IResource) {
            return ((IResource) sourceElement).getProject();
        } else if (sourceElement instanceof IClassFile) {
            IJavaProject javaProject = ((IClassFile) sourceElement).getJavaProject();
            if (javaProject != null) {
                return javaProject.getProject();
            }
        }
    } catch (AbsentInformationException e) {
        // When the compiled .class file doesn't contain debug source information, return null.
    }
    return null;
}
项目:openjdk9    文件:GetObjectLockCount.java   
private static void addBreakpoint(VirtualMachine vm, ReferenceType refType) {
    Location breakpointLocation = null;
    List<Location> locs;
    try {
        locs = refType.allLineLocations();
        for (Location loc: locs) {
            if (loc.method().name().equals(METHOD_NAME)) {
                breakpointLocation = loc;
                break;
            }
        }
    } catch (AbsentInformationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    if (breakpointLocation != null) {
        EventRequestManager evtReqMgr = vm.eventRequestManager();
        BreakpointRequest bReq = evtReqMgr.createBreakpointRequest(breakpointLocation);
        bReq.setSuspendPolicy(BreakpointRequest.SUSPEND_ALL);
        bReq.enable();
    }
}
项目:openjdk9    文件:SourceMapper.java   
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
项目:jdk8u_jdk    文件:SourceMapper.java   
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:SourceMapper.java   
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
项目:intellij-ce-playground    文件:CompoundPositionManager.java   
@Override
@NotNull
public List<Location> locationsOfLine(@NotNull final ReferenceType type, @NotNull SourcePosition position) {
  VirtualFile file = position.getFile().getVirtualFile();
  if (file != null) {
    LineNumbersMapping mapping = file.getUserData(LineNumbersMapping.LINE_NUMBERS_MAPPING_KEY);
    if (mapping != null) {
      int line = mapping.sourceToBytecode(position.getLine() + 1);
      if (line > -1) {
        position = SourcePosition.createFromLine(position.getFile(), line - 1);
      }
    }
  }

  final SourcePosition finalPosition = position;
  return iterate(new Processor<List<Location>>() {
    @Override
    public List<Location> process(PositionManager positionManager) throws NoDataException {
      return positionManager.locationsOfLine(type, finalPosition);
    }
  }, Collections.<Location>emptyList());
}
项目:intellij-ce-playground    文件:CompoundPositionManager.java   
@Nullable
@Override
public XStackFrame createStackFrame(@NotNull StackFrameProxyImpl frame, @NotNull DebugProcessImpl debugProcess, @NotNull Location location) {
  for (PositionManager positionManager : myPositionManagers) {
    if (positionManager instanceof PositionManagerEx) {
      try {
        XStackFrame xStackFrame = ((PositionManagerEx)positionManager).createStackFrame(frame, debugProcess, location);
        if (xStackFrame != null) {
          return xStackFrame;
        }
      }
      catch (Throwable e) {
        LOG.error(e);
      }
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:CompoundPositionManager.java   
@Override
public ThreeState evaluateCondition(@NotNull EvaluationContext context,
                                    @NotNull StackFrameProxyImpl frame,
                                    @NotNull Location location,
                                    @NotNull String expression) {
  for (PositionManager positionManager : myPositionManagers) {
    if (positionManager instanceof PositionManagerEx) {
      try {
        ThreeState result = ((PositionManagerEx)positionManager).evaluateCondition(context, frame, location, expression);
        if (result != ThreeState.UNSURE) {
          return result;
        }
      }
      catch (Throwable e) {
        LOG.error(e);
      }
    }
  }
  return ThreeState.UNSURE;
}
项目:intellij-ce-playground    文件:AddSteppingFilterAction.java   
private static String getClassName(StackFrameProxyImpl stackFrameProxy) {
  if (stackFrameProxy != null) {
    try {
      Location location = stackFrameProxy.location();
      if (location != null) {
        ReferenceType type = location.declaringType();
        if (type != null) {
          return type.name();
        }
      }
    }
    catch (EvaluateException ignore) {
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:NodeManagerImpl.java   
@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;
  }
}
项目:intellij-ce-playground    文件:GroovyPositionManager.java   
@Override
@NotNull
public List<Location> locationsOfLine(@NotNull ReferenceType type, @NotNull SourcePosition position) throws NoDataException {
  checkGroovyFile(position);
  try {
    if (LOG.isDebugEnabled()) {
      LOG.debug("locationsOfLine: " + type + "; " + position);
    }
    int line = position.getLine() + 1;
    List<Location> locations = getDebugProcess().getVirtualMachineProxy().versionHigher("1.4")
                               ? type.locationsOfLine(DebugProcess.JAVA_STRATUM, null, line)
                               : type.locationsOfLine(line);
    if (locations == null || locations.isEmpty()) throw NoDataException.INSTANCE;
    return locations;
  }
  catch (AbsentInformationException e) {
    throw NoDataException.INSTANCE;
  }
}
项目:form-follows-function    文件:F3PositionManager.java   
@NotNull public List<Location> locationsOfLine (ReferenceType type, SourcePosition position) throws NoDataException {
    try {
        // TODO - resolve type in case of inner classes or instances
        int line = position.getLine() + 1;
        List<Location> locations;
        if (debugProcess.getVirtualMachineProxy ().versionHigher ("1.4"))
            locations = type.locationsOfLine (DebugProcess.JAVA_STRATUM, null, line);
        else
            locations = type.locationsOfLine (line);
        if (locations == null  ||  locations.isEmpty())
            throw new NoDataException();
        return locations;
    } catch (AbsentInformationException e) {
        e.printStackTrace (); // TODO
        throw new NoDataException ();
    }
}
项目:form-follows-function    文件:SourceMapper.java   
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
项目:infobip-open-jdk-8    文件:SourceMapper.java   
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
项目:jdk8u-dev-jdk    文件:SourceMapper.java   
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
项目:jdk7-jdk    文件:SourceMapper.java   
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
项目:OLD-OpenJDK8    文件:SourceMapper.java   
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
项目:tools-idea    文件:NodeManagerImpl.java   
@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;
  }
}
项目:jive    文件:JiveThread.java   
protected boolean shouldHandleStepOver(final Location location)
{
  try
  {
    if (getOriginalStepStackDepth() == getUnderlyingFrameCount()
        && getOriginalStepLocation().lineNumber() != location.lineNumber())
    {
      return true;
    }
    if (getOriginalStepStackDepth() > getUnderlyingFrameCount())
    {
      return true;
    }
    return false;
  }
  catch (final DebugException e)
  {
    // TODO log error
    return false;
  }
}
项目:jive    文件:JiveThread.java   
protected boolean shouldHandleStepReturn(final Location location)
{
  try
  {
    if (getOriginalStepStackDepth() > getUnderlyingFrameCount())
    {
      return true;
    }
    return false;
  }
  catch (final DebugException e)
  {
    // TODO log error
    return false;
  }
}
项目:jive    文件:EventFactoryAdapter.java   
private ILineValue resolveLine(final Location location)
{
  if (location != null)
  {
    try
    {
      final String fileName = location.sourcePath();
      final int lineNumber = location.lineNumber();
      return staticModelFactory().lookupLine(fileName, lineNumber);
    }
    catch (final AbsentInformationException e)
    {
    }
  }
  return valueFactory().createUnavailableLine();
}