Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@links to Java methods annotated with @JsProperty do not resolve correctly in Typescript #90

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.sun.source.util.DocTreePath;
import com.sun.source.util.DocTrees;
import com.sun.source.util.SimpleDocTreeVisitor;
import com.vertispan.tsdefs.impl.Formatting;
import com.vertispan.tsdefs.impl.HasProcessorEnv;
import com.vertispan.tsdefs.impl.builders.TsElement;
import java.util.Optional;
Expand Down Expand Up @@ -67,7 +68,12 @@ public String visitReference(ReferenceTree node, Element element) {
String refNamespace = refTsElement.getNamespace();
String parentNamespace = parentTsElement.getNamespace();

String name = refTsElement.getName();
boolean isSetterOrGetter = refTsElement.isSetter() || refTsElement.isGetter();

String name =
isSetterOrGetter
? Formatting.nonGetSetName(refTsElement.getName())
: refTsElement.getName();
String parentName = parentTsElement.getName();
if (refNamespace.equals(parentNamespace)) {
String fullName = refNamespace + "." + parentName + "." + name;
Expand Down Expand Up @@ -127,7 +133,7 @@ public String visitDocComment(DocCommentTree node, Element element) {
node.getBlockTags().stream()
.map(tag -> tag.accept(this, element))
.collect(Collectors.joining("\n"));
return body + "\n" + tags;
return " " + body + "\n" + tags;
}

@Override
Expand All @@ -145,6 +151,6 @@ public String visitLiteral(LiteralTree node, Element element) {

@Override
public String visitText(TextTree node, Element element) {
return " " + node.getBody();
return "" + node.getBody();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright © 2023 Vertispan
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.vertispan.tsdefs.tests.tsdocs.doclet.links.methods;

import jsinterop.annotations.JsProperty;

/** The entire point of this class is to let you use {@link #getSomethingImportant()}. */
public class MyClass {
@JsProperty
public String getSomethingImportant() {
return null;
}
}
Loading