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

RdFault: add @Nls annotations #227

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
package com.jetbrains.rd.util.reactive

import com.jetbrains.rd.util.ExecutionException
import com.jetbrains.rd.util.getThrowableText

expect class RdFault constructor(
reasonTypeFqn: String,
reasonMessage: String,
localizedReasonMessage: String,
reasonAsText: String,
reason: Throwable? = null
) : ExecutionException {
val reasonTypeFqn: String
val reasonMessage: String
val localizedReasonMessage: String
val reasonAsText: String

class RdFault constructor(val reasonTypeFqn: String, val reasonMessage: String, val reasonAsText: String, reason: Throwable? = null)
: ExecutionException(reasonMessage + if (reason == null) ", reason: $reasonAsText" else "", reason) {
constructor(reason: Throwable)

constructor (reason: Throwable) : this (reason::class.simpleName?:"", reason.message ?: "-- no message --", reason.getThrowableText(), reason) {
}
}
@Deprecated("Use the override with localizedReasonMessage")
constructor(reasonTypeFqn: String, reasonMessage: String, reasonAsText: String, reason: Throwable? = null)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.jetbrains.rd.util.reactive

import com.jetbrains.rd.util.ExecutionException
import com.jetbrains.rd.util.getThrowableText

actual class RdFault actual constructor(
actual val reasonTypeFqn: String,
actual val reasonMessage: String,
actual val localizedReasonMessage: String,
actual val reasonAsText: String,
reason: Throwable?
) : ExecutionException(reasonMessage + if (reason == null) ", reason: $reasonAsText" else "", reason) {

actual constructor (reason: Throwable) : this(
reason::class.simpleName ?: "",
reason.message ?: "-- no message --",
reason.message ?: "-- no message --",
reason.getThrowableText(),
reason
)

@Deprecated("Use the override with localizedReasonMessage")
actual constructor(reasonTypeFqn: String, reasonMessage: String, reasonAsText: String, reason: Throwable?) : this(
reasonTypeFqn,
reasonMessage,
reasonMessage,
reasonAsText,
reason
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.jetbrains.rd.util.reactive

import com.jetbrains.rd.util.ExecutionException
import com.jetbrains.rd.util.getThrowableText
import org.jetbrains.annotations.Nls

actual class RdFault actual constructor(
actual val reasonTypeFqn: String,
actual val reasonMessage: String,
@field:Nls @get:Nls @Nls actual val localizedReasonMessage: String,
actual val reasonAsText: String,
reason: Throwable?
) : ExecutionException(reasonMessage + if (reason == null) ", reason: $reasonAsText" else "", reason) {

actual constructor(reason: Throwable) : this(
reason::class.simpleName ?: "",
reason.message ?: "-- no message --",
reason.localizedMessage ?: reason.message ?: "-- no message --",
reason.getThrowableText(),
reason
)

@Deprecated("Use the override with localizedReasonMessage")
actual constructor(reasonTypeFqn: String, reasonMessage: String, reasonAsText: String, reason: Throwable?) : this(
reasonTypeFqn,
reasonMessage,
reasonMessage,
reasonAsText,
reason
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ class TestExample {
classloader.scanForResourcesContaining("com.jetbrains.rd.util") +
classloader.scanForResourcesContaining("org.jetbrains.annotations")

rdgen.verbose *= true
rdgen.classpath *= rdFrameworkClasspath.joinToString(File.pathSeparator)

val generatedSources = File(kotlinGeneratedSourcesDir).walk().toList()
Expand Down