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
Add support for runtime analysis at Java 6 #66
Comments
I thought about this when porting the processor and while I don't mind moving stuff around I put it all in Java8, mostly to simplify number of dependencies and setting up the project. I don't think reflection part of dsl-json is all that useful, since it supports much less stuff than annotation processor (it doesn't do private reflection overrides and similar stuff which it could). So if we want to support Java6 we should probably move annotation processor to Java6 compatible project (even maybe core project). |
I know at least one issue with generated code. If POJO contains property with type 'List', the generated code tries find reader/writer for List type, but it fails in case CollectionAnalyzer not registered. |
Do we realy need move annotation processor to Java6? When developing project we can use Java8 compiler to compile java6 project. |
Or means that generated code should be Java6? |
I meant the gen-code should be Java6. But there are some deps which ought to be moved to dsl-json. |
Yes, currently android build tools can convert(aka 'desugar') java8 code (with labdas) to java6, but if Java8 classes used like ' java.lang.function.*' then app wiil crash at runtime. |
So what do we need to change except create our own signature instead of function? I'm keen on dropping that inline=false thing. It doesn't seem as useful anymore (and it's not really properly tested) |
It seems rest of code is compatible. |
Let's change the problematic signatures then |
There is problem, since 'dsl-json-java8' module registers service configuration 'ConfigureJava8' which uses java8 specific classes (Optional*, java.time.*), so we will get runtime exception. |
Indeed. I guess the best solution seems to move compile time deps to dsl-json and allow usage of java8 project as APT. |
I've refactored some stuff so Java8 configuration should not be loaded by default anymore. |
I've run AndroidJava6 example with new version, and there are two issues:
|
The first one seems easily fixable (will fix it now) Not sure what you mean by the second one. That tryFindWriter will return null? It was always like that. |
Your last fix is not fully compatible with Java6. Please look at how it done in my PR 3cacdd5#diff-837b9da4c6b09f28d602cf80cfa379de Just run AndroidJava6 example project on Android simulator with api16 and you will see problem. |
Ah, right. Can you finish it up on master? I won't have time until Monday |
Yes, I will provide PR |
This will allow use reflection data binding on platform which currently does not support Java8 (e.g. Android prior API 24).
I propose to move appropriate classes from 'dsl-json-java8' module to core module 'dsl-json' or we can create new one 'dsl-json-reflection'.
It seems relatively easy to do. We just need to replace usage of 'java.lang.function.*' with our custom interfaces. And keep ImmutableAnalyzer class in 'dsl-json-java8' module, since parameter names are not supported prior Java8.
The text was updated successfully, but these errors were encountered: