Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 45
Minimize exceptions in signature#418
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
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
1 change: 0 additions & 1 deletion
1 utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/UtExecutionResult.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10 utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/util/ThrowableUtils.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package org.utbot.framework.plugin.api.util | ||
| val Throwable.description | ||
| get() = message?.replace('\n', '\t') ?: "<Throwable with empty message>" | ||
| val Throwable.isCheckedException | ||
| get() = !(this is RuntimeException || this is Error) | ||
| val Class<*>.isCheckedException | ||
| get() = !(RuntimeException::class.java.isAssignableFrom(this) || Error::class.java.isAssignableFrom(this)) |
2 changes: 1 addition & 1 deletion
2 utbot-framework/src/main/kotlin/org/utbot/engine/UtBotSymbolicEngine.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 24 additions & 5 deletions
29 ...mework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/context/CgContext.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 10 additions & 11 deletions
21 ...main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgCallableAccessManager.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -127,15 +127,12 @@ internal class CgCallableAccessManagerImpl(val context: CgContext) : CgCallableA | ||
| //Builtin methods does not have jClass, so [methodId.method] will crash on it, | ||
| //so we need to collect required exceptions manually from source codes | ||
| if (methodId is BuiltinMethodId) { | ||
| methodId.findExceptionTypes().forEach { addException(it) } | ||
| methodId.findExceptionTypes().forEach { addExceptionIfNeeded(it) } | ||
| return | ||
| } | ||
| //If [InvocationTargetException] is thrown manually in test, we need | ||
| // to add "throws Throwable" and other exceptions are not required so on. | ||
| if (methodId == getTargetException) { | ||
| collectedExceptions.clear() | ||
| addException(Throwable::class.id) | ||
| return | ||
| addExceptionIfNeeded(Throwable::class.id) | ||
Damtev marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
| val methodIsUnderTestAndThrowsExplicitly = methodId == currentExecutable | ||
| @@ -148,16 +145,18 @@ internal class CgCallableAccessManagerImpl(val context: CgContext) : CgCallableA | ||
| return | ||
| } | ||
| methodId.method.exceptionTypes.forEach { addException(it.id) } | ||
| methodId.method.exceptionTypes.forEach { addExceptionIfNeeded(it.id) } | ||
| } | ||
| private fun newConstructorCall(constructorId: ConstructorId) { | ||
| importIfNeeded(constructorId.classId) | ||
| for (exception in constructorId.exceptions) { | ||
| addException(exception) | ||
| addExceptionIfNeeded(exception) | ||
| } | ||
| } | ||
| //WARN: if you make changes in the following sets of exceptions, | ||
| //don't forget to change them in hardcoded [UtilMethods] as well | ||
| private fun BuiltinMethodId.findExceptionTypes(): Set<ClassId> { | ||
| if (!this.isUtil) return emptySet() | ||
| @@ -167,9 +166,9 @@ internal class CgCallableAccessManagerImpl(val context: CgContext) : CgCallableA | ||
| getStaticFieldValueMethodId, | ||
| getFieldValueMethodId, | ||
| setStaticFieldMethodId, | ||
| setFieldMethodId, | ||
| createInstanceMethodId, | ||
| getUnsafeInstanceMethodId -> setOf(Exception::class.id) | ||
| setFieldMethodId -> setOf(IllegalAccessException::class.id, NoSuchFieldException::class.id) | ||
| createInstanceMethodId -> setOf(Exception::class.id) | ||
| getUnsafeInstanceMethodId -> setOf(ClassNotFoundException::class.id, NoSuchFieldException::class.id, IllegalAccessException::class.id) | ||
| createArrayMethodId -> setOf(ClassNotFoundException::class.id) | ||
| deepEqualsMethodId, | ||
| arraysDeepEqualsMethodId, | ||
18 changes: 11 additions & 7 deletions
18 ...src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgMethodConstructor.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2 .../main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgTestClassConstructor.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4 utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/tree/Builders.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3 utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/tree/CgElement.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3 utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/visitor/CgJavaRenderer.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3 utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/visitor/UtilMethods.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4 utbot-framework/src/main/kotlin/org/utbot/framework/util/ThrowableUtils.kt
This file was deleted.
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
2 changes: 1 addition & 1 deletion
2 utbot-framework/src/test/kotlin/org/utbot/framework/codegen/BaseTestCodeGeneratorPipeline.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5 utbot-summary/src/main/kotlin/org/utbot/summary/TagGenerator.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.