Skip to content

Commit

Permalink
fix for stackoverflow when typeParameter refer to itself or its decla…
Browse files Browse the repository at this point in the history
…ring class.
  • Loading branch information
m0rkeulv committed Jan 27, 2024
1 parent bc2f04a commit ad9cd65
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.jetbrains.annotations.NotNull;

import java.util.List;
import java.util.Objects;

/**
* Experimental hack to allow HaxeGenericSpecialization to keep typeParameters that can not be resolved to any type.
Expand Down Expand Up @@ -34,4 +35,16 @@ public List<HaxeType> getHaxeExtendsList() {
return List.of();
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
HaxeClassWrapperForTypeParameter that = (HaxeClassWrapperForTypeParameter)o;
return Objects.equals(typeList, that.typeList);
}

@Override
public int hashCode() {
return Objects.hash(typeList);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.jetbrains.annotations.NotNull;

import java.util.List;
import java.util.Objects;

/**
* This class is a helper class to handle type parameters with constrains from multiple types
Expand Down Expand Up @@ -67,4 +68,16 @@ public List<HaxeType> getHaxeExtendsList() {
}


@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
HaxeTypeParameterMultiType type = (HaxeTypeParameterMultiType)o;
return Objects.equals(typeList, type.typeList) && Objects.equals(anonymousTypeBodyList, type.anonymousTypeBodyList);
}

@Override
public int hashCode() {
return Objects.hash(typeList, anonymousTypeBodyList);
}
}

0 comments on commit ad9cd65

Please sign in to comment.