|
|
|
Re: Annotation processing type element look-up problem with Java 9 or later [message #1835494 is a reply to message #1835475] |
Fri, 04 December 2020 17:22   |
Scott Cameron Messages: 3 Registered: December 2020 |
Junior Member |
|
|
Hello again,
As I was trying to simplify my code enough to share a repro case, I noticed something that is a bit more specific. The exception happens when I pass a nested class name into Elements.getTypeElement. Interestingly, this triggers the exception:
elements.getTypeElement("com.scott.MyClass.MyNestedClass")
But this works fine:
elements.getTypeElement("com.scott.MyClass$MyNestedClass")
With the compiler Maven uses, only the first one works. The second one returns null because the type isn't found.
I'm guessing this must be a bug because the Javadoc for getTypeElement says that name should be the canonical name but Class.getCanonicalName returns the dot-separated version (e.g. com.scott.MyClass.MyNestedClass) so this fails:
elements.getTypeElement(MyNestedClass.class.getCanonicalName())
Do you know if this is a known issue already, or should I great a bug for that?
Cheers,
scott
[Updated on: Fri, 04 December 2020 17:26] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02319 seconds