Community
Participate
Working Groups
Window>Preferences>Java>Compiler>Compliance and Classfiles Outofthebox, "Compiler compliance level" is 1.4 but source files with assert statements report errors. But! when I specifically customize "Source compatibility" and "Generated .class files compatibility" to 1.4 then the proper conformance behaviour happens.
This works as designed. Compliance 1.4 means that the compiler "behaves" like javac 1.4. By default javac 1.4 doesn't compile assert statements. You need to specify -source 1.4. This is done in Eclipse by changing the Source compatibility. Because -source 1.4 means -target 1.4, in Eclipse you also need to change the Generated .class files compatibility to 1.4 and set assert as an identifier to Error. Close as INVALID