I am trying to add a field (called special) to a hibernate table. I am copying existing code (related to the NAME field) so I don't have to figure this out from scratch.
I am getting the error "[ERROR] C:\VOX\voxware-1.1.13\voxware\voxware-impl\src\main\java\com\voxware\impl\flow\VoxFlowConfiguration.java:[213,38] error: non-static variable special cannot be referenced from a static context".
Line 213 is in public void mergeFrom, the actual line is "special = VoxFlowConfiguration.special;" I don't understand why Java thinks special is a "non-static" variable but it doesn't have a problem with the other variables (such as name, orderShow)
Michael Piaser wrote:I don't understand why Java thinks special is a "non-static" variable but it doesn't have a problem with the other variables (such as name, orderShow)
That's because you haven't tried to use VoxFlowConfiguration.name or VoxFlowConfiguration.orderShow. If you looked at the place where you used those variables, you'll see that you wrote voxFlowConfiguration.name -- this says to use the public name variable of the object referred to by the variable voxFlowConfiguration. This isn't a static context because it's about an object, and so it's not a problem. However when you used the special variable you'll see that you wrote VoxFlowConfiguration.special -- this says to use the public special variable of the VoxFlowConfiguration class. And that's a static context because it's about a class, not an object.
If you still don't see the difference then let me point out that VoxFlowConfiguration and voxFlowConfiguration aren't the same thing. They are two confusingly similar names.
posted 5 years ago
Thanks - basically I accidentally used the wrong case in the first letter and didn't notice it.