"illegal loopback involving InterfaceAudience" when using Scala 2.11 reflection

I find the error above on scala 2.11.7:

def main(args: Array[String]): Unit = {
  val x = typeOf[ org.apache.hadoop.io.Writable ]
  println( x )
}

Additional information about my compilation process:

I narrowed down to the minimum required to play:

I have a project with build.gradle as follows:

buildscript {
  repositories {
      mavenCentral()
      maven {
        name 'Shadow'
        url 'http://dl.bintray.com/content/johnrengelman/gradle-    plugins'
      }
  }
  dependencies {
    classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.1'
  }
}

apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'scala'

repositories {
    mavenCentral()
}

dependencies 
{
  compile group: 'org.scala-lang', name: 'scala-library', version: '2.11.7'
  compile group: 'org.scala-lang', name: 'scala-reflect', version: '2.11.7'
  compile( "org.apache.hadoop:hadoop-common:2.4.0" )
}

This is my main:

import scala.reflect.runtime.universe._

object Test 
{
  def main(args: Array[String]): Unit = {
     val x = typeOf[ org.apache.hadoop.io.Writable ]
     println( x )
  }  
}

Create with:

gradle clean shadow

creates a jar with all the dependencies.

java -cp ./build/libs/uber.jar Test

Results in the above exception

+4
source share

Source: https://habr.com/ru/post/1651453/


All Articles