Skip to content

Commit

Permalink
Fix arg name inference for array types
Browse files Browse the repository at this point in the history
If you are extending a class and haven't implemented an abstract method
that contains an argument that's an array type,
and the array element type is a well-known type such as `java.lang.Object`,
this will now properly use the suggested name from JDT.

eg. parent signature `abstract public void useArray(Object[] arg1)`

child signature `public void useArray(Object[] o)`

`o` is the JDT suggested name for objects.

Signed-off-by: David Thompson <davthomp@redhat.com>
  • Loading branch information
datho7561 committed Aug 13, 2024
1 parent e3431f2 commit 180cf6f
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ private IJavaElement getJavaElementForMethodDeclaration(IType currentType, Metho

private String resolveTypeName(com.sun.tools.javac.code.Type type, boolean binary) {
if (binary) {
if (type instanceof com.sun.tools.javac.code.Type.ArrayType arrayType) {
return resolveTypeName(arrayType.elemtype, binary) + "[]";
}
TypeSymbol sym = type.asElement();
if (sym != null) {
return sym.getQualifiedName().toString();
Expand Down

0 comments on commit 180cf6f

Please sign in to comment.