Skip to content

Commit

Permalink
Clarify why field/method counts would be different after assembling
Browse files Browse the repository at this point in the history
  • Loading branch information
Col-E committed Nov 14, 2024
1 parent 8199604 commit 9549aa0
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -447,17 +447,21 @@ private CompletableFuture<Void> assemble() {
String memberType;
if (oldMember.isMethod()) {
memberType = "method";
if (assembledClass.getMethods().size() == methodCount) {
newMember = assembledClass.getDeclaredMethod(oldMember.getName(), oldMember.getDescriptor());
} else {
newMember = null;
newMember = assembledClass.getDeclaredMethod(oldMember.getName(), oldMember.getDescriptor());
if (methodCount != assembledClass.getMethods().size()){
ASTElement sourceAst = lastConcreteAst.get(0);
Error err = new Error("Assembling in this context detected a change in the number of methods.\n" +
"Check and see if your class has illegal duplicate method definitions.", sourceAst.location());
processErrors(List.of(err), ProblemPhase.BUILD);
}
} else {
memberType = "field";
if (assembledClass.getFields().size() == fieldCount) {
newMember = assembledClass.getDeclaredField(oldMember.getName(), oldMember.getDescriptor());
} else {
newMember = null;
newMember = assembledClass.getDeclaredField(oldMember.getName(), oldMember.getDescriptor());
if (fieldCount != assembledClass.getFields().size()){
ASTElement sourceAst = lastConcreteAst.get(0);
Error err = new Error("Assembling in this context detected a change in the number of fields.\n" +
"Check and see if your class has illegal duplicate field definitions.", sourceAst.location());
processErrors(List.of(err), ProblemPhase.BUILD);
}
}

Expand Down

0 comments on commit 9549aa0

Please sign in to comment.