I made a post about inner classes last week, see:
http://www.mail-archive.com/tcljava@tclconsortium.org/msg00129.html
which in part said:
> Someone in my group asked me about accessing static nested classes
> from Jacl. Below is a description and a solution.
>
> http://java.sun.com/docs/books/tutorial/java/more/nested.html
> says:
> A static nested class is called just that: a static nested
> class. A nonstatic nested class is called an inner class.
>
> The innerclass spec has a slightly different terminology
>
>http://java.sun.com/products/jdk/1.1/docs/guide/innerclasses/spec/innerclasses.doc.html
> says:
> In addition, the programmer can define a class as a static
> member of any top-level class. Classes which are static class
> members and classes which are package members are both called
> top-level classes. They differ from inner classes in that a
> top-level class can make direct use only of its own
> instance variables. The ability to nest classes in this way
> allows any top-level class to provide a package-like
> organization for a logically related group of secondary
> top-level classes, all of which share full access to
> private members.
Below is the example extended to include a public static field
from a public static nested class. I'm not sure if it is possible
to access static variables inside inner classes.
cxh@maury 7% cat TestInnerClasses.java
public class TestInnerClasses {
public static void main(String args[]) {
MyInnerClass mic = new MyInnerClass();
System.out.println( mic.testing());
}
public static class MyInnerClass {
public static int aStaticInt = 1;
public String testing() {
return new String("MyInnerClass::testing()");
}
}
}
cxh@maury 8% javac TestInnerClasses.java
cxh@maury 9% ptjacl
% set mic [java::new TestInnerClasses\$MyInnerClass]
java0x1
% $mic testing
MyInnerClass::testing()
% java::info fields $mic
% java::field $mic aStaticInt
1
%
Perhaps it is a bug that java::info fields does not report that
$mic has a field named aStaticInt?
-Christopher
--------
Hi,
is there a way to access a static field from a Java inner class from
TCL?
The java::info hasnt got a possibility to inspect this (i believe), so
i dont know
if / how i can access an inner class.
Thanks for a hint,
Marcel
--------
----------------------------------------------------------------
The TclJava mailing list is sponsored by WebNet Technologies.
To subscribe: send mail to [EMAIL PROTECTED]
with the word SUBSCRIBE as the subject.
To unsubscribe: send mail to [EMAIL PROTECTED]
with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'.
A list archive is at: http://www.findmail.com/listsaver/tcldallas/