Extension point for cross-language create method/field/JavaBean property?

The Java editor in IDEA has a number of nice "create from usage" QuickFixes.
If I write someObject.nonExistingMethod(), IDEA will offer to create the non-existing method for me.

Unfortunately, this does not seem to work across (JVM) language boundries at all.
For example, for Java code calling an unknown method on a Scala class (shown below), IDEA will blindly generate Java code and make a big mess of things.

public void aJavaMethod() {

If the initial target Scala class was empty, the QuickFix will mangle it to something like this (which is obviously broken):

class SomeScalaClass {
} public void nonExistingMethod ( ) {

Another very common case is integration with frameworks that use JavaBean properties.
For example, take the following spring xml that configures a Scala service:

<bean >                  
    <property name="unresolvedProperty" value="something"/>

The unresolvedProperty is not defined in the SomeScalaService Scala class, so the IDEA Spring plugin marks it red.
A QuickFix is offered, but invoking it corrupts the code, just like the earlier example above.

Even if the QuickFix produced the correct Scala signature, it could be more logical to use the concise Scala-specific @BeanProperty annotation.
The same would apply to Groovy, which unlike java has a native "Groovy property" concept that implicitly generates JavaBean accessors.

Imagine if an extension point for such "create method/field/property element" operations was available.
Not only would such QuickFixes produce valid code, each language implementation could contribute some variations that might be more applicable for the target language.
In the case of creating missing JavaBean properties in a Scala class, the language could suggest both an @BeanProperty-annotated var, as well as a regular setter method (in that order of preference).

I haven't been involved in PSI/plugin code for some years, so I could have misses some already existing infrastructure.
Not to complain too much, but this stuff has been broken for over three years. It sounds like a problem that can be solved, with quite some benefits.

Comments welcome :)


Comment actions Permalink

Aye, you're right about that. The "create from usage" feature is quite useful, while it's not so hard to implement it (and make it work across different languages).

There's another forum thread devoted to the same matter: Need "Create method"

So, I'v created SCL-2851 and suppose to complete it soon.


Please sign in to leave a comment.