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

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

Print this page
rev 7840 : 8071999: SA's buildreplayjars fail with exception
Summary: support default methods when dumping classes in SA
Reviewed-by:

*** 421,436 **** dos.writeInt(0); } protected void writeMethods() throws IOException { MethodArray methods = klass.getMethods(); ! final int len = methods.length(); // write number of methods dos.writeShort((short) len); if (DEBUG) debugMessage("number of methods = " + len); for (int m = 0; m < len; m++) { ! writeMethod(methods.at(m)); } } protected void writeMethod(Method m) throws IOException { long accessFlags = m.getAccessFlags(); --- 421,455 ---- dos.writeInt(0); } protected void writeMethods() throws IOException { MethodArray methods = klass.getMethods(); ! ArrayList<Method> valid_methods = new ArrayList<Method>(); ! for (int i = 0; i < methods.length(); i++) { ! Method m = methods.at(i); ! long accessFlags = m.getAccessFlags(); ! // overpass method ! if (accessFlags == (JVM_ACC_PUBLIC | JVM_ACC_SYNTHETIC | JVM_ACC_BRIDGE)) { ! continue; ! } ! final boolean isNative = ((accessFlags & JVM_ACC_NATIVE) != 0); ! final boolean isAbstract = ((accessFlags & JVM_ACC_ABSTRACT) != 0); ! final boolean isCodeAvailable = (!isNative) && (!isAbstract); ! // If _codeIndex == 0 but code exists we're in an ! // interface and we're dealing with a default method. Skip ! // it. ! if (isCodeAvailable && _codeIndex == 0) { ! continue; ! } ! valid_methods.add(m); ! } ! final int len = valid_methods.size(); // write number of methods dos.writeShort((short) len); if (DEBUG) debugMessage("number of methods = " + len); for (int m = 0; m < len; m++) { ! writeMethod(valid_methods.get(m)); } } protected void writeMethod(Method m) throws IOException { long accessFlags = m.getAccessFlags();
agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File