'Load classes from referenced project

I have a Quarkus Maven project, which has dependencies to multiple other projects.

Is it possible to load all classes (respectively class names) which are defined within my own project and the referenced ones?

I tried to get this information from the jandex.idx file in my project, but here only the classes, which are defined within the project itself are available.

Example / Test implementation

public String listClasses() {
    final var indexStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("/META-INF/jandex.idx");
    final var stringBuilder = new StringBuilder();

    if (indexStream != null) {
        IndexReader reader = new IndexReader(indexStream);
        try {
            Index index = reader.read();
            // index.getKnownClasses() contains only the classes of my project
            index.getKnownClasses().stream().forEach(c -> stringBuilder.append(c.name() + " || "));
        }
        catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    return stringBuilder.toString();
}

When using a Quarkus extension, the CombinedIndexBuildItem has all this information.

Example:

@BuildStep
void printBOs(CombinedIndexBuildItem combinedIndexBuildItem,
              BuildProducer<AdditionalBeanBuildItem> additionalBeans) {

    final var classInfos = combinedIndexBuildItem.getIndex().getKnownClasses();
    
    // classInfos contains all classes which are defined
}

But the usage of the Quarkus extension is not an option, as it requires to have a completely runnable "application" (in my understanding). So the build step of the quarkus-maven-plugin checks the application.properties, whether all injected interfaces have an implementation, etc.

As a hint: This is a simplified constellation. We have hundreds of Maven projects and every project/module needs to know its own classes and the ones from the referenced projects.



Solution 1:[1]

using VS Code in the browser as a text editor certainly feels handicapped after being used to the tooling provided by the Salesforce Extensions.

Salesforce certainly seems aware of this and the benefits of a browser based code editor. In June 2020 Salesforce announced a pilot of Code Builder, which is a browser based version of VS Code with the Salesforce extensions built into it.

At Dreamforce this year (2021) it was announced that a beta Code Builder would become available in Spring 22. The spring 22 release notes have recently been published. While it doesn't seem to mention Code Builder, it is clearly something that has been in the works for a while and could be seen soon. Keep your eyes peeled, and if anyone else has any further information I'd love to hear it!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jeff Kranz