Java Code Examples for com.sun.jdi.Location#sourceName()

The following examples show how to use com.sun.jdi.Location#sourceName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SourceMapper.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 2
Source File: SourceMapper.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 3
Source File: SourceMapper.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 4
Source File: SourceMapper.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 5
Source File: SourceMapper.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 6
Source File: SourceMapper.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 7
Source File: SourceMapper.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 8
Source File: StackTraceRequestHandler.java    From java-debug with Eclipse Public License 1.0 6 votes vote down vote up
private Types.Source convertDebuggerSourceToClient(Location location, IDebugAdapterContext context) throws URISyntaxException {
    final String fullyQualifiedName = location.declaringType().name();
    String sourceName = "";
    String relativeSourcePath = "";
    try {
        // When the .class file doesn't contain source information in meta data,
        // invoking Location#sourceName() would throw AbsentInformationException.
        sourceName = location.sourceName();
        relativeSourcePath = location.sourcePath();
    } catch (AbsentInformationException e) {
        String enclosingType = AdapterUtils.parseEnclosingType(fullyQualifiedName);
        sourceName = enclosingType.substring(enclosingType.lastIndexOf('.') + 1) + ".java";
        relativeSourcePath = enclosingType.replace('.', File.separatorChar) + ".java";
    }

    return convertDebuggerSourceToClient(fullyQualifiedName, sourceName, relativeSourcePath, context);
}
 
Example 9
Source File: SourceMapper.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 10
Source File: SourceMapper.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 11
Source File: SourceMapper.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 12
Source File: SourceMapper.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 13
Source File: SourceMapper.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 14
Source File: SourceMapper.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}