Skip to content

Commit

Permalink
Ignore IllegalStateExceptions when loading classes for retrieving lin…
Browse files Browse the repository at this point in the history
…e numbers.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=197761929
  • Loading branch information
sameb authored and ronshapiro committed May 25, 2018
1 parent 0451111 commit 35caaec
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions core/src/com/google/inject/internal/util/LineNumbers.java
Expand Up @@ -51,14 +51,17 @@ final class LineNumbers {
* Reads line number information from the given class, if available.
*
* @param type the class to read line number information from
* @throws IllegalArgumentException if the bytecode for the class cannot be found
* @throws java.io.IOException if an error occurs while reading bytecode
*/
public LineNumbers(Class type) throws IOException {
this.type = type;

if (!type.isArray()) {
InputStream in = type.getResourceAsStream("/" + type.getName().replace('.', '/') + ".class");
InputStream in = null;
try {
in = type.getResourceAsStream("/" + type.getName().replace('.', '/') + ".class");
} catch (IllegalStateException ignored) {
// Some classloaders throw IllegalStateException when they can't load a resource.
}
if (in != null) {
try {
new ClassReader(in).accept(new LineNumberReader(), ClassReader.SKIP_FRAMES);
Expand Down

0 comments on commit 35caaec

Please sign in to comment.