diff --git a/app/src/processing/app/contrib/ContributionManager.java b/app/src/processing/app/contrib/ContributionManager.java index 6874d5908..0f9125e4e 100644 --- a/app/src/processing/app/contrib/ContributionManager.java +++ b/app/src/processing/app/contrib/ContributionManager.java @@ -187,7 +187,7 @@ public class ContributionManager { msg = "This item is not compatible with this version of Processing"; } else if (cause instanceof UnsupportedClassVersionError) { msg = "This item needs to be recompiled for Java " + - PApplet.javaVersionShort; + PApplet.javaPlatform; } } diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index cdfee726d..02bb15d30 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -44,11 +44,11 @@ import java.awt.image.BufferedImage; + // used by loadImage() functions import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFileChooser; - import javax.swing.JOptionPane; // used by desktopFile() method import javax.swing.filechooser.FileSystemView; @@ -109,12 +109,22 @@ public class PApplet implements PConstants { static public final String javaVersionName = System.getProperty("java.version"); - /** Short name of Java version, i.e. 1.8. */ - static public final String javaVersionShort = - //javaVersionName.substring(0, 3); - javaVersionName.substring(0, javaVersionName.indexOf(".", 2)); - // can't use this one, it's 1.8.0 and breaks things - //javaVersionName.substring(0, javaVersionName.indexOf("_")); +// /** Short name of Java version, i.e. 1.8. */ +// static public final String javaVersionShort = +// //javaVersionName.substring(0, 3); +// javaVersionName.substring(0, javaVersionName.indexOf(".", 2)); +// // can't use this one, it's 1.8.0 and breaks things +// //javaVersionName.substring(0, javaVersionName.indexOf("_")); + + static public final int javaPlatform = + PApplet.parseInt(PApplet.split(javaVersionName, '.')[1]); +// static { +// try { +// javaPlatform = PApplet.split(javaVersionName, '.')[1]; +// } catch (Exception e) { +// javaPlatform = "8"; // set a default in case +// } +// } /** * Version of Java that's in use, whether 1.1 or 1.3 or whatever, @@ -127,9 +137,17 @@ public class PApplet implements PConstants { * (i.e. 1.40000001). This could just be a double, but since Processing * only uses floats, it's safer as a float because specifying a double * (with this narrow case especially) with the preprocessor is awkward. + *
+ * @deprecated Java 10 is around the corner. Use javaPlatform when you need + * a number for comparisons, i.e. "if (javaPlatform >= 7)". */ + @Deprecated public static final float javaVersion = - new Float(javaVersionShort).floatValue(); + new Float(javaVersionName.substring(0, 3)); +// public static final float javaVersion = +// new Float(javaVersionName.substring(0, javaVersionName.indexOf(".", 2))).floatValue(); +// // Making this a String in 3.0, in anticipation of Java 10 +// public static final String javaVersion = "1." + javaPlatform; /** * Current platform in use, one of the diff --git a/core/todo.txt b/core/todo.txt index a185047d9..6afc9cd57 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -5,6 +5,8 @@ X https://github.com/processing/processing/issues/3347 X show warning when display spanning is turned off with fullScreen(SPAN) X defaults read com.apple.spaces spans-displays X https://github.com/processing/processing/issues/3381 +_ note that full screen and present are now different +_ on Export to Application, this has an impact cleaning o possible addition for 'implementation' variable diff --git a/java/src/processing/mode/java/JavaEditor.java b/java/src/processing/mode/java/JavaEditor.java index cec82432c..9ed4a30c1 100644 --- a/java/src/processing/mode/java/JavaEditor.java +++ b/java/src/processing/mode/java/JavaEditor.java @@ -825,8 +825,6 @@ public class JavaEditor extends Editor { platformName = "Linux (" + Base.getNativeBits() + "-bit)"; } - final String javaPlatform = - PApplet.split(System.getProperty("java.version"), '.')[1]; boolean embed = Preferences.getBoolean("export.application.embed_java"); final String embedWarning = "