R.S. question

Can R.S. replace in one go:

foo==null?null:foo.level1
foo==null?null:foo.levelOne.level2
by
foo.level1
foo.levelOne.level2
?

(the only filtering constraint is '$foo$ implements MyInterface')

I had to do it in 2 steps.

Alain

4 comments
Comment actions Permalink

It should

$foo$ == null ? null: $foo$.$bar$
by
$foo$.$bar$

Alain Ravet wrote:

Can R.S. replace in one go:

foo==null?null:foo.level1
foo==null?null:foo.levelOne.level2
by
foo.level1
foo.levelOne.level2
?

(the only filtering constraint is '$foo$ implements MyInterface')

I had to do it in 2 steps.

Alain



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

Maxim

It should
$foo$ == null ? null: $foo$.$bar$
by
$foo$.$bar$

>

On the code below, I replaced
$ssn$ == null ? null : $ssn$.$nodeOrMore$
by
$ssn$.$nodeOrMore$

with as sole constraint that $ssn$ inherits from Serializable
, and only the 1st target is found.

Alain


public final class Foo
{

public static void main (String[] args) {
SuperSuperNode ssn = new SuperSuperNode ();
Node node = ssn == null ? null : ssn.node; <<-- IS FOUND
Node node2 = ssn == null ? null : ssn.supernode.node; <---
is NOT found
}

private static class Node {
}
public static class SuperNode {
public Node node;
}
public static class SuperSuperNode implements Serializable{
public SuperNode supernode;
public Node node;
}
}

0
Comment actions Permalink

Caught the problem (and my error too), current any var should be well
formed part of psi tree, and to match $foo$.$bar$ with
ssn.supernode.node the constraint gets violated.

Lets file full blown JIRA request any way.

Alain Ravet wrote:

Maxim

>> It should
>> $foo$ == null ? null: $foo$.$bar$
>> by
>> $foo$.$bar$
>>


On the code below, I replaced
$ssn$ == null ? null : $ssn$.$nodeOrMore$
by
$ssn$.$nodeOrMore$

with as sole constraint that $ssn$ inherits from Serializable
, and only the 1st target is found.

Alain


public final class Foo
{

public static void main (String[] args) {
SuperSuperNode ssn = new SuperSuperNode ();
Node node = ssn == null ? null : ssn.node; <<-- IS FOUND
Node node2 = ssn == null ? null : ssn.supernode.node; <---
is NOT found
}

private static class Node {
}
public static class SuperNode {
public Node node;
}
public static class SuperSuperNode implements Serializable{
public SuperNode supernode;
public Node node;
}
}



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

Maxim

Lets file full blown JIRA request any way.



Done:
"R.S. problem"
http://www.jetbrains.net/jira/browse/IDEA-3693

Alain

0

Please sign in to leave a comment.