5

Trying to use a Java Enum in Jython but I can't figure out how to use them.

when importing I see the enum listed as BotInterface$MOVE so I've put down the line

from amazebot2012.BotInterface import MOVE

In Java I would normally just use it as

bot.move(MOVE.FORWARD);
bot.move(MOVE.BACKWARD);

What is the Jython equivalent once I've imported it?

Trying bot.move(MOVE.FORWARD) gives me the error:

Undefined variable from import: FORWARD

Brendan Long
  • 53,280
  • 21
  • 146
  • 188
Nebri
  • 773
  • 2
  • 8
  • 21

1 Answers1

1

Your import and reference seem correct.

I suspect this is a bug in your editing environment, if you're using PyDev/Anapta:

http://jira.appcelerator.org/browse/APSTUD-7502

  • Thank you Matt! I had not even considered that the problem may be in my IDE. I ignored the problem and forced it to compile and everything runs perfectly. – Nebri Nov 18 '12 at 04:39