Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

javac Vs jikes

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am facing some problems with the jikes compiler.
Let me put the scenario:
Child extends Parent which is abstract class.
Child class has one inner class called Inner.

Parent extends GrandParent.

someMethod of GrandParent is overridden in Child.

In one of the methods of inner class. Child.super.someMethod(); is called.
When I compile through the normal java compiler it creates Parent.class, GrandParent.class, Child.class, Child$Inner.class and Child$1.class.
When Child.super.someMethod() is called from Inner class method then GrandParent�s someMethod gets executed.
And if I compile through jikes compiler Child$1.class is not created.
When Child.super.someMethod() is called from Inner class method then Child�s someMethod gets executed.
I don�t know who is correct jikes or javac.
--Avinash
[ April 03, 2002: Message edited by: Michael Ernest ]
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Avinash -
Please change your screen name to conform to JavaRanch's naming policy.
I also took the liberty of modifying your code to include indents and use CODE tags for readability. Please let me know if I'm marked it up incorrectly.
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After I corrected your code so I could compile it using javac, I got Child.class and Child$Inner.class. I get no Child$1.class.

My output was:
In someMethod of child
SomeMethod of Grand Parent

by using Jikes, I got Child.class and Child$Inner.class.

My output was:
In someMethod of child
SomeMethod of Grand Parent
 
Avinash Bhosale
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Michael for the indentation.
I have changed my screen name also.
Sorry While pasting the code I have done a mistake.
In the method someMethod2() of Child class i have commented out the code. I was just experimenting with the code and by commenting out this code the annonymous inner class is not created if I compile through javac.
public void someMethod2()
{
Inner inner = new Inner();
inner.run();
}
 
Remember to always leap before you look. But always take the time to smell the tiny ads:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic