Open AlexXuChen opened 3 years ago
One idea for doing this : The Java SearchEngine API should be able to search the entire project and find all type declarations. From there, it should just be a matter of figuring out if the total number of type declarations containing an ApplicationPath annotation is greater than 1.
Also @ApplicationPath
is only supported on a class that extends javax.ws.rs.Application
. We should validate that the type declaration satisfies this. Maybe even providing a code action to make the necessary fix.
Given two java files in a quarkus project:
MyApplication.java
import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application;
@ApplicationPath("/api") public class MyApplication extends Application {
}
The following error will occur when building the quarkus project:
We should have a diagnostic thrown to indicate that more than one
Application
class isn't supported.