• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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();
}
 
Maybe he went home and went to bed. And took this tiny ad with him:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic