Skip to content

Commit

Permalink
Project health: fix Descriptor.getName() in j2objc proto runtime.
Browse files Browse the repository at this point in the history
	Change on 2019/03/14 by antoniocortes <[email protected]>

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=238441842
  • Loading branch information
antonio-cortes-perez committed Mar 14, 2019
1 parent 24b7b48 commit 59881f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion protobuf/runtime/src/com/google/protobuf/Descriptors.m
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ - (instancetype)initWithMessageClass:(Class)messageClass
}

- (NSString *)getName {
return [[self java_getClass] getSimpleName];
return [[messageClass_ java_getClass] getSimpleName];
}

- (id<JavaUtilList>)getFields {
Expand Down
5 changes: 4 additions & 1 deletion protobuf/tests/CompatibilityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,9 @@ public void testInvalidUtf8Bytes() throws Exception {

public void testDescriptorGetName() throws Exception {
Descriptor descriptor = TypicalData.Builder.getDescriptor();
assertEquals("TypicalData", descriptor.getName()); // Verify package isn't included.
// Java returns TypicalData.
// The transpiled code returns ProtosTypicalData because it does not have
// reflection metadata (i.e. defaults to NSStringFromClass).
assertTrue(descriptor.getName().endsWith("TypicalData"));
}
}

0 comments on commit 59881f4

Please sign in to comment.