@@ -22,13 +22,12 @@ class TwirlWorker {
2222 twirlInstanceCache match {
2323 case Some ((sig, instance)) if sig == classloaderSig => instance
2424 case _ =>
25- val cl = new URLClassLoader (twirlClasspath.map(_.toIO.toURI.toURL).toArray)
25+ val cpWithoutScalaLib = twirlClasspath.filter { p =>
26+ ! p.toString.contains(" scala-library" )
27+ }.map(_.toIO.toURI.toURL).toArray
28+ val cl = new URLClassLoader (cpWithoutScalaLib, getClass.getClassLoader)
2629 val twirlCompilerClass = cl.loadClass(" play.twirl.compiler.TwirlCompiler" )
27- // Use the Java API (available in Twirl 1.3+)
28- // Using reflection on a method with "Seq[String] = Nil" parameter type does not seem to work.
2930
30- // REMIND: Unable to call the compile method with a primitive boolean
31- // codec and inclusiveDot will not be available
3231 val compileMethod = twirlCompilerClass.getMethod(" compile" ,
3332 classOf [java.io.File ],
3433 classOf [java.io.File ],
@@ -56,10 +55,10 @@ class TwirlWorker {
5655 sourceDirectory,
5756 generatedDirectory,
5857 formatterType,
59- defaultAdditionalImportsMethod.invoke( null ) ,
60- defaultConstructorAnnotationsMethod.invoke( null ) ,
61- defaultCodecMethod.invoke( null ),
62- defaultFlagMethod.invoke( null )
58+ additionalImports ,
59+ constructorAnnotations ,
60+ Codec ( " UTF-8 " ), // may provide as parameter too.
61+ scala. Boolean .box( false )
6362 )
6463 }
6564 }
0 commit comments