Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException: Parameter specified as non-null is null: #266

Closed
ben-manes opened this issue Feb 1, 2024 · 1 comment
Closed

NullPointerException: Parameter specified as non-null is null: #266

ben-manes opened this issue Feb 1, 2024 · 1 comment
Assignees

Comments

@ben-manes
Copy link

Gradle suite > Gradle test > com.github.benmanes.caffeine.lincheck.CaffeineLincheckTest$BoundedLincheckTest > modelCheckingTest FAILED
    java.lang.ExceptionInInitializerError
        at com.github.benmanes.caffeine.cache.BoundedLocalCache.<init>(BoundedLocalCache.java:270)
        at com.github.benmanes.caffeine.cache.SS.<init>(Unknown Source)
        at com.github.benmanes.caffeine.cache.SSMS.<init>(Unknown Source)
        at com.github.benmanes.caffeine.cache.SSMSW.<init>(Unknown Source)
        at com.github.benmanes.caffeine.cache.LocalCacheFactory.newBoundedLocalCache(LocalCacheFactory.java:48)
        at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalManualCache.<init>(BoundedLocalCache.java:3953)
        at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalLoadingCache.<init>(BoundedLocalCache.java:4451)
        at com.github.benmanes.caffeine.cache.Caffeine.build(Caffeine.java:1073)
        at com.github.benmanes.caffeine.lincheck.AbstractLincheckCacheTest.<init>(AbstractLincheckCacheTest.java:47)
        at com.github.benmanes.caffeine.lincheck.CaffeineLincheckTest$BoundedLincheckTest.<init>(CaffeineLincheckTest.java:40)

        Caused by:
        java.lang.NullPointerException: Parameter specified as non-null is null: method org.jetbrains.kotlinx.lincheck.strategy.managed.ManagedStrategy.identityHashCodeDeterministic$lincheck, parameter obj
            at org.jetbrains.kotlinx.lincheck.strategy.managed.ManagedStrategy.identityHashCodeDeterministic$lincheck(ManagedStrategy.kt)
            at com.github.benmanes.caffeine.cache.References$WeakKeyReference.<init>(References.java:188)
            at com.github.benmanes.caffeine.cache.NodeFactory$RetiredWeakKey.<init>(NodeFactory.java:160)
            at com.github.benmanes.caffeine.cache.NodeFactory.<clinit>(NodeFactory.java:38)
            ... 10 more

This is when the build upgrades from 2.18.1 to 2.24. The hash of null is well defined (zero by System.identityHashCode` so I think this method should be loosened. The instrumented constructors all handle this null parameters properly.

@ben-manes
Copy link
Author

When trying to work around this a different NPE appears,

java.lang.NullPointerException: it.first must not be null
	at org.jetbrains.kotlinx.lincheck.runner.ParallelThreadsRunner.run(ParallelThreadsRunner.kt:286)
	at org.jetbrains.kotlinx.lincheck.strategy.managed.ManagedStrategy.runInvocation(ManagedStrategy.kt:243)
	at org.jetbrains.kotlinx.lincheck.strategy.managed.modelchecking.ModelCheckingStrategy.runImpl(ModelCheckingStrategy.kt:62)
	at org.jetbrains.kotlinx.lincheck.strategy.managed.ManagedStrategy.run(ManagedStrategy.kt:130)
	at org.jetbrains.kotlinx.lincheck.LinChecker.run(LinChecker.kt:126)
	at org.jetbrains.kotlinx.lincheck.LinChecker.checkImpl(LinChecker.kt:80)
	at org.jetbrains.kotlinx.lincheck.LinChecker.checkImpl$lincheck(LinChecker.kt:52)
	at org.jetbrains.kotlinx.lincheck.LinChecker.check(LinChecker.kt:42)

@ndkoval ndkoval self-assigned this Feb 6, 2024
@ndkoval ndkoval closed this as completed in 2d0ab4b Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants