Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 182 by
daniel....@gmail.com: Switch case in protected scope
http://code.google.com/p/j2objc/issues/detail?id=182
The translation of this method in Java:
private static int testMethod(int value) {
switch (value) {
case 1:
String test = "test";
return 2;
default:
return 4;
}
}
}
Produces this output:
+ (int)testMethodWithInt:(int)value {
switch (value) {
NSString *test;
case 1:
test = @"test";
return 2;
default:
return 4;
}
}
XCode complains (error) for both cases "1" and "default" - "Switch case is
in protected scope".
This happens when you define a String inside a case, it's not a problem
with an int (I am not experienced enough in Objective-C to answer why is
this a problem at all).
The fix is to move the declaration of test variable above the switch
statement.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings