dfabulich / sitemapgen4j

SitemapGen4j is a library to generate XML sitemaps in Java.
Apache License 2.0
160 stars 90 forks source link

Accessing ISitemapUrl interface throws IllegalAccessError #36

Closed ramsrib closed 6 years ago

ramsrib commented 7 years ago

Trying to use the following code snippet in my Kotlin project.

WebSitemapGenerator wsg = new WebSitemapGenerator("http://www.example.com", myDir);
WebSitemapUrl url = new WebSitemapUrl.Options("http://www.example.com/index.html")
    .lastMod(new Date()).priority(1.0).changeFreq(ChangeFreq.HOURLY).build();
wsg.addUrl(url);
wsg.write();

I'm getting the following error during the runtime.

Exception in thread "main" java.lang.IllegalAccessError: tried to access class com.redfin.sitemapgenerator.ISitemapUrl from class Main
    at Main.run(Main.kt:20)
    at Main$Companion.main(Main.kt:38)
    at Main.main(Main.kt)

The ISitemapUrl interface is not public and it's creating the problem when i try to access the wsg.addUrl(url).

Solution:

Miha-x64 commented 6 years ago

It's Kotlin compiler bug, but I think that solution PR should be merged.

mkurz commented 6 years ago

Fixed via #37

mkurz commented 6 years ago

Version 1.1.0 with support for this feature should be available in a few hours.