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

0
14 comments
Avatar
Permanently deleted user

why do you have "value="custom" in your XML whereas your class is named "Custom"?

0

Yeah, the attribute value must follow normal Java variable name capitalization, that's why I need a custom QueryExecutorBase to register with referencesSearch extension

0
Avatar
Permanently deleted user

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?

0

I'm building a plugin for a Java framework and the framework works like this :(

0

The framework will throw a RuntimeException when names conflict

0
Avatar
Permanently deleted user

What framework is this?

0
Avatar
Permanently deleted user

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.

0

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"

0
Avatar
Permanently deleted user

Thanks. One option to support this terrible abomination is to register your own implementation of 

com.intellij.codeInsight.daemon.ImplicitUsageProvider

 Override method isImplicitUsage() where for a given class check if there are MyBatis XML configuration files with typealiases defined for this class.

0

Thank you very very much for your help, I have spent a long time to solve this problem :)

1
Avatar
Permanently deleted user

how to you solve the problem? help me

0
Avatar
Permanently deleted user

Yeah I saw that. but still now i get the same error..

0

Please sign in to leave a comment.