Skip to content
AlexanderR edited this page May 3, 2016 · 19 revisions

Processor options

To modify the behavior of aidl2 annotation processor you can pass following options to it:

  • aidl2_log_to_files enables logging to log file. If you specify a filename, that location will be used, otherwise expect a processor.log to be created inside directory with generated source files
  • aidl2_dontwarn suppresses all aidl2-specific warnings/errors (about passing Object as parameter etc.) Standard Javac wanrnings/errors and errors, caused by incorrect interface definition, won't be affected.

Limitations/Known Issues

  • Checked exceptions are pretty much not supported.

  • JDK 6 may work, but isn't supported, since it is no longer supported by it's creator and developers of Javapoet.

  • Due to permissive nature of AIDL2 interfaces it may be possible to (accidentally) serialize an inner/anonymous class or lambda. All usual caveats of serializing such classes will apply. This applies only to subtypes of Serializable/Externalizable.

  • Some of generated files may contain redundant casts due to limitations of Java compilers or way AIDL2 handles certain types. You are highly unlikely to see those unless you use complex generic types.

  • Passing invalid expressions as annotation parameters may not be correctly detected during validation step and results in runtime exception during compilation with Javac.

    Example:

    // will fail to compile with ugly message, asking you to send a bug report :(
    @AIDL(SomeNonExistingType.DESCRIPTOR)

    This is due to limitations of Javac, which converts erroneous "types" to strings before passing them to AnnotationValueVisitor. This also happens with other annotation processors, such as ButterKnife.

  • Generated implementations of interfaces, containing intersection types, may fail to compile with source versions before Java 8.

    // this will fail to compile with JDK 7
    <T extends Parcelable & Runnable> void methodWithIntersectionArgument(T param);

    This is because implementing those requires support for either advanced type inference or casts to intersection, both of which didn't exist until Java 8.

  • Nonsential intersection types like Boolean & Runnable aren't detected. I believe, that handling those should be responsibility of compiler.

Clone this wiki locally