This is an automated email from the ASF dual-hosted git repository.

sergeykamov pushed a commit to branch NLPCRAFT-398
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git


The following commit(s) were added to refs/heads/NLPCRAFT-398 by this push:
     new c70ed0c  WIP.
c70ed0c is described below

commit c70ed0c96635d7206f810d8e9a0e45b41f1bbce0
Author: Sergey Kamov <[email protected]>
AuthorDate: Mon Aug 9 22:45:25 2021 +0300

    WIP.
---
 .../probe/mgrs/deploy/NCDeployManager.scala        | 26 +++++++++++++---------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
index 6943151..91beb01 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
@@ -81,12 +81,15 @@ object NCDeployManager extends NCService {
         CLS_JAVA_OPT
     )
     
-    case class Callback(id: String, clsName: String, funName: String, cbFun: 
Function[NCIntentMatch, NCResult])
+    case class Callback(method: Method, cbFun: Function[NCIntentMatch, 
NCResult]) {
+        val id: String = method.toString
+        val clsName: String = method.getDeclaringClass.getName
+        val funName: String = method.getName
+    }
     type Intent = (NCIdlIntent, Callback)
     type Sample = (String/* Intent ID */, Seq[Seq[String]] /* List of list of 
input samples for that intent. */)
     
     private final val SEPARATORS = Seq('?', ',', '.', '-', '!')
-
     private final val SUSP_SYNS_CHARS = Seq("?", "*", "+")
 
     @volatile private var data: mutable.ArrayBuffer[NCProbeModel] = _
@@ -1219,9 +1222,7 @@ object NCDeployManager extends NCService {
         checkMinMax(mdl, mtd, tokParamTypes, termIds.map(allLimits), 
ctxFirstParam)
 
         Callback(
-            mtd.toString,
-            mtd.getDeclaringClass.getName,
-            mtd.getName,
+            mtd,
             (ctx: NCIntentMatch) => {
                 invoke(
                     mdl.getId,
@@ -1593,7 +1594,10 @@ object NCDeployManager extends NCService {
 
             // Process inline intent declarations by @NCIntent annotation.
             for (ann <- m.getAnnotationsByType(CLS_INTENT); intent <- 
NCIdlCompiler.compileIntents(ann.value(), mdl, mtdStr))
-                if (intentDecls.exists(_.id == intent.id) || 
intents.exists(_._1.id == intent.id))
+                if (
+                    intentDecls.exists(_.id == intent.id) ||
+                    intents.exists { case (i, cb) => i.id == intent.id && 
cb.method != m }
+                )
                     throw new NCE(s"Duplicate intent ID [" +
                         s"mdlId=$mdlId, " +
                         s"origin=${mdl.getOrigin}, " +
@@ -1662,11 +1666,11 @@ object NCDeployManager extends NCService {
                         throw new NCE(
                             // TODO:
                             s"Invalid references [" +
-                                s"mdlId=$mdlId, " +
-                                s"origin=${mdl.getOrigin}, " +
-                                s"reference=${CLS_MDL_PACKAGES_REF.getName}, " 
+
-                                s"package=$p" +
-                                s"]"
+                            s"mdlId=$mdlId, " +
+                            s"origin=${mdl.getOrigin}, " +
+                            s"reference=${CLS_MDL_PACKAGES_REF.getName}, " +
+                            s"package=$p" +
+                            s"]"
                         )
 
                     
ClassPath.from(cl).getTopLevelClassesRecursive(p).asScala.map(_.load())

Reply via email to