这行代码:
def exists = (existingIndRecs.find{ existant -> existant.uniqueId == incomingRecord.uniqueId}????? ? true : false)
Run Code Online (Sandbox Code Playgroud)
在编译时导致此错误:
/FileImportService.groovy: 184: expecting ')', found '?????' @ line 184, column 100.
Id == incomingRecord.uniqueId}????? ? tr
^
Run Code Online (Sandbox Code Playgroud)
1错误
如果我评论这一行,文件中的其余776行代码编译就好了.我在Groovy Web控制台中尝试了这一行,没有问题.奇怪.
您的源代码中必须包含一些特殊字符.当我调出groovyConsole并输入以下内容时:
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)
Run Code Online (Sandbox Code Playgroud)
有用.当我用你的最后一行替换(视觉上相同)时,它失败了
expecting ')', found '?????' at line: 7, column: 94
Run Code Online (Sandbox Code Playgroud)
我做了一个hexdump差异,看到以下内容:
$ 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
Run Code Online (Sandbox Code Playgroud)
谷歌表示e2 80 8b是"零宽度空间",不管这意味着什么.