"/src/share/vm/classfile/classLoader.cpp", line 907: Error: Cannot use long to initialize instanceKlassHandle.

Andreas Eriksson andreas.eriksson at oracle.com
Wed Nov 5 16:58:43 UTC 2014


Hi all,

I'm backporting JDK-8020675 
<https://bugs.openjdk.java.net/browse/JDK-8020675> to jdk7, but debug 
builds on solaris fails with the following error:

".../src/share/vm/classfile/classLoader.cpp", line 907: Error: Cannot use long to initialize instanceKlassHandle.

This is in method ClassLoader::load_classfile which returns an 
instanceKlassHandle.
The changed code adds a CHECK_NULL:

-      stream = e->open_stream(name);
+      stream = e->open_stream(name, CHECK_NULL);

The CHECK_NULL macro expands to

stream = e->open_stream(name, THREAD); if (HAS_PENDING_EXCEPTION) return NULL; (0);

NULL is of type long on solaris_x64 (or int on solaris_i586, which has 
the same problem),
and the solaris debug build fails with the above error because we try to 
return NULL i.e. 0L as an instanceKlassHandle.

This is only a problem on jdk7 solaris debug builds, does anyone know 
why it fails in this particular configuration?
It is not a problem on jdk8, even though the same code exists there.

Returning instanceKlassHandle() works as expected, would this be the 
correct way to go since that is a NULL handle?

Any help is appreciated.

Regards,
Andreas


More information about the hotspot-dev mailing list