1

Updated with more details : My objective is to set source of below code .

source(sourceSets.map { it.javaDirectories }.flatten()) 

above code working fine with jdk 1.8 but when I changed to jdk 11 then 

Task :quality-tools:compileKotlin FAILED The kotlin-dsl plugin applied to project ':quality-tools' enables experimental Kotlin compiler features.

 My import inside Kotlin file :

import jdk.nashorn.internal.objects.NativeRegExp.source 

Console error : Symbol is declared in module 'jdk.scripting.nashorn' which does not export package 'jdk.nashorn.internal.objects'

My code inside same Kotlin file:

source(sourceSets.map { it.javaDirectories }.flatten()) 

Console error :Symbol is declared in module 'jdk.scripting.nashorn' which does not export package 'jdk.nashorn.internal.objects' 
 Build scan for your reference :

https://gradle.com/s/neicp3tzhs3yo



#TODO

  • If symbol is declared in module ‘jdk.scripting.nashorn' then how can I export package jdk.nashorn.internal.objects' in jdk 11 or any alternative to set source as I mentioned above ?


I found this link when I investigated further. 
https://docs.oracle.com/javase/9/docs/api/jdk.scripting.nashorn-summary.html

Thanks Jitendra

jitendra kumar
  • 2,161
  • 2
  • 7
  • 12
  • 1
    The Nashorn engine is entirely irrelevant. Read the message: “*Symbol is declared in module … which does not export package …*”. You are using a private class, not part of the official API. The word **internal** in the qualified name does already hint at it, even when older Java versions did not have a module system to enforce using the official API. This is, by the way, also entirely unrelated to Spotbugs. When we dive into the unnecessary details of Nashorn, we’ll find that the version you’ve linked, doesn’t even have packages starting with `jdk.`. – Holger Sep 03 '21 at 10:32
  • @Holger Thanks for your time and quick reply . 1/2 I agree with you that I may be wrong and I didn’t understand the root cause of my problem.
 My objective is to set source of below code .

source(sourceSets.map { it.javaDirectories }.flatten()) 

above code working fine with jdk 1.8 but when I changed to jdk 11 then 

Task :quality-tools:compileKotlin FAILED – jitendra kumar Sep 05 '21 at 12:04
  • 1
    Internal APIs can change, internal APIs can disappear. There is no guaranty that the code will run on future versions when it uses internal APIs. It doesn’t matter that it happened to run with a specific older version. Don’t expect anyone to be able to suggest an alternative for a single line of code without any context or purpose (beyond describing the line itself). – Holger Sep 06 '21 at 08:08

1 Answers1

0

Because I did not kotlinx , But import jdk.nashorn.internal.runtime.GlobalConstants is in my code , So solved after deleting.