Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expect a command like 'getstatic', can get non-static field from a singleton object #101

Closed
Kingson4Wu opened this issue Sep 20, 2018 · 6 comments

Comments

@Kingson4Wu
Copy link

No description provided.

@ralf0131
Copy link
Collaborator

public class Singleton {
    private Singleton singleton = new Singleton();
    private String test = "abc";

    private Singleton() {}

    public Singleton getInstance() {
         return singleton;
    }

}

Expected command:

getstatic -c hash_code Singleton getInstance '{returnObj.test}'

Expected output:

abc

Is this what you want? If so, this is currently not supported yet.

@Kingson4Wu
Copy link
Author

Kingson4Wu commented Oct 5, 2018

yes,this is what I want.
If there is only one object in JVM, the parameter 'hash_code' is not nesscessary?

@ralf0131
Copy link
Collaborator

ralf0131 commented Oct 6, 2018

@hengyunabc I believe this feature has not been implemented yet. Currently getstatic command does not support expression. We should leave it open.

@ralf0131 ralf0131 reopened this Oct 6, 2018
@ralf0131
Copy link
Collaborator

ralf0131 commented Oct 6, 2018

If there is only one object in JVM, the parameter 'hash_code' is not nesscessary?

@Kingson4Wu Yes

@Hearen
Copy link
Contributor

Hearen commented Oct 15, 2018

@ralf0131 What's the best way to make sure it's a singleton:

  • private constructor

enough? #230

@hengyunabc
Copy link
Collaborator

Refer to #240

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants