evaluate code fragment says "statement not supported"

I am trying to evaluate something like this:
for (Entry<K, CacheValue<V>> valueArrayMapEntry : valueArrayMap.entrySet()) {
    logger.warn(valueArrayMapEntry.getValue().getCreateTime());
}

When i hit the 'evaluate' button, i see the following in the result box:

Statement 'for (Entry<K, CacheValue<V>> valueArrayMapEntry :  valueArrayMap.entrySet()) {    logger.warn(valueArrayMapEntry.getValue().getCreateTime());}' not supported'

However, the help page clearly says "Code Fragment Mode for evaluating  short code portions introducing them in the Statements  to evaluate text field. Supported constructs are declarations,  assignments, loops (for , while , do...while)  and if/else."

Please help!

4 comments
Comment actions Permalink

Turns out it does not like the 'for(x : xx)'.
Admins, should I open a bug? Same problem in IDEA7.x and IDEA9.0.2

0
Comment actions Permalink

Btw, maybe this will be helpful to someone.

When using a loop to calculate some value, the only way to get the output into the result box, is to add a 'silly assignment' at the end:

String s= "";

for (int i=0;i < 2; i++) {
s = s + i;  //code evaluation doesnt like the += operator
}

s=s; //silly assignment
then it will print the value in the results box

HTH

0
Comment actions Permalink

Yes, sure.

On 20.07.2010 18:49, Anton Mostovoy wrote:

Turns out it does not like the 'for(x : xx)'.
Admins, should I open a bug? Same problem in IDEA7.x and IDEA9.0.2

>

---
Original message URL: http://devnet.jetbrains.net/message/5268032#5268032


0

Please sign in to leave a comment.