File tree Expand file tree Collapse file tree 2 files changed +19
-19
lines changed
main/scala/com/fasterxml/jackson/module/scala/util
test/scala/com/fasterxml/jackson/module/scala Expand file tree Collapse file tree 2 files changed +19
-19
lines changed Original file line number Diff line number Diff line change @@ -7,19 +7,24 @@ private[util] object TastyUtil {
7
7
8
8
@ tailrec
9
9
def hasTastyFile (clz : Class [_]): Boolean = {
10
- clz != null && getClassName(clz) != null && {
11
- val baseName = getClassName(clz).replace(" ." , " /" )
12
- val classFileBase = if (baseName.endsWith(" $" )) {
13
- baseName.substring(0 , baseName.length - 1 )
14
- } else {
15
- baseName
16
- }
17
- val tastyFile = s " / $classFileBase.tasty "
18
- Option (thisClass.getResource(tastyFile)).isDefined || hasTastyFile(clz.getEnclosingClass)
10
+ if (clz == null ) {
11
+ false
12
+ } else {
13
+ lazy val className = getClassName(clz)
14
+ className != null && {
15
+ val baseName = className.replace(" ." , " /" )
16
+ val classFileBase = if (baseName.endsWith(" $" )) {
17
+ baseName.substring(0 , baseName.length - 1 )
18
+ } else {
19
+ baseName
20
+ }
21
+ val tastyFile = s " / $classFileBase.tasty "
22
+ Option (thisClass.getResource(tastyFile)).isDefined
23
+ } || hasTastyFile(clz.getEnclosingClass)
19
24
}
20
25
}
21
26
22
- private def getClassName (clz : Class [_]) = {
27
+ private def getClassName (clz : Class [_]): String = {
23
28
try clz.getCanonicalName catch {
24
29
case _ : InternalError => null
25
30
}
Original file line number Diff line number Diff line change @@ -4,14 +4,9 @@ import com.fasterxml.jackson.databind.json.JsonMapper
4
4
5
5
class QuxClassTagExtensionsTest extends BaseSpec {
6
6
" An ObjectMapper with the ClassTagExtensions mixin" should " deserialize Qux" in {
7
- val javaVersion = System .getProperty(" java.specification.version" )
8
- if (javaVersion == " 1.8" ) {
9
- // skip - this test fails on Java 1.8 - see https://github.com/FasterXML/jackson-module-scala/issues/542
10
- } else {
11
- val objectMapper = JsonMapper
12
- .builder().addModule(DefaultScalaModule ).build() :: ClassTagExtensions
13
- val qux = objectMapper.readValue[Qux ](""" {"qux": {"num": "3"}}""" )
14
- qux.qux.num shouldEqual 3
15
- }
7
+ val objectMapper = JsonMapper
8
+ .builder().addModule(DefaultScalaModule ).build() :: ClassTagExtensions
9
+ val qux = objectMapper.readValue[Qux ](""" {"qux": {"num": "3"}}""" )
10
+ qux.qux.num shouldEqual 3
16
11
}
17
12
}
You can’t perform that action at this time.
0 commit comments