()
| 206 | } |
| 207 | |
| 208 | void addSDE() throws UnsupportedEncodingException, IOException { |
| 209 | copy(4 + 2 + 2); // magic min/maj version |
| 210 | int constantPoolCountPos = genPos; |
| 211 | int constantPoolCount = readU2(); |
| 212 | if (log.isTraceEnabled()) { |
| 213 | log.trace("constant pool count: " + constantPoolCount); |
| 214 | } |
| 215 | writeU2(constantPoolCount); |
| 216 | |
| 217 | // copy old constant pool return index of SDE symbol, if found |
| 218 | sdeIndex = copyConstantPool(constantPoolCount); |
| 219 | if (sdeIndex < 0) { |
| 220 | // if "SourceDebugExtension" symbol not there add it |
| 221 | writeUtf8ForSDE(); |
| 222 | |
| 223 | // increment the constantPoolCount |
| 224 | sdeIndex = constantPoolCount; |
| 225 | ++constantPoolCount; |
| 226 | randomAccessWriteU2(constantPoolCountPos, constantPoolCount); |
| 227 | |
| 228 | if (log.isTraceEnabled()) { |
| 229 | log.trace("SourceDebugExtension not found, installed at: " + sdeIndex); |
| 230 | } |
| 231 | } else { |
| 232 | if (log.isTraceEnabled()) { |
| 233 | log.trace("SourceDebugExtension found at: " + sdeIndex); |
| 234 | } |
| 235 | } |
| 236 | copy(2 + 2 + 2); // access, this, super |
| 237 | int interfaceCount = readU2(); |
| 238 | writeU2(interfaceCount); |
| 239 | if (log.isTraceEnabled()) { |
| 240 | log.trace("interfaceCount: " + interfaceCount); |
| 241 | } |
| 242 | copy(interfaceCount * 2); |
| 243 | copyMembers(); // fields |
| 244 | copyMembers(); // methods |
| 245 | int attrCountPos = genPos; |
| 246 | int attrCount = readU2(); |
| 247 | writeU2(attrCount); |
| 248 | if (log.isTraceEnabled()) { |
| 249 | log.trace("class attrCount: " + attrCount); |
| 250 | } |
| 251 | // copy the class attributes, return true if SDE attr found (not copied) |
| 252 | if (!copyAttrs(attrCount)) { |
| 253 | // we will be adding SDE and it isn't already counted |
| 254 | ++attrCount; |
| 255 | randomAccessWriteU2(attrCountPos, attrCount); |
| 256 | if (log.isTraceEnabled()) { |
| 257 | log.trace("class attrCount incremented"); |
| 258 | } |
| 259 | } |
| 260 | writeAttrForSDE(sdeIndex); |
| 261 | } |
| 262 | |
| 263 | void copyMembers() { |
| 264 | int count = readU2(); |
no test coverage detected