public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Vaijayanthi Mala Suresh <vaijayanthimalas@gmail.com>
To: java@gcc.gnu.org
Subject: Using CNI on inner classes
Date: Thu, 13 Aug 2009 07:18:00 -0000	[thread overview]
Message-ID: <6f1633170908130018k3f96d4a1o744572ae5c597678@mail.gmail.com> (raw)

Hi,

I have an Test.java as shown below


public class Test {

    private native void natRegister(Inner obj);
    Inner myInnerClassObj;

    class Inner
    {
      private void printline()
      {
        System.out.printline("Prints from printline");
      }
      Inner()
      {
      }
    }

    public Test()
    {
      myInnerClassObj = new Inner();
    }

    public void register()
    {
	natRegister(myInnerClassObj);
    }


    public static void main(String [] args) {
      System.out.println("Hello from main");
      Test ht = new Test();
      ht.register();
    }
  }

I have the Test.cc defined as shown below
// This file is intended to give you a head start on implementing native
// methods using CNI.
// Be aware: running 'gcjh -stubs' once more for this class may
// overwrite any edits you have made to this file.

#include <gcj/cni.h>
#include <java/lang/UnsupportedOperationException.h>

#include "Test.h"
#include "Test$Inner.h"
void
Test::natRegister(::Test$Inner *innerObj)
{
  innerObj->printline();
}

I need to access the private method from the native code. This was
possible in JNI but it is not possible in CNI.

Can you please suggest me a solution for this using CNI.

Thanks
Mala

             reply	other threads:[~2009-08-13  7:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-13  7:18 Vaijayanthi Mala Suresh [this message]
2009-08-13  9:10 ` Andrew Haley
2009-08-13 10:07   ` Bryce McKinlay
2009-08-13 10:44     ` Andrew Haley
2009-08-13 10:49       ` Andrew Haley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6f1633170908130018k3f96d4a1o744572ae5c597678@mail.gmail.com \
    --to=vaijayanthimalas@gmail.com \
    --cc=java@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).