A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Engineering
»
IDEs, Version Control and other tools
Author
eclipse internal compiler bug
samantha clarkson
Ranch Hand
Joined: Sep 09, 2008
Posts: 48
posted
Aug 31, 2012 10:24:39
0
Hello,
I think there is a bug in the eclipse internal compiler,
consider :
public class Car extends Vehicle { }
public class Vehicle { public int publicVehiclefield; protected int protectedVehiclefield; private int privateVehiclefield; public void publicVehicleMethod() {} protected void protectedVehicleMethod() {} private void privateVehicleMethod() {} }
public class TestAll { public void testInheritence() { Vehicle vehicle = new Vehicle(); Car car = new Car(); System.out.println(car.publicVehiclefield); System.out.println(car.protectedVehiclefield); System.out.println(car.privateVehicleField); car.publicVehicleMethod(); car.protectedVehicleMethod(); car.privateVehicleMethod(); car.inexistantMethod(); } public static void main(String[] args) { TestAll t = new TestAll(); t.testInheritence(); } }
Under eclipse helios i got this
Exception in thread "main" java.lang.Error: Unresolved compilation problems: privateVehicleField cannot be resolved or is not a field The method privateVehicleMethod() from the type Vehicle is not visible The method inexistantMethod() is undefined for the type Car at TestAll.testInheritence(TestAll.java:15) at TestAll.main(TestAll.java:28)
normally the method privateVehicleMethod() should be considered undefined too like the inexistent one
under cmd windows javac 1.6
TestAll.java:15: cannot find symbol symbol : variable privateVehicleField location: class Car System.out.println(car.privateVehicleField); ^ TestAll.java:20: cannot find symbol symbol : method privateVehicleMethod() location: class Car car.privateVehicleMethod(); ^ TestAll.java:21: cannot find symbol symbol : method inexistantMethod() location: class Car car.inexistantMethod(); ^ 3 errors
javac compile clean i guess?!
what do you think?
farm rubbit hihihihihihi, be aware !!
William P O'Sullivan
Ranch Hand
Joined: Mar 28, 2012
Posts: 860
I like...
posted
Aug 31, 2012 10:32:21
0
That javac output is not "clean".
WP
samantha clarkson
Ranch Hand
Joined: Sep 09, 2008
Posts: 48
posted
Aug 31, 2012 10:45:27
0
William P O'Sullivan wrote:
That javac output is not "clean".
WP
may be the output is not "clean"
but it compiles correctly
I agree. Here's the link:
http://aspose.com/file-tools
subject: eclipse internal compiler bug
Similar Threads
Generics doubt
Basic Question.
What's wrong??
Ambigous compiling errors.
Creating Objects
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter