Skip to content

Commit

Permalink
FIX: Fixed bug where the type parameters as bounds of wildcards were …
Browse files Browse the repository at this point in the history
…not correctly linked. To be be more specific, the EGenericType which was set as bound was not referencing the ETypeParameter of the correlating TypeParameterSource. Instead it was linking to a EDataType with the name of the ETypeParameter, which was automatically created to deal with the unknown type.
  • Loading branch information
tsaglam committed Feb 1, 2018
1 parent 1fcf7bf commit ace935f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/java/eme/generator/EDataTypeGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void addGenericArguments(EGenericType genericType, ExtractedDataType data
for (ExtractedDataType genericArgument : dataType.getGenericArguments()) { // for every generic argument
EGenericType eArgument = ecoreFactory.createEGenericType(); // create ETypeArgument as EGenericType
if (genericArgument.isWildcard()) { // wildcard argument:
addWildcardBound(eArgument, genericArgument);
addWildcardBound(eArgument, genericArgument, source);
} else { // normal argument or type parameter
generateBoundType(eArgument, genericArgument, source);
}
Expand Down Expand Up @@ -141,11 +141,11 @@ private void addBounds(ETypeParameter eTypeParameter, ExtractedTypeParameter typ
/**
* Adds a bound to an wild card argument if it has one.
*/
private void addWildcardBound(EGenericType eArgument, ExtractedDataType genericArgument) {
private void addWildcardBound(EGenericType eArgument, ExtractedDataType genericArgument, TypeParameterSource source) {
WildcardStatus status = genericArgument.getWildcardStatus(); // get wild card status
if (status != WildcardStatus.UNBOUND) { // if has bounds:
EGenericType bound = ecoreFactory.createEGenericType(); // create bound
bound.setEClassifier(generate(genericArgument)); // generate bound type
generateBoundType(bound, genericArgument, source); // generate bound type
if (status == WildcardStatus.LOWER_BOUND) {
eArgument.setELowerBound(bound); // add lower bound
} else {
Expand Down Expand Up @@ -210,8 +210,9 @@ private EClassifier generate(ExtractedDataType extractedDataType) {
}

/**
* Sets the type of an {@link EGenericType} from an bound {@link ExtractedDataType}. This is either an
* {@link ETypeParameter} if the {@link ExtractedDataType} is a type parameter or {@link EClassifier}.
* Sets the type of an {@link EGenericType} from a bound {@link ExtractedDataType}. This is either an
* {@link ETypeParameter} if the {@link ExtractedDataType} is a type parameter in the {@link TypeParameterSource} or
* {@link EClassifier} if not.
*/
private void generateBoundType(EGenericType genericType, ExtractedDataType boundType, TypeParameterSource source) {
if (source.containsTypeParameter(boundType)) {
Expand Down

0 comments on commit ace935f

Please sign in to comment.