google / google/closure-compiler

GCC does not recognize 0b00 as zero

Open
#3,458 1 comment 0 reactions 0 assignees View on GitHub
internal-issue-created triage-done
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

GCC is not recognizing 0b00 as the number 0. This is a snippet from running GCC closure-compiler-v20190819.jar

[java] core_mp.js:210: ERROR - Parse error. missing ) after argument list
[java] this.map.putIfAbsent$TK$TV(t, new Integer(0b00));
[java] ^
[java] 1 error(s), 0 warning(s)
[java] Java Result: 1

see http://www.ecma-international.org/ecma-262/6.0/#sec-literals-numeric-literals

This bug was found by a developer in the process of compressing full package files for java2script/SwingJS. https://github.com/BobHanson/java2script. I have reconfigured the java2script transpiler to not output 0b00 format literals. So it is not a priority to me. But still I suggest it get fixed/upgraded, as it is becoming a standard notation in JavaScript.

This was a unique usage case, by the way, in java.util.stream.StreamOpFlags.java.

https://github.com/JetBrains/jdk8u_jdk/blob/master/src/share/classes/java/util/stream/StreamOpFlag.java

Apparently the only place in JDK8 where 0b syntax is used!

Bob Hanson hansonr@stolaf.edu
principal developer of java2script/SwingJS

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.