Skip to content

Commit

Permalink
tolerate missing outer classes for interface desugaring
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 197946783
  • Loading branch information
kevin1e100 authored and Copybara-Service committed May 24, 2018
1 parent d8e7f9c commit ee5ea6b
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.
package com.google.devtools.build.android.desugar;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;

import com.google.devtools.build.android.desugar.io.BitFlags;
Expand Down Expand Up @@ -54,9 +53,14 @@ public boolean isOuterInterface(String outerName, String innerName) {
if (result == null) {
// We could just load the outer class here, but this tolerates incomplete classpaths better.
// Note the outer class should be in the Jar we're desugaring, so it should always be there.
ClassReader outerClass = checkNotNull(classpath.readIfKnown(outerName),
"Couldn't find outer class %s of %s", outerName, innerName);
result = BitFlags.isInterface(outerClass.getAccess());
ClassReader outerClass = classpath.readIfKnown(outerName);
if (outerClass == null) {
System.err.printf("WARNING: Couldn't find outer class %s of %s%n", outerName, innerName);
// TODO(b/79155927): Make this an error when sources of this problem are fixed.
result = false; // assume it's a class if we can't find it (b/79155927)
} else {
result = BitFlags.isInterface(outerClass.getAccess());
}
known.put(outerName, result);
}
return result;
Expand Down

0 comments on commit ee5ea6b

Please sign in to comment.