开发者

MVEL nested property resolution issue

I have the following class

private static class Person{
    private int iq;  
    private Person[] minions;

    public int getIq() {
        return iq;
    }
    public Person[] getMinions() {
        return minions;
    } 
}

I'm trying out the following MVEL (1.3.16-java1.6) expression against this code

count = 0;
foreach (minion : minions){ 
    if (minions[count].iq > 120) { 
        re开发者_如何转开发turn true;
    } 
}
return false;

However MVEL seems to have problems with the minions[count].iq (or even minions[0].iq) construct.

Any inputs would be appreciated. The compilers exact grouse is

Caused by: java.lang.IllegalAccessException: Class org.mvel.optimizers.impl.asm.ASMAccessorOptimizer can not access a member of class Person with modifiers "public"


Your Person class is private, thus I assume it would not be visible to ASMAccessorOptimizer or if it would, ASMAccessorOptimizer would not have the rights to access it.

Declaring Person public should solve that issue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜