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

Using Icepick without Annotation Processing? #81

Open
mazurio opened this Issue Mar 23, 2016 · 4 comments

Comments

Projects
None yet
5 participants
@mazurio

mazurio commented Mar 23, 2016

Hi,

Is it possible to use Icepick without "@State" annotations? Can I manually add the objects I want to save? I would like to use Icepick with Kotlin but I cannot get it to work.

Thanks

@donnysim

This comment has been minimized.

Show comment
Hide comment
@donnysim

donnysim May 29, 2016

I'd love to use kotlin too, but when you have Icepick

a simple class as

abstract class BaseFragment : Fragment() {

    override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        return super.onCreateView(inflater, container, savedInstanceState)
    }

}

fails to compile because of icepick processor.

13:46:45.179 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.IllegalArgumentException: (android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)android.view.View
13:46:45.179 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.model.JavacTypes.validateTypeNotIn(JavacTypes.java:291)
13:46:45.179 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.model.JavacTypes.isAssignable(JavacTypes.java:102)
13:46:45.179 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
13:46:45.179 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
13:46:45.179 [ERROR] [org.gradle.BuildExceptionReporter]    at icepick.processor$assignable_QMARK_.invoke(processor.clj:38)
13:46:45.179 [ERROR] [org.gradle.BuildExceptionReporter]    at icepick.processor$parcelable_QMARK_.invoke(processor.clj:220)
13:46:45.179 [ERROR] [org.gradle.BuildExceptionReporter]    at icepick.processor$bundle_method.invoke(processor.clj:239)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at icepick.processor$analyze_field.invoke(processor.clj:259)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.core$map$fn__4553.invoke(core.clj:2624)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.lang.LazySeq.sval(LazySeq.java:40)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.lang.LazySeq.seq(LazySeq.java:49)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.lang.RT.seq(RT.java:507)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.core$seq__4128.invoke(core.clj:137)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.core.protocols$seq_reduce.invoke(protocols.clj:30)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.core.protocols$fn__6506.invoke(protocols.clj:101)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.core.protocols$fn__6452$G__6447__6465.invoke(protocols.clj:13)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.core$reduce.invoke(core.clj:6519)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.core$group_by.invoke(core.clj:6861)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at icepick.processor$process.invoke(processor.clj:275)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.lang.Var.invoke(Var.java:388)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at icepick.processor.IcepickProcessor.process(IcepickProcessor.java:42)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at org.jetbrains.kotlin.annotation.AnnotationProcessorWrapper.process(AnnotationProcessorWrapper.kt:115)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
13:46:45.181 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.main.Main.compile(Main.java:523)
13:46:45.181 [ERROR] [org.gradle.BuildExceptionReporter]    ... 91 more

not really sure tough if it's the kotlin processor or icepick.

donnysim commented May 29, 2016

I'd love to use kotlin too, but when you have Icepick

a simple class as

abstract class BaseFragment : Fragment() {

    override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        return super.onCreateView(inflater, container, savedInstanceState)
    }

}

fails to compile because of icepick processor.

13:46:45.179 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.IllegalArgumentException: (android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)android.view.View
13:46:45.179 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.model.JavacTypes.validateTypeNotIn(JavacTypes.java:291)
13:46:45.179 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.model.JavacTypes.isAssignable(JavacTypes.java:102)
13:46:45.179 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
13:46:45.179 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
13:46:45.179 [ERROR] [org.gradle.BuildExceptionReporter]    at icepick.processor$assignable_QMARK_.invoke(processor.clj:38)
13:46:45.179 [ERROR] [org.gradle.BuildExceptionReporter]    at icepick.processor$parcelable_QMARK_.invoke(processor.clj:220)
13:46:45.179 [ERROR] [org.gradle.BuildExceptionReporter]    at icepick.processor$bundle_method.invoke(processor.clj:239)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at icepick.processor$analyze_field.invoke(processor.clj:259)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.core$map$fn__4553.invoke(core.clj:2624)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.lang.LazySeq.sval(LazySeq.java:40)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.lang.LazySeq.seq(LazySeq.java:49)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.lang.RT.seq(RT.java:507)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.core$seq__4128.invoke(core.clj:137)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.core.protocols$seq_reduce.invoke(protocols.clj:30)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.core.protocols$fn__6506.invoke(protocols.clj:101)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.core.protocols$fn__6452$G__6447__6465.invoke(protocols.clj:13)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.core$reduce.invoke(core.clj:6519)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.core$group_by.invoke(core.clj:6861)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at icepick.processor$process.invoke(processor.clj:275)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at clojure.lang.Var.invoke(Var.java:388)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at icepick.processor.IcepickProcessor.process(IcepickProcessor.java:42)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at org.jetbrains.kotlin.annotation.AnnotationProcessorWrapper.process(AnnotationProcessorWrapper.kt:115)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
13:46:45.180 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
13:46:45.181 [ERROR] [org.gradle.BuildExceptionReporter]    at com.sun.tools.javac.main.Main.compile(Main.java:523)
13:46:45.181 [ERROR] [org.gradle.BuildExceptionReporter]    ... 91 more

not really sure tough if it's the kotlin processor or icepick.

@tinsukE

This comment has been minimized.

Show comment
Hide comment
@tinsukE

tinsukE Aug 19, 2016

If you're not a fan of exposing your variables and using @JvmField, I've started a simple lib that should work as Icepick: https://github.com/tinsukE/icekick
Contributions are welcome!

tinsukE commented Aug 19, 2016

If you're not a fan of exposing your variables and using @JvmField, I've started a simple lib that should work as Icepick: https://github.com/tinsukE/icekick
Contributions are welcome!

@adrielcafe

This comment has been minimized.

Show comment
Hide comment
@adrielcafe

adrielcafe Sep 12, 2016

@tinsukE your lib works great! Thanks man!

adrielcafe commented Sep 12, 2016

@tinsukE your lib works great! Thanks man!

@vRallev

This comment has been minimized.

Show comment
Hide comment
@vRallev

vRallev Jan 26, 2017

And here's another alternative. Same API like Icepick, but works well with properties: https://github.com/evernote/android-state

vRallev commented Jan 26, 2017

And here's another alternative. Same API like Icepick, but works well with properties: https://github.com/evernote/android-state

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment