diff --git a/src/main/java/me/coley/cafedude/classfile/annotation/ClassElementValue.java b/src/main/java/me/coley/cafedude/classfile/annotation/ClassElementValue.java index 8ff09a3..be218fc 100644 --- a/src/main/java/me/coley/cafedude/classfile/annotation/ClassElementValue.java +++ b/src/main/java/me/coley/cafedude/classfile/annotation/ClassElementValue.java @@ -25,7 +25,7 @@ public ClassElementValue(char tag, int classIndex) { } /** - * @return Index of class constant. + * @return Index of a class's descriptor. */ public int getClassIndex() { return classIndex; @@ -33,7 +33,7 @@ public int getClassIndex() { /** * @param classIndex - * Index of class constant. + * Index of a class's descriptor. */ public void setClassIndex(int classIndex) { this.classIndex = classIndex; diff --git a/src/main/java/me/coley/cafedude/transform/IllegalStrippingTransformer.java b/src/main/java/me/coley/cafedude/transform/IllegalStrippingTransformer.java index 4c4ec85..da43ae5 100644 --- a/src/main/java/me/coley/cafedude/transform/IllegalStrippingTransformer.java +++ b/src/main/java/me/coley/cafedude/transform/IllegalStrippingTransformer.java @@ -83,6 +83,8 @@ public IllegalStrippingTransformer(ClassFile clazz) { super(clazz); } + // TODO: Make it possible to track if calling transform did remove anything + @Override public void transform() { logger.info("Transforming '{}'", clazz.getName()); @@ -476,8 +478,8 @@ private void addElementValueValidation(AttributeHolder holder, ElementValue elementValue) { if (elementValue instanceof ClassElementValue) { int classIndex = ((ClassElementValue) elementValue).getClassIndex(); - expectedTypeMasks.put(classIndex, i -> i == ConstantPool.CLASS); - cpEntryValidators.put(classIndex, matchClassType()); + expectedTypeMasks.put(classIndex, i -> i == ConstantPool.UTF8); + cpEntryValidators.put(classIndex, matchUtf8ClassType()); } else if (elementValue instanceof EnumElementValue) { EnumElementValue enumElementValue = (EnumElementValue) elementValue; expectedTypeMasks.put(enumElementValue.getNameIndex(), i -> i == ConstantPool.UTF8);