Hello, I'm trying to use your PermissionsDispatcher on an app that I'm creating to be backwards compatible to Java 1.6
It looks like when the annotations create the matching generated source it is using the <> typing. Is there something I can do so that it uses the full "type name", vs just using the <> supported in java 1.7+
Example:
private static final class PickImagePermissionRequest implements PermissionRequest {
private final WeakReference<CropFragment> weakTarget;
private PickImagePermissionRequest(CropFragment target) {
this.weakTarget = new WeakReference<>(target);
}
for java 1.6 it should be:
private static final class PickImagePermissionRequest implements PermissionRequest {
private final WeakReference<CropFragment> weakTarget;
private PickImagePermissionRequest(CropFragment target) {
this.weakTarget = new WeakReference<CropFragment>(target);
}
Now, we should discuss we need to support Java 1.6 syntax. @hotchemi, @aurae
Well, basically we're not going to support 1.6 aggressively, but in this case the diff is so small so that it's okay to fix. Thoughts?
one thing i was concerned about is, is this the only issue that support java1.6...
In any case, there should be a consistent message for the library. For instance, while the README claims compatibility with Java 6, the library module's build.gradle sets both language level options to JavaVersion.VERSION_1_7.
I'm okay with going down to 1.6, although personally I feel like there's no compelling reason not to build with 1.7+ nowadays. We should scan the source for any diamond operators other than the one mentioned in this issue. There aren't any try-with-resources statements in the code, and that's about it for Java 7 features, unless I'm missing something here.
I don't have time to write any comment for now. just find <> and change to JavaVersion.VERSION_1_6.
commit it & sqaushed it
I will comment my thought tomorrow.
OK, my kids asked me to go, so I gonna comment my thought, now.
I totally agree with @hotchemi and @aurae . After changing to JavaVersion.VERSION_1_6, compiler gives me a hint for adding type parameters for diamond operators. So, I think if the code works with all 1.6, 1.7, and 1.8, then I like to support 1.6.
However, in future, it may raise problems since we tend to forget 1.6 support. If that happens a lot, then we need to drop the support of 1.6.
My PR just pass the test cases. But I really want someone tests it in real Android project with 1.6, 1.7 and 1.8 before releasing the next version.
In short, let's give it a shot!
I'm willing to test it for 1.6 in my project.
@ZacWolf Why do you need to use Java 1.6 for build? I think you have to update it somedays.
I don't "have to", just doing some backwards compatibility checking to support really old versions of android. I also use it as a way to test my own code for "strictness". It's not slowing me down, I upped to 1.7 and I'm moving along, but when I saw this I figured it would be a pretty quick fix? So not critical, just something to keep 1.6 support alive in the project.
@ZacWolf Umm, I don't understand why you're doing but we merged the PR so let me close.
Could you test this version? @ZacWolf using jitpack?
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencies {
compile 'com.github.hotchemi.permissionsdispatcher:permissionsdispatcher:b90696c249'
kapt 'com.github.hotchemi.permissionsdispatcher:permissionsdispatcher-processor:b90696c249'
}
Yup, my generated class compiles correctly, seems to be working. Thanks!