Code incorrectly highlighted as errors
Hi Scott, I have two instance in a class where code is being highlighted as errors, and I don't believe they should be. One is the use of the word 'Format' in a SOQL query on the Report object, the other is declaring a variable as Transient in a method. Both of these are running fine in our live org and are not picked up as problems in the Salesforce IDE.
The highlighted errors beneath Transient disappear if each transient line is removed.
Comments (9)
-
repo owner -
repo owner - changed version to 1.7.3.8
-
repo owner Steve, regarding the first error shown where the
transient
modifier keyword is highlighted, that looks correct to me. Correct me if I'm wrong, but local variables shouldn't be declaredtransient
, only member variables to omit them from Visualforce view state/JSON/XML serialization:Again, it's possible there's a use of this modifier in Apex that I'm not familiar with, but I'm surprised that would even compile. Please let me know if that's actually controlling something.
I'll take a look at the other two and see what's going on. The
Format
one is just another instance of allowing a reserved keyword to be used as an identifier. I'm not 100% sure what's going on at the bottom of that method with so many things being marked as invalid, though. I'll see what I can find. -
repo owner Steve, can you see if removing the
transient
keyword from local variables in that code removes all of the subsequent errors. I'm not able to reproduce exactly what you're seeing, but basically it seems like that keyword is preventing the parser from recovering properly. I'll work on that, and of course iftransient
should be supported as a local variable modifier, I'll go that route, but I'd like to understand what role it's playing in the subsequent errors in that method body before trying to reproduce something that's potentially a side-effect. -
repo owner Yeah, looks like this has come up before, and looks like it's likely an allowance of Salesforce's Apex parser that doesn't actually do anything:
Let me chew on whether I want IC's parser to have that same allowance or not.
-
repo owner Okay, I decided to add an allowance for
transient
on local variables. You won't get a parse error, but I'm pretty sure it doesn't do anything either. When I add local code inspections, I may include one that flags that as a warning.I've also fixed the
Format
issue. These will all be included in the next build. -
repo owner - changed status to resolved
Delivered with 1.7.3.8. Please let me know if the fix for
transient
doesn't also fix the other errors in that same method. -
reporter Hi Scott,
That's all looking fine now. All of the errors below the
transient
variables are gone, andformat
is showing correctly.You're absolutely right about my over zealous application of
transient
as well! -
repo owner Glad it resolved the issues, Steve! Thanks for letting me know.
- Log in to comment
Steve, thanks for the report. These are almost certainly minor parser issues. I'll take a look shortly.