Index: /trunk/Compiler/Script/Interactive.mo
===================================================================
--- /trunk/Compiler/Script/Interactive.mo	(revision 25477)
+++ /trunk/Compiler/Script/Interactive.mo	(revision 25478)
@@ -12535,18 +12535,19 @@
       list<Absyn.Element> rest;
       FCore.Graph env;
+      Option<Absyn.ConstrainClass> cc;
 
     case ({},_,_,_,_) then {};
 
-    case ((Absyn.ELEMENT(specification = Absyn.COMPONENTS(components = items)) :: rest),env,_,_,_)
-      equation
-        res1 = getComponentitemsAnnotationsFromItems(items, env, inClass,inFullProgram,inModelPath);
-        res2 = getComponentitemsAnnotations(rest, env, inClass,inFullProgram,inModelPath);
+    case ((Absyn.ELEMENT(specification = Absyn.COMPONENTS(components = items), constrainClass = cc) :: rest),env,_,_,_)
+      equation
+        res1 = getComponentitemsAnnotationsFromItems(items, getAnnotationsFromConstraintClass(cc), env, inClass, inFullProgram, inModelPath);
+        res2 = getComponentitemsAnnotations(rest, env, inClass, inFullProgram, inModelPath);
         res = listAppend(res1, res2);
       then
         res;
 
-    case ((Absyn.ELEMENT(specification = Absyn.COMPONENTS()) :: rest),env,_,_,_)
-      equation
-        res2 = getComponentitemsAnnotations(rest, env,inClass,inFullProgram,inModelPath);
+    case ((Absyn.ELEMENT(specification = Absyn.COMPONENTS(), constrainClass = cc) :: rest),env,_,_,_)
+      equation
+        res2 = getComponentitemsAnnotations(rest, env, inClass, inFullProgram, inModelPath);
         res = "{}"::res2;
       then
@@ -12560,4 +12561,16 @@
   end matchcontinue;
 end getComponentitemsAnnotations;
+
+protected function getAnnotationsFromConstraintClass
+  input Option<Absyn.ConstrainClass> inCC;
+  output list<Absyn.ElementArg> outElArgLst;
+algorithm
+  outElArgLst := match(inCC)
+    local list<Absyn.ElementArg> elementArgs;
+    case SOME(Absyn.CONSTRAINCLASS(comment = SOME(Absyn.COMMENT(annotation_ = SOME(Absyn.ANNOTATION(elementArgs))))))
+      then elementArgs;
+    else {};
+  end match;
+end getAnnotationsFromConstraintClass;
 
 protected function getComponentitemsAnnotationsElArgs
@@ -12664,4 +12677,5 @@
 "Helper function to getComponentitemsAnnotations."
   input list<Absyn.ComponentItem> inAbsynComponentItemLst;
+  input list<Absyn.ElementArg> ccAnnotations;
   input FCore.Graph inEnv;
   input Absyn.Class inClass;
@@ -12670,5 +12684,5 @@
   output list<String> outStringLst;
 algorithm
-  outStringLst := match (inAbsynComponentItemLst,inEnv,inClass,inFullProgram,inModelPath)
+  outStringLst := match (inAbsynComponentItemLst,ccAnnotations,inEnv,inClass,inFullProgram,inModelPath)
     local
       FCore.Graph env;
@@ -12679,34 +12693,47 @@
 
     // handle empty
-    case ({},_,_,_,_) then {};
+    case ({},_,_,_,_,_) then {};
 
     case ((Absyn.COMPONENTITEM(comment = SOME(
       Absyn.COMMENT(
             SOME(Absyn.ANNOTATION(annotations)),
-            _))) :: rest),env,_,_,_)
-      equation
+            _))) :: rest),_,env,_,_,_)
+      equation
+        annotations = listAppend(annotations, ccAnnotations);
         res = getComponentitemsAnnotationsElArgs(annotations,env,inClass,inFullProgram,inModelPath);
         gexpstr = stringDelimitList(res, ", ");
-
         gexpstr_1 = stringAppendList({"{",gexpstr,"}"});
-        res = getComponentitemsAnnotationsFromItems(rest, env, inClass,inFullProgram,inModelPath);
+        res = getComponentitemsAnnotationsFromItems(rest, ccAnnotations, env, inClass,inFullProgram,inModelPath);
       then
         (gexpstr_1 :: res);
 
-    case ((Absyn.COMPONENTITEM(comment = SOME(Absyn.COMMENT(_,_))) :: rest),env,_,_,_)
-      equation
-        res = getComponentitemsAnnotationsFromItems(rest, env, inClass,inFullProgram,inModelPath);
-      then
-        ("{}" :: res);
-
-    case ((Absyn.COMPONENTITEM(comment = NONE()) :: (rest as (_ :: _))),env, _,_,_)
-      equation
-        res = getComponentitemsAnnotationsFromItems(rest, env, inClass,inFullProgram,inModelPath);
-      then
-        ("{}" :: res);
-
-    case ({Absyn.COMPONENTITEM(comment = NONE())},_,_,_,_)
-      then
-        {"{}"};
+    case ((Absyn.COMPONENTITEM(comment = SOME(Absyn.COMMENT(_,_))) :: rest),_,env,_,_,_)
+      equation
+        annotations = ccAnnotations;
+        res = getComponentitemsAnnotationsElArgs(annotations,env,inClass,inFullProgram,inModelPath);
+        gexpstr = stringDelimitList(res, ", ");
+        gexpstr_1 = stringAppendList({"{",gexpstr,"}"});
+        res = getComponentitemsAnnotationsFromItems(rest, ccAnnotations, env, inClass,inFullProgram,inModelPath);
+      then
+        (gexpstr_1 :: res);
+
+    case ((Absyn.COMPONENTITEM(comment = NONE()) :: (rest as (_ :: _))),_,env, _,_,_)
+      equation
+        annotations = ccAnnotations;
+        res = getComponentitemsAnnotationsElArgs(annotations,env,inClass,inFullProgram,inModelPath);
+        gexpstr = stringDelimitList(res, ", ");
+        gexpstr_1 = stringAppendList({"{",gexpstr,"}"});
+        res = getComponentitemsAnnotationsFromItems(rest, ccAnnotations, env, inClass,inFullProgram,inModelPath);
+      then
+        (gexpstr_1 :: res);
+
+    case ({Absyn.COMPONENTITEM(comment = NONE())},_,env,_,_,_)
+      equation
+        annotations = ccAnnotations;
+        res = getComponentitemsAnnotationsElArgs(annotations,env,inClass,inFullProgram,inModelPath);
+        gexpstr = stringDelimitList(res, ", ");
+        gexpstr_1 = stringAppendList({"{",gexpstr,"}"});
+      then
+        {gexpstr_1};
 
   end match;
Index: /trunk/testsuite/openmodelica/interactive-API/choicesAllMatching.mos
===================================================================
--- /trunk/testsuite/openmodelica/interactive-API/choicesAllMatching.mos	(revision 25477)
+++ /trunk/testsuite/openmodelica/interactive-API/choicesAllMatching.mos	(revision 25478)
@@ -1,3 +1,3 @@
-// name: choicesAllMatching.mos [BUG: #3254]
+// name: choicesAllMatching.mos [BUG: #3254, #3255]
 // keywords: Graphical API, component annotations
 // status: correct
@@ -18,4 +18,13 @@
 getErrorString();
 
+loadString("model M
+  type N = Real;
+  replaceable N n1 constrainedby Real annotation(choicesAllMatching=true,Placement(visible = true, transformation(origin = {-30, 42}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
+end M;");
+getErrorString();
+getComponentAnnotations(M);
+getErrorString();
+
+
 // Result:
 // true
@@ -27,3 +36,7 @@
 // {{choicesAllMatching=true, Placement(true,-30.0,42.0,-10.0,-10.0,10.0,10.0,0.0,-,-,-,-,-,-,)}}
 // ""
+// true
+// ""
+// {{choicesAllMatching=true, Placement(true,-30.0,42.0,-10.0,-10.0,10.0,10.0,0.0,-,-,-,-,-,-,)}}
+// ""
 // endResult
