Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type and enum leaking from one imported KSY to another #303

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class JavaScriptClassSpecs(importer: JavaScriptImporter, firstSpec: ClassSpec)
val MODE_REL = "rel"
val MODE_ABS = "abs"

override def importRelative(name: String, path: List[String], inFile: Option[String]): Future[Option[ClassSpec]] =
override def importRelative(name: String, path: List[String], inFile: String): Future[Option[ClassSpec]] =
doImport(name, path, MODE_REL)
override def importAbsolute(name: String, path: List[String], inFile: Option[String]): Future[Option[ClassSpec]] =
override def importAbsolute(name: String, path: List[String], inFile: String): Future[Option[ClassSpec]] =
doImport(name, path, MODE_ABS)

def doImport(name: String, path: List[String], mode: String): Future[Option[ClassSpec]] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ class JavaClassSpecs(relPath: String, absPaths: Seq[String], firstSpec: ClassSpe
private val relFiles: concurrent.Map[String, ClassSpec] = new ConcurrentHashMap[String, ClassSpec]().asScala
private val absFiles: concurrent.Map[String, ClassSpec] = new ConcurrentHashMap[String, ClassSpec]().asScala

override def importRelative(name: String, path: List[String], inFile: Option[String]): Future[Option[ClassSpec]] = Future {
override def importRelative(name: String, path: List[String], inFile: String): Future[Option[ClassSpec]] = Future {
Log.importOps.info(() => s".. importing relative $name")
JavaClassSpecs.cached(path, inFile, relFiles, name, (_) =>
JavaKSYParser.fileNameToSpec(s"$relPath/$name.ksy")
)
}

override def importAbsolute(name: String, path: List[String], inFile: Option[String]): Future[Option[ClassSpec]] = Future {
override def importAbsolute(name: String, path: List[String], inFile: String): Future[Option[ClassSpec]] = Future {
Log.importOps.info(() => s".. importing absolute $name")
JavaClassSpecs.cached(path, inFile, absFiles, name, tryAbsolutePaths)
}
Expand Down Expand Up @@ -62,7 +62,7 @@ class JavaClassSpecs(relPath: String, absPaths: Seq[String], firstSpec: ClassSpe
object JavaClassSpecs {
def cached(
path: List[String],
inFile: Option[String],
inFile: String,
cacheMap: mutable.Map[String, ClassSpec],
name: String,
importOp: (String) => ClassSpec
Expand All @@ -80,7 +80,7 @@ object JavaClassSpecs {
cacheMap(name) = spec
Some(spec)
} catch {
case err: Throwable => throw ErrorInInput(err, path, inFile).toException
case err: Throwable => throw ErrorInInput(err, path, Some(inFile)).toException
}
}
}
Expand Down
Loading
Loading