< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java

Print this page
*** 350,20 ***
          }
      }
      protected void writeInterfaces() throws IOException {
          KlassArray interfaces = klass.getLocalInterfaces();
          final int len = interfaces.length();
  
!         if (DEBUG) debugMessage("number of interfaces = " + len);
  
          // write interfaces count
!         dos.writeShort((short) len);
          for (int i = 0; i < len; i++) {
             Klass k = interfaces.getAt(i);
             Short index = (Short) classToIndex.get(k.getName().asString());
!            dos.writeShort(index.shortValue());
!            if (DEBUG) debugMessage("\t" + index);
          }
      }
  
      protected void writeFields() throws IOException {
          final int javaFieldsCount = klass.getJavaFieldsCount();
--- 350,26 ---
          }
      }
      protected void writeInterfaces() throws IOException {
          KlassArray interfaces = klass.getLocalInterfaces();
          final int len = interfaces.length();
+         int nb_interfaces = len;
+         if (klass.hasInjectedIdentityObject() || klass.hasInjectedPrimitiveObject()) {
+             nb_interfaces--;
+         }
  
!         if (DEBUG) debugMessage("number of interfaces = " + nb_interfaces);
  
          // write interfaces count
!         dos.writeShort((short) nb_interfaces);
          for (int i = 0; i < len; i++) {
             Klass k = interfaces.getAt(i);
             Short index = (Short) classToIndex.get(k.getName().asString());
!            if (index != null) { // Injected interfaces have no constant pool entry
!                dos.writeShort(index.shortValue());
+                if (DEBUG) debugMessage("\t" + index);
+            }
          }
      }
  
      protected void writeFields() throws IOException {
          final int javaFieldsCount = klass.getJavaFieldsCount();
< prev index next >