Also do proper cloning so we can be subclassed.
This commit is contained in:
@@ -51,6 +51,7 @@ import com.samskivert.util.StringUtil;
|
|||||||
* prefix like "something*" or a suffix like "*something".
|
* prefix like "something*" or a suffix like "*something".
|
||||||
*/
|
*/
|
||||||
public class ImportSet
|
public class ImportSet
|
||||||
|
implements Cloneable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Adds the given class' name to the set of imports.
|
* Adds the given class' name to the set of imports.
|
||||||
@@ -99,9 +100,15 @@ public class ImportSet
|
|||||||
@Override
|
@Override
|
||||||
public ImportSet clone ()
|
public ImportSet clone ()
|
||||||
{
|
{
|
||||||
ImportSet newset = new ImportSet();
|
try {
|
||||||
newset.addAll(this);
|
ImportSet newSet = (ImportSet)super.clone();
|
||||||
return newset;
|
newSet._pushed = Lists.newArrayList();
|
||||||
|
newSet._imports = Sets.newHashSet(this._imports);
|
||||||
|
return newSet;
|
||||||
|
|
||||||
|
} catch (CloneNotSupportedException cnse) {
|
||||||
|
throw new AssertionError(cnse); // we are Cloneable
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user