-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Algorithm contains this deepCopy method:
@Nonnull
@Override
public INode deepCopy() {
Algorithm copy = new Algorithm(this);
for (INode child : this.children.values()) {
copy.children.put(child.getKind(), child.deepCopy());
}
return copy;
}All the algorithms (AES, ...) are extending Algorithm, so they get this deepCopy method. However, calling it on an AES object does not create an AES instance but an Algorithm instance (creating later problems when relying on instanceof, in the enricher for example).
To solve this, the only solution is probably to add each subclass of Algorithm a "copy" constructor (like AES(AES aes), calling the super "copy" constructor of Algorithm given below) and to overwrite the deepCopy() method, in which we instantiate a new AES using this constructor.
private Algorithm(@Nonnull Algorithm algorithm) {
this.children = new HashMap<>();
this.kind = algorithm.kind;
this.detectionLocation = algorithm.detectionLocation;
this.name = algorithm.name;
}Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Backlog