-
Notifications
You must be signed in to change notification settings - Fork 3
Annotation OpMode Loading
FIRST has implemented the opcode annotation system in the main GitHub branch. We are proud to have helped inspire this introduction. We now use FIRST's built-in annotation system to register OpModes.
We used the ClassIndex framework to process and catalog all classes in the project that are annotated with our custom @OpMode
annotation. The OpMode
is named by providing a String
object for the value of the annotation. Our modified FtcOpModeRegister
class iterates over the entire list of classes annotated with @OpMode
and registers those that extend OpMode
.
This modification makes it easier and faster for programmers to create new OpMode
s, and removes the need to have FtcOpModeRegister
open for modification constantly. We also modified the Gradle compilation script to include the index file in the build, so each class is only indexed once per build. This speeds up the loading times for the app.