Fix bug in dependency analyzer

This commit is contained in:
Alexey Andreev 2017-11-13 00:15:15 +03:00
parent 2bbdf6caba
commit 945a0fee9d
2 changed files with 11 additions and 0 deletions

View File

@ -120,10 +120,14 @@ public class DependencyNode implements ValueDependencyInfo {
} }
int j = 0; int j = 0;
boolean copied = false;
for (int i = 0; i < newTypes.length; ++i) { for (int i = 0; i < newTypes.length; ++i) {
DependencyType type = newTypes[i]; DependencyType type = newTypes[i];
if (addType(type) && filter(type)) { if (addType(type) && filter(type)) {
newTypes[j++] = type; newTypes[j++] = type;
} else if (!copied) {
copied = true;
newTypes = newTypes.clone();
} }
} }
if (j == 0) { if (j == 0) {

View File

@ -51,10 +51,13 @@ class DependencyNodeToNodeTransition implements DependencyConsumer {
void consume(DependencyType[] types) { void consume(DependencyType[] types) {
int j = 0; int j = 0;
boolean copied = false;
for (DependencyType type : types) { for (DependencyType type : types) {
boolean added = false;
if (filterType(type)) { if (filterType(type)) {
if (!destination.hasType(type)) { if (!destination.hasType(type)) {
types[j++] = type; types[j++] = type;
added = true;
} }
if (type.getName().startsWith("[")) { if (type.getName().startsWith("[")) {
@ -65,6 +68,10 @@ class DependencyNodeToNodeTransition implements DependencyConsumer {
source.getClassValueNode().connect(destination.getClassValueNode()); source.getClassValueNode().connect(destination.getClassValueNode());
} }
} }
if (!added && !copied) {
copied = true;
types = types.clone();
}
} }
if (j == 0) { if (j == 0) {