[ 
https://issues.apache.org/jira/browse/SPARK-22393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16265394#comment-16265394
 ] 

Mark Petruska commented on SPARK-22393:
---------------------------------------

Proof for the above statement:
Tracing the import handler generated by `import java.util.UUID` yields

{code}
MemberHandlers$ImportHandler (refs: java)
expr: java.util
selectors: List(ImportSelector(UUID,17,UUID,17))
targetType: <noprefix>
importsWildcard: false
implicitSymbols: List()
importedSymbols: List()
importString: import java.util.UUID
{code}

(also in `scala.tools.nsc.interpreter.MemberHandlers.ImportHandler` (excerpt):
{code}
def importedSymbols = individualSymbols ++ wildcardSymbols

...

/** Complete list of names imported by a wildcard */
lazy val wildcardNames: List[Name]   = wildcardSymbols map (_.name)
lazy val individualNames: List[Name] = individualSymbols map (_.name)

/** The names imported by this statement */
override lazy val importedNames: List[Name] = wildcardNames ++ individualNames
{code}
)

and the source code of `scala.tools.nsc.interpreter.Imports.importsCode` 
(excerpt):

{code}
// Single symbol imports might be implicits! See bug #1752.  Rather than
// try to finesse this, we will mimic all imports for now.
def keepHandler(handler: MemberHandler) = handler match {
  // While defining classes in class based mode - implicits are not needed.
  case h: ImportHandler if isClassBased && definesClass => 
h.importedNames.exists(x => wanted.contains(x))
  case _: ImportHandler     => true
  case x if generousImports => x.definesImplicit || (x.definedNames exists (d 
=> wanted.exists(w => d.startsWith(w))))
  case x                    => x.definesImplicit || (x.definedNames exists 
wanted)
}
{code}


> spark-shell can't find imported types in class constructors, extends clause
> ---------------------------------------------------------------------------
>
>                 Key: SPARK-22393
>                 URL: https://issues.apache.org/jira/browse/SPARK-22393
>             Project: Spark
>          Issue Type: Bug
>          Components: Spark Shell
>    Affects Versions: 2.0.2, 2.1.2, 2.2.0
>            Reporter: Ryan Williams
>            Priority: Minor
>
> {code}
> $ spark-shell
> …
> scala> import org.apache.spark.Partition
> import org.apache.spark.Partition
> scala> class P(p: Partition)
> <console>:11: error: not found: type Partition
>        class P(p: Partition)
>                   ^
> scala> class P(val index: Int) extends Partition
> <console>:11: error: not found: type Partition
>        class P(val index: Int) extends Partition
>                                        ^
> {code}
> Any class that I {{import}} gives "not found: type ___" when used as a 
> parameter to a class, or in an extends clause; this applies to classes I 
> import from JARs I provide via {{--jars}} as well as core Spark classes as 
> above.
> This worked in 1.6.3 but has been broken since 2.0.0.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to