Skip to content
Permalink
Browse files

Error-Trace shows bogus values - #372

- Part of the underlying Tree implementation is relying on the item's hashcode, so our purposing of the hash calculations to make it easy to filter all TLCVariables based on a single proto-variable instance was resulting in the data for one instance of TLCVariable being shown for all of the same name/is-explorer couplet value. Have discontinued overriding hashcode for our filtering purposes.

#372
[Bug][Regression][Toolbox]
  • Loading branch information...
quaeler committed Oct 5, 2019
1 parent ea18143 commit a3c4329d68e49824962842a596f0bfef628eb1b3
@@ -110,33 +110,11 @@ public int getChildCount() {
public final boolean isChanged() {
return value.isAdded() || value.isDeleted() || value.isChanged();
}

/**
* This only included name and whether this is a trace explorer variable in the calculation.
*/
@Override
public int hashCode() {
return Objects.hash(isTraceExplorerVar, name);
}


/**
* This only included name and whether this is a trace explorer variable in the determination.
* This compares against name and the value of {@code isTraceExplorerVar}
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}

if (obj == null) {
return false;
}

if (getClass() != obj.getClass()) {
return false;
}

final TLCVariable other = (TLCVariable) obj;
public boolean representsTheSameAs(final TLCVariable other) {
return (isTraceExplorerVar == other.isTraceExplorerVar) && Objects.equals(name, other.name);
}
}
@@ -109,6 +109,7 @@
+ "\u2022 Double-click on a line to go to corresponding action in spec \u2014 "
+ "or while holding down " + (Platform.getOS().equals(Platform.OS_MACOSX) ? "\u2318" : "CTRL")
+ " to go to the original PlusCal code, if present.\n"
+ "\u2022 Click on a variable while holding down ALT to hide the variable from view.\n"
+ "\u2022 Right-click on a location row for a context menu.";

/**
@@ -466,10 +467,10 @@ public void mouseUp(final MouseEvent event) {

if (selection instanceof TLCVariable) {
if (filterErrorTraceAction.isChecked()) {
currentErrorTraceFilterSet.add((TLCVariable)selection);
addVariableFamilyToFiltering((TLCVariable)selection);
} else {
currentErrorTraceFilterSet.clear();
currentErrorTraceFilterSet.add((TLCVariable)selection);
addVariableFamilyToFiltering((TLCVariable)selection);
filterErrorTraceAction.setChecked(true);
}

@@ -815,6 +816,16 @@ TreeViewer getViewer() {
return errorTraceTreeViewer.getTreeViewer();
}

private void addVariableFamilyToFiltering(final TLCVariable protoVariable) {
for (final TLCState state : unfilteredInput.getStates(TLCError.Length.ALL)) {
for (final TLCVariable variable : state.getVariablesAsList()) {
if (protoVariable.representsTheSameAs(variable)) {
currentErrorTraceFilterSet.add(variable);
}
}
}
}

private void performVariableViewPopulation(final EnumSet<FilterType> filters) {
if (filters.contains(FilterType.NONE)) {
setTraceInput(unfilteredInput, false);

0 comments on commit a3c4329

Please sign in to comment.
You can’t perform that action at this time.