Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

11
LINES

< > BotCompany Repo | #1019933 // classFileVersionToJavaVersion

JavaX fragment (include)

1  
static int classFileVersionToJavaVersion(S version) {
2  
  ret classFileVersionToJavaVersion(parseFirstInt(version));
3  
}
4  
5  
static int classFileVersionToJavaVersion(int majorVersion) {
6  
  if (majorVersion < 45) ret -1; // bad input
7  
  // Java 2 through 11, probably for newer versions this works too
8  
  int j = majorVersion-44;
9  
  if (j > 11) print("Warning: Please upgrade function classFileVersionToJavaVersion for JDK 12+");
10  
  ret j;
11  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019933
Snippet name: classFileVersionToJavaVersion
Eternal ID of this version: #1019933/2
Text MD5: 4335798e58363cbaed43237760fe7414
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-01 15:50:16
Source code size: 438 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 245 / 276
Version history: 1 change(s)
Referenced in: [show references]