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
Ignore only the valueOf methods used for boxing. #32
Conversation
Current coverage is 79.09% (diff: 57.14%)@@ master #32 diff @@
==========================================
Files 1 1
Lines 216 220 +4
Methods 0 0
Messages 0 0
Branches 77 79 +2
==========================================
Hits 174 174
Misses 14 14
- Partials 28 32 +4
|
b435b95
to
44c883e
Compare
@jhalterman, I feel that I should have written a more detailed explanation of the current changes. method: public static Integer valueOf(java.lang.String)
declared in class: class java.lang.Integer
constructor: public Object()
declared in class: class java.lang.Object And the return value is: method: public static Integer valueOf(java.lang.String)
declared in class: class java.lang.Integer But, with retrolambda and with IntelliJ Idea coverage, the constructor (added by retrolambda): private LambdaTest$$Lambda$23() []
declared in class: class net.jodah.typetools.functional.LambdaTest$$Lambda$23
method: public static Integer valueOf(java.lang.String)
declared in class: class java.lang.Integer
constructor: public Object()
declared in class: class java.lang.Object
method added by coverage tool: public static Object loadClassData(java.lang.String)
declared in class: class com.intellij.rt.coverage.data.ProjectData Without the fix return value is: method: public static Object loadClassData(java.lang.String)
declared in class: class com.intellij.rt.coverage.data.ProjectData With the fix return value is: method: public static Integer valueOf(java.lang.String)
declared in class: class java.lang.Integer In the first case (without retrolambda), IntelliJ's coverage tool does not instrument the runtime generated lambda class, but in the second case, the class is not runtime generated anymore, it is generated by retrolambda in the compilation step, and even if it is marked as a synthetic class, it is still instrumented by IntelliJ's coverage tool. With this change the type detection is more stable for lambdas and I couldn't think yet to some other failing scenario. Cheers |
@csoroiu AFAIK Oracle/Open JDK 9 should still have |
@csoroiu This stuff looks good - thanks! Is there anything else still TODO regarding retrolambda support that should be looked at before the next release? Possibly related would be ProGuard, though I haven't looked at that at all yet... |
@jhalterman regarding the I haven't worked with ProGuard yet. I'm not an Android guy, but the issue #3 relates to Android. The least thing we should do is to create a simple android project and run the typetools unit tests on that platform with and without ProGuard. I could try to do this, but it may take a while as I'm not an Android developer. |
@csoroiu I'm not an Android developer either. I expect none of the lambda/method-ref capabilities to work since Android is still on 1.6 AFAIK. So, no need to worry about that stuff. |
With this commit all tests are passing when retrolambda is used in combination with IntelliJ & jacoco code coverage.
Without this commit the test
LambdaTest.shouldResolveSubclassArgumentsForMethodRefs
was failing when ran with code coverage after retrolambda was used.Basically, we need to check if the valueOf method matches the signature of methods used for boxing operations such as
Integer.valueof(int)
,Boolean.valueOf(boolean)
etc.Integer
class contains 3valueOf
methods out of which onlyInteger.valueof(int)
is used for boxing.Thanks