Permalink
Browse files

Fix the JDK11 opensource build for Guice. This was failing by chance …

…in the testlib tests because some of the tests were trying to create a JIT binding for "Integer", which caused Guice to try to parse Integer.class for line numbers. This failed because the JDK was 11, which compiles with "nest members", but our ASM (ASM6) doesn't support "nest members" yet.

The only sane fix I can think of here is to just blanket ignore unsupported things when parsing line numbers, because even if your code is compiled for an earlier target (all of Guice's code+tests are compiled to target JDK 1.7), the JDK itself might be higher, and code may trigger Guice to try to do ASM operations against the JDK.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213313384
  • Loading branch information...
sameb authored and ronshapiro committed Sep 17, 2018
1 parent 7e04216 commit b958fd0ef08b0aa7dbbe2056f6138c96d0d0d657
Showing with 4 additions and 0 deletions.
  1. +4 −0 core/src/com/google/inject/internal/util/LineNumbers.java
@@ -65,6 +65,10 @@ public LineNumbers(Class type) throws IOException {
if (in != null) {
try {
new ClassReader(in).accept(new LineNumberReader(), ClassReader.SKIP_FRAMES);
} catch (UnsupportedOperationException ignored) {
// We may be trying to inspect classes that were compiled with a more recent version
// of javac than our ASM supports. If that happens, just ignore the class and don't
// capture line numbers.
} finally {
try {
in.close();

0 comments on commit b958fd0

Please sign in to comment.