MCPcopy Index your code
hub / github.com/clojure/clojure / canCopyMethodAttributes

Method canCopyMethodAttributes

src/jvm/clojure/asm/MethodWriter.java:2005–2042  ·  view source on GitHub ↗

Returns whether the attributes of this method can be copied from the attributes of the given method (assuming there is no method visitor between the given ClassReader and this MethodWriter). This method should only be called just after this MethodWriter has been created, and before any content is vi

(
      final ClassReader source,
      final int methodInfoOffset,
      final int methodInfoLength,
      final boolean hasSyntheticAttribute,
      final boolean hasDeprecatedAttribute,
      final int signatureIndex,
      final int exceptionsOffset)

Source from the content-addressed store, hash-verified

2003 * + 'methodInfoLength'.
2004 */
2005 boolean canCopyMethodAttributes(
2006 final ClassReader source,
2007 final int methodInfoOffset,
2008 final int methodInfoLength,
2009 final boolean hasSyntheticAttribute,
2010 final boolean hasDeprecatedAttribute,
2011 final int signatureIndex,
2012 final int exceptionsOffset) {
2013 if (source != symbolTable.getSource()
2014 || signatureIndex != this.signatureIndex
2015 || hasDeprecatedAttribute != ((accessFlags & Opcodes.ACC_DEPRECATED) != 0)) {
2016 return false;
2017 }
2018 boolean needSyntheticAttribute =
2019 symbolTable.getMajorVersion() < Opcodes.V1_5 && (accessFlags & Opcodes.ACC_SYNTHETIC) != 0;
2020 if (hasSyntheticAttribute != needSyntheticAttribute) {
2021 return false;
2022 }
2023 if (exceptionsOffset == 0) {
2024 if (numberOfExceptions != 0) {
2025 return false;
2026 }
2027 } else if (source.readUnsignedShort(exceptionsOffset) == numberOfExceptions) {
2028 int currentExceptionOffset = exceptionsOffset + 2;
2029 for (int i = 0; i < numberOfExceptions; ++i) {
2030 if (source.readUnsignedShort(currentExceptionOffset) != exceptionIndexTable[i]) {
2031 return false;
2032 }
2033 currentExceptionOffset += 2;
2034 }
2035 }
2036 // Don't copy the attributes yet, instead store their location in the source class reader so
2037 // they can be copied later, in {@link #putMethodInfo}. Note that we skip the 6 header bytes
2038 // of the method_info JVMS structure.
2039 this.sourceOffset = methodInfoOffset + 6;
2040 this.sourceLength = methodInfoLength - 6;
2041 return true;
2042 }
2043
2044 /**
2045 * Returns the size of the method_info JVMS structure generated by this MethodWriter. Also add the

Callers 1

readMethodMethod · 0.95

Calls 3

getSourceMethod · 0.80
getMajorVersionMethod · 0.80
readUnsignedShortMethod · 0.80

Tested by

no test coverage detected