Java interop #1: synthetic accessors for 'Groovy bean properties'


GRVY-314 was marked as "Won't Fix".
However, I still think that the current behaviour is wrong.
I'll try to explain why, breaking the observed problem into two parts.

First part
-


Java module has Groovy facet and contains a groovy class.

Groovy code (GroovyBean.groovy):
-


class GroovyBean {
String someString;
}
-



Java client calling above groovy class (JavaClient.java):
-


public class JavaClient {
public static void main(String[] args) {
GroovyBean b = new GroovyBean();
b.setSomeString("test"); // should be "green" but is "red"
}
}
-



Observed behavior:
1) Code is red: In the Java code, method "setSomeString" is marked as unresolved.
2) Now compile the groovy class, attach the compiled version as a library
and delete the original source. Result: code is green.

For 'Groovy properties', the groovy PSI should include a getter and setter,
as described here:
http://groovy.codehaus.org/Groovy+Beans
(section "Property and field rules")

-tt


0
7 comments
Avatar
Permanently deleted user

It is indeed a bug, though your conslusions about groovy psi containing accessors is not necessary.

0

Hello Eugene,

It is indeed a bug, though your conslusions about groovy psi
containing accessors is not necessary.


Is there a ticket already in JIRA? Then I can add myself as 'watcher'.

-tt


0

Hello Eugene,

It is indeed a bug, though your conslusions about groovy psi
containing accessors is not necessary.


Hmm, would it not make sense if 'synthetic' accessors were present in the
PSI?
Then a lot of current plugins that work with getters/setters of a (Java)
class would transparently work with groovy classes (containing such special
'groovy properties').

-tt


0
Avatar
Permanently deleted user

I'm not sure they would like synthetic psi. What it would certainly cause is the performance penalty.

0
Avatar
Permanently deleted user

No, please submit one.

0
Avatar
Permanently deleted user

No, please submit one.

0

I'm not sure they would like synthetic psi. What it would certainly
cause is the performance penalty.


One concrete example would be spring facet from Selena.
As far as I can see property resolving is based on com.intellij.psi.util.PropertyUtil.

At the moment no properties are returned of course, for the reason mentioned
in this thread. :)

-tt


0

Please sign in to leave a comment.