Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upCleanup of warnings / possible not checked nullpointers #1610
Conversation
|
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign the CLA at https://www.nativescript.org/cla. |
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
| if (!isKotlinClass) { | ||
| return new JavaClassDescriptor(javaClass); | ||
| } | ||
| return new JavaClassDescriptor(javaClass); |
NathanaelA
May 11, 2020
Member
I believe this is only supposed to occur on a Kotlin class; which is why it is wrapped in the if statement.
I believe this is only supposed to occur on a Kotlin class; which is why it is wrapped in the if statement.
vmutafov
May 11, 2020
Contributor
The if statement seems unnecessary as we return some lines above in the case of Kotlin originating bytecode and the only case we will reach this point is when we're dealing with Java originating bytecode
The if statement seems unnecessary as we return some lines above in the case of Kotlin originating bytecode and the only case we will reach this point is when we're dealing with Java originating bytecode
saschaarthur
May 11, 2020
•
Author
Contributor
The IDE complained that the if statement is always false.
Which is correct, its never set to true and then reached.
The IDE complained that the if statement is always false.
Which is correct, its never set to true and then reached.
NathanaelA
May 11, 2020
Member
You are correct, I totally missed the "return on line 87/82" Duh. :D
You are correct, I totally missed the "return on line 87/82" Duh. :D
| @@ -61,7 +62,7 @@ private static void writeInt(int value, StreamWriter out) throws Exception { | |||
| private static void writeMethodInfo(MethodInfo mi, | |||
| HashMap<String, Integer> uniqueStrings, StreamWriter outValueStream) | |||
| throws Exception { | |||
| int pos = uniqueStrings.get(mi.name).intValue(); | |||
NathanaelA
May 11, 2020
Member
These are supposed to be the UNBOXED values. By default .get() returns a Java Integer class; and we want to make sure that we are using the unboxed value later in the app. Please revert that code.
These are supposed to be the UNBOXED values. By default .get() returns a Java Integer class; and we want to make sure that we are using the unboxed value later in the app. Please revert that code.
vmutafov
May 11, 2020
Contributor
It should be autounboxed by the JVM, and this is also a build time step. I believe this change is ok.
It should be autounboxed by the JVM, and this is also a build time step. I believe this change is ok.
| if (!isKotlinClass) { | ||
| return new JavaClassDescriptor(javaClass); | ||
| } | ||
| return new JavaClassDescriptor(javaClass); |
vmutafov
May 11, 2020
Contributor
The if statement seems unnecessary as we return some lines above in the case of Kotlin originating bytecode and the only case we will reach this point is when we're dealing with Java originating bytecode
The if statement seems unnecessary as we return some lines above in the case of Kotlin originating bytecode and the only case we will reach this point is when we're dealing with Java originating bytecode
| @@ -61,7 +62,7 @@ private static void writeInt(int value, StreamWriter out) throws Exception { | |||
| private static void writeMethodInfo(MethodInfo mi, | |||
| HashMap<String, Integer> uniqueStrings, StreamWriter outValueStream) | |||
| throws Exception { | |||
| int pos = uniqueStrings.get(mi.name).intValue(); | |||
vmutafov
May 11, 2020
Contributor
It should be autounboxed by the JVM, and this is also a build time step. I believe this change is ok.
It should be autounboxed by the JVM, and this is also a build time step. I believe this change is ok.
ff0c7ec
to
c2c7932
|
readded .intValue() unboxing, to be very clear that we want to have here int not Integer |
|
@saschaarthur there is no difference in this case. If the |
* chore:Update CHANGELOG for v6.5.0 * Make buildMetadata aware of whitelist/blacklist files (#1590) * - warning cleanups (#1610) * Bump to 6.5.1 * Update CHANGELOG.md for 6.5.1 * Hardcode first emulator * Use wait-for-device Co-authored-by: Martin Bektchiev <martin.bektchiev@progress.com> Co-authored-by: saschaarthur <sascha.arthur@gmail.com>
Description
Exception handling / code cleanup
Does your commit message include the wording below to reference a specific issue in this repo?
There was plenty of warnings by my IDE (IntelliJ).
Most of the stuff was because of failing null pointer checks and unreachable/unused code / as well not needed function calls.
Logic is 100% the same.
Does your pull request have unit tests?
Everything fixed here should be covered by already existing unit tests