[ nice-Bugs-790976 ] final field overriding fails at runtime

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.lang.nice.devel
Message-ID <[email protected]>
Bugs item #790976, was opened at 2003-08-19 16:19
Message generated for change (Comment added) made by dr_dee
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=790976&group_id=12788

Category: None
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Rohan Hart (dr_dee)
Assigned to: Nobody/Anonymous (nobody)
Summary: final field overriding fails at runtime

Initial Comment:
I've seen this only when the code has been precompiled

into a jar and that jar then used to build more code. 

The runtime error indicates that it's looking for an

<init> with the original field type but the subclass

only provides one with the overridden type.



first compile package a into a jar



----

package a;



abstract class A {}

class B extends A {}



abstract class AA {

  final A val;

}

class BB extends AA {

  override B val;

}



----

then try this test



/// PASS

  new BB(val: new B());



  /// toplevel

  import a;



----

result - java.lang.NoSuchMethodError: a.BB: method

<init>(La/A;)V not found



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

>Comment By: Rohan Hart (dr_dee)
Date: 2003-09-16 09:15

Message:
Logged In: YES 
user_id=774102

This can be closed

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

Comment By: Daniel Bonniot (bonniot)
Date: 2003-09-13 02:13

Message:
Logged In: YES 
user_id=88952

You normally should not pass client code in the -runtime

argument to TestNice. runtime is used to tell where the

standard library is.

The way I usually run tests is:

java -ea -classpath classes nice.tools.testsuite.TestNice

<some_dir>

from the toplevel of the Nice source tree.



Can you reproduce the bug with normal calls to the nicec

compiler? If not, then this is probably not a bug, and we

can close the report. If yes, then we can look for a way to

write a testcase that reproduces this condition, and of

course a fix.





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

Comment By: Rohan Hart (dr_dee)
Date: 2003-09-01 09:24

Message:
Logged In: YES 
user_id=774102

Seems the bug only appears if the precompiled jar is

included in the $CLASSPATH as well as the -runtime parameter

to nice.tools.testsuite.TestNice



However it looks like all but the fun.class files are

extracted from the jar by the tester, raising a

java.lang.NoClassDefFoundError instead.  Fixing this should

be easier

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

Comment By: Daniel Bonniot (bonniot)
Date: 2003-08-27 01:38

Message:
Logged In: YES 
user_id=88952

We have trouble reproducing this bug. Could you provide the

exact version of the compiler, and detailed instructions in

the steps you take to compile the different packages?

Do you really use a testcase for the last part?

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=790976&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.