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

Pretty-print throws clause in method signatures #160

Merged
merged 1 commit into from
Apr 16, 2021

Conversation

Strum355
Copy link
Member

Add 'throws' field to MethodSignature in semanticdb for implementing pretty-printing, to be upstreamed to semanticdb spec.
This is a fairly trivial change so it shouldnt be a big deal to upstream.

Closes #147

Copy link
Member

@olafurpg olafurpg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm investigating in #163 why the CI is failing.

One minor comments, otherwise looks good

@@ -17,7 +17,7 @@ private static String staticOverload(String value) {
return value + "1";
}

public static String app(int n, String m) {
public static String app(int n, String m) throws RuntimeException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised that epoxy doesn't use throws anywhere. Checked exceptions are IMO one of the biggest pains of working with Java. Can we add one test case where the exception has type parameters just to stress the code path that throws is Type and not symbols

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out custom exceptions (that extend Exception/Throwable) cant have type parameters 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did you find examples with type parameters? Are they only in the JDK?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly "conclusive" or "proving" evidence by any means 😁

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ive added an additional exception to the signature to make up for it. Gonna merge 👍

@Strum355 Strum355 force-pushed the nsc/method-throws-formatter branch from ec7e190 to 6d6a27c Compare April 16, 2021 12:51
@Strum355 Strum355 merged commit 5750340 into main Apr 16, 2021
@Strum355 Strum355 deleted the nsc/method-throws-formatter branch April 16, 2021 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add throws clause to pretty-printed signature
2 participants