Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Thrift Java: Cannot use reserved language keyword: "alias"

I'm trying to compile thrift code using Ant and seeing the following error:

generate-thrift-chained:
[apply] [ERROR:<path_to_thrift_file>/<thrift_file>.thrift:361] (last token was 'alias')
[apply] Cannot use reserved language keyword: "alias"

If it matters, I'm on Mac OS X version 10.15.4, Thrift 0.9.3, Ant 1.10.7. While I understand that using reserved keywords legitimately leads to such problems, this project passes compilation on a different environment, Linux Mint 17.3, with the same Thrift version.

Is there anything I'm missing?

like image 892
superM Avatar asked May 10 '26 10:05

superM


1 Answers

As per reference from Manning|Programmer’s Guide to Apache Thrift

Reserved words

The following lexically sorted list of symbols aren’t part of Thrift IDL syntax but may not be used in Thrift IDL for various reasons, many of which are related to output language conflicts.

BEGIN, END, __CLASS__, __DIR__, __FILE__, __FUNCTION__, __LINE__, __METHOD__, __NAMESPACE__, abstract, alias, and, args, as, assert, begin, break, case, catch, class, clone, continue, declare, def, default, del, delete, do, dynamic, elif, else, elseif, elsif, end, enddeclare, endfor, endforeach, endif, endswitch, endwhile, ensure, except, exec, finally, float, for, foreach, from, function, global, goto, if, implements, import, in, inline, instanceof, interface, is, lambda, module, native, new, next, nil, not, or, package, pass, print, private, protected, public, raise, redo, rescue, retry, register, return, self, sizeof, static, super, switch, synchronized, then, this, throw, transient, try, undef, unless, unsigned, until, use, var, virtual, volatile, when, while, with, xor, yield

alias is also in the list

like image 180
Mohit Avatar answered May 12 '26 00:05

Mohit