1

This line of code:

def exists = (existingIndRecs.find{ existant -> existant.uniqueId == incomingRecord.uniqueId}​​​​​ ? true : false)

is causing this error upon compilation:

/FileImportService.groovy: 184: expecting ')', found '​​​​​' @ line 184, column 100.
Id == incomingRecord.uniqueId}​​​​​ ? tr
                             ^

1 error

If I comment this line out the rest of the 776 lines of code in the file compile just fine. I tried this line in the Groovy web console and no problems there. Strange.

4
  • Try updating your deps Jul 13, 2014 at 22:56
  • I did a refresh dependencies and then 'grails compile', same error. Jul 13, 2014 at 22:58
  • 2
    You have these special characters ​​​​​ after } instead of white spaces. Answer speaks about the same. Clear everything after } and rewrite.
    – dmahapatro
    Jul 14, 2014 at 1:58
  • @dmahapatro Yes, I must have had something funny yet invisible. I erased entire line and retyped by hand and it compiled fine. Thanks. Jul 14, 2014 at 12:03

1 Answer 1

5

You must be having some special characters in your source code. When I bring up groovyConsole and type this:

class Record {
  int uniqueId;
  Record(int uniqueId) { this.uniqueId = uniqueId; }
}
def existingIndRecs = [new Record(1), new Record(2)]
def incomingRecord = new Record(1)
def exists = (existingIndRecs.find{ existant -> existant.uniqueId == incomingRecord.uniqueId} ? true : false)

it works. When I replace the last line with yours (visually identical), it fails with

expecting ')', found '​​​​​' at line: 7, column: 94

I did a hexdump diff and see the following:

$ diff -u 1.hex 2.hex
--- 1.hex   2014-07-13 19:32:02.343929086 -0400
+++ 2.hex   2014-07-13 19:32:05.419928970 -0400
@@ -3,7 +3,6 @@
 00000020  6e 64 7b 20 65 78 69 73  74 61 6e 74 20 2d 3e 20  |nd{ existant -> |
 00000030  65 78 69 73 74 61 6e 74  2e 75 6e 69 71 75 65 49  |existant.uniqueI|
 00000040  64 20 3d 3d 20 69 6e 63  6f 6d 69 6e 67 52 65 63  |d == incomingRec|
-00000050  6f 72 64 2e 75 6e 69 71  75 65 49 64 7d e2 80 8b  |ord.uniqueId}...|
-00000060  e2 80 8b e2 80 8b e2 80  8b e2 80 8b 20 3f 20 74  |............ ? t|
-00000070  72 75 65 20 3a 20 66 61  6c 73 65 29 0a           |rue : false).|
-0000007d
+00000050  6f 72 64 2e 75 6e 69 71  75 65 49 64 7d 20 3f 20  |ord.uniqueId} ? |
+00000060  74 72 75 65 20 3a 20 66  61 6c 73 65 29 0a        |true : false).|
+0000006e

Google says e2 80 8b is "zero-width space", whatever this means.

1
  • Wow I didn't even know this was possible. Invisible character. I mean I knew it was possible but didn't think that could have been it. Thanks. Jul 14, 2014 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.