Commit c737bf20 authored by Marco Konersmann's avatar Marco Konersmann

Fixes that elements were created instead of updated

parent da633b0d
Pipeline #3023 failed with stages
in 1 minute and 18 seconds
......@@ -39,18 +39,24 @@ abstract class ContainmentOperationTransformation<OWNERECLASS extends EObject, T
if (type.getMethod(target.nameAttributeValue, newArrayOfSize(0)).exists) {
// Method already exists. Do nothing
} else {
// Method does not exist. Create a new one.
val String targetName = target.nameAttributeValue;
val String content = '''
«IF newAnnotationName !== null»
@«newAnnotationName»
«ENDIF»
public void «targetName.toFirstLower»(){}
''';
methods.add(type.createMethod(content, null, true, null));
JDTUtils.addImportIfNecessary(type, newAnnotationName, null);
val IMethod method = type.methods.findFirst[it.elementName.equals(target.nameAttributeValue)]
if (method !== null && method.exists) {
// We also allow the methods to have parameters. Do nothing if that already exists
// This is kept separate, so that it can be easily removed when necessary.
} else {
// Method does not exist. Create a new one.
val String targetName = target.nameAttributeValue;
val String content = '''
«IF newAnnotationName !== null»
@«newAnnotationName»
«ENDIF»
public void «targetName.toFirstLower»(){}
''';
methods.add(type.createMethod(content, null, true, null));
JDTUtils.addImportIfNecessary(type, newAnnotationName, null);
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment