File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
main/java/com/google/devtools/j2objc/translate
test/java/com/google/devtools/j2objc/gen Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -272,6 +272,7 @@ public void endVisit(PropertyAnnotation node) {
272
272
MethodDeclaration method = (MethodDeclaration ) body ;
273
273
if (method .getParameters ().isEmpty ()
274
274
&& !method .isConstructor ()
275
+ && !TypeUtil .isVoid (method .getReturnTypeMirror ())
275
276
&& !ElementUtil .hasAnnotation (method .getExecutableElement (), Property .Suppress .class )) {
276
277
method .setIsPseudoProperty (true );
277
278
}
Original file line number Diff line number Diff line change @@ -887,6 +887,18 @@ public void testPropertiesOfGetTypesWithSettersNullable() throws IOException {
887
887
+ " NSString * fooField;" );
888
888
}
889
889
890
+ public void testPropertyAnnotationIgnoresVoidMethod () throws IOException {
891
+ String sourceContent =
892
+ " import com.google.j2objc.annotations.Property;"
893
+ + "@Property "
894
+ + "public class FooBar {"
895
+ + " public void doFoo() {}"
896
+ + " "
897
+ + "}" ;
898
+ String translation = translateSourceFile (sourceContent , "FooBar" , "FooBar.h" );
899
+ assertNotInTranslation (translation , "@property" );
900
+ }
901
+
890
902
public void testPropertiesOfClassTypes () throws IOException {
891
903
String sourceContent =
892
904
" import com.google.j2objc.annotations.Property;"
You can’t perform that action at this time.
0 commit comments