#2386 NPE in compiler::FPod.read when reading icons pod

ivan Wed 7 Jan 2015

Happy new year!

Just wanted to report a minor bug I've encountered while working on F4 issue. The icons pod has no types, so compiler::FPod#read fails with NPE while trying to read data from /fcode/types.def. This causes an issue in F4, but can be reproduced in a console build when build.fan sets build::BuildPod#dependsDir:

fan build.fan
compile [issue38]
 Compile [issue38]
   FindSourceFiles [1 files]
ERR: Internal compiler error
sys::NullErr: java.lang.NullPointerException
 compiler::FPod.read (FPod.fan:183)
 compiler::FPodNamespace.findPod (FPodNamespace.fan:55)
 compiler::CNamespace.resolvePod (CNamespace.fan:226)
 compiler::ResolveDepends.resolveDepend (ResolveDepends.fan:92)
 compiler::ResolveDepends.run (ResolveDepends.fan:58)
 fan.sys.List.each (List.java:588)
 compiler::ResolveDepends.run (ResolveDepends.fan:55)
 compiler::Compiler.frontend (Compiler.fan:87)
 compiler::Compiler.compile (Compiler.fan:66)
 build::BuildPod.compileFan (BuildPod.fan:243)
 build::BuildPod.compile (BuildPod.fan:166)
 java.lang.reflect.Method.invoke (Method.java:606)
 fan.sys.Method.invoke (Method.java:559)
 fan.sys.Method$MethodFunc.callOn (Method.java:230)
 fan.sys.Method.callOn (Method.java:139)
 build::TargetMethod.run (TargetMethod.fan:77)
 build::BuildScript.main (BuildScript.fan:316)
 fan.sys.List.each (List.java:588)
 build::BuildScript.main (BuildScript.fan:316)
 java.lang.reflect.Method.invoke (Method.java:606)
 fan.sys.Method.invoke (Method.java:559)
 fan.sys.Method$MethodFunc.callOn (Method.java:230)
 fan.sys.Method.callOn (Method.java:139)
 fanx.tools.Fan.callMain (Fan.java:175)
 fanx.tools.Fan.executeFile (Fan.java:98)
 4 More...
BUILD FAILED [70ms]!

brian Wed 7 Jan 2015

Hi Ivan,

I'm trying to reproduce that problem, but can't figure it out (at least in latest code). I added a dependency on icons pod and did various things like introduce compiler errors.

ivan Wed 7 Jan 2015

Hi Brian,

Thanks for looking into that. I've uploaded a sample project here – http://iinozemtsev.net/dump/issue38.zip

It's really just a single empty class, even without compile error, and almost default build.fan with a dependency to icons pod. It compiles fine via fan build.fan, but once I specify dependsDir in build.fan, this error happens, as it seems that compiler starts using FPods instead of ReflectPods.

➜  /tmp/tmp/issue38  fan -version
Fantom Launcher
Copyright (c) 2006-2013, Brian Frank and Andy Frank
Licensed under the Academic Free License version 3.0

Java Runtime:
  java.version:    1.7.0_72
  java.vm.name:    Java HotSpot(TM) 64-Bit Server VM
  java.vm.vendor:  Oracle Corporation
  java.vm.version: 24.72-b04
  java.home:       /Library/Java/JavaVirtualMachines/jdk1.7.0_72.jdk/Contents/Home/jre
  fan.platform:    macosx-x86_64
  fan.version:     1.0.66
  fan.env:         sys::BootEnv
  fan.home:        /Users/ivaninozemtsev/fantom-1.0.66
➜  /tmp/tmp/issue38  cat build.fan
using build
class Build : build::BuildPod
{
  new make()
  {
    podName = "issue38"
    summary = ""
    srcDirs = [`fan/`]
    depends = ["sys 1.0", "icons 1.0"]
    dependsDir = `/Users/ivaninozemtsev/fantom-1.0.66/lib/fan/`
  }
}
➜  /tmp/tmp/issue38  fan build.fan
compile [issue38]
  Compile [issue38]
    FindSourceFiles [1 files]
ERR: Internal compiler error
sys::NullErr: java.lang.NullPointerException
  compiler::FPod.read (FPod.fan:183)
  compiler::FPodNamespace.findPod (FPodNamespace.fan:55)
  compiler::CNamespace.resolvePod (CNamespace.fan:226)
  compiler::ResolveDepends.resolveDepend (ResolveDepends.fan:92)
  compiler::ResolveDepends.run (ResolveDepends.fan:58)
  fan.sys.List.each (List.java:588)
  ... skipped ...

brian Wed 7 Jan 2015

Thanks for reporting that. I pushed a fix.

Login or Signup to reply.