Skip to content

Commit 4c69d4f

Browse files
committed
Introduced ExpInstanceOp as parent class of ExpObjOp and ExpInstanceConstructor
1 parent efdd7ea commit 4c69d4f

File tree

7 files changed

+11
-10
lines changed

7 files changed

+11
-10
lines changed

use-core/src/main/java/org/tzi/use/parser/use/ASTOperation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void genFinal(Context ctx) throws SemanticException
138138
return;
139139

140140
if (fIsConstructor && fOperation.resultType() != fOperation.cls()) {
141-
throw new SemanticException(fName, "Constructor " + StringUtil.inQuotes(fName.getText()) +
141+
throw new SemanticException(fName, "Instance constructor " + StringUtil.inQuotes(fName.getText()) +
142142
" must not have result type.");
143143
}
144144

@@ -162,7 +162,7 @@ public void genFinal(Context ctx) throws SemanticException
162162
try {
163163
if (fExpr != null ) {
164164
if (fIsConstructor) {
165-
throw new MInvalidModelException("Constructor " + StringUtil.inQuotes(fName.getText())
165+
throw new MInvalidModelException("Instance constructor " + StringUtil.inQuotes(fName.getText())
166166
+ " must not have body.");
167167
}
168168
Expression expr = fExpr.gen(ctx);

use-core/src/main/java/org/tzi/use/uml/mm/MDataTypeImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public void addOperation(MOperation op) throws MInvalidModelException {
179179
.map(MModelElementImpl::name).collect(Collectors.toList());
180180
List<String> paramNames = op.paramNames();
181181
if (!CollectionUtil.equalLists(allAttributes, paramNames, Comparator.comparing(String::toString))) {
182-
throw new MInvalidModelException("Constructor `" + opname + "' is missing parent attribute(s).");
182+
throw new MInvalidModelException("Instance constructor `" + opname + "' is missing parent attribute(s).");
183183
}
184184
}
185185

use-core/src/main/java/org/tzi/use/uml/ocl/expr/ExpInstanceConstructor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.tzi.use.uml.sys.*;
2626
import org.tzi.use.uml.ocl.value.Value;
2727
import org.tzi.use.uml.sys.ppcHandling.ExpressionPPCHandler;
28-
import org.tzi.use.util.Log;
2928
import org.tzi.use.util.StringUtil;
3029

3130
import java.util.HashMap;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
t25.use:8:6: Definition of constructor `C' only possible in data types.
1+
t25.use:9:6: Definition of constructor `C' only possible in data types.
2+
t25.use:5:2: Instance constructor `D' must not have body.

use-core/src/test/resources/org/tzi/use/parser/t25.use

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ model t25
22

33
dataType D
44
operations
5-
D(a : Integer, b : Integer)
5+
D(a : Integer, b : Integer) =
6+
D(a, b)
67
end
78

89
class C
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
t26.use:3:9: Data type `C' already contains an attribute named `c0'.
22
t26.use:3:9: Data type `C' already contains an operation named `C'.
33
t26.use:9:9: Attribute with name `c0' already defined in a super data type.
4-
t26.use:14:9: Constructor `E' is missing parent attribute(s).
5-
t26.use:19:9: Constructor `F' is missing parent attribute(s).
6-
t26.use:36:2: Constructor `I' must not have result type.
4+
t26.use:14:9: Instance constructor `E' is missing parent attribute(s).
5+
t26.use:19:9: Instance constructor `F' is missing parent attribute(s).
6+
t26.use:36:2: Instance constructor `I' must not have result type.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
t27.use:8:9: Constructor `B' is missing parent attribute(s).
1+
t27.use:8:9: Instance constructor `B' is missing parent attribute(s).

0 commit comments

Comments
 (0)