Comments (18)
Is the boolean[] field itself null or does it contain nulls?
from parceler.
It's not even a boolean[] field... the def is:
Boolean isFeatured;
from parceler.
Oh, I see... will fix tonight.
from parceler.
Now that I think about it.. I bet this is a problem for all Object version of primitives (Integer, Float, etc). We should probably have a null check for all of them.
from parceler.
Yeah.. I think I'm going to hit this problem quite a bit in these classes... lots of primitive wrappers..
from parceler.
this should do the trick: 73d8d68 Deployed under 0.2.8-SNAPSHOT. Let me know if it works for you.
from parceler.
Awesome! Thanks! I'll try it shortly
from parceler.
I think this fixed my problem... but is this generated code for an Integer correct?
int int$$3 = parcel$$0 .readInt();
java.lang.Long long$$0;
if (int$$3 < 0) {
long$$0 = null;
} else {
long$$0 = parcel$$0 .readLong();
}
listingEntity$$0 .listingId = long$$0;
That looks like I can't have negative values in an Integer field?
from parceler.
er.. sorry, Long
from parceler.
There are two variables in play here. The int
value is there as a flag to determine if the Long
is null or not.
int int$$3 = parcel$$0 .readInt(); //null flag
java.lang.Long long$$0; // eventual value
if (int$$3 < 0) { // <- is the value null?
long$$0 = null;
} else { // nope...
long$$0 = parcel$$0 .readLong();
}
listingEntity$$0 .listingId = long$$0;
from parceler.
Ahhh, duh, got it... thanks. Seems like everything is working great then!
from parceler.
I was thinking about defining a null constant so that this code is more readable:
int int$$3 = parcel$$0 .readInt();
java.lang.Long long$$0;
if (int$$3 == IS_NULL) {
long$$0 = null;
} else {
long$$0 = parcel$$0 .readLong();
}
listingEntity$$0 .listingId = long$$0;
I use this technique all over the place, especially in collections and arrays where -1 represents null, 0 represents empty and > 0 represents the size of the collection:
int int$$18 = parcel$$12 .readInt();
java.util.ArrayList<org.parceler.SubParcel> list$$4;
if (int$$18 < 0) {
list$$4 = null;
} else {
list$$4 = new java.util.ArrayList<org.parceler.SubParcel>();
for (int int$$19 = 0; (int$$19 <int$$18); int$$19 ++) {
list$$4 .add(...);
}
}
converterTarget$$0 .parcelList = list$$4;
from parceler.
That certainly would have prevented my stupid question :)
from parceler.
Still hitting this issue in public void writeToParcel(android.os.Parcel parcel$$1, int flags)
:
parcel$$1 .writeBooleanArray(new boolean[] {listingEntity$$0 .isFeatured });
where isFeatured
is a null Boolean
from parceler.
Robolectic's lack of Parcelable support is biting me... Looks like I missed
Boolean and Character. Will fix shortly.
On Mar 4, 2014 4:53 PM, "dbachelder" [email protected] wrote:
Still hitting this issue in public void writeToParcel(android.os.Parcel
parcel$$1, int flags):parcel$$1 .writeBooleanArray(new boolean[] {listingEntity$$0 .isFeatured
});where isFeatured is a null Boolean
Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-36694495
.
from parceler.
try again with 0.2.8-SNAPSHOT
from parceler.
looks good, thanks
from parceler.
Finally... thanks for sticking with it.
from parceler.
Related Issues (20)
- Ability to treat reflection warnings as errors HOT 5
- Parceler fails when used with with Lifecycle-viewmodel 2.2.0 HOT 7
- Facing Vulnerabilities in parceler library HOT 1
- Facing Vulnerabilities in parceler library HOT 1
- Polymorphism documentation not updated? HOT 6
- Cannot get working with navigation graph HOT 1
- Crashing on background HOT 4
- ParcelAnnotationProcessor.process take lot amount of time. HOT 15
- Unable to find generated Parcelable class HOT 1
- error: Parceler: Code generation did not complete successfully. HOT 47
- Cant find class to parcel ! HOT 1
- Can't generate code HOT 3
- Unable to Marshall with Parceler HOT 2
- Errors in HashMap$$PackageHelper HOT 3
- cannot running with kapt HOT 1
- Parceler: Code generation did not complete successfully. org.parceler.transfuse.transaction.TransactionRuntimeException: Encountered ErrorType <error>, unable to recover HOT 4
- [Request Feature] Support for Kotlin Symbol Processing
- Parceler code generation fails on AS 2023.3.1
- Getters and Setter Alphabetically Order for Write and Read
- Not sure how to convert a Cursor
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parceler.