Note: Annotation processing is enabled because one or more processors were found on the class path. A future release of javac may disable annotation processing unless at least one processor is specified by name (-processor), or a search path is specified (--processor-path, --processor-module-path), or annotation processing is enabled explicitly (-proc:only, -proc:full). Use -Xlint:-options to suppress this message. Use -proc:none to disable annotation processing. /boxgenerated/templates/Bigint$cfm.java:79: error: integer number too large new Object[] { EqualsEquals.invoke(1111111111111111111, ^ /boxgenerated/templates/Bigint$cfm.java:80: error: integer number too large 2222222222222222222) }); ^ package boxgenerated.templates; // BoxLang Auto Imports import ortus.boxlang.runtime.BoxRuntime; import ortus.boxlang.runtime.components.Component; import ortus.boxlang.runtime.context.*; import ortus.boxlang.runtime.context.ClassBoxContext; import ortus.boxlang.runtime.context.FunctionBoxContext; import ortus.boxlang.runtime.dynamic.casters.*; import ortus.boxlang.runtime.dynamic.ExpressionInterpreter; import ortus.boxlang.runtime.dynamic.Referencer; import ortus.boxlang.runtime.interop.DynamicObject; import ortus.boxlang.runtime.interop.DynamicObject; import ortus.boxlang.runtime.loader.ClassLocator; import ortus.boxlang.runtime.loader.ImportDefinition; import ortus.boxlang.runtime.operators.*; import ortus.boxlang.runtime.runnables.BoxScript; import ortus.boxlang.runtime.runnables.BoxTemplate; import ortus.boxlang.runtime.runnables.IBoxRunnable; import ortus.boxlang.runtime.scopes.*; import ortus.boxlang.runtime.scopes.Key; import ortus.boxlang.runtime.types.*; import ortus.boxlang.runtime.types.util.*; import ortus.boxlang.runtime.types.exceptions.*; import ortus.boxlang.runtime.util.*; import ortus.boxlang.compiler.parser.BoxSourceType; import ortus.boxlang.compiler.ast.statement.BoxMethodDeclarationModifier; import ortus.boxlang.runtime.runnables.BoxClassSupport; // Java Imports import java.nio.file.Path; import java.nio.file.Paths; import java.time.LocalDateTime; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Optional; public class Bigint$cfm extends BoxTemplate { private static Bigint$cfm instance; private static final List<ImportDefinition> imports = List.of(); private static final ResolvedFilePath path = ResolvedFilePath.of("/", "/Users/johnwhish/projects/jericho/sandbox", "/bigint.cfm", "/Users/johnwhish/projects/jericho/sandbox/bigint.cfm"); private static final BoxSourceType sourceType = BoxSourceType.CFTEMPLATE; private static final long compileVersion = 1L; private static final LocalDateTime compiledOn = LocalDateTime.parse("2024-08-01T09:10:16"); private static final Object ast = null; public static final Key[] keys = new Key[] { Key.of("writeoutput") }; public Bigint$cfm() { } public static synchronized Bigint$cfm getInstance() { if (instance == null) { instance = new Bigint$cfm(); } return instance; } /** * Each template must implement the invoke() method which executes the template * * @param context The execution context requesting the execution */ public void _invoke(IBoxContext context) { ClassLocator classLocator = ClassLocator.getInstance(); context.invokeFunction(Bigint$cfm.keys[0], new Object[] { EqualsEquals.invoke(1111111111111111111, 2222222222222222222) }); } // ITemplateRunnable implementation methods /** * The version of the BoxLang runtime */ public long getRunnableCompileVersion() { return Bigint$cfm.compileVersion; } /** * The date the template was compiled */ public LocalDateTime getRunnableCompiledOn() { return Bigint$cfm.compiledOn; } /** * The AST (abstract syntax tree) of the runnable */ public Object getRunnableAST() { return Bigint$cfm.ast; } /** * The path to the template */ public ResolvedFilePath getRunnablePath() { return Bigint$cfm.path; } /** * The original source type */ public BoxSourceType getSourceType() { return sourceType; } /** * The imports for this runnable */ public List<ImportDefinition> getImports() { return imports; } }
Activity
Show:
Brad WoodAugust 7, 2024 at 4:43 PM
This is in theory sorted on the snapshot builds of BL core. I’m still working through what else I may have broken in the web runtimes and modules I’ll update the ticket above with the changes, but it was a huge refactor of the core changing how we parse, store, and cast numbers.
Brad WoodAugust 6, 2024 at 7:17 PM
Jira issue linking is being stupid right now. This ticket will be resolved by
John WhishAugust 4, 2024 at 2:16 PM
Yeah, figured that was what it was but provided a full stack to be complete.
I think java.math.BigDecimal makes sense. I discovered this issue in Boxlang when testing the following code (using Twitter style Snowflake IDs) which only works in Lucee 6.
Brad WoodAugust 2, 2024 at 7:59 PM
Edited
The part of that error that matters is this
which is the actual Java code we compile to create the bytecode. You can see integer literals in BL are just translated directly to integer literals in Java which works well with little overhead for small ints. I have a feeling CF and Lucee force every int literal into a Double, or perform a length check and force the big ones into doubles.
One thing we’ve been discussing is copying Lucee and moving to use BigDecimals everywhere, but I haven’t researched the impact of that though. I would prefer to keep numbers which are small enough in the primitive form, though a primitive int will be immediately boxed as soon as you store it, so it really boils down to the storage size of a Double vs the storage size of a BigDecimal in terms of heap usage.
Fixed
Pinned fields
Click on the next to a field label to start pinning.
Example:
Error message: