Non-reifiable types are types where information has been removed at compile-time by type erasure
so I am expecting that after compilation the type-information of generics is lost.
package com.v;
import java.util.ArrayList;
import java.util.List;
public class NonReifiable {
List<Human> hl = new ArrayList<>();
List<NonHuman> nhl = new ArrayList<>();
}
class Human { }
class NonHuman {}
But, I see the .java generated from the compiled .class still has type info.
//
// Decompiled by Procyon v0.5.36
//
package com.v;
import java.util.ArrayList;
import java.util.List;
public class NonReifiable
{
List<Human> hl;
List<NonHuman> nhl;
public NonRefiable() {
this.hl = new ArrayList<Human>();
this.nhl = new ArrayList<NonHuman>();
}
}
How is the above possible. Could some one help me better understand how it work practically.
This is what I have been expecting
public class NonReifiable
{
List<Object> hl;
List<Object> nhl;
public NonRefiable() {
this.hl = new ArrayList<Object>();
this.nhl = new ArrayList<Object>();
}
}