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

ContestEstimator fails with java.lang.NullPointerException #558

Closed
volivan239 opened this issue Jul 19, 2022 · 0 comments · Fixed by #559
Closed

ContestEstimator fails with java.lang.NullPointerException #558

volivan239 opened this issue Jul 19, 2022 · 0 comments · Fixed by #559
Labels
comp-fuzzing Issue is related to the fuzzing ctg-bug Issue is a bug

Comments

@volivan239
Copy link
Collaborator

Description

ContestEstimator throws unexpected java.lang.NullPointerException and generates empty test class on enums

To Reproduce

Launch contestEstimator with methodFilter = "com.google.common.base.CaseFormat.*" and projectFilter = null and 120s time limit

Expected behavior

Tests generated

Actual behavior

java.lang.NullPointerException is thrown and empty test class is generated

Visual proofs (screenshots, logs, images)

Generated test file:

package com.google.common.base;

public class CaseFormatTest {
}

From console:

Exception in thread "SymbolicExecution" java.lang.NullPointerException: classId.jClass.enumConstants must not be null
	at org.utbot.fuzzer.providers.EnumModelProvider$generate$1.invokeSuspend(EnumModelProvider.kt:18)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlin.sequences.SequenceBuilderIterator.hasNext(SequenceBuilder.kt:140)
	at org.utbot.fuzzer.ModelProvider$Combined$generate$1.invokeSuspend(ModelProvider.kt:143)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlin.sequences.SequenceBuilderIterator.hasNext(SequenceBuilder.kt:140)
	at org.utbot.fuzzer.FuzzerKt.fuzz(Fuzzer.kt:76)
	at org.utbot.fuzzer.providers.ObjectModelProvider$Companion.fuzzParameters(ObjectModelProvider.kt:173)
	at org.utbot.fuzzer.providers.ObjectModelProvider$Companion.access$fuzzParameters(ObjectModelProvider.kt:145)
	at org.utbot.fuzzer.providers.ObjectModelProvider$generate$1.invokeSuspend(ObjectModelProvider.kt:82)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlin.sequences.SequenceBuilderIterator.hasNext(SequenceBuilder.kt:140)
	at org.utbot.fuzzer.ModelProvider$Combined$generate$1.invokeSuspend(ModelProvider.kt:143)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlin.sequences.SequenceBuilderIterator.hasNext(SequenceBuilder.kt:140)
	at org.utbot.fuzzer.FuzzerKt.fuzz(Fuzzer.kt:76)
	at org.utbot.engine.UtBotSymbolicEngine$fuzzing$2.invokeSuspend(UtBotSymbolicEngine.kt:426)
	at org.utbot.engine.UtBotSymbolicEngine$fuzzing$2.invoke(UtBotSymbolicEngine.kt)
	at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
	at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:212)
	at kotlinx.coroutines.flow.FlowKt__MergeKt$flattenConcat$$inlined$unsafeFlow$1$lambda$1.emit(Collect.kt:134)
	at kotlinx.coroutines.flow.FlowKt__BuildersKt$flowOf$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:114)
	at kotlinx.coroutines.flow.FlowKt__MergeKt$flattenConcat$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:114)
	at org.utbot.contest.ContestKt$runGeneration$1$invokeSuspend$$inlined$bracket$lambda$1$1.invokeSuspend(Contest.kt:519)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)

Additional context

Was working ok in main on 11.07.2022

@korifey korifey moved this to Todo in UTBot Java Jul 19, 2022
@volivan239 volivan239 added ctg-bug Issue is a bug comp-fuzzing Issue is related to the fuzzing labels Jul 19, 2022
dtim added a commit that referenced this issue Jul 19, 2022
Co-author: volivan239

Anonymous inner classes declared for enum constants are not enums
themselves, as the necessary condition for being enums is that their
direct supertype is `java.lang.Enum` (see the JavaDoc and comments of
`java.lang.Class#isEnum` method). For these classes, `getEnumConstants`
method returns `null`.
@dtim dtim closed this as completed in #559 Jul 20, 2022
dtim added a commit that referenced this issue Jul 20, 2022
Co-author: volivan239

Anonymous inner classes declared for enum constants are not enums
themselves, as the necessary condition for being enums is that their
direct supertype is `java.lang.Enum` (see the JavaDoc and comments of
`java.lang.Class#isEnum` method). For these classes, `getEnumConstants`
method returns `null`.
Repository owner moved this from Todo to Done in UTBot Java Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-fuzzing Issue is related to the fuzzing ctg-bug Issue is a bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant