Skip to content

Commit

Permalink
feat(java_indexer): add method type parameters to MarkedSource (#5882)
Browse files Browse the repository at this point in the history
  • Loading branch information
schroederc committed Oct 6, 2023
1 parent 93bcd40 commit dc4b005
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
Expand Up @@ -151,6 +151,22 @@ private static MarkedSource construct(
.build());
}
}
if (sym.getKind() == ElementKind.METHOD && !sym.getTypeParameters().isEmpty()) {
MarkedSource.Builder typeParams =
markedSource
.addChildBuilder()
.setKind(MarkedSource.Kind.TYPE)
.setPostChildText(" ")
.setAddFinalListToken(true)
.addChildBuilder()
.setKind(MarkedSource.Kind.PARAMETER)
.setPreText("<")
.setPostText(">")
.setPostChildText(", ");
for (Symbol t : sym.getTypeParameters()) {
typeParams.addChildBuilder().setKind(MarkedSource.Kind.IDENTIFIER).setPreText(t.toString());
}
}
if (markedType != null && sym.getKind() != ElementKind.CONSTRUCTOR) {
markedSource.addChild(markedType);
}
Expand Down
Expand Up @@ -12,12 +12,28 @@ public final class RenderedCode {
// - Constructor.code/rendered/callsite_signature "RenderedCode()"
private RenderedCode() {}

// - @create defines/binding Create
// - Create.code/rendered/qualified_name "pkg.RenderedCode.create"
// - Create.code/rendered/signature "public static RenderedCode create()"
// - Create.code/rendered/callsite_signature "create()"
public static RenderedCode create() {
return null;
}

// - @Inner defines/binding Inner
// - Inner.code/rendered/qualified_name "pkg.RenderedCode.Inner"
// - Inner.code/rendered/signature "public static class Inner<T, U>"
// - Inner tparam.0 T
// - T.code/rendered/qualified_name "pkg.RenderedCode.Inner.T"
public static class Inner<T, U> {}
public static class Inner<T, U> {
// - @create defines/binding CreateInner
// - CreateInner.code/rendered/qualified_name "pkg.RenderedCode.Inner.create"
// - CreateInner.code/rendered/signature "public static <A, B> Inner<A, B> create()"
// - CreateInner.code/rendered/callsite_signature "create()"
public static <A, B> Inner<A, B> create() {
return null;
}
}

// - @CONSTANT defines/binding Constant
// - Constant.code/rendered/signature "public static final String CONSTANT"
Expand Down

0 comments on commit dc4b005

Please sign in to comment.