-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Improve the dependency path exception message #11405
Conversation
maybe this should target 4.8.x |
Consider adding a full class name. I think IntelliJ will provide a link to the class |
How does it look with a factory method / field? |
Message: No bean of type [io.micronaut.inject.failures.NestedDependencyFailureSpec\$MyClassD] exists.$space | ||
Path Taken:$space | ||
new MyClassB() | ||
\\---> MyClassB.propA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an example of field here
For factory there is a circular dependency test: Lines 41 to 48 in da67f65
|
this is a good point, with the new lines maybe we can include qualified names. Can you check this link works in IntelliJ? |
@dstepanov WDYT? |
Intellij supports even shortened names, so we can reduce it if it's too large: try:
|
@andriy-dmytruk can you try that? |
Maybe we can have something like 200-300 characters per name and start reducing when it's more. |
the first one is the best yes |
…t on a new line. This improves the readability of message for long paths, large classnames or classes with many parameters, as each class from the path is immediately visible. I changed the tests to use longer classnames, which is more realistic.
Fully-qualified names are clickable in IDE terminals, which improves usability. Shortened form prevents the messages from being too convoluted.
351a91a
to
c5b8ae4
Compare
I went for using the first form always, as it is shortest, but is still clickable. We can also extend it at a later point if we experience issues with it.
We can start a GitHub discussion, but I think shortest should be good in most cases. The chances of conflict are pretty low. If we do need this, the typical line limits are 80, 100, 120, which would mean around 60 chars limit for the name alone. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just two small tweaks before merging.
*/ | ||
@Experimental | ||
public static String getShortenedName(String typeName) { | ||
int nameStart = typeName.lastIndexOf('$'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check type name doesn't == null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is not checked in other methods, so I assume it is not typical for typeName
to be null
. Added @NonNull
though.
@yawkat I don't understand the issue. Can you take a look? |
that test is just flakey. i dont know why |
Quality Gate passedIssues Measures |
This improves the readability of message for long paths, large class names or classes with many parameters, as each class from the path is immediately visible. I changed the tests to use longer class names, which is more realistic.
The type names are also in fully-qualified shortened form, which makes them clickable in IDEs.
As a comparison this message
will change to
Part of the change is similar to visualization change for circular dependencies: #11299.