Skip to content
Snippets Groups Projects
Commit 137a6446 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Fixed Lint issues

parent b510d714
No related branches found
No related tags found
No related merge requests found
Showing with 20 additions and 18 deletions
......@@ -5,6 +5,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@SuppressWarnings("WeakerAccess")
@Retention(RetentionPolicy.SOURCE)
@Target(value = ElementType.METHOD)
public @interface Slot {
......
......@@ -5,6 +5,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@SuppressWarnings("WeakerAccess")
@Retention(RetentionPolicy.RUNTIME)
@Target(value = ElementType.TYPE)
public @interface Syncable {
......
......@@ -17,7 +17,6 @@ import java.util.Set;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.Filer;
import javax.annotation.processing.Messager;
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.Processor;
import javax.annotation.processing.RoundEnvironment;
......@@ -33,18 +32,17 @@ import javax.lang.model.element.TypeElement;
import javax.lang.model.type.ExecutableType;
import javax.lang.model.type.TypeMirror;
@SuppressWarnings("WeakerAccess")
@AutoService(Processor.class)
@SupportedAnnotationTypes("de.kuschku.libquassel.annotations.Syncable")
@SupportedSourceVersion(SourceVersion.RELEASE_8)
public class InvokerProcessor extends AbstractProcessor {
private Filer filer;
private Messager messager;
@Override
public synchronized void init(ProcessingEnvironment processingEnv) {
filer = processingEnv.getFiler();
messager = processingEnv.getMessager();
}
@Override
......@@ -224,12 +222,12 @@ public class InvokerProcessor extends AbstractProcessor {
}
private class SyncableElement {
PackageElement packageElement;
TypeElement typeElement;
final PackageElement packageElement;
final TypeElement typeElement;
Syncable annotation;
final Syncable annotation;
List<SlotElement> slots;
final List<SlotElement> slots;
public SyncableElement(PackageElement packageElement, TypeElement typeElement, Syncable annotation, List<SlotElement> slots) {
this.packageElement = packageElement;
......
......@@ -36,10 +36,10 @@ fun <U> QVariant_?.value(): U?
= this?._value<U?>(null)
fun <U> QVariant_?.value(defValue: U): U
= this?._value<U>(defValue) ?: defValue
= this?._value(defValue) ?: defValue
fun <U> QVariant_?.valueOr(f: () -> U): U
= this?._valueOr<U>(f) ?: f()
= this?._valueOr(f) ?: f()
fun <U> QVariant_?.valueOrThrow(e: Throwable = NullPointerException()): U
= this?._valueOrThrow<U>(e) ?: throw e
......@@ -54,7 +54,7 @@ class AliasManager constructor(
fun contains(name: String) = _aliases.map(Alias::name).contains(name)
fun defaults() = listOf<Alias>(
fun defaults() = listOf(
Alias("j", "/join $0"),
Alias("ns", "/msg nickserv $0"),
Alias("nickserv", "/msg nickserv $0"),
......
......@@ -68,13 +68,13 @@ class Network constructor(
= prefixModes().elementAtOrNull(prefixes().indexOf(prefix))
fun prefixesToModes(prefixes: String): String
= prefixes.toCharArray().map(this::prefixToMode).filterNotNull().joinToString()
= prefixes.mapNotNull(this::prefixToMode).joinToString()
fun modeToPrefix(mode: Char): Char?
= prefixes().elementAtOrNull(prefixModes().indexOf(mode))
fun modesToPrefixes(modes: String): String
= modes.toCharArray().map(this::modeToPrefix).filterNotNull().joinToString()
= modes.mapNotNull(this::modeToPrefix).joinToString()
fun channelModeType(mode: Char): ChannelModeType {
if (_channelModes == null)
......@@ -357,9 +357,9 @@ class Network constructor(
fun ircChannel(channelName: String) = _ircChannels[channelName]
fun ircChannels() = _ircChannels.values.toList()
fun ircChanenlCount(): UInt = _ircChannels.size
fun codecForServer() = _codecForServer.name()
fun codecForEncoding() = _codecForEncoding.name()
fun codecForDecoding() = _codecForDecoding.name()
fun codecForServer(): String = _codecForServer.name()
fun codecForEncoding(): String = _codecForEncoding.name()
fun codecForDecoding(): String = _codecForDecoding.name()
fun setCodecForDecoding(codec: Charset) {
_codecForDecoding = codec
super.setCodecForDecoding(Charsets.ISO_8859_1.encode(codecForDecoding()))
......
......@@ -43,7 +43,8 @@ class CoreConnection(
private val sizeBuffer = ByteBuffer.allocateDirect(4)
private val chainedBuffer = ChainedByteBuffer(direct = true)
val state = BehaviorSubject.createDefault(ConnectionState.DISCONNECTED)
val state: BehaviorSubject<ConnectionState> = BehaviorSubject.createDefault(
ConnectionState.DISCONNECTED)
private var channel: WrappedChannel? = null
......
......@@ -13,6 +13,7 @@ import de.kuschku.libquassel.util.compatibility.log
import org.threeten.bp.Instant
import java.io.Closeable
@Suppress("LeakingThis")
abstract class ProtocolHandler : SignalProxy, AuthHandler, Closeable {
private val objectStorage: ObjectStorage = ObjectStorage(this)
private val rpcHandler: RpcHandler = RpcHandler(this)
......
......@@ -73,8 +73,8 @@ class SessionManager(
}
private var inProgressSession = BehaviorSubject.createDefault(offlineSession)
override val state = inProgressSession.switchMap { it.state }
val session = state.map { connectionState ->
override val state: Observable<ConnectionState> = inProgressSession.switchMap { it.state }
val session: Observable<ISession> = state.map { connectionState ->
if (connectionState == ConnectionState.CONNECTED)
inProgressSession.value
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment