Permalink
Browse files

Prompt the user to give the L suffix on numbers

Fixes #4878
  • Loading branch information...
GKFX committed May 20, 2017
1 parent b3fbe0c commit 66f94265a20a66998454fb05185d122b7e987c76
Showing with 13 additions and 2 deletions.
  1. +13 −2 java/src/processing/mode/java/Compiler.java
@@ -166,6 +166,8 @@ public void close() { }
exception = new SketchException(errorMessage);
}
String[] parts = null;
if (errorMessage.startsWith("The import ") &&
errorMessage.endsWith("cannot be resolved")) {
// The import poo cannot be resolved
@@ -253,9 +255,18 @@ public void close() { }
// "Duplicate nested type xxx"
// "Duplicate local variable xxx"
} else if (null != (parts = PApplet.match(errorMessage,
"literal (\\S*) of type (\\S*) is out of range"))) {
if ("int".equals(parts[2])) {
exception.setMessage("The type int can't handle numbers that big. Try "
+ parts[1] + "L to upgrade to long.");
} else {
// I'd like to give an essay on BigInteger and BigDecimal, but
// this margin is too narrow to contain it.
exception.setMessage("Even the type " + parts[2] + " can't handle "
+ parts[1] + ". Research big numbers in Java.");
}
} else {
String[] parts = null;
// The method xxx(String) is undefined for the type Temporary_XXXX_XXXX
//xxx("blah");
// The method xxx(String, int) is undefined for the type Temporary_XXXX_XXXX

0 comments on commit 66f9426

Please sign in to comment.