Change the Kotlin language version to 2.1
This commit is contained in:
parent
5bedd323ca
commit
dd68ef111b
10 changed files with 21 additions and 24 deletions
7
.idea/kotlinc.xml
generated
7
.idea/kotlinc.xml
generated
|
@ -7,10 +7,7 @@
|
||||||
<option name="jvmTarget" value="17" />
|
<option name="jvmTarget" value="17" />
|
||||||
</component>
|
</component>
|
||||||
<component name="KotlinCommonCompilerArguments">
|
<component name="KotlinCommonCompilerArguments">
|
||||||
<option name="apiVersion" value="2.2" />
|
<option name="apiVersion" value="2.1" />
|
||||||
<option name="languageVersion" value="2.2" />
|
<option name="languageVersion" value="2.1" />
|
||||||
</component>
|
|
||||||
<component name="KotlinJpsPluginSettings">
|
|
||||||
<option name="version" value="2.1.20" />
|
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -72,8 +72,8 @@ public class MobibotBuild extends Project {
|
||||||
|
|
||||||
javaRelease = 17;
|
javaRelease = 17;
|
||||||
|
|
||||||
downloadSources = true;
|
|
||||||
autoDownloadPurge = true;
|
autoDownloadPurge = true;
|
||||||
|
downloadSources = true;
|
||||||
|
|
||||||
repositories = List.of(
|
repositories = List.of(
|
||||||
MAVEN_LOCAL,
|
MAVEN_LOCAL,
|
||||||
|
@ -168,7 +168,7 @@ public class MobibotBuild extends Project {
|
||||||
public void compile() throws Exception {
|
public void compile() throws Exception {
|
||||||
releaseInfo();
|
releaseInfo();
|
||||||
var op = new CompileKotlinOperation().fromProject(this);
|
var op = new CompileKotlinOperation().fromProject(this);
|
||||||
op.compileOptions().progressive(true).verbose(true);
|
op.compileOptions().languageVersion("2.1").progressive(true).verbose(true);
|
||||||
op.execute();
|
op.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,10 +125,10 @@ class Mobibot(nickname: String, val channel: String, logsDirPath: String, p: Pro
|
||||||
).use { fis ->
|
).use { fis ->
|
||||||
p.load(fis)
|
p.load(fis)
|
||||||
}
|
}
|
||||||
} catch (ignore: FileNotFoundException) {
|
} catch (_: FileNotFoundException) {
|
||||||
System.err.println("Unable to find properties file.")
|
System.err.println("Unable to find properties file.")
|
||||||
exitProcess(1)
|
exitProcess(1)
|
||||||
} catch (ignore: IOException) {
|
} catch (_: IOException) {
|
||||||
System.err.println("Unable to open properties file.")
|
System.err.println("Unable to open properties file.")
|
||||||
exitProcess(1)
|
exitProcess(1)
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ class Mobibot(nickname: String, val channel: String, logsDirPath: String, p: Pro
|
||||||
), true
|
), true
|
||||||
)
|
)
|
||||||
System.setOut(stdout)
|
System.setOut(stdout)
|
||||||
} catch (ignore: IOException) {
|
} catch (_: IOException) {
|
||||||
System.err.println("Unable to open output (stdout) log file.")
|
System.err.println("Unable to open output (stdout) log file.")
|
||||||
exitProcess(1)
|
exitProcess(1)
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ class Mobibot(nickname: String, val channel: String, logsDirPath: String, p: Pro
|
||||||
), true
|
), true
|
||||||
)
|
)
|
||||||
System.setErr(stderr)
|
System.setErr(stderr)
|
||||||
} catch (ignore: IOException) {
|
} catch (_: IOException) {
|
||||||
System.err.println("Unable to open error (stderr) log file.")
|
System.err.println("Unable to open error (stderr) log file.")
|
||||||
exitProcess(1)
|
exitProcess(1)
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,7 +331,7 @@ object Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a formatted commands/modules, etc. list.
|
* Send a formatted list to the channel.
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
|
@ -394,7 +394,7 @@ object Utils {
|
||||||
fun String.toIntOrDefault(defaultValue: Int): Int {
|
fun String.toIntOrDefault(defaultValue: Int): Int {
|
||||||
return try {
|
return try {
|
||||||
toInt()
|
toInt()
|
||||||
} catch (e: NumberFormatException) {
|
} catch (_: NumberFormatException) {
|
||||||
defaultValue
|
defaultValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,7 @@ class LinksManager : AbstractCommand() {
|
||||||
|
|
||||||
pinboard.addPin(event.bot().serverHostname, entry)
|
pinboard.addPin(event.bot().serverHostname, entry)
|
||||||
|
|
||||||
// Queue link for posting to social media.
|
// Queue the entry for posting to social media.
|
||||||
socialManager.queueEntry(index)
|
socialManager.queueEntry(index)
|
||||||
|
|
||||||
entries.save()
|
entries.save()
|
||||||
|
@ -179,7 +179,7 @@ class LinksManager : AbstractCommand() {
|
||||||
if (title.isNotBlank()) {
|
if (title.isNotBlank()) {
|
||||||
return title
|
return title
|
||||||
}
|
}
|
||||||
} catch (ignore: IOException) {
|
} catch (_: IOException) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
return Constants.NO_TITLE
|
return Constants.NO_TITLE
|
||||||
|
@ -193,7 +193,7 @@ class LinksManager : AbstractCommand() {
|
||||||
"Duplicate".bold() + " >> " + printLink(entries.links.indexOf(match), match)
|
"Duplicate".bold() + " >> " + printLink(entries.links.indexOf(match), match)
|
||||||
)
|
)
|
||||||
true
|
true
|
||||||
} catch (ignore: NoSuchElementException) {
|
} catch (_: NoSuchElementException) {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ class View : AbstractCommand() {
|
||||||
if (start > entries.links.size) {
|
if (start > entries.links.size) {
|
||||||
start = 0
|
start = 0
|
||||||
}
|
}
|
||||||
} catch (ignore: NumberFormatException) {
|
} catch (_: NumberFormatException) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ class CryptoPrices : AbstractModule() {
|
||||||
val price = currentPrice(args.split(' '))
|
val price = currentPrice(args.split(' '))
|
||||||
val amount = try {
|
val amount = try {
|
||||||
price.toCurrency()
|
price.toCurrency()
|
||||||
} catch (ignore: IllegalArgumentException) {
|
} catch (_: IllegalArgumentException) {
|
||||||
price.amount
|
price.amount
|
||||||
}
|
}
|
||||||
event.respond("${price.base} current price is $amount [${CURRENCIES[price.currency]}]")
|
event.respond("${price.base} current price is $amount [${CURRENCIES[price.currency]}]")
|
||||||
|
|
|
@ -82,7 +82,7 @@ class StockQuote : AbstractModule() {
|
||||||
if (info.isNotEmpty()) {
|
if (info.isNotEmpty()) {
|
||||||
throw ModuleException(debugMessage, info.unescapeXml())
|
throw ModuleException(debugMessage, info.unescapeXml())
|
||||||
}
|
}
|
||||||
} catch (ignore: JSONException) {
|
} catch (_: JSONException) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -94,7 +94,7 @@ class StockQuote : AbstractModule() {
|
||||||
if (error.isNotEmpty()) {
|
if (error.isNotEmpty()) {
|
||||||
throw ModuleException(debugMessage, error.unescapeXml())
|
throw ModuleException(debugMessage, error.unescapeXml())
|
||||||
}
|
}
|
||||||
} catch (ignore: JSONException) {
|
} catch (_: JSONException) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
json
|
json
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ChatGpt2Test : LocalProperties() {
|
||||||
fun chat() {
|
fun chat() {
|
||||||
assertThat(
|
assertThat(
|
||||||
ChatGpt2.chat(
|
ChatGpt2.chat(
|
||||||
"return only the code for javascript function to make a request with XMLHttpRequest",
|
"javascript function to make a request with XMLHttpRequest, just code",
|
||||||
apiKey,
|
apiKey,
|
||||||
50
|
50
|
||||||
)
|
)
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Gemini2Test : LocalProperties() {
|
||||||
fun chatHttpRequestInJavascript() {
|
fun chatHttpRequestInJavascript() {
|
||||||
assertThat(
|
assertThat(
|
||||||
Gemini2.chat(
|
Gemini2.chat(
|
||||||
"return only the code for a javascript function to make a request with XMLHttpRequest",
|
"javascript function to make a request with XMLHttpRequest, just code",
|
||||||
apiKey,
|
apiKey,
|
||||||
maxTokens
|
maxTokens
|
||||||
)
|
)
|
||||||
|
@ -62,8 +62,8 @@ class Gemini2Test : LocalProperties() {
|
||||||
@DisableOnCi
|
@DisableOnCi
|
||||||
fun chatEncodeUrlInJava() {
|
fun chatEncodeUrlInJava() {
|
||||||
assertThat(
|
assertThat(
|
||||||
Gemini2.chat("how do I encode a URL in java?", apiKey, 60)
|
Gemini2.chat("encode a url in java, one line, just code", apiKey, 60)
|
||||||
).isNotNull().contains("URLEncoder")
|
).isNotNull().contains("UrlEncoder", true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue