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

IndexOutOfBoundsException during kapt (not sure which step) #1628

Closed
CapnSpellcheck opened this issue Nov 8, 2018 · 6 comments
Closed

IndexOutOfBoundsException during kapt (not sure which step) #1628

CapnSpellcheck opened this issue Nov 8, 2018 · 6 comments
Assignees
Labels
Milestone

Comments

@CapnSpellcheck
Copy link

CapnSpellcheck commented Nov 8, 2018

ISSUE_TEMPLATE

DBFlow Version: 4.2.4

Bug or Feature Request: Bug

Description: Updating DBflow dependency from 4.0.0 to current release as part of updateing Android targetSdk to 26. Kotlin is 1.2.61. After deleting build folder and starting a build I get this error during kapt.

Looking in disk folder generated/source/kapt/debug I see, compared to the last successful release, several table Java files are missing in debug. So it didn't finish. I looked at the first file alphabetically missing, the looked at the kt file for the @table, and uncommented out the @table declaration, so it should not longer be kapt processed for the table, but same error happened.

e: [kapt] An exception occurred: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at com.raizlabs.android.dbflow.processor.definition.column.ReferenceColumnDefinition.appendPropertyComparisonAccessStatement(ReferenceColumnDefinition.kt:351)
	at com.raizlabs.android.dbflow.processor.definition.PrimaryConditionMethod$methodSpec$1.invoke(Methods.kt:583)
	at com.raizlabs.android.dbflow.processor.definition.PrimaryConditionMethod$methodSpec$1.invoke(Methods.kt:573)
	at com.raizlabs.android.dbflow.processor.utils.JavaPoetExtensionsKt.override fun(JavaPoetExtensions.kt:25)
	at com.raizlabs.android.dbflow.processor.definition.PrimaryConditionMethod.getMethodSpec(Methods.kt:576)
	at com.raizlabs.android.dbflow.processor.definition.TableDefinition.onWriteDefinition(TableDefinition.kt:637)
	at com.raizlabs.android.dbflow.processor.definition.BaseDefinition.getTypeSpec(BaseDefinition.kt:150)
	at com.raizlabs.android.dbflow.processor.utils.WriterUtils$writeBaseDefinition$1.invoke(WriterUtils.kt:16)
	at com.raizlabs.android.dbflow.processor.utils.WriterUtils$writeBaseDefinition$1.invoke(WriterUtils.kt:11)
	at com.grosner.kpoet.JavaFileExtensionsKt.javaFile(JavaFileExtensions.kt:9)
	at com.grosner.kpoet.JavaFileExtensionsKt.javaFile$default(JavaFileExtensions.kt:8)
	at com.raizlabs.android.dbflow.processor.utils.WriterUtils.writeBaseDefinition(WriterUtils.kt:16)
	at com.raizlabs.android.dbflow.processor.ProcessorManager.handle(ProcessorManager.kt:309)
	at com.raizlabs.android.dbflow.processor.DBFlowProcessor.process(DBFlowProcessor.kt:67)
	at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:99)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1039)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1180)
	at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
	at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1068)
	at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:55)
	at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing$default(annotationProcessing.kt:27)
	at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.runAnnotationProcessing(Kapt3Extension.kt:210)
	at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.analysisCompleted(Kapt3Extension.kt:175)
	at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.analysisCompleted(Kapt3Extension.kt:93)
	at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:98)
	at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:108)
	at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:85)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:370)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:61)
	at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:101)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:361)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:126)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:154)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:51)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:94)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:50)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:88)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$1$2.invoke(CompileServiceImpl.kt:408)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$1$2.invoke(CompileServiceImpl.kt:101)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:929)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:101)
	at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:969)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:928)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:407)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:346)
	at sun.rmi.transport.Transport$1.run(Transport.java:200)
	at sun.rmi.transport.Transport$1.run(Transport.java:197)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
@CapnSpellcheck
Copy link
Author

CapnSpellcheck commented Nov 8, 2018

Just a note I have determined which table model it is during, it is this annotated declaration:

@PrimaryKey @NotNull @Index(indexGroups = intArrayOf(1))
     @ForeignKey(stubbedRelationship = true,
                 tableClass = ProspectQuiz::class,
                 onDelete = ForeignKeyAction.CASCADE)
     var quizID: String?

@agrosner
Copy link
Owner

can you paste your fulll model here to see what the issue is ( thank you for the call stack) so I can try to repo the problem and see if its an issue on 5.0.0-alpha1 and how to rectify this.

@agrosner
Copy link
Owner

I found the piece of code:

codeBuilder.addCode(references!![0].columnName, getDefaultValueBlock(), 0, modelBlock)

it seems as though the references could not be found and it thinks that the column is not a model column. quick Q, is ProspectQuiz a table?

@agrosner
Copy link
Owner

my mistake. it is a primitive column. looks like something else might be up.

@CapnSpellcheck
Copy link
Author

Attached that model source, the generated code as of the older dbflow version, and the source of the foreign key model
Files.zip

agrosner added a commit that referenced this issue Feb 21, 2021
@agrosner agrosner self-assigned this Feb 21, 2021
@agrosner agrosner added the bug label Feb 21, 2021
@agrosner agrosner added this to the 5.0.0-alpha2 milestone Feb 21, 2021
@agrosner
Copy link
Owner

in develop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants