FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

more consistency to Java version numbering · dhootha/processing@64026cb · GitHub

Repository navigation

Commit 64026cb

Browse files
committed
more consistency to Java version numbering
1 parent b6347e4 commit 64026cb

4 files changed

Lines changed: 31 additions & 13 deletions

File tree

‎app/src/processing/app/contrib/ContributionManager.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public void run() {
187187
msg = "This item is not compatible with this version of Processing";
188188
} else if (cause instanceof UnsupportedClassVersionError) {
189189
msg = "This item needs to be recompiled for Java " +
190-
PApplet.javaVersionShort;
190+
PApplet.javaPlatform;
191191
}
192192
}
193193

‎core/src/processing/core/PApplet.java‎

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@
4444

4545

4646

47+
4748
// used by loadImage() functions
4849
import javax.imageio.ImageIO;
4950
import javax.swing.ImageIcon;
5051
import javax.swing.JFileChooser;
51-
5252
import javax.swing.JOptionPane;
5353
// used by desktopFile() method
5454
import javax.swing.filechooser.FileSystemView;
@@ -109,12 +109,22 @@ public class PApplet implements PConstants {
109109
static public final String javaVersionName =
110110
System.getProperty("java.version");
111111

112-
/** Short name of Java version, i.e. 1.8. */
113-
static public final String javaVersionShort =
114-
//javaVersionName.substring(0, 3);
115-
javaVersionName.substring(0, javaVersionName.indexOf(".", 2));
116-
// can't use this one, it's 1.8.0 and breaks things
117-
//javaVersionName.substring(0, javaVersionName.indexOf("_"));
112+
// /** Short name of Java version, i.e. 1.8. */
113+
// static public final String javaVersionShort =
114+
// //javaVersionName.substring(0, 3);
115+
// javaVersionName.substring(0, javaVersionName.indexOf(".", 2));
116+
// // can't use this one, it's 1.8.0 and breaks things
117+
// //javaVersionName.substring(0, javaVersionName.indexOf("_"));
118+
119+
static public final int javaPlatform =
120+
PApplet.parseInt(PApplet.split(javaVersionName, '.')[1]);
121+
// static {
122+
// try {
123+
// javaPlatform = PApplet.split(javaVersionName, '.')[1];
124+
// } catch (Exception e) {
125+
// javaPlatform = "8"; // set a default in case
126+
// }
127+
// }
118128

119129
/**
120130
* Version of Java that's in use, whether 1.1 or 1.3 or whatever,
@@ -127,9 +137,17 @@ public class PApplet implements PConstants {
127137
* (i.e. 1.40000001). This could just be a double, but since Processing
128138
* only uses floats, it's safer as a float because specifying a double
129139
* (with this narrow case especially) with the preprocessor is awkward.
140+
* <p>
141+
* @deprecated Java 10 is around the corner. Use javaPlatform when you need
142+
* a number for comparisons, i.e. "if (javaPlatform >= 7)".
130143
*/
144+
@Deprecated
131145
public static final float javaVersion =
132-
new Float(javaVersionShort).floatValue();
146+
new Float(javaVersionName.substring(0, 3));
147+
// public static final float javaVersion =
148+
// new Float(javaVersionName.substring(0, javaVersionName.indexOf(".", 2))).floatValue();
149+
// // Making this a String in 3.0, in anticipation of Java 10
150+
// public static final String javaVersion = "1." + javaPlatform;
133151

134152
/**
135153
* Current platform in use, one of the

‎core/todo.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ X https://github.com/processing/processing/issues/3347
55
X show warning when display spanning is turned off with fullScreen(SPAN)
66
X defaults read com.apple.spaces spans-displays
77
X https://github.com/processing/processing/issues/3381
8+
_ note that full screen and present are now different
9+
_ on Export to Application, this has an impact
810

911
cleaning
1012
o possible addition for 'implementation' variable

‎java/src/processing/mode/java/JavaEditor.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -825,21 +825,19 @@ public void paintComponent(Graphics g) {
825825
platformName = "Linux (" + Base.getNativeBits() + "-bit)";
826826
}
827827

828-
final String javaPlatform =
829-
PApplet.split(System.getProperty("java.version"), '.')[1];
830828
boolean embed = Preferences.getBoolean("export.application.embed_java");
831829
final String embedWarning =
832830
"<html><div width=\"" + divWidth + "\"><font size=\"2\">" +
833831
// "<html><body><font size=2>" +
834832
"Embedding Java will make the " + platformName + " application " +
835833
"larger, but it will be far more likely to work. " +
836834
"Users on other platforms will need to " +
837-
"<a href=\"\">install Java " + PApplet.javaVersionShort + "</a>.";
835+
"<a href=\"\">install Java " + PApplet.javaPlatform + "</a>.";
838836
final String nopeWarning =
839837
"<html><div width=\"" + divWidth + "\"><font size=\"2\">" +
840838
// "<html><body><font size=2>" +
841839
"Users on all platforms will have to install the latest " +
842-
"version of Java " + javaPlatform +
840+
"version of Java " + PApplet.javaPlatform +
843841
" from <a href=\"\">http://java.com/download</a>. " +
844842
"<br/>&nbsp;";
845843
//"from <a href=\"http://java.com/download\">java.com/download</a>.";

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL