-
Notifications
You must be signed in to change notification settings - Fork 93
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
retrolambda support & cleaner type detection for lambda's #28
Conversation
Current coverage is 80.28% (diff: 76.66%)@@ master #28 diff @@
==========================================
Files 2 1 -1
Lines 293 213 -80
Methods 0 0
Messages 0 0
Branches 89 73 -16
==========================================
- Hits 229 171 -58
+ Misses 31 14 -17
+ Partials 33 28 -5
|
Re-opening. Apparently there was an issue when I used retro lambda and jacoco in the same project, but is issue has nothing to do with this change. Thanks |
7174ea9
to
b7a7fa6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this change a lot. A few comments though - have a look at those.
@@ -250,7 +239,7 @@ public static Type resolveGenericType(Class<?> type, Type subType) { | |||
Map<TypeVariable<?>, Type> map = ref != null ? ref.get() : null; | |||
|
|||
if (map == null) { | |||
map = new HashMap<TypeVariable<?>, Type>(); | |||
map = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeTools compilation is currently targeted at 1.7, so I don't think we can use the diamond operator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized that later and the next commit b7a7fa6 fixes the diamond issue.
@@ -282,7 +271,7 @@ public static Type resolveGenericType(Class<?> type, Type subType) { | |||
} | |||
|
|||
if (CACHE_ENABLED) | |||
typeVariableCache.put(targetType, new WeakReference<Map<TypeVariable<?>, Type>>(map)); | |||
typeVariableCache.put(targetType, new WeakReference<>(map)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here regarding the diamond operator.
@@ -296,7 +285,7 @@ private static void populateLambdaArgs(Class<?> functionalInterface, final Class | |||
if (GET_CONSTANT_POOL != null) { | |||
// Find SAM | |||
for (Method m : functionalInterface.getMethods()) { | |||
if (!m.isDefault() && !Modifier.isStatic(m.getModifiers()) && !m.isBridge()) { | |||
if (!isDefaultMethod(m) && !Modifier.isStatic(m.getModifiers()) && !m.isBridge()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this change was necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added that check because I removed the version check at the class initialization and it would fail with NoSuchMethodError when ran with java 6 or 7.
Looks good - thanks for this! |
0.4.8 is released, with this change. |
Thanks a lot. |
Added support for
retrolambda
library:instance
inside the generated classes). I will try to figure out how I can create a test that imitates this behavior.Also I did a refactor and made the code work without the
TypeDescriptor
class. Not sure how to test android compatibility, but I expect it to work.