diff options
author | cnsun <cnsun@google.com> | 2017-06-28 23:43:51 +0200 |
---|---|---|
committer | Marcel Hlopko <hlopko@google.com> | 2017-06-29 09:33:39 +0200 |
commit | 1b9933a96e6cc4217e8d8c3e6fe0646a345c680e (patch) | |
tree | 4ba7b8b3916dd63b007a37f5017da0aa16285821 /src/tools/android | |
parent | 873d25e1f2c20606bc35368c0d5607196626d6e8 (diff) |
When we access a field of an interface, if the field is of type long or double,
then we use pop2 to pop the value out of the stack.
RELNOTES: None
PiperOrigin-RevId: 160453904
Diffstat (limited to 'src/tools/android')
-rw-r--r-- | src/tools/android/java/com/google/devtools/build/android/desugar/InterfaceDesugaring.java | 9 |
1 files changed, 8 insertions, 1 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 c5bdbe7ff2..f7621dfcc0 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 @@ -103,12 +103,19 @@ class InterfaceDesugaring extends ClassVisitor { "Cannot get a method visitor to write out %s to the companion class.", COMPANION_METHOD_TO_TRIGGER_INTERFACE_CLINIT_NAME); // Visit the interface field to triger <clinit> of the interface. + visitor.visitFieldInsn( Opcodes.GETSTATIC, interfaceFieldToAccessInCompanionMethodToTriggerInterfaceClinit.owner(), interfaceFieldToAccessInCompanionMethodToTriggerInterfaceClinit.name(), interfaceFieldToAccessInCompanionMethodToTriggerInterfaceClinit.desc()); - visitor.visitInsn(Opcodes.POP); + Type fieldType = + Type.getType(interfaceFieldToAccessInCompanionMethodToTriggerInterfaceClinit.desc()); + if (fieldType.getSort() == Type.LONG || fieldType.getSort() == Type.DOUBLE) { + visitor.visitInsn(Opcodes.POP2); + } else { + visitor.visitInsn(Opcodes.POP); + } visitor.visitInsn(Opcodes.RETURN); } |