Skip to content

Commit

Permalink
Micronaut: Provide Endpoint and Bean symbols originating from libraries.
Browse files Browse the repository at this point in the history
  • Loading branch information
dbalek committed Jun 20, 2024
1 parent b4f3d08 commit 382aeba
Show file tree
Hide file tree
Showing 6 changed files with 489 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public List<StructureElement> getStructure(Document doc) {
JavaSource js = JavaSource.forDocument(doc);
if (js != null) {
ClassPath cp = js.getClasspathInfo().getClassPath(ClasspathInfo.PathKind.COMPILE);
if (cp.findResource("io/micronaut/http/annotation/HttpMethodMapping.class") != null) {
if (cp.findResource("io/micronaut/http/annotation/HttpMethodMapping.class") != null
|| cp.findResource("io/micronaut/management/endpoint/annotation/Endpoint.class") != null) {
try {
List<StructureElement> elements = new ArrayList<>();
js.runUserActionTask(cc -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public List<? extends Diagnostic> computeErrors(Context context) {
"ERR_Duplicated_URI_path=Duplicated endpoint URI path: {0}"
})
private Diagnostic desc2diag(MicronautSymbolSearcher.SymbolDescriptor descriptor) {
OffsetRange offsetRange = descriptor.getOffsetRange(null);
return Diagnostic.Builder.create(() -> offsetRange.getStart(), () -> offsetRange.getEnd(), Bundle.ERR_Duplicated_URI_path(descriptor.getName()))
OffsetRange offsetRange = descriptor.getElement().getOffsetRange(null);
return Diagnostic.Builder.create(() -> offsetRange.getStart(), () -> offsetRange.getEnd(), Bundle.ERR_Duplicated_URI_path(descriptor.getElement().getName()))
.setCode("WARN_Duplicated_MN_Data_Endpoint_Path " + offsetRange.getStart() + " - " + offsetRange.getEnd())
.setSeverity(Diagnostic.Severity.Warning)
.build();
Expand Down
Loading

0 comments on commit 382aeba

Please sign in to comment.