equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
59 |
59 |
60 /** JDK 8. */ |
60 /** JDK 8. */ |
61 JDK1_8("1.8", 52, 0), |
61 JDK1_8("1.8", 52, 0), |
62 |
62 |
63 /** JDK 9. */ |
63 /** JDK 9. */ |
64 JDK1_9("1.9", 53, 0); |
64 JDK1_9("1.9", 53, 0), |
|
65 |
|
66 /** JDK 10, initially an alias for 9 */ |
|
67 JDK1_10("1.10", 53, 0); |
65 |
68 |
66 private static final Context.Key<Target> targetKey = new Context.Key<>(); |
69 private static final Context.Key<Target> targetKey = new Context.Key<>(); |
67 |
70 |
68 public static Target instance(Context context) { |
71 public static Target instance(Context context) { |
69 Target instance = context.get(targetKey); |
72 Target instance = context.get(targetKey); |
89 tab.put("5", JDK1_5); |
92 tab.put("5", JDK1_5); |
90 tab.put("6", JDK1_6); |
93 tab.put("6", JDK1_6); |
91 tab.put("7", JDK1_7); |
94 tab.put("7", JDK1_7); |
92 tab.put("8", JDK1_8); |
95 tab.put("8", JDK1_8); |
93 tab.put("9", JDK1_9); |
96 tab.put("9", JDK1_9); |
|
97 tab.put("10", JDK1_10); |
94 } |
98 } |
95 |
99 |
96 public final String name; |
100 public final String name; |
97 public final int majorVersion; |
101 public final int majorVersion; |
98 public final int minorVersion; |
102 public final int minorVersion; |
100 this.name = name; |
104 this.name = name; |
101 this.majorVersion = majorVersion; |
105 this.majorVersion = majorVersion; |
102 this.minorVersion = minorVersion; |
106 this.minorVersion = minorVersion; |
103 } |
107 } |
104 |
108 |
105 public static final Target DEFAULT = JDK1_9; |
109 public static final Target DEFAULT = values()[values().length - 1]; |
106 |
110 |
107 public static Target lookup(String name) { |
111 public static Target lookup(String name) { |
108 return tab.get(name); |
112 return tab.get(name); |
109 } |
113 } |
110 |
114 |
144 /** Value of platform release used to access multi-release jar files |
148 /** Value of platform release used to access multi-release jar files |
145 */ |
149 */ |
146 public String multiReleaseValue() { |
150 public String multiReleaseValue() { |
147 return Integer.toString(this.ordinal() - Target.JDK1_1.ordinal() + 1); |
151 return Integer.toString(this.ordinal() - Target.JDK1_1.ordinal() + 1); |
148 } |
152 } |
149 |
|
150 } |
153 } |