[ nice-Bugs-1060718 ] Cant access protected members of a java class
"SourceForge.net" <[email protected]> Sun, 14 Nov 2004 21:04:39 -0800
| Newsgroups | gmane.comp.lang.nice.devel |
|---|---|
| Message-ID | <[email protected]> |
Bugs item #1060718, was opened at 2004-11-04 21:06
Message generated for change (Comment added) made by leblin
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=1060718&group_id=12788
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Luc Perrin (leblin)
Assigned to: Nobody/Anonymous (nobody)
Summary: Cant access protected members of a java class
Initial Comment:
Nice compiler version 0.9.10 prerelease, from cvs
Create a folder test, and subfolder java.
Create file test/java/A.java
---start---
package test.java;
public class A {
public A() {}
protected String getMessage() { return "Hello World!"; }
}
---end---
Create file test/test.nice
----start---
package test;
class B extends test.java.A {
void start() {
System.out.println(this.getMessage());
}
}
void main( String[] args ) {
B b = new B( );
b.start();
}
---end---
Compile:
javac test/java/A.java
nicec test
test.nice: line 6, column 36:
Method java.lang.String test.java.A.getMessage() is not
accessible
----------------------------------------------------------------------
>Comment By: Luc Perrin (leblin)
Date: 2004-11-14 21:04
Message:
Logged In: YES
user_id=717201
i have attached a partial fix for this.
when overloading is being resolved for a call expression, i
test for a protected java method, and create a new method in
the nice class with the same name and signature with a
'super' call in it. an easier fix would be to override all
the methods by default, but this would create lots of waste.
the problem is that this does not work with type variables.
The above example works great, but not if the test()
function is implemented as a multimethod with a type
parameter. i am not sure how to find the class from a
MonotypeVar.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=1060718&group_id=12788
-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8