reyerizo / jcstress-gradle-plugin

Jcstress Gradle plugin
Apache License 2.0
31 stars 7 forks source link

Task fails with NPE #27

Open l0rinc opened 4 years ago

l0rinc commented 4 years ago

Similarly to https://github.com/jerzykrlk/jcstress-gradle-plugin/issues/20#issue-443139669, having a kotlin build script with:

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath("com.github.erizo.gradle:jcstress-gradle-plugin:0.8.4")
    }
}

repositories {
    jcenter()
}

apply(plugin = "jcstress")

and APISample_02_Arbiters under src/jcstress/java and running ./gradlew jcstress using latest Gradle 6.7 fails with:

Exception in thread "main" java.lang.NullPointerException
        at java.base/java.io.Reader.<init>(Reader.java:167)
        at java.base/java.io.InputStreamReader.<init>(InputStreamReader.java:72)
        at org.openjdk.jcstress.infra.runners.TestList.getTests(TestList.java:53)
        at org.openjdk.jcstress.infra.runners.TestList.tests(TestList.java:105)
        at org.openjdk.jcstress.JCStress.getTests(JCStress.java:139)
        at org.openjdk.jcstress.JCStress.run(JCStress.java:67)
        at org.openjdk.jcstress.Main.main(Main.java:60)
jerzykrlk commented 4 years ago

Hey Pap,

I'm afraid it's not something I can pick up right away. Especially, that I've never used a Kotlin-Gradle project.

But, would you be able to confirm that this happens with both Groovy and Kotlin scripts? And, is only this specific test case affected, or all JCStress suites result in the same error?

Thank you! Jerzy

l0rinc commented 4 years ago

Shouldn't depend on Kotlin, could you please just try your plugin with latest Gradle?

jerzykrlk commented 4 years ago

I've tried to reproduce the issue with an integration test: https://github.com/jerzykrlk/jcstress-gradle-plugin/pull/30/files

Seems to be working fine with Gradle 6.6.1 (I couldn't find Gradle 6.7 anywhere) and Groovy config.

I will keep looking for the problem, though. No worries.

l0rinc commented 4 years ago

Could you maybe try it with https://gradle.org/release-candidate? If you can't reproduce it, I'll try to come up with a simple reproducer in the next few weeks.

jerzykrlk commented 4 years ago

I assume it's just a matter of setting the right version string, I just entered "6.7", which failed.

I will try to update the integration test soon - maybe just it will do the trick.

Thank you!

pon., 28 wrz 2020, 21:59 użytkownik Lőrinc Pap notifications@github.com napisał:

Could you maybe try it with https://gradle.org/release-candidate? If you can't reproduce it, I'll try to come up with a simple reproducer in the next few weeks.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jerzykrlk/jcstress-gradle-plugin/issues/27#issuecomment-700249774, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6R75NO4SPCKYUDJDC2TGLSIDTJNANCNFSM4RNIA4GA .

jerzykrlk commented 4 years ago

I've tried to create a Gradle kts integration test case, but I failed miserably (see here: https://github.com/jerzykrlk/jcstress-gradle-plugin/pull/30/commits/0c07caa7177b4ad150ab73160dd1187dd6bb9875) - the test case won't find the plugin. Groovy-based Gradle 6.7-rc2 seems fine, though - this will need more investigation.

jerzykrlk commented 3 years ago

Hi Pap,

I had a little time to produce a kts build file: https://github.com/jerzykrlk/jcstress-gradle-plugin/pull/30 - apparently the Gradle build works well.

Would you be able to verify the problem with the recent 0.8.6 version of the plugin? I noticed some changes that could fix your issue, too.

l0rinc commented 3 years ago

Will do, thank you!

jerzykrlk commented 3 years ago

I've recreated the entire setup (Gradle 6.7-rc2, the Arbiters class and build.gradle.kts) and no results.

My setup is a Windows machine, AdoptOpenJDK 11 and everything works fine here.

Please have a look here: https://github.com/jerzykrlk/jcstress-kotlin-project - I will need some extra help reproducing the issue (like - what JVM you used, what operating system, etc).

Thanks!

anti-social commented 3 years ago

Also have the same problem. And I managed to reproduce it. My problem is kapt: https://github.com/anti-social/jcstress-with-kapt

If you comment one line https://github.com/anti-social/jcstress-with-kapt/blob/master/build.gradle.kts#L22 then jcstress will work again.

anti-social commented 3 years ago

Gradle version: 6.6.1 Java: 14.0.2 & 11.0.8

With kapt plugin active there is no META-INF/TestList (as I can see NPE is a result of missing this file) in the resulting jar file. *_jcstress.class and jcstress dependency classes is also missing.

jerzykrlk commented 3 years ago

Hey @anti-social - sorry, it's been a while.

Kapt seems to be an annotation processor for Kotlin - it might conflict with the JDK's annotation processor used in jcstress.

jerzykrlk commented 3 years ago

I think I've fixed the issue. You were right - that was kapt causing the damage. I will try to publish the new version over the weekend.

anti-social commented 3 years ago

Thanks a lot for your work.

jerzykrlk commented 3 years ago

Hey @anti-social - I've just published a new version - 0.8.7. See https://github.com/jerzykrlk/jcstress-gradle-plugin/releases/tag/0.8.7

wind57 commented 2 years ago

same problem happens for gradle 7.4 and 0.8.13 plugin version

jerzykrlkroche commented 2 years ago

Hi @wind57 Thank you for the report. Apologies for the delay - I'll try to pick this up next week.

Can you send your Java version, too?

Thanks!

wind57 commented 2 years ago

sure! its jdk-17, thank you

jerzykrlk commented 2 years ago

Hey @wind57 - Gradle 7 seems to contain quite a few API changes making it incompatible with the current plugin version. No worries though - I'll try to fix it.

wind57 commented 2 years ago

Thank you!

jerzykrlk commented 2 years ago

Ok, some progress is there - the tool works with Gradle 7.5.1, but not with Java 17.

The Gradle-related changes are in master - but I think existing plugin should work, too.

jerzykrlk commented 2 years ago

Hello @wind57 - so far, everything seems fine. A Java 17 test case passes.

Would you be able to provide a test case that would allow me to reproduce the problem?

Thank you!

wind57 commented 2 years ago

I can provide a sample github repo. will that help? the test is really easy, actually, nothing unusual.

jerzykrlk commented 2 years ago

Hi @wind57 yes, that's exactly what I need. I wasn't able to reproduce the issue in my current test suite - I hope to find something in yours.

Thank you!

jerzykrlk commented 2 years ago

Good evening @wind57 can you also check the new plugin version - 0.8.14? It should work well with Java 17 and Gradle up to 7.5.1.

Spikhalskiy commented 1 year ago

Hi @jerzykrlk, I faced the same problem with 0.8.14. Please find a repro attached, to reproduce it's enough to run ./gradlew jcstress

jerzykrlk commented 1 year ago

Hello Spikhalskiy,

I think I've found the reason. Please move the jcstress test to the jcstress sourceset. Have a look here:

jcstress-sourceset

I think it's due to JCStress internals. I'll need to figure out a good way to communicate this to the users.

Have a good day.

Spikhalskiy commented 1 year ago

This totally makes sense. I think any combination of

would be great.

Thank you for the pointer to the actual issue!

jerzykrlk commented 1 year ago

I just made an extra check - you could work around that by adding jsctress as an annotation processor like that:

jcstress-apt

I'll need to fix the docs anyway - the paragraph about a separate sourceset is well hidden at the end of the readme. Adding a code check will be trickier - but I'll try to think of something.

Thanks for your help - especially for the example!