Community
Participate
Working Groups
In one project of mine, Eclipse seemed to compile all code correctly, where Sun's JDK 1.3.1_02 compiler caught an error described below. According to the Java Language Spec, section 8.4.6.3: The access modifier (ยง6.6) of an overriding or hiding method must provide at least as much access as the overridden or hidden method, or a compile-time error occurs. In my case, the error was when a method that was public in the superclass was overridden with default access. I altered the overrides to be public as well, and the command-line errors went away. Unfortunately, when I changed them back to reproduce it later, it caught the error. Hence its unpredictable nature. A bug like this could cause some serious issues when the JVM tries to access the subclass that has quietly reduced the visibility of an overridden method. This was running Eclipse 2.O-pre, build 20011219. I have not tried it on a more recent build, because it would not duplicate on this one. It might be worth a look.
For the following test case, I am getting the expected error: class X { public void foo(){} } class Y extends X { void foo(){} } Report for 1 markers: Marker 1: Resource: /Crap/src/X.java, Line: 15 Message: Cannot reduce the visibility of the inherited method from X Marker type: org.eclipse.jdt.core.problem Priority: Normal Please provide a reproduceable test case for us to investigate any further.
Cannot reproduce, closing, please reopen if you can reproduce it.