-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Description
Vineflower version
1.12.0 (happens across all versions even fernflower)
Describe the bug
A field in another class with the same name as a field in the current class has its class qualifier removed when it was the target of an assignment.
Additional information
EDIT: Below I just vibe coded and got a working solution but don't know how accurate it is or what other issues it may cause so leaving it to the maintainers the file is AssignmentExprent and method is ToJava.
public TextBuffer toJava(int indent) {
VarType leftType = left.getInferredExprType(null);
boolean fieldInClassInit = false, hiddenField = false;
if (left instanceof FieldExprent) {
FieldExprent field = (FieldExprent) left;
ClassNode node = ((ClassNode) DecompilerContext.getContextProperty(DecompilerContext.CURRENT_CLASS_NODE));
if (node != null) {
StructField fd = node.classStruct.getField(field.getName(), field.getDescriptor().descriptorString);
if (fd != null) {
if (field.getClassname().equals(node.classStruct.qualifiedName)) { // Claude added this if statement to fix it
if (field.isStatic() && fd.hasModifier(CodeConstants.ACC_FINAL)) {
fieldInClassInit = true;
}
if (node.getWrapper() != null && node.getWrapper().getHiddenMembers().contains(InterpreterUtil.makeUniqueKey(fd.getName(), fd.getDescriptor()))) {
hiddenField = true;
}
}
}
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels