diff options
author | cnsun <cnsun@google.com> | 2017-08-08 20:42:03 +0200 |
---|---|---|
committer | Marcel Hlopko <hlopko@google.com> | 2017-08-09 11:33:40 +0200 |
commit | ae93cdf5f2377f9903a3003396b499787e334165 (patch) | |
tree | f52c3da03fd68e32e5fb847d0cef7519e6a9346b /src/tools/android/java/com | |
parent | cf439f2fc1fb6b0da898e67ffecc604b3dcd5504 (diff) |
Remove invalid check. It is possible that an interface initializer can set
fields in other classes. The original check assumes that this is not possible.
This CL just deletes that check.
RELNOTES: None
PiperOrigin-RevId: 164622080
Diffstat (limited to 'src/tools/android/java/com')
-rw-r--r-- | src/tools/android/java/com/google/devtools/build/android/desugar/InterfaceDesugaring.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/InterfaceDesugaring.java b/src/tools/android/java/com/google/devtools/build/android/desugar/InterfaceDesugaring.java index 97135cf2b4..8c0ea7eb52 100644 --- a/src/tools/android/java/com/google/devtools/build/android/desugar/InterfaceDesugaring.java +++ b/src/tools/android/java/com/google/devtools/build/android/desugar/InterfaceDesugaring.java @@ -245,7 +245,7 @@ class InterfaceDesugaring extends ClassVisitor { } /** - * Interface field scanner to get the field of the current interface that is written in the + * Interface field scanner to get the first field of the current interface that is written in the * initializer. */ private class InterfaceFieldWriteCollector extends MethodVisitor { @@ -257,12 +257,10 @@ class InterfaceDesugaring extends ClassVisitor { @Override public void visitFieldInsn(int opcode, String owner, String name, String desc) { if (interfaceFieldToAccessInCompanionMethodToTriggerInterfaceClinit == null - && opcode == Opcodes.PUTSTATIC) { - checkState( - owner.equals(internalName), - "Expect only the fields in this interface to be initialized. owner=%s, expected=%s", - owner, - internalName); + && opcode == Opcodes.PUTSTATIC + && owner.equals(internalName)) { + // It is possible that an interface initializer can sets fields of other classes. + // (b/64290760), so we test whether the owner is the same as the internalName. interfaceFieldToAccessInCompanionMethodToTriggerInterfaceClinit = FieldInfo.create(owner, name, desc); } @@ -285,6 +283,7 @@ class InterfaceDesugaring extends ClassVisitor { * do (b/62623509). */ @Nullable private final String interfaceName; + private final ClassReaderFactory bootclasspath; public InterfaceInvocationRewriter( |