drccrd commented on code in PR #3999:
URL:
https://github.com/apache/incubator-kie-tools/pull/3999#discussion_r4005291852
##########
packages/drools-lsp/drools-completion/src/main/java/org/drools/completion/JavaSourceTypeParser.java:
##########
@@ -172,22 +178,26 @@ private static JavaSourceType
fromInterface(JavaParser.InterfaceDeclarationConte
List<String> interfaces = (id.EXTENDS() != null &&
!id.typeList().isEmpty())
? simplifyAll(id.typeList(0)) : List.of();
- List<Field> fields = new ArrayList<>();
+ // An interface field is implicitly public static final, so
+ // collectInterfaceMember's field list is the constant list: it becomes
+ // the static view, not the member view, matching what reflection
+ // reports once the interface is compiled.
+ List<Field> constants = new ArrayList<>();
List<Field> getters = new ArrayList<>();
if (id.interfaceBody() != null) {
for (JavaParser.InterfaceBodyDeclarationContext ibd :
id.interfaceBody().interfaceBodyDeclaration()) {
try {
- collectInterfaceMember(ibd, fields, getters);
+ collectInterfaceMember(ibd, constants, getters);
} catch (Exception e) {
logger.fine(() -> "Skipping interface member in " +
simpleName + ": " + e.getMessage());
}
}
}
Map<String, Field> members = new LinkedHashMap<>();
- mergeGettersThenFields(members, getters, fields);
+ mergeGettersThenFields(members, getters, List.of());
return new JavaSourceType(fqcn(pkg, simpleName), simpleName, false,
null, interfaces,
- new ArrayList<>(members.values()), List.of(), List.of(),
+ new ArrayList<>(members.values()), List.of(), constants,
List.of(),
Review Comment:
passed static interface methods through in
[bad86b9](https://github.com/apache/incubator-kie-tools/pull/3999/commits/bad86b913e439f797c99b7667de59fc6cbe99a0d)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]