Question about get Method Handle to interface field

Remi Forax forax at
Sat Sep 2 19:26:26 UTC 2017

Hi Radek,
Do you still trying to implement properties in Java ?

It seem to be an overlook to me,
getstatic and putstatic are allowed on a static field declared in an interface, getstatic and putstatic use a CONSTANT_Fieldref so unlike constant method handle based on method which need to know if the owner is an interface or not (to generate a CONSTANT_Methodref or a CONSTANT_InterfaceMethodRef), see JVMS 4.4.2.

The following patch should fix the issue
  case ClassFile.REF_getStatic:
  case ClassFile.REF_putStatic:
      staticOk = true;
+       interfaceOwner = true;
  case ClassFile.REF_getField:


----- Mail original -----
> De: "Radek Smogura" <rsmogura at>
> À: compiler-dev at
> Envoyé: Samedi 2 Septembre 2017 19:20:06
> Objet: Question about get Method Handle to interface field

> Hi all,
> Recently I played a little bit and tried to obtain MethodHandle to GET method
> for interface static field. The code which I try to use is
> new Pool.MethodHandle(ClassFile.REF_getStatic, sym, types);
> But it fails on assertion: Assert.check(!refSym.owner.isInterface() ||
> interfaceOwner) located in MethodHandle.checkConsistent:365 ?
> I wonder if such handles are allowed?
> Thanks,
> Radek
> P.S. Sorry if I post this message twice, but I got SMTP issues

More information about the compiler-dev mailing list