[ nice-Bugs-809381 ] overriding in Java subclass

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.lang.nice.devel
Message-ID <[email protected]>
Bugs item #809381, was opened at 2003-09-19 10:04
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=809381&group_id=12788

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Isaac Gouy (igouy)
Assigned to: Nobody/Anonymous (nobody)
Summary: overriding in Java subclass

Initial Comment:
1) Java class Green has subclass Blue

2) Nice multiply1 adds method to Green

3) Java Exercise calls Nice multiply1

4) Adding override method to Blue in Nice multiply1 

results in a runtime error



I:\pls\Nice\test>javac test2\*.java



I:\pls\Nice\test>nicec test2

nice.lang: parsing

test2: parsing

test2: typechecking

test2: generating code

test2: linking



I:\pls\Nice\test>javac Multiple.java



I:\pls\Nice\test>java Multiple

Exception in thread "main" 

java.lang.NoClassDefFoundError: 

gnu/mapping/WrongType

        at Multiple.main(Multiple.java:9)





//------------------------------------------------

// compilation unit test\test2\Green.java



package test2;



public class Green {

   

   public Green( double value ) {

      this.value = value;

   }

   

   public double value() {

      return value;

   }

   

   public String toString() {

      return "" + value;

   }

   

   private double value;

}



//------------------------------------------------

// compilation unit test\test2\Blue.java



package test2;



public class Blue extends Green {

   

   public Blue( long lValue ) {

      super( lValue );

      this.lValue = lValue;

   }

   

   public long lValue() {

      return lValue;

   }



   public String toString() {

      return "" + lValue;

   }



   public long lValue;

}





//------------------------------------------------

// compilation unit test\test2\multiply1.nice



package test2;

import test2.*;



Green multiply1(Green this, Green other);

multiply1(this@Green, other@Green) = new Green

(this.value * other.value());





//Uncomment these lines and Multiple will have a runtime 

error

 multiply1(this@Blue, other@Blue) = new Blue(5);



//------------------------------------------------

// compilation unit test\Exercise.java

import test2.*;



public class Multiple {

   public static void main (String[] args) {

      Green x = new Green( 

3.141592653589793238462643383 );

      Green y = new Green( 1.0 );

      Green result = dispatch.multiply1(x,y);

      System.out.println(result);

   }

}

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=809381&group_id=12788


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.