agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java	Fri Apr  3 15:30:15 2009
--- new/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java	Fri Apr  3 15:30:14 2009

*** 359,370 **** --- 359,370 ---- short signatureIndex = fields.getShortAt(index + InstanceKlass.SIGNATURE_INDEX_OFFSET); dos.writeShort(signatureIndex); if (DEBUG) debugMessage("\tfield name = " + nameIndex + ", signature = " + signatureIndex); short fieldAttributeCount = 0; ! boolean isSyn = isSynthetic(accessFlags); ! if (isSyn && _syntheticIndex != 0) ! boolean hasSyn = hasSyntheticAttribute(accessFlags); ! if (hasSyn) fieldAttributeCount++; short initvalIndex = fields.getShortAt(index + InstanceKlass.INITVAL_INDEX_OFFSET); if (initvalIndex != 0) fieldAttributeCount++;
*** 374,384 **** --- 374,384 ---- fieldAttributeCount++; dos.writeShort(fieldAttributeCount); // write synthetic, if applicable ! if (isSyn) ! if (hasSyn) writeSynthetic(); if (initvalIndex != 0) { writeIndex(_constantValueIndex); dos.writeInt(2);
*** 397,412 **** --- 397,415 ---- protected boolean isSynthetic(short accessFlags) { return (accessFlags & (short) JVM_ACC_SYNTHETIC) != 0; } + protected boolean hasSyntheticAttribute(short accessFlags) { + // Check is flags have the attribute and if the constant pool contains an entry for it. + return isSynthetic(accessFlags) && _syntheticIndex != 0; + } + protected void writeSynthetic() throws IOException { if (_syntheticIndex != 0) { writeIndex(_syntheticIndex); dos.writeInt(0); } } protected void writeMethods() throws IOException { ObjArray methods = klass.getMethods(); final int len = (int) methods.getLength(); // write number of methods
*** 428,439 **** --- 431,442 ---- final boolean isNative = ((accessFlags & JVM_ACC_NATIVE) != 0); final boolean isAbstract = ((accessFlags & JVM_ACC_ABSTRACT) != 0); short methodAttributeCount = 0; ! final boolean isSyn = isSynthetic((short)accessFlags); ! if (isSyn && _syntheticIndex != 0) ! final boolean hasSyn = hasSyntheticAttribute((short)accessFlags); ! if (hasSyn) methodAttributeCount++; final boolean hasCheckedExceptions = m.hasCheckedExceptions(); if (hasCheckedExceptions) methodAttributeCount++;
*** 447,457 **** --- 450,460 ---- methodAttributeCount++; dos.writeShort(methodAttributeCount); if (DEBUG) debugMessage("\tmethod attribute count = " + methodAttributeCount); ! if (isSyn) { ! if (hasSyn) { if (DEBUG) debugMessage("\tmethod is synthetic"); writeSynthetic(); } if (isCodeAvailable) {
*** 622,637 **** --- 625,640 ---- if (DEBUG) debugMessage("generic signature = " + index); } protected void writeClassAttributes() throws IOException { final long flags = klass.getAccessFlags(); ! final boolean isSyn = isSynthetic((short) flags); ! final boolean hasSyn = hasSyntheticAttribute((short) flags); // check for source file short classAttributeCount = 0; ! if (isSyn && _syntheticIndex != 0) ! if (hasSyn) classAttributeCount++; Symbol sourceFileName = klass.getSourceFileName(); if (sourceFileName != null) classAttributeCount++;
*** 646,656 **** --- 649,659 ---- classAttributeCount++; dos.writeShort(classAttributeCount); if (DEBUG) debugMessage("class attribute count = " + classAttributeCount); ! if (isSyn) ! if (hasSyn) writeSynthetic(); // write SourceFile, if any if (sourceFileName != null) { writeIndex(_sourceFileIndex);

agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File