FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Moved autoreleasepool for JUnit 4 tests to include setup() and teardo… · 2Fgoogle/j2objc@06c22a6 · GitHub

forked from google/j2objc

Commit 06c22a6

Browse files
committed
Moved autoreleasepool for JUnit 4 tests to include setup() and teardown() calls, removed extra autorelease in new proxies.
Change on 2014/08/26 by tball <tball@google.com> ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=74153848
1 parent 5959e70 commit 06c22a6

3 files changed

Lines changed: 390 additions & 169 deletions

File tree

‎jre_emul/Classes/java/lang/reflect/Field.m‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,18 @@ - (short)getShortWithId:(id)object {
201201
}
202202

203203
- (void)setWithId:(id)object withId:(id)value {
204-
J2ObjcRawValue rawValue;
204+
// TODO(kstanger): correctly handle @Weak fields.
205205
IOSClass *fieldType = [self getType];
206+
BOOL needsRetain = ![fieldType isPrimitive];
207+
if (needsRetain) {
208+
AUTORELEASE([self getWithId:object]);
209+
}
210+
J2ObjcRawValue rawValue;
206211
[fieldType __unboxValue:value toRawValue:&rawValue];
207212
SetWithRawValue(&rawValue, self, object, fieldType);
213+
if (needsRetain) {
214+
RETAIN_(value);
215+
}
208216
}
209217

210218
- (void)setBooleanWithId:(id)object withBoolean:(BOOL)value {

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL