CPD Results
The following document contains the results of PMD's CPD 7.26.0.
Duplications
| File |
Line |
| org/apache/bcel/classfile/NestMembers.java |
96 |
| org/apache/bcel/classfile/PermittedSubclasses.java |
99 |
final NestMembers c = (NestMembers) clone();
if (classes.length > 0) {
c.classes = classes.clone();
}
c.setConstantPool(constantPool);
return c;
}
/**
* Dumps NestMembers attribute to file stream in binary format.
*
* @param file Output file stream.
* @throws IOException Thrown if an I/O error occurs.
*/
@Override
public void dump(final DataOutputStream file) throws IOException {
super.dump(file);
file.writeShort(Args.requireU2(classes.length, "classes.length"));
for (final int index : classes) {
file.writeShort(index);
}
}
/**
* Gets the classes.
*
* @return array of indices into constant pool of class names.
*/
public int[] getClasses() {
return classes;
}
/**
* Gets the class names.
*
* @return string array of class names.
*/
public String[] getClassNames() {
final String[] names = new String[classes.length];
Arrays.setAll(names, i -> Utility.pathToPackage(super.getConstantPool().getConstantString(classes[i], Const.CONSTANT_Class)));
return names;
}
/**
* Gets the number of classes.
*
* @return Length of classes table.
*/
public int getNumberClasses() {
return classes.length;
}
/**
* Sets the classes.
*
* @param classes The list of class indexes Also redefines number_of_classes according to table length.
*/
public void setClasses(final int[] classes) {
this.classes = ArrayUtils.nullToEmpty(classes);
}
/**
* @return String representation, that is, a list of classes.
*/
@Override
public String toString() {
final StringBuilder buf = new StringBuilder();
buf.append("NestMembers("); |
| File |
Line |
| org/apache/bcel/Const.java |
2987 |
| org/apache/bcel/Const.java |
3006 |
{ T_BYTE }/* astore */, {}/* istore_0 */, {}/* istore_1 */, {}/* istore_2 */, {}/* istore_3 */, {}/* lstore_0 */, {}/* lstore_1 */,
{}/* lstore_2 */, {}/* lstore_3 */, {}/* fstore_0 */, {}/* fstore_1 */, {}/* fstore_2 */, {}/* fstore_3 */, {}/* dstore_0 */, {}/* dstore_1 */,
{}/* dstore_2 */, {}/* dstore_3 */, {}/* astore_0 */, {}/* astore_1 */, {}/* astore_2 */, {}/* astore_3 */, {}/* iastore */, {}/* lastore */,
{}/* fastore */, {}/* dastore */, {}/* aastore */, {}/* bastore */, {}/* castore */, {}/* sastore */, {}/* pop */, {}/* pop2 */, {}/* dup */,
{}/* dup_x1 */, {}/* dup_x2 */, {}/* dup2 */, {}/* dup2_x1 */, {}/* dup2_x2 */, {}/* swap */, {}/* iadd */, {}/* ladd */, {}/* fadd */,
{}/* dadd */, {}/* isub */, {}/* lsub */, {}/* fsub */, {}/* dsub */, {}/* imul */, {}/* lmul */, {}/* fmul */, {}/* dmul */, {}/* idiv */,
{}/* ldiv */, {}/* fdiv */, {}/* ddiv */, {}/* irem */, {}/* lrem */, {}/* frem */, {}/* drem */, {}/* ineg */, {}/* lneg */, {}/* fneg */, |
| File |
Line |
| org/apache/bcel/verifier/structurals/ControlFlowGraph.java |
129 |
| org/apache/bcel/verifier/structurals/Subroutines.java |
367 |
single[0] = ((JsrInstruction) inst).getTarget();
return single;
}
if (inst instanceof GotoInstruction) {
single[0] = ((GotoInstruction) inst).getTarget();
return single;
}
if (inst instanceof BranchInstruction) {
if (inst instanceof Select) {
// BCEL's getTargets() returns only the non-default targets,
// thanks to Eli Tilevich for reporting.
final InstructionHandle[] matchTargets = ((Select) inst).getTargets();
final InstructionHandle[] ret = new InstructionHandle[matchTargets.length + 1];
ret[0] = ((Select) inst).getTarget();
System.arraycopy(matchTargets, 0, ret, 1, matchTargets.length);
return ret;
}
final InstructionHandle[] pair = new InstructionHandle[2];
pair[0] = getInstruction().getNext(); |
| File |
Line |
| org/apache/bcel/classfile/ConstantClass.java |
73 |
| org/apache/bcel/classfile/ConstantModule.java |
78 |
| org/apache/bcel/classfile/ConstantPackage.java |
78 |
v.visitConstantClass(this);
}
/**
* Dumps constant class to file stream in binary format.
*
* @param file Output file stream.
* @throws IOException Thrown if an I/O error occurs writing to the DataOutputStream.
*/
@Override
public void dump(final DataOutputStream file) throws IOException {
file.writeByte(super.getTag());
file.writeShort(nameIndex);
}
/**
* Gets the dereferenced string.
*
* @param cp The constant pool.
* @return dereferenced string.
*/
public String getBytes(final ConstantPool cp) {
return (String) getConstantValue(cp);
}
/**
* Gets the String object.
*
* @param cp The constant pool.
* @return String object.
*/
@Override
public Object getConstantValue(final ConstantPool cp) {
return cp.getConstantUtf8(nameIndex).getBytes();
}
/**
* Gets the name index in constant pool of class name.
*
* @return Name index in constant pool of class name.
*/
public int getNameIndex() {
return nameIndex;
}
/**
* Sets the name index in the constant pool.
*
* @param nameIndex The name index in the constant pool of this Constant Class.
*/
public void setNameIndex(final int nameIndex) {
this.nameIndex = nameIndex;
}
/**
* @return String representation.
*/
@Override
public String toString() {
return super.toString() + "(nameIndex = " + nameIndex + ")";
}
} |
| File |
Line |
| org/apache/bcel/Const.java |
2991 |
| org/apache/bcel/Const.java |
3006 |
{}/* dup_x1 */, {}/* dup_x2 */, {}/* dup2 */, {}/* dup2_x1 */, {}/* dup2_x2 */, {}/* swap */, {}/* iadd */, {}/* ladd */, {}/* fadd */,
{}/* dadd */, {}/* isub */, {}/* lsub */, {}/* fsub */, {}/* dsub */, {}/* imul */, {}/* lmul */, {}/* fmul */, {}/* dmul */, {}/* idiv */,
{}/* ldiv */, {}/* fdiv */, {}/* ddiv */, {}/* irem */, {}/* lrem */, {}/* frem */, {}/* drem */, {}/* ineg */, {}/* lneg */, {}/* fneg */,
{}/* dneg */, {}/* ishl */, {}/* lshl */, {}/* ishr */, {}/* lshr */, {}/* iushr */, {}/* lushr */, {}/* iand */, {}/* land */, {}/* ior */,
{}/* lor */, {}/* ixor */, {}/* lxor */, { T_BYTE, T_BYTE }/* iinc */, {}/* i2l */, {}/* i2f */, {}/* i2d */, {}/* l2i */, {}/* l2f */, {}/* l2d */, |
| File |
Line |
| org/apache/bcel/Const.java |
2987 |
| org/apache/bcel/Const.java |
2991 |
{ T_BYTE }/* astore */, {}/* istore_0 */, {}/* istore_1 */, {}/* istore_2 */, {}/* istore_3 */, {}/* lstore_0 */, {}/* lstore_1 */,
{}/* lstore_2 */, {}/* lstore_3 */, {}/* fstore_0 */, {}/* fstore_1 */, {}/* fstore_2 */, {}/* fstore_3 */, {}/* dstore_0 */, {}/* dstore_1 */,
{}/* dstore_2 */, {}/* dstore_3 */, {}/* astore_0 */, {}/* astore_1 */, {}/* astore_2 */, {}/* astore_3 */, {}/* iastore */, {}/* lastore */,
{}/* fastore */, {}/* dastore */, {}/* aastore */, {}/* bastore */, {}/* castore */, {}/* sastore */, {}/* pop */, {}/* pop2 */, {}/* dup */,
{}/* dup_x1 */, {}/* dup_x2 */, {}/* dup2 */, {}/* dup2_x1 */, {}/* dup2_x2 */, {}/* swap */, {}/* iadd */, {}/* ladd */, {}/* fadd */, |
| File |
Line |
| org/apache/bcel/verifier/statics/Pass2Verifier.java |
1035 |
| org/apache/bcel/verifier/statics/Pass2Verifier.java |
1063 |
| org/apache/bcel/verifier/statics/Pass2Verifier.java |
1096 |
throw new ClassConstraintException("Invalid field name '" + name + "' referenced by '" + tostring(obj) + "'.");
}
final int classIndex = obj.getClassIndex();
final ConstantClass cc = (ConstantClass) cp.getConstant(classIndex);
final String className = ((ConstantUtf8) cp.getConstant(cc.getNameIndex())).getBytes(); // Class Name in internal form
if (!validClassName(className)) {
throw new ClassConstraintException("Illegal class name '" + className + "' used by '" + tostring(obj) + "'.");
}
final String sig = ((ConstantUtf8) cp.getConstant(cnat.getSignatureIndex())).getBytes(); // Field or Method sig.(=descriptor)
try { |
| File |
Line |
| org/apache/bcel/verifier/structurals/ExecutionVisitor.java |
844 |
| org/apache/bcel/verifier/structurals/ExecutionVisitor.java |
894 |
public void visitINVOKEINTERFACE(final INVOKEINTERFACE o) {
stack().pop(); // objectref
stack().pop(o.getArgumentTypes(cpg).length);
// We are sure the invoked method will xRETURN eventually
// We simulate xRETURNs functionality here because we
// don't really "jump into" and simulate the invoked
// method.
if (o.getReturnType(cpg) != Type.VOID) {
Type t = o.getReturnType(cpg);
if (t.equals(Type.BOOLEAN) || t.equals(Type.CHAR) || t.equals(Type.BYTE) || t.equals(Type.SHORT)) {
t = Type.INT;
}
stack().push(t);
}
}
/** Symbolically executes the corresponding Java Virtual Machine instruction. */
@Override
public void visitINVOKESPECIAL(final INVOKESPECIAL o) { |
| File |
Line |
| org/apache/bcel/util/CodeHTML.java |
162 |
| org/apache/bcel/util/CodeHTML.java |
451 |
break;
/*
* Two address bytes + offset from start of byte stream form the jump target.
*/
case Const.GOTO:
case Const.IFEQ:
case Const.IFGE:
case Const.IFGT:
case Const.IFLE:
case Const.IFLT:
case Const.IFNE:
case Const.IFNONNULL:
case Const.IFNULL:
case Const.IF_ACMPEQ:
case Const.IF_ACMPNE:
case Const.IF_ICMPEQ:
case Const.IF_ICMPGE:
case Const.IF_ICMPGT:
case Const.IF_ICMPLE:
case Const.IF_ICMPLT:
case Const.IF_ICMPNE:
case Const.JSR:
index = bytes.getIndex() + bytes.readShort() - 1; |
| File |
Line |
| org/apache/bcel/Const.java |
2968 |
| org/apache/bcel/Const.java |
3069 |
| org/apache/bcel/Const.java |
3103 |
2/* ifnonnull */, 4/* goto_w */, 4/* jsr_w */, 0/* breakpoint */, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, RESERVED/* impdep1 */, RESERVED/* impdep2 */ |
| File |
Line |
| org/apache/bcel/classfile/Utility.java |
372 |
| org/apache/bcel/util/CodeHTML.java |
103 |
}
// Both cases have a field default_offset in common
defaultOffset = bytes.readInt();
}
switch (opcode) {
/*
* Table switch has variable length arguments.
*/
case Const.TABLESWITCH:
low = bytes.readInt();
high = bytes.readInt();
offset = bytes.getIndex() - 12 - noPadBytes - 1;
defaultOffset += offset;
// Each jump table entry is a 4 byte offset, so a well-formed table cannot declare more entries than fit
// into the remaining byte code; checking before allocating keeps a crafted low/high pair from forcing a
// huge allocation.
final long jumpTableLength = (long) high - low + 1;
if (jumpTableLength < 0 || jumpTableLength * 4 > bytes.available()) {
throw new ClassFormatException("Invalid TABLESWITCH: low = " + low + ", high = " + high + " but only " + bytes.available() + " bytes remain");
}
buf.append("\tdefault = ").append(defaultOffset).append(", low = ").append(low).append(", high = ").append(high).append("("); |
| File |
Line |
| org/apache/bcel/verifier/structurals/ExecutionVisitor.java |
845 |
| org/apache/bcel/verifier/structurals/ExecutionVisitor.java |
871 |
| org/apache/bcel/verifier/structurals/ExecutionVisitor.java |
895 |
stack().pop(); // objectref
stack().pop(o.getArgumentTypes(cpg).length);
// We are sure the invoked method will xRETURN eventually
// We simulate xRETURNs functionality here because we
// don't really "jump into" and simulate the invoked
// method.
if (o.getReturnType(cpg) != Type.VOID) {
Type t = o.getReturnType(cpg);
if (t.equals(Type.BOOLEAN) || t.equals(Type.CHAR) || t.equals(Type.BYTE) || t.equals(Type.SHORT)) {
t = Type.INT;
}
stack().push(t);
}
}
/** Symbolically executes the corresponding Java Virtual Machine instruction. */
@Override
public void visitINVOKESPECIAL(final INVOKESPECIAL o) { |
| File |
Line |
| org/apache/bcel/Const.java |
2968 |
| org/apache/bcel/Const.java |
3069 |
| org/apache/bcel/Const.java |
3103 |
2/* ifnonnull */, 4/* goto_w */, 4/* jsr_w */, 0/* breakpoint */, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, RESERVED/* impdep1 */, RESERVED/* impdep2 */ |
| File |
Line |
| org/apache/bcel/Const.java |
3069 |
| org/apache/bcel/Const.java |
3103 |
UNPREDICTABLE/* multianewarray */, 1/* ifnull */, 1/* ifnonnull */, 0/* goto_w */, 0/* jsr_w */, 0/* breakpoint */, UNDEFINED, UNDEFINED, UNDEFINED,
UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNPREDICTABLE/* impdep1 */, |
| File |
Line |
| org/apache/bcel/classfile/Utility.java |
1587 |
| org/apache/bcel/classfile/Utility.java |
1610 |
if (signature.charAt(consumedChars) == '+') {
type.append("? extends ");
consumedChars++;
} else if (signature.charAt(consumedChars) == '-') {
type.append("? super ");
consumedChars++;
}
// get the first TypeArgument
if (signature.charAt(consumedChars) == '*') {
type.append("?");
consumedChars++;
} else {
type.append(typeSignatureToString(signature.substring(consumedChars), chopit, depth + 1));
// update our consumed count by the number of characters the for type argument
consumedChars = unwrap(CONSUMER_CHARS) + consumedChars;
wrap(CONSUMER_CHARS, consumedChars);
} |
|