E0006: Java static access syntax not valid in C++

Compiler Error

What it means

Writing ClassName.member() or ClassName.CONSTANT the way you would in Java doesn't work in C++ for static access. The dot operator in C++ means instance member access, not static. CppMode detects this pattern for common wrapper classes and any uppercase-named class it can identify as static-only.

How to fix it

Use :: instead of . when accessing static methods or fields on a class name.

Example

Before
int n = Integer.parseInt("42"); float f = Float.parseFloat("3.14"); float pi = Math.PI;
After
int n = Integer::parseInt("42"); float f = Float::parseFloat("3.14"); float pi = Math::PI;

Notes

This covers both method calls and field access. The check applies to known static-only classes: Integer, Float, Double, Long, Boolean, Character, Byte, Short, Math, Arrays, Collections, System, Thread, Runtime, Class, and Objects. It skips known instance types like PImage, PFont, PVector, PShape, and PGraphics even though they start with an uppercase letter. For your own classes, use :: for anything declared static and . only on an actual instance. Related: E0004, E0005.