4

I'm importing an implicit: scala.concurrent.ExecutionContext.Implicits.global, and before this, I import global.Analytics.xyzMethod, where global is a directory in my package. However, for some reason, scala things this global is same as the first global. How do I resolve this?

Govind Singh
  • 15,282
  • 14
  • 72
  • 106
0fnt
  • 8,211
  • 9
  • 45
  • 62

2 Answers2

13

Use import rename :

import scala.concurrent.ExecutionContext.Implicits.{global => newName}
LMeyer
  • 2,570
  • 1
  • 24
  • 35
  • Thanks, actually I should have noted I know this (and also because this is the simpler answer) :) Thanks again, I've upvoted both, but would be accepting the other as answer... – 0fnt Aug 08 '14 at 08:17
9

Try this:

import _root_.global.Analytics.xyzMethod

see also: scala package conflict

edit: I'm unfortunately unable to address the concern of som-snytt properly. Please take his comment into account.

Community
  • 1
  • 1
ljgw
  • 2,751
  • 1
  • 20
  • 39
  • This answer seems to be wrong or incomplete. If `global` is a subpackage of the current package: `imported 'global' is permanently hidden by definition of package global in package maqicode`. – som-snytt Aug 08 '14 at 15:25
  • @som-snytt: hmm,.. you raise an interesting point. Unfortunately I'm unable to modify my answer to reflect this properly, so I will delete this answer. (..and I find that I cannot, as the answer is already accepted) – ljgw Aug 11 '14 at 05:45