From 18c521dd4b14744bc66112795d6167b79552ba81 Mon Sep 17 00:00:00 2001 From: Martin Duhem Date: Sat, 29 Nov 2014 12:07:40 +0100 Subject: [PATCH] Check for null type trees in dependency extraction In some cases the dependency extraction may encounter a null `TypeTree` (eg. arguments of macro annotations that are untyped). In such cases, we simply ignore the node. Fixes #1593, #1655. --- compile/interface/src/main/scala/xsbt/Dependency.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compile/interface/src/main/scala/xsbt/Dependency.scala b/compile/interface/src/main/scala/xsbt/Dependency.scala index 5fb688c73..be2454afb 100644 --- a/compile/interface/src/main/scala/xsbt/Dependency.scala +++ b/compile/interface/src/main/scala/xsbt/Dependency.scala @@ -137,7 +137,9 @@ final class Dependency(val global: CallbackGlobal) extends LocateClassFile { */ case ident: Ident => addDependency(ident.symbol) - case typeTree: TypeTree => + // In some cases (eg. macro annotations), `typeTree.tpe` may be null. + // See sbt/sbt#1593 and sbt/sbt#1655. + case typeTree: TypeTree if typeTree.tpe != null => val typeSymbolCollector = new CollectTypeTraverser({ case tpe if !tpe.typeSymbol.isPackage => tpe.typeSymbol })