Referenced PsiClass stays as "Class 'ClassName' is never used"
I created an XML configuration file and make an attribute value be referencing to a PsiClass. Here is the XML and JAVA file segment
<settings>
<setting name="configurationFactory" value="custom"/>
</settings>
public class Custom {
}
Currently, I can navigate (reference) from the attribute value 'custom' to class 'Custom' based on my custom PsiReference, and I have implemented a QueryExecutorBase (referencesSearch) to find usage for class 'Custom', and it works well if I use 'Find Usages' functionality. But we I open the class 'Custom' directly, it still says 'Class 'Custom' is never used'.
Can anyone help me, please, thanks
Please sign in to leave a comment.
why do you have "value="custom" in your XML whereas your class is named "Custom"?
Yeah, the attribute value must follow normal Java variable name capitalization, that's why I need a custom QueryExecutorBase to register with referencesSearch extension
It's the first time we stumble on a framework which willingly pushes itself into problems,
because classes in Java are case-sensitive but your framework assumes they are not.
E.g.
value="myClass" // aaaa which class to choose from two candidates?
class MyClass {}
class myClass {}
Why not follow the same capitalization rules in both XML attribute values and Java?
I'm building a plugin for a Java framework and the framework works like this :(
The framework will throw a RuntimeException when names conflict
What framework is this?
It's MyBatis
I see. Could you please point me to the documentation or an example where this case-insensitivity is allowed? Because I can't find any. Thanks.
It's here http://www.mybatis.org/mybatis-3/configuration.html ->
"Each bean found in domain.blog , if no annotation is found, will be registered as an alias using uncapitalized non-qualified class name of the bean. That is domain.blog.Author will be registered as author"
Thanks. One option to support this terrible abomination is to register your own implementation of
Override method isImplicitUsage() where for a given class check if there are MyBatis XML configuration files with typealiases defined for this class.
Thank you very very much for your help, I have spent a long time to solve this problem :)
how to you solve the problem? help me
See the Alexey Kudravtsev's answer
Yeah I saw that. but still now i get the same error..