/** * Marks the given visitor accepter as being used. */ private void markAsUsed(Constant constant) { constant.setVisitorInfo(USED); }
public int getTag(int constantIndex) { return constantPool[constantIndex].getTag(); }
public void interfaceConstantsAccept(ConstantVisitor constantVisitor) { for (int index = 0; index < u2interfacesCount; index++) { constantPool[u2interfaces[index]].accept(this, constantVisitor); } }
public int getTag(int constantIndex) { return constantPool[constantIndex].getTag(); }
/** * Checks whether the given constant contains wildcard indices. */ private boolean containsWildcard(Clazz clazz, Constant constant) { wildcardChecker.containsWildcard = false; constant.accept(clazz, wildcardChecker); return wildcardChecker.containsWildcard; }
public int getTag(int constantIndex) { return constantPool[constantIndex].getTag(); }
public void constantPoolEntriesAccept(ConstantVisitor constantVisitor) { for (int index = 1; index < u2constantPoolCount; index++) { if (constantPool[index] != null) { constantPool[index].accept(this, constantVisitor); } } }
/** * Marks the given visitor accepter as being used. */ private void markAsUsed(Constant constant) { constant.setVisitorInfo(USED); }
public int getTag(int constantIndex) { return constantPool[constantIndex].getTag(); }
/** * Adds a copy of the given constant in the given class and returns * its index. */ public int addConstant(Clazz clazz, Constant constant) { constant.accept(clazz, this); return this.constantIndex; }
/** * Marks the given visitor accepter as being used. */ private void markAsUsed(Constant constant) { constant.setVisitorInfo(USED); }
public int compareTo(Object other) { ComparableConstant otherComparableConstant = (ComparableConstant)other; otherConstant = otherComparableConstant.thisConstant; // Compare based on the original indices, if the actual constant pool // entries are the same. if (thisConstant == otherConstant) { int otherIndex = otherComparableConstant.thisIndex; return thisIndex < otherIndex ? -1 : thisIndex == otherIndex ? 0 : 1; } // Compare based on the tags, if they are different. int thisTag = thisConstant.getTag(); int otherTag = otherConstant.getTag(); if (thisTag != otherTag) { return PRIORITIES[thisTag] < PRIORITIES[otherTag] ? -1 : 1; } // Otherwise compare based on the contents of the Constant objects. thisConstant.accept(clazz, this); return result; }
/** * Finds or creates a MethodHandleConstant constant pool entry of the * specified kind and with the given field ref, interface method ref, * or method ref constant pool entry index. * @return the constant pool index of the MethodHandleConstant. */ public int addMethodHandleConstant(int referenceKind, int referenceIndex) { int constantPoolCount = targetClass.u2constantPoolCount; Constant[] constantPool = targetClass.constantPool; // Check if the entry already exists. for (int index = 1; index < constantPoolCount; index++) { Constant constant = constantPool[index]; if (constant != null && constant.getTag() == ClassConstants.CONSTANT_MethodHandle) { MethodHandleConstant methodHandleConstant = (MethodHandleConstant)constant; if (methodHandleConstant.u1referenceKind == referenceKind && methodHandleConstant.u2referenceIndex == referenceIndex) { return index; } } } return addConstant(new MethodHandleConstant(referenceKind, referenceIndex)); }
/** * Checks whether the given constant contains wildcard indices. */ private boolean containsWildcard(Clazz clazz, Constant constant) { wildcardChecker.containsWildcard = false; constant.accept(clazz, wildcardChecker); return wildcardChecker.containsWildcard; }
public int compareTo(Object other) { ComparableConstant otherComparableConstant = (ComparableConstant)other; otherConstant = otherComparableConstant.thisConstant; // Compare based on the original indices, if the actual constant pool // entries are the same. if (thisConstant == otherConstant) { int otherIndex = otherComparableConstant.thisIndex; return thisIndex < otherIndex ? -1 : thisIndex == otherIndex ? 0 : 1; } // Compare based on the tags, if they are different. int thisTag = thisConstant.getTag(); int otherTag = otherConstant.getTag(); if (thisTag != otherTag) { return PRIORITIES[thisTag] < PRIORITIES[otherTag] ? -1 : 1; } // Otherwise compare based on the contents of the Constant objects. thisConstant.accept(clazz, this); return result; }
/** * Finds or creates a MethodHandleConstant constant pool entry of the * specified kind and with the given field ref, interface method ref, * or method ref constant pool entry index. * @return the constant pool index of the MethodHandleConstant. */ public int addMethodHandleConstant(int referenceKind, int referenceIndex) { int constantPoolCount = targetClass.u2constantPoolCount; Constant[] constantPool = targetClass.constantPool; // Check if the entry already exists. for (int index = 1; index < constantPoolCount; index++) { Constant constant = constantPool[index]; if (constant != null && constant.getTag() == ClassConstants.CONSTANT_MethodHandle) { MethodHandleConstant methodHandleConstant = (MethodHandleConstant)constant; if (methodHandleConstant.u1referenceKind == referenceKind && methodHandleConstant.u2referenceIndex == referenceIndex) { return index; } } } return addConstant(new MethodHandleConstant(referenceKind, referenceIndex)); }
public void superClassConstantAccept(ConstantVisitor constantVisitor) { if (u2superClass != 0) { constantPool[u2superClass].accept(this, constantVisitor); } }