nguyennhutkhanh / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

private inheritance #628

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
-What steps will reproduce the problem?
When I run this code :
import com.google.gson.Gson;

/**
 * Created by Razi on 2/12/2015.
 */
public class Main {

    public static void main(String[] args)
    {
        Child child = new Child();
        Gson gson = new Gson();
        String json = gson.toJson(child);
    }
}
class Parent{
    protected int a;
    private int b;
}

class Child extends Parent{
    private float b;
}

I see this exception:
java.lang.IllegalArgumentException: class messages.BlockData declares multiple 
JSON fields named other

- What is the expected output? What do you see instead?
ignore parent private field

- What version of the product are you using? On what operating system?
gson-2.3.1
windows 7
java version 1.8.0

- Please provide any additional information below.
Tnx.

Original issue reported on code.google.com by sm.raz...@gmail.com on 12 Feb 2015 at 11:01