Fixed bug in java codegeneration

Note: Assert's don't run in Eclipse.